]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathSubstack.cpp
fix off-by-two drawing error
[lyx.git] / src / mathed / InsetMathSubstack.cpp
index b2260a40cb4960f674d5ecb58b544bce481fd22e..059e02955149ba69177645ecc1977db4881da83a 100644 (file)
 
 #include <config.h>
 
-#include "LaTeXFeatures.h"
 #include "InsetMathSubstack.h"
-#include "MathArray.h"
+
+#include "LaTeXFeatures.h"
+#include "MathData.h"
 #include "MathStream.h"
-#include "support/std_ostream.h"
 
 #include "FuncRequest.h"
 #include "FuncStatus.h"
-#include "gettext.h"
+#include "support/gettext.h"
 
 #include "support/lstrings.h"
 
+#include <ostream>
+
+using namespace std;
 
 namespace lyx {
 
 using support::bformat;
 
-using std::string;
-using std::auto_ptr;
-
 
 InsetMathSubstack::InsetMathSubstack()
        : InsetMathGrid(1, 1)
 {}
 
 
-auto_ptr<InsetBase> InsetMathSubstack::doClone() const
+Inset * InsetMathSubstack::clone() const
 {
-       return auto_ptr<InsetBase>(new InsetMathSubstack(*this));
+       return new InsetMathSubstack(*this);
 }
 
 
-bool InsetMathSubstack::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathSubstack::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        if (mi.base.style == LM_ST_DISPLAY) {
                StyleChanger dummy(mi.base, LM_ST_TEXT);
@@ -50,10 +50,6 @@ bool InsetMathSubstack::metrics(MetricsInfo & mi, Dimension & dim) const
        } else {
                InsetMathGrid::metrics(mi, dim);
        }
-       if (dim_ == dim)
-               return false;
-       dim_ = dim;
-       return true;
 }
 
 
@@ -63,17 +59,18 @@ void InsetMathSubstack::draw(PainterInfo & pi, int x, int y) const
 }
 
 
-bool InsetMathSubstack::getStatus(LCursor & cur, FuncRequest const & cmd,
+bool InsetMathSubstack::getStatus(Cursor & cur, FuncRequest const & cmd,
                FuncStatus & flag) const
 {
        switch (cmd.action) {
        case LFUN_TABULAR_FEATURE: {
-               string const name("substack");
+               string const name = "substack";
                docstring const & s = cmd.argument();
                if (s == "add-vline-left" || s == "add-vline-right") {
                        flag.message(bformat(
-                               from_utf8(N_("Can't add vertical grid lines in '%1$s'")), lyx::from_utf8(name)));
-                       flag.enabled(false);
+                               from_utf8(N_("Can't add vertical grid lines in '%1$s'")),
+                               from_utf8(name)));
+                       flag.setEnabled(false);
                        return true;
                }
                return InsetMathGrid::getStatus(cur, cmd, flag);
@@ -92,6 +89,7 @@ void InsetMathSubstack::infoize(odocstream & os) const
 
 void InsetMathSubstack::write(WriteStream & os) const
 {
+       MathEnsurer ensurer(os);
        os << "\\substack{";
        InsetMathGrid::write(os);
        os << "}\n";