From: mental Date: Thu, 10 May 2007 01:18:16 +0000 (+0000) Subject: add document serial numbers X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=1d712d30509468e39e1fe4cea947151fcf214227;p=inkscape.git add document serial numbers --- diff --git a/src/document-private.h b/src/document-private.h index 1c03a8025..fa4754248 100644 --- a/src/document-private.h +++ b/src/document-private.h @@ -43,6 +43,8 @@ struct SPDocumentPrivate { GHashTable *iddef; /**< Dictionary of id -> SPObject mappings */ GHashTable *reprdef; /**< Dictionary of Inkscape::XML::Node -> SPObject mappings */ + unsigned long serial; + /** Dictionary of signals for id changes */ IDChangedSignalMap id_changed_signals; diff --git a/src/document-undo.cpp b/src/document-undo.cpp index 8f1dd90ce..0f0a606a1 100644 --- a/src/document-undo.cpp +++ b/src/document-undo.cpp @@ -147,6 +147,9 @@ public: : InteractionEvent(share_static_string("commit")) { _addProperty(share_static_string("timestamp"), timestamp()); + gchar *serial = g_strdup_printf("%ul", doc->serial()); + _addProperty(share_static_string("document"), serial); + g_free(serial); Verb *verb = Verb::get(type); if (verb) { _addProperty(share_static_string("context"), verb->get_id()); diff --git a/src/document.cpp b/src/document.cpp index a61dffc0b..6ab08ffb6 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -70,6 +70,8 @@ gboolean sp_document_resource_list_free(gpointer key, gpointer value, gpointer d static gint doc_count = 0; +static unsigned long next_serial = 0; + SPDocument::SPDocument() { SPDocumentPrivate *p; @@ -96,6 +98,8 @@ SPDocument::SPDocument() { p = new SPDocumentPrivate(); + p->serial = next_serial++; + p->iddef = g_hash_table_new(g_direct_hash, g_direct_equal); p->reprdef = g_hash_table_new(g_direct_hash, g_direct_equal); @@ -182,6 +186,10 @@ SPDocument::~SPDocument() { //delete this->_whiteboard_session_manager; } +unsigned long SPDocument::serial() const { + return priv->serial; +} + void SPDocument::queueForOrphanCollection(SPObject *object) { g_return_if_fail(object != NULL); g_return_if_fail(SP_OBJECT_DOCUMENT(object) == this); diff --git a/src/document.h b/src/document.h index a3377f398..d9acc93fc 100644 --- a/src/document.h +++ b/src/document.h @@ -131,6 +131,7 @@ public: void emitReconstructionStart (void); void emitReconstructionFinish (void); + unsigned long serial() const; void reset_key (void *dummy); sigc::connection _selection_changed_connection; sigc::connection _desktop_activated_connection;