From: Jean-Marc Lasgouttes Date: Tue, 21 Jul 2015 07:51:06 +0000 (+0200) Subject: Get rid of SEPARATOR row element type X-Git-Tag: 2.2.0alpha1~408^2 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=371bd2b1e53a7275f7a4eebbe3ad064acdecca2f;p=lyx.git Get rid of SEPARATOR row element type It is not used anymore. Also get rid of a comment made irrelevant by recent changes. --- diff --git a/src/Row.cpp b/src/Row.cpp index 1bd11c97cd..0974265328 100644 --- a/src/Row.cpp +++ b/src/Row.cpp @@ -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) { diff --git a/src/Row.h b/src/Row.h index 77dcbb5f75..92521ef4ba 100644 --- 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; diff --git a/src/RowPainter.cpp b/src/RowPainter.cpp index b8f9189600..2a25482b34 100644 --- a/src/RowPainter.cpp +++ b/src/RowPainter.cpp @@ -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