]> git.lyx.org Git - lyx.git/blobdiff - src/metricsinfo.C
ws changes only
[lyx.git] / src / metricsinfo.C
index 1a66b53eb014d1bc1e0017416897bb214374a156..7307defd4f5575ce7c001634a7404249c05cedb5 100644 (file)
@@ -1,26 +1,46 @@
+/**
+ * \file metricsinfo.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author André Pönitz
+ *
+ * Full author contact details are available in file CREDITS.
+ */
 
 #include <config.h>
 
 #include "metricsinfo.h"
 #include "mathed/math_support.h"
 #include "frontends/Painter.h"
-#include "debug.h"
 #include "BufferView.h"
+#include "LColor.h"
 
+using std::string;
 
 
 MetricsBase::MetricsBase()
        : bv(0), font(), style(LM_ST_TEXT), fontname("mathnormal"),
-         restrictwidth(false), textwidth(0)
+         textwidth(0)
 {}
 
 
 
+MetricsBase::MetricsBase(BufferView * b, LyXFont const & f, int w)
+       : bv(b), font(f), style(LM_ST_TEXT), fontname("mathnormal"),
+         textwidth(w)
+{}
+
+
 
 MetricsInfo::MetricsInfo()
 {}
 
 
+MetricsInfo::MetricsInfo(BufferView * bv, LyXFont const & font, int textwidth)
+       : base(bv, font, textwidth)
+{}
+
 
 
 PainterInfo::PainterInfo(BufferView * bv)
@@ -126,9 +146,11 @@ FontSetChanger::FontSetChanger(MetricsBase & mb, char const * name)
 {
        save_ = mb;
        mb.fontname = name;
+       mb.font = LyXFont();
        augmentFont(mb.font, name);
 }
 
+
 FontSetChanger::~FontSetChanger()
 {
        orig_ = save_;
@@ -139,7 +161,6 @@ WidthChanger::WidthChanger(MetricsBase & mb, int w)
        :       Changer<MetricsBase>(mb)
 {
        save_ = mb;
-       mb.restrictwidth = true;
        mb.textwidth     = w;
 }
 
@@ -148,3 +169,19 @@ WidthChanger::~WidthChanger()
 {
        orig_ = save_;
 }
+
+
+
+
+ColorChanger::ColorChanger(LyXFont & font, string const & color)
+       : Changer<LyXFont, string>(font)
+{
+       save_ = lcolor.getFromGUIName(color);
+       font.setColor(lcolor.getFromGUIName(color));
+}
+
+
+ColorChanger::~ColorChanger()
+{
+       orig_.setColor(lcolor.getFromGUIName(save_));
+}