support for \textcolor

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7993 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2003-10-28 08:51:33 +00:00
parent 12a2f2705f
commit 09548338ce
3 changed files with 12 additions and 5 deletions

View File

@ -23,8 +23,8 @@
using std::auto_ptr;
MathColorInset::MathColorInset()
: MathNestInset(2)
MathColorInset::MathColorInset(bool oldstyle)
: MathNestInset(2), oldstyle_(oldstyle)
{}
@ -80,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) << '}';
}

View File

@ -19,7 +19,7 @@
class MathColorInset : public MathNestInset {
public:
///
MathColorInset();
explicit MathColorInset(bool oldstyle);
///
std::auto_ptr<InsetBase> clone() const;
///
@ -39,6 +39,8 @@ public:
private:
/// width of '[' in current font
mutable int w_;
///
bool oldstyle_;
};
#endif

View File

@ -311,7 +311,9 @@ MathAtom createMathInset(string const & s)
if (s == "boldsymbol")
return MathAtom(new MathBoldsymbolInset);
if (s == "color")
return MathAtom(new MathColorInset);
return MathAtom(new MathColorInset(true));
if (s == "textcolor")
return MathAtom(new MathColorInset(false));
if (s == "dfrac")
return MathAtom(new MathDfracInset);