mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-11 11:08:41 +00:00
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:
parent
50072b9431
commit
19198334bc
@ -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) << '}';
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user