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 MathDelimInset::MathDelimInset(int l, int r)
22 left_ = in_word_set(ls);
26 right_ = in_word_set(rs);
31 MathInset * MathDelimInset::clone() const
33 return new MathDelimInset(*this);
37 string MathDelimInset::latexName(latexkeys const * l)
39 //static const string vdelim("(){}[]./|");
40 string name = l->name;
55 return "\\" + name + " ";
59 void MathDelimInset::write(std::ostream & os, bool fragile) const
61 os << "\\left" << latexName(left_);
62 cell(0).write(os, fragile);
63 os << "\\right" << latexName(right_);
67 void MathDelimInset::draw(Painter & pain, int x, int y) const
73 xcell(0).draw(pain, x + w, y);
75 if (latexName(left_) == ".") {
76 pain.line(x + 4, yo() - ascent_, x + 4, yo() + descent_,
77 LColor::mathcursor, Painter::line_onoffdash);
79 mathed_draw_deco(pain, x, y - ascent_, w, height(), left_);
83 if (latexName(right_) == ".") {
84 pain.line(x + 4, yo() - ascent_, x + 4, yo() + descent_,
85 LColor::mathcursor, Painter::line_onoffdash);
87 mathed_draw_deco(pain, x, y - ascent_, w, height(), right_);
91 int MathDelimInset::dw() const
102 void MathDelimInset::metrics(MathStyles st) const
104 xcell(0).metrics(st);
106 ascent_ = xcell(0).ascent() + 2;
107 descent_ = xcell(0).descent() + 2;
108 width_ = xcell(0).width() + 2 * dw() + 4;