]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetspecialchar.C
* src/LyXAction.C: mark goto-clear-bookmark as working without buffer
[lyx.git] / src / insets / insetspecialchar.C
index 386fca533aa3c935765810a2b19d21817f555de2..7ed1ea8489cbae9250b301601e10480647e119c3 100644 (file)
@@ -23,7 +23,8 @@
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
 
-using lyx::docstring;
+
+namespace lyx {
 
 using std::string;
 using std::auto_ptr;
@@ -41,9 +42,9 @@ InsetSpecialChar::Kind InsetSpecialChar::kind() const
 }
 
 
-void InsetSpecialChar::metrics(MetricsInfo & mi, Dimension & dim) const
+bool InsetSpecialChar::metrics(MetricsInfo & mi, Dimension & dim) const
 {
-       lyx::frontend::FontMetrics const & fm =
+       frontend::FontMetrics const & fm =
                theFontMetrics(mi.base.font);
        dim.asc = fm.maxAscent();
        dim.des = fm.maxDescent();
@@ -60,7 +61,9 @@ void 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;
 }
 
 
@@ -72,19 +75,19 @@ void InsetSpecialChar::draw(PainterInfo & pi, int x, int y) const
        case HYPHENATION:
        {
                font.setColor(LColor::special);
-               pi.pain.text(x, y, lyx::char_type('-'), font);
+               pi.pain.text(x, y, char_type('-'), font);
                break;
        }
        case LIGATURE_BREAK:
        {
                font.setColor(LColor::special);
-               pi.pain.text(x, y, lyx::char_type('|'), font);
+               pi.pain.text(x, y, char_type('|'), font);
                break;
        }
        case END_OF_SENTENCE:
        {
                font.setColor(LColor::special);
-               pi.pain.text(x, y, lyx::char_type('.'), font);
+               pi.pain.text(x, y, char_type('.'), font);
                break;
        }
        case LDOTS:
@@ -97,13 +100,13 @@ void InsetSpecialChar::draw(PainterInfo & pi, int x, int y) const
        }
        case MENU_SEPARATOR:
        {
-               lyx::frontend::FontMetrics const & fm =
+               frontend::FontMetrics const & fm =
                        theFontMetrics(font);
 
                // A triangle the width and height of an 'x'
-                int w = fm.width(lyx::char_type('x'));
-               int ox = fm.width(lyx::char_type(' ')) + x;
-               int h = fm.ascent(lyx::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];
 
                xp[0] = ox;     yp[0] = y;
@@ -164,7 +167,7 @@ void InsetSpecialChar::read(Buffer const &, LyXLex & lex)
 }
 
 
-int InsetSpecialChar::latex(Buffer const &, ostream & os,
+int InsetSpecialChar::latex(Buffer const &, odocstream & os,
                            OutputParams const &) const
 {
        switch (kind_) {
@@ -188,7 +191,7 @@ int InsetSpecialChar::latex(Buffer const &, ostream & os,
 }
 
 
-int InsetSpecialChar::plaintext(Buffer const &, lyx::odocstream & os,
+int InsetSpecialChar::plaintext(Buffer const &, odocstream & os,
                            OutputParams const &) const
 {
        switch (kind_) {
@@ -209,7 +212,7 @@ int InsetSpecialChar::plaintext(Buffer const &, lyx::odocstream & os,
 }
 
 
-int InsetSpecialChar::docbook(Buffer const &, ostream & os,
+int InsetSpecialChar::docbook(Buffer const &, odocstream & os,
                              OutputParams const &) const
 {
        switch (kind_) {
@@ -230,7 +233,7 @@ int InsetSpecialChar::docbook(Buffer const &, ostream & os,
 }
 
 
-int InsetSpecialChar::textString(Buffer const & buf, lyx::odocstream & os,
+int InsetSpecialChar::textString(Buffer const & buf, odocstream & os,
                       OutputParams const & op) const
 {
        return plaintext(buf, os, op);
@@ -275,3 +278,6 @@ bool InsetSpecialChar::isLineSeparator() const
        return false;
 #endif
 }
+
+
+} // namespace lyx