7 #include "math_deliminset.h"
8 #include "math_parser.h"
9 #include "mathed/support.h"
10 #include "support/LOstream.h"
14 MathDelimInset::MathDelimInset(latexkeys const * l, latexkeys const * r)
15 : MathNestInset(1), left_(l), right_(r)
19 MathInset * MathDelimInset::clone() const
21 return new MathDelimInset(*this);
25 string MathDelimInset::latexName(latexkeys const * l)
27 //static const string vdelim("(){}[]./|");
28 string name = l->name;
43 return "\\" + name + " ";
47 void MathDelimInset::write(std::ostream & os, bool fragile) const
49 os << "\\left" << latexName(left_);
50 cell(0).write(os, fragile);
51 os << "\\right" << latexName(right_);
55 int MathDelimInset::dw() const
66 void MathDelimInset::metrics(MathStyles st) const
71 mathed_char_dim(LM_TC_VAR, st,'I', a, d, w);
73 int a0 = std::max(xcell(0).ascent(), a) - h0;
74 int d0 = std::max(xcell(0).descent(), d) + h0;
75 ascent_ = max(a0, d0) + h0;
76 descent_ = max(a0, d0) - h0;
77 width_ = xcell(0).width() + 2 * dw() + 4;
81 void MathDelimInset::draw(Painter & pain, int x, int y) const
87 int const b = y - ascent_ - 2;
88 xcell(0).draw(pain, x + w + 2, y);
89 mathed_draw_deco(pain, x + 1, b, w, height() + 4, left_->name);
90 mathed_draw_deco(pain, x + width() - w - 1, b, w, height() + 4, right_->name);