]> git.lyx.org Git - lyx.git/blob - src/mathed/math_casesinset.C
Jean-Marc's fix for wrong descent
[lyx.git] / src / mathed / math_casesinset.C
1 #include <config.h>
2
3
4 #include "math_casesinset.h"
5 #include "math_parser.h"
6 #include "math_mathmlstream.h"
7 #include "math_support.h"
8 #include "support/LOstream.h"
9
10
11 MathCasesInset::MathCasesInset(row_type n)
12         : MathGridInset(2, n, 'c', "ll")
13 {}
14
15
16 MathInset * MathCasesInset::clone() const
17 {
18         return new MathCasesInset(*this);
19 }
20
21
22 void MathCasesInset::metrics(MathMetricsInfo & mi) const
23 {
24         MathGridInset::metrics(mi);
25         dim_.w += 8;
26 }
27
28
29 void MathCasesInset::draw(MathPainterInfo & pain, int x, int y) const
30 {
31         mathed_draw_deco(pain, x + 1, y - ascent(), 6, height(), "{");
32         MathGridInset::draw(pain, x + 8, y);
33 }
34
35
36 void MathCasesInset::write(WriteStream & os) const
37 {
38         if (os.fragile())
39                 os << "\\protect";
40         os << "\\begin{cases}\n";
41         MathGridInset::write(os);
42         if (os.fragile())
43                 os << "\\protect";
44         os << "\\end{cases}";
45 }
46
47
48 void MathCasesInset::normalize(NormalStream & os) const
49 {
50         os << "[cases ";
51         MathGridInset::normalize(os);
52         os << ']';
53 }
54
55
56 void MathCasesInset::maple(MapleStream & os) const
57 {
58         os << "cases(";
59         MathGridInset::maple(os);
60         os << ')';
61 }
62
63
64 void MathCasesInset::infoize(std::ostream & os) const
65 {
66         os << "Cases ";
67 }