fix color handling

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7989 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2003-10-27 17:22:27 +00:00
parent 50072b9431
commit 19198334bc
3 changed files with 16 additions and 3 deletions

View File

@ -16,6 +16,7 @@
#include "math_support.h"
#include "LaTeXFeatures.h"
#include "LColor.h"
#include "support/std_ostream.h"
@ -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,7 @@ void MathColorInset::validate(LaTeXFeatures & features) const
void MathColorInset::write(WriteStream & os) const
{
os << "\\color" << '{' << cell(0) << '}' << '{' << cell(1) << '}';
os << "{\\color" << '{' << cell(0) << '}' << cell(1) << '}';
}

View File

@ -21,9 +21,11 @@ public:
///
MathColorInset();
///
virtual std::auto_ptr<InsetBase> clone() const;
std::auto_ptr<InsetBase> clone() const;
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
/// we write extra braces in any case...
bool extraBraces() const { return true; }
///
void draw(PainterInfo & pi, int x, int y) const;
/// we need package color

View File

@ -1135,6 +1135,14 @@ void Parser::parse1(MathGridInset & grid, unsigned flags,
return;
}
else if (t.cs() == "color") {
MathAtom at = createMathInset(t.cs());
parse(at.nucleus()->cell(0), FLAG_ITEM, MathInset::TEXT_MODE);
parse(at.nucleus()->cell(1), flags, mode);
cell->push_back(at);
return;
}
else if (t.cs() == "substack") {
cell->push_back(createMathInset(t.cs()));
parse2(cell->back(), FLAG_ITEM, mode, false);