[gimp/cage: 84/130] app: Clearly present Fade and Color dynamics options as such



commit 9bda9be9f631d44f9d76a5458e77be202cc02832
Author: Alexia Death <alexiadeath gmail com>
Date:   Wed Nov 24 23:34:00 2010 +0200

    app: Clearly present Fade and Color dynamics options as such

 app/core/gimpdynamicsoutput.c    |   30 ++----
 app/paint/gimppaintoptions.c     |  238 ++++++++++++++++----------------------
 app/paint/gimppaintoptions.h     |    4 +-
 app/tools/gimppaintoptions-gui.c |  131 ++++++++++-----------
 4 files changed, 174 insertions(+), 229 deletions(-)
---
diff --git a/app/core/gimpdynamicsoutput.c b/app/core/gimpdynamicsoutput.c
index ac0d869..3549147 100644
--- a/app/core/gimpdynamicsoutput.c
+++ b/app/core/gimpdynamicsoutput.c
@@ -460,15 +460,11 @@ gimp_dynamics_output_get_linear_value (GimpDynamicsOutput *output,
       factors++;
     }
 
-  if ((output->use_fade) && (options))
+  if (output->use_fade)
     {
-      GimpFadeOptions *fade_options = options->fade_options;
+      total += gimp_curve_map_value (output->fade_curve, fade_point);
 
-      if (fade_options->use_fade)
-        {
-          total += gimp_curve_map_value (output->fade_curve, fade_point);
-          factors++;
-        }
+      factors++;
     }
 
   if (factors > 0)
@@ -565,15 +561,11 @@ gimp_dynamics_output_get_angular_value (GimpDynamicsOutput *output,
       factors++;
     }
 
-  if ((output->use_fade) && (options))
+  if (output->use_fade)
     {
-      GimpFadeOptions *fade_options = options->fade_options;
+      total += gimp_curve_map_value (output->fade_curve, fade_point);
 
-      if (fade_options->use_fade)
-        {
-          total += gimp_curve_map_value (output->fade_curve, fade_point);
-          factors++;
-        }
+      factors++;
     }
 
   if (factors > 0)
@@ -659,15 +651,11 @@ gimp_dynamics_output_get_aspect_value (GimpDynamicsOutput *output,
       factors++;
     }
 
-  if ((output->use_fade) && (options))
+  if (output->use_fade)
     {
-      GimpFadeOptions *fade_options = options->fade_options;
+      total += gimp_curve_map_value (output->fade_curve, fade_point);
 
-      if (fade_options->use_fade)
-        {
-          total += gimp_curve_map_value (output->fade_curve, fade_point);
-          factors++;
-        }
+      factors++;
     }
 
   if (factors > 0)
diff --git a/app/paint/gimppaintoptions.c b/app/paint/gimppaintoptions.c
index dfde0f3..8277328 100644
--- a/app/paint/gimppaintoptions.c
+++ b/app/paint/gimppaintoptions.c
@@ -44,16 +44,17 @@
 #define DEFAULT_APPLICATION_MODE       GIMP_PAINT_CONSTANT
 #define DEFAULT_HARD                   FALSE
 
-#define DEFAULT_USE_FADE               FALSE
+
+#define DEFAULT_USE_JITTER             FALSE
+#define DEFAULT_JITTER_AMOUNT          0.2
+
+#define DEFAULT_DYNAMICS_EXPANDED      FALSE
+
 #define DEFAULT_FADE_LENGTH            100.0
 #define DEFAULT_FADE_REVERSE           FALSE
 #define DEFAULT_FADE_REPEAT            GIMP_REPEAT_NONE
 #define DEFAULT_FADE_UNIT              GIMP_UNIT_PIXEL
 
-#define DEFAULT_USE_JITTER             FALSE
-#define DEFAULT_JITTER_AMOUNT          0.2
-
-#define DEFAULT_USE_GRADIENT           FALSE
 #define DEFAULT_GRADIENT_REVERSE       FALSE
 #define DEFAULT_GRADIENT_REPEAT        GIMP_REPEAT_TRIANGULAR
 #define DEFAULT_GRADIENT_LENGTH        100.0
@@ -75,16 +76,16 @@ enum
   PROP_APPLICATION_MODE,
   PROP_HARD,
 
-  PROP_USE_FADE,
+  PROP_USE_JITTER,
+  PROP_JITTER_AMOUNT,
+
+  PROP_DYNAMICS_EXPANDED,
+
   PROP_FADE_LENGTH,
   PROP_FADE_REVERSE,
   PROP_FADE_REPEAT,
   PROP_FADE_UNIT,
 
-  PROP_USE_JITTER,
-  PROP_JITTER_AMOUNT,
-
-  PROP_USE_GRADIENT,
   PROP_GRADIENT_REVERSE,
 
   PROP_BRUSH_VIEW_TYPE,
@@ -108,8 +109,6 @@ static void    gimp_paint_options_get_property     (GObject      *object,
                                                     guint         property_id,
                                                     GValue       *value,
                                                     GParamSpec   *pspec);
-static void    gimp_paint_options_notify           (GObject      *object,
-                                                    GParamSpec   *pspec);
 
 
 
@@ -127,7 +126,6 @@ gimp_paint_options_class_init (GimpPaintOptionsClass *klass)
   object_class->finalize     = gimp_paint_options_finalize;
   object_class->set_property = gimp_paint_options_set_property;
   object_class->get_property = gimp_paint_options_get_property;
-  object_class->notify       = gimp_paint_options_notify;
 
   g_object_class_install_property (object_class, PROP_PAINT_INFO,
                                    g_param_spec_object ("paint-info",
@@ -155,15 +153,27 @@ gimp_paint_options_class_init (GimpPaintOptionsClass *klass)
                                  GIMP_TYPE_PAINT_APPLICATION_MODE,
                                  DEFAULT_APPLICATION_MODE,
                                  GIMP_PARAM_STATIC_STRINGS);
+
   GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_HARD,
                                     "hard", NULL,
                                     DEFAULT_HARD,
                                     GIMP_PARAM_STATIC_STRINGS);
 
-  GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_USE_FADE,
-                                    "use-fade", NULL,
-                                    DEFAULT_USE_FADE,
+  GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_USE_JITTER,
+                                    "use-jitter", NULL,
+                                    DEFAULT_USE_JITTER,
+                                    GIMP_PARAM_STATIC_STRINGS);
+  GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_JITTER_AMOUNT,
+                                   "jitter-amount", NULL,
+                                   0.0, 50.0, DEFAULT_JITTER_AMOUNT,
+                                   GIMP_PARAM_STATIC_STRINGS);
+
+
+  GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_DYNAMICS_EXPANDED,
+                                     "dynamics-expanded", NULL,
+                                    DEFAULT_DYNAMICS_EXPANDED,
                                     GIMP_PARAM_STATIC_STRINGS);
+  
   GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_FADE_LENGTH,
                                    "fade-length", NULL,
                                    0.0, 32767.0, DEFAULT_FADE_LENGTH,
@@ -182,18 +192,6 @@ gimp_paint_options_class_init (GimpPaintOptionsClass *klass)
                                  DEFAULT_FADE_REPEAT,
                                  GIMP_PARAM_STATIC_STRINGS);
 
-  GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_USE_JITTER,
-                                    "use-jitter", NULL,
-                                    DEFAULT_USE_JITTER,
-                                    GIMP_PARAM_STATIC_STRINGS);
-  GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_JITTER_AMOUNT,
-                                   "jitter-amount", NULL,
-                                   0.0, 50.0, DEFAULT_JITTER_AMOUNT,
-                                   GIMP_PARAM_STATIC_STRINGS);
-  GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_USE_GRADIENT,
-                                    "use-gradient", NULL,
-                                    DEFAULT_USE_GRADIENT,
-                                    GIMP_PARAM_STATIC_STRINGS);
   GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_GRADIENT_REVERSE,
                                     "gradient-reverse", NULL,
                                     DEFAULT_GRADIENT_REVERSE,
@@ -321,8 +319,16 @@ gimp_paint_options_set_property (GObject      *object,
       options->hard = g_value_get_boolean (value);
       break;
 
-    case PROP_USE_FADE:
-      fade_options->use_fade = g_value_get_boolean (value);
+    case PROP_USE_JITTER:
+      jitter_options->use_jitter = g_value_get_boolean (value);
+      break;
+
+    case PROP_JITTER_AMOUNT:
+      jitter_options->jitter_amount = g_value_get_double (value);
+      break;
+
+    case PROP_DYNAMICS_EXPANDED:
+      options->dynamics_expanded = g_value_get_boolean (value);
       break;
 
     case PROP_FADE_LENGTH:
@@ -341,18 +347,6 @@ gimp_paint_options_set_property (GObject      *object,
       fade_options->fade_unit = g_value_get_int (value);
       break;
 
-    case PROP_USE_JITTER:
-      jitter_options->use_jitter = g_value_get_boolean (value);
-      break;
-
-    case PROP_JITTER_AMOUNT:
-      jitter_options->jitter_amount = g_value_get_double (value);
-      break;
-
-    case PROP_USE_GRADIENT:
-      gradient_options->use_gradient = g_value_get_boolean (value);
-      break;
-
     case PROP_GRADIENT_REVERSE:
       gradient_options->gradient_reverse = g_value_get_boolean (value);
       break;
@@ -432,8 +426,16 @@ gimp_paint_options_get_property (GObject    *object,
       g_value_set_boolean (value, options->hard);
       break;
 
-    case PROP_USE_FADE:
-      g_value_set_boolean (value, fade_options->use_fade);
+    case PROP_USE_JITTER:
+      g_value_set_boolean (value, jitter_options->use_jitter);
+      break;
+
+    case PROP_JITTER_AMOUNT:
+      g_value_set_double (value, jitter_options->jitter_amount);
+      break;
+
+    case PROP_DYNAMICS_EXPANDED:
+      g_value_set_boolean (value, options->dynamics_expanded);
       break;
 
     case PROP_FADE_LENGTH:
@@ -452,18 +454,6 @@ gimp_paint_options_get_property (GObject    *object,
       g_value_set_int (value, fade_options->fade_unit);
       break;
 
-    case PROP_USE_JITTER:
-      g_value_set_boolean (value, jitter_options->use_jitter);
-      break;
-
-    case PROP_JITTER_AMOUNT:
-      g_value_set_double (value, jitter_options->jitter_amount);
-      break;
-
-    case PROP_USE_GRADIENT:
-      g_value_set_boolean (value, gradient_options->use_gradient);
-      break;
-
     case PROP_GRADIENT_REVERSE:
       g_value_set_boolean (value, gradient_options->gradient_reverse);
       break;
@@ -506,30 +496,6 @@ gimp_paint_options_get_property (GObject    *object,
     }
 }
 
-static void
-gimp_paint_options_notify (GObject    *object,
-                           GParamSpec *pspec)
-{
-  GimpPaintOptions *options = GIMP_PAINT_OPTIONS (object);
-
-  if (pspec->param_id == PROP_USE_GRADIENT)
-    {
-      if (options->gradient_options->use_gradient)
-        {
-          options->application_mode_save = options->application_mode;
-          options->application_mode      = GIMP_PAINT_INCREMENTAL;
-        }
-      else
-        {
-          options->application_mode = options->application_mode_save;
-        }
-
-      g_object_notify (object, "application-mode");
-    }
-
-  if (G_OBJECT_CLASS (parent_class)->notify)
-    G_OBJECT_CLASS (parent_class)->notify (object, pspec);
-}
 
 GimpPaintOptions *
 gimp_paint_options_new (GimpPaintInfo *paint_info)
@@ -553,7 +519,10 @@ gimp_paint_options_get_fade (GimpPaintOptions *paint_options,
                              gdouble           pixel_dist)
 {
   GimpFadeOptions *fade_options;
-  gdouble          z = -1.0;
+  gdouble          z        = -1.0;
+  gdouble          fade_out =  0.0;
+  gdouble          unit_factor;
+  gdouble          pos;
 
 
   g_return_val_if_fail (GIMP_IS_PAINT_OPTIONS (paint_options),
@@ -562,66 +531,57 @@ gimp_paint_options_get_fade (GimpPaintOptions *paint_options,
 
   fade_options = paint_options->fade_options;
 
-  if (fade_options->use_fade)
+  switch (fade_options->fade_unit)
     {
-      gdouble fade_out = 0.0;
-      gdouble unit_factor;
-      gdouble pos;
-
-
-      switch (fade_options->fade_unit)
-        {
-        case GIMP_UNIT_PIXEL:
-          fade_out = fade_options->fade_length;
-          break;
-
-        case GIMP_UNIT_PERCENT:
-          fade_out = (MAX (gimp_image_get_width  (image),
-                           gimp_image_get_height (image)) *
-                      fade_options->fade_length / 100);
-          break;
-
-        default:
-          {
-            gdouble xres;
-            gdouble yres;
-
-            gimp_image_get_resolution (image, &xres, &yres);
-
-            unit_factor = gimp_unit_get_factor (fade_options->fade_unit);
-            fade_out    = (fade_options->fade_length *
-                           MAX (xres, yres) / unit_factor);
-          }
-          break;
-        }
-
-      /*  factor in the fade out value  */
-      if (fade_out > 0.0)
-        {
-          pos = pixel_dist / fade_out;
-        }
-      else
-        pos = DYNAMIC_MAX_VALUE;
-
-      /*  for no repeat, set pos close to 1.0 after the first chunk  */
-      if (fade_options->fade_repeat == GIMP_REPEAT_NONE && pos >= DYNAMIC_MAX_VALUE)
-        pos = DYNAMIC_MAX_VALUE - 0.0000001;
-
-      if (((gint) pos & 1) &&
-          fade_options->fade_repeat != GIMP_REPEAT_SAWTOOTH)
-        pos = DYNAMIC_MAX_VALUE - (pos - (gint) pos);
-      else
-        pos = pos - (gint) pos;
-
-      z = pos;
-
-      if (fade_options->fade_reverse)
-        z = 1.0 - z;
-
-      return z;    /*  ln (1/255)  */
+    case GIMP_UNIT_PIXEL:
+      fade_out = fade_options->fade_length;
+      break;
+
+    case GIMP_UNIT_PERCENT:
+      fade_out = (MAX (gimp_image_get_width  (image),
+                       gimp_image_get_height (image)) *
+                  fade_options->fade_length / 100);
+      break;
+
+    default:
+      {
+        gdouble xres;
+        gdouble yres;
+
+        gimp_image_get_resolution (image, &xres, &yres);
+
+        unit_factor = gimp_unit_get_factor (fade_options->fade_unit);
+        fade_out    = (fade_options->fade_length *
+                       MAX (xres, yres) / unit_factor);
+      }
+      break;
     }
 
-  return DYNAMIC_MIN_VALUE;
+  /*  factor in the fade out value  */
+  if (fade_out > 0.0)
+    {
+      pos = pixel_dist / fade_out;
+    }
+  else
+    pos = DYNAMIC_MAX_VALUE;
+
+  /*  for no repeat, set pos close to 1.0 after the first chunk  */
+  if (fade_options->fade_repeat == GIMP_REPEAT_NONE && pos >= DYNAMIC_MAX_VALUE)
+    pos = DYNAMIC_MAX_VALUE - 0.0000001;
+
+  if (((gint) pos & 1) &&
+      fade_options->fade_repeat != GIMP_REPEAT_SAWTOOTH)
+    pos = DYNAMIC_MAX_VALUE - (pos - (gint) pos);
+  else
+    pos = pos - (gint) pos;
+
+  z = pos;
+
+  if (fade_options->fade_reverse)
+    z = 1.0 - z;
+
+  return z;    /*  ln (1/255)  */
+ 
 }
 
 gdouble
@@ -663,7 +623,7 @@ gimp_paint_options_get_gradient_color (GimpPaintOptions *paint_options,
 
   dynamics = gimp_context_get_dynamics (GIMP_CONTEXT (paint_options));
 
-  if (gimp_dynamics_output_is_enabled(dynamics->color_output) && gradient_options->use_gradient)
+  if (gimp_dynamics_output_is_enabled (dynamics->color_output))
     {
       gimp_gradient_get_color_at (gradient, GIMP_CONTEXT (paint_options),
                                   NULL, grad_point,
diff --git a/app/paint/gimppaintoptions.h b/app/paint/gimppaintoptions.h
index 6f79c49..30908a0 100644
--- a/app/paint/gimppaintoptions.h
+++ b/app/paint/gimppaintoptions.h
@@ -37,7 +37,6 @@ typedef struct _GimpGradientOptions GimpGradientOptions;
 
 struct _GimpFadeOptions
 {
-  gboolean        use_fade;
   gboolean        fade_reverse;
   gdouble         fade_length;
   GimpUnit        fade_unit;
@@ -52,7 +51,6 @@ struct _GimpJitterOptions
 
 struct _GimpGradientOptions
 {
-  gboolean        use_gradient;
   gboolean        gradient_reverse;
   GimpRepeatMode  gradient_repeat;
 };
@@ -83,6 +81,8 @@ struct _GimpPaintOptions
 
   gboolean                  hard;
 
+  gboolean                  dynamics_expanded;
+
   GimpFadeOptions          *fade_options;
   GimpJitterOptions        *jitter_options;
   GimpGradientOptions      *gradient_options;
diff --git a/app/tools/gimppaintoptions-gui.c b/app/tools/gimppaintoptions-gui.c
index b1b3741..2d2aa78 100644
--- a/app/tools/gimppaintoptions-gui.c
+++ b/app/tools/gimppaintoptions-gui.c
@@ -53,11 +53,9 @@
 
 
 
-static GtkWidget * fade_options_gui           (GimpPaintOptions *paint_options,
+static GtkWidget * dynamics_options_gui       (GimpPaintOptions *paint_options,
                                                GType             tool_type);
-static GtkWidget * gradient_options_gui       (GimpPaintOptions *paint_options,
-                                               GType             tool_type,
-                                               GtkWidget        *incremental_toggle);
+
 static GtkWidget * jitter_options_gui         (GimpPaintOptions *paint_options,
                                                GType             tool_type);
 
@@ -122,13 +120,6 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
       gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
       gtk_widget_show (button);
 
-      button = gimp_prop_dynamics_box_new (NULL, GIMP_CONTEXT (tool_options),
-                                           _("Dynamics"), 2,
-                                           "dynamics-view-type",
-                                           "dynamics-view-size");
-      gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
-      gtk_widget_show (button);
-
       hbox = gtk_hbox_new (FALSE, 2);
       gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
       gtk_widget_show (hbox);
@@ -164,11 +155,15 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
                                         1.0, 5.0, 2);
       gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
       gtk_widget_show (scale);
-    }
 
-  if (g_type_is_a (tool_type, GIMP_TYPE_BRUSH_TOOL))
-    {
-      frame = fade_options_gui (options, tool_type);
+      button = gimp_prop_dynamics_box_new (NULL, GIMP_CONTEXT (tool_options),
+                                           _("Dynamics"), 2,
+                                           "dynamics-view-type",
+                                           "dynamics-view-size");
+      gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
+      gtk_widget_show (button);
+
+      frame = dynamics_options_gui (options, tool_type);
       gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
       gtk_widget_show (frame);
 
@@ -206,12 +201,7 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
       gtk_widget_show (button);
     }
 
-  if (g_type_is_a (tool_type, GIMP_TYPE_PAINTBRUSH_TOOL))
-    {
-      frame = gradient_options_gui (options, tool_type, incremental_toggle);
-      gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
-      gtk_widget_show (frame);
-    }
+
 
   return vbox;
 }
@@ -220,35 +210,49 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
 /*  private functions  */
 
 static GtkWidget *
-fade_options_gui (GimpPaintOptions *paint_options,
-                  GType             tool_type)
+dynamics_options_gui (GimpPaintOptions *paint_options,
+                      GType             tool_type)
 {
   GObject   *config = G_OBJECT (paint_options);
   GtkWidget *frame;
-  GtkWidget *table;
+  GtkWidget *inner_frame;
+  GtkWidget *fade_table;
+  GtkWidget *gradient_table;
   GtkWidget *scale;
   GtkWidget *menu;
   GtkWidget *combo;
   GtkWidget *checkbox;
+  GtkWidget *vbox;
+  GtkWidget *box;
 
-  table = gtk_table_new (3, 3, FALSE);
-  gtk_table_set_col_spacings (GTK_TABLE (table), 2);
-  gtk_table_set_row_spacings (GTK_TABLE (table), 2);
+  frame = gimp_prop_expander_new  (config, "dynamics-expanded",
+                                          _("Dynamics options"));
 
-  frame = gimp_prop_expanding_frame_new (config, "use-fade",
-                                         _("Fade out"),
-                                         table, NULL);
+  vbox = gtk_vbox_new (FALSE, 2);
+  gtk_container_add (GTK_CONTAINER (frame), vbox);
+  gtk_widget_show (vbox);
 
+  inner_frame = gimp_frame_new (_("Fade options:"));
+  gtk_box_pack_start (GTK_BOX (vbox), inner_frame, FALSE, FALSE, 0);
+  gtk_widget_show (inner_frame);
+
+  fade_table = gtk_table_new (3, 3, FALSE);
+  gtk_table_set_col_spacings (GTK_TABLE (fade_table), 2);
+  gtk_table_set_row_spacings (GTK_TABLE (fade_table), 2);
+  
+  gtk_container_add (GTK_CONTAINER (inner_frame), fade_table);
+  gtk_widget_show (fade_table);
+  
   /*  the fade-out sizeentry  */
   scale = gimp_prop_spin_scale_new (config, "fade-length",
-                                    _("Length"), 1.0, 50.0, 0);
-  gtk_table_attach (GTK_TABLE (table), scale, 0, 2, 0, 1,
+                                    _("Fade length"), 1.0, 50.0, 0);
+  gtk_table_attach (GTK_TABLE (fade_table), scale, 0, 2, 0, 1,
                     GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
   gtk_widget_show (scale);
 
   /*  the fade-out unitmenu  */
   menu = gimp_prop_unit_combo_box_new (config, "fade-unit");
-  gtk_table_attach (GTK_TABLE (table), menu, 2, 3, 0, 1,
+  gtk_table_attach (GTK_TABLE (fade_table), menu, 2, 3, 0, 1,
                     GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
   gtk_widget_show (menu);
 
@@ -260,17 +264,42 @@ fade_options_gui (GimpPaintOptions *paint_options,
 
     /*  the repeat type  */
   combo = gimp_prop_enum_combo_box_new (config, "fade-repeat", 0, 0);
-  gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
+  gimp_table_attach_aligned (GTK_TABLE (fade_table), 0, 2,
                              _("Repeat:"), 0.0, 0.5,
                              combo, 2, FALSE);
 
   checkbox = gimp_prop_check_button_new (config,
                                          "fade-reverse",
                                           _("Reverse"));
-  gtk_table_attach (GTK_TABLE (table), checkbox, 0, 2, 3, 4,
+  gtk_table_attach (GTK_TABLE (fade_table), checkbox, 0, 2, 3, 4,
                     GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
   gtk_widget_show (checkbox);
 
+  /*Color UI*/
+  if (g_type_is_a (tool_type, GIMP_TYPE_PAINTBRUSH_TOOL))
+    {
+      inner_frame = gimp_frame_new (_("Color options:"));
+      gtk_box_pack_start (GTK_BOX (vbox), inner_frame, FALSE, FALSE, 0);
+      gtk_widget_show (inner_frame);
+
+      gradient_table = gtk_table_new (1, 3, FALSE);
+      gtk_table_set_col_spacings (GTK_TABLE (gradient_table), 2);
+      gtk_table_set_row_spacings (GTK_TABLE (gradient_table), 2);
+
+      gtk_container_add (GTK_CONTAINER (inner_frame), gradient_table);
+      gtk_widget_show (gradient_table);
+
+      box = gimp_prop_gradient_box_new (NULL, GIMP_CONTEXT (config),
+                                        _("Gradient"), 2,
+                                        "gradient-view-type",
+                                        "gradient-view-size",
+                                        "gradient-reverse");
+
+      gimp_table_attach_aligned (GTK_TABLE (gradient_table), 0, 1,
+                                 _("Colors:"), 0.0, 0.5,
+                                 box, 2, FALSE);
+    }
+
   return frame;
 }
 
@@ -293,38 +322,6 @@ jitter_options_gui (GimpPaintOptions *paint_options,
   return frame;
 }
 
-static GtkWidget *
-gradient_options_gui (GimpPaintOptions *paint_options,
-                      GType             tool_type,
-                      GtkWidget        *incremental_toggle)
-{
-  GObject   *config = G_OBJECT (paint_options);
-  GtkWidget *frame;
-  GtkWidget *box;
-  GtkWidget *button;
-
-  /*  the gradient view  */
-  box = gimp_prop_gradient_box_new (NULL, GIMP_CONTEXT (config),
-                                    _("Gradient"), 2,
-                                    "gradient-view-type",
-                                    "gradient-view-size",
-                                    "gradient-reverse");
-
-  frame = gimp_prop_expanding_frame_new (config, "use-gradient",
-                                         _("Use color from gradient"),
-                                         box, &button);
-
-  if (incremental_toggle)
-    {
-      gtk_widget_set_sensitive (incremental_toggle,
-                                ! paint_options->gradient_options->use_gradient);
-      g_object_set_data (G_OBJECT (button), "inverse_sensitive",
-                         incremental_toggle);
-    }
-
-  return frame;
-}
-
 static void
 gimp_paint_options_gui_reset_size (GtkWidget        *button,
                                    GimpPaintOptions *paint_options)



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