#include "MathParser.h"
#include "MathSupport.h"
-#include "LCursor.h"
+#include "Buffer.h"
+#include "Cursor.h"
#include "debug.h"
#include "gettext.h"
-#include "LyXLex.h"
-#include "LColor.h"
+#include "Lexer.h"
+#include "Color.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
MathMacroTemplate::MathMacroTemplate(docstring const & name, int numargs,
- docstring const & type, MathArray const & ar1, MathArray const & ar2)
+ docstring const & type, MathData const & ar1, MathData const & ar2)
: InsetMathNest(2), numargs_(numargs), name_(name), type_(type)
{
initMath();
{
initMath();
- MathArray ar;
+ MathData ar;
mathed_parse_cell(ar, str);
if (ar.size() != 1 || !ar[0]->asMacroTemplate()) {
lyxerr << "Cannot read macro from '" << ar << "'" << endl;
}
-auto_ptr<InsetBase> MathMacroTemplate::doClone() const
+auto_ptr<Inset> MathMacroTemplate::doClone() const
{
- return auto_ptr<InsetBase>(new MathMacroTemplate(*this));
+ return auto_ptr<Inset>(new MathMacroTemplate(*this));
}
-void MathMacroTemplate::edit(LCursor & cur, bool)
+void MathMacroTemplate::edit(Cursor & cur, bool)
{
//lyxerr << "MathMacroTemplate: edit left/right" << endl;
cur.push(*this);
+ theFontMetrics(mi.base.font).width(dp);
dim.asc = std::max(cell(0).ascent(), cell(1).ascent()) + 7;
dim.des = std::max(cell(0).descent(), cell(1).descent()) + 7;
-
+
if (lockMacro)
MacroTable::globalMacros().get(name_).unlock();
-
+
if (dim_ == dim)
return false;
dim_ = dim;
bool lockMacro = MacroTable::globalMacros().has(name_);
if (lockMacro)
MacroTable::globalMacros().get(name_).lock();
-
+
setPosCache(p, x, y);
// label
- LyXFont font = p.base.font;
- font.setColor(LColor::math);
+ Font font = p.base.font;
+ font.setColor(Color::math);
PainterInfo pi(p.base.bv, p.pain);
pi.base.style = LM_ST_TEXT;
int const w = dim_.wid - 2;
int const h = dim_.height() - 2;
- // LColor::mathbg used to be "AntiqueWhite" but is "linen" now, too
+ // Color::mathbg used to be "AntiqueWhite" but is "linen" now, too
// the next line would overwrite the selection!
- //pi.pain.fillRectangle(x, a, w, h, LColor::mathmacrobg);
- pi.pain.rectangle(x, a, w, h, LColor::mathframe);
+ //pi.pain.fillRectangle(x, a, w, h, Color::mathmacrobg);
+ pi.pain.rectangle(x, a, w, h, Color::mathframe);
#ifdef WITH_WARNINGS
#warning FIXME
#endif
#if 0
- LCursor & cur = p.base.bv->cursor();
+ Cursor & cur = p.base.bv->cursor();
if (cur.isInside(this))
cur.drawSelection(pi);
#endif
int const w1 = cell(1).width();
cell(0).draw(pi, x + 2, y + 1);
pi.pain.rectangle(x, y - dim_.ascent() + 3,
- w0 + 4, dim_.height() - 6, LColor::mathline);
+ w0 + 4, dim_.height() - 6, Color::mathline);
cell(1).draw(pi, x + 8 + w0, y + 1);
pi.pain.rectangle(x + w0 + 6, y - dim_.ascent() + 3,
- w1 + 4, dim_.height() - 6, LColor::mathline);
-
+ w1 + 4, dim_.height() - 6, Color::mathline);
+
if (lockMacro)
MacroTable::globalMacros().get(name_).unlock();
}
-void MathMacroTemplate::read(Buffer const &, LyXLex & lex)
+void MathMacroTemplate::read(Buffer const &, Lexer & lex)
{
- MathArray ar;
+ MathData ar;
mathed_parse_cell(ar, lex.getStream());
if (ar.size() != 1 || !ar[0]->asMacroTemplate()) {
lyxerr << "Cannot read macro from '" << ar << "'" << endl;
}
-int MathMacroTemplate::plaintext(Buffer const &, odocstream & os,
- OutputParams const &) const
+int MathMacroTemplate::plaintext(Buffer const & buf, odocstream & os,
+ OutputParams const &) const
{
- static docstring const str = '[' + _("math macro") + ']';
+ static docstring const str = '[' + buf.B_("math macro") + ']';
os << str;
return str.size();