]> git.lyx.org Git - features.git/commitdiff
Turn a double variable into an int.
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 7 Jan 2015 21:38:48 +0000 (22:38 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 7 Jan 2015 21:42:14 +0000 (22:42 +0100)
This is a better fix than 0ad9d46068, and was just as simple.

src/TextMetrics.cpp

index d3523ae47e87d67c7d8b9b92342355e773fe2ef3..b8771b23e6a8d97456bc7b6bc8ac9a5f213441f7 100644 (file)
@@ -565,7 +565,7 @@ void TextMetrics::computeRowMetrics(pit_type const pit,
 
        Paragraph const & par = text_->getPar(pit);
 
-       double const w = width - row.right_margin - row.width();
+       int const w = width - row.right_margin - row.width();
        // FIXME: put back this assertion when the crash on new doc is solved.
        //LASSERT(w >= 0, /**/);
 
@@ -600,7 +600,7 @@ void TextMetrics::computeRowMetrics(pit_type const pit,
        // are there any hfills in the row?
        if (int const nh = numberOfHfills(row, par.beginOfBody())) {
                if (w > 0)
-                       hfill = w / double(nh);
+                       hfill = double(w) / 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!
@@ -615,20 +615,20 @@ void TextMetrics::computeRowMetrics(pit_type const pit,
                         * or newline, then stretch it */
                        if (ns && !row.right_boundary()
                            && row.endpos() != par.size()) {
-                               setSeparatorWidth(row, w / ns);
+                               setSeparatorWidth(row, double(w) / ns);
                                row.dimension().wid = width;
                        } else if (is_rtl) {
                                row.dimension().wid = width;
-                               row.left_margin += int(w);
+                               row.left_margin += w;
                        }
                        break;
                }
                case LYX_ALIGN_RIGHT:
-                       row.left_margin += int(w);
+                       row.left_margin += w;
                        break;
                case LYX_ALIGN_CENTER:
-                       row.dimension().wid = width - int(w / 2);
-                       row.left_margin += int(w / 2);
+                       row.dimension().wid = width - w / 2;
+                       row.left_margin += w / 2;
                        break;
                case LYX_ALIGN_LEFT:
                case LYX_ALIGN_NONE: