]> git.lyx.org Git - features.git/commitdiff
rewrite ::status a bit so it's more obvious what's going on
authorJohn Levon <levon@movementarian.org>
Fri, 14 Mar 2003 01:49:19 +0000 (01:49 +0000)
committerJohn Levon <levon@movementarian.org>
Fri, 14 Mar 2003 01:49:19 +0000 (01:49 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6497 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/text2.C

index 26094f87c429ba20a06130716209fbd93c6b3951..ae031cbce8fe7e68b1f9ca18794236f3f2936876 100644 (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>
 
        * lyxtext.h: add some docs
index cfcbe8847a97e0dbd69746886bb4c1d8ac2256ac..3575e7acc8a69276d891d1d8277ec483533b6d98 100644 (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;
 
-       // 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();
        }
 }