X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FInsetMathBoxed.cpp;h=d9e52c3e1fe4047178274676a162a9b474642870;hb=58ab972f714309aa87e7d956ceda00e18337875f;hp=2ff48888f771fc0aaba0674460a658a2098333e7;hpb=f497296c30e6da2f97b16da8ad1c9e96feffb16b;p=lyx.git diff --git a/src/mathed/InsetMathBoxed.cpp b/src/mathed/InsetMathBoxed.cpp index 2ff48888f7..d9e52c3e1f 100644 --- a/src/mathed/InsetMathBoxed.cpp +++ b/src/mathed/InsetMathBoxed.cpp @@ -14,7 +14,7 @@ #include "MathData.h" #include "MathStream.h" #include "LaTeXFeatures.h" -#include "LColor.h" +#include "Color.h" #include "support/std_ostream.h" #include "frontends/Painter.h" @@ -22,35 +22,31 @@ namespace lyx { -using std::auto_ptr; - - InsetMathBoxed::InsetMathBoxed() : InsetMathNest(1) {} -auto_ptr InsetMathBoxed::doClone() const +Inset * InsetMathBoxed::clone() const { - return auto_ptr(new InsetMathBoxed(*this)); + return new InsetMathBoxed(*this); } -bool InsetMathBoxed::metrics(MetricsInfo & mi, Dimension & dim) const +void InsetMathBoxed::metrics(MetricsInfo & mi, Dimension & dim) const { cell(0).metrics(mi, dim); metricsMarkers2(dim, 3); // 1 pixel space, 1 frame, 1 space - if (dim_ == dim) - return false; - dim_ = dim; - return true; + // Cache the inset dimension. + setDimCache(mi, dim); } void InsetMathBoxed::draw(PainterInfo & pi, int x, int y) const { - pi.pain.rectangle(x + 1, y - dim_.ascent() + 1, - dim_.width() - 2, dim_.height() - 2, LColor::foreground); + Dimension const dim = dimension(*pi.base.bv); + pi.pain.rectangle(x + 1, y - dim.ascent() + 1, + dim.width() - 2, dim.height() - 2, Color::foreground); cell(0).draw(pi, x + 3, y); setPosCache(pi, x, y); }