X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fdocument-undo.cpp;h=ae1c82e71f4e4d2e02b4ab2e6e480599ac26096f;hb=57eb32794c2df43d60ee8f0a9aa8576567358ce6;hp=911258ee050e70e39b49c0c332d122a9ed2653e2;hpb=c2c4329845a9f8f7fa448516e75c21e09ec4e8a2;p=inkscape.git diff --git a/src/document-undo.cpp b/src/document-undo.cpp index 911258ee0..ae1c82e71 100644 --- a/src/document-undo.cpp +++ b/src/document-undo.cpp @@ -58,6 +58,8 @@ #if HAVE_STDLIB_H #endif +#include +#include #include "xml/repr.h" #include "document-private.h" #include "inkscape.h" @@ -124,10 +126,10 @@ sp_document_done (SPDocument *doc, const unsigned int event_type, Glib::ustring } void -sp_document_reset_key (Inkscape::Application *inkscape, SPDesktop *desktop, GtkObject *base) +sp_document_reset_key (Inkscape::Application */*inkscape*/, SPDesktop */*desktop*/, GtkObject *base) { - SPDocument *doc = (SPDocument *) base; - doc->actionkey = NULL; + SPDocument *doc = (SPDocument *) base; + doc->actionkey = NULL; } namespace { @@ -143,19 +145,20 @@ typedef SimpleEvent InteractionEvent; class CommitEvent : public InteractionEvent { public: - CommitEvent(SPDocument *doc, const gchar *key, const unsigned int type, - Glib::ustring const &description) + CommitEvent(SPDocument *doc, const gchar *key, const unsigned int type) : InteractionEvent(share_static_string("commit")) { - _addProperty(share_static_string("timestamp"), timestamp()); + _addProperty(share_static_string("timestamp"), timestamp()); + gchar *serial = g_strdup_printf("%lu", doc->serial()); + _addProperty(share_static_string("document"), serial); + g_free(serial); Verb *verb = Verb::get(type); if (verb) { - _addProperty(share_static_string("verb"), verb->get_id()); + _addProperty(share_static_string("context"), verb->get_id()); } if (key) { _addProperty(share_static_string("merge-key"), key); } - _addProperty(share_static_string("description"), description.c_str()); } }; @@ -169,7 +172,7 @@ sp_document_maybe_done (SPDocument *doc, const gchar *key, const unsigned int ev g_assert (doc->priv != NULL); g_assert (doc->priv->sensitive); - Inkscape::Debug::Logger::write(doc, key, event_type, event_description); + Inkscape::Debug::EventTracker tracker(doc, key, event_type); doc->collectOrphans(); @@ -198,9 +201,7 @@ sp_document_maybe_done (SPDocument *doc, const gchar *key, const unsigned int ev doc->actionkey = key; doc->virgin = FALSE; - if (!doc->rroot->attribute("sodipodi:modified")) { - doc->rroot->setAttribute("sodipodi:modified", "true"); - } + doc->setModifiedSinceSave(); sp_repr_begin_transaction (doc->rdoc); @@ -225,9 +226,7 @@ sp_document_cancel (SPDocument *doc) sp_repr_begin_transaction (doc->rdoc); } -namespace { - -void finish_incomplete_transaction(SPDocument &doc) { +static void finish_incomplete_transaction(SPDocument &doc) { SPDocumentPrivate &priv=*doc.priv; Inkscape::XML::Event *log=sp_repr_commit_undoable(doc.rdoc); if (log || priv.partial) { @@ -241,8 +240,6 @@ void finish_incomplete_transaction(SPDocument &doc) { } } -} - gboolean sp_document_undo (SPDocument *doc) { @@ -270,7 +267,7 @@ sp_document_undo (SPDocument *doc) sp_repr_undo_log (log->event); doc->priv->redo = g_slist_prepend (doc->priv->redo, log); - doc->rroot->setAttribute("sodipodi:modified", "true"); + doc->setModifiedSinceSave(); doc->priv->undoStackObservers.notifyUndoEvent(log); ret = TRUE; @@ -316,7 +313,7 @@ sp_document_redo (SPDocument *doc) sp_repr_replay_log (log->event); doc->priv->undo = g_slist_prepend (doc->priv->undo, log); - doc->rroot->setAttribute("sodipodi:modified", "true"); + doc->setModifiedSinceSave(); doc->priv->undoStackObservers.notifyRedoEvent(log); ret = TRUE;