]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetSpecialChar.cpp
pimpl not needed here
[lyx.git] / src / insets / InsetSpecialChar.cpp
index 178034136d3bd5819e5c39d2910608bda1aa0ea0..ad5a8f33ee0eb4f64346a68f5831910989b5b17a 100644 (file)
@@ -15,8 +15,8 @@
 #include "InsetSpecialChar.h"
 
 #include "debug.h"
+#include "Dimension.h"
 #include "LaTeXFeatures.h"
-#include "Color.h"
 #include "Lexer.h"
 #include "MetricsInfo.h"
 
@@ -27,7 +27,6 @@
 namespace lyx {
 
 using std::string;
-using std::auto_ptr;
 using std::ostream;
 
 
@@ -42,7 +41,7 @@ InsetSpecialChar::Kind InsetSpecialChar::kind() const
 }
 
 
-bool InsetSpecialChar::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetSpecialChar::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        frontend::FontMetrics const & fm =
                theFontMetrics(mi.base.font);
@@ -61,38 +60,37 @@ bool InsetSpecialChar::metrics(MetricsInfo & mi, Dimension & dim) const
        dim.wid = fm.width(ds);
        if (kind_ == HYPHENATION && dim.wid > 5)
                dim.wid -= 2; // to make it look shorter
-       bool const changed = dim_ != dim;
-       dim_ = dim;
-       return changed;
+       
+       setDimCache(mi, dim);
 }
 
 
 void InsetSpecialChar::draw(PainterInfo & pi, int x, int y) const
 {
-       Font font = pi.base.font;
+       FontInfo font = pi.base.font;
 
        switch (kind_) {
        case HYPHENATION:
        {
-               font.setColor(Color::special);
+               font.setColor(Color_special);
                pi.pain.text(x, y, char_type('-'), font);
                break;
        }
        case LIGATURE_BREAK:
        {
-               font.setColor(Color::special);
+               font.setColor(Color_special);
                pi.pain.text(x, y, char_type('|'), font);
                break;
        }
        case END_OF_SENTENCE:
        {
-               font.setColor(Color::special);
+               font.setColor(Color_special);
                pi.pain.text(x, y, char_type('.'), font);
                break;
        }
        case LDOTS:
        {
-               font.setColor(Color::special);
+               font.setColor(Color_special);
                string ell = ". . . ";
                docstring dell(ell.begin(), ell.end());
                pi.pain.text(x, y, dell, font);
@@ -114,7 +112,7 @@ void InsetSpecialChar::draw(PainterInfo & pi, int x, int y) const
                xp[2] = ox + w; yp[2] = y - h/2;
                xp[3] = ox;     yp[3] = y;
 
-               pi.pain.lines(xp, yp, 4, Color::special);
+               pi.pain.lines(xp, yp, 4, Color_special);
                break;
        }
        }
@@ -240,17 +238,16 @@ int InsetSpecialChar::textString(Buffer const & buf, odocstream & os,
 }
 
 
-auto_ptr<Inset> InsetSpecialChar::doClone() const
+Inset * InsetSpecialChar::clone() const
 {
-       return auto_ptr<Inset>(new InsetSpecialChar(kind_));
+       return new InsetSpecialChar(kind_);
 }
 
 
 void InsetSpecialChar::validate(LaTeXFeatures & features) const
 {
-       if (kind_ == MENU_SEPARATOR) {
+       if (kind_ == MENU_SEPARATOR)
                features.require("lyxarrow");
-       }
 }