From 4d0552dd807b5f185c6e2e7a1116f0c7806bfa34 Mon Sep 17 00:00:00 2001 From: Bo Peng Date: Sat, 12 May 2007 06:24:46 +0000 Subject: [PATCH] add color mathcorners and implement mathbg (partially) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18277 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Color.cpp | 1 + src/Color.h | 4 +++- src/insets/Inset.cpp | 4 ++-- src/mathed/InsetMathHull.cpp | 9 +++++++++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Color.cpp b/src/Color.cpp index 3474850fbc..9080907550 100644 --- a/src/Color.cpp +++ b/src/Color.cpp @@ -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" }, diff --git a/src/Color.h b/src/Color.h index b2a43b7784..372c1a5025 100644 --- a/src/Color.h +++ b/src/Color.h @@ -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, diff --git a/src/insets/Inset.cpp b/src/insets/Inset.cpp index 93b749e5d8..9b79ddf362 100644 --- a/src/insets/Inset.cpp +++ b/src/insets/Inset.cpp @@ -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; diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index 6b9d8d3cce..ba381f4d72 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -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); -- 2.39.5