]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathAMSArray.cpp
* src/frontends/GuiDocument.{cpp,h}:
[lyx.git] / src / mathed / InsetMathAMSArray.cpp
index 436eb23d70ebb9f074745b04ccce0c00e7953eee..a8fdf68346e110ff1322dc954d10ae6229fc6855 100644 (file)
 
 #include <config.h>
 
-#include "LaTeXFeatures.h"
 #include "InsetMathAMSArray.h"
-#include "MathArray.h"
-#include "MathStream.h"
+
+#include "LaTeXFeatures.h"
+#include "MathData.h"
 #include "MathStream.h"
 #include "MathSupport.h"
+#include "MetricsInfo.h"
 
 #include "FuncRequest.h"
 #include "FuncStatus.h"
-#include "gettext.h"
+#include "support/gettext.h"
 
 #include "support/lstrings.h"
-#include "support/std_ostream.h"
 
-using std::auto_ptr;
+#include <ostream>
+
 
 namespace lyx {
 
@@ -41,9 +42,9 @@ InsetMathAMSArray::InsetMathAMSArray(docstring const & name)
 {}
 
 
-auto_ptr<InsetBase> InsetMathAMSArray::doClone() const
+Inset * InsetMathAMSArray::clone() const
 {
-       return auto_ptr<InsetBase>(new InsetMathAMSArray(*this));
+       return new InsetMathAMSArray(*this);
 }
 
 
@@ -79,29 +80,35 @@ 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);
 }
 
 
-bool InsetMathAMSArray::getStatus(LCursor & cur, FuncRequest const & cmd,
+bool InsetMathAMSArray::getStatus(Cursor & cur, FuncRequest const & cmd,
                FuncStatus & flag) const
 {
        switch (cmd.action) {