From 995a7a4c867e240a6c52781fd2f52e9564a2b4ab Mon Sep 17 00:00:00 2001 From: Alfredo Braunstein Date: Mon, 1 Mar 2004 21:10:47 +0000 Subject: [PATCH] coord fix + shut up compiler warning git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8474 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 4 ++++ src/rowpainter.C | 27 ++++++++++----------------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index b96e47b5c9..f4acffa501 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2004-03-01 Alfredo Braunstein + + * rowpainter.C (paintSelection): fix x coordinates + 2004-03-01 Alfredo Braunstein * text.C (rowBreakPoint): fix breaking before displayed insets diff --git a/src/rowpainter.C b/src/rowpainter.C index 117f82bed1..a20ce8c84e 100644 --- a/src/rowpainter.C +++ b/src/rowpainter.C @@ -412,25 +412,18 @@ void RowPainter::paintSelection() bool const sel_on_one_row = sel_starts_here && sel_ends_here; if (text_.bidi.same_direction()) { - int x; - int w; if (sel_on_one_row) { - if (startx < endx) { - x = startx; - w = endx - startx; - } else { - x = endx; - w = startx - endx; - } - pain_.fillRectangle(x, yo_, w, h, LColor::selection); + int const x1 = is_rtl ? endx : startx; + int const x2 = is_rtl ? startx : endx; + pain_.fillRectangle(x1, yo_, x2 - x1, h, LColor::selection); } else if (sel_starts_here) { - int const x = is_rtl ? 0 : startx; - int const w = is_rtl ? startx : (width_ - startx); - pain_.fillRectangle(x, yo_, w, h, LColor::selection); + int const x1 = is_rtl ? int(xo_) : startx; + int const x2 = is_rtl ? startx : int(xo_) + width_; + pain_.fillRectangle(x1, yo_, x2 - x1, h, LColor::selection); } else if (sel_ends_here) { - int const x = is_rtl ? endx : 0; - int const w = is_rtl ? (width_ - endx) : endx; - pain_.fillRectangle(x, yo_, w, h, LColor::selection); + int const x1 = is_rtl ? endx : int(xo_); + int const x2 = is_rtl ? int(xo_) + width_ : endx; + pain_.fillRectangle(x1, yo_, x2 - x1, h, LColor::selection); } else if (row_y > starty && row_y < endy) { pain_.fillRectangle(int(xo_), yo_, width_, h, LColor::selection); } @@ -721,7 +714,7 @@ void RowPainter::paintLast() int const y = yo_ + row_.baseline() - size; int x = is_rtl ? NEST_MARGIN + CHANGEBAR_MARGIN: width_ - size; - if (width_ - row_.width() <= size) + if (width_ - int(row_.width()) <= size) x += (size - width_ + row_.width() + 1) * (is_rtl ? -1 : 1); if (endlabel == END_LABEL_BOX) -- 2.39.2