app/tools/gimprectangletool.[ch] transform into an interface.

2005-08-15  Karine Delvare  <kdelvare@nerim.net>

        * app/tools/gimprectangletool.[ch]
        * app/tools/gimprectangleoptions.[ch]: transform into an interface.

        * app/tools/gimpcroptool.[ch]
        * app/tools/gimpnewrectselecttool.[ch]: use the rectangletool interface.

        * app/tools/gimpcropoptions.[ch]
        * app/tools/gimpnewrectselectoptions.[ch]: use the rectangleoptions
        interface.

        * app/tools/Makefile.am: added gimpnewrectselectionoptions.[ch]
This commit is contained in:
Karine Delvare 2005-08-15 14:23:28 +00:00 committed by Karine Delvare
parent 47f84a8b1f
commit 5a9f83bd46
18 changed files with 5191 additions and 2235 deletions

View File

@ -1,3 +1,17 @@
2005-08-15 Karine Delvare <kdelvare@nerim.net>
* app/tools/gimprectangletool.[ch]
* app/tools/gimprectangleoptions.[ch]: transform into an interface.
* app/tools/gimpcroptool.[ch]
* app/tools/gimpnewrectselecttool.[ch]: use the rectangletool interface.
* app/tools/gimpcropoptions.[ch]
* app/tools/gimpnewrectselectoptions.[ch]: use the rectangleoptions
interface.
* app/tools/Makefile.am: added gimpnewrectselectionoptions.[ch]
2005-08-15 Sven Neumann <sven@gimp.org>
* plug-ins/rcm/rcm_callback.c

View File

@ -118,6 +118,8 @@ libapptools_a_sources = \
gimpposterizetool.h \
gimpnewrectselecttool.c \
gimpnewrectselecttool.h \
gimpnewrectselectoptions.c \
gimpnewrectselectoptions.h \
gimprectangletool.c \
gimprectangletool.h \
gimprectangleoptions.c \

View File

@ -20,6 +20,7 @@
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpconfig/gimpconfig.h"
#include "libgimpwidgets/gimpwidgets.h"
@ -27,6 +28,7 @@
#include "widgets/gimpwidgets-utils.h"
#include "gimprectangleoptions.h"
#include "gimpcropoptions.h"
#include "gimptooloptions-gui.h"
@ -37,13 +39,23 @@ enum
{
PROP_0,
PROP_LAYER_ONLY,
PROP_ALLOW_ENLARGE,
PROP_KEEP_ASPECT,
PROP_CROP_MODE
PROP_CROP_MODE,
PROP_HIGHLIGHT,
PROP_FIXED_WIDTH,
PROP_WIDTH,
PROP_FIXED_HEIGHT,
PROP_HEIGHT,
PROP_FIXED_ASPECT,
PROP_ASPECT,
PROP_FIXED_CENTER,
PROP_CENTER_X,
PROP_CENTER_Y,
PROP_UNIT
};
static void gimp_crop_options_class_init (GimpCropOptionsClass *klass);
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_set_property (GObject *object,
guint property_id,
@ -54,6 +66,46 @@ static void gimp_crop_options_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
void gimp_crop_options_set_highlight (GimpRectangleOptions *options,
gboolean highlight);
gboolean gimp_crop_options_get_highlight (GimpRectangleOptions *options);
void gimp_crop_options_set_fixed_width (GimpRectangleOptions *options,
gboolean fixed_width);
gboolean gimp_crop_options_get_fixed_width (GimpRectangleOptions *options);
void gimp_crop_options_set_width (GimpRectangleOptions *options,
gdouble width);
gdouble gimp_crop_options_get_width (GimpRectangleOptions *options);
void gimp_crop_options_set_fixed_height (GimpRectangleOptions *options,
gboolean fixed_height);
gboolean gimp_crop_options_get_fixed_height (GimpRectangleOptions *options);
void gimp_crop_options_set_height (GimpRectangleOptions *options,
gdouble height);
gdouble gimp_crop_options_get_height (GimpRectangleOptions *options);
void gimp_crop_options_set_fixed_aspect (GimpRectangleOptions *options,
gboolean fixed_aspect);
gboolean gimp_crop_options_get_fixed_aspect (GimpRectangleOptions *options);
void gimp_crop_options_set_aspect (GimpRectangleOptions *options,
gdouble aspect);
gdouble gimp_crop_options_get_aspect (GimpRectangleOptions *options);
void gimp_crop_options_set_fixed_center (GimpRectangleOptions *options,
gboolean fixed_center);
gboolean gimp_crop_options_get_fixed_center (GimpRectangleOptions *options);
void gimp_crop_options_set_center_x (GimpRectangleOptions *options,
gdouble center_x);
gdouble gimp_crop_options_get_center_x (GimpRectangleOptions *options);
void gimp_crop_options_set_center_y (GimpRectangleOptions *options,
gdouble center_y);
gdouble gimp_crop_options_get_center_y (GimpRectangleOptions *options);
void gimp_crop_options_set_unit (GimpRectangleOptions *options,
GimpUnit unit);
GimpUnit gimp_crop_options_get_unit (GimpRectangleOptions *options);
static GimpToolOptionsClass *parent_class = NULL;
@ -77,11 +129,20 @@ gimp_crop_options_get_type (void)
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;
}
@ -100,19 +161,84 @@ gimp_crop_options_class_init (GimpCropOptionsClass *klass)
"layer-only", NULL,
FALSE,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_ALLOW_ENLARGE,
"allow-enlarge", NULL,
FALSE,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_KEEP_ASPECT,
"keep-aspect", NULL,
FALSE,
0);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_CROP_MODE,
"crop-mode", NULL,
GIMP_TYPE_CROP_MODE,
GIMP_CROP_MODE_CROP,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_HIGHLIGHT,
"highlight",
N_("Highlight rectangle"),
TRUE,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FIXED_WIDTH,
"fixed-width", N_("Fixed width"),
FALSE, 0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_WIDTH,
"width", N_("Width"),
0.0, GIMP_MAX_IMAGE_SIZE, 1.0,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FIXED_HEIGHT,
"fixed-height", N_("Fixed height"),
FALSE, 0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_HEIGHT,
"height", N_("Height"),
0.0, GIMP_MAX_IMAGE_SIZE, 1.0,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FIXED_ASPECT,
"fixed-aspect", N_("Fixed aspect"),
FALSE, 0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_ASPECT,
"aspect", N_("Aspect"),
0.0, GIMP_MAX_IMAGE_SIZE, 1.0,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FIXED_CENTER,
"fixed-center", N_("Fixed center"),
FALSE, 0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CENTER_X,
"center-x", N_("Center X"),
0.0, GIMP_MAX_IMAGE_SIZE, 1.0,
0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CENTER_Y,
"center-y", N_("Center Y"),
0.0, GIMP_MAX_IMAGE_SIZE, 1.0,
0);
GIMP_CONFIG_INSTALL_PROP_UNIT (object_class, PROP_UNIT,
"unit", NULL,
TRUE, FALSE, GIMP_UNIT_PIXEL, 0);
}
static void
gimp_crop_options_rectangle_options_iface_init (GimpRectangleOptionsInterface *rectangle_iface)
{
rectangle_iface->set_highlight = gimp_crop_options_set_highlight;
rectangle_iface->get_highlight = gimp_crop_options_get_highlight;
rectangle_iface->set_fixed_width = gimp_crop_options_set_fixed_width;
rectangle_iface->get_fixed_width = gimp_crop_options_get_fixed_width;
rectangle_iface->set_width = gimp_crop_options_set_width;
rectangle_iface->get_width = gimp_crop_options_get_width;
rectangle_iface->set_fixed_height = gimp_crop_options_set_fixed_height;
rectangle_iface->get_fixed_height = gimp_crop_options_get_fixed_height;
rectangle_iface->set_height = gimp_crop_options_set_height;
rectangle_iface->get_height = gimp_crop_options_get_height;
rectangle_iface->set_fixed_aspect = gimp_crop_options_set_fixed_aspect;
rectangle_iface->get_fixed_aspect = gimp_crop_options_get_fixed_aspect;
rectangle_iface->set_aspect = gimp_crop_options_set_aspect;
rectangle_iface->get_aspect = gimp_crop_options_get_aspect;
rectangle_iface->set_fixed_center = gimp_crop_options_set_fixed_center;
rectangle_iface->get_fixed_center = gimp_crop_options_get_fixed_center;
rectangle_iface->set_center_x = gimp_crop_options_set_center_x;
rectangle_iface->get_center_x = gimp_crop_options_get_center_x;
rectangle_iface->set_center_y = gimp_crop_options_set_center_y;
rectangle_iface->get_center_y = gimp_crop_options_get_center_y;
rectangle_iface->set_unit = gimp_crop_options_set_unit;
rectangle_iface->get_unit = gimp_crop_options_get_unit;
}
static void
@ -121,22 +247,50 @@ gimp_crop_options_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
GimpCropOptions *options = GIMP_CROP_OPTIONS (object);
GimpCropOptions *options = GIMP_CROP_OPTIONS (object);
GimpRectangleOptions *rectangle_options = GIMP_RECTANGLE_OPTIONS (options);
switch (property_id)
{
case PROP_LAYER_ONLY:
options->layer_only = g_value_get_boolean (value);
break;
case PROP_ALLOW_ENLARGE:
options->allow_enlarge = g_value_get_boolean (value);
break;
case PROP_KEEP_ASPECT:
options->keep_aspect = g_value_get_boolean (value);
break;
case PROP_CROP_MODE:
options->crop_mode = g_value_get_enum (value);
break;
case PROP_HIGHLIGHT:
gimp_rectangle_options_set_highlight (rectangle_options, g_value_get_boolean (value));
break;
case PROP_FIXED_WIDTH:
gimp_rectangle_options_set_fixed_width (rectangle_options, g_value_get_boolean (value));
break;
case PROP_WIDTH:
gimp_rectangle_options_set_width (rectangle_options, g_value_get_double (value));
break;
case PROP_FIXED_HEIGHT:
gimp_rectangle_options_set_fixed_height (rectangle_options, g_value_get_boolean (value));
break;
case PROP_HEIGHT:
gimp_rectangle_options_set_height (rectangle_options, g_value_get_double (value));
break;
case PROP_FIXED_ASPECT:
gimp_rectangle_options_set_fixed_aspect (rectangle_options, g_value_get_boolean (value));
break;
case PROP_ASPECT:
gimp_rectangle_options_set_aspect (rectangle_options, g_value_get_double (value));
break;
case PROP_FIXED_CENTER:
gimp_rectangle_options_set_fixed_center (rectangle_options, g_value_get_boolean (value));
break;
case PROP_CENTER_X:
gimp_rectangle_options_set_center_x (rectangle_options, g_value_get_double (value));
break;
case PROP_CENTER_Y:
gimp_rectangle_options_set_center_y (rectangle_options, g_value_get_double (value));
break;
case PROP_UNIT:
gimp_rectangle_options_set_unit (rectangle_options, g_value_get_int (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@ -149,33 +303,227 @@ gimp_crop_options_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
GimpCropOptions *options = GIMP_CROP_OPTIONS (object);
GimpCropOptions *options = GIMP_CROP_OPTIONS (object);
GimpRectangleOptions *rectangle_options = GIMP_RECTANGLE_OPTIONS (options);
switch (property_id)
{
case PROP_LAYER_ONLY:
g_value_set_boolean (value, options->layer_only);
break;
case PROP_ALLOW_ENLARGE:
g_value_set_boolean (value, options->allow_enlarge);
break;
case PROP_KEEP_ASPECT:
g_value_set_boolean (value, options->keep_aspect);
break;
case PROP_CROP_MODE:
g_value_set_enum (value, options->crop_mode);
break;
case PROP_HIGHLIGHT:
g_value_set_boolean (value, gimp_rectangle_options_get_highlight (rectangle_options));
break;
case PROP_FIXED_WIDTH:
g_value_set_boolean (value, gimp_rectangle_options_get_fixed_width (rectangle_options));
break;
case PROP_WIDTH:
g_value_set_double (value, gimp_rectangle_options_get_width (rectangle_options));
break;
case PROP_FIXED_HEIGHT:
g_value_set_boolean (value, gimp_rectangle_options_get_fixed_height (rectangle_options));
break;
case PROP_HEIGHT:
g_value_set_double (value, gimp_rectangle_options_get_height (rectangle_options));
break;
case PROP_FIXED_ASPECT:
g_value_set_boolean (value, gimp_rectangle_options_get_fixed_aspect (rectangle_options));
break;
case PROP_ASPECT:
g_value_set_double (value, gimp_rectangle_options_get_aspect (rectangle_options));
break;
case PROP_FIXED_CENTER:
g_value_set_boolean (value, gimp_rectangle_options_get_fixed_center (rectangle_options));
break;
case PROP_CENTER_X:
g_value_set_double (value, gimp_rectangle_options_get_center_x (rectangle_options));
break;
case PROP_CENTER_Y:
g_value_set_double (value, gimp_rectangle_options_get_center_y (rectangle_options));
break;
case PROP_UNIT:
g_value_set_int (value, gimp_rectangle_options_get_unit (rectangle_options));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
void
gimp_crop_options_set_highlight (GimpRectangleOptions *options,
gboolean highlight)
{
GimpCropOptions *crop_options = GIMP_CROP_OPTIONS (options);
crop_options->highlight = highlight;
}
gboolean
gimp_crop_options_get_highlight (GimpRectangleOptions *options)
{
GimpCropOptions *crop_options = GIMP_CROP_OPTIONS (options);
return crop_options->highlight;
}
void
gimp_crop_options_set_fixed_width (GimpRectangleOptions *options,
gboolean fixed_width)
{
GimpCropOptions *crop_options = GIMP_CROP_OPTIONS (options);
crop_options->fixed_width = fixed_width;
}
gboolean
gimp_crop_options_get_fixed_width (GimpRectangleOptions *options)
{
GimpCropOptions *crop_options = GIMP_CROP_OPTIONS (options);
return crop_options->fixed_width;
}
void
gimp_crop_options_set_width (GimpRectangleOptions *options,
gdouble width)
{
GimpCropOptions *crop_options = GIMP_CROP_OPTIONS (options);
crop_options->width = width;
}
gdouble
gimp_crop_options_get_width (GimpRectangleOptions *options)
{
GimpCropOptions *crop_options = GIMP_CROP_OPTIONS (options);
return crop_options->width;
}
void
gimp_crop_options_set_fixed_height (GimpRectangleOptions *options,
gboolean fixed_height)
{
GimpCropOptions *crop_options = GIMP_CROP_OPTIONS (options);
crop_options->fixed_height = fixed_height;
}
gboolean
gimp_crop_options_get_fixed_height (GimpRectangleOptions *options)
{
GimpCropOptions *crop_options = GIMP_CROP_OPTIONS (options);
return crop_options->fixed_height;
}
void
gimp_crop_options_set_height (GimpRectangleOptions *options,
gdouble height)
{
GimpCropOptions *crop_options = GIMP_CROP_OPTIONS (options);
crop_options->height = height;
}
gdouble
gimp_crop_options_get_height (GimpRectangleOptions *options)
{
GimpCropOptions *crop_options = GIMP_CROP_OPTIONS (options);
return crop_options->height;
}
void
gimp_crop_options_set_fixed_aspect (GimpRectangleOptions *options,
gboolean fixed_aspect)
{
GimpCropOptions *crop_options = GIMP_CROP_OPTIONS (options);
crop_options->fixed_aspect = fixed_aspect;
}
gboolean
gimp_crop_options_get_fixed_aspect (GimpRectangleOptions *options)
{
GimpCropOptions *crop_options = GIMP_CROP_OPTIONS (options);
return crop_options->fixed_aspect;
}
void
gimp_crop_options_set_aspect (GimpRectangleOptions *options,
gdouble aspect)
{
GimpCropOptions *crop_options = GIMP_CROP_OPTIONS (options);
crop_options->aspect = aspect;
}
gdouble
gimp_crop_options_get_aspect (GimpRectangleOptions *options)
{
GimpCropOptions *crop_options = GIMP_CROP_OPTIONS (options);
return crop_options->aspect;
}
void
gimp_crop_options_set_fixed_center (GimpRectangleOptions *options,
gboolean fixed_center)
{
GimpCropOptions *crop_options = GIMP_CROP_OPTIONS (options);
crop_options->fixed_center = fixed_center;
}
gboolean
gimp_crop_options_get_fixed_center (GimpRectangleOptions *options)
{
GimpCropOptions *crop_options = GIMP_CROP_OPTIONS (options);
return crop_options->fixed_center;
}
void
gimp_crop_options_set_center_x (GimpRectangleOptions *options,
gdouble center_x)
{
GimpCropOptions *crop_options = GIMP_CROP_OPTIONS (options);
crop_options->center_x = center_x;
}
gdouble
gimp_crop_options_get_center_x (GimpRectangleOptions *options)
{
GimpCropOptions *crop_options = GIMP_CROP_OPTIONS (options);
return crop_options->center_x;
}
void
gimp_crop_options_set_center_y (GimpRectangleOptions *options,
gdouble center_y)
{
GimpCropOptions *crop_options = GIMP_CROP_OPTIONS (options);
crop_options->center_y = center_y;
}
gdouble
gimp_crop_options_get_center_y (GimpRectangleOptions *options)
{
GimpCropOptions *crop_options = GIMP_CROP_OPTIONS (options);
return crop_options->center_y;
}
void
gimp_crop_options_set_unit (GimpRectangleOptions *options,
GimpUnit unit)
{
GimpCropOptions *crop_options = GIMP_CROP_OPTIONS (options);
crop_options->unit = unit;
}
GimpUnit
gimp_crop_options_get_unit (GimpRectangleOptions *options)
{
GimpCropOptions *crop_options = GIMP_CROP_OPTIONS (options);
return crop_options->unit;
}
GtkWidget *
gimp_crop_options_gui (GimpToolOptions *tool_options)
{
GObject *config = G_OBJECT (tool_options);
GtkWidget *vbox;
GtkWidget *vbox_rectangle;
GtkWidget *frame;
GtkWidget *button;
gchar *str;
@ -199,24 +547,10 @@ gimp_crop_options_gui (GimpToolOptions *tool_options)
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
/* enlarge toggle */
str = g_strdup_printf (_("Allow enlarging %s"),
gimp_get_mod_string (GDK_MOD1_MASK));
button = gimp_prop_check_button_new (config, "allow-enlarge", str);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
g_free (str);
/* layer toggle */
str = g_strdup_printf (_("Keep aspect ratio %s"),
gimp_get_mod_string (GDK_SHIFT_MASK));
button = gimp_prop_check_button_new (config, "keep-aspect", str);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
g_free (str);
/* rectangle options */
vbox_rectangle = gimp_rectangle_options_gui (tool_options);
gtk_box_pack_start (GTK_BOX (vbox), vbox_rectangle, FALSE, FALSE, 0);
gtk_widget_show (vbox_rectangle);
return vbox;
}

View File

@ -39,9 +39,24 @@ struct _GimpCropOptions
GimpToolOptions parent_instence;
gboolean layer_only;
gboolean allow_enlarge;
gboolean keep_aspect;
GimpCropMode crop_mode;
gboolean highlight;
gboolean fixed_width;
gdouble width;
gboolean fixed_height;
gdouble height;
gboolean fixed_aspect;
gdouble aspect;
gboolean fixed_center;
gdouble center_x;
gdouble center_y;
GimpUnit unit;
};

File diff suppressed because it is too large Load Diff

View File

@ -19,12 +19,6 @@
#ifndef __GIMP_CROP_TOOL_H__
#define __GIMP_CROP_TOOL_H__
#ifdef __GNUC__
#warning FIXME #include "gui/gui-types.h"
#endif
#include "gui/gui-types.h"
#include "gimpdrawtool.h"
@ -32,7 +26,8 @@
#define GIMP_CROP_TOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_CROP_TOOL, GimpCropTool))
#define GIMP_CROP_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_CROP_TOOL, GimpCropToolClass))
#define GIMP_IS_CROP_TOOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_CROP_TOOL))
#define GIMP_CROP_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_CROP_TOOL, GimpCropToolClass))
#define GIMP_IS_CROP_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CROP_TOOL))
#define GIMP_CROP_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_CROP_TOOL, GimpCropToolClass))
typedef struct _GimpCropTool GimpCropTool;
@ -42,12 +37,18 @@ struct _GimpCropTool
{
GimpDrawTool parent_instance;
GtkWidget *controls;
GtkWidget *dimensions_entry;
gint startx; /* starting x coord */
gint starty; /* starting y coord */
gint lastx; /* previous x coord */
gint lasty; /* previous y coord */
gint pressx; /* x where button pressed */
gint pressy; /* y where button pressed */
gint x1, y1; /* upper left hand coordinate */
gint x2, y2; /* lower right hand coords */
@ -56,22 +57,10 @@ struct _GimpCropTool
gint dx1, dy1; /* display coords */
gint dx2, dy2; /* */
gint dcw, dch; /* width and height of corners */
gint dcw, dch; /* width and height of edges */
/* the crop dialog */
InfoDialog *crop_info;
gdouble orig_vals[2];
gdouble size_vals[2];
gdouble aspect_ratio;
gboolean change_aspect_ratio; /* Boolean for the crop_info_update function */
/* aspect_ratio should not be chaget whith */
/* crop_info_update when is called from */
/* crop_aspect_changed, due to the innacurate*/
/* decimal precision */
GtkWidget *origin_sizeentry;
GtkWidget *size_sizeentry;
gdouble origx, origy;
gdouble sizew, sizeh;
};
struct _GimpCropToolClass

View File

@ -0,0 +1,515 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpconfig/gimpconfig.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "tools-types.h"
#include "widgets/gimpwidgets-utils.h"
#include "gimprectangleoptions.h"
#include "gimpnewrectselectoptions.h"
#include "gimptooloptions-gui.h"
#include "gimp-intl.h"
enum
{
PROP_0,
PROP_HIGHLIGHT,
PROP_FIXED_WIDTH,
PROP_WIDTH,
PROP_FIXED_HEIGHT,
PROP_HEIGHT,
PROP_FIXED_ASPECT,
PROP_ASPECT,
PROP_FIXED_CENTER,
PROP_CENTER_X,
PROP_CENTER_Y,
PROP_UNIT
};
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_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_new_rect_select_options_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
void gimp_new_rect_select_options_set_highlight (GimpRectangleOptions *options,
gboolean highlight);
gboolean gimp_new_rect_select_options_get_highlight (GimpRectangleOptions *options);
void gimp_new_rect_select_options_set_fixed_width (GimpRectangleOptions *options,
gboolean fixed_width);
gboolean gimp_new_rect_select_options_get_fixed_width (GimpRectangleOptions *options);
void gimp_new_rect_select_options_set_width (GimpRectangleOptions *options,
gdouble width);
gdouble gimp_new_rect_select_options_get_width (GimpRectangleOptions *options);
void gimp_new_rect_select_options_set_fixed_height (GimpRectangleOptions *options,
gboolean fixed_height);
gboolean gimp_new_rect_select_options_get_fixed_height (GimpRectangleOptions *options);
void gimp_new_rect_select_options_set_height (GimpRectangleOptions *options,
gdouble height);
gdouble gimp_new_rect_select_options_get_height (GimpRectangleOptions *options);
void gimp_new_rect_select_options_set_fixed_aspect (GimpRectangleOptions *options,
gboolean fixed_aspect);
gboolean gimp_new_rect_select_options_get_fixed_aspect (GimpRectangleOptions *options);
void gimp_new_rect_select_options_set_aspect (GimpRectangleOptions *options,
gdouble aspect);
gdouble gimp_new_rect_select_options_get_aspect (GimpRectangleOptions *options);
void gimp_new_rect_select_options_set_fixed_center (GimpRectangleOptions *options,
gboolean fixed_center);
gboolean gimp_new_rect_select_options_get_fixed_center (GimpRectangleOptions *options);
void gimp_new_rect_select_options_set_center_x (GimpRectangleOptions *options,
gdouble center_x);
gdouble gimp_new_rect_select_options_get_center_x (GimpRectangleOptions *options);
void gimp_new_rect_select_options_set_center_y (GimpRectangleOptions *options,
gdouble center_y);
gdouble gimp_new_rect_select_options_get_center_y (GimpRectangleOptions *options);
void gimp_new_rect_select_options_set_unit (GimpRectangleOptions *options,
GimpUnit unit);
GimpUnit gimp_new_rect_select_options_get_unit (GimpRectangleOptions *options);
static GimpSelectionOptionsClass *parent_class = NULL;
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_new_rect_select_options_set_property;
object_class->get_property = gimp_new_rect_select_options_get_property;
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_HIGHLIGHT,
"highlight",
N_("Highlight rectangle"),
TRUE,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FIXED_WIDTH,
"fixed-width", N_("Fixed width"),
FALSE, 0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_WIDTH,
"width", N_("Width"),
0.0, GIMP_MAX_IMAGE_SIZE, 1.0,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FIXED_HEIGHT,
"fixed-height", N_("Fixed height"),
FALSE, 0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_HEIGHT,
"height", N_("Height"),
0.0, GIMP_MAX_IMAGE_SIZE, 1.0,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FIXED_ASPECT,
"fixed-aspect", N_("Fixed aspect"),
FALSE, 0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_ASPECT,
"aspect", N_("Aspect"),
0.0, GIMP_MAX_IMAGE_SIZE, 1.0,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FIXED_CENTER,
"fixed-center", N_("Fixed center"),
FALSE, 0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CENTER_X,
"center-x", N_("Center X"),
0.0, GIMP_MAX_IMAGE_SIZE, 1.0,
0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CENTER_Y,
"center-y", N_("Center Y"),
0.0, GIMP_MAX_IMAGE_SIZE, 1.0,
0);
GIMP_CONFIG_INSTALL_PROP_UNIT (object_class, PROP_UNIT,
"unit", NULL,
TRUE, FALSE, GIMP_UNIT_PIXEL, 0);
}
static void
gimp_new_rect_select_options_rectangle_options_iface_init (GimpRectangleOptionsInterface *rectangle_iface)
{
rectangle_iface->set_highlight = gimp_new_rect_select_options_set_highlight;
rectangle_iface->get_highlight = gimp_new_rect_select_options_get_highlight;
rectangle_iface->set_fixed_width = gimp_new_rect_select_options_set_fixed_width;
rectangle_iface->get_fixed_width = gimp_new_rect_select_options_get_fixed_width;
rectangle_iface->set_width = gimp_new_rect_select_options_set_width;
rectangle_iface->get_width = gimp_new_rect_select_options_get_width;
rectangle_iface->set_fixed_height = gimp_new_rect_select_options_set_fixed_height;
rectangle_iface->get_fixed_height = gimp_new_rect_select_options_get_fixed_height;
rectangle_iface->set_height = gimp_new_rect_select_options_set_height;
rectangle_iface->get_height = gimp_new_rect_select_options_get_height;
rectangle_iface->set_fixed_aspect = gimp_new_rect_select_options_set_fixed_aspect;
rectangle_iface->get_fixed_aspect = gimp_new_rect_select_options_get_fixed_aspect;
rectangle_iface->set_aspect = gimp_new_rect_select_options_set_aspect;
rectangle_iface->get_aspect = gimp_new_rect_select_options_get_aspect;
rectangle_iface->set_fixed_center = gimp_new_rect_select_options_set_fixed_center;
rectangle_iface->get_fixed_center = gimp_new_rect_select_options_get_fixed_center;
rectangle_iface->set_center_x = gimp_new_rect_select_options_set_center_x;
rectangle_iface->get_center_x = gimp_new_rect_select_options_get_center_x;
rectangle_iface->set_center_y = gimp_new_rect_select_options_set_center_y;
rectangle_iface->get_center_y = gimp_new_rect_select_options_get_center_y;
rectangle_iface->set_unit = gimp_new_rect_select_options_set_unit;
rectangle_iface->get_unit = gimp_new_rect_select_options_get_unit;
}
static void
gimp_new_rect_select_options_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
GimpNewRectSelectOptions *options = GIMP_NEW_RECT_SELECT_OPTIONS (object);
GimpRectangleOptions *rectangle_options = GIMP_RECTANGLE_OPTIONS (options);
switch (property_id)
{
case PROP_HIGHLIGHT:
gimp_rectangle_options_set_highlight (rectangle_options, g_value_get_boolean (value));
break;
case PROP_FIXED_WIDTH:
gimp_rectangle_options_set_fixed_width (rectangle_options, g_value_get_boolean (value));
break;
case PROP_WIDTH:
gimp_rectangle_options_set_width (rectangle_options, g_value_get_double (value));
break;
case PROP_FIXED_HEIGHT:
gimp_rectangle_options_set_fixed_height (rectangle_options, g_value_get_boolean (value));
break;
case PROP_HEIGHT:
gimp_rectangle_options_set_height (rectangle_options, g_value_get_double (value));
break;
case PROP_FIXED_ASPECT:
gimp_rectangle_options_set_fixed_aspect (rectangle_options, g_value_get_boolean (value));
break;
case PROP_ASPECT:
gimp_rectangle_options_set_aspect (rectangle_options, g_value_get_double (value));
break;
case PROP_FIXED_CENTER:
gimp_rectangle_options_set_fixed_center (rectangle_options, g_value_get_boolean (value));
break;
case PROP_CENTER_X:
gimp_rectangle_options_set_center_x (rectangle_options, g_value_get_double (value));
break;
case PROP_CENTER_Y:
gimp_rectangle_options_set_center_y (rectangle_options, g_value_get_double (value));
break;
case PROP_UNIT:
gimp_rectangle_options_set_unit (rectangle_options, g_value_get_int (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
gimp_new_rect_select_options_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GimpNewRectSelectOptions *options = GIMP_NEW_RECT_SELECT_OPTIONS (object);
GimpRectangleOptions *rectangle_options = GIMP_RECTANGLE_OPTIONS (options);
switch (property_id)
{
case PROP_HIGHLIGHT:
g_value_set_boolean (value, gimp_rectangle_options_get_highlight (rectangle_options));
break;
case PROP_FIXED_WIDTH:
g_value_set_boolean (value, gimp_rectangle_options_get_fixed_width (rectangle_options));
break;
case PROP_WIDTH:
g_value_set_double (value, gimp_rectangle_options_get_width (rectangle_options));
break;
case PROP_FIXED_HEIGHT:
g_value_set_boolean (value, gimp_rectangle_options_get_fixed_height (rectangle_options));
break;
case PROP_HEIGHT:
g_value_set_double (value, gimp_rectangle_options_get_height (rectangle_options));
break;
case PROP_FIXED_ASPECT:
g_value_set_boolean (value, gimp_rectangle_options_get_fixed_aspect (rectangle_options));
break;
case PROP_ASPECT:
g_value_set_double (value, gimp_rectangle_options_get_aspect (rectangle_options));
break;
case PROP_FIXED_CENTER:
g_value_set_boolean (value, gimp_rectangle_options_get_fixed_center (rectangle_options));
break;
case PROP_CENTER_X:
g_value_set_double (value, gimp_rectangle_options_get_center_x (rectangle_options));
break;
case PROP_CENTER_Y:
g_value_set_double (value, gimp_rectangle_options_get_center_y (rectangle_options));
break;
case PROP_UNIT:
g_value_set_int (value, gimp_rectangle_options_get_unit (rectangle_options));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
void
gimp_new_rect_select_options_set_highlight (GimpRectangleOptions *options,
gboolean highlight)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
new_rect_select_options->highlight = highlight;
}
gboolean
gimp_new_rect_select_options_get_highlight (GimpRectangleOptions *options)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
return new_rect_select_options->highlight;
}
void
gimp_new_rect_select_options_set_fixed_width (GimpRectangleOptions *options,
gboolean fixed_width)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
new_rect_select_options->fixed_width = fixed_width;
}
gboolean
gimp_new_rect_select_options_get_fixed_width (GimpRectangleOptions *options)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
return new_rect_select_options->fixed_width;
}
void
gimp_new_rect_select_options_set_width (GimpRectangleOptions *options,
gdouble width)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
new_rect_select_options->width = width;
}
gdouble
gimp_new_rect_select_options_get_width (GimpRectangleOptions *options)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
return new_rect_select_options->width;
}
void
gimp_new_rect_select_options_set_fixed_height (GimpRectangleOptions *options,
gboolean fixed_height)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
new_rect_select_options->fixed_height = fixed_height;
}
gboolean
gimp_new_rect_select_options_get_fixed_height (GimpRectangleOptions *options)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
return new_rect_select_options->fixed_height;
}
void
gimp_new_rect_select_options_set_height (GimpRectangleOptions *options,
gdouble height)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
new_rect_select_options->height = height;
}
gdouble
gimp_new_rect_select_options_get_height (GimpRectangleOptions *options)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
return new_rect_select_options->height;
}
void
gimp_new_rect_select_options_set_fixed_aspect (GimpRectangleOptions *options,
gboolean fixed_aspect)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
new_rect_select_options->fixed_aspect = fixed_aspect;
}
gboolean
gimp_new_rect_select_options_get_fixed_aspect (GimpRectangleOptions *options)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
return new_rect_select_options->fixed_aspect;
}
void
gimp_new_rect_select_options_set_aspect (GimpRectangleOptions *options,
gdouble aspect)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
new_rect_select_options->aspect = aspect;
}
gdouble
gimp_new_rect_select_options_get_aspect (GimpRectangleOptions *options)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
return new_rect_select_options->aspect;
}
void
gimp_new_rect_select_options_set_fixed_center (GimpRectangleOptions *options,
gboolean fixed_center)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
new_rect_select_options->fixed_center = fixed_center;
}
gboolean
gimp_new_rect_select_options_get_fixed_center (GimpRectangleOptions *options)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
return new_rect_select_options->fixed_center;
}
void
gimp_new_rect_select_options_set_center_x (GimpRectangleOptions *options,
gdouble center_x)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
new_rect_select_options->center_x = center_x;
}
gdouble
gimp_new_rect_select_options_get_center_x (GimpRectangleOptions *options)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
return new_rect_select_options->center_x;
}
void
gimp_new_rect_select_options_set_center_y (GimpRectangleOptions *options,
gdouble center_y)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
new_rect_select_options->center_y = center_y;
}
gdouble
gimp_new_rect_select_options_get_center_y (GimpRectangleOptions *options)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
return new_rect_select_options->center_y;
}
void
gimp_new_rect_select_options_set_unit (GimpRectangleOptions *options,
GimpUnit unit)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
new_rect_select_options->unit = unit;
}
GimpUnit
gimp_new_rect_select_options_get_unit (GimpRectangleOptions *options)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
return new_rect_select_options->unit;
}
GtkWidget *
gimp_new_rect_select_options_gui (GimpToolOptions *tool_options)
{
//GObject *config = G_OBJECT (tool_options);
GtkWidget *vbox;
GtkWidget *vbox_rectangle;
//GtkWidget *frame;
//GtkWidget *button;
//gchar *str;
vbox = gimp_selection_options_gui (tool_options);
/* rectangle options */
vbox_rectangle = gimp_rectangle_options_gui (tool_options);
gtk_box_pack_start (GTK_BOX (vbox), vbox_rectangle, FALSE, FALSE, 0);
gtk_widget_show (vbox_rectangle);
return vbox;
}

View File

@ -0,0 +1,65 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_NEW_RECT_SELECT_OPTIONS_H__
#define __GIMP_NEW_RECT_SELECT_OPTIONS_H__
#include "gimpselectionoptions.h"
#define GIMP_TYPE_NEW_RECT_SELECT_OPTIONS (gimp_new_rect_select_options_get_type ())
#define GIMP_NEW_RECT_SELECT_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_NEW_RECT_SELECT_OPTIONS, GimpNewRectSelectOptions))
#define GIMP_NEW_RECT_SELECT_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_NEW_RECT_SELECT_OPTIONS, GimpNewRectSelectOptionsClass))
#define GIMP_IS_NEW_RECT_SELECT_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_NEW_RECT_SELECT_OPTIONS))
#define GIMP_IS_NEW_RECT_SELECT_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_NEW_RECT_SELECT_OPTIONS))
#define GIMP_NEW_RECT_SELECT_OPTIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_NEW_RECT_SELECT_OPTIONS, GimpNewRectSelectOptionsClass))
typedef struct _GimpNewRectSelectOptions GimpNewRectSelectOptions;
typedef struct _GimpToolOptionsClass GimpNewRectSelectOptionsClass;
struct _GimpNewRectSelectOptions
{
GimpSelectionOptions parent_instence;
gboolean highlight;
gboolean fixed_width;
gdouble width;
gboolean fixed_height;
gdouble height;
gboolean fixed_aspect;
gdouble aspect;
gboolean fixed_center;
gdouble center_x;
gdouble center_y;
GimpUnit unit;
};
GType gimp_new_rect_select_options_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_new_rect_select_options_gui (GimpToolOptions *tool_options);
#endif /* __GIMP_NEW_RECT_SELECT_OPTIONS_H__ */

View File

@ -47,6 +47,7 @@
#include "gimprectangletool.h"
#include "gimprectangleoptions.h"
#include "gimpnewrectselecttool.h"
#include "gimpnewrectselectoptions.h"
#include "gimptoolcontrol.h"
#include "gimp-intl.h"
@ -54,29 +55,104 @@
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_button_press (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp);
static void gimp_new_rect_select_tool_modifier_key (GimpTool *tool,
GdkModifierType key,
gboolean press,
GdkModifierType state,
GimpDisplay *gdisp);
static void gimp_new_rect_select_tool_cursor_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
GimpDisplay *gdisp);
static GObject * gimp_new_rect_select_tool_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
static void gimp_new_rect_select_tool_finalize (GObject *object);
static void gimp_new_rect_select_tool_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *gdisp);
static void gimp_new_rect_select_tool_oper_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
GimpDisplay *gdisp);
static gboolean gimp_new_rect_select_tool_execute (GimpRectangleTool *rect_tool,
gint x,
gint y,
gint w,
gint h);
static GimpDrawToolClass *parent_class = NULL;
void gimp_new_rect_select_tool_set_controls (GimpRectangleTool *tool,
GtkWidget *controls);
GtkWidget * gimp_new_rect_select_tool_get_controls (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_entry (GimpRectangleTool *tool,
GtkWidget *entry);
GtkWidget * gimp_new_rect_select_tool_get_entry (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_startx (GimpRectangleTool *tool,
gint startx);
gint gimp_new_rect_select_tool_get_startx (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_starty (GimpRectangleTool *tool,
gint starty);
gint gimp_new_rect_select_tool_get_starty (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_lastx (GimpRectangleTool *tool,
gint lastx);
gint gimp_new_rect_select_tool_get_lastx (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_lasty (GimpRectangleTool *tool,
gint lasty);
gint gimp_new_rect_select_tool_get_lasty (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_pressx (GimpRectangleTool *tool,
gint pressx);
gint gimp_new_rect_select_tool_get_pressx (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_pressy (GimpRectangleTool *tool,
gint pressy);
gint gimp_new_rect_select_tool_get_pressy (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_x1 (GimpRectangleTool *tool,
gint x1);
gint gimp_new_rect_select_tool_get_x1 (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_y1 (GimpRectangleTool *tool,
gint y1);
gint gimp_new_rect_select_tool_get_y1 (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_x2 (GimpRectangleTool *tool,
gint x2);
gint gimp_new_rect_select_tool_get_x2 (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_y2 (GimpRectangleTool *tool,
gint y2);
gint gimp_new_rect_select_tool_get_y2 (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_function (GimpRectangleTool *tool,
guint function);
guint gimp_new_rect_select_tool_get_function (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_dx1 (GimpRectangleTool *tool,
gint dx1);
gint gimp_new_rect_select_tool_get_dx1 (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_dy1 (GimpRectangleTool *tool,
gint dy1);
gint gimp_new_rect_select_tool_get_dy1 (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_dx2 (GimpRectangleTool *tool,
gint dx2);
gint gimp_new_rect_select_tool_get_dx2 (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_dy2 (GimpRectangleTool *tool,
gint dy2);
gint gimp_new_rect_select_tool_get_dy2 (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_dcw (GimpRectangleTool *tool,
gint dcw);
gint gimp_new_rect_select_tool_get_dcw (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_dch (GimpRectangleTool *tool,
gint dch);
gint gimp_new_rect_select_tool_get_dch (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_origx (GimpRectangleTool *tool,
gdouble origx);
gdouble gimp_new_rect_select_tool_get_origx (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_origy (GimpRectangleTool *tool,
gdouble origy);
gdouble gimp_new_rect_select_tool_get_origy (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_sizew (GimpRectangleTool *tool,
gdouble sizew);
gdouble gimp_new_rect_select_tool_get_sizew (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_sizeh (GimpRectangleTool *tool,
gdouble sizeh);
gdouble gimp_new_rect_select_tool_get_sizeh (GimpRectangleTool *tool);
static GimpSelectionToolClass *parent_class = NULL;
/* public functions */
@ -86,8 +162,8 @@ gimp_new_rect_select_tool_register (GimpToolRegisterCallback callback,
gpointer data)
{
(* callback) (GIMP_TYPE_NEW_RECT_SELECT_TOOL,
GIMP_TYPE_RECTANGLE_OPTIONS,
gimp_rectangle_options_gui,
GIMP_TYPE_NEW_RECT_SELECT_OPTIONS,
gimp_new_rect_select_options_gui,
0,
"gimp-new-rect-select-tool",
_("New Rect Select"),
@ -117,10 +193,19 @@ gimp_new_rect_select_tool_get_type (void)
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_RECTANGLE_TOOL,
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;
@ -129,66 +214,129 @@ gimp_new_rect_select_tool_get_type (void)
static void
gimp_new_rect_select_tool_class_init (GimpNewRectSelectToolClass *klass)
{
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
GimpRectangleToolClass *rect_class = GIMP_RECTANGLE_TOOL_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (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_new_rect_select_tool_button_press;
tool_class->modifier_key = gimp_new_rect_select_tool_modifier_key;
tool_class->cursor_update = gimp_new_rect_select_tool_cursor_update;
object_class->constructor = gimp_new_rect_select_tool_constructor;
object_class->finalize = gimp_new_rect_select_tool_finalize;
rect_class->execute = gimp_new_rect_select_tool_execute;
tool_class->initialize = gimp_rectangle_tool_initialize;
tool_class->control = gimp_new_rect_select_tool_control;
tool_class->button_press = gimp_rectangle_tool_button_press;
tool_class->button_release = gimp_rectangle_tool_button_release;
tool_class->motion = gimp_rectangle_tool_motion;
tool_class->key_press = gimp_rectangle_tool_key_press;
tool_class->modifier_key = gimp_rectangle_tool_modifier_key;
tool_class->oper_update = gimp_new_rect_select_tool_oper_update;
tool_class->cursor_update = gimp_rectangle_tool_cursor_update;
draw_tool_class->draw = gimp_rectangle_tool_draw;
}
static void
gimp_new_rect_select_tool_init (GimpNewRectSelectTool *new_rect_select_tool)
{
GimpTool *tool = GIMP_TOOL (new_rect_select_tool);
GimpRectangleTool *rectangle = GIMP_RECTANGLE_TOOL (new_rect_select_tool);
gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_RECT_SELECT);
rectangle->selection_tool = TRUE;
}
static void
gimp_new_rect_select_tool_button_press (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp)
gimp_new_rect_select_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *rectangle_iface)
{
GimpSelectionTool *sel_tool = GIMP_SELECTION_TOOL (tool);
rectangle_iface->set_controls = gimp_new_rect_select_tool_set_controls;
rectangle_iface->get_controls = gimp_new_rect_select_tool_get_controls;
rectangle_iface->set_entry = gimp_new_rect_select_tool_set_entry;
rectangle_iface->get_entry = gimp_new_rect_select_tool_get_entry;
rectangle_iface->set_startx = gimp_new_rect_select_tool_set_startx;
rectangle_iface->get_startx = gimp_new_rect_select_tool_get_startx;
rectangle_iface->set_starty = gimp_new_rect_select_tool_set_starty;
rectangle_iface->get_starty = gimp_new_rect_select_tool_get_starty;
rectangle_iface->set_lastx = gimp_new_rect_select_tool_set_lastx;
rectangle_iface->get_lastx = gimp_new_rect_select_tool_get_lastx;
rectangle_iface->set_lasty = gimp_new_rect_select_tool_set_lasty;
rectangle_iface->get_lasty = gimp_new_rect_select_tool_get_lasty;
rectangle_iface->set_pressx = gimp_new_rect_select_tool_set_pressx;
rectangle_iface->get_pressx = gimp_new_rect_select_tool_get_pressx;
rectangle_iface->set_pressy = gimp_new_rect_select_tool_set_pressy;
rectangle_iface->get_pressy = gimp_new_rect_select_tool_get_pressy;
rectangle_iface->set_x1 = gimp_new_rect_select_tool_set_x1;
rectangle_iface->get_x1 = gimp_new_rect_select_tool_get_x1;
rectangle_iface->set_y1 = gimp_new_rect_select_tool_set_y1;
rectangle_iface->get_y1 = gimp_new_rect_select_tool_get_y1;
rectangle_iface->set_x2 = gimp_new_rect_select_tool_set_x2;
rectangle_iface->get_x2 = gimp_new_rect_select_tool_get_x2;
rectangle_iface->set_y2 = gimp_new_rect_select_tool_set_y2;
rectangle_iface->get_y2 = gimp_new_rect_select_tool_get_y2;
rectangle_iface->set_function = gimp_new_rect_select_tool_set_function;
rectangle_iface->get_function = gimp_new_rect_select_tool_get_function;
rectangle_iface->set_dx1 = gimp_new_rect_select_tool_set_dx1;
rectangle_iface->get_dx1 = gimp_new_rect_select_tool_get_dx1;
rectangle_iface->set_dy1 = gimp_new_rect_select_tool_set_dy1;
rectangle_iface->get_dy1 = gimp_new_rect_select_tool_get_dy1;
rectangle_iface->set_dx2 = gimp_new_rect_select_tool_set_dx2;
rectangle_iface->get_dx2 = gimp_new_rect_select_tool_get_dx2;
rectangle_iface->set_dy2 = gimp_new_rect_select_tool_set_dy2;
rectangle_iface->get_dy2 = gimp_new_rect_select_tool_get_dy2;
rectangle_iface->set_dcw = gimp_new_rect_select_tool_set_dcw;
rectangle_iface->get_dcw = gimp_new_rect_select_tool_get_dcw;
rectangle_iface->set_dch = gimp_new_rect_select_tool_set_dch;
rectangle_iface->get_dch = gimp_new_rect_select_tool_get_dch;
rectangle_iface->set_origx = gimp_new_rect_select_tool_set_origx;
rectangle_iface->get_origx = gimp_new_rect_select_tool_get_origx;
rectangle_iface->set_origy = gimp_new_rect_select_tool_set_origy;
rectangle_iface->get_origy = gimp_new_rect_select_tool_get_origy;
rectangle_iface->set_sizew = gimp_new_rect_select_tool_set_sizew;
rectangle_iface->get_sizew = gimp_new_rect_select_tool_get_sizew;
rectangle_iface->set_sizeh = gimp_new_rect_select_tool_set_sizeh;
rectangle_iface->get_sizeh = gimp_new_rect_select_tool_get_sizeh;
rectangle_iface->execute = gimp_new_rect_select_tool_execute;
}
GIMP_TOOL_CLASS (parent_class)->button_press (tool, coords,
time, state, gdisp);
static GObject *
gimp_new_rect_select_tool_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
{
GObject *object;
if (gimp_selection_tool_start_edit (sel_tool, coords))
{
gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool));
return;
}
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
gimp_rectangle_tool_constructor (object);
return object;
}
static void
gimp_new_rect_select_tool_modifier_key (GimpTool *tool,
GdkModifierType key,
gboolean press,
GdkModifierType state,
GimpDisplay *gdisp)
gimp_new_rect_select_tool_finalize (GObject *object)
{
gimp_rectangle_tool_finalize (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gimp_new_rect_select_tool_cursor_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
GimpDisplay *gdisp)
gimp_new_rect_select_tool_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *gdisp)
{
gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_RECT_SELECT);
gimp_rectangle_tool_control (tool, action, gdisp);
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, gdisp);
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
}
static void
gimp_new_rect_select_tool_oper_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
GimpDisplay *gdisp)
{
gimp_rectangle_tool_oper_update (tool, coords, state, gdisp);
GIMP_TOOL_CLASS (parent_class)->oper_update (tool, coords, state, gdisp);
}
/*
@ -219,6 +367,8 @@ gimp_new_rect_select_tool_execute (GimpRectangleTool *rectangle,
gboolean selected;
gint val;
GimpChannel *selection_mask;
gint x1, y1;
gint x2, y2;
options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options);
@ -250,7 +400,7 @@ gimp_new_rect_select_tool_execute (GimpRectangleTool *rectangle,
val = gimp_pickable_get_opacity_at (GIMP_PICKABLE (selection_mask),
rectangle->pressx, rectangle->pressy);
gimp_rectangle_tool_get_pressx (rectangle), gimp_rectangle_tool_get_pressy (rectangle));
selected = (val > 127);
@ -259,13 +409,20 @@ gimp_new_rect_select_tool_execute (GimpRectangleTool *rectangle,
if (selected)
{
if (! gimp_channel_bounds (selection_mask,
&rectangle->x1, &rectangle->y1,
&rectangle->x2, &rectangle->y2))
&x1, &y1,
&x2, &y2))
{
rectangle->x1 = 0;
rectangle->y1 = 0;
rectangle->x2 = gimage->width;
rectangle->y2 = gimage->height;
gimp_rectangle_tool_set_x1 (rectangle, x1);
gimp_rectangle_tool_set_y1 (rectangle, y1);
gimp_rectangle_tool_set_x2 (rectangle, x2);
gimp_rectangle_tool_set_y2 (rectangle, y2);
}
else
{
gimp_rectangle_tool_set_x1 (rectangle, 0);
gimp_rectangle_tool_set_y1 (rectangle, 0);
gimp_rectangle_tool_set_x2 (rectangle, gimage->width);
gimp_rectangle_tool_set_y2 (rectangle, gimage->height);
}
return FALSE;
@ -277,3 +434,348 @@ gimp_new_rect_select_tool_execute (GimpRectangleTool *rectangle,
return TRUE;
}
void
gimp_new_rect_select_tool_set_controls (GimpRectangleTool *tool,
GtkWidget *controls)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->controls = controls;
}
GtkWidget *
gimp_new_rect_select_tool_get_controls (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->controls;
}
void
gimp_new_rect_select_tool_set_entry (GimpRectangleTool *tool,
GtkWidget *entry)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->dimensions_entry = entry;
}
GtkWidget *
gimp_new_rect_select_tool_get_entry (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->dimensions_entry;
}
void
gimp_new_rect_select_tool_set_startx (GimpRectangleTool *tool,
gint startx)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->startx = startx;
}
gint
gimp_new_rect_select_tool_get_startx (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->startx;
}
void
gimp_new_rect_select_tool_set_starty (GimpRectangleTool *tool,
gint starty)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->starty = starty;
}
gint
gimp_new_rect_select_tool_get_starty (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->starty;
}
void
gimp_new_rect_select_tool_set_lastx (GimpRectangleTool *tool,
gint lastx)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->lastx = lastx;
}
gint
gimp_new_rect_select_tool_get_lastx (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->lastx;
}
void
gimp_new_rect_select_tool_set_lasty (GimpRectangleTool *tool,
gint lasty)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->lasty = lasty;
}
gint
gimp_new_rect_select_tool_get_lasty (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->lasty;
}
void
gimp_new_rect_select_tool_set_pressx (GimpRectangleTool *tool,
gint pressx)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->pressx = pressx;
}
gint
gimp_new_rect_select_tool_get_pressx (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->pressx;
}
void
gimp_new_rect_select_tool_set_pressy (GimpRectangleTool *tool,
gint pressy)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->pressy = pressy;
}
gint
gimp_new_rect_select_tool_get_pressy (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->pressy;
}
void
gimp_new_rect_select_tool_set_x1 (GimpRectangleTool *tool,
gint x1)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->x1 = x1;
}
gint
gimp_new_rect_select_tool_get_x1 (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->x1;
}
void
gimp_new_rect_select_tool_set_y1 (GimpRectangleTool *tool,
gint y1)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->y1 = y1;
}
gint
gimp_new_rect_select_tool_get_y1 (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->y1;
}
void
gimp_new_rect_select_tool_set_x2 (GimpRectangleTool *tool,
gint x2)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->x2 = x2;
}
gint
gimp_new_rect_select_tool_get_x2 (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->x2;
}
void
gimp_new_rect_select_tool_set_y2 (GimpRectangleTool *tool,
gint y2)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->y2 = y2;
}
gint
gimp_new_rect_select_tool_get_y2 (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->y2;
}
void
gimp_new_rect_select_tool_set_function (GimpRectangleTool *tool,
guint function)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->function = function;
}
guint
gimp_new_rect_select_tool_get_function (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->function;
}
void
gimp_new_rect_select_tool_set_dx1 (GimpRectangleTool *tool,
gint dx1)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->dx1 = dx1;
}
gint
gimp_new_rect_select_tool_get_dx1 (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->dx1;
}
void
gimp_new_rect_select_tool_set_dy1 (GimpRectangleTool *tool,
gint dy1)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->dy1 = dy1;
}
gint
gimp_new_rect_select_tool_get_dy1 (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->dy1;
}
void
gimp_new_rect_select_tool_set_dx2 (GimpRectangleTool *tool,
gint dx2)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->dx2 = dx2;
}
gint
gimp_new_rect_select_tool_get_dx2 (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->dx2;
}
void
gimp_new_rect_select_tool_set_dy2 (GimpRectangleTool *tool,
gint dy2)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->dy2 = dy2;
}
gint
gimp_new_rect_select_tool_get_dy2 (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->dy2;
}
void
gimp_new_rect_select_tool_set_dcw (GimpRectangleTool *tool,
gint dcw)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->dcw = dcw;
}
gint
gimp_new_rect_select_tool_get_dcw (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->dcw;
}
void
gimp_new_rect_select_tool_set_dch (GimpRectangleTool *tool,
gint dch)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->dch = dch;
}
gint
gimp_new_rect_select_tool_get_dch (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->dch;
}
void
gimp_new_rect_select_tool_set_origx (GimpRectangleTool *tool,
gdouble origx)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->origx = origx;
}
gdouble
gimp_new_rect_select_tool_get_origx (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->origx;
}
void
gimp_new_rect_select_tool_set_origy (GimpRectangleTool *tool,
gdouble origy)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->origy = origy;
}
gdouble
gimp_new_rect_select_tool_get_origy (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->origy;
}
void
gimp_new_rect_select_tool_set_sizew (GimpRectangleTool *tool,
gdouble sizew)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->sizew = sizew;
}
gdouble
gimp_new_rect_select_tool_get_sizew (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->sizew;
}
void
gimp_new_rect_select_tool_set_sizeh (GimpRectangleTool *tool,
gdouble sizeh)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->sizeh = sizeh;
}
gdouble
gimp_new_rect_select_tool_get_sizeh (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->sizeh;
}

View File

@ -19,14 +19,14 @@
#ifndef __GIMP_NEW_RECT_SELECT_TOOL_H__
#define __GIMP_NEW_RECT_SELECT_TOOL_H__
#include "gimprectangletool.h"
#include "gimpselectiontool.h"
#define GIMP_TYPE_NEW_RECT_SELECT_TOOL (gimp_new_rect_select_tool_get_type ())
#define GIMP_NEW_RECT_SELECT_TOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_NEW_RECT_SELECT_TOOL, GimpNewRectSelectTool))
#define GIMP_NEW_RECT_SELECT_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_NEW_RECT_SELECT_TOOL, GimpNewRectSelectToolClass))
#define GIMP_IS_NEW_RECT_SELECT_TOOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_NEW_RECT_SELECT_TOOL))
#define GIMP_NEW_RECT_SELECT_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_NEW_RECT_SELECT_TOOL, GimpNewRectSelectToolClass))
#define GIMP_IS_NEW_RECT_SELECT_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_NEW_RECT_SELECT_TOOL))
#define GIMP_NEW_RECT_SELECT_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_NEW_RECT_SELECT_TOOL, GimpNewRectSelectToolClass))
@ -35,17 +35,42 @@ typedef struct _GimpNewRectSelectToolClass GimpNewRectSelectToolClass;
struct _GimpNewRectSelectTool
{
GimpRectangleTool parent_instance;
GimpSelectionTool parent_instance;
GtkWidget *controls;
GtkWidget *dimensions_entry;
gint startx; /* starting x coord */
gint starty; /* starting y coord */
gint lastx; /* previous x coord */
gint lasty; /* previous y coord */
gint pressx; /* x where button pressed */
gint pressy; /* y where button pressed */
gint x1, y1; /* upper left hand coordinate */
gint x2, y2; /* lower right hand coords */
guint function; /* moving or resizing */
gint dx1, dy1; /* display coords */
gint dx2, dy2; /* */
gint dcw, dch; /* width and height of edges */
gdouble origx, origy;
gdouble sizew, sizeh;
};
struct _GimpNewRectSelectToolClass
{
GimpRectangleToolClass parent_class;
GimpSelectionToolClass parent_class;
};
void gimp_new_rect_select_tool_register (GimpToolRegisterCallback callback,
gpointer data);
gpointer data);
GType gimp_new_rect_select_tool_get_type (void) G_GNUC_CONST;

View File

@ -26,13 +26,6 @@
#include "tools-types.h"
#include "config/gimpguiconfig.h"
#include "core/gimp.h"
#include "core/gimptoolinfo.h"
#include "widgets/gimpwidgets-utils.h"
#include "gimprectangleoptions.h"
#include "gimptooloptions-gui.h"
@ -56,202 +49,360 @@ enum
};
static void gimp_rectangle_options_class_init (GimpRectangleOptionsClass *options_class);
static void gimp_rectangle_options_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_rectangle_options_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static GimpToolOptionsClass *parent_class = NULL;
static void gimp_rectangle_options_iface_base_init (GimpRectangleOptionsInterface *rectangle_options_iface);
GType
gimp_rectangle_options_get_type (void)
gimp_rectangle_options_interface_get_type (void)
{
static GType type = 0;
static GType rectangle_options_iface_type = 0;
if (! type)
if (!rectangle_options_iface_type)
{
static const GTypeInfo info =
static const GTypeInfo rectangle_options_iface_info =
{
sizeof (GimpRectangleOptionsClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_rectangle_options_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpRectangleOptions),
0, /* n_preallocs */
(GInstanceInitFunc) NULL
sizeof (GimpRectangleOptionsInterface),
(GBaseInitFunc) gimp_rectangle_options_iface_base_init,
(GBaseFinalizeFunc) NULL,
};
type = g_type_register_static (GIMP_TYPE_SELECTION_OPTIONS,
"GimpRectangleOptions",
&info, 0);
rectangle_options_iface_type = g_type_register_static (G_TYPE_INTERFACE,
"GimpRectangleOptionsInterface",
&rectangle_options_iface_info,
0);
}
return type;
return rectangle_options_iface_type;
}
static void
gimp_rectangle_options_class_init (GimpRectangleOptionsClass *klass)
gimp_rectangle_options_iface_base_init (GimpRectangleOptionsInterface *rectangle_options_iface)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
static gboolean initialized = FALSE;
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;
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_HIGHLIGHT,
"highlight",
N_("Highlight rectangle"),
TRUE,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FIXED_WIDTH,
"fixed-width", N_("Fixed width"),
FALSE, 0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_WIDTH,
"width", N_("Width"),
0.0, GIMP_MAX_IMAGE_SIZE, 1.0,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FIXED_HEIGHT,
"fixed-height", N_("Fixed height"),
FALSE, 0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_HEIGHT,
"height", N_("Height"),
0.0, GIMP_MAX_IMAGE_SIZE, 1.0,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FIXED_ASPECT,
"fixed-aspect", N_("Fixed aspect"),
FALSE, 0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_ASPECT,
"aspect", N_("Aspect"),
0.0, GIMP_MAX_IMAGE_SIZE, 1.0,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FIXED_CENTER,
"fixed-center", N_("Fixed center"),
FALSE, 0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CENTER_X,
"center-x", N_("Center X"),
0.0, GIMP_MAX_IMAGE_SIZE, 1.0,
0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CENTER_Y,
"center-y", N_("Center Y"),
0.0, GIMP_MAX_IMAGE_SIZE, 1.0,
0);
GIMP_CONFIG_INSTALL_PROP_UNIT (object_class, PROP_UNIT,
"unit", NULL,
TRUE, FALSE, GIMP_UNIT_PIXEL, 0);
}
static void
gimp_rectangle_options_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
GimpRectangleOptions *options = GIMP_RECTANGLE_OPTIONS (object);
switch (property_id)
if (! initialized)
{
case PROP_HIGHLIGHT:
options->highlight = g_value_get_boolean (value);
break;
case PROP_FIXED_WIDTH:
options->fixed_width = g_value_get_boolean (value);
break;
case PROP_WIDTH:
options->width = g_value_get_double (value);
break;
case PROP_FIXED_HEIGHT:
options->fixed_height = g_value_get_boolean (value);
break;
case PROP_HEIGHT:
options->height = g_value_get_double (value);
break;
case PROP_FIXED_ASPECT:
options->fixed_aspect = g_value_get_boolean (value);
break;
case PROP_ASPECT:
options->aspect = g_value_get_double (value);
break;
case PROP_FIXED_CENTER:
options->fixed_center = g_value_get_boolean (value);
break;
case PROP_CENTER_X:
options->center_x = g_value_get_double (value);
break;
case PROP_CENTER_Y:
options->center_y = g_value_get_double (value);
break;
case PROP_UNIT:
options->unit = g_value_get_int (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
initialized = TRUE;
}
}
static void
gimp_rectangle_options_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
void
gimp_rectangle_options_set_highlight (GimpRectangleOptions *options,
gboolean highlight)
{
GimpRectangleOptions *options = GIMP_RECTANGLE_OPTIONS (object);
GimpRectangleOptionsInterface *options_iface;
switch (property_id)
{
case PROP_HIGHLIGHT:
g_value_set_boolean (value, options->highlight);
break;
case PROP_FIXED_WIDTH:
g_value_set_boolean (value, options->fixed_width);
break;
case PROP_WIDTH:
g_value_set_double (value, options->width);
break;
case PROP_FIXED_HEIGHT:
g_value_set_boolean (value, options->fixed_height);
break;
case PROP_HEIGHT:
g_value_set_double (value, options->height);
break;
case PROP_FIXED_ASPECT:
g_value_set_boolean (value, options->fixed_aspect);
break;
case PROP_ASPECT:
g_value_set_double (value, options->aspect);
break;
case PROP_FIXED_CENTER:
g_value_set_boolean (value, options->fixed_center);
break;
case PROP_CENTER_X:
g_value_set_double (value, options->center_x);
break;
case PROP_CENTER_Y:
g_value_set_double (value, options->center_y);
break;
case PROP_UNIT:
g_value_set_int (value, options->unit);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
g_return_if_fail (GIMP_IS_RECTANGLE_OPTIONS (options));
options_iface = GIMP_RECTANGLE_OPTIONS_GET_INTERFACE (options);
if (options_iface->set_highlight)
options_iface->set_highlight (options, highlight);
}
gboolean
gimp_rectangle_options_get_highlight (GimpRectangleOptions *options)
{
GimpRectangleOptionsInterface *options_iface;
g_return_val_if_fail (GIMP_IS_RECTANGLE_OPTIONS (options), FALSE);
options_iface = GIMP_RECTANGLE_OPTIONS_GET_INTERFACE (options);
if (options_iface->get_highlight)
return options_iface->get_highlight (options);
return FALSE;
}
void
gimp_rectangle_options_set_fixed_width (GimpRectangleOptions *options,
gboolean fixed_width)
{
GimpRectangleOptionsInterface *options_iface;
g_return_if_fail (GIMP_IS_RECTANGLE_OPTIONS (options));
options_iface = GIMP_RECTANGLE_OPTIONS_GET_INTERFACE (options);
if (options_iface->set_fixed_width)
options_iface->set_fixed_width (options, fixed_width);
}
gboolean
gimp_rectangle_options_get_fixed_width (GimpRectangleOptions *options)
{
GimpRectangleOptionsInterface *options_iface;
g_return_val_if_fail (GIMP_IS_RECTANGLE_OPTIONS (options), FALSE);
options_iface = GIMP_RECTANGLE_OPTIONS_GET_INTERFACE (options);
if (options_iface->get_fixed_width)
return options_iface->get_fixed_width (options);
return FALSE;
}
void
gimp_rectangle_options_set_width (GimpRectangleOptions *options,
gdouble width)
{
GimpRectangleOptionsInterface *options_iface;
g_return_if_fail (GIMP_IS_RECTANGLE_OPTIONS (options));
options_iface = GIMP_RECTANGLE_OPTIONS_GET_INTERFACE (options);
if (options_iface->set_width)
options_iface->set_width (options, width);
}
gdouble
gimp_rectangle_options_get_width (GimpRectangleOptions *options)
{
GimpRectangleOptionsInterface *options_iface;
g_return_val_if_fail (GIMP_IS_RECTANGLE_OPTIONS (options), 0);
options_iface = GIMP_RECTANGLE_OPTIONS_GET_INTERFACE (options);
if (options_iface->get_width)
return options_iface->get_width (options);
return 0;
}
void
gimp_rectangle_options_set_fixed_height (GimpRectangleOptions *options,
gboolean fixed_height)
{
GimpRectangleOptionsInterface *options_iface;
g_return_if_fail (GIMP_IS_RECTANGLE_OPTIONS (options));
options_iface = GIMP_RECTANGLE_OPTIONS_GET_INTERFACE (options);
if (options_iface->set_fixed_height)
options_iface->set_fixed_height (options, fixed_height);
}
gboolean
gimp_rectangle_options_get_fixed_height (GimpRectangleOptions *options)
{
GimpRectangleOptionsInterface *options_iface;
g_return_val_if_fail (GIMP_IS_RECTANGLE_OPTIONS (options), FALSE);
options_iface = GIMP_RECTANGLE_OPTIONS_GET_INTERFACE (options);
if (options_iface->get_fixed_height)
return options_iface->get_fixed_height (options);
return FALSE;
}
void
gimp_rectangle_options_set_height (GimpRectangleOptions *options,
gdouble height)
{
GimpRectangleOptionsInterface *options_iface;
g_return_if_fail (GIMP_IS_RECTANGLE_OPTIONS (options));
options_iface = GIMP_RECTANGLE_OPTIONS_GET_INTERFACE (options);
if (options_iface->set_height)
options_iface->set_height (options, height);
}
gdouble
gimp_rectangle_options_get_height (GimpRectangleOptions *options)
{
GimpRectangleOptionsInterface *options_iface;
g_return_val_if_fail (GIMP_IS_RECTANGLE_OPTIONS (options), 0);
options_iface = GIMP_RECTANGLE_OPTIONS_GET_INTERFACE (options);
if (options_iface->get_height)
return options_iface->get_height (options);
return 0;
}
void
gimp_rectangle_options_set_fixed_aspect (GimpRectangleOptions *options,
gboolean fixed_aspect)
{
GimpRectangleOptionsInterface *options_iface;
g_return_if_fail (GIMP_IS_RECTANGLE_OPTIONS (options));
options_iface = GIMP_RECTANGLE_OPTIONS_GET_INTERFACE (options);
if (options_iface->set_fixed_aspect)
options_iface->set_fixed_aspect (options, fixed_aspect);
}
gboolean
gimp_rectangle_options_get_fixed_aspect (GimpRectangleOptions *options)
{
GimpRectangleOptionsInterface *options_iface;
g_return_val_if_fail (GIMP_IS_RECTANGLE_OPTIONS (options), FALSE);
options_iface = GIMP_RECTANGLE_OPTIONS_GET_INTERFACE (options);
if (options_iface->get_fixed_aspect)
return options_iface->get_fixed_aspect (options);
return FALSE;
}
void
gimp_rectangle_options_set_aspect (GimpRectangleOptions *options,
gdouble aspect)
{
GimpRectangleOptionsInterface *options_iface;
g_return_if_fail (GIMP_IS_RECTANGLE_OPTIONS (options));
options_iface = GIMP_RECTANGLE_OPTIONS_GET_INTERFACE (options);
if (options_iface->set_aspect)
options_iface->set_aspect (options, aspect);
}
gdouble
gimp_rectangle_options_get_aspect (GimpRectangleOptions *options)
{
GimpRectangleOptionsInterface *options_iface;
g_return_val_if_fail (GIMP_IS_RECTANGLE_OPTIONS (options), 0);
options_iface = GIMP_RECTANGLE_OPTIONS_GET_INTERFACE (options);
if (options_iface->get_aspect)
return options_iface->get_aspect (options);
return 0;
}
void
gimp_rectangle_options_set_fixed_center (GimpRectangleOptions *options,
gboolean fixed_center)
{
GimpRectangleOptionsInterface *options_iface;
g_return_if_fail (GIMP_IS_RECTANGLE_OPTIONS (options));
options_iface = GIMP_RECTANGLE_OPTIONS_GET_INTERFACE (options);
if (options_iface->set_fixed_center)
options_iface->set_fixed_center (options, fixed_center);
}
gboolean
gimp_rectangle_options_get_fixed_center (GimpRectangleOptions *options)
{
GimpRectangleOptionsInterface *options_iface;
g_return_val_if_fail (GIMP_IS_RECTANGLE_OPTIONS (options), FALSE);
options_iface = GIMP_RECTANGLE_OPTIONS_GET_INTERFACE (options);
if (options_iface->get_fixed_center)
return options_iface->get_fixed_center (options);
return FALSE;
}
void
gimp_rectangle_options_set_center_x (GimpRectangleOptions *options,
gdouble center_x)
{
GimpRectangleOptionsInterface *options_iface;
g_return_if_fail (GIMP_IS_RECTANGLE_OPTIONS (options));
options_iface = GIMP_RECTANGLE_OPTIONS_GET_INTERFACE (options);
if (options_iface->set_center_x)
options_iface->set_center_x (options, center_x);
}
gdouble
gimp_rectangle_options_get_center_x (GimpRectangleOptions *options)
{
GimpRectangleOptionsInterface *options_iface;
g_return_val_if_fail (GIMP_IS_RECTANGLE_OPTIONS (options), 0);
options_iface = GIMP_RECTANGLE_OPTIONS_GET_INTERFACE (options);
if (options_iface->get_center_x)
return options_iface->get_center_x (options);
return 0;
}
void
gimp_rectangle_options_set_center_y (GimpRectangleOptions *options,
gdouble center_y)
{
GimpRectangleOptionsInterface *options_iface;
g_return_if_fail (GIMP_IS_RECTANGLE_OPTIONS (options));
options_iface = GIMP_RECTANGLE_OPTIONS_GET_INTERFACE (options);
if (options_iface->set_center_y)
options_iface->set_center_y (options, center_y);
}
gdouble
gimp_rectangle_options_get_center_y (GimpRectangleOptions *options)
{
GimpRectangleOptionsInterface *options_iface;
g_return_val_if_fail (GIMP_IS_RECTANGLE_OPTIONS (options), 0);
options_iface = GIMP_RECTANGLE_OPTIONS_GET_INTERFACE (options);
if (options_iface->get_center_y)
return options_iface->get_center_y (options);
return 0;
}
void
gimp_rectangle_options_set_unit (GimpRectangleOptions *options,
GimpUnit unit)
{
GimpRectangleOptionsInterface *options_iface;
g_return_if_fail (GIMP_IS_RECTANGLE_OPTIONS (options));
options_iface = GIMP_RECTANGLE_OPTIONS_GET_INTERFACE (options);
if (options_iface->set_unit)
options_iface->set_unit (options, unit);
}
GimpUnit
gimp_rectangle_options_get_unit (GimpRectangleOptions *options)
{
GimpRectangleOptionsInterface *options_iface;
g_return_val_if_fail (GIMP_IS_RECTANGLE_OPTIONS (options), GIMP_UNIT_PIXEL);
options_iface = GIMP_RECTANGLE_OPTIONS_GET_INTERFACE (options);
if (options_iface->get_unit)
return options_iface->get_unit (options);
return GIMP_UNIT_PIXEL;
}
GtkWidget *
@ -267,9 +418,8 @@ gimp_rectangle_options_gui (GimpToolOptions *tool_options)
GtkWidget *label;
GtkWidget *spinbutton;
vbox = gimp_selection_options_gui (tool_options);
vbox = gimp_tool_options_gui (tool_options);
/* the highlight toggle button */
button = gimp_prop_check_button_new (config, "highlight",
_("Highlight"));
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);

View File

@ -20,46 +20,103 @@
#define __GIMP_RECTANGLE_OPTIONS_H__
#include "gimpselectionoptions.h"
#define GIMP_TYPE_RECTANGLE_OPTIONS (gimp_rectangle_options_interface_get_type ())
#define GIMP_IS_RECTANGLE_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_RECTANGLE_OPTIONS))
#define GIMP_RECTANGLE_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_RECTANGLE_OPTIONS, GimpRectangleOptions))
#define GIMP_RECTANGLE_OPTIONS_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GIMP_TYPE_RECTANGLE_OPTIONS, GimpRectangleOptionsInterface))
#define GIMP_TYPE_RECTANGLE_OPTIONS (gimp_rectangle_options_get_type ())
#define GIMP_RECTANGLE_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_RECTANGLE_OPTIONS, GimpRectangleOptions))
#define GIMP_RECTANGLE_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_RECTANGLE_OPTIONS, GimpRectangleOptionsClass))
#define GIMP_IS_RECTANGLE_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_RECTANGLE_OPTIONS))
#define GIMP_IS_RECTANGLE_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_RECTANGLE_OPTIONS))
#define GIMP_RECTANGLE_OPTIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_RECTANGLE_OPTIONS, GimpRectangleOptionsClass))
typedef struct _GimpRectangleOptions GimpRectangleOptions;
typedef struct _GimpRectangleOptionsInterface GimpRectangleOptionsInterface;
typedef struct _GimpRectangleOptions GimpRectangleOptions;
typedef struct _GimpToolOptionsClass GimpRectangleOptionsClass;
struct _GimpRectangleOptions
struct _GimpRectangleOptionsInterface
{
GimpSelectionOptions parent_instance;
GTypeInterface base_iface;
gboolean highlight;
/* virtual functions */
void (* set_highlight) (GimpRectangleOptions *options,
gboolean highlight);
gboolean (* get_highlight) (GimpRectangleOptions *options);
gboolean fixed_width;
gdouble width;
void (* set_fixed_width) (GimpRectangleOptions *options,
gboolean fixed_width);
gboolean (* get_fixed_width) (GimpRectangleOptions *options);
void (* set_width) (GimpRectangleOptions *options,
gdouble width);
gdouble (* get_width) (GimpRectangleOptions *options);
gboolean fixed_height;
gdouble height;
void (* set_fixed_height) (GimpRectangleOptions *options,
gboolean fixed_height);
gboolean (* get_fixed_height) (GimpRectangleOptions *options);
void (* set_height) (GimpRectangleOptions *options,
gdouble height);
gdouble (* get_height) (GimpRectangleOptions *options);
gboolean fixed_aspect;
gdouble aspect;
void (* set_fixed_aspect) (GimpRectangleOptions *options,
gboolean fixed_aspect);
gboolean (* get_fixed_aspect) (GimpRectangleOptions *options);
void (* set_aspect) (GimpRectangleOptions *options,
gdouble aspect);
gdouble (* get_aspect) (GimpRectangleOptions *options);
gboolean fixed_center;
gdouble center_x;
gdouble center_y;
void (* set_fixed_center) (GimpRectangleOptions *options,
gboolean fixed_center);
gboolean (* get_fixed_center) (GimpRectangleOptions *options);
void (* set_center_x) (GimpRectangleOptions *options,
gdouble center_x);
gdouble (* get_center_x) (GimpRectangleOptions *options);
void (* set_center_y) (GimpRectangleOptions *options,
gdouble center_y);
gdouble (* get_center_y) (GimpRectangleOptions *options);
GimpUnit unit;
void (* set_unit) (GimpRectangleOptions *options,
GimpUnit unit);
GimpUnit (* get_unit) (GimpRectangleOptions *options);
};
GType gimp_rectangle_options_get_type (void) G_GNUC_CONST;
GType gimp_rectangle_options_interface_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_rectangle_options_gui (GimpToolOptions *tool_options);
void gimp_rectangle_options_set_highlight (GimpRectangleOptions *options,
gboolean highlight);
gboolean gimp_rectangle_options_get_highlight (GimpRectangleOptions *options);
void gimp_rectangle_options_set_fixed_width (GimpRectangleOptions *options,
gboolean fixed_width);
gboolean gimp_rectangle_options_get_fixed_width (GimpRectangleOptions *options);
void gimp_rectangle_options_set_width (GimpRectangleOptions *options,
gdouble width);
gdouble gimp_rectangle_options_get_width (GimpRectangleOptions *options);
void gimp_rectangle_options_set_fixed_height (GimpRectangleOptions *options,
gboolean fixed_height);
gboolean gimp_rectangle_options_get_fixed_height (GimpRectangleOptions *options);
void gimp_rectangle_options_set_height (GimpRectangleOptions *options,
gdouble height);
gdouble gimp_rectangle_options_get_height (GimpRectangleOptions *options);
void gimp_rectangle_options_set_fixed_aspect (GimpRectangleOptions *options,
gboolean fixed_aspect);
gboolean gimp_rectangle_options_get_fixed_aspect (GimpRectangleOptions *options);
void gimp_rectangle_options_set_aspect (GimpRectangleOptions *options,
gdouble aspect);
gdouble gimp_rectangle_options_get_aspect (GimpRectangleOptions *options);
void gimp_rectangle_options_set_fixed_center (GimpRectangleOptions *options,
gboolean fixed_center);
gboolean gimp_rectangle_options_get_fixed_center (GimpRectangleOptions *options);
void gimp_rectangle_options_set_center_x (GimpRectangleOptions *options,
gdouble center_x);
gdouble gimp_rectangle_options_get_center_x (GimpRectangleOptions *options);
void gimp_rectangle_options_set_center_y (GimpRectangleOptions *options,
gdouble center_y);
gdouble gimp_rectangle_options_get_center_y (GimpRectangleOptions *options);
void gimp_rectangle_options_set_unit (GimpRectangleOptions *options,
GimpUnit unit);
GimpUnit gimp_rectangle_options_get_unit (GimpRectangleOptions *options);
GtkWidget * gimp_rectangle_options_gui (GimpToolOptions *tool_options);
#endif /* __GIMP_SELCTION_OPTIONS_H__ */
#endif /* __GIMP_RECTANGLE_OPTIONS_H__ */

View File

@ -0,0 +1,515 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpconfig/gimpconfig.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "tools-types.h"
#include "widgets/gimpwidgets-utils.h"
#include "gimprectangleoptions.h"
#include "gimpnewrectselectoptions.h"
#include "gimptooloptions-gui.h"
#include "gimp-intl.h"
enum
{
PROP_0,
PROP_HIGHLIGHT,
PROP_FIXED_WIDTH,
PROP_WIDTH,
PROP_FIXED_HEIGHT,
PROP_HEIGHT,
PROP_FIXED_ASPECT,
PROP_ASPECT,
PROP_FIXED_CENTER,
PROP_CENTER_X,
PROP_CENTER_Y,
PROP_UNIT
};
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_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_new_rect_select_options_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
void gimp_new_rect_select_options_set_highlight (GimpRectangleOptions *options,
gboolean highlight);
gboolean gimp_new_rect_select_options_get_highlight (GimpRectangleOptions *options);
void gimp_new_rect_select_options_set_fixed_width (GimpRectangleOptions *options,
gboolean fixed_width);
gboolean gimp_new_rect_select_options_get_fixed_width (GimpRectangleOptions *options);
void gimp_new_rect_select_options_set_width (GimpRectangleOptions *options,
gdouble width);
gdouble gimp_new_rect_select_options_get_width (GimpRectangleOptions *options);
void gimp_new_rect_select_options_set_fixed_height (GimpRectangleOptions *options,
gboolean fixed_height);
gboolean gimp_new_rect_select_options_get_fixed_height (GimpRectangleOptions *options);
void gimp_new_rect_select_options_set_height (GimpRectangleOptions *options,
gdouble height);
gdouble gimp_new_rect_select_options_get_height (GimpRectangleOptions *options);
void gimp_new_rect_select_options_set_fixed_aspect (GimpRectangleOptions *options,
gboolean fixed_aspect);
gboolean gimp_new_rect_select_options_get_fixed_aspect (GimpRectangleOptions *options);
void gimp_new_rect_select_options_set_aspect (GimpRectangleOptions *options,
gdouble aspect);
gdouble gimp_new_rect_select_options_get_aspect (GimpRectangleOptions *options);
void gimp_new_rect_select_options_set_fixed_center (GimpRectangleOptions *options,
gboolean fixed_center);
gboolean gimp_new_rect_select_options_get_fixed_center (GimpRectangleOptions *options);
void gimp_new_rect_select_options_set_center_x (GimpRectangleOptions *options,
gdouble center_x);
gdouble gimp_new_rect_select_options_get_center_x (GimpRectangleOptions *options);
void gimp_new_rect_select_options_set_center_y (GimpRectangleOptions *options,
gdouble center_y);
gdouble gimp_new_rect_select_options_get_center_y (GimpRectangleOptions *options);
void gimp_new_rect_select_options_set_unit (GimpRectangleOptions *options,
GimpUnit unit);
GimpUnit gimp_new_rect_select_options_get_unit (GimpRectangleOptions *options);
static GimpSelectionOptionsClass *parent_class = NULL;
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_new_rect_select_options_set_property;
object_class->get_property = gimp_new_rect_select_options_get_property;
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_HIGHLIGHT,
"highlight",
N_("Highlight rectangle"),
TRUE,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FIXED_WIDTH,
"fixed-width", N_("Fixed width"),
FALSE, 0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_WIDTH,
"width", N_("Width"),
0.0, GIMP_MAX_IMAGE_SIZE, 1.0,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FIXED_HEIGHT,
"fixed-height", N_("Fixed height"),
FALSE, 0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_HEIGHT,
"height", N_("Height"),
0.0, GIMP_MAX_IMAGE_SIZE, 1.0,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FIXED_ASPECT,
"fixed-aspect", N_("Fixed aspect"),
FALSE, 0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_ASPECT,
"aspect", N_("Aspect"),
0.0, GIMP_MAX_IMAGE_SIZE, 1.0,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FIXED_CENTER,
"fixed-center", N_("Fixed center"),
FALSE, 0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CENTER_X,
"center-x", N_("Center X"),
0.0, GIMP_MAX_IMAGE_SIZE, 1.0,
0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CENTER_Y,
"center-y", N_("Center Y"),
0.0, GIMP_MAX_IMAGE_SIZE, 1.0,
0);
GIMP_CONFIG_INSTALL_PROP_UNIT (object_class, PROP_UNIT,
"unit", NULL,
TRUE, FALSE, GIMP_UNIT_PIXEL, 0);
}
static void
gimp_new_rect_select_options_rectangle_options_iface_init (GimpRectangleOptionsInterface *rectangle_iface)
{
rectangle_iface->set_highlight = gimp_new_rect_select_options_set_highlight;
rectangle_iface->get_highlight = gimp_new_rect_select_options_get_highlight;
rectangle_iface->set_fixed_width = gimp_new_rect_select_options_set_fixed_width;
rectangle_iface->get_fixed_width = gimp_new_rect_select_options_get_fixed_width;
rectangle_iface->set_width = gimp_new_rect_select_options_set_width;
rectangle_iface->get_width = gimp_new_rect_select_options_get_width;
rectangle_iface->set_fixed_height = gimp_new_rect_select_options_set_fixed_height;
rectangle_iface->get_fixed_height = gimp_new_rect_select_options_get_fixed_height;
rectangle_iface->set_height = gimp_new_rect_select_options_set_height;
rectangle_iface->get_height = gimp_new_rect_select_options_get_height;
rectangle_iface->set_fixed_aspect = gimp_new_rect_select_options_set_fixed_aspect;
rectangle_iface->get_fixed_aspect = gimp_new_rect_select_options_get_fixed_aspect;
rectangle_iface->set_aspect = gimp_new_rect_select_options_set_aspect;
rectangle_iface->get_aspect = gimp_new_rect_select_options_get_aspect;
rectangle_iface->set_fixed_center = gimp_new_rect_select_options_set_fixed_center;
rectangle_iface->get_fixed_center = gimp_new_rect_select_options_get_fixed_center;
rectangle_iface->set_center_x = gimp_new_rect_select_options_set_center_x;
rectangle_iface->get_center_x = gimp_new_rect_select_options_get_center_x;
rectangle_iface->set_center_y = gimp_new_rect_select_options_set_center_y;
rectangle_iface->get_center_y = gimp_new_rect_select_options_get_center_y;
rectangle_iface->set_unit = gimp_new_rect_select_options_set_unit;
rectangle_iface->get_unit = gimp_new_rect_select_options_get_unit;
}
static void
gimp_new_rect_select_options_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
GimpNewRectSelectOptions *options = GIMP_NEW_RECT_SELECT_OPTIONS (object);
GimpRectangleOptions *rectangle_options = GIMP_RECTANGLE_OPTIONS (options);
switch (property_id)
{
case PROP_HIGHLIGHT:
gimp_rectangle_options_set_highlight (rectangle_options, g_value_get_boolean (value));
break;
case PROP_FIXED_WIDTH:
gimp_rectangle_options_set_fixed_width (rectangle_options, g_value_get_boolean (value));
break;
case PROP_WIDTH:
gimp_rectangle_options_set_width (rectangle_options, g_value_get_double (value));
break;
case PROP_FIXED_HEIGHT:
gimp_rectangle_options_set_fixed_height (rectangle_options, g_value_get_boolean (value));
break;
case PROP_HEIGHT:
gimp_rectangle_options_set_height (rectangle_options, g_value_get_double (value));
break;
case PROP_FIXED_ASPECT:
gimp_rectangle_options_set_fixed_aspect (rectangle_options, g_value_get_boolean (value));
break;
case PROP_ASPECT:
gimp_rectangle_options_set_aspect (rectangle_options, g_value_get_double (value));
break;
case PROP_FIXED_CENTER:
gimp_rectangle_options_set_fixed_center (rectangle_options, g_value_get_boolean (value));
break;
case PROP_CENTER_X:
gimp_rectangle_options_set_center_x (rectangle_options, g_value_get_double (value));
break;
case PROP_CENTER_Y:
gimp_rectangle_options_set_center_y (rectangle_options, g_value_get_double (value));
break;
case PROP_UNIT:
gimp_rectangle_options_set_unit (rectangle_options, g_value_get_int (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
gimp_new_rect_select_options_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GimpNewRectSelectOptions *options = GIMP_NEW_RECT_SELECT_OPTIONS (object);
GimpRectangleOptions *rectangle_options = GIMP_RECTANGLE_OPTIONS (options);
switch (property_id)
{
case PROP_HIGHLIGHT:
g_value_set_boolean (value, gimp_rectangle_options_get_highlight (rectangle_options));
break;
case PROP_FIXED_WIDTH:
g_value_set_boolean (value, gimp_rectangle_options_get_fixed_width (rectangle_options));
break;
case PROP_WIDTH:
g_value_set_double (value, gimp_rectangle_options_get_width (rectangle_options));
break;
case PROP_FIXED_HEIGHT:
g_value_set_boolean (value, gimp_rectangle_options_get_fixed_height (rectangle_options));
break;
case PROP_HEIGHT:
g_value_set_double (value, gimp_rectangle_options_get_height (rectangle_options));
break;
case PROP_FIXED_ASPECT:
g_value_set_boolean (value, gimp_rectangle_options_get_fixed_aspect (rectangle_options));
break;
case PROP_ASPECT:
g_value_set_double (value, gimp_rectangle_options_get_aspect (rectangle_options));
break;
case PROP_FIXED_CENTER:
g_value_set_boolean (value, gimp_rectangle_options_get_fixed_center (rectangle_options));
break;
case PROP_CENTER_X:
g_value_set_double (value, gimp_rectangle_options_get_center_x (rectangle_options));
break;
case PROP_CENTER_Y:
g_value_set_double (value, gimp_rectangle_options_get_center_y (rectangle_options));
break;
case PROP_UNIT:
g_value_set_int (value, gimp_rectangle_options_get_unit (rectangle_options));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
void
gimp_new_rect_select_options_set_highlight (GimpRectangleOptions *options,
gboolean highlight)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
new_rect_select_options->highlight = highlight;
}
gboolean
gimp_new_rect_select_options_get_highlight (GimpRectangleOptions *options)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
return new_rect_select_options->highlight;
}
void
gimp_new_rect_select_options_set_fixed_width (GimpRectangleOptions *options,
gboolean fixed_width)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
new_rect_select_options->fixed_width = fixed_width;
}
gboolean
gimp_new_rect_select_options_get_fixed_width (GimpRectangleOptions *options)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
return new_rect_select_options->fixed_width;
}
void
gimp_new_rect_select_options_set_width (GimpRectangleOptions *options,
gdouble width)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
new_rect_select_options->width = width;
}
gdouble
gimp_new_rect_select_options_get_width (GimpRectangleOptions *options)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
return new_rect_select_options->width;
}
void
gimp_new_rect_select_options_set_fixed_height (GimpRectangleOptions *options,
gboolean fixed_height)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
new_rect_select_options->fixed_height = fixed_height;
}
gboolean
gimp_new_rect_select_options_get_fixed_height (GimpRectangleOptions *options)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
return new_rect_select_options->fixed_height;
}
void
gimp_new_rect_select_options_set_height (GimpRectangleOptions *options,
gdouble height)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
new_rect_select_options->height = height;
}
gdouble
gimp_new_rect_select_options_get_height (GimpRectangleOptions *options)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
return new_rect_select_options->height;
}
void
gimp_new_rect_select_options_set_fixed_aspect (GimpRectangleOptions *options,
gboolean fixed_aspect)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
new_rect_select_options->fixed_aspect = fixed_aspect;
}
gboolean
gimp_new_rect_select_options_get_fixed_aspect (GimpRectangleOptions *options)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
return new_rect_select_options->fixed_aspect;
}
void
gimp_new_rect_select_options_set_aspect (GimpRectangleOptions *options,
gdouble aspect)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
new_rect_select_options->aspect = aspect;
}
gdouble
gimp_new_rect_select_options_get_aspect (GimpRectangleOptions *options)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
return new_rect_select_options->aspect;
}
void
gimp_new_rect_select_options_set_fixed_center (GimpRectangleOptions *options,
gboolean fixed_center)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
new_rect_select_options->fixed_center = fixed_center;
}
gboolean
gimp_new_rect_select_options_get_fixed_center (GimpRectangleOptions *options)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
return new_rect_select_options->fixed_center;
}
void
gimp_new_rect_select_options_set_center_x (GimpRectangleOptions *options,
gdouble center_x)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
new_rect_select_options->center_x = center_x;
}
gdouble
gimp_new_rect_select_options_get_center_x (GimpRectangleOptions *options)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
return new_rect_select_options->center_x;
}
void
gimp_new_rect_select_options_set_center_y (GimpRectangleOptions *options,
gdouble center_y)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
new_rect_select_options->center_y = center_y;
}
gdouble
gimp_new_rect_select_options_get_center_y (GimpRectangleOptions *options)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
return new_rect_select_options->center_y;
}
void
gimp_new_rect_select_options_set_unit (GimpRectangleOptions *options,
GimpUnit unit)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
new_rect_select_options->unit = unit;
}
GimpUnit
gimp_new_rect_select_options_get_unit (GimpRectangleOptions *options)
{
GimpNewRectSelectOptions *new_rect_select_options = GIMP_NEW_RECT_SELECT_OPTIONS (options);
return new_rect_select_options->unit;
}
GtkWidget *
gimp_new_rect_select_options_gui (GimpToolOptions *tool_options)
{
//GObject *config = G_OBJECT (tool_options);
GtkWidget *vbox;
GtkWidget *vbox_rectangle;
//GtkWidget *frame;
//GtkWidget *button;
//gchar *str;
vbox = gimp_selection_options_gui (tool_options);
/* rectangle options */
vbox_rectangle = gimp_rectangle_options_gui (tool_options);
gtk_box_pack_start (GTK_BOX (vbox), vbox_rectangle, FALSE, FALSE, 0);
gtk_widget_show (vbox_rectangle);
return vbox;
}

View File

@ -0,0 +1,65 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_NEW_RECT_SELECT_OPTIONS_H__
#define __GIMP_NEW_RECT_SELECT_OPTIONS_H__
#include "gimpselectionoptions.h"
#define GIMP_TYPE_NEW_RECT_SELECT_OPTIONS (gimp_new_rect_select_options_get_type ())
#define GIMP_NEW_RECT_SELECT_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_NEW_RECT_SELECT_OPTIONS, GimpNewRectSelectOptions))
#define GIMP_NEW_RECT_SELECT_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_NEW_RECT_SELECT_OPTIONS, GimpNewRectSelectOptionsClass))
#define GIMP_IS_NEW_RECT_SELECT_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_NEW_RECT_SELECT_OPTIONS))
#define GIMP_IS_NEW_RECT_SELECT_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_NEW_RECT_SELECT_OPTIONS))
#define GIMP_NEW_RECT_SELECT_OPTIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_NEW_RECT_SELECT_OPTIONS, GimpNewRectSelectOptionsClass))
typedef struct _GimpNewRectSelectOptions GimpNewRectSelectOptions;
typedef struct _GimpToolOptionsClass GimpNewRectSelectOptionsClass;
struct _GimpNewRectSelectOptions
{
GimpSelectionOptions parent_instence;
gboolean highlight;
gboolean fixed_width;
gdouble width;
gboolean fixed_height;
gdouble height;
gboolean fixed_aspect;
gdouble aspect;
gboolean fixed_center;
gdouble center_x;
gdouble center_y;
GimpUnit unit;
};
GType gimp_new_rect_select_options_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_new_rect_select_options_gui (GimpToolOptions *tool_options);
#endif /* __GIMP_NEW_RECT_SELECT_OPTIONS_H__ */

View File

@ -47,6 +47,7 @@
#include "gimprectangletool.h"
#include "gimprectangleoptions.h"
#include "gimpnewrectselecttool.h"
#include "gimpnewrectselectoptions.h"
#include "gimptoolcontrol.h"
#include "gimp-intl.h"
@ -54,29 +55,104 @@
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_button_press (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp);
static void gimp_new_rect_select_tool_modifier_key (GimpTool *tool,
GdkModifierType key,
gboolean press,
GdkModifierType state,
GimpDisplay *gdisp);
static void gimp_new_rect_select_tool_cursor_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
GimpDisplay *gdisp);
static GObject * gimp_new_rect_select_tool_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
static void gimp_new_rect_select_tool_finalize (GObject *object);
static void gimp_new_rect_select_tool_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *gdisp);
static void gimp_new_rect_select_tool_oper_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
GimpDisplay *gdisp);
static gboolean gimp_new_rect_select_tool_execute (GimpRectangleTool *rect_tool,
gint x,
gint y,
gint w,
gint h);
static GimpDrawToolClass *parent_class = NULL;
void gimp_new_rect_select_tool_set_controls (GimpRectangleTool *tool,
GtkWidget *controls);
GtkWidget * gimp_new_rect_select_tool_get_controls (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_entry (GimpRectangleTool *tool,
GtkWidget *entry);
GtkWidget * gimp_new_rect_select_tool_get_entry (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_startx (GimpRectangleTool *tool,
gint startx);
gint gimp_new_rect_select_tool_get_startx (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_starty (GimpRectangleTool *tool,
gint starty);
gint gimp_new_rect_select_tool_get_starty (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_lastx (GimpRectangleTool *tool,
gint lastx);
gint gimp_new_rect_select_tool_get_lastx (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_lasty (GimpRectangleTool *tool,
gint lasty);
gint gimp_new_rect_select_tool_get_lasty (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_pressx (GimpRectangleTool *tool,
gint pressx);
gint gimp_new_rect_select_tool_get_pressx (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_pressy (GimpRectangleTool *tool,
gint pressy);
gint gimp_new_rect_select_tool_get_pressy (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_x1 (GimpRectangleTool *tool,
gint x1);
gint gimp_new_rect_select_tool_get_x1 (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_y1 (GimpRectangleTool *tool,
gint y1);
gint gimp_new_rect_select_tool_get_y1 (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_x2 (GimpRectangleTool *tool,
gint x2);
gint gimp_new_rect_select_tool_get_x2 (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_y2 (GimpRectangleTool *tool,
gint y2);
gint gimp_new_rect_select_tool_get_y2 (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_function (GimpRectangleTool *tool,
guint function);
guint gimp_new_rect_select_tool_get_function (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_dx1 (GimpRectangleTool *tool,
gint dx1);
gint gimp_new_rect_select_tool_get_dx1 (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_dy1 (GimpRectangleTool *tool,
gint dy1);
gint gimp_new_rect_select_tool_get_dy1 (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_dx2 (GimpRectangleTool *tool,
gint dx2);
gint gimp_new_rect_select_tool_get_dx2 (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_dy2 (GimpRectangleTool *tool,
gint dy2);
gint gimp_new_rect_select_tool_get_dy2 (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_dcw (GimpRectangleTool *tool,
gint dcw);
gint gimp_new_rect_select_tool_get_dcw (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_dch (GimpRectangleTool *tool,
gint dch);
gint gimp_new_rect_select_tool_get_dch (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_origx (GimpRectangleTool *tool,
gdouble origx);
gdouble gimp_new_rect_select_tool_get_origx (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_origy (GimpRectangleTool *tool,
gdouble origy);
gdouble gimp_new_rect_select_tool_get_origy (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_sizew (GimpRectangleTool *tool,
gdouble sizew);
gdouble gimp_new_rect_select_tool_get_sizew (GimpRectangleTool *tool);
void gimp_new_rect_select_tool_set_sizeh (GimpRectangleTool *tool,
gdouble sizeh);
gdouble gimp_new_rect_select_tool_get_sizeh (GimpRectangleTool *tool);
static GimpSelectionToolClass *parent_class = NULL;
/* public functions */
@ -86,8 +162,8 @@ gimp_new_rect_select_tool_register (GimpToolRegisterCallback callback,
gpointer data)
{
(* callback) (GIMP_TYPE_NEW_RECT_SELECT_TOOL,
GIMP_TYPE_RECTANGLE_OPTIONS,
gimp_rectangle_options_gui,
GIMP_TYPE_NEW_RECT_SELECT_OPTIONS,
gimp_new_rect_select_options_gui,
0,
"gimp-new-rect-select-tool",
_("New Rect Select"),
@ -117,10 +193,19 @@ gimp_new_rect_select_tool_get_type (void)
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_RECTANGLE_TOOL,
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;
@ -129,66 +214,129 @@ gimp_new_rect_select_tool_get_type (void)
static void
gimp_new_rect_select_tool_class_init (GimpNewRectSelectToolClass *klass)
{
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
GimpRectangleToolClass *rect_class = GIMP_RECTANGLE_TOOL_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (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_new_rect_select_tool_button_press;
tool_class->modifier_key = gimp_new_rect_select_tool_modifier_key;
tool_class->cursor_update = gimp_new_rect_select_tool_cursor_update;
object_class->constructor = gimp_new_rect_select_tool_constructor;
object_class->finalize = gimp_new_rect_select_tool_finalize;
rect_class->execute = gimp_new_rect_select_tool_execute;
tool_class->initialize = gimp_rectangle_tool_initialize;
tool_class->control = gimp_new_rect_select_tool_control;
tool_class->button_press = gimp_rectangle_tool_button_press;
tool_class->button_release = gimp_rectangle_tool_button_release;
tool_class->motion = gimp_rectangle_tool_motion;
tool_class->key_press = gimp_rectangle_tool_key_press;
tool_class->modifier_key = gimp_rectangle_tool_modifier_key;
tool_class->oper_update = gimp_new_rect_select_tool_oper_update;
tool_class->cursor_update = gimp_rectangle_tool_cursor_update;
draw_tool_class->draw = gimp_rectangle_tool_draw;
}
static void
gimp_new_rect_select_tool_init (GimpNewRectSelectTool *new_rect_select_tool)
{
GimpTool *tool = GIMP_TOOL (new_rect_select_tool);
GimpRectangleTool *rectangle = GIMP_RECTANGLE_TOOL (new_rect_select_tool);
gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_RECT_SELECT);
rectangle->selection_tool = TRUE;
}
static void
gimp_new_rect_select_tool_button_press (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp)
gimp_new_rect_select_tool_rectangle_tool_iface_init (GimpRectangleToolInterface *rectangle_iface)
{
GimpSelectionTool *sel_tool = GIMP_SELECTION_TOOL (tool);
rectangle_iface->set_controls = gimp_new_rect_select_tool_set_controls;
rectangle_iface->get_controls = gimp_new_rect_select_tool_get_controls;
rectangle_iface->set_entry = gimp_new_rect_select_tool_set_entry;
rectangle_iface->get_entry = gimp_new_rect_select_tool_get_entry;
rectangle_iface->set_startx = gimp_new_rect_select_tool_set_startx;
rectangle_iface->get_startx = gimp_new_rect_select_tool_get_startx;
rectangle_iface->set_starty = gimp_new_rect_select_tool_set_starty;
rectangle_iface->get_starty = gimp_new_rect_select_tool_get_starty;
rectangle_iface->set_lastx = gimp_new_rect_select_tool_set_lastx;
rectangle_iface->get_lastx = gimp_new_rect_select_tool_get_lastx;
rectangle_iface->set_lasty = gimp_new_rect_select_tool_set_lasty;
rectangle_iface->get_lasty = gimp_new_rect_select_tool_get_lasty;
rectangle_iface->set_pressx = gimp_new_rect_select_tool_set_pressx;
rectangle_iface->get_pressx = gimp_new_rect_select_tool_get_pressx;
rectangle_iface->set_pressy = gimp_new_rect_select_tool_set_pressy;
rectangle_iface->get_pressy = gimp_new_rect_select_tool_get_pressy;
rectangle_iface->set_x1 = gimp_new_rect_select_tool_set_x1;
rectangle_iface->get_x1 = gimp_new_rect_select_tool_get_x1;
rectangle_iface->set_y1 = gimp_new_rect_select_tool_set_y1;
rectangle_iface->get_y1 = gimp_new_rect_select_tool_get_y1;
rectangle_iface->set_x2 = gimp_new_rect_select_tool_set_x2;
rectangle_iface->get_x2 = gimp_new_rect_select_tool_get_x2;
rectangle_iface->set_y2 = gimp_new_rect_select_tool_set_y2;
rectangle_iface->get_y2 = gimp_new_rect_select_tool_get_y2;
rectangle_iface->set_function = gimp_new_rect_select_tool_set_function;
rectangle_iface->get_function = gimp_new_rect_select_tool_get_function;
rectangle_iface->set_dx1 = gimp_new_rect_select_tool_set_dx1;
rectangle_iface->get_dx1 = gimp_new_rect_select_tool_get_dx1;
rectangle_iface->set_dy1 = gimp_new_rect_select_tool_set_dy1;
rectangle_iface->get_dy1 = gimp_new_rect_select_tool_get_dy1;
rectangle_iface->set_dx2 = gimp_new_rect_select_tool_set_dx2;
rectangle_iface->get_dx2 = gimp_new_rect_select_tool_get_dx2;
rectangle_iface->set_dy2 = gimp_new_rect_select_tool_set_dy2;
rectangle_iface->get_dy2 = gimp_new_rect_select_tool_get_dy2;
rectangle_iface->set_dcw = gimp_new_rect_select_tool_set_dcw;
rectangle_iface->get_dcw = gimp_new_rect_select_tool_get_dcw;
rectangle_iface->set_dch = gimp_new_rect_select_tool_set_dch;
rectangle_iface->get_dch = gimp_new_rect_select_tool_get_dch;
rectangle_iface->set_origx = gimp_new_rect_select_tool_set_origx;
rectangle_iface->get_origx = gimp_new_rect_select_tool_get_origx;
rectangle_iface->set_origy = gimp_new_rect_select_tool_set_origy;
rectangle_iface->get_origy = gimp_new_rect_select_tool_get_origy;
rectangle_iface->set_sizew = gimp_new_rect_select_tool_set_sizew;
rectangle_iface->get_sizew = gimp_new_rect_select_tool_get_sizew;
rectangle_iface->set_sizeh = gimp_new_rect_select_tool_set_sizeh;
rectangle_iface->get_sizeh = gimp_new_rect_select_tool_get_sizeh;
rectangle_iface->execute = gimp_new_rect_select_tool_execute;
}
GIMP_TOOL_CLASS (parent_class)->button_press (tool, coords,
time, state, gdisp);
static GObject *
gimp_new_rect_select_tool_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
{
GObject *object;
if (gimp_selection_tool_start_edit (sel_tool, coords))
{
gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool));
return;
}
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
gimp_rectangle_tool_constructor (object);
return object;
}
static void
gimp_new_rect_select_tool_modifier_key (GimpTool *tool,
GdkModifierType key,
gboolean press,
GdkModifierType state,
GimpDisplay *gdisp)
gimp_new_rect_select_tool_finalize (GObject *object)
{
gimp_rectangle_tool_finalize (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gimp_new_rect_select_tool_cursor_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
GimpDisplay *gdisp)
gimp_new_rect_select_tool_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *gdisp)
{
gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_RECT_SELECT);
gimp_rectangle_tool_control (tool, action, gdisp);
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, gdisp);
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
}
static void
gimp_new_rect_select_tool_oper_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
GimpDisplay *gdisp)
{
gimp_rectangle_tool_oper_update (tool, coords, state, gdisp);
GIMP_TOOL_CLASS (parent_class)->oper_update (tool, coords, state, gdisp);
}
/*
@ -219,6 +367,8 @@ gimp_new_rect_select_tool_execute (GimpRectangleTool *rectangle,
gboolean selected;
gint val;
GimpChannel *selection_mask;
gint x1, y1;
gint x2, y2;
options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options);
@ -250,7 +400,7 @@ gimp_new_rect_select_tool_execute (GimpRectangleTool *rectangle,
val = gimp_pickable_get_opacity_at (GIMP_PICKABLE (selection_mask),
rectangle->pressx, rectangle->pressy);
gimp_rectangle_tool_get_pressx (rectangle), gimp_rectangle_tool_get_pressy (rectangle));
selected = (val > 127);
@ -259,13 +409,20 @@ gimp_new_rect_select_tool_execute (GimpRectangleTool *rectangle,
if (selected)
{
if (! gimp_channel_bounds (selection_mask,
&rectangle->x1, &rectangle->y1,
&rectangle->x2, &rectangle->y2))
&x1, &y1,
&x2, &y2))
{
rectangle->x1 = 0;
rectangle->y1 = 0;
rectangle->x2 = gimage->width;
rectangle->y2 = gimage->height;
gimp_rectangle_tool_set_x1 (rectangle, x1);
gimp_rectangle_tool_set_y1 (rectangle, y1);
gimp_rectangle_tool_set_x2 (rectangle, x2);
gimp_rectangle_tool_set_y2 (rectangle, y2);
}
else
{
gimp_rectangle_tool_set_x1 (rectangle, 0);
gimp_rectangle_tool_set_y1 (rectangle, 0);
gimp_rectangle_tool_set_x2 (rectangle, gimage->width);
gimp_rectangle_tool_set_y2 (rectangle, gimage->height);
}
return FALSE;
@ -277,3 +434,348 @@ gimp_new_rect_select_tool_execute (GimpRectangleTool *rectangle,
return TRUE;
}
void
gimp_new_rect_select_tool_set_controls (GimpRectangleTool *tool,
GtkWidget *controls)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->controls = controls;
}
GtkWidget *
gimp_new_rect_select_tool_get_controls (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->controls;
}
void
gimp_new_rect_select_tool_set_entry (GimpRectangleTool *tool,
GtkWidget *entry)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->dimensions_entry = entry;
}
GtkWidget *
gimp_new_rect_select_tool_get_entry (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->dimensions_entry;
}
void
gimp_new_rect_select_tool_set_startx (GimpRectangleTool *tool,
gint startx)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->startx = startx;
}
gint
gimp_new_rect_select_tool_get_startx (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->startx;
}
void
gimp_new_rect_select_tool_set_starty (GimpRectangleTool *tool,
gint starty)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->starty = starty;
}
gint
gimp_new_rect_select_tool_get_starty (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->starty;
}
void
gimp_new_rect_select_tool_set_lastx (GimpRectangleTool *tool,
gint lastx)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->lastx = lastx;
}
gint
gimp_new_rect_select_tool_get_lastx (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->lastx;
}
void
gimp_new_rect_select_tool_set_lasty (GimpRectangleTool *tool,
gint lasty)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->lasty = lasty;
}
gint
gimp_new_rect_select_tool_get_lasty (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->lasty;
}
void
gimp_new_rect_select_tool_set_pressx (GimpRectangleTool *tool,
gint pressx)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->pressx = pressx;
}
gint
gimp_new_rect_select_tool_get_pressx (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->pressx;
}
void
gimp_new_rect_select_tool_set_pressy (GimpRectangleTool *tool,
gint pressy)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->pressy = pressy;
}
gint
gimp_new_rect_select_tool_get_pressy (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->pressy;
}
void
gimp_new_rect_select_tool_set_x1 (GimpRectangleTool *tool,
gint x1)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->x1 = x1;
}
gint
gimp_new_rect_select_tool_get_x1 (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->x1;
}
void
gimp_new_rect_select_tool_set_y1 (GimpRectangleTool *tool,
gint y1)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->y1 = y1;
}
gint
gimp_new_rect_select_tool_get_y1 (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->y1;
}
void
gimp_new_rect_select_tool_set_x2 (GimpRectangleTool *tool,
gint x2)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->x2 = x2;
}
gint
gimp_new_rect_select_tool_get_x2 (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->x2;
}
void
gimp_new_rect_select_tool_set_y2 (GimpRectangleTool *tool,
gint y2)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->y2 = y2;
}
gint
gimp_new_rect_select_tool_get_y2 (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->y2;
}
void
gimp_new_rect_select_tool_set_function (GimpRectangleTool *tool,
guint function)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->function = function;
}
guint
gimp_new_rect_select_tool_get_function (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->function;
}
void
gimp_new_rect_select_tool_set_dx1 (GimpRectangleTool *tool,
gint dx1)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->dx1 = dx1;
}
gint
gimp_new_rect_select_tool_get_dx1 (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->dx1;
}
void
gimp_new_rect_select_tool_set_dy1 (GimpRectangleTool *tool,
gint dy1)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->dy1 = dy1;
}
gint
gimp_new_rect_select_tool_get_dy1 (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->dy1;
}
void
gimp_new_rect_select_tool_set_dx2 (GimpRectangleTool *tool,
gint dx2)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->dx2 = dx2;
}
gint
gimp_new_rect_select_tool_get_dx2 (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->dx2;
}
void
gimp_new_rect_select_tool_set_dy2 (GimpRectangleTool *tool,
gint dy2)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->dy2 = dy2;
}
gint
gimp_new_rect_select_tool_get_dy2 (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->dy2;
}
void
gimp_new_rect_select_tool_set_dcw (GimpRectangleTool *tool,
gint dcw)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->dcw = dcw;
}
gint
gimp_new_rect_select_tool_get_dcw (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->dcw;
}
void
gimp_new_rect_select_tool_set_dch (GimpRectangleTool *tool,
gint dch)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->dch = dch;
}
gint
gimp_new_rect_select_tool_get_dch (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->dch;
}
void
gimp_new_rect_select_tool_set_origx (GimpRectangleTool *tool,
gdouble origx)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->origx = origx;
}
gdouble
gimp_new_rect_select_tool_get_origx (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->origx;
}
void
gimp_new_rect_select_tool_set_origy (GimpRectangleTool *tool,
gdouble origy)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->origy = origy;
}
gdouble
gimp_new_rect_select_tool_get_origy (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->origy;
}
void
gimp_new_rect_select_tool_set_sizew (GimpRectangleTool *tool,
gdouble sizew)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->sizew = sizew;
}
gdouble
gimp_new_rect_select_tool_get_sizew (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->sizew;
}
void
gimp_new_rect_select_tool_set_sizeh (GimpRectangleTool *tool,
gdouble sizeh)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
new_rect_select_tool->sizeh = sizeh;
}
gdouble
gimp_new_rect_select_tool_get_sizeh (GimpRectangleTool *tool)
{
GimpNewRectSelectTool *new_rect_select_tool = GIMP_NEW_RECT_SELECT_TOOL (tool);
return new_rect_select_tool->sizeh;
}

View File

@ -19,14 +19,14 @@
#ifndef __GIMP_NEW_RECT_SELECT_TOOL_H__
#define __GIMP_NEW_RECT_SELECT_TOOL_H__
#include "gimprectangletool.h"
#include "gimpselectiontool.h"
#define GIMP_TYPE_NEW_RECT_SELECT_TOOL (gimp_new_rect_select_tool_get_type ())
#define GIMP_NEW_RECT_SELECT_TOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_NEW_RECT_SELECT_TOOL, GimpNewRectSelectTool))
#define GIMP_NEW_RECT_SELECT_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_NEW_RECT_SELECT_TOOL, GimpNewRectSelectToolClass))
#define GIMP_IS_NEW_RECT_SELECT_TOOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_NEW_RECT_SELECT_TOOL))
#define GIMP_NEW_RECT_SELECT_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_NEW_RECT_SELECT_TOOL, GimpNewRectSelectToolClass))
#define GIMP_IS_NEW_RECT_SELECT_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_NEW_RECT_SELECT_TOOL))
#define GIMP_NEW_RECT_SELECT_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_NEW_RECT_SELECT_TOOL, GimpNewRectSelectToolClass))
@ -35,17 +35,42 @@ typedef struct _GimpNewRectSelectToolClass GimpNewRectSelectToolClass;
struct _GimpNewRectSelectTool
{
GimpRectangleTool parent_instance;
GimpSelectionTool parent_instance;
GtkWidget *controls;
GtkWidget *dimensions_entry;
gint startx; /* starting x coord */
gint starty; /* starting y coord */
gint lastx; /* previous x coord */
gint lasty; /* previous y coord */
gint pressx; /* x where button pressed */
gint pressy; /* y where button pressed */
gint x1, y1; /* upper left hand coordinate */
gint x2, y2; /* lower right hand coords */
guint function; /* moving or resizing */
gint dx1, dy1; /* display coords */
gint dx2, dy2; /* */
gint dcw, dch; /* width and height of edges */
gdouble origx, origy;
gdouble sizew, sizeh;
};
struct _GimpNewRectSelectToolClass
{
GimpRectangleToolClass parent_class;
GimpSelectionToolClass parent_class;
};
void gimp_new_rect_select_tool_register (GimpToolRegisterCallback callback,
gpointer data);
gpointer data);
GType gimp_new_rect_select_tool_get_type (void) G_GNUC_CONST;

File diff suppressed because it is too large Load Diff

View File

@ -19,16 +19,12 @@
#ifndef __GIMP_RECTANGLE_TOOL_H__
#define __GIMP_RECTANGLE_TOOL_H__
#include "gimptool.h"
#include "gimpselectiontool.h"
#define GIMP_TYPE_RECTANGLE_TOOL (gimp_rectangle_tool_get_type ())
#define GIMP_RECTANGLE_TOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_RECTANGLE_TOOL, GimpRectangleTool))
#define GIMP_RECTANGLE_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_RECTANGLE_TOOL, GimpRectangleToolClass))
#define GIMP_IS_RECTANGLE_TOOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_RECTANGLE_TOOL))
#define GIMP_RECTANGLE_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_RECTANGLE_TOOL, GimpRectangleToolClass))
#define GIMP_RECTANGLE_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_RECTANGLE_TOOL, GimpRectangleToolClass))
#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))
/* possible functions */
@ -48,58 +44,231 @@ enum
};
typedef struct _GimpRectangleTool GimpRectangleTool;
typedef struct _GimpRectangleToolClass GimpRectangleToolClass;
typedef struct _GimpRectangleTool GimpRectangleTool;
typedef struct _GimpRectangleToolInterface GimpRectangleToolInterface;
struct _GimpRectangleTool
struct _GimpRectangleToolInterface
{
GimpSelectionTool parent_instance;
GTypeInterface base_iface;
GtkWidget *controls;
GtkWidget *dimensions_entry;
/* virtual functions */
void (* set_controls) (GimpRectangleTool *tool,
GtkWidget *controls);
GtkWidget * (* get_controls) (GimpRectangleTool *tool);
void (* set_entry) (GimpRectangleTool *tool,
GtkWidget *entry);
GtkWidget * (* get_entry) (GimpRectangleTool *tool);
gboolean selection_tool; /* is this a selection tool? */
/* starting coordinates */
void (* set_startx) (GimpRectangleTool *tool,
gint startx);
gint (* get_startx) (GimpRectangleTool *tool);
void (* set_starty) (GimpRectangleTool *tool,
gint starty);
gint (* get_starty) (GimpRectangleTool *tool);
/* previous coordinates */
void (* set_lastx) (GimpRectangleTool *tool,
gint lastx);
gint (* get_lastx) (GimpRectangleTool *tool);
void (* set_lasty) (GimpRectangleTool *tool,
gint lasty);
gint (* get_lasty) (GimpRectangleTool *tool);
/* button pressed coordinates */
void (* set_pressx) (GimpRectangleTool *tool,
gint pressx);
gint (* get_pressx) (GimpRectangleTool *tool);
void (* set_pressy) (GimpRectangleTool *tool,
gint pressy);
gint (* get_pressy) (GimpRectangleTool *tool);
/* upper left hand coordinates */
void (* set_x1) (GimpRectangleTool *tool,
gint x1);
gint (* get_x1) (GimpRectangleTool *tool);
void (* set_y1) (GimpRectangleTool *tool,
gint y1);
gint (* get_y1) (GimpRectangleTool *tool);
/* lower right hand coordinates */
void (* set_x2) (GimpRectangleTool *tool,
gint x2);
gint (* get_x2) (GimpRectangleTool *tool);
void (* set_y2) (GimpRectangleTool *tool,
gint y2);
gint (* get_y2) (GimpRectangleTool *tool);
gint startx; /* starting x coord */
gint starty; /* starting y coord */
void (* set_function) (GimpRectangleTool *tool,
guint function);
guint (* get_function) (GimpRectangleTool *tool);
/* display coords */
void (* set_dx1) (GimpRectangleTool *tool,
gint dx1);
gint (* get_dx1) (GimpRectangleTool *tool);
void (* set_dy1) (GimpRectangleTool *tool,
gint dy1);
gint (* get_dy1) (GimpRectangleTool *tool);
void (* set_dx2) (GimpRectangleTool *tool,
gint dx2);
gint (* get_dx2) (GimpRectangleTool *tool);
void (* set_dy2) (GimpRectangleTool *tool,
gint dy2);
gint (* get_dy2) (GimpRectangleTool *tool);
gint lastx; /* previous x coord */
gint lasty; /* previous y coord */
/* width and height of edges */
void (* set_dcw) (GimpRectangleTool *tool,
gint dcw);
gint (* get_dcw) (GimpRectangleTool *tool);
void (* set_dch) (GimpRectangleTool *tool,
gint dch);
gint (* get_dch) (GimpRectangleTool *tool);
gint pressx; /* x where button pressed */
gint pressy; /* y where button pressed */
void (* set_origx) (GimpRectangleTool *tool,
gdouble origx);
gdouble (* get_origx) (GimpRectangleTool *tool);
void (* set_origy) (GimpRectangleTool *tool,
gdouble origy);
gdouble (* get_origy) (GimpRectangleTool *tool);
void (* set_sizew) (GimpRectangleTool *tool,
gdouble sizew);
gdouble (* get_sizew) (GimpRectangleTool *tool);
void (* set_sizeh) (GimpRectangleTool *tool,
gdouble sizeh);
gdouble (* get_sizeh) (GimpRectangleTool *tool);
gint x1, y1; /* upper left hand coordinate */
gint x2, y2; /* lower right hand coords */
guint function;
gint dx1, dy1; /* display coords */
gint dx2, dy2; /* */
gint dcw, dch; /* width and height of edges */
gdouble orig_vals[2];
gdouble size_vals[2];
};
struct _GimpRectangleToolClass
{
GimpSelectionToolClass parent_class;
/* virtual function */
gboolean (* execute) (GimpRectangleTool *rect_tool,
gint x,
gint y,
gint w,
gint h);
gboolean (* execute) (GimpRectangleTool *rect_tool,
gint x,
gint y,
gint w,
gint h);
};
GType gimp_rectangle_tool_get_type (void) G_GNUC_CONST;
GType gimp_rectangle_tool_interface_get_type (void) G_GNUC_CONST;
void gimp_rectangle_tool_width_changed (GimpRectangleTool *rectangle,
gint new_width);
void gimp_rectangle_tool_set_controls (GimpRectangleTool *tool,
GtkWidget *controls);
GtkWidget * gimp_rectangle_tool_get_controls (GimpRectangleTool *tool);
void gimp_rectangle_tool_set_entry (GimpRectangleTool *tool,
GtkWidget *entry);
GtkWidget * gimp_rectangle_tool_get_entry (GimpRectangleTool *tool);
void gimp_rectangle_tool_set_startx (GimpRectangleTool *tool,
gint startx);
gint gimp_rectangle_tool_get_startx (GimpRectangleTool *tool);
void gimp_rectangle_tool_set_starty (GimpRectangleTool *tool,
gint starty);
gint gimp_rectangle_tool_get_starty (GimpRectangleTool *tool);
void gimp_rectangle_tool_set_lastx (GimpRectangleTool *tool,
gint lastx);
gint gimp_rectangle_tool_get_lastx (GimpRectangleTool *tool);
void gimp_rectangle_tool_set_lasty (GimpRectangleTool *tool,
gint lasty);
gint gimp_rectangle_tool_get_lasty (GimpRectangleTool *tool);
void gimp_rectangle_tool_set_pressx (GimpRectangleTool *tool,
gint pressx);
gint gimp_rectangle_tool_get_pressx (GimpRectangleTool *tool);
void gimp_rectangle_tool_set_pressy (GimpRectangleTool *tool,
gint pressy);
gint gimp_rectangle_tool_get_pressy (GimpRectangleTool *tool);
void gimp_rectangle_tool_set_x1 (GimpRectangleTool *tool,
gint x1);
gint gimp_rectangle_tool_get_x1 (GimpRectangleTool *tool);
void gimp_rectangle_tool_set_y1 (GimpRectangleTool *tool,
gint y1);
gint gimp_rectangle_tool_get_y1 (GimpRectangleTool *tool);
void gimp_rectangle_tool_set_x2 (GimpRectangleTool *tool,
gint x2);
gint gimp_rectangle_tool_get_x2 (GimpRectangleTool *tool);
void gimp_rectangle_tool_set_y2 (GimpRectangleTool *tool,
gint y2);
gint gimp_rectangle_tool_get_y2 (GimpRectangleTool *tool);
void gimp_rectangle_tool_set_function (GimpRectangleTool *tool,
guint function);
guint gimp_rectangle_tool_get_function (GimpRectangleTool *tool);
void gimp_rectangle_tool_set_dx1 (GimpRectangleTool *tool,
gint dx1);
gint gimp_rectangle_tool_get_dx1 (GimpRectangleTool *tool);
void gimp_rectangle_tool_set_dy1 (GimpRectangleTool *tool,
gint dy1);
gint gimp_rectangle_tool_get_dy1 (GimpRectangleTool *tool);
void gimp_rectangle_tool_set_dx2 (GimpRectangleTool *tool,
gint dx2);
gint gimp_rectangle_tool_get_dx2 (GimpRectangleTool *tool);
void gimp_rectangle_tool_set_dy2 (GimpRectangleTool *tool,
gint dy2);
gint gimp_rectangle_tool_get_dy2 (GimpRectangleTool *tool);
void gimp_rectangle_tool_set_dcw (GimpRectangleTool *tool,
gint dcw);
gint gimp_rectangle_tool_get_dcw (GimpRectangleTool *tool);
void gimp_rectangle_tool_set_dch (GimpRectangleTool *tool,
gint dch);
gint gimp_rectangle_tool_get_dch (GimpRectangleTool *tool);
void gimp_rectangle_tool_set_origx (GimpRectangleTool *tool,
gdouble origx);
gdouble gimp_rectangle_tool_get_origx (GimpRectangleTool *tool);
void gimp_rectangle_tool_set_origy (GimpRectangleTool *tool,
gdouble origy);
gdouble gimp_rectangle_tool_get_origy (GimpRectangleTool *tool);
void gimp_rectangle_tool_set_sizew (GimpRectangleTool *tool,
gdouble sizew);
gdouble gimp_rectangle_tool_get_sizew (GimpRectangleTool *tool);
void gimp_rectangle_tool_set_sizeh (GimpRectangleTool *tool,
gdouble sizeh);
gdouble gimp_rectangle_tool_get_sizeh (GimpRectangleTool *tool);
void gimp_rectangle_tool_constructor (GObject *object);
void gimp_rectangle_tool_finalize (GObject *object);
gboolean gimp_rectangle_tool_initialize (GimpTool *tool,
GimpDisplay *gdisp);
void gimp_rectangle_tool_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *gdisp);
void gimp_rectangle_tool_button_press (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp);
void gimp_rectangle_tool_button_release (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp);
void gimp_rectangle_tool_motion (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp);
gboolean gimp_rectangle_tool_key_press (GimpTool *tool,
GdkEventKey *kevent,
GimpDisplay *gdisp);
void gimp_rectangle_tool_modifier_key (GimpTool *tool,
GdkModifierType key,
gboolean press,
GdkModifierType state,
GimpDisplay *gdisp);
void gimp_rectangle_tool_oper_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
GimpDisplay *gdisp);
void gimp_rectangle_tool_cursor_update (GimpTool *tool,
GimpCoords *coords,
GdkModifierType state,
GimpDisplay *gdisp);
void gimp_rectangle_tool_draw (GimpDrawTool *draw);
gboolean gimp_rectangle_tool_execute (GimpRectangleTool *rect_tool,
gint x,
gint y,
gint w,
gint h);
#endif /* __GIMP_RECTANGLE_TOOL_H__ */