]> git.lyx.org Git - lyx.git/blob - src/mathed/math_braceinset.C
IU of drawing phase one without 'semantic changes' as requested by John
[lyx.git] / src / mathed / math_braceinset.C
1 #include <config.h>
2
3 #include "math_braceinset.h"
4 #include "math_parser.h"
5 #include "math_support.h"
6 #include "math_mathmlstream.h"
7 #include "support/LOstream.h"
8
9 using std::max;
10
11
12 MathBraceInset::MathBraceInset()
13         : MathNestInset(1)
14 {}
15
16
17 MathBraceInset::MathBraceInset(MathArray const & ar)
18         : MathNestInset(1)
19 {
20         cell(0) = ar;
21 }
22
23
24 MathInset * MathBraceInset::clone() const
25 {
26         return new MathBraceInset(*this);
27 }
28
29
30 void MathBraceInset::metrics(MetricsInfo & mi, Dimension & dim) const
31 {
32         cell(0).metrics(mi);
33         Dimension t;
34         mathed_char_dim(mi.base.font, '{', t);
35         wid_ = t.wid;
36         dim_.asc = max(cell(0).ascent(), t.asc);
37         dim_.des = max(cell(0).descent(), t.des);
38         dim_.wid = cell(0).width() + 2 * wid_;
39         dim = dim_;
40 }
41
42
43 void MathBraceInset::draw(PainterInfo & 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 + dim_.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 }