]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/MathMacroTemplate.cpp
* the old cursor is stored before dispatch and then used after moving
[lyx.git] / src / mathed / MathMacroTemplate.cpp
index 024c5d4f126e5c861eb067e8db325d6500b4d97f..e6e439163bf92d7aef97763e76ef97fb95bdb26c 100644 (file)
 #include "MathParser.h"
 #include "MathSupport.h"
 
+#include "Buffer.h"
 #include "Cursor.h"
 #include "debug.h"
 #include "gettext.h"
 #include "Lexer.h"
-#include "LColor.h"
+#include "Color.h"
 
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
@@ -72,9 +73,9 @@ MathMacroTemplate::MathMacroTemplate(docstring const & str)
 }
 
 
-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));
 }
 
 
@@ -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,10 +154,10 @@ 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
@@ -175,11 +176,11 @@ 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();
 }
@@ -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();