From e275c5d8115780fcc413047fadabec72d06e7feb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Fri, 1 Aug 2003 15:17:22 +0000 Subject: [PATCH] remove need_update git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7476 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView_pimpl.C | 1 - src/ChangeLog | 4 ++++ src/insets/insettext.C | 14 +++----------- src/lyxtext.h | 16 ---------------- src/text.C | 19 ------------------- src/text2.C | 32 -------------------------------- src/text3.C | 7 +------ src/undo_funcs.C | 5 ----- 8 files changed, 8 insertions(+), 90 deletions(-) diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 533b520f30..ac59faa231 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -650,7 +650,6 @@ void BufferView::Pimpl::update() { lyxerr << "BufferView::update()\n"; screen().redraw(*bv_); - bv_->text->clearPaint(); } diff --git a/src/ChangeLog b/src/ChangeLog index 506cbb779f..cbeceeba4c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -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 * paragraph.[Ch] (copyIntoMinibuffer): removed unused function diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 0b21274b8e..5ab4f3cee9 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -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(this)); - } if (need_update == CURSOR) need_update = NONE; diff --git a/src/lyxtext.h b/src/lyxtext.h index c45f319f34..3ec8c78bce 100644 --- a/src/lyxtext.h +++ b/src/lyxtext.h @@ -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; diff --git a/src/text.C b/src/text.C index 5ff3b50111..174a5bf61b 100644 --- a/src/text.C +++ b/src/text.C @@ -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()); } } diff --git a/src/text2.C b/src/text2.C index 7ae9733aa3..08e68c958c 100644 --- a/src/text2.C +++ b/src/text2.C @@ -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 diff --git a/src/text3.C b/src/text3.C index 7264ce2753..341bcde009 100644 --- a/src/text3.C +++ b/src/text3.C @@ -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; diff --git a/src/undo_funcs.C b/src/undo_funcs.C index 8386041b4d..2705a0ed33 100644 --- a/src/undo_funcs.C +++ b/src/undo_funcs.C @@ -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; }