Code

GSoC C++-ificiation merge and cleanup.
[inkscape.git] / src / event-log.h
index 02cfa4b9a2560ecd5d245b970e78be8570932e73..3f3c6830eeeb94088f25763f93cacf37c0811eaa 100644 (file)
@@ -16,7 +16,7 @@
  * Author:
  *   Gustav Broberg <broberg@kth.se>
  *
- * Copyright (c) 2006 Authors
+ * Copyright (c) 2006, 2007 Authors
  *
  * Released under GNU GPL, read the file 'COPYING' for more information
  */
@@ -45,7 +45,7 @@ public:
     typedef Gtk::TreeModel::const_iterator const_iterator;
 
     EventLog(SPDocument* document);
-    ~EventLog();
+    virtual ~EventLog();
 
     /**
      * Event datatype
@@ -72,6 +72,8 @@ public:
     void notifyUndoEvent(Event *log);
     void notifyRedoEvent(Event *log);
     void notifyUndoCommitEvent(Event *log);
+    void notifyClearUndoEvent();
+    void notifyClearRedoEvent();
 
     /**
      * Accessor functions
@@ -85,6 +87,7 @@ public:
     void setCurrEvent(iterator event)          { _curr_event = event; }
     void setCurrEventParent(iterator event)    { _curr_event_parent = event; }
     void blockNotifications(bool status=true)  { _notifications_blocked = status; }
+    void rememberFileSave()                    { _last_saved = _curr_event; }
 
     /* 
      * Callback types for TreeView changes.
@@ -116,10 +119,6 @@ private:
 
     const EventModelColumns _columns;
 
-    /**
-     * Helper functions for initialization
-     */
-
     Glib::RefPtr<Gtk::TreeStore> _event_list_store; 
     Glib::RefPtr<Gtk::TreeSelection> _event_list_selection;
     Gtk::TreeView *_event_list_view;
@@ -128,14 +127,25 @@ private:
     iterator _last_event;        //< end position in _event_list_store
     iterator _curr_event_parent; //< parent to current event, if any
 
+    iterator _last_saved;        //< position where last document save occurred
+
     bool _notifications_blocked; //< if notifications should be handled
 
     // Map of connections used to temporary block/unblock callbacks in a TreeView
     CallbackMap *_callback_connections;
 
+    /**
+     * Helper functions
+     */
+
     const_iterator _getUndoEvent() const; //< returns the current undoable event or NULL if none
     const_iterator _getRedoEvent() const; //< returns the current redoable event or NULL if none
 
+    void _clearUndo();  //< erase all previously commited events
+    void _clearRedo();  //< erase all previously undone events
+
+    void checkForVirginity(); //< marks the document as untouched if undo/redo reaches a previously saved state
+
     // noncopyable, nonassignable
     EventLog(EventLog const &other);
     EventLog& operator=(EventLog const &other);
@@ -155,4 +165,4 @@ private:
   fill-column:99
   End:
 */
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :