]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathAMSArray.cpp
* dynamic macros as described in http://1stein.org/download/dynmacro.pdf
[lyx.git] / src / mathed / InsetMathAMSArray.cpp
index 7e8bbfce79ecd5450b9c646a1078f965233ed34e..4ec493f03fcf7eb5156c3bf3916a2e4531d485ea 100644 (file)
@@ -12,7 +12,7 @@
 
 #include "LaTeXFeatures.h"
 #include "InsetMathAMSArray.h"
-#include "MathArray.h"
+#include "MathData.h"
 #include "MathStream.h"
 #include "MathStream.h"
 #include "MathSupport.h"
@@ -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<InsetBase> InsetMathAMSArray::doClone() const
+Inset * InsetMathAMSArray::clone() const
 {
-       return auto_ptr<InsetBase>(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);
 }