]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_symbolinset.C
architectural changes to tex2lyx
[lyx.git] / src / mathed / math_symbolinset.C
index 774366aa03647f84097370fb15215e1c538c70e0..809e25464936f7767aa67635eb58e474c670f171 100644 (file)
@@ -1,20 +1,24 @@
-
 #include <config.h>
 
 #include "math_symbolinset.h"
+#include "dimension.h"
 #include "math_mathmlstream.h"
 #include "math_streamstr.h"
 #include "math_support.h"
 #include "math_parser.h"
+#include "math_atom.h"
 #include "LaTeXFeatures.h"
 #include "debug.h"
 
-MathSymbolInset::MathSymbolInset(const latexkeys * l)
+using std::auto_ptr;
+
+
+MathSymbolInset::MathSymbolInset(latexkeys const * l)
        : sym_(l), h_(0)
 {}
 
 
-MathSymbolInset::MathSymbolInset(const char * name)
+MathSymbolInset::MathSymbolInset(char const * name)
        : sym_(in_word_set(name)), h_(0)
 {}
 
@@ -24,10 +28,9 @@ MathSymbolInset::MathSymbolInset(string const & name)
 {}
 
 
-
-MathInset * MathSymbolInset::clone() const
+auto_ptr<InsetBase> MathSymbolInset::clone() const
 {
-       return new MathSymbolInset(*this);
+       return auto_ptr<InsetBase>(new MathSymbolInset(*this));
 }
 
 
@@ -37,7 +40,7 @@ string MathSymbolInset::name() const
 }
 
 
-void MathSymbolInset::metrics(MetricsInfo & mi) const
+void MathSymbolInset::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        //lyxerr << "metrics: symbol: '" << sym_->name
        //      << "' in font: '" << sym_->inset
@@ -46,18 +49,18 @@ void MathSymbolInset::metrics(MetricsInfo & mi) const
 
        int const em = mathed_char_width(mi.base.font, 'M');
        FontSetChanger dummy(mi.base, sym_->inset.c_str());
-       mathed_string_dim(mi.base.font, sym_->draw, dim_);
+       mathed_string_dim(mi.base.font, sym_->draw, dim);
        // correct height for broken cmex and wasy font
        if (sym_->inset == "cmex" || sym_->inset == "wasy") {
-               h_ = 4 * dim_.d / 5;
-               dim_.a += h_;
-               dim_.d -= h_;
+               h_ = 4 * dim.des / 5;
+               dim.asc += h_;
+               dim.des -= h_;
        }
        // seperate things a bit
        if (isRelOp())
-               dim_.w += static_cast<int>(0.5*em+0.5);
+               dim.wid += static_cast<int>(0.5 * em + 0.5);
        else
-               dim_.w += static_cast<int>(0.1667*em+0.5);
+               dim.wid += static_cast<int>(0.1667 * em + 0.5);
 
        scriptable_ = false;
        if (mi.base.style == LM_ST_DISPLAY)