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
This commit is contained in:
John Levon 2003-03-14 01:49:19 +00:00
parent 872473c800
commit 9d693fbf05
2 changed files with 26 additions and 21 deletions

View File

@ -1,3 +1,7 @@
2003-03-14 John Levon <levon@movementarian.org>
* text2.C: rewrite ::status() a bit
2003-03-13 John Levon <levon@movementarian.org> 2003-03-13 John Levon <levon@movementarian.org>
* lyxtext.h: add some docs * lyxtext.h: add some docs

View File

@ -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; LyXText * t = bview->text;
// We should only go up with refreshing code so this means that if // We are an inset's lyxtext. Tell the top-level lyxtext
// we have a MORE refresh we should never set it to LITTLE if we still // it needs to update the row we're in.
// didn't handle it (and then it will be UNCHANGED. Now as long as t->status(bview, NEED_VERY_LITTLE_REFRESH);
// we stay inside one LyXText this may work but we need to tell the if (!t->refresh_row) {
// outermost LyXText that it should REALLY draw us if there is some t->refresh_row = t->cursor.row();
// change in a Inset::LyXText. So you see that when we are inside a t->refresh_y = t->cursor.y() - t->cursor.row()->baseline();
// 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();
}
}
} }
} }