[gimp] app: use spin scales for all trivial cases in tool options



commit 0a98d16814ea7862e783b85e85eff9d1d3cc2e1a
Author: Michael Natterer <mitch gimp org>
Date:   Mon Nov 1 21:48:59 2010 +0100

    app: use spin scales for all trivial cases in tool options

 app/tools/gimpairbrushtool.c           |   31 +++++++++++++------------------
 app/tools/gimpblendoptions.c           |   29 ++++++++++++++---------------
 app/tools/gimpbucketfilloptions.c      |   18 ++++++++++--------
 app/tools/gimpcoloroptions.c           |   25 ++++++++++---------------
 app/tools/gimpconvolvetool.c           |   18 +++++++-----------
 app/tools/gimpdodgeburntool.c          |   18 +++++++-----------
 app/tools/gimprectangleselectoptions.c |   17 ++++++-----------
 app/tools/gimpregionselectoptions.c    |   16 ++++++++++------
 app/tools/gimpselectionoptions.c       |   17 ++++++-----------
 app/tools/gimpsmudgetool.c             |   18 +++++++-----------
 10 files changed, 90 insertions(+), 117 deletions(-)
---
diff --git a/app/tools/gimpairbrushtool.c b/app/tools/gimpairbrushtool.c
index a858dbe..f738a41 100644
--- a/app/tools/gimpairbrushtool.c
+++ b/app/tools/gimpairbrushtool.c
@@ -26,6 +26,7 @@
 #include "paint/gimpairbrushoptions.h"
 
 #include "widgets/gimphelp-ids.h"
+#include "widgets/gimppropwidgets.h"
 
 #include "gimpairbrushtool.h"
 #include "gimppaintoptions-gui.h"
@@ -79,30 +80,24 @@ gimp_airbrush_options_gui (GimpToolOptions *tool_options)
 {
   GObject   *config = G_OBJECT (tool_options);
   GtkWidget *vbox   = gimp_paint_options_gui (tool_options);
-  GtkWidget *table;
   GtkWidget *button;
-
-  table = gtk_table_new (2, 3, FALSE);
-  gtk_table_set_col_spacing (GTK_TABLE (table), 0, 2);
+  GtkWidget *scale;
 
   button = gimp_prop_check_button_new (config, "motion-only", _("Motion only"));
   gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
   gtk_widget_show (button);
 
-  gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
-  gtk_widget_show (table);
-
-  gimp_prop_scale_entry_new (config, "rate",
-                             GTK_TABLE (table), 0, 0,
-                             _("Rate:"),
-                             1.0, 1.0, 1,
-                             FALSE, 0.0, 0.0);
-
-  gimp_prop_scale_entry_new (config, "flow",
-                             GTK_TABLE (table), 0, 1,
-                             _("Flow:"),
-                             1.0, 1.0, 1,
-                             FALSE, 0.0, 0.0);
+  scale = gimp_prop_spin_scale_new (config, "rate",
+                                    _("Rate"),
+                                    1.0, 10.0, 1);
+  gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
+  gtk_widget_show (scale);
+
+  scale = gimp_prop_spin_scale_new (config, "flow",
+                                    _("Flow"),
+                                    1.0, 10.0, 1);
+  gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
+  gtk_widget_show (scale);
 
   return vbox;
 }
diff --git a/app/tools/gimpblendoptions.c b/app/tools/gimpblendoptions.c
index be516f0..4fcdf99 100644
--- a/app/tools/gimpblendoptions.c
+++ b/app/tools/gimpblendoptions.c
@@ -200,9 +200,11 @@ gimp_blend_options_gui (GimpToolOptions *tool_options)
   GObject   *config = G_OBJECT (tool_options);
   GtkWidget *vbox   = gimp_paint_options_gui (tool_options);
   GtkWidget *table;
+  GtkWidget *vbox2;
   GtkWidget *frame;
   GtkWidget *combo;
   GtkWidget *button;
+  GtkWidget *scale;
 
   table = g_object_get_data (G_OBJECT (vbox), GIMP_PAINT_OPTIONS_TABLE_KEY);
 
@@ -248,29 +250,26 @@ gimp_blend_options_gui (GimpToolOptions *tool_options)
   gtk_widget_show (button);
 
   /*  supersampling options  */
-  table = gtk_table_new (2, 3, FALSE);
-  gtk_table_set_col_spacings (GTK_TABLE (table), 2);
-  gtk_table_set_row_spacings (GTK_TABLE (table), 1);
-
+  vbox2 = gtk_vbox_new (FALSE, 2);
   frame = gimp_prop_expanding_frame_new (config, "supersample",
                                          _("Adaptive supersampling"),
-                                         table, NULL);
+                                         vbox2, NULL);
   gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
   gtk_widget_show (frame);
 
   /*  max depth scale  */
-  gimp_prop_scale_entry_new (config, "supersample-depth",
-                             GTK_TABLE (table), 0, 0,
-                             _("Max depth:"),
-                             1.0, 1.0, 0,
-                             FALSE, 0.0, 0.0);
+  scale = gimp_prop_spin_scale_new (config, "supersample-depth",
+                                    _("Max depth"),
+                                    1.0, 1.0, 0);
+  gtk_box_pack_start (GTK_BOX (vbox2), scale, FALSE, FALSE, 0);
+  gtk_widget_show (scale);
 
   /*  threshold scale  */
-  gimp_prop_scale_entry_new (config, "supersample-threshold",
-                             GTK_TABLE (table), 0, 1,
-                             _("Threshold:"),
-                             0.01, 0.1, 2,
-                             FALSE, 0.0, 0.0);
+  scale = gimp_prop_spin_scale_new (config, "supersample-threshold",
+                                    _("Threshold"),
+                                    0.01, 0.1, 2);
+  gtk_box_pack_start (GTK_BOX (vbox2), scale, FALSE, FALSE, 0);
+  gtk_widget_show (scale);
 
   return vbox;
 }
diff --git a/app/tools/gimpbucketfilloptions.c b/app/tools/gimpbucketfilloptions.c
index 285a6cb..8eb14eb 100644
--- a/app/tools/gimpbucketfilloptions.c
+++ b/app/tools/gimpbucketfilloptions.c
@@ -32,6 +32,7 @@
 
 #include "display/gimpdisplay.h"
 
+#include "widgets/gimppropwidgets.h"
 #include "widgets/gimpviewablebox.h"
 #include "widgets/gimpwidgets-utils.h"
 
@@ -218,6 +219,7 @@ gimp_bucket_fill_options_gui (GimpToolOptions *tool_options)
   GtkWidget *frame;
   GtkWidget *hbox;
   GtkWidget *button;
+  GtkWidget *scale;
   GtkWidget *combo;
   gchar     *str;
 
@@ -277,20 +279,20 @@ gimp_bucket_fill_options_gui (GimpToolOptions *tool_options)
   gtk_widget_show (button);
 
   /*  the threshold scale  */
+  scale = gimp_prop_spin_scale_new (config, "threshold",
+                                    _("Threshold"),
+                                    1.0, 16.0, 1);
+  gtk_box_pack_start (GTK_BOX (vbox2), scale, FALSE, FALSE, 0);
+  gtk_widget_show (scale);
+
+  /*  the fill criterion combo  */
   table = gtk_table_new (2, 3, FALSE);
   gtk_table_set_col_spacings (GTK_TABLE (table), 2);
   gtk_box_pack_start (GTK_BOX (vbox2), table, FALSE, FALSE, 0);
   gtk_widget_show (table);
 
-  gimp_prop_scale_entry_new (config, "threshold",
-                             GTK_TABLE (table), 0, 0,
-                             _("Threshold:"),
-                             1.0, 16.0, 1,
-                             FALSE, 0.0, 0.0);
-
-  /*  the fill criterion combo  */
   combo = gimp_prop_enum_combo_box_new (config, "fill-criterion", 0, 0);
-  gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
+  gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
                              _("Fill by:"), 0.0, 0.5,
                              combo, 2, FALSE);
 
diff --git a/app/tools/gimpcoloroptions.c b/app/tools/gimpcoloroptions.c
index fe50582..4264041 100644
--- a/app/tools/gimpcoloroptions.c
+++ b/app/tools/gimpcoloroptions.c
@@ -24,6 +24,8 @@
 
 #include "tools-types.h"
 
+#include "widgets/gimppropwidgets.h"
+
 #include "gimphistogramoptions.h"
 #include "gimpcoloroptions.h"
 #include "gimptooloptions-gui.h"
@@ -138,9 +140,8 @@ gimp_color_options_gui (GimpToolOptions *tool_options)
   GObject   *config = G_OBJECT (tool_options);
   GtkWidget *vbox;
   GtkWidget *frame;
-  GtkWidget *table;
+  GtkWidget *scale;
   GtkWidget *button;
-  GtkObject *adj;
 
   if (GIMP_IS_HISTOGRAM_OPTIONS (tool_options))
     vbox = gimp_histogram_options_gui (tool_options);
@@ -152,26 +153,20 @@ gimp_color_options_gui (GimpToolOptions *tool_options)
   gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
   gtk_widget_show (frame);
 
-  table = gtk_table_new (1, 3, FALSE);
-  gtk_table_set_col_spacings (GTK_TABLE (table), 2);
-  gtk_container_add (GTK_CONTAINER (frame), table);
-  gtk_widget_show (table);
+  scale = gimp_prop_spin_scale_new (config, "average-radius",
+                                    _("Radius"),
+                                    1.0, 10.0, 0);
+  gtk_container_add (GTK_CONTAINER (frame), scale);
+  gtk_widget_show (scale);
 
   button = gimp_prop_check_button_new (config, "sample-average",
                                        _("Sample average"));
   gtk_frame_set_label_widget (GTK_FRAME (frame), button);
   gtk_widget_show (button);
 
-  gtk_widget_set_sensitive (table,
+  gtk_widget_set_sensitive (scale,
                             GIMP_COLOR_OPTIONS (config)->sample_average);
-  g_object_set_data (G_OBJECT (button), "set_sensitive", table);
-
-  adj = gimp_prop_scale_entry_new (config, "average-radius",
-                                   GTK_TABLE (table), 0, 0,
-                                   _("Radius:"),
-                                   1.0, 10.0, 0,
-                                   FALSE, 0.0, 0.0);
-  gimp_scale_entry_set_logarithmic (adj, TRUE);
+  g_object_set_data (G_OBJECT (button), "set_sensitive", scale);
 
   return vbox;
 }
diff --git a/app/tools/gimpconvolvetool.c b/app/tools/gimpconvolvetool.c
index c487303..df81bf3 100644
--- a/app/tools/gimpconvolvetool.c
+++ b/app/tools/gimpconvolvetool.c
@@ -26,6 +26,7 @@
 #include "paint/gimpconvolveoptions.h"
 
 #include "widgets/gimphelp-ids.h"
+#include "widgets/gimppropwidgets.h"
 #include "widgets/gimpwidgets-utils.h"
 
 #include "gimpconvolvetool.h"
@@ -190,8 +191,8 @@ gimp_convolve_options_gui (GimpToolOptions *tool_options)
 {
   GObject   *config = G_OBJECT (tool_options);
   GtkWidget *vbox   = gimp_paint_options_gui (tool_options);
-  GtkWidget *table;
   GtkWidget *frame;
+  GtkWidget *scale;
   gchar     *str;
 
   /*  the type radio box  */
@@ -206,16 +207,11 @@ gimp_convolve_options_gui (GimpToolOptions *tool_options)
   g_free (str);
 
   /*  the rate scale  */
-  table = gtk_table_new (1, 3, FALSE);
-  gtk_table_set_col_spacings (GTK_TABLE (table), 2);
-  gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
-  gtk_widget_show (table);
-
-  gimp_prop_scale_entry_new (config, "rate",
-                             GTK_TABLE (table), 0, 0,
-                             _("Rate:"),
-                             1.0, 10.0, 1,
-                             FALSE, 0.0, 0.0);
+  scale = gimp_prop_spin_scale_new (config, "rate",
+                                    _("Rate"),
+                                    1.0, 10.0, 1);
+  gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
+  gtk_widget_show (scale);
 
   return vbox;
 }
diff --git a/app/tools/gimpdodgeburntool.c b/app/tools/gimpdodgeburntool.c
index a59e646..b720dc5 100644
--- a/app/tools/gimpdodgeburntool.c
+++ b/app/tools/gimpdodgeburntool.c
@@ -26,6 +26,7 @@
 #include "paint/gimpdodgeburnoptions.h"
 
 #include "widgets/gimphelp-ids.h"
+#include "widgets/gimppropwidgets.h"
 #include "widgets/gimpwidgets-utils.h"
 
 #include "gimpdodgeburntool.h"
@@ -193,8 +194,8 @@ gimp_dodge_burn_options_gui (GimpToolOptions *tool_options)
 {
   GObject   *config = G_OBJECT (tool_options);
   GtkWidget *vbox   = gimp_paint_options_gui (tool_options);
-  GtkWidget *table;
   GtkWidget *frame;
+  GtkWidget *scale;
   gchar     *str;
 
   /* the type (dodge or burn) */
@@ -214,16 +215,11 @@ gimp_dodge_burn_options_gui (GimpToolOptions *tool_options)
   gtk_widget_show (frame);
 
   /*  the exposure scale  */
-  table = gtk_table_new (1, 3, FALSE);
-  gtk_table_set_col_spacings (GTK_TABLE (table), 2);
-  gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
-  gtk_widget_show (table);
-
-  gimp_prop_scale_entry_new (config, "exposure",
-                             GTK_TABLE (table), 0, 0,
-                             _("Exposure:"),
-                             1.0, 10.0, 1,
-                             FALSE, 0.0, 0.0);
+  scale = gimp_prop_spin_scale_new (config, "exposure",
+                                    _("Exposure"),
+                                    1.0, 10.0, 1);
+  gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
+  gtk_widget_show (scale);
 
   return vbox;
 }
diff --git a/app/tools/gimprectangleselectoptions.c b/app/tools/gimprectangleselectoptions.c
index b520092..a0ff867 100644
--- a/app/tools/gimprectangleselectoptions.c
+++ b/app/tools/gimprectangleselectoptions.c
@@ -154,14 +154,15 @@ gimp_rectangle_select_options_gui (GimpToolOptions *tool_options)
     {
       GtkWidget *frame;
       GtkWidget *button;
-      GtkWidget *table;
+      GtkWidget *scale;
 
-      table = gtk_table_new (1, 3, FALSE);
-      gtk_table_set_col_spacings (GTK_TABLE (table), 2);
+      scale = gimp_prop_spin_scale_new (config, "corner-radius",
+                                        _("Radius"),
+                                        1.0, 10.0, 1);
 
       frame = gimp_prop_expanding_frame_new (config, "round-corners",
                                              _("Rounded corners"),
-                                             table, &button);
+                                             scale, &button);
       gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
       gtk_widget_show (frame);
 
@@ -169,13 +170,7 @@ gimp_rectangle_select_options_gui (GimpToolOptions *tool_options)
                          GIMP_SELECTION_OPTIONS (tool_options)->antialias_toggle);
       gtk_widget_set_sensitive (GIMP_SELECTION_OPTIONS (tool_options)->antialias_toggle,
                                 GIMP_RECTANGLE_SELECT_OPTIONS (tool_options)->round_corners);
-
-      gimp_prop_scale_entry_new (config, "corner-radius",
-                                 GTK_TABLE (table), 0, 0,
-                                 _("Radius:"),
-                                 1.0, 10.0, 1,
-                                 FALSE, 0.0, 0.0);
-  }
+    }
 
   /*  the rectangle options  */
   {
diff --git a/app/tools/gimpregionselectoptions.c b/app/tools/gimpregionselectoptions.c
index 0fb9a0d..77f1d59 100644
--- a/app/tools/gimpregionselectoptions.c
+++ b/app/tools/gimpregionselectoptions.c
@@ -194,6 +194,7 @@ gimp_region_select_options_gui (GimpToolOptions *tool_options)
   GtkWidget *vbox    = gimp_selection_options_gui (tool_options);
   GtkWidget *button;
   GtkWidget *table;
+  GtkWidget *scale;
   GtkWidget *combo;
 
   /*  the select transparent areas toggle  */
@@ -208,17 +209,20 @@ gimp_region_select_options_gui (GimpToolOptions *tool_options)
   gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
   gtk_widget_show (button);
 
-  /*  the threshold scale  */
   table = gtk_table_new (2, 3, FALSE);
   gtk_table_set_col_spacings (GTK_TABLE (table), 2);
+  gtk_table_set_row_spacings (GTK_TABLE (table), 2);
   gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
   gtk_widget_show (table);
 
-  gimp_prop_scale_entry_new (config, "threshold",
-                             GTK_TABLE (table), 0, 0,
-                             _("Threshold:"),
-                             1.0, 16.0, 1,
-                             FALSE, 0.0, 0.0);
+  /*  the threshold scale  */
+  scale = gimp_prop_spin_scale_new (config, "threshold",
+                                    _("Thrshold"),
+                                    1.0, 16.0, 1);
+  gtk_table_attach (GTK_TABLE (table), scale,
+                    0, 3, 0, 1,
+                    GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_SHRINK, 0, 0);
+  gtk_widget_show (scale);
 
   /*  the select criterion combo  */
   combo = gimp_prop_enum_combo_box_new (config, "select-criterion", 0, 0);
diff --git a/app/tools/gimpselectionoptions.c b/app/tools/gimpselectionoptions.c
index 99490a3..f4d3a10 100644
--- a/app/tools/gimpselectionoptions.c
+++ b/app/tools/gimpselectionoptions.c
@@ -263,23 +263,18 @@ gimp_selection_options_gui (GimpToolOptions *tool_options)
   /*  the feather frame  */
   {
     GtkWidget *frame;
-    GtkWidget *table;
+    GtkWidget *scale;
 
-    table = gtk_table_new (1, 3, FALSE);
-    gtk_table_set_col_spacings (GTK_TABLE (table), 2);
+    /*  the feather radius scale  */
+    scale = gimp_prop_spin_scale_new (config, "feather-radius",
+                                      _("Radius"),
+                                      1.0, 10.0, 1);
 
     frame = gimp_prop_expanding_frame_new (config, "feather",
                                            _("Feather edges"),
-                                           table, NULL);
+                                           scale, NULL);
     gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
     gtk_widget_show (frame);
-
-    /*  the feather radius scale  */
-    gimp_prop_scale_entry_new (config, "feather-radius",
-                               GTK_TABLE (table), 0, 0,
-                               _("Radius:"),
-                               1.0, 10.0, 1,
-                               FALSE, 0.0, 0.0);
   }
 
   return vbox;
diff --git a/app/tools/gimpsmudgetool.c b/app/tools/gimpsmudgetool.c
index 1bda67e..17512bd 100644
--- a/app/tools/gimpsmudgetool.c
+++ b/app/tools/gimpsmudgetool.c
@@ -26,6 +26,7 @@
 #include "paint/gimpsmudgeoptions.h"
 
 #include "widgets/gimphelp-ids.h"
+#include "widgets/gimppropwidgets.h"
 
 #include "gimpsmudgetool.h"
 #include "gimppaintoptions-gui.h"
@@ -83,19 +84,14 @@ gimp_smudge_options_gui (GimpToolOptions *tool_options)
 {
   GObject   *config = G_OBJECT (tool_options);
   GtkWidget *vbox   = gimp_paint_options_gui (tool_options);
-  GtkWidget *table;
+  GtkWidget *scale;
 
   /*  the rate scale  */
-  table = gtk_table_new (1, 3, FALSE);
-  gtk_table_set_col_spacings (GTK_TABLE (table), 2);
-  gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
-  gtk_widget_show (table);
-
-  gimp_prop_scale_entry_new (config, "rate",
-                             GTK_TABLE (table), 0, 0,
-                             _("Rate:"),
-                             1.0, 10.0, 1,
-                             FALSE, 0.0, 0.0);
+  scale = gimp_prop_spin_scale_new (config, "rate",
+                                    _("Rate"),
+                                    1.0, 10.0, 1);
+  gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
+  gtk_widget_show (scale);
 
   return vbox;
 }



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