mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-26 06:15:16 +00:00
990069f546
aehm... move things from the parbox inset to an abstract base class 'MathTextInset' and have a shot on implementing an ERT inset on top of that. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4819 a592a061-630c-0410-9148-cb99ea01b6c8
69 lines
1.3 KiB
C
69 lines
1.3 KiB
C
|
|
#include "math_parboxinset.h"
|
|
#include "math_mathmlstream.h"
|
|
#include "math_streamstr.h"
|
|
#include "lyxlength.h"
|
|
#include "debug.h"
|
|
|
|
using std::vector;
|
|
|
|
|
|
MathParboxInset::MathParboxInset()
|
|
: lyx_width_(0), tex_width_("0mm"), position_('c')
|
|
{
|
|
lyxerr << "constructing MathParboxInset\n";
|
|
}
|
|
|
|
|
|
MathInset * MathParboxInset::clone() const
|
|
{
|
|
return new MathParboxInset(*this);
|
|
}
|
|
|
|
|
|
void MathParboxInset::setPosition(string const & p)
|
|
{
|
|
position_ = p.size() > 0 ? p[0] : 'c';
|
|
}
|
|
|
|
|
|
void MathParboxInset::setWidth(string const & w)
|
|
{
|
|
tex_width_ = w;
|
|
lyx_width_ = LyXLength(w).inBP();
|
|
lyxerr << "setting " << w << " to " << lyx_width_ << " pixel\n";
|
|
}
|
|
|
|
|
|
void MathParboxInset::metrics(MathMetricsInfo & mi) const
|
|
{
|
|
MathFontSetChanger dummy1(mi.base, "textnormal");
|
|
MathWidthChanger dummy2(mi.base, lyx_width_);
|
|
MathTextInset::metrics(mi);
|
|
metricsMarkers2();
|
|
}
|
|
|
|
|
|
void MathParboxInset::draw(MathPainterInfo & pi, int x, int y) const
|
|
{
|
|
MathFontSetChanger dummy(pi.base, "textnormal");
|
|
MathTextInset::draw(pi, x + 1, y);
|
|
drawMarkers2(pi, x, y);
|
|
}
|
|
|
|
|
|
void MathParboxInset::write(WriteStream & os) const
|
|
{
|
|
os << "\\parbox";
|
|
if (position_ != 'c')
|
|
os << '[' << position_ << ']';
|
|
os << '{' << tex_width_ << "}{" << cell(0) << '}';
|
|
}
|
|
|
|
|
|
void MathParboxInset::infoize(std::ostream & os) const
|
|
{
|
|
os << "Box: Parbox " << tex_width_;
|
|
}
|
|
|