app/tools/gimprectangleselecttool.[ch]

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

	* app/tools/gimprectangleselecttool.[ch]
	* app/tools/gimprectangleselectoptions.[ch]
	* app/tools/gimpellipseselecttool.[ch]
	* app/tools/gimp-tools.c: s/Rect/Rectangle/ and s/rect/rectangle/
	in types and function names.


svn path=/trunk/; revision=25076
This commit is contained in:
Michael Natterer 2008-03-09 15:38:25 +00:00 committed by Michael Natterer
parent c8331a8266
commit 64317165e9
8 changed files with 276 additions and 268 deletions

View File

@ -1,3 +1,11 @@
2008-03-09 Michael Natterer <mitch@gimp.org>
* app/tools/gimprectangleselecttool.[ch]
* app/tools/gimprectangleselectoptions.[ch]
* app/tools/gimpellipseselecttool.[ch]
* app/tools/gimp-tools.c: s/Rect/Rectangle/ and s/rect/rectangle/
in types and function names.
2008-03-09 Michael Natterer <mitch@gimp.org>
* app/tools/Makefile.am

View File

@ -173,7 +173,7 @@ gimp_tools_init (Gimp *gimp)
gimp_polygon_select_tool_register,
gimp_free_select_tool_register,
gimp_ellipse_select_tool_register,
gimp_rect_select_tool_register
gimp_rectangle_select_tool_register
};
GList *default_order = NULL;

View File

@ -38,18 +38,18 @@
#include "gimp-intl.h"
static void gimp_ellipse_select_tool_draw (GimpDrawTool *draw_tool);
static void gimp_ellipse_select_tool_draw (GimpDrawTool *draw_tool);
static void gimp_ellipse_select_tool_select (GimpRectSelectTool *rect_tool,
GimpChannelOps operation,
gint x,
gint y,
gint w,
gint h);
static void gimp_ellipse_select_tool_select (GimpRectangleSelectTool *rect_tool,
GimpChannelOps operation,
gint x,
gint y,
gint w,
gint h);
G_DEFINE_TYPE (GimpEllipseSelectTool, gimp_ellipse_select_tool,
GIMP_TYPE_RECT_SELECT_TOOL)
GIMP_TYPE_RECTANGLE_SELECT_TOOL)
#define parent_class gimp_ellipse_select_tool_parent_class
@ -61,8 +61,8 @@ gimp_ellipse_select_tool_register (GimpToolRegisterCallback callback,
gpointer data)
{
(* callback) (GIMP_TYPE_ELLIPSE_SELECT_TOOL,
GIMP_TYPE_RECT_SELECT_OPTIONS,
gimp_rect_select_options_gui,
GIMP_TYPE_RECTANGLE_SELECT_OPTIONS,
gimp_rectangle_select_options_gui,
0,
"gimp-ellipse-select-tool",
_("Ellipse Select"),
@ -79,8 +79,8 @@ gimp_ellipse_select_tool_register (GimpToolRegisterCallback callback,
static void
gimp_ellipse_select_tool_class_init (GimpEllipseSelectToolClass *klass)
{
GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
GimpRectSelectToolClass *rect_tool_class = GIMP_RECT_SELECT_TOOL_CLASS (klass);
GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
GimpRectangleSelectToolClass *rect_tool_class = GIMP_RECTANGLE_SELECT_TOOL_CLASS (klass);
draw_tool_class->draw = gimp_ellipse_select_tool_draw;
@ -119,12 +119,12 @@ gimp_ellipse_select_tool_draw (GimpDrawTool *draw_tool)
}
static void
gimp_ellipse_select_tool_select (GimpRectSelectTool *rect_tool,
GimpChannelOps operation,
gint x,
gint y,
gint w,
gint h)
gimp_ellipse_select_tool_select (GimpRectangleSelectTool *rect_tool,
GimpChannelOps operation,
gint x,
gint y,
gint w,
gint h)
{
GimpTool *tool = GIMP_TOOL (rect_tool);
GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (rect_tool);

View File

@ -36,12 +36,12 @@ typedef struct _GimpEllipseSelectToolClass GimpEllipseSelectToolClass;
struct _GimpEllipseSelectTool
{
GimpRectSelectTool parent_instance;
GimpRectangleSelectTool parent_instance;
};
struct _GimpEllipseSelectToolClass
{
GimpRectSelectToolClass parent_class;
GimpRectangleSelectToolClass parent_class;
};

View File

@ -44,29 +44,30 @@ enum
};
static void gimp_rect_select_options_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_rect_select_options_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_rectangle_select_options_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_rectangle_select_options_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
G_DEFINE_TYPE_WITH_CODE (GimpRectSelectOptions, gimp_rect_select_options,
G_DEFINE_TYPE_WITH_CODE (GimpRectangleSelectOptions,
gimp_rectangle_select_options,
GIMP_TYPE_SELECTION_OPTIONS,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_RECTANGLE_OPTIONS,
NULL))
static void
gimp_rect_select_options_class_init (GimpRectSelectOptionsClass *klass)
gimp_rectangle_select_options_class_init (GimpRectangleSelectOptionsClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->set_property = gimp_rect_select_options_set_property;
object_class->get_property = gimp_rect_select_options_get_property;
object_class->set_property = gimp_rectangle_select_options_set_property;
object_class->get_property = gimp_rectangle_select_options_get_property;
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_ROUND_CORNERS,
"round-corners", NULL,
@ -82,17 +83,17 @@ gimp_rect_select_options_class_init (GimpRectSelectOptionsClass *klass)
}
static void
gimp_rect_select_options_init (GimpRectSelectOptions *options)
gimp_rectangle_select_options_init (GimpRectangleSelectOptions *options)
{
}
static void
gimp_rect_select_options_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
gimp_rectangle_select_options_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
GimpRectSelectOptions *options = GIMP_RECT_SELECT_OPTIONS (object);
GimpRectangleSelectOptions *options = GIMP_RECTANGLE_SELECT_OPTIONS (object);
switch (property_id)
{
@ -111,12 +112,12 @@ gimp_rect_select_options_set_property (GObject *object,
}
static void
gimp_rect_select_options_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
gimp_rectangle_select_options_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GimpRectSelectOptions *options = GIMP_RECT_SELECT_OPTIONS (object);
GimpRectangleSelectOptions *options = GIMP_RECTANGLE_SELECT_OPTIONS (object);
switch (property_id)
{
@ -135,13 +136,13 @@ gimp_rect_select_options_get_property (GObject *object,
}
GtkWidget *
gimp_rect_select_options_gui (GimpToolOptions *tool_options)
gimp_rectangle_select_options_gui (GimpToolOptions *tool_options)
{
GObject *config = G_OBJECT (tool_options);
GtkWidget *vbox = gimp_selection_options_gui (tool_options);
/* the round corners frame */
if (tool_options->tool_info->tool_type == GIMP_TYPE_RECT_SELECT_TOOL)
if (tool_options->tool_info->tool_type == GIMP_TYPE_RECTANGLE_SELECT_TOOL)
{
GtkWidget *frame;
GtkWidget *button;
@ -159,7 +160,7 @@ gimp_rect_select_options_gui (GimpToolOptions *tool_options)
g_object_set_data (G_OBJECT (button), "set_sensitive",
GIMP_SELECTION_OPTIONS (tool_options)->antialias_toggle);
gtk_widget_set_sensitive (GIMP_SELECTION_OPTIONS (tool_options)->antialias_toggle,
GIMP_RECT_SELECT_OPTIONS (tool_options)->round_corners);
GIMP_RECTANGLE_SELECT_OPTIONS (tool_options)->round_corners);
gimp_prop_scale_entry_new (config, "corner-radius",
GTK_TABLE (table), 0, 0,

View File

@ -16,25 +16,25 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_RECT_SELECT_OPTIONS_H__
#define __GIMP_RECT_SELECT_OPTIONS_H__
#ifndef __GIMP_RECTANGLE_SELECT_OPTIONS_H__
#define __GIMP_RECTANGLE_SELECT_OPTIONS_H__
#include "gimpselectionoptions.h"
#define GIMP_TYPE_RECT_SELECT_OPTIONS (gimp_rect_select_options_get_type ())
#define GIMP_RECT_SELECT_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_RECT_SELECT_OPTIONS, GimpRectSelectOptions))
#define GIMP_RECT_SELECT_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_RECT_SELECT_OPTIONS, GimpRectSelectOptionsClass))
#define GIMP_IS_RECT_SELECT_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_RECT_SELECT_OPTIONS))
#define GIMP_IS_RECT_SELECT_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_RECT_SELECT_OPTIONS))
#define GIMP_RECT_SELECT_OPTIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_RECT_SELECT_OPTIONS, GimpRectSelectOptionsClass))
#define GIMP_TYPE_RECTANGLE_SELECT_OPTIONS (gimp_rectangle_select_options_get_type ())
#define GIMP_RECTANGLE_SELECT_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_RECTANGLE_SELECT_OPTIONS, GimpRectangleSelectOptions))
#define GIMP_RECTANGLE_SELECT_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_RECTANGLE_SELECT_OPTIONS, GimpRectangleSelectOptionsClass))
#define GIMP_IS_RECTANGLE_SELECT_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_RECTANGLE_SELECT_OPTIONS))
#define GIMP_IS_RECTANGLE_SELECT_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_RECTANGLE_SELECT_OPTIONS))
#define GIMP_RECTANGLE_SELECT_OPTIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_RECTANGLE_SELECT_OPTIONS, GimpRectangleSelectOptionsClass))
typedef struct _GimpRectSelectOptions GimpRectSelectOptions;
typedef struct _GimpToolOptionsClass GimpRectSelectOptionsClass;
typedef struct _GimpRectangleSelectOptions GimpRectangleSelectOptions;
typedef struct _GimpToolOptionsClass GimpRectangleSelectOptionsClass;
struct _GimpRectSelectOptions
struct _GimpRectangleSelectOptions
{
GimpSelectionOptions parent_instence;
@ -43,9 +43,9 @@ struct _GimpRectSelectOptions
};
GType gimp_rect_select_options_get_type (void) G_GNUC_CONST;
GType gimp_rectangle_select_options_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_rect_select_options_gui (GimpToolOptions *tool_options);
GtkWidget * gimp_rectangle_select_options_gui (GimpToolOptions *tool_options);
#endif /* __GIMP_RECT_SELECT_OPTIONS_H__ */
#endif /* __GIMP_RECTANGLE_SELECT_OPTIONS_H__ */

View File

@ -58,7 +58,7 @@
#include "gimp-intl.h"
typedef struct GimpRectSelectToolPrivate
typedef struct GimpRectangleSelectToolPrivate
{
GimpChannelOps operation; /* remember for use when modifying */
gboolean use_saved_op; /* use operation or get from options */
@ -71,92 +71,95 @@ typedef struct GimpRectSelectToolPrivate
gdouble press_x;
gdouble press_y;
} GimpRectSelectToolPrivate;
} GimpRectangleSelectToolPrivate;
#define GIMP_RECT_SELECT_TOOL_GET_PRIVATE(obj) \
((GimpRectSelectToolPrivate *) ((GimpRectSelectTool *) (obj))->priv)
#define GIMP_RECTANGLE_SELECT_TOOL_GET_PRIVATE(obj) \
((GimpRectangleSelectToolPrivate *) ((GimpRectangleSelectTool *) (obj))->priv)
static void gimp_rect_select_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *iface);
static void gimp_rectangle_select_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *iface);
static GObject *gimp_rect_select_tool_constructor (GType type,
static GObject *gimp_rectangle_select_tool_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
static void gimp_rect_select_tool_control (GimpTool *tool,
static void gimp_rectangle_select_tool_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *display);
static void gimp_rect_select_tool_button_press (GimpTool *tool,
static void gimp_rectangle_select_tool_button_press (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *display);
static void gimp_rect_select_tool_button_release (GimpTool *tool,
static void gimp_rectangle_select_tool_button_release (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpButtonReleaseType release_type,
GimpDisplay *display);
static void gimp_rect_select_tool_active_modifier_key (GimpTool *tool,
static void gimp_rectangle_select_tool_active_modifier_key
(GimpTool *tool,
GdkModifierType key,
gboolean press,
GdkModifierType state,
GimpDisplay *display);
static gboolean gimp_rect_select_tool_key_press (GimpTool *tool,
static gboolean gimp_rectangle_select_tool_key_press (GimpTool *tool,
GdkEventKey *kevent,
GimpDisplay *display);
static void gimp_rect_select_tool_oper_update (GimpTool *tool,
static void gimp_rectangle_select_tool_oper_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
gboolean proximity,
GimpDisplay *display);
static void gimp_rect_select_tool_cursor_update (GimpTool *tool,
static void gimp_rectangle_select_tool_cursor_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
GimpDisplay *display);
static void gimp_rect_select_tool_draw (GimpDrawTool *draw_tool);
static gboolean gimp_rect_select_tool_select (GimpRectangleTool *rect_tool,
static void gimp_rectangle_select_tool_draw (GimpDrawTool *draw_tool);
static gboolean gimp_rectangle_select_tool_select (GimpRectangleTool *rect_tool,
gint x,
gint y,
gint w,
gint h);
static gboolean gimp_rect_select_tool_execute (GimpRectangleTool *rect_tool,
static gboolean gimp_rectangle_select_tool_execute (GimpRectangleTool *rect_tool,
gint x,
gint y,
gint w,
gint h);
static void gimp_rect_select_tool_cancel (GimpRectangleTool *rect_tool);
static gboolean gimp_rect_select_tool_rectangle_changed (GimpRectangleTool *rect_tool);
static void gimp_rect_select_tool_real_select (GimpRectSelectTool *rect_sel_tool,
static void gimp_rectangle_select_tool_cancel (GimpRectangleTool *rect_tool);
static gboolean gimp_rectangle_select_tool_rectangle_changed
(GimpRectangleTool *rect_tool);
static void gimp_rectangle_select_tool_real_select (GimpRectangleSelectTool *rect_sel_tool,
GimpChannelOps operation,
gint x,
gint y,
gint w,
gint h);
static void gimp_rect_select_tool_update_option_defaults
(GimpRectSelectTool *rect_sel_tool,
gboolean ignore_pending);
static void gimp_rectangle_select_tool_update_option_defaults
(GimpRectangleSelectTool *rect_sel_tool,
gboolean ignore_pending);
static void gimp_rect_select_tool_round_corners_notify(GimpRectSelectOptions *options,
GParamSpec *pspec,
GimpRectSelectTool *rect_sel_tool);
static void gimp_rectangle_select_tool_round_corners_notify
(GimpRectangleSelectOptions *options,
GParamSpec *pspec,
GimpRectangleSelectTool *rect_sel_tool);
G_DEFINE_TYPE_WITH_CODE (GimpRectSelectTool, gimp_rect_select_tool,
G_DEFINE_TYPE_WITH_CODE (GimpRectangleSelectTool, gimp_rectangle_select_tool,
GIMP_TYPE_SELECTION_TOOL,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_RECTANGLE_TOOL,
gimp_rect_select_tool_rectangle_tool_iface_init))
gimp_rectangle_select_tool_rectangle_tool_iface_init))
#define parent_class gimp_rect_select_tool_parent_class
#define parent_class gimp_rectangle_select_tool_parent_class
void
gimp_rect_select_tool_register (GimpToolRegisterCallback callback,
gpointer data)
gimp_rectangle_select_tool_register (GimpToolRegisterCallback callback,
gpointer data)
{
(* callback) (GIMP_TYPE_RECT_SELECT_TOOL,
GIMP_TYPE_RECT_SELECT_OPTIONS,
gimp_rect_select_options_gui,
(* callback) (GIMP_TYPE_RECTANGLE_SELECT_TOOL,
GIMP_TYPE_RECTANGLE_SELECT_OPTIONS,
gimp_rectangle_select_options_gui,
0,
"gimp-rect-select-tool",
_("Rectangle Select"),
@ -168,55 +171,55 @@ gimp_rect_select_tool_register (GimpToolRegisterCallback callback,
}
static void
gimp_rect_select_tool_class_init (GimpRectSelectToolClass *klass)
gimp_rectangle_select_tool_class_init (GimpRectangleSelectToolClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
g_type_class_add_private (klass, sizeof (GimpRectSelectToolPrivate));
g_type_class_add_private (klass, sizeof (GimpRectangleSelectToolPrivate));
object_class->constructor = gimp_rect_select_tool_constructor;
object_class->constructor = gimp_rectangle_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);
tool_class->control = gimp_rect_select_tool_control;
tool_class->button_press = gimp_rect_select_tool_button_press;
tool_class->button_release = gimp_rect_select_tool_button_release;
tool_class->control = gimp_rectangle_select_tool_control;
tool_class->button_press = gimp_rectangle_select_tool_button_press;
tool_class->button_release = gimp_rectangle_select_tool_button_release;
tool_class->motion = gimp_rectangle_tool_motion;
tool_class->key_press = gimp_rect_select_tool_key_press;
tool_class->active_modifier_key = gimp_rect_select_tool_active_modifier_key;
tool_class->oper_update = gimp_rect_select_tool_oper_update;
tool_class->cursor_update = gimp_rect_select_tool_cursor_update;
tool_class->key_press = gimp_rectangle_select_tool_key_press;
tool_class->active_modifier_key = gimp_rectangle_select_tool_active_modifier_key;
tool_class->oper_update = gimp_rectangle_select_tool_oper_update;
tool_class->cursor_update = gimp_rectangle_select_tool_cursor_update;
draw_tool_class->draw = gimp_rect_select_tool_draw;
draw_tool_class->draw = gimp_rectangle_select_tool_draw;
klass->select = gimp_rect_select_tool_real_select;
klass->select = gimp_rectangle_select_tool_real_select;
}
static void
gimp_rect_select_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *iface)
gimp_rectangle_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;
iface->execute = gimp_rectangle_select_tool_execute;
iface->cancel = gimp_rectangle_select_tool_cancel;
iface->rectangle_changed = gimp_rectangle_select_tool_rectangle_changed;
}
static void
gimp_rect_select_tool_init (GimpRectSelectTool *rect_sel_tool)
gimp_rectangle_select_tool_init (GimpRectangleSelectTool *rect_sel_tool)
{
GimpTool *tool = GIMP_TOOL (rect_sel_tool);
GimpRectSelectToolPrivate *priv;
GimpTool *tool = GIMP_TOOL (rect_sel_tool);
GimpRectangleSelectToolPrivate *priv;
gimp_rectangle_tool_init (GIMP_RECTANGLE_TOOL (rect_sel_tool));
rect_sel_tool->priv = G_TYPE_INSTANCE_GET_PRIVATE (rect_sel_tool,
GIMP_TYPE_RECT_SELECT_TOOL,
GimpRectSelectToolPrivate);
GIMP_TYPE_RECTANGLE_SELECT_TOOL,
GimpRectangleSelectToolPrivate);
priv = GIMP_RECT_SELECT_TOOL_GET_PRIVATE (rect_sel_tool);
priv = GIMP_RECTANGLE_SELECT_TOOL_GET_PRIVATE (rect_sel_tool);
gimp_tool_control_set_wants_click (tool->control, TRUE);
gimp_tool_control_set_tool_cursor (tool->control,
@ -233,43 +236,42 @@ gimp_rect_select_tool_init (GimpRectSelectTool *rect_sel_tool)
}
static GObject *
gimp_rect_select_tool_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
gimp_rectangle_select_tool_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
{
GObject *object;
GimpRectSelectTool *rect_sel_tool;
GimpRectSelectOptions *options;
GimpRectSelectToolPrivate *priv;
GObject *object;
GimpRectangleSelectTool *rect_sel_tool;
GimpRectangleSelectOptions *options;
GimpRectangleSelectToolPrivate *priv;
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
gimp_rectangle_tool_constructor (object);
rect_sel_tool = GIMP_RECT_SELECT_TOOL (object);
options = GIMP_RECT_SELECT_TOOL_GET_OPTIONS (rect_sel_tool);
priv = GIMP_RECT_SELECT_TOOL_GET_PRIVATE(rect_sel_tool);
rect_sel_tool = GIMP_RECTANGLE_SELECT_TOOL (object);
options = GIMP_RECTANGLE_SELECT_TOOL_GET_OPTIONS (rect_sel_tool);
priv = GIMP_RECTANGLE_SELECT_TOOL_GET_PRIVATE (rect_sel_tool);
priv->round_corners = options->round_corners;
priv->corner_radius = options->corner_radius;
g_signal_connect_object (options, "notify::round-corners",
G_CALLBACK (gimp_rect_select_tool_round_corners_notify),
G_CALLBACK (gimp_rectangle_select_tool_round_corners_notify),
object, 0);
g_signal_connect_object (options, "notify::corner-radius",
G_CALLBACK (gimp_rect_select_tool_round_corners_notify),
G_CALLBACK (gimp_rectangle_select_tool_round_corners_notify),
object, 0);
gimp_rect_select_tool_update_option_defaults (GIMP_RECT_SELECT_TOOL (object),
FALSE);
gimp_rectangle_select_tool_update_option_defaults (rect_sel_tool, FALSE);
return object;
}
static void
gimp_rect_select_tool_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *display)
gimp_rectangle_select_tool_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *display)
{
gimp_rectangle_tool_control (tool, action, display);
@ -277,13 +279,13 @@ gimp_rect_select_tool_control (GimpTool *tool,
}
static void
gimp_rect_select_tool_draw (GimpDrawTool *draw_tool)
gimp_rectangle_select_tool_draw (GimpDrawTool *draw_tool)
{
GimpRectSelectTool *rect_sel_tool;
GimpRectSelectToolPrivate *priv;
GimpRectangleSelectTool *rect_sel_tool;
GimpRectangleSelectToolPrivate *priv;
rect_sel_tool = GIMP_RECT_SELECT_TOOL (draw_tool);
priv = GIMP_RECT_SELECT_TOOL_GET_PRIVATE(rect_sel_tool);
rect_sel_tool = GIMP_RECTANGLE_SELECT_TOOL (draw_tool);
priv = GIMP_RECTANGLE_SELECT_TOOL_GET_PRIVATE (rect_sel_tool);
gimp_rectangle_tool_draw (draw_tool);
@ -332,22 +334,22 @@ gimp_rect_select_tool_draw (GimpDrawTool *draw_tool)
}
static void
gimp_rect_select_tool_button_press (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *display)
gimp_rectangle_select_tool_button_press (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *display)
{
GimpRectangleTool *rectangle;
GimpRectSelectTool *rect_sel_tool;
GimpDisplayShell *shell;
GimpRectSelectToolPrivate *priv;
GimpRectangleFunction function;
GimpRectangleTool *rectangle;
GimpRectangleSelectTool *rect_sel_tool;
GimpDisplayShell *shell;
GimpRectangleSelectToolPrivate *priv;
GimpRectangleFunction function;
rectangle = GIMP_RECTANGLE_TOOL (tool);
rect_sel_tool = GIMP_RECT_SELECT_TOOL (tool);
rect_sel_tool = GIMP_RECTANGLE_SELECT_TOOL (tool);
shell = GIMP_DISPLAY_SHELL (display->shell);
priv = GIMP_RECT_SELECT_TOOL_GET_PRIVATE(rect_sel_tool);
priv = GIMP_RECTANGLE_SELECT_TOOL_GET_PRIVATE (rect_sel_tool);
if (tool->display && display != tool->display)
gimp_rectangle_tool_cancel (GIMP_RECTANGLE_TOOL (tool));
@ -433,18 +435,18 @@ gimp_rect_select_tool_button_press (GimpTool *tool,
}
static void
gimp_rect_select_tool_button_release (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpButtonReleaseType release_type,
GimpDisplay *display)
gimp_rectangle_select_tool_button_release (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpButtonReleaseType release_type,
GimpDisplay *display)
{
GimpRectSelectTool *rect_sel_tool;
GimpRectSelectToolPrivate *priv;
GimpRectangleSelectTool *rect_sel_tool;
GimpRectangleSelectToolPrivate *priv;
rect_sel_tool = GIMP_RECT_SELECT_TOOL (tool);
priv = GIMP_RECT_SELECT_TOOL_GET_PRIVATE(rect_sel_tool);
rect_sel_tool = GIMP_RECTANGLE_SELECT_TOOL (tool);
priv = GIMP_RECTANGLE_SELECT_TOOL_GET_PRIVATE (rect_sel_tool);
gimp_tool_pop_status (tool, display);
gimp_display_shell_set_show_selection (GIMP_DISPLAY_SHELL (display->shell),
@ -491,16 +493,15 @@ gimp_rect_select_tool_button_release (GimpTool *tool,
priv->redo = NULL;
gimp_rect_select_tool_update_option_defaults (rect_sel_tool,
FALSE);
gimp_rectangle_select_tool_update_option_defaults (rect_sel_tool, FALSE);
}
static void
gimp_rect_select_tool_active_modifier_key (GimpTool *tool,
GdkModifierType key,
gboolean press,
GdkModifierType state,
GimpDisplay *display)
gimp_rectangle_select_tool_active_modifier_key (GimpTool *tool,
GdkModifierType key,
gboolean press,
GdkModifierType state,
GimpDisplay *display)
{
GIMP_TOOL_CLASS (parent_class)->active_modifier_key (tool, key, press, state,
display);
@ -509,20 +510,20 @@ gimp_rect_select_tool_active_modifier_key (GimpTool *tool,
}
static gboolean
gimp_rect_select_tool_key_press (GimpTool *tool,
GdkEventKey *kevent,
GimpDisplay *display)
gimp_rectangle_select_tool_key_press (GimpTool *tool,
GdkEventKey *kevent,
GimpDisplay *display)
{
return (gimp_rectangle_tool_key_press (tool, kevent, display) ||
gimp_edit_selection_tool_key_press (tool, kevent, display));
}
static void
gimp_rect_select_tool_oper_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
gboolean proximity,
GimpDisplay *display)
gimp_rectangle_select_tool_oper_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
gboolean proximity,
GimpDisplay *display)
{
GimpRectangleFunction function;
@ -540,10 +541,10 @@ gimp_rect_select_tool_oper_update (GimpTool *tool,
}
static void
gimp_rect_select_tool_cursor_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
GimpDisplay *display)
gimp_rectangle_select_tool_cursor_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
GimpDisplay *display)
{
gimp_rectangle_tool_cursor_update (tool, coords, state, display);
@ -556,24 +557,24 @@ gimp_rect_select_tool_cursor_update (GimpTool *tool,
static gboolean
gimp_rect_select_tool_select (GimpRectangleTool *rectangle,
gint x,
gint y,
gint w,
gint h)
gimp_rectangle_select_tool_select (GimpRectangleTool *rectangle,
gint x,
gint y,
gint w,
gint h)
{
GimpTool *tool;
GimpRectSelectTool *rect_sel_tool;
GimpSelectionOptions *options;
GimpImage *image;
GimpRectSelectToolPrivate *priv;
gboolean rectangle_exists;
GimpChannelOps operation;
GimpTool *tool;
GimpRectangleSelectTool *rect_sel_tool;
GimpSelectionOptions *options;
GimpImage *image;
GimpRectangleSelectToolPrivate *priv;
gboolean rectangle_exists;
GimpChannelOps operation;
tool = GIMP_TOOL (rectangle);
rect_sel_tool = GIMP_RECT_SELECT_TOOL (rectangle);
rect_sel_tool = GIMP_RECTANGLE_SELECT_TOOL (rectangle);
options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
priv = GIMP_RECT_SELECT_TOOL_GET_PRIVATE(rect_sel_tool);
priv = GIMP_RECTANGLE_SELECT_TOOL_GET_PRIVATE (rect_sel_tool);
image = tool->display->image;
@ -593,27 +594,27 @@ gimp_rect_select_tool_select (GimpRectangleTool *rectangle,
/* if rectangle exists, turn it into a selection */
if (rectangle_exists)
GIMP_RECT_SELECT_TOOL_GET_CLASS (rect_sel_tool)->select (rect_sel_tool,
operation,
x, y, w, h);
GIMP_RECTANGLE_SELECT_TOOL_GET_CLASS (rect_sel_tool)->select (rect_sel_tool,
operation,
x, y, w, h);
return rectangle_exists;
}
static void
gimp_rect_select_tool_real_select (GimpRectSelectTool *rect_sel_tool,
GimpChannelOps operation,
gint x,
gint y,
gint w,
gint h)
gimp_rectangle_select_tool_real_select (GimpRectangleSelectTool *rect_sel_tool,
GimpChannelOps operation,
gint x,
gint y,
gint w,
gint h)
{
GimpTool *tool = GIMP_TOOL (rect_sel_tool);
GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
GimpRectSelectOptions *rect_select_options;
GimpChannel *channel;
GimpTool *tool = GIMP_TOOL (rect_sel_tool);
GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
GimpRectangleSelectOptions *rect_select_options;
GimpChannel *channel;
rect_select_options = GIMP_RECT_SELECT_TOOL_GET_OPTIONS (tool);
rect_select_options = GIMP_RECTANGLE_SELECT_TOOL_GET_OPTIONS (tool);
channel = gimp_image_get_mask (tool->display->image);
@ -648,7 +649,7 @@ gimp_rect_select_tool_real_select (GimpRectSelectTool *rect_sel_tool,
}
/**
* gimp_rect_select_tool_update_option_defaults:
* gimp_rectangle_select_tool_update_option_defaults:
* @crop_tool:
* @ignore_pending: %TRUE to ignore any pending crop rectangle.
*
@ -656,8 +657,8 @@ gimp_rect_select_tool_real_select (GimpRectSelectTool *rect_sel_tool,
* properties.
*/
static void
gimp_rect_select_tool_update_option_defaults (GimpRectSelectTool *rect_sel_tool,
gboolean ignore_pending)
gimp_rectangle_select_tool_update_option_defaults (GimpRectangleSelectTool *rect_sel_tool,
gboolean ignore_pending)
{
GimpTool *tool;
GimpRectangleTool *rectangle_tool;
@ -712,17 +713,17 @@ gimp_rect_select_tool_update_option_defaults (GimpRectSelectTool *rect_sel_tool,
* we clear the selection.
*/
static gboolean
gimp_rect_select_tool_execute (GimpRectangleTool *rectangle,
gint x,
gint y,
gint w,
gint h)
gimp_rectangle_select_tool_execute (GimpRectangleTool *rectangle,
gint x,
gint y,
gint w,
gint h)
{
GimpRectSelectTool *rect_sel_tool;
GimpRectSelectToolPrivate *priv;
GimpRectangleSelectTool *rect_sel_tool;
GimpRectangleSelectToolPrivate *priv;
rect_sel_tool = GIMP_RECT_SELECT_TOOL (rectangle);
priv = GIMP_RECT_SELECT_TOOL_GET_PRIVATE(rect_sel_tool);
rect_sel_tool = GIMP_RECTANGLE_SELECT_TOOL (rectangle);
priv = GIMP_RECTANGLE_SELECT_TOOL_GET_PRIVATE (rect_sel_tool);
if (w == 0 && h == 0)
{
@ -757,7 +758,8 @@ gimp_rect_select_tool_execute (GimpRectangleTool *rectangle,
NULL);
}
gimp_rectangle_tool_set_function (rectangle, GIMP_RECTANGLE_TOOL_MOVING);
gimp_rectangle_tool_set_function (rectangle,
GIMP_RECTANGLE_TOOL_MOVING);
return FALSE;
}
@ -776,8 +778,7 @@ gimp_rect_select_tool_execute (GimpRectangleTool *rectangle,
}
}
gimp_rect_select_tool_update_option_defaults (rect_sel_tool,
FALSE);
gimp_rectangle_select_tool_update_option_defaults (rect_sel_tool, FALSE);
/* Reset the automatic undo/redo mechanism */
priv->undo = NULL;
@ -787,15 +788,15 @@ gimp_rect_select_tool_execute (GimpRectangleTool *rectangle,
}
static void
gimp_rect_select_tool_cancel (GimpRectangleTool *rectangle)
gimp_rectangle_select_tool_cancel (GimpRectangleTool *rectangle)
{
GimpTool *tool;
GimpRectSelectTool *rect_sel_tool;
GimpRectSelectToolPrivate *priv;
GimpTool *tool;
GimpRectangleSelectTool *rect_sel_tool;
GimpRectangleSelectToolPrivate *priv;
tool = GIMP_TOOL (rectangle);
rect_sel_tool = GIMP_RECT_SELECT_TOOL (rectangle);
priv = GIMP_RECT_SELECT_TOOL_GET_PRIVATE(rect_sel_tool);
rect_sel_tool = GIMP_RECTANGLE_SELECT_TOOL (rectangle);
priv = GIMP_RECTANGLE_SELECT_TOOL_GET_PRIVATE (rect_sel_tool);
if (tool->display)
{
@ -825,15 +826,15 @@ gimp_rect_select_tool_cancel (GimpRectangleTool *rectangle)
}
static gboolean
gimp_rect_select_tool_rectangle_changed (GimpRectangleTool *rectangle)
gimp_rectangle_select_tool_rectangle_changed (GimpRectangleTool *rectangle)
{
GimpTool *tool;
GimpRectSelectTool *rect_sel_tool;
GimpRectSelectToolPrivate *priv;
GimpTool *tool;
GimpRectangleSelectTool *rect_sel_tool;
GimpRectangleSelectToolPrivate *priv;
tool = GIMP_TOOL (rectangle);
rect_sel_tool = GIMP_RECT_SELECT_TOOL (tool);
priv = GIMP_RECT_SELECT_TOOL_GET_PRIVATE(rect_sel_tool);
rect_sel_tool = GIMP_RECTANGLE_SELECT_TOOL (tool);
priv = GIMP_RECTANGLE_SELECT_TOOL_GET_PRIVATE (rect_sel_tool);
/* prevent change in selection from halting the tool */
gimp_tool_control_set_preserve (tool->control, TRUE);
@ -863,7 +864,7 @@ gimp_rect_select_tool_rectangle_changed (GimpRectangleTool *rectangle)
"y2", &y2,
NULL);
if (gimp_rect_select_tool_select (rectangle, x1, y1, x2 - x1, y2 - y1))
if (gimp_rectangle_select_tool_select (rectangle, x1, y1, x2 - x1, y2 - y1))
{
/* save the undo that we got when executing, but only if
* we actually selected something
@ -892,24 +893,22 @@ gimp_rect_select_tool_rectangle_changed (GimpRectangleTool *rectangle)
}
static void
gimp_rect_select_tool_round_corners_notify (GimpRectSelectOptions *options,
GParamSpec *pspec,
GimpRectSelectTool *rect_sel_tool)
gimp_rectangle_select_tool_round_corners_notify (GimpRectangleSelectOptions *options,
GParamSpec *pspec,
GimpRectangleSelectTool *rect_sel_tool)
{
GimpDrawTool *draw_tool;
GimpRectangleTool *rect_tool;
GimpRectSelectToolPrivate *priv;
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (rect_sel_tool);
GimpRectangleTool *rect_tool = GIMP_RECTANGLE_TOOL (rect_sel_tool);
GimpRectangleSelectToolPrivate *priv;
draw_tool = GIMP_DRAW_TOOL (rect_sel_tool);
rect_tool = GIMP_RECTANGLE_TOOL (rect_sel_tool);
priv = GIMP_RECT_SELECT_TOOL_GET_PRIVATE(rect_sel_tool);
priv = GIMP_RECTANGLE_SELECT_TOOL_GET_PRIVATE (rect_sel_tool);
gimp_draw_tool_pause (draw_tool);
priv->round_corners = options->round_corners;
priv->corner_radius = options->corner_radius;
gimp_rect_select_tool_rectangle_changed (rect_tool);
gimp_rectangle_select_tool_rectangle_changed (rect_tool);
gimp_draw_tool_resume (draw_tool);
}

View File

@ -16,50 +16,50 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_RECT_SELECT_TOOL_H__
#define __GIMP_RECT_SELECT_TOOL_H__
#ifndef __GIMP_RECTANGLE_SELECT_TOOL_H__
#define __GIMP_RECTANGLE_SELECT_TOOL_H__
#include "gimpselectiontool.h"
#define GIMP_TYPE_RECT_SELECT_TOOL (gimp_rect_select_tool_get_type ())
#define GIMP_RECT_SELECT_TOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_RECT_SELECT_TOOL, GimpRectSelectTool))
#define GIMP_RECT_SELECT_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_RECT_SELECT_TOOL, GimpRectSelectToolClass))
#define GIMP_IS_RECT_SELECT_TOOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_RECT_SELECT_TOOL))
#define GIMP_IS_RECT_SELECT_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_RECT_SELECT_TOOL))
#define GIMP_RECT_SELECT_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_RECT_SELECT_TOOL, GimpRectSelectToolClass))
#define GIMP_TYPE_RECTANGLE_SELECT_TOOL (gimp_rectangle_select_tool_get_type ())
#define GIMP_RECTANGLE_SELECT_TOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_RECTANGLE_SELECT_TOOL, GimpRectangleSelectTool))
#define GIMP_RECTANGLE_SELECT_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_RECTANGLE_SELECT_TOOL, GimpRectangleSelectToolClass))
#define GIMP_IS_RECTANGLE_SELECT_TOOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_RECTANGLE_SELECT_TOOL))
#define GIMP_IS_RECTANGLE_SELECT_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_RECTANGLE_SELECT_TOOL))
#define GIMP_RECTANGLE_SELECT_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_RECTANGLE_SELECT_TOOL, GimpRectangleSelectToolClass))
#define GIMP_RECT_SELECT_TOOL_GET_OPTIONS(t) (GIMP_RECT_SELECT_OPTIONS (gimp_tool_get_options (GIMP_TOOL (t))))
#define GIMP_RECTANGLE_SELECT_TOOL_GET_OPTIONS(t) (GIMP_RECTANGLE_SELECT_OPTIONS (gimp_tool_get_options (GIMP_TOOL (t))))
typedef struct _GimpRectSelectTool GimpRectSelectTool;
typedef struct _GimpRectSelectToolClass GimpRectSelectToolClass;
typedef struct _GimpRectangleSelectTool GimpRectangleSelectTool;
typedef struct _GimpRectangleSelectToolClass GimpRectangleSelectToolClass;
struct _GimpRectSelectTool
struct _GimpRectangleSelectTool
{
GimpSelectionTool parent_instance;
gpointer priv;
};
struct _GimpRectSelectToolClass
struct _GimpRectangleSelectToolClass
{
GimpSelectionToolClass parent_class;
void (* select) (GimpRectSelectTool *rect_select,
GimpChannelOps operation,
gint x,
gint y,
gint w,
gint h);
void (* select) (GimpRectangleSelectTool *rect_select,
GimpChannelOps operation,
gint x,
gint y,
gint w,
gint h);
};
void gimp_rect_select_tool_register (GimpToolRegisterCallback callback,
gpointer data);
void gimp_rectangle_select_tool_register (GimpToolRegisterCallback callback,
gpointer data);
GType gimp_rect_select_tool_get_type (void) G_GNUC_CONST;
GType gimp_rectangle_select_tool_get_type (void) G_GNUC_CONST;
#endif /* __GIMP_RECT_SELECT_TOOL_H__ */
#endif /* __GIMP_RECTANGLE_SELECT_TOOL_H__ */