X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FInsetMathCancelto.cpp;h=1a7d38c78ffb2f2b3bf2907237e288ec66e7accb;hb=a11780b59fcb6cdd16b15f9fa4de45d7ddfd1b2a;hp=d6d2233dd25488111b3ffe5d866e79d850661266;hpb=400703aff1984aa304a71e1ba315e1047d344020;p=features.git diff --git a/src/mathed/InsetMathCancelto.cpp b/src/mathed/InsetMathCancelto.cpp index d6d2233dd2..1a7d38c78f 100644 --- a/src/mathed/InsetMathCancelto.cpp +++ b/src/mathed/InsetMathCancelto.cpp @@ -12,11 +12,13 @@ #include "InsetMathCancelto.h" -#include "Cursor.h" -#include "LaTeXFeatures.h" #include "MathData.h" #include "MathStream.h" +#include "Cursor.h" +#include "LaTeXFeatures.h" +#include "MetricsInfo.h" + #include "frontends/Painter.h" #include @@ -39,27 +41,28 @@ Inset * InsetMathCancelto::clone() const void InsetMathCancelto::metrics(MetricsInfo & mi, Dimension & dim) const { - InsetMathNest::metrics(mi); + Changer dummy = mi.base.changeEnsureMath(); + cellsMetrics(mi); Dimension const & dim0 = cell(0).dimension(*mi.base.bv); Dimension const & dim1 = cell(1).dimension(*mi.base.bv); dim.asc = max(dim0.ascent() + 2, dim0.ascent() + dim1.ascent()) + 2 + 8; dim.des = max(dim0.descent() - 2, dim1.descent()) + 2; dim.wid = dim0.width() + dim1.width() + 10; - metricsMarkers(dim); } void InsetMathCancelto::draw(PainterInfo & pi, int x, int y) const { + Changer dummy = pi.base.changeEnsureMath(); ColorCode const origcol = pi.base.font.color(); // We first draw the text and then an arrow Dimension const & dim0 = cell(0).dimension(*pi.base.bv); - cell(0).draw(pi, x + 1, y); - cell(1).draw(pi, x + dim0.wid + 2 + 8, y - dim0.asc - 8); - + cell(0).draw(pi, x, y); + cell(1).draw(pi, x + dim0.wid + 1 + 8, y - dim0.asc - 8); + //Dimension const dim = dimension(*pi.base.bv); - + // y3____ ___ // /| // y2_ / | @@ -82,12 +85,10 @@ void InsetMathCancelto::draw(PainterInfo & pi, int x, int y) const // the arrow bars pi.pain.line(x3, y3, x2 + 2, y3, origcol); pi.pain.line(x3, y3, x3 - 2, y2 - 2, origcol); - - drawMarkers(pi, x, y); } -void InsetMathCancelto::write(WriteStream & os) const +void InsetMathCancelto::write(TeXMathStream & os) const { MathEnsurer ensurer(os); os << "\\cancelto{" << cell(1) << "}{" << cell(0) << '}'; @@ -101,7 +102,7 @@ void InsetMathCancelto::normalize(NormalStream & os) const bool InsetMathCancelto::idxUpDown(Cursor & cur, bool up) const { - Cursor::idx_type const target = up ? 1 : 0; + idx_type const target = up ? 1 : 0; if (cur.idx() == target) return false; cur.idx() = target;