5 #include "math_deliminset.h"
6 #include "math_parser.h"
8 #include "mathed/support.h"
9 #include "support/LOstream.h"
12 MathDelimInset::MathDelimInset(latexkeys const * l, latexkeys const * r)
13 : MathNestInset(1), left_(l), right_(r)
17 MathInset * MathDelimInset::clone() const
19 return new MathDelimInset(*this);
23 string MathDelimInset::latexName(latexkeys const * l)
25 //static const string vdelim("(){}[]./|");
26 string name = l->name;
41 return "\\" + name + " ";
45 void MathDelimInset::write(std::ostream & os, bool fragile) const
47 os << "\\left" << latexName(left_);
48 cell(0).write(os, fragile);
49 os << "\\right" << latexName(right_);
53 void MathDelimInset::draw(Painter & pain, int x, int y) const
59 xcell(0).draw(pain, x + w, y);
61 if (latexName(left_) == ".") {
62 pain.line(x + 4, yo() - ascent_, x + 4, yo() + descent_,
63 LColor::mathcursor, Painter::line_onoffdash);
65 mathed_draw_deco(pain, x, y - ascent_, w, height(), left_);
69 if (latexName(right_) == ".") {
70 pain.line(x + 4, yo() - ascent_, x + 4, yo() + descent_,
71 LColor::mathcursor, Painter::line_onoffdash);
73 mathed_draw_deco(pain, x, y - ascent_, w, height(), right_);
77 int MathDelimInset::dw() const
88 void MathDelimInset::metrics(MathStyles st) const
92 ascent_ = xcell(0).ascent() + 2;
93 descent_ = xcell(0).descent() + 2;
94 width_ = xcell(0).width() + 2 * dw() + 4;