]> git.lyx.org Git - lyx.git/blob - src/mathed/math_sizeinset.C
architectural changes to tex2lyx
[lyx.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 using std::atoi;
11 using std::auto_ptr;
12
13
14 MathSizeInset::MathSizeInset(latexkeys const * l)
15         : MathNestInset(1), key_(l), style_(Styles(atoi(l->extra.c_str())))
16 {}
17
18
19 auto_ptr<InsetBase> MathSizeInset::clone() const
20 {
21         return auto_ptr<InsetBase>(new MathSizeInset(*this));
22 }
23
24
25 void MathSizeInset::metrics(MetricsInfo & mi, Dimension & dim) const
26 {
27         StyleChanger dummy(mi.base, style_);
28         cell(0).metrics(mi, dim_);
29         metricsMarkers();
30         dim = dim_;
31 }
32
33
34 void MathSizeInset::draw(PainterInfo & pi, int x, int y) const
35 {
36         StyleChanger dummy(pi.base, style_);
37         cell(0).draw(pi, x + 1, y);
38         drawMarkers(pi, x, y);
39 }
40
41
42 void MathSizeInset::write(WriteStream & os) const
43 {
44         os << "{\\" << key_->name << ' ' << cell(0) << '}';
45 }
46
47
48 void MathSizeInset::normalize(NormalStream & os) const
49 {
50         os << '[' << key_->name << ' ' << cell(0) << ']';
51 }
52
53
54 void MathSizeInset::infoize(std::ostream & os) const
55 {
56         os << "Size: " << key_->name;
57 }