[gimp] app: apply "trc" setting when repeating curves and levels



commit 0096e563f6413a9fdc914cf9b04c27421b0b3ff1
Author: Ell <ell_se yahoo com>
Date:   Mon Apr 13 01:51:40 2020 +0300

    app: apply "trc" setting when repeating curves and levels
    
    In gimp_operation_config_sync_node(), when the operation has a
    property of the config object's type, don't skip the other
    properties.  This makes sure to set the "trc" property of
    GimpOperation{Curves,Levels} according to the config object.  We'd
    previously done it manually in GimpFilterTool, but the setting was
    not applied when repeating the filter.

 app/operations/gimp-operation-config.c | 24 ++++++++----------------
 app/tools/gimpcurvestool.c             |  8 --------
 app/tools/gimplevelstool.c             |  8 --------
 3 files changed, 8 insertions(+), 32 deletions(-)
---
diff --git a/app/operations/gimp-operation-config.c b/app/operations/gimp-operation-config.c
index 4135d7d50d..953ac7f404 100644
--- a/app/operations/gimp-operation-config.c
+++ b/app/operations/gimp-operation-config.c
@@ -342,29 +342,21 @@ gimp_operation_config_sync_node (GObject  *config,
 
   for (i = 0; i < n_pspecs; i++)
     {
-      GParamSpec *pspec = pspecs[i];
+      GParamSpec *gegl_pspec = pspecs[i];
+      GParamSpec *gimp_pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (config),
+                                                             gegl_pspec->name);
 
       /*  if the operation has an object property of the config's
-       *  type, set it and done
+       *  type, use the config object directly
        */
-      if (G_IS_PARAM_SPEC_OBJECT (pspec) &&
-          pspec->value_type == G_TYPE_FROM_INSTANCE (config))
+      if (G_IS_PARAM_SPEC_OBJECT (gegl_pspec) &&
+          gegl_pspec->value_type == G_TYPE_FROM_INSTANCE (config))
         {
           gegl_node_set (node,
-                         pspec->name, config,
+                         gegl_pspec->name, config,
                          NULL);
-          g_free (pspecs);
-          return;
         }
-    }
-
-  for (i = 0; i < n_pspecs; i++)
-    {
-      GParamSpec *gegl_pspec = pspecs[i];
-      GParamSpec *gimp_pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (config),
-                                                             gegl_pspec->name);
-
-      if (gimp_pspec)
+      else if (gimp_pspec)
         {
           GValue value = G_VALUE_INIT;
 
diff --git a/app/tools/gimpcurvestool.c b/app/tools/gimpcurvestool.c
index 7721e2ad5e..24e4463512 100644
--- a/app/tools/gimpcurvestool.c
+++ b/app/tools/gimpcurvestool.c
@@ -211,10 +211,6 @@ gimp_curves_tool_initialize (GimpTool     *tool,
 
   config = GIMP_CURVES_CONFIG (filter_tool->config);
 
-  gegl_node_set (filter_tool->operation,
-                 "trc", config->trc,
-                 NULL);
-
   histogram = gimp_histogram_new (config->trc);
   g_object_unref (gimp_drawable_calculate_histogram_async (drawable, histogram,
                                                            FALSE));
@@ -744,10 +740,6 @@ gimp_curves_tool_config_notify (GimpFilterTool   *filter_tool,
     {
       GimpHistogram *histogram;
 
-      gegl_node_set (filter_tool->operation,
-                     "trc", curves_config->trc,
-                     NULL);
-
       histogram = gimp_histogram_new (curves_config->trc);
       g_object_unref (gimp_drawable_calculate_histogram_async
                       (GIMP_TOOL (filter_tool)->drawable, histogram, FALSE));
diff --git a/app/tools/gimplevelstool.c b/app/tools/gimplevelstool.c
index 9f7b1e2a8c..2620cf37a6 100644
--- a/app/tools/gimplevelstool.c
+++ b/app/tools/gimplevelstool.c
@@ -201,10 +201,6 @@ gimp_levels_tool_initialize (GimpTool     *tool,
 
   config = GIMP_LEVELS_CONFIG (filter_tool->config);
 
-  gegl_node_set (filter_tool->operation,
-                 "trc", config->trc,
-                 NULL);
-
   g_clear_object (&l_tool->histogram);
   g_clear_object (&l_tool->histogram_async);
   l_tool->histogram = gimp_histogram_new (config->trc);
@@ -678,10 +674,6 @@ gimp_levels_tool_config_notify (GimpFilterTool   *filter_tool,
 
   if (! strcmp (pspec->name, "trc"))
     {
-      gegl_node_set (filter_tool->operation,
-                     "trc", levels_config->trc,
-                     NULL);
-
       g_clear_object (&levels_tool->histogram);
       g_clear_object (&levels_tool->histogram_async);
       levels_tool->histogram = gimp_histogram_new (levels_config->trc);


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