[gimp] app: use gimp_prop_widget_set_factor() not gimp_spin_scale_set_factor()



commit a009b18a6e4ca7313b6e9bb6b73b37749f899dbe
Author: Michael Natterer <mitch gimp org>
Date:   Sat Jun 15 20:52:57 2013 +0200

    app: use gimp_prop_widget_set_factor() not gimp_spin_scale_set_factor()

 app/tools/gimpbrightnesscontrasttool.c |   21 ++++-----------------
 app/tools/gimpcolorbalancetool.c       |    2 +-
 app/tools/gimpcolorizetool.c           |    6 +++---
 app/tools/gimphuesaturationtool.c      |    8 ++++----
 4 files changed, 12 insertions(+), 25 deletions(-)
---
diff --git a/app/tools/gimpbrightnesscontrasttool.c b/app/tools/gimpbrightnesscontrasttool.c
index 3ab9e06..08b61cd 100644
--- a/app/tools/gimpbrightnesscontrasttool.c
+++ b/app/tools/gimpbrightnesscontrasttool.c
@@ -136,7 +136,6 @@ gimp_brightness_contrast_tool_initialize (GimpTool     *tool,
   GimpBrightnessContrastTool *bc_tool  = GIMP_BRIGHTNESS_CONTRAST_TOOL (tool);
   GimpImage                  *image    = gimp_display_get_image (display);
   GimpDrawable               *drawable = gimp_image_get_active_drawable (image);
-  GtkWidget                  *scale;
 
   if (! GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error))
     {
@@ -145,23 +144,13 @@ gimp_brightness_contrast_tool_initialize (GimpTool     *tool,
 
   if (gimp_drawable_get_precision (drawable) == GIMP_PRECISION_U8)
     {
-      scale = bc_tool->brightness_scale;
-      gtk_spin_button_set_digits (GTK_SPIN_BUTTON (scale), 0);
-      gimp_spin_scale_set_factor (GIMP_SPIN_SCALE (scale), 127.0);
-
-      scale = bc_tool->contrast_scale;
-      gtk_spin_button_set_digits (GTK_SPIN_BUTTON (scale), 0);
-      gimp_spin_scale_set_factor (GIMP_SPIN_SCALE (scale), 127.0);
+      gimp_prop_widget_set_factor (bc_tool->brightness_scale, 127.0, 0);
+      gimp_prop_widget_set_factor (bc_tool->contrast_scale,   127.0, 0);
     }
   else
     {
-      scale = bc_tool->brightness_scale;
-      gtk_spin_button_set_digits (GTK_SPIN_BUTTON (scale), 3);
-      gimp_spin_scale_set_factor (GIMP_SPIN_SCALE (scale), 0.5);
-
-      scale = bc_tool->contrast_scale;
-      gtk_spin_button_set_digits (GTK_SPIN_BUTTON (scale), 3);
-      gimp_spin_scale_set_factor (GIMP_SPIN_SCALE (scale), 0.5);
+      gimp_prop_widget_set_factor (bc_tool->brightness_scale, 0.5, 3);
+      gimp_prop_widget_set_factor (bc_tool->contrast_scale,   0.5, 3);
     }
 
   return TRUE;
@@ -262,7 +251,6 @@ gimp_brightness_contrast_tool_dialog (GimpImageMapTool *image_map_tool)
   scale = gimp_prop_spin_scale_new (image_map_tool->config, "brightness",
                                     _("_Brightness"), 1.0 / 127.0, 10.0 / 127.0,
                                     0);
-  gimp_spin_scale_set_factor (GIMP_SPIN_SCALE (scale), 127.0);
   gtk_box_pack_start (GTK_BOX (main_vbox), scale, FALSE, FALSE, 0);
   gtk_widget_show (scale);
 
@@ -272,7 +260,6 @@ gimp_brightness_contrast_tool_dialog (GimpImageMapTool *image_map_tool)
   scale = gimp_prop_spin_scale_new (image_map_tool->config, "contrast",
                                     _("_Contrast"), 1.0 / 127.0, 10.0 / 127.0,
                                     0);
-  gimp_spin_scale_set_factor (GIMP_SPIN_SCALE (scale), 127.0);
   gtk_box_pack_start (GTK_BOX (main_vbox), scale, FALSE, FALSE, 0);
   gtk_widget_show (scale);
 
diff --git a/app/tools/gimpcolorbalancetool.c b/app/tools/gimpcolorbalancetool.c
index 79b99b8..017d450 100644
--- a/app/tools/gimpcolorbalancetool.c
+++ b/app/tools/gimpcolorbalancetool.c
@@ -168,7 +168,7 @@ create_levels_scale (GObject     *config,
 
   scale = gimp_prop_spin_scale_new (config, property_name,
                                     NULL, 0.01, 0.1, 0);
-  gimp_spin_scale_set_factor (GIMP_SPIN_SCALE (scale), 100.0);
+  gimp_prop_widget_set_factor (scale, 100.0, 1);
   gtk_table_attach_defaults (GTK_TABLE (table), scale, 1, 2, col, col + 1);
   gtk_widget_show (scale);
 
diff --git a/app/tools/gimpcolorizetool.c b/app/tools/gimpcolorizetool.c
index f3add4c..321cbbd 100644
--- a/app/tools/gimpcolorizetool.c
+++ b/app/tools/gimpcolorizetool.c
@@ -172,21 +172,21 @@ gimp_colorize_tool_dialog (GimpImageMapTool *image_map_tool)
   /*  Create the hue scale widget  */
   scale = gimp_prop_spin_scale_new (image_map_tool->config, "hue",
                                     _("_Hue"), 1.0 / 230.0, 15.0 / 360.0, 0);
-  gimp_spin_scale_set_factor (GIMP_SPIN_SCALE (scale), 360.0);
+  gimp_prop_widget_set_factor (scale, 360.0, 1);
   gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
   gtk_widget_show (scale);
 
   /*  Create the saturation scale widget  */
   scale = gimp_prop_spin_scale_new (image_map_tool->config, "saturation",
                                     _("_Saturation"), 0.01, 0.1, 0);
-  gimp_spin_scale_set_factor (GIMP_SPIN_SCALE (scale), 100.0);
+  gimp_prop_widget_set_factor (scale, 100.0, 1);
   gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
   gtk_widget_show (scale);
 
   /*  Create the lightness scale widget  */
   scale = gimp_prop_spin_scale_new (image_map_tool->config, "lightness",
                                     _("_Lightness"), 0.01, 0.1, 0);
-  gimp_spin_scale_set_factor (GIMP_SPIN_SCALE (scale), 100.0);
+  gimp_prop_widget_set_factor (scale, 100.0, 1);
   gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
   gtk_widget_show (scale);
 
diff --git a/app/tools/gimphuesaturationtool.c b/app/tools/gimphuesaturationtool.c
index 5db71ba..f3759c1 100644
--- a/app/tools/gimphuesaturationtool.c
+++ b/app/tools/gimphuesaturationtool.c
@@ -286,7 +286,7 @@ gimp_hue_saturation_tool_dialog (GimpImageMapTool *image_map_tool)
   /* Create the 'Overlap' option slider */
   scale = gimp_prop_spin_scale_new (image_map_tool->config, "overlap",
                                     _("_Overlap"), 0.01, 0.1, 0);
-  gimp_spin_scale_set_factor (GIMP_SPIN_SCALE (scale), 100.0);
+  gimp_prop_widget_set_factor (scale, 100.0, 1);
   gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
   gtk_widget_show (scale);
 
@@ -301,21 +301,21 @@ gimp_hue_saturation_tool_dialog (GimpImageMapTool *image_map_tool)
   /*  Create the hue scale widget  */
   scale = gimp_prop_spin_scale_new (image_map_tool->config, "hue",
                                     _("_Hue"), 1.0 / 180.0, 15.0 / 180.0, 0);
-  gimp_spin_scale_set_factor (GIMP_SPIN_SCALE (scale), 180.0);
+  gimp_prop_widget_set_factor (scale, 180.0, 1);
   gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
   gtk_widget_show (scale);
 
   /*  Create the lightness scale widget  */
   scale = gimp_prop_spin_scale_new (image_map_tool->config, "lightness",
                                     _("_Lightness"), 0.01, 0.1, 0);
-  gimp_spin_scale_set_factor (GIMP_SPIN_SCALE (scale), 100.0);
+  gimp_prop_widget_set_factor (scale, 100.0, 1);
   gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
   gtk_widget_show (scale);
 
   /*  Create the saturation scale widget  */
   scale = gimp_prop_spin_scale_new (image_map_tool->config, "saturation",
                                     _("_Saturation"), 0.01, 0.1, 0);
-  gimp_spin_scale_set_factor (GIMP_SPIN_SCALE (scale), 100.0);
+  gimp_prop_widget_set_factor (scale, 100.0, 1);
   gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
   gtk_widget_show (scale);
 


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