gimp r24724 - in trunk: . app/gegl app/tools



Author: mitch
Date: Sun Jan 27 17:39:01 2008
New Revision: 24724
URL: http://svn.gnome.org/viewvc/gimp?rev=24724&view=rev

Log:
2008-01-27  Michael Natterer  <mitch gimp org>

	* app/gegl/gimpcolorbalanceconfig.[ch]
	* app/gegl/gimpcolorizeconfig.[ch]
	* app/gegl/gimpcurvesconfig.[ch]
	* app/gegl/gimphuesaturationconfig.[ch]
	* app/gegl/gimplevelsconfig.[ch]
	* app/gegl/gimpposterizeconfig.[ch]
	* app/gegl/gimpthresholdconfig.[ch]: implement the GimpConfig
	interface and remove public reset() functions except special ones
	which reset only parts of the objects. Add lots of property
	notifications.

	* app/tools/gimpcolorbalancetool.c
	* app/tools/gimpcolorizetool.c
	* app/tools/gimpcurvestool.c
	* app/tools/gimphuesaturationtool.c
	* app/tools/gimplevelstool.c
	* app/tools/gimpposterizetool.c
	* app/tools/gimpthresholdtool.c: use gimp_config_reset(), misc.
	related changes and cleanups.



Modified:
   trunk/ChangeLog
   trunk/app/gegl/gimpcolorbalanceconfig.c
   trunk/app/gegl/gimpcolorbalanceconfig.h
   trunk/app/gegl/gimpcolorizeconfig.c
   trunk/app/gegl/gimpcolorizeconfig.h
   trunk/app/gegl/gimpcurvesconfig.c
   trunk/app/gegl/gimpcurvesconfig.h
   trunk/app/gegl/gimphuesaturationconfig.c
   trunk/app/gegl/gimphuesaturationconfig.h
   trunk/app/gegl/gimplevelsconfig.c
   trunk/app/gegl/gimplevelsconfig.h
   trunk/app/gegl/gimpposterizeconfig.c
   trunk/app/gegl/gimpposterizeconfig.h
   trunk/app/gegl/gimpthresholdconfig.c
   trunk/app/gegl/gimpthresholdconfig.h
   trunk/app/tools/gimpcolorbalancetool.c
   trunk/app/tools/gimpcolorizetool.c
   trunk/app/tools/gimpcurvestool.c
   trunk/app/tools/gimphuesaturationtool.c
   trunk/app/tools/gimplevelstool.c
   trunk/app/tools/gimpposterizetool.c
   trunk/app/tools/gimpthresholdtool.c

Modified: trunk/app/gegl/gimpcolorbalanceconfig.c
==============================================================================
--- trunk/app/gegl/gimpcolorbalanceconfig.c	(original)
+++ trunk/app/gegl/gimpcolorbalanceconfig.c	Sun Jan 27 17:39:01 2008
@@ -25,6 +25,7 @@
 
 #include "libgimpcolor/gimpcolor.h"
 #include "libgimpmath/gimpmath.h"
+#include "libgimpconfig/gimpconfig.h"
 
 #include "gegl-types.h"
 
@@ -45,6 +46,8 @@
 };
 
 
+static void   gimp_color_balance_config_iface_init   (GimpConfigInterface *iface);
+
 static void   gimp_color_balance_config_get_property (GObject      *object,
                                                       guint         property_id,
                                                       GValue       *value,
@@ -54,9 +57,13 @@
                                                       const GValue *value,
                                                       GParamSpec   *pspec);
 
+static void   gimp_color_balance_config_reset        (GimpConfig   *config);
+
 
-G_DEFINE_TYPE (GimpColorBalanceConfig, gimp_color_balance_config,
-               G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_CODE (GimpColorBalanceConfig, gimp_color_balance_config,
+                         G_TYPE_OBJECT,
+                         G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
+                                                gimp_color_balance_config_iface_init))
 
 #define parent_class gimp_color_balance_config_parent_class
 
@@ -98,7 +105,7 @@
                                    g_param_spec_double ("yellow-blue",
                                                         "Yellow-Blue",
                                                         "Yellow-Blue",
-                                                        -1.0, 1.0, 1.0,
+                                                        -1.0, 1.0, 0.0,
                                                         G_PARAM_READWRITE |
                                                         G_PARAM_CONSTRUCT));
 
@@ -112,9 +119,15 @@
 }
 
 static void
+gimp_color_balance_config_iface_init (GimpConfigInterface *iface)
+{
+  iface->reset = gimp_color_balance_config_reset;
+}
+
+static void
 gimp_color_balance_config_init (GimpColorBalanceConfig *self)
 {
-  gimp_color_balance_config_reset (self);
+  gimp_config_reset (GIMP_CONFIG (self));
 }
 
 static void
@@ -189,35 +202,41 @@
     }
 }
 
-
-/*  public functions  */
-
-void
-gimp_color_balance_config_reset (GimpColorBalanceConfig *config)
+static void
+gimp_color_balance_config_reset (GimpConfig *config)
 {
-  GimpTransferMode range;
+  GimpColorBalanceConfig *cb_config = GIMP_COLOR_BALANCE_CONFIG (config);
+  GimpTransferMode        range;
 
-  g_return_if_fail (GIMP_IS_COLOR_BALANCE_CONFIG (config));
-
-  config->range = GIMP_MIDTONES;
+  g_object_freeze_notify (G_OBJECT (config));
 
   for (range = GIMP_SHADOWS; range <= GIMP_HIGHLIGHTS; range++)
     {
-      gimp_color_balance_config_reset_range (config, range);
+      cb_config->range = range;
+      gimp_color_balance_config_reset_range (cb_config);
     }
 
-  config->preserve_luminosity = TRUE;
+  gimp_config_reset_property (G_OBJECT (config), "range");
+  gimp_config_reset_property (G_OBJECT (config), "preserve-luminosity");
+
+  g_object_thaw_notify (G_OBJECT (config));
 }
 
+
+/*  public functions  */
+
 void
-gimp_color_balance_config_reset_range (GimpColorBalanceConfig *config,
-                                       GimpTransferMode        range)
+gimp_color_balance_config_reset_range (GimpColorBalanceConfig *config)
 {
   g_return_if_fail (GIMP_IS_COLOR_BALANCE_CONFIG (config));
 
-  config->cyan_red[range]      = 0.0;
-  config->magenta_green[range] = 0.0;
-  config->yellow_blue[range]   = 0.0;
+  g_object_freeze_notify (G_OBJECT (config));
+
+  gimp_config_reset_property (G_OBJECT (config), "cyan-red");
+  gimp_config_reset_property (G_OBJECT (config), "magenta-green");
+  gimp_config_reset_property (G_OBJECT (config), "yellow-blue");
+
+  g_object_thaw_notify (G_OBJECT (config));
 }
 
 

Modified: trunk/app/gegl/gimpcolorbalanceconfig.h
==============================================================================
--- trunk/app/gegl/gimpcolorbalanceconfig.h	(original)
+++ trunk/app/gegl/gimpcolorbalanceconfig.h	Sun Jan 27 17:39:01 2008
@@ -54,9 +54,7 @@
 
 GType   gimp_color_balance_config_get_type    (void) G_GNUC_CONST;
 
-void    gimp_color_balance_config_reset       (GimpColorBalanceConfig *config);
-void    gimp_color_balance_config_reset_range (GimpColorBalanceConfig *config,
-                                               GimpTransferMode        range);
+void    gimp_color_balance_config_reset_range (GimpColorBalanceConfig *config);
 
 /*  temp cruft  */
 void    gimp_color_balance_config_to_cruft    (GimpColorBalanceConfig *config,

Modified: trunk/app/gegl/gimpcolorizeconfig.c
==============================================================================
--- trunk/app/gegl/gimpcolorizeconfig.c	(original)
+++ trunk/app/gegl/gimpcolorizeconfig.c	Sun Jan 27 17:39:01 2008
@@ -23,6 +23,8 @@
 
 #include <gegl.h>
 
+#include "libgimpconfig/gimpconfig.h"
+
 #include "gegl-types.h"
 
 /*  temp cruft  */
@@ -50,7 +52,9 @@
                                                  GParamSpec   *pspec);
 
 
-G_DEFINE_TYPE (GimpColorizeConfig, gimp_colorize_config, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_CODE (GimpColorizeConfig, gimp_colorize_config,
+                         G_TYPE_OBJECT,
+                         G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG, NULL))
 
 #define parent_class gimp_colorize_config_parent_class
 
@@ -150,19 +154,6 @@
 }
 
 
-/*  public functions  */
-
-void
-gimp_colorize_config_reset (GimpColorizeConfig *config)
-{
-  g_return_if_fail (GIMP_IS_COLORIZE_CONFIG (config));
-
-  config->hue        = 0.5;
-  config->saturation = 0.5;
-  config->lightness  = 0.0;
-}
-
-
 /*  temp cruft  */
 
 void

Modified: trunk/app/gegl/gimpcolorizeconfig.h
==============================================================================
--- trunk/app/gegl/gimpcolorizeconfig.h	(original)
+++ trunk/app/gegl/gimpcolorizeconfig.h	Sun Jan 27 17:39:01 2008
@@ -50,8 +50,6 @@
 
 GType   gimp_colorize_config_get_type (void) G_GNUC_CONST;
 
-void    gimp_colorize_config_reset    (GimpColorizeConfig *config);
-
 /*  temp cruft  */
 void    gimp_colorize_config_to_cruft (GimpColorizeConfig *config,
                                        Colorize           *cruft);

Modified: trunk/app/gegl/gimpcurvesconfig.c
==============================================================================
--- trunk/app/gegl/gimpcurvesconfig.c	(original)
+++ trunk/app/gegl/gimpcurvesconfig.c	Sun Jan 27 17:39:01 2008
@@ -24,6 +24,7 @@
 #include <string.h>
 
 #include <gegl.h>
+#include <glib/gstdio.h>
 
 #include "libgimpcolor/gimpcolor.h"
 #include "libgimpmath/gimpmath.h"
@@ -49,6 +50,8 @@
 };
 
 
+static void   gimp_curves_config_iface_init   (GimpConfigInterface *iface);
+
 static void   gimp_curves_config_finalize     (GObject       *object);
 static void   gimp_curves_config_get_property (GObject       *object,
                                                guint          property_id,
@@ -59,8 +62,13 @@
                                                const GValue  *value,
                                                GParamSpec    *pspec);
 
+static void   gimp_curves_config_reset        (GimpConfig    *config);
+
 
-G_DEFINE_TYPE (GimpCurvesConfig, gimp_curves_config, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_CODE (GimpCurvesConfig, gimp_curves_config,
+                         G_TYPE_OBJECT,
+                         G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
+                                                gimp_curves_config_iface_init))
 
 #define parent_class gimp_curves_config_parent_class
 
@@ -92,6 +100,12 @@
 }
 
 static void
+gimp_curves_config_iface_init (GimpConfigInterface *iface)
+{
+  iface->reset = gimp_curves_config_reset;
+}
+
+static void
 gimp_curves_config_init (GimpCurvesConfig *self)
 {
   GimpHistogramChannel channel;
@@ -103,7 +117,7 @@
       self->curve[channel] = GIMP_CURVE (gimp_curve_new ("curves config"));
     }
 
-  gimp_curves_config_reset (self);
+  gimp_config_reset (GIMP_CONFIG (self));
 }
 
 static void
@@ -176,33 +190,36 @@
     }
 }
 
-
-/*  public functions  */
-
-void
-gimp_curves_config_reset (GimpCurvesConfig *config)
+static void
+gimp_curves_config_reset (GimpConfig *config)
 {
-  GimpHistogramChannel channel;
-
-  g_return_if_fail (GIMP_IS_CURVES_CONFIG (config));
+  GimpCurvesConfig     *c_config = GIMP_CURVES_CONFIG (config);
+  GimpHistogramChannel  channel;
 
-  config->channel = GIMP_HISTOGRAM_VALUE;
+  g_object_freeze_notify (G_OBJECT (config));
 
   for (channel = GIMP_HISTOGRAM_VALUE;
        channel <= GIMP_HISTOGRAM_ALPHA;
        channel++)
     {
-      gimp_curve_reset (config->curve[channel], FALSE);
+      c_config->channel = channel;
+      gimp_curves_config_reset_channel (c_config);
     }
+
+  gimp_config_reset_property (G_OBJECT (config), "channel");
+
+  g_object_thaw_notify (G_OBJECT (config));
 }
 
+
+/*  public functions  */
+
 void
-gimp_curves_config_reset_channel (GimpCurvesConfig     *config,
-                                  GimpHistogramChannel  channel)
+gimp_curves_config_reset_channel (GimpCurvesConfig *config)
 {
   g_return_if_fail (GIMP_IS_CURVES_CONFIG (config));
 
-  gimp_curve_reset (config->curve[channel], FALSE);
+  gimp_curve_reset (config->curve[config->channel], TRUE);
 }
 
 gboolean

Modified: trunk/app/gegl/gimpcurvesconfig.h
==============================================================================
--- trunk/app/gegl/gimpcurvesconfig.h	(original)
+++ trunk/app/gegl/gimpcurvesconfig.h	Sun Jan 27 17:39:01 2008
@@ -55,21 +55,19 @@
 
 GType      gimp_curves_config_get_type      (void) G_GNUC_CONST;
 
-void       gimp_curves_config_reset         (GimpCurvesConfig      *config);
-void       gimp_curves_config_reset_channel (GimpCurvesConfig      *config,
-                                             GimpHistogramChannel   channel);
-
-gboolean   gimp_curves_config_load_cruft    (GimpCurvesConfig      *config,
-                                             gpointer               fp,
-                                             GError               **error);
-gboolean   gimp_curves_config_save_cruft    (GimpCurvesConfig      *config,
-                                             gpointer               fp);
+void       gimp_curves_config_reset_channel (GimpCurvesConfig  *config);
+
+gboolean   gimp_curves_config_load_cruft    (GimpCurvesConfig  *config,
+                                             gpointer           fp,
+                                             GError           **error);
+gboolean   gimp_curves_config_save_cruft    (GimpCurvesConfig  *config,
+                                             gpointer           fp);
 
 
 /*  temp cruft  */
-void       gimp_curves_config_to_cruft      (GimpCurvesConfig      *config,
-                                             Curves                *cruft,
-                                             gboolean               is_color);
+void       gimp_curves_config_to_cruft      (GimpCurvesConfig  *config,
+                                             Curves            *cruft,
+                                             gboolean           is_color);
 
 
 #endif /* __GIMP_CURVES_CONFIG_H__ */

Modified: trunk/app/gegl/gimphuesaturationconfig.c
==============================================================================
--- trunk/app/gegl/gimphuesaturationconfig.c	(original)
+++ trunk/app/gegl/gimphuesaturationconfig.c	Sun Jan 27 17:39:01 2008
@@ -23,6 +23,8 @@
 
 #include <gegl.h>
 
+#include "libgimpconfig/gimpconfig.h"
+
 #include "gegl-types.h"
 
 /*  temp cruft  */
@@ -42,6 +44,8 @@
 };
 
 
+static void   gimp_hue_saturation_config_iface_init   (GimpConfigInterface *iface);
+
 static void   gimp_hue_saturation_config_get_property (GObject      *object,
                                                        guint         property_id,
                                                        GValue       *value,
@@ -51,9 +55,13 @@
                                                        const GValue *value,
                                                        GParamSpec   *pspec);
 
+static void   gimp_hue_saturation_config_reset        (GimpConfig   *config);
+
 
-G_DEFINE_TYPE (GimpHueSaturationConfig, gimp_hue_saturation_config,
-               G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_CODE (GimpHueSaturationConfig, gimp_hue_saturation_config,
+                         G_TYPE_OBJECT,
+                         G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
+                                                gimp_hue_saturation_config_iface_init))
 
 #define parent_class gimp_hue_saturation_config_parent_class
 
@@ -109,9 +117,15 @@
 }
 
 static void
+gimp_hue_saturation_config_iface_init (GimpConfigInterface *iface)
+{
+  iface->reset = gimp_hue_saturation_config_reset;
+}
+
+static void
 gimp_hue_saturation_config_init (GimpHueSaturationConfig *self)
 {
-  gimp_hue_saturation_config_reset (self);
+  gimp_config_reset (GIMP_CONFIG (self));
 }
 
 static void
@@ -186,35 +200,41 @@
     }
 }
 
-
-/*  public functions  */
-
-void
-gimp_hue_saturation_config_reset (GimpHueSaturationConfig *config)
+static void
+gimp_hue_saturation_config_reset (GimpConfig *config)
 {
-  GimpHueRange range;
+  GimpHueSaturationConfig *hs_config = GIMP_HUE_SATURATION_CONFIG (config);
+  GimpHueRange             range;
 
-  g_return_if_fail (GIMP_IS_HUE_SATURATION_CONFIG (config));
-
-  config->range = GIMP_ALL_HUES;
+  g_object_freeze_notify (G_OBJECT (config));
 
   for (range = GIMP_ALL_HUES; range <= GIMP_MAGENTA_HUES; range++)
     {
-      gimp_hue_saturation_config_reset_range (config, range);
+      hs_config->range = range;
+      gimp_hue_saturation_config_reset_range (hs_config);
     }
 
-  config->overlap = 0.0;
+  gimp_config_reset_property (G_OBJECT (config), "range");
+  gimp_config_reset_property (G_OBJECT (config), "overlap");
+
+  g_object_thaw_notify (G_OBJECT (config));
 }
 
+
+/*  public functions  */
+
 void
-gimp_hue_saturation_config_reset_range (GimpHueSaturationConfig *config,
-                                        GimpHueRange             range)
+gimp_hue_saturation_config_reset_range (GimpHueSaturationConfig *config)
 {
   g_return_if_fail (GIMP_IS_HUE_SATURATION_CONFIG (config));
 
-  config->hue[range]        = 0.0;
-  config->saturation[range] = 0.0;
-  config->lightness[range]  = 0.0;
+  g_object_freeze_notify (G_OBJECT (config));
+
+  gimp_config_reset_property (G_OBJECT (config), "hue");
+  gimp_config_reset_property (G_OBJECT (config), "saturation");
+  gimp_config_reset_property (G_OBJECT (config), "lightness");
+
+  g_object_thaw_notify (G_OBJECT (config));
 }
 
 

Modified: trunk/app/gegl/gimphuesaturationconfig.h
==============================================================================
--- trunk/app/gegl/gimphuesaturationconfig.h	(original)
+++ trunk/app/gegl/gimphuesaturationconfig.h	Sun Jan 27 17:39:01 2008
@@ -54,9 +54,7 @@
 
 GType   gimp_hue_saturation_config_get_type    (void) G_GNUC_CONST;
 
-void    gimp_hue_saturation_config_reset       (GimpHueSaturationConfig *config);
-void    gimp_hue_saturation_config_reset_range (GimpHueSaturationConfig *config,
-                                                GimpHueRange             range);
+void    gimp_hue_saturation_config_reset_range (GimpHueSaturationConfig *config);
 
 /*  temp cruft  */
 void    gimp_hue_saturation_config_to_cruft    (GimpHueSaturationConfig *config,

Modified: trunk/app/gegl/gimplevelsconfig.c
==============================================================================
--- trunk/app/gegl/gimplevelsconfig.c	(original)
+++ trunk/app/gegl/gimplevelsconfig.c	Sun Jan 27 17:39:01 2008
@@ -55,6 +55,8 @@
 };
 
 
+static void   gimp_levels_config_iface_init   (GimpConfigInterface *iface);
+
 static void   gimp_levels_config_get_property (GObject       *object,
                                                guint          property_id,
                                                GValue        *value,
@@ -64,8 +66,13 @@
                                                const GValue  *value,
                                                GParamSpec    *pspec);
 
+static void   gimp_levels_config_reset        (GimpConfig    *config);
+
 
-G_DEFINE_TYPE (GimpLevelsConfig, gimp_levels_config, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_CODE (GimpLevelsConfig, gimp_levels_config,
+                         G_TYPE_OBJECT,
+                         G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
+                                                gimp_levels_config_iface_init))
 
 #define parent_class gimp_levels_config_parent_class
 
@@ -129,9 +136,15 @@
 }
 
 static void
+gimp_levels_config_iface_init (GimpConfigInterface *iface)
+{
+  iface->reset = gimp_levels_config_reset;
+}
+
+static void
 gimp_levels_config_init (GimpLevelsConfig *self)
 {
-  gimp_levels_config_reset (self);
+  gimp_config_reset (GIMP_CONFIG (self));
 }
 
 static void
@@ -214,64 +227,80 @@
     }
 }
 
-
-/*  public functions  */
-
-void
-gimp_levels_config_reset (GimpLevelsConfig *config)
+static void
+gimp_levels_config_reset (GimpConfig *config)
 {
-  GimpHistogramChannel channel;
-
-  g_return_if_fail (GIMP_IS_LEVELS_CONFIG (config));
+  GimpLevelsConfig     *l_config = GIMP_LEVELS_CONFIG (config);
+  GimpHistogramChannel  channel;
 
-  config->channel = GIMP_HISTOGRAM_VALUE;
+  g_object_freeze_notify (G_OBJECT (config));
 
   for (channel = GIMP_HISTOGRAM_VALUE;
        channel <= GIMP_HISTOGRAM_ALPHA;
        channel++)
     {
-      gimp_levels_config_reset_channel (config, channel);
+      l_config->channel = channel;
+      gimp_levels_config_reset_channel (l_config);
     }
+
+  gimp_config_reset_property (G_OBJECT (config), "channel");
+
+  g_object_thaw_notify (G_OBJECT (config));
 }
 
+
+/*  public functions  */
+
 void
-gimp_levels_config_reset_channel (GimpLevelsConfig     *config,
-                                  GimpHistogramChannel  channel)
+gimp_levels_config_reset_channel (GimpLevelsConfig *config)
 {
   g_return_if_fail (GIMP_IS_LEVELS_CONFIG (config));
 
-  config->gamma[channel]       = 1.0;
-  config->low_input[channel]   = 0.0;
-  config->high_input[channel]  = 1.0;
-  config->low_output[channel]  = 0.0;
-  config->high_output[channel] = 1.0;
+  g_object_freeze_notify (G_OBJECT (config));
+
+  gimp_config_reset_property (G_OBJECT (config), "gamma");
+  gimp_config_reset_property (G_OBJECT (config), "low-input");
+  gimp_config_reset_property (G_OBJECT (config), "high-input");
+  gimp_config_reset_property (G_OBJECT (config), "low-output");
+  gimp_config_reset_property (G_OBJECT (config), "high-output");
+
+  g_object_thaw_notify (G_OBJECT (config));
 }
 
 void
-gimp_levels_config_stretch (GimpLevelsConfig     *config,
-                            GimpHistogram        *histogram,
-                            gboolean              is_color)
+gimp_levels_config_stretch (GimpLevelsConfig *config,
+                            GimpHistogram    *histogram,
+                            gboolean          is_color)
 {
   g_return_if_fail (GIMP_IS_LEVELS_CONFIG (config));
   g_return_if_fail (histogram != NULL);
 
+  g_object_freeze_notify (G_OBJECT (config));
+
   if (is_color)
     {
       GimpHistogramChannel channel;
 
-     /*  Set the overall value to defaults  */
-      gimp_levels_config_reset_channel (config, GIMP_HISTOGRAM_VALUE);
+      /*  Set the overall value to defaults  */
+      channel = config->channel;
+      config->channel = GIMP_HISTOGRAM_VALUE;
+      gimp_levels_config_reset_channel (config);
+      config->channel = channel;
 
       for (channel = GIMP_HISTOGRAM_RED;
            channel <= GIMP_HISTOGRAM_BLUE;
            channel++)
-        gimp_levels_config_stretch_channel (config, histogram, channel);
+        {
+          gimp_levels_config_stretch_channel (config, histogram, channel);
+        }
     }
   else
     {
       gimp_levels_config_stretch_channel (config, histogram,
                                           GIMP_HISTOGRAM_VALUE);
     }
+
+  g_object_thaw_notify (G_OBJECT (config));
 }
 
 void
@@ -285,6 +314,8 @@
   g_return_if_fail (GIMP_IS_LEVELS_CONFIG (config));
   g_return_if_fail (histogram != NULL);
 
+  g_object_freeze_notify (G_OBJECT (config));
+
   config->gamma[channel]       = 1.0;
   config->low_output[channel]  = 0.0;
   config->high_output[channel] = 1.0;
@@ -340,6 +371,14 @@
             }
         }
     }
+
+  g_object_notify (G_OBJECT (config), "gamma");
+  g_object_notify (G_OBJECT (config), "low-input");
+  g_object_notify (G_OBJECT (config), "high-input");
+  g_object_notify (G_OBJECT (config), "low-output");
+  g_object_notify (G_OBJECT (config), "high-output");
+
+  g_object_thaw_notify (G_OBJECT (config));
 }
 
 static gdouble
@@ -379,13 +418,22 @@
 {
   g_return_if_fail (GIMP_IS_LEVELS_CONFIG (config));
 
+  g_object_freeze_notify (G_OBJECT (config));
+
   if (black)
-    config->low_input[channel] = gimp_levels_config_input_from_color (channel,
-                                                                      black);
+    {
+      config->low_input[channel] = gimp_levels_config_input_from_color (channel,
+                                                                        black);
+      g_object_notify (G_OBJECT (config), "low-input");
+    }
+
 
   if (white)
-    config->high_input[channel] = gimp_levels_config_input_from_color (channel,
-                                                                       white);
+    {
+      config->high_input[channel] = gimp_levels_config_input_from_color (channel,
+                                                                         white);
+      g_object_notify (G_OBJECT (config), "high-input");
+    }
 
   if (gray)
     {
@@ -417,7 +465,10 @@
 
       /* Map selected color to corresponding lightness */
       config->gamma[channel] = log (inten) / log (out_light);
+      g_object_notify (G_OBJECT (config), "gamma");
     }
+
+  g_object_thaw_notify (G_OBJECT (config));
 }
 
 gboolean
@@ -468,6 +519,8 @@
         goto error;
     }
 
+  g_object_freeze_notify (G_OBJECT (config));
+
   for (i = 0; i < 5; i++)
     {
       config->low_input[i]   = low_input[i]   / 255.0;
@@ -477,6 +530,14 @@
       config->gamma[i]       = gamma[i];
     }
 
+  g_object_notify (G_OBJECT (config), "gamma");
+  g_object_notify (G_OBJECT (config), "low-input");
+  g_object_notify (G_OBJECT (config), "high-input");
+  g_object_notify (G_OBJECT (config), "low-output");
+  g_object_notify (G_OBJECT (config), "high-output");
+
+  g_object_thaw_notify (G_OBJECT (config));
+
   return TRUE;
 
  error:

Modified: trunk/app/gegl/gimplevelsconfig.h
==============================================================================
--- trunk/app/gegl/gimplevelsconfig.h	(original)
+++ trunk/app/gegl/gimplevelsconfig.h	Sun Jan 27 17:39:01 2008
@@ -56,9 +56,7 @@
 
 GType      gimp_levels_config_get_type         (void) G_GNUC_CONST;
 
-void       gimp_levels_config_reset            (GimpLevelsConfig      *config);
-void       gimp_levels_config_reset_channel    (GimpLevelsConfig      *config,
-                                                GimpHistogramChannel   channel);
+void       gimp_levels_config_reset_channel    (GimpLevelsConfig      *config);
 
 void       gimp_levels_config_stretch          (GimpLevelsConfig      *config,
                                                 GimpHistogram         *histogram,

Modified: trunk/app/gegl/gimpposterizeconfig.c
==============================================================================
--- trunk/app/gegl/gimpposterizeconfig.c	(original)
+++ trunk/app/gegl/gimpposterizeconfig.c	Sun Jan 27 17:39:01 2008
@@ -23,6 +23,8 @@
 
 #include <gegl.h>
 
+#include "libgimpconfig/gimpconfig.h"
+
 #include "gegl-types.h"
 
 #include "gimpposterizeconfig.h"
@@ -45,8 +47,9 @@
                                                   GParamSpec   *pspec);
 
 
-G_DEFINE_TYPE (GimpPosterizeConfig, gimp_posterize_config,
-               G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_CODE (GimpPosterizeConfig, gimp_posterize_config,
+                         G_TYPE_OBJECT,
+                         G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG, NULL))
 
 #define parent_class gimp_posterize_config_parent_class
 
@@ -112,14 +115,3 @@
       break;
     }
 }
-
-
-/*  public functions  */
-
-void
-gimp_posterize_config_reset (GimpPosterizeConfig *config)
-{
-  g_return_if_fail (GIMP_IS_POSTERIZE_CONFIG (config));
-
-  config->levels = 3;
-}

Modified: trunk/app/gegl/gimpposterizeconfig.h
==============================================================================
--- trunk/app/gegl/gimpposterizeconfig.h	(original)
+++ trunk/app/gegl/gimpposterizeconfig.h	Sun Jan 27 17:39:01 2008
@@ -48,7 +48,5 @@
 
 GType   gimp_posterize_config_get_type (void) G_GNUC_CONST;
 
-void    gimp_posterize_config_reset    (GimpPosterizeConfig *config);
-
 
 #endif /* __GIMP_POSTERIZE_CONFIG_H__ */

Modified: trunk/app/gegl/gimpthresholdconfig.c
==============================================================================
--- trunk/app/gegl/gimpthresholdconfig.c	(original)
+++ trunk/app/gegl/gimpthresholdconfig.c	Sun Jan 27 17:39:01 2008
@@ -23,6 +23,8 @@
 
 #include <gegl.h>
 
+#include "libgimpconfig/gimpconfig.h"
+
 #include "gegl-types.h"
 
 /*  temp cruft  */
@@ -49,8 +51,9 @@
                                                   GParamSpec   *pspec);
 
 
-G_DEFINE_TYPE (GimpThresholdConfig, gimp_threshold_config,
-               G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_CODE (GimpThresholdConfig, gimp_threshold_config,
+                         G_TYPE_OBJECT,
+                         G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG, NULL))
 
 #define parent_class gimp_threshold_config_parent_class
 
@@ -134,18 +137,6 @@
 }
 
 
-/*  public functions  */
-
-void
-gimp_threshold_config_reset (GimpThresholdConfig *config)
-{
-  g_return_if_fail (GIMP_IS_THRESHOLD_CONFIG (config));
-
-  config->low  = 0.5;
-  config->high = 1.0;
-}
-
-
 /*  temp cruft  */
 
 void

Modified: trunk/app/gegl/gimpthresholdconfig.h
==============================================================================
--- trunk/app/gegl/gimpthresholdconfig.h	(original)
+++ trunk/app/gegl/gimpthresholdconfig.h	Sun Jan 27 17:39:01 2008
@@ -49,8 +49,6 @@
 
 GType   gimp_threshold_config_get_type (void) G_GNUC_CONST;
 
-void    gimp_threshold_config_reset    (GimpThresholdConfig *config);
-
 /*  temp cruft  */
 void    gimp_threshold_config_to_cruft (GimpThresholdConfig *config,
                                         Threshold           *cruft);

Modified: trunk/app/tools/gimpcolorbalancetool.c
==============================================================================
--- trunk/app/tools/gimpcolorbalancetool.c	(original)
+++ trunk/app/tools/gimpcolorbalancetool.c	Sun Jan 27 17:39:01 2008
@@ -21,6 +21,7 @@
 #include <gegl.h>
 #include <gtk/gtk.h>
 
+#include "libgimpconfig/gimpconfig.h"
 #include "libgimpwidgets/gimpwidgets.h"
 
 #include "tools-types.h"
@@ -160,7 +161,7 @@
       return FALSE;
     }
 
-  gimp_color_balance_config_reset (cb_tool->config);
+  gimp_config_reset (GIMP_CONFIG (cb_tool->config));
 
   GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error);
 
@@ -329,7 +330,7 @@
   GimpColorBalanceTool *cb_tool = GIMP_COLOR_BALANCE_TOOL (im_tool);
   GimpTransferMode      range   = cb_tool->config->range;
 
-  gimp_color_balance_config_reset (cb_tool->config);
+  gimp_config_reset (GIMP_CONFIG (cb_tool->config));
   g_object_set (cb_tool->config,
                 "range", range,
                 NULL);
@@ -374,8 +375,7 @@
 color_balance_range_reset_callback (GtkWidget            *widget,
                                     GimpColorBalanceTool *cb_tool)
 {
-  gimp_color_balance_config_reset_range (cb_tool->config,
-                                         cb_tool->config->range);
+  gimp_color_balance_config_reset_range (cb_tool->config);
 
   color_balance_update (cb_tool);
 

Modified: trunk/app/tools/gimpcolorizetool.c
==============================================================================
--- trunk/app/tools/gimpcolorizetool.c	(original)
+++ trunk/app/tools/gimpcolorizetool.c	Sun Jan 27 17:39:01 2008
@@ -21,6 +21,7 @@
 #include <gegl.h>
 #include <gtk/gtk.h>
 
+#include "libgimpconfig/gimpconfig.h"
 #include "libgimpwidgets/gimpwidgets.h"
 
 #include "tools-types.h"
@@ -154,7 +155,7 @@
       return FALSE;
     }
 
-  gimp_colorize_config_reset (col_tool->config);
+  gimp_config_reset (GIMP_CONFIG (col_tool->config));
 
   GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error);
 
@@ -271,7 +272,7 @@
 {
   GimpColorizeTool *col_tool = GIMP_COLORIZE_TOOL (image_map_tool);
 
-  gimp_colorize_config_reset (col_tool->config);
+  gimp_config_reset (GIMP_CONFIG (col_tool->config));
 
   colorize_update_sliders (col_tool);
 }

Modified: trunk/app/tools/gimpcurvestool.c
==============================================================================
--- trunk/app/tools/gimpcurvestool.c	(original)
+++ trunk/app/tools/gimpcurvestool.c	Sun Jan 27 17:39:01 2008
@@ -22,6 +22,7 @@
 #include <gtk/gtk.h>
 
 #include "libgimpcolor/gimpcolor.h"
+#include "libgimpconfig/gimpconfig.h"
 #include "libgimpwidgets/gimpwidgets.h"
 
 #include "tools-types.h"
@@ -210,7 +211,6 @@
 {
   GimpCurvesTool *c_tool   = GIMP_CURVES_TOOL (tool);
   GimpDrawable   *drawable = gimp_image_get_active_drawable (display->image);
-  gint            i;
 
   if (! drawable)
     return FALSE;
@@ -222,8 +222,7 @@
       return FALSE;
     }
 
-  for (i = 0; i < G_N_ELEMENTS (c_tool->config->curve); i++)
-    gimp_curve_reset (c_tool->config->curve[i], TRUE);
+  gimp_config_reset (GIMP_CONFIG (c_tool->config));
 
   if (! c_tool->hist)
     c_tool->hist = gimp_histogram_new ();
@@ -605,13 +604,15 @@
 static void
 gimp_curves_tool_reset (GimpImageMapTool *image_map_tool)
 {
-  GimpCurvesTool       *tool    = GIMP_CURVES_TOOL (image_map_tool);
-  GimpHistogramChannel  channel = tool->config->channel;
+  GimpCurvesTool       *tool = GIMP_CURVES_TOOL (image_map_tool);
+  GimpHistogramChannel  channel;
 
-  gimp_curves_config_reset (tool->config);
-  g_object_set (tool->config,
-                "channel", channel,
-                NULL);
+  for (channel = GIMP_HISTOGRAM_VALUE;
+       channel <= GIMP_HISTOGRAM_ALPHA;
+       channel++)
+    {
+      gimp_curve_reset (tool->config->curve[channel], FALSE);
+    }
 }
 
 static gboolean
@@ -714,7 +715,7 @@
 curves_channel_reset_callback (GtkWidget      *widget,
                                GimpCurvesTool *tool)
 {
-  gimp_curves_config_reset_channel (tool->config, tool->config->channel);
+  gimp_curve_reset (tool->config->curve[tool->config->channel], FALSE);
 }
 
 static gboolean

Modified: trunk/app/tools/gimphuesaturationtool.c
==============================================================================
--- trunk/app/tools/gimphuesaturationtool.c	(original)
+++ trunk/app/tools/gimphuesaturationtool.c	Sun Jan 27 17:39:01 2008
@@ -21,6 +21,7 @@
 #include <gegl.h>
 #include <gtk/gtk.h>
 
+#include "libgimpconfig/gimpconfig.h"
 #include "libgimpwidgets/gimpwidgets.h"
 
 #include "tools-types.h"
@@ -168,7 +169,7 @@
       return FALSE;
     }
 
-  gimp_hue_saturation_config_reset (hs_tool->config);
+  gimp_config_reset (GIMP_CONFIG (hs_tool->config));
 
   GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error);
 
@@ -448,7 +449,7 @@
   GimpHueSaturationTool *hs_tool = GIMP_HUE_SATURATION_TOOL (image_map_tool);
   GimpHueRange           range   = hs_tool->config->range;
 
-  gimp_hue_saturation_config_reset (hs_tool->config);
+  gimp_config_reset (GIMP_CONFIG (hs_tool->config));
   g_object_set (hs_tool->config,
                 "range", range,
                 NULL);
@@ -520,8 +521,7 @@
 hue_saturation_range_reset_callback (GtkWidget             *widget,
                                      GimpHueSaturationTool *hs_tool)
 {
-  gimp_hue_saturation_config_reset_range (hs_tool->config,
-                                          hs_tool->config->range);
+  gimp_hue_saturation_config_reset_range (hs_tool->config);
 
   hue_saturation_update_sliders (hs_tool);
   hue_saturation_update_color_areas (hs_tool);

Modified: trunk/app/tools/gimplevelstool.c
==============================================================================
--- trunk/app/tools/gimplevelstool.c	(original)
+++ trunk/app/tools/gimplevelstool.c	Sun Jan 27 17:39:01 2008
@@ -22,6 +22,7 @@
 #include <gtk/gtk.h>
 
 #include "libgimpmath/gimpmath.h"
+#include "libgimpconfig/gimpconfig.h"
 #include "libgimpwidgets/gimpwidgets.h"
 
 #include "tools-types.h"
@@ -219,11 +220,11 @@
       return FALSE;
     }
 
+  gimp_config_reset (GIMP_CONFIG (l_tool->config));
+
   if (! l_tool->hist)
     l_tool->hist = gimp_histogram_new ();
 
-  gimp_levels_config_reset (l_tool->config);
-
   l_tool->color = gimp_drawable_is_rgb (drawable);
   l_tool->alpha = gimp_drawable_has_alpha (drawable);
 
@@ -681,7 +682,7 @@
   GimpLevelsTool       *tool    = GIMP_LEVELS_TOOL (image_map_tool);
   GimpHistogramChannel  channel = tool->config->channel;
 
-  gimp_levels_config_reset (tool->config);
+  gimp_config_reset (GIMP_CONFIG (tool->config));
   g_object_set (tool->config,
                 "channel", channel,
                 NULL);
@@ -828,7 +829,7 @@
 levels_channel_reset_callback (GtkWidget      *widget,
                                GimpLevelsTool *tool)
 {
-  gimp_levels_config_reset_channel (tool->config, tool->config->channel);
+  gimp_levels_config_reset_channel (tool->config);
   levels_update_adjustments (tool);
 
   gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (tool));

Modified: trunk/app/tools/gimpposterizetool.c
==============================================================================
--- trunk/app/tools/gimpposterizetool.c	(original)
+++ trunk/app/tools/gimpposterizetool.c	Sun Jan 27 17:39:01 2008
@@ -22,6 +22,7 @@
 #include <gtk/gtk.h>
 
 #include "libgimpmath/gimpmath.h"
+#include "libgimpconfig/gimpconfig.h"
 #include "libgimpwidgets/gimpwidgets.h"
 
 #include "tools-types.h"
@@ -154,7 +155,7 @@
       return FALSE;
     }
 
-  gimp_posterize_config_reset (posterize_tool->config);
+  gimp_config_reset (GIMP_CONFIG (posterize_tool->config));
 
   GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error);
 
@@ -235,7 +236,7 @@
 {
   GimpPosterizeTool *posterize_tool = GIMP_POSTERIZE_TOOL (image_map_tool);
 
-  gimp_posterize_config_reset (posterize_tool->config);
+  gimp_config_reset (GIMP_CONFIG (posterize_tool->config));
 
   gtk_adjustment_set_value (posterize_tool->levels_data,
                             posterize_tool->config->levels);

Modified: trunk/app/tools/gimpthresholdtool.c
==============================================================================
--- trunk/app/tools/gimpthresholdtool.c	(original)
+++ trunk/app/tools/gimpthresholdtool.c	Sun Jan 27 17:39:01 2008
@@ -21,6 +21,7 @@
 #include <gegl.h>
 #include <gtk/gtk.h>
 
+#include "libgimpconfig/gimpconfig.h"
 #include "libgimpwidgets/gimpwidgets.h"
 
 #include "tools-types.h"
@@ -161,11 +162,11 @@
       return FALSE;
     }
 
+  gimp_config_reset (GIMP_CONFIG (t_tool->config));
+
   if (! t_tool->hist)
     t_tool->hist = gimp_histogram_new ();
 
-  gimp_threshold_config_reset (t_tool->config);
-
   t_tool->threshold->color = gimp_drawable_is_rgb (drawable);
 
   GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error);
@@ -277,7 +278,7 @@
 {
   GimpThresholdTool *t_tool = GIMP_THRESHOLD_TOOL (image_map_tool);
 
-  gimp_threshold_config_reset (t_tool->config);
+  gimp_config_reset (GIMP_CONFIG (t_tool->config));
 
   gimp_histogram_view_set_range (t_tool->histogram_box->view,
                                  t_tool->config->low  * 255.999,



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