[gimp] app: add reset buttons to all brush settings sliders



commit 5f9bd0c0441f763a5f96f19618486663002f4b66
Author: Alexia Death <alexiadeath gmail com>
Date:   Sun Jan 23 18:14:25 2011 +0200

    app: add reset buttons to all brush settings sliders

 app/tools/gimppaintoptions-gui.c |   83 +++++++++++++++++++++++++++++++++-----
 1 files changed, 72 insertions(+), 11 deletions(-)
---
diff --git a/app/tools/gimppaintoptions-gui.c b/app/tools/gimppaintoptions-gui.c
index 16af2e6..01403b1 100644
--- a/app/tools/gimppaintoptions-gui.c
+++ b/app/tools/gimppaintoptions-gui.c
@@ -52,15 +52,20 @@
 
 
 
-static void gimp_paint_options_gui_reset_size (GtkWidget        *button,
-                                               GimpPaintOptions *paint_options);
-
-static GtkWidget * dynamics_options_gui       (GimpPaintOptions *paint_options,
-                                               GType             tool_type);
-static GtkWidget * jitter_options_gui         (GimpPaintOptions *paint_options,
-                                               GType             tool_type);
-static GtkWidget * smoothing_options_gui      (GimpPaintOptions *paint_options,
-                                               GType             tool_type);
+static void gimp_paint_options_gui_reset_size  (GtkWidget        *button,
+                                                GimpPaintOptions *paint_options);
+static void gimp_paint_options_gui_reset_aspect_ratio
+                                               (GtkWidget        *button,
+                                                GimpPaintOptions *paint_options);
+static void gimp_paint_options_gui_reset_angle (GtkWidget        *button,
+                                                GimpPaintOptions *paint_options);
+
+static GtkWidget * dynamics_options_gui        (GimpPaintOptions *paint_options,
+                                                GType             tool_type);
+static GtkWidget * jitter_options_gui          (GimpPaintOptions *paint_options,
+                                                GType             tool_type);
+static GtkWidget * smoothing_options_gui       (GimpPaintOptions *paint_options,
+                                                GType             tool_type);
 
 
 /*  public functions  */
@@ -144,18 +149,54 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
       gimp_help_set_help_data (button,
                                _("Reset size to brush's native size"), NULL);
 
+      hbox = gtk_hbox_new (FALSE, 2);
+      gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
+      gtk_widget_show (hbox);
+
       scale = gimp_prop_spin_scale_new (config, "brush-aspect-ratio",
                                         _("Aspect Ratio"),
                                         0.01, 0.1, 2);
-      gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
+      gtk_box_pack_start (GTK_BOX (hbox), scale, TRUE, TRUE, 0);
       gtk_widget_show (scale);
 
+      button = gimp_stock_button_new (GIMP_STOCK_RESET, NULL);
+      gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
+      gtk_image_set_from_stock (GTK_IMAGE (gtk_bin_get_child (GTK_BIN (button))),
+                                GIMP_STOCK_RESET, GTK_ICON_SIZE_MENU);
+      gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
+      gtk_widget_show (button);
+
+      g_signal_connect (button, "clicked",
+                        G_CALLBACK (gimp_paint_options_gui_reset_aspect_ratio),
+                        options);
+
+      gimp_help_set_help_data (button,
+                               _("Reset aspect ratio to brush's native"), NULL);
+
+      hbox = gtk_hbox_new (FALSE, 2);
+      gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
+      gtk_widget_show (hbox);
+
       scale = gimp_prop_spin_scale_new (config, "brush-angle",
                                         _("Angle"),
                                         1.0, 5.0, 2);
-      gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
+      gtk_box_pack_start (GTK_BOX (hbox), scale, TRUE, TRUE, 0);
       gtk_widget_show (scale);
 
+      button = gimp_stock_button_new (GIMP_STOCK_RESET, NULL);
+      gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
+      gtk_image_set_from_stock (GTK_IMAGE (gtk_bin_get_child (GTK_BIN (button))),
+                                GIMP_STOCK_RESET, GTK_ICON_SIZE_MENU);
+      gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
+      gtk_widget_show (button);
+
+      g_signal_connect (button, "clicked",
+                        G_CALLBACK (gimp_paint_options_gui_reset_angle),
+                        options);
+
+      gimp_help_set_help_data (button,
+                               _("Reset angle to zero"), NULL);
+
       button = gimp_prop_dynamics_box_new (NULL, GIMP_CONTEXT (tool_options),
                                            _("Dynamics"), 2,
                                            "dynamics-view-type",
@@ -361,3 +402,23 @@ gimp_paint_options_gui_reset_size (GtkWidget        *button,
                    NULL);
    }
 }
+
+static void
+gimp_paint_options_gui_reset_aspect_ratio (GtkWidget        *button,
+                                           GimpPaintOptions *paint_options)
+{
+
+   g_object_set (paint_options,
+                 "brush-aspect-ratio", 1.0,
+                 NULL);
+}
+
+static void
+gimp_paint_options_gui_reset_angle (GtkWidget        *button,
+                                    GimpPaintOptions *paint_options)
+{
+
+   g_object_set (paint_options,
+                 "brush-angle", 0.0,
+                 NULL);
+}
\ No newline at end of file



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]