gegl r2794 - in trunk: . gegl gegl/property-types



Author: ok
Date: Sun Nov 23 20:12:41 2008
New Revision: 2794
URL: http://svn.gnome.org/viewvc/gegl?rev=2794&view=rev

Log:
* gegl/gegl-chant.h: Create the default value of color properties in
in the constructor if they are no set manually in the varargs.
* gegl/property-types/gegl-color.c: (gegl_param_color_get_type),
(gegl_param_spec_color), (gegl_param_spec_color_from_string):


Modified:
   trunk/ChangeLog
   trunk/gegl/gegl-chant.h
   trunk/gegl/property-types/gegl-color.c

Modified: trunk/gegl/gegl-chant.h
==============================================================================
--- trunk/gegl/gegl-chant.h	(original)
+++ trunk/gegl/gegl-chant.h	Sun Nov 23 20:12:41 2008
@@ -452,7 +452,6 @@
       break;
 #define gegl_chant_color(name, nick, def, blurb)              \
     case PROP_##name:                                         \
-      if (!properties->name)properties->name = gegl_color_new ("red"); /* feels ugly as well */\
       g_value_set_object (value, properties->name);           \
       break;
 #define gegl_chant_curve(name, nick, blurb)                   \
@@ -659,10 +658,43 @@
                         GObjectConstructParam *construct_properties)
 {
   GObject *obj;
+  GeglChantO *properties;
 
   obj = G_OBJECT_CLASS (gegl_chant_parent_class)->constructor (
             type, n_construct_properties, construct_properties);
 
+  /* create dummy colors and vectors */
+  properties = GEGL_CHANT_PROPERTIES (obj);
+
+#define gegl_chant_int(name, nick, min, max, def, blurb)              
+#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_file_path(name, nick, def, blurb)                  
+#define gegl_chant_multiline(name, nick, def, blurb)                  
+#define gegl_chant_object(name, nick, blurb)                          
+#define gegl_chant_pointer(name, nick, blurb)                         
+#define gegl_chant_color(name, nick, def, blurb)              \
+    if (properties->name == NULL) \
+    {properties->name = gegl_color_new(def?def:"black");}
+#define gegl_chant_path(name, nick, blurb)
+#define gegl_chant_curve(name, nick, blurb)
+
+#include GEGL_CHANT_C_FILE
+
+#undef gegl_chant_int
+#undef gegl_chant_double
+#undef gegl_chant_boolean
+#undef gegl_chant_string
+#undef gegl_chant_file_path
+#undef gegl_chant_multiline
+#undef gegl_chant_object
+#undef gegl_chant_pointer
+#undef gegl_chant_color
+#undef gegl_chant_curve
+#undef gegl_chant_path
+
+
   g_object_set_data_full (obj, "chant-data", obj, gegl_chant_destroy_notify);
   return obj;
 }
@@ -746,20 +778,20 @@
                                                           def,               \
                                                           (GParamFlags) (    \
                                                           G_PARAM_READWRITE |\
-                                                          G_PARAM_CONSTRUCT |\
+														  G_PARAM_CONSTRUCT | \
                                                           GEGL_PARAM_PAD_INPUT)));
-#define gegl_chant_curve(name, nick, blurb)                                  \
+#define gegl_chant_path(name, nick, blurb)                                 \
   g_object_class_install_property (object_class, PROP_##name,                \
-                                   gegl_param_spec_curve (#name, nick, blurb,\
-                                                          gegl_curve_default_curve(),\
+                                   gegl_param_spec_path (#name, nick, blurb,\
+                                                           NULL,             \
                                                           (GParamFlags) (    \
                                                           G_PARAM_READWRITE |\
                                                           G_PARAM_CONSTRUCT |\
                                                           GEGL_PARAM_PAD_INPUT)));
-#define gegl_chant_path(name, nick, blurb)                                 \
+#define gegl_chant_curve(name, nick, blurb)                                  \
   g_object_class_install_property (object_class, PROP_##name,                \
-                                   gegl_param_spec_path (#name, nick, blurb,\
-                                                           NULL,             \
+                                   gegl_param_spec_curve (#name, nick, blurb,\
+                                                          gegl_curve_default_curve(),\
                                                           (GParamFlags) (    \
                                                           G_PARAM_READWRITE |\
                                                           G_PARAM_CONSTRUCT |\

Modified: trunk/gegl/property-types/gegl-color.c
==============================================================================
--- trunk/gegl/property-types/gegl-color.c	(original)
+++ trunk/gegl/property-types/gegl-color.c	Sun Nov 23 20:12:41 2008
@@ -499,7 +499,7 @@
         gegl_param_color_init,
         0,
         gegl_param_color_finalize,
-        value_set_default,
+        NULL, /*value_set_default,*/
         NULL,
         NULL
       };
@@ -523,10 +523,10 @@
 
   param_color = g_param_spec_internal (GEGL_TYPE_PARAM_COLOR,
                                        name, nick, blurb, flags);
-
+/*
   param_color->default_color = default_color;
   if (default_color)
-    g_object_ref (default_color);
+    g_object_ref (default_color);*/
 
   return G_PARAM_SPEC (param_color);
 }
@@ -542,9 +542,9 @@
 
   param_color = g_param_spec_internal (GEGL_TYPE_PARAM_COLOR,
                                        name, nick, blurb, flags);
-
+/*
   param_color->default_color = g_object_new (GEGL_TYPE_COLOR,
                                              "string", default_color_string,
-                                             NULL);
+                                             NULL);*/
   return G_PARAM_SPEC (param_color);
 }



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