[gimp] Bug 750674 - Stroke selection doesn't honor brush size set in paint tool options
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 750674 - Stroke selection doesn't honor brush size set in paint tool options
- Date: Sun, 14 Jun 2015 18:46:07 +0000 (UTC)
commit 5422646d91bea34cea63b614435b677a10db44c8
Author: Michael Natterer <mitch gimp org>
Date: Sun Jun 14 20:43:45 2015 +0200
Bug 750674 - Stroke selection doesn't honor brush size set in paint tool options
Implement GimpConfigInterface::duplicate() and after duplicating the
paint options, copy the brush-related properties again, because they
might have been changed by setting the brush on the copy (if they are
set to be linked to the brush's native values).
app/paint/gimppaintoptions.c | 56 +++++++++++++++++++++++++++++++++++++----
1 files changed, 50 insertions(+), 6 deletions(-)
---
diff --git a/app/paint/gimppaintoptions.c b/app/paint/gimppaintoptions.c
index 49a249e..de7caf3 100644
--- a/app/paint/gimppaintoptions.c
+++ b/app/paint/gimppaintoptions.c
@@ -131,25 +131,35 @@ enum
};
-static void gimp_paint_options_dispose (GObject *object);
-static void gimp_paint_options_finalize (GObject *object);
-static void gimp_paint_options_set_property (GObject *object,
+static void gimp_paint_options_config_iface_init (GimpConfigInterface *config_iface);
+
+static void gimp_paint_options_dispose (GObject *object);
+static void gimp_paint_options_finalize (GObject *object);
+static void gimp_paint_options_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
-static void gimp_paint_options_get_property (GObject *object,
+static void gimp_paint_options_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
-static void gimp_paint_options_brush_changed (GimpContext *context,
+
+static GimpConfig * gimp_paint_options_duplicate (GimpConfig *config);
+
+static void gimp_paint_options_brush_changed (GimpContext *context,
GimpBrush *brush);
-G_DEFINE_TYPE (GimpPaintOptions, gimp_paint_options, GIMP_TYPE_TOOL_OPTIONS)
+G_DEFINE_TYPE_WITH_CODE (GimpPaintOptions, gimp_paint_options,
+ GIMP_TYPE_TOOL_OPTIONS,
+ G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
+ gimp_paint_options_config_iface_init))
#define parent_class gimp_paint_options_parent_class
+static GimpConfigInterface *parent_config_iface = NULL;
+
static void
gimp_paint_options_class_init (GimpPaintOptionsClass *klass)
@@ -358,6 +368,17 @@ gimp_paint_options_class_init (GimpPaintOptionsClass *klass)
}
static void
+gimp_paint_options_config_iface_init (GimpConfigInterface *config_iface)
+{
+ parent_config_iface = g_type_interface_peek_parent (config_iface);
+
+ if (! parent_config_iface)
+ parent_config_iface = g_type_default_interface_peek (GIMP_TYPE_CONFIG);
+
+ config_iface->duplicate = gimp_paint_options_duplicate;
+}
+
+static void
gimp_paint_options_init (GimpPaintOptions *options)
{
options->application_mode_save = DEFAULT_APPLICATION_MODE;
@@ -715,6 +736,29 @@ gimp_paint_options_get_property (GObject *object,
}
}
+static GimpConfig *
+gimp_paint_options_duplicate (GimpConfig *config)
+{
+ GimpPaintOptions *options = GIMP_PAINT_OPTIONS (config);
+ GimpPaintOptions *new_options;
+
+ new_options = GIMP_PAINT_OPTIONS (parent_config_iface->duplicate (config));
+
+ /* after duplicating, copy those properties again which might have
+ * changed by setting the brush on the copy, see
+ * gimp_paint_options_brush_changed().
+ */
+ g_object_set (new_options,
+ "brush-size", options->brush_size,
+ "brush-aspect-ratio", options->brush_aspect_ratio,
+ "brush-angle", options->brush_angle,
+ "brush-spacing", options->brush_spacing,
+ "brush-hardness", options->brush_hardness,
+ NULL);
+
+ return GIMP_CONFIG (new_options);
+}
+
static void
gimp_paint_options_brush_changed (GimpContext *context,
GimpBrush *brush)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]