parlist-19-a.diff

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7042 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2003-05-25 08:49:48 +00:00
parent 40df686312
commit 9aee8a07b0
7 changed files with 35 additions and 20 deletions

View File

@ -1,3 +1,14 @@
2003-05-25 Lars Gullik Bjønnes <larsbj@gullik.net>
* 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 <larsbj@gullik.net>
* paragraph_funcs.C (breakParagraph): adjust

View File

@ -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;

View File

@ -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;
@ -99,7 +99,7 @@ Paragraph::Paragraph(Paragraph const & lp, bool same_ids)
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);
}

View File

@ -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 &);
};

View File

@ -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()));

View File

@ -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();

View File

@ -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<Paragraph *> 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.