Code

patch 1705533
[inkscape.git] / src / document-undo.cpp
index c7da41080bd8d3593786aec4b1642c986109b351..9ce1dad603fa8f59af769b9aef213d579b989939 100644 (file)
@@ -7,6 +7,7 @@
  *   Lauris Kaplinski <lauris@kaplinski.com>
  *   MenTaLguY <mental@rydia.net>
  *
+ * Copyright (C) 2007  MenTaLguY <mental@rydia.net>
  * Copyright (C) 1999-2003 authors
  * Copyright (C) 2001-2002 Ximian, Inc.
  *
@@ -151,9 +152,8 @@ sp_document_maybe_done (SPDocument *doc, const gchar *key, const unsigned int ev
        }
 
        if (key && doc->actionkey && !strcmp (key, doc->actionkey) && doc->priv->undo) {
-                doc->priv->undo->data = 
-                    new Inkscape::Event(sp_repr_coalesce_log (((Inkscape::Event *)
-                                                               doc->priv->undo->data)->event, log));
+                ((Inkscape::Event *)doc->priv->undo->data)->event =
+                    sp_repr_coalesce_log (((Inkscape::Event *)doc->priv->undo->data)->event, log);
        } else {
                 Inkscape::Event *event = new Inkscape::Event(log, event_type, event_description);
                 doc->priv->undo = g_slist_prepend (doc->priv->undo, event);
@@ -200,7 +200,9 @@ void finish_incomplete_transaction(SPDocument &doc) {
                g_warning ("Incomplete undo transaction:");
                priv.partial = sp_repr_coalesce_log(priv.partial, log);
                sp_repr_debug_print_log(priv.partial);
-               priv.undo = g_slist_prepend(priv.undo, priv.partial);
+                Inkscape::Event *event = new Inkscape::Event(priv.partial);
+               priv.undo = g_slist_prepend(priv.undo, event);
+                priv.undoStackObservers.notifyUndoCommitEvent(event);
                priv.partial = NULL;
        }
 }
@@ -222,6 +224,7 @@ sp_document_undo (SPDocument *doc)
        g_assert (doc->priv->sensitive);
 
        doc->priv->sensitive = FALSE;
+        doc->priv->seeking = true;
 
        doc->actionkey = NULL;
 
@@ -244,6 +247,7 @@ sp_document_undo (SPDocument *doc)
        sp_repr_begin_transaction (doc->rdoc);
 
        doc->priv->sensitive = TRUE;
+        doc->priv->seeking = false;
 
        if (ret)
                inkscape_external_change();
@@ -266,6 +270,7 @@ sp_document_redo (SPDocument *doc)
        g_assert (doc->priv->sensitive);
 
        doc->priv->sensitive = FALSE;
+        doc->priv->seeking = true;
 
        doc->actionkey = NULL;
 
@@ -288,6 +293,7 @@ sp_document_redo (SPDocument *doc)
        sp_repr_begin_transaction (doc->rdoc);
 
        doc->priv->sensitive = TRUE;
+        doc->priv->seeking = false;
 
        if (ret)
                inkscape_external_change();
@@ -298,6 +304,9 @@ sp_document_redo (SPDocument *doc)
 void
 sp_document_clear_undo (SPDocument *doc)
 {
+        if (doc->priv->undo)
+                doc->priv->undoStackObservers.notifyClearUndoEvent();
+
        while (doc->priv->undo) {
                GSList *current;
 
@@ -313,6 +322,9 @@ sp_document_clear_undo (SPDocument *doc)
 void
 sp_document_clear_redo (SPDocument *doc)
 {
+        if (doc->priv->redo)
+                doc->priv->undoStackObservers.notifyClearRedoEvent();
+
        while (doc->priv->redo) {
                GSList *current;