Commit 24bd2b13 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

modules/cdisplay_colorblind.c modules/cdisplay_gamma.c

2008-01-09  Michael Natterer  <mitch@gimp.org>

	* modules/cdisplay_colorblind.c
	* modules/cdisplay_gamma.c
	* modules/cdisplay_highcontrast.c
	* modules/cdisplay_lcms.c
	* modules/cdisplay_proof.c
	* modules/colorsel_cmyk.c
	* modules/colorsel_triangle.c
	* modules/colorsel_water.c
	* modules/controller_dx_dinput.c
	* modules/controller_linux_input.c
	* modules/controller_midi.c: use G_DEFINE_DYNAMIC_TYPE() instead
	of boilerplate code.


svn path=/trunk/; revision=24582
parent 51eca41a
2008-01-09 Michael Natterer <mitch@gimp.org>
* modules/cdisplay_colorblind.c
* modules/cdisplay_gamma.c
* modules/cdisplay_highcontrast.c
* modules/cdisplay_lcms.c
* modules/cdisplay_proof.c
* modules/colorsel_cmyk.c
* modules/colorsel_triangle.c
* modules/colorsel_water.c
* modules/controller_dx_dinput.c
* modules/controller_linux_input.c
* modules/controller_midi.c: use G_DEFINE_DYNAMIC_TYPE() instead
of boilerplate code.
2008-01-09 Sven Neumann <sven@gimp.org>
* modules/colorsel_cmyk_lcms.c (colorsel_cmyk_class_init): don't
......
......@@ -48,7 +48,7 @@ typedef enum
} ColorblindDeficiency;
#define CDISPLAY_TYPE_COLORBLIND_DEFICIENCY (cdisplay_colorblind_deficiency_type)
static GType cdisplay_colorblind_deficiency_get_type (GTypeModule *module);
static GType cdisplay_colorblind_deficiency_register_type (GTypeModule *module);
static const GEnumValue enum_values[] =
{
......@@ -76,7 +76,7 @@ static const GimpEnumDesc enum_descs[] =
#define COLOR_CACHE_SIZE 1021
#define CDISPLAY_TYPE_COLORBLIND (cdisplay_colorblind_type)
#define CDISPLAY_TYPE_COLORBLIND (cdisplay_colorblind_get_type ())
#define CDISPLAY_COLORBLIND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CDISPLAY_TYPE_COLORBLIND, CdisplayColorblind))
#define CDISPLAY_COLORBLIND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CDISPLAY_TYPE_COLORBLIND, CdisplayColorblindClass))
#define CDISPLAY_IS_COLORBLIND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CDISPLAY_TYPE_COLORBLIND))
......@@ -113,9 +113,7 @@ enum
};
static GType cdisplay_colorblind_get_type (GTypeModule *module);
static void cdisplay_colorblind_class_init (CdisplayColorblindClass *klass);
static void cdisplay_colorblind_init (CdisplayColorblind *colorblind);
GType cdisplay_colorblind_get_type (void);
static void cdisplay_colorblind_set_property (GObject *object,
guint property_id,
......@@ -205,9 +203,11 @@ static const GimpModuleInfo cdisplay_colorblind_info =
"January 22, 2003"
};
static GType cdisplay_colorblind_type = 0;
static GType cdisplay_colorblind_deficiency_type = 0;
static GimpColorDisplayClass *parent_class = NULL;
G_DEFINE_DYNAMIC_TYPE (CdisplayColorblind, cdisplay_colorblind,
GIMP_TYPE_COLOR_DISPLAY)
static GType cdisplay_colorblind_deficiency_type = 0;
G_MODULE_EXPORT const GimpModuleInfo *
......@@ -219,43 +219,14 @@ gimp_module_query (GTypeModule *module)
G_MODULE_EXPORT gboolean
gimp_module_register (GTypeModule *module)
{
cdisplay_colorblind_get_type (module);
cdisplay_colorblind_deficiency_get_type (module);
cdisplay_colorblind_register_type (module);
cdisplay_colorblind_deficiency_register_type (module);
return TRUE;
}
static GType
cdisplay_colorblind_get_type (GTypeModule *module)
{
if (! cdisplay_colorblind_type)
{
const GTypeInfo display_info =
{
sizeof (CdisplayColorblindClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) cdisplay_colorblind_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (CdisplayColorblind),
0, /* n_preallocs */
(GInstanceInitFunc) cdisplay_colorblind_init,
};
cdisplay_colorblind_type =
g_type_module_register_type (module,
GIMP_TYPE_COLOR_DISPLAY,
"CdisplayColorblind",
&display_info, 0);
}
return cdisplay_colorblind_type;
}
static GType
cdisplay_colorblind_deficiency_get_type (GTypeModule *module)
cdisplay_colorblind_deficiency_register_type (GTypeModule *module)
{
if (! cdisplay_colorblind_deficiency_type)
{
......@@ -278,8 +249,6 @@ cdisplay_colorblind_class_init (CdisplayColorblindClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpColorDisplayClass *display_class = GIMP_COLOR_DISPLAY_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->get_property = cdisplay_colorblind_get_property;
object_class->set_property = cdisplay_colorblind_set_property;
......@@ -298,6 +267,11 @@ cdisplay_colorblind_class_init (CdisplayColorblindClass *klass)
display_class->changed = cdisplay_colorblind_changed;
}
static void
cdisplay_colorblind_class_finalize (CdisplayColorblindClass *klass)
{
}
static void
cdisplay_colorblind_init (CdisplayColorblind *colorblind)
{
......@@ -320,6 +294,7 @@ cdisplay_colorblind_get_property (GObject *object,
case PROP_DEFICIENCY:
g_value_set_enum (value, colorblind->deficiency);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
......@@ -340,6 +315,7 @@ cdisplay_colorblind_set_property (GObject *object,
cdisplay_colorblind_set_deficiency (colorblind,
g_value_get_enum (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
......
......@@ -31,7 +31,7 @@
#define DEFAULT_GAMMA 1.0
#define CDISPLAY_TYPE_GAMMA (cdisplay_gamma_type)
#define CDISPLAY_TYPE_GAMMA (cdisplay_gamma_get_type ())
#define CDISPLAY_GAMMA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CDISPLAY_TYPE_GAMMA, CdisplayGamma))
#define CDISPLAY_GAMMA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CDISPLAY_TYPE_GAMMA, CdisplayGammaClass))
#define CDISPLAY_IS_GAMMA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CDISPLAY_TYPE_GAMMA))
......@@ -62,8 +62,7 @@ enum
};
static GType cdisplay_gamma_get_type (GTypeModule *module);
static void cdisplay_gamma_class_init (CdisplayGammaClass *klass);
GType cdisplay_gamma_get_type (void);
static void cdisplay_gamma_set_property (GObject *object,
guint property_id,
......@@ -95,8 +94,8 @@ static const GimpModuleInfo cdisplay_gamma_info =
"October 14, 2000"
};
static GType cdisplay_gamma_type = 0;
static GimpColorDisplayClass *parent_class = NULL;
G_DEFINE_DYNAMIC_TYPE (CdisplayGamma, cdisplay_gamma,
GIMP_TYPE_COLOR_DISPLAY)
G_MODULE_EXPORT const GimpModuleInfo *
......@@ -108,47 +107,17 @@ gimp_module_query (GTypeModule *module)
G_MODULE_EXPORT gboolean
gimp_module_register (GTypeModule *module)
{
cdisplay_gamma_get_type (module);
cdisplay_gamma_register_type (module);
return TRUE;
}
static GType
cdisplay_gamma_get_type (GTypeModule *module)
{
if (! cdisplay_gamma_type)
{
const GTypeInfo display_info =
{
sizeof (CdisplayGammaClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) cdisplay_gamma_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (CdisplayGamma),
0, /* n_preallocs */
NULL /* instance_init */
};
cdisplay_gamma_type =
g_type_module_register_type (module,
GIMP_TYPE_COLOR_DISPLAY,
"CdisplayGamma",
&display_info, 0);
}
return cdisplay_gamma_type;
}
static void
cdisplay_gamma_class_init (CdisplayGammaClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpColorDisplayClass *display_class = GIMP_COLOR_DISPLAY_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->get_property = cdisplay_gamma_get_property;
object_class->set_property = cdisplay_gamma_set_property;
......@@ -165,6 +134,16 @@ cdisplay_gamma_class_init (CdisplayGammaClass *klass)
display_class->configure = cdisplay_gamma_configure;
}
static void
cdisplay_gamma_class_finalize (CdisplayGammaClass *klass)
{
}
static void
cdisplay_gamma_init (CdisplayGamma *gamma)
{
}
static void
cdisplay_gamma_get_property (GObject *object,
guint property_id,
......
......@@ -31,7 +31,7 @@
#define DEFAULT_CONTRAST 1.0
#define CDISPLAY_TYPE_CONTRAST (cdisplay_contrast_type)
#define CDISPLAY_TYPE_CONTRAST (cdisplay_contrast_get_type ())
#define CDISPLAY_CONTRAST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CDISPLAY_TYPE_CONTRAST, CdisplayContrast))
#define CDISPLAY_CONTRAST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CDISPLAY_TYPE_CONTRAST, CdisplayContrastClass))
#define CDISPLAY_IS_CONTRAST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CDISPLAY_TYPE_CONTRAST))
......@@ -62,8 +62,7 @@ enum
};
static GType cdisplay_contrast_get_type (GTypeModule *module);
static void cdisplay_contrast_class_init (CdisplayContrastClass *klass);
GType cdisplay_contrast_get_type (void);
static void cdisplay_contrast_set_property (GObject *object,
guint property_id,
......@@ -95,8 +94,8 @@ static const GimpModuleInfo cdisplay_contrast_info =
"October 14, 2000"
};
static GType cdisplay_contrast_type = 0;
static GimpColorDisplayClass *parent_class = NULL;
G_DEFINE_DYNAMIC_TYPE (CdisplayContrast, cdisplay_contrast,
GIMP_TYPE_COLOR_DISPLAY)
G_MODULE_EXPORT const GimpModuleInfo *
......@@ -108,47 +107,17 @@ gimp_module_query (GTypeModule *module)
G_MODULE_EXPORT gboolean
gimp_module_register (GTypeModule *module)
{
cdisplay_contrast_get_type (module);
cdisplay_contrast_register_type (module);
return TRUE;
}
static GType
cdisplay_contrast_get_type (GTypeModule *module)
{
if (! cdisplay_contrast_type)
{
const GTypeInfo display_info =
{
sizeof (CdisplayContrastClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) cdisplay_contrast_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (CdisplayContrast),
0, /* n_preallocs */
NULL /* instance_init */
};
cdisplay_contrast_type =
g_type_module_register_type (module,
GIMP_TYPE_COLOR_DISPLAY,
"CdisplayContrast",
&display_info, 0);
}
return cdisplay_contrast_type;
}
static void
cdisplay_contrast_class_init (CdisplayContrastClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpColorDisplayClass *display_class = GIMP_COLOR_DISPLAY_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->get_property = cdisplay_contrast_get_property;
object_class->set_property = cdisplay_contrast_set_property;
......@@ -165,6 +134,16 @@ cdisplay_contrast_class_init (CdisplayContrastClass *klass)
display_class->configure = cdisplay_contrast_configure;
}
static void
cdisplay_contrast_class_finalize (CdisplayContrastClass *klass)
{
}
static void
cdisplay_contrast_init (CdisplayContrast *contrast)
{
}
static void
cdisplay_contrast_get_property (GObject *object,
guint property_id,
......
......@@ -49,7 +49,7 @@
#include "libgimp/libgimp-intl.h"
#define CDISPLAY_TYPE_LCMS (cdisplay_lcms_type)
#define CDISPLAY_TYPE_LCMS (cdisplay_lcms_get_type ())
#define CDISPLAY_LCMS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CDISPLAY_TYPE_LCMS, CdisplayLcms))
#define CDISPLAY_LCMS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CDISPLAY_TYPE_LCMS, CdisplayLcmsClass))
#define CDISPLAY_IS_LCMS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CDISPLAY_TYPE_LCMS))
......@@ -72,9 +72,8 @@ struct _CdisplayLcmsClass
};
static GType cdisplay_lcms_get_type (GTypeModule *module);
static void cdisplay_lcms_class_init (CdisplayLcmsClass *klass);
static void cdisplay_lcms_init (CdisplayLcms *lcms);
GType cdisplay_lcms_get_type (void);
static void cdisplay_lcms_finalize (GObject *object);
static GtkWidget * cdisplay_lcms_configure (GimpColorDisplay *display);
......@@ -111,9 +110,8 @@ static const GimpModuleInfo cdisplay_lcms_info =
"2005 - 2007"
};
static GType cdisplay_lcms_type = 0;
static GimpColorDisplayClass *parent_class = NULL;
G_DEFINE_DYNAMIC_TYPE (CdisplayLcms, cdisplay_lcms,
GIMP_TYPE_COLOR_DISPLAY)
G_MODULE_EXPORT const GimpModuleInfo *
gimp_module_query (GTypeModule *module)
......@@ -124,45 +122,17 @@ gimp_module_query (GTypeModule *module)
G_MODULE_EXPORT gboolean
gimp_module_register (GTypeModule *module)
{
cdisplay_lcms_get_type (module);
cdisplay_lcms_register_type (module);
return TRUE;
}
static GType
cdisplay_lcms_get_type (GTypeModule *module)
{
if (! cdisplay_lcms_type)
{
const GTypeInfo display_info =
{
sizeof (CdisplayLcmsClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) cdisplay_lcms_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (CdisplayLcms),
0, /* n_preallocs */
(GInstanceInitFunc) cdisplay_lcms_init,
};
cdisplay_lcms_type =
g_type_module_register_type (module, GIMP_TYPE_COLOR_DISPLAY,
"CdisplayLcms", &display_info, 0);
}
return cdisplay_lcms_type;
}
static void
cdisplay_lcms_class_init (CdisplayLcmsClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpColorDisplayClass *display_class = GIMP_COLOR_DISPLAY_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = cdisplay_lcms_finalize;
display_class->name = _("Color Management");
......@@ -176,6 +146,11 @@ cdisplay_lcms_class_init (CdisplayLcmsClass *klass)
cmsErrorAction (LCMS_ERROR_IGNORE);
}
static void
cdisplay_lcms_class_finalize (CdisplayLcmsClass *klass)
{
}
static void
cdisplay_lcms_init (CdisplayLcms *lcms)
{
......@@ -193,7 +168,7 @@ cdisplay_lcms_finalize (GObject *object)
lcms->transform = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (cdisplay_lcms_parent_class)->finalize (object);
}
static void
......
......@@ -36,7 +36,7 @@
#include "libgimp/libgimp-intl.h"
#define CDISPLAY_TYPE_PROOF (cdisplay_proof_type)
#define CDISPLAY_TYPE_PROOF (cdisplay_proof_get_type ())
#define CDISPLAY_PROOF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CDISPLAY_TYPE_PROOF, CdisplayProof))
#define CDISPLAY_PROOF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CDISPLAY_TYPE_PROOF, CdisplayProofClass))
#define CDISPLAY_IS_PROOF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CDISPLAY_TYPE_PROOF))
......@@ -72,9 +72,7 @@ enum
};
static GType cdisplay_proof_get_type (GTypeModule *module);
static void cdisplay_proof_class_init (CdisplayProofClass *klass);
static void cdisplay_proof_init (CdisplayProof *proof);
GType cdisplay_proof_get_type (void);
static void cdisplay_proof_finalize (GObject *object);
static void cdisplay_proof_get_property (GObject *object,
......@@ -107,9 +105,8 @@ static const GimpModuleInfo cdisplay_proof_info =
"November 14, 2003"
};
static GType cdisplay_proof_type = 0;
static GimpColorDisplayClass *parent_class = NULL;
G_DEFINE_DYNAMIC_TYPE (CdisplayProof, cdisplay_proof,
GIMP_TYPE_COLOR_DISPLAY)
G_MODULE_EXPORT const GimpModuleInfo *
gimp_module_query (GTypeModule *module)
......@@ -120,45 +117,17 @@ gimp_module_query (GTypeModule *module)
G_MODULE_EXPORT gboolean
gimp_module_register (GTypeModule *module)
{
cdisplay_proof_get_type (module);
cdisplay_proof_register_type (module);
return TRUE;
}
static GType
cdisplay_proof_get_type (GTypeModule *module)
{
if (! cdisplay_proof_type)
{
const GTypeInfo display_info =
{
sizeof (CdisplayProofClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) cdisplay_proof_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (CdisplayProof),
0, /* n_preallocs */
(GInstanceInitFunc) cdisplay_proof_init,
};
cdisplay_proof_type =
g_type_module_register_type (module, GIMP_TYPE_COLOR_DISPLAY,
"CdisplayProof", &display_info, 0);
}
return cdisplay_proof_type;
}
static void
cdisplay_proof_class_init (CdisplayProofClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpColorDisplayClass *display_class = GIMP_COLOR_DISPLAY_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = cdisplay_proof_finalize;
object_class->get_property = cdisplay_proof_get_property;
object_class->set_property = cdisplay_proof_set_property;
......@@ -188,6 +157,11 @@ cdisplay_proof_class_init (CdisplayProofClass *klass)
cmsErrorAction (LCMS_ERROR_IGNORE);
}
static void
cdisplay_proof_class_finalize (CdisplayProofClass *klass)
{
}
static void
cdisplay_proof_init (CdisplayProof *proof)
{
......@@ -205,13 +179,14 @@ cdisplay_proof_finalize (GObject *object)
g_free (proof->profile);
proof->profile = NULL;
}
if (proof->transform)
{
cmsDeleteTransform (proof->transform);
proof->transform = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
G_OBJECT_CLASS (cdisplay_proof_parent_class)->finalize (object);
}
static void
......
......@@ -29,7 +29,7 @@
/* definitions and variables */
#define COLORSEL_TYPE_CMYK (colorsel_cmyk_type)
#define COLORSEL_TYPE_CMYK (colorsel_cmyk_get_type ())
#define COLORSEL_CMYK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), COLORSEL_TYPE_CMYK, ColorselCmyk))
#define COLORSEL_CMYK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), COLORSEL_TYPE_CMYK, ColorselCmykClass))
#define COLORSEL_IS_CMYK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), COLORSEL_TYPE_CMYK))
......@@ -54,9 +54,7 @@ struct _ColorselCmykClass
};
static GType colorsel_cmyk_get_type (GTypeModule *module);
static void colorsel_cmyk_class_init (ColorselCmykClass *klass);
static void colorsel_cmyk_init (ColorselCmyk *cmyk);
GType colorsel_cmyk_get_type (void);
static void colorsel_cmyk_set_color (GimpColorSelector *selector,
const GimpRGB *rgb,
......@@ -77,7 +75,9 @@ static const GimpModuleInfo colorsel_cmyk_info =
"July 2003"
};
static GType colorsel_cmyk_type = 0;
G_DEFINE_DYNAMIC_TYPE (ColorselCmyk, colorsel_cmyk,
GIMP_TYPE_COLOR_SELECTOR)
G_MODULE_EXPORT const GimpModuleInfo *
......@@ -89,39 +89,11 @@ gimp_module_query (GTypeModule *module)
G_MODULE_EXPORT gboolean
gimp_module_register (GTypeModule *module)
{
colorsel_cmyk_get_type (module);
colorsel_cmyk_register_type (module);
return TRUE;
}
static GType
colorsel_cmyk_get_type (GTypeModule *module)
{
if (! colorsel_cmyk_type)
{
const GTypeInfo select_info =
{
sizeof (ColorselCmykClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) colorsel_cmyk_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (ColorselCmyk),
0, /* n_preallocs */
(GInstanceInitFunc) colorsel_cmyk_init,
};
colorsel_cmyk_type =
g_type_module_register_type (module,
GIMP_TYPE_COLOR_SELECTOR,
"ColorselCmyk",
&select_info, 0);
}
return colorsel_cmyk_type;
}
static void
colorsel_cmyk_class_init (ColorselCmykClass *klass)
{
......@@ -133,6 +105,11 @@ colorsel_cmyk_class_init (ColorselCmykClass *klass)
selector_class->set_color = colorsel_cmyk_set_color;
}
static void
colorsel_cmyk_class_finalize (ColorselCmykClass *klass)
{
}
static void
colorsel_cmyk_init (ColorselCmyk *module)
{
......
......@@ -42,7 +42,7 @@
GDK_BUTTON_MOTION_MASK )
#define COLORSEL_TYPE_TRIANGLE (colorsel_triangle_type)
#define COLORSEL_TYPE_TRIANGLE (colorsel_triangle_get_type ())
#define COLORSEL_TRIANGLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), COLORSEL_TYPE_TRIANGLE, ColorselTriangle))
#define COLORSEL_TRIANGLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), COLORSEL_TYPE_TRIANGLE, ColorselTriangleClass))
#define COLORSEL_IS_TRIANGLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), COLORSEL_TYPE_TRIANGLE))
......@@ -70,15 +70,13 @@ struct _ColorselTriangleClass
};
static GType colorsel_triangle_get_type (GTypeModule *module);
static void colorsel_triangle_class_init (ColorselTriangleClass *klass);
static void colorsel_triangle_init (ColorselTriangle *triangle);
GType colorsel_triangle_get_type (void);
static void colorsel_triangle_set_color (GimpColorSelector *selector,
static void colorsel_triangle_set_color (GimpColorSelector *selector,
const GimpRGB *rgb,
const GimpHSV *hsv);
static void colorsel_xy_to_triangle_buf (gint x,
static void colorsel_xy_to_triangle_buf (gint x,
gint y,
gdouble hue,
guchar *buf,
......@@ -89,12 +87,12 @@ static void colorsel_xy_to_triangle_buf (gint x,
gint hx,
gint hy);
static GtkWidget *colorsel_triangle_create_preview (ColorselTriangle *triangle);
static void colorsel_triangle_update_preview (ColorselTriangle *triangle);
static void colorsel_triangle_size_allocate (GtkWidget *widget,
static GtkWidget * colorsel_triangle_create_preview (ColorselTriangle *triangle);
static void colorsel_triangle_update_preview (ColorselTriangle *triangle);
static void colorsel_triangle_size_allocate (GtkWidget *widget,
GtkAllocation *allocation,
ColorselTriangle *triangle);
static gboolean colorsel_triangle_event (GtkWidget *widget,
static gboolean colorsel_triangle_event (GtkWidget *widget,
GdkEvent *event,
ColorselTriangle *triangle);
......@@ -114,8 +112,8 @@ static const GtkTargetEntry targets[] =
};
static GType colorsel_triangle_type = 0;
static GimpColorSelectorClass *parent_class = NULL;
G_DEFINE_DYNAMIC_TYPE (ColorselTriangle, colorsel_triangle,
GIMP_TYPE_COLOR_SELECTOR)
G_MODULE_EXPORT const GimpModuleInfo *
......@@ -127,52 +125,27 @@ gimp_module_query (GTypeModule *module)
G_MODULE_EXPORT gboolean
gimp_module_register (GTypeModule *module)
{
colorsel_triangle_get_type (module);
colorsel_triangle_register_type (module);
return TRUE;
}
static GType
colorsel_triangle_get_type (GTypeModule *module)
{
if (! colorsel_triangle_type)
{
const GTypeInfo select_info =
{
sizeof (ColorselTriangleClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) colorsel_triangle_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (ColorselTriangle),
0, /* n_preallocs */
(GInstanceInitFunc) colorsel_triangle_init,
};
colorsel_triangle_type =
g_type_module_register_type (module,
GIMP_TYPE_COLOR_SELECTOR,
"ColorselTriangle",
&select_info, 0);
}
return colorsel_triangle_type;
}
static void
colorsel_triangle_class_init (ColorselTriangleClass *klass)
{
GimpColorSelectorClass *selector_class = GIMP_COLOR_SELECTOR_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
selector_class->name = _("Triangle");
selector_class->help_id = "gimp-colorselector-triangle";
selector_class->stock_id = GIMP_STOCK_COLOR_TRIANGLE;
selector_class->set_color = colorsel_triangle_set_color;
}
static void
colorsel_triangle_class_finalize (ColorselTriangleClass *klass)
{
}
static void
colorsel_triangle_init (ColorselTriangle *triangle)
{
......
......@@ -32,7 +32,7 @@
#include "libgimp/libgimp-intl.h"
#define COLORSEL_TYPE_WATER (colorsel_water_type)
#define COLORSEL_TYPE_WATER (colorsel_water_get_type ())
#define COLORSEL_WATER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), COLORSEL_TYPE_WATER, ColorselWater))
#define COLORSEL_WATER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), COLORSEL_TYPE_WATER, ColorselWaterClass))
#define COLORSEL_IS_WATER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), COLORSEL_TYPE_WATER))
......@@ -59,23 +59,21 @@ struct _ColorselWaterClass
};
static GType colorsel_water_get_type (GTypeModule *module);
static void colorsel_water_class_init (ColorselWaterClass *klass);
static void colorsel_water_init (ColorselWater *water);
GType colorsel_water_get_type (void);
static void select_area_expose (GtkWidget *widget,
GdkEventExpose *event);
static gboolean button_press_event (GtkWidget *widget,
GdkEventButton *event,
ColorselWater *water);