[gimp] app: reset common settings when resetting Curves tool



commit 88689515ab22e973a32f53c73a857603090a8adc
Author: Ell <ell_se yahoo com>
Date:   Tue Apr 14 17:53:21 2020 +0300

    app: reset common settings when resetting Curves tool
    
    In GimpCurveTool, don't reset the curve config manually, and rather
    let GimpFilterTool reset it, only maintaining the active channel
    (similarly to GimpLevelsTool), so that the common operation
    settings are also reset.
    
    Note that this also avoids keeping the channel curve types, which
    should work correctly after last commit.

 app/tools/gimpcurvestool.c | 45 ++++++++-------------------------------------
 1 file changed, 8 insertions(+), 37 deletions(-)
---
diff --git a/app/tools/gimpcurvestool.c b/app/tools/gimpcurvestool.c
index 24e4463512..9112308efa 100644
--- a/app/tools/gimpcurvestool.c
+++ b/app/tools/gimpcurvestool.c
@@ -678,46 +678,17 @@ gimp_curves_tool_dialog (GimpFilterTool *filter_tool)
 static void
 gimp_curves_tool_reset (GimpFilterTool *filter_tool)
 {
-  GimpCurvesConfig     *config = GIMP_CURVES_CONFIG (filter_tool->config);
-  GimpCurvesConfig     *default_config;
-  GimpHistogramChannel  channel;
-
-  default_config = GIMP_CURVES_CONFIG (filter_tool->default_config);
-
-  g_object_freeze_notify (G_OBJECT (config));
-
-  if (default_config)
-    g_object_set (config, "trc", default_config->trc, NULL);
-  else
-    gimp_config_reset_property (G_OBJECT (config), "trc");
-
-  for (channel = GIMP_HISTOGRAM_VALUE;
-       channel <= GIMP_HISTOGRAM_ALPHA;
-       channel++)
-    {
-      if (default_config)
-        {
-          GimpCurveType curve_type = config->curve[channel]->curve_type;
-
-          g_object_freeze_notify (G_OBJECT (config->curve[channel]));
-
-          gimp_config_copy (GIMP_CONFIG (default_config->curve[channel]),
-                            GIMP_CONFIG (config->curve[channel]),
-                            0);
+  GimpHistogramChannel channel;
 
-          g_object_set (config->curve[channel],
-                        "curve-type", curve_type,
-                        NULL);
+  g_object_get (filter_tool->config,
+                "channel", &channel,
+                NULL);
 
-          g_object_thaw_notify (G_OBJECT (config->curve[channel]));
-        }
-      else
-        {
-          gimp_curve_reset (config->curve[channel], FALSE);
-        }
-    }
+  GIMP_FILTER_TOOL_CLASS (parent_class)->reset (filter_tool);
 
-  g_object_thaw_notify (G_OBJECT (config));
+  g_object_set (filter_tool->config,
+                "channel", channel,
+                NULL);
 }
 
 static void


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