]> git.lyx.org Git - lyx.git/blob - src/mathed/math_xarrowinset.C
fix #1073
[lyx.git] / src / mathed / math_xarrowinset.C
1 #include <config.h>
2
3
4 #include "math_xarrowinset.h"
5 #include "math_support.h"
6 #include "math_parser.h"
7 #include "math_mathmlstream.h"
8 #include "math_streamstr.h"
9
10
11 MathXArrowInset::MathXArrowInset(string const & name)
12         : MathFracbaseInset(), name_(name)
13 {}
14
15
16 MathInset * MathXArrowInset::clone() const
17 {
18         return new MathXArrowInset(*this);
19 }
20
21
22 void MathXArrowInset::metrics(MetricsInfo & mi) const
23 {
24         ScriptChanger dummy(mi.base);
25         cell(0).metrics(mi);
26         cell(1).metrics(mi);
27         dim_.w = std::max(cell(0).width(), cell(1).width()) + 10;
28         dim_.a = cell(0).height() + 10;
29         dim_.d = cell(1).height();
30 }
31
32
33 void MathXArrowInset::draw(PainterInfo & pi, int x, int y) const
34 {
35         ScriptChanger dummy(pi.base);
36         cell(0).draw(pi, x + 5, y - 10);
37         cell(1).draw(pi, x + 5, y + cell(1).height());
38         mathed_draw_deco(pi, x + 1, y - 7, width() - 2, 5, name_);
39 }
40
41
42 void MathXArrowInset::write(WriteStream & os) const
43 {
44         os << '\\' << name_;
45         if (cell(1).size())
46                 os << '[' << cell(1) << ']';
47         os << '{' << cell(0) << '}';
48 }
49
50
51 void MathXArrowInset::normalize(NormalStream & os) const
52 {
53         os << "[xarrow " << name_ << ' ' <<  cell(0) << ' ' << cell(1) << ']';
54 }