]> git.lyx.org Git - lyx.git/blob - src/mathed/math_undersetinset.C
rename commandtags.h to lfuns.h and renumber/cleanup. Rebuild the tree !
[lyx.git] / src / mathed / math_undersetinset.C
1
2 #include "math_undersetinset.h"
3 #include "math_mathmlstream.h"
4 #include "math_support.h"
5
6
7 using std::max;
8
9
10 MathUndersetInset::MathUndersetInset()
11 {}
12
13
14 MathInset * MathUndersetInset::clone() const
15 {
16         return new MathUndersetInset(*this);
17 }
18
19
20 void MathUndersetInset::metrics(MathMetricsInfo & mi) const
21 {
22         cell(1).metrics(mi);
23         MathFracChanger dummy(mi.base);
24         cell(0).metrics(mi);
25         dim_.w = max(cell(0).width(), cell(1).width()) + 4;
26         dim_.a = cell(1).ascent();
27         dim_.d = cell(1).descent() + cell(0).height() + 4;
28 }
29
30
31 void MathUndersetInset::draw(MathPainterInfo & pi, int x, int y) const
32 {
33         int m  = x + width() / 2;
34         int yo = y + cell(1).descent() + cell(0).ascent() + 1;
35         cell(1).draw(pi, m - cell(1).width() / 2, y);
36         MathFracChanger dummy(pi.base);
37         cell(0).draw(pi, m - cell(0).width() / 2, yo);
38 }
39
40
41 void MathUndersetInset::write(WriteStream & os) const
42 {
43         os << "\\underset{" << cell(0) << "}{" << cell(1) << '}';
44 }
45
46
47 void MathUndersetInset::normalize(NormalStream & os) const
48 {
49         os << "[underset " << cell(0) << ' ' << cell(1) << ']';
50 }