X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FInsetMathFrameBox.cpp;h=90bcacdc5ee34165f5cc48ce57e20abb9e653ade;hb=58ab972f714309aa87e7d956ceda00e18337875f;hp=252589894129086a4c0aa047e60b431472669216;hpb=6e3a75969b97a5db4c80c46be49d4deb122abfe7;p=lyx.git diff --git a/src/mathed/InsetMathFrameBox.cpp b/src/mathed/InsetMathFrameBox.cpp index 2525898941..90bcacdc5e 100644 --- a/src/mathed/InsetMathFrameBox.cpp +++ b/src/mathed/InsetMathFrameBox.cpp @@ -11,63 +11,60 @@ #include #include "InsetMathFrameBox.h" -#include "MathArray.h" +#include "MathData.h" #include "MathStream.h" #include "MathSupport.h" -#include "LColor.h" +#include "Color.h" #include "frontends/Painter.h" namespace lyx { -using std::auto_ptr; - - InsetMathFrameBox::InsetMathFrameBox() : InsetMathNest(3) {} -auto_ptr InsetMathFrameBox::doClone() const +Inset * InsetMathFrameBox::clone() const { - return auto_ptr(new InsetMathFrameBox(*this)); + return new InsetMathFrameBox(*this); } -bool InsetMathFrameBox::metrics(MetricsInfo & mi, Dimension & dim) const +void InsetMathFrameBox::metrics(MetricsInfo & mi, Dimension & dim) const { FontSetChanger dummy(mi.base, "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); metricsMarkers(dim); - if (dim_ == dim) - return false; - dim_ = dim; - return true; + // Cache the inset dimension. + setDimCache(mi, dim); } void InsetMathFrameBox::draw(PainterInfo & pi, int x, int y) const { FontSetChanger dummy(pi.base, "textnormal"); - 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); x += 5; + BufferView const & bv = *pi.base.bv; drawStrBlack(pi, x, y, from_ascii("[")); x += w_; cell(0).draw(pi, x, y); - x += cell(0).width(); + x += cell(0).dimension(bv).wid; drawStrBlack(pi, x, y, from_ascii("]")); x += w_ + 4; drawStrBlack(pi, x, y, from_ascii("[")); x += w_; cell(1).draw(pi, x, y); - x += cell(1).width(); + x += cell(1).dimension(bv).wid; drawStrBlack(pi, x, y, from_ascii("]")); x += w_ + 4;