]> git.lyx.org Git - features.git/commitdiff
remove need_update
authorAndré Pönitz <poenitz@gmx.net>
Fri, 1 Aug 2003 15:17:22 +0000 (15:17 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Fri, 1 Aug 2003 15:17:22 +0000 (15:17 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7476 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView_pimpl.C
src/ChangeLog
src/insets/insettext.C
src/lyxtext.h
src/text.C
src/text2.C
src/text3.C
src/undo_funcs.C

index 533b520f307fdb14645801ead23acb40d45cffad..ac59faa2315194b5dee1a5d01267e91cbb226f93 100644 (file)
@@ -650,7 +650,6 @@ void BufferView::Pimpl::update()
 {
        lyxerr << "BufferView::update()\n";
        screen().redraw(*bv_);
-       bv_->text->clearPaint();
 }
 
 
index 506cbb779fa8e9e65ac62841d14d1444fb8215d6..cbeceeba4c2f2878374d040924c5a235e1e61573 100644 (file)
@@ -9,6 +9,10 @@
        * text.C:
        * text2.C: make redoParagraph more independent of current cursor
 
+       * lyxtext.h (need_update, needUpdate, postPaint, clearPaint):
+       * text.C:
+       * text2.C: remove unneeded members
+
 2003-07-30  André Pönitz  <poenitz@gmx.net>
 
        * paragraph.[Ch] (copyIntoMinibuffer): removed unused function
index 0b21274b8e640df4b5474b04e012c53ba9f4c662..5ab4f3cee96ef5bf2c9bf72fd3f74be820197fe1 100644 (file)
@@ -363,8 +363,6 @@ void InsetText::draw(PainterInfo & pi, int x, int baseline) const
 
        paintRows(*bv, text_, rit, x, 0, yo, y2, yo);
 
-       text_.clearPaint();
-
        if (drawFrame_ == ALWAYS || (drawFrame_ == LOCKED && locked))
                drawFrame(pain, int(start_x));
 
@@ -388,10 +386,6 @@ void InsetText::drawFrame(Painter & pain, int x) const
 void InsetText::setUpdateStatus(int what) const
 {
        need_update |= what;
-       // we will to redraw us full if our LyXText wants it
-       if (text_.needRefresh())
-               need_update |= FULL;
-
        // this to not draw a selection when we redraw all of it!
        if (need_update & CURSOR && !(need_update & SELECTION)) {
                if (text_.selection.set())
@@ -412,17 +406,15 @@ 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_.needRefresh() || text_.selection.set());
+               (need_update != CURSOR && need_update != NONE) ||
+               text_.selection.set();
        if (!text_.selection.set())
                text_.selection.cursor = text_.cursor;
 
        bv->fitCursor();
 
-       if (flag) {
-               text_.postPaint();
+       if (flag)
                bv->updateInset(const_cast<InsetText *>(this));
-       }
 
        if (need_update == CURSOR)
                need_update = NONE;
index c45f319f34f9b066074372b59443282b588a0f44..3ec8c78bce84883baac626afe7260db994419684 100644 (file)
@@ -167,12 +167,6 @@ public:
        /// compute text metrics
        void metrics(MetricsInfo & mi, Dimension & dim);
 
-       /// clear any pending paints
-       void clearPaint();
-
-       /// submit repaint request
-       void postPaint();
-
        ///
        InsetOld::RESULT dispatch(FuncRequest const & cmd);
 
@@ -182,16 +176,6 @@ public:
 
        friend class LyXScreen;
 
-       /**
-        * Return the status. This represents what repaints are
-        * pending after some operation (e.g. inserting a char).
-        */
-       bool needRefresh() const;
-
-private:
-       // do we need a refresh?
-       bool need_refresh_;
-
 public:
        /// only the top-level LyXText has this non-zero
        BufferView * bv_owner;
index 5ff3b501112a084be17b7180b3bbd9da5359e8aa..174a5bf61b3e3b63a8620053750cd65cf61a71a4 100644 (file)
@@ -126,7 +126,6 @@ void LyXText::top_y(int newy)
        anchor_row_offset_ = newy - y;
        lyxerr[Debug::GUI] << "changing reference to row: " << &*anchor_row_
               << " offset: " << anchor_row_offset_ << endl;
-       postPaint();
 }
 
 
@@ -1542,8 +1541,6 @@ void LyXText::breakParagraph(ParagraphList & paragraphs, char keep_layout)
                cursorLeft(bv());
        }
 
-       postPaint();
-
        removeParagraph(cursorRow());
 
        // set the dimensions of the cursor row
@@ -1732,8 +1729,6 @@ void LyXText::insertChar(char c)
 
                        setHeightOfRow(boost::prior(row));
 
-                       postPaint();
-
                        breakAgainOneRow(row);
 
                        current_font = rawtmpfont;
@@ -1760,7 +1755,6 @@ void LyXText::insertChar(char c)
        }
 
        if (c == Paragraph::META_INSET || row->fill() < 0) {
-               postPaint();
                breakAgainOneRow(row);
 
                RowList::iterator next_row = boost::next(row);
@@ -1788,7 +1782,6 @@ void LyXText::insertChar(char c)
        } else {
                // FIXME: similar code is duplicated all over - make resetHeightOfRow
                setHeightOfRow(row);
-               postPaint();
 
                current_font = rawtmpfont;
                real_current_font = realtmpfont;
@@ -2266,9 +2259,6 @@ void LyXText::changeCase(LyXText::TextCase action)
 
                ++pos;
        }
-
-       if (getRow(to) != getRow(from))
-               postPaint();
 }
 
 
@@ -2350,10 +2340,7 @@ void LyXText::backspace()
                                cursorLeft(bv());
 
                                // the layout things can change the height of a row !
-                               int const tmpheight = cursorRow()->height();
                                setHeightOfRow(cursorRow());
-                               if (cursorRow()->height() != tmpheight)
-                                       postPaint();
                                return;
                        }
                }
@@ -2407,8 +2394,6 @@ void LyXText::backspace()
                                if (cursor.pos())
                                        cursor.pos(cursor.pos() - 1);
 
-                       postPaint();
-
                        // remove the lost paragraph
                        // This one is not safe, since the paragraph that the tmprow and the
                        // following rows belong to has been deleted by the PasteParagraph
@@ -2531,7 +2516,6 @@ void LyXText::backspace()
                                y -= tmprow->height();
                                tmprow->fill(fill(tmprow, workWidth()));
                                setHeightOfRow(tmprow);
-                               postPaint();
 
                                setCursor(cursor.par(), cursor.pos(),
                                          false, cursor.boundary());
@@ -2559,8 +2543,6 @@ void LyXText::backspace()
                        if (lastPos(*this, row) == row->par()->size() - 1)
                                removeRow(boost::next(row));
 
-                       postPaint();
-
                        breakAgainOneRow(row);
                        // will the cursor be in another row now?
                        if (boost::next(row) != rows().end() &&
@@ -2575,7 +2557,6 @@ void LyXText::backspace()
                        // set the dimensions of the row
                        row->fill(fill(row, workWidth()));
                        setHeightOfRow(row);
-                       postPaint();
                        setCursor(cursor.par(), cursor.pos(), false, cursor.boundary());
                }
        }
index 7ae9733aa342e4a244cebd48a8801d09fb90e8ec..08e68c958c816463d1b7ee194bacdd0e521f0adb 100644 (file)
@@ -65,7 +65,6 @@ LyXText::LyXText(BufferView * bv)
          inset_owner(0), the_locking_inset(0), bv_owner(bv)
 {
        anchor_row_ = rows().end();
-       need_refresh_ = true;
 }
 
 
@@ -74,7 +73,6 @@ LyXText::LyXText(BufferView * bv, InsetText * inset)
          inset_owner(inset), the_locking_inset(0), bv_owner(bv)
 {
        anchor_row_ = rows().end();
-       need_refresh_ = true;
 }
 
 
@@ -84,7 +82,6 @@ void LyXText::init(BufferView * bview)
 
        rowlist_.clear();
        width = height = 0;
-       need_refresh_ = true;
 
        anchor_row_ = rows().end();
        anchor_row_offset_ = 0;
@@ -608,8 +605,6 @@ void LyXText::redoHeightOfParagraph()
                setHeightOfRow(tmprow);
        }
 
-       postPaint();
-
        setCursor(cursor.par(), cursor.pos(), false, cursor.boundary());
 }
 
@@ -958,7 +953,6 @@ void LyXText::setParagraph(bool line_top, bool line_bottom,
                params.noindent(noindent);
                tmppit = boost::prior(pit);
        }
-       postPaint();
 
        redoParagraphs(selection.start.par(), endpit);
 
@@ -1468,7 +1462,6 @@ void LyXText::insertStringAsParagraphs(string const & str)
 void LyXText::checkParagraph(ParagraphList::iterator pit, pos_type pos)
 {
        breakAgain(getRow(pit, pos));
-       postPaint();
        setCursorIntern(cursor.par(), cursor.pos(), false, cursor.boundary());
 }
 
@@ -2126,7 +2119,6 @@ bool LyXText::deleteEmptyParagraphMechanism(LyXCursor const & old_cursor)
 
                if (getRow(old_cursor) != rows().begin()) {
                        RowList::iterator prevrow = boost::prior(getRow(old_cursor));
-                       postPaint();
                        tmpcursor = cursor;
                        cursor = old_cursor; // that undo can restore the right cursor position
                        #warning FIXME. --end() iterator is usable here
@@ -2157,7 +2149,6 @@ bool LyXText::deleteEmptyParagraphMechanism(LyXCursor const & old_cursor)
                        setHeightOfRow(prevrow);
                } else {
                        RowList::iterator nextrow = boost::next(getRow(old_cursor));
-                       postPaint();
 
                        tmpcursor = cursor;
                        cursor = old_cursor; // that undo can restore the right cursor position
@@ -2215,29 +2206,6 @@ ParagraphList & LyXText::ownerParagraphs() const
 }
 
 
-bool LyXText::needRefresh() const
-{
-       return need_refresh_;
-}
-
-
-void LyXText::clearPaint()
-{
-       need_refresh_ = false;
-}
-
-
-void LyXText::postPaint()
-{
-       need_refresh_ = true;
-
-       // We are an inset's lyxtext. Tell the top-level lyxtext
-       // it needs to update the row we're in.
-       if (inset_owner)
-               bv()->text->postPaint();
-}
-
-
 bool LyXText::isInInset() const
 {
        // Sub-level has non-null bv owner and
index 7264ce27537ce3bd2cd6e9f3f03b1840f2843bdd..341bcde009c3bb02ae7a6f1304831f4ebb8f787e 100644 (file)
@@ -74,11 +74,7 @@ namespace {
                        else
                                bv->repaint();
                }
-               if (!lt->isInInset()) {
-                       bv->update(lt, BufferView::SELECT);
-               } else if (bv->text->needRefresh()) {
-                       bv->update(BufferView::SELECT);
-               }
+               bv->update();
 
                if (!lt->selection.set())
                        bv->haveSelection(false);
@@ -434,7 +430,6 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
                // we can set the refreshing parameters now
                updateCounters();
                redoHeightOfParagraph();
-               postPaint();
                setCursor(cursor.par(), cursor.pos());
                update();
                break;
index 8386041b4d7927928e7ffd835cedb6d762dce124..2705a0ed335a51ac96d861fa3eed82bfd64d4907 100644 (file)
@@ -156,10 +156,6 @@ bool performUndoOrRedo(BufferView * bv, Undo & undo)
        }
 
        finishUndo();
-
-       // And repaint the lot
-       bv->text->postPaint();
-
        return true;
 }
 
@@ -177,7 +173,6 @@ bool textUndoOrRedo(BufferView * bv,
                freezeUndo();
                bv->unlockInset(bv->theLockingInset());
                finishUndo();
-               bv->text->postPaint();
                unFreezeUndo();
                return false;
        }