On 5/10/07, Stefan Schimanski <[EMAIL PROTECTED]> wrote:
Does the patch work fine with selections? I.e. is the blue of the selection visible or overdrawn by the mathbg?
Not really, because InsetGrid is redrawn after selection is drawn. :-( Because of line 333 of MathData.cpp, at->drawSelection(pi, x, y); at->draw(pi, x, y); an inset is redrawn after selection box is drawn. Any background will cover selection. The only solution is to define draw(pi, x, y, background=true) and call at->draw(pi, x, y, false) in MathData.cpp. However, this is sort of intrusive and we actually only need this information in MathHull... Anyway, attached is another version of the patch. The only drawback is that toplevel selection (when cur.inset() == this) makes background disappear. Bo
Index: src/Color.h =================================================================== --- src/Color.h (revision 18258) +++ src/Color.h (working copy) @@ -123,8 +123,10 @@ mathbg, /// Macro math inset background color mathmacrobg, - /// Math inset frame color + /// Math inset frame color under focus mathframe, + /// Math inset frame color not under focus + mathcorners, /// Math line color mathline, Index: src/insets/Inset.cpp =================================================================== --- src/insets/Inset.cpp (revision 18258) +++ src/insets/Inset.cpp (working copy) @@ -288,7 +288,7 @@ void Inset::drawMarkers(PainterInfo & pi, int x, int y) const { Color::color pen_color = editing(pi.base.bv)? - Color::mathframe : Color::background; + Color::mathframe : Color::mathcorners; int const t = x + width() - 1; int const d = y + descent(); @@ -303,7 +303,7 @@ void Inset::drawMarkers2(PainterInfo & pi, int x, int y) const { Color::color pen_color = editing(pi.base.bv)? - Color::mathframe : Color::background; + Color::mathframe : Color::mathcorners; drawMarkers(pi, x, y); int const t = x + width() - 1; Index: src/mathed/InsetMathHull.cpp =================================================================== --- src/mathed/InsetMathHull.cpp (revision 18258) +++ src/mathed/InsetMathHull.cpp (working copy) @@ -48,6 +48,7 @@ #include "insets/RenderPreview.h" #include "insets/InsetLabel.h" +#include "frontends/Painter.h" #include "graphics/PreviewImage.h" #include "graphics/PreviewLoader.h" @@ -334,6 +335,10 @@ void InsetMathHull::draw(PainterInfo & pi, int x, int y) const { use_preview_ = previewState(pi.base.bv); + Cursor & cur = pi.base.bv->cursor(); + if (!editing(pi.base.bv) || !cur.selection() || &cur.inset() != this) + pi.pain.fillRectangle(x + 1, y - ascent() + 1, width() - 2, + ascent() + descent() - 1, Color::mathbg); if (use_preview_) { // one pixel gap in front Index: src/Color.cpp =================================================================== --- src/Color.cpp (revision 18258) +++ src/Color.cpp (working copy) @@ -298,6 +298,7 @@ { graphicsbg, N_("graphics background"), "graphicsbg", "linen", "graphicsbg" }, { mathmacrobg, N_("Math macro background"), "mathmacrobg", "linen", "mathmacrobg" }, { mathframe, N_("math frame"), "mathframe", "Magenta", "mathframe" }, + { mathcorners, N_("math corners"), "mathcorners", "linen", "mathcorners" }, { mathline, N_("math line"), "mathline", "Blue", "mathline" }, { captionframe, N_("caption frame"), "captionframe", "DarkRed", "captionframe" }, { collapsable, N_("collapsable inset text"), "collapsable", "DarkRed", "collapsable" },