]> git.lyx.org Git - lyx.git/commitdiff
Fix drawing of labels in insets
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 4 Jan 2019 15:24:18 +0000 (16:24 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sat, 5 Jan 2019 14:01:58 +0000 (15:01 +0100)
In many cases, the origin xo_ of insets was forgotten.

Also fix spacing between text and label in rtl

Fixes bug #11425.

(cherry picked from commit 5c1d65afee3a37d5befcf9eb55d8d50e1d8e4f13)
(cherry picked from commit 5fc035f99c42835da41d6eb6cf5a375382c06870)

src/RowPainter.cpp

index c6578cee2bb31ccba2085a4a0b298571deac4cc5..93ac63dce6a6594ba3a5f64d382c4cd5791bf319 100644 (file)
@@ -402,7 +402,7 @@ void RowPainter::paintLabel() const
        double x = x_;
 
        if (row_.isRTL())
-               x = tm_.width() - row_.right_margin + fm.width(layout.labelsep);
+               x = xo_ + row_.width() + fm.width(layout.labelsep);
        else
                x = x_ - fm.width(layout.labelsep) - fm.width(str);
 
@@ -437,10 +437,10 @@ void RowPainter::paintTopLevelLabel() const
 
        double x = x_;
        if (layout.labeltype == LABEL_CENTERED) {
-               x = row_.left_margin + (tm_.width() - row_.left_margin - row_.right_margin) / 2;
+               x += (tm_.width() - row_.left_margin - row_.right_margin) / 2;
                x -= fm.width(str) / 2;
        } else if (row_.isRTL()) {
-               x = tm_.width() - row_.right_margin - fm.width(str);
+               x = xo_ + tm_.width() - row_.right_margin - fm.width(str);
        }
        pi_.pain.text(int(x), yo_ - maxdesc - labeladdon, str, font);
 }
@@ -525,9 +525,9 @@ void RowPainter::paintLast() const
                }
 
                if (endlabel == END_LABEL_BOX)
-                       pi_.pain.rectangle(x, y, size, size, Color_eolmarker);
+                       pi_.pain.rectangle(xo_ + x, y, size, size, Color_eolmarker);
                else
-                       pi_.pain.fillRectangle(x, y, size, size, Color_eolmarker);
+                       pi_.pain.fillRectangle(xo_ + x, y, size, size, Color_eolmarker);
                break;
        }