Code

Prevent opacity slider changes from going into undo as separate items. Fixes bug...
authorJon A. Cruz <jon@joncruz.org>
Wed, 15 Sep 2010 07:43:40 +0000 (00:43 -0700)
committerJon A. Cruz <jon@joncruz.org>
Wed, 15 Sep 2010 07:43:40 +0000 (00:43 -0700)
src/widgets/gradient-vector.cpp

index 7f02566653374ee4a5d66eb4d99135a57ffff706..1c1e8173bc8fd3bc2642667c55b448a0ab2bb77f 100644 (file)
@@ -648,25 +648,22 @@ static void sp_grad_edit_select(GtkOptionMenu *mnu, GtkWidget *tbl)
 
 static void offadjustmentChanged( GtkAdjustment *adjustment, GtkWidget *vb)
 {
-    if (blocked) {
-        return;
-    }
+    if (!blocked) {
+        blocked = TRUE;
 
-    blocked = TRUE;
+        GtkOptionMenu *mnu = static_cast<GtkOptionMenu *>(g_object_get_data(G_OBJECT(vb), "stopmenu"));
+        if ( g_object_get_data(G_OBJECT(gtk_menu_get_active(GTK_MENU(gtk_option_menu_get_menu(mnu)))), "stop") ) {
+            SPStop *stop = SP_STOP(g_object_get_data(G_OBJECT(gtk_menu_get_active(GTK_MENU(gtk_option_menu_get_menu(mnu)))), "stop"));
 
-    GtkOptionMenu *mnu = static_cast<GtkOptionMenu *>(g_object_get_data(G_OBJECT(vb), "stopmenu"));
-    if (!g_object_get_data(G_OBJECT(gtk_menu_get_active(GTK_MENU(gtk_option_menu_get_menu(mnu)))), "stop")) {
-        return;
-    }
-    SPStop *stop = SP_STOP(g_object_get_data(G_OBJECT(gtk_menu_get_active(GTK_MENU(gtk_option_menu_get_menu(mnu)))), "stop"));
-
-    stop->offset = adjustment->value;
-    sp_repr_set_css_double(SP_OBJECT_REPR(stop), "offset", stop->offset);
+            stop->offset = adjustment->value;
+            sp_repr_set_css_double(SP_OBJECT_REPR(stop), "offset", stop->offset);
 
-    sp_document_done(SP_OBJECT_DOCUMENT(stop), SP_VERB_CONTEXT_GRADIENT,
-                      _("Change gradient stop offset"));
+            sp_document_maybe_done(SP_OBJECT_DOCUMENT(stop), "gradient:stop:offset", SP_VERB_CONTEXT_GRADIENT,
+                                   _("Change gradient stop offset"));
 
-    blocked = FALSE;
+            blocked = FALSE;
+        }
+    }
 }
 
 guint32 sp_average_color(guint32 c1, guint32 c2, gdouble p = 0.5)