]> git.lyx.org Git - features.git/blob - src/mathed/math_braceinset.C
write \mathrm{x}\mathrm{y} as \mathrm{xy} again
[features.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 "mathed/support.h"
10 #include "support/LOstream.h"
11
12 using std::max;
13
14
15 MathBraceInset::MathBraceInset()
16         : MathNestInset(1)
17 {}
18
19
20 MathInset * MathBraceInset::clone() const
21 {   
22         return new MathBraceInset(*this);
23 }
24
25
26 void MathBraceInset::write(MathWriteInfo & os) const
27 {
28         os << '{' << cell(0) << '}';
29 }
30
31
32 void MathBraceInset::writeNormal(std::ostream & os) const
33 {
34         os << "[block ";
35         cell(0).writeNormal(os);
36         os << "]";
37 }
38
39
40 void MathBraceInset::metrics(MathMetricsInfo const & mi) const
41 {
42         xcell(0).metrics(mi);
43         int a, d;
44         mathed_char_dim(LM_TC_TEX, mi, '{', a, d, wid_);
45         ascent_  = std::max(xcell(0).ascent(), a);
46         descent_ = std::max(xcell(0).descent(), a);
47         width_   = xcell(0).width() + 2 * wid_;
48 }
49
50
51 void MathBraceInset::draw(Painter & pain, int x, int y) const
52
53         drawChar(pain, LM_TC_TEX, mi_, x, y, '{');
54         xcell(0).draw(pain, x + wid_, y);
55         drawChar(pain, LM_TC_TEX, mi_, x + width_ - wid_, y, '}');
56 }