]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_colorinset.C
mathed uglyfication
[lyx.git] / src / mathed / math_colorinset.C
index ec3edee0da6265026a01673a36d6e20f7773bfa7..3d5a68b398fbe52372e583055c46e59ca2dfe26e 100644 (file)
 #include "math_support.h"
 
 #include "LaTeXFeatures.h"
+#include "LColor.h"
 
 #include "support/std_ostream.h"
 
 using std::auto_ptr;
 
 
-MathColorInset::MathColorInset()
-       : MathNestInset(2)
+MathColorInset::MathColorInset(bool oldstyle)
+       : MathNestInset(2), oldstyle_(oldstyle)
 {}
 
 
@@ -63,8 +64,10 @@ void MathColorInset::draw(PainterInfo & pi, int x, int y) const
                x += w_ + 2;
        }
 
-       ColorChanger dummy1(pi.base.font, asString(cell(0)));
+       LColor_color origcol = pi.base.font.color();
+       pi.base.font.setColor(lcolor.getFromGUIName(asString(cell(0))));
        cell(1).draw(pi, x, y);
+       pi.base.font.setColor(origcol);
 }
 
 
@@ -77,7 +80,10 @@ void MathColorInset::validate(LaTeXFeatures & features) const
 
 void MathColorInset::write(WriteStream & os) const
 {
-       os << "\\color" << '{' << cell(0) << '}' << '{' << cell(1) << '}';
+       if (oldstyle_)
+               os << "{\\color" << '{' << cell(0) << '}' << cell(1) << '}';
+       else 
+               os << "\\textcolor" << '{' << cell(0) << "}{" << cell(1) << '}';
 }