X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FInsetMathAMSArray.cpp;h=4ec493f03fcf7eb5156c3bf3916a2e4531d485ea;hb=12314897982e07afd8926c997f66d7bb08e7e1fd;hp=d74ed1db30926034674045c3738d94b5bb164a7e;hpb=32871c1284f15265f652ff01c438e539a7c8181f;p=lyx.git diff --git a/src/mathed/InsetMathAMSArray.cpp b/src/mathed/InsetMathAMSArray.cpp index d74ed1db30..4ec493f03f 100644 --- a/src/mathed/InsetMathAMSArray.cpp +++ b/src/mathed/InsetMathAMSArray.cpp @@ -24,7 +24,6 @@ #include "support/lstrings.h" #include "support/std_ostream.h" -using std::auto_ptr; namespace lyx { @@ -41,9 +40,9 @@ InsetMathAMSArray::InsetMathAMSArray(docstring const & name) {} -auto_ptr InsetMathAMSArray::doClone() const +Inset * InsetMathAMSArray::clone() const { - return auto_ptr(new InsetMathAMSArray(*this)); + return new InsetMathAMSArray(*this); } @@ -79,23 +78,29 @@ char const * InsetMathAMSArray::name_right() const } -bool InsetMathAMSArray::metrics(MetricsInfo & mi, Dimension & dim) const +void InsetMathAMSArray::metrics(MetricsInfo & mi, Dimension & dim) const { ArrayChanger dummy(mi.base); InsetMathGrid::metrics(mi, dim); dim.wid += 14; - bool const changed = dim_ != dim; - dim_ = dim; - return changed; +} + + +Dimension const InsetMathAMSArray::dimension(BufferView const & bv) const +{ + Dimension dim = InsetMathGrid::dimension(bv); + dim.wid += 14; + return dim; } void InsetMathAMSArray::draw(PainterInfo & pi, int x, int y) const { - int const yy = y - dim_.ascent(); + Dimension const dim = dimension(*pi.base.bv); + int const yy = y - dim.ascent(); // Drawing the deco after an ArrayChanger does not work - mathed_draw_deco(pi, x + 1, yy, 5, dim_.height(), from_ascii(name_left())); - mathed_draw_deco(pi, x + dim_.width() - 8, yy, 5, dim_.height(), from_ascii(name_right())); + mathed_draw_deco(pi, x + 1, yy, 5, dim.height(), from_ascii(name_left())); + mathed_draw_deco(pi, x + dim.width() - 8, yy, 5, dim.height(), from_ascii(name_right())); ArrayChanger dummy(pi.base); InsetMathGrid::drawWithMargin(pi, x, y, 6, 8); }