From 6d4709d46c750eaa31e06d0da18a98a1e71bdea2 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Thu, 9 Sep 2010 13:02:20 +0000 Subject: [PATCH] Sanitize ColorChanger git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35331 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/MetricsInfo.cpp | 4 ++-- src/MetricsInfo.h | 6 +++--- src/mathed/InsetMathHull.cpp | 10 ++++------ src/mathed/InsetMathHull.h | 3 ++- src/mathed/MathMacroTemplate.cpp | 2 +- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/MetricsInfo.cpp b/src/MetricsInfo.cpp index a3c2705ec9..e68c18d79d 100644 --- a/src/MetricsInfo.cpp +++ b/src/MetricsInfo.cpp @@ -312,13 +312,13 @@ WidthChanger::~WidthChanger() // ///////////////////////////////////////////////////////////////////////// -ColorChanger::ColorChanger(FontInfo & font, docstring const & color, +ColorChanger::ColorChanger(FontInfo & font, ColorCode color, bool really_change_color) : Changer(font), change_(really_change_color) { if (change_) { save_ = font.color(); - font.setColor(lcolor.getFromLyXName(to_utf8(color))); + font.setColor(color); } } diff --git a/src/MetricsInfo.h b/src/MetricsInfo.h index d717a54282..020b25f874 100644 --- a/src/MetricsInfo.h +++ b/src/MetricsInfo.h @@ -14,7 +14,7 @@ #define METRICSINFO_H #include "Changes.h" -#include "Color.h" +#include "ColorCode.h" #include "FontInfo.h" #include "support/strfwd.h" @@ -104,7 +104,7 @@ public: ColorCode backgroundColor(Inset const * inset, bool sel = true) const; /// Determines the text color based on the intended color, the - /// change tracking state and the selectio state. + /// change tracking state and the selection state. /// \param color what the color should be by default Color textColor(Color const & color) const; @@ -230,7 +230,7 @@ public: class ColorChanger : public Changer { public: /// - ColorChanger(FontInfo & font, docstring const & color, + ColorChanger(FontInfo & font, ColorCode color, bool really_change_color = true); /// ~ColorChanger(); diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index bf3d0f9789..1c3eb53370 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -329,18 +329,16 @@ docstring InsetMathHull::standardFont() const } -docstring InsetMathHull::standardColor() const +ColorCode InsetMathHull::standardColor() const { - docstring color; + ColorCode color; switch (type_) { case hullRegexp: - color = from_ascii("foreground"); - break; case hullNone: - color = from_ascii("foreground"); + color = Color_foreground; break; default: - color = from_ascii("math"); + color = Color_math; } return color; } diff --git a/src/mathed/InsetMathHull.h b/src/mathed/InsetMathHull.h index 8305c72a7d..9f325feb26 100644 --- a/src/mathed/InsetMathHull.h +++ b/src/mathed/InsetMathHull.h @@ -14,6 +14,7 @@ #include "InsetMathGrid.h" +#include "Color.h" #include "DocIterator.h" #include "OutputEnums.h" @@ -207,7 +208,7 @@ private: /// docstring standardFont() const; /// - docstring standardColor() const; + ColorCode standardColor() const; /// consistency check void check() const; /// can this change its number of rows? diff --git a/src/mathed/MathMacroTemplate.cpp b/src/mathed/MathMacroTemplate.cpp index 053b9f1eb3..3eadf6d2ef 100644 --- a/src/mathed/MathMacroTemplate.cpp +++ b/src/mathed/MathMacroTemplate.cpp @@ -591,7 +591,7 @@ void MathMacroTemplate::metrics(MetricsInfo & mi, Dimension & dim) const void MathMacroTemplate::draw(PainterInfo & pi, int x, int y) const { - ColorChanger dummy0(pi.base.font, from_ascii("math")); + ColorChanger dummy0(pi.base.font, Color_math); FontSetChanger dummy1(pi.base, from_ascii("mathnormal")); StyleChanger dummy2(pi.base, LM_ST_TEXT); -- 2.39.5