Commit 27f1ccd4 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

app/core/core-types.h have app/gegl know app/core's namespace.

2008-02-01  Michael Natterer  <mitch@gimp.org>

	* app/core/core-types.h
	* app/gegl/gegl-types.h: have app/gegl know app/core's namespace.

	* app/gegl/gimpoperationcurves.h: remove temp hack includes.

	* app/gegl/gimpoperationcurves.c: include "core/gimpcurve.h"

	* app/gegl/gimpbrightnesscontrastconfig.[ch]
	* app/gegl/gimpcolorbalanceconfig.[ch]
	* app/gegl/gimpcolorizeconfig.[ch]
	* app/gegl/gimpcurvesconfig.[ch]
	* app/gegl/gimphuesaturationconfig.[ch]
	* app/gegl/gimplevelsconfig.[ch]
	* app/gegl/gimpoperationcurves.[ch]
	* app/gegl/gimpposterizeconfig.[ch]
	* app/gegl/gimpthresholdconfig.[ch]: derive from GimpViewable, install
	properties using the GimpConfig macros, add implementations of
	GimpConfigInterface::equal() and ::copy() where needed.

	* app/tools/gimpimagemaptool.[ch]: add prototype of a menu of
	recently used settings so the same color correction can easily be
	applied to many images.


svn path=/trunk/; revision=24770
parent a1c5cbdc
2008-02-01 Michael Natterer <mitch@gimp.org>
* app/core/core-types.h
* app/gegl/gegl-types.h: have app/gegl know app/core's namespace.
* app/gegl/gimpoperationcurves.h: remove temp hack includes.
* app/gegl/gimpoperationcurves.c: include "core/gimpcurve.h"
* app/gegl/gimpbrightnesscontrastconfig.[ch]
* app/gegl/gimpcolorbalanceconfig.[ch]
* app/gegl/gimpcolorizeconfig.[ch]
* app/gegl/gimpcurvesconfig.[ch]
* app/gegl/gimphuesaturationconfig.[ch]
* app/gegl/gimplevelsconfig.[ch]
* app/gegl/gimpoperationcurves.[ch]
* app/gegl/gimpposterizeconfig.[ch]
* app/gegl/gimpthresholdconfig.[ch]: derive from GimpViewable, install
properties using the GimpConfig macros, add implementations of
GimpConfigInterface::equal() and ::copy() where needed.
* app/tools/gimpimagemaptool.[ch]: add prototype of a menu of
recently used settings so the same color correction can easily be
applied to many images.
2008-02-01 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpcontainerview.c
......
......@@ -23,7 +23,7 @@
#include "libgimpmodule/gimpmoduletypes.h"
#include "libgimpthumb/gimpthumb-types.h"
#include "gegl/gegl-types.h"
#include "base/base-types.h"
#include "core/core-enums.h"
......@@ -206,6 +206,7 @@ struct _GimpCoords
};
#include "gegl/gegl-types.h"
#include "paint/paint-types.h"
#include "text/text-types.h"
#include "vectors/vectors-types.h"
......
......@@ -22,7 +22,7 @@
#define __GEGL_TYPES_H__
#include "base/base-types.h"
#include "core/core-types.h"
#include "gegl/gegl-types.h"
......
......@@ -50,7 +50,7 @@ static void gimp_brightness_contrast_config_set_property (GObject *object
G_DEFINE_TYPE_WITH_CODE (GimpBrightnessContrastConfig,
gimp_brightness_contrast_config,
G_TYPE_OBJECT,
GIMP_TYPE_VIEWABLE,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG, NULL))
#define parent_class gimp_brightness_contrast_config_parent_class
......@@ -59,26 +59,23 @@ G_DEFINE_TYPE_WITH_CODE (GimpBrightnessContrastConfig,
static void
gimp_brightness_contrast_config_class_init (GimpBrightnessContrastConfigClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->set_property = gimp_brightness_contrast_config_set_property;
object_class->get_property = gimp_brightness_contrast_config_get_property;
g_object_class_install_property (object_class, PROP_BRIGHTNESS,
g_param_spec_double ("brightness",
"Brightness",
"Brightness",
-1.0, 1.0, 0.0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_CONTRAST,
g_param_spec_double ("contrast",
"Contrast",
"Contrast",
-1.0, 1.0, 0.0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
object_class->set_property = gimp_brightness_contrast_config_set_property;
object_class->get_property = gimp_brightness_contrast_config_get_property;
viewable_class->default_stock_id = "gimp-tool-brightness-constrast";
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_BRIGHTNESS,
"brightness",
"Brightness",
-1.0, 1.0, 0.0, 0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CONTRAST,
"contrast",
"Contrast",
-1.0, 1.0, 0.0, 0);
}
static void
......
......@@ -23,6 +23,9 @@
#define __GIMP_BRIGHTNESS_CONTRAST_CONFIG_H__
#include "core/gimpviewable.h"
#define GIMP_TYPE_BRIGHTNESS_CONTRAST_CONFIG (gimp_brightness_contrast_config_get_type ())
#define GIMP_BRIGHTNESS_CONTRAST_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_BRIGHTNESS_CONTRAST_CONFIG, GimpBrightnessContrastConfig))
#define GIMP_BRIGHTNESS_CONTRAST_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_BRIGHTNESS_CONTRAST_CONFIG, GimpBrightnessContrastConfigClass))
......@@ -35,15 +38,15 @@ typedef struct _GimpBrightnessContrastConfigClass GimpBrightnessContrastConfigCl
struct _GimpBrightnessContrastConfig
{
GObject parent_instance;
GimpViewable parent_instance;
gdouble brightness;
gdouble contrast;
gdouble brightness;
gdouble contrast;
};
struct _GimpBrightnessContrastConfigClass
{
GObjectClass parent_class;
GimpViewableClass parent_class;
};
......
......@@ -46,22 +46,27 @@ enum
};
static void gimp_color_balance_config_iface_init (GimpConfigInterface *iface);
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,
GParamSpec *pspec);
static void gimp_color_balance_config_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_color_balance_config_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_color_balance_config_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_color_balance_config_reset (GimpConfig *config);
static gboolean gimp_color_balance_config_equal (GimpConfig *a,
GimpConfig *b);
static void gimp_color_balance_config_reset (GimpConfig *config);
static gboolean gimp_color_balance_config_copy (GimpConfig *src,
GimpConfig *dest,
GParamFlags flags);
G_DEFINE_TYPE_WITH_CODE (GimpColorBalanceConfig, gimp_color_balance_config,
G_TYPE_OBJECT,
GIMP_TYPE_VIEWABLE,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
gimp_color_balance_config_iface_init))
......@@ -71,57 +76,47 @@ G_DEFINE_TYPE_WITH_CODE (GimpColorBalanceConfig, gimp_color_balance_config,
static void
gimp_color_balance_config_class_init (GimpColorBalanceConfigClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->set_property = gimp_color_balance_config_set_property;
object_class->get_property = gimp_color_balance_config_get_property;
g_object_class_install_property (object_class, PROP_RANGE,
g_param_spec_enum ("range",
"range",
"The affected range",
GIMP_TYPE_TRANSFER_MODE,
GIMP_MIDTONES,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_CYAN_RED,
g_param_spec_double ("cyan-red",
"Cyan-Red",
"Cyan-Red",
-1.0, 1.0, 0.0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_MAGENTA_GREEN,
g_param_spec_double ("magenta-green",
"Magenta-Green",
"Magenta-Green",
-1.0, 1.0, 0.0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_YELLOW_BLUE,
g_param_spec_double ("yellow-blue",
"Yellow-Blue",
"Yellow-Blue",
-1.0, 1.0, 0.0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_PRESERVE_LUMINOSITY,
g_param_spec_boolean ("preserve-luminosity",
"Preserve Luminosity",
"Preserve Luminosity",
TRUE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
object_class->set_property = gimp_color_balance_config_set_property;
object_class->get_property = gimp_color_balance_config_get_property;
viewable_class->default_stock_id = "gimp-tool-color-balance";
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_RANGE,
"range",
"The affected range",
GIMP_TYPE_TRANSFER_MODE,
GIMP_MIDTONES, 0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CYAN_RED,
"cyan-red",
"Cyan-Red",
-1.0, 1.0, 0.0, 0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MAGENTA_GREEN,
"magenta-green",
"Magenta-Green",
-1.0, 1.0, 0.0, 0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_YELLOW_BLUE,
"yellow-blue",
"Yellow-Blue",
-1.0, 1.0, 0.0, 0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_PRESERVE_LUMINOSITY,
"preserve-luminosity",
"Preserve Luminosity",
TRUE, 0);
}
static void
gimp_color_balance_config_iface_init (GimpConfigInterface *iface)
{
iface->equal = gimp_color_balance_config_equal;
iface->reset = gimp_color_balance_config_reset;
iface->copy = gimp_color_balance_config_copy;
}
static void
......@@ -205,14 +200,36 @@ gimp_color_balance_config_set_property (GObject *object,
}
}
static gboolean
gimp_color_balance_config_equal (GimpConfig *a,
GimpConfig *b)
{
GimpColorBalanceConfig *a_config = GIMP_COLOR_BALANCE_CONFIG (a);
GimpColorBalanceConfig *b_config = GIMP_COLOR_BALANCE_CONFIG (b);
GimpTransferMode range;
for (range = GIMP_SHADOWS; range <= GIMP_HIGHLIGHTS; range++)
{
if (a_config->cyan_red[range] != b_config->cyan_red[range] ||
a_config->magenta_green[range] != b_config->magenta_green[range] ||
a_config->yellow_blue[range] != b_config->yellow_blue[range])
return FALSE;
}
/* don't compare "range" */
if (a_config->preserve_luminosity != b_config->preserve_luminosity)
return FALSE;
return TRUE;
}
static void
gimp_color_balance_config_reset (GimpConfig *config)
{
GimpColorBalanceConfig *cb_config = GIMP_COLOR_BALANCE_CONFIG (config);
GimpTransferMode range;
g_object_freeze_notify (G_OBJECT (config));
for (range = GIMP_SHADOWS; range <= GIMP_HIGHLIGHTS; range++)
{
cb_config->range = range;
......@@ -221,8 +238,35 @@ gimp_color_balance_config_reset (GimpConfig *config)
gimp_config_reset_property (G_OBJECT (config), "range");
gimp_config_reset_property (G_OBJECT (config), "preserve-luminosity");
}
g_object_thaw_notify (G_OBJECT (config));
static gboolean
gimp_color_balance_config_copy (GimpConfig *src,
GimpConfig *dest,
GParamFlags flags)
{
GimpColorBalanceConfig *src_config = GIMP_COLOR_BALANCE_CONFIG (src);
GimpColorBalanceConfig *dest_config = GIMP_COLOR_BALANCE_CONFIG (dest);
GimpTransferMode range;
for (range = GIMP_SHADOWS; range <= GIMP_HIGHLIGHTS; range++)
{
dest_config->cyan_red[range] = src_config->cyan_red[range];
dest_config->magenta_green[range] = src_config->magenta_green[range];
dest_config->yellow_blue[range] = src_config->yellow_blue[range];
}
g_object_notify (G_OBJECT (dest), "cyan-red");
g_object_notify (G_OBJECT (dest), "magenta-green");
g_object_notify (G_OBJECT (dest), "yellow-blue");
dest_config->range = src_config->range;
dest_config->preserve_luminosity = src_config->preserve_luminosity;
g_object_notify (G_OBJECT (dest), "range");
g_object_notify (G_OBJECT (dest), "preserve-luminosity");
return TRUE;
}
......
......@@ -23,6 +23,9 @@
#define __GIMP_COLOR_BALANCE_CONFIG_H__
#include "core/gimpviewable.h"
#define GIMP_TYPE_COLOR_BALANCE_CONFIG (gimp_color_balance_config_get_type ())
#define GIMP_COLOR_BALANCE_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_COLOR_BALANCE_CONFIG, GimpColorBalanceConfig))
#define GIMP_COLOR_BALANCE_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_COLOR_BALANCE_CONFIG, GimpColorBalanceConfigClass))
......@@ -35,7 +38,7 @@ typedef struct _GimpColorBalanceConfigClass GimpColorBalanceConfigClass;
struct _GimpColorBalanceConfig
{
GObject parent_instance;
GimpViewable parent_instance;
GimpTransferMode range;
......@@ -48,7 +51,7 @@ struct _GimpColorBalanceConfig
struct _GimpColorBalanceConfigClass
{
GObjectClass parent_class;
GimpViewableClass parent_class;
};
......
......@@ -53,7 +53,7 @@ static void gimp_colorize_config_set_property (GObject *object,
G_DEFINE_TYPE_WITH_CODE (GimpColorizeConfig, gimp_colorize_config,
G_TYPE_OBJECT,
GIMP_TYPE_VIEWABLE,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG, NULL))
#define parent_class gimp_colorize_config_parent_class
......@@ -62,34 +62,28 @@ G_DEFINE_TYPE_WITH_CODE (GimpColorizeConfig, gimp_colorize_config,
static void
gimp_colorize_config_class_init (GimpColorizeConfigClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->set_property = gimp_colorize_config_set_property;
object_class->get_property = gimp_colorize_config_get_property;
g_object_class_install_property (object_class, PROP_HUE,
g_param_spec_double ("hue",
"Hue",
"Hue",
0.0, 1.0, 0.5,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_SATURATION,
g_param_spec_double ("saturation",
"Saturation",
"Saturation",
0.0, 1.0, 0.5,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_LIGHTNESS,
g_param_spec_double ("lightness",
"Lightness",
"Lightness",
-1.0, 1.0, 0.0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
object_class->set_property = gimp_colorize_config_set_property;
object_class->get_property = gimp_colorize_config_get_property;
viewable_class->default_stock_id = "gimp-tool-colorize";
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_HUE,
"hue",
"Hue",
0.0, 1.0, 0.5, 0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_SATURATION,
"saturation",
"Saturation",
0.0, 1.0, 0.5, 0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_LIGHTNESS,
"lightness",
"Lightness",
-1.0, 1.0, 0.0, 0);
}
static void
......
......@@ -23,6 +23,9 @@
#define __GIMP_COLORIZE_CONFIG_H__
#include "core/gimpviewable.h"
#define GIMP_TYPE_COLORIZE_CONFIG (gimp_colorize_config_get_type ())
#define GIMP_COLORIZE_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_COLORIZE_CONFIG, GimpColorizeConfig))
#define GIMP_COLORIZE_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_COLORIZE_CONFIG, GimpColorizeConfigClass))
......@@ -35,16 +38,16 @@ typedef struct _GimpColorizeConfigClass GimpColorizeConfigClass;
struct _GimpColorizeConfig
{
GObject parent_instance;
GimpViewable parent_instance;
gdouble hue;
gdouble saturation;
gdouble lightness;
gdouble hue;
gdouble saturation;
gdouble lightness;
};
struct _GimpColorizeConfigClass
{
GObjectClass parent_class;
GimpViewableClass parent_class;
};
......
......@@ -37,6 +37,8 @@
/* temp cruft */
#include "base/curves.h"
#include "core/gimpcurve.h"
#include "gimpcurvesconfig.h"
#include "gimp-intl.h"
......@@ -50,26 +52,31 @@ enum
};
static void gimp_curves_config_iface_init (GimpConfigInterface *iface);
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,
GValue *value,
GParamSpec *pspec);
static void gimp_curves_config_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_curves_config_finalize (GObject *object);
static void gimp_curves_config_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_curves_config_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_curves_config_reset (GimpConfig *config);
static gboolean gimp_curves_config_equal (GimpConfig *a,
GimpConfig *b);
static void gimp_curves_config_reset (GimpConfig *config);
static gboolean gimp_curves_config_copy (GimpConfig *src,
GimpConfig *dest,
GParamFlags flags);
static void gimp_curves_config_curve_dirty (GimpCurve *curve,
GimpCurvesConfig *config);
static void gimp_curves_config_curve_dirty (GimpCurve *curve,
GimpCurvesConfig *config);
G_DEFINE_TYPE_WITH_CODE (GimpCurvesConfig, gimp_curves_config,
G_TYPE_OBJECT,
GIMP_TYPE_VIEWABLE,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
gimp_curves_config_iface_init))
......@@ -79,33 +86,34 @@ G_DEFINE_TYPE_WITH_CODE (GimpCurvesConfig, gimp_curves_config,
static void
gimp_curves_config_class_init (GimpCurvesConfigClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = gimp_curves_config_finalize;
object_class->set_property = gimp_curves_config_set_property;
object_class->get_property = gimp_curves_config_get_property;
g_object_class_install_property (object_class, PROP_CHANNEL,
g_param_spec_enum ("channel",
"Channel",
"The affected channel",
GIMP_TYPE_HISTOGRAM_CHANNEL,
GIMP_HISTOGRAM_VALUE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_CURVE,
g_param_spec_object ("curve",
"Curve",
"Curve",
GIMP_TYPE_CURVE,
G_PARAM_READWRITE));
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
object_class->finalize = gimp_curves_config_finalize;
object_class->set_property = gimp_curves_config_set_property;
object_class->get_property = gimp_curves_config_get_property;
viewable_class->default_stock_id = "gimp-tool-curves";
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_CHANNEL,
"channel",
"The affected channel",
GIMP_TYPE_HISTOGRAM_CHANNEL,
GIMP_HISTOGRAM_VALUE, 0);
GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_CURVE,
"curve",
"Curve",
GIMP_TYPE_CURVE,
GIMP_CONFIG_PARAM_AGGREGATE);
}
static void
gimp_curves_config_iface_init (GimpConfigInterface *iface)
{
iface->equal = gimp_curves_config_equal;
iface->reset = gimp_curves_config_reset;
iface->copy = gimp_curves_config_copy;
}
static void
......@@ -137,11 +145,8 @@ gimp_curves_config_finalize (GObject *object)
channel <= GIMP_HISTOGRAM_ALPHA;
channel++)
{
if (self->curve[channel])
{
g_object_unref (self->curve[channel]);
self->curve[channel] = NULL;
}
g_object_unref (self->curve[channel]);
self->curve[channel] = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
......@@ -187,9 +192,20 @@ gimp_curves_config_set_property (GObject *object,
break;
case PROP_CURVE:
if (self->curve[self->channel])
g_object_unref (self->curve[self->channel]);
self->curve[self->channel] = g_value_dup_object (value);
{
GimpCurve *src_curve = g_value_get_object (value);
GimpCurve *dest_curve = self->curve[self->channel];
if (src_curve && dest_curve)
{
gimp_config_sync (G_OBJECT (src_curve), G_OBJECT (dest_curve), 0);
memcpy (dest_curve->points, src_curve->points,
sizeof (src_curve->points));
memcpy (dest_curve->curve, src_curve->curve,
sizeof (src_curve->curve));