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