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 return new MathDelimInset(*this);
24 void MathDelimInset::Write(ostream & os, bool fragile)
26 latexkeys const * l = (left_ != '|') ?
27 lm_get_key_by_id(left_, LM_TK_SYM) : 0;
28 latexkeys const * r = (right_ != '|') ?
29 lm_get_key_by_id(right_, LM_TK_SYM) : 0;
32 os << '\\' << l->name << ' ';
34 if (left_ == '{' || left_ == '}') {
35 os << '\\' << char(left_) << ' ';
37 os << char(left_) << ' ';
40 MathParInset::Write(os, fragile);
43 os << '\\' << r->name << ' ';
45 if (right_ == '{' || right_ == '}') {
46 os << '\\' << char(right_) << ' ';
48 os << char(right_) << ' ';
55 MathDelimInset::draw(Painter & pain, int x, int y)
59 MathParInset::draw(pain, x + dw_ + 2, y - dh_);
62 pain.line(x + 4, yo() - ascent,
63 x + 4, yo() + descent,
64 LColor::mathcursor, Painter::line_onoffdash);
66 mathed_draw_deco(pain, x, y - ascent, dw_, Height(), left_);
67 x += Width() - dw_ - 2;
69 pain.line(x + 4, yo() - ascent,
70 x + 4, yo() + descent,
71 LColor::mathcursor, Painter::line_onoffdash);
73 mathed_draw_deco(pain, x, y - ascent, dw_, Height(), right_);
78 MathDelimInset::Metrics()
80 MathParInset::Metrics();
83 mathed_char_height(LM_TC_CONST, size(), 'I', d, dh_);
88 if (dw_ > 15) dw_ = 15;