]> git.lyx.org Git - features.git/blob - src/mathed/math_sizeinset.C
Prepare mathed for unified two-stage drawing
[features.git] / src / mathed / math_sizeinset.C
1 #include <config.h>
2
3 #include "math_sizeinset.h"
4 #include "math_parser.h"
5 #include "math_mathmlstream.h"
6 #include "math_streamstr.h"
7 #include "math_support.h"
8 #include "support/LOstream.h"
9
10
11 using std::atoi;
12
13 MathSizeInset::MathSizeInset(latexkeys const * l)
14         : MathNestInset(1), key_(l), style_(Styles(atoi(l->extra.c_str())))
15 {}
16
17
18 MathInset * MathSizeInset::clone() const
19 {
20         return new MathSizeInset(*this);
21 }
22
23
24 Dimension MathSizeInset::metrics(MetricsInfo & mi) const
25 {
26         StyleChanger dummy(mi.base, style_);
27         cell(0).metrics(mi, dim_);
28         metricsMarkers();
29         return dim_;
30 }
31
32
33 void MathSizeInset::draw(PainterInfo & pi, int x, int y) const
34 {
35         StyleChanger dummy(pi.base, style_);
36         cell(0).draw(pi, x + 1, y);
37         drawMarkers(pi, x, y);
38 }
39
40
41 void MathSizeInset::write(WriteStream & os) const
42 {
43         os << "{\\" << key_->name << ' ' << cell(0) << '}';
44 }
45
46
47 void MathSizeInset::normalize(NormalStream & os) const
48 {
49         os << '[' << key_->name << ' ' << cell(0) << ']';
50 }
51
52
53 void MathSizeInset::infoize(std::ostream & os) const
54 {
55         os << "Size: " << key_->name;
56 }