]> git.lyx.org Git - lyx.git/blob - src/mathed/math_xarrowinset.C
Get rid of lyxstring, remove usage of STRCONV.
[lyx.git] / src / mathed / math_xarrowinset.C
1 /**
2  * \file math_xarrowinset.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author André Pönitz
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "math_xarrowinset.h"
14 #include "math_data.h"
15 #include "math_mathmlstream.h"
16 #include "math_streamstr.h"
17 #include "math_support.h"
18
19 using std::auto_ptr;
20
21
22 MathXArrowInset::MathXArrowInset(string const & name)
23         : MathFracbaseInset(), name_(name)
24 {}
25
26
27 auto_ptr<InsetBase> MathXArrowInset::clone() const
28 {
29         return auto_ptr<InsetBase>(new MathXArrowInset(*this));
30 }
31
32
33 void MathXArrowInset::metrics(MetricsInfo & mi, Dimension & dim) const
34 {
35         ScriptChanger dummy(mi.base);
36         cell(0).metrics(mi);
37         cell(1).metrics(mi);
38         dim_.wid = std::max(cell(0).width(), cell(1).width()) + 10;
39         dim_.asc = cell(0).height() + 10;
40         dim_.des = cell(1).height();
41         dim = dim_;
42 }
43
44
45 void MathXArrowInset::draw(PainterInfo & pi, int x, int y) const
46 {
47         ScriptChanger dummy(pi.base);
48         cell(0).draw(pi, x + 5, y - 10);
49         cell(1).draw(pi, x + 5, y + cell(1).height());
50         mathed_draw_deco(pi, x + 1, y - 7, pi.width - 2, 5, name_);
51 }
52
53
54 void MathXArrowInset::write(WriteStream & os) const
55 {
56         os << '\\' << name_;
57         if (cell(1).size())
58                 os << '[' << cell(1) << ']';
59         os << '{' << cell(0) << '}';
60 }
61
62
63 void MathXArrowInset::normalize(NormalStream & os) const
64 {
65         os << "[xarrow " << name_ << ' ' <<  cell(0) << ' ' << cell(1) << ']';
66 }