Georg Baum wrote:
> > This patch does not feel correct...
>
> Indeed.

The attached will not satisfy you probably, but maybe it illustrates better 
what's going on.

Jürgen
Index: math_colorinset.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_colorinset.C,v
retrieving revision 1.12
diff -u -r1.12 math_colorinset.C
--- math_colorinset.C	9 Apr 2005 11:13:21 -0000	1.12
+++ math_colorinset.C	13 Jun 2005 08:03:06 -0000
@@ -18,6 +18,8 @@
 #include "LaTeXFeatures.h"
 #include "LColor.h"
 
+#include "gettext.h"
+
 #include "support/std_ostream.h"
 
 using std::auto_ptr;
@@ -25,10 +27,18 @@
 
 namespace {
 
+LColor::color getColor(MathArray const & ar)
+{
+	return lcolor.getFromGUIName(asString(ar));
+}
+
+
 // color "none" (reset to default) needs special treatment
 bool normalcolor(MathArray const & ar)
 {
-	return (asString(ar) == "none");
+	// we need the LaTeX name for comparision, because
+	// the gui name is a translatable string
+	return (lcolor.getLaTeXName(getColor(ar)) == "none");
 }
 
 } // namespace anon
@@ -77,7 +87,7 @@
 	}
 
 	LColor_color origcol = pi.base.font.color();
-	pi.base.font.setColor(lcolor.getFromGUIName(asString(cell(0))));
+	pi.base.font.setColor(getColor(cell(0)));
 	cell(1).draw(pi, x, y);
 	pi.base.font.setColor(origcol);
 	if (editing(pi.base.bv))
@@ -95,12 +105,13 @@
 
 void MathColorInset::write(WriteStream & os) const
 {
+	std::string const color = lcolor.getLaTeXName(getColor(cell(0)));
 	if (normalcolor(cell(0)))
 		os << "{\\normalcolor " << cell(1) << '}';
 	else if (oldstyle_)
-		os << "{\\color" << '{' << cell(0) << '}' << cell(1) << '}';
+		os << "{\\color" << '{' << color.c_str() << '}' << cell(1) << '}';
 	else
-		os << "\\textcolor" << '{' << cell(0) << "}{" << cell(1) << '}';
+		os << "\\textcolor" << '{' << color.c_str() << "}{" << cell(1) << '}';
 }
 
 
@@ -112,5 +123,5 @@
 
 void MathColorInset::infoize(std::ostream & os) const
 {
-	os << "Color: " << cell(0);
+	os << _("Color") << ": " << asString(cell(0));
 }

Reply via email to