]> git.lyx.org Git - lyx.git/commitdiff
rowlist8
authorLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 1 Apr 2003 00:01:42 +0000 (00:01 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 1 Apr 2003 00:01:42 +0000 (00:01 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6665 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/insets/ChangeLog
src/insets/insetert.C
src/insets/insetminipage.C
src/lyxtext.h
src/text2.C

index 6e8cfdd7f0dd34edb7a4496c23aa0e4a8b46a430..6f1eedf0e796778640a843fe11ffff66879ec895 100644 (file)
@@ -1,3 +1,11 @@
+2003-04-01  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * text2.C (redoParagraphs): rewrite (with help from Alfredo) for
+       RowList::iterator.
+
+       * lyxtext.h (rows): drop one version and leve a const variant that
+       returns a RowList::iterator.
+
 2003-03-31  Angus Leeming  <leeming@lyx.org>
 
        * text.C (fill): ensure that the signature is the same as that in the
index 6da95bf9e98e0957a8a7ffe3c5a2b33a1c5da8f0..28a3517dc358b3de45b9e99adb2636f13ef6c901 100644 (file)
@@ -1,3 +1,9 @@
+2003-04-01  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * insetminipage.C (localDispatch): adjust
+
+       * insetert.C (localDispatch): adjust
+
 2003-03-31  John Levon  <levon@movementarian.org>
 
        * insetgraphics.C:
index 6499ea54b173deb16d5bf7c7dce0f3c24e71fa5e..37fc79acc64456f9aa8825f7a73db9708581581b 100644 (file)
@@ -455,7 +455,7 @@ Inset::RESULT InsetERT::localDispatch(FuncRequest const & cmd)
                 * taken by the text).
                 */
                LyXText * t = inset.getLyXText(cmd.view());
-               t->need_break_row = &*t->rows().begin();
+               t->need_break_row = t->rows().begin();
                t->fullRebreak();
                t->setCursorIntern(t->cursor.par(), t->cursor.pos());
                inset.update(cmd.view(), true);
index bc0ffda2d158904d00de023d7d31ab821cd92214..892473647d078755fb0f72166d36c5851f6c2763 100644 (file)
@@ -120,7 +120,7 @@ dispatch_result InsetMinipage::localDispatch(FuncRequest const & cmd)
                /* FIXME: I refuse to believe we have to live
                 * with ugliness like this ... */
                LyXText * t = inset.getLyXText(cmd.view());
-               t->need_break_row = &*t->rows().begin();
+               t->need_break_row = t->rows().begin();
                t->fullRebreak();
                inset.update(cmd.view(), true);
                t->setCursorIntern(t->cursor.par(), t->cursor.pos());
index 8b3f2c01113971f84ebcbff3ca9aa29ec64cb34e..44ce1d749e781e3baa457d80df55e7b4841b4125 100644 (file)
@@ -247,10 +247,7 @@ public:
        RowList::iterator
        getRow(Paragraph * par, lyx::pos_type pos, int & y) const;
 
-       RowList & rows() {
-               return rowlist_;
-       }
-       RowList const & rows() const {
+       RowList & rows() const {
                return rowlist_;
        }
 
index d0b793b8662548414043bc1d2e576a2e443126c5..938da8bab06a39b19eac8caf05d82ce5eb2f02fd 100644 (file)
@@ -679,83 +679,72 @@ void LyXText::redoDrawingOfParagraph(LyXCursor const & cur)
 void LyXText::redoParagraphs(LyXCursor const & cur,
                             Paragraph const * endpar)
 {
-       Row * tmprow = cur.row();
+       RowList::iterator tmprit = cur.row();
 
-       int y = cur.y() - tmprow->baseline();
+       int y = cur.y() - tmprit->baseline();
 
        Paragraph * first_phys_par = 0;
-       if (!tmprow->previous()) {
+       if (tmprit == rows().begin()) {
                // a trick/hack for UNDO
                // This is needed because in an UNDO/REDO we could have changed
                // the ownerParagrah() so the paragraph inside the row is NOT
                // my really first par anymore. Got it Lars ;) (Jug 20011206)
                first_phys_par = ownerParagraph();
        } else {
-               first_phys_par = tmprow->par();
-
-               // Find first row of this paragraph.
-               while (tmprow->previous()
-                      && tmprow->previous()->par() == first_phys_par)
+               first_phys_par = tmprit->par();
+               while (tmprit != rows().begin()
+                      && boost::prior(tmprit)->par() == first_phys_par)
                {
-                       tmprow = tmprow->previous();
-                       y -= tmprow->height();
+                       --tmprit;
+                       y -= tmprit->height();
                }
        }
 
-       Row * prevrow = tmprow->previous();
+       RowList::iterator prevrit;
+       if (tmprit != rows().begin()) {
+               prevrit = boost::prior(tmprit);
+       } else {
+               prevrit = tmprit;
+               y = prevrit ->height();
+       }
 
-       // Remove all the rows until we reach endpar
+       // remove it
        Paragraph * tmppar = 0;
-       if (tmprow->next())
-               tmppar = tmprow->next()->par();
-       while (tmprow->next() && tmppar != endpar) {
-               removeRow(tmprow->next());
-               if (tmprow->next()) {
-                       tmppar = tmprow->next()->par();
+       if (boost::next(tmprit) != rows().end())
+               tmppar = boost::next(tmprit)->par();
+       while (boost::next(tmprit) != rows().end() && tmppar != endpar) {
+               removeRow(boost::next(tmprit));
+               if (boost::next(tmprit) != rows().end()) {
+                       tmppar = boost::next(tmprit)->par();
                } else {
                        tmppar = 0;
                }
        }
 
-       // Remove the first of the paragraphs rows.
-       // This is because tmprow->previous() can be 0
-       Row * tmprow2 = tmprow;
-       tmprow = tmprow->previous();
-       removeRow(tmprow2);
+       // remove the first one
+       RowList::iterator tmprit2 = tmprit; /* this is because tmprow->previous()
+                                can be 0 */
+       ++tmprit;
+       removeRow(tmprit2);
 
        // Reinsert the paragraphs.
        tmppar = first_phys_par;
        do {
                if (tmppar) {
-                       if (!tmprow) {
-                               insertParagraph(tmppar, rowlist_.begin());
-                       } else {
-                               insertParagraph(tmppar, tmprow->next());
-                       }
-
-
-                       if (!tmprow) {
-                               tmprow = &*rows().begin();
-                       }
-                       while (tmprow->next()
-                              && tmprow->next()->par() == tmppar) {
-                               tmprow = tmprow->next();
+                       insertParagraph(tmppar, tmprit);
+                       while (tmprit != rows().end()
+                              && tmprit->par() == tmppar) {
+                               ++tmprit;
                        }
                        tmppar = tmppar->next();
                }
        } while (tmppar && tmppar != endpar);
 
-       // this is because of layout changes
-       if (prevrow) {
-               setHeightOfRow(prevrow);
-               const_cast<LyXText *>(this)->postPaint(y - prevrow->height());
-       } else {
-               setHeightOfRow(rows().begin());
-               const_cast<LyXText *>(this)->postPaint(0);
-       }
+       setHeightOfRow(prevrit);
+       const_cast<LyXText *>(this)->postPaint(y - prevrit->height());
 
-       if (tmprow && tmprow->next())
-               setHeightOfRow(tmprow->next());
+       if (tmprit != rows().end() && boost::next(tmprit) != rows().end())
+               setHeightOfRow(boost::next(tmprit));
        updateCounters();
 }
 
@@ -1230,7 +1219,6 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par)
                                textclass.counters().step(fl.type());
 
                                // Doesn't work... yet.
-#warning use boost.format
 #if USE_BOOST_FORMAT
                                s = boost::io::str(boost::format(_("%1$s #:")) % fl.name());
                                // s << boost::format(_("%1$s %1$d:")
@@ -1877,8 +1865,7 @@ void LyXText::setCurrentFont()
 // returns the column near the specified x-coordinate of the row
 // x is set to the real beginning of this column
 pos_type
-LyXText::getColumnNearX(RowList::iterator rit, int & x,
-                       bool & boundary) const
+LyXText::getColumnNearX(RowList::iterator rit, int & x, bool & boundary) const
 {
        float tmpx = 0.0;
        float fill_separator;