[gegl] gegl-chant: replace gegl_chant_sampler with a generic gegl_chant_enum and update ops
- From: Michael Murà <mmure src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] gegl-chant: replace gegl_chant_sampler with a generic gegl_chant_enum and update ops
- Date: Sun, 4 Sep 2011 17:36:56 +0000 (UTC)
commit 81322c10ce9cd5f9961f565f32d2874bf466f82b
Author: Michael Murà <batolettre gmail com>
Date: Sat Jul 9 11:54:54 2011 +0200
gegl-chant: replace gegl_chant_sampler with a generic gegl_chant_enum and update ops
gegl/gegl-chant.h | 56 +++++++++++++++++++-------------------
operations/common/map-absolute.c | 4 +-
operations/common/map-relative.c | 4 +-
3 files changed, 32 insertions(+), 32 deletions(-)
---
diff --git a/gegl/gegl-chant.h b/gegl/gegl-chant.h
index 47841dd..d0d73a4 100644
--- a/gegl/gegl-chant.h
+++ b/gegl/gegl-chant.h
@@ -346,6 +346,7 @@ struct _GeglChantO
#define gegl_chant_double(name, nick, min, max, def, blurb) gdouble name;
#define gegl_chant_boolean(name, nick, def, blurb) gboolean name;
#define gegl_chant_string(name, nick, def, blurb) gchar *name;
+#define gegl_chant_enum(name, nick, enum, type, def, blurb) enum name;
#define gegl_chant_file_path(name, nick, def, blurb) gchar *name;
#define gegl_chant_multiline(name, nick, def, blurb) gchar *name;
#define gegl_chant_object(name,nick, blurb) GObject *name;
@@ -354,7 +355,6 @@ struct _GeglChantO
#define gegl_chant_curve(name, nick, blurb) GeglCurve *name;
#define gegl_chant_path(name, nick, blurb) GeglPath *name;\
guint path_changed_handler;
-#define gegl_chant_sampler(name, nick, def, blurb) GeglSamplerType name;
#include GEGL_CHANT_C_FILE
@@ -362,6 +362,7 @@ struct _GeglChantO
#undef gegl_chant_double
#undef gegl_chant_boolean
#undef gegl_chant_string
+#undef gegl_chant_enum
#undef gegl_chant_file_path
#undef gegl_chant_multiline
#undef gegl_chant_object
@@ -369,7 +370,6 @@ struct _GeglChantO
#undef gegl_chant_color
#undef gegl_chant_curve
#undef gegl_chant_path
-#undef gegl_chant_sampler
};
#define GEGL_CHANT_OPERATION(obj) ((Operation*)(obj))
@@ -381,6 +381,7 @@ enum
#define gegl_chant_double(name, nick, min, max, def, blurb) PROP_##name,
#define gegl_chant_boolean(name, nick, def, blurb) PROP_##name,
#define gegl_chant_string(name, nick, def, blurb) PROP_##name,
+#define gegl_chant_enum(name, nick, enum, type, def, blurb) PROP_##name,
#define gegl_chant_file_path(name, nick, def, blurb) PROP_##name,
#define gegl_chant_multiline(name, nick, def, blurb) PROP_##name,
#define gegl_chant_object(name, nick, blurb) PROP_##name,
@@ -388,7 +389,6 @@ enum
#define gegl_chant_color(name, nick, def, blurb) PROP_##name,
#define gegl_chant_curve(name, nick, blurb) PROP_##name,
#define gegl_chant_path(name, nick, blurb) PROP_##name,
-#define gegl_chant_sampler(name, nick, def, blurb) PROP_##name,
#include GEGL_CHANT_C_FILE
@@ -396,6 +396,7 @@ enum
#undef gegl_chant_double
#undef gegl_chant_boolean
#undef gegl_chant_string
+#undef gegl_chant_enum
#undef gegl_chant_file_path
#undef gegl_chant_multiline
#undef gegl_chant_object
@@ -403,7 +404,6 @@ enum
#undef gegl_chant_color
#undef gegl_chant_curve
#undef gegl_chant_path
-#undef gegl_chant_sampler
PROP_LAST
};
@@ -435,6 +435,10 @@ get_property (GObject *gobject,
case PROP_##name: \
g_value_set_string (value, properties->name); \
break;
+#define gegl_chant_enum(name, nick, enum, type, def, blurb) \
+ case PROP_##name: \
+ g_value_set_enum (value, properties->name); \
+ break;
#define gegl_chant_file_path(name, nick, def, blurb) \
case PROP_##name: \
g_value_set_string (value, properties->name); \
@@ -464,10 +468,6 @@ get_property (GObject *gobject,
if (!properties->name)properties->name = gegl_path_new (); /* this feels ugly */\
g_value_set_object (value, properties->name); \
break;/*XXX*/
-#define gegl_chant_sampler(name, nick, def, blurb) \
- case PROP_##name: \
- g_value_set_enum (value, properties->name); \
- break;
#include GEGL_CHANT_C_FILE
@@ -475,6 +475,7 @@ get_property (GObject *gobject,
#undef gegl_chant_double
#undef gegl_chant_boolean
#undef gegl_chant_string
+#undef gegl_chant_enum
#undef gegl_chant_file_path
#undef gegl_chant_multiline
#undef gegl_chant_object
@@ -482,7 +483,6 @@ get_property (GObject *gobject,
#undef gegl_chant_color
#undef gegl_chant_curve
#undef gegl_chant_path
-#undef gegl_chant_sampler
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, property_id, pspec);
break;
@@ -520,6 +520,10 @@ set_property (GObject *gobject,
g_free (properties->name); \
properties->name = g_strdup (g_value_get_string (value)); \
break;
+#define gegl_chant_enum(name, nick, enum, type, def, blurb) \
+ case PROP_##name: \
+ properties->name = g_value_get_enum (value); \
+ break;
#define gegl_chant_file_path(name, nick, def, blurb) \
case PROP_##name: \
if (properties->name) \
@@ -570,10 +574,6 @@ set_property (GObject *gobject,
G_CALLBACK(path_changed), gobject); \
}\
break; /*XXX*/
-#define gegl_chant_sampler(name, nick, def, blurb) \
- case PROP_##name: \
- properties->name = g_value_get_enum (value); \
- break;
#include GEGL_CHANT_C_FILE
@@ -581,6 +581,7 @@ set_property (GObject *gobject,
#undef gegl_chant_double
#undef gegl_chant_boolean
#undef gegl_chant_string
+#undef gegl_chant_enum
#undef gegl_chant_file_path
#undef gegl_chant_multiline
#undef gegl_chant_object
@@ -588,7 +589,6 @@ set_property (GObject *gobject,
#undef gegl_chant_color
#undef gegl_chant_curve
#undef gegl_chant_path
-#undef gegl_chant_sampler
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, property_id, pspec);
@@ -611,6 +611,7 @@ static void gegl_chant_destroy_notify (gpointer data)
g_free (properties->name); \
properties->name = NULL; \
}
+#define gegl_chant_enum(name, nick, enum, type, def, blurb)
#define gegl_chant_file_path(name, nick, def, blurb) \
if (properties->name) \
{ \
@@ -648,7 +649,6 @@ static void gegl_chant_destroy_notify (gpointer data)
g_object_unref (properties->name); \
properties->name = NULL; \
}
-#define gegl_chant_sampler(name, nick, def, blurb)
#include GEGL_CHANT_C_FILE
@@ -656,6 +656,7 @@ static void gegl_chant_destroy_notify (gpointer data)
#undef gegl_chant_double
#undef gegl_chant_boolean
#undef gegl_chant_string
+#undef gegl_chant_enum
#undef gegl_chant_file_path
#undef gegl_chant_multiline
#undef gegl_chant_object
@@ -663,7 +664,6 @@ static void gegl_chant_destroy_notify (gpointer data)
#undef gegl_chant_color
#undef gegl_chant_curve
#undef gegl_chant_path
-#undef gegl_chant_sampler
g_slice_free (GeglChantO, properties);
}
@@ -686,6 +686,7 @@ gegl_chant_constructor (GType type,
#define gegl_chant_double(name, nick, min, max, def, blurb)
#define gegl_chant_boolean(name, nick, def, blurb)
#define gegl_chant_string(name, nick, def, blurb)
+#define gegl_chant_enum(name, nick, enum, type, def, blurb)
#define gegl_chant_file_path(name, nick, def, blurb)
#define gegl_chant_multiline(name, nick, def, blurb)
#define gegl_chant_object(name, nick, blurb)
@@ -695,7 +696,6 @@ gegl_chant_constructor (GType type,
{properties->name = gegl_color_new(def?def:"black");}
#define gegl_chant_path(name, nick, blurb)
#define gegl_chant_curve(name, nick, blurb)
-#define gegl_chant_sampler(name, nick, def, blurb)
#include GEGL_CHANT_C_FILE
@@ -703,6 +703,7 @@ gegl_chant_constructor (GType type,
#undef gegl_chant_double
#undef gegl_chant_boolean
#undef gegl_chant_string
+#undef gegl_chant_enum
#undef gegl_chant_file_path
#undef gegl_chant_multiline
#undef gegl_chant_object
@@ -710,7 +711,6 @@ gegl_chant_constructor (GType type,
#undef gegl_chant_color
#undef gegl_chant_curve
#undef gegl_chant_path
-#undef gegl_chant_sampler
g_object_set_data_full (obj, "chant-data", obj, gegl_chant_destroy_notify);
properties ++; /* evil hack to silence gcc */
@@ -758,6 +758,15 @@ gegl_chant_class_intern_init (gpointer klass)
G_PARAM_READWRITE | \
G_PARAM_CONSTRUCT | \
GEGL_PARAM_PAD_INPUT)));
+#define gegl_chant_enum(name, nick, enum, type, def, blurb) \
+ g_object_class_install_property (object_class, PROP_##name, \
+ g_param_spec_enum (#name, nick, blurb, \
+ type, \
+ def, \
+ (GParamFlags) ( \
+ G_PARAM_READWRITE | \
+ G_PARAM_CONSTRUCT | \
+ GEGL_PARAM_PAD_INPUT)));
#define gegl_chant_file_path(name, nick, def, blurb) \
g_object_class_install_property (object_class, PROP_##name, \
gegl_param_spec_file_path (#name, nick, blurb, \
@@ -814,15 +823,6 @@ gegl_chant_class_intern_init (gpointer klass)
G_PARAM_READWRITE |\
G_PARAM_CONSTRUCT |\
GEGL_PARAM_PAD_INPUT)));
-#define gegl_chant_sampler(name, nick, def, blurb) \
- g_object_class_install_property (object_class, PROP_##name, \
- g_param_spec_enum (#name, nick, blurb, \
- GEGL_TYPE_SAMPLER_TYPE,\
- def, \
- (GParamFlags) ( \
- G_PARAM_READWRITE | \
- G_PARAM_CONSTRUCT | \
- GEGL_PARAM_PAD_INPUT)));
#include GEGL_CHANT_C_FILE
@@ -830,6 +830,7 @@ gegl_chant_class_intern_init (gpointer klass)
#undef gegl_chant_double
#undef gegl_chant_boolean
#undef gegl_chant_string
+#undef gegl_chant_enum
#undef gegl_chant_file_path
#undef gegl_chant_multiline
#undef gegl_chant_object
@@ -837,7 +838,6 @@ gegl_chant_class_intern_init (gpointer klass)
#undef gegl_chant_color
#undef gegl_chant_curve
#undef gegl_chant_path
-#undef gegl_chant_sampler
}
diff --git a/operations/common/map-absolute.c b/operations/common/map-absolute.c
index 1cc4be9..c0e444d 100644
--- a/operations/common/map-absolute.c
+++ b/operations/common/map-absolute.c
@@ -19,8 +19,8 @@
#ifdef GEGL_CHANT_PROPERTIES
-gegl_chant_sampler (sampler_type, _("Interpolation"),
- GEGL_INTERPOLATION_CUBIC, _("Sampler used internaly"))
+gegl_chant_enum (sampler_type, _("Sampler"), GeglSamplerType, GEGL_TYPE_SAMPLER_TYPE,
+ GEGL_INTERPOLATION_CUBIC, _("Sampler used internaly"))
#else
diff --git a/operations/common/map-relative.c b/operations/common/map-relative.c
index b65841e..c9f1b1e 100644
--- a/operations/common/map-relative.c
+++ b/operations/common/map-relative.c
@@ -23,8 +23,8 @@
gegl_chant_double (scaling, _("Scaling"), 0.0, 5000.0, 1.0,
_("scaling factor of displacement, indicates how large spatial"
" displacement a relative mapping value of 1.0 corresponds to."))
-gegl_chant_sampler (sampler_type, _("Interpolation"),
- GEGL_INTERPOLATION_CUBIC, _("Sampler used internaly"))
+gegl_chant_enum (sampler_type, _("Sampler"), GeglSamplerType, GEGL_TYPE_SAMPLER_TYPE,
+ GEGL_INTERPOLATION_CUBIC, _("Sampler used internaly"))
#else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]