]> git.lyx.org Git - lyx.git/blobdiff - src/Undo.cpp
Andre's s/getTextClass/textClass/ cleanup.
[lyx.git] / src / Undo.cpp
index 9efd218918b6fab89f53dfd7627e0e16cdf09de8..8378859ea3fe21ba25e74d5f4627de3621a3f913 100644 (file)
@@ -20,7 +20,6 @@
 #include "Buffer.h"
 #include "BufferParams.h"
 #include "buffer_funcs.h"
-#include "debug.h"
 #include "DocIterator.h"
 #include "Paragraph.h"
 #include "ParagraphList.h"
 
 #include "insets/Inset.h"
 
+#include "support/debug.h"
+#include "support/limited_stack.h"
+
 #include <algorithm>
+#include <ostream>
 
-using std::advance;
-using std::endl;
+using namespace std;
+using namespace lyx::support;
 
 namespace lyx {
 
@@ -143,7 +146,7 @@ bool Undo::hasRedoStack() const
 
 namespace {
 
-std::ostream & operator<<(std::ostream & os, UndoElement const & undo)
+ostream & operator<<(ostream & os, UndoElement const & undo)
 {
        return os << " from: " << undo.from << " end: " << undo.end
                << " cell:\n" << undo.cell
@@ -169,7 +172,7 @@ void Undo::Private::doRecordUndo(UndoKind kind,
        bool isUndoOperation)
 {
        if (first_pit > last_pit)
-               std::swap(first_pit, last_pit);
+               swap(first_pit, last_pit);
        // create the position information of the Undo entry
        UndoElement undo;
        undo.array = 0;
@@ -220,7 +223,7 @@ void Undo::Private::doRecordUndo(UndoKind kind,
 
        // push the undo entry to undo stack
        stack.push(undo);
-       //lyxerr << "undo record: " << stack.top() << std::endl;
+       //lyxerr << "undo record: " << stack.top() << endl;
 
        // next time we'll try again to combine entries if possible
        undo_finished = false;
@@ -240,7 +243,7 @@ void Undo::Private::recordUndo(UndoKind kind, DocIterator & cur,
        redostack.clear();
        //lyxerr << "undostack:\n";
        //for (size_t i = 0, n = buf.undostack().size(); i != n && i < 6; ++i)
-       //      lyxerr << "  " << i << ": " << buf.undostack()[i] << std::endl;
+       //      lyxerr << "  " << i << ": " << buf.undostack()[i] << endl;
 }
 
 
@@ -270,7 +273,7 @@ bool Undo::Private::textUndoOrRedo(DocIterator & cur, bool isUndoOperation)
                undo.isFullBuffer, !isUndoOperation);
 
        // This does the actual undo/redo.
-       //lyxerr << "undo, performing: " << undo << std::endl;
+       //LYXERR0("undo, performing: " << undo);
        bool labelsUpdateNeeded = false;
        DocIterator dit = undo.cell.asDocIterator(&buffer_.inset());
        if (undo.isFullBuffer) {
@@ -278,14 +281,14 @@ bool Undo::Private::textUndoOrRedo(DocIterator & cur, bool isUndoOperation)
                // This is a full document
                otherstack.top().bparams = buffer_.params();
                buffer_.params() = undo.bparams;
-               std::swap(buffer_.paragraphs(), *undo.pars);
+               swap(buffer_.paragraphs(), *undo.pars);
                delete undo.pars;
                undo.pars = 0;
        } else if (dit.inMathed()) {
                // We stored the full cell here as there is not much to be
                // gained by storing just 'a few' paragraphs (most if not
                // all math inset cells have just one paragraph!)
-               //lyxerr << "undo.array: " << *undo.array <<endl;
+               //LYXERR0("undo.array: " << *undo.array);
                BOOST_ASSERT(undo.array);
                dit.cell().swap(*undo.array);
                delete undo.array;