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