X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FUndo.cpp;h=20c76462e3b3324b5ab5e914df53e09ff1c89fcf;hb=8524ee93c35ed3ca15a0aaafa7b893f2f7d21f47;hp=07f69e10803a8bf83d5b5adedbe17975ec0e8936;hpb=f630be890494c849981e4fb52ea4740506e92bed;p=lyx.git diff --git a/src/Undo.cpp b/src/Undo.cpp index 07f69e1080..20c76462e3 100644 --- a/src/Undo.cpp +++ b/src/Undo.cpp @@ -18,15 +18,15 @@ #include "Buffer.h" #include "buffer_funcs.h" -#include "LCursor.h" +#include "Cursor.h" #include "debug.h" #include "BufferView.h" -#include "LyXText.h" +#include "Text.h" #include "Paragraph.h" #include "ParagraphList.h" #include "mathed/MathSupport.h" -#include "mathed/MathArray.h" +#include "mathed/MathData.h" #include "insets/Inset.h" @@ -101,12 +101,12 @@ void doRecordUndo(Undo::undo_kind kind, // fill in the real data to be saved if (cell.inMathed()) { // simply use the whole cell - undo.array = new MathArray(cell.cell()); + undo.array = new MathData(cell.cell()); } else { // some more effort needed here as 'the whole cell' of the - // main LyXText _is_ the whole document. + // main Text _is_ the whole document. // record the relevant paragraphs - LyXText const * text = cell.text(); + Text const * text = cell.text(); BOOST_ASSERT(text); ParagraphList const & plist = text->paragraphs(); ParagraphList::const_iterator first = plist.begin(); @@ -126,7 +126,7 @@ void doRecordUndo(Undo::undo_kind kind, void recordUndo(Undo::undo_kind kind, - LCursor & cur, pit_type first_pit, pit_type last_pit, + Cursor & cur, pit_type first_pit, pit_type last_pit, limited_stack & stack) { BOOST_ASSERT(first_pit <= cur.lastpit()); @@ -164,6 +164,7 @@ bool textUndoOrRedo(BufferView & bv, // This does the actual undo/redo. //lyxerr << "undo, performing: " << undo << std::endl; + bool labelsUpdateNeeded = false; DocIterator dit = undo.cell.asDocIterator(&buf->inset()); if (undo.isFullBuffer) { BOOST_ASSERT(undo.pars); @@ -184,7 +185,7 @@ bool textUndoOrRedo(BufferView & bv, undo.array = 0; } else { // Some finer machinery is needed here. - LyXText * text = dit.text(); + Text * text = dit.text(); BOOST_ASSERT(text); BOOST_ASSERT(undo.pars); ParagraphList & plist = text->paragraphs(); @@ -209,19 +210,21 @@ bool textUndoOrRedo(BufferView & bv, plist.insert(first, undo.pars->begin(), undo.pars->end()); delete undo.pars; undo.pars = 0; - updateLabels(*buf); + labelsUpdateNeeded = true; } BOOST_ASSERT(undo.pars == 0); BOOST_ASSERT(undo.array == 0); // Set cursor - LCursor & cur = bv.cursor(); + Cursor & cur = bv.cursor(); cur.setCursor(undo.cursor.asDocIterator(&buf->inset())); cur.selection() = false; cur.resetAnchor(); cur.fixIfBroken(); + + if (labelsUpdateNeeded) + updateLabels(*buf); finishUndo(); - return true; } @@ -250,7 +253,7 @@ bool textRedo(BufferView & bv) void recordUndo(Undo::undo_kind kind, - LCursor & cur, pit_type first, pit_type last) + Cursor & cur, pit_type first, pit_type last) { Buffer * buf = cur.bv().buffer(); recordUndo(kind, cur, first, last, buf->undostack()); @@ -261,15 +264,15 @@ void recordUndo(Undo::undo_kind kind, } -void recordUndo(LCursor & cur, Undo::undo_kind kind) +void recordUndo(Cursor & cur, Undo::undo_kind kind) { recordUndo(kind, cur, cur.pit(), cur.pit()); } -void recordUndoInset(LCursor & cur, Undo::undo_kind kind) +void recordUndoInset(Cursor & cur, Undo::undo_kind kind) { - LCursor c = cur; + Cursor c = cur; c.pop(); Buffer * buf = cur.bv().buffer(); doRecordUndo(kind, c, c.pit(), c.pit(), cur, @@ -277,19 +280,19 @@ void recordUndoInset(LCursor & cur, Undo::undo_kind kind) } -void recordUndoSelection(LCursor & cur, Undo::undo_kind kind) +void recordUndoSelection(Cursor & cur, Undo::undo_kind kind) { recordUndo(kind, cur, cur.selBegin().pit(), cur.selEnd().pit()); } -void recordUndo(LCursor & cur, Undo::undo_kind kind, pit_type from) +void recordUndo(Cursor & cur, Undo::undo_kind kind, pit_type from) { recordUndo(kind, cur, cur.pit(), from); } -void recordUndo(LCursor & cur, Undo::undo_kind kind, +void recordUndo(Cursor & cur, Undo::undo_kind kind, pit_type from, pit_type to) { recordUndo(kind, cur, from, to);