This moves closer towards full redraw but there are regressions:
Selection in tables gets slow and when selecting bottom up, the
selection anchor "moves" in parallel to the cursor.

Nested minipages, however, work just fine "at full speed", so this does
not look like a problem of 'full redraw' and/or InsetText but rather
something indroduced by the extra layer of entanglement in the tabular
code.

Looks like it's time for a decision. Ignore that or try to fix tabular
"first"?

Andre'

-- 
Those who desire to give up Freedom in order to gain Security, will not have,
nor do they deserve, either one.     (T. Jefferson or B. Franklin or both...)
Index: lyxtext.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxtext.h,v
retrieving revision 1.188
diff -u -p -r1.188 lyxtext.h
--- lyxtext.h   15 Jul 2003 11:47:27 -0000      1.188
+++ lyxtext.h   15 Jul 2003 12:48:51 -0000
@@ -170,11 +170,8 @@ public:
        /// clear any pending paints
        void clearPaint();
 
-       /// Mark position y as the starting point for a repaint
-       void postPaint(int start_y);
-
-       /// Mark the given row at position y as needing a repaint.
-       void postRowPaint(RowList::iterator rit, int start_y);
+       /// submit repaint request
+       void postPaint();
 
        ///
        Inset::RESULT dispatch(FuncRequest const & cmd);
@@ -192,14 +189,6 @@ public:
        bool needRefresh() const;
 
 private:
-       /**
-        * The pixel y position from which to repaint the screen.
-        * The position is absolute along the height of outermost
-        * lyxtext (I think). If need_refresh_ is true
-        * repaints use this as a starting point (if it's within
-        * the viewable portion of the lyxtext).
-        */
-       int refresh_y;
        // do we need a refresh?
        bool need_refresh_;
 
Index: text.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v
retrieving revision 1.376
diff -u -p -r1.376 text.C
--- text.C      10 Jul 2003 12:26:39 -0000      1.376
+++ text.C      15 Jul 2003 12:48:51 -0000
@@ -125,7 +125,7 @@ void LyXText::top_y(int newy)
        anchor_row_offset_ = newy - y;
        lyxerr[Debug::GUI] << "changing reference to row: " << &*anchor_row_
               << " offset: " << anchor_row_offset_ << endl;
-       postPaint(0);
+       postPaint();
 }
 
 
@@ -1518,20 +1518,7 @@ void LyXText::breakParagraph(ParagraphLi
                cursorLeft(bv());
        }
 
-       int y = cursor.y() - cursorRow()->baseline();
-
-       // Do not forget the special right address boxes
-       if (layout->margintype == MARGIN_RIGHT_ADDRESS_BOX) {
-               RowList::iterator r = cursorRow();
-               RowList::iterator beg = rows().begin();
-
-               while (r != beg && boost::prior(r)->par() == r->par()) {
-                       --r;
-                       y -= r->height();
-               }
-       }
-
-       postPaint(y);
+       postPaint();
 
        removeParagraph(cursorRow());
 
@@ -1690,9 +1677,8 @@ void LyXText::insertChar(char c)
 
        // get the cursor row fist
        RowList::iterator row = cursorRow();
-       int y = cursor.y() - row->baseline();
        if (c != Paragraph::META_INSET) {
-               // Here case LyXText::InsertInset  already insertet the character
+               // Here case LyXText::InsertInset  already inserted the character
                cursor.par()->insertChar(cursor.pos(), c);
        }
        setCharFont(bv()->buffer(), cursor.par(), cursor.pos(), rawtmpfont);
@@ -1728,9 +1714,7 @@ void LyXText::insertChar(char c)
 
                        setHeightOfRow(boost::prior(row));
 
-                       y -= boost::prior(row)->height();
-
-                       postPaint(y);
+                       postPaint();
 
                        breakAgainOneRow(row);
 
@@ -1765,7 +1749,7 @@ void LyXText::insertChar(char c)
        }
 
        if (c == Paragraph::META_INSET || row->fill() < 0) {
-               postPaint(y);
+               postPaint();
                breakAgainOneRow(row);
 
                RowList::iterator next_row = boost::next(row);
@@ -1803,12 +1787,7 @@ void LyXText::insertChar(char c)
                int const tmpheight = row->height();
 
                setHeightOfRow(row);
-
-               if (tmpheight == row->height()) {
-                       postRowPaint(row, y);
-               } else {
-                       postPaint(y);
-               }
+               postPaint();
 
                current_font = rawtmpfont;
                real_current_font = realtmpfont;
@@ -1820,12 +1799,6 @@ void LyXText::insertChar(char c)
        if (cursor.pos() && cursor.pos() == cursor.par()->size()
            && rawparfont != rawtmpfont) {
                redoHeightOfParagraph();
-       } else {
-               // now the special right address boxes
-               if (cursor.par()->layout()->margintype
-                   == MARGIN_RIGHT_ADDRESS_BOX) {
-                       redoDrawingOfParagraph(cursor);
-               }
        }
 
        charInserted();
@@ -2300,7 +2273,7 @@ void LyXText::changeCase(LyXText::TextCa
        }
 
        if (getRow(to) != getRow(from))
-               postPaint(from.y() - getRow(from)->baseline());
+               postPaint();
 }
 
 
@@ -2384,9 +2357,8 @@ void LyXText::backspace()
                                // the layout things can change the height of a row !
                                int const tmpheight = cursorRow()->height();
                                setHeightOfRow(cursorRow());
-                               if (cursorRow()->height() != tmpheight) {
-                                       postPaint(cursor.y() - 
cursorRow()->baseline());
-                               }
+                               if (cursorRow()->height() != tmpheight)
+                                       postPaint();
                                return;
                        }
                }
@@ -2440,7 +2412,7 @@ void LyXText::backspace()
                                if (cursor.pos())
                                        cursor.pos(cursor.pos() - 1);
 
-                       postPaint(cursor.y() - cursorRow()->baseline());
+                       postPaint();
 
                        // remove the lost paragraph
                        // This one is not safe, since the paragraph that the tmprow 
and the
@@ -2571,8 +2543,7 @@ void LyXText::backspace()
                                y -= tmprow->height();
                                tmprow->fill(fill(tmprow, workWidth()));
                                setHeightOfRow(tmprow);
-
-                               postPaint(y);
+                               postPaint();
 
                                setCursor(cursor.par(), cursor.pos(),
                                          false, cursor.boundary());
@@ -2600,7 +2571,7 @@ void LyXText::backspace()
                        if (lastPos(*this, row) == row->par()->size() - 1)
                                removeRow(boost::next(row));
 
-                       postPaint(y);
+                       postPaint();
 
                        breakAgainOneRow(row);
                        // will the cursor be in another row now?
@@ -2623,11 +2594,7 @@ void LyXText::backspace()
                        row->fill(fill(row, workWidth()));
                        int const tmpheight = row->height();
                        setHeightOfRow(row);
-                       if (tmpheight == row->height()) {
-                               postRowPaint(row, y);
-                       } else {
-                               postPaint(y);
-                       }
+                       postPaint();
                        setCursor(cursor.par(), cursor.pos(), false, 
cursor.boundary());
                }
        }
@@ -2648,12 +2615,6 @@ void LyXText::backspace()
        if (rawparfont !=
            cursor.par()->getFontSettings(bv()->buffer()->params, lastpos - 1)) {
                redoHeightOfParagraph();
-       } else {
-               // now the special right address boxes
-               if (cursor.par()->layout()->margintype
-                   == MARGIN_RIGHT_ADDRESS_BOX) {
-                       redoDrawingOfParagraph(cursor);
-               }
        }
 }
 
Index: text2.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text2.C,v
retrieving revision 1.387
diff -u -p -r1.387 text2.C
--- text2.C     15 Jul 2003 11:47:27 -0000      1.387
+++ text2.C     15 Jul 2003 12:48:51 -0000
@@ -63,8 +63,7 @@ LyXText::LyXText(BufferView * bv)
 {
        anchor_row_ = rows().end();
        need_break_row = rows().end();
-
-       clearPaint();
+       need_refresh_ = true;
 }
 
 
@@ -74,8 +73,7 @@ LyXText::LyXText(BufferView * bv, InsetT
 {
        anchor_row_ = rows().end();
        need_break_row = rows().end();
-
-       clearPaint();
+       need_refresh_ = true;
 }
 
 
@@ -86,7 +84,7 @@ void LyXText::init(BufferView * bview)
        rowlist_.clear();
        need_break_row = rows().end();
        width = height = 0;
-       clearPaint();
+       need_refresh_ = true;
 
        anchor_row_ = rows().end();
        anchor_row_offset_ = 0;
@@ -613,41 +611,21 @@ void LyXText::setFont(LyXFont const & fo
 void LyXText::redoHeightOfParagraph()
 {
        RowList::iterator tmprow = cursorRow();
-       int y = cursor.y() - tmprow->baseline();
 
        setHeightOfRow(tmprow);
 
        while (tmprow != rows().begin()
               && boost::prior(tmprow)->par() == tmprow->par()) {
                --tmprow;
-               y -= tmprow->height();
                setHeightOfRow(tmprow);
        }
 
-       postPaint(y);
+       postPaint();
 
        setCursor(cursor.par(), cursor.pos(), false, cursor.boundary());
 }
 
 
-void LyXText::redoDrawingOfParagraph(LyXCursor const & cur)
-{
-       RowList::iterator tmprow = getRow(cur);
-
-       int y = cur.y() - tmprow->baseline();
-       setHeightOfRow(tmprow);
-
-       while (tmprow != rows().begin()
-              && boost::prior(tmprow)->par() == tmprow->par())  {
-               --tmprow;
-               y -= tmprow->height();
-       }
-
-       postPaint(y);
-       setCursor(cur.par(), cur.pos());
-}
-
-
 // deletes and inserts again all paragraphs between the cursor
 // and the specified par
 // This function is needed after SetLayout and SetFont etc.
@@ -655,7 +633,6 @@ void LyXText::redoParagraphs(LyXCursor c
                             ParagraphList::iterator endpit)
 {
        RowList::iterator tmprit = getRow(cur);
-       int y = cur.y() - tmprit->baseline();
 
        ParagraphList::iterator first_phys_pit;
        RowList::iterator prevrit;
@@ -673,7 +650,6 @@ void LyXText::redoParagraphs(LyXCursor c
                       && boost::prior(tmprit)->par() == first_phys_pit)
                {
                        --tmprit;
-                       y -= tmprit->height();
                }
                prevrit = boost::prior(tmprit);
        }
@@ -697,13 +673,11 @@ void LyXText::redoParagraphs(LyXCursor c
                if (tmppit == endpit)
                        break;
        }
-       if (prevrit != rows().end()) {
+       if (prevrit != rows().end())
                setHeightOfRow(prevrit);
-               postPaint(y - prevrit->height());
-       } else {
+       else
                setHeightOfRow(rows().begin());
-               postPaint(0);
-       }
+       postPaint();
        if (tmprit != rows().end())
                setHeightOfRow(tmprit);
 
@@ -913,7 +887,6 @@ void LyXText::setParagraph(bool line_top
 
        while (tmppit != boost::prior(selection.start.par())) {
                setCursor(tmppit, 0);
-               postPaint(cursor.y() - cursorRow()->baseline());
 
                ParagraphList::iterator pit = cursor.par();
                ParagraphParameters & params = pit->params();
@@ -940,6 +913,7 @@ void LyXText::setParagraph(bool line_top
                params.noindent(noindent);
                tmppit = boost::prior(pit);
        }
+       postPaint();
 
        redoParagraphs(selection.start, endpit);
 
@@ -1446,19 +1420,16 @@ void LyXText::checkParagraph(ParagraphLi
 {
        LyXCursor tmpcursor;
 
-       int y = 0;
        pos_type z;
-       RowList::iterator row = getRow(pit, pos, y);
+       RowList::iterator row = getRow(pit, pos);
        RowList::iterator beg = rows().begin();
 
        // is there a break one row above
-       if (row != beg
-           && boost::prior(row)->par() == row->par()) {
+       if (row != beg && boost::prior(row)->par() == row->par()) {
                z = rowBreakPoint(*boost::prior(row));
                if (z >= row->pos()) {
                        // set the dimensions of the row above
-                       y -= boost::prior(row)->height();
-                       postPaint(y);
+                       postPaint();
 
                        breakAgain(boost::prior(row));
 
@@ -1471,25 +1442,8 @@ void LyXText::checkParagraph(ParagraphLi
                }
        }
 
-       int const tmpheight = row->height();
-       pos_type const tmplast = lastPos(*this, row);
-
        breakAgain(row);
-       if (row->height() == tmpheight && lastPos(*this, row) == tmplast) {
-               postRowPaint(row, y);
-       } else {
-               postPaint(y);
-       }
-
-       // check the special right address boxes
-       if (pit->layout()->margintype == MARGIN_RIGHT_ADDRESS_BOX) {
-               tmpcursor.par(pit);
-               tmpcursor.y(y);
-               tmpcursor.x(0);
-               tmpcursor.x_fix(0);
-               tmpcursor.pos(pos);
-               redoDrawingOfParagraph(tmpcursor);
-       }
+       postPaint();
 
        // set the cursor again. Otherwise dangling pointers are possible
        // also set the selection
@@ -2184,9 +2138,8 @@ bool LyXText::deleteEmptyParagraphMechan
                        && selection.cursor.pos() == old_cursor.pos());
 
                if (getRow(old_cursor) != rows().begin()) {
-                       RowList::iterator
-                               prevrow = boost::prior(getRow(old_cursor));
-                       postPaint(old_cursor.y() - getRow(old_cursor)->baseline() - 
prevrow->height());
+                       RowList::iterator prevrow = boost::prior(getRow(old_cursor));
+                       postPaint();
                        tmpcursor = cursor;
                        cursor = old_cursor; // that undo can restore the right cursor 
position
                        #warning FIXME. --end() iterator is usable here
@@ -2217,7 +2170,7 @@ bool LyXText::deleteEmptyParagraphMechan
                        setHeightOfRow(prevrow);
                } else {
                        RowList::iterator nextrow = boost::next(getRow(old_cursor));
-                       postPaint(old_cursor.y() - getRow(old_cursor)->baseline());
+                       postPaint();
 
                        tmpcursor = cursor;
                        cursor = old_cursor; // that undo can restore the right cursor 
position
@@ -2284,54 +2237,17 @@ bool LyXText::needRefresh() const
 void LyXText::clearPaint()
 {
        need_refresh_ = false;
-       refresh_y = 0;
 }
 
 
-void LyXText::postPaint(int start_y)
+void LyXText::postPaint()
 {
-       bool old = need_refresh_;
-
        need_refresh_ = true;
 
-       if (old && refresh_y < start_y)
-               return;
-
-       refresh_y = start_y;
-
-       if (!inset_owner)
-               return;
-
-       // We are an inset's lyxtext. Tell the top-level lyxtext
-       // it needs to update the row we're in.
-       LyXText * t = bv()->text;
-       t->postRowPaint(t->cursorRow(), t->cursor.y() - t->cursorRow()->baseline());
-}
-
-
-// FIXME: we should probably remove this y parameter,
-// make refresh_y be 0, and use row->y etc.
-void LyXText::postRowPaint(RowList::iterator rit, int start_y)
-{
-       if (need_refresh_ && refresh_y < start_y) {
-               need_refresh_ = true;
-               return;
-       }
-
-       refresh_y = start_y;
-
-       if (need_refresh_)
-               return;
-
-       need_refresh_ = true;
-
-       if (!inset_owner)
-               return;
-
-       // We are an inset's lyxtext. Tell the top-level lyxtext
-       // it needs to update the row we're in.
-       LyXText * t = bv()->text;
-       t->postRowPaint(t->cursorRow(), t->cursor.y() - t->cursorRow()->baseline());
+       // If we are an inset's lyxtext tell the top-level lyxtext
+       // it needs to repaint
+       if (inset_owner)
+               bv()->text->postPaint();
 }
 
 
Index: text3.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text3.C,v
retrieving revision 1.88
diff -u -p -r1.88 text3.C
--- text3.C     15 Jul 2003 11:08:01 -0000      1.88
+++ text3.C     15 Jul 2003 12:48:51 -0000
@@ -439,7 +439,7 @@ Inset::RESULT LyXText::dispatch(FuncRequ
                // we can set the refreshing parameters now
                updateCounters();
                redoHeightOfParagraph();
-               postPaint(0);
+               postPaint();
                setCursor(cursor.par(), cursor.pos());
                update();
                break;
Index: undo_funcs.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/undo_funcs.C,v
retrieving revision 1.74
diff -u -p -r1.74 undo_funcs.C
--- undo_funcs.C        30 Jun 2003 23:56:09 -0000      1.74
+++ undo_funcs.C        15 Jul 2003 12:48:51 -0000
@@ -38,7 +38,7 @@ void finishNoUndo(BufferView * bv)
        freezeUndo();
        bv->unlockInset(bv->theLockingInset());
        finishUndo();
-       bv->text->postPaint(0);
+       bv->text->postPaint();
        unFreezeUndo();
 }
 
@@ -153,7 +153,7 @@ bool textHandleUndo(BufferView * bv, Und
 
 
        finishUndo();
-       bv->text->postPaint(0);
+       bv->text->postPaint();
 
        lyxerr << "finished  textHandleUndo...\n";
        return true;
Index: frontends/screen.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/screen.C,v
retrieving revision 1.49
diff -u -p -r1.49 screen.C
--- frontends/screen.C  15 Jul 2003 11:08:01 -0000      1.49
+++ frontends/screen.C  15 Jul 2003 12:48:51 -0000
@@ -314,7 +314,7 @@ void LyXScreen::update(BufferView & bv, 
                int const vwidth = workarea().workWidth();
                int const vheight = workarea().workHeight();
                text->updateRowPositions();
-               int const y = max(int(text->refresh_y - text->top_y()), 0);
+               int const y = 0;
                drawFromTo(text, &bv, y, vheight, yo, xo);
                expose(0, y, vwidth, vheight - y);
        }
Index: insets/insettext.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettext.C,v
retrieving revision 1.429
diff -u -p -r1.429 insettext.C
--- insets/insettext.C  15 Jul 2003 11:08:02 -0000      1.429
+++ insets/insettext.C  15 Jul 2003 12:48:51 -0000
@@ -490,7 +490,7 @@ void InsetText::updateLocal(BufferView *
        bv->fitCursor();
 
        if (flag) {
-               text_.postPaint(0);
+               text_.postPaint();
                bv->updateInset(const_cast<InsetText *>(this));
        }
 

Reply via email to