t->setCursorIntern(undoParagraphs(bv, num).begin(), 0);
}
- // Set the right(new) inset-owner of the paragraph if there is any.
+ // Set the right(new) inset-owner of the paragraph if there is any.
if (!undo.pars.empty()) {
Inset * in = 0;
if (before != end)
}
// this surprisingly fills the undo! (Andre')
size_t par = 0;
- //while (deletepar && deletepar != *behind) {
+ //while (deletepar && deletepar != *behind)
while (deletepar != *behind) {
deletelist.push_back(&*deletepar);
++deletepar;
// Thread the end of the undo onto the par in front if any.
if (!undo.pars.empty()) {
- undo.pars.back()->next(&**behind);
- if (behind != end)
- (&**behind)->previous(undo.pars.back());
+#warning FIXME
+ //undo.pars.back()->next(&**behind);
+ //if (behind != end)
+ //(&**behind)->previous(undo.pars.back());
}
// Put the new stuff in the list if there is one.
Paragraph * undopar = undo.pars.empty() ? 0 : undo.pars.front();
if (!undo.pars.empty()) {
- undo.pars.front()->previous(&**before);
- if (before != end)
- (&**before)->next(undopar);
- else {
+#warning FIXME
+ //undo.pars.front()->previous(&**before);
+ if (before != end) {
+#warning FIXME
+ //(&**before)->next(undopar);
+ } else {
int id = undoParagraphs(bv, undo.number_of_inset_id).front().id();
ParIterator op = bv->buffer()->getParFromID(id);
if (op != end && op->inInset()) {
- static_cast<InsetText*>(op->inInset())->paragraph(undopar);
+#warning FIXME reimplementaion needed here
+ //static_cast<InsetText*>(op->inInset())->paragraph(undopar);
} else {
- bv->buffer()->paragraphs.set(undopar);
+#warning FIXME reimplementation needed here
+ //bv->buffer()->paragraphs.set(undopar);
}
}
} else {
int id = undoParagraphs(bv, undo.number_of_inset_id).front().id();
ParIterator op = bv->buffer()->getParFromID(id);
if (op != end && op->inInset()) {
- static_cast<InsetText*>(op->inInset())->paragraph(&**behind);
+#warning FIXME reimplementation needed here
+ //static_cast<InsetText*>(op->inInset())->paragraph(&**behind);
} else {
- bv->buffer()->paragraphs.set(&**behind);
+#warning FIXME reimplementation needed here
+ //bv->buffer()->paragraphs.set(&**behind);
}
undopar = &**behind;
}
ParIterator tmppar =
bv->buffer()->getParFromID(undo.number_of_cursor_par);
- if (it) {
- 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();
- bv->fitCursor();
+ 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();
+ }
+
+ if (it) {
+ bv->fitCursor();
bv->updateInset(it);
bv->text->setCursorIntern(bv->text->cursor.par(),
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.
vector<Paragraph *>::iterator pit = deletelist.begin();
for(; pit != deletelist.end(); ++pit) {
- (*pit)->previous(0);
- (*pit)->next(0);
+#warning FIXME
+ //(*pit)->previous(0);
+ //(*pit)->next(0);
delete (*pit);
}
int behind_number = -1;
int inset_id = -1;
- if (first->previous())
- before_number = first->previous()->id();
+#warning FIXME
+ //if (first->previous())
+ // before_number = first->previous()->id();
if (behind)
behind_number = behind->id();
if (first->inInset())
Paragraph const * end = 0;
- if (behind)
- end = behind->previous();
- else {
+ if (behind) {
+#warning FIXME
+ //end = behind->previous();
+ }else {
end = first;
- while (end->next())
- end = end->next();
+#warning FIXME
+ //while (end->next())
+ // end = end->next();
}
- if (first && end && (first != end->next()) &&
- ((before_number != behind_number) ||
- ((before_number < 0) && (behind_number < 0))))
- {
- undo_pars.push_back(new Paragraph(*first, true));
- for (Paragraph * tmppar = first; tmppar != end && tmppar->next(); ) {
- tmppar = tmppar->next();
- undo_pars.push_back(new Paragraph(*tmppar, true));
- size_t const n = undo_pars.size();
- undo_pars[n - 2]->next(undo_pars[n - 1]);
- undo_pars[n - 1]->previous(undo_pars[n - 2]);
- }
- undo_pars.back()->next(0);
- }
+#warning FIXME
+// if (first && end && (first != end->next()) &&
+// ((before_number != behind_number) ||
+// ((before_number < 0) && (behind_number < 0))))
+// {
+// undo_pars.push_back(new Paragraph(*first, true));
+// for (Paragraph * tmppar = first; tmppar != end && tmppar->next(); ) {
+// tmppar = tmppar->next();
+// undo_pars.push_back(new Paragraph(*tmppar, true));
+// size_t const n = undo_pars.size();
+// undo_pars[n - 2]->next(undo_pars[n - 1]);
+// undo_pars[n - 1]->previous(undo_pars[n - 2]);
+// }
+// undo_pars.back()->next(0);
+// }
// A memory optimization: Just store the layout
// information when only edit.
if (kind == Undo::EDIT) {
for (size_t i = 0, n = undo_pars.size(); i < n; ++i)
undo_pars[i]->clearContents();
- }
+ }
int cursor_par = undoCursor(bv).par()->id();
int cursor_pos = undoCursor(bv).pos();
- //lyxerr << "createUndo: inset_id: " << inset_id << " before_number: "
+ //lyxerr << "createUndo: inset_id: " << inset_id << " before_number: "
// << before_number << " behind_number: " << behind_number << "\n";
u.reset(new Undo(kind, inset_id,
before_number, behind_number,
// Returns false if no undo possible.
bool textUndoOrRedo(BufferView * bv,
limited_stack<boost::shared_ptr<Undo> > & stack,
- limited_stack<boost::shared_ptr<Undo> > & otherstack)
+ limited_stack<boost::shared_ptr<Undo> > & /*otherstack*/)
{
- Buffer * b = bv->buffer();
+ //Buffer * b = bv->buffer();
if (stack.empty()) {
finishNoUndo(bv);