]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathBig.cpp
* dynamic macros as described in http://1stein.org/download/dynmacro.pdf
[lyx.git] / src / mathed / InsetMathBig.cpp
index 3c5950b69ced2c96e2a306d2e301df0aba9f4f5b..117127e882ba2c303dfaa453d0b1e72dd3e2bef5 100644 (file)
@@ -22,8 +22,6 @@
 
 namespace lyx {
 
-using std::auto_ptr;
-
 
 InsetMathBig::InsetMathBig(docstring const & name, docstring const & delim)
        : name_(name), delim_(delim)
@@ -36,9 +34,9 @@ docstring InsetMathBig::name() const
 }
 
 
-auto_ptr<Inset> InsetMathBig::doClone() const
+Inset * InsetMathBig::clone() const
 {
-       return auto_ptr<Inset>(new InsetMathBig(*this));
+       return new InsetMathBig(*this);
 }
 
 
@@ -62,29 +60,28 @@ double InsetMathBig::increase() const
 }
 
 
-bool InsetMathBig::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathBig::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        double const h = theFontMetrics(mi.base.font).ascent('I');
        double const f = increase();
        dim.wid = 6;
        dim.asc = int(h + f * h);
        dim.des = int(f * h);
-       if (dim_ == dim)
-               return false;
-       dim_ = dim;
-       return true;
+       // Cache the inset dimension. 
+       setDimCache(mi, dim);
 }
 
 
 void InsetMathBig::draw(PainterInfo & pi, int x, int y) const
 {
+       Dimension const dim = dimension(*pi.base.bv);
        // mathed_draw_deco does not use the leading backslash, so remove it
        // (but don't use ltrim if this is the backslash delimiter).
        // Replace \| by \Vert (equivalent in LaTeX), since mathed_draw_deco
        // would treat it as |.
        docstring const delim = (delim_ == "\\|") ?  from_ascii("Vert") :
                (delim_ == "\\\\") ? from_ascii("\\") : support::ltrim(delim_, "\\");
-       mathed_draw_deco(pi, x + 1, y - dim_.ascent(), 4, dim_.height(),
+       mathed_draw_deco(pi, x + 1, y - dim.ascent(), 4, dim.height(),
                         delim);
        setPosCache(pi, x, y);
 }