From 9aee8a07b059bf8b8a35c6531cd4081a0291cad4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Sun, 25 May 2003 08:49:48 +0000 Subject: [PATCH] parlist-19-a.diff git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7042 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 11 +++++++++++ src/ParagraphList.C | 4 ++-- src/paragraph.C | 8 ++++---- src/paragraph.h | 8 +++----- src/paragraph_pimpl.C | 7 ++----- src/paragraph_pimpl.h | 2 +- src/undo_funcs.C | 15 ++++++++++++--- 7 files changed, 35 insertions(+), 20 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 111f4b33bd..48cb9638b2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2003-05-25 Lars Gullik Bjønnes + + * undo_funcs.C (createUndo): use the id functions directly, adjust. + + * paragraph_pimpl.C (Pimpl): get rid of same_ids parameter + + * paragraph.C (Paragraph): get rid of same_ids parameter + + * ParagraphList.C (insert): adjust + (push_back): adjust + 2003-05-24 Lars Gullik Bjønnes * paragraph_funcs.C (breakParagraph): adjust diff --git a/src/ParagraphList.C b/src/ParagraphList.C index 4b3f5bb434..0c70bee13d 100644 --- a/src/ParagraphList.C +++ b/src/ParagraphList.C @@ -112,7 +112,7 @@ ParagraphList & ParagraphList::operator=(ParagraphList const & rhs) ParagraphList::iterator ParagraphList::insert(ParagraphList::iterator it, Paragraph const & p) { - Paragraph * par = new Paragraph(p, false); + Paragraph * par = new Paragraph(p); if (it != end()) { Paragraph * prev = it->prev_par_; @@ -281,7 +281,7 @@ Paragraph & ParagraphList::back() void ParagraphList::push_back(Paragraph const & pr) { - Paragraph * p = new Paragraph(pr, false); + Paragraph * p = new Paragraph(pr); if (!parlist) { parlist = p; diff --git a/src/paragraph.C b/src/paragraph.C index 0d12383a6c..4034a5624c 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -80,8 +80,8 @@ Paragraph::Paragraph() } -Paragraph::Paragraph(Paragraph const & lp, bool same_ids) - : pimpl_(new Paragraph::Pimpl(*lp.pimpl_, this, same_ids)) +Paragraph::Paragraph(Paragraph const & lp) + : pimpl_(new Paragraph::Pimpl(*lp.pimpl_, this)) { enumdepth = 0; itemdepth = 0; @@ -93,13 +93,13 @@ Paragraph::Paragraph(Paragraph const & lp, bool same_ids) // follow footnotes layout_ = lp.layout(); buffer_ = lp.buffer_; - + // copy everything behind the break-position to the new paragraph insetlist = lp.insetlist; InsetList::iterator it = insetlist.begin(); InsetList::iterator end = insetlist.end(); for (; it != end; ++it) { - it.setInset(it.getInset()->clone(**buffer_, same_ids)); + it.setInset(it.getInset()->clone(**buffer_, false)); // tell the new inset who is the boss now it.getInset()->parOwner(this); } diff --git a/src/paragraph.h b/src/paragraph.h index f38ef03cfc..c96bde6512 100644 --- a/src/paragraph.h +++ b/src/paragraph.h @@ -64,7 +64,9 @@ public: Paragraph(); /// - Paragraph(Paragraph const &, bool same_ids); + Paragraph(Paragraph const &); + /// + //void operator=(Paragraph const &); /// the destructor removes the new paragraph from the list ~Paragraph(); @@ -308,8 +310,6 @@ public: private: /// LyXLayout_ptr layout_; - /// if anything uses this we don't want it to. - Paragraph(Paragraph const &); #ifdef NO_STD_LIST Paragraph * next_par_; Paragraph * prev_par_; @@ -323,8 +323,6 @@ private: /// Pimpl * pimpl_; - /// unimplemented - void operator=(Paragraph const &); }; diff --git a/src/paragraph_pimpl.C b/src/paragraph_pimpl.C index a998da958c..bb19f8af42 100644 --- a/src/paragraph_pimpl.C +++ b/src/paragraph_pimpl.C @@ -63,16 +63,13 @@ Paragraph::Pimpl::Pimpl(Paragraph * owner) } -Paragraph::Pimpl::Pimpl(Pimpl const & p, Paragraph * owner, bool same_ids) +Paragraph::Pimpl::Pimpl(Pimpl const & p, Paragraph * owner) : params(p.params), owner_(owner) { inset_owner = p.inset_owner; text = p.text; fontlist = p.fontlist; - if (same_ids) - id_ = p.id_; - else - id_ = paragraph_id++; + id_ = paragraph_id++; if (p.tracking()) changes_.reset(new Changes(*p.changes_.get())); diff --git a/src/paragraph_pimpl.h b/src/paragraph_pimpl.h index adfd5a5acc..4edd5da9e2 100644 --- a/src/paragraph_pimpl.h +++ b/src/paragraph_pimpl.h @@ -24,7 +24,7 @@ struct Paragraph::Pimpl { /// Pimpl(Paragraph * owner); /// Copy constructor - Pimpl(Pimpl const &, Paragraph * owner, bool same_ids = false); + Pimpl(Pimpl const &, Paragraph * owner); /// lyx::pos_type size() const { return text.size(); diff --git a/src/undo_funcs.C b/src/undo_funcs.C index a352978977..4d895fbe32 100644 --- a/src/undo_funcs.C +++ b/src/undo_funcs.C @@ -293,11 +293,20 @@ bool createUndo(BufferView * bv, Undo::undo_kind kind, } // Create a new Undo. +#warning FIXME Why is this a vector and not a ParagraphList? std::vector undo_pars; - for (ParagraphList::iterator it = *first; it != *last; ++it) - undo_pars.push_back(new Paragraph(*it, true)); - undo_pars.push_back(new Paragraph(**last, true)); + for (ParagraphList::iterator it = *first; it != *last; ++it) { + int id = it->id(); + Paragraph * tmp = new Paragraph(*it); + tmp->id(id); + undo_pars.push_back(tmp); + } + + int const id = last->id(); + Paragraph * tmp = new Paragraph(**last); + tmp->id(id); + undo_pars.push_back(tmp); // A memory optimization: Just store the layout // information when only edit.