[gimp/goat-invasion: 303/412] app: remove the lagacy hue-saturation cruft



commit 4530671138e83a8c419f2bd9fcfe2effd772849d
Author: Michael Natterer <mitch gimp org>
Date:   Thu Mar 29 02:35:56 2012 +0200

    app: remove the lagacy hue-saturation cruft
    
    it's unclear whether the operation is correct, but that can be sorted
    out on master and merged.

 app/base/Makefile.am                   |    2 -
 app/base/base-types.h                  |    2 -
 app/base/hue-saturation.c              |  211 --------------------------------
 app/base/hue-saturation.h              |   42 -------
 app/core/Makefile.am                   |    2 -
 app/core/gimpdrawable-hue-saturation.c |   92 --------------
 app/core/gimpdrawable-hue-saturation.h |   30 -----
 app/gegl/gimphuesaturationconfig.c     |   27 ----
 app/gegl/gimphuesaturationconfig.h     |    4 -
 app/pdb/color-cmds.c                   |   39 +++---
 app/tools/gimphuesaturationtool.c      |   35 ------
 app/tools/gimphuesaturationtool.h      |    1 -
 tools/pdbgen/pdb/color.pdb             |   39 +++---
 13 files changed, 42 insertions(+), 484 deletions(-)
---
diff --git a/app/base/Makefile.am b/app/base/Makefile.am
index 2c749fd..2ca38a2 100644
--- a/app/base/Makefile.am
+++ b/app/base/Makefile.am
@@ -26,8 +26,6 @@ libappbase_a_SOURCES = \
 	cpercep.h		\
 	gimplut.c		\
 	gimplut.h		\
-	hue-saturation.c	\
-	hue-saturation.h	\
 	pixel-processor.c	\
 	pixel-processor.h	\
 	pixel-region.c		\
diff --git a/app/base/base-types.h b/app/base/base-types.h
index 2599e1c..54a6cef 100644
--- a/app/base/base-types.h
+++ b/app/base/base-types.h
@@ -49,8 +49,6 @@
 
 typedef struct _GimpLut             GimpLut;
 
-typedef struct _HueSaturation       HueSaturation;
-
 typedef struct _PixelRegionIterator PixelRegionIterator;
 typedef struct _PixelRegion         PixelRegion;
 typedef struct _PixelRegionHolder   PixelRegionHolder;
diff --git a/app/core/Makefile.am b/app/core/Makefile.am
index a4ad4b2..d75338b 100644
--- a/app/core/Makefile.am
+++ b/app/core/Makefile.am
@@ -136,8 +136,6 @@ libappcore_a_sources = \
 	gimpdrawable-foreground-extract.h	\
 	gimpdrawable-histogram.c		\
 	gimpdrawable-histogram.h		\
-	gimpdrawable-hue-saturation.c		\
-	gimpdrawable-hue-saturation.h		\
 	gimpdrawable-levels.c			\
 	gimpdrawable-levels.h			\
 	gimpdrawable-offset.c			\
diff --git a/app/gegl/gimphuesaturationconfig.c b/app/gegl/gimphuesaturationconfig.c
index a7c1cba..1b3bb0b 100644
--- a/app/gegl/gimphuesaturationconfig.c
+++ b/app/gegl/gimphuesaturationconfig.c
@@ -27,9 +27,6 @@
 
 #include "gimp-gegl-types.h"
 
-/*  temp cruft  */
-#include "base/hue-saturation.h"
-
 #include "gimphuesaturationconfig.h"
 
 
@@ -352,27 +349,3 @@ gimp_hue_saturation_config_reset_range (GimpHueSaturationConfig *config)
 
   g_object_thaw_notify (G_OBJECT (config));
 }
-
-
-/*  temp cruft  */
-
-void
-gimp_hue_saturation_config_to_cruft (GimpHueSaturationConfig *config,
-                                     HueSaturation           *cruft)
-{
-  GimpHueRange range;
-
-  g_return_if_fail (GIMP_IS_HUE_SATURATION_CONFIG (config));
-  g_return_if_fail (cruft != NULL);
-
-  for (range = GIMP_ALL_HUES; range <= GIMP_MAGENTA_HUES; range++)
-    {
-      cruft->hue[range]        = config->hue[range]        * 180;
-      cruft->saturation[range] = config->saturation[range] * 100;
-      cruft->lightness[range]  = config->lightness[range]  * 100;
-    }
-
-  cruft->overlap = config->overlap * 100;
-
-  hue_saturation_calculate_transfers (cruft);
-}
diff --git a/app/gegl/gimphuesaturationconfig.h b/app/gegl/gimphuesaturationconfig.h
index 27cfb09..02b2d22 100644
--- a/app/gegl/gimphuesaturationconfig.h
+++ b/app/gegl/gimphuesaturationconfig.h
@@ -58,9 +58,5 @@ GType   gimp_hue_saturation_config_get_type    (void) G_GNUC_CONST;
 
 void    gimp_hue_saturation_config_reset_range (GimpHueSaturationConfig *config);
 
-/*  temp cruft  */
-void    gimp_hue_saturation_config_to_cruft    (GimpHueSaturationConfig *config,
-                                                HueSaturation           *cruft);
-
 
 #endif /* __GIMP_HUE_SATURATION_CONFIG_H__ */
diff --git a/app/pdb/color-cmds.c b/app/pdb/color-cmds.c
index 7da8252..8a75210 100644
--- a/app/pdb/color-cmds.c
+++ b/app/pdb/color-cmds.c
@@ -25,7 +25,6 @@
 
 #include "core/gimpdrawable-equalize.h"
 #include "core/gimpdrawable-histogram.h"
-#include "core/gimpdrawable-hue-saturation.h"
 #include "core/gimpdrawable-levels.h"
 #include "core/gimpdrawable-operation.h"
 #include "core/gimpdrawable.h"
@@ -36,6 +35,7 @@
 #include "gegl/gimpcolorizeconfig.h"
 #include "gegl/gimpcurvesconfig.h"
 #include "gegl/gimpdesaturateconfig.h"
+#include "gegl/gimphuesaturationconfig.h"
 #include "gegl/gimplevelsconfig.h"
 #include "gegl/gimpposterizeconfig.h"
 #include "gegl/gimpthresholdconfig.h"
@@ -79,7 +79,6 @@ brightness_contrast_invoker (GimpProcedure      *procedure,
                                                  C_("undo-type", "Brightness-Contrast"),
                                                  "gimp:brightness-contrast",
                                                  config);
-
           g_object_unref (config);
         }
       else
@@ -139,7 +138,6 @@ levels_invoker (GimpProcedure      *procedure,
                                                  C_("undo-type", "Levels"),
                                                  "gimp:levels",
                                                  config);
-
           g_object_unref (config);
         }
       else
@@ -234,7 +232,6 @@ posterize_invoker (GimpProcedure      *procedure,
                                                  _("Posterize"),
                                                  "gimp:posterize",
                                                  config);
-
           g_object_unref (config);
         }
       else
@@ -272,7 +269,6 @@ desaturate_invoker (GimpProcedure      *procedure,
                                                  _("Desaturate"),
                                                  "gimp:desaturate",
                                                  config);
-
           g_object_unref (config);
         }
       else
@@ -312,7 +308,6 @@ desaturate_full_invoker (GimpProcedure      *procedure,
                                                  _("Desaturate"),
                                                  "gimp:desaturate",
                                                  config);
-
           g_object_unref (config);
         }
       else
@@ -421,7 +416,6 @@ curves_spline_invoker (GimpProcedure      *procedure,
                                                  C_("undo-type", "Curves"),
                                                  "gimp:curves",
                                                  config);
-
           g_object_unref (config);
         }
       else
@@ -468,7 +462,6 @@ curves_explicit_invoker (GimpProcedure      *procedure,
                                                  C_("undo-type", "Curves"),
                                                  "gimp:curves",
                                                  config);
-
           g_object_unref (config);
         }
       else
@@ -522,7 +515,6 @@ color_balance_invoker (GimpProcedure      *procedure,
                                                  C_("undo-type", "Color Balance"),
                                                  "gimp:color-balance",
                                                  config);
-
           g_object_unref (config);
         }
       else
@@ -568,7 +560,6 @@ colorize_invoker (GimpProcedure      *procedure,
                                                  C_("undo-type", "Colorize"),
                                                  "gimp:colorize",
                                                  config);
-
           g_object_unref (config);
         }
       else
@@ -675,14 +666,27 @@ hue_saturation_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
-      if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) ||
-          ! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) ||
-          gimp_drawable_is_indexed (drawable))
-        success = FALSE;
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
+          gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+        {
+          GObject *config = g_object_new (GIMP_TYPE_HUE_SATURATION_CONFIG,
+                                          "range", hue_range,
+                                          NULL);
 
-      if (success)
-        gimp_drawable_hue_saturation (drawable, progress,
-                                      hue_range, hue_offset, saturation, lightness);
+           g_object_set (config,
+                         "hue",        hue_offset / 180.0,
+                         "saturation", saturation / 100.0,
+                         "lightness",  lightness  / 100.0,
+                         NULL);
+
+          gimp_drawable_apply_operation_by_name (drawable, progress,
+                                                 _("Hue-Saturation"),
+                                                 "gimp:hue-saturation",
+                                                 config);
+          g_object_unref (config);
+        }
+      else
+        success = FALSE;
     }
 
   return gimp_procedure_get_return_values (procedure, success,
@@ -720,7 +724,6 @@ threshold_invoker (GimpProcedure      *procedure,
                                                  _("Threshold"),
                                                  "gimp:threshold",
                                                  config);
-
           g_object_unref (config);
         }
       else
diff --git a/app/tools/gimphuesaturationtool.c b/app/tools/gimphuesaturationtool.c
index 972a505..96c0314 100644
--- a/app/tools/gimphuesaturationtool.c
+++ b/app/tools/gimphuesaturationtool.c
@@ -27,8 +27,6 @@
 
 #include "tools-types.h"
 
-#include "base/hue-saturation.h"
-
 #include "gegl/gimphuesaturationconfig.h"
 #include "gegl/gimpoperationhuesaturation.h"
 
@@ -53,15 +51,12 @@
 
 /*  local function prototypes  */
 
-static void       gimp_hue_saturation_tool_finalize      (GObject          *object);
-
 static gboolean   gimp_hue_saturation_tool_initialize    (GimpTool         *tool,
                                                           GimpDisplay      *display,
                                                           GError          **error);
 
 static GeglNode * gimp_hue_saturation_tool_get_operation (GimpImageMapTool *im_tool,
                                                           GObject         **config);
-static void       gimp_hue_saturation_tool_map           (GimpImageMapTool *im_tool);
 static void       gimp_hue_saturation_tool_dialog        (GimpImageMapTool *im_tool);
 static void       gimp_hue_saturation_tool_reset         (GimpImageMapTool *im_tool);
 
@@ -110,12 +105,9 @@ gimp_hue_saturation_tool_register (GimpToolRegisterCallback  callback,
 static void
 gimp_hue_saturation_tool_class_init (GimpHueSaturationToolClass *klass)
 {
-  GObjectClass          *object_class  = G_OBJECT_CLASS (klass);
   GimpToolClass         *tool_class    = GIMP_TOOL_CLASS (klass);
   GimpImageMapToolClass *im_tool_class = GIMP_IMAGE_MAP_TOOL_CLASS (klass);
 
-  object_class->finalize             = gimp_hue_saturation_tool_finalize;
-
   tool_class->initialize             = gimp_hue_saturation_tool_initialize;
 
   im_tool_class->dialog_desc         = _("Adjust Hue / Lightness / Saturation");
@@ -124,7 +116,6 @@ gimp_hue_saturation_tool_class_init (GimpHueSaturationToolClass *klass)
   im_tool_class->export_dialog_title = _("Export Hue-Saturation Settings");
 
   im_tool_class->get_operation       = gimp_hue_saturation_tool_get_operation;
-  im_tool_class->map                 = gimp_hue_saturation_tool_map;
   im_tool_class->dialog              = gimp_hue_saturation_tool_dialog;
   im_tool_class->reset               = gimp_hue_saturation_tool_reset;
 }
@@ -132,24 +123,6 @@ gimp_hue_saturation_tool_class_init (GimpHueSaturationToolClass *klass)
 static void
 gimp_hue_saturation_tool_init (GimpHueSaturationTool *hs_tool)
 {
-  GimpImageMapTool *im_tool = GIMP_IMAGE_MAP_TOOL (hs_tool);
-
-  hs_tool->hue_saturation = g_slice_new0 (HueSaturation);
-
-  hue_saturation_init (hs_tool->hue_saturation);
-
-  im_tool->apply_func = (GimpImageMapApplyFunc) hue_saturation;
-  im_tool->apply_data = hs_tool->hue_saturation;
-}
-
-static void
-gimp_hue_saturation_tool_finalize (GObject *object)
-{
-  GimpHueSaturationTool *hs_tool = GIMP_HUE_SATURATION_TOOL (object);
-
-  g_slice_free (HueSaturation, hs_tool->hue_saturation);
-
-  G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
 static gboolean
@@ -202,14 +175,6 @@ gimp_hue_saturation_tool_get_operation (GimpImageMapTool  *im_tool,
   return node;
 }
 
-static void
-gimp_hue_saturation_tool_map (GimpImageMapTool *image_map_tool)
-{
-  GimpHueSaturationTool *hs_tool = GIMP_HUE_SATURATION_TOOL (image_map_tool);
-
-  gimp_hue_saturation_config_to_cruft (hs_tool->config, hs_tool->hue_saturation);
-}
-
 
 /***************************/
 /*  Hue-Saturation dialog  */
diff --git a/app/tools/gimphuesaturationtool.h b/app/tools/gimphuesaturationtool.h
index 8fc23bd..24d5927 100644
--- a/app/tools/gimphuesaturationtool.h
+++ b/app/tools/gimphuesaturationtool.h
@@ -38,7 +38,6 @@ struct _GimpHueSaturationTool
   GimpImageMapTool         parent_instance;
 
   GimpHueSaturationConfig *config;
-  HueSaturation           *hue_saturation;
 
   /*  dialog  */
   GtkWidget               *range_radio;
diff --git a/tools/pdbgen/pdb/color.pdb b/tools/pdbgen/pdb/color.pdb
index dd6d83a..179554f 100644
--- a/tools/pdbgen/pdb/color.pdb
+++ b/tools/pdbgen/pdb/color.pdb
@@ -53,7 +53,6 @@ HELP
                                              C_("undo-type", "Brightness-Contrast"),
                                              "gimp:brightness-contrast",
                                              config);
-
       g_object_unref (config);
     }
   else
@@ -125,7 +124,6 @@ HELP
                                              C_("undo-type", "Levels"),
                                              "gimp:levels",
                                              config);
-
       g_object_unref (config);
     }
   else
@@ -225,7 +223,6 @@ HELP
                                              _("Posterize"),
                                              "gimp:posterize",
                                              config);
-
       g_object_unref (config);
     }
   else
@@ -266,7 +263,6 @@ HELP
                                              _("Desaturate"),
                                              "gimp:desaturate",
                                              config);
-
       g_object_unref (config);
     }
   else
@@ -314,7 +310,6 @@ HELP
                                              _("Desaturate"),
                                              "gimp:desaturate",
                                              config);
-
       g_object_unref (config);
     }
   else
@@ -443,7 +438,6 @@ HELP
                                              C_("undo-type", "Curves"),
                                              "gimp:curves",
                                              config);
-
       g_object_unref (config);
     }
   else
@@ -498,7 +492,6 @@ HELP
                                              C_("undo-type", "Curves"),
                                              "gimp:curves",
                                              config);
-
       g_object_unref (config);
     }
   else
@@ -561,7 +554,6 @@ HELP
                                              C_("undo-type", "Color Balance"),
                                              "gimp:color-balance",
                                              config);
-
       g_object_unref (config);
     }
   else
@@ -610,7 +602,6 @@ HELP
                                              C_("undo-type", "Colorize"),
                                              "gimp:colorize",
                                              config);
-
       g_object_unref (config);
     }
   else
@@ -732,17 +723,30 @@ HELP
     );
 
     %invoke = (
-	headers => [ qw("core/gimpdrawable-hue-saturation.h") ],
+	headers => [ qw("gegl/gimphuesaturationconfig.h") ],
 	code => <<'CODE'
 {
-  if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) ||
-      ! gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error) ||
-      gimp_drawable_is_indexed (drawable))
-    success = FALSE;
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
+      gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+    {
+      GObject *config = g_object_new (GIMP_TYPE_HUE_SATURATION_CONFIG,
+                                      "range", hue_range,
+                                      NULL);
 
-  if (success)
-    gimp_drawable_hue_saturation (drawable, progress,
-                                  hue_range, hue_offset, saturation, lightness);
+       g_object_set (config,
+                     "hue",        hue_offset / 180.0,
+                     "saturation", saturation / 100.0,
+                     "lightness",  lightness  / 100.0,
+                     NULL);
+
+      gimp_drawable_apply_operation_by_name (drawable, progress,
+                                             _("Hue-Saturation"),
+                                             "gimp:hue-saturation",
+                                             config);
+      g_object_unref (config);
+    }
+  else
+    success = FALSE;
 }
 CODE
     );
@@ -785,7 +789,6 @@ HELP
                                              _("Threshold"),
                                              "gimp:threshold",
                                              config);
-
       g_object_unref (config);
     }
   else



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