Clean out text.C of explicit mentions

Index: text.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v
retrieving revision 1.313
diff -u -p -r1.313 text.C
--- text.C      13 Mar 2003 21:19:00 -0000      1.313
+++ text.C      14 Mar 2003 02:18:51 -0000
@@ -1453,19 +1453,19 @@ void LyXText::breakParagraph(BufferView 
                cursorLeft(bview);
        }
 
-       status(bview, LyXText::NEED_MORE_REFRESH);
-       refresh_row = cursor.row();
-       refresh_y = cursor.y() - cursor.row()->baseline();
+       int y = cursor.y() - cursor.row()->baseline();
 
        // Do not forget the special right address boxes
        if (layout->margintype == MARGIN_RIGHT_ADDRESS_BOX) {
-               while (refresh_row->previous() &&
-                      refresh_row->previous()->par() == refresh_row->par())
-               {
-                       refresh_row = refresh_row->previous();
-                       refresh_y -= refresh_row->height();
+               Row * r = cursor.row();
+               while (r->previous() && r->previous()->par() == r->par()) {
+                       r = r->previous();
+                       y -= r->height();
                }
        }
+
+       postPaint(*bview, y);
+
        removeParagraph(cursor.row());
 
        // set the dimensions of the cursor row
@@ -1660,9 +1660,8 @@ void LyXText::insertChar(BufferView * bv
                        setHeightOfRow(bview, row->previous());
 
                        y -= row->previous()->height();
-                       refresh_y = y;
-                       refresh_row = row->previous();
-                       status(bview, LyXText::NEED_MORE_REFRESH);
+
+                       postPaint(*bview, y);
 
                        breakAgainOneRow(bview, row);
 
@@ -1695,9 +1694,7 @@ void LyXText::insertChar(BufferView * bv
        }
 
        if (c == Paragraph::META_INSET || row->fill() < 0) {
-               refresh_y = y;
-               refresh_row = row;
-               status(bview, LyXText::NEED_MORE_REFRESH);
+               postPaint(*bview, y);
                breakAgainOneRow(bview, row);
                // will the cursor be in another row now?
                if (row->lastPos() <= cursor.pos() + 1 && row->next()) {
@@ -1720,15 +1717,16 @@ void LyXText::insertChar(BufferView * bv
                else
                        need_break_row = 0;
        } else {
-               refresh_y = y;
-               refresh_row = row;
-
+               // FIXME: similar code is duplicated all over - make resetHeightOfRow
                int const tmpheight = row->height();
+
                setHeightOfRow(bview, row);
-               if (tmpheight == row->height())
-                       status(bview, LyXText::NEED_VERY_LITTLE_REFRESH);
-               else
-                       status(bview, LyXText::NEED_MORE_REFRESH);
+
+               if (tmpheight == row->height()) {
+                       postRowPaint(*bview, row, y);
+               } else {
+                       postPaint(*bview, y);
+               }
 
                current_font = rawtmpfont;
                real_current_font = realtmpfont;
@@ -2344,11 +2342,9 @@ void LyXText::changeCase(BufferView & bv
 
                ++pos;
        }
-       if (to.row() != from.row()) {
-               refresh_y = from.y() - from.row()->baseline();
-               refresh_row = from.row();
-               status(&bview, LyXText::NEED_MORE_REFRESH);
-       }
+
+       if (to.row() != from.row())
+               postPaint(bview, from.y() - fromt.row()->baseline());
 }
 
 
@@ -2468,9 +2464,7 @@ void LyXText::backspace(BufferView * bvi
                                int const tmpheight = cursor.row()->height();
                                setHeightOfRow(bview, cursor.row());
                                if (cursor.row()->height() != tmpheight) {
-                                       refresh_y = cursor.y() - 
cursor.row()->baseline();
-                                       refresh_row = cursor.row();
-                                       status(bview, LyXText::NEED_MORE_REFRESH);
+                                       postPaint(*bview, cursor.y() - 
cursor.row()->baseline());
                                }
                                return;
                        }
@@ -2524,9 +2518,7 @@ void LyXText::backspace(BufferView * bvi
                                if (cursor.pos())
                                        cursor.pos(cursor.pos() - 1);
 
-                       status(bview, LyXText::NEED_MORE_REFRESH);
-                       refresh_row = cursor.row();
-                       refresh_y = cursor.y() - cursor.row()->baseline();
+                       postPaint(*bview, cursor.y() - cursor.row()->baseline());
 
                        // remove the lost paragraph
                        // This one is not safe, since the paragraph that the tmprow 
and the
@@ -2655,9 +2647,8 @@ void LyXText::backspace(BufferView * bvi
                                tmprow->fill(fill(*bview, *tmprow, workWidth(*bview)));
                                setHeightOfRow(bview, tmprow);
 
-                               refresh_y = y;
-                               refresh_row = tmprow;
-                               status(bview, LyXText::NEED_MORE_REFRESH);
+                               postPaint(*bview, y);
+
                                setCursor(bview, cursor.par(), cursor.pos(),
                                          false, cursor.boundary());
                                //current_font = rawtmpfont;
@@ -2683,9 +2674,7 @@ void LyXText::backspace(BufferView * bvi
                        if (row->lastPos() == row->par()->size() - 1)
                                removeRow(row->next());
 
-                       refresh_y = y;
-                       refresh_row = row;
-                       status(bview, LyXText::NEED_MORE_REFRESH);
+                       postPaint(*bview, y);
 
                        breakAgainOneRow(bview, row);
                        // will the cursor be in another row now?
@@ -2706,12 +2695,11 @@ void LyXText::backspace(BufferView * bvi
                        row->fill(fill(*bview, *row, workWidth(*bview)));
                        int const tmpheight = row->height();
                        setHeightOfRow(bview, row);
-                       if (tmpheight == row->height())
-                               status(bview, LyXText::NEED_VERY_LITTLE_REFRESH);
-                       else
-                               status(bview, LyXText::NEED_MORE_REFRESH);
-                       refresh_y = y;
-                       refresh_row = row;
+                       if (tmpheight == row->height()) {
+                               postRowPaint(*bview, row, y);
+                       } else {
+                               postPaint(*bview, y);
+                       }
                        setCursor(bview, cursor.par(), cursor.pos(), false, 
cursor.boundary());
                }
        }
Index: insets/insettext.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettext.C,v
retrieving revision 1.356
diff -u -p -r1.356 insettext.C
--- insets/insettext.C  13 Mar 2003 13:56:25 -0000      1.356
+++ insets/insettext.C  14 Mar 2003 02:18:56 -0000
@@ -100,7 +100,6 @@ void InsetText::saveLyXTextState(LyXText
                sstate.selendboundary = t->selection.end.boundary();
                sstate.selection = t->selection.set();
                sstate.mark_set = t->selection.mark();
-               sstate.refresh = t->refresh_row != 0;
        } else {
                sstate.lpar = 0;
        }
@@ -109,26 +108,24 @@ void InsetText::saveLyXTextState(LyXText
 
 void InsetText::restoreLyXTextState(BufferView * bv, LyXText * t) const
 {
-       if (sstate.lpar) {
-               t->selection.set(true);
-               /* at this point just to avoid the Delete-Empty-Paragraph
-                * Mechanism when setting the cursor */
-               t->selection.mark(sstate.mark_set);
-               if (sstate.selection) {
-                       t->setCursor(bv, sstate.selstartpar, sstate.selstartpos,
-                                    true, sstate.selstartboundary);
-                       t->selection.cursor = t->cursor;
-                       t->setCursor(bv, sstate.selendpar, sstate.selendpos,
-                                    true, sstate.selendboundary);
-                       t->setSelection(bv);
-                       t->setCursor(bv, sstate.lpar, sstate.pos);
-               } else {
-                       t->setCursor(bv, sstate.lpar, sstate.pos, true, 
sstate.boundary);
-                       t->selection.cursor = t->cursor;
-                       t->selection.set(false);
-               }
-               if (sstate.refresh) {
-               }
+       if (!sstate.lpar)
+               return;
+
+       t->selection.set(true);
+       /* at this point just to avoid the DEPM when setting the cursor */
+       t->selection.mark(sstate.mark_set);
+       if (sstate.selection) {
+               t->setCursor(bv, sstate.selstartpar, sstate.selstartpos,
+                            true, sstate.selstartboundary);
+               t->selection.cursor = t->cursor;
+               t->setCursor(bv, sstate.selendpar, sstate.selendpos,
+                            true, sstate.selendboundary);
+               t->setSelection(bv);
+               t->setCursor(bv, sstate.lpar, sstate.pos);
+       } else {
+               t->setCursor(bv, sstate.lpar, sstate.pos, true, sstate.boundary);
+               t->selection.cursor = t->cursor;
+               t->selection.set(false);
        }
 }
 
Index: insets/insettext.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettext.h,v
retrieving revision 1.142
diff -u -p -r1.142 insettext.h
--- insets/insettext.h  6 Mar 2003 10:02:39 -0000       1.142
+++ insets/insettext.h  14 Mar 2003 02:18:56 -0000
@@ -412,7 +412,6 @@ private:
                bool selendboundary;
                bool selection;
                bool mark_set;
-               bool refresh;
        };
        ///
        mutable save_state sstate;

Reply via email to