]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetSpecialChar.cpp
Fix text frame drawing.
[lyx.git] / src / insets / InsetSpecialChar.cpp
index 361554628d0bf0140ad0cea33e9443886782bbd8..3d0129e88b8658cb8cee02090c4af5437f6e126f 100644 (file)
@@ -16,9 +16,9 @@
 
 #include "debug.h"
 #include "LaTeXFeatures.h"
-#include "LColor.h"
-#include "lyxlex.h"
-#include "metricsinfo.h"
+#include "Color.h"
+#include "Lexer.h"
+#include "MetricsInfo.h"
 
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
@@ -27,7 +27,6 @@
 namespace lyx {
 
 using std::string;
-using std::auto_ptr;
 using std::ostream;
 
 
@@ -57,7 +56,7 @@ bool InsetSpecialChar::metrics(MetricsInfo & mi, Dimension & dim) const
                case MENU_SEPARATOR:      s = " x ";   break;
                case HYPHENATION:      s = "-";   break;
        }
-        docstring ds(s.begin(), s.end());
+       docstring ds(s.begin(), s.end());
        dim.wid = fm.width(ds);
        if (kind_ == HYPHENATION && dim.wid > 5)
                dim.wid -= 2; // to make it look shorter
@@ -69,32 +68,32 @@ bool InsetSpecialChar::metrics(MetricsInfo & mi, Dimension & dim) const
 
 void InsetSpecialChar::draw(PainterInfo & pi, int x, int y) const
 {
-       LyXFont font = pi.base.font;
+       Font font = pi.base.font;
 
        switch (kind_) {
        case HYPHENATION:
        {
-               font.setColor(LColor::special);
+               font.setColor(Color::special);
                pi.pain.text(x, y, char_type('-'), font);
                break;
        }
        case LIGATURE_BREAK:
        {
-               font.setColor(LColor::special);
+               font.setColor(Color::special);
                pi.pain.text(x, y, char_type('|'), font);
                break;
        }
        case END_OF_SENTENCE:
        {
-               font.setColor(LColor::special);
+               font.setColor(Color::special);
                pi.pain.text(x, y, char_type('.'), font);
                break;
        }
        case LDOTS:
        {
-               font.setColor(LColor::special);
-                string ell = ". . . ";
-                docstring dell(ell.begin(), ell.end());
+               font.setColor(Color::special);
+               string ell = ". . . ";
+               docstring dell(ell.begin(), ell.end());
                pi.pain.text(x, y, dell, font);
                break;
        }
@@ -104,7 +103,7 @@ void InsetSpecialChar::draw(PainterInfo & pi, int x, int y) const
                        theFontMetrics(font);
 
                // A triangle the width and height of an 'x'
-                int w = fm.width(char_type('x'));
+               int w = fm.width(char_type('x'));
                int ox = fm.width(char_type(' ')) + x;
                int h = fm.ascent(char_type('x'));
                int xp[4], yp[4];
@@ -114,7 +113,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, LColor::special);
+               pi.pain.lines(xp, yp, 4, Color::special);
                break;
        }
        }
@@ -147,7 +146,7 @@ void InsetSpecialChar::write(Buffer const &, ostream & os) const
 
 
 // This function will not be necessary when lyx3
-void InsetSpecialChar::read(Buffer const &, LyXLex & lex)
+void InsetSpecialChar::read(Buffer const &, Lexer & lex)
 {
        lex.next();
        string const command = lex.getString();
@@ -192,7 +191,7 @@ int InsetSpecialChar::latex(Buffer const &, odocstream & os,
 
 
 int InsetSpecialChar::plaintext(Buffer const &, odocstream & os,
-                                OutputParams const &) const
+                               OutputParams const &) const
 {
        switch (kind_) {
        case HYPHENATION:
@@ -213,7 +212,7 @@ int InsetSpecialChar::plaintext(Buffer const &, odocstream & os,
 
 
 int InsetSpecialChar::docbook(Buffer const &, odocstream & os,
-                              OutputParams const &) const
+                             OutputParams const &) const
 {
        switch (kind_) {
        case HYPHENATION:
@@ -240,17 +239,16 @@ int InsetSpecialChar::textString(Buffer const & buf, odocstream & os,
 }
 
 
-auto_ptr<InsetBase> InsetSpecialChar::doClone() const
+Inset * InsetSpecialChar::clone() const
 {
-       return auto_ptr<InsetBase>(new InsetSpecialChar(kind_));
+       return new InsetSpecialChar(kind_);
 }
 
 
 void InsetSpecialChar::validate(LaTeXFeatures & features) const
 {
-       if (kind_ == MENU_SEPARATOR) {
+       if (kind_ == MENU_SEPARATOR)
                features.require("lyxarrow");
-       }
 }