]> git.lyx.org Git - lyx.git/blob - src/mathed/math_stackrelinset.C
IU of drawing phase one without 'semantic changes' as requested by John
[lyx.git] / src / mathed / math_stackrelinset.C
1
2 #include "math_stackrelinset.h"
3 #include "math_mathmlstream.h"
4 #include "math_support.h"
5
6
7 using std::max;
8
9
10 MathStackrelInset::MathStackrelInset()
11 {}
12
13
14 MathInset * MathStackrelInset::clone() const
15 {
16         return new MathStackrelInset(*this);
17 }
18
19
20 void MathStackrelInset::metrics(MetricsInfo & mi, Dimension & dim) const
21 {
22         cell(1).metrics(mi);
23         FracChanger dummy(mi.base);
24         cell(0).metrics(mi);
25         dim_.wid = max(cell(0).width(), cell(1).width()) + 4;
26         dim_.asc = cell(1).ascent() + cell(0).height() + 4;
27         dim_.des = cell(1).descent();
28         metricsMarkers();
29         dim = dim_;
30 }
31
32
33 void MathStackrelInset::draw(PainterInfo & pi, int x, int y) const
34 {
35         int m  = x + dim_.width() / 2;
36         int yo = y - cell(1).ascent() - cell(0).descent() - 1;
37         cell(1).draw(pi, m - cell(1).width() / 2, y);
38         FracChanger dummy(pi.base);
39         cell(0).draw(pi, m - cell(0).width() / 2, yo);
40         drawMarkers(pi, x, y);  
41 }
42
43
44 void MathStackrelInset::write(WriteStream & os) const
45 {
46         os << "\\stackrel{" << cell(0) << "}{" << cell(1) << '}';
47 }
48
49
50 void MathStackrelInset::normalize(NormalStream & os) const
51 {
52         os << "[stackrel " << cell(0) << ' ' << cell(1) << ']';
53 }