Pavel Sanda 2013-06-03 00:10:26 -07:00
parent 8c50965692
commit 63c193afef
4 changed files with 0 additions and 215 deletions

View File

@ -1,132 +0,0 @@
/**
* \file InsetMathMBox.cpp
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author André Pönitz
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "InsetMathMBox.h"
#include "MathData.h"
#include "MathStream.h"
#include "BufferView.h"
#include "Buffer.h"
#include "BufferParams.h"
#include "Cursor.h"
#include "MetricsInfo.h"
#include "output_latex.h"
#include "OutputParams.h"
#include "Paragraph.h"
#include "TexRow.h"
#include "TextMetrics.h"
#include "support/debug.h"
using namespace std;
namespace lyx {
InsetMathMBox::InsetMathMBox(Buffer * buffer) : InsetMath(buffer), text_(buffer)
{
text_.paragraphs().clear();
text_.paragraphs().push_back(Paragraph());
}
InsetMathMBox::InsetMathMBox(Buffer * buffer, Layout const & layout)
: InsetMath(buffer), text_(buffer)
{
text_.paragraphs().clear();
text_.paragraphs().push_back(Paragraph());
text_.paragraphs().back().setLayout(layout);
}
Inset * InsetMathMBox::clone() const
{
return new InsetMathMBox(*this);
}
void InsetMathMBox::metrics(MetricsInfo & mi, Dimension & dim) const
{
TextMetrics & tm = mi.base.bv->textMetrics(&text_.text());
tm.metrics(mi, dim);
metricsMarkers2(dim);
}
void InsetMathMBox::draw(PainterInfo & pi, int x, int y) const
{
pi.base.bv->textMetrics(&text_.text()).draw(pi, x + 1, y);
drawMarkers(pi, x, y);
}
void InsetMathMBox::write(WriteStream & ws) const
{
if (ws.latex()) {
ws << "\\mbox{\n";
TexRow texrow;
OutputParams runparams(&buffer().params().encoding());
otexstream os(ws.os(), texrow);
latexParagraphs(buffer(), text_.text(), os, runparams);
ws.addlines(texrow.rows());
ws << "}";
} else {
ws << "\\mbox{\n";
ostringstream os;
text_.text().write(os);
ws.os() << from_utf8(os.str());
ws << "}";
}
}
void InsetMathMBox::latex(otexstream & os, OutputParams const & runparams) const
{
os << "\\mbox{\n";
latexParagraphs(buffer(), text_.text(), os, runparams);
os << "}";
}
void InsetMathMBox::doDispatch(Cursor & cur, FuncRequest & cmd)
{
text_.text().dispatch(cur, cmd);
}
Text * InsetMathMBox::getText(int) const
{
return &text_.text();
}
void InsetMathMBox::cursorPos(BufferView const & bv,
CursorSlice const & sl, bool boundary, int & x, int & y) const
{
x = bv.textMetrics(&text_.text()).cursorX(sl, boundary);
y = bv.textMetrics(&text_.text()).cursorY(sl, boundary);
}
void InsetMathMBox::mathmlize(MathStream & ms) const
{
SetMode textmode(ms, true);
ms << cell(0);
}
void InsetMathMBox::htmlize(HtmlStream & ms) const
{
SetHTMLMode textmode(ms, true);
ms << cell(0);
}
} // namespace lyx

View File

@ -1,78 +0,0 @@
// -*- C++ -*-
/**
* \file InsetMathMBox.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author André Pönitz
*
* Full author contact details are available in file CREDITS.
*/
#define MATH_MBOX
#ifdef MATH_MBOX
#ifndef MATH_MBOXINSET_H
#define MATH_MBOXINSET_H
#include "InsetMath.h"
#include "insets/InsetText.h"
namespace lyx {
class Buffer;
class BufferView;
// almost a substitute for the real text inset...
class InsetMathMBox : public InsetMath {
public:
///
explicit InsetMathMBox(Buffer * buffer);
explicit InsetMathMBox(Buffer * buffer, Layout const & layout);
/// this stores metrics information in cache_
void metrics(MetricsInfo & mi, Dimension & dim) const;
/// draw according to cached metrics
void draw(PainterInfo &, int x, int y) const;
///
bool inMathed() const { return false; }
///
bool isActive() const { return true; }
///
void write(WriteStream & os) const;
///
void latex(otexstream & os, OutputParams const & runparams) const;
///
void mathmlize(MathStream &) const;
///
void htmlize(HtmlStream &) const;
///
Text * getText(int) const;
///
void cursorPos(BufferView const & bv, CursorSlice const & sl,
bool boundary, int & x, int & y) const;
///
InsetCode lyxCode() const { return MATH_MBOX_CODE; }
protected:
virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
///
mutable InsetText text_;
private:
virtual Inset * clone() const;
};
} // namespace lyx
#endif //MATH_MBOXINSET_H
#endif //MATH_MBOX

View File

@ -1004,7 +1004,6 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
cur.macroModeClose();
docstring const save_selection = grabAndEraseSelection(cur);
selClearOrDel(cur);
//cur.plainInsert(MathAtom(new InsetMathMBox(cur.bv())));
if (currentMode() <= Inset::TEXT_MODE)
cur.plainInsert(MathAtom(new InsetMathEnsureMath(buffer_)));
else

View File

@ -356,10 +356,6 @@ MathAtom createInsetMath(docstring const & s, Buffer * buf)
if (inset == "dots")
return MathAtom(new InsetMathDots(l));
if (inset == "mbox")
// return MathAtom(new InsetMathMBox);
// InsetMathMBox is proposed to replace InsetMathBox,
// but is not ready yet (it needs a BufferView for
// construction)
return MathAtom(new InsetMathBox(buf, l->name));
// if (inset == "fbox")
// return MathAtom(new InsetMathFBox(l));