[gimp] app: Add an option to explicity turn off airbrush rate



commit e85220f8f93836f354033b7b89a4d98dff3f1094
Author: Alexia Death <alexiadeath gmail com>
Date:   Sun Mar 14 17:27:27 2010 +0200

    app: Add an option to explicity turn off airbrush rate
    
    This was decided in a discussion with guiguru on irc
    some time ago. However, one element is missing. The
    rate slider needs to be disabled when motion only is
    enabled, because it has no effect.

 app/paint/gimpairbrush.c        |    2 +-
 app/paint/gimpairbrushoptions.c |   15 ++++++++++++++-
 app/paint/gimpairbrushoptions.h |    1 +
 app/tools/gimpairbrushtool.c    |    6 ++++++
 4 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/app/paint/gimpairbrush.c b/app/paint/gimpairbrush.c
index ef4ceb0..4eee96f 100644
--- a/app/paint/gimpairbrush.c
+++ b/app/paint/gimpairbrush.c
@@ -140,7 +140,7 @@ gimp_airbrush_paint (GimpPaintCore    *paint_core,
 
       gimp_airbrush_motion (paint_core, drawable, paint_options, coords);
 
-      if (options->rate != 0.0)
+      if ((options->rate != 0.0) && (!options->motion_only))
         {
           GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
           gdouble    fade_point;
diff --git a/app/paint/gimpairbrushoptions.c b/app/paint/gimpairbrushoptions.c
index 07de196..abca417 100644
--- a/app/paint/gimpairbrushoptions.c
+++ b/app/paint/gimpairbrushoptions.c
@@ -28,12 +28,13 @@
 
 #define AIRBRUSH_DEFAULT_RATE        80.0
 #define AIRBRUSH_DEFAULT_FLOW        10.0
-
+#define AIRBRUSH_DEFAULT_MOTION_ONLY FALSE
 
 enum
 {
   PROP_0,
   PROP_RATE,
+  PROP_MOTION_ONLY,
   PROP_FLOW
 };
 
@@ -65,6 +66,12 @@ gimp_airbrush_options_class_init (GimpAirbrushOptionsClass *klass)
                                    0.0, 150.0, AIRBRUSH_DEFAULT_RATE,
                                    GIMP_PARAM_STATIC_STRINGS);
 
+
+  GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_MOTION_ONLY,
+                                    "motion-only", NULL,
+                                    AIRBRUSH_DEFAULT_MOTION_ONLY,
+                                    GIMP_PARAM_STATIC_STRINGS);
+
   GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_FLOW,
                                    "flow", NULL,
                                    0.0, 100.0, AIRBRUSH_DEFAULT_FLOW,
@@ -89,6 +96,9 @@ gimp_airbrush_options_set_property (GObject      *object,
     case PROP_RATE:
       options->rate = g_value_get_double (value);
       break;
+    case PROP_MOTION_ONLY:
+      options->motion_only = g_value_get_boolean (value);
+      break;
     case PROP_FLOW:
       options->flow = g_value_get_double (value);
       break;
@@ -112,6 +122,9 @@ gimp_airbrush_options_get_property (GObject    *object,
     case PROP_RATE:
       g_value_set_double (value, options->rate);
       break;
+    case PROP_MOTION_ONLY:
+      g_value_set_boolean (value, options->motion_only);
+      break;
     case PROP_FLOW:
       g_value_set_double (value, options->flow);
       break;
diff --git a/app/paint/gimpairbrushoptions.h b/app/paint/gimpairbrushoptions.h
index 4455692..4f96f31 100644
--- a/app/paint/gimpairbrushoptions.h
+++ b/app/paint/gimpairbrushoptions.h
@@ -37,6 +37,7 @@ struct _GimpAirbrushOptions
   GimpPaintOptions  parent_instance;
 
   gdouble           rate;
+  gboolean          motion_only;
   gdouble           flow;
 };
 
diff --git a/app/tools/gimpairbrushtool.c b/app/tools/gimpairbrushtool.c
index c6aa15a..a858dbe 100644
--- a/app/tools/gimpairbrushtool.c
+++ b/app/tools/gimpairbrushtool.c
@@ -80,9 +80,15 @@ 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);
+
+  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);
 



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