Code

Make the snap toolbar unsensitive to undo actions. How could I not have noticed this...
authordvlierop2 <dvlierop2@users.sourceforge.net>
Mon, 27 Apr 2009 20:05:57 +0000 (20:05 +0000)
committerdvlierop2 <dvlierop2@users.sourceforge.net>
Mon, 27 Apr 2009 20:05:57 +0000 (20:05 +0000)
src/widgets/toolbox.cpp

index fba4f58ce21a1311491c4b8edfd4a03ae8130849..fbcb397cff96f77302c8360f50a218cef099241e 100644 (file)
@@ -1886,6 +1886,7 @@ void toggle_snap_callback (GtkToggleAction *act, gpointer data) { //data points
 
        SPDesktop *dt = reinterpret_cast<SPDesktop*>(ptr);
        SPNamedView *nv = sp_desktop_namedview(dt);
+       SPDocument *doc = SP_OBJECT_DOCUMENT(nv);
 
        if (dt == NULL || nv == NULL) {
                g_warning("No desktop or namedview specified (in toggle_snap_callback)!");
@@ -1899,6 +1900,9 @@ void toggle_snap_callback (GtkToggleAction *act, gpointer data) { //data points
                return;
        }
 
+       bool saved = sp_document_get_undo_sensitive(doc);
+       sp_document_set_undo_sensitive(doc, false);
+
        bool v = false;
        SPAttributeEnum attr = (SPAttributeEnum) GPOINTER_TO_INT(g_object_get_data(G_OBJECT(act), "SP_ATTR_INKSCAPE"));
 
@@ -1980,8 +1984,9 @@ void toggle_snap_callback (GtkToggleAction *act, gpointer data) { //data points
        }
 
        // The snapping preferences are stored in the document, and therefore toggling makes the document dirty
-       SPDocument *doc = SP_OBJECT_DOCUMENT(nv);
        doc->setModifiedSinceSave();
+
+       sp_document_set_undo_sensitive(doc, saved);
 }
 
 void setup_snap_toolbox(GtkWidget *toolbox, SPDesktop *desktop)