]> git.lyx.org Git - features.git/commitdiff
Code simplification. We don't need to memorize the current Row hfill anymore.
authorAbdelrazak Younes <younes@lyx.org>
Thu, 6 Dec 2007 08:39:42 +0000 (08:39 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Thu, 6 Dec 2007 08:39:42 +0000 (08:39 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21987 a592a061-630c-0410-9148-cb99ea01b6c8

src/Row.cpp
src/Row.h
src/TextMetrics.cpp

index f4e62014358740360967da486a3db4f32109848f..c1a2e6cd7b91d76e86ae8f4d8e26672a0fe23ac2 100644 (file)
@@ -24,13 +24,13 @@ namespace lyx {
 
 
 Row::Row()
-       : separator(0), hfill(0), label_hfill(0), x(0),
+       : separator(0), label_hfill(0), x(0),
        sel_beg(-1), sel_end(-1), changed_(false), crc_(0), pos_(0), end_(0)
 {}
 
 
 Row::Row(pos_type pos)
-       : separator(0), hfill(0), label_hfill(0), x(0),
+       : separator(0), label_hfill(0), x(0),
        sel_beg(-1), sel_end(-1), changed_(false), crc_(0), pos_(pos), end_(0)
 {}
 
index cb25a4dcd99f17608fad48271527f2b71c6f427f..ae8ed71fd1d73382e2f9d9eead7ed01eb51c6bb2 100644 (file)
--- a/src/Row.h
+++ b/src/Row.h
@@ -68,8 +68,6 @@ public:
 
        /// width of a separator (i.e. space)
        double separator;
-       /// width of hfills in the body
-       double hfill;
        /// width of hfills in the label
        double label_hfill;
        /// the x position of the row
index 737024af1b7439cf8884bfe495398f0533d88005..4adffdcdd8078e38fb9dfe0012bbb54271876e09 100644 (file)
@@ -513,7 +513,6 @@ void TextMetrics::computeRowMetrics(pit_type const pit,
                Row & row, int width) const
 {
        row.label_hfill = 0;
-       row.hfill = 0;
        row.separator = 0;
 
        Buffer & buffer = bv_->buffer();
@@ -553,12 +552,11 @@ void TextMetrics::computeRowMetrics(pit_type const pit,
                        row.label_hfill = labelFill(pit, row) / double(nlh);
        }
 
-       // are there any hfills in the row?
-       int const nh = numberOfHfills(par, row);
-
-       if (nh) {
-               if (w > 0)
-                       row.hfill = w / nh;
+       double hfill = 0;
+       if (w > 0) {
+               // are there any hfills in the row?
+               if (int nh = numberOfHfills(par, row))
+                       hfill = w / double(nh);
        // we don't have to look at the alignment if it is ALIGN_LEFT and
        // if the row is already larger then the permitted width as then
        // we force the LEFT_ALIGN'edness!
@@ -653,7 +651,7 @@ void TextMetrics::computeRowMetrics(pit_type const pit,
                        continue;
                Dimension dim = row.dimension();
                if (pm.hfillExpansion(row, ii->pos))
-                       dim.wid = int(ii->pos >= body_pos ? row.hfill : row.label_hfill);
+                       dim.wid = int(ii->pos >= body_pos ? hfill : row.label_hfill);
                else
                        dim.wid = 3;
                // Cache the inset dimension.