This is probably the the first of a series of small patches that try to
get rid of calls to getPar() before the rowlist split.

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...)
? .diff.diff.swp
? 1.diff
? 2.diff
? abel
? diff.diff
? fullredraw.diff
? parrow-1.diff
? parrow-2.diff
? parrow-3.diff
? parrow-4-broken.diff
? parrow-5.diff
? parrow-6.diff
? parrow-7.1.diff
? parrow-7.2.diff
? parrow-7.diff
? parrow-8-broken.diff
? parrow-9-broken.diff
? insets/1.diff
Index: lyxtext.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxtext.h,v
retrieving revision 1.211
diff -u -p -r1.211 lyxtext.h
--- lyxtext.h   14 Aug 2003 08:34:13 -0000      1.211
+++ lyxtext.h   14 Aug 2003 08:46:56 -0000
@@ -404,7 +404,7 @@ private:
                             RowList::iterator rowit);
 
        /// Calculate and set the height of the row
-       void setHeightOfRow(RowList::iterator rit);
+       void setHeightOfRow(ParagraphList::iterator, RowList::iterator rit);
 
        // fix the cursor `cur' after a characters has been deleted at `where'
        // position. Called by deleteEmptyParagraphMechanism
@@ -482,7 +482,8 @@ private:
                Row const & row) const;
 
        /// returns the minimum space a row needs on the screen in pixel
-       int fill(RowList::iterator row, int workwidth) const;
+       int fill(ParagraphList::iterator pit,
+               RowList::iterator row, int workwidth) const;
 
        /**
         * returns the minimum space a manual label needs on the
Index: text.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v
retrieving revision 1.413
diff -u -p -r1.413 text.C
--- text.C      14 Aug 2003 08:34:13 -0000      1.413
+++ text.C      14 Aug 2003 08:46:57 -0000
@@ -605,18 +605,12 @@ int LyXText::leftMargin(ParagraphList::i
                // are *NOT* allowed in the LaTeX realisation of this layout.
 
                // find the first row of this paragraph
-               RowList::iterator tmprit = rowlist_.begin();
-               while (tmprit != rowlist_.end()
-                      && getPar(tmprit) != pit)
-                       ++tmprit;
-
-               int minfill = tmprit->fill();
-               while (boost::next(tmprit) != rowlist_.end() &&
-                      getPar(boost::next(tmprit)) == pit) {
-                       ++tmprit;
-                       if (tmprit->fill() < minfill)
-                               minfill = tmprit->fill();
-               }
+               RowList::iterator rit = beginRow(pit);
+               RowList::iterator end = endRow(pit);
+               int minfill = rit->fill();
+               for ( ; rit != end; ++rit)
+                       if (rit->fill() < minfill)
+                               minfill = rit->fill();
 
                x += font_metrics::signedWidth(layout->leftmargin,
                        tclass.defaultfont());
@@ -875,14 +869,14 @@ pos_type LyXText::rowBreakPoint(Paragrap
 
 
 // returns the minimum space a row needs on the screen in pixel
-int LyXText::fill(RowList::iterator row, int paper_width) const
+int LyXText::fill(ParagraphList::iterator pit,
+       RowList::iterator row, int paper_width) const
 {
        if (paper_width < 0)
                return 0;
 
        int w;
        // get the pure distance
-       ParagraphList::iterator pit = getPar(row);
        pos_type const last = lastPrintablePos(*this, pit, row);
 
        LyXLayout_ptr const & layout = pit->layout();
@@ -1009,7 +1003,7 @@ LColor::color LyXText::backgroundColor()
 }
 
 
-void LyXText::setHeightOfRow(RowList::iterator rit)
+void LyXText::setHeightOfRow(ParagraphList::iterator pit, RowList::iterator rit)
 {
        Assert(rit != rows().end());
 
@@ -1021,8 +1015,6 @@ void LyXText::setHeightOfRow(RowList::it
        // ok, let us initialize the maxasc and maxdesc value.
        // Only the fontsize count. The other properties
        // are taken from the layoutfont. Nicer on the screen :)
-       ParagraphList::iterator pit = getPar(rit);
-
        LyXLayout_ptr const & layout = pit->layout();
 
        // as max get the first character of this row then it can increase but not
@@ -2076,7 +2068,7 @@ void LyXText::backspace()
                                cursorLeft(bv());
 
                                // the layout things can change the height of a row !
-                               setHeightOfRow(cursorRow());
+                               setHeightOfRow(cursor.par(), cursorRow());
                                return;
                        }
                }
Index: text2.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text2.C,v
retrieving revision 1.428
diff -u -p -r1.428 text2.C
--- text2.C     14 Aug 2003 08:34:13 -0000      1.428
+++ text2.C     14 Aug 2003 08:46:57 -0000
@@ -299,9 +299,9 @@ void LyXText::insertParagraph(ParagraphL
 
                // Set the dimensions of the row
                // fixed fill setting now by calling inset->update() in
-               // SingleWidth when needed!
-               tmprow->fill(fill(tmprow, workWidth()));
-               setHeightOfRow(tmprow);
+               // singleWidth when needed!
+               tmprow->fill(fill(pit, tmprow, workWidth()));
+               setHeightOfRow(pit, tmprow);
 
        } while (!done);
 }
@@ -732,10 +732,11 @@ void LyXText::cursorEnd()
 
        RowList::iterator rit = cursorRow();
        RowList::iterator next_rit = boost::next(rit);
+       RowList::iterator end = boost::next(rit);
        ParagraphList::iterator pit = cursor.par();
        pos_type last_pos = lastPos(*this, pit, rit);
 
-       if (next_rit == rows().end() || getPar(next_rit) != pit) {
+       if (next_rit == end) {
                ++last_pos;
        } else {
                if (pit->empty() ||
@@ -2010,7 +2011,7 @@ bool LyXText::deleteEmptyParagraphMechan
                                redoParagraph(getPar(tmprit));
                                updateCounters();
                        }
-                       setHeightOfRow(prevrow);
+                       setHeightOfRow(getPar(prevrow), prevrow);
                } else {
                        RowList::iterator nextrow = boost::next(getRow(old_cursor));
 
Index: text3.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text3.C,v
retrieving revision 1.111
diff -u -p -r1.111 text3.C
--- text3.C     14 Aug 2003 08:34:13 -0000      1.111
+++ text3.C     14 Aug 2003 08:46:57 -0000
@@ -409,7 +409,7 @@ InsetOld::RESULT LyXText::dispatch(FuncR
                        if (tmp->params().startOfAppendix()) {
                                recordUndo(bv, Undo::ATOMIC, tmp);
                                tmp->params().startOfAppendix(false);
-                               setHeightOfRow(getRow(tmp, 0));
+                               setHeightOfRow(tmp, getRow(tmp, 0));
                                break;
                        }
                }

Reply via email to