]> git.lyx.org Git - features.git/commitdiff
move pasteParagraph to global scope
authorLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 21 Aug 2002 17:35:24 +0000 (17:35 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 21 Aug 2002 17:35:24 +0000 (17:35 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5062 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/CutAndPaste.C
src/insets/ChangeLog
src/insets/insettext.C
src/paragraph.C
src/paragraph.h
src/paragraph_funcs.C
src/paragraph_funcs.h
src/text.C
src/text2.C

index 3bf8e880aaf901639402a3d121f9b770b90a5daf..c56303b2a8cca3d42adfb81a5648586e37cb5777 100644 (file)
@@ -1,3 +1,12 @@
+2002-08-21  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * text.C (backspace): pasteParagraph now in global scipe
+
+       * CutAndPaste.C (cutSelection): pasteParagraph now in global scope
+       (pasteSelection): ditto
+
+       * paragraph.[Ch] (pasteParagraph): move function to global scope ...
+       * paragraph_funcs.C (pasteParagraph): ... here
 
 2002-08-20  André Pönitz <poenitz@gmx.net>
 
@@ -8,7 +17,7 @@
 
 2002-08-21  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
-       * tabular.C: 
+       * tabular.C:
        * buffer.[Ch]: remove NO_COMPABILITY stuff
 
 2002-08-20  Lars Gullik Bjønnes  <larsbj@gullik.net>
index 230648add52e499f208bd11d6ac3f6cf310f91bc..91601f293414cf69c270a98f792badeb26698232 100644 (file)
@@ -149,7 +149,7 @@ bool CutAndPaste::cutSelection(Paragraph * startpar, Paragraph ** endpar,
                        startpar->next()->stripLeadingSpaces();
                if (startpar->hasSameLayout(startpar->next()) ||
                    startpar->next()->empty()) {
-                       startpar->pasteParagraph(current_view->buffer()->params);
+                       pasteParagraph(current_view->buffer()->params, startpar);
                        (*endpar) = startpar; // this because endpar gets deleted here!
                }
                // this paragraph's are of noone's owner!
@@ -365,20 +365,20 @@ bool CutAndPaste::pasteSelection(Paragraph ** par, Paragraph ** endpar,
                if ((*par)->next() == lastbuffer)
                        lastbuffer = *par;
 
-               (*par)->pasteParagraph(current_view->buffer()->params);
+               pasteParagraph(current_view->buffer()->params, *par);
                // store the new cursor position
                *par = lastbuffer;
                pos = lastbuffer->size();
                // maybe some pasting
                if (lastbuffer->next() && paste_the_end) {
                        if (lastbuffer->next()->hasSameLayout(lastbuffer)) {
-                               lastbuffer->pasteParagraph(current_view->buffer()->params);
+                               pasteParagraph(current_view->buffer()->params, lastbuffer);
                        } else if (lastbuffer->next()->empty()) {
                                lastbuffer->next()->makeSameLayout(lastbuffer);
-                               lastbuffer->pasteParagraph(current_view->buffer()->params);
+                               pasteParagraph(current_view->buffer()->params, lastbuffer);
                        } else if (lastbuffer->empty()) {
                                lastbuffer->makeSameLayout(lastbuffer->next());
-                               lastbuffer->pasteParagraph(current_view->buffer()->params);
+                               pasteParagraph(current_view->buffer()->params, lastbuffer);
                        } else
                                lastbuffer->next()->stripLeadingSpaces();
                }
index 73bd5ad5df2648f41a575fa63e7159a439221483..1bd2e210f177a813dccf83410dd17b6b68b12527 100644 (file)
@@ -1,3 +1,9 @@
+2002-08-21  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * insettext.C (collapseParagraphs): pasteParagraph now in global
+       scope
+       (appendParagraphs): ditto
+
 2002-08-21  Dekel Tsur  <dekelts@tau.ac.il>
 
        * insetcite.C (latex): Remove spaces only after commmas.
index 27dcbc7dfc7b54319f4bbd793f022e875736eba8..88a46381216d8d85daac9153fff197330e103f16 100644 (file)
@@ -37,6 +37,7 @@
 #include "trans_mgr.h"
 #include "undo_funcs.h"
 #include "WordLangTuple.h"
+#include "paragraph_funcs.h"
 
 #include "frontends/Alert.h"
 #include "frontends/Dialogs.h"
@@ -2729,7 +2730,7 @@ void InsetText::collapseParagraphs(BufferView * bv) const
                                        llt->selection.end.pos() + paragraphs.begin()->size());
                        }
                }
-               paragraphs.begin()->pasteParagraph(bparams);
+               pasteParagraph(bparams, &*paragraphs.begin());
        }
        reinitLyXText();
 }
@@ -2771,7 +2772,7 @@ void InsetText::appendParagraphs(BufferParams const & bparams,
        // paste it!
        lastbuffer->next(buf);
        buf->previous(lastbuffer);
-       lastbuffer->pasteParagraph(bparams);
+       pasteParagraph(bparams, lastbuffer);
 
        reinitLyXText();
 }
index 6695bb38446eee5f45a403730a243b9f950e41df..01f2f542fd85e966e03d423d9f9e22577683fb4a 100644 (file)
@@ -765,37 +765,6 @@ bool Paragraph::hasSameLayout(Paragraph const * par) const
 }
 
 
-// Be carefull, this does not make any check at all.
-// This method has wrong name, it combined this par with the next par.
-// In that sense it is the reverse of break paragraph. (Lgb)
-void Paragraph::pasteParagraph(BufferParams const & bparams)
-{
-       // copy the next paragraph to this one
-       Paragraph * the_next = next();
-
-       // first the DTP-stuff
-       params().lineBottom(the_next->params().lineBottom());
-       params().spaceBottom(the_next->params().spaceBottom());
-       params().pagebreakBottom(the_next->params().pagebreakBottom());
-
-       pos_type pos_end = the_next->pimpl_->size() - 1;
-       pos_type pos_insert = size();
-
-       // ok, now copy the paragraph
-       for (pos_type i = 0, j = 0; i <= pos_end; ++i) {
-               the_next->cutIntoMinibuffer(bparams, i);
-               if (insertFromMinibuffer(pos_insert + j))
-                       ++j;
-       }
-
-       // delete the next paragraph
-       Paragraph * ppar = the_next->previous_;
-       Paragraph * npar = the_next->next_;
-       delete the_next;
-       ppar->next(npar);
-}
-
-
 int Paragraph::getEndLabel() const
 {
        Paragraph const * par = this;
index d68e9a5e2e6537f02f343dec93644b570672beca..0b55d03cfac4bee1462c2c614395e05426264744 100644 (file)
@@ -273,11 +273,6 @@ public:
        ///
        bool isWord(lyx::pos_type pos) const;
 
-       /** paste this paragraph with the next one
-           be carefull, this doesent make any check at all
-       */
-       void pasteParagraph(BufferParams const &);
-
        /// returns -1 if inset not found
        int getPositionOfInset(Inset const * inset) const;
 
index 4486bae1b4722eddef55db8082c088f4e2ba9c6b..597444fa1e5742c8b8f71cc7cc30726b70bb7829 100644 (file)
@@ -1,10 +1,10 @@
 /* This file is part of
- * ====================================================== 
- * 
+ * ======================================================
+ *
  *           LyX, The Document Processor
- *      
+ *
  *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-2001 The LyX Team. 
+ *           Copyright 1995-2001 The LyX Team.
  *
  * ====================================================== */
 
@@ -33,10 +33,10 @@ void breakParagraph(BufferParams const & bparams,
        tmp->layout(bparams.getLyXTextClass().defaultLayout());
        // remember to set the inset_owner
        tmp->setInsetOwner(par->inInset());
-       
+
        // this is an idea for a more userfriendly layout handling, I will
        // see what the users say
-       
+
        // layout stays the same with latex-environments
        if (flag) {
                tmp->layout(par->layout());
@@ -44,22 +44,22 @@ void breakParagraph(BufferParams const & bparams,
        }
 
        bool isempty = (par->layout()->keepempty && par->empty());
-       
+
        if (!isempty && (par->size() > pos || par->empty() || flag == 2)) {
                tmp->layout(par->layout());
                tmp->params().align(par->params().align());
                tmp->setLabelWidthString(par->params().labelWidthString());
-               
+
                tmp->params().lineBottom(par->params().lineBottom());
                par->params().lineBottom(false);
                tmp->params().pagebreakBottom(par->params().pagebreakBottom());
                par->params().pagebreakBottom(false);
                tmp->params().spaceBottom(par->params().spaceBottom());
                par->params().spaceBottom(VSpace(VSpace::NONE));
-               
+
                tmp->params().depth(par->params().depth());
                tmp->params().noindent(par->params().noindent());
-               
+
                // copy everything behind the break-position
                // to the new paragraph
                pos_type pos_end = par->size() - 1;
@@ -74,7 +74,7 @@ void breakParagraph(BufferParams const & bparams,
                        par->erase(i);
                }
        }
-       
+
        // just an idea of me
        if (!pos) {
                tmp->params().lineTop(par->params().lineTop());
@@ -86,7 +86,7 @@ void breakParagraph(BufferParams const & bparams,
                par->params().clear();
 
                par->layout(bparams.getLyXTextClass().defaultLayout());
-               
+
                // layout stays the same with latex-environments
                if (flag) {
                        par->layout(tmp->layout());
@@ -117,7 +117,7 @@ void breakParagraphConservative(BufferParams const & bparams,
                        if (tmp->insertFromMinibuffer(j - pos))
                                ++j;
                }
-               
+
                for (pos_type k = pos_end; k >= pos; --k) {
                        par->erase(k);
                }
@@ -125,7 +125,6 @@ void breakParagraphConservative(BufferParams const & bparams,
 }
 
 
-#if 0
 // Be carefull, this does not make any check at all.
 // This method has wrong name, it combined this par with the next par.
 // In that sense it is the reverse of break paragraph. (Lgb)
@@ -158,6 +157,7 @@ void pasteParagraph(BufferParams const & bparams,
 }
 
 
+#if 0
 Paragraph * depthHook(Paragraph * par, Paragraph::depth_type depth)
 {
        Paragraph * newpar = par;
@@ -176,7 +176,7 @@ Paragraph * depthHook(Paragraph * par, Paragraph::depth_type depth)
 }
 
 
-Paragraph * outerHook(Paragraph * par) 
+Paragraph * outerHook(Paragraph * par)
 {
        if (!par->getDepth())
                return 0;
index 5d2a051384d3a0aadde3e6c48ef72c6b22f66cf9..c02a33006cb96adc9cf2e39df9f5891842ed9de4 100644 (file)
@@ -1,11 +1,11 @@
 // -*- C++ -*-
 /* This file is part of
- * ====================================================== 
- * 
+ * ======================================================
+ *
  *           LyX, The Document Processor
- *      
+ *
  *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-2001 The LyX Team. 
+ *           Copyright 1995-2001 The LyX Team.
  *
  * ====================================================== */
 
@@ -30,14 +30,14 @@ void breakParagraphConservative(BufferParams const & bparams,
                                Paragraph *,
                                lyx::pos_type pos);
 
-#if 0
 /** Paste this paragraph with the next one.
     Be carefull, this doesent make any check at all.
-*/ 
+*/
 void pasteParagraph(BufferParams const & bparams,
                    Paragraph *);
 
 
+#if 0
 /// for the environments
 Paragraph * depthHook(Paragraph * par, Paragraph::depth_type depth);
 
index ed074c4330ef2d94daf165efdfac8652ae614fd2..3b637993d29b475b3ddb15b20a47fd909b3651f4 100644 (file)
@@ -2796,7 +2796,7 @@ void LyXText::backspace(BufferView * bview)
                    && cursor.par()->getAlign() == tmppar->getAlign()) {
                        removeParagraph(tmprow);
                        removeRow(tmprow);
-                       cursor.par()->pasteParagraph(bview->buffer()->params);
+                       pasteParagraph(bview->buffer()->params, cursor.par());
 
                        if (!cursor.pos() || !cursor.par()->isSeparator(cursor.pos() - 1))
                                ; //cursor.par()->insertChar(cursor.pos(), ' ');
index 12e0bd5590e4bf1bb5923a7d5385f5ad0b899abc..7268ca2e3aca3bed6434bc64fc1e00fa31dc5cf9 100644 (file)
@@ -382,8 +382,8 @@ void LyXText::removeParagraph(Row * row) const
 void LyXText::insertParagraph(BufferView * bview, Paragraph * par,
                              Row * row) const
 {
-       // insert a new row, starting at position 0 
-       insertRow(row, par, 0); 
+       // insert a new row, starting at position 0
+       insertRow(row, par, 0);
 
        // set the counters
        setCounter(bview->buffer(), par);
@@ -1362,7 +1362,7 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const
                                s = o.str();
                        } else {
                                // par->SetLayout(0);
-                               // s = layout->labelstring; 
+                               // s = layout->labelstring;
                                s = (par->getParLanguage(buf->params)->lang() == "hebrew")
                                        ? " :úåòîùî øñç" : "Senseless: ";
                        }
@@ -1370,7 +1370,7 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const
                par->params().labelString(s);
 
                // reset the enumeration counter. They are always resetted
-               // when there is any other layout between 
+               // when there is any other layout between
                for (int i = par->enumdepth + 1; i < 4; i++) {
                        buf->counters().set(buf->counters().enums[i], 0);
                }