]> git.lyx.org Git - features.git/commitdiff
minor cleanup
authorAndré Pönitz <poenitz@gmx.net>
Thu, 13 Dec 2001 17:19:53 +0000 (17:19 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Thu, 13 Dec 2001 17:19:53 +0000 (17:19 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3206 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/undo_funcs.C
src/undostack.C
src/undostack.h

index 3558d8cac6abe7f6b4ba1bbc52715417317f5f81..fd5a065a91513b0608e8d5c4daaeb69d615b6050 100644 (file)
@@ -1,3 +1,9 @@
+
+2001-12-13  André Pönitz <poenitz@gmx.net>
+
+       * undostack.[Ch]:
+       * undo_func.C: minor cleanup
+
 2001-12-12  Jean-Marc Lasgouttes  <lasgouttes@freesurf.fr>
 
        * FontLoader.C (getFontinfo): only use symbol fonts with encoding
index 37041317f4474efa292857e7ff326349d7773f41..175003ac25d4a442eaa2cfd68f80a7974f357934 100644 (file)
@@ -26,10 +26,12 @@ bool undo_finished;
 /// a flag
 bool undo_frozen;
 
+
 bool textUndo(BufferView * bv)
 {
        // returns false if no undo possible
-       Undo * undo = bv->buffer()->undostack.pop();
+       Undo * undo = bv->buffer()->undostack.top();
+       bv->buffer()->undostack.pop();
        if (undo) {
                finishUndo();
                if (!undo_frozen) {
@@ -50,7 +52,8 @@ bool textUndo(BufferView * bv)
 bool textRedo(BufferView * bv)
 {
        // returns false if no redo possible
-       Undo * undo = bv->buffer()->redostack.pop();
+       Undo * undo = bv->buffer()->redostack.top();
+       bv->buffer()->redostack.pop();
        if (undo) {
                finishUndo();
                if (!undo_frozen) {
@@ -247,7 +250,6 @@ void setRedo(BufferView * bv, Undo::undo_kind kind,
        bv->buffer()->redostack.push(createUndo(bv, kind, first, behind));
 }
 
-using lyx::pos_type;
 
 Undo * createUndo(BufferView * bv, Undo::undo_kind kind,
                   Paragraph const * first, Paragraph const * behind)
@@ -276,8 +278,8 @@ Undo * createUndo(BufferView * bv, Undo::undo_kind kind,
                // check wether storing is needed
                if (!bv->buffer()->undostack.empty() && 
                    bv->buffer()->undostack.top()->kind == kind &&
-                   bv->buffer()->undostack.top()->number_of_before_par ==  before_number &&
-                   bv->buffer()->undostack.top()->number_of_behind_par ==  behind_number ){
+                   bv->buffer()->undostack.top()->number_of_before_par == before_number &&
+                   bv->buffer()->undostack.top()->number_of_behind_par == behind_number) {
                        // no undo needed
                        return 0;
                }
@@ -345,6 +347,7 @@ void setCursorParUndo(BufferView * bv)
                        bv->text->cursor.par()->next());
 }
 
+
 Paragraph * firstUndoParagraph(BufferView * bv, int inset_id)
 {
        Inset * inset = bv->buffer()->getInsetFromID(inset_id);
@@ -356,6 +359,7 @@ Paragraph * firstUndoParagraph(BufferView * bv, int inset_id)
        return bv->text->ownerParagraph();
 }
 
+
 LyXCursor const & undoCursor(BufferView * bv)
 {
        if (bv->theLockingInset())
index 8ca17bfd47c94c33ed47d29459823a57354432ed..5b7ec58569ed3b8ed5b3d6a3f33bfbf986a5d86c 100644 (file)
@@ -23,18 +23,18 @@ UndoStack::UndoStack()
        : limit(100) {}
 
 
-Undo * UndoStack::pop()
+void UndoStack::pop()
 {
-       if (stakk.empty()) return 0;
-       Undo * result = stakk.front();
+       if (stakk.empty())
+               return;
        stakk.pop_front();
-       return result;
 }
 
 
-Undo * UndoStack::top()
+Undo * UndoStack::top() const
 {
-       if (stakk.empty()) return 0;
+       if (stakk.empty())
+               return 0;
        return stakk.front();
 }
 
@@ -63,7 +63,8 @@ void UndoStack::SetStackLimit(Stakk::size_type l)
 
 void UndoStack::push(Undo * undo_arg)
 {
-       if (!undo_arg) return;
+       if (!undo_arg)
+               return;
        
        stakk.push_front(undo_arg);
        if (stakk.size() > limit) {
@@ -74,6 +75,7 @@ void UndoStack::push(Undo * undo_arg)
 }
 
 
-bool UndoStack::empty() const {
+bool UndoStack::empty() const
+{
        return stakk.empty();
 }
index e611e3a065792d6935e3957920d1b74d755dbf55..35632d54bd01a2b0bd863abbe70d6110c7c750ff 100644 (file)
@@ -33,13 +33,13 @@ public:
        ///
        UndoStack();
        ///
-       Undo * pop();
+       ~UndoStack();
        ///
-       Undo * top();
+       void pop();
        ///
-       bool empty() const;
+       Undo * top() const;
        ///
-       ~UndoStack();
+       bool empty() const;
        ///
        void clear();
        ///