]> git.lyx.org Git - lyx.git/blob - src/mathed/math_parboxinset.C
Point fix, earlier forgotten
[lyx.git] / src / mathed / math_parboxinset.C
1 /**
2  * \file math_parboxinset.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author André Pönitz
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "math_parboxinset.h"
14 #include "math_mathmlstream.h"
15 #include "math_streamstr.h"
16 #include "lyxlength.h"
17 #include "debug.h"
18
19 using std::auto_ptr;
20 using std::endl;
21
22
23 MathParboxInset::MathParboxInset()
24         : lyx_width_(0), tex_width_("0mm"), position_('c')
25 {
26         lyxerr << "constructing MathParboxInset" << endl;
27 }
28
29
30 auto_ptr<InsetBase> MathParboxInset::clone() const
31 {
32         return auto_ptr<InsetBase>(new MathParboxInset(*this));
33 }
34
35
36 void MathParboxInset::setPosition(string const & p)
37 {
38         position_ = p.size() > 0 ? p[0] : 'c';
39 }
40
41
42 void MathParboxInset::setWidth(string const & w)
43 {
44         tex_width_ = w;
45         lyx_width_ = LyXLength(w).inBP();
46         lyxerr << "setting " << w << " to " << lyx_width_ << " pixel" << endl;
47 }
48
49
50 void MathParboxInset::metrics(MetricsInfo & mi, Dimension & dim) const
51 {
52         FontSetChanger dummy1(mi.base, "textnormal");
53         WidthChanger dummy2(mi.base, lyx_width_);
54         MathTextInset::metrics(mi, dim_);
55         metricsMarkers();
56         dim = dim_;
57 }
58
59
60 void MathParboxInset::draw(PainterInfo & pi, int x, int y) const
61 {
62         FontSetChanger dummy(pi.base, "textnormal");
63         MathTextInset::draw(pi, x + 1, y);
64         drawMarkers(pi, x, y);
65 }
66
67
68 void MathParboxInset::write(WriteStream & os) const
69 {
70         os << "\\parbox";
71         if (position_ != 'c')
72                 os << '[' << position_ << ']';
73         os << '{' << tex_width_ << "}{" << cell(0) << '}';
74 }
75
76
77 void MathParboxInset::infoize(std::ostream & os) const
78 {
79         os << "Box: Parbox " << tex_width_;
80 }