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
68 mathed_char_dim(LM_TC_VAR, st,'I', a, d, w);
70 int a0 = std::max(xcell(0).ascent(), a) - h0;
71 int d0 = std::max(xcell(0).descent(), d) + h0;
72 ascent_ = max(a0, d0) + h0;
73 descent_ = max(a0, d0) - h0;
74 width_ = xcell(0).width() + 2 * dw() + 4;
78 void MathDelimInset::draw(Painter & pain, int x, int y) const
84 int const b = y - ascent_ - 2;
85 xcell(0).draw(pain, x + w + 2, y);
86 mathed_draw_deco(pain, x + 1, b, w, height() + 4, left_);
87 mathed_draw_deco(pain, x + width() - w - 1, b, w, height() + 4, right_);