]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathColor.C
Fix comment according to Enricos explanation
[lyx.git] / src / mathed / InsetMathColor.C
index 6740ff5612ca54cc3d9dae811a163fb60963a1f0..55d9c656cbadd3a4f962788bfc17ddd834326e1a 100644 (file)
 
 #include "InsetMathColor.h"
 #include "MathData.h"
-#include "MathMLStream.h"
 #include "MathStream.h"
 #include "MathSupport.h"
-
 #include "LaTeXFeatures.h"
 
 #include "support/std_ostream.h"
 
-using std::auto_ptr;
-using std::string;
-
-
-namespace {
-
-/// color "none" (reset to default) needs special treatment
-bool normalcolor(string const & color)
-{
-       return color == "none";
-}
 
-} // namespace anon
+namespace lyx {
 
+using std::auto_ptr;
+using std::string;
 
 InsetMathColor::InsetMathColor(bool oldstyle, LColor_color const & color)
        : InsetMathNest(1), oldstyle_(oldstyle),
-         color_(lcolor.getLaTeXName(color))
+         color_(from_utf8(lcolor.getLaTeXName(color)))
 {}
 
 
-InsetMathColor::InsetMathColor(bool oldstyle, string const & color)
+InsetMathColor::InsetMathColor(bool oldstyle, docstring const & color)
        : InsetMathNest(1), oldstyle_(oldstyle), color_(color)
 {}
 
@@ -63,7 +52,7 @@ void InsetMathColor::metrics(MetricsInfo & mi, Dimension & dim) const
 void InsetMathColor::draw(PainterInfo & pi, int x, int y) const
 {
        LColor_color origcol = pi.base.font.color();
-       pi.base.font.setColor(lcolor.getFromLaTeXName(color_));
+       pi.base.font.setColor(lcolor.getFromLaTeXName(to_utf8(color_)));
        cell(0).draw(pi, x + 1, y);
        pi.base.font.setColor(origcol);
        drawMarkers(pi, x, y);
@@ -71,6 +60,13 @@ void InsetMathColor::draw(PainterInfo & pi, int x, int y) const
 }
 
 
+/// color "none" (reset to default) needs special treatment
+static bool normalcolor(docstring const & color)
+{
+       return color == "none";
+}
+
+
 void InsetMathColor::validate(LaTeXFeatures & features) const
 {
        InsetMathNest::validate(features);
@@ -85,9 +81,9 @@ void InsetMathColor::write(WriteStream & os) const
                // reset to default color inside another color inset
                os << "{\\normalcolor " << cell(0) << '}';
        else if (oldstyle_)
-               os << "{\\color" << '{' << color_ << '}' << cell(0) << '}';
+               os << "{\\color{" << color_ << '}' << cell(0) << '}';
        else
-               os << "\\textcolor" << '{' << color_ << "}{" << cell(0) << '}';
+               os << "\\textcolor{" << color_ << "}{" << cell(0) << '}';
 }
 
 
@@ -97,7 +93,10 @@ void InsetMathColor::normalize(NormalStream & os) const
 }
 
 
-void InsetMathColor::infoize(std::ostream & os) const
+void InsetMathColor::infoize(odocstream & os) const
 {
        os << "Color: " << color_;
 }
+
+
+} // namespace lyx