mirror of https://github.com/GNOME/gimp.git
app/tools/gimpcroptool.[ch] app/tools/gimpellipseselecttool.c
2006-11-05 Michael Natterer <mitch@gimp.org> * app/tools/gimpcroptool.[ch] * app/tools/gimpellipseselecttool.c * app/tools/gimprectangleselecttool.[ch] * app/tools/gimprectangletool.[ch]: removed dispose() and finalize() implementations. The finalize() ones did nothing and dispose() was only redundantly disconnecting from signals that were connected using connect_object() anyway. Some cosmetic cleanups all over the place.
This commit is contained in:
parent
e2a0604174
commit
94182f1439
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2006-11-05 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/tools/gimpcroptool.[ch]
|
||||
* app/tools/gimpellipseselecttool.c
|
||||
* app/tools/gimprectangleselecttool.[ch]
|
||||
* app/tools/gimprectangletool.[ch]: removed dispose() and
|
||||
finalize() implementations. The finalize() ones did nothing and
|
||||
dispose() was only redundantly disconnecting from signals that
|
||||
were connected using connect_object() anyway. Some cosmetic
|
||||
cleanups all over the place.
|
||||
|
||||
2006-11-05 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/actions/file-actions.c
|
||||
|
|
|
@ -42,12 +42,9 @@
|
|||
|
||||
static void gimp_crop_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *iface);
|
||||
|
||||
static GObject *
|
||||
gimp_crop_tool_constructor (GType type,
|
||||
static GObject *gimp_crop_tool_constructor (GType type,
|
||||
guint n_params,
|
||||
GObjectConstructParam *params);
|
||||
static void gimp_crop_tool_dispose (GObject *object);
|
||||
static void gimp_crop_tool_finalize (GObject *object);
|
||||
static gboolean gimp_crop_tool_initialize (GimpTool *tool,
|
||||
GimpDisplay *display,
|
||||
GError **error);
|
||||
|
@ -117,11 +114,10 @@ gimp_crop_tool_class_init (GimpCropToolClass *klass)
|
|||
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
|
||||
GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
|
||||
|
||||
object_class->constructor = gimp_crop_tool_constructor;
|
||||
object_class->dispose = gimp_crop_tool_dispose;
|
||||
object_class->finalize = gimp_crop_tool_finalize;
|
||||
object_class->set_property = gimp_rectangle_tool_set_property;
|
||||
object_class->get_property = gimp_rectangle_tool_get_property;
|
||||
object_class->constructor = gimp_crop_tool_constructor;
|
||||
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_crop_tool_initialize;
|
||||
|
@ -137,6 +133,12 @@ gimp_crop_tool_class_init (GimpCropToolClass *klass)
|
|||
draw_tool_class->draw = gimp_rectangle_tool_draw;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_crop_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *iface)
|
||||
{
|
||||
iface->execute = gimp_crop_tool_execute;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_crop_tool_init (GimpCropTool *crop_tool)
|
||||
{
|
||||
|
@ -147,12 +149,6 @@ gimp_crop_tool_init (GimpCropTool *crop_tool)
|
|||
gimp_rectangle_tool_set_constraint (rect_tool, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_crop_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *iface)
|
||||
{
|
||||
iface->execute = gimp_crop_tool_execute;
|
||||
}
|
||||
|
||||
static GObject *
|
||||
gimp_crop_tool_constructor (GType type,
|
||||
guint n_params,
|
||||
|
@ -192,25 +188,6 @@ gimp_crop_tool_initialize (GimpTool *tool,
|
|||
return gimp_rectangle_tool_initialize (tool, display, error);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_crop_tool_finalize (GObject *object)
|
||||
{
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_crop_tool_dispose (GObject *object)
|
||||
{
|
||||
GimpTool *tool = GIMP_TOOL (object);
|
||||
GObject *options = G_OBJECT (gimp_tool_get_options (tool));
|
||||
|
||||
gimp_rectangle_tool_dispose (object);
|
||||
|
||||
g_signal_handlers_disconnect_by_func (options,
|
||||
G_CALLBACK (gimp_crop_tool_notify_layer_only),
|
||||
tool);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_crop_tool_control (GimpTool *tool,
|
||||
GimpToolAction action,
|
||||
|
@ -341,7 +318,9 @@ gimp_crop_tool_notify_layer_only (GimpCropOptions *options,
|
|||
NULL);
|
||||
|
||||
if (layer_only)
|
||||
gimp_rectangle_tool_set_constraint (rectangle, GIMP_RECTANGLE_CONSTRAIN_DRAWABLE);
|
||||
gimp_rectangle_tool_set_constraint (rectangle,
|
||||
GIMP_RECTANGLE_CONSTRAIN_DRAWABLE);
|
||||
else
|
||||
gimp_rectangle_tool_set_constraint (rectangle, GIMP_RECTANGLE_CONSTRAIN_IMAGE);
|
||||
gimp_rectangle_tool_set_constraint (rectangle,
|
||||
GIMP_RECTANGLE_CONSTRAIN_IMAGE);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#ifndef __GIMP_CROP_TOOL_H__
|
||||
#define __GIMP_CROP_TOOL_H__
|
||||
|
||||
|
||||
#include "gimpdrawtool.h"
|
||||
|
||||
|
||||
|
|
|
@ -83,11 +83,8 @@ gimp_ellipse_select_tool_register (GimpToolRegisterCallback callback,
|
|||
static void
|
||||
gimp_ellipse_select_tool_class_init (GimpEllipseSelectToolClass *klass)
|
||||
{
|
||||
GimpDrawToolClass *draw_tool_class;
|
||||
GimpRectSelectToolClass *rect_tool_class;
|
||||
|
||||
draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
|
||||
rect_tool_class = GIMP_RECT_SELECT_TOOL_CLASS (klass);
|
||||
GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
|
||||
GimpRectSelectToolClass *rect_tool_class = GIMP_RECT_SELECT_TOOL_CLASS (klass);
|
||||
|
||||
draw_tool_class->draw = gimp_ellipse_select_tool_draw;
|
||||
|
||||
|
@ -97,7 +94,7 @@ gimp_ellipse_select_tool_class_init (GimpEllipseSelectToolClass *klass)
|
|||
static void
|
||||
gimp_ellipse_select_tool_init (GimpEllipseSelectTool *ellipse_select)
|
||||
{
|
||||
GimpTool *tool = GIMP_TOOL (ellipse_select);
|
||||
GimpTool *tool = GIMP_TOOL (ellipse_select);
|
||||
|
||||
gimp_tool_control_set_tool_cursor (tool->control,
|
||||
GIMP_TOOL_CURSOR_ELLIPSE_SELECT);
|
||||
|
@ -107,8 +104,8 @@ static void
|
|||
gimp_ellipse_select_tool_draw (GimpDrawTool *draw_tool)
|
||||
{
|
||||
GimpRectSelectTool *rect_sel = GIMP_RECT_SELECT_TOOL (draw_tool);
|
||||
gint x1, y1;
|
||||
gint x2, y2;
|
||||
gint x1, y1;
|
||||
gint x2, y2;
|
||||
|
||||
g_object_get (rect_sel,
|
||||
"x1", &x1,
|
||||
|
|
|
@ -63,8 +63,6 @@ static void gimp_rect_select_tool_rectangle_tool_iface_init (GimpRectangleTo
|
|||
static GObject *gimp_rect_select_tool_constructor (GType type,
|
||||
guint n_params,
|
||||
GObjectConstructParam *params);
|
||||
static void gimp_rect_select_tool_dispose (GObject *object);
|
||||
static void gimp_rect_select_tool_finalize (GObject *object);
|
||||
static void gimp_rect_select_tool_control (GimpTool *tool,
|
||||
GimpToolAction action,
|
||||
GimpDisplay *display);
|
||||
|
@ -146,11 +144,9 @@ gimp_rect_select_tool_class_init (GimpRectSelectToolClass *klass)
|
|||
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
|
||||
GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
|
||||
|
||||
object_class->constructor = gimp_rect_select_tool_constructor;
|
||||
object_class->dispose = gimp_rect_select_tool_dispose;
|
||||
object_class->finalize = gimp_rect_select_tool_finalize;
|
||||
object_class->set_property = gimp_rectangle_tool_set_property;
|
||||
object_class->get_property = gimp_rectangle_tool_get_property;
|
||||
object_class->constructor = gimp_rect_select_tool_constructor;
|
||||
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);
|
||||
|
||||
|
@ -169,6 +165,14 @@ gimp_rect_select_tool_class_init (GimpRectSelectToolClass *klass)
|
|||
klass->select = gimp_rect_select_tool_real_select;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_rect_select_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *iface)
|
||||
{
|
||||
iface->execute = gimp_rect_select_tool_execute;
|
||||
iface->cancel = gimp_rect_select_tool_cancel;
|
||||
iface->rectangle_changed = gimp_rect_select_tool_rectangle_changed;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_rect_select_tool_init (GimpRectSelectTool *rect_select)
|
||||
{
|
||||
|
@ -184,14 +188,6 @@ gimp_rect_select_tool_init (GimpRectSelectTool *rect_select)
|
|||
rect_select->redo = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_rect_select_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *iface)
|
||||
{
|
||||
iface->execute = gimp_rect_select_tool_execute;
|
||||
iface->cancel = gimp_rect_select_tool_cancel;
|
||||
iface->rectangle_changed = gimp_rect_select_tool_rectangle_changed;
|
||||
}
|
||||
|
||||
static GObject *
|
||||
gimp_rect_select_tool_constructor (GType type,
|
||||
guint n_params,
|
||||
|
@ -209,18 +205,6 @@ gimp_rect_select_tool_constructor (GType type,
|
|||
return object;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_rect_select_tool_dispose (GObject *object)
|
||||
{
|
||||
gimp_rectangle_tool_dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_rect_select_tool_finalize (GObject *object)
|
||||
{
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_rect_select_tool_control (GimpTool *tool,
|
||||
GimpToolAction action,
|
||||
|
@ -234,10 +218,10 @@ gimp_rect_select_tool_control (GimpTool *tool,
|
|||
static void
|
||||
gimp_rect_select_tool_draw (GimpDrawTool *draw_tool)
|
||||
{
|
||||
GimpRectSelectTool *rect_sel = GIMP_RECT_SELECT_TOOL (draw_tool);
|
||||
GimpRectSelectOptions *options = GIMP_RECT_SELECT_TOOL_GET_OPTIONS (draw_tool);
|
||||
gint x1, y1;
|
||||
gint x2, y2;
|
||||
GimpRectSelectTool *rect_sel = GIMP_RECT_SELECT_TOOL (draw_tool);
|
||||
GimpRectSelectOptions *options = GIMP_RECT_SELECT_TOOL_GET_OPTIONS (rect_sel);
|
||||
gint x1, y1;
|
||||
gint x2, y2;
|
||||
|
||||
g_object_get (rect_sel,
|
||||
"x1", &x1,
|
||||
|
@ -248,35 +232,35 @@ gimp_rect_select_tool_draw (GimpDrawTool *draw_tool)
|
|||
|
||||
if (options->round_corners)
|
||||
{
|
||||
gint bounding_square_size;
|
||||
gdouble radius;
|
||||
gint square_size;
|
||||
|
||||
radius = MIN (options->corner_radius,
|
||||
MIN ((x2 - x1) / 2.0, (y2 - y1) / 2.0));
|
||||
|
||||
bounding_square_size = (int) (radius * 2);
|
||||
square_size = (int) (radius * 2);
|
||||
|
||||
gimp_draw_tool_draw_arc (draw_tool, FALSE,
|
||||
x1, y1,
|
||||
bounding_square_size, bounding_square_size,
|
||||
square_size, square_size,
|
||||
90 * 64, 90 * 64,
|
||||
FALSE);
|
||||
|
||||
gimp_draw_tool_draw_arc (draw_tool, FALSE,
|
||||
x2 - bounding_square_size, y1,
|
||||
bounding_square_size, bounding_square_size,
|
||||
x2 - square_size, y1,
|
||||
square_size, square_size,
|
||||
0, 90 * 64,
|
||||
FALSE);
|
||||
|
||||
gimp_draw_tool_draw_arc (draw_tool, FALSE,
|
||||
x2 - bounding_square_size, y2 - bounding_square_size,
|
||||
bounding_square_size, bounding_square_size,
|
||||
x2 - square_size, y2 - square_size,
|
||||
square_size, square_size,
|
||||
270 * 64, 90 * 64,
|
||||
FALSE);
|
||||
|
||||
gimp_draw_tool_draw_arc (draw_tool, FALSE,
|
||||
x1, y2 - bounding_square_size,
|
||||
bounding_square_size, bounding_square_size,
|
||||
x1, y2 - square_size,
|
||||
square_size, square_size,
|
||||
180 * 64, 90 * 64,
|
||||
FALSE);
|
||||
}
|
||||
|
@ -291,8 +275,8 @@ gimp_rect_select_tool_button_press (GimpTool *tool,
|
|||
GdkModifierType state,
|
||||
GimpDisplay *display)
|
||||
{
|
||||
GimpRectSelectTool *rect_select = GIMP_RECT_SELECT_TOOL (tool);
|
||||
guint function;
|
||||
GimpRectSelectTool *rect_select = GIMP_RECT_SELECT_TOOL (tool);
|
||||
guint function;
|
||||
|
||||
if (tool->display && display != tool->display)
|
||||
gimp_rectangle_tool_cancel (GIMP_RECTANGLE_TOOL (tool));
|
||||
|
@ -385,8 +369,8 @@ gimp_rect_select_tool_button_release (GimpTool *tool,
|
|||
GdkModifierType state,
|
||||
GimpDisplay *display)
|
||||
{
|
||||
GimpRectSelectTool *rect_select = GIMP_RECT_SELECT_TOOL (tool);
|
||||
GimpRectangleTool *rectangle = GIMP_RECTANGLE_TOOL (tool);
|
||||
GimpRectSelectTool *rect_select = GIMP_RECT_SELECT_TOOL (tool);
|
||||
GimpRectangleTool *rectangle = GIMP_RECTANGLE_TOOL (tool);
|
||||
|
||||
gimp_tool_pop_status (tool, display);
|
||||
gimp_display_shell_set_show_selection (GIMP_DISPLAY_SHELL (display->shell),
|
||||
|
@ -713,7 +697,7 @@ gimp_rect_select_tool_cancel (GimpRectangleTool *rectangle)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gimp_rect_select_tool_rectangle_changed (GimpRectangleTool *rectangle)
|
||||
gimp_rect_select_tool_rectangle_changed (GimpRectangleTool *rectangle)
|
||||
{
|
||||
GimpTool *tool = GIMP_TOOL (rectangle);
|
||||
|
||||
|
@ -722,10 +706,10 @@ gimp_rect_select_tool_rectangle_changed (GimpRectangleTool *rectangle)
|
|||
|
||||
if (tool->display)
|
||||
{
|
||||
GimpRectSelectTool *rect_select = GIMP_RECT_SELECT_TOOL (tool);
|
||||
GimpImage *image = tool->display->image;
|
||||
GimpUndo *undo;
|
||||
gint x1, y1, x2, y2;
|
||||
GimpRectSelectTool *rect_select = GIMP_RECT_SELECT_TOOL (tool);
|
||||
GimpImage *image = tool->display->image;
|
||||
GimpUndo *undo;
|
||||
gint x1, y1, x2, y2;
|
||||
|
||||
/* if we got here via button release, we have already undone the
|
||||
* previous operation. But if we got here by some other means,
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#ifndef __GIMP_RECT_SELECT_TOOL_H__
|
||||
#define __GIMP_RECT_SELECT_TOOL_H__
|
||||
|
||||
|
||||
#include "gimpselectiontool.h"
|
||||
|
||||
|
||||
|
|
|
@ -224,6 +224,8 @@ gimp_rectangle_tool_iface_base_init (GimpRectangleToolInterface *iface)
|
|||
GIMP_RECTANGLE_CONSTRAIN_NONE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
|
||||
iface->execute = NULL;
|
||||
iface->cancel = NULL;
|
||||
iface->rectangle_changed = NULL;
|
||||
|
||||
initialized = TRUE;
|
||||
|
@ -415,8 +417,6 @@ gimp_rectangle_tool_constructor (GObject *object)
|
|||
GimpRectangleTool *rectangle = GIMP_RECTANGLE_TOOL (object);
|
||||
GObject *options;
|
||||
|
||||
tool->display = NULL;
|
||||
|
||||
options = G_OBJECT (gimp_tool_get_options (tool));
|
||||
|
||||
g_signal_connect_object (options, "notify",
|
||||
|
@ -427,17 +427,6 @@ gimp_rectangle_tool_constructor (GObject *object)
|
|||
GIMP_RECTANGLE_CONSTRAIN_NONE);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_rectangle_tool_dispose (GObject *object)
|
||||
{
|
||||
GimpTool *tool = GIMP_TOOL (object);
|
||||
GimpRectangleTool *rectangle = GIMP_RECTANGLE_TOOL (object);
|
||||
GObject *options = G_OBJECT (gimp_tool_get_options (tool));
|
||||
|
||||
g_signal_handlers_disconnect_matched (options, G_SIGNAL_MATCH_DATA,
|
||||
0, 0, NULL, NULL, rectangle);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_rectangle_tool_initialize (GimpTool *tool,
|
||||
GimpDisplay *display,
|
||||
|
|
|
@ -36,14 +36,6 @@ typedef enum
|
|||
} GimpRectangleToolProp;
|
||||
|
||||
|
||||
#define GIMP_TYPE_RECTANGLE_TOOL (gimp_rectangle_tool_interface_get_type ())
|
||||
#define GIMP_IS_RECTANGLE_TOOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_RECTANGLE_TOOL))
|
||||
#define GIMP_RECTANGLE_TOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_RECTANGLE_TOOL, GimpRectangleTool))
|
||||
#define GIMP_RECTANGLE_TOOL_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GIMP_TYPE_RECTANGLE_TOOL, GimpRectangleToolInterface))
|
||||
|
||||
#define GIMP_RECTANGLE_TOOL_GET_OPTIONS(t) (GIMP_RECTANGLE_OPTIONS (gimp_tool_get_options (GIMP_TOOL (t))))
|
||||
|
||||
|
||||
/* possible functions */
|
||||
enum
|
||||
{
|
||||
|
@ -62,6 +54,14 @@ enum
|
|||
};
|
||||
|
||||
|
||||
#define GIMP_TYPE_RECTANGLE_TOOL (gimp_rectangle_tool_interface_get_type ())
|
||||
#define GIMP_IS_RECTANGLE_TOOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_RECTANGLE_TOOL))
|
||||
#define GIMP_RECTANGLE_TOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_RECTANGLE_TOOL, GimpRectangleTool))
|
||||
#define GIMP_RECTANGLE_TOOL_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GIMP_TYPE_RECTANGLE_TOOL, GimpRectangleToolInterface))
|
||||
|
||||
#define GIMP_RECTANGLE_TOOL_GET_OPTIONS(t) (GIMP_RECTANGLE_OPTIONS (gimp_tool_get_options (GIMP_TOOL (t))))
|
||||
|
||||
|
||||
typedef struct _GimpRectangleTool GimpRectangleTool;
|
||||
typedef struct _GimpRectangleToolInterface GimpRectangleToolInterface;
|
||||
|
||||
|
@ -69,6 +69,7 @@ struct _GimpRectangleToolInterface
|
|||
{
|
||||
GTypeInterface base_iface;
|
||||
|
||||
/* virtual functions */
|
||||
gboolean (* execute) (GimpRectangleTool *rect_tool,
|
||||
gint x,
|
||||
gint y,
|
||||
|
@ -76,6 +77,7 @@ struct _GimpRectangleToolInterface
|
|||
gint h);
|
||||
void (* cancel) (GimpRectangleTool *rect_tool);
|
||||
|
||||
/* signals */
|
||||
gboolean (* rectangle_changed) (GimpRectangleTool *rect_tool);
|
||||
};
|
||||
|
||||
|
@ -84,7 +86,6 @@ GType gimp_rectangle_tool_interface_get_type (void) G_GNUC_CONST;
|
|||
|
||||
|
||||
void gimp_rectangle_tool_constructor (GObject *object);
|
||||
void gimp_rectangle_tool_dispose (GObject *object);
|
||||
gboolean gimp_rectangle_tool_initialize (GimpTool *tool,
|
||||
GimpDisplay *display,
|
||||
GError **error);
|
||||
|
|
Loading…
Reference in New Issue