X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finsetspecialchar.C;h=7ed1ea8489cbae9250b301601e10480647e119c3;hb=e28331ed63062dea10d0a21b9ec12034b4b17b9a;hp=af4f8176b0bc36f1a51d905696947ef5963901f3;hpb=0d449056ef9ace3ef737e4b9aba8d3994615dc18;p=lyx.git diff --git a/src/insets/insetspecialchar.C b/src/insets/insetspecialchar.C index af4f8176b0..7ed1ea8489 100644 --- a/src/insets/insetspecialchar.C +++ b/src/insets/insetspecialchar.C @@ -23,8 +23,8 @@ #include "frontends/FontMetrics.h" #include "frontends/Painter.h" -using lyx::docstring; -using lyx::odocstream; + +namespace lyx { using std::string; using std::auto_ptr; @@ -42,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(); @@ -61,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; } @@ -73,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: @@ -98,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; @@ -276,3 +278,6 @@ bool InsetSpecialChar::isLineSeparator() const return false; #endif } + + +} // namespace lyx