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.
This commit is contained in:
Alexia Death 2010-03-14 17:27:27 +02:00
parent 861179b452
commit e85220f8f9
4 changed files with 22 additions and 2 deletions

View File

@ -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;

View File

@ -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;

View File

@ -37,6 +37,7 @@ struct _GimpAirbrushOptions
GimpPaintOptions parent_instance;
gdouble rate;
gboolean motion_only;
gdouble flow;
};

View File

@ -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);