Code

add document serial numbers
authormental <mental@users.sourceforge.net>
Thu, 10 May 2007 01:18:16 +0000 (01:18 +0000)
committermental <mental@users.sourceforge.net>
Thu, 10 May 2007 01:18:16 +0000 (01:18 +0000)
src/document-private.h
src/document-undo.cpp
src/document.cpp
src/document.h

index 1c03a8025d44ec3a9349bc14a648aefc82c9d444..fa4754248f082b84ff2eea883dd0bec593da7977 100644 (file)
@@ -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;
 
index 8f1dd90ce08af65128990a06dafd8cd4975dee6a..0f0a606a1253237954f69e3ddd462150c3ec4c90 100644 (file)
@@ -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());
index a61dffc0b4a1c3fd78d7a9045dc88c51dcc1ab86..6ab08ffb62c7b5165bd38baee66bdcb09cd1ae2c 100644 (file)
@@ -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);
index a3377f398287ad756e91387114c5aa4764f46c05..d9acc93fc294b6457b8ef897230baaf1b0f9794e 100644 (file)
@@ -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;