]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetFormulaMacro.C
cursor is no more damaging the background. L-shaped cursor is broken right now....
[lyx.git] / src / mathed / InsetFormulaMacro.C
index 4544151305ef600cc72bf01345b5eae752966192..26cefd2f0e0e87d75a6f0a7290f3e869b4178bf7 100644 (file)
@@ -14,7 +14,6 @@
 #include "InsetFormulaMacro.h"
 #include "MathMacroTable.h"
 #include "MathMacroTemplate.h"
-#include "MathMLStream.h"
 
 #include "BufferView.h"
 #include "cursor.h"
 #include "lyxlex.h"
 #include "outputparams.h"
 
+#include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
-#include "frontends/font_metrics.h"
 
 #include "support/lstrings.h"
 
 #include <sstream>
 
-using lyx::support::bformat;
+
+namespace lyx {
+
+using odocstream;
+using support::bformat;
 
 using std::string;
 using std::auto_ptr;
@@ -75,7 +78,7 @@ void InsetFormulaMacro::write(Buffer const &, ostream & os) const
 }
 
 
-int InsetFormulaMacro::latex(Buffer const &, ostream & os,
+int InsetFormulaMacro::latex(Buffer const &, odocstream & os,
                             OutputParams const & runparams) const
 {
        //lyxerr << "InsetFormulaMacro::latex" << endl;
@@ -85,7 +88,7 @@ int InsetFormulaMacro::latex(Buffer const &, ostream & os,
 }
 
 
-int InsetFormulaMacro::plaintext(Buffer const &, ostream & os,
+int InsetFormulaMacro::plaintext(Buffer const &, odocstream & os,
                             OutputParams const &) const
 {
        WriteStream wi(os, false, true);
@@ -117,7 +120,7 @@ void InsetFormulaMacro::read(std::istream & is)
 
 string InsetFormulaMacro::prefix() const
 {
-       return lyx::to_utf8(bformat(_(" Macro: %1$s: "), lyx::from_utf8(name_)));
+       return to_utf8(bformat(_(" Macro: %1$s: "), lyx::from_utf8(name_)));
 }
 
 
@@ -127,7 +130,7 @@ void InsetFormulaMacro::metrics(MetricsInfo & mi, Dimension & dim) const
        tmpl()->metrics(mi, dim);
        dim.asc += 5;
        dim.des += 5;
-       dim.wid += 10 + font_metrics::width(prefix(), mi.base.font);
+       dim.wid += 10 + theFontMetrics(mi.base.font).width(prefix());
        dim_ = dim;
 }
 
@@ -162,7 +165,9 @@ void InsetFormulaMacro::draw(PainterInfo & p, int x, int y) const
        pi.pain.text(x + 2, y, prefix(), font);
 
        // body
-       tmpl()->draw(pi, x + font_metrics::width(prefix(), p.base.font) + 5, y);
+       tmpl()->draw(pi,
+               x + theFontMetrics(p.base.font).width(prefix()) + 5,
+               y);
 
        setPosCache(pi, x, y);
 }
@@ -172,3 +177,6 @@ MathAtom & InsetFormulaMacro::tmpl() const
 {
        return MathMacroTable::provide(name_);
 }
+
+
+} // namespace lyx