]> git.lyx.org Git - lyx.git/blobdiff - src/metricsinfo.C
move everything into namespace lyx
[lyx.git] / src / metricsinfo.C
index 9e50cd0683bedbecff2e46d2e87e171806a8c206..ccd72404c3b6714659992d7522244fc26a8040d5 100644 (file)
 
 #include <config.h>
 
-#include "metricsinfo.h"
-#include "mathed/math_support.h"
-#include "frontends/Painter.h"
 #include "BufferView.h"
 #include "LColor.h"
+#include "metricsinfo.h"
+
+#include "mathed/MathSupport.h"
+
+#include "frontends/Painter.h"
+
+#include <boost/assert.hpp>
+
+
+namespace lyx {
 
 using std::string;
 
@@ -25,7 +32,6 @@ MetricsBase::MetricsBase()
 {}
 
 
-
 MetricsBase::MetricsBase(BufferView * b, LyXFont const & f, int w)
        : bv(b), font(f), style(LM_ST_TEXT), fontname("mathnormal"),
          textwidth(w)
@@ -43,19 +49,25 @@ MetricsInfo::MetricsInfo(BufferView * bv, LyXFont const & font, int textwidth)
 
 
 
-PainterInfo::PainterInfo(BufferView * bv)
-       : pain(bv->painter())
+PainterInfo::PainterInfo(BufferView * bv, lyx::frontend::Painter & painter)
+       : pain(painter), ltr_pos(false), erased_(false)
 {
        base.bv = bv;
 }
 
 
-void PainterInfo::draw(int x, int y, char c)
+void PainterInfo::draw(int x, int y, char_type c)
 {
        pain.text(x, y, c, base.font);
 }
 
 
+void PainterInfo::draw(int x, int y, docstring const & str)
+{
+       pain.text(x, y, str, base.font);
+}
+
+
 Styles smallerScriptStyle(Styles st)
 {
        switch (st) {
@@ -101,6 +113,7 @@ ArrayChanger::ArrayChanger(MetricsBase & mb)
 {}
 
 
+
 ShapeChanger::ShapeChanger(LyXFont & font, LyXFont::FONT_SHAPE shape)
        : Changer<LyXFont, LyXFont::FONT_SHAPE>(font)
 {
@@ -108,6 +121,7 @@ ShapeChanger::ShapeChanger(LyXFont & font, LyXFont::FONT_SHAPE shape)
        orig_.setShape(shape);
 }
 
+
 ShapeChanger::~ShapeChanger()
 {
        orig_.setShape(save_);
@@ -118,10 +132,11 @@ ShapeChanger::~ShapeChanger()
 StyleChanger::StyleChanger(MetricsBase & mb, Styles style)
        :       Changer<MetricsBase>(mb)
 {
-       static const int diff[4][4]  = { { 0, 0, -3, -5 },
-                                        { 0, 0, -3, -5 },
-                                        { 3, 3,  0, -2 },
-                                        { 5, 5,  2,  0 } };
+       static const int diff[4][4] =
+               { { 0, 0, -3, -5 },
+                 { 0, 0, -3, -5 },
+                 { 3, 3,  0, -2 },
+                 { 5, 5,  2,  0 } };
        save_ = mb;
        int t = diff[mb.style][style];
        if (t > 0)
@@ -187,3 +202,6 @@ ColorChanger::~ColorChanger()
 {
        orig_.setColor(lcolor.getFromLyXName(save_));
 }
+
+
+} // namespace lyx