]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathMBox.cpp
* dynamic macros as described in http://1stein.org/download/dynmacro.pdf
[lyx.git] / src / mathed / InsetMathMBox.cpp
index bdc95de8d6c95b8a14525cb671e3aa64f179ac49..90b152f9c18d8b8bec4dd1103e3fe4b079fd9b16 100644 (file)
 #include "TexRow.h"
 #include "TextMetrics.h"
 
-namespace lyx {
 
-//using support::odocstream;
+namespace lyx {
 
-using std::auto_ptr;
 using std::endl;
 
 
@@ -41,7 +39,7 @@ InsetMathMBox::InsetMathMBox()
 }
 
 
-InsetMathMBox::InsetMathMBox(LyXLayout_ptr const & layout)
+InsetMathMBox::InsetMathMBox(LayoutPtr const & layout)
 {
        text_.paragraphs().clear();
        text_.paragraphs().push_back(Paragraph());
@@ -49,27 +47,23 @@ InsetMathMBox::InsetMathMBox(LyXLayout_ptr const & layout)
 }
 
 
-auto_ptr<InsetBase> InsetMathMBox::doClone() const
+Inset * InsetMathMBox::clone() const
 {
-       return auto_ptr<InsetBase>(new InsetMathMBox(*this));
+       return new InsetMathMBox(*this);
 }
 
 
-bool InsetMathMBox::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathMBox::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        TextMetrics & tm = mi.base.bv->textMetrics(&text_);
        tm.metrics(mi, dim);
        metricsMarkers2(dim);
-       if (dim_ == dim)
-               return false;
-       dim_ = dim;
-       return true;
 }
 
 
 void InsetMathMBox::draw(PainterInfo & pi, int x, int y) const
 {
-       text_.draw(pi, x + 1, y);
+       pi.base.bv->textMetrics(&text_).draw(pi, x + 1, y);
        drawMarkers(pi, x, y);
 }
 
@@ -110,7 +104,7 @@ void InsetMathMBox::doDispatch(Cursor & cur, FuncRequest & cmd)
 }
 
 
-LyXText * InsetMathMBox::getText(int) const
+Text * InsetMathMBox::getText(int) const
 {
        return &text_;
 }
@@ -119,14 +113,8 @@ LyXText * InsetMathMBox::getText(int) const
 void InsetMathMBox::cursorPos(BufferView const & bv,
                CursorSlice const & sl, bool boundary, int & x, int & y) const
 {
-       x = text_.cursorX(bv, sl, boundary);
-       y = text_.cursorY(bv, sl, boundary);
-}
-
-
-void InsetMathMBox::drawSelection(PainterInfo & pi, int x, int y) const
-{
-       text_.drawSelection(pi, x, y);
+       x = bv.textMetrics(&text_).cursorX(sl, boundary);
+       y = bv.textMetrics(&text_).cursorY(sl, boundary);
 }