From: Lars Gullik Bjønnes Date: Tue, 5 Mar 2002 23:02:37 +0000 (+0000) Subject: get rid of Paragraph::clear X-Git-Tag: 1.6.10~19726 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=26f07a39bcce38800814623f6cbe27d9a037ea68;p=lyx.git get rid of Paragraph::clear git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3672 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/ChangeLog b/src/ChangeLog index f75c9ed9d1..adee1a9bf8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,19 @@ +2002-03-06 Lars Gullik Bjønnes + + * paragraph.C (breakParagraph): dont call clear do the work manually + + * paragraph.[Ch] (clear): remove function + +2002-03-05 Lars Gullik Bjønnes + + * 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 * BufferView_pimpl.C: protect selectionLost against text == 0 diff --git a/src/CutAndPaste.C b/src/CutAndPaste.C index 34dbf7ed11..2081ec2765 100644 --- a/src/CutAndPaste.C +++ b/src/CutAndPaste.C @@ -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); diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 7de29516de..e6002b7a3c 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,7 @@ +2002-03-06 Lars Gullik Bjønnes + + * insetert.C (getMaxWidth): make w unsigned int. + 2002-03-05 Juergen Vigna * insetert.C (status): change behaviour of Inlined. diff --git a/src/insets/insetert.C b/src/insets/insetert.C index 982a249e29..2f8ab8b917 100644 --- a/src/insets/insetert.C +++ b/src/insets/insetert.C @@ -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); diff --git a/src/lyxtextclass.C b/src/lyxtextclass.C index 7fdb478d96..ff19fbc493 100644 --- a/src/lyxtextclass.C +++ b/src/lyxtextclass.C @@ -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; diff --git a/src/paragraph.C b/src/paragraph.C index bcc3eb9864..618504e940 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -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; } diff --git a/src/paragraph.h b/src/paragraph.h index 3a6999528e..9523a23a7c 100644 --- a/src/paragraph.h +++ b/src/paragraph.h @@ -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 */