#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)
{}
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);
}
+/// 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);
// 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) << '}';
}
}
-void InsetMathColor::infoize(std::ostream & os) const
+void InsetMathColor::infoize(odocstream & os) const
{
os << "Color: " << color_;
}
+
+
+} // namespace lyx