Code

Filter effects dialog:
[inkscape.git] / src / event-log.h
index 148d6329de0fc812963bc8ee90ad608613810437..a618f0467e0a1b7e84fce9dba1c08231b0649075 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
  */
@@ -44,7 +44,7 @@ public:
     typedef Gtk::TreeModel::iterator iterator;
     typedef Gtk::TreeModel::const_iterator const_iterator;
 
-    EventLog();
+    EventLog(SPDocument* document);
     ~EventLog();
 
     /**
@@ -53,13 +53,14 @@ public:
 
     struct EventModelColumns : public Gtk::TreeModelColumnRecord
     {
+        Gtk::TreeModelColumn<Event *> event;
         Gtk::TreeModelColumn<unsigned int> type;
         Gtk::TreeModelColumn<Glib::ustring> description;
         Gtk::TreeModelColumn<int> child_count;
 
         EventModelColumns()
         { 
-            add(type); add(description); add(child_count);
+            add(event); add(type); add(description); add(child_count);
         }
     };
 
@@ -71,6 +72,8 @@ public:
     void notifyUndoEvent(Event *log);
     void notifyRedoEvent(Event *log);
     void notifyUndoCommitEvent(Event *log);
+    void notifyClearUndoEvent();
+    void notifyClearRedoEvent();
 
     /**
      * Accessor functions
@@ -103,14 +106,17 @@ public:
      */
     void connectWithDialog(Gtk::TreeView *event_list_view, CallbackMap *callback_connections);
 
+    /*
+     * Updates the sensitivity and names of SP_VERB_EDIT_UNDO and SP_VERB_EDIT_REDO to reflect the
+     * current state.
+     */
+    void updateUndoVerbs();
+
 private:
     bool _connected;             //< connected with dialog
-    const EventModelColumns _columns;
+    SPDocument *_document;       //< document that is logged
 
-    /**
-     * Helper functions for initialization
-     */
+    const EventModelColumns _columns;
 
     Glib::RefPtr<Gtk::TreeStore> _event_list_store; 
     Glib::RefPtr<Gtk::TreeSelection> _event_list_selection;
@@ -125,6 +131,16 @@ private:
     // 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
+
     // noncopyable, nonassignable
     EventLog(EventLog const &other);
     EventLog& operator=(EventLog const &other);