]> git.lyx.org Git - lyx.git/commitdiff
get rid of Paragraph::clear
authorLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 5 Mar 2002 23:02:37 +0000 (23:02 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 5 Mar 2002 23:02:37 +0000 (23:02 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3672 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/CutAndPaste.C
src/insets/ChangeLog
src/insets/insetert.C
src/lyxtextclass.C
src/paragraph.C
src/paragraph.h

index f75c9ed9d1dda3390b7f3123aea8912e9eaf933b..adee1a9bf87ec012e1c8e2a1787cf695d92d56e4 100644 (file)
@@ -1,3 +1,19 @@
+2002-03-06  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * paragraph.C (breakParagraph): dont call clear do the work manually
+
+       * paragraph.[Ch] (clear): remove function 
+
+2002-03-05  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * paragraph.C (Paragraph): dont call clear, the work has already
+       been done.
+
+       * lyxtextclass.C (operator): assert if n is empty
+
+       * CutAndPaste.C (cutSelection): dont call Paragraph::clear, do the
+       work manually instead.
+
 2002-03-01  John Levon  <moz@compsoc.man.ac.uk>
 
        * BufferView_pimpl.C: protect selectionLost against text == 0
index 34dbf7ed11d38377d672d47928aa8fc543963c1a..2081ec2765e66a773af54c9121e4443746f8bce0 100644 (file)
@@ -131,9 +131,12 @@ bool CutAndPaste::cutSelection(Paragraph * startpar, Paragraph ** endpar,
                (*endpar)->previous(startpar);
                
                // the cut selection should begin with standard layout
-               if (realcut)
-                       buf->clear(); 
-               
+               if (realcut) {
+                       buf->params().clear();
+                       buf->bibkey = 0;
+                       buf->layout(textclasslist[current_view->buffer()->params.textclass].defaultLayoutName());
+               }
+
                // paste the paragraphs again, if possible
                if (doclear)
                        startpar->next()->stripLeadingSpaces(textclass);
index 7de29516def7ec6c7b1fe2a78063e64c174adcfd..e6002b7a3cb1f952d965f140eb9d7a66c3d0b313 100644 (file)
@@ -1,3 +1,7 @@
+2002-03-06  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * insetert.C (getMaxWidth): make w unsigned int.
+
 2002-03-05  Juergen Vigna  <jug@sad.it>
 
        * insetert.C (status): change behaviour of Inlined.
index 982a249e29ccbd074dbc917d92c63f3cc740997a..2f8ab8b9177c94fe71ab9c18d110899541edaba1 100644 (file)
@@ -693,7 +693,7 @@ void InsetERT::getDrawFont(LyXFont & font) const
 
 int InsetERT::getMaxWidth(BufferView * bv, UpdatableInset const * in) const
 {
-       int w = InsetCollapsable::getMaxWidth(bv, in);
+       unsigned int w = InsetCollapsable::getMaxWidth(bv, in);
        if (status_ != Inlined || w < 0)
                return w;
        LyXText * text = inset.getLyXText(bv);
index 7fdb478d96bb26b6b507b724ba2b70bb59bd7803..ff19fbc4934c40c6e28ae83dabb78f299f5fd4da 100644 (file)
@@ -505,6 +505,8 @@ bool LyXTextClass::hasLayout(string const & n) const
 
 LyXLayout const & LyXTextClass::operator[](string const & n) const
 {
+       lyx::Assert(!n.empty());
+       
        if (n.empty())
                lyxerr << "Operator[] called with empty n" << endl;
        
@@ -530,6 +532,8 @@ LyXLayout const & LyXTextClass::operator[](string const & n) const
 
 LyXLayout & LyXTextClass::operator[](string const & n)
 {
+       lyx::Assert(!n.empty());
+
        if (n.empty())
                lyxerr << "Operator[] called with empty n" << endl;
 
index bcc3eb9864240f454ecbe1ed5da11cf3df279b7f..618504e9408393b0587adaa7f67358eb47dfe524 100644 (file)
@@ -86,7 +86,6 @@ Paragraph::Paragraph()
        enumdepth = 0;
        itemdepth = 0;
        bibkey = 0; // ale970302
-       clear();
 }
 
 
@@ -108,8 +107,6 @@ Paragraph::Paragraph(Paragraph * par)
        // end
 
        bibkey = 0; // ale970302        
-
-       clear();
 }
 
 
@@ -472,17 +469,6 @@ bool Paragraph::insertFromMinibuffer(pos_type pos)
 // end of minibuffer
 
 
-
-void Paragraph::clear()
-{
-       params().clear();
-
-       layout_.erase();
-
-       bibkey = 0;
-}
-
-
 void Paragraph::erase(pos_type pos)
 {
        pimpl_->erase(pos);
@@ -909,7 +895,11 @@ void Paragraph::breakParagraph(BufferParams const & bparams,
                tmp->params().pagebreakTop(params().pagebreakTop());
                tmp->params().spaceTop(params().spaceTop());
                tmp->bibkey = bibkey;
-               clear();
+
+               bibkey = 0;
+               params().clear();
+               layout(textclasslist[bparams.textclass].defaultLayoutName());
+               
                // layout stays the same with latex-environments
                if (flag) {
                        layout(tmp->layout());
@@ -2124,6 +2114,8 @@ string const & Paragraph::layout() const
 
 void Paragraph::layout(string const & new_layout)
 {
+       lyx::Assert(!new_layout.empty());
+       
        layout_ = new_layout;
 }
 
index 3a6999528e206009b402fba80e490298dac6a2f2..9523a23a7cb73464533ad78c28294a8a451620e6 100644 (file)
@@ -309,11 +309,6 @@ public:
        /// 
        bool isWord(lyx::pos_type pos) const;
 
-       /** This one resets all layout and dtp switches but not the font
-           of the single characters
-       */ 
-       void clear();
-
        /** paste this paragraph with the next one
            be carefull, this doesent make any check at all
        */