duplicated code, ParIterator::operator=

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7002 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2003-05-22 15:16:58 +00:00
parent 6c5a9c421e
commit 81a967c573
4 changed files with 36 additions and 37 deletions

View File

@ -1,3 +1,10 @@
2003-05-22 André Pönitz <poenitz@gmx.net>
* undo_funcs.C: remove duplicated code
* iterator.[Ch]: operator=
2003-05-22 Lars Gullik Bjønnes <larsbj@gullik.net> 2003-05-22 Lars Gullik Bjønnes <larsbj@gullik.net>
* tabular.C (SetMultiColumn): ws changes * tabular.C (SetMultiColumn): ws changes

View File

@ -88,6 +88,13 @@ ParIterator::ParIterator(ParIterator const & pi)
{} {}
void ParIterator::operator=(ParIterator const & pi)
{
ParIterator tmp(pi);
pimpl_.swap(tmp.pimpl_);
}
ParIterator & ParIterator::operator++() ParIterator & ParIterator::operator++()
{ {
while (!pimpl_->positions.empty()) { while (!pimpl_->positions.empty()) {

View File

@ -25,6 +25,8 @@ public:
/// ///
ParIterator(ParIterator const &); ParIterator(ParIterator const &);
/// ///
void operator=(ParIterator const &);
///
ParIterator & operator++(); ParIterator & operator++();
/// ///
ParagraphList::iterator operator*() const; ParagraphList::iterator operator*() const;

View File

@ -123,7 +123,7 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
} }
// this surprisingly fills the undo! (Andre') // this surprisingly fills the undo! (Andre')
size_t par = 0; size_t par = 0;
//while (deletepar && deletepar != *behind) { //while (deletepar && deletepar != *behind)
while (deletepar != *behind) { while (deletepar != *behind) {
deletelist.push_back(&*deletepar); deletelist.push_back(&*deletepar);
++deletepar; ++deletepar;
@ -222,46 +222,29 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
ParIterator tmppar = ParIterator tmppar =
bv->buffer()->getParFromID(undo.number_of_cursor_par); bv->buffer()->getParFromID(undo.number_of_cursor_par);
if (it) { if (tmppar != end) {
if (tmppar != end) { LyXText * t;
LyXText * t; Inset * it = tmppar->inInset();
Inset * it = tmppar->inInset(); if (it) {
if (it) { FuncRequest cmd(bv, LFUN_INSET_EDIT, "left");
FuncRequest cmd(bv, LFUN_INSET_EDIT, "left"); it->localDispatch(cmd);
it->localDispatch(cmd); t = it->getLyXText(bv);
t = it->getLyXText(bv); } else {
} else { t = bv->text;
t = bv->text;
}
t->setCursorIntern(*tmppar, undo.cursor_pos);
// Clear any selection and set the selection
// cursor for an evt. new selection.
t->clearSelection();
t->selection.cursor = t->cursor;
t->updateCounters();
bv->fitCursor();
} }
t->setCursorIntern(*tmppar, undo.cursor_pos);
// Clear any selection and set the selection
// cursor for an evt. new selection.
t->clearSelection();
t->selection.cursor = t->cursor;
t->updateCounters();
}
if (it) {
bv->fitCursor();
bv->updateInset(it); bv->updateInset(it);
bv->text->setCursorIntern(bv->text->cursor.par(), bv->text->setCursorIntern(bv->text->cursor.par(),
bv->text->cursor.pos()); bv->text->cursor.pos());
} else {
if (tmppar != end) {
LyXText * t;
Inset * it = tmppar->inInset();
if (it) {
FuncRequest cmd(bv, LFUN_INSET_EDIT, "left");
it->localDispatch(cmd);
t = it->getLyXText(bv);
} else {
t = bv->text;
}
t->setCursorIntern(*tmppar, undo.cursor_pos);
// Clear any selection and set the selection
// cursor for an evt. new selection.
t->clearSelection();
t->selection.cursor = t->cursor;
t->updateCounters();
}
} }
// And here it's safe enough to delete all removed paragraphs. // And here it's safe enough to delete all removed paragraphs.