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
This commit is contained in:
Michael Natterer 2008-02-01 12:45:32 +00:00 committed by Michael Natterer
parent a1c5cbdcca
commit 27f1ccd4bd
22 changed files with 719 additions and 331 deletions

View File

@ -1,3 +1,28 @@
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

View File

@ -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"

View File

@ -22,7 +22,7 @@
#define __GEGL_TYPES_H__
#include "base/base-types.h"
#include "core/core-types.h"
#include "gegl/gegl-types.h"

View File

@ -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);
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;
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));
viewable_class->default_stock_id = "gimp-tool-brightness-constrast";
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));
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

View File

@ -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;
};

View File

@ -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);
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;
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));
viewable_class->default_stock_id = "gimp-tool-color-balance";
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));
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_RANGE,
"range",
"The affected range",
GIMP_TYPE_TRANSFER_MODE,
GIMP_MIDTONES, 0);
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));
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CYAN_RED,
"cyan-red",
"Cyan-Red",
-1.0, 1.0, 0.0, 0);
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));
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MAGENTA_GREEN,
"magenta-green",
"Magenta-Green",
-1.0, 1.0, 0.0, 0);
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));
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;
}

View File

@ -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;
};

View File

@ -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);
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;
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));
viewable_class->default_stock_id = "gimp-tool-colorize";
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));
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_HUE,
"hue",
"Hue",
0.0, 1.0, 0.5, 0);
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));
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

View File

@ -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;
};

View File

@ -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);
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;
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));
viewable_class->default_stock_id = "gimp-tool-curves";
g_object_class_install_property (object_class, PROP_CURVE,
g_param_spec_object ("curve",
"Curve",
"Curve",
GIMP_TYPE_CURVE,
G_PARAM_READWRITE));
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));
}
}
break;
default:
@ -198,14 +214,49 @@ gimp_curves_config_set_property (GObject *object,
}
}
static gboolean
gimp_curves_config_equal (GimpConfig *a,
GimpConfig *b)
{
GimpCurvesConfig *a_config = GIMP_CURVES_CONFIG (a);
GimpCurvesConfig *b_config = GIMP_CURVES_CONFIG (b);
GimpHistogramChannel channel;
for (channel = GIMP_HISTOGRAM_VALUE;
channel <= GIMP_HISTOGRAM_ALPHA;
channel++)
{
GimpCurve *a_curve = a_config->curve[channel];
GimpCurve *b_curve = b_config->curve[channel];
if (a_curve && b_curve)
{
if (a_curve->curve_type != b_curve->curve_type)
return FALSE;
if (memcmp (a_curve->points, b_curve->points,
sizeof (b_curve->points)) ||
memcmp (a_curve->curve, b_curve->curve,
sizeof (b_curve->curve)))
return FALSE;
}
else if (a_curve || b_curve)
{
return FALSE;
}
}
/* don't compare "channel" */
return TRUE;
}
static void
gimp_curves_config_reset (GimpConfig *config)
{
GimpCurvesConfig *c_config = GIMP_CURVES_CONFIG (config);
GimpHistogramChannel channel;
g_object_freeze_notify (G_OBJECT (config));
for (channel = GIMP_HISTOGRAM_VALUE;
channel <= GIMP_HISTOGRAM_ALPHA;
channel++)
@ -215,8 +266,42 @@ gimp_curves_config_reset (GimpConfig *config)
}
gimp_config_reset_property (G_OBJECT (config), "channel");
}
g_object_thaw_notify (G_OBJECT (config));
static gboolean
gimp_curves_config_copy (GimpConfig *src,
GimpConfig *dest,
GParamFlags flags)
{
GimpCurvesConfig *src_config = GIMP_CURVES_CONFIG (src);
GimpCurvesConfig *dest_config = GIMP_CURVES_CONFIG (dest);
GimpHistogramChannel channel;
for (channel = GIMP_HISTOGRAM_VALUE;
channel <= GIMP_HISTOGRAM_ALPHA;
channel++)
{
GimpCurve *src_curve = src_config->curve[channel];
GimpCurve *dest_curve = dest_config->curve[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));
}
}
g_object_notify (G_OBJECT (dest), "curve");
dest_config->channel = src_config->channel;
g_object_notify (G_OBJECT (dest), "channel");
return TRUE;
}
static void

View File

@ -23,9 +23,7 @@
#define __GIMP_CURVES_CONFIG_H__
#include <gdk-pixbuf/gdk-pixbuf.h> /* eek */
#include "core/core-types.h" /* eek */
#include "core/gimpcurve.h" /* eek */
#include "core/gimpviewable.h"
#define GIMP_TYPE_CURVES_CONFIG (gimp_curves_config_get_type ())
@ -40,7 +38,7 @@ typedef struct _GimpCurvesConfigClass GimpCurvesConfigClass;
struct _GimpCurvesConfig
{
GObject parent_instance;
GimpViewable parent_instance;
GimpHistogramChannel channel;
@ -49,7 +47,7 @@ struct _GimpCurvesConfig
struct _GimpCurvesConfigClass
{
GObjectClass parent_class;
GimpViewableClass parent_class;
};

View File

@ -44,22 +44,27 @@ enum
};
static void gimp_hue_saturation_config_iface_init (GimpConfigInterface *iface);
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,
GParamSpec *pspec);
static void gimp_hue_saturation_config_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_hue_saturation_config_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_hue_saturation_config_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_hue_saturation_config_reset (GimpConfig *config);
static gboolean gimp_hue_saturation_config_equal (GimpConfig *a,
GimpConfig *b);
static void gimp_hue_saturation_config_reset (GimpConfig *config);
static gboolean gimp_hue_saturation_config_copy (GimpConfig *src,
GimpConfig *dest,
GParamFlags flags);
G_DEFINE_TYPE_WITH_CODE (GimpHueSaturationConfig, gimp_hue_saturation_config,
G_TYPE_OBJECT,
GIMP_TYPE_VIEWABLE,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
gimp_hue_saturation_config_iface_init))
@ -69,57 +74,47 @@ G_DEFINE_TYPE_WITH_CODE (GimpHueSaturationConfig, gimp_hue_saturation_config,
static void
gimp_hue_saturation_config_class_init (GimpHueSaturationConfigClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
object_class->set_property = gimp_hue_saturation_config_set_property;
object_class->get_property = gimp_hue_saturation_config_get_property;
object_class->set_property = gimp_hue_saturation_config_set_property;
object_class->get_property = gimp_hue_saturation_config_get_property;
g_object_class_install_property (object_class, PROP_RANGE,
g_param_spec_enum ("range",
"range",
"The affected range",
GIMP_TYPE_HUE_RANGE,
GIMP_ALL_HUES,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
viewable_class->default_stock_id = "gimp-tool-hue-saturation";
g_object_class_install_property (object_class, PROP_HUE,
g_param_spec_double ("hue",
"Hue",
"Hue",
-1.0, 1.0, 0.0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_RANGE,
"range",
"The affected range",
GIMP_TYPE_HUE_RANGE,
GIMP_ALL_HUES, 0);
g_object_class_install_property (object_class, PROP_SATURATION,
g_param_spec_double ("saturation",
"Saturation",
"Saturation",
-1.0, 1.0, 0.0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_HUE,
"hue",
"Hue",
-1.0, 1.0, 0.0, 0);
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));
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_SATURATION,
"saturation",
"Saturation",
-1.0, 1.0, 0.0, 0);
g_object_class_install_property (object_class, PROP_OVERLAP,
g_param_spec_double ("overlap",
"Overlap",
"Overlap",
0.0, 1.0, 0.0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_LIGHTNESS,
"lightness",
"Lightness",
-1.0, 1.0, 0.0, 0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_OVERLAP,
"overlap",
"Overlap",
0.0, 1.0, 0.0, 0);
}
static void
gimp_hue_saturation_config_iface_init (GimpConfigInterface *iface)
{
iface->equal = gimp_hue_saturation_config_equal;
iface->reset = gimp_hue_saturation_config_reset;
iface->copy = gimp_hue_saturation_config_copy;
}
static void
@ -203,14 +198,36 @@ gimp_hue_saturation_config_set_property (GObject *object,
}
}
static gboolean
gimp_hue_saturation_config_equal (GimpConfig *a,
GimpConfig *b)
{
GimpHueSaturationConfig *a_config = GIMP_HUE_SATURATION_CONFIG (a);
GimpHueSaturationConfig *b_config = GIMP_HUE_SATURATION_CONFIG (b);
GimpHueRange range;
for (range = GIMP_ALL_HUES; range <= GIMP_MAGENTA_HUES; range++)
{
if (a_config->hue[range] != b_config->hue[range] ||
a_config->saturation[range] != b_config->saturation[range] ||
a_config->lightness[range] != b_config->lightness[range])
return FALSE;
}
/* don't compare "range" */
if (a_config->overlap != b_config->overlap)
return FALSE;
return TRUE;
}
static void
gimp_hue_saturation_config_reset (GimpConfig *config)
{
GimpHueSaturationConfig *hs_config = GIMP_HUE_SATURATION_CONFIG (config);
GimpHueRange range;
g_object_freeze_notify (G_OBJECT (config));
for (range = GIMP_ALL_HUES; range <= GIMP_MAGENTA_HUES; range++)
{
hs_config->range = range;
@ -219,8 +236,35 @@ gimp_hue_saturation_config_reset (GimpConfig *config)
gimp_config_reset_property (G_OBJECT (config), "range");
gimp_config_reset_property (G_OBJECT (config), "overlap");
}
g_object_thaw_notify (G_OBJECT (config));
static gboolean
gimp_hue_saturation_config_copy (GimpConfig *src,
GimpConfig *dest,
GParamFlags flags)
{
GimpHueSaturationConfig *src_config = GIMP_HUE_SATURATION_CONFIG (src);
GimpHueSaturationConfig *dest_config = GIMP_HUE_SATURATION_CONFIG (dest);
GimpHueRange range;
for (range = GIMP_ALL_HUES; range <= GIMP_MAGENTA_HUES; range++)
{
dest_config->hue[range] = src_config->hue[range];
dest_config->saturation[range] = src_config->saturation[range];
dest_config->lightness[range] = src_config->lightness[range];
}
g_object_notify (G_OBJECT (dest), "hue");
g_object_notify (G_OBJECT (dest), "saturation");
g_object_notify (G_OBJECT (dest), "lightness");
dest_config->range = src_config->range;
dest_config->overlap = src_config->overlap;
g_object_notify (G_OBJECT (dest), "range");
g_object_notify (G_OBJECT (dest), "overlap");
return TRUE;
}

View File

@ -23,6 +23,9 @@
#define __GIMP_HUE_SATURATION_CONFIG_H__
#include "core/gimpviewable.h"
#define GIMP_TYPE_HUE_SATURATION_CONFIG (gimp_hue_saturation_config_get_type ())
#define GIMP_HUE_SATURATION_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_HUE_SATURATION_CONFIG, GimpHueSaturationConfig))
#define GIMP_HUE_SATURATION_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_HUE_SATURATION_CONFIG, GimpHueSaturationConfigClass))
@ -35,7 +38,7 @@ typedef struct _GimpHueSaturationConfigClass GimpHueSaturationConfigClass;
struct _GimpHueSaturationConfig
{
GObject parent_instance;
GimpViewable parent_instance;
GimpHueRange range;
@ -48,7 +51,7 @@ struct _GimpHueSaturationConfig
struct _GimpHueSaturationConfigClass
{
GObjectClass parent_class;
GimpViewableClass parent_class;
};

View File

@ -55,22 +55,27 @@ enum
};
static void gimp_levels_config_iface_init (GimpConfigInterface *iface);
static void gimp_levels_config_iface_init (GimpConfigInterface *iface);
static void gimp_levels_config_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_levels_config_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_levels_config_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_levels_config_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_levels_config_reset (GimpConfig *config);
static gboolean gimp_levels_config_equal (GimpConfig *a,
GimpConfig *b);
static void gimp_levels_config_reset (GimpConfig *config);
static gboolean gimp_levels_config_copy (GimpConfig *src,
GimpConfig *dest,
GParamFlags flags);
G_DEFINE_TYPE_WITH_CODE (GimpLevelsConfig, gimp_levels_config,
G_TYPE_OBJECT,
GIMP_TYPE_VIEWABLE,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
gimp_levels_config_iface_init))
@ -80,65 +85,52 @@ G_DEFINE_TYPE_WITH_CODE (GimpLevelsConfig, gimp_levels_config,
static void
gimp_levels_config_class_init (GimpLevelsConfigClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
object_class->set_property = gimp_levels_config_set_property;
object_class->get_property = gimp_levels_config_get_property;
object_class->set_property = gimp_levels_config_set_property;
object_class->get_property = gimp_levels_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));
viewable_class->default_stock_id = "gimp-tool-levels";
g_object_class_install_property (object_class, PROP_GAMMA,
g_param_spec_double ("gamma",
"Gamma",
"Gamma",
0.1, 10.0, 1.0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_CHANNEL,
"channel",
"The affected channel",
GIMP_TYPE_HISTOGRAM_CHANNEL,
GIMP_HISTOGRAM_VALUE, 0);
g_object_class_install_property (object_class, PROP_LOW_INPUT,
g_param_spec_double ("low-input",
"Low Input",
"Low Input",
0.0, 1.0, 0.0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_GAMMA,
"gamma",
"Gamma",
0.1, 10.0, 1.0, 0);
g_object_class_install_property (object_class, PROP_HIGH_INPUT,
g_param_spec_double ("high-input",
"High Input",
"High Input",
0.0, 1.0, 1.0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_LOW_INPUT,
"low-input",
"Low Input",
0.0, 1.0, 0.0, 0);
g_object_class_install_property (object_class, PROP_LOW_OUTPUT,
g_param_spec_double ("low-output",
"Low Output",
"Low Output",
0.0, 1.0, 0.0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_HIGH_INPUT,
"high-input",
"High Input",
0.0, 1.0, 1.0, 0);
g_object_class_install_property (object_class, PROP_HIGH_OUTPUT,
g_param_spec_double ("high-output",
"High Output",
"High Output",
0.0, 1.0, 1.0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_LOW_OUTPUT,
"low-output",
"Low Output",
0.0, 1.0, 0.0, 0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_HIGH_OUTPUT,
"high-output",
"High Output",
0.0, 1.0, 1.0, 0);
}
static void
gimp_levels_config_iface_init (GimpConfigInterface *iface)
{
iface->equal = gimp_levels_config_equal;
iface->reset = gimp_levels_config_reset;
iface->copy = gimp_levels_config_copy;
}
static void
@ -232,14 +224,37 @@ gimp_levels_config_set_property (GObject *object,
}
}
static gboolean
gimp_levels_config_equal (GimpConfig *a,
GimpConfig *b)
{
GimpLevelsConfig *a_config = GIMP_LEVELS_CONFIG (a);
GimpLevelsConfig *b_config = GIMP_LEVELS_CONFIG (b);
GimpHistogramChannel channel;
for (channel = GIMP_HISTOGRAM_VALUE;
channel <= GIMP_HISTOGRAM_ALPHA;
channel++)
{
if (a_config->gamma[channel] != b_config->gamma[channel] ||
a_config->low_input[channel] != b_config->low_input[channel] ||
a_config->high_input[channel] != b_config->high_input[channel] ||
a_config->low_output[channel] != b_config->low_output[channel] ||
a_config->high_output[channel] != b_config->high_output[channel])
return FALSE;
}
/* don't compare "channel" */
return TRUE;
}
static void
gimp_levels_config_reset (GimpConfig *config)
{
GimpLevelsConfig *l_config = GIMP_LEVELS_CONFIG (config);
GimpHistogramChannel channel;
g_object_freeze_notify (G_OBJECT (config));
for (channel = GIMP_HISTOGRAM_VALUE;
channel <= GIMP_HISTOGRAM_ALPHA;
channel++)
@ -249,8 +264,39 @@ gimp_levels_config_reset (GimpConfig *config)
}
gimp_config_reset_property (G_OBJECT (config), "channel");
}
g_object_thaw_notify (G_OBJECT (config));
static gboolean
gimp_levels_config_copy (GimpConfig *src,
GimpConfig *dest,
GParamFlags flags)
{
GimpLevelsConfig *src_config = GIMP_LEVELS_CONFIG (src);
GimpLevelsConfig *dest_config = GIMP_LEVELS_CONFIG (dest);
GimpHistogramChannel channel;
for (channel = GIMP_HISTOGRAM_VALUE;
channel <= GIMP_HISTOGRAM_ALPHA;
channel++)
{
dest_config->gamma[channel] = src_config->gamma[channel];
dest_config->low_input[channel] = src_config->low_input[channel];
dest_config->high_input[channel] = src_config->high_input[channel];
dest_config->low_output[channel] = src_config->low_output[channel];
dest_config->high_output[channel] = src_config->high_output[channel];
}
g_object_notify (G_OBJECT (dest), "gamma");
g_object_notify (G_OBJECT (dest), "low-input");
g_object_notify (G_OBJECT (dest), "high-input");
g_object_notify (G_OBJECT (dest), "low-output");
g_object_notify (G_OBJECT (dest), "high-output");
dest_config->channel = src_config->channel;
g_object_notify (G_OBJECT (dest), "channel");
return TRUE;
}

View File

@ -23,6 +23,9 @@
#define __GIMP_LEVELS_CONFIG_H__
#include "core/gimpviewable.h"
#define GIMP_TYPE_LEVELS_CONFIG (gimp_levels_config_get_type ())
#define GIMP_LEVELS_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_LEVELS_CONFIG, GimpLevelsConfig))
#define GIMP_LEVELS_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_LEVELS_CONFIG, GimpLevelsConfigClass))
@ -35,7 +38,7 @@ typedef struct _GimpLevelsConfigClass GimpLevelsConfigClass;
struct _GimpLevelsConfig
{
GObject parent_instance;
GimpViewable parent_instance;
GimpHistogramChannel channel;
@ -50,7 +53,7 @@ struct _GimpLevelsConfig
struct _GimpLevelsConfigClass
{
GObjectClass parent_class;
GimpViewableClass parent_class;
};

View File

@ -28,6 +28,8 @@
#include "gegl-types.h"
#include "core/gimpcurve.h"
#include "gimpcurvesconfig.h"
#include "gimpoperationcurves.h"

View File

@ -48,7 +48,7 @@ static void gimp_posterize_config_set_property (GObject *object,
G_DEFINE_TYPE_WITH_CODE (GimpPosterizeConfig, gimp_posterize_config,
G_TYPE_OBJECT,
GIMP_TYPE_VIEWABLE,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG, NULL))
#define parent_class gimp_posterize_config_parent_class
@ -57,18 +57,18 @@ G_DEFINE_TYPE_WITH_CODE (GimpPosterizeConfig, gimp_posterize_config,
static void
gimp_posterize_config_class_init (GimpPosterizeConfigClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
object_class->set_property = gimp_posterize_config_set_property;
object_class->get_property = gimp_posterize_config_get_property;
object_class->set_property = gimp_posterize_config_set_property;
object_class->get_property = gimp_posterize_config_get_property;
g_object_class_install_property (object_class, PROP_LEVELS,
g_param_spec_int ("levels",
"Levels",
"Posterize levels",
2, 256, 3,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
viewable_class->default_stock_id = "gimp-tool-posterize";
GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_LEVELS,
"levels",
"Posterize levels",
2, 256, 3, 0);
}
static void

View File

@ -23,6 +23,9 @@
#define __GIMP_POSTERIZE_CONFIG_H__
#include "core/gimpviewable.h"
#define GIMP_TYPE_POSTERIZE_CONFIG (gimp_posterize_config_get_type ())
#define GIMP_POSTERIZE_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_POSTERIZE_CONFIG, GimpPosterizeConfig))
#define GIMP_POSTERIZE_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_POSTERIZE_CONFIG, GimpPosterizeConfigClass))
@ -35,14 +38,14 @@ typedef struct _GimpPosterizeConfigClass GimpPosterizeConfigClass;
struct _GimpPosterizeConfig
{
GObject parent_instance;
GimpViewable parent_instance;
gint levels;
gint levels;
};
struct _GimpPosterizeConfigClass
{
GObjectClass parent_class;
GimpViewableClass parent_class;
};

View File

@ -52,7 +52,7 @@ static void gimp_threshold_config_set_property (GObject *object,
G_DEFINE_TYPE_WITH_CODE (GimpThresholdConfig, gimp_threshold_config,
G_TYPE_OBJECT,
GIMP_TYPE_VIEWABLE,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG, NULL))
#define parent_class gimp_threshold_config_parent_class
@ -61,26 +61,23 @@ G_DEFINE_TYPE_WITH_CODE (GimpThresholdConfig, gimp_threshold_config,
static void
gimp_threshold_config_class_init (GimpThresholdConfigClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
object_class->set_property = gimp_threshold_config_set_property;
object_class->get_property = gimp_threshold_config_get_property;
object_class->set_property = gimp_threshold_config_set_property;
object_class->get_property = gimp_threshold_config_get_property;
g_object_class_install_property (object_class, PROP_LOW,
g_param_spec_double ("low",
"Low",
"Low threshold",
0.0, 1.0, 0.5,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
viewable_class->default_stock_id = "gimp-tool-threshold";
g_object_class_install_property (object_class, PROP_HIGH,
g_param_spec_double ("high",
"High",
"High threshold",
0.0, 1.0, 1.0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_LOW,
"low",
"Low threshold",
0.0, 1.0, 0.5, 0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_HIGH,
"high",
"High threshold",
0.0, 1.0, 1.0, 0);
}
static void

View File

@ -23,6 +23,9 @@
#define __GIMP_THRESHOLD_CONFIG_H__
#include "core/gimpviewable.h"
#define GIMP_TYPE_THRESHOLD_CONFIG (gimp_threshold_config_get_type ())
#define GIMP_THRESHOLD_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_THRESHOLD_CONFIG, GimpThresholdConfig))
#define GIMP_THRESHOLD_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_THRESHOLD_CONFIG, GimpThresholdConfigClass))
@ -35,15 +38,15 @@ typedef struct _GimpThresholdConfigClass GimpThresholdConfigClass;
struct _GimpThresholdConfig
{
GObject parent_instance;
GimpViewable parent_instance;
gdouble low;
gdouble high;
gdouble low;
gdouble high;
};
struct _GimpThresholdConfigClass
{
GObjectClass parent_class;
GimpViewableClass parent_class;
};

View File

@ -36,10 +36,13 @@
#include "core/gimpimage.h"
#include "core/gimpimage-pick-color.h"
#include "core/gimpimagemap.h"
#include "core/gimplist.h"
#include "core/gimppickable.h"
#include "core/gimpprojection.h"
#include "core/gimptoolinfo.h"
#include "widgets/gimpcontainercombobox.h"
#include "widgets/gimpcontainerview.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimptooldialog.h"
#include "widgets/gimpwidgets-utils.h"
@ -57,6 +60,11 @@
/* local function prototypes */
static void gimp_image_map_tool_class_init (GimpImageMapToolClass *klass);
static void gimp_image_map_tool_base_init (GimpImageMapToolClass *klass);
static void gimp_image_map_tool_init (GimpImageMapTool *im_tool);
static GObject * gimp_image_map_tool_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
@ -91,31 +99,63 @@ static void gimp_image_map_tool_response (GtkWidget *widget,
gint response_id,
GimpImageMapTool *im_tool);
static void gimp_image_map_tool_load_clicked (GtkWidget *widget,
GimpImageMapTool *tool);
static void gimp_image_map_tool_load_ext_clicked (GtkWidget *widget,
GdkModifierType state,
GimpImageMapTool *tool);
static void gimp_image_map_tool_save_clicked (GtkWidget *widget,
GimpImageMapTool *tool);
static void gimp_image_map_tool_save_ext_clicked (GtkWidget *widget,
GdkModifierType state,
GimpImageMapTool *tool);
static void gimp_image_map_tool_recent_selected (GimpContainerView *view,
GimpViewable *object,
gpointer insert_data,
GimpImageMapTool *tool);
static void gimp_image_map_tool_settings_dialog (GimpImageMapTool *im_tool,
const gchar *title,
gboolean save);
static void gimp_image_map_tool_notify_preview (GObject *config,
GParamSpec *pspec,
GimpImageMapTool *im_tool);
static void gimp_image_map_tool_gegl_notify (GObject *config,
const GParamSpec *pspec,
GimpImageMapTool *im_tool);
static void gimp_image_map_tool_load_clicked (GtkWidget *widget,
GimpImageMapTool *tool);
static void gimp_image_map_tool_load_ext_clicked (GtkWidget *widget,
GdkModifierType state,
GimpImageMapTool *tool);
static void gimp_image_map_tool_save_clicked (GtkWidget *widget,
GimpImageMapTool *tool);
static void gimp_image_map_tool_save_ext_clicked (GtkWidget *widget,
GdkModifierType state,
GimpImageMapTool *tool);
static void gimp_image_map_tool_settings_dialog (GimpImageMapTool *im_tool,
const gchar *title,
gboolean save);
static void gimp_image_map_tool_notify_preview (GObject *config,
GParamSpec *pspec,
GimpImageMapTool *im_tool);
static void gimp_image_map_tool_gegl_notify (GObject *config,
const GParamSpec *pspec,
GimpImageMapTool *im_tool);
G_DEFINE_TYPE (GimpImageMapTool, gimp_image_map_tool, GIMP_TYPE_COLOR_TOOL)
static GimpColorToolClass *parent_class = NULL;
#define parent_class gimp_image_map_tool_parent_class
GType
gimp_image_map_tool_get_type (void)
{
static GType type = 0;
if (! type)
{
const GTypeInfo info =
{
sizeof (GimpImageMapToolClass),
(GBaseInitFunc) gimp_image_map_tool_base_init,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_image_map_tool_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpImageMapTool),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_image_map_tool_init,
};
type = g_type_register_static (GIMP_TYPE_COLOR_TOOL,
"GimpImageMapTool",
&info, 0);
}
return type;
}
static void
@ -125,6 +165,8 @@ gimp_image_map_tool_class_init (GimpImageMapToolClass *klass)
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
GimpColorToolClass *color_tool_class = GIMP_COLOR_TOOL_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->constructor = gimp_image_map_tool_constructor;
object_class->finalize = gimp_image_map_tool_finalize;
@ -149,6 +191,12 @@ gimp_image_map_tool_class_init (GimpImageMapToolClass *klass)
klass->settings_save = NULL;
}
static void
gimp_image_map_tool_base_init (GimpImageMapToolClass *klass)
{
klass->recent_settings = gimp_list_new (GIMP_TYPE_VIEWABLE, FALSE);
}
static void
gimp_image_map_tool_init (GimpImageMapTool *image_map_tool)
{
@ -243,6 +291,9 @@ gimp_image_map_tool_initialize (GimpTool *tool,
GimpImageMapToolClass *klass;
GtkWidget *shell;
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *label;
GtkWidget *combo;
GtkWidget *toggle;
const gchar *stock_id;
@ -275,6 +326,27 @@ gimp_image_map_tool_initialize (GimpTool *tool,
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (shell)->vbox), vbox);
hbox = gtk_hbox_new (FALSE, 4);
gtk_box_pack_start (GTK_BOX (image_map_tool->main_vbox), hbox,
FALSE, FALSE, 0);
gtk_widget_show (hbox);
label = gtk_label_new (_("Recent Settings:"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
combo = gimp_container_combo_box_new (klass->recent_settings,
GIMP_CONTEXT (tool_info->tool_options),
16, 0);
gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 0);
gtk_widget_show (combo);
gimp_help_set_help_data (combo, _("Pick a setting from the list"), NULL);
g_signal_connect_after (combo, "select-item",
G_CALLBACK (gimp_image_map_tool_recent_selected),
image_map_tool);
/* The preview toggle */
toggle = gimp_prop_check_button_new (G_OBJECT (tool_info->tool_options),
"preview",
@ -565,6 +637,49 @@ gimp_image_map_tool_flush (GimpImageMap *image_map,
gimp_display_flush_now (tool->display);
}
static void
gimp_image_map_tool_add_recent (GimpImageMapTool *image_map_tool)
{
GimpContainer *recent;
GimpConfig *current;
GimpConfig *config = NULL;
GList *list;
time_t now;
struct tm tm;
gchar buf[64];
gchar *name;
recent = GIMP_IMAGE_MAP_TOOL_GET_CLASS (image_map_tool)->recent_settings;
current = GIMP_CONFIG (image_map_tool->config);
for (list = GIMP_LIST (recent)->list; list; list = g_list_next (list))
{
config = list->data;
if (gimp_config_is_equal_to (config, current))
{
gimp_container_reorder (recent, GIMP_OBJECT (config), 0);
break;
}
config = NULL;
}
if (! config)
{
config = gimp_config_duplicate (current);
gimp_container_insert (recent, GIMP_OBJECT (config), 0);
}
now = time (NULL);
localtime_r (&now, &tm);
strftime (buf, sizeof (buf), "%F %T", &tm);
name = g_locale_to_utf8 (buf, -1, NULL, NULL, NULL);
gimp_object_set_name (GIMP_OBJECT (config), name);
g_free (name);
}
static void
gimp_image_map_tool_response (GtkWidget *widget,
gint response_id,
@ -598,6 +713,8 @@ gimp_image_map_tool_response (GtkWidget *widget,
gimp_tool_control_set_preserve (tool->control, FALSE);
gimp_image_flush (tool->display->image);
gimp_image_map_tool_add_recent (image_map_tool);
}
tool->display = NULL;
@ -626,6 +743,21 @@ gimp_image_map_tool_response (GtkWidget *widget,
}
}
static void
gimp_image_map_tool_recent_selected (GimpContainerView *view,
GimpViewable *object,
gpointer insert_data,
GimpImageMapTool *tool)
{
if (object)
{
gimp_config_copy (GIMP_CONFIG (object),
GIMP_CONFIG (tool->config), 0);
gimp_container_view_select_item (view, NULL);
}
}
static void
gimp_image_map_tool_notify_preview (GObject *config,
GParamSpec *pspec,

View File

@ -69,6 +69,8 @@ struct _GimpImageMapToolClass
const gchar *save_button_tip;
const gchar *save_dialog_title;
GimpContainer *recent_settings;
/* virtual functions */
GeglNode * (* get_operation) (GimpImageMapTool *image_map_tool,
GObject **config);