]> git.lyx.org Git - lyx.git/blob - src/mathed/math_braceinset.C
rename commandtags.h to lfuns.h and renumber/cleanup. Rebuild the tree !
[lyx.git] / src / mathed / math_braceinset.C
1 #include <config.h>
2
3
4 #include "math_braceinset.h"
5 #include "math_parser.h"
6 #include "math_support.h"
7 #include "math_mathmlstream.h"
8 #include "support/LOstream.h"
9
10 using std::max;
11
12
13 MathBraceInset::MathBraceInset()
14         : MathNestInset(1)
15 {}
16
17
18 MathBraceInset::MathBraceInset(MathArray const & ar)
19         : MathNestInset(1)
20 {
21         cell(0) = ar;
22 }
23
24
25 MathInset * MathBraceInset::clone() const
26 {
27         return new MathBraceInset(*this);
28 }
29
30
31 void MathBraceInset::metrics(MathMetricsInfo & mi) const
32 {
33         cell(0).metrics(mi);
34         Dimension t;
35         mathed_char_dim(mi.base.font, '{', t);
36         wid_ = t.w;
37         dim_.a = max(cell(0).ascent(), t.a);
38         dim_.d = max(cell(0).descent(), t.d);
39         dim_.w = cell(0).width() + 2 * wid_;
40 }
41
42
43 void MathBraceInset::draw(MathPainterInfo & pi, int x, int y) const
44 {
45         LyXFont font = pi.base.font;
46         font.setColor(LColor::latex);
47         drawChar(pi, font, x, y, '{');
48         cell(0).draw(pi, x + wid_, y);
49         drawChar(pi, font, x + width() - wid_, y, '}');
50 }
51
52
53 void MathBraceInset::write(WriteStream & os) const
54 {
55         os << '{' << cell(0) << '}';
56 }
57
58
59 void MathBraceInset::normalize(NormalStream & os) const
60 {
61         os << "[block " << cell(0) << ']';
62 }
63
64
65 void MathBraceInset::maple(MapleStream & os) const
66 {
67         os << cell(0);
68 }
69
70
71 void MathBraceInset::octave(OctaveStream & os) const
72 {
73         os << cell(0);
74 }
75
76
77 void MathBraceInset::mathmlize(MathMLStream & os) const
78 {
79         os << MTag("mrow") << cell(0) << ETag("mrow");
80 }
81
82
83 void MathBraceInset::mathematica(MathematicaStream & os) const
84 {
85         os << cell(0);
86 }
87
88
89 void MathBraceInset::infoize(std::ostream & os) const
90 {
91         os << "Nested Block: ";
92 }