removed GIMP_TYPE_COLOR.

2004-07-26  Michael Natterer  <mitch@gimp.org>

	* app/config/gimpconfig-types.h: removed GIMP_TYPE_COLOR.

	* app/config/gimpconfig-params.[ch]: renamed GimpParamSpecColor
	to GimpParamSpecRGB.

	* app/config/gimpconfig-deserialize.c
	* app/config/gimpconfig-dump.c
	* app/config/gimpconfig-serialize.c
	* app/config/gimpscanner.c
	* app/core/gimp-utils.c
	* app/core/gimpcontext.c
	* app/core/gimpgrid.c
	* app/display/gimpdisplayoptions.c
	* app/text/gimptext.c
	* app/tools/gimpcolortool.c
	* app/widgets/gimpaction.c
	* app/widgets/gimpcolorbar.c
	* app/widgets/gimppropwidgets.c: changed accordingly.
This commit is contained in:
Michael Natterer 2004-07-26 19:56:47 +00:00 committed by Michael Natterer
parent bfa52ab740
commit caabe7f334
22 changed files with 193 additions and 172 deletions

View File

@ -1,3 +1,24 @@
2004-07-26 Michael Natterer <mitch@gimp.org>
* app/config/gimpconfig-types.h: removed GIMP_TYPE_COLOR.
* app/config/gimpconfig-params.[ch]: renamed GimpParamSpecColor
to GimpParamSpecRGB.
* app/config/gimpconfig-deserialize.c
* app/config/gimpconfig-dump.c
* app/config/gimpconfig-serialize.c
* app/config/gimpscanner.c
* app/core/gimp-utils.c
* app/core/gimpcontext.c
* app/core/gimpgrid.c
* app/display/gimpdisplayoptions.c
* app/text/gimptext.c
* app/tools/gimpcolortool.c
* app/widgets/gimpaction.c
* app/widgets/gimpcolorbar.c
* app/widgets/gimppropwidgets.c: changed accordingly.
2004-07-26 Shlomi Fish <shlomif@iglu.org.il>
* plug-ins/gimpressionist/: added a de-allocation to the PPM's

View File

@ -67,7 +67,7 @@ static GTokenType gimp_config_deserialize_memsize (GValue *value,
static GTokenType gimp_config_deserialize_path (GValue *value,
GParamSpec *prop_spec,
GScanner *scanner);
static GTokenType gimp_config_deserialize_color (GValue *value,
static GTokenType gimp_config_deserialize_rgb (GValue *value,
GParamSpec *prop_spec,
GScanner *scanner);
static GTokenType gimp_config_deserialize_matrix2 (GValue *value,
@ -351,9 +351,9 @@ gimp_config_deserialize_value (GValue *value,
{
return gimp_config_deserialize_path (value, prop_spec, scanner);
}
else if (prop_spec->value_type == GIMP_TYPE_COLOR)
else if (prop_spec->value_type == GIMP_TYPE_RGB)
{
return gimp_config_deserialize_color (value, prop_spec, scanner);
return gimp_config_deserialize_rgb (value, prop_spec, scanner);
}
else if (prop_spec->value_type == GIMP_TYPE_MATRIX2)
{
@ -622,16 +622,16 @@ gimp_config_deserialize_path (GValue *value,
}
static GTokenType
gimp_config_deserialize_color (GValue *value,
GParamSpec *prop_spec,
GScanner *scanner)
gimp_config_deserialize_rgb (GValue *value,
GParamSpec *prop_spec,
GScanner *scanner)
{
GimpRGB color;
GimpRGB rgb;
if (! gimp_scanner_parse_color (scanner, &color))
if (! gimp_scanner_parse_color (scanner, &rgb))
return G_TOKEN_NONE;
g_value_set_boxed (value, &color);
g_value_set_boxed (value, &rgb);
return G_TOKEN_RIGHT_PAREN;
}

View File

@ -30,6 +30,7 @@
#include <glib-object.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpcolor/gimpcolor.h"
#ifdef G_OS_WIN32
#include "libgimpbase/gimpwin32-io.h"
@ -335,7 +336,7 @@ dump_describe_param (GParamSpec *param_spec)
type = param_spec->value_type;
if (g_type_is_a (type, GIMP_TYPE_COLOR))
if (g_type_is_a (type, GIMP_TYPE_RGB))
{
values =
"The color is specified in the form (color-rgba red green blue alpha) "

View File

@ -34,24 +34,24 @@
/*
* GIMP_TYPE_PARAM_COLOR
* GIMP_TYPE_PARAM_RGB
*/
#define GIMP_PARAM_SPEC_COLOR(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GIMP_TYPE_PARAM_COLOR, GimpParamSpecColor))
#define GIMP_PARAM_SPEC_RGB(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GIMP_TYPE_PARAM_RGB, GimpParamSpecRGB))
static void gimp_param_color_class_init (GParamSpecClass *class);
static void gimp_param_color_init (GParamSpec *pspec);
static void gimp_param_color_set_default (GParamSpec *pspec,
GValue *value);
static gboolean gimp_param_color_validate (GParamSpec *pspec,
GValue *value);
static gint gimp_param_color_values_cmp (GParamSpec *pspec,
const GValue *value1,
const GValue *value2);
static void gimp_param_rgb_class_init (GParamSpecClass *class);
static void gimp_param_rgb_init (GParamSpec *pspec);
static void gimp_param_rgb_set_default (GParamSpec *pspec,
GValue *value);
static gboolean gimp_param_rgb_validate (GParamSpec *pspec,
GValue *value);
static gint gimp_param_rgb_values_cmp (GParamSpec *pspec,
const GValue *value1,
const GValue *value2);
typedef struct _GimpParamSpecColor GimpParamSpecColor;
typedef struct _GimpParamSpecRGB GimpParamSpecRGB;
struct _GimpParamSpecColor
struct _GimpParamSpecRGB
{
GParamSpecBoxed parent_instance;
@ -59,7 +59,7 @@ struct _GimpParamSpecColor
};
GType
gimp_param_color_get_type (void)
gimp_param_rgb_get_type (void)
{
static GType spec_type = 0;
@ -69,15 +69,15 @@ gimp_param_color_get_type (void)
{
sizeof (GParamSpecClass),
NULL, NULL,
(GClassInitFunc) gimp_param_color_class_init,
(GClassInitFunc) gimp_param_rgb_class_init,
NULL, NULL,
sizeof (GimpParamSpecColor),
sizeof (GimpParamSpecRGB),
0,
(GInstanceInitFunc) gimp_param_color_init
(GInstanceInitFunc) gimp_param_rgb_init
};
spec_type = g_type_register_static (G_TYPE_PARAM_BOXED,
"GimpParamColor",
"GimpParamRGB",
&type_info, 0);
}
@ -85,83 +85,83 @@ gimp_param_color_get_type (void)
}
static void
gimp_param_color_class_init (GParamSpecClass *class)
gimp_param_rgb_class_init (GParamSpecClass *class)
{
class->value_type = GIMP_TYPE_COLOR;
class->value_set_default = gimp_param_color_set_default;
class->value_validate = gimp_param_color_validate;
class->values_cmp = gimp_param_color_values_cmp;
class->value_type = GIMP_TYPE_RGB;
class->value_set_default = gimp_param_rgb_set_default;
class->value_validate = gimp_param_rgb_validate;
class->values_cmp = gimp_param_rgb_values_cmp;
}
static void
gimp_param_color_init (GParamSpec *pspec)
gimp_param_rgb_init (GParamSpec *pspec)
{
GimpParamSpecColor *cspec = GIMP_PARAM_SPEC_COLOR (pspec);
GimpParamSpecRGB *cspec = GIMP_PARAM_SPEC_RGB (pspec);
gimp_rgba_set (&cspec->default_value, 0.0, 0.0, 0.0, 0.0);
}
static void
gimp_param_color_set_default (GParamSpec *pspec,
GValue *value)
gimp_param_rgb_set_default (GParamSpec *pspec,
GValue *value)
{
GimpParamSpecColor *cspec = GIMP_PARAM_SPEC_COLOR (pspec);
GimpParamSpecRGB *cspec = GIMP_PARAM_SPEC_RGB (pspec);
g_value_set_static_boxed (value, &cspec->default_value);
}
static gboolean
gimp_param_color_validate (GParamSpec *pspec,
GValue *value)
gimp_param_rgb_validate (GParamSpec *pspec,
GValue *value)
{
GimpRGB *color;
GimpRGB *rgb;
color = value->data[0].v_pointer;
rgb = value->data[0].v_pointer;
if (color)
if (rgb)
{
GimpRGB oval;
oval = *color;
oval = *rgb;
gimp_rgb_clamp (color);
gimp_rgb_clamp (rgb);
return (oval.r != color->r ||
oval.g != color->g ||
oval.b != color->b ||
oval.a != color->a);
return (oval.r != rgb->r ||
oval.g != rgb->g ||
oval.b != rgb->b ||
oval.a != rgb->a);
}
return FALSE;
}
static gint
gimp_param_color_values_cmp (GParamSpec *pspec,
const GValue *value1,
const GValue *value2)
gimp_param_rgb_values_cmp (GParamSpec *pspec,
const GValue *value1,
const GValue *value2)
{
GimpRGB *color1;
GimpRGB *color2;
GimpRGB *rgb1;
GimpRGB *rgb2;
color1 = value1->data[0].v_pointer;
color2 = value2->data[0].v_pointer;
rgb1 = value1->data[0].v_pointer;
rgb2 = value2->data[0].v_pointer;
/* try to return at least *something*, it's useless anyway... */
if (! color1)
return color2 != NULL ? -1 : 0;
else if (! color2)
return color1 != NULL;
if (! rgb1)
return rgb2 != NULL ? -1 : 0;
else if (! rgb2)
return rgb1 != NULL;
else
{
guint32 int1, int2;
gimp_rgba_get_uchar (color1,
gimp_rgba_get_uchar (rgb1,
((guchar *) &int1) + 0,
((guchar *) &int1) + 1,
((guchar *) &int1) + 2,
((guchar *) &int1) + 3);
gimp_rgba_get_uchar (color2,
gimp_rgba_get_uchar (rgb2,
((guchar *) &int2) + 0,
((guchar *) &int2) + 1,
((guchar *) &int2) + 2,
@ -172,17 +172,17 @@ gimp_param_color_values_cmp (GParamSpec *pspec,
}
GParamSpec *
gimp_param_spec_color (const gchar *name,
const gchar *nick,
const gchar *blurb,
const GimpRGB *default_value,
GParamFlags flags)
gimp_param_spec_rgb (const gchar *name,
const gchar *nick,
const gchar *blurb,
const GimpRGB *default_value,
GParamFlags flags)
{
GimpParamSpecColor *cspec;
GimpParamSpecRGB *cspec;
g_return_val_if_fail (default_value != NULL, NULL);
cspec = g_param_spec_internal (GIMP_TYPE_PARAM_COLOR,
cspec = g_param_spec_internal (GIMP_TYPE_PARAM_RGB,
name, nick, blurb, flags);
cspec->default_value = *default_value;

View File

@ -52,15 +52,15 @@
/*
* GIMP_TYPE_PARAM_COLOR
* GIMP_TYPE_PARAM_RGB
*/
#define GIMP_TYPE_PARAM_COLOR (gimp_param_color_get_type ())
#define GIMP_IS_PARAM_SPEC_COLOR(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_COLOR))
#define GIMP_TYPE_PARAM_RGB (gimp_param_rgb_get_type ())
#define GIMP_IS_PARAM_SPEC_RGB(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_RGB))
GType gimp_param_color_get_type (void) G_GNUC_CONST;
GType gimp_param_rgb_get_type (void) G_GNUC_CONST;
GParamSpec * gimp_param_spec_color (const gchar *name,
GParamSpec * gimp_param_spec_rgb (const gchar *name,
const gchar *nick,
const gchar *blurb,
const GimpRGB *default_value,
@ -154,10 +154,10 @@ GParamSpec * gimp_param_spec_unit (const gchar *name,
g_param_spec_boolean (name, NULL, blurb,\
default,\
flags | GIMP_CONFIG_PARAM_FLAGS))
#define GIMP_CONFIG_INSTALL_PROP_COLOR(class, id,\
name, blurb, default, flags)\
#define GIMP_CONFIG_INSTALL_PROP_RGB(class, id,\
name, blurb, default, flags)\
g_object_class_install_property (class, id,\
gimp_param_spec_color (name, NULL, blurb,\
gimp_param_spec_rgb (name, NULL, blurb,\
default,\
flags | GIMP_CONFIG_PARAM_FLAGS))
#define GIMP_CONFIG_INSTALL_PROP_DOUBLE(class, id,\

View File

@ -403,17 +403,17 @@ gimp_config_serialize_value (const GValue *value,
return TRUE;
}
if (GIMP_VALUE_HOLDS_COLOR (value))
if (GIMP_VALUE_HOLDS_RGB (value))
{
GimpRGB *color;
GimpRGB *rgb;
gchar buf[4][G_ASCII_DTOSTR_BUF_SIZE];
color = g_value_get_boxed (value);
rgb = g_value_get_boxed (value);
g_ascii_formatd (buf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", color->r);
g_ascii_formatd (buf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", color->g);
g_ascii_formatd (buf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", color->b);
g_ascii_formatd (buf[3], G_ASCII_DTOSTR_BUF_SIZE, "%f", color->a);
g_ascii_formatd (buf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", rgb->r);
g_ascii_formatd (buf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", rgb->g);
g_ascii_formatd (buf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", rgb->b);
g_ascii_formatd (buf[3], G_ASCII_DTOSTR_BUF_SIZE, "%f", rgb->a);
g_string_append_printf (str, "(color-rgba %s %s %s %s)",
buf[0], buf[1], buf[2], buf[3]);

View File

@ -23,12 +23,6 @@
#define __GIMP_CONFIG_TYPES_H__
#define GIMP_TYPE_COLOR (gimp_color_get_type ())
#define GIMP_VALUE_HOLDS_COLOR(value) (G_TYPE_CHECK_VALUE_TYPE ((value), GIMP_TYPE_COLOR))
GType gimp_color_get_type (void) G_GNUC_CONST;
#define GIMP_TYPE_MATRIX2 (gimp_matrix2_get_type ())
#define GIMP_VALUE_HOLDS_MATRIX2(value) (G_TYPE_CHECK_VALUE_TYPE ((value), GIMP_TYPE_MATRIX2))

View File

@ -327,13 +327,13 @@ gimp_scanner_parse_color (GScanner *scanner,
if (! g_scanner_scope_lookup_symbol (scanner, scope_id, "color-rgb"))
{
g_scanner_scope_add_symbol (scanner, scope_id,
g_scanner_scope_add_symbol (scanner, scope_id,
"color-rgb", GINT_TO_POINTER (COLOR_RGB));
g_scanner_scope_add_symbol (scanner, scope_id,
g_scanner_scope_add_symbol (scanner, scope_id,
"color-rgba", GINT_TO_POINTER (COLOR_RGBA));
g_scanner_scope_add_symbol (scanner, scope_id,
g_scanner_scope_add_symbol (scanner, scope_id,
"color-hsv", GINT_TO_POINTER (COLOR_HSV));
g_scanner_scope_add_symbol (scanner, scope_id,
g_scanner_scope_add_symbol (scanner, scope_id,
"color-hsva", GINT_TO_POINTER (COLOR_HSVA));
}

View File

@ -25,6 +25,8 @@
#include <glib-object.h>
#include <gobject/gvaluecollector.h>
#include "libgimpcolor/gimpcolor.h"
#include "core-types.h"
#include "config/gimpconfig-types.h"
@ -115,7 +117,7 @@ gimp_g_value_get_memsize (GValue *value)
}
else if (G_VALUE_HOLDS_BOXED (value))
{
if (GIMP_VALUE_HOLDS_COLOR (value))
if (GIMP_VALUE_HOLDS_RGB (value))
{
memsize += sizeof (GimpRGB);
}

View File

@ -417,7 +417,7 @@ gimp_context_class_init (GimpContextClass *klass)
NULL, NULL,
gimp_marshal_VOID__BOXED,
G_TYPE_NONE, 1,
GIMP_TYPE_COLOR | G_SIGNAL_TYPE_STATIC_SCOPE);
GIMP_TYPE_RGB | G_SIGNAL_TYPE_STATIC_SCOPE);
gimp_context_signals[BACKGROUND_CHANGED] =
g_signal_new ("background_changed",
@ -427,7 +427,7 @@ gimp_context_class_init (GimpContextClass *klass)
NULL, NULL,
gimp_marshal_VOID__BOXED,
G_TYPE_NONE, 1,
GIMP_TYPE_COLOR | G_SIGNAL_TYPE_STATIC_SCOPE);
GIMP_TYPE_RGB | G_SIGNAL_TYPE_STATIC_SCOPE);
gimp_context_signals[OPACITY_CHANGED] =
g_signal_new ("opacity_changed",
@ -588,17 +588,17 @@ gimp_context_class_init (GimpContextClass *klass)
GIMP_TYPE_TOOL_INFO,
0);
GIMP_CONFIG_INSTALL_PROP_COLOR (object_class, GIMP_CONTEXT_PROP_FOREGROUND,
gimp_context_prop_names[GIMP_CONTEXT_PROP_FOREGROUND],
NULL,
&black,
0);
GIMP_CONFIG_INSTALL_PROP_RGB (object_class, GIMP_CONTEXT_PROP_FOREGROUND,
gimp_context_prop_names[GIMP_CONTEXT_PROP_FOREGROUND],
NULL,
&black,
0);
GIMP_CONFIG_INSTALL_PROP_COLOR (object_class, GIMP_CONTEXT_PROP_BACKGROUND,
gimp_context_prop_names[GIMP_CONTEXT_PROP_BACKGROUND],
NULL,
&white,
0);
GIMP_CONFIG_INSTALL_PROP_RGB (object_class, GIMP_CONTEXT_PROP_BACKGROUND,
gimp_context_prop_names[GIMP_CONTEXT_PROP_BACKGROUND],
NULL,
&white,
0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, GIMP_CONTEXT_PROP_OPACITY,
gimp_context_prop_names[GIMP_CONTEXT_PROP_OPACITY],

View File

@ -129,17 +129,17 @@ gimp_grid_class_init (GimpGridClass *klass)
GIMP_TYPE_GRID_STYLE,
GIMP_GRID_INTERSECTIONS,
0);
GIMP_CONFIG_INSTALL_PROP_COLOR (object_class, PROP_FGCOLOR,
"fgcolor",
N_("The foreground color of the grid."),
&black,
0);
GIMP_CONFIG_INSTALL_PROP_COLOR (object_class, PROP_BGCOLOR,
"bgcolor",
N_("The background color of the grid; "
"only used in double dashed line style."),
&white,
0);
GIMP_CONFIG_INSTALL_PROP_RGB (object_class, PROP_FGCOLOR,
"fgcolor",
N_("The foreground color of the grid."),
&black,
0);
GIMP_CONFIG_INSTALL_PROP_RGB (object_class, PROP_BGCOLOR,
"bgcolor",
N_("The background color of the grid; "
"only used in double dashed line style."),
&white,
0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_XSPACING,
"xspacing",
N_("Horizontal spacing of grid lines."),

View File

@ -192,10 +192,10 @@ gimp_display_options_class_init (GimpDisplayOptionsClass *klass)
GIMP_TYPE_CANVAS_PADDING_MODE,
GIMP_CANVAS_PADDING_MODE_DEFAULT,
0);
GIMP_CONFIG_INSTALL_PROP_COLOR (object_class, PROP_PADDING_COLOR,
"padding-color", CANVAS_PADDING_COLOR_BLURB,
&white,
0);
GIMP_CONFIG_INSTALL_PROP_RGB (object_class, PROP_PADDING_COLOR,
"padding-color", CANVAS_PADDING_COLOR_BLURB,
&white,
0);
}
static void
@ -246,10 +246,10 @@ gimp_display_options_fs_class_init (GimpDisplayOptionsClass *klass)
GIMP_TYPE_CANVAS_PADDING_MODE,
GIMP_CANVAS_PADDING_MODE_CUSTOM,
0);
GIMP_CONFIG_INSTALL_PROP_COLOR (object_class, PROP_PADDING_COLOR,
"padding-color", CANVAS_PADDING_COLOR_BLURB,
&black,
0);
GIMP_CONFIG_INSTALL_PROP_RGB (object_class, PROP_PADDING_COLOR,
"padding-color", CANVAS_PADDING_COLOR_BLURB,
&black,
0);
}
static void

View File

@ -193,10 +193,10 @@ gimp_text_class_init (GimpTextClass *klass)
GIMP_TYPE_TEXT_DIRECTION,
GIMP_TEXT_DIRECTION_LTR,
0);
GIMP_CONFIG_INSTALL_PROP_COLOR (object_class, PROP_COLOR,
"color", NULL,
&black,
0);
GIMP_CONFIG_INSTALL_PROP_RGB (object_class, PROP_COLOR,
"color", NULL,
&black,
0);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_OUTLINE,
"outline", NULL,
GIMP_TYPE_TEXT_OUTLINE,

View File

@ -20,6 +20,7 @@
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "tools-types.h"
@ -137,7 +138,7 @@ gimp_color_tool_class_init (GimpColorToolClass *klass)
G_TYPE_NONE, 4,
GIMP_TYPE_COLOR_PICK_STATE,
GIMP_TYPE_IMAGE_TYPE,
GIMP_TYPE_COLOR | G_SIGNAL_TYPE_STATIC_SCOPE,
GIMP_TYPE_RGB | G_SIGNAL_TYPE_STATIC_SCOPE,
G_TYPE_INT);
object_class->finalize = gimp_color_tool_finalize;

View File

@ -115,10 +115,10 @@ gimp_action_class_init (GimpActionClass *klass)
gimp_rgba_set (&black, 0.0, 0.0, 0.0, GIMP_OPACITY_OPAQUE);
g_object_class_install_property (object_class, PROP_COLOR,
gimp_param_spec_color ("color",
NULL, NULL,
&black,
G_PARAM_READWRITE));
gimp_param_spec_rgb ("color",
NULL, NULL,
&black,
G_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_VIEWABLE,
g_param_spec_object ("viewable",

View File

@ -100,11 +100,11 @@ gimp_color_bar_class_init (GimpColorBarClass *klass)
G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class, PROP_COLOR,
gimp_param_spec_color ("color",
NULL, NULL,
&white,
G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT));
gimp_param_spec_rgb ("color",
NULL, NULL,
&white,
G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_ORIENTATION,
g_param_spec_enum ("histogram-channel",
NULL, NULL,

View File

@ -26,6 +26,7 @@
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"
#include "libgimpmath/gimpmath.h"
#include "libgimpbase/gimpbase.h"
#include "libgimpwidgets/gimpwidgets.h"
@ -2552,7 +2553,7 @@ gimp_prop_color_area_new (GObject *config,
GimpRGB *value;
param_spec = check_param_spec (config, property_name,
GIMP_TYPE_PARAM_COLOR, G_STRFUNC);
GIMP_TYPE_PARAM_RGB, G_STRFUNC);
if (! param_spec)
return NULL;
@ -2653,7 +2654,7 @@ gimp_prop_color_button_new (GObject *config,
GimpRGB *value;
param_spec = check_param_spec (config, property_name,
GIMP_TYPE_PARAM_COLOR, G_STRFUNC);
GIMP_TYPE_PARAM_RGB, G_STRFUNC);
if (! param_spec)
return NULL;

View File

@ -67,7 +67,7 @@ static GTokenType gimp_config_deserialize_memsize (GValue *value,
static GTokenType gimp_config_deserialize_path (GValue *value,
GParamSpec *prop_spec,
GScanner *scanner);
static GTokenType gimp_config_deserialize_color (GValue *value,
static GTokenType gimp_config_deserialize_rgb (GValue *value,
GParamSpec *prop_spec,
GScanner *scanner);
static GTokenType gimp_config_deserialize_matrix2 (GValue *value,
@ -351,9 +351,9 @@ gimp_config_deserialize_value (GValue *value,
{
return gimp_config_deserialize_path (value, prop_spec, scanner);
}
else if (prop_spec->value_type == GIMP_TYPE_COLOR)
else if (prop_spec->value_type == GIMP_TYPE_RGB)
{
return gimp_config_deserialize_color (value, prop_spec, scanner);
return gimp_config_deserialize_rgb (value, prop_spec, scanner);
}
else if (prop_spec->value_type == GIMP_TYPE_MATRIX2)
{
@ -622,16 +622,16 @@ gimp_config_deserialize_path (GValue *value,
}
static GTokenType
gimp_config_deserialize_color (GValue *value,
GParamSpec *prop_spec,
GScanner *scanner)
gimp_config_deserialize_rgb (GValue *value,
GParamSpec *prop_spec,
GScanner *scanner)
{
GimpRGB color;
GimpRGB rgb;
if (! gimp_scanner_parse_color (scanner, &color))
if (! gimp_scanner_parse_color (scanner, &rgb))
return G_TOKEN_NONE;
g_value_set_boxed (value, &color);
g_value_set_boxed (value, &rgb);
return G_TOKEN_RIGHT_PAREN;
}

View File

@ -52,15 +52,15 @@
/*
* GIMP_TYPE_PARAM_COLOR
* GIMP_TYPE_PARAM_RGB
*/
#define GIMP_TYPE_PARAM_COLOR (gimp_param_color_get_type ())
#define GIMP_IS_PARAM_SPEC_COLOR(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_COLOR))
#define GIMP_TYPE_PARAM_RGB (gimp_param_rgb_get_type ())
#define GIMP_IS_PARAM_SPEC_RGB(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_RGB))
GType gimp_param_color_get_type (void) G_GNUC_CONST;
GType gimp_param_rgb_get_type (void) G_GNUC_CONST;
GParamSpec * gimp_param_spec_color (const gchar *name,
GParamSpec * gimp_param_spec_rgb (const gchar *name,
const gchar *nick,
const gchar *blurb,
const GimpRGB *default_value,
@ -154,10 +154,10 @@ GParamSpec * gimp_param_spec_unit (const gchar *name,
g_param_spec_boolean (name, NULL, blurb,\
default,\
flags | GIMP_CONFIG_PARAM_FLAGS))
#define GIMP_CONFIG_INSTALL_PROP_COLOR(class, id,\
name, blurb, default, flags)\
#define GIMP_CONFIG_INSTALL_PROP_RGB(class, id,\
name, blurb, default, flags)\
g_object_class_install_property (class, id,\
gimp_param_spec_color (name, NULL, blurb,\
gimp_param_spec_rgb (name, NULL, blurb,\
default,\
flags | GIMP_CONFIG_PARAM_FLAGS))
#define GIMP_CONFIG_INSTALL_PROP_DOUBLE(class, id,\

View File

@ -403,17 +403,17 @@ gimp_config_serialize_value (const GValue *value,
return TRUE;
}
if (GIMP_VALUE_HOLDS_COLOR (value))
if (GIMP_VALUE_HOLDS_RGB (value))
{
GimpRGB *color;
GimpRGB *rgb;
gchar buf[4][G_ASCII_DTOSTR_BUF_SIZE];
color = g_value_get_boxed (value);
rgb = g_value_get_boxed (value);
g_ascii_formatd (buf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", color->r);
g_ascii_formatd (buf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", color->g);
g_ascii_formatd (buf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", color->b);
g_ascii_formatd (buf[3], G_ASCII_DTOSTR_BUF_SIZE, "%f", color->a);
g_ascii_formatd (buf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", rgb->r);
g_ascii_formatd (buf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", rgb->g);
g_ascii_formatd (buf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", rgb->b);
g_ascii_formatd (buf[3], G_ASCII_DTOSTR_BUF_SIZE, "%f", rgb->a);
g_string_append_printf (str, "(color-rgba %s %s %s %s)",
buf[0], buf[1], buf[2], buf[3]);

View File

@ -327,13 +327,13 @@ gimp_scanner_parse_color (GScanner *scanner,
if (! g_scanner_scope_lookup_symbol (scanner, scope_id, "color-rgb"))
{
g_scanner_scope_add_symbol (scanner, scope_id,
g_scanner_scope_add_symbol (scanner, scope_id,
"color-rgb", GINT_TO_POINTER (COLOR_RGB));
g_scanner_scope_add_symbol (scanner, scope_id,
g_scanner_scope_add_symbol (scanner, scope_id,
"color-rgba", GINT_TO_POINTER (COLOR_RGBA));
g_scanner_scope_add_symbol (scanner, scope_id,
g_scanner_scope_add_symbol (scanner, scope_id,
"color-hsv", GINT_TO_POINTER (COLOR_HSV));
g_scanner_scope_add_symbol (scanner, scope_id,
g_scanner_scope_add_symbol (scanner, scope_id,
"color-hsva", GINT_TO_POINTER (COLOR_HSVA));
}

View File

@ -26,6 +26,7 @@
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"
#include "libgimpmath/gimpmath.h"
#include "libgimpbase/gimpbase.h"
#include "libgimpwidgets/gimpwidgets.h"
@ -2552,7 +2553,7 @@ gimp_prop_color_area_new (GObject *config,
GimpRGB *value;
param_spec = check_param_spec (config, property_name,
GIMP_TYPE_PARAM_COLOR, G_STRFUNC);
GIMP_TYPE_PARAM_RGB, G_STRFUNC);
if (! param_spec)
return NULL;
@ -2653,7 +2654,7 @@ gimp_prop_color_button_new (GObject *config,
GimpRGB *value;
param_spec = check_param_spec (config, property_name,
GIMP_TYPE_PARAM_COLOR, G_STRFUNC);
GIMP_TYPE_PARAM_RGB, G_STRFUNC);
if (! param_spec)
return NULL;