]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_scriptinset.C
architectural changes to tex2lyx
[lyx.git] / src / mathed / math_scriptinset.C
index c59bf351e4ed1afde202b7390f4dc1c8cea90572..bd054206ae745b1b3486979b1794e925812581a4 100644 (file)
@@ -1,3 +1,4 @@
+#include <config.h>
 
 #include "math_scriptinset.h"
 #include "math_support.h"
@@ -7,8 +8,11 @@
 #include "support/LAssert.h"
 #include "debug.h"
 
+using namespace lyx::support;
 
 using std::max;
+using std::auto_ptr;
+using std::endl;
 
 
 MathScriptInset::MathScriptInset()
@@ -37,9 +41,9 @@ MathScriptInset::MathScriptInset(MathAtom const & at, bool up)
 
 
 
-MathInset * MathScriptInset::clone() const
+auto_ptr<InsetBase> MathScriptInset::clone() const
 {
-       return new MathScriptInset(*this);
+       return auto_ptr<InsetBase>(new MathScriptInset(*this));
 }
 
 
@@ -144,14 +148,14 @@ int MathScriptInset::dy1() const
 
 int MathScriptInset::dx0() const
 {
-       lyx::Assert(hasDown());
+       Assert(hasDown());
        return hasLimits() ? (dim_.wid - down().width()) / 2 : nwid();
 }
 
 
 int MathScriptInset::dx1() const
 {
-       lyx::Assert(hasUp());
+       Assert(hasUp());
        return hasLimits() ? (dim_.wid - up().width()) / 2 : nwid();
 }
 
@@ -180,7 +184,7 @@ int MathScriptInset::ndes() const
 }
 
 
-Dimension MathScriptInset::metrics(MetricsInfo & mi) const
+void MathScriptInset::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        cell(2).metrics(mi);
        ScriptChanger dummy(mi.base);
@@ -203,7 +207,7 @@ Dimension MathScriptInset::metrics(MetricsInfo & mi) const
        dim_.asc = dy1() + (hasUp() ? up().ascent() : 0);
        dim_.des = dy0() + (hasDown() ? down().descent() : 0);
        metricsMarkers();
-       return dim_;
+       dim = dim_;
 }
 
 
@@ -358,7 +362,8 @@ void MathScriptInset::write(WriteStream & os) const
                //}
        } else {
                if (os.firstitem())
-                       lyxerr[Debug::MATHED] << "suppressing {} when writing\n";
+                       lyxerr[Debug::MATHED] << "suppressing {} when writing"
+                                             << endl;
                else
                        os << "{}";
        }