#include <config.h>
#include "InsetMathMBox.h"
-#include "MathArray.h"
+#include "MathData.h"
#include "MathStream.h"
#include "BufferView.h"
#include "Buffer.h"
#include "BufferParams.h"
-#include "LCursor.h"
-#include "debug.h"
+#include "Cursor.h"
+#include "support/debug.h"
#include "MetricsInfo.h"
#include "output_latex.h"
#include "OutputParams.h"
#include "TexRow.h"
#include "TextMetrics.h"
-namespace lyx {
-
-//using support::odocstream;
+using namespace std;
-using std::auto_ptr;
-using std::endl;
+namespace lyx {
InsetMathMBox::InsetMathMBox()
}
-InsetMathMBox::InsetMathMBox(LyXLayout_ptr const & layout)
+InsetMathMBox::InsetMathMBox(LayoutPtr const & layout)
{
text_.paragraphs().clear();
text_.paragraphs().push_back(Paragraph());
}
-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);
}
ws << "}";
} else {
ws << "\\mbox{\n";
- std::ostringstream os;
+ ostringstream os;
text_.write(buf, os);
ws.os() << from_utf8(os.str());
ws << "}";
}
-void InsetMathMBox::doDispatch(LCursor & cur, FuncRequest & cmd)
+void InsetMathMBox::doDispatch(Cursor & cur, FuncRequest & cmd)
{
text_.dispatch(cur, cmd);
}
-LyXText * InsetMathMBox::getText(int) const
+Text * InsetMathMBox::getText(int) const
{
return &text_;
}
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);
}