]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_symbolinset.C
Andreas' patch to prevent crash on click on previewd inset
[lyx.git] / src / mathed / math_symbolinset.C
index 6657899b3f06c6fd5aaff51b3715bf9c9150a6f6..523d0727704172dfe3649de535538f584373325e 100644 (file)
@@ -40,7 +40,7 @@ MathSymbolInset::MathSymbolInset(string const & name)
 {}
 
 
-auto_ptr<InsetBase> MathSymbolInset::clone() const
+auto_ptr<InsetBase> MathSymbolInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathSymbolInset(*this));
 }
@@ -91,6 +91,8 @@ void MathSymbolInset::metrics(MetricsInfo & mi, Dimension & dim) const
        if (mi.base.style == LM_ST_DISPLAY)
                if (sym_->inset == "cmex" || sym_->extra == "funclim")
                        scriptable_ = true;
+
+       width_ = dim.wid;
 }
 
 
@@ -107,7 +109,7 @@ void MathSymbolInset::draw(PainterInfo & pi, int x, int y) const
                x += static_cast<int>(0.0833*em+0.5);
 
        FontSetChanger dummy(pi.base, sym_->inset.c_str());
-       drawStr(pi, pi.base.font, x, y - h_, sym_->draw);
+       pi.draw(x, y - h_, sym_->draw);
 }
 
 
@@ -134,8 +136,8 @@ bool MathSymbolInset::takesLimits() const
 
 void MathSymbolInset::validate(LaTeXFeatures & features) const
 {
-       if (sym_->inset == "msa" || sym_->inset == "msb")
-               features.require("amssymb");
+       if (!sym_->requires.empty())
+               features.require(sym_->requires);
 }
 
 
@@ -182,13 +184,6 @@ char const * MathMLtype(string const & s)
 }
 
 
-bool MathSymbolInset::match(MathAtom const & at) const
-{
-       MathSymbolInset const * q = at->asSymbolInset();
-       return q && name() == q->name();
-}
-
-
 void MathSymbolInset::mathmlize(MathMLStream & os) const
 {
        char const * type = MathMLtype(sym_->extra);