more ParagraphList::iterator usage

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6343 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2003-03-04 19:52:35 +00:00
parent 7a602f4d09
commit 4bc6c8ebd5
5 changed files with 39 additions and 15 deletions

View File

@ -1,5 +1,14 @@
2003-03-04 Lars Gullik Bjønnes <larsbj@gullik.net>
* paragraph_funcs.C (breakParagraph): take ParagraphList::iterator
as arg
(breakParagraphConservative): ditto
* paragraph.h: remove the breakParagraph friend
* paragraph.C (eraseIntern): new function
(setChange): new function
* paragraph_funcs.C (mergeParagraph): make it take a
ParagraphList::iterator instead of a Paragraph *, adjust
accordingly.

View File

@ -376,6 +376,12 @@ bool Paragraph::insertFromMinibuffer(pos_type pos)
// end of minibuffer
void Paragraph::eraseIntern(lyx::pos_type pos)
{
pimpl_->eraseIntern(pos);
}
void Paragraph::erase(pos_type pos)
{
pimpl_->erase(pos);
@ -1522,6 +1528,13 @@ bool Paragraph::isChangeEdited(pos_type start, pos_type end) const
}
void Paragraph::setChange(lyx::pos_type pos, Change::Type type)
{
pimpl_->setChange(pos, type);
}
void Paragraph::markErased()
{
pimpl_->markErased();

View File

@ -183,6 +183,9 @@ public:
/// is there a non-addition in this range ?
bool isChangeEdited(lyx::pos_type start, lyx::pos_type end) const;
/// set change at pos
void setChange(lyx::pos_type pos, Change::Type type);
/// accept change
void acceptChange(lyx::pos_type start, lyx::pos_type end);
@ -218,6 +221,8 @@ public:
///
void applyLayout(LyXLayout_ptr const & new_layout);
/// definite erase
void eraseIntern(lyx::pos_type pos);
/// erase the char at the given position
void erase(lyx::pos_type pos);
/// erase the given range. Returns true if actually erased.
@ -314,10 +319,6 @@ public:
InsetList insetlist;
///
//Counters & counters();
friend void breakParagraph(BufferParams const & bparams,
Paragraph * par, lyx::pos_type pos, int flag);
private:
///
LyXLayout_ptr layout_;

View File

@ -30,12 +30,12 @@ using std::endl;
using std::ostream;
void breakParagraph(BufferParams const & bparams,
Paragraph * par,
ParagraphList::iterator par,
pos_type pos,
int flag)
{
// create a new paragraph
Paragraph * tmp = new Paragraph(par);
// create a new paragraph, and insert into the list
Paragraph * tmp = new Paragraph(&*par);
// without doing that we get a crash when typing <Return> at the
// end of a paragraph
tmp->layout(bparams.getLyXTextClass().defaultLayout());
@ -89,12 +89,12 @@ void breakParagraph(BufferParams const & bparams,
Change::Type change(par->lookupChange(i));
par->cutIntoMinibuffer(bparams, i);
if (tmp->insertFromMinibuffer(j - pos)) {
tmp->pimpl_->setChange(j - pos, change);
tmp->setChange(j - pos, change);
++j;
}
}
for (i = pos_end; i >= pos; --i) {
par->pimpl_->eraseIntern(i);
par->eraseIntern(i);
}
}
@ -127,12 +127,12 @@ void breakParagraph(BufferParams const & bparams,
void breakParagraphConservative(BufferParams const & bparams,
Paragraph * par,
ParagraphList::iterator par,
pos_type pos)
{
// create a new paragraph
Paragraph * tmp = new Paragraph(par);
tmp->makeSameLayout(par);
Paragraph * tmp = new Paragraph(&*par);
tmp->makeSameLayout(&*par);
// When can pos > Last()?
// I guess pos == Last() is possible.

View File

@ -22,20 +22,21 @@ class TexRow;
///
void breakParagraph(BufferParams const & bparams,
Paragraph *,
ParagraphList::iterator par,
lyx::pos_type pos,
int flag);
///
void breakParagraphConservative(BufferParams const & bparams,
Paragraph *,
ParagraphList::iterator par,
lyx::pos_type pos);
/**
* Append the next paragraph onto the tail of this one.
* Be careful, this doesent make any check at all.
*/
void mergeParagraph(BufferParams const & bparams, ParagraphList::iterator);
void mergeParagraph(BufferParams const & bparams,
ParagraphList::iterator par);
#if 0