remove need_update

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7476 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2003-08-01 15:17:22 +00:00
parent 37ae3fda0d
commit e275c5d811
8 changed files with 8 additions and 90 deletions

View File

@ -650,7 +650,6 @@ void BufferView::Pimpl::update()
{ {
lyxerr << "BufferView::update()\n"; lyxerr << "BufferView::update()\n";
screen().redraw(*bv_); screen().redraw(*bv_);
bv_->text->clearPaint();
} }

View File

@ -9,6 +9,10 @@
* text.C: * text.C:
* text2.C: make redoParagraph more independent of current cursor * 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> 2003-07-30 André Pönitz <poenitz@gmx.net>
* paragraph.[Ch] (copyIntoMinibuffer): removed unused function * paragraph.[Ch] (copyIntoMinibuffer): removed unused function

View File

@ -363,8 +363,6 @@ void InsetText::draw(PainterInfo & pi, int x, int baseline) const
paintRows(*bv, text_, rit, x, 0, yo, y2, yo); paintRows(*bv, text_, rit, x, 0, yo, y2, yo);
text_.clearPaint();
if (drawFrame_ == ALWAYS || (drawFrame_ == LOCKED && locked)) if (drawFrame_ == ALWAYS || (drawFrame_ == LOCKED && locked))
drawFrame(pain, int(start_x)); drawFrame(pain, int(start_x));
@ -388,10 +386,6 @@ void InsetText::drawFrame(Painter & pain, int x) const
void InsetText::setUpdateStatus(int what) const void InsetText::setUpdateStatus(int what) const
{ {
need_update |= what; 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! // this to not draw a selection when we redraw all of it!
if (need_update & CURSOR && !(need_update & SELECTION)) { if (need_update & CURSOR && !(need_update & SELECTION)) {
if (text_.selection.set()) if (text_.selection.set())
@ -412,17 +406,15 @@ void InsetText::updateLocal(BufferView * bv, int what, bool mark_dirty)
text_.partialRebreak(); text_.partialRebreak();
setUpdateStatus(what); setUpdateStatus(what);
bool flag = mark_dirty || bool flag = mark_dirty ||
((need_update != CURSOR && need_update != NONE) || (need_update != CURSOR && need_update != NONE) ||
text_.needRefresh() || text_.selection.set()); text_.selection.set();
if (!text_.selection.set()) if (!text_.selection.set())
text_.selection.cursor = text_.cursor; text_.selection.cursor = text_.cursor;
bv->fitCursor(); bv->fitCursor();
if (flag) { if (flag)
text_.postPaint();
bv->updateInset(const_cast<InsetText *>(this)); bv->updateInset(const_cast<InsetText *>(this));
}
if (need_update == CURSOR) if (need_update == CURSOR)
need_update = NONE; need_update = NONE;

View File

@ -167,12 +167,6 @@ public:
/// compute text metrics /// compute text metrics
void metrics(MetricsInfo & mi, Dimension & dim); void metrics(MetricsInfo & mi, Dimension & dim);
/// clear any pending paints
void clearPaint();
/// submit repaint request
void postPaint();
/// ///
InsetOld::RESULT dispatch(FuncRequest const & cmd); InsetOld::RESULT dispatch(FuncRequest const & cmd);
@ -182,16 +176,6 @@ public:
friend class LyXScreen; 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: public:
/// only the top-level LyXText has this non-zero /// only the top-level LyXText has this non-zero
BufferView * bv_owner; BufferView * bv_owner;

View File

@ -126,7 +126,6 @@ void LyXText::top_y(int newy)
anchor_row_offset_ = newy - y; anchor_row_offset_ = newy - y;
lyxerr[Debug::GUI] << "changing reference to row: " << &*anchor_row_ lyxerr[Debug::GUI] << "changing reference to row: " << &*anchor_row_
<< " offset: " << anchor_row_offset_ << endl; << " offset: " << anchor_row_offset_ << endl;
postPaint();
} }
@ -1542,8 +1541,6 @@ void LyXText::breakParagraph(ParagraphList & paragraphs, char keep_layout)
cursorLeft(bv()); cursorLeft(bv());
} }
postPaint();
removeParagraph(cursorRow()); removeParagraph(cursorRow());
// set the dimensions of the cursor row // set the dimensions of the cursor row
@ -1732,8 +1729,6 @@ void LyXText::insertChar(char c)
setHeightOfRow(boost::prior(row)); setHeightOfRow(boost::prior(row));
postPaint();
breakAgainOneRow(row); breakAgainOneRow(row);
current_font = rawtmpfont; current_font = rawtmpfont;
@ -1760,7 +1755,6 @@ void LyXText::insertChar(char c)
} }
if (c == Paragraph::META_INSET || row->fill() < 0) { if (c == Paragraph::META_INSET || row->fill() < 0) {
postPaint();
breakAgainOneRow(row); breakAgainOneRow(row);
RowList::iterator next_row = boost::next(row); RowList::iterator next_row = boost::next(row);
@ -1788,7 +1782,6 @@ void LyXText::insertChar(char c)
} else { } else {
// FIXME: similar code is duplicated all over - make resetHeightOfRow // FIXME: similar code is duplicated all over - make resetHeightOfRow
setHeightOfRow(row); setHeightOfRow(row);
postPaint();
current_font = rawtmpfont; current_font = rawtmpfont;
real_current_font = realtmpfont; real_current_font = realtmpfont;
@ -2266,9 +2259,6 @@ void LyXText::changeCase(LyXText::TextCase action)
++pos; ++pos;
} }
if (getRow(to) != getRow(from))
postPaint();
} }
@ -2350,10 +2340,7 @@ void LyXText::backspace()
cursorLeft(bv()); cursorLeft(bv());
// the layout things can change the height of a row ! // the layout things can change the height of a row !
int const tmpheight = cursorRow()->height();
setHeightOfRow(cursorRow()); setHeightOfRow(cursorRow());
if (cursorRow()->height() != tmpheight)
postPaint();
return; return;
} }
} }
@ -2407,8 +2394,6 @@ void LyXText::backspace()
if (cursor.pos()) if (cursor.pos())
cursor.pos(cursor.pos() - 1); cursor.pos(cursor.pos() - 1);
postPaint();
// remove the lost paragraph // remove the lost paragraph
// This one is not safe, since the paragraph that the tmprow and the // This one is not safe, since the paragraph that the tmprow and the
// following rows belong to has been deleted by the PasteParagraph // following rows belong to has been deleted by the PasteParagraph
@ -2531,7 +2516,6 @@ void LyXText::backspace()
y -= tmprow->height(); y -= tmprow->height();
tmprow->fill(fill(tmprow, workWidth())); tmprow->fill(fill(tmprow, workWidth()));
setHeightOfRow(tmprow); setHeightOfRow(tmprow);
postPaint();
setCursor(cursor.par(), cursor.pos(), setCursor(cursor.par(), cursor.pos(),
false, cursor.boundary()); false, cursor.boundary());
@ -2559,8 +2543,6 @@ void LyXText::backspace()
if (lastPos(*this, row) == row->par()->size() - 1) if (lastPos(*this, row) == row->par()->size() - 1)
removeRow(boost::next(row)); removeRow(boost::next(row));
postPaint();
breakAgainOneRow(row); breakAgainOneRow(row);
// will the cursor be in another row now? // will the cursor be in another row now?
if (boost::next(row) != rows().end() && if (boost::next(row) != rows().end() &&
@ -2575,7 +2557,6 @@ void LyXText::backspace()
// set the dimensions of the row // set the dimensions of the row
row->fill(fill(row, workWidth())); row->fill(fill(row, workWidth()));
setHeightOfRow(row); setHeightOfRow(row);
postPaint();
setCursor(cursor.par(), cursor.pos(), false, cursor.boundary()); setCursor(cursor.par(), cursor.pos(), false, cursor.boundary());
} }
} }

View File

@ -65,7 +65,6 @@ LyXText::LyXText(BufferView * bv)
inset_owner(0), the_locking_inset(0), bv_owner(bv) inset_owner(0), the_locking_inset(0), bv_owner(bv)
{ {
anchor_row_ = rows().end(); 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) inset_owner(inset), the_locking_inset(0), bv_owner(bv)
{ {
anchor_row_ = rows().end(); anchor_row_ = rows().end();
need_refresh_ = true;
} }
@ -84,7 +82,6 @@ void LyXText::init(BufferView * bview)
rowlist_.clear(); rowlist_.clear();
width = height = 0; width = height = 0;
need_refresh_ = true;
anchor_row_ = rows().end(); anchor_row_ = rows().end();
anchor_row_offset_ = 0; anchor_row_offset_ = 0;
@ -608,8 +605,6 @@ void LyXText::redoHeightOfParagraph()
setHeightOfRow(tmprow); setHeightOfRow(tmprow);
} }
postPaint();
setCursor(cursor.par(), cursor.pos(), false, cursor.boundary()); setCursor(cursor.par(), cursor.pos(), false, cursor.boundary());
} }
@ -958,7 +953,6 @@ void LyXText::setParagraph(bool line_top, bool line_bottom,
params.noindent(noindent); params.noindent(noindent);
tmppit = boost::prior(pit); tmppit = boost::prior(pit);
} }
postPaint();
redoParagraphs(selection.start.par(), endpit); redoParagraphs(selection.start.par(), endpit);
@ -1468,7 +1462,6 @@ void LyXText::insertStringAsParagraphs(string const & str)
void LyXText::checkParagraph(ParagraphList::iterator pit, pos_type pos) void LyXText::checkParagraph(ParagraphList::iterator pit, pos_type pos)
{ {
breakAgain(getRow(pit, pos)); breakAgain(getRow(pit, pos));
postPaint();
setCursorIntern(cursor.par(), cursor.pos(), false, cursor.boundary()); 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()) { if (getRow(old_cursor) != rows().begin()) {
RowList::iterator prevrow = boost::prior(getRow(old_cursor)); RowList::iterator prevrow = boost::prior(getRow(old_cursor));
postPaint();
tmpcursor = cursor; tmpcursor = cursor;
cursor = old_cursor; // that undo can restore the right cursor position cursor = old_cursor; // that undo can restore the right cursor position
#warning FIXME. --end() iterator is usable here #warning FIXME. --end() iterator is usable here
@ -2157,7 +2149,6 @@ bool LyXText::deleteEmptyParagraphMechanism(LyXCursor const & old_cursor)
setHeightOfRow(prevrow); setHeightOfRow(prevrow);
} else { } else {
RowList::iterator nextrow = boost::next(getRow(old_cursor)); RowList::iterator nextrow = boost::next(getRow(old_cursor));
postPaint();
tmpcursor = cursor; tmpcursor = cursor;
cursor = old_cursor; // that undo can restore the right cursor position 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 bool LyXText::isInInset() const
{ {
// Sub-level has non-null bv owner and // Sub-level has non-null bv owner and

View File

@ -74,11 +74,7 @@ namespace {
else else
bv->repaint(); bv->repaint();
} }
if (!lt->isInInset()) { bv->update();
bv->update(lt, BufferView::SELECT);
} else if (bv->text->needRefresh()) {
bv->update(BufferView::SELECT);
}
if (!lt->selection.set()) if (!lt->selection.set())
bv->haveSelection(false); bv->haveSelection(false);
@ -434,7 +430,6 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
// we can set the refreshing parameters now // we can set the refreshing parameters now
updateCounters(); updateCounters();
redoHeightOfParagraph(); redoHeightOfParagraph();
postPaint();
setCursor(cursor.par(), cursor.pos()); setCursor(cursor.par(), cursor.pos());
update(); update();
break; break;

View File

@ -156,10 +156,6 @@ bool performUndoOrRedo(BufferView * bv, Undo & undo)
} }
finishUndo(); finishUndo();
// And repaint the lot
bv->text->postPaint();
return true; return true;
} }
@ -177,7 +173,6 @@ bool textUndoOrRedo(BufferView * bv,
freezeUndo(); freezeUndo();
bv->unlockInset(bv->theLockingInset()); bv->unlockInset(bv->theLockingInset());
finishUndo(); finishUndo();
bv->text->postPaint();
unFreezeUndo(); unFreezeUndo();
return false; return false;
} }