X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FInsetMathDecoration.cpp;h=1dc8a1471bc18784256ddea93cb333d3ad5f2efe;hb=58ab972f714309aa87e7d956ceda00e18337875f;hp=f1c8a7c3f743bad1623bba956009d510087e4eda;hpb=6e3a75969b97a5db4c80c46be49d4deb122abfe7;p=lyx.git diff --git a/src/mathed/InsetMathDecoration.cpp b/src/mathed/InsetMathDecoration.cpp index f1c8a7c3f7..1dc8a1471b 100644 --- a/src/mathed/InsetMathDecoration.cpp +++ b/src/mathed/InsetMathDecoration.cpp @@ -12,7 +12,7 @@ #include #include "InsetMathDecoration.h" -#include "MathArray.h" +#include "MathData.h" #include "MathParser.h" #include "MathSupport.h" #include "MathStream.h" @@ -33,9 +33,9 @@ InsetMathDecoration::InsetMathDecoration(latexkeys const * key) } -std::auto_ptr InsetMathDecoration::doClone() const +Inset * InsetMathDecoration::clone() const { - return std::auto_ptr(new InsetMathDecoration(*this)); + return new InsetMathDecoration(*this); } @@ -101,7 +101,7 @@ bool InsetMathDecoration::ams() const } -bool InsetMathDecoration::metrics(MetricsInfo & mi, Dimension & dim) const +void InsetMathDecoration::metrics(MetricsInfo & mi, Dimension & dim) const { cell(0).metrics(mi, dim); @@ -117,20 +117,19 @@ bool InsetMathDecoration::metrics(MetricsInfo & mi, Dimension & dim) const } metricsMarkers(dim); - if (dim_ == dim) - return false; - dim_ = dim; - return true; + // Cache the inset dimension. + setDimCache(mi, dim); } void InsetMathDecoration::draw(PainterInfo & pi, int x, int y) const { cell(0).draw(pi, x + 1, y); + Dimension const & dim0 = cell(0).dimension(*pi.base.bv); if (wide()) - mathed_draw_deco(pi, x + 1, y + dy_, cell(0).width(), dh_, key_->name); + mathed_draw_deco(pi, x + 1, y + dy_, dim0.wid, dh_, key_->name); else - mathed_draw_deco(pi, x + 1 + (cell(0).width() - dw_) / 2, + mathed_draw_deco(pi, x + 1 + (dim0.wid - dw_) / 2, y + dy_, dw_, dh_, key_->name); drawMarkers(pi, x, y); setPosCache(pi, x, y);