3 #include "math_deliminset.h"
5 #include "math_parser.h"
8 #include "mathed/support.h"
9 #include "support/LOstream.h"
14 MathDelimInset::MathDelimInset(int l, int r, short st)
15 : MathParInset(st, "", LM_OT_DELIM), left_(l), right_(r) {}
18 MathedInset * MathDelimInset::Clone()
20 MathDelimInset * p = new MathDelimInset(left_, right_, GetStyle());
22 p->setData(it.Copy());
27 void MathDelimInset::Write(ostream & os, bool fragile)
29 latexkeys const * l = (left_ != '|') ?
30 lm_get_key_by_id(left_, LM_TK_SYM) : 0;
31 latexkeys const * r = (right_ != '|') ?
32 lm_get_key_by_id(right_, LM_TK_SYM) : 0;
35 os << '\\' << l->name << ' ';
37 if (left_ == '{' || left_ == '}') {
38 os << '\\' << char(left_) << ' ';
40 os << char(left_) << ' ';
43 MathParInset::Write(os, fragile);
46 os << '\\' << r->name << ' ';
48 if (right_ == '{' || right_ == '}') {
49 os << '\\' << char(right_) << ' ';
51 os << char(right_) << ' ';
58 MathDelimInset::draw(Painter & pain, int x, int y)
62 MathParInset::draw(pain, x + dw_ + 2, y - dh_);
65 pain.line(x + 4, yo() - ascent,
66 x + 4, yo() + descent,
67 LColor::mathcursor, Painter::line_onoffdash);
69 mathed_draw_deco(pain, x, y - ascent, dw_, Height(), left_);
70 x += Width() - dw_ - 2;
72 pain.line(x + 4, yo() - ascent,
73 x + 4, yo() + descent,
74 LColor::mathcursor, Painter::line_onoffdash);
76 mathed_draw_deco(pain, x, y - ascent, dw_, Height(), right_);
81 MathDelimInset::Metrics()
83 MathParInset::Metrics();
86 mathed_char_height(LM_TC_CONST, size(), 'I', d, dh_);
91 if (dw_ > 15) dw_ = 15;