From 9d693fbf05d3646ddf166b049bf083b1e25d94c8 Mon Sep 17 00:00:00 2001 From: John Levon Date: Fri, 14 Mar 2003 01:49:19 +0000 Subject: [PATCH] rewrite ::status a bit so it's more obvious what's going on git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6497 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 4 ++++ src/text2.C | 43 ++++++++++++++++++++++--------------------- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 26094f87c4..ae031cbce8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2003-03-14 John Levon + + * text2.C: rewrite ::status() a bit + 2003-03-13 John Levon * lyxtext.h: add some docs diff --git a/src/text2.C b/src/text2.C index cfcbe8847a..3575e7acc8 100644 --- a/src/text2.C +++ b/src/text2.C @@ -2465,30 +2465,31 @@ LyXText::text_status LyXText::status() const } -void LyXText::status(BufferView * bview, LyXText::text_status st) const +void LyXText::status(BufferView * bview, LyXText::text_status new_status) const { + // We should not lose information from previous status + // sets, or we'll forget to repaint the other bits + // covered by the NEED_MORE_REFRESH + if (new_status == NEED_VERY_LITTLE_REFRESH + && status_ == NEED_MORE_REFRESH) + return; + + status_ = new_status; + + if (new_status == UNCHANGED) + return; + + if (!inset_owner) + return; + LyXText * t = bview->text; - // We should only go up with refreshing code so this means that if - // we have a MORE refresh we should never set it to LITTLE if we still - // didn't handle it (and then it will be UNCHANGED. Now as long as - // we stay inside one LyXText this may work but we need to tell the - // outermost LyXText that it should REALLY draw us if there is some - // change in a Inset::LyXText. So you see that when we are inside a - // inset's LyXText we give the LITTLE to the outermost LyXText to - // tell'em that it should redraw the actual row (where the inset - // resides! Capito?! - - if (status_ != NEED_MORE_REFRESH || st != NEED_VERY_LITTLE_REFRESH) { - status_ = st; - if (inset_owner && st != UNCHANGED) { - t->status(bview, NEED_VERY_LITTLE_REFRESH); - if (!t->refresh_row) { - t->refresh_row = t->cursor.row(); - t->refresh_y = t->cursor.y() - - t->cursor.row()->baseline(); - } - } + // We are an inset's lyxtext. Tell the top-level lyxtext + // it needs to update the row we're in. + t->status(bview, NEED_VERY_LITTLE_REFRESH); + if (!t->refresh_row) { + t->refresh_row = t->cursor.row(); + t->refresh_y = t->cursor.y() - t->cursor.row()->baseline(); } } -- 2.39.2