X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FMathMacroTemplate.cpp;h=e6e439163bf92d7aef97763e76ef97fb95bdb26c;hb=98fb638d61d38df1443339de4e8ba58c7c81784a;hp=1c21beb5c6be22a8bdd31eba1a272fdb654e31fd;hpb=00e305c9d9bd8b0ff54b6c58adb6192d5934ed60;p=lyx.git diff --git a/src/mathed/MathMacroTemplate.cpp b/src/mathed/MathMacroTemplate.cpp index 1c21beb5c6..e6e439163b 100644 --- a/src/mathed/MathMacroTemplate.cpp +++ b/src/mathed/MathMacroTemplate.cpp @@ -15,11 +15,12 @@ #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" @@ -44,7 +45,7 @@ MathMacroTemplate::MathMacroTemplate() 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(); @@ -62,7 +63,7 @@ MathMacroTemplate::MathMacroTemplate(docstring const & str) { initMath(); - MathArray ar; + MathData ar; mathed_parse_cell(ar, str); if (ar.size() != 1 || !ar[0]->asMacroTemplate()) { lyxerr << "Cannot read macro from '" << ar << "'" << endl; @@ -72,13 +73,13 @@ MathMacroTemplate::MathMacroTemplate(docstring const & str) } -auto_ptr MathMacroTemplate::doClone() const +auto_ptr MathMacroTemplate::doClone() const { - return auto_ptr(new MathMacroTemplate(*this)); + return auto_ptr(new MathMacroTemplate(*this)); } -void MathMacroTemplate::edit(LCursor & cur, bool) +void MathMacroTemplate::edit(Cursor & cur, bool) { //lyxerr << "MathMacroTemplate: edit left/right" << endl; cur.push(*this); @@ -122,10 +123,10 @@ bool MathMacroTemplate::metrics(MetricsInfo & mi, Dimension & dim) const + 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; @@ -138,12 +139,12 @@ void MathMacroTemplate::draw(PainterInfo & p, int x, int y) const 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; @@ -153,16 +154,16 @@ void MathMacroTemplate::draw(PainterInfo & p, int x, int y) const 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 @@ -175,19 +176,19 @@ void MathMacroTemplate::draw(PainterInfo & p, int x, int y) const 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; @@ -234,10 +235,10 @@ void MathMacroTemplate::write(WriteStream & os) const } -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();