#include <config.h>
+#include "BufferView.h"
+#include "LColor.h"
#include "metricsinfo.h"
+
#include "mathed/math_support.h"
+
#include "frontends/Painter.h"
-#include "BufferView.h"
+#include <boost/assert.hpp>
+
+using std::string;
MetricsBase::MetricsBase()
{}
-
MetricsBase::MetricsBase(BufferView * b, LyXFont const & f, int w)
: bv(b), font(f), style(LM_ST_TEXT), fontname("mathnormal"),
textwidth(w)
-PainterInfo::PainterInfo(BufferView * bv)
- : pain(bv->painter())
+PainterInfo::PainterInfo(BufferView * bv, Painter & painter)
+ : pain(painter), ltr_pos(false)
{
base.bv = bv;
}
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)
: Changer<MetricsBase>(mb)
{
save_ = mb;
+ LyXFont::FONT_SIZE oldsize = save_.font.size();
mb.fontname = name;
+ mb.font = LyXFont();
augmentFont(mb.font, name);
+ mb.font.setSize(oldsize);
}
+
FontSetChanger::~FontSetChanger()
{
orig_ = save_;
: Changer<MetricsBase>(mb)
{
save_ = mb;
- mb.textwidth = w;
+ mb.textwidth = w;
}
{
orig_ = save_;
}
+
+
+
+
+ColorChanger::ColorChanger(LyXFont & font, string const & color)
+ : Changer<LyXFont, string>(font)
+{
+ save_ = lcolor.getFromLyXName(color);
+ font.setColor(lcolor.getFromLyXName(color));
+}
+
+
+ColorChanger::~ColorChanger()
+{
+ orig_.setColor(lcolor.getFromLyXName(save_));
+}