diff --git a/ChangeLog b/ChangeLog index 0cd9616f3c..1babdfa7fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2006-03-28 Michael Natterer + + * app/core/gimpparamspecs.[ch] (gimp_param_spec_string): reordered + params to be consistent with other param specs. + + (gimp_value_get_rgb): utility function which reads the value + into a GimpRGB struct, instead of returning a pointer. + + (gimp_value_set_rgb): added for symmetry. Just calls + g_value_set_boxed(). + 2006-03-28 Sven Neumann * plug-ins/jpeg/jpeg-exif.c diff --git a/app/core/gimpparamspecs.c b/app/core/gimpparamspecs.c index 4e577d30b9..2d3d08011a 100644 --- a/app/core/gimpparamspecs.c +++ b/app/core/gimpparamspecs.c @@ -21,6 +21,7 @@ #include #include "libgimpbase/gimpbase.h" +#include "libgimpcolor/gimpcolor.h" #include "core-types.h" @@ -127,9 +128,9 @@ GParamSpec * gimp_param_spec_string (const gchar *name, const gchar *nick, const gchar *blurb, - const gchar *default_value, gboolean no_validate, gboolean null_ok, + const gchar *default_value, GParamFlags flags) { GimpParamSpecString *sspec; @@ -623,6 +624,35 @@ gimp_value_set_display (GValue *value, value->data[0].v_int = id; } + +/* + * GIMP_TYPE_RGB + */ + +void +gimp_value_get_rgb (const GValue *value, + GimpRGB *rgb) +{ + g_return_if_fail (GIMP_VALUE_HOLDS_RGB (value)); + g_return_if_fail (rgb != NULL); + + if (value->data[0].v_pointer) + *rgb = *((GimpRGB *) value->data[0].v_pointer); + else + gimp_rgba_set (rgb, 0.0, 0.0, 0.0, 1.0); +} + +void +gimp_value_set_rgb (GValue *value, + GimpRGB *rgb) +{ + g_return_if_fail (GIMP_VALUE_HOLDS_RGB (value)); + g_return_if_fail (rgb != NULL); + + g_value_set_boxed (value, rgb); +} + + /* * GIMP_TYPE_PARASITE */ diff --git a/app/core/gimpparamspecs.h b/app/core/gimpparamspecs.h index c8cb61b8ff..5e5a6253e0 100644 --- a/app/core/gimpparamspecs.h +++ b/app/core/gimpparamspecs.h @@ -38,9 +38,9 @@ GType gimp_param_string_get_type (void) G_GNUC_CONST; GParamSpec * gimp_param_spec_string (const gchar *name, const gchar *nick, const gchar *blurb, - const gchar *default_value, gboolean no_validate, gboolean null_ok, + const gchar *default_value, GParamFlags flags); @@ -110,6 +110,16 @@ void gimp_value_set_display (GValue *value, GimpObject *display); +/* + * GIMP_TYPE_RGB + */ + +void gimp_value_get_rgb (const GValue *value, + GimpRGB *rgb); +void gimp_value_set_rgb (GValue *value, + GimpRGB *rgb); + + /* * GIMP_TYPE_PARASITE */ @@ -119,6 +129,7 @@ void gimp_value_set_display (GValue *value, GType gimp_parasite_get_type (void) G_GNUC_CONST; + /* * GIMP_TYPE_PARAM_PARASITE */