From 8b8c784a5bdca679b535a20c7f8fee4acc0d6782 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Tue, 13 Dec 2005 09:13:50 +0000 Subject: [PATCH] port to G_DEFINE_TYPE() and friends. Some related cleanup. 2005-12-13 Michael Natterer * app/tools/*.c: port to G_DEFINE_TYPE() and friends. Some related cleanup. --- ChangeLog | 5 + app/tools/gimpairbrushtool.c | 31 +-- app/tools/gimpalignoptions.c | 68 ++--- app/tools/gimpaligntool.c | 229 +++++++--------- app/tools/gimpblendoptions.c | 39 +-- app/tools/gimpblendtool.c | 82 ++---- app/tools/gimpbrightnesscontrasttool.c | 108 +++----- app/tools/gimpbrushtool.c | 35 +-- app/tools/gimpbucketfilloptions.c | 40 +-- app/tools/gimpbucketfilltool.c | 82 ++---- app/tools/gimpbycolorselecttool.c | 41 +-- app/tools/gimpclonetool.c | 77 ++---- app/tools/gimpcolorbalancetool.c | 90 ++----- app/tools/gimpcolorizetool.c | 70 +---- app/tools/gimpcoloroptions.c | 35 +-- app/tools/gimpcolorpickeroptions.c | 40 +-- app/tools/gimpcolorpickertool.c | 43 +-- app/tools/gimpcolortool.c | 40 +-- app/tools/gimpconvolvetool.c | 57 +--- app/tools/gimpcropoptions.c | 58 +--- app/tools/gimpcroptool.c | 57 +--- app/tools/gimpcurvestool.c | 85 ++---- app/tools/gimpdodgeburntool.c | 37 +-- app/tools/gimpdrawtool.c | 336 +++++++++++------------- app/tools/gimpeditselectiontool.c | 42 +-- app/tools/gimpellipseselecttool.c | 38 +-- app/tools/gimperasertool.c | 57 +--- app/tools/gimpflipoptions.c | 56 ++-- app/tools/gimpfliptool.c | 40 +-- app/tools/gimpforegroundselectoptions.c | 51 ++-- app/tools/gimpforegroundselecttool.c | 39 +-- app/tools/gimpfreeselecttool.c | 65 ++--- app/tools/gimpfuzzyselecttool.c | 38 +-- app/tools/gimphistogramoptions.c | 40 +-- app/tools/gimphuesaturationtool.c | 74 ++---- app/tools/gimpimagemapoptions.c | 40 +-- app/tools/gimpimagemaptool.c | 73 ++--- app/tools/gimpinktool.c | 45 +--- app/tools/gimpiscissorstool.c | 42 +-- app/tools/gimplevelstool.c | 83 ++---- app/tools/gimpmagnifyoptions.c | 40 +-- app/tools/gimpmagnifytool.c | 40 +-- app/tools/gimpmeasureoptions.c | 56 ++-- app/tools/gimpmeasuretool.c | 37 +-- app/tools/gimpmoveoptions.c | 55 +--- app/tools/gimpmovetool.c | 37 +-- app/tools/gimpnewrectselectoptions.c | 54 +--- app/tools/gimpnewrectselecttool.c | 57 +--- app/tools/gimppaintbrushtool.c | 29 +- app/tools/gimppainttool.c | 35 +-- app/tools/gimppenciltool.c | 29 +- app/tools/gimpperspectivetool.c | 40 +-- app/tools/gimpposterizetool.c | 72 ++--- app/tools/gimprectangleselectoptions.c | 54 +--- app/tools/gimprectangleselecttool.c | 57 +--- app/tools/gimprectselecttool.c | 42 +-- app/tools/gimpregionselecttool.c | 38 +-- app/tools/gimprotatetool.c | 52 +--- app/tools/gimpscaletool.c | 52 +--- app/tools/gimpselectionoptions.c | 40 +-- app/tools/gimpselectiontool.c | 35 +-- app/tools/gimpsheartool.c | 39 +-- app/tools/gimpsmudgetool.c | 31 +-- app/tools/gimpsourcetool.c | 77 ++---- app/tools/gimptextoptions.c | 35 +-- app/tools/gimptexttool.c | 41 +-- app/tools/gimpthresholdtool.c | 75 ++---- app/tools/gimptool.c | 37 +-- app/tools/gimptoolcontrol.c | 37 +-- app/tools/gimptransformoptions.c | 40 +-- app/tools/gimptransformtool.c | 34 +-- app/tools/gimpvectoroptions.c | 55 +--- app/tools/gimpvectortool.c | 47 +--- 73 files changed, 927 insertions(+), 3180 deletions(-) diff --git a/ChangeLog b/ChangeLog index c4a754d5e5..616bbeb95f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-12-13 Michael Natterer + + * app/tools/*.c: port to G_DEFINE_TYPE() and friends. Some related + cleanup. + 2005-12-12 Michael Schumacher * plug-ins/script-fu/siod/slib.c: added a fix for the script-fu diff --git a/app/tools/gimpairbrushtool.c b/app/tools/gimpairbrushtool.c index ed12191a6f..91a7098b26 100644 --- a/app/tools/gimpairbrushtool.c +++ b/app/tools/gimpairbrushtool.c @@ -37,10 +37,12 @@ #include "gimp-intl.h" -static void gimp_airbrush_tool_init (GimpAirbrushTool *airbrush); static GtkWidget * gimp_airbrush_options_gui (GimpToolOptions *tool_options); +G_DEFINE_TYPE (GimpAirbrushTool, gimp_airbrush_tool, GIMP_TYPE_PAINTBRUSH_TOOL); + + void gimp_airbrush_tool_register (GimpToolRegisterCallback callback, gpointer data) @@ -59,32 +61,9 @@ gimp_airbrush_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_airbrush_tool_get_type (void) +static void +gimp_airbrush_tool_class_init (GimpAirbrushToolClass *klass) { - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpAirbrushToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - NULL, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpAirbrushTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_airbrush_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_PAINTBRUSH_TOOL, - "GimpAirbrushTool", - &tool_info, 0); - } - - return tool_type; } static void diff --git a/app/tools/gimpalignoptions.c b/app/tools/gimpalignoptions.c index 175690169a..3611e3278c 100644 --- a/app/tools/gimpalignoptions.c +++ b/app/tools/gimpalignoptions.c @@ -42,56 +42,24 @@ enum }; -static void gimp_align_options_class_init (GimpAlignOptionsClass *options_class); - -static void gimp_align_options_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec); -static void gimp_align_options_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec); +static void gimp_align_options_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec); +static void gimp_align_options_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec); -static GimpToolOptionsClass *parent_class = NULL; +G_DEFINE_TYPE (GimpAlignOptions, gimp_align_options, GIMP_TYPE_TOOL_OPTIONS); -GType -gimp_align_options_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo info = - { - sizeof (GimpAlignOptionsClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_align_options_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpAlignOptions), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL - }; - - type = g_type_register_static (GIMP_TYPE_TOOL_OPTIONS, - "GimpAlignOptions", - &info, 0); - } - - return type; -} - static void gimp_align_options_class_init (GimpAlignOptionsClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->set_property = gimp_align_options_set_property; object_class->get_property = gimp_align_options_get_property; @@ -102,11 +70,16 @@ gimp_align_options_class_init (GimpAlignOptionsClass *klass) 0); } +static void +gimp_align_options_init (GimpAlignOptions *options) +{ +} + static void gimp_align_options_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) + guint property_id, + const GValue *value, + GParamSpec *pspec) { GimpAlignOptions *options = GIMP_ALIGN_OPTIONS (object); @@ -123,9 +96,9 @@ gimp_align_options_set_property (GObject *object, static void gimp_align_options_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) + guint property_id, + GValue *value, + GParamSpec *pspec) { GimpAlignOptions *options = GIMP_ALIGN_OPTIONS (object); @@ -173,4 +146,3 @@ gimp_align_options_gui (GimpToolOptions *tool_options) return vbox; } - diff --git a/app/tools/gimpaligntool.c b/app/tools/gimpaligntool.c index ee62ad7e9b..9c2f5078a1 100644 --- a/app/tools/gimpaligntool.c +++ b/app/tools/gimpaligntool.c @@ -41,51 +41,52 @@ #include "gimp-intl.h" + /* local function prototypes */ -static void gimp_align_tool_class_init (GimpAlignToolClass *klass); -static void gimp_align_tool_init (GimpAlignTool *align_tool); - -static GObject * gimp_align_tool_constructor (GType type, - guint n_params, +static GObject * gimp_align_tool_constructor (GType type, + guint n_params, GObjectConstructParam *params); -static void gimp_align_tool_dispose (GObject *object); -static gboolean gimp_align_tool_initialize (GimpTool *tool, - GimpDisplay *gdisp); -static void gimp_align_tool_finalize (GObject *object); +static void gimp_align_tool_dispose (GObject *object); +static gboolean gimp_align_tool_initialize (GimpTool *tool, + GimpDisplay *gdisp); +static void gimp_align_tool_finalize (GObject *object); static void gimp_align_tool_button_press (GimpTool *tool, - GimpCoords *coords, - guint32 time, - GdkModifierType state, - GimpDisplay *gdisp); + GimpCoords *coords, + guint32 time, + GdkModifierType state, + GimpDisplay *gdisp); static void gimp_align_tool_cursor_update (GimpTool *tool, - GimpCoords *coords, - GdkModifierType state, - GimpDisplay *gdisp); + GimpCoords *coords, + GdkModifierType state, + GimpDisplay *gdisp); static void gimp_align_tool_draw (GimpDrawTool *draw_tool); -static GtkWidget *button_with_stock (GimpAlignmentType action, - GimpAlignTool *align_tool); -static GtkWidget *gimp_align_tool_controls (GimpAlignTool *align_tool); -static void set_action (GtkWidget *widget, - gpointer data); -static void do_horizontal_alignment (GtkWidget *widget, - gpointer data); -static void do_vertical_alignment (GtkWidget *widget, - gpointer data); -static void clear_reference (GimpItem *reference_item, - GimpAlignTool *align_tool); -static void clear_target (GimpItem *target_item, - GimpAlignTool *align_tool); +static GtkWidget *button_with_stock (GimpAlignmentType action, + GimpAlignTool *align_tool); +static GtkWidget *gimp_align_tool_controls (GimpAlignTool *align_tool); +static void set_action (GtkWidget *widget, + gpointer data); +static void do_horizontal_alignment (GtkWidget *widget, + gpointer data); +static void do_vertical_alignment (GtkWidget *widget, + gpointer data); +static void clear_reference (GimpItem *reference_item, + GimpAlignTool *align_tool); +static void clear_target (GimpItem *target_item, + GimpAlignTool *align_tool); -static GimpDrawToolClass *parent_class = NULL; + +G_DEFINE_TYPE (GimpAlignTool, gimp_align_tool, GIMP_TYPE_DRAW_TOOL); + +#define parent_class gimp_align_tool_parent_class void gimp_align_tool_register (GimpToolRegisterCallback callback, - gpointer data) + gpointer data) { (* callback) (GIMP_TYPE_ALIGN_TOOL, GIMP_TYPE_ALIGN_OPTIONS, @@ -100,34 +101,6 @@ gimp_align_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_align_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpAlignToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_align_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpAlignTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_align_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_DRAW_TOOL, - "GimpAlignTool", - &tool_info, 0); - } - - return tool_type; -} - static void gimp_align_tool_class_init (GimpAlignToolClass *klass) { @@ -135,11 +108,10 @@ gimp_align_tool_class_init (GimpAlignToolClass *klass) GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->finalize = gimp_align_tool_finalize; object_class->constructor = gimp_align_tool_constructor; object_class->dispose = gimp_align_tool_dispose; + tool_class->initialize = gimp_align_tool_initialize; tool_class->button_press = gimp_align_tool_button_press; tool_class->cursor_update = gimp_align_tool_cursor_update; @@ -147,66 +119,6 @@ gimp_align_tool_class_init (GimpAlignToolClass *klass) draw_tool_class->draw = gimp_align_tool_draw; } -static void -gimp_align_tool_dispose (GObject *object) -{ - GimpAlignTool *align_tool = GIMP_ALIGN_TOOL (object); - - if (align_tool->reference_item) - { - g_signal_handlers_disconnect_by_func (align_tool->reference_item, - G_CALLBACK (clear_reference), - (gpointer) align_tool); - align_tool->reference_item = NULL; - } - - if (align_tool->target_item) - { - g_signal_handlers_disconnect_by_func (align_tool->target_item, - G_CALLBACK (clear_target), - (gpointer) align_tool); - align_tool->target_item = NULL; - } - - G_OBJECT_CLASS (parent_class)->dispose (object); -} - -static void -gimp_align_tool_finalize (GObject *object) -{ - GimpTool *tool = GIMP_TOOL (object); - GimpAlignTool *align_tool = GIMP_ALIGN_TOOL (object); - - if (gimp_draw_tool_is_active (GIMP_DRAW_TOOL (object))) - gimp_draw_tool_stop (GIMP_DRAW_TOOL (object)); - - if (gimp_tool_control_is_active (tool->control)) - gimp_tool_control_halt (tool->control); - - if (align_tool->controls) - { - gtk_widget_destroy (align_tool->controls); - align_tool->controls = NULL; - } - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static gboolean -gimp_align_tool_initialize (GimpTool *tool, - GimpDisplay *gdisp) -{ - GimpAlignTool *align_tool = GIMP_ALIGN_TOOL (tool); - - if (tool->gdisp != gdisp) - { -/* align_tool->target_item = NULL; */ -/* align_tool->reference_item = NULL; */ - } - - return TRUE; -} - static void gimp_align_tool_init (GimpAlignTool *align_tool) { @@ -261,12 +173,72 @@ gimp_align_tool_constructor (GType type, return object; } +static void +gimp_align_tool_dispose (GObject *object) +{ + GimpAlignTool *align_tool = GIMP_ALIGN_TOOL (object); + + if (align_tool->reference_item) + { + g_signal_handlers_disconnect_by_func (align_tool->reference_item, + G_CALLBACK (clear_reference), + (gpointer) align_tool); + align_tool->reference_item = NULL; + } + + if (align_tool->target_item) + { + g_signal_handlers_disconnect_by_func (align_tool->target_item, + G_CALLBACK (clear_target), + (gpointer) align_tool); + align_tool->target_item = NULL; + } + + G_OBJECT_CLASS (parent_class)->dispose (object); +} + +static void +gimp_align_tool_finalize (GObject *object) +{ + GimpTool *tool = GIMP_TOOL (object); + GimpAlignTool *align_tool = GIMP_ALIGN_TOOL (object); + + if (gimp_draw_tool_is_active (GIMP_DRAW_TOOL (object))) + gimp_draw_tool_stop (GIMP_DRAW_TOOL (object)); + + if (gimp_tool_control_is_active (tool->control)) + gimp_tool_control_halt (tool->control); + + if (align_tool->controls) + { + gtk_widget_destroy (align_tool->controls); + align_tool->controls = NULL; + } + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +static gboolean +gimp_align_tool_initialize (GimpTool *tool, + GimpDisplay *gdisp) +{ + GimpAlignTool *align_tool = GIMP_ALIGN_TOOL (tool); + + if (tool->gdisp != gdisp) + { +/* align_tool->target_item = NULL; */ +/* align_tool->reference_item = NULL; */ + } + + return TRUE; +} + static void gimp_align_tool_button_press (GimpTool *tool, - GimpCoords *coords, - guint32 time, - GdkModifierType state, - GimpDisplay *gdisp) + GimpCoords *coords, + guint32 time, + GdkModifierType state, + GimpDisplay *gdisp) { GimpAlignTool *align_tool = GIMP_ALIGN_TOOL (tool); GimpAlignOptions *options = GIMP_ALIGN_OPTIONS (tool->tool_info->tool_options); @@ -355,9 +327,9 @@ gimp_align_tool_button_press (GimpTool *tool, static void gimp_align_tool_cursor_update (GimpTool *tool, - GimpCoords *coords, - GdkModifierType state, - GimpDisplay *gdisp) + GimpCoords *coords, + GdkModifierType state, + GimpDisplay *gdisp) { GimpAlignOptions *options = GIMP_ALIGN_OPTIONS (tool->tool_info->tool_options); @@ -757,4 +729,3 @@ clear_reference (GimpItem *reference_item, gimp_draw_tool_resume (GIMP_DRAW_TOOL (align_tool)); } - diff --git a/app/tools/gimpblendoptions.c b/app/tools/gimpblendoptions.c index 231499f836..17475c230b 100644 --- a/app/tools/gimpblendoptions.c +++ b/app/tools/gimpblendoptions.c @@ -50,8 +50,6 @@ enum }; -static void gimp_blend_options_class_init (GimpBlendOptionsClass *klass); - static void gimp_blend_options_set_property (GObject *object, guint property_id, const GValue *value, @@ -66,44 +64,14 @@ static void blend_options_gradient_type_notify (GimpBlendOptions *options, GtkWidget *repeat_combo); -static GimpPaintOptionsClass *parent_class = NULL; +G_DEFINE_TYPE (GimpBlendOptions, gimp_blend_options, GIMP_TYPE_PAINT_OPTIONS); -GType -gimp_blend_options_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo info = - { - sizeof (GimpBlendOptionsClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_blend_options_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpBlendOptions), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL - }; - - type = g_type_register_static (GIMP_TYPE_PAINT_OPTIONS, - "GimpBlendOptions", - &info, 0); - } - - return type; -} - static void gimp_blend_options_class_init (GimpBlendOptionsClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->set_property = gimp_blend_options_set_property; object_class->get_property = gimp_blend_options_get_property; @@ -141,6 +109,11 @@ gimp_blend_options_class_init (GimpBlendOptionsClass *klass) 0); } +static void +gimp_blend_options_init (GimpBlendOptions *options) +{ +} + static void gimp_blend_options_set_property (GObject *object, guint property_id, diff --git a/app/tools/gimpblendtool.c b/app/tools/gimpblendtool.c index db04c6d487..7d87c52e19 100644 --- a/app/tools/gimpblendtool.c +++ b/app/tools/gimpblendtool.c @@ -52,39 +52,34 @@ /* local function prototypes */ -static void gimp_blend_tool_class_init (GimpBlendToolClass *klass); -static void gimp_blend_tool_init (GimpBlendTool *blend_tool); +static void gimp_blend_tool_button_press (GimpTool *tool, + GimpCoords *coords, + guint32 time, + GdkModifierType state, + GimpDisplay *gdisp); +static void gimp_blend_tool_button_release (GimpTool *tool, + GimpCoords *coords, + guint32 time, + GdkModifierType state, + GimpDisplay *gdisp); +static void gimp_blend_tool_motion (GimpTool *tool, + GimpCoords *coords, + guint32 time, + GdkModifierType state, + GimpDisplay *gdisp); +static void gimp_blend_tool_cursor_update (GimpTool *tool, + GimpCoords *coords, + GdkModifierType state, + GimpDisplay *gdisp); -static void gimp_blend_tool_button_press (GimpTool *tool, - GimpCoords *coords, - guint32 time, - GdkModifierType state, - GimpDisplay *gdisp); -static void gimp_blend_tool_button_release (GimpTool *tool, - GimpCoords *coords, - guint32 time, - GdkModifierType state, - GimpDisplay *gdisp); -static void gimp_blend_tool_motion (GimpTool *tool, - GimpCoords *coords, - guint32 time, - GdkModifierType state, - GimpDisplay *gdisp); -static void gimp_blend_tool_cursor_update (GimpTool *tool, - GimpCoords *coords, - GdkModifierType state, - GimpDisplay *gdisp); - -static void gimp_blend_tool_draw (GimpDrawTool *draw_tool); +static void gimp_blend_tool_draw (GimpDrawTool *draw_tool); -/* private variables */ +G_DEFINE_TYPE (GimpBlendTool, gimp_blend_tool, GIMP_TYPE_DRAW_TOOL); -static GimpDrawToolClass *parent_class = NULL; +#define parent_class gimp_blend_tool_parent_class -/* public functions */ - void gimp_blend_tool_register (GimpToolRegisterCallback callback, gpointer data) @@ -106,45 +101,12 @@ gimp_blend_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_blend_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpBlendToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_blend_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpBlendTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_blend_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_DRAW_TOOL, - "GimpBlendTool", - &tool_info, 0); - } - - return tool_type; -} - - -/* private functions */ - static void gimp_blend_tool_class_init (GimpBlendToolClass *klass) { GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - tool_class->button_press = gimp_blend_tool_button_press; tool_class->button_release = gimp_blend_tool_button_release; tool_class->motion = gimp_blend_tool_motion; diff --git a/app/tools/gimpbrightnesscontrasttool.c b/app/tools/gimpbrightnesscontrasttool.c index 77ac0be2e6..246e0eebf7 100644 --- a/app/tools/gimpbrightnesscontrasttool.c +++ b/app/tools/gimpbrightnesscontrasttool.c @@ -50,9 +50,6 @@ #define ALL (BRIGHTNESS | CONTRAST) -static void gimp_brightness_contrast_tool_class_init (GimpBrightnessContrastToolClass *klass); -static void gimp_brightness_contrast_tool_init (GimpBrightnessContrastTool *bc_tool); - static void gimp_brightness_contrast_tool_finalize (GObject *object); static gboolean gimp_brightness_contrast_tool_initialize (GimpTool *tool, @@ -85,10 +82,11 @@ static void brightness_contrast_contrast_adjustment_update (GtkAdjustment gpointer data); -static GimpImageMapToolClass *parent_class = NULL; +G_DEFINE_TYPE (GimpBrightnessContrastTool, gimp_brightness_contrast_tool, + GIMP_TYPE_IMAGE_MAP_TOOL); +#define parent_class gimp_brightness_contrast_tool_parent_class -/* functions */ void gimp_brightness_contrast_tool_register (GimpToolRegisterCallback callback, @@ -106,60 +104,25 @@ gimp_brightness_contrast_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_brightness_contrast_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpBrightnessContrastToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_brightness_contrast_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpBrightnessContrastTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_brightness_contrast_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_IMAGE_MAP_TOOL, - "GimpBrightnessContrastTool", - &tool_info, 0); - } - - return tool_type; -} - static void gimp_brightness_contrast_tool_class_init (GimpBrightnessContrastToolClass *klass) { - GObjectClass *object_class; - GimpToolClass *tool_class; - GimpImageMapToolClass *image_map_tool_class; + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); + GimpImageMapToolClass *im_tool_class = GIMP_IMAGE_MAP_TOOL_CLASS (klass); - object_class = G_OBJECT_CLASS (klass); - tool_class = GIMP_TOOL_CLASS (klass); - image_map_tool_class = GIMP_IMAGE_MAP_TOOL_CLASS (klass); - - parent_class = g_type_class_peek_parent (klass); - - object_class->finalize = gimp_brightness_contrast_tool_finalize; - - tool_class->initialize = gimp_brightness_contrast_tool_initialize; + object_class->finalize = gimp_brightness_contrast_tool_finalize; + tool_class->initialize = gimp_brightness_contrast_tool_initialize; tool_class->button_press = gimp_brightness_contrast_tool_button_press; tool_class->button_release = gimp_brightness_contrast_tool_button_release; tool_class->motion = gimp_brightness_contrast_tool_motion; - image_map_tool_class->shell_desc = _("Adjust Brightness and Contrast"); + im_tool_class->shell_desc = _("Adjust Brightness and Contrast"); - image_map_tool_class->map = gimp_brightness_contrast_tool_map; - image_map_tool_class->dialog = gimp_brightness_contrast_tool_dialog; - image_map_tool_class->reset = gimp_brightness_contrast_tool_reset; + im_tool_class->map = gimp_brightness_contrast_tool_map; + im_tool_class->dialog = gimp_brightness_contrast_tool_dialog; + im_tool_class->reset = gimp_brightness_contrast_tool_reset; } static void @@ -213,17 +176,15 @@ gimp_brightness_contrast_tool_initialize (GimpTool *tool, } static void -gimp_brightness_contrast_tool_map (GimpImageMapTool *image_map_tool) +gimp_brightness_contrast_tool_map (GimpImageMapTool *im_tool) { - GimpBrightnessContrastTool *bc_tool; - - bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (image_map_tool); + GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (im_tool); brightness_contrast_lut_setup (bc_tool->lut, bc_tool->brightness / 255.0, bc_tool->contrast / 127.0, - gimp_drawable_bytes (image_map_tool->drawable)); - gimp_image_map_apply (image_map_tool->image_map, + gimp_drawable_bytes (im_tool->drawable)); + gimp_image_map_apply (im_tool->image_map, (GimpImageMapApplyFunc) gimp_lut_process, bc_tool->lut); } @@ -254,9 +215,8 @@ gimp_brightness_contrast_tool_button_release (GimpTool *tool, GdkModifierType state, GimpDisplay *gdisp) { - GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (tool); - GimpImageMapTool *image_map_tool = GIMP_IMAGE_MAP_TOOL (tool); - + GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (tool); + GimpImageMapTool *im_tool = GIMP_IMAGE_MAP_TOOL (tool); gimp_tool_control_halt (tool->control); @@ -264,9 +224,9 @@ gimp_brightness_contrast_tool_button_release (GimpTool *tool, return; if ((state & GDK_BUTTON3_MASK)) - gimp_brightness_contrast_tool_reset (GIMP_IMAGE_MAP_TOOL (tool)); + gimp_brightness_contrast_tool_reset (im_tool); - gimp_image_map_tool_preview (image_map_tool); + gimp_image_map_tool_preview (im_tool); } @@ -277,8 +237,8 @@ gimp_brightness_contrast_tool_motion (GimpTool *tool, GdkModifierType state, GimpDisplay *gdisp) { - GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (tool); - GimpImageMapTool *image_map_tool = GIMP_IMAGE_MAP_TOOL (tool); + GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (tool); + GimpImageMapTool *im_tool = GIMP_IMAGE_MAP_TOOL (tool); gimp_tool_control_pause (tool->control); @@ -289,7 +249,7 @@ gimp_brightness_contrast_tool_motion (GimpTool *tool, bc_tool->contrast = CLAMP (bc_tool->dx, -127.0, 127.0); brightness_contrast_update (bc_tool, ALL); - gimp_image_map_tool_preview (image_map_tool); + gimp_image_map_tool_preview (im_tool); gimp_tool_control_resume (tool->control); } @@ -300,20 +260,18 @@ gimp_brightness_contrast_tool_motion (GimpTool *tool, /********************************/ static void -gimp_brightness_contrast_tool_dialog (GimpImageMapTool *image_map_tool) +gimp_brightness_contrast_tool_dialog (GimpImageMapTool *im_tool) { - GimpBrightnessContrastTool *bc_tool; + GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (im_tool); GtkWidget *table; GtkWidget *slider; GtkObject *data; - bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (image_map_tool); - /* The table containing sliders */ table = gtk_table_new (2, 3, FALSE); gtk_table_set_col_spacings (GTK_TABLE (table), 4); gtk_table_set_row_spacings (GTK_TABLE (table), 2); - gtk_box_pack_start (GTK_BOX (image_map_tool->main_vbox), table, + gtk_box_pack_start (GTK_BOX (im_tool->main_vbox), table, FALSE, FALSE, 0); gtk_widget_show (table); @@ -349,11 +307,9 @@ gimp_brightness_contrast_tool_dialog (GimpImageMapTool *image_map_tool) } static void -gimp_brightness_contrast_tool_reset (GimpImageMapTool *image_map_tool) +gimp_brightness_contrast_tool_reset (GimpImageMapTool *im_tool) { - GimpBrightnessContrastTool *bc_tool; - - bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (image_map_tool); + GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (im_tool); bc_tool->brightness = 0.0; bc_tool->contrast = 0.0; @@ -376,9 +332,7 @@ static void brightness_contrast_brightness_adjustment_update (GtkAdjustment *adjustment, gpointer data) { - GimpBrightnessContrastTool *bc_tool; - - bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (data); + GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (data); if (bc_tool->brightness != adjustment->value) { @@ -392,9 +346,7 @@ static void brightness_contrast_contrast_adjustment_update (GtkAdjustment *adjustment, gpointer data) { - GimpBrightnessContrastTool *bc_tool; - - bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (data); + GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (data); if (bc_tool->contrast != adjustment->value) { diff --git a/app/tools/gimpbrushtool.c b/app/tools/gimpbrushtool.c index 91ae6e40de..b1898f5e4a 100644 --- a/app/tools/gimpbrushtool.c +++ b/app/tools/gimpbrushtool.c @@ -62,9 +62,6 @@ #define STATUSBAR_SIZE 128 -static void gimp_paint_tool_class_init (GimpPaintToolClass *klass); -static void gimp_paint_tool_init (GimpPaintTool *paint_tool); - static GObject * gimp_paint_tool_constructor (GType type, guint n_params, GObjectConstructParam *params); @@ -121,36 +118,10 @@ static void gimp_paint_tool_notify_brush (GimpDisplayConfig *config, GimpPaintTool *paint_tool); -static GimpColorToolClass *parent_class = NULL; +G_DEFINE_TYPE (GimpPaintTool, gimp_paint_tool, GIMP_TYPE_COLOR_TOOL); +#define parent_class gimp_paint_tool_parent_class -GType -gimp_paint_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpPaintToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_paint_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpPaintTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_paint_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_COLOR_TOOL, - "GimpPaintTool", - &tool_info, 0); - } - - return tool_type; -} static void gimp_paint_tool_class_init (GimpPaintToolClass *klass) @@ -160,8 +131,6 @@ gimp_paint_tool_class_init (GimpPaintToolClass *klass) GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); GimpColorToolClass *color_tool_class = GIMP_COLOR_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_paint_tool_constructor; object_class->finalize = gimp_paint_tool_finalize; diff --git a/app/tools/gimpbucketfilloptions.c b/app/tools/gimpbucketfilloptions.c index 5c308de191..f43727a7ca 100644 --- a/app/tools/gimpbucketfilloptions.c +++ b/app/tools/gimpbucketfilloptions.c @@ -53,8 +53,6 @@ enum }; -static void gimp_bucket_fill_options_class_init (GimpBucketFillOptionsClass *klass); - static void gimp_bucket_fill_options_set_property (GObject *object, guint property_id, const GValue *value, @@ -70,36 +68,11 @@ static void gimp_bucket_fill_options_notify (GimpBucketFillOptions *options, GtkWidget *widget); -static GimpPaintOptionsClass *parent_class = NULL; +G_DEFINE_TYPE (GimpBucketFillOptions, gimp_bucket_fill_options, + GIMP_TYPE_PAINT_OPTIONS); +#define parent_class gimp_bucket_fill_options_parent_class -GType -gimp_bucket_fill_options_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo info = - { - sizeof (GimpBucketFillOptionsClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_bucket_fill_options_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpBucketFillOptions), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL - }; - - type = g_type_register_static (GIMP_TYPE_PAINT_OPTIONS, - "GimpBucketFillOptions", - &info, 0); - } - - return type; -} static void gimp_bucket_fill_options_class_init (GimpBucketFillOptionsClass *klass) @@ -107,8 +80,6 @@ gimp_bucket_fill_options_class_init (GimpBucketFillOptionsClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GimpToolOptionsClass *options_class = GIMP_TOOL_OPTIONS_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->set_property = gimp_bucket_fill_options_set_property; object_class->get_property = gimp_bucket_fill_options_get_property; @@ -142,6 +113,11 @@ gimp_bucket_fill_options_class_init (GimpBucketFillOptionsClass *klass) 0); } +static void +gimp_bucket_fill_options_init (GimpBucketFillOptions *options) +{ +} + static void gimp_bucket_fill_options_set_property (GObject *object, guint property_id, diff --git a/app/tools/gimpbucketfilltool.c b/app/tools/gimpbucketfilltool.c index 404d2efc7d..b6c3c03813 100644 --- a/app/tools/gimpbucketfilltool.c +++ b/app/tools/gimpbucketfilltool.c @@ -45,36 +45,33 @@ #include "gimp-intl.h" -static GimpToolClass *parent_class = NULL; - - /* local function prototypes */ -static void gimp_bucket_fill_tool_class_init (GimpBucketFillToolClass *klass); -static void gimp_bucket_fill_tool_init (GimpBucketFillTool *bucket_fill_tool); - -static void gimp_bucket_fill_tool_button_press (GimpTool *tool, - GimpCoords *coords, - guint32 time, - GdkModifierType state, - GimpDisplay *gdisp); -static void gimp_bucket_fill_tool_button_release (GimpTool *tool, - GimpCoords *coords, - guint32 time, - GdkModifierType state, - GimpDisplay *gdisp); -static void gimp_bucket_fill_tool_modifier_key (GimpTool *tool, - GdkModifierType key, - gboolean press, - GdkModifierType state, - GimpDisplay *gdisp); -static void gimp_bucket_fill_tool_cursor_update (GimpTool *tool, - GimpCoords *coords, - GdkModifierType state, - GimpDisplay *gdisp); +static void gimp_bucket_fill_tool_button_press (GimpTool *tool, + GimpCoords *coords, + guint32 time, + GdkModifierType state, + GimpDisplay *gdisp); +static void gimp_bucket_fill_tool_button_release (GimpTool *tool, + GimpCoords *coords, + guint32 time, + GdkModifierType state, + GimpDisplay *gdisp); +static void gimp_bucket_fill_tool_modifier_key (GimpTool *tool, + GdkModifierType key, + gboolean press, + GdkModifierType state, + GimpDisplay *gdisp); +static void gimp_bucket_fill_tool_cursor_update (GimpTool *tool, + GimpCoords *coords, + GdkModifierType state, + GimpDisplay *gdisp); -/* public functions */ +G_DEFINE_TYPE (GimpBucketFillTool, gimp_bucket_fill_tool, GIMP_TYPE_TOOL); + +#define parent_class gimp_bucket_fill_tool_parent_class + void gimp_bucket_fill_tool_register (GimpToolRegisterCallback callback, @@ -97,44 +94,11 @@ gimp_bucket_fill_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_bucket_fill_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpBucketFillToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_bucket_fill_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpBucketFillTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_bucket_fill_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_TOOL, - "GimpBucketFillTool", - &tool_info, 0); - } - - return tool_type; -} - - -/* private functions */ - static void gimp_bucket_fill_tool_class_init (GimpBucketFillToolClass *klass) { GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - tool_class->button_press = gimp_bucket_fill_tool_button_press; tool_class->button_release = gimp_bucket_fill_tool_button_release; tool_class->modifier_key = gimp_bucket_fill_tool_modifier_key; diff --git a/app/tools/gimpbycolorselecttool.c b/app/tools/gimpbycolorselecttool.c index 711abe7e3b..5deee755f9 100644 --- a/app/tools/gimpbycolorselecttool.c +++ b/app/tools/gimpbycolorselecttool.c @@ -42,9 +42,6 @@ #include "gimp-intl.h" -static void gimp_by_color_select_tool_class_init (GimpByColorSelectToolClass *klass); -static void gimp_by_color_select_tool_init (GimpByColorSelectTool *by_color_select); - static void gimp_by_color_select_tool_button_press (GimpTool *tool, GimpCoords *coords, guint32 time, @@ -65,10 +62,11 @@ static void gimp_by_color_select_tool_cursor_update (GimpTool *tool, GimpDisplay *gdisp); -static GimpSelectionToolClass *parent_class = NULL; +G_DEFINE_TYPE (GimpByColorSelectTool, gimp_by_color_select_tool, + GIMP_TYPE_SELECTION_TOOL); +#define parent_class gimp_by_color_select_tool_parent_class -/* public functions */ void gimp_by_color_select_tool_register (GimpToolRegisterCallback callback, @@ -87,44 +85,11 @@ gimp_by_color_select_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_by_color_select_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpByColorSelectToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_by_color_select_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpByColorSelectTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_by_color_select_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_SELECTION_TOOL, - "GimpByColorSelectTool", - &tool_info, 0); - } - - return tool_type; -} - - -/* private functions */ - static void gimp_by_color_select_tool_class_init (GimpByColorSelectToolClass *klass) { GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - tool_class->button_press = gimp_by_color_select_tool_button_press; tool_class->button_release = gimp_by_color_select_tool_button_release; tool_class->oper_update = gimp_by_color_select_tool_oper_update; diff --git a/app/tools/gimpclonetool.c b/app/tools/gimpclonetool.c index f33679036a..aa92f094c4 100644 --- a/app/tools/gimpclonetool.c +++ b/app/tools/gimpclonetool.c @@ -49,35 +49,34 @@ #define TARGET_HEIGHT 15 -static void gimp_clone_tool_class_init (GimpCloneToolClass *klass); -static void gimp_clone_tool_init (GimpCloneTool *tool); +static void gimp_clone_tool_button_press (GimpTool *tool, + GimpCoords *coords, + guint32 time, + GdkModifierType state, + GimpDisplay *gdisp); +static void gimp_clone_tool_motion (GimpTool *tool, + GimpCoords *coords, + guint32 time, + GdkModifierType state, + GimpDisplay *gdisp); -static void gimp_clone_tool_button_press (GimpTool *tool, - GimpCoords *coords, - guint32 time, - GdkModifierType state, - GimpDisplay *gdisp); -static void gimp_clone_tool_motion (GimpTool *tool, - GimpCoords *coords, - guint32 time, - GdkModifierType state, - GimpDisplay *gdisp); +static void gimp_clone_tool_cursor_update (GimpTool *tool, + GimpCoords *coords, + GdkModifierType state, + GimpDisplay *gdisp); +static void gimp_clone_tool_oper_update (GimpTool *tool, + GimpCoords *coords, + GdkModifierType state, + GimpDisplay *gdisp); -static void gimp_clone_tool_cursor_update (GimpTool *tool, - GimpCoords *coords, - GdkModifierType state, - GimpDisplay *gdisp); -static void gimp_clone_tool_oper_update (GimpTool *tool, - GimpCoords *coords, - GdkModifierType state, - GimpDisplay *gdisp); +static void gimp_clone_tool_draw (GimpDrawTool *draw_tool); -static void gimp_clone_tool_draw (GimpDrawTool *draw_tool); - -static GtkWidget * gimp_clone_options_gui (GimpToolOptions *tool_options); +static GtkWidget * gimp_clone_options_gui (GimpToolOptions *tool_options); -static GimpPaintToolClass *parent_class = NULL; +G_DEFINE_TYPE (GimpCloneTool, gimp_clone_tool, GIMP_TYPE_PAINT_TOOL); + +#define parent_class gimp_clone_tool_parent_class void @@ -98,42 +97,12 @@ gimp_clone_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_clone_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpCloneToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_clone_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpCloneTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_clone_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_PAINT_TOOL, - "GimpCloneTool", - &tool_info, 0); - } - - return tool_type; -} - static void gimp_clone_tool_class_init (GimpCloneToolClass *klass) { GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - tool_class->button_press = gimp_clone_tool_button_press; tool_class->motion = gimp_clone_tool_motion; tool_class->cursor_update = gimp_clone_tool_cursor_update; diff --git a/app/tools/gimpcolorbalancetool.c b/app/tools/gimpcolorbalancetool.c index 64d5ff9b26..8b92d4d16c 100644 --- a/app/tools/gimpcolorbalancetool.c +++ b/app/tools/gimpcolorbalancetool.c @@ -51,17 +51,14 @@ /* local function prototypes */ -static void gimp_color_balance_tool_class_init (GimpColorBalanceToolClass *klass); -static void gimp_color_balance_tool_init (GimpColorBalanceTool *cb_tool); - static void gimp_color_balance_tool_finalize (GObject *object); static gboolean gimp_color_balance_tool_initialize (GimpTool *tool, GimpDisplay *gdisp); -static void gimp_color_balance_tool_map (GimpImageMapTool *image_map_tool); -static void gimp_color_balance_tool_dialog (GimpImageMapTool *image_map_tool); -static void gimp_color_balance_tool_reset (GimpImageMapTool *image_map_tool); +static void gimp_color_balance_tool_map (GimpImageMapTool *im_tool); +static void gimp_color_balance_tool_dialog (GimpImageMapTool *im_tool); +static void gimp_color_balance_tool_reset (GimpImageMapTool *im_tool); static void color_balance_update (GimpColorBalanceTool *cb_tool, gint update); @@ -79,10 +76,11 @@ static void color_balance_yb_adjustment_update (GtkAdjustment *adj, GimpColorBalanceTool *cb_tool); -static GimpImageMapToolClass *parent_class = NULL; +G_DEFINE_TYPE (GimpColorBalanceTool, gimp_color_balance_tool, + GIMP_TYPE_IMAGE_MAP_TOOL); +#define parent_class gimp_color_balance_tool_parent_class -/* functions */ void gimp_color_balance_tool_register (GimpToolRegisterCallback callback, @@ -100,56 +98,22 @@ gimp_color_balance_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_color_balance_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpColorBalanceToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_color_balance_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpColorBalanceTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_color_balance_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_IMAGE_MAP_TOOL, - "GimpColorBalanceTool", - &tool_info, 0); - } - - return tool_type; -} - static void gimp_color_balance_tool_class_init (GimpColorBalanceToolClass *klass) { - GObjectClass *object_class; - GimpToolClass *tool_class; - GimpImageMapToolClass *image_map_tool_class; + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); + GimpImageMapToolClass *im_tool_class = GIMP_IMAGE_MAP_TOOL_CLASS (klass); - object_class = G_OBJECT_CLASS (klass); - tool_class = GIMP_TOOL_CLASS (klass); - image_map_tool_class = GIMP_IMAGE_MAP_TOOL_CLASS (klass); + object_class->finalize = gimp_color_balance_tool_finalize; - parent_class = g_type_class_peek_parent (klass); + tool_class->initialize = gimp_color_balance_tool_initialize; - object_class->finalize = gimp_color_balance_tool_finalize; + im_tool_class->shell_desc = _("Adjust Color Balance"); - tool_class->initialize = gimp_color_balance_tool_initialize; - - image_map_tool_class->shell_desc = _("Adjust Color Balance"); - - image_map_tool_class->map = gimp_color_balance_tool_map; - image_map_tool_class->dialog = gimp_color_balance_tool_dialog; - image_map_tool_class->reset = gimp_color_balance_tool_reset; + im_tool_class->map = gimp_color_balance_tool_map; + im_tool_class->dialog = gimp_color_balance_tool_dialog; + im_tool_class->reset = gimp_color_balance_tool_reset; } static void @@ -205,12 +169,12 @@ gimp_color_balance_tool_initialize (GimpTool *tool, } static void -gimp_color_balance_tool_map (GimpImageMapTool *image_map_tool) +gimp_color_balance_tool_map (GimpImageMapTool *im_tool) { - GimpColorBalanceTool *cb_tool = GIMP_COLOR_BALANCE_TOOL (image_map_tool); + GimpColorBalanceTool *cb_tool = GIMP_COLOR_BALANCE_TOOL (im_tool); color_balance_create_lookup_tables (cb_tool->color_balance); - gimp_image_map_apply (image_map_tool->image_map, + gimp_image_map_apply (im_tool->image_map, (GimpImageMapApplyFunc) color_balance, cb_tool->color_balance); } @@ -261,9 +225,9 @@ create_levels_scale (const gchar *left, } static void -gimp_color_balance_tool_dialog (GimpImageMapTool *image_map_tool) +gimp_color_balance_tool_dialog (GimpImageMapTool *im_tool) { - GimpColorBalanceTool *cb_tool = GIMP_COLOR_BALANCE_TOOL (image_map_tool); + GimpColorBalanceTool *cb_tool = GIMP_COLOR_BALANCE_TOOL (im_tool); GtkWidget *vbox; GtkWidget *hbox; GtkWidget *table; @@ -276,13 +240,11 @@ gimp_color_balance_tool_dialog (GimpImageMapTool *image_map_tool) G_CALLBACK (color_balance_range_callback), cb_tool, &toggle); - gtk_box_pack_start (GTK_BOX (image_map_tool->main_vbox), frame, - FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (im_tool->main_vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); frame = gimp_frame_new (_("Adjust Color Levels")); - gtk_box_pack_start (GTK_BOX (image_map_tool->main_vbox), frame, - FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (im_tool->main_vbox), frame, FALSE, FALSE, 0); gtk_widget_show (frame); vbox = gtk_vbox_new (FALSE, 4); @@ -333,8 +295,8 @@ gimp_color_balance_tool_dialog (GimpImageMapTool *image_map_tool) gtk_check_button_new_with_mnemonic (_("Preserve _luminosity")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb_tool->preserve_toggle), cb_tool->color_balance->preserve_luminosity); - gtk_box_pack_end (GTK_BOX (image_map_tool->main_vbox), - cb_tool->preserve_toggle, FALSE, FALSE, 0); + gtk_box_pack_end (GTK_BOX (im_tool->main_vbox), cb_tool->preserve_toggle, + FALSE, FALSE, 0); gtk_widget_show (cb_tool->preserve_toggle); g_signal_connect (cb_tool->preserve_toggle, "toggled", @@ -347,9 +309,9 @@ gimp_color_balance_tool_dialog (GimpImageMapTool *image_map_tool) } static void -gimp_color_balance_tool_reset (GimpImageMapTool *image_map_tool) +gimp_color_balance_tool_reset (GimpImageMapTool *im_tool) { - GimpColorBalanceTool *cb_tool = GIMP_COLOR_BALANCE_TOOL (image_map_tool); + GimpColorBalanceTool *cb_tool = GIMP_COLOR_BALANCE_TOOL (im_tool); color_balance_init (cb_tool->color_balance); color_balance_update (cb_tool, ALL); diff --git a/app/tools/gimpcolorizetool.c b/app/tools/gimpcolorizetool.c index 04dd183866..db4ecf3b57 100644 --- a/app/tools/gimpcolorizetool.c +++ b/app/tools/gimpcolorizetool.c @@ -56,17 +56,14 @@ /* local function prototypes */ -static void gimp_colorize_tool_class_init (GimpColorizeToolClass *klass); -static void gimp_colorize_tool_init (GimpColorizeTool *tool); - static void gimp_colorize_tool_finalize (GObject *object); static gboolean gimp_colorize_tool_initialize (GimpTool *tool, GimpDisplay *gdisp); -static void gimp_colorize_tool_map (GimpImageMapTool *image_map_tool); -static void gimp_colorize_tool_dialog (GimpImageMapTool *image_map_tool); -static void gimp_colorize_tool_reset (GimpImageMapTool *image_map_tool); +static void gimp_colorize_tool_map (GimpImageMapTool *im_tool); +static void gimp_colorize_tool_dialog (GimpImageMapTool *im_tool); +static void gimp_colorize_tool_reset (GimpImageMapTool *im_tool); static void colorize_update (GimpColorizeTool *col_tool, gint update); @@ -78,13 +75,11 @@ static void colorize_lightness_adj_update (GtkAdjustment *adj, GimpColorizeTool *col_tool); -/* private variables */ +G_DEFINE_TYPE (GimpColorizeTool, gimp_colorize_tool, GIMP_TYPE_IMAGE_MAP_TOOL); -static GimpImageMapToolClass *parent_class = NULL; +#define parent_class gimp_colorize_tool_parent_class -/* public functions */ - void gimp_colorize_tool_register (GimpToolRegisterCallback callback, gpointer data) @@ -101,59 +96,22 @@ gimp_colorize_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_colorize_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpColorizeToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_colorize_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpColorizeTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_colorize_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_IMAGE_MAP_TOOL, - "GimpColorizeTool", - &tool_info, 0); - } - - return tool_type; -} - - -/* private functions */ - static void gimp_colorize_tool_class_init (GimpColorizeToolClass *klass) { - GObjectClass *object_class; - GimpToolClass *tool_class; - GimpImageMapToolClass *image_map_tool_class; + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); + GimpImageMapToolClass *im_tool_class = GIMP_IMAGE_MAP_TOOL_CLASS (klass); - object_class = G_OBJECT_CLASS (klass); - tool_class = GIMP_TOOL_CLASS (klass); - image_map_tool_class = GIMP_IMAGE_MAP_TOOL_CLASS (klass); + object_class->finalize = gimp_colorize_tool_finalize; - parent_class = g_type_class_peek_parent (klass); + tool_class->initialize = gimp_colorize_tool_initialize; - object_class->finalize = gimp_colorize_tool_finalize; + im_tool_class->shell_desc = _("Colorize the Image"); - tool_class->initialize = gimp_colorize_tool_initialize; - - image_map_tool_class->shell_desc = _("Colorize the Image"); - - image_map_tool_class->map = gimp_colorize_tool_map; - image_map_tool_class->dialog = gimp_colorize_tool_dialog; - image_map_tool_class->reset = gimp_colorize_tool_reset; + im_tool_class->map = gimp_colorize_tool_map; + im_tool_class->dialog = gimp_colorize_tool_dialog; + im_tool_class->reset = gimp_colorize_tool_reset; } static void diff --git a/app/tools/gimpcoloroptions.c b/app/tools/gimpcoloroptions.c index 57458e321f..929bad71c4 100644 --- a/app/tools/gimpcoloroptions.c +++ b/app/tools/gimpcoloroptions.c @@ -41,8 +41,6 @@ enum }; -static void gimp_color_options_class_init (GimpColorOptionsClass *klass); - static void gimp_color_options_set_property (GObject *object, guint property_id, const GValue *value, @@ -53,33 +51,9 @@ static void gimp_color_options_get_property (GObject *object, GParamSpec *pspec); -GType -gimp_color_options_get_type (void) -{ - static GType type = 0; +G_DEFINE_TYPE (GimpColorOptions, gimp_color_options, + GIMP_TYPE_IMAGE_MAP_OPTIONS); - if (! type) - { - static const GTypeInfo info = - { - sizeof (GimpColorOptionsClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_color_options_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpColorOptions), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL - }; - - type = g_type_register_static (GIMP_TYPE_IMAGE_MAP_OPTIONS, - "GimpColorOptions", - &info, 0); - } - - return type; -} static void gimp_color_options_class_init (GimpColorOptionsClass *klass) @@ -103,6 +77,11 @@ gimp_color_options_class_init (GimpColorOptionsClass *klass) 0); } +static void +gimp_color_options_init (GimpColorOptions *options) +{ +} + static void gimp_color_options_set_property (GObject *object, guint property_id, diff --git a/app/tools/gimpcolorpickeroptions.c b/app/tools/gimpcolorpickeroptions.c index 7888ffe768..cf694828a6 100644 --- a/app/tools/gimpcolorpickeroptions.c +++ b/app/tools/gimpcolorpickeroptions.c @@ -42,8 +42,6 @@ enum }; -static void gimp_color_picker_options_class_init (GimpColorPickerOptionsClass *klass); - static void gimp_color_picker_options_set_property (GObject *object, guint property_id, const GValue *value, @@ -54,44 +52,15 @@ static void gimp_color_picker_options_get_property (GObject *object, GParamSpec *pspec); -static GimpToolOptionsClass *parent_class = NULL; +G_DEFINE_TYPE (GimpColorPickerOptions, gimp_color_picker_options, + GIMP_TYPE_COLOR_OPTIONS); -GType -gimp_color_picker_options_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo info = - { - sizeof (GimpColorPickerOptionsClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_color_picker_options_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpColorPickerOptions), - 0, /* n_preallocs */ - NULL /* instance_init */ - }; - - type = g_type_register_static (GIMP_TYPE_COLOR_OPTIONS, - "GimpColorPickerOptions", - &info, 0); - } - - return type; -} - static void gimp_color_picker_options_class_init (GimpColorPickerOptionsClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->set_property = gimp_color_picker_options_set_property; object_class->get_property = gimp_color_picker_options_get_property; @@ -115,6 +84,11 @@ gimp_color_picker_options_class_init (GimpColorPickerOptionsClass *klass) 0); } +static void +gimp_color_picker_options_init (GimpColorPickerOptions *options) +{ +} + static void gimp_color_picker_options_set_property (GObject *object, guint property_id, diff --git a/app/tools/gimpcolorpickertool.c b/app/tools/gimpcolorpickertool.c index 13a18b1131..6d00c187af 100644 --- a/app/tools/gimpcolorpickertool.c +++ b/app/tools/gimpcolorpickertool.c @@ -52,11 +52,9 @@ /* local function prototypes */ -static void gimp_color_picker_tool_class_init (GimpColorPickerToolClass *klass); -static void gimp_color_picker_tool_init (GimpColorPickerTool *tool); -static GObject * gimp_color_picker_tool_constructor(GType type, - guint n_params, - GObjectConstructParam *params); +static GObject * gimp_color_picker_tool_constructor (GType type, + guint n_params, + GObjectConstructParam *params); static void gimp_color_picker_tool_finalize (GObject *object); static void gimp_color_picker_tool_control (GimpTool *tool, @@ -88,7 +86,10 @@ static void gimp_color_picker_tool_info_update (GimpColorPickerTool *picker_to gint color_index); -static GimpColorToolClass *parent_class = NULL; +G_DEFINE_TYPE (GimpColorPickerTool, gimp_color_picker_tool, + GIMP_TYPE_COLOR_TOOL); + +#define parent_class gimp_color_picker_tool_parent_class void @@ -108,34 +109,6 @@ gimp_color_picker_tool_register (GimpToolRegisterCallback callback, data); } -GtkType -gimp_color_picker_tool_get_type (void) -{ - static GtkType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpColorPickerToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_color_picker_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpColorPickerTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_color_picker_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_COLOR_TOOL, - "GimpColorPickerTool", - &tool_info, 0); - } - - return tool_type; -} - static void gimp_color_picker_tool_class_init (GimpColorPickerToolClass *klass) { @@ -143,8 +116,6 @@ gimp_color_picker_tool_class_init (GimpColorPickerToolClass *klass) GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); GimpColorToolClass *color_tool_class = GIMP_COLOR_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_color_picker_tool_constructor; object_class->finalize = gimp_color_picker_tool_finalize; diff --git a/app/tools/gimpcolortool.c b/app/tools/gimpcolortool.c index 018aecf3e5..8ba1268a25 100644 --- a/app/tools/gimpcolortool.c +++ b/app/tools/gimpcolortool.c @@ -56,9 +56,7 @@ enum /* local function prototypes */ -static void gimp_color_tool_class_init (GimpColorToolClass *klass); -static void gimp_color_tool_init (GimpColorTool *color_tool); -static void gimp_color_tool_finalize (GObject *object); +static void gimp_color_tool_finalize (GObject *object); static void gimp_color_tool_control (GimpTool *tool, GimpToolAction action, @@ -101,38 +99,12 @@ static void gimp_color_tool_pick (GimpColorTool *tool, gint y); +G_DEFINE_TYPE (GimpColorTool, gimp_color_tool, GIMP_TYPE_DRAW_TOOL); + +#define parent_class gimp_color_tool_parent_class + static guint gimp_color_tool_signals[LAST_SIGNAL] = { 0 }; -static GimpDrawToolClass *parent_class = NULL; - - -GType -gimp_color_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpColorToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_color_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpColorTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_color_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_DRAW_TOOL, - "GimpColorTool", - &tool_info, 0); - } - - return tool_type; -} static void gimp_color_tool_class_init (GimpColorToolClass *klass) @@ -141,8 +113,6 @@ gimp_color_tool_class_init (GimpColorToolClass *klass) GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); GimpDrawToolClass *draw_class = GIMP_DRAW_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - gimp_color_tool_signals[PICKED] = g_signal_new ("picked", G_TYPE_FROM_CLASS (klass), diff --git a/app/tools/gimpconvolvetool.c b/app/tools/gimpconvolvetool.c index 3e5d487b8c..a31bf27b1d 100644 --- a/app/tools/gimpconvolvetool.c +++ b/app/tools/gimpconvolvetool.c @@ -38,23 +38,22 @@ #include "gimp-intl.h" -static void gimp_convolve_tool_class_init (GimpConvolveToolClass *klass); -static void gimp_convolve_tool_init (GimpConvolveTool *tool); +static void gimp_convolve_tool_modifier_key (GimpTool *tool, + GdkModifierType key, + gboolean press, + GdkModifierType state, + GimpDisplay *gdisp); +static void gimp_convolve_tool_cursor_update (GimpTool *tool, + GimpCoords *coords, + GdkModifierType state, + GimpDisplay *gdisp); -static void gimp_convolve_tool_modifier_key (GimpTool *tool, - GdkModifierType key, - gboolean press, - GdkModifierType state, - GimpDisplay *gdisp); -static void gimp_convolve_tool_cursor_update (GimpTool *tool, - GimpCoords *coords, - GdkModifierType state, - GimpDisplay *gdisp); - -static GtkWidget * gimp_convolve_options_gui (GimpToolOptions *options); +static GtkWidget * gimp_convolve_options_gui (GimpToolOptions *options); -static GimpPaintToolClass *parent_class; +G_DEFINE_TYPE (GimpConvolveTool, gimp_convolve_tool, GIMP_TYPE_PAINT_TOOL); + +#define parent_class gimp_convolve_tool_parent_class void @@ -74,41 +73,11 @@ gimp_convolve_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_convolve_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpConvolveToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_convolve_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpConvolveTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_convolve_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_PAINT_TOOL, - "GimpConvolveTool", - &tool_info, 0); - } - - return tool_type; -} - static void gimp_convolve_tool_class_init (GimpConvolveToolClass *klass) { GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - tool_class->modifier_key = gimp_convolve_tool_modifier_key; tool_class->cursor_update = gimp_convolve_tool_cursor_update; } diff --git a/app/tools/gimpcropoptions.c b/app/tools/gimpcropoptions.c index 9915c790c9..666fab658f 100644 --- a/app/tools/gimpcropoptions.c +++ b/app/tools/gimpcropoptions.c @@ -54,8 +54,7 @@ enum }; -static void gimp_crop_options_class_init (GimpCropOptionsClass *klass); -static void gimp_crop_options_rectangle_options_iface_init (GimpRectangleOptionsInterface *rectangle_iface); +static void gimp_crop_options_rectangle_options_iface_init (GimpRectangleOptionsInterface *iface); static void gimp_crop_options_set_property (GObject *object, guint property_id, @@ -67,53 +66,17 @@ static void gimp_crop_options_get_property (GObject *object, GParamSpec *pspec); -static GimpToolOptionsClass *parent_class = NULL; +G_DEFINE_TYPE_WITH_CODE (GimpCropOptions, gimp_crop_options, + GIMP_TYPE_TOOL_OPTIONS, + G_IMPLEMENT_INTERFACE (GIMP_TYPE_RECTANGLE_OPTIONS, + gimp_crop_options_rectangle_options_iface_init)); -GType -gimp_crop_options_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo info = - { - sizeof (GimpCropOptionsClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_crop_options_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpCropOptions), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL - }; - static const GInterfaceInfo rectangle_info = - { - (GInterfaceInitFunc) gimp_crop_options_rectangle_options_iface_init, /* interface_init */ - NULL, /* interface_finalize */ - NULL /* interface_data */ - }; - - type = g_type_register_static (GIMP_TYPE_TOOL_OPTIONS, - "GimpCropOptions", - &info, 0); - g_type_add_interface_static (type, - GIMP_TYPE_RECTANGLE_OPTIONS, - &rectangle_info); - } - - return type; -} - static void gimp_crop_options_class_init (GimpCropOptionsClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->set_property = gimp_crop_options_set_property; object_class->get_property = gimp_crop_options_get_property; @@ -131,7 +94,12 @@ gimp_crop_options_class_init (GimpCropOptionsClass *klass) } static void -gimp_crop_options_rectangle_options_iface_init (GimpRectangleOptionsInterface *rectangle_iface) +gimp_crop_options_init (GimpCropOptions *options) +{ +} + +static void +gimp_crop_options_rectangle_options_iface_init (GimpRectangleOptionsInterface *iface) { } @@ -141,7 +109,7 @@ gimp_crop_options_set_property (GObject *object, const GValue *value, GParamSpec *pspec) { - GimpCropOptions *options = GIMP_CROP_OPTIONS (object); + GimpCropOptions *options = GIMP_CROP_OPTIONS (object); switch (property_id) { @@ -176,7 +144,7 @@ gimp_crop_options_get_property (GObject *object, GValue *value, GParamSpec *pspec) { - GimpCropOptions *options = GIMP_CROP_OPTIONS (object); + GimpCropOptions *options = GIMP_CROP_OPTIONS (object); switch (property_id) { diff --git a/app/tools/gimpcroptool.c b/app/tools/gimpcroptool.c index db2f5d9a8a..40ef24a319 100644 --- a/app/tools/gimpcroptool.c +++ b/app/tools/gimpcroptool.c @@ -41,14 +41,13 @@ #include "gimp-intl.h" -static void gimp_crop_tool_class_init (GimpCropToolClass *klass); -static void gimp_crop_tool_init (GimpCropTool *crop_tool); -static void gimp_crop_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *rectangle_iface); +static void gimp_crop_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *iface); static GObject * gimp_crop_tool_constructor (GType type, guint n_params, GObjectConstructParam *params); -static void gimp_crop_tool_finalize (GObject *object); +static void gimp_crop_tool_finalize (GObject *object); + static void gimp_crop_tool_control (GimpTool *tool, GimpToolAction action, GimpDisplay *gdisp); @@ -74,7 +73,12 @@ static gboolean gimp_crop_tool_execute (GimpRectangleTool *rectangle, gint w, gint h); -static GimpDrawToolClass *parent_class = NULL; + +G_DEFINE_TYPE_WITH_CODE (GimpCropTool, gimp_crop_tool, GIMP_TYPE_DRAW_TOOL, + G_IMPLEMENT_INTERFACE (GIMP_TYPE_RECTANGLE_TOOL, + gimp_crop_tool_rectangle_tool_iface_init)); + +#define parent_class gimp_crop_tool_parent_class /* public functions */ @@ -96,43 +100,6 @@ gimp_crop_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_crop_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpCropToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_crop_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpCropTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_crop_tool_init, - }; - static const GInterfaceInfo rectangle_info = - { - (GInterfaceInitFunc) gimp_crop_tool_rectangle_tool_iface_init, /* interface_init */ - NULL, /* interface_finalize */ - NULL /* interface_data */ - }; - - tool_type = g_type_register_static (GIMP_TYPE_DRAW_TOOL, - "GimpCropTool", - &tool_info, 0); - g_type_add_interface_static (tool_type, - GIMP_TYPE_RECTANGLE_TOOL, - &rectangle_info); - } - - return tool_type; -} - static void gimp_crop_tool_class_init (GimpCropToolClass *klass) { @@ -140,8 +107,6 @@ gimp_crop_tool_class_init (GimpCropToolClass *klass) GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_crop_tool_constructor; object_class->dispose = gimp_rectangle_tool_dispose; object_class->finalize = gimp_crop_tool_finalize; @@ -171,9 +136,9 @@ gimp_crop_tool_init (GimpCropTool *crop_tool) } static void -gimp_crop_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *rectangle_iface) +gimp_crop_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *iface) { - rectangle_iface->execute = gimp_crop_tool_execute; + iface->execute = gimp_crop_tool_execute; } static GObject * diff --git a/app/tools/gimpcurvestool.c b/app/tools/gimpcurvestool.c index 483fab8654..7c680908f0 100644 --- a/app/tools/gimpcurvestool.c +++ b/app/tools/gimpcurvestool.c @@ -70,9 +70,6 @@ /* local function prototypes */ -static void gimp_curves_tool_class_init (GimpCurvesToolClass *klass); -static void gimp_curves_tool_init (GimpCurvesTool *tool); - static void gimp_curves_tool_finalize (GObject *object); static gboolean gimp_curves_tool_initialize (GimpTool *tool, @@ -128,7 +125,9 @@ static gboolean curves_graph_expose (GtkWidget *widget, GimpCurvesTool *tool); -static GimpImageMapToolClass *parent_class = NULL; +G_DEFINE_TYPE (GimpCurvesTool, gimp_curves_tool, GIMP_TYPE_IMAGE_MAP_TOOL); + +#define parent_class gimp_curves_tool_parent_class /* public functions */ @@ -150,74 +149,38 @@ gimp_curves_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_curves_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpCurvesToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_curves_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpCurvesTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_curves_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_IMAGE_MAP_TOOL, - "GimpCurvesTool", - &tool_info, 0); - } - - return tool_type; -} - /* private functions */ static void gimp_curves_tool_class_init (GimpCurvesToolClass *klass) { - GObjectClass *object_class; - GimpToolClass *tool_class; - GimpColorToolClass *color_tool_class; - GimpImageMapToolClass *image_map_tool_class; + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); + GimpColorToolClass *color_tool_class = GIMP_COLOR_TOOL_CLASS (klass); + GimpImageMapToolClass *im_tool_class = GIMP_IMAGE_MAP_TOOL_CLASS (klass); - object_class = G_OBJECT_CLASS (klass); - tool_class = GIMP_TOOL_CLASS (klass); - color_tool_class = GIMP_COLOR_TOOL_CLASS (klass); - image_map_tool_class = GIMP_IMAGE_MAP_TOOL_CLASS (klass); + object_class->finalize = gimp_curves_tool_finalize; - parent_class = g_type_class_peek_parent (klass); + tool_class->initialize = gimp_curves_tool_initialize; + tool_class->button_release = gimp_curves_tool_button_release; + tool_class->key_press = gimp_curves_tool_key_press; + tool_class->oper_update = gimp_curves_tool_oper_update; - object_class->finalize = gimp_curves_tool_finalize; + color_tool_class->picked = gimp_curves_tool_color_picked; - tool_class->initialize = gimp_curves_tool_initialize; - tool_class->button_release = gimp_curves_tool_button_release; - tool_class->key_press = gimp_curves_tool_key_press; - tool_class->oper_update = gimp_curves_tool_oper_update; + im_tool_class->shell_desc = _("Adjust Color Curves"); + im_tool_class->settings_name = "curves"; + im_tool_class->load_dialog_title = _("Load Curves"); + im_tool_class->load_button_tip = _("Load curves settings from file"); + im_tool_class->save_dialog_title = _("Save Curves"); + im_tool_class->save_button_tip = _("Save curves settings to file"); - color_tool_class->picked = gimp_curves_tool_color_picked; - - image_map_tool_class->shell_desc = _("Adjust Color Curves"); - image_map_tool_class->settings_name = "curves"; - image_map_tool_class->load_dialog_title = _("Load Curves"); - image_map_tool_class->load_button_tip = _("Load curves settings from file"); - image_map_tool_class->save_dialog_title = _("Save Curves"); - image_map_tool_class->save_button_tip = _("Save curves settings to file"); - - image_map_tool_class->map = gimp_curves_tool_map; - image_map_tool_class->dialog = gimp_curves_tool_dialog; - image_map_tool_class->reset = gimp_curves_tool_reset; - - image_map_tool_class->settings_load = gimp_curves_tool_settings_load; - image_map_tool_class->settings_save = gimp_curves_tool_settings_save; + im_tool_class->map = gimp_curves_tool_map; + im_tool_class->dialog = gimp_curves_tool_dialog; + im_tool_class->reset = gimp_curves_tool_reset; + im_tool_class->settings_load = gimp_curves_tool_settings_load; + im_tool_class->settings_save = gimp_curves_tool_settings_save; } static void diff --git a/app/tools/gimpdodgeburntool.c b/app/tools/gimpdodgeburntool.c index a1656e2319..3651e4f4d4 100644 --- a/app/tools/gimpdodgeburntool.c +++ b/app/tools/gimpdodgeburntool.c @@ -38,9 +38,6 @@ #include "gimp-intl.h" -static void gimp_dodge_burn_tool_class_init (GimpDodgeBurnToolClass *klass); -static void gimp_dodge_burn_tool_init (GimpDodgeBurnTool *dodgeburn); - static void gimp_dodge_burn_tool_modifier_key (GimpTool *tool, GdkModifierType key, gboolean press, @@ -54,7 +51,9 @@ static void gimp_dodge_burn_tool_cursor_update (GimpTool *tool, static GtkWidget * gimp_dodge_burn_options_gui (GimpToolOptions *tool_options); -static GimpPaintToolClass *parent_class = NULL; +G_DEFINE_TYPE (GimpDodgeBurnTool, gimp_dodge_burn_tool, GIMP_TYPE_PAINT_TOOL); + +#define parent_class gimp_dodge_burn_tool_parent_class void @@ -74,41 +73,11 @@ gimp_dodge_burn_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_dodge_burn_tool_get_type (void) -{ - static GType tool_type = 0; - - if (!tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpDodgeBurnToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_dodge_burn_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpDodgeBurnTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_dodge_burn_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_PAINT_TOOL, - "GimpDodgeBurnTool", - &tool_info, 0); - } - - return tool_type; -} - static void gimp_dodge_burn_tool_class_init (GimpDodgeBurnToolClass *klass) { GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - tool_class->modifier_key = gimp_dodge_burn_tool_modifier_key; tool_class->cursor_update = gimp_dodge_burn_tool_cursor_update; } diff --git a/app/tools/gimpdrawtool.c b/app/tools/gimpdrawtool.c index f83545860d..a3e46f8454 100644 --- a/app/tools/gimpdrawtool.c +++ b/app/tools/gimpdrawtool.c @@ -41,204 +41,43 @@ #include "gimpdrawtool.h" -static void gimp_draw_tool_class_init (GimpDrawToolClass *klass); -static void gimp_draw_tool_init (GimpDrawTool *draw_tool); +static void gimp_draw_tool_finalize (GObject *object); -static void gimp_draw_tool_finalize (GObject *object); +static void gimp_draw_tool_control (GimpTool *tool, + GimpToolAction action, + GimpDisplay *gdisp); -static void gimp_draw_tool_control (GimpTool *tool, - GimpToolAction action, - GimpDisplay *gdisp); - -static void gimp_draw_tool_draw (GimpDrawTool *draw_tool); -static void gimp_draw_tool_real_draw (GimpDrawTool *draw_tool); +static void gimp_draw_tool_draw (GimpDrawTool *draw_tool); +static void gimp_draw_tool_real_draw (GimpDrawTool *draw_tool); static inline void gimp_draw_tool_shift_to_north_west - (gdouble x, - gdouble y, - gint handle_width, - gint handle_height, - GtkAnchorType anchor, - gdouble *shifted_x, - gdouble *shifted_y); + (gdouble x, + gdouble y, + gint handle_width, + gint handle_height, + GtkAnchorType anchor, + gdouble *shifted_x, + gdouble *shifted_y); static inline void gimp_draw_tool_shift_to_center - (gdouble x, - gdouble y, - gint handle_width, - gint handle_height, - GtkAnchorType anchor, - gdouble *shifted_x, - gdouble *shifted_y); + (gdouble x, + gdouble y, + gint handle_width, + gint handle_height, + GtkAnchorType anchor, + gdouble *shifted_x, + gdouble *shifted_y); -static GimpToolClass *parent_class = NULL; +G_DEFINE_TYPE (GimpDrawTool, gimp_draw_tool, GIMP_TYPE_TOOL); +#define parent_class gimp_draw_tool_parent_class -/* private functions */ - -static inline void -gimp_draw_tool_shift_to_north_west (gdouble x, - gdouble y, - gint handle_width, - gint handle_height, - GtkAnchorType anchor, - gdouble *shifted_x, - gdouble *shifted_y) -{ - switch (anchor) - { - case GTK_ANCHOR_CENTER: - x -= (handle_width >> 1); - y -= (handle_height >> 1); - break; - - case GTK_ANCHOR_NORTH: - x -= (handle_width >> 1); - break; - - case GTK_ANCHOR_NORTH_WEST: - /* nothing, this is the default */ - break; - - case GTK_ANCHOR_NORTH_EAST: - x -= handle_width; - break; - - case GTK_ANCHOR_SOUTH: - x -= (handle_width >> 1); - y -= handle_height; - break; - - case GTK_ANCHOR_SOUTH_WEST: - y -= handle_height; - break; - - case GTK_ANCHOR_SOUTH_EAST: - x -= handle_width; - y -= handle_height; - break; - - case GTK_ANCHOR_WEST: - y -= (handle_height >> 1); - break; - - case GTK_ANCHOR_EAST: - x -= handle_width; - y -= (handle_height >> 1); - break; - - default: - break; - } - - if (shifted_x) - *shifted_x = x; - - if (shifted_y) - *shifted_y = y; -} - -static inline void -gimp_draw_tool_shift_to_center (gdouble x, - gdouble y, - gint handle_width, - gint handle_height, - GtkAnchorType anchor, - gdouble *shifted_x, - gdouble *shifted_y) -{ - switch (anchor) - { - case GTK_ANCHOR_CENTER: - /* nothing, this is the default */ - break; - - case GTK_ANCHOR_NORTH: - y += (handle_height >> 1); - break; - - case GTK_ANCHOR_NORTH_WEST: - x += (handle_width >> 1); - y += (handle_height >> 1); - break; - - case GTK_ANCHOR_NORTH_EAST: - x -= (handle_width >> 1); - y += (handle_height >> 1); - break; - - case GTK_ANCHOR_SOUTH: - y -= (handle_height >> 1); - break; - - case GTK_ANCHOR_SOUTH_WEST: - x += (handle_width >> 1); - y -= (handle_height >> 1); - break; - - case GTK_ANCHOR_SOUTH_EAST: - x -= (handle_width >> 1); - y -= (handle_height >> 1); - break; - - case GTK_ANCHOR_WEST: - x += (handle_width >> 1); - break; - - case GTK_ANCHOR_EAST: - x -= (handle_width >> 1); - break; - - default: - break; - } - - if (shifted_x) - *shifted_x = x; - - if (shifted_y) - *shifted_y = y; -} - - -GType -gimp_draw_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpDrawToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_draw_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpDrawTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_draw_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_TOOL, - "GimpDrawTool", - &tool_info, 0); - } - - return tool_type; -} static void gimp_draw_tool_class_init (GimpDrawToolClass *klass) { - GObjectClass *object_class; - GimpToolClass *tool_class; - - object_class = G_OBJECT_CLASS (klass); - tool_class = GIMP_TOOL_CLASS (klass); - - parent_class = g_type_class_peek_parent (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); object_class->finalize = gimp_draw_tool_finalize; @@ -1357,3 +1196,130 @@ gimp_draw_tool_draw_boundary (GimpDrawTool *draw_tool, g_free (gdk_points); } + + +/* private functions */ + +static inline void +gimp_draw_tool_shift_to_north_west (gdouble x, + gdouble y, + gint handle_width, + gint handle_height, + GtkAnchorType anchor, + gdouble *shifted_x, + gdouble *shifted_y) +{ + switch (anchor) + { + case GTK_ANCHOR_CENTER: + x -= (handle_width >> 1); + y -= (handle_height >> 1); + break; + + case GTK_ANCHOR_NORTH: + x -= (handle_width >> 1); + break; + + case GTK_ANCHOR_NORTH_WEST: + /* nothing, this is the default */ + break; + + case GTK_ANCHOR_NORTH_EAST: + x -= handle_width; + break; + + case GTK_ANCHOR_SOUTH: + x -= (handle_width >> 1); + y -= handle_height; + break; + + case GTK_ANCHOR_SOUTH_WEST: + y -= handle_height; + break; + + case GTK_ANCHOR_SOUTH_EAST: + x -= handle_width; + y -= handle_height; + break; + + case GTK_ANCHOR_WEST: + y -= (handle_height >> 1); + break; + + case GTK_ANCHOR_EAST: + x -= handle_width; + y -= (handle_height >> 1); + break; + + default: + break; + } + + if (shifted_x) + *shifted_x = x; + + if (shifted_y) + *shifted_y = y; +} + +static inline void +gimp_draw_tool_shift_to_center (gdouble x, + gdouble y, + gint handle_width, + gint handle_height, + GtkAnchorType anchor, + gdouble *shifted_x, + gdouble *shifted_y) +{ + switch (anchor) + { + case GTK_ANCHOR_CENTER: + /* nothing, this is the default */ + break; + + case GTK_ANCHOR_NORTH: + y += (handle_height >> 1); + break; + + case GTK_ANCHOR_NORTH_WEST: + x += (handle_width >> 1); + y += (handle_height >> 1); + break; + + case GTK_ANCHOR_NORTH_EAST: + x -= (handle_width >> 1); + y += (handle_height >> 1); + break; + + case GTK_ANCHOR_SOUTH: + y -= (handle_height >> 1); + break; + + case GTK_ANCHOR_SOUTH_WEST: + x += (handle_width >> 1); + y -= (handle_height >> 1); + break; + + case GTK_ANCHOR_SOUTH_EAST: + x -= (handle_width >> 1); + y -= (handle_height >> 1); + break; + + case GTK_ANCHOR_WEST: + x += (handle_width >> 1); + break; + + case GTK_ANCHOR_EAST: + x -= (handle_width >> 1); + break; + + default: + break; + } + + if (shifted_x) + *shifted_x = x; + + if (shifted_y) + *shifted_y = y; +} diff --git a/app/tools/gimpeditselectiontool.c b/app/tools/gimpeditselectiontool.c index 3e9e8aaf9a..19ba42931d 100644 --- a/app/tools/gimpeditselectiontool.c +++ b/app/tools/gimpeditselectiontool.c @@ -98,15 +98,10 @@ struct _GimpEditSelectionTool struct _GimpEditSelectionToolClass { - GimpDrawToolClass parent_class; + GimpDrawToolClass parent_class; }; -static GType gimp_edit_selection_tool_get_type (void) G_GNUC_CONST; - -static void gimp_edit_selection_tool_class_init (GimpEditSelectionToolClass *klass); -static void gimp_edit_selection_tool_init (GimpEditSelectionTool *edit_selection_tool); - static void gimp_edit_selection_tool_button_release (GimpTool *tool, GimpCoords *coords, guint32 time, @@ -121,36 +116,11 @@ static void gimp_edit_selection_tool_motion (GimpTool *tool, static void gimp_edit_selection_tool_draw (GimpDrawTool *tool); -static GimpDrawToolClass *parent_class = NULL; +G_DEFINE_TYPE (GimpEditSelectionTool, gimp_edit_selection_tool, + GIMP_TYPE_DRAW_TOOL); +#define parent_class gimp_edit_selection_tool_parent_class -static GType -gimp_edit_selection_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpEditSelectionToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_edit_selection_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpEditSelectionTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_edit_selection_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_DRAW_TOOL, - "GimpEditSelectionTool", - &tool_info, 0); - } - - return tool_type; -} static void gimp_edit_selection_tool_class_init (GimpEditSelectionToolClass *klass) @@ -158,12 +128,10 @@ gimp_edit_selection_tool_class_init (GimpEditSelectionToolClass *klass) GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); GimpDrawToolClass *draw_class = GIMP_DRAW_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - tool_class->button_release = gimp_edit_selection_tool_button_release; tool_class->motion = gimp_edit_selection_tool_motion; - draw_class->draw = gimp_edit_selection_tool_draw; + draw_class->draw = gimp_edit_selection_tool_draw; } static void diff --git a/app/tools/gimpellipseselecttool.c b/app/tools/gimpellipseselecttool.c index be882fee79..e6c22b987d 100644 --- a/app/tools/gimpellipseselecttool.c +++ b/app/tools/gimpellipseselecttool.c @@ -42,9 +42,6 @@ #include "gimp-intl.h" -static void gimp_ellipse_select_tool_class_init (GimpEllipseSelectToolClass *klass); -static void gimp_ellipse_select_tool_init (GimpEllipseSelectTool *ellipse_select); - static void gimp_ellipse_select_tool_draw (GimpDrawTool *draw_tool); static void gimp_ellipse_select_tool_rect_select (GimpRectSelectTool *rect_tool, @@ -54,7 +51,10 @@ static void gimp_ellipse_select_tool_rect_select (GimpRectSelectTool *rect_too gint h); -static GimpRectSelectToolClass *parent_class = NULL; +G_DEFINE_TYPE (GimpEllipseSelectTool, gimp_ellipse_select_tool, + GIMP_TYPE_RECT_SELECT_TOOL); + +#define parent_class gimp_ellipse_select_tool_parent_class /* public functions */ @@ -76,34 +76,6 @@ gimp_ellipse_select_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_ellipse_select_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpEllipseSelectToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_ellipse_select_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpEllipseSelectTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_ellipse_select_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_RECT_SELECT_TOOL, - "GimpEllipseSelectTool", - &tool_info, 0); - } - - return tool_type; -} - /* private functions */ @@ -116,8 +88,6 @@ gimp_ellipse_select_tool_class_init (GimpEllipseSelectToolClass *klass) draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); rect_tool_class = GIMP_RECT_SELECT_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - draw_tool_class->draw = gimp_ellipse_select_tool_draw; rect_tool_class->rect_select = gimp_ellipse_select_tool_rect_select; diff --git a/app/tools/gimperasertool.c b/app/tools/gimperasertool.c index 2cb839c2ae..788d679736 100644 --- a/app/tools/gimperasertool.c +++ b/app/tools/gimperasertool.c @@ -38,23 +38,22 @@ #include "gimp-intl.h" -static void gimp_eraser_tool_class_init (GimpEraserToolClass *klass); -static void gimp_eraser_tool_init (GimpEraserTool *eraser); +static void gimp_eraser_tool_modifier_key (GimpTool *tool, + GdkModifierType key, + gboolean press, + GdkModifierType state, + GimpDisplay *gdisp); +static void gimp_eraser_tool_cursor_update (GimpTool *tool, + GimpCoords *coords, + GdkModifierType state, + GimpDisplay *gdisp); -static void gimp_eraser_tool_modifier_key (GimpTool *tool, - GdkModifierType key, - gboolean press, - GdkModifierType state, - GimpDisplay *gdisp); -static void gimp_eraser_tool_cursor_update (GimpTool *tool, - GimpCoords *coords, - GdkModifierType state, - GimpDisplay *gdisp); - -static GtkWidget * gimp_eraser_options_gui (GimpToolOptions *tool_options); +static GtkWidget * gimp_eraser_options_gui (GimpToolOptions *tool_options); -static GimpPaintToolClass *parent_class = NULL; +G_DEFINE_TYPE (GimpEraserTool, gimp_eraser_tool, GIMP_TYPE_PAINT_TOOL); + +#define parent_class gimp_eraser_tool_parent_class void @@ -74,41 +73,11 @@ gimp_eraser_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_eraser_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpEraserToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_eraser_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpEraserTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_eraser_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_PAINT_TOOL, - "GimpEraserTool", - &tool_info, 0); - } - - return tool_type; -} - static void gimp_eraser_tool_class_init (GimpEraserToolClass *klass) { GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - tool_class->modifier_key = gimp_eraser_tool_modifier_key; tool_class->cursor_update = gimp_eraser_tool_cursor_update; } diff --git a/app/tools/gimpflipoptions.c b/app/tools/gimpflipoptions.c index 98c6de69f1..7456f1be5d 100644 --- a/app/tools/gimpflipoptions.c +++ b/app/tools/gimpflipoptions.c @@ -42,56 +42,25 @@ enum }; -static void gimp_flip_options_class_init (GimpFlipOptionsClass *klass); - -static void gimp_flip_options_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec); -static void gimp_flip_options_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec); +static void gimp_flip_options_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec); +static void gimp_flip_options_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec); -static GimpTransformOptionsClass *parent_class = NULL; +G_DEFINE_TYPE (GimpFlipOptions, gimp_flip_options, + GIMP_TYPE_TRANSFORM_OPTIONS); -GType -gimp_flip_options_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo info = - { - sizeof (GimpFlipOptionsClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_flip_options_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpFlipOptions), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL - }; - - type = g_type_register_static (GIMP_TYPE_TRANSFORM_OPTIONS, - "GimpFlipOptions", - &info, 0); - } - - return type; -} - static void gimp_flip_options_class_init (GimpFlipOptionsClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->set_property = gimp_flip_options_set_property; object_class->get_property = gimp_flip_options_get_property; @@ -102,6 +71,11 @@ gimp_flip_options_class_init (GimpFlipOptionsClass *klass) 0); } +static void +gimp_flip_options_init (GimpFlipOptions *options) +{ +} + static void gimp_flip_options_set_property (GObject *object, guint property_id, diff --git a/app/tools/gimpfliptool.c b/app/tools/gimpfliptool.c index f01ba516bb..37bcd6497a 100644 --- a/app/tools/gimpfliptool.c +++ b/app/tools/gimpfliptool.c @@ -45,9 +45,6 @@ /* local function prototypes */ -static void gimp_flip_tool_class_init (GimpFlipToolClass *klass); -static void gimp_flip_tool_init (GimpFlipTool *flip_tool); - static void gimp_flip_tool_modifier_key (GimpTool *tool, GdkModifierType key, gboolean press, @@ -64,10 +61,10 @@ static TileManager * gimp_flip_tool_transform (GimpTransformTool *tool, GimpDisplay *gdisp); -static GimpTransformToolClass *parent_class = NULL; +G_DEFINE_TYPE (GimpFlipTool, gimp_flip_tool, GIMP_TYPE_TRANSFORM_TOOL); +#define parent_class gimp_flip_tool_parent_class -/* public functions */ void gimp_flip_tool_register (GimpToolRegisterCallback callback, @@ -86,45 +83,12 @@ gimp_flip_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_flip_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpFlipToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_flip_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpFlipTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_flip_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_TRANSFORM_TOOL, - "GimpFlipTool", - &tool_info, 0); - } - - return tool_type; -} - - -/* private functions */ - static void gimp_flip_tool_class_init (GimpFlipToolClass *klass) { GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); GimpTransformToolClass *trans_class = GIMP_TRANSFORM_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - tool_class->modifier_key = gimp_flip_tool_modifier_key; tool_class->cursor_update = gimp_flip_tool_cursor_update; diff --git a/app/tools/gimpforegroundselectoptions.c b/app/tools/gimpforegroundselectoptions.c index 689b667e99..555bd898d2 100644 --- a/app/tools/gimpforegroundselectoptions.c +++ b/app/tools/gimpforegroundselectoptions.c @@ -49,45 +49,19 @@ enum }; -static void gimp_foreground_select_options_class_init (GimpForegroundSelectOptionsClass *klass); - -static void gimp_foreground_select_options_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec); -static void gimp_foreground_select_options_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec); +static void gimp_foreground_select_options_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec); +static void gimp_foreground_select_options_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec); -GType -gimp_foreground_select_options_get_type (void) -{ - static GType type = 0; +G_DEFINE_TYPE (GimpForegroundSelectOptions, gimp_foreground_select_options, + GIMP_TYPE_SELECTION_OPTIONS); - if (! type) - { - static const GTypeInfo info = - { - sizeof (GimpForegroundSelectOptionsClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_foreground_select_options_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpForegroundSelectOptions), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL - }; - - type = g_type_register_static (GIMP_TYPE_SELECTION_OPTIONS, - "GimpForegroundSelectOptions", - &info, 0); - } - - return type; -} static void gimp_foreground_select_options_class_init (GimpForegroundSelectOptionsClass *klass) @@ -139,6 +113,11 @@ gimp_foreground_select_options_class_init (GimpForegroundSelectOptionsClass *kla 0); } +static void +gimp_foreground_select_options_init (GimpForegroundSelectOptions *options) +{ +} + static void gimp_foreground_select_options_set_property (GObject *object, guint property_id, diff --git a/app/tools/gimpforegroundselecttool.c b/app/tools/gimpforegroundselecttool.c index 9015587686..d5ce8bd20c 100644 --- a/app/tools/gimpforegroundselecttool.c +++ b/app/tools/gimpforegroundselecttool.c @@ -62,8 +62,6 @@ typedef struct } FgSelectStroke; -static void gimp_foreground_select_tool_class_init (GimpForegroundSelectToolClass *klass); -static void gimp_foreground_select_tool_init (GimpForegroundSelectTool *fg_select); static GObject * gimp_foreground_select_tool_constructor (GType type, guint n_params, GObjectConstructParam *params); @@ -122,10 +120,11 @@ static void gimp_foreground_select_options_notify (GimpForegroundSelectOptions GimpForegroundSelectTool *fg_select); -static GimpFreeSelectToolClass *parent_class = NULL; +G_DEFINE_TYPE (GimpForegroundSelectTool, gimp_foreground_select_tool, + GIMP_TYPE_FREE_SELECT_TOOL); +#define parent_class gimp_foreground_select_tool_parent_class -/* public functions */ void gimp_foreground_select_tool_register (GimpToolRegisterCallback callback, @@ -144,36 +143,6 @@ gimp_foreground_select_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_foreground_select_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpForegroundSelectToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_foreground_select_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpForegroundSelectTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_foreground_select_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_FREE_SELECT_TOOL, - "GimpForegroundSelectTool", - &tool_info, 0); - } - - return tool_type; -} - -/* private functions */ - static void gimp_foreground_select_tool_class_init (GimpForegroundSelectToolClass *klass) { @@ -184,8 +153,6 @@ gimp_foreground_select_tool_class_init (GimpForegroundSelectToolClass *klass) free_select_tool_class = GIMP_FREE_SELECT_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_foreground_select_tool_constructor; object_class->finalize = gimp_foreground_select_tool_finalize; diff --git a/app/tools/gimpfreeselecttool.c b/app/tools/gimpfreeselecttool.c index 3de755c0d1..7c25aa4392 100644 --- a/app/tools/gimpfreeselecttool.c +++ b/app/tools/gimpfreeselecttool.c @@ -44,8 +44,6 @@ #define DEFAULT_MAX_INC 1024 -static void gimp_free_select_tool_class_init (GimpFreeSelectToolClass *klass); -static void gimp_free_select_tool_init (GimpFreeSelectTool *free_select); static void gimp_free_select_tool_finalize (GObject *object); static void gimp_free_select_tool_control (GimpTool *tool, @@ -80,10 +78,11 @@ static void gimp_free_select_tool_move_points (GimpFreeSelectTool *free_sel gdouble dy); -static GimpSelectionToolClass *parent_class = NULL; +G_DEFINE_TYPE (GimpFreeSelectTool, gimp_free_select_tool, + GIMP_TYPE_SELECTION_TOOL); +#define parent_class gimp_free_select_tool_parent_class -/* public functions */ void gimp_free_select_tool_register (GimpToolRegisterCallback callback, @@ -102,46 +101,6 @@ gimp_free_select_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_free_select_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpFreeSelectToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_free_select_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpFreeSelectTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_free_select_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_SELECTION_TOOL, - "GimpFreeSelectTool", - &tool_info, 0); - } - - return tool_type; -} - -void -gimp_free_select_tool_select (GimpFreeSelectTool *free_sel, - GimpDisplay *gdisp) -{ - g_return_if_fail (GIMP_IS_FREE_SELECT_TOOL (free_sel)); - g_return_if_fail (GIMP_IS_DISPLAY (gdisp)); - - GIMP_FREE_SELECT_TOOL_GET_CLASS (free_sel)->select (free_sel, gdisp); -} - -/* private functions */ - static void gimp_free_select_tool_class_init (GimpFreeSelectToolClass *klass) { @@ -149,8 +108,6 @@ gimp_free_select_tool_class_init (GimpFreeSelectToolClass *klass) GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->finalize = gimp_free_select_tool_finalize; tool_class->control = gimp_free_select_tool_control; @@ -332,6 +289,22 @@ gimp_free_select_tool_draw (GimpDrawTool *draw_tool) } } + +/* public functions */ + +void +gimp_free_select_tool_select (GimpFreeSelectTool *free_sel, + GimpDisplay *gdisp) +{ + g_return_if_fail (GIMP_IS_FREE_SELECT_TOOL (free_sel)); + g_return_if_fail (GIMP_IS_DISPLAY (gdisp)); + + GIMP_FREE_SELECT_TOOL_GET_CLASS (free_sel)->select (free_sel, gdisp); +} + + +/* private functions */ + static void gimp_free_select_tool_real_select (GimpFreeSelectTool *free_sel, GimpDisplay *gdisp) diff --git a/app/tools/gimpfuzzyselecttool.c b/app/tools/gimpfuzzyselecttool.c index dd7ef46315..287623cc4c 100644 --- a/app/tools/gimpfuzzyselecttool.c +++ b/app/tools/gimpfuzzyselecttool.c @@ -53,9 +53,6 @@ #include "gimp-intl.h" -static void gimp_fuzzy_select_tool_class_init (GimpFuzzySelectToolClass *klass); -static void gimp_fuzzy_select_tool_init (GimpFuzzySelectTool *fuzzy_select); - static void gimp_fuzzy_select_tool_finalize (GObject *object); static void gimp_fuzzy_select_tool_button_press (GimpTool *tool, @@ -82,7 +79,10 @@ static GdkSegment * gint *num_segs); -static GimpSelectionToolClass *parent_class = NULL; +G_DEFINE_TYPE (GimpFuzzySelectTool, gimp_fuzzy_select_tool, + GIMP_TYPE_SELECTION_TOOL); + +#define parent_class gimp_fuzzy_select_tool_parent_class void @@ -102,34 +102,6 @@ gimp_fuzzy_select_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_fuzzy_select_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpFuzzySelectToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_fuzzy_select_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpFuzzySelectTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_fuzzy_select_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_SELECTION_TOOL, - "GimpFuzzySelectTool", - &tool_info, 0); - } - - return tool_type; -} - static void gimp_fuzzy_select_tool_class_init (GimpFuzzySelectToolClass *klass) { @@ -137,8 +109,6 @@ gimp_fuzzy_select_tool_class_init (GimpFuzzySelectToolClass *klass) GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->finalize = gimp_fuzzy_select_tool_finalize; tool_class->button_press = gimp_fuzzy_select_tool_button_press; diff --git a/app/tools/gimphistogramoptions.c b/app/tools/gimphistogramoptions.c index bc725a1227..e60b3dc9e8 100644 --- a/app/tools/gimphistogramoptions.c +++ b/app/tools/gimphistogramoptions.c @@ -42,8 +42,6 @@ enum }; -static void gimp_histogram_options_class_init (GimpHistogramOptionsClass *options_class); - static void gimp_histogram_options_set_property (GObject *object, guint property_id, const GValue *value, @@ -54,44 +52,15 @@ static void gimp_histogram_options_get_property (GObject *object, GParamSpec *pspec); -static GimpColorOptionsClass *parent_class = NULL; +G_DEFINE_TYPE (GimpHistogramOptions, gimp_histogram_options, + GIMP_TYPE_COLOR_OPTIONS); -GType -gimp_histogram_options_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo info = - { - sizeof (GimpHistogramOptionsClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_histogram_options_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpHistogramOptions), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL - }; - - type = g_type_register_static (GIMP_TYPE_COLOR_OPTIONS, - "GimpHistogramOptions", - &info, 0); - } - - return type; -} - static void gimp_histogram_options_class_init (GimpHistogramOptionsClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->set_property = gimp_histogram_options_set_property; object_class->get_property = gimp_histogram_options_get_property; @@ -102,6 +71,11 @@ gimp_histogram_options_class_init (GimpHistogramOptionsClass *klass) 0); } +static void +gimp_histogram_options_init (GimpHistogramOptions *options) +{ +} + static void gimp_histogram_options_set_property (GObject *object, guint property_id, diff --git a/app/tools/gimphuesaturationtool.c b/app/tools/gimphuesaturationtool.c index 28219dbda8..34ca659c23 100644 --- a/app/tools/gimphuesaturationtool.c +++ b/app/tools/gimphuesaturationtool.c @@ -60,17 +60,14 @@ /* local function prototypes */ -static void gimp_hue_saturation_tool_class_init (GimpHueSaturationToolClass *klass); -static void gimp_hue_saturation_tool_init (GimpHueSaturationTool *tool); - static void gimp_hue_saturation_tool_finalize (GObject *object); static gboolean gimp_hue_saturation_tool_initialize (GimpTool *tool, GimpDisplay *gdisp); -static void gimp_hue_saturation_tool_map (GimpImageMapTool *image_map_tool); -static void gimp_hue_saturation_tool_dialog (GimpImageMapTool *image_map_tool); -static void gimp_hue_saturation_tool_reset (GimpImageMapTool *image_map_tool); +static void gimp_hue_saturation_tool_map (GimpImageMapTool *im_tool); +static void gimp_hue_saturation_tool_dialog (GimpImageMapTool *im_tool); +static void gimp_hue_saturation_tool_reset (GimpImageMapTool *im_tool); static void hue_saturation_update (GimpHueSaturationTool *hs_tool, gint update); @@ -87,7 +84,11 @@ static void hue_saturation_saturation_adjustment_update (GtkAdjustment *adj, static void hue_saturation_overlap_adjustment_update (GtkAdjustment *adj, gpointer data); -/* private variables */ + +G_DEFINE_TYPE (GimpHueSaturationTool, gimp_hue_saturation_tool, + GIMP_TYPE_IMAGE_MAP_TOOL); + +#define parent_class gimp_hue_saturation_tool_parent_class static gint default_colors[6][3] = { @@ -99,10 +100,6 @@ static gint default_colors[6][3] = { 255, 0, 255 } }; -static GimpImageMapToolClass *parent_class = NULL; - - -/* public functions */ void gimp_hue_saturation_tool_register (GimpToolRegisterCallback callback, @@ -120,59 +117,22 @@ gimp_hue_saturation_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_hue_saturation_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpHueSaturationToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_hue_saturation_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpHueSaturationTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_hue_saturation_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_IMAGE_MAP_TOOL, - "GimpHueSaturationTool", - &tool_info, 0); - } - - return tool_type; -} - - -/* private functions */ - static void gimp_hue_saturation_tool_class_init (GimpHueSaturationToolClass *klass) { - GObjectClass *object_class; - GimpToolClass *tool_class; - GimpImageMapToolClass *image_map_tool_class; + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); + GimpImageMapToolClass *im_tool_class = GIMP_IMAGE_MAP_TOOL_CLASS (klass); - object_class = G_OBJECT_CLASS (klass); - tool_class = GIMP_TOOL_CLASS (klass); - image_map_tool_class = GIMP_IMAGE_MAP_TOOL_CLASS (klass); + object_class->finalize = gimp_hue_saturation_tool_finalize; - parent_class = g_type_class_peek_parent (klass); + tool_class->initialize = gimp_hue_saturation_tool_initialize; - object_class->finalize = gimp_hue_saturation_tool_finalize; + im_tool_class->shell_desc = _("Adjust Hue / Lightness / Saturation"); - tool_class->initialize = gimp_hue_saturation_tool_initialize; - - image_map_tool_class->shell_desc = _("Adjust Hue / Lightness / Saturation"); - - image_map_tool_class->map = gimp_hue_saturation_tool_map; - image_map_tool_class->dialog = gimp_hue_saturation_tool_dialog; - image_map_tool_class->reset = gimp_hue_saturation_tool_reset; + im_tool_class->map = gimp_hue_saturation_tool_map; + im_tool_class->dialog = gimp_hue_saturation_tool_dialog; + im_tool_class->reset = gimp_hue_saturation_tool_reset; } static void diff --git a/app/tools/gimpimagemapoptions.c b/app/tools/gimpimagemapoptions.c index b525bf8fc9..037c8dafdb 100644 --- a/app/tools/gimpimagemapoptions.c +++ b/app/tools/gimpimagemapoptions.c @@ -35,9 +35,7 @@ enum }; -static void gimp_image_map_options_class_init (GimpImageMapOptionsClass *klass); static void gimp_image_map_options_finalize (GObject *object); - static void gimp_image_map_options_set_property (GObject *object, guint property_id, const GValue *value, @@ -48,44 +46,17 @@ static void gimp_image_map_options_get_property (GObject *object, GParamSpec *pspec); -static GimpToolOptionsClass *parent_class = NULL; +G_DEFINE_TYPE (GimpImageMapOptions, gimp_image_map_options, + GIMP_TYPE_TOOL_OPTIONS); +#define parent_class gimp_image_map_options_parent_class -GType -gimp_image_map_options_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo info = - { - sizeof (GimpImageMapOptionsClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_image_map_options_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpImageMapOptions), - 0, /* n_preallocs */ - NULL /* instance_init */ - }; - - type = g_type_register_static (GIMP_TYPE_TOOL_OPTIONS, - "GimpImageMapOptions", - &info, 0); - } - - return type; -} static void gimp_image_map_options_class_init (GimpImageMapOptionsClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->finalize = gimp_image_map_options_finalize; object_class->set_property = gimp_image_map_options_set_property; object_class->get_property = gimp_image_map_options_get_property; @@ -101,6 +72,11 @@ gimp_image_map_options_class_init (GimpImageMapOptionsClass *klass) G_PARAM_READWRITE)); } +static void +gimp_image_map_options_init (GimpImageMapOptions *options) +{ +} + static void gimp_image_map_options_finalize (GObject *object) { diff --git a/app/tools/gimpimagemaptool.c b/app/tools/gimpimagemaptool.c index 2ac2d87a3d..10808d75ae 100644 --- a/app/tools/gimpimagemaptool.c +++ b/app/tools/gimpimagemaptool.c @@ -54,9 +54,6 @@ /* local function prototypes */ -static void gimp_image_map_tool_class_init (GimpImageMapToolClass *klass); -static void gimp_image_map_tool_init (GimpImageMapTool *image_map_tool); - static void gimp_image_map_tool_finalize (GObject *object); static gboolean gimp_image_map_tool_initialize (GimpTool *tool, @@ -74,16 +71,16 @@ static gboolean gimp_image_map_tool_pick_color (GimpColorTool *color_tool, GimpImageType *sample_type, GimpRGB *color, gint *color_index); -static void gimp_image_map_tool_map (GimpImageMapTool *image_map_tool); -static void gimp_image_map_tool_dialog (GimpImageMapTool *image_map_tool); -static void gimp_image_map_tool_reset (GimpImageMapTool *image_map_tool); +static void gimp_image_map_tool_map (GimpImageMapTool *im_tool); +static void gimp_image_map_tool_dialog (GimpImageMapTool *im_tool); +static void gimp_image_map_tool_reset (GimpImageMapTool *im_tool); static void gimp_image_map_tool_flush (GimpImageMap *image_map, - GimpImageMapTool *image_map_tool); + GimpImageMapTool *im_tool); static void gimp_image_map_tool_response (GtkWidget *widget, gint response_id, - GimpImageMapTool *image_map_tool); + GimpImageMapTool *im_tool); static void gimp_image_map_tool_load_clicked (GtkWidget *widget, GimpImageMapTool *tool); @@ -96,45 +93,19 @@ static void gimp_image_map_tool_save_ext_clicked (GtkWidget *widget, GdkModifierType state, GimpImageMapTool *tool); -static void gimp_image_map_tool_settings_dialog (GimpImageMapTool *image_map_tool, +static void gimp_image_map_tool_settings_dialog (GimpImageMapTool *im_tool, const gchar *title, gboolean save); -static void gimp_image_map_tool_notify_preview (GObject *config, - GParamSpec *pspec, - GimpImageMapTool *image_map_tool); +static void gimp_image_map_tool_notify_preview (GObject *config, + GParamSpec *pspec, + GimpImageMapTool *im_tool); -static GimpToolClass *parent_class = NULL; +G_DEFINE_TYPE (GimpImageMapTool, gimp_image_map_tool, GIMP_TYPE_COLOR_TOOL); +#define parent_class gimp_image_map_tool_parent_class -GType -gimp_image_map_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpImageMapToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_image_map_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpImageMapTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_image_map_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_COLOR_TOOL, - "GimpImageMapTool", - &tool_info, 0); - } - - return tool_type; -} static void gimp_image_map_tool_class_init (GimpImageMapToolClass *klass) @@ -143,15 +114,13 @@ gimp_image_map_tool_class_init (GimpImageMapToolClass *klass) GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); GimpColorToolClass *color_tool_class = GIMP_COLOR_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); + object_class->finalize = gimp_image_map_tool_finalize; - object_class->finalize = gimp_image_map_tool_finalize; + tool_class->initialize = gimp_image_map_tool_initialize; + tool_class->control = gimp_image_map_tool_control; + tool_class->key_press = gimp_image_map_tool_key_press; - tool_class->initialize = gimp_image_map_tool_initialize; - tool_class->control = gimp_image_map_tool_control; - tool_class->key_press = gimp_image_map_tool_key_press; - - color_tool_class->pick = gimp_image_map_tool_pick_color; + color_tool_class->pick = gimp_image_map_tool_pick_color; klass->shell_desc = NULL; klass->settings_name = NULL; @@ -160,11 +129,11 @@ gimp_image_map_tool_class_init (GimpImageMapToolClass *klass) klass->save_dialog_title = NULL; klass->save_button_tip = NULL; - klass->map = NULL; - klass->dialog = NULL; - klass->reset = NULL; - klass->settings_load = NULL; - klass->settings_save = NULL; + klass->map = NULL; + klass->dialog = NULL; + klass->reset = NULL; + klass->settings_load = NULL; + klass->settings_save = NULL; } static void diff --git a/app/tools/gimpinktool.c b/app/tools/gimpinktool.c index a615838ac2..bd4c062573 100644 --- a/app/tools/gimpinktool.c +++ b/app/tools/gimpinktool.c @@ -35,16 +35,15 @@ #include "gimp-intl.h" -static void gimp_ink_tool_init (GimpInkTool *tool); -static void gimp_ink_tool_class_init (GimpInkToolClass *klass); - -static void gimp_ink_tool_cursor_update (GimpTool *tool, - GimpCoords *coords, - GdkModifierType state, - GimpDisplay *gdisp); +static void gimp_ink_tool_cursor_update (GimpTool *tool, + GimpCoords *coords, + GdkModifierType state, + GimpDisplay *gdisp); -static GimpPaintToolClass *parent_class = NULL; +G_DEFINE_TYPE (GimpInkTool, gimp_ink_tool, GIMP_TYPE_PAINT_TOOL); + +#define parent_class gimp_ink_tool_parent_class void @@ -67,41 +66,11 @@ gimp_ink_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_ink_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpInkToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_ink_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpInkTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_ink_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_PAINT_TOOL, - "GimpInkTool", - &tool_info, 0); - } - - return tool_type; -} - static void gimp_ink_tool_class_init (GimpInkToolClass *klass) { GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - tool_class->cursor_update = gimp_ink_tool_cursor_update; } diff --git a/app/tools/gimpiscissorstool.c b/app/tools/gimpiscissorstool.c index 83d3c002ae..03d87bd3cf 100644 --- a/app/tools/gimpiscissorstool.c +++ b/app/tools/gimpiscissorstool.c @@ -123,9 +123,6 @@ struct _ICurve /* local function prototypes */ -static void gimp_iscissors_tool_class_init (GimpIscissorsToolClass *klass); -static void gimp_iscissors_tool_init (GimpIscissorsTool *iscissors); - static void gimp_iscissors_tool_finalize (GObject *object); static void gimp_iscissors_tool_control (GimpTool *tool, @@ -202,6 +199,12 @@ static GPtrArray * plot_pixels (GimpIscissorsTool *iscissors, gint ye); +G_DEFINE_TYPE (GimpIscissorsTool, gimp_iscissors_tool, + GIMP_TYPE_SELECTION_TOOL); + +#define parent_class gimp_iscissors_tool_parent_class + + /* static variables */ /* where to move on a given link direction */ @@ -263,9 +266,6 @@ static gboolean initialized = FALSE; static Tile *cur_tile = NULL; -static GimpSelectionToolClass *parent_class = NULL; - - void gimp_iscissors_tool_register (GimpToolRegisterCallback callback, gpointer data) @@ -284,34 +284,6 @@ gimp_iscissors_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_iscissors_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpIscissorsToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_iscissors_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpIscissorsTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_iscissors_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_SELECTION_TOOL, - "GimpIscissorsTool", - &tool_info, 0); - } - - return tool_type; -} - static void gimp_iscissors_tool_class_init (GimpIscissorsToolClass *klass) { @@ -319,8 +291,6 @@ gimp_iscissors_tool_class_init (GimpIscissorsToolClass *klass) GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->finalize = gimp_iscissors_tool_finalize; tool_class->control = gimp_iscissors_tool_control; diff --git a/app/tools/gimplevelstool.c b/app/tools/gimplevelstool.c index 857172b5d4..675573a661 100644 --- a/app/tools/gimplevelstool.c +++ b/app/tools/gimplevelstool.c @@ -77,9 +77,7 @@ /* local function prototypes */ -static void gimp_levels_tool_class_init (GimpLevelsToolClass *klass); -static void gimp_levels_tool_init (GimpLevelsTool *tool); -static void gimp_levels_tool_finalize (GObject *object); +static void gimp_levels_tool_finalize (GObject *object); static gboolean gimp_levels_tool_initialize (GimpTool *tool, GimpDisplay *gdisp); @@ -138,10 +136,10 @@ static gboolean levels_output_area_expose (GtkWidget *widget, GimpLevelsTool *tool); -static GimpImageMapToolClass *parent_class = NULL; +G_DEFINE_TYPE (GimpLevelsTool, gimp_levels_tool, GIMP_TYPE_IMAGE_MAP_TOOL); +#define parent_class gimp_levels_tool_parent_class -/* public functions */ void gimp_levels_tool_register (GimpToolRegisterCallback callback, @@ -160,71 +158,32 @@ gimp_levels_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_levels_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpLevelsToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_levels_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpLevelsTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_levels_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_IMAGE_MAP_TOOL, - "GimpLevelsTool", - &tool_info, 0); - } - - return tool_type; -} - - -/* private functions */ - static void gimp_levels_tool_class_init (GimpLevelsToolClass *klass) { - GObjectClass *object_class; - GimpToolClass *tool_class; - GimpColorToolClass *color_tool_class; - GimpImageMapToolClass *image_map_tool_class; + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); + GimpColorToolClass *color_tool_class = GIMP_COLOR_TOOL_CLASS (klass); + GimpImageMapToolClass *im_tool_class = GIMP_IMAGE_MAP_TOOL_CLASS (klass); - object_class = G_OBJECT_CLASS (klass); - tool_class = GIMP_TOOL_CLASS (klass); - color_tool_class = GIMP_COLOR_TOOL_CLASS (klass); - image_map_tool_class = GIMP_IMAGE_MAP_TOOL_CLASS (klass); + object_class->finalize = gimp_levels_tool_finalize; - parent_class = g_type_class_peek_parent (klass); + tool_class->initialize = gimp_levels_tool_initialize; - object_class->finalize = gimp_levels_tool_finalize; + color_tool_class->picked = gimp_levels_tool_color_picked; - tool_class->initialize = gimp_levels_tool_initialize; + im_tool_class->shell_desc = _("Adjust Color Levels"); + im_tool_class->settings_name = "levels"; + im_tool_class->load_dialog_title = _("Load Levels"); + im_tool_class->load_button_tip = _("Load levels settings from file"); + im_tool_class->save_dialog_title = _("Save Levels"); + im_tool_class->save_button_tip = _("Save levels settings to file"); - color_tool_class->picked = gimp_levels_tool_color_picked; - - image_map_tool_class->shell_desc = _("Adjust Color Levels"); - image_map_tool_class->settings_name = "levels"; - image_map_tool_class->load_dialog_title = _("Load Levels"); - image_map_tool_class->load_button_tip = _("Load levels settings from file"); - image_map_tool_class->save_dialog_title = _("Save Levels"); - image_map_tool_class->save_button_tip = _("Save levels settings to file"); - - image_map_tool_class->map = gimp_levels_tool_map; - image_map_tool_class->dialog = gimp_levels_tool_dialog; - image_map_tool_class->reset = gimp_levels_tool_reset; - - image_map_tool_class->settings_load = gimp_levels_tool_settings_load; - image_map_tool_class->settings_save = gimp_levels_tool_settings_save; + im_tool_class->map = gimp_levels_tool_map; + im_tool_class->dialog = gimp_levels_tool_dialog; + im_tool_class->reset = gimp_levels_tool_reset; + im_tool_class->settings_load = gimp_levels_tool_settings_load; + im_tool_class->settings_save = gimp_levels_tool_settings_save; } static void diff --git a/app/tools/gimpmagnifyoptions.c b/app/tools/gimpmagnifyoptions.c index 5727b584a9..f3a2086e93 100644 --- a/app/tools/gimpmagnifyoptions.c +++ b/app/tools/gimpmagnifyoptions.c @@ -47,8 +47,6 @@ enum }; -static void gimp_magnify_options_class_init (GimpMagnifyOptionsClass *klass); - static void gimp_magnify_options_set_property (GObject *object, guint property_id, const GValue *value, @@ -61,36 +59,11 @@ static void gimp_magnify_options_get_property (GObject *object, static void gimp_magnify_options_reset (GimpToolOptions *tool_options); -static GimpToolOptionsClass *parent_class = NULL; +G_DEFINE_TYPE (GimpMagnifyOptions, gimp_magnify_options, + GIMP_TYPE_TOOL_OPTIONS); +#define parent_class gimp_magnify_options_parent_class -GType -gimp_magnify_options_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo info = - { - sizeof (GimpMagnifyOptionsClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_magnify_options_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpMagnifyOptions), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL - }; - - type = g_type_register_static (GIMP_TYPE_TOOL_OPTIONS, - "GimpMagnifyOptions", - &info, 0); - } - - return type; -} static void gimp_magnify_options_class_init (GimpMagnifyOptionsClass *klass) @@ -98,8 +71,6 @@ gimp_magnify_options_class_init (GimpMagnifyOptionsClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GimpToolOptionsClass *options_class = GIMP_TOOL_OPTIONS_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->set_property = gimp_magnify_options_set_property; object_class->get_property = gimp_magnify_options_get_property; @@ -120,6 +91,11 @@ gimp_magnify_options_class_init (GimpMagnifyOptionsClass *klass) 0); } +static void +gimp_magnify_options_init (GimpMagnifyOptions *options) +{ +} + static void gimp_magnify_options_set_property (GObject *object, guint property_id, diff --git a/app/tools/gimpmagnifytool.c b/app/tools/gimpmagnifytool.c index fe841189b8..f9569e089e 100644 --- a/app/tools/gimpmagnifytool.c +++ b/app/tools/gimpmagnifytool.c @@ -47,9 +47,6 @@ #include "gimp-intl.h" -static void gimp_magnify_tool_class_init (GimpMagnifyToolClass *klass); -static void gimp_magnify_tool_init (GimpMagnifyTool *tool); - static void gimp_magnify_tool_button_press (GimpTool *tool, GimpCoords *coords, guint32 time, @@ -78,10 +75,10 @@ static void gimp_magnify_tool_cursor_update (GimpTool *tool, static void gimp_magnify_tool_draw (GimpDrawTool *draw_tool); -static GimpDrawToolClass *parent_class = NULL; +G_DEFINE_TYPE (GimpMagnifyTool, gimp_magnify_tool, GIMP_TYPE_DRAW_TOOL); +#define parent_class gimp_magnify_tool_parent_class -/* public functions */ void gimp_magnify_tool_register (GimpToolRegisterCallback callback, @@ -100,45 +97,12 @@ gimp_magnify_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_magnify_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpMagnifyToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_magnify_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpMagnifyTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_magnify_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_DRAW_TOOL, - "GimpMagnifyTool", - &tool_info, 0); - } - - return tool_type; -} - - -/* private functions */ - static void gimp_magnify_tool_class_init (GimpMagnifyToolClass *klass) { GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - tool_class->button_press = gimp_magnify_tool_button_press; tool_class->button_release = gimp_magnify_tool_button_release; tool_class->motion = gimp_magnify_tool_motion; diff --git a/app/tools/gimpmeasureoptions.c b/app/tools/gimpmeasureoptions.c index d9484b0cc2..903d464cd5 100644 --- a/app/tools/gimpmeasureoptions.c +++ b/app/tools/gimpmeasureoptions.c @@ -43,56 +43,25 @@ enum }; -static void gimp_measure_options_class_init (GimpMeasureOptionsClass *klass); - -static void gimp_measure_options_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec); -static void gimp_measure_options_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec); +static void gimp_measure_options_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec); +static void gimp_measure_options_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec); -static GimpToolOptionsClass *parent_class = NULL; +G_DEFINE_TYPE (GimpMeasureOptions, gimp_measure_options, + GIMP_TYPE_TOOL_OPTIONS); -GType -gimp_measure_options_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo info = - { - sizeof (GimpMeasureOptionsClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_measure_options_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpMeasureOptions), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL - }; - - type = g_type_register_static (GIMP_TYPE_TOOL_OPTIONS, - "GimpMeasureOptions", - &info, 0); - } - - return type; -} - static void gimp_measure_options_class_init (GimpMeasureOptionsClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->set_property = gimp_measure_options_set_property; object_class->get_property = gimp_measure_options_get_property; @@ -102,6 +71,11 @@ gimp_measure_options_class_init (GimpMeasureOptionsClass *klass) 0); } +static void +gimp_measure_options_init (GimpMeasureOptions *options) +{ +} + static void gimp_measure_options_set_property (GObject *object, guint property_id, diff --git a/app/tools/gimpmeasuretool.c b/app/tools/gimpmeasuretool.c index 18202ab00a..912c52cd6f 100644 --- a/app/tools/gimpmeasuretool.c +++ b/app/tools/gimpmeasuretool.c @@ -60,9 +60,6 @@ /* local function prototypes */ -static void gimp_measure_tool_class_init (GimpMeasureToolClass *klass); -static void gimp_measure_tool_init (GimpMeasureTool *tool); - static void gimp_measure_tool_control (GimpTool *tool, GimpToolAction action, GimpDisplay *gdisp); @@ -103,7 +100,9 @@ static void gimp_measure_tool_dialog_update (GimpMeasureTool *mtool, GimpDisplay *gdisp); -static GimpDrawToolClass *parent_class = NULL; +G_DEFINE_TYPE (GimpMeasureTool, gimp_measure_tool, GIMP_TYPE_DRAW_TOOL); + +#define parent_class gimp_measure_tool_parent_class void @@ -123,42 +122,12 @@ gimp_measure_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_measure_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpMeasureToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_measure_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpMeasureTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_measure_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_DRAW_TOOL, - "GimpMeasureTool", - &tool_info, 0); - } - - return tool_type; -} - static void gimp_measure_tool_class_init (GimpMeasureToolClass *klass) { GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - tool_class->control = gimp_measure_tool_control; tool_class->button_press = gimp_measure_tool_button_press; tool_class->button_release = gimp_measure_tool_button_release; diff --git a/app/tools/gimpmoveoptions.c b/app/tools/gimpmoveoptions.c index 8f7a9d9f1d..f2d215d288 100644 --- a/app/tools/gimpmoveoptions.c +++ b/app/tools/gimpmoveoptions.c @@ -43,56 +43,24 @@ enum }; -static void gimp_move_options_class_init (GimpMoveOptionsClass *options_class); - -static void gimp_move_options_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec); -static void gimp_move_options_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec); +static void gimp_move_options_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec); +static void gimp_move_options_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec); -static GimpToolOptionsClass *parent_class = NULL; +G_DEFINE_TYPE (GimpMoveOptions, gimp_move_options, GIMP_TYPE_TOOL_OPTIONS); -GType -gimp_move_options_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo info = - { - sizeof (GimpMoveOptionsClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_move_options_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpMoveOptions), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL - }; - - type = g_type_register_static (GIMP_TYPE_TOOL_OPTIONS, - "GimpMoveOptions", - &info, 0); - } - - return type; -} - static void gimp_move_options_class_init (GimpMoveOptionsClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->set_property = gimp_move_options_set_property; object_class->get_property = gimp_move_options_get_property; @@ -107,6 +75,11 @@ gimp_move_options_class_init (GimpMoveOptionsClass *klass) 0); } +static void +gimp_move_options_init (GimpMoveOptions *options) +{ +} + static void gimp_move_options_set_property (GObject *object, guint property_id, diff --git a/app/tools/gimpmovetool.c b/app/tools/gimpmovetool.c index 1351ffdd38..38bcff2d08 100644 --- a/app/tools/gimpmovetool.c +++ b/app/tools/gimpmovetool.c @@ -59,9 +59,6 @@ /* local function prototypes */ -static void gimp_move_tool_class_init (GimpMoveToolClass *klass); -static void gimp_move_tool_init (GimpMoveTool *move_tool); - static void gimp_move_tool_control (GimpTool *tool, GimpToolAction action, GimpDisplay *gdisp); @@ -101,7 +98,9 @@ static void gimp_move_tool_start_guide (GimpMoveTool *move, GimpOrientationType orientation); -static GimpDrawToolClass *parent_class = NULL; +G_DEFINE_TYPE (GimpMoveTool, gimp_move_tool, GIMP_TYPE_DRAW_TOOL); + +#define parent_class gimp_move_tool_parent_class void @@ -121,42 +120,12 @@ gimp_move_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_move_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpMoveToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_move_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpMoveTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_move_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_DRAW_TOOL, - "GimpMoveTool", - &tool_info, 0); - } - - return tool_type; -} - static void gimp_move_tool_class_init (GimpMoveToolClass *klass) { GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - tool_class->control = gimp_move_tool_control; tool_class->button_press = gimp_move_tool_button_press; tool_class->button_release = gimp_move_tool_button_release; diff --git a/app/tools/gimpnewrectselectoptions.c b/app/tools/gimpnewrectselectoptions.c index 79992e16ef..1f725f081a 100644 --- a/app/tools/gimpnewrectselectoptions.c +++ b/app/tools/gimpnewrectselectoptions.c @@ -35,57 +35,20 @@ #include "gimp-intl.h" -static void gimp_new_rect_select_options_class_init (GimpNewRectSelectOptionsClass *klass); -static void gimp_new_rect_select_options_rectangle_options_iface_init (GimpRectangleOptionsInterface *rectangle_iface); +static void gimp_new_rect_select_options_rectangle_options_iface_init (GimpRectangleOptionsInterface *iface); -static GimpSelectionOptionsClass *parent_class = NULL; +G_DEFINE_TYPE_WITH_CODE (GimpNewRectSelectOptions, gimp_new_rect_select_options, + GIMP_TYPE_SELECTION_OPTIONS, + G_IMPLEMENT_INTERFACE (GIMP_TYPE_RECTANGLE_OPTIONS, + gimp_new_rect_select_options_rectangle_options_iface_init)); -GType -gimp_new_rect_select_options_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo info = - { - sizeof (GimpNewRectSelectOptionsClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_new_rect_select_options_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpNewRectSelectOptions), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL - }; - static const GInterfaceInfo rectangle_info = - { - (GInterfaceInitFunc) gimp_new_rect_select_options_rectangle_options_iface_init, /* interface_init */ - NULL, /* interface_finalize */ - NULL /* interface_data */ - }; - - type = g_type_register_static (GIMP_TYPE_SELECTION_OPTIONS, - "GimpNewRectSelectOptions", - &info, 0); - g_type_add_interface_static (type, - GIMP_TYPE_RECTANGLE_OPTIONS, - &rectangle_info); - } - - return type; -} - static void gimp_new_rect_select_options_class_init (GimpNewRectSelectOptionsClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->set_property = gimp_rectangle_options_set_property; object_class->get_property = gimp_rectangle_options_get_property; @@ -93,7 +56,12 @@ gimp_new_rect_select_options_class_init (GimpNewRectSelectOptionsClass *klass) } static void -gimp_new_rect_select_options_rectangle_options_iface_init (GimpRectangleOptionsInterface *rectangle_iface) +gimp_new_rect_select_options_init (GimpNewRectSelectOptions *options) +{ +} + +static void +gimp_new_rect_select_options_rectangle_options_iface_init (GimpRectangleOptionsInterface *iface) { } diff --git a/app/tools/gimpnewrectselecttool.c b/app/tools/gimpnewrectselecttool.c index 1001431e57..05473a2ee9 100644 --- a/app/tools/gimpnewrectselecttool.c +++ b/app/tools/gimpnewrectselecttool.c @@ -55,9 +55,7 @@ #include "gimp-intl.h" -static void gimp_new_rect_select_tool_class_init (GimpNewRectSelectToolClass *klass); -static void gimp_new_rect_select_tool_init (GimpNewRectSelectTool *rect_tool); -static void gimp_new_rect_select_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *rectangle_iface); +static void gimp_new_rect_select_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *iface); static GObject * gimp_new_rect_select_tool_constructor (GType type, guint n_params, @@ -86,10 +84,14 @@ static gboolean gimp_new_rect_select_tool_execute (GimpRectangleTool gint w, gint h); -static GimpSelectionToolClass *parent_class = NULL; +G_DEFINE_TYPE_WITH_CODE (GimpNewRectSelectTool, gimp_new_rect_select_tool, + GIMP_TYPE_SELECTION_TOOL, + G_IMPLEMENT_INTERFACE (GIMP_TYPE_RECTANGLE_TOOL, + gimp_new_rect_select_tool_rectangle_tool_iface_init)); + +#define parent_class gimp_new_rect_select_tool_parent_class -/* public functions */ void gimp_new_rect_select_tool_register (GimpToolRegisterCallback callback, @@ -108,43 +110,6 @@ gimp_new_rect_select_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_new_rect_select_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpNewRectSelectToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_new_rect_select_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpNewRectSelectTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_new_rect_select_tool_init, - }; - static const GInterfaceInfo rectangle_info = - { - (GInterfaceInitFunc) gimp_new_rect_select_tool_rectangle_tool_iface_init, /* interface_init */ - NULL, /* interface_finalize */ - NULL /* interface_data */ - }; - - tool_type = g_type_register_static (GIMP_TYPE_SELECTION_TOOL, - "GimpNewRectSelectTool", - &tool_info, 0); - g_type_add_interface_static (tool_type, - GIMP_TYPE_RECTANGLE_TOOL, - &rectangle_info); - } - - return tool_type; -} - static void gimp_new_rect_select_tool_class_init (GimpNewRectSelectToolClass *klass) { @@ -152,13 +117,12 @@ gimp_new_rect_select_tool_class_init (GimpNewRectSelectToolClass *klass) GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_new_rect_select_tool_constructor; object_class->dispose = gimp_rectangle_tool_dispose; object_class->finalize = gimp_new_rect_select_tool_finalize; object_class->set_property = gimp_rectangle_tool_set_property; object_class->get_property = gimp_rectangle_tool_get_property; + gimp_rectangle_tool_install_properties (object_class); tool_class->initialize = gimp_rectangle_tool_initialize; @@ -183,9 +147,9 @@ gimp_new_rect_select_tool_init (GimpNewRectSelectTool *new_rect_select_tool) } static void -gimp_new_rect_select_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *rectangle_iface) +gimp_new_rect_select_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *iface) { - rectangle_iface->execute = gimp_new_rect_select_tool_execute; + iface->execute = gimp_new_rect_select_tool_execute; } static GObject * @@ -418,4 +382,3 @@ gimp_new_rect_select_tool_execute (GimpRectangleTool *rectangle, return TRUE; } - diff --git a/app/tools/gimppaintbrushtool.c b/app/tools/gimppaintbrushtool.c index 15b769309d..f3c5282805 100644 --- a/app/tools/gimppaintbrushtool.c +++ b/app/tools/gimppaintbrushtool.c @@ -35,7 +35,7 @@ #include "gimp-intl.h" -static void gimp_paintbrush_tool_init (GimpPaintbrushTool *tool); +G_DEFINE_TYPE (GimpPaintbrushTool, gimp_paintbrush_tool, GIMP_TYPE_PAINT_TOOL); void @@ -56,32 +56,9 @@ gimp_paintbrush_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_paintbrush_tool_get_type (void) +static void +gimp_paintbrush_tool_class_init (GimpPaintbrushToolClass *klass) { - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpPaintbrushToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - NULL, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpPaintbrushTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_paintbrush_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_PAINT_TOOL, - "GimpPaintbrushTool", - &tool_info, 0); - } - - return tool_type; } static void diff --git a/app/tools/gimppainttool.c b/app/tools/gimppainttool.c index 91ae6e40de..b1898f5e4a 100644 --- a/app/tools/gimppainttool.c +++ b/app/tools/gimppainttool.c @@ -62,9 +62,6 @@ #define STATUSBAR_SIZE 128 -static void gimp_paint_tool_class_init (GimpPaintToolClass *klass); -static void gimp_paint_tool_init (GimpPaintTool *paint_tool); - static GObject * gimp_paint_tool_constructor (GType type, guint n_params, GObjectConstructParam *params); @@ -121,36 +118,10 @@ static void gimp_paint_tool_notify_brush (GimpDisplayConfig *config, GimpPaintTool *paint_tool); -static GimpColorToolClass *parent_class = NULL; +G_DEFINE_TYPE (GimpPaintTool, gimp_paint_tool, GIMP_TYPE_COLOR_TOOL); +#define parent_class gimp_paint_tool_parent_class -GType -gimp_paint_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpPaintToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_paint_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpPaintTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_paint_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_COLOR_TOOL, - "GimpPaintTool", - &tool_info, 0); - } - - return tool_type; -} static void gimp_paint_tool_class_init (GimpPaintToolClass *klass) @@ -160,8 +131,6 @@ gimp_paint_tool_class_init (GimpPaintToolClass *klass) GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); GimpColorToolClass *color_tool_class = GIMP_COLOR_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_paint_tool_constructor; object_class->finalize = gimp_paint_tool_finalize; diff --git a/app/tools/gimppenciltool.c b/app/tools/gimppenciltool.c index fcc5896dcb..23f1142442 100644 --- a/app/tools/gimppenciltool.c +++ b/app/tools/gimppenciltool.c @@ -35,7 +35,7 @@ #include "gimp-intl.h" -static void gimp_pencil_tool_init (GimpPencilTool *pencil); +G_DEFINE_TYPE (GimpPencilTool, gimp_pencil_tool, GIMP_TYPE_PAINTBRUSH_TOOL); void @@ -56,32 +56,9 @@ gimp_pencil_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_pencil_tool_get_type (void) +static void +gimp_pencil_tool_class_init (GimpPencilToolClass *klass) { - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpPencilToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - NULL, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpPencilTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_pencil_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_PAINTBRUSH_TOOL, - "GimpPencilTool", - &tool_info, 0); - } - - return tool_type; } static void diff --git a/app/tools/gimpperspectivetool.c b/app/tools/gimpperspectivetool.c index fd665aa0c6..7d63e2ab4b 100644 --- a/app/tools/gimpperspectivetool.c +++ b/app/tools/gimpperspectivetool.c @@ -49,9 +49,6 @@ /* local function prototypes */ -static void gimp_perspective_tool_class_init (GimpPerspectiveToolClass *klass); -static void gimp_perspective_tool_init (GimpPerspectiveTool *tool); - static void gimp_perspective_tool_dialog (GimpTransformTool *tr_tool); static void gimp_perspective_tool_dialog_update (GimpTransformTool *tr_tool); static void gimp_perspective_tool_prepare (GimpTransformTool *tr_tool, @@ -62,12 +59,9 @@ static void gimp_perspective_tool_recalc (GimpTransformTool *tr_tool, GimpDisplay *gdisp); -/* private variables */ +G_DEFINE_TYPE (GimpPerspectiveTool, gimp_perspective_tool, + GIMP_TYPE_TRANSFORM_TOOL); -static GimpTransformToolClass *parent_class = NULL; - - -/* public functions */ void gimp_perspective_tool_register (GimpToolRegisterCallback callback, @@ -86,41 +80,11 @@ gimp_perspective_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_perspective_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpPerspectiveToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_perspective_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpPerspectiveTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_perspective_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_TRANSFORM_TOOL, - "GimpPerspectiveTool", - &tool_info, 0); - } - - return tool_type; -} - static void gimp_perspective_tool_class_init (GimpPerspectiveToolClass *klass) { GimpTransformToolClass *trans_class = GIMP_TRANSFORM_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - trans_class->dialog = gimp_perspective_tool_dialog; trans_class->dialog_update = gimp_perspective_tool_dialog_update; trans_class->prepare = gimp_perspective_tool_prepare; diff --git a/app/tools/gimpposterizetool.c b/app/tools/gimpposterizetool.c index bc28b1a6d7..e098c2e83d 100644 --- a/app/tools/gimpposterizetool.c +++ b/app/tools/gimpposterizetool.c @@ -46,26 +46,24 @@ #define SLIDER_WIDTH 200 -static void gimp_posterize_tool_class_init (GimpPosterizeToolClass *klass); -static void gimp_posterize_tool_init (GimpPosterizeTool *bc_tool); +static void gimp_posterize_tool_finalize (GObject *object); -static void gimp_posterize_tool_finalize (GObject *object); +static gboolean gimp_posterize_tool_initialize (GimpTool *tool, + GimpDisplay *gdisp); -static gboolean gimp_posterize_tool_initialize (GimpTool *tool, - GimpDisplay *gdisp); - -static void gimp_posterize_tool_map (GimpImageMapTool *image_map_tool); -static void gimp_posterize_tool_dialog (GimpImageMapTool *image_map_tool); -static void gimp_posterize_tool_reset (GimpImageMapTool *image_map_tool); +static void gimp_posterize_tool_map (GimpImageMapTool *im_tool); +static void gimp_posterize_tool_dialog (GimpImageMapTool *im_tool); +static void gimp_posterize_tool_reset (GimpImageMapTool *im_tool); static void posterize_levels_adjustment_update (GtkAdjustment *adjustment, GimpPosterizeTool *posterize_tool); -static GimpImageMapToolClass *parent_class = NULL; +G_DEFINE_TYPE (GimpPosterizeTool, gimp_posterize_tool, + GIMP_TYPE_IMAGE_MAP_TOOL); +#define parent_class gimp_posterize_tool_parent_class -/* functions */ void gimp_posterize_tool_register (GimpToolRegisterCallback callback, @@ -83,56 +81,22 @@ gimp_posterize_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_posterize_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpPosterizeToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_posterize_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpPosterizeTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_posterize_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_IMAGE_MAP_TOOL, - "GimpPosterizeTool", - &tool_info, 0); - } - - return tool_type; -} - static void gimp_posterize_tool_class_init (GimpPosterizeToolClass *klass) { - GObjectClass *object_class; - GimpToolClass *tool_class; - GimpImageMapToolClass *image_map_tool_class; + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); + GimpImageMapToolClass *im_tool_class = GIMP_IMAGE_MAP_TOOL_CLASS (klass); - object_class = G_OBJECT_CLASS (klass); - tool_class = GIMP_TOOL_CLASS (klass); - image_map_tool_class = GIMP_IMAGE_MAP_TOOL_CLASS (klass); + object_class->finalize = gimp_posterize_tool_finalize; - parent_class = g_type_class_peek_parent (klass); + tool_class->initialize = gimp_posterize_tool_initialize; - object_class->finalize = gimp_posterize_tool_finalize; + im_tool_class->shell_desc = _("Posterize (Reduce Number of Colors)"); - tool_class->initialize = gimp_posterize_tool_initialize; - - image_map_tool_class->shell_desc = _("Posterize (Reduce Number of Colors)"); - - image_map_tool_class->map = gimp_posterize_tool_map; - image_map_tool_class->dialog = gimp_posterize_tool_dialog; - image_map_tool_class->reset = gimp_posterize_tool_reset; + im_tool_class->map = gimp_posterize_tool_map; + im_tool_class->dialog = gimp_posterize_tool_dialog; + im_tool_class->reset = gimp_posterize_tool_reset; } static void diff --git a/app/tools/gimprectangleselectoptions.c b/app/tools/gimprectangleselectoptions.c index 79992e16ef..1f725f081a 100644 --- a/app/tools/gimprectangleselectoptions.c +++ b/app/tools/gimprectangleselectoptions.c @@ -35,57 +35,20 @@ #include "gimp-intl.h" -static void gimp_new_rect_select_options_class_init (GimpNewRectSelectOptionsClass *klass); -static void gimp_new_rect_select_options_rectangle_options_iface_init (GimpRectangleOptionsInterface *rectangle_iface); +static void gimp_new_rect_select_options_rectangle_options_iface_init (GimpRectangleOptionsInterface *iface); -static GimpSelectionOptionsClass *parent_class = NULL; +G_DEFINE_TYPE_WITH_CODE (GimpNewRectSelectOptions, gimp_new_rect_select_options, + GIMP_TYPE_SELECTION_OPTIONS, + G_IMPLEMENT_INTERFACE (GIMP_TYPE_RECTANGLE_OPTIONS, + gimp_new_rect_select_options_rectangle_options_iface_init)); -GType -gimp_new_rect_select_options_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo info = - { - sizeof (GimpNewRectSelectOptionsClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_new_rect_select_options_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpNewRectSelectOptions), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL - }; - static const GInterfaceInfo rectangle_info = - { - (GInterfaceInitFunc) gimp_new_rect_select_options_rectangle_options_iface_init, /* interface_init */ - NULL, /* interface_finalize */ - NULL /* interface_data */ - }; - - type = g_type_register_static (GIMP_TYPE_SELECTION_OPTIONS, - "GimpNewRectSelectOptions", - &info, 0); - g_type_add_interface_static (type, - GIMP_TYPE_RECTANGLE_OPTIONS, - &rectangle_info); - } - - return type; -} - static void gimp_new_rect_select_options_class_init (GimpNewRectSelectOptionsClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->set_property = gimp_rectangle_options_set_property; object_class->get_property = gimp_rectangle_options_get_property; @@ -93,7 +56,12 @@ gimp_new_rect_select_options_class_init (GimpNewRectSelectOptionsClass *klass) } static void -gimp_new_rect_select_options_rectangle_options_iface_init (GimpRectangleOptionsInterface *rectangle_iface) +gimp_new_rect_select_options_init (GimpNewRectSelectOptions *options) +{ +} + +static void +gimp_new_rect_select_options_rectangle_options_iface_init (GimpRectangleOptionsInterface *iface) { } diff --git a/app/tools/gimprectangleselecttool.c b/app/tools/gimprectangleselecttool.c index 1001431e57..05473a2ee9 100644 --- a/app/tools/gimprectangleselecttool.c +++ b/app/tools/gimprectangleselecttool.c @@ -55,9 +55,7 @@ #include "gimp-intl.h" -static void gimp_new_rect_select_tool_class_init (GimpNewRectSelectToolClass *klass); -static void gimp_new_rect_select_tool_init (GimpNewRectSelectTool *rect_tool); -static void gimp_new_rect_select_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *rectangle_iface); +static void gimp_new_rect_select_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *iface); static GObject * gimp_new_rect_select_tool_constructor (GType type, guint n_params, @@ -86,10 +84,14 @@ static gboolean gimp_new_rect_select_tool_execute (GimpRectangleTool gint w, gint h); -static GimpSelectionToolClass *parent_class = NULL; +G_DEFINE_TYPE_WITH_CODE (GimpNewRectSelectTool, gimp_new_rect_select_tool, + GIMP_TYPE_SELECTION_TOOL, + G_IMPLEMENT_INTERFACE (GIMP_TYPE_RECTANGLE_TOOL, + gimp_new_rect_select_tool_rectangle_tool_iface_init)); + +#define parent_class gimp_new_rect_select_tool_parent_class -/* public functions */ void gimp_new_rect_select_tool_register (GimpToolRegisterCallback callback, @@ -108,43 +110,6 @@ gimp_new_rect_select_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_new_rect_select_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpNewRectSelectToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_new_rect_select_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpNewRectSelectTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_new_rect_select_tool_init, - }; - static const GInterfaceInfo rectangle_info = - { - (GInterfaceInitFunc) gimp_new_rect_select_tool_rectangle_tool_iface_init, /* interface_init */ - NULL, /* interface_finalize */ - NULL /* interface_data */ - }; - - tool_type = g_type_register_static (GIMP_TYPE_SELECTION_TOOL, - "GimpNewRectSelectTool", - &tool_info, 0); - g_type_add_interface_static (tool_type, - GIMP_TYPE_RECTANGLE_TOOL, - &rectangle_info); - } - - return tool_type; -} - static void gimp_new_rect_select_tool_class_init (GimpNewRectSelectToolClass *klass) { @@ -152,13 +117,12 @@ gimp_new_rect_select_tool_class_init (GimpNewRectSelectToolClass *klass) GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_new_rect_select_tool_constructor; object_class->dispose = gimp_rectangle_tool_dispose; object_class->finalize = gimp_new_rect_select_tool_finalize; object_class->set_property = gimp_rectangle_tool_set_property; object_class->get_property = gimp_rectangle_tool_get_property; + gimp_rectangle_tool_install_properties (object_class); tool_class->initialize = gimp_rectangle_tool_initialize; @@ -183,9 +147,9 @@ gimp_new_rect_select_tool_init (GimpNewRectSelectTool *new_rect_select_tool) } static void -gimp_new_rect_select_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *rectangle_iface) +gimp_new_rect_select_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *iface) { - rectangle_iface->execute = gimp_new_rect_select_tool_execute; + iface->execute = gimp_new_rect_select_tool_execute; } static GObject * @@ -418,4 +382,3 @@ gimp_new_rect_select_tool_execute (GimpRectangleTool *rectangle, return TRUE; } - diff --git a/app/tools/gimprectselecttool.c b/app/tools/gimprectselecttool.c index f03162087a..01d8e3907b 100644 --- a/app/tools/gimprectselecttool.c +++ b/app/tools/gimprectselecttool.c @@ -48,9 +48,6 @@ #include "gimp-intl.h" -static void gimp_rect_select_tool_class_init (GimpRectSelectToolClass *klass); -static void gimp_rect_select_tool_init (GimpRectSelectTool *rect_select); - static void gimp_rect_select_tool_button_press (GimpTool *tool, GimpCoords *coords, guint32 time, @@ -78,10 +75,12 @@ static void gimp_rect_select_tool_real_rect_select (GimpRectSelectTool *rect_t static void gimp_rect_select_tool_update_options (GimpRectSelectTool *rect_sel, GimpDisplay *display); -static GimpSelectionToolClass *parent_class = NULL; +G_DEFINE_TYPE (GimpRectSelectTool, gimp_rect_select_tool, + GIMP_TYPE_SELECTION_TOOL); + +#define parent_class gimp_rect_select_tool_parent_class -/* public functions */ void gimp_rect_select_tool_register (GimpToolRegisterCallback callback, @@ -100,45 +99,12 @@ gimp_rect_select_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_rect_select_tool_get_type (void) -{ - static GtkType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpRectSelectToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_rect_select_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpRectSelectTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_rect_select_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_SELECTION_TOOL, - "GimpRectSelectTool", - &tool_info, 0); - } - - return tool_type; -} - - -/* private functions */ - static void gimp_rect_select_tool_class_init (GimpRectSelectToolClass *klass) { GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - tool_class->button_press = gimp_rect_select_tool_button_press; tool_class->button_release = gimp_rect_select_tool_button_release; tool_class->motion = gimp_rect_select_tool_motion; diff --git a/app/tools/gimpregionselecttool.c b/app/tools/gimpregionselecttool.c index dd7ef46315..287623cc4c 100644 --- a/app/tools/gimpregionselecttool.c +++ b/app/tools/gimpregionselecttool.c @@ -53,9 +53,6 @@ #include "gimp-intl.h" -static void gimp_fuzzy_select_tool_class_init (GimpFuzzySelectToolClass *klass); -static void gimp_fuzzy_select_tool_init (GimpFuzzySelectTool *fuzzy_select); - static void gimp_fuzzy_select_tool_finalize (GObject *object); static void gimp_fuzzy_select_tool_button_press (GimpTool *tool, @@ -82,7 +79,10 @@ static GdkSegment * gint *num_segs); -static GimpSelectionToolClass *parent_class = NULL; +G_DEFINE_TYPE (GimpFuzzySelectTool, gimp_fuzzy_select_tool, + GIMP_TYPE_SELECTION_TOOL); + +#define parent_class gimp_fuzzy_select_tool_parent_class void @@ -102,34 +102,6 @@ gimp_fuzzy_select_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_fuzzy_select_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpFuzzySelectToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_fuzzy_select_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpFuzzySelectTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_fuzzy_select_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_SELECTION_TOOL, - "GimpFuzzySelectTool", - &tool_info, 0); - } - - return tool_type; -} - static void gimp_fuzzy_select_tool_class_init (GimpFuzzySelectToolClass *klass) { @@ -137,8 +109,6 @@ gimp_fuzzy_select_tool_class_init (GimpFuzzySelectToolClass *klass) GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->finalize = gimp_fuzzy_select_tool_finalize; tool_class->button_press = gimp_fuzzy_select_tool_button_press; diff --git a/app/tools/gimprotatetool.c b/app/tools/gimprotatetool.c index f41e451581..1e69e25364 100644 --- a/app/tools/gimprotatetool.c +++ b/app/tools/gimprotatetool.c @@ -60,9 +60,6 @@ /* local function prototypes */ -static void gimp_rotate_tool_class_init (GimpRotateToolClass *klass); -static void gimp_rotate_tool_init (GimpRotateTool *rotate_tool); - static void gimp_rotate_tool_dialog (GimpTransformTool *tr_tool); static void gimp_rotate_tool_dialog_update (GimpTransformTool *tr_tool); static void gimp_rotate_tool_prepare (GimpTransformTool *tr_tool, @@ -78,13 +75,11 @@ static void rotate_center_changed (GtkWidget *entry, GimpTransformTool *tr_tool); -/* private variables */ +G_DEFINE_TYPE (GimpRotateTool, gimp_rotate_tool, GIMP_TYPE_TRANSFORM_TOOL); -static GimpTransformToolClass *parent_class = NULL; +#define parent_class gimp_rotate_tool_parent_class -/* public functions */ - void gimp_rotate_tool_register (GimpToolRegisterCallback callback, gpointer data) @@ -102,49 +97,16 @@ gimp_rotate_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_rotate_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpRotateToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_rotate_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpRotateTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_rotate_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_TRANSFORM_TOOL, - "GimpRotateTool", - &tool_info, 0); - } - - return tool_type; -} - - -/* private functions */ - static void gimp_rotate_tool_class_init (GimpRotateToolClass *klass) { GimpTransformToolClass *trans_class = GIMP_TRANSFORM_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - - trans_class->dialog = gimp_rotate_tool_dialog; - trans_class->dialog_update = gimp_rotate_tool_dialog_update; - trans_class->prepare = gimp_rotate_tool_prepare; - trans_class->motion = gimp_rotate_tool_motion; - trans_class->recalc = gimp_rotate_tool_recalc; + trans_class->dialog = gimp_rotate_tool_dialog; + trans_class->dialog_update = gimp_rotate_tool_dialog_update; + trans_class->prepare = gimp_rotate_tool_prepare; + trans_class->motion = gimp_rotate_tool_motion; + trans_class->recalc = gimp_rotate_tool_recalc; } static void diff --git a/app/tools/gimpscaletool.c b/app/tools/gimpscaletool.c index a532d56bed..476631131a 100644 --- a/app/tools/gimpscaletool.c +++ b/app/tools/gimpscaletool.c @@ -52,9 +52,6 @@ /* local function prototypes */ -static void gimp_scale_tool_class_init (GimpScaleToolClass *klass); -static void gimp_scale_tool_init (GimpScaleTool *sc_tool); - static void gimp_scale_tool_dialog (GimpTransformTool *tr_tool); static void gimp_scale_tool_dialog_update (GimpTransformTool *tr_tool); static void gimp_scale_tool_prepare (GimpTransformTool *tr_tool, @@ -72,13 +69,11 @@ static void gimp_scale_tool_aspect_changed (GtkWidget *widget, GimpTransformTool *tr_tool); -/* private variables */ +G_DEFINE_TYPE (GimpScaleTool, gimp_scale_tool, GIMP_TYPE_TRANSFORM_TOOL); -static GimpTransformToolClass *parent_class = NULL; +#define parent_class gimp_scale_tool_parent_class -/* public functions */ - void gimp_scale_tool_register (GimpToolRegisterCallback callback, gpointer data) @@ -96,49 +91,16 @@ gimp_scale_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_scale_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpScaleToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_scale_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpScaleTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_scale_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_TRANSFORM_TOOL, - "GimpScaleTool", - &tool_info, 0); - } - - return tool_type; -} - - -/* private functions */ - static void gimp_scale_tool_class_init (GimpScaleToolClass *klass) { GimpTransformToolClass *trans_class = GIMP_TRANSFORM_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - - trans_class->dialog = gimp_scale_tool_dialog; - trans_class->dialog_update = gimp_scale_tool_dialog_update; - trans_class->prepare = gimp_scale_tool_prepare; - trans_class->motion = gimp_scale_tool_motion; - trans_class->recalc = gimp_scale_tool_recalc; + trans_class->dialog = gimp_scale_tool_dialog; + trans_class->dialog_update = gimp_scale_tool_dialog_update; + trans_class->prepare = gimp_scale_tool_prepare; + trans_class->motion = gimp_scale_tool_motion; + trans_class->recalc = gimp_scale_tool_recalc; } static void diff --git a/app/tools/gimpselectionoptions.c b/app/tools/gimpselectionoptions.c index da01b9265e..493a99da9c 100644 --- a/app/tools/gimpselectionoptions.c +++ b/app/tools/gimpselectionoptions.c @@ -65,8 +65,6 @@ enum }; -static void gimp_selection_options_class_init (GimpSelectionOptionsClass *options_class); - static void gimp_selection_options_set_property (GObject *object, guint property_id, const GValue *value, @@ -83,36 +81,11 @@ static void selection_options_fixed_mode_notify (GimpSelectionOptions *options GtkWidget *fixed_box); -static GimpToolOptionsClass *parent_class = NULL; +G_DEFINE_TYPE (GimpSelectionOptions, gimp_selection_options, + GIMP_TYPE_TOOL_OPTIONS); +#define parent_class gimp_selection_options_parent_class -GType -gimp_selection_options_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo info = - { - sizeof (GimpSelectionOptionsClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_selection_options_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpSelectionOptions), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL - }; - - type = g_type_register_static (GIMP_TYPE_TOOL_OPTIONS, - "GimpSelectionOptions", - &info, 0); - } - - return type; -} static void gimp_selection_options_class_init (GimpSelectionOptionsClass *klass) @@ -120,8 +93,6 @@ gimp_selection_options_class_init (GimpSelectionOptionsClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GimpToolOptionsClass *options_class = GIMP_TOOL_OPTIONS_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->set_property = gimp_selection_options_set_property; object_class->get_property = gimp_selection_options_get_property; @@ -198,6 +169,11 @@ gimp_selection_options_class_init (GimpSelectionOptionsClass *klass) 0); } +static void +gimp_selection_options_init (GimpSelectionOptions *options) +{ +} + static void gimp_selection_options_set_property (GObject *object, guint property_id, diff --git a/app/tools/gimpselectiontool.c b/app/tools/gimpselectiontool.c index f2383aa757..42d26f8976 100644 --- a/app/tools/gimpselectiontool.c +++ b/app/tools/gimpselectiontool.c @@ -41,9 +41,6 @@ #include "gimp-intl.h" -static void gimp_selection_tool_class_init (GimpSelectionToolClass *klass); -static void gimp_selection_tool_init (GimpSelectionTool *sel_tool); - static void gimp_selection_tool_control (GimpTool *tool, GimpToolAction action, GimpDisplay *gdisp); @@ -62,44 +59,16 @@ static void gimp_selection_tool_cursor_update (GimpTool *tool, GimpDisplay *gdisp); -static GimpDrawToolClass *parent_class = NULL; +G_DEFINE_TYPE (GimpSelectionTool, gimp_selection_tool, GIMP_TYPE_DRAW_TOOL); +#define parent_class gimp_selection_tool_parent_class -GType -gimp_selection_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpSelectionToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_selection_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpSelectionTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_selection_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_DRAW_TOOL, - "GimpSelectionTool", - &tool_info, 0); - } - - return tool_type; -} static void gimp_selection_tool_class_init (GimpSelectionToolClass *klass) { GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - tool_class->control = gimp_selection_tool_control; tool_class->modifier_key = gimp_selection_tool_modifier_key; tool_class->key_press = gimp_edit_selection_tool_key_press; diff --git a/app/tools/gimpsheartool.c b/app/tools/gimpsheartool.c index 6399c9fe94..5b7a0466d0 100644 --- a/app/tools/gimpsheartool.c +++ b/app/tools/gimpsheartool.c @@ -60,9 +60,6 @@ /* local function prototypes */ -static void gimp_shear_tool_class_init (GimpShearToolClass *klass); -static void gimp_shear_tool_init (GimpShearTool *shear_tool); - static void gimp_shear_tool_dialog (GimpTransformTool *tr_tool); static void gimp_shear_tool_dialog_update (GimpTransformTool *tr_tool); @@ -79,12 +76,8 @@ static void shear_y_mag_changed (GtkWidget *widget, GimpTransformTool *tr_tool); -/* private variables */ +G_DEFINE_TYPE (GimpShearTool, gimp_shear_tool, GIMP_TYPE_TRANSFORM_TOOL); -static GimpTransformToolClass *parent_class = NULL; - - -/* public functions */ void gimp_shear_tool_register (GimpToolRegisterCallback callback, @@ -103,41 +96,11 @@ gimp_shear_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_shear_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpShearToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_shear_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpShearTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_shear_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_TRANSFORM_TOOL, - "GimpShearTool", - &tool_info, 0); - } - - return tool_type; -} - static void gimp_shear_tool_class_init (GimpShearToolClass *klass) { GimpTransformToolClass *trans_class = GIMP_TRANSFORM_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - trans_class->dialog = gimp_shear_tool_dialog; trans_class->dialog_update = gimp_shear_tool_dialog_update; trans_class->prepare = gimp_shear_tool_prepare; diff --git a/app/tools/gimpsmudgetool.c b/app/tools/gimpsmudgetool.c index 159f12528c..dbe33d7332 100644 --- a/app/tools/gimpsmudgetool.c +++ b/app/tools/gimpsmudgetool.c @@ -37,10 +37,12 @@ #include "gimp-intl.h" -static void gimp_smudge_tool_init (GimpSmudgeTool *tool); static GtkWidget * gimp_smudge_options_gui (GimpToolOptions *tool_options); +G_DEFINE_TYPE (GimpSmudgeTool, gimp_smudge_tool, GIMP_TYPE_PAINT_TOOL); + + void gimp_smudge_tool_register (GimpToolRegisterCallback callback, gpointer data) @@ -58,32 +60,9 @@ gimp_smudge_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_smudge_tool_get_type (void) +static void +gimp_smudge_tool_class_init (GimpSmudgeToolClass *klass) { - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpSmudgeToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - NULL, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpSmudgeTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_smudge_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_PAINT_TOOL, - "GimpSmudgeTool", - &tool_info, 0); - } - - return tool_type; } static void diff --git a/app/tools/gimpsourcetool.c b/app/tools/gimpsourcetool.c index f33679036a..aa92f094c4 100644 --- a/app/tools/gimpsourcetool.c +++ b/app/tools/gimpsourcetool.c @@ -49,35 +49,34 @@ #define TARGET_HEIGHT 15 -static void gimp_clone_tool_class_init (GimpCloneToolClass *klass); -static void gimp_clone_tool_init (GimpCloneTool *tool); +static void gimp_clone_tool_button_press (GimpTool *tool, + GimpCoords *coords, + guint32 time, + GdkModifierType state, + GimpDisplay *gdisp); +static void gimp_clone_tool_motion (GimpTool *tool, + GimpCoords *coords, + guint32 time, + GdkModifierType state, + GimpDisplay *gdisp); -static void gimp_clone_tool_button_press (GimpTool *tool, - GimpCoords *coords, - guint32 time, - GdkModifierType state, - GimpDisplay *gdisp); -static void gimp_clone_tool_motion (GimpTool *tool, - GimpCoords *coords, - guint32 time, - GdkModifierType state, - GimpDisplay *gdisp); +static void gimp_clone_tool_cursor_update (GimpTool *tool, + GimpCoords *coords, + GdkModifierType state, + GimpDisplay *gdisp); +static void gimp_clone_tool_oper_update (GimpTool *tool, + GimpCoords *coords, + GdkModifierType state, + GimpDisplay *gdisp); -static void gimp_clone_tool_cursor_update (GimpTool *tool, - GimpCoords *coords, - GdkModifierType state, - GimpDisplay *gdisp); -static void gimp_clone_tool_oper_update (GimpTool *tool, - GimpCoords *coords, - GdkModifierType state, - GimpDisplay *gdisp); +static void gimp_clone_tool_draw (GimpDrawTool *draw_tool); -static void gimp_clone_tool_draw (GimpDrawTool *draw_tool); - -static GtkWidget * gimp_clone_options_gui (GimpToolOptions *tool_options); +static GtkWidget * gimp_clone_options_gui (GimpToolOptions *tool_options); -static GimpPaintToolClass *parent_class = NULL; +G_DEFINE_TYPE (GimpCloneTool, gimp_clone_tool, GIMP_TYPE_PAINT_TOOL); + +#define parent_class gimp_clone_tool_parent_class void @@ -98,42 +97,12 @@ gimp_clone_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_clone_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpCloneToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_clone_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpCloneTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_clone_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_PAINT_TOOL, - "GimpCloneTool", - &tool_info, 0); - } - - return tool_type; -} - static void gimp_clone_tool_class_init (GimpCloneToolClass *klass) { GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - tool_class->button_press = gimp_clone_tool_button_press; tool_class->motion = gimp_clone_tool_motion; tool_class->cursor_update = gimp_clone_tool_cursor_update; diff --git a/app/tools/gimptextoptions.c b/app/tools/gimptextoptions.c index 02350fbd2b..07c465ad0d 100644 --- a/app/tools/gimptextoptions.c +++ b/app/tools/gimptextoptions.c @@ -66,9 +66,6 @@ enum }; -static void gimp_text_options_class_init (GimpTextOptionsClass *options_class); -static void gimp_text_options_init (GimpTextOptions *options); - static void gimp_text_options_set_property (GObject *object, guint property_id, const GValue *value, @@ -92,44 +89,14 @@ static void gimp_text_options_notify_text_color (GimpText *text, GimpContext *context); -static GimpToolOptionsClass *parent_class = NULL; +G_DEFINE_TYPE (GimpTextOptions, gimp_text_options, GIMP_TYPE_TOOL_OPTIONS); -GType -gimp_text_options_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo info = - { - sizeof (GimpTextOptionsClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_text_options_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpTextOptions), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_text_options_init - }; - - type = g_type_register_static (GIMP_TYPE_TOOL_OPTIONS, - "GimpTextOptions", - &info, 0); - } - - return type; -} - static void gimp_text_options_class_init (GimpTextOptionsClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->set_property = gimp_text_options_set_property; object_class->get_property = gimp_text_options_get_property; diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c index 0a5f359ba3..29ab54d4d3 100644 --- a/app/tools/gimptexttool.c +++ b/app/tools/gimptexttool.c @@ -71,8 +71,6 @@ /* local function prototypes */ -static void gimp_text_tool_class_init (GimpTextToolClass *klass); -static void gimp_text_tool_init (GimpTextTool *tool); static GObject * gimp_text_tool_constructor (GType type, guint n_params, GObjectConstructParam *params); @@ -127,13 +125,11 @@ static gboolean gimp_text_tool_set_drawable (GimpTextTool *text_tool, gboolean confirm); -/* local variables */ +G_DEFINE_TYPE (GimpTextTool, gimp_text_tool, GIMP_TYPE_TOOL); -static GimpToolClass *parent_class = NULL; +#define parent_class gimp_text_tool_parent_class -/* public functions */ - void gimp_text_tool_register (GimpToolRegisterCallback callback, gpointer data) @@ -151,45 +147,12 @@ gimp_text_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_text_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpTextToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_text_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpTextTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_text_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_TOOL, - "GimpTextTool", - &tool_info, 0); - } - - return tool_type; -} - - -/* private functions */ - static void gimp_text_tool_class_init (GimpTextToolClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_text_tool_constructor; object_class->dispose = gimp_text_tool_dispose; object_class->finalize = gimp_text_tool_finalize; diff --git a/app/tools/gimpthresholdtool.c b/app/tools/gimpthresholdtool.c index 1f9f29ae4a..2e81614bb0 100644 --- a/app/tools/gimpthresholdtool.c +++ b/app/tools/gimpthresholdtool.c @@ -54,17 +54,14 @@ /* local function prototypes */ -static void gimp_threshold_tool_class_init (GimpThresholdToolClass *klass); -static void gimp_threshold_tool_init (GimpThresholdTool *threshold_tool); +static void gimp_threshold_tool_finalize (GObject *object); -static void gimp_threshold_tool_finalize (GObject *object); +static gboolean gimp_threshold_tool_initialize (GimpTool *tool, + GimpDisplay *gdisp); -static gboolean gimp_threshold_tool_initialize (GimpTool *tool, - GimpDisplay *gdisp); - -static void gimp_threshold_tool_map (GimpImageMapTool *image_map_tool); -static void gimp_threshold_tool_dialog (GimpImageMapTool *image_map_tool); -static void gimp_threshold_tool_reset (GimpImageMapTool *image_map_tool); +static void gimp_threshold_tool_map (GimpImageMapTool *im_tool); +static void gimp_threshold_tool_dialog (GimpImageMapTool *im_tool); +static void gimp_threshold_tool_reset (GimpImageMapTool *im_tool); static void gimp_threshold_tool_histogram_range (GimpHistogramView *view, gint start, @@ -72,10 +69,11 @@ static void gimp_threshold_tool_histogram_range (GimpHistogramView *view, GimpThresholdTool *t_tool); -static GimpImageMapToolClass *parent_class = NULL; +G_DEFINE_TYPE (GimpThresholdTool, gimp_threshold_tool, + GIMP_TYPE_IMAGE_MAP_TOOL); +#define parent_class gimp_threshold_tool_parent_class -/* public functions */ void gimp_threshold_tool_register (GimpToolRegisterCallback callback, @@ -94,59 +92,22 @@ gimp_threshold_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_threshold_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpThresholdToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_threshold_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpThresholdTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_threshold_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_IMAGE_MAP_TOOL, - "GimpThresholdTool", - &tool_info, 0); - } - - return tool_type; -} - - -/* private functions */ - static void gimp_threshold_tool_class_init (GimpThresholdToolClass *klass) { - GObjectClass *object_class; - GimpToolClass *tool_class; - GimpImageMapToolClass *image_map_tool_class; + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); + GimpImageMapToolClass *im_tool_class = GIMP_IMAGE_MAP_TOOL_CLASS (klass); - object_class = G_OBJECT_CLASS (klass); - tool_class = GIMP_TOOL_CLASS (klass); - image_map_tool_class = GIMP_IMAGE_MAP_TOOL_CLASS (klass); + object_class->finalize = gimp_threshold_tool_finalize; - parent_class = g_type_class_peek_parent (klass); + tool_class->initialize = gimp_threshold_tool_initialize; - object_class->finalize = gimp_threshold_tool_finalize; + im_tool_class->shell_desc = _("Apply Threshold"); - tool_class->initialize = gimp_threshold_tool_initialize; - - image_map_tool_class->shell_desc = _("Apply Threshold"); - - image_map_tool_class->map = gimp_threshold_tool_map; - image_map_tool_class->dialog = gimp_threshold_tool_dialog; - image_map_tool_class->reset = gimp_threshold_tool_reset; + im_tool_class->map = gimp_threshold_tool_map; + im_tool_class->dialog = gimp_threshold_tool_dialog; + im_tool_class->reset = gimp_threshold_tool_reset; } static void diff --git a/app/tools/gimptool.c b/app/tools/gimptool.c index 858a7e4a73..4d723f4ce7 100644 --- a/app/tools/gimptool.c +++ b/app/tools/gimptool.c @@ -41,9 +41,6 @@ enum }; -static void gimp_tool_class_init (GimpToolClass *klass); -static void gimp_tool_init (GimpTool *tool); - static void gimp_tool_finalize (GObject *object); static void gimp_tool_set_property (GObject *object, guint property_id, @@ -92,46 +89,18 @@ static void gimp_tool_real_cursor_update (GimpTool *tool, GimpDisplay *gdisp); -static GimpObjectClass *parent_class = NULL; +G_DEFINE_TYPE (GimpTool, gimp_tool, GIMP_TYPE_OBJECT); + +#define parent_class gimp_tool_parent_class static gint global_tool_ID = 1; -GType -gimp_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_OBJECT, - "GimpTool", - &tool_info, 0); - } - - return tool_type; -} - static void gimp_tool_class_init (GimpToolClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->finalize = gimp_tool_finalize; object_class->set_property = gimp_tool_set_property; object_class->get_property = gimp_tool_get_property; diff --git a/app/tools/gimptoolcontrol.c b/app/tools/gimptoolcontrol.c index 28e8125e4c..828c3c8149 100644 --- a/app/tools/gimptoolcontrol.c +++ b/app/tools/gimptoolcontrol.c @@ -25,50 +25,19 @@ #include "gimptoolcontrol.h" -static void gimp_tool_control_class_init (GimpToolControlClass *klass); -static void gimp_tool_control_init (GimpToolControl *tool); - -static void gimp_tool_control_finalize (GObject *object); +static void gimp_tool_control_finalize (GObject *object); -static GimpObjectClass *parent_class = NULL; +G_DEFINE_TYPE (GimpToolControl, gimp_tool_control, GIMP_TYPE_OBJECT); +#define parent_class gimp_tool_control_parent_class -GType -gimp_tool_control_get_type (void) -{ - static GType tool_control_type = 0; - - if (! tool_control_type) - { - static const GTypeInfo tool_control_info = - { - sizeof (GimpToolControlClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_tool_control_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpToolControl), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_tool_control_init, - }; - - tool_control_type = g_type_register_static (GIMP_TYPE_OBJECT, - "GimpToolControl", - &tool_control_info, 0); - } - - return tool_control_type; -} static void gimp_tool_control_class_init (GimpToolControlClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->finalize = gimp_tool_control_finalize; } diff --git a/app/tools/gimptransformoptions.c b/app/tools/gimptransformoptions.c index 3c2325c16e..5918afd8e9 100644 --- a/app/tools/gimptransformoptions.c +++ b/app/tools/gimptransformoptions.c @@ -58,8 +58,6 @@ enum }; -static void gimp_transform_options_class_init (GimpTransformOptionsClass *options_class); - static void gimp_transform_options_set_property (GObject *object, guint property_id, const GValue *value, @@ -81,36 +79,11 @@ static void gimp_scale_options_constrain_notify (GimpTransformOptions *optio GtkWidget *vbox); -static GimpToolOptionsClass *parent_class = NULL; +G_DEFINE_TYPE (GimpTransformOptions, gimp_transform_options, + GIMP_TYPE_TOOL_OPTIONS); +#define parent_class gimp_transform_options_parent_class -GType -gimp_transform_options_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo info = - { - sizeof (GimpTransformOptionsClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_transform_options_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpTransformOptions), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL - }; - - type = g_type_register_static (GIMP_TYPE_TOOL_OPTIONS, - "GimpTransformOptions", - &info, 0); - } - - return type; -} static void gimp_transform_options_class_init (GimpTransformOptionsClass *klass) @@ -118,8 +91,6 @@ gimp_transform_options_class_init (GimpTransformOptionsClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GimpToolOptionsClass *options_class = GIMP_TOOL_OPTIONS_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->set_property = gimp_transform_options_set_property; object_class->get_property = gimp_transform_options_get_property; @@ -187,6 +158,11 @@ gimp_transform_options_class_init (GimpTransformOptionsClass *klass) 0); } +static void +gimp_transform_options_init (GimpTransformOptions *options) +{ +} + static void gimp_transform_options_set_property (GObject *object, guint property_id, diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c index 9fb864d093..26a3e712a3 100644 --- a/app/tools/gimptransformtool.c +++ b/app/tools/gimptransformtool.c @@ -75,9 +75,6 @@ /* local function prototypes */ -static void gimp_transform_tool_init (GimpTransformTool *tool); -static void gimp_transform_tool_class_init (GimpTransformToolClass *tool); - static GObject * gimp_transform_tool_constructor (GType type, guint n_params, GObjectConstructParam *params); @@ -152,36 +149,11 @@ static void gimp_transform_tool_notify_preview (GimpTransformOptions *option GParamSpec *pspec, GimpTransformTool *tr_tool); -static GimpDrawToolClass *parent_class = NULL; +G_DEFINE_TYPE (GimpTransformTool, gimp_transform_tool, GIMP_TYPE_DRAW_TOOL); -GType -gimp_transform_tool_get_type (void) -{ - static GType tool_type = 0; +#define parent_class gimp_transform_tool_parent_class - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpTransformToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_transform_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpTransformTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_transform_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_DRAW_TOOL, - "GimpTransformTool", - &tool_info, 0); - } - - return tool_type; -} static void gimp_transform_tool_class_init (GimpTransformToolClass *klass) @@ -190,8 +162,6 @@ gimp_transform_tool_class_init (GimpTransformToolClass *klass) GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); GimpDrawToolClass *draw_class = GIMP_DRAW_TOOL_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->constructor = gimp_transform_tool_constructor; object_class->finalize = gimp_transform_tool_finalize; diff --git a/app/tools/gimpvectoroptions.c b/app/tools/gimpvectoroptions.c index c756e8632b..b13bcd288b 100644 --- a/app/tools/gimpvectoroptions.c +++ b/app/tools/gimpvectoroptions.c @@ -47,56 +47,24 @@ enum }; -static void gimp_vector_options_class_init (GimpVectorOptionsClass *options_class); - -static void gimp_vector_options_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec); -static void gimp_vector_options_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec); +static void gimp_vector_options_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec); +static void gimp_vector_options_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec); -static GimpToolOptionsClass *parent_class = NULL; +G_DEFINE_TYPE (GimpVectorOptions, gimp_vector_options, GIMP_TYPE_TOOL_OPTIONS); -GType -gimp_vector_options_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo info = - { - sizeof (GimpVectorOptionsClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_vector_options_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpVectorOptions), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL - }; - - type = g_type_register_static (GIMP_TYPE_TOOL_OPTIONS, - "GimpVectorOptions", - &info, 0); - } - - return type; -} - static void gimp_vector_options_class_init (GimpVectorOptionsClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->set_property = gimp_vector_options_set_property; object_class->get_property = gimp_vector_options_get_property; @@ -113,6 +81,11 @@ gimp_vector_options_class_init (GimpVectorOptionsClass *klass) 0); } +static void +gimp_vector_options_init (GimpVectorOptions *options) +{ +} + static void gimp_vector_options_set_property (GObject *object, guint property_id, diff --git a/app/tools/gimpvectortool.c b/app/tools/gimpvectortool.c index c411c1fc26..4fd829aab7 100644 --- a/app/tools/gimpvectortool.c +++ b/app/tools/gimpvectortool.c @@ -68,9 +68,6 @@ /* local function prototypes */ -static void gimp_vector_tool_class_init (GimpVectorToolClass *klass); -static void gimp_vector_tool_init (GimpVectorTool *tool); - static void gimp_vector_tool_control (GimpTool *tool, GimpToolAction action, GimpDisplay *gdisp); @@ -139,7 +136,9 @@ static void gimp_vector_tool_stroke_vectors (GimpVectorTool *vector_tool, GtkWidget *button); -static GimpDrawToolClass *parent_class = NULL; +G_DEFINE_TYPE (GimpVectorTool, gimp_vector_tool, GIMP_TYPE_DRAW_TOOL); + +#define parent_class gimp_vector_tool_parent_class void @@ -159,46 +158,11 @@ gimp_vector_tool_register (GimpToolRegisterCallback callback, data); } -GType -gimp_vector_tool_get_type (void) -{ - static GType tool_type = 0; - - if (! tool_type) - { - static const GTypeInfo tool_info = - { - sizeof (GimpVectorToolClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_vector_tool_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpVectorTool), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_vector_tool_init, - }; - - tool_type = g_type_register_static (GIMP_TYPE_DRAW_TOOL, - "GimpVectorTool", - &tool_info, 0); - } - - return tool_type; -} - static void gimp_vector_tool_class_init (GimpVectorToolClass *klass) { - GObjectClass *object_class; - GimpToolClass *tool_class; - GimpDrawToolClass *draw_tool_class; - - object_class = G_OBJECT_CLASS (klass); - tool_class = GIMP_TOOL_CLASS (klass); - draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); - - parent_class = g_type_class_peek_parent (klass); + GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); + GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); tool_class->control = gimp_vector_tool_control; tool_class->button_press = gimp_vector_tool_button_press; @@ -1937,4 +1901,3 @@ gimp_vector_tool_stroke_vectors (GimpVectorTool *vector_tool, button); gtk_widget_show (dialog); } -