GimpRectangleTool

GimpRectangleTool

Synopsis

                    GimpRectangleTool;
struct              GimpRectangleToolInterface;
enum                GimpRectangleToolProp;
enum                GimpRectangleFunction;
#define             GIMP_RECTANGLE_TOOL_GET_OPTIONS     (t)
void                gimp_rectangle_tool_constructor     (GObject *object);
void                gimp_rectangle_tool_init            (GimpRectangleTool *rect_tool);
void                gimp_rectangle_tool_control         (GimpTool *tool,
                                                         GimpToolAction action,
                                                         GimpDisplay *display);
void                gimp_rectangle_tool_button_press    (GimpTool *tool,
                                                         const GimpCoords *coords,
                                                         guint32 time,
                                                         GdkModifierType state,
                                                         GimpDisplay *display);
void                gimp_rectangle_tool_button_release  (GimpTool *tool,
                                                         const GimpCoords *coords,
                                                         guint32 time,
                                                         GdkModifierType state,
                                                         GimpButtonReleaseType release_type,
                                                         GimpDisplay *display);
void                gimp_rectangle_tool_motion          (GimpTool *tool,
                                                         const GimpCoords *coords,
                                                         guint32 time,
                                                         GdkModifierType state,
                                                         GimpDisplay *display);
gboolean            gimp_rectangle_tool_key_press       (GimpTool *tool,
                                                         GdkEventKey *kevent,
                                                         GimpDisplay *display);
void                gimp_rectangle_tool_active_modifier_key
                                                        (GimpTool *tool,
                                                         GdkModifierType key,
                                                         gboolean press,
                                                         GdkModifierType state,
                                                         GimpDisplay *display);
void                gimp_rectangle_tool_oper_update     (GimpTool *tool,
                                                         const GimpCoords *coords,
                                                         GdkModifierType state,
                                                         gboolean proximity,
                                                         GimpDisplay *display);
void                gimp_rectangle_tool_cursor_update   (GimpTool *tool,
                                                         const GimpCoords *coords,
                                                         GdkModifierType state,
                                                         GimpDisplay *display);
void                gimp_rectangle_tool_draw            (GimpDrawTool *draw,
                                                         GimpCanvasGroup *stroke_group);
gboolean            gimp_rectangle_tool_execute         (GimpRectangleTool *rect_tool);
void                gimp_rectangle_tool_cancel          (GimpRectangleTool *rect_tool);
void                gimp_rectangle_tool_set_constraint  (GimpRectangleTool *rectangle,
                                                         GimpRectangleConstraint constraint);
GimpRectangleConstraint gimp_rectangle_tool_get_constraint
                                                        (GimpRectangleTool *rectangle);
GimpRectangleFunction gimp_rectangle_tool_get_function  (GimpRectangleTool *rectangle);
void                gimp_rectangle_tool_set_function    (GimpRectangleTool *rectangle,
                                                         GimpRectangleFunction function);
void                gimp_rectangle_tool_constraint_size_set
                                                        (GimpRectangleTool *rectangle,
                                                         GObject *object,
                                                         const gchar *width_property,
                                                         const gchar *height_property);
void                gimp_rectangle_tool_pending_size_set
                                                        (GimpRectangleTool *rectangle,
                                                         GObject *object,
                                                         const gchar *width_property,
                                                         const gchar *height_property);
gboolean            gimp_rectangle_tool_rectangle_is_new
                                                        (GimpRectangleTool *rect_tool);
gboolean            gimp_rectangle_tool_point_in_rectangle
                                                        (GimpRectangleTool *rect_tool,
                                                         gdouble x,
                                                         gdouble y);
void                gimp_rectangle_tool_frame_item      (GimpRectangleTool *rect_tool,
                                                         GimpItem *item);
void                gimp_rectangle_tool_install_properties
                                                        (GObjectClass *klass);
void                gimp_rectangle_tool_set_property    (GObject *object,
                                                         guint property_id,
                                                         const GValue *value,
                                                         GParamSpec *pspec);
void                gimp_rectangle_tool_get_property    (GObject *object,
                                                         guint property_id,
                                                         GValue *value,
                                                         GParamSpec *pspec);

Object Hierarchy

  GInterface
   +----GimpRectangleToolInterface

Prerequisites

GimpRectangleToolInterface requires GimpDrawTool.

Known Implementations

GimpRectangleToolInterface is implemented by GimpCropTool, GimpEllipseSelectTool, GimpRectangleSelectTool and GimpTextTool.

Properties

  "constraint"               GimpRectangleConstraint  : Read / Write
  "narrow-mode"              gboolean              : Read / Write
  "precision"                GimpRectanglePrecision  : Read / Write
  "x1"                       gint                  : Read / Write
  "x2"                       gint                  : Read / Write
  "y1"                       gint                  : Read / Write
  "y2"                       gint                  : Read / Write

Signals

  "rectangle-change-complete"                      : Run First

Description

Details

GimpRectangleTool

typedef struct _GimpRectangleTool GimpRectangleTool;


struct GimpRectangleToolInterface

struct GimpRectangleToolInterface;


enum GimpRectangleToolProp

typedef enum {
  GIMP_RECTANGLE_TOOL_PROP_0,
  GIMP_RECTANGLE_TOOL_PROP_X1,
  GIMP_RECTANGLE_TOOL_PROP_Y1,
  GIMP_RECTANGLE_TOOL_PROP_X2,
  GIMP_RECTANGLE_TOOL_PROP_Y2,
  GIMP_RECTANGLE_TOOL_PROP_CONSTRAINT,
  GIMP_RECTANGLE_TOOL_PROP_PRECISION,
  GIMP_RECTANGLE_TOOL_PROP_NARROW_MODE,
  GIMP_RECTANGLE_TOOL_PROP_LAST = GIMP_RECTANGLE_TOOL_PROP_NARROW_MODE
} GimpRectangleToolProp;

GIMP_RECTANGLE_TOOL_PROP_0

GIMP_RECTANGLE_TOOL_PROP_X1

GIMP_RECTANGLE_TOOL_PROP_Y1

GIMP_RECTANGLE_TOOL_PROP_X2

GIMP_RECTANGLE_TOOL_PROP_Y2

GIMP_RECTANGLE_TOOL_PROP_CONSTRAINT

GIMP_RECTANGLE_TOOL_PROP_PRECISION

GIMP_RECTANGLE_TOOL_PROP_NARROW_MODE

GIMP_RECTANGLE_TOOL_PROP_LAST


enum GimpRectangleFunction

typedef enum {
  GIMP_RECTANGLE_TOOL_INACTIVE,
  GIMP_RECTANGLE_TOOL_DEAD,
  GIMP_RECTANGLE_TOOL_CREATING,
  GIMP_RECTANGLE_TOOL_MOVING,
  GIMP_RECTANGLE_TOOL_RESIZING_UPPER_LEFT,
  GIMP_RECTANGLE_TOOL_RESIZING_UPPER_RIGHT,
  GIMP_RECTANGLE_TOOL_RESIZING_LOWER_LEFT,
  GIMP_RECTANGLE_TOOL_RESIZING_LOWER_RIGHT,
  GIMP_RECTANGLE_TOOL_RESIZING_LEFT,
  GIMP_RECTANGLE_TOOL_RESIZING_RIGHT,
  GIMP_RECTANGLE_TOOL_RESIZING_TOP,
  GIMP_RECTANGLE_TOOL_RESIZING_BOTTOM,
  GIMP_RECTANGLE_TOOL_AUTO_SHRINK,
  GIMP_RECTANGLE_TOOL_EXECUTING
} GimpRectangleFunction;

GIMP_RECTANGLE_TOOL_INACTIVE

GIMP_RECTANGLE_TOOL_DEAD

GIMP_RECTANGLE_TOOL_CREATING

GIMP_RECTANGLE_TOOL_MOVING

GIMP_RECTANGLE_TOOL_RESIZING_UPPER_LEFT

GIMP_RECTANGLE_TOOL_RESIZING_UPPER_RIGHT

GIMP_RECTANGLE_TOOL_RESIZING_LOWER_LEFT

GIMP_RECTANGLE_TOOL_RESIZING_LOWER_RIGHT

GIMP_RECTANGLE_TOOL_RESIZING_LEFT

GIMP_RECTANGLE_TOOL_RESIZING_RIGHT

GIMP_RECTANGLE_TOOL_RESIZING_TOP

GIMP_RECTANGLE_TOOL_RESIZING_BOTTOM

GIMP_RECTANGLE_TOOL_AUTO_SHRINK

GIMP_RECTANGLE_TOOL_EXECUTING


GIMP_RECTANGLE_TOOL_GET_OPTIONS()

#define GIMP_RECTANGLE_TOOL_GET_OPTIONS(t)     (GIMP_RECTANGLE_OPTIONS (gimp_tool_get_options (GIMP_TOOL (t))))


gimp_rectangle_tool_constructor ()

void                gimp_rectangle_tool_constructor     (GObject *object);


gimp_rectangle_tool_init ()

void                gimp_rectangle_tool_init            (GimpRectangleTool *rect_tool);

Initializes the GimpRectangleTool.


gimp_rectangle_tool_control ()

void                gimp_rectangle_tool_control         (GimpTool *tool,
                                                         GimpToolAction action,
                                                         GimpDisplay *display);


gimp_rectangle_tool_button_press ()

void                gimp_rectangle_tool_button_press    (GimpTool *tool,
                                                         const GimpCoords *coords,
                                                         guint32 time,
                                                         GdkModifierType state,
                                                         GimpDisplay *display);


gimp_rectangle_tool_button_release ()

void                gimp_rectangle_tool_button_release  (GimpTool *tool,
                                                         const GimpCoords *coords,
                                                         guint32 time,
                                                         GdkModifierType state,
                                                         GimpButtonReleaseType release_type,
                                                         GimpDisplay *display);


gimp_rectangle_tool_motion ()

void                gimp_rectangle_tool_motion          (GimpTool *tool,
                                                         const GimpCoords *coords,
                                                         guint32 time,
                                                         GdkModifierType state,
                                                         GimpDisplay *display);


gimp_rectangle_tool_key_press ()

gboolean            gimp_rectangle_tool_key_press       (GimpTool *tool,
                                                         GdkEventKey *kevent,
                                                         GimpDisplay *display);


gimp_rectangle_tool_active_modifier_key ()

void                gimp_rectangle_tool_active_modifier_key
                                                        (GimpTool *tool,
                                                         GdkModifierType key,
                                                         gboolean press,
                                                         GdkModifierType state,
                                                         GimpDisplay *display);


gimp_rectangle_tool_oper_update ()

void                gimp_rectangle_tool_oper_update     (GimpTool *tool,
                                                         const GimpCoords *coords,
                                                         GdkModifierType state,
                                                         gboolean proximity,
                                                         GimpDisplay *display);


gimp_rectangle_tool_cursor_update ()

void                gimp_rectangle_tool_cursor_update   (GimpTool *tool,
                                                         const GimpCoords *coords,
                                                         GdkModifierType state,
                                                         GimpDisplay *display);


gimp_rectangle_tool_draw ()

void                gimp_rectangle_tool_draw            (GimpDrawTool *draw,
                                                         GimpCanvasGroup *stroke_group);


gimp_rectangle_tool_execute ()

gboolean            gimp_rectangle_tool_execute         (GimpRectangleTool *rect_tool);


gimp_rectangle_tool_cancel ()

void                gimp_rectangle_tool_cancel          (GimpRectangleTool *rect_tool);


gimp_rectangle_tool_set_constraint ()

void                gimp_rectangle_tool_set_constraint  (GimpRectangleTool *rectangle,
                                                         GimpRectangleConstraint constraint);


gimp_rectangle_tool_get_constraint ()

GimpRectangleConstraint gimp_rectangle_tool_get_constraint
                                                        (GimpRectangleTool *rectangle);


gimp_rectangle_tool_get_function ()

GimpRectangleFunction gimp_rectangle_tool_get_function  (GimpRectangleTool *rectangle);


gimp_rectangle_tool_set_function ()

void                gimp_rectangle_tool_set_function    (GimpRectangleTool *rectangle,
                                                         GimpRectangleFunction function);


gimp_rectangle_tool_constraint_size_set ()

void                gimp_rectangle_tool_constraint_size_set
                                                        (GimpRectangleTool *rectangle,
                                                         GObject *object,
                                                         const gchar *width_property,
                                                         const gchar *height_property);

Sets specified rectangle tool options properties to the width and height of the current contraint size.

width_property :

Option property to set to current constraint width.

height_property :

Option property to set to current constraint height.

gimp_rectangle_tool_pending_size_set ()

void                gimp_rectangle_tool_pending_size_set
                                                        (GimpRectangleTool *rectangle,
                                                         GObject *object,
                                                         const gchar *width_property,
                                                         const gchar *height_property);

Sets specified rectangle tool options properties to the width and height of the current pending rectangle.

width_property :

Option property to set to pending rectangle width.

height_property :

Option property to set to pending rectangle height.

gimp_rectangle_tool_rectangle_is_new ()

gboolean            gimp_rectangle_tool_rectangle_is_new
                                                        (GimpRectangleTool *rect_tool);

Returns :

TRUE if the user is creating a new rectangle from scratch, FALSE if modifying n previously existing rectangle. This function is only meaningful in _motion and _button_release.

gimp_rectangle_tool_point_in_rectangle ()

gboolean            gimp_rectangle_tool_point_in_rectangle
                                                        (GimpRectangleTool *rect_tool,
                                                         gdouble x,
                                                         gdouble y);

x :

X-coord of point to test (in image coordinates)

y :

Y-coord of point to test (in image coordinates)

Returns :

TRUE if the passed point was within the rectangle

gimp_rectangle_tool_frame_item ()

void                gimp_rectangle_tool_frame_item      (GimpRectangleTool *rect_tool,
                                                         GimpItem *item);

Convenience function to set the corners of the rectangle to match the bounds of the specified item. The rectangle interface must be active (i.e., showing a rectangle), and the item must be attached to the image on which the rectangle is active.

rect_tool :

a GimpRectangleTool interface

item :

a GimpItem attached to the image on which a rectangle is being shown.

gimp_rectangle_tool_install_properties ()

void                gimp_rectangle_tool_install_properties
                                                        (GObjectClass *klass);

Installs the necessary properties for a class implementing GimpToolOptions. A GimpRectangleToolProp property is installed for each property, using the values from the GimpRectangleToolProp enumeration. The caller must make sure itself that the enumeration values don't collide with some other property values they are using (that's what GIMP_RECTANGLE_TOOL_PROP_LAST is good for).

klass :

the class structure for a type deriving from GObject

gimp_rectangle_tool_set_property ()

void                gimp_rectangle_tool_set_property    (GObject *object,
                                                         guint property_id,
                                                         const GValue *value,
                                                         GParamSpec *pspec);


gimp_rectangle_tool_get_property ()

void                gimp_rectangle_tool_get_property    (GObject *object,
                                                         guint property_id,
                                                         GValue *value,
                                                         GParamSpec *pspec);

Property Details

The "constraint" property

  "constraint"               GimpRectangleConstraint  : Read / Write

Default value: GIMP_RECTANGLE_CONSTRAIN_NONE


The "narrow-mode" property

  "narrow-mode"              gboolean              : Read / Write

Default value: FALSE


The "precision" property

  "precision"                GimpRectanglePrecision  : Read / Write

Default value: GIMP_RECTANGLE_PRECISION_INT


The "x1" property

  "x1"                       gint                  : Read / Write

Allowed values: [-262144,262144]

Default value: 0


The "x2" property

  "x2"                       gint                  : Read / Write

Allowed values: [-262144,262144]

Default value: 0


The "y1" property

  "y1"                       gint                  : Read / Write

Allowed values: [-262144,262144]

Default value: 0


The "y2" property

  "y2"                       gint                  : Read / Write

Allowed values: [-262144,262144]

Default value: 0

Signal Details

The "rectangle-change-complete" signal

void                user_function                      (GimpRectangleToolInterface *gimprectangletoolinterface,
                                                        gpointer                    user_data)                       : Run First

gimprectangletoolinterface :

the object which received the signal.

user_data :

user data set when the signal handler was connected.