]> git.lyx.org Git - lyx.git/blob - src/mathed/math_parboxinset.C
rename commandtags.h to lfuns.h and renumber/cleanup. Rebuild the tree !
[lyx.git] / src / mathed / math_parboxinset.C
1
2 #include "math_parboxinset.h"
3 #include "math_mathmlstream.h"
4 #include "math_streamstr.h"
5 #include "lyxlength.h"
6 #include "debug.h"
7
8
9 MathParboxInset::MathParboxInset()
10         : lyx_width_(0), tex_width_("0mm"), position_('c')
11 {
12         lyxerr << "constructing MathParboxInset\n";
13 }
14
15
16 MathInset * MathParboxInset::clone() const
17 {
18         return new MathParboxInset(*this);
19 }
20
21
22 void MathParboxInset::setPosition(string const & p)
23 {
24         position_ = p.size() > 0 ? p[0] : 'c';
25 }
26
27
28 void MathParboxInset::setWidth(string const & w)
29 {
30         tex_width_ = w;
31         lyx_width_ = LyXLength(w).inBP();
32         lyxerr << "setting " << w << " to " << lyx_width_ << " pixel\n";
33 }
34
35
36 void MathParboxInset::metrics(MathMetricsInfo & mi) const
37 {
38         MathFontSetChanger dummy1(mi.base, "textnormal");
39         MathWidthChanger dummy2(mi.base, lyx_width_);
40         MathTextInset::metrics(mi);
41         metricsMarkers2();
42 }
43
44
45 void MathParboxInset::draw(MathPainterInfo & pi, int x, int y) const
46 {
47         MathFontSetChanger dummy(pi.base, "textnormal");
48         MathTextInset::draw(pi, x + 1, y);
49         drawMarkers2(pi, x, y);
50 }
51
52
53 void MathParboxInset::write(WriteStream & os) const
54 {
55         os << "\\parbox";
56         if (position_ != 'c')
57                 os << '[' << position_ << ']';
58         os << '{' << tex_width_ << "}{" << cell(0) << '}';
59 }
60
61
62 void MathParboxInset::infoize(std::ostream & os) const
63 {
64         os << "Box: Parbox " << tex_width_;
65 }