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