]> git.lyx.org Git - features.git/commitdiff
some bool variables to make if() simpler
authorAndré Pönitz <poenitz@gmx.net>
Mon, 24 Nov 2003 16:36:59 +0000 (16:36 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Mon, 24 Nov 2003 16:36:59 +0000 (16:36 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8126 a592a061-630c-0410-9148-cb99ea01b6c8

src/rowpainter.C

index 4778b29a29466e3fbab9f4e2b886866c18241d2b..efdc60a6eecf0b77478fc5e191a036a3ba9e777c 100644 (file)
@@ -405,11 +405,14 @@ void RowPainter::paintSelection()
 
        int const row_y = pit_->y + row_.y_offset();
 
+       bool const sel_starts_here = startpit == pit_ && startrow == rit_;
+       bool const sel_ends_here   = endpit == pit_ && endrow == rit_;
+       bool const sel_on_one_row  = sel_starts_here && sel_ends_here;
+
        if (text_.bidi.same_direction()) {
                int x;
                int w;
-               if ((startpit == pit_ && startrow == rit_) &&
-                   (endpit == pit_ && endrow == rit_)) {
+               if (sel_on_one_row) {
                        if (startx < endx) {
                                x = int(xo_) + startx;
                                w = endx - startx;
@@ -418,11 +421,11 @@ void RowPainter::paintSelection()
                                w = startx - endx;
                        }
                        pain_.fillRectangle(x, yo_, w, h, LColor::selection);
-               } else if (startpit == pit_ && startrow == rit_) {
+               } else if (sel_starts_here) {
                        int const x = is_rtl ? int(xo_) : int(xo_ + startx);
                        int const w = is_rtl ? startx : (width_ - startx);
                        pain_.fillRectangle(x, yo_, w, h, LColor::selection);
-               } else if (endpit == pit_ && endrow == rit_) {
+               } else if (sel_ends_here) {
                        int const x = is_rtl ? int(xo_ + endx) : int(xo_);
                        int const w = is_rtl ? (width_ - endx) : endx;
                        pain_.fillRectangle(x, yo_, w, h, LColor::selection);