void InsetMathBinom::draw(PainterInfo & pi, int x, int y) const { Dimension const dim = dimension(*pi.base.bv); Dimension const & dim0 = cell(0).dimension(*pi.base.bv); Dimension const & dim1 = cell(1).dimension(*pi.base.bv); // define the binom brackets docstring const bra = kind_ == BRACE ? from_ascii("{") : kind_ == BRACK ? from_ascii("[") : from_ascii("("); docstring const ket = kind_ == BRACE ? from_ascii("}") : kind_ == BRACK ? from_ascii("]") : from_ascii(")"); int m = x + dim.width() / 2; // FIXME: for an unknown reason the cells must be drawn directly // after the StyleChanger and cannot be drawn after the if case if (kind_ == DBINOM) { StyleChanger dummy(pi.base, LM_ST_DISPLAY); cell(0).draw(pi, m - dim0.wid / 2, y - dim0.des - 3 - 5); cell(1).draw(pi, m - dim1.wid / 2, y + dim1.asc + 3 - 5); } else if (kind_ == TBINOM) { StyleChanger dummy(pi.base, LM_ST_SCRIPT); cell(0).draw(pi, m - dim0.wid / 2, y - dim0.des - 3 - 5); cell(1).draw(pi, m - dim1.wid / 2, y + dim1.asc + 3 - 5); } else { FracChanger dummy2(pi.base); cell(0).draw(pi, m - dim0.wid / 2, y - dim0.des - 3 - 5); cell(1).draw(pi, m - dim1.wid / 2, y + dim1.asc + 3 - 5); } // draw the brackets and the marker mathed_draw_deco(pi, x, y - dim.ascent(), dw(dim.height()), dim.height(), bra); mathed_draw_deco(pi, x + dim.width() - dw(dim.height()), y - dim.ascent(), dw(dim.height()), dim.height(), ket); drawMarkers2(pi, x, y); }
void InsetMathDelim::draw(PainterInfo & pi, int x, int y) const { Dimension const dim = dimension(*pi.base.bv); int const b = y - dim.asc; cell(0).draw(pi, x + dw_ + 4, y); mathed_draw_deco(pi, x + 4, b, dw_, dim.height(), left_); mathed_draw_deco(pi, x + dim.width() - dw_ - 4, b, dw_, dim.height(), right_); setPosCache(pi, x, y); }
void InsetMathAMSArray::draw(PainterInfo & pi, int x, int y) const { Changer dummy2 = pi.base.changeEnsureMath(); Dimension const dim = dimension(*pi.base.bv); int const yy = y - dim.ascent(); // Drawing the deco after changeStyle does not work mathed_draw_deco(pi, x + 1, yy, 5, dim.height(), from_ascii(name_left())); mathed_draw_deco(pi, x + dim.width() - 8, yy, 5, dim.height(), from_ascii(name_right())); Changer dummy = pi.base.changeArray(); InsetMathGrid::draw(pi, x, y); }
void InsetMathXArrow::draw(PainterInfo & pi, int x, int y) const { ScriptChanger dummy(pi.base); Dimension const dim = dimension(*pi.base.bv); Dimension const & dim0 = cell(0).dimension(*pi.base.bv); // center the cells with the decoration cell(0).draw(pi, x + dim.width()/2 - dim0.width()/2, y - 10); Dimension const & dim1 = cell(1).dimension(*pi.base.bv); cell(1).draw(pi, x + dim.width()/2 - dim1.width()/2, y + dim1.height()); mathed_draw_deco(pi, x + 1, y - 7, dim.wid - 2, 5, name_); drawMarkers(pi, x, y); }
void InsetMathBig::draw(PainterInfo & pi, int x, int y) const { Dimension const dim = dimension(*pi.base.bv); // mathed_draw_deco does not use the leading backslash, so remove it // (but don't use ltrim if this is the backslash delimiter). // Replace \| by \Vert (equivalent in LaTeX), since mathed_draw_deco // would treat it as |. docstring const delim = (delim_ == "\\|") ? from_ascii("Vert") : (delim_ == "\\\\") ? from_ascii("\\") : support::ltrim(delim_, "\\"); mathed_draw_deco(pi, x + 1, y - dim.ascent(), 4, dim.height(), delim); setPosCache(pi, x, y); }