3 #include "math_deliminset.h"
5 #include "math_parser.h"
8 #include "mathed/support.h"
11 MathDelimInset::MathDelimInset(int l, int r, short st)
12 : MathParInset(st, "", LM_OT_DELIM), left(l), right(r) {}
15 MathedInset * MathDelimInset::Clone()
17 MathDelimInset * p = new MathDelimInset(left, right, GetStyle());
19 p->SetData(it.Copy());
25 void MathDelimInset::Write(ostream & os, bool fragile)
27 latexkeys * l = (left != '|') ? lm_get_key_by_id(left, LM_TK_SYM): 0;
28 latexkeys * r = (right != '|') ? lm_get_key_by_id(right, LM_TK_SYM): 0;
31 os << '\\' << l->name << ' ';
33 if (left == '{' || left == '}') {
34 os << '\\' << char(left) << ' ';
36 os << char(left) << ' ';
39 MathParInset::Write(os, fragile);
42 os << '\\' << r->name << ' ';
44 if (right == '{' || right == '}') {
45 os << '\\' << char(right) << ' ';
47 os << char(right) << ' ';
55 MathDelimInset::draw(Painter & pain, int x, int y)
58 MathParInset::draw(pain, x + dw + 2, y - dh);
61 pain.line(x + 4, yo - ascent,
63 LColor::mathcursor, Painter::line_onoffdash);
65 mathed_draw_deco(pain, x, y - ascent, dw, Height(), left);
66 x += Width() - dw - 2;
68 pain.line(x + 4, yo - ascent,
70 LColor::mathcursor, Painter::line_onoffdash);
72 mathed_draw_deco(pain, x, y-ascent, dw, Height(), right);
77 MathDelimInset::Metrics()
79 MathParInset::Metrics();
82 mathed_char_height(LM_TC_CONST, size, 'I', d, dh);