]> git.lyx.org Git - features.git/commitdiff
add color mathcorners and implement mathbg (partially)
authorBo Peng <bpeng@lyx.org>
Sat, 12 May 2007 06:24:46 +0000 (06:24 +0000)
committerBo Peng <bpeng@lyx.org>
Sat, 12 May 2007 06:24:46 +0000 (06:24 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18277 a592a061-630c-0410-9148-cb99ea01b6c8

src/Color.cpp
src/Color.h
src/insets/Inset.cpp
src/mathed/InsetMathHull.cpp

index 3474850fbcac8772a6861fa8d842ea4cae57c1ef..908090755017464533fe0c832fe97f872bf3a810 100644 (file)
@@ -298,6 +298,7 @@ Color::Color()
        { 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" },
index b2a43b7784f7f34e7f42261625d1dcde1d0e22f6..372c1a50253d4273467e80f9b0e2628397926380 100644 (file)
@@ -123,8 +123,10 @@ public:
                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 93b749e5d8a14e24e4414af28bb686ae5e59eb07..9b79ddf362bcbcf7035174806a432370d7153182 100644 (file)
@@ -288,7 +288,7 @@ void Inset::metricsMarkers2(Dimension & dim, int framesize) const
 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::drawMarkers(PainterInfo & pi, int x, int y) const
 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 6b9d8d3cce01e5e8a1c9b0ff52208e315307cbb8..ba381f4d727d9694765862aaa76562204369cef1 100644 (file)
@@ -52,6 +52,8 @@
 #include "graphics/PreviewImage.h"
 #include "graphics/PreviewLoader.h"
 
+#include "frontends/Painter.h"
+
 #include "support/lyxlib.h"
 #include "support/lstrings.h"
 
@@ -335,6 +337,13 @@ void InsetMathHull::draw(PainterInfo & pi, int x, int y) const
 {
        use_preview_ = previewState(pi.base.bv);
 
+       Cursor & cur = pi.base.bv->cursor();
+       // background of mathed under focus is not painted because
+       // selection at the top level of nested inset is difficult to handle.
+       if (!editing(pi.base.bv))
+               pi.pain.fillRectangle(x + 1, y - ascent() + 1, width() - 2, 
+                               ascent() + descent() - 1, Color::mathbg);
+
        if (use_preview_) {
                // one pixel gap in front
                preview_->draw(pi, x + 1, y);