]> git.lyx.org Git - features.git/commitdiff
refresh_status_ trisate -> need_refresh_ bool
authorAndré Pönitz <poenitz@gmx.net>
Tue, 15 Jul 2003 11:08:02 +0000 (11:08 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Tue, 15 Jul 2003 11:08:02 +0000 (11:08 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7276 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/screen.C
src/frontends/screen.h
src/insets/insettabular.C
src/insets/insettext.C
src/lyxtext.h
src/rowpainter.C
src/text2.C
src/text3.C

index cd5e6bf93112fe0673abc8d1838cf95455fd32df..2b375be2f532328ece42c62b910f77a174899edb 100644 (file)
@@ -306,25 +306,17 @@ bool LyXScreen::fitCursor(LyXText * text, BufferView * bv)
 
 void LyXScreen::update(BufferView & bv, int yo, int xo)
 {
-       int const vwidth = workarea().workWidth();
-       int const vheight = workarea().workHeight();
        LyXText * text = bv.text;
 
        workarea().getPainter().start();
 
-       switch (text->refreshStatus()) {
-       case LyXText::REFRESH_ROW:
-       case LyXText::REFRESH_AREA:
-       {
+       if (text->needRefresh()) {
+               int const vwidth = workarea().workWidth();
+               int const vheight = workarea().workHeight();
                text->updateRowPositions();
                int const y = max(int(text->refresh_y - text->top_y()), 0);
                drawFromTo(text, &bv, y, vheight, yo, xo);
                expose(0, y, vwidth, vheight - y);
-               break;
-       }
-       case LyXText::REFRESH_NONE:
-               // Nothing needs done
-               break;
        }
 
        workarea().getPainter().end();
index fd1b229e3a1f830291f32cc563c34965c63f8da3..4628e9ea43379a75b606f38197c0d4bca1a594c2 100644 (file)
@@ -89,11 +89,9 @@ public:
         * @param xo the x offset into the text
         * @param yo the x offset into the text
         *
-        * Updates part of the screen. If bv->text->status is
-        * LyXText::REFRESH_AREA, we update from the
-        * point of change and to the end of the screen.
-        * If text->status is LyXText::REFRESH_ROW,
-        * we only update the current row.
+        * Updates part of the screen. If bv->text->needRefresh is
+        * true, we update from the
+        * point of change to the end of the screen.
         */
        virtual void update(BufferView & bv, int yo = 0, int xo = 0);
 
@@ -141,11 +139,6 @@ protected:
        void drawFromTo(LyXText *, BufferView *, int y1, int y2,
                        int y_offset = 0, int x_offset = 0);
 
-       /// y is a coordinate of the text
-       void drawOneRow(LyXText *, BufferView *,
-                       RowList::iterator row,
-                       int y_text, int y_offset = 0, int x_offset = 0);
-
 private:
        /// grey out (no buffer)
        void greyOut();
index 055d680db8292269a599e9661d747c6e8447776e..4808426553b0725ef71a357d47acee08f710b790 100644 (file)
@@ -431,11 +431,8 @@ void InsetTabular::update(BufferView * bv, bool reinit)
        }
        if (the_locking_inset)
                the_locking_inset->update(bv, reinit);
-       if (need_update < FULL &&
-               bv->text->refreshStatus() == LyXText::REFRESH_AREA)
-       {
+       if (need_update < FULL && bv->text->needRefresh())
                need_update = FULL;
-       }
 
        switch (need_update) {
        case INIT:
index d4b3e0e14b5458747e24aaba538bf86d776f2bbf..0f9a42e2b879fa936efe834ebdcf74da44997cc0 100644 (file)
@@ -440,12 +440,12 @@ void InsetText::update(BufferView * bv, bool reinit)
                the_locking_inset->update(bv, reinit);
        }
 
-       if ((need_update & CURSOR_PAR) && (text_.refreshStatus() == LyXText::REFRESH_NONE) &&
+       if ((need_update & CURSOR_PAR) && !text_.needRefresh() &&
                the_locking_inset) {
                text_.updateInset(the_locking_inset);
        }
 
-       if (text_.refreshStatus() == LyXText::REFRESH_AREA)
+       if (text_.needRefresh())
                need_update |= FULL;
 
        in_update = false;
@@ -461,16 +461,9 @@ void InsetText::update(BufferView * bv, bool reinit)
 void InsetText::setUpdateStatus(int what) const
 {
        need_update |= what;
-       // we have to redraw us full if our LyXText REFRESH_AREA or
-       // if we don't break row so that we only have one row to update!
-       if ((text_.refreshStatus() == LyXText::REFRESH_AREA) ||
-           (!autoBreakRows &&
-            (text_.refreshStatus() == LyXText::REFRESH_ROW)))
-       {
+       // we will to redraw us full if our LyXText wants it
+       if (text_.needRefresh())
                need_update |= FULL;
-       } else if (text_.refreshStatus() == LyXText::REFRESH_ROW) {
-               need_update |= CURSOR_PAR;
-       }
 
        // this to not draw a selection when we redraw all of it!
        if (need_update & CURSOR && !(need_update & SELECTION)) {
@@ -489,8 +482,8 @@ void InsetText::updateLocal(BufferView * bv, int what, bool mark_dirty)
        text_.partialRebreak();
        setUpdateStatus(what);
        bool flag = mark_dirty ||
-               (((need_update != CURSOR) && (need_update != NONE)) ||
-                (text_.refreshStatus() != LyXText::REFRESH_NONE) || text_.selection.set());
+               ((need_update != CURSOR && need_update != NONE) ||
+                text_.needRefresh() || text_.selection.set());
        if (!text_.selection.set())
                text_.selection.cursor = text_.cursor;
 
index 438b41e99c0f9e88d6cd372bcd9468569c632db4..0c0a5a3a2990df50d065a0292f8a4e7c304640cb 100644 (file)
@@ -44,16 +44,6 @@ class ParagraphList;
 // transition...
 class LyXText : public TextCursor {
 public:
-       /// what repainting is needed
-       enum refresh_status {
-               /// no repaint is needed
-               REFRESH_NONE = 0,
-               /// the refresh_row needs repainting
-               REFRESH_ROW = 1,
-               /// everything from refresh_y downwards needs repainting
-               REFRESH_AREA = 2
-       };
-
        /// Constructor
        LyXText(BufferView *);
        /// sets inset as owner
@@ -180,14 +170,10 @@ public:
        /// clear any pending paints
        void clearPaint();
 
-       /**
-        * Mark position y as the starting point for a repaint
-        */
+       /// Mark position y as the starting point for a repaint
        void postPaint(int start_y);
 
-       /**
-        * Mark the given row at position y as needing a repaint.
-        */
+       /// Mark the given row at position y as needing a repaint.
        void postRowPaint(RowList::iterator rit, int start_y);
 
        ///
@@ -203,14 +189,14 @@ public:
         * Return the status. This represents what repaints are
         * pending after some operation (e.g. inserting a char).
         */
-       refresh_status refreshStatus() const;
+       bool needRefresh() const;
 
 private:
        /**
         * The pixel y position from which to repaint the screen.
         * The position is absolute along the height of outermost
-        * lyxtext (I think). REFRESH_AREA and REFRESH_ROW
-        * repaints both use this as a starting point (if it's within
+        * lyxtext (I think). If need_refresh_ is true
+        * repaints use this as a starting point (if it's within
         * the viewable portion of the lyxtext).
         */
        int refresh_y;
@@ -220,8 +206,8 @@ private:
         * It doesn't make any difference for REFRESH_AREA.
         */
        RowList::iterator refresh_row;
-
-       refresh_status refresh_status_;
+       // do we need a refresh?
+       bool need_refresh_;
 
 public:
        /// only the top-level LyXText has this non-zero
index 820755e811dd047c1ac5d59bc34ca726c62e5473..8c0ee616b396665dcca24e6f5c2bca8af744bb67 100644 (file)
@@ -259,7 +259,7 @@ void RowPainter::paintChars(pos_type & vpos, bool hebrew, bool arabic)
 {
        pos_type pos = text_.vis2log(vpos);
        pos_type const last = lastPrintablePos(text_, row_);
-       LyXFont orig_font(getFont(pos));
+       LyXFont orig_font = getFont(pos);
 
        // first character
        string str;
index 16de638e2a7b75dc949ce2c71f5054cd7a15a640..d8204f0b7cd585f0822ca24d675cd37ce4de8537 100644 (file)
@@ -2288,15 +2288,15 @@ ParagraphList & LyXText::ownerParagraphs() const
 }
 
 
-LyXText::refresh_status LyXText::refreshStatus() const
+bool LyXText::needRefresh() const
 {
-       return refresh_status_;
+       return need_refresh_;
 }
 
 
 void LyXText::clearPaint()
 {
-       refresh_status_ = REFRESH_NONE;
+       need_refresh_ = true;
        refresh_row = rows().end();
        refresh_y = 0;
 }
@@ -2304,12 +2304,12 @@ void LyXText::clearPaint()
 
 void LyXText::postPaint(int start_y)
 {
-       refresh_status old = refresh_status_;
+       bool old = need_refresh_;
 
-       refresh_status_ = REFRESH_AREA;
+       need_refresh_ = true;
        refresh_row = rows().end();
 
-       if (old != REFRESH_NONE && refresh_y < start_y)
+       if (old && refresh_y < start_y)
                return;
 
        refresh_y = start_y;
@@ -2328,17 +2328,17 @@ void LyXText::postPaint(int start_y)
 // make refresh_y be 0, and use row->y etc.
 void LyXText::postRowPaint(RowList::iterator rit, int start_y)
 {
-       if (refresh_status_ != REFRESH_NONE && refresh_y < start_y) {
-               refresh_status_ = REFRESH_AREA;
+       if (need_refresh_ && refresh_y < start_y) {
+               need_refresh_ = true;
                return;
-       } else {
-               refresh_y = start_y;
        }
 
-       if (refresh_status_ == REFRESH_AREA)
+       refresh_y = start_y;
+
+       if (need_refresh_)
                return;
 
-       refresh_status_ = REFRESH_ROW;
+       need_refresh_ = true;
        refresh_row = rit;
 
        if (!inset_owner)
index a99d1d4ba61f39d7d67df4e5331187a5e1691071..d22969ca00bbd29d9661894491df2ecf61ecc9f8 100644 (file)
@@ -75,7 +75,7 @@ namespace {
                }
                if (!lt->isInInset()) {
                        bv->update(lt, BufferView::SELECT);
-               } else if (bv->text->refreshStatus() != LyXText::REFRESH_NONE) {
+               } else if (bv->text->needRefresh()) {
                        bv->update(BufferView::SELECT);
                }