lyx_mirror/src/mathed/math_parboxinset.C
André Pönitz a37064c0ac add #pragme interface/implementation
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5263 a592a061-630c-0410-9148-cb99ea01b6c8
2002-09-11 09:14:57 +00:00

71 lines
1.3 KiB
C

#ifdef __GNUG__
#pragma implementation
#endif
#include "math_parboxinset.h"
#include "math_mathmlstream.h"
#include "math_streamstr.h"
#include "lyxlength.h"
#include "debug.h"
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_;
}