mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 19:07:45 +00:00
support for AMS's \boxed{} command
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4807 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
a794a45949
commit
6c57f7353f
@ -69,7 +69,8 @@ bool math_font_available(string & name)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
lyxerr[Debug::MATHED] << "font " << name << " not available and I can't fake it\n";
|
lyxerr[Debug::MATHED]
|
||||||
|
<< "font " << name << " not available and I can't fake it\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,7 +234,7 @@ MathAtom createMathInset(string const & s)
|
|||||||
if (inset == "parbox")
|
if (inset == "parbox")
|
||||||
return MathAtom(new MathParboxInset);
|
return MathAtom(new MathParboxInset);
|
||||||
if (inset == "fbox")
|
if (inset == "fbox")
|
||||||
return MathAtom(new MathFboxInset);
|
return MathAtom(new MathFboxInset(l));
|
||||||
if (inset == "style")
|
if (inset == "style")
|
||||||
return MathAtom(new MathSizeInset(l));
|
return MathAtom(new MathSizeInset(l));
|
||||||
if (inset == "font")
|
if (inset == "font")
|
||||||
|
@ -7,12 +7,14 @@
|
|||||||
#include "math_fboxinset.h"
|
#include "math_fboxinset.h"
|
||||||
#include "math_support.h"
|
#include "math_support.h"
|
||||||
#include "math_mathmlstream.h"
|
#include "math_mathmlstream.h"
|
||||||
|
#include "math_streamstr.h"
|
||||||
|
#include "math_parser.h"
|
||||||
#include "frontends/Painter.h"
|
#include "frontends/Painter.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MathFboxInset::MathFboxInset()
|
MathFboxInset::MathFboxInset(latexkeys const * key)
|
||||||
: MathNestInset(1)
|
: MathNestInset(1), key_(key)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -22,30 +24,47 @@ MathInset * MathFboxInset::clone() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
MathInset::mode_type MathFboxInset::currentMode() const
|
||||||
|
{
|
||||||
|
if (key_->name == "fbox")
|
||||||
|
return TEXT_MODE;
|
||||||
|
return MATH_MODE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MathFboxInset::metrics(MathMetricsInfo & mi) const
|
void MathFboxInset::metrics(MathMetricsInfo & mi) const
|
||||||
{
|
{
|
||||||
MathFontSetChanger dummy(mi.base, "textnormal");
|
if (key_->name == "fbox") {
|
||||||
dim_ = xcell(0).metrics(mi);
|
MathFontSetChanger dummy(mi.base, "textnormal");
|
||||||
metricsMarkers2(5); // 5 pixels margin
|
dim_ = xcell(0).metrics(mi);
|
||||||
|
metricsMarkers2(5); // 5 pixels margin
|
||||||
|
} else {
|
||||||
|
dim_ = xcell(0).metrics(mi);
|
||||||
|
metricsMarkers2(5); // 5 pixels margin
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MathFboxInset::draw(MathPainterInfo & pi, int x, int y) const
|
void MathFboxInset::draw(MathPainterInfo & pi, int x, int y) const
|
||||||
{
|
{
|
||||||
MathFontSetChanger dummy(pi.base, "textnormal");
|
|
||||||
pi.pain.rectangle(x + 1, y - ascent() + 1, width() - 2, height() - 2,
|
pi.pain.rectangle(x + 1, y - ascent() + 1, width() - 2, height() - 2,
|
||||||
LColor::black);
|
LColor::black);
|
||||||
xcell(0).draw(pi, x + 5, y);
|
if (key_->name == "fbox") {
|
||||||
|
MathFontSetChanger dummy(pi.base, "textnormal");
|
||||||
|
xcell(0).draw(pi, x + 5, y);
|
||||||
|
} else {
|
||||||
|
xcell(0).draw(pi, x + 5, y);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MathFboxInset::write(WriteStream & os) const
|
void MathFboxInset::write(WriteStream & os) const
|
||||||
{
|
{
|
||||||
os << "\\fbox{" << cell(0) << '}';
|
os << '\\' << key_->name << '{' << cell(0) << '}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MathFboxInset::normalize(NormalStream & os) const
|
void MathFboxInset::normalize(NormalStream & os) const
|
||||||
{
|
{
|
||||||
os << "[fbox " << cell(0) << ']';
|
os << '[' << key_->name << ' ' << cell(0) << ']';
|
||||||
}
|
}
|
||||||
|
@ -13,14 +13,16 @@
|
|||||||
\author André Pönitz
|
\author André Pönitz
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
class latexkeys;
|
||||||
|
|
||||||
class MathFboxInset : public MathNestInset {
|
class MathFboxInset : public MathNestInset {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
MathFboxInset();
|
MathFboxInset(latexkeys const * key);
|
||||||
///
|
///
|
||||||
MathInset * clone() const;
|
MathInset * clone() const;
|
||||||
///
|
///
|
||||||
mode_type currentMode() const { return TEXT_MODE; }
|
mode_type currentMode() const;
|
||||||
///
|
///
|
||||||
void metrics(MathMetricsInfo & mi) const;
|
void metrics(MathMetricsInfo & mi) const;
|
||||||
///
|
///
|
||||||
@ -29,6 +31,9 @@ public:
|
|||||||
void write(WriteStream & os) const;
|
void write(WriteStream & os) const;
|
||||||
/// write normalized content
|
/// write normalized content
|
||||||
void normalize(NormalStream & ns) const;
|
void normalize(NormalStream & ns) const;
|
||||||
|
private:
|
||||||
|
///
|
||||||
|
latexkeys const * key_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user