X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FInsetMathMakebox.cpp;h=c8ba21931e3bed9251dfb403b023a1c9f28f01e9;hb=12314897982e07afd8926c997f66d7bb08e7e1fd;hp=fb6a0b09a422d42fb55c924a477c7a5d306cc18e;hpb=31059d1741933d95403e7f07ed033cae482f778b;p=lyx.git diff --git a/src/mathed/InsetMathMakebox.cpp b/src/mathed/InsetMathMakebox.cpp index fb6a0b09a4..c8ba21931e 100644 --- a/src/mathed/InsetMathMakebox.cpp +++ b/src/mathed/InsetMathMakebox.cpp @@ -20,34 +20,29 @@ namespace lyx { -using std::auto_ptr; - - InsetMathMakebox::InsetMathMakebox() : InsetMathNest(3) {} -auto_ptr InsetMathMakebox::doClone() const +Inset * InsetMathMakebox::clone() const { - return auto_ptr(new InsetMathMakebox(*this)); + return new InsetMathMakebox(*this); } -bool InsetMathMakebox::metrics(MetricsInfo & mi, Dimension & dim) const +void InsetMathMakebox::metrics(MetricsInfo & mi, Dimension & dim) const { FontSetChanger dummy(mi.base, from_ascii("textnormal")); w_ = mathed_char_width(mi.base.font, '['); InsetMathNest::metrics(mi); - dim = cell(0).dim(); - dim += cell(1).dim(); - dim += cell(2).dim(); + dim = cell(0).dimension(*mi.base.bv); + dim += cell(1).dimension(*mi.base.bv); + dim += cell(2).dimension(*mi.base.bv); dim.wid += 4 * w_ + 4; metricsMarkers(dim); - if (dim_ == dim) - return false; - dim_ = dim; - return true; + // Cache the inset dimension. + setDimCache(mi, dim); } @@ -59,14 +54,14 @@ void InsetMathMakebox::draw(PainterInfo & pi, int x, int y) const drawStrBlack(pi, x, y, from_ascii("[")); x += w_; cell(0).draw(pi, x, y); - x += cell(0).width(); + x += cell(0).dimension(*pi.base.bv).width(); drawStrBlack(pi, x, y, from_ascii("]")); x += w_ + 2; drawStrBlack(pi, x, y, from_ascii("[")); x += w_; cell(1).draw(pi, x, y); - x += cell(1).width(); + x += cell(1).dimension(*pi.base.bv).wid; drawStrBlack(pi, x, y, from_ascii("]")); x += w_ + 2;