[gimp] Bug 731279 - Tool Preset Editor not working correctly



commit 93fdaa059709e6314adf3d6aaa8e7622ac3913f3
Author: Michael Natterer <mitch gimp org>
Date:   Wed Oct 14 23:02:07 2015 +0200

    Bug 731279 - Tool Preset Editor not working correctly
    
    This (doesn't quite) fix an obscure part of the tool preset bugs: when
    changing the brush on a GimpPaintOptions instance, we might or might
    not change the brush size, aspect etc. to the set brush's native
    values, possibly overwriting the intended values from a tool preset.
    
    Implement GimpConfig::copy() and copy the affected values again after
    the entire object has been copied, so we actually use the value of
    gimp_config_copy()'s "source" object.
    
    This would fix that particular tool preset problem if there wasn't
    another bug that is still unfixed, stay tuned...

 app/paint/gimppaintoptions.c |   59 ++++++++++++++++++++++++++++++++----------
 1 files changed, 45 insertions(+), 14 deletions(-)
---
diff --git a/app/paint/gimppaintoptions.c b/app/paint/gimppaintoptions.c
index de7caf3..90e224d 100644
--- a/app/paint/gimppaintoptions.c
+++ b/app/paint/gimppaintoptions.c
@@ -131,23 +131,26 @@ enum
 };
 
 
-static void   gimp_paint_options_config_iface_init (GimpConfigInterface *config_iface);
+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,
-                                                    guint         property_id,
-                                                    GValue       *value,
-                                                    GParamSpec   *pspec);
+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,
+                                                          guint         property_id,
+                                                          GValue       *value,
+                                                          GParamSpec   *pspec);
 
-static GimpConfig * gimp_paint_options_duplicate   (GimpConfig   *config);
+static GimpConfig * gimp_paint_options_duplicate         (GimpConfig   *config);
+static gboolean     gimp_paint_options_copy              (GimpConfig   *src,
+                                                          GimpConfig   *dest,
+                                                          GParamFlags   flags);
 
-static void   gimp_paint_options_brush_changed     (GimpContext  *context,
-                                                    GimpBrush    *brush);
+static void         gimp_paint_options_brush_changed     (GimpContext  *context,
+                                                          GimpBrush    *brush);
 
 
 
@@ -376,6 +379,7 @@ gimp_paint_options_config_iface_init (GimpConfigInterface *config_iface)
     parent_config_iface = g_type_default_interface_peek (GIMP_TYPE_CONFIG);
 
   config_iface->duplicate = gimp_paint_options_duplicate;
+  config_iface->copy      = gimp_paint_options_copy;
 }
 
 static void
@@ -759,6 +763,33 @@ gimp_paint_options_duplicate (GimpConfig *config)
   return GIMP_CONFIG (new_options);
 }
 
+static gboolean
+gimp_paint_options_copy (GimpConfig  *src,
+                         GimpConfig  *dest,
+                         GParamFlags  flags)
+{
+  if (parent_config_iface->copy (src, dest, flags))
+    {
+      GimpPaintOptions *options = GIMP_PAINT_OPTIONS (src);
+
+      /*  after copying, copy those properties again which might have
+       *  changed by setting the brush on dest, see
+       *  gimp_paint_options_brush_changed().
+       */
+      g_object_set (dest,
+                    "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 TRUE;
+    }
+
+  return FALSE;
+}
+
 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]