gegl r1963 - in trunk: . gegl
- From: neo svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r1963 - in trunk: . gegl
- Date: Tue, 5 Feb 2008 15:24:00 +0000 (GMT)
Author: neo
Date: Tue Feb 5 15:23:59 2008
New Revision: 1963
URL: http://svn.gnome.org/viewvc/gegl?rev=1963&view=rev
Log:
2008-02-05 Sven Neumann <sven gimp org>
* gegl/gegl-utils.[ch]: added gegl_canonicalize_identifier().
* gegl/gegl-chant.h: canonicalize property names used as name and
nick for param specs.
Modified:
trunk/ChangeLog
trunk/gegl/gegl-chant.h
trunk/gegl/gegl-utils.c
trunk/gegl/gegl-utils.h
Modified: trunk/gegl/gegl-chant.h
==============================================================================
--- trunk/gegl/gegl-chant.h (original)
+++ trunk/gegl/gegl-chant.h Tue Feb 5 15:23:59 2008
@@ -592,101 +592,127 @@
gegl_chant_class_init (gpointer klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ gchar *canon;
object_class->set_property = set_property;
object_class->get_property = get_property;
object_class->constructor = gegl_chant_constructor;
+ canon = NULL;
+
/* g_type_class_add_private (klass, sizeof (GeglChantO));*/
-#define gegl_chant_int(name, min, max, def, blurb) \
- g_object_class_install_property (object_class, PROP_##name, \
- g_param_spec_int (#name, #name, blurb, \
- min, max, def, \
- (GParamFlags) ( \
- G_PARAM_READWRITE | \
- G_PARAM_CONSTRUCT | \
- GEGL_PARAM_PAD_INPUT)));
-#define gegl_chant_double(name, min, max, def, blurb) \
- g_object_class_install_property (object_class, PROP_##name, \
- g_param_spec_double (#name, #name, blurb,\
- min, max, def, \
- (GParamFlags) ( \
- G_PARAM_READWRITE | \
- G_PARAM_CONSTRUCT | \
- GEGL_PARAM_PAD_INPUT)));
-#define gegl_chant_boolean(name, def, blurb) \
- g_object_class_install_property (object_class, PROP_##name, \
- g_param_spec_boolean (#name, #name, blurb,\
- def, \
- (GParamFlags) ( \
- G_PARAM_READWRITE |\
- G_PARAM_CONSTRUCT |\
- GEGL_PARAM_PAD_INPUT)));
-#define gegl_chant_string(name, def, blurb) \
- g_object_class_install_property (object_class, PROP_##name, \
- g_param_spec_string (#name, #name, blurb,\
- def, \
- (GParamFlags) ( \
- G_PARAM_READWRITE | \
- G_PARAM_CONSTRUCT | \
- GEGL_PARAM_PAD_INPUT)));
-#define gegl_chant_path(name, def, blurb) \
- g_object_class_install_property (object_class, PROP_##name, \
- gegl_param_spec_path (#name, #name, blurb,\
- FALSE, FALSE, \
- def, \
- (GParamFlags) ( \
- G_PARAM_READWRITE |\
- G_PARAM_CONSTRUCT |\
- GEGL_PARAM_PAD_INPUT)));
-#define gegl_chant_multiline(name, def, blurb) \
- g_object_class_install_property (object_class, PROP_##name, \
- gegl_param_spec_multiline (#name, #name, blurb,\
- def, \
- (GParamFlags) ( \
- G_PARAM_READWRITE |\
- G_PARAM_CONSTRUCT |\
- GEGL_PARAM_PAD_INPUT)));
-#define gegl_chant_object(name, blurb) \
- g_object_class_install_property (object_class, PROP_##name, \
- g_param_spec_object (#name, #name, blurb,\
- G_TYPE_OBJECT, \
- (GParamFlags) ( \
- G_PARAM_READWRITE | \
- G_PARAM_CONSTRUCT | \
- GEGL_PARAM_PAD_INPUT)));
-#define gegl_chant_pointer(name, blurb) \
- g_object_class_install_property (object_class, PROP_##name, \
- g_param_spec_pointer (#name, #name, blurb,\
- (GParamFlags) ( \
- G_PARAM_READWRITE | \
- G_PARAM_CONSTRUCT | \
- GEGL_PARAM_PAD_INPUT)));
-#define gegl_chant_color(name, def, blurb) \
- g_object_class_install_property (object_class, PROP_##name, \
- gegl_param_spec_color_from_string (#name, #name, blurb,\
- def, \
- (GParamFlags) ( \
+#define gegl_chant_int(name, min, max, def, blurb) \
+ canon = gegl_canonicalize_identifier (#name); \
+ g_object_class_install_property (object_class, PROP_##name, \
+ g_param_spec_int (canon, canon, blurb, \
+ min, max, def, \
+ (GParamFlags) ( \
+ G_PARAM_READWRITE | \
+ G_PARAM_CONSTRUCT | \
+ GEGL_PARAM_PAD_INPUT)));\
+ g_free (canon);
+#define gegl_chant_double(name, min, max, def, blurb) \
+ canon = gegl_canonicalize_identifier (#name); \
+ g_object_class_install_property (object_class, PROP_##name, \
+ g_param_spec_double (canon, canon, blurb, \
+ min, max, def, \
+ (GParamFlags) ( \
+ G_PARAM_READWRITE | \
+ G_PARAM_CONSTRUCT | \
+ GEGL_PARAM_PAD_INPUT)));\
+ g_free (canon);
+#define gegl_chant_boolean(name, def, blurb) \
+ canon = gegl_canonicalize_identifier (#name); \
+ g_object_class_install_property (object_class, PROP_##name, \
+ g_param_spec_boolean (canon, canon, blurb,\
+ def, \
+ (GParamFlags) ( \
+ G_PARAM_READWRITE | \
+ G_PARAM_CONSTRUCT | \
+ GEGL_PARAM_PAD_INPUT)));\
+ g_free (canon);
+#define gegl_chant_string(name, def, blurb) \
+ canon = gegl_canonicalize_identifier (#name); \
+ g_object_class_install_property (object_class, PROP_##name, \
+ g_param_spec_string (canon, canon, blurb, \
+ def, \
+ (GParamFlags) ( \
+ G_PARAM_READWRITE | \
+ G_PARAM_CONSTRUCT | \
+ GEGL_PARAM_PAD_INPUT)));\
+ g_free (canon);
+#define gegl_chant_path(name, def, blurb) \
+ canon = gegl_canonicalize_identifier (#name); \
+ g_object_class_install_property (object_class, PROP_##name, \
+ gegl_param_spec_path (canon, canon, blurb,\
+ FALSE, FALSE, \
+ def, \
+ (GParamFlags) ( \
+ G_PARAM_READWRITE | \
+ G_PARAM_CONSTRUCT | \
+ GEGL_PARAM_PAD_INPUT)));\
+ g_free (canon);
+#define gegl_chant_multiline(name, def, blurb) \
+ canon = gegl_canonicalize_identifier (#name); \
+ g_object_class_install_property (object_class, PROP_##name, \
+ gegl_param_spec_multiline (canon, canon, blurb, \
+ def, \
+ (GParamFlags) ( \
+ G_PARAM_READWRITE | \
+ G_PARAM_CONSTRUCT | \
+ GEGL_PARAM_PAD_INPUT)));\
+ g_free (canon);
+#define gegl_chant_object(name, blurb) \
+ canon = gegl_canonicalize_identifier (#name); \
+ g_object_class_install_property (object_class, PROP_##name, \
+ g_param_spec_object (canon, canon, blurb, \
+ G_TYPE_OBJECT, \
+ (GParamFlags) ( \
+ G_PARAM_READWRITE | \
+ G_PARAM_CONSTRUCT | \
+ GEGL_PARAM_PAD_INPUT)));\
+ g_free (canon);
+#define gegl_chant_pointer(name, blurb) \
+ canon = gegl_canonicalize_identifier (#name); \
+ g_object_class_install_property (object_class, PROP_##name, \
+ g_param_spec_pointer (canon, canon, blurb,\
+ (GParamFlags) ( \
+ G_PARAM_READWRITE | \
+ G_PARAM_CONSTRUCT | \
+ GEGL_PARAM_PAD_INPUT)));\
+ g_free (canon);
+#define gegl_chant_color(name, def, blurb) \
+ canon = gegl_canonicalize_identifier (#name); \
+ g_object_class_install_property (object_class, PROP_##name, \
+ gegl_param_spec_color_from_string (canon, canon, blurb,\
+ def, \
+ (GParamFlags) ( \
G_PARAM_READWRITE |\
G_PARAM_CONSTRUCT |\
- GEGL_PARAM_PAD_INPUT)));
+ GEGL_PARAM_PAD_INPUT)));\
+ g_free (canon);
#define gegl_chant_curve(name, blurb) \
- g_object_class_install_property (object_class, PROP_##name, \
- gegl_param_spec_curve (#name, #name, blurb,\
+ canon = gegl_canonicalize_identifier (#name); \
+ g_object_class_install_property (object_class, PROP_##name, \
+ gegl_param_spec_curve (canon, canon, blurb,\
gegl_curve_default_curve(),\
- (GParamFlags) ( \
- G_PARAM_READWRITE | \
- G_PARAM_CONSTRUCT | \
- GEGL_PARAM_PAD_INPUT)));
-#define gegl_chant_vector(name, blurb) \
- g_object_class_install_property (object_class, PROP_##name, \
- gegl_param_spec_vector (#name, #name, blurb,\
- NULL, \
- (GParamFlags) ( \
- G_PARAM_READWRITE | \
- G_PARAM_CONSTRUCT | \
- GEGL_PARAM_PAD_INPUT)));
+ (GParamFlags) ( \
+ G_PARAM_READWRITE |\
+ G_PARAM_CONSTRUCT |\
+ GEGL_PARAM_PAD_INPUT)));\
+ g_free (canon);
+#define gegl_chant_vector(name, blurb) \
+ canon = gegl_canonicalize_identifier (#name); \
+ g_object_class_install_property (object_class, PROP_##name, \
+ gegl_param_spec_vector (canon, canon, blurb,\
+ NULL, \
+ (GParamFlags) ( \
+ G_PARAM_READWRITE |\
+ G_PARAM_CONSTRUCT |\
+ GEGL_PARAM_PAD_INPUT)));\
+ g_free (canon);
+
#include GEGL_CHANT_C_FILE
#undef gegl_chant_int
Modified: trunk/gegl/gegl-utils.c
==============================================================================
--- trunk/gegl/gegl-utils.c (original)
+++ trunk/gegl/gegl-utils.c Tue Feb 5 15:23:59 2008
@@ -301,6 +301,33 @@
}
+gchar *
+gegl_canonicalize_identifier (const gchar *identifier)
+{
+ gchar *canonicalized = NULL;
+
+ if (identifier)
+ {
+ gchar *p;
+
+ canonicalized = g_strdup (identifier);
+
+ for (p = canonicalized; *p != 0; p++)
+ {
+ gchar c = *p;
+
+ if (c != '-' &&
+ (c < '0' || c > '9') &&
+ (c < 'A' || c > 'Z') &&
+ (c < 'a' || c > 'z'))
+ *p = '-';
+ }
+ }
+
+ return canonicalized;
+}
+
+
static GeglRectangle *
gegl_rectangle_dup (const GeglRectangle *rectangle)
{
Modified: trunk/gegl/gegl-utils.h
==============================================================================
--- trunk/gegl/gegl-utils.h (original)
+++ trunk/gegl/gegl-utils.h Tue Feb 5 15:23:59 2008
@@ -21,47 +21,49 @@
G_BEGIN_DECLS
-void gegl_rectangle_set (GeglRectangle *r,
- gint x,
- gint y,
- guint width,
- guint height);
-gboolean gegl_rectangle_equal (const GeglRectangle *r,
- const GeglRectangle *s);
-gboolean gegl_rectangle_equal_coords (const GeglRectangle *r,
- gint x,
- gint y,
- gint width,
- gint height);
-void gegl_rectangle_copy (GeglRectangle *to,
- const GeglRectangle *from);
-void gegl_rectangle_bounding_box (GeglRectangle *dest,
- const GeglRectangle *src1,
- const GeglRectangle *src2);
-gboolean gegl_rectangle_intersect (GeglRectangle *dest,
- const GeglRectangle *src1,
- const GeglRectangle *src2);
-gboolean gegl_rectangle_contains (const GeglRectangle *r,
- const GeglRectangle *s);
-
-void gegl_log_debug (gchar *file,
- gint line,
- gchar *function,
- gchar *format,
- ...);
-void gegl_log_info (gchar *file,
- gint line,
- gchar *function,
- gchar *format,
- ...);
-void gegl_log_message (gchar *file,
- gint line,
- gchar *function,
- gchar *format,
- ...);
-void gegl_log_direct (gchar *format,
- ...);
-GType gegl_rectangle_get_type (void) G_GNUC_CONST;
+void gegl_rectangle_set (GeglRectangle *r,
+ gint x,
+ gint y,
+ guint width,
+ guint height);
+gboolean gegl_rectangle_equal (const GeglRectangle *r,
+ const GeglRectangle *s);
+gboolean gegl_rectangle_equal_coords (const GeglRectangle *r,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
+void gegl_rectangle_copy (GeglRectangle *to,
+ const GeglRectangle *from);
+void gegl_rectangle_bounding_box (GeglRectangle *dest,
+ const GeglRectangle *src1,
+ const GeglRectangle *src2);
+gboolean gegl_rectangle_intersect (GeglRectangle *dest,
+ const GeglRectangle *src1,
+ const GeglRectangle *src2);
+gboolean gegl_rectangle_contains (const GeglRectangle *r,
+ const GeglRectangle *s);
+
+gchar * gegl_canonicalize_identifier (const gchar *identifier);
+
+void gegl_log_debug (gchar *file,
+ gint line,
+ gchar *function,
+ gchar *format,
+ ...);
+void gegl_log_info (gchar *file,
+ gint line,
+ gchar *function,
+ gchar *format,
+ ...);
+void gegl_log_message (gchar *file,
+ gint line,
+ gchar *function,
+ gchar *format,
+ ...);
+void gegl_log_direct (gchar *format,
+ ...);
+GType gegl_rectangle_get_type (void) G_GNUC_CONST;
#ifndef __GEGL_H__
#define GEGL_TYPE_RECTANGLE (gegl_rectangle_get_type ())
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]