[gimp] app: use a spin scale for the brush size (have to limit size to 1000 temporarily)



commit 90e525ca09d8cf69c1788568e0bebee389166830
Author: Mikael Magnusson <mikachu gmail com>
Date:   Tue Nov 2 12:16:19 2010 +0100

    app: use a spin scale for the brush size (have to limit size to 1000 temporarily)

 app/paint/gimppaintoptions.c           |    2 +-
 app/tools/gimppaintoptions-gui.c       |   26 ++++++++++++++----------
 app/widgets/gimpwidgets-constructors.c |   34 ++++++++++++++++++++-----------
 3 files changed, 38 insertions(+), 24 deletions(-)
---
diff --git a/app/paint/gimppaintoptions.c b/app/paint/gimppaintoptions.c
index 78d9f78..dfde0f3 100644
--- a/app/paint/gimppaintoptions.c
+++ b/app/paint/gimppaintoptions.c
@@ -138,7 +138,7 @@ gimp_paint_options_class_init (GimpPaintOptionsClass *klass)
 
   GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_BRUSH_SIZE,
                                    "brush-size", _("Brush Size"),
-                                   1.0, 10000.0, DEFAULT_BRUSH_SIZE,
+                                   1.0, 1000.0, DEFAULT_BRUSH_SIZE,
                                    GIMP_PARAM_STATIC_STRINGS);
 
   GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_BRUSH_ASPECT_RATIO,
diff --git a/app/tools/gimppaintoptions-gui.c b/app/tools/gimppaintoptions-gui.c
index 51ff1d8..f8cc7c4 100644
--- a/app/tools/gimppaintoptions-gui.c
+++ b/app/tools/gimppaintoptions-gui.c
@@ -122,6 +122,7 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
   if (g_type_is_a (tool_type, GIMP_TYPE_BRUSH_TOOL))
     {
       GtkObject *adj;
+      GtkWidget *hbox;
 
       button = gimp_prop_brush_box_new (NULL, GIMP_CONTEXT (tool_options),
                                         _("Brush"), 2,
@@ -142,18 +143,22 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
       gtk_widget_show (button);
       table_row++;
 
-      adj = gimp_prop_scale_entry_new (config, "brush-size",
-                                       GTK_TABLE (table), 0, table_row++,
-                                       _("Size:"),
-                                       0.01, 0.1, 2,
-                                       FALSE, 0.0, 0.0);
-      gimp_scale_entry_set_logarithmic (adj, TRUE);
+      hbox = gtk_hbox_new (FALSE, 2);
+      gtk_table_attach (GTK_TABLE (table), hbox,
+                        0, 3, table_row, table_row + 1,
+                        GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_SHRINK, 0, 0);
+      gtk_widget_show (hbox);
+      table_row++;
 
+      scale = gimp_prop_spin_scale_new (config, "brush-size",
+                                        _("Size"),
+                                        0.01, 1.0, 2);
+      gtk_box_pack_start (GTK_BOX (hbox), scale, TRUE, TRUE, 0);
+      gtk_widget_show (scale);
 
-      button = gimp_stock_button_new (GTK_STOCK_REFRESH, _("Reset size"));
-      gimp_table_attach_aligned (GTK_TABLE (table), 0, table_row++,
-                                 "", 0.0, 0.5,
-                                 button, 2, FALSE);
+      button = gimp_stock_button_new (GTK_STOCK_REFRESH, NULL);
+      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_size),
@@ -178,7 +183,6 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
       table_row++;
     }
 
-
   if (g_type_is_a (tool_type, GIMP_TYPE_BRUSH_TOOL))
     {
       frame = fade_options_gui (options, tool_type);
diff --git a/app/widgets/gimpwidgets-constructors.c b/app/widgets/gimpwidgets-constructors.c
index 44fc686..3f073b6 100644
--- a/app/widgets/gimpwidgets-constructors.c
+++ b/app/widgets/gimpwidgets-constructors.c
@@ -184,24 +184,34 @@ gimp_stock_button_new (const gchar *stock_id,
                        const gchar *label)
 {
   GtkWidget *button;
-  GtkWidget *hbox;
   GtkWidget *image;
-  GtkWidget *lab;
 
   button = gtk_button_new ();
 
-  hbox = gtk_hbox_new (FALSE, 6);
-  gtk_container_add (GTK_CONTAINER (button), hbox);
-  gtk_widget_show (hbox);
+  if (label)
+    {
+      GtkWidget *hbox;
+      GtkWidget *lab;
+
+      hbox = gtk_hbox_new (FALSE, 6);
+      gtk_container_add (GTK_CONTAINER (button), hbox);
+      gtk_widget_show (hbox);
 
-  image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_BUTTON);
-  gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
-  gtk_widget_show (image);
+      image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_BUTTON);
+      gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
+      gtk_widget_show (image);
 
-  lab = gtk_label_new_with_mnemonic (label);
-  gtk_label_set_mnemonic_widget (GTK_LABEL (lab), button);
-  gtk_box_pack_start (GTK_BOX (hbox), lab, TRUE, TRUE, 0);
-  gtk_widget_show (lab);
+      lab = gtk_label_new_with_mnemonic (label);
+      gtk_label_set_mnemonic_widget (GTK_LABEL (lab), button);
+      gtk_box_pack_start (GTK_BOX (hbox), lab, TRUE, TRUE, 0);
+      gtk_widget_show (lab);
+    }
+  else
+    {
+      image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_BUTTON);
+      gtk_container_add (GTK_CONTAINER (button), image);
+      gtk_widget_show (image);
+    }
 
   return button;
 }



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