Commit 0c6848e7 authored by Alexia Death's avatar Alexia Death

app: make spacing override part of paint options

parent 69e09e07
......@@ -402,7 +402,7 @@ gimp_brush_core_start (GimpPaintCore *paint_core,
coords);
}
core->spacing = (gdouble) gimp_brush_get_spacing (core->main_brush) / 100.0;
core->spacing = (gdouble) paint_options->brush_spacing / 100;
core->brush = core->main_brush;
......
......@@ -42,6 +42,7 @@
#define DEFAULT_BRUSH_SIZE 20.0
#define DEFAULT_BRUSH_ASPECT_RATIO 0.0
#define DEFAULT_BRUSH_ANGLE 0.0
#define DEFAULT_BRUSH_SPACING 10.0
#define DEFAULT_APPLICATION_MODE GIMP_PAINT_CONSTANT
#define DEFAULT_HARD FALSE
......@@ -79,6 +80,7 @@ enum
PROP_BRUSH_SIZE,
PROP_BRUSH_ASPECT_RATIO,
PROP_BRUSH_ANGLE,
PROP_BRUSH_SPACING,
PROP_APPLICATION_MODE,
PROP_HARD,
......@@ -161,11 +163,17 @@ gimp_paint_options_class_init (GimpPaintOptionsClass *klass)
"brush-aspect-ratio", _("Brush Aspect Ratio"),
-20.0, 20.0, DEFAULT_BRUSH_ASPECT_RATIO,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_BRUSH_ANGLE,
"brush-angle", _("Brush Angle"),
-180.0, 180.0, DEFAULT_BRUSH_ANGLE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_BRUSH_SPACING,
"brush-spacing", _("Brush spacing"),
1.0, 5000.0, DEFAULT_BRUSH_SPACING,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_APPLICATION_MODE,
"application-mode", _("Every stamp has its own opacity"),
GIMP_TYPE_PAINT_APPLICATION_MODE,
......@@ -352,6 +360,10 @@ gimp_paint_options_set_property (GObject *object,
options->brush_angle = - 1.0 * g_value_get_double (value) / 360.0; /* let's make the angle mathematically correct */
break;
case PROP_BRUSH_SPACING:
options->brush_spacing = g_value_get_double (value);
break;
case PROP_APPLICATION_MODE:
options->application_mode = g_value_get_enum (value);
break;
......@@ -476,6 +488,10 @@ gimp_paint_options_get_property (GObject *object,
g_value_set_double (value, - 1.0 * options->brush_angle * 360.0); /* mathematically correct -> intuitively correct */
break;
case PROP_BRUSH_SPACING:
g_value_set_double (value, options->brush_spacing);
break;
case PROP_APPLICATION_MODE:
g_value_set_enum (value, options->application_mode);
break;
......@@ -756,6 +772,25 @@ gimp_paint_options_set_default_brush_size (GimpPaintOptions *paint_options,
}
}
void
gimp_paint_options_set_default_brush_spacing (GimpPaintOptions *paint_options,
GimpBrush *brush)
{
g_return_if_fail (GIMP_IS_PAINT_OPTIONS (paint_options));
g_return_if_fail (brush == NULL || GIMP_IS_BRUSH (brush));
if (! brush)
brush = gimp_context_get_brush (GIMP_CONTEXT (paint_options));
if (brush)
{
g_object_set (paint_options,
"brush-spacing", (gdouble) gimp_brush_get_spacing (brush),
NULL);
}
}
void
gimp_paint_options_copy_brush_props (GimpPaintOptions *src,
GimpPaintOptions *dest)
......
......@@ -85,6 +85,7 @@ struct _GimpPaintOptions
gdouble brush_size;
gdouble brush_angle;
gdouble brush_aspect_ratio;
gdouble brush_spacing;
GimpPaintApplicationMode application_mode;
GimpPaintApplicationMode application_mode_save;
......@@ -132,9 +133,14 @@ gboolean gimp_paint_options_get_gradient_color (GimpPaintOptions *paint_options,
GimpRGB *color);
GimpBrushApplicationMode
gimp_paint_options_get_brush_mode (GimpPaintOptions *paint_options);
gimp_paint_options_get_brush_mode (GimpPaintOptions *paint_options);
void gimp_paint_options_set_default_brush_size (GimpPaintOptions *paint_options,
void gimp_paint_options_set_default_brush_size
(GimpPaintOptions *paint_options,
GimpBrush *brush);
void gimp_paint_options_set_default_brush_spacing
(GimpPaintOptions *paint_options,
GimpBrush *brush);
void gimp_paint_options_copy_brush_props (GimpPaintOptions *src,
......
......@@ -52,6 +52,9 @@
static void gimp_paint_options_gui_reset_size (GtkWidget *button,
GimpPaintOptions *paint_options);
static void gimp_paint_options_gui_reset_spacing
(GtkWidget *button,
GimpPaintOptions *paint_options);
static void gimp_paint_options_gui_reset_aspect_ratio
(GtkWidget *button,
GimpPaintOptions *paint_options);
......@@ -203,6 +206,32 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
gimp_help_set_help_data (button,
_("Reset angle to zero"), NULL);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
scale = gimp_prop_spin_scale_new (config, "brush-spacing",
_("Spacing"),
1.0, 10.0, 2);
gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (scale), 1.0, 200.0);
gimp_spin_scale_set_gamma (GIMP_SPIN_SCALE (scale), 1.7);
gtk_box_pack_start (GTK_BOX (hbox), scale, TRUE, TRUE, 0);
gtk_widget_show (scale);
button = gimp_icon_button_new (GIMP_STOCK_RESET, NULL);
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
gtk_image_set_from_icon_name (GTK_IMAGE (gtk_bin_get_child (GTK_BIN (button))),
GIMP_STOCK_RESET, GTK_ICON_SIZE_MENU);
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_spacing),
options);
gimp_help_set_help_data (button,
_("Reset size to brush's native spacing"), NULL);
button = gimp_prop_dynamics_box_new (NULL, GIMP_CONTEXT (tool_options),
_("Dynamics"), 2,
"dynamics-view-type",
......@@ -411,6 +440,16 @@ gimp_paint_options_gui_reset_size (GtkWidget *button,
gimp_paint_options_set_default_brush_size (paint_options, brush);
}
static void
gimp_paint_options_gui_reset_spacing (GtkWidget *button,
GimpPaintOptions *paint_options)
{
GimpBrush *brush = gimp_context_get_brush (GIMP_CONTEXT (paint_options));
if (brush)
gimp_paint_options_set_default_brush_spacing (paint_options, brush);
}
static void
gimp_paint_options_gui_reset_aspect_ratio (GtkWidget *button,
GimpPaintOptions *paint_options)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment