Code

Warning cleanup.
[inkscape.git] / src / event-log.cpp
index 4ee65f3f8417ae9b18c7c295d58b03b4b7b5b04d..82de44696b7b8b29356fac0fce0d0b22d8a6a219 100644 (file)
@@ -13,6 +13,9 @@
 #include "event-log.h"
 #include "inkscape.h"
 #include "util/ucompose.hpp"
+#include "document.h"
+#include "xml/repr.h"
+#include "sp-object.h"
 
 namespace Inkscape {
 
@@ -29,7 +32,7 @@ EventLog::EventLog(SPDocument* document) :
 {
     // add initial pseudo event
     Gtk::TreeRow curr_row = *(_event_list_store->append());
-    _curr_event = _last_event = curr_row;
+    _curr_event = _last_saved = _last_event = curr_row;
     
     curr_row[_columns.description] = _("[Unchanged]");
     curr_row[_columns.type] = SP_VERB_FILE_NEW;
@@ -72,6 +75,8 @@ EventLog::notifyUndoEvent(Event* log)
             }
        }
 
+        checkForVirginity();
+
         // update the view
         if (_connected) {
             (*_callback_connections)[CALLB_SELECTION_CHANGE].block();
@@ -132,6 +137,8 @@ EventLog::notifyRedoEvent(Event* log)
             }
         }
 
+        checkForVirginity();
+
         // update the view
         if (_connected) {
             Gtk::TreePath curr_path = _event_list_store->get_path(_curr_event);
@@ -190,6 +197,8 @@ EventLog::notifyUndoCommitEvent(Event* log)
     curr_row[_columns.type] = event_type;
     curr_row[_columns.description] = log->description;
 
+    checkForVirginity();
+
     // update the view
     if (_connected) {
         Gtk::TreePath curr_path = _event_list_store->get_path(_curr_event);
@@ -350,6 +359,15 @@ EventLog::_clearRedo()
     }
 }
 
+/* mark document as untouched if we reach a state where the document was previously saved */
+void
+EventLog::checkForVirginity() {
+    g_return_if_fail (_document);
+    if (_curr_event == _last_saved) {
+        _document->setModifiedSinceSave(false);
+    }
+}
+
 } // namespace Inkscape