]> git.lyx.org Git - lyx.git/commitdiff
Get rid of SEPARATOR row element type
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 21 Jul 2015 07:51:06 +0000 (09:51 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 21 Jul 2015 07:51:52 +0000 (09:51 +0200)
It is not used anymore.

Also get rid of a comment made irrelevant by recent changes.

src/Row.cpp
src/Row.h
src/RowPainter.cpp

index 1bd11c97cd41aacb9749e603bc6c88991cc395cb..0974265328e9158df888f629bea47f7656218ab0 100644 (file)
@@ -87,7 +87,6 @@ pos_type Row::Element::x2pos(int &x) const
                i = 0;
                x = rtl ? int(full_width()) : 0;
                break;
-       case SEPARATOR:
        case INSET:
        case SPACE:
                // those elements contain only one position. Round to
@@ -233,9 +232,6 @@ ostream & operator<<(ostream & os, Row::Element const & e)
        case Row::INSET:
                os << "INSET: " << to_utf8(e.inset->layoutName()) << ", ";
                break;
-       case Row::SEPARATOR:
-               os << "SEPARATOR: extra=" << e.extra << ", ";
-               break;
        case Row::SPACE:
                os << "SPACE: ";
                break;
@@ -360,18 +356,6 @@ void Row::addVirtual(pos_type const pos, docstring const & s,
 }
 
 
-void Row::addSeparator(pos_type const pos, char_type const c,
-                      Font const & f, Change const & ch)
-{
-       finalizeLast();
-       Element e(SEPARATOR, pos, f, ch);
-       e.str += c;
-       e.dim.wid = theFontMetrics(f).width(c);
-       elements_.push_back(e);
-       dim_.wid += e.dim.wid;
-}
-
-
 void Row::addSpace(pos_type const pos, int const width,
                   Font const & f, Change const & ch)
 {
index 77dcbb5f75c984adb02f62130dab44e73efc3578..92521ef4baa9ffb8a9e3ffed346cfb560c71c293 100644 (file)
--- a/src/Row.h
+++ b/src/Row.h
@@ -29,18 +29,6 @@ namespace lyx {
 class DocIterator;
 class Inset;
 
-/**
- * FIXME: Change Row object to operate only on integers and not doubles.
- *
- * This use of double is only useful to distribute the extra
- * horizontal space between separators in justified text. If we do
- * integer arithmetic, then it is possible to have two groups of
- * separators, with size s or s+1. Then strings can be drawn without
- * cutting at separators in justfied text, as it is done in
- * non-justified text. This will improve performance.
- */
-
-
 /**
  * An on-screen row of text. A paragraph is broken into a RowList for
  * display. Each Row contains a tokenized description of the contents
@@ -58,8 +46,6 @@ public:
                 * correspond to any paragraph contents
                 */
                VIRTUAL,
-               // A stretchable space, basically
-               SEPARATOR,
                // An inset
                INSET,
                // Some spacing described by its width, not a string
@@ -114,10 +100,10 @@ public:
                // Non-zero only if element is an inset
                Inset const * inset;
 
-               // Only non-null for separator elements
+               // Only non-null for justified rows
                double extra;
 
-               // Non-empty if element is a string or separator
+               // Non-empty if element is a string or is virtual
                docstring str;
                //
                Font font;
@@ -192,9 +178,6 @@ public:
        void addVirtual(pos_type pos, docstring const & s,
                        Font const & f, Change const & ch);
        ///
-       void addSeparator(pos_type pos, char_type const c,
-                         Font const & f, Change const & ch);
-       ///
        void addSpace(pos_type pos, int width, Font const & f, Change const & ch);
 
        ///
@@ -249,7 +232,7 @@ public:
 
        friend std::ostream & operator<<(std::ostream & os, Row const & row);
 
-       /// width of a separator (i.e. space)
+       /// additional width for separators in justified rows (i.e. space)
        double separator;
        /// width of hfills in the label
        double label_hfill;
index b8f91896004c8d414cc5851a088a3ae1cd6d98ff..2a25482b34409d5179f9634cf54a0d970be5374c 100644 (file)
@@ -163,13 +163,6 @@ void RowPainter::paintInset(Inset const * inset, Font const & font,
 }
 
 
-void RowPainter::paintSeparator(double width, Font const & font)
-{
-       pi_.pain.textDecoration(font.fontInfo(), int(x_), yo_, int(width));
-       x_ += width;
-}
-
-
 void RowPainter::paintForeignMark(double orig_x, Language const * lang, int desc) const
 {
        if (!lyxrc.mark_foreign_language)
@@ -651,9 +644,9 @@ void RowPainter::paintText()
                        foreign_descent = e.dim.descent();
                }
                        break;
-               case Row::SEPARATOR:
                case Row::SPACE:
-                       paintSeparator(e.full_width(), e.font);
+                       pi_.pain.textDecoration(e.font.fontInfo(), int(x_), yo_, int(e.full_width()));
+                       x_ += e.full_width();
                }
 
                // The line that indicates word in a different language