]> git.lyx.org Git - lyx.git/commitdiff
more ParagraphList::iterator usage
authorLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 4 Mar 2003 19:52:35 +0000 (19:52 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 4 Mar 2003 19:52:35 +0000 (19:52 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6343 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/paragraph.C
src/paragraph.h
src/paragraph_funcs.C
src/paragraph_funcs.h

index 9c62bc2afc04080bb3385c25af645cb799a6f956..9b7e289a15c6f6ca3d34455f39b70b4d26387bfa 100644 (file)
@@ -1,5 +1,14 @@
 2003-03-04  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
+       * paragraph_funcs.C (breakParagraph): take ParagraphList::iterator
+       as arg
+       (breakParagraphConservative): ditto
+
+       * paragraph.h: remove the breakParagraph friend
+
+       * paragraph.C (eraseIntern): new function
+       (setChange): new function
+
        * paragraph_funcs.C (mergeParagraph): make it take a
        ParagraphList::iterator instead of a Paragraph *, adjust
        accordingly.
index 75824ab36bd62913c49e5a3cdd1275b9be698210..517c9f00692b1264ab4ba05b9960cd8f70da9c94 100644 (file)
@@ -376,6 +376,12 @@ bool Paragraph::insertFromMinibuffer(pos_type pos)
 // end of minibuffer
 
 
+void Paragraph::eraseIntern(lyx::pos_type pos)
+{
+       pimpl_->eraseIntern(pos);
+}
+
+
 void Paragraph::erase(pos_type pos)
 {
        pimpl_->erase(pos);
@@ -1522,6 +1528,13 @@ bool Paragraph::isChangeEdited(pos_type start, pos_type end) const
 }
 
 
+void Paragraph::setChange(lyx::pos_type pos, Change::Type type)
+{
+       pimpl_->setChange(pos, type);
+
+}
+
+
 void Paragraph::markErased()
 {
        pimpl_->markErased();
index 62a82b68308ee8d8f85f3e5babad470382d71436..e7192c8d460da7faca797117ec0f4bb31e689e96 100644 (file)
@@ -183,6 +183,9 @@ public:
        /// is there a non-addition in this range ?
        bool isChangeEdited(lyx::pos_type start, lyx::pos_type end) const;
 
+       /// set change at pos
+       void setChange(lyx::pos_type pos, Change::Type type);
+
        /// accept change
        void acceptChange(lyx::pos_type start, lyx::pos_type end);
 
@@ -218,6 +221,8 @@ public:
        ///
        void applyLayout(LyXLayout_ptr const & new_layout);
 
+       /// definite erase
+       void eraseIntern(lyx::pos_type pos);
        /// erase the char at the given position
        void erase(lyx::pos_type pos);
        /// erase the given range. Returns true if actually erased.
@@ -314,10 +319,6 @@ public:
        InsetList insetlist;
        ///
        //Counters & counters();
-
-       friend void breakParagraph(BufferParams const & bparams,
-                   Paragraph * par, lyx::pos_type pos, int flag);
-
 private:
        ///
        LyXLayout_ptr layout_;
index 638da10a767b4012432b6cf70832d204a4ead5f8..2bc417722464ac5af9947a4e3e05a304f7b39e98 100644 (file)
@@ -30,12 +30,12 @@ using std::endl;
 using std::ostream;
 
 void breakParagraph(BufferParams const & bparams,
-                   Paragraph * par,
+                   ParagraphList::iterator par,
                    pos_type pos,
                    int flag)
 {
-       // create a new paragraph
-       Paragraph * tmp = new Paragraph(par);
+       // create a new paragraph, and insert into the list
+       Paragraph * tmp = new Paragraph(&*par);
        // without doing that we get a crash when typing <Return> at the
        // end of a paragraph
        tmp->layout(bparams.getLyXTextClass().defaultLayout());
@@ -89,12 +89,12 @@ void breakParagraph(BufferParams const & bparams,
                        Change::Type change(par->lookupChange(i));
                        par->cutIntoMinibuffer(bparams, i);
                        if (tmp->insertFromMinibuffer(j - pos)) {
-                               tmp->pimpl_->setChange(j - pos, change);
+                               tmp->setChange(j - pos, change);
                                ++j;
                        }
                }
                for (i = pos_end; i >= pos; --i) {
-                       par->pimpl_->eraseIntern(i);
+                       par->eraseIntern(i);
                }
        }
 
@@ -127,12 +127,12 @@ void breakParagraph(BufferParams const & bparams,
 
 
 void breakParagraphConservative(BufferParams const & bparams,
-                               Paragraph * par,
+                               ParagraphList::iterator par,
                                pos_type pos)
 {
        // create a new paragraph
-       Paragraph * tmp = new Paragraph(par);
-       tmp->makeSameLayout(par);
+       Paragraph * tmp = new Paragraph(&*par);
+       tmp->makeSameLayout(&*par);
 
        // When can pos > Last()?
        // I guess pos == Last() is possible.
index 82d54556ec05a5142a67aeacd44caf84cba40d3e..56054c8f2acb5d16aa0517d0e9e7efe9f418e7fd 100644 (file)
@@ -22,20 +22,21 @@ class TexRow;
 
 ///
 void breakParagraph(BufferParams const & bparams,
-                   Paragraph *,
+                   ParagraphList::iterator par,
                    lyx::pos_type pos,
                    int flag);
 
 ///
 void breakParagraphConservative(BufferParams const & bparams,
-                               Paragraph *,
+                               ParagraphList::iterator par,
                                lyx::pos_type pos);
 
 /**
  * Append the next paragraph onto the tail of this one.
  * Be careful, this doesent make any check at all.
  */
-void mergeParagraph(BufferParams const & bparams, ParagraphList::iterator);
+void mergeParagraph(BufferParams const & bparams,
+                   ParagraphList::iterator par);
 
 
 #if 0