mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-11 13:46:43 +00:00
00413a7841
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4843 a592a061-630c-0410-9148-cb99ea01b6c8
71 lines
1.3 KiB
C
71 lines
1.3 KiB
C
#include <config.h>
|
|
|
|
#ifdef __GNUG__
|
|
#pragma implementation
|
|
#endif
|
|
|
|
#include "math_fboxinset.h"
|
|
#include "math_support.h"
|
|
#include "math_mathmlstream.h"
|
|
#include "math_streamstr.h"
|
|
#include "math_parser.h"
|
|
#include "frontends/Painter.h"
|
|
|
|
|
|
|
|
MathFboxInset::MathFboxInset(latexkeys const * key)
|
|
: MathNestInset(1), key_(key)
|
|
{}
|
|
|
|
|
|
MathInset * MathFboxInset::clone() const
|
|
{
|
|
return new MathFboxInset(*this);
|
|
}
|
|
|
|
|
|
MathInset::mode_type MathFboxInset::currentMode() const
|
|
{
|
|
if (key_->name == "fbox")
|
|
return TEXT_MODE;
|
|
return MATH_MODE;
|
|
}
|
|
|
|
|
|
void MathFboxInset::metrics(MathMetricsInfo & mi) const
|
|
{
|
|
if (key_->name == "fbox") {
|
|
MathFontSetChanger dummy(mi.base, "textnormal");
|
|
dim_ = cell(0).metrics(mi);
|
|
metricsMarkers2(5); // 5 pixels margin
|
|
} else {
|
|
dim_ = cell(0).metrics(mi);
|
|
metricsMarkers2(5); // 5 pixels margin
|
|
}
|
|
}
|
|
|
|
|
|
void MathFboxInset::draw(MathPainterInfo & pi, int x, int y) const
|
|
{
|
|
pi.pain.rectangle(x + 1, y - ascent() + 1, width() - 2, height() - 2,
|
|
LColor::black);
|
|
if (key_->name == "fbox") {
|
|
MathFontSetChanger dummy(pi.base, "textnormal");
|
|
cell(0).draw(pi, x + 5, y);
|
|
} else {
|
|
cell(0).draw(pi, x + 5, y);
|
|
}
|
|
}
|
|
|
|
|
|
void MathFboxInset::write(WriteStream & os) const
|
|
{
|
|
os << '\\' << key_->name << '{' << cell(0) << '}';
|
|
}
|
|
|
|
|
|
void MathFboxInset::normalize(NormalStream & os) const
|
|
{
|
|
os << '[' << key_->name << ' ' << cell(0) << ']';
|
|
}
|