5 #include "math_deliminset.h"
6 #include "math_parser.h"
7 #include "mathed/support.h"
8 #include "support/LOstream.h"
11 MathDelimInset::MathDelimInset(latexkeys const * l, latexkeys const * r)
12 : MathNestInset(1), left_(l), right_(r)
16 MathInset * MathDelimInset::clone() const
18 return new MathDelimInset(*this);
22 string MathDelimInset::latexName(latexkeys const * l)
24 //static const string vdelim("(){}[]./|");
25 string name = l->name;
40 return "\\" + name + " ";
44 void MathDelimInset::write(std::ostream & os, bool fragile) const
46 os << "\\left" << latexName(left_);
47 cell(0).write(os, fragile);
48 os << "\\right" << latexName(right_);
52 int MathDelimInset::dw() const
63 void MathDelimInset::metrics(MathStyles st) const
67 ascent_ = std::max(xcell(0).ascent(), mathed_char_ascent(LM_TC_VAR, st,'I'));
68 descent_ = xcell(0).descent();
69 width_ = xcell(0).width() + 2 * dw() + 4;
73 void MathDelimInset::draw(Painter & pain, int x, int y) const
79 int const b = y - ascent_ - 2;
80 xcell(0).draw(pain, x + w + 2, y);
81 mathed_draw_deco(pain, x, b, w, height() + 4, left_);
82 mathed_draw_deco(pain, x + width() - w, b, w, height() + 4, right_);