app: introduce enum GimpHandleAnchor as replacement for GtkAnchorType

because the latter is gone in GTK+ 3.0
This commit is contained in:
Michael Natterer
2010-10-18 12:50:17 +02:00
parent 0e9442b7c0
commit 5b64b83569
10 changed files with 221 additions and 160 deletions

View File

@ -74,6 +74,49 @@ gimp_handle_type_get_type (void)
return type; return type;
} }
GType
gimp_handle_anchor_get_type (void)
{
static const GEnumValue values[] =
{
{ GIMP_HANDLE_ANCHOR_CENTER, "GIMP_HANDLE_ANCHOR_CENTER", "center" },
{ GIMP_HANDLE_ANCHOR_NORTH, "GIMP_HANDLE_ANCHOR_NORTH", "north" },
{ GIMP_HANDLE_ANCHOR_NORTH_WEST, "GIMP_HANDLE_ANCHOR_NORTH_WEST", "north-west" },
{ GIMP_HANDLE_ANCHOR_NORTH_EAST, "GIMP_HANDLE_ANCHOR_NORTH_EAST", "north-east" },
{ GIMP_HANDLE_ANCHOR_SOUTH, "GIMP_HANDLE_ANCHOR_SOUTH", "south" },
{ GIMP_HANDLE_ANCHOR_SOUTH_WEST, "GIMP_HANDLE_ANCHOR_SOUTH_WEST", "south-west" },
{ GIMP_HANDLE_ANCHOR_SOUTH_EAST, "GIMP_HANDLE_ANCHOR_SOUTH_EAST", "south-east" },
{ GIMP_HANDLE_ANCHOR_WEST, "GIMP_HANDLE_ANCHOR_WEST", "west" },
{ GIMP_HANDLE_ANCHOR_EAST, "GIMP_HANDLE_ANCHOR_EAST", "east" },
{ 0, NULL, NULL }
};
static const GimpEnumDesc descs[] =
{
{ GIMP_HANDLE_ANCHOR_CENTER, "GIMP_HANDLE_ANCHOR_CENTER", NULL },
{ GIMP_HANDLE_ANCHOR_NORTH, "GIMP_HANDLE_ANCHOR_NORTH", NULL },
{ GIMP_HANDLE_ANCHOR_NORTH_WEST, "GIMP_HANDLE_ANCHOR_NORTH_WEST", NULL },
{ GIMP_HANDLE_ANCHOR_NORTH_EAST, "GIMP_HANDLE_ANCHOR_NORTH_EAST", NULL },
{ GIMP_HANDLE_ANCHOR_SOUTH, "GIMP_HANDLE_ANCHOR_SOUTH", NULL },
{ GIMP_HANDLE_ANCHOR_SOUTH_WEST, "GIMP_HANDLE_ANCHOR_SOUTH_WEST", NULL },
{ GIMP_HANDLE_ANCHOR_SOUTH_EAST, "GIMP_HANDLE_ANCHOR_SOUTH_EAST", NULL },
{ GIMP_HANDLE_ANCHOR_WEST, "GIMP_HANDLE_ANCHOR_WEST", NULL },
{ GIMP_HANDLE_ANCHOR_EAST, "GIMP_HANDLE_ANCHOR_EAST", NULL },
{ 0, NULL, NULL }
};
static GType type = 0;
if (G_UNLIKELY (! type))
{
type = g_enum_register_static ("GimpHandleAnchor", values);
gimp_type_set_translation_context (type, "handle-anchor");
gimp_enum_set_value_descriptions (type, descs);
}
return type;
}
GType GType
gimp_zoom_focus_get_type (void) gimp_zoom_focus_get_type (void)
{ {

View File

@ -45,6 +45,24 @@ typedef enum
} GimpHandleType; } GimpHandleType;
#define GIMP_TYPE_HANDLE_ANCHOR (gimp_handle_anchor_get_type ())
GType gimp_handle_anchor_get_type (void) G_GNUC_CONST;
typedef enum
{
GIMP_HANDLE_ANCHOR_CENTER,
GIMP_HANDLE_ANCHOR_NORTH,
GIMP_HANDLE_ANCHOR_NORTH_WEST,
GIMP_HANDLE_ANCHOR_NORTH_EAST,
GIMP_HANDLE_ANCHOR_SOUTH,
GIMP_HANDLE_ANCHOR_SOUTH_WEST,
GIMP_HANDLE_ANCHOR_SOUTH_EAST,
GIMP_HANDLE_ANCHOR_WEST,
GIMP_HANDLE_ANCHOR_EAST
} GimpHandleAnchor;
#define GIMP_TYPE_ZOOM_FOCUS (gimp_zoom_focus_get_type ()) #define GIMP_TYPE_ZOOM_FOCUS (gimp_zoom_focus_get_type ())
GType gimp_zoom_focus_get_type (void) G_GNUC_CONST; GType gimp_zoom_focus_get_type (void) G_GNUC_CONST;

View File

@ -55,7 +55,7 @@ struct _GimpCanvasCornerPrivate
gdouble y; gdouble y;
gdouble width; gdouble width;
gdouble height; gdouble height;
GtkAnchorType anchor; GimpHandleAnchor anchor;
gint corner_width; gint corner_width;
gint corner_height; gint corner_height;
gboolean outside; gboolean outside;
@ -128,8 +128,8 @@ gimp_canvas_corner_class_init (GimpCanvasCornerClass *klass)
g_object_class_install_property (object_class, PROP_ANCHOR, g_object_class_install_property (object_class, PROP_ANCHOR,
g_param_spec_enum ("anchor", NULL, NULL, g_param_spec_enum ("anchor", NULL, NULL,
GTK_TYPE_ANCHOR_TYPE, GIMP_TYPE_HANDLE_ANCHOR,
GTK_ANCHOR_CENTER, GIMP_HANDLE_ANCHOR_CENTER,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_CORNER_WIDTH, g_object_class_install_property (object_class, PROP_CORNER_WIDTH,
@ -280,10 +280,10 @@ gimp_canvas_corner_transform (GimpCanvasItem *item,
switch (private->anchor) switch (private->anchor)
{ {
case GTK_ANCHOR_CENTER: case GIMP_HANDLE_ANCHOR_CENTER:
break; break;
case GTK_ANCHOR_NORTH_WEST: case GIMP_HANDLE_ANCHOR_NORTH_WEST:
if (private->outside) if (private->outside)
{ {
*x = rx - private->corner_width; *x = rx - private->corner_width;
@ -296,7 +296,7 @@ gimp_canvas_corner_transform (GimpCanvasItem *item,
} }
break; break;
case GTK_ANCHOR_NORTH_EAST: case GIMP_HANDLE_ANCHOR_NORTH_EAST:
if (private->outside) if (private->outside)
{ {
*x = rx + rw; *x = rx + rw;
@ -309,7 +309,7 @@ gimp_canvas_corner_transform (GimpCanvasItem *item,
} }
break; break;
case GTK_ANCHOR_SOUTH_WEST: case GIMP_HANDLE_ANCHOR_SOUTH_WEST:
if (private->outside) if (private->outside)
{ {
*x = rx - private->corner_width; *x = rx - private->corner_width;
@ -322,7 +322,7 @@ gimp_canvas_corner_transform (GimpCanvasItem *item,
} }
break; break;
case GTK_ANCHOR_SOUTH_EAST: case GIMP_HANDLE_ANCHOR_SOUTH_EAST:
if (private->outside) if (private->outside)
{ {
*x = rx + rw; *x = rx + rw;
@ -335,7 +335,7 @@ gimp_canvas_corner_transform (GimpCanvasItem *item,
} }
break; break;
case GTK_ANCHOR_NORTH: case GIMP_HANDLE_ANCHOR_NORTH:
if (private->outside) if (private->outside)
{ {
*x = rx; *x = rx;
@ -349,7 +349,7 @@ gimp_canvas_corner_transform (GimpCanvasItem *item,
} }
break; break;
case GTK_ANCHOR_SOUTH: case GIMP_HANDLE_ANCHOR_SOUTH:
if (private->outside) if (private->outside)
{ {
*x = rx; *x = rx;
@ -363,7 +363,7 @@ gimp_canvas_corner_transform (GimpCanvasItem *item,
} }
break; break;
case GTK_ANCHOR_WEST: case GIMP_HANDLE_ANCHOR_WEST:
if (private->outside) if (private->outside)
{ {
*x = rx - private->corner_width; *x = rx - private->corner_width;
@ -377,7 +377,7 @@ gimp_canvas_corner_transform (GimpCanvasItem *item,
} }
break; break;
case GTK_ANCHOR_EAST: case GIMP_HANDLE_ANCHOR_EAST:
if (private->outside) if (private->outside)
{ {
*x = rx + rw; *x = rx + rw;
@ -432,7 +432,7 @@ gimp_canvas_corner_new (GimpDisplayShell *shell,
gdouble y, gdouble y,
gdouble width, gdouble width,
gdouble height, gdouble height,
GtkAnchorType anchor, GimpHandleAnchor anchor,
gint corner_width, gint corner_width,
gint corner_height, gint corner_height,
gboolean outside) gboolean outside)

View File

@ -54,7 +54,7 @@ GimpCanvasItem * gimp_canvas_corner_new (GimpDisplayShell *shell,
gdouble y, gdouble y,
gdouble width, gdouble width,
gdouble height, gdouble height,
GtkAnchorType anchor, GimpHandleAnchor anchor,
gint corner_width, gint corner_width,
gint corner_height, gint corner_height,
gboolean outside); gboolean outside);

View File

@ -54,7 +54,7 @@ typedef struct _GimpCanvasHandlePrivate GimpCanvasHandlePrivate;
struct _GimpCanvasHandlePrivate struct _GimpCanvasHandlePrivate
{ {
GimpHandleType type; GimpHandleType type;
GtkAnchorType anchor; GimpHandleAnchor anchor;
gdouble x; gdouble x;
gdouble y; gdouble y;
gint width; gint width;
@ -112,8 +112,8 @@ gimp_canvas_handle_class_init (GimpCanvasHandleClass *klass)
g_object_class_install_property (object_class, PROP_ANCHOR, g_object_class_install_property (object_class, PROP_ANCHOR,
g_param_spec_enum ("anchor", NULL, NULL, g_param_spec_enum ("anchor", NULL, NULL,
GTK_TYPE_ANCHOR_TYPE, GIMP_TYPE_HANDLE_ANCHOR,
GTK_ANCHOR_CENTER, GIMP_HANDLE_ANCHOR_CENTER,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_X, g_object_class_install_property (object_class, PROP_X,
@ -256,42 +256,42 @@ gimp_canvas_handle_shift_to_north_west (GtkAnchorType anchor,
{ {
switch (anchor) switch (anchor)
{ {
case GTK_ANCHOR_CENTER: case GIMP_HANDLE_ANCHOR_CENTER:
x -= handle_width / 2; x -= handle_width / 2;
y -= handle_height / 2; y -= handle_height / 2;
break; break;
case GTK_ANCHOR_NORTH: case GIMP_HANDLE_ANCHOR_NORTH:
x -= handle_width / 2; x -= handle_width / 2;
break; break;
case GTK_ANCHOR_NORTH_WEST: case GIMP_HANDLE_ANCHOR_NORTH_WEST:
/* nothing, this is the default */ /* nothing, this is the default */
break; break;
case GTK_ANCHOR_NORTH_EAST: case GIMP_HANDLE_ANCHOR_NORTH_EAST:
x -= handle_width; x -= handle_width;
break; break;
case GTK_ANCHOR_SOUTH: case GIMP_HANDLE_ANCHOR_SOUTH:
x -= handle_width / 2; x -= handle_width / 2;
y -= handle_height; y -= handle_height;
break; break;
case GTK_ANCHOR_SOUTH_WEST: case GIMP_HANDLE_ANCHOR_SOUTH_WEST:
y -= handle_height; y -= handle_height;
break; break;
case GTK_ANCHOR_SOUTH_EAST: case GIMP_HANDLE_ANCHOR_SOUTH_EAST:
x -= handle_width; x -= handle_width;
y -= handle_height; y -= handle_height;
break; break;
case GTK_ANCHOR_WEST: case GIMP_HANDLE_ANCHOR_WEST:
y -= handle_height / 2; y -= handle_height / 2;
break; break;
case GTK_ANCHOR_EAST: case GIMP_HANDLE_ANCHOR_EAST:
x -= handle_width; x -= handle_width;
y -= handle_height / 2; y -= handle_height / 2;
break; break;
@ -318,43 +318,43 @@ gimp_canvas_handle_shift_to_center (GtkAnchorType anchor,
{ {
switch (anchor) switch (anchor)
{ {
case GTK_ANCHOR_CENTER: case GIMP_HANDLE_ANCHOR_CENTER:
/* nothing, this is the default */ /* nothing, this is the default */
break; break;
case GTK_ANCHOR_NORTH: case GIMP_HANDLE_ANCHOR_NORTH:
y += height / 2; y += height / 2;
break; break;
case GTK_ANCHOR_NORTH_WEST: case GIMP_HANDLE_ANCHOR_NORTH_WEST:
x += width / 2; x += width / 2;
y += height / 2; y += height / 2;
break; break;
case GTK_ANCHOR_NORTH_EAST: case GIMP_HANDLE_ANCHOR_NORTH_EAST:
x -= width / 2; x -= width / 2;
y += height / 2; y += height / 2;
break; break;
case GTK_ANCHOR_SOUTH: case GIMP_HANDLE_ANCHOR_SOUTH:
y -= height / 2; y -= height / 2;
break; break;
case GTK_ANCHOR_SOUTH_WEST: case GIMP_HANDLE_ANCHOR_SOUTH_WEST:
x += width / 2; x += width / 2;
y -= height / 2; y -= height / 2;
break; break;
case GTK_ANCHOR_SOUTH_EAST: case GIMP_HANDLE_ANCHOR_SOUTH_EAST:
x -= width / 2; x -= width / 2;
y -= height / 2; y -= height / 2;
break; break;
case GTK_ANCHOR_WEST: case GIMP_HANDLE_ANCHOR_WEST:
x += width / 2; x += width / 2;
break; break;
case GTK_ANCHOR_EAST: case GIMP_HANDLE_ANCHOR_EAST:
x -= width / 2; x -= width / 2;
break; break;
@ -506,7 +506,7 @@ gimp_canvas_handle_get_extents (GimpCanvasItem *item,
GimpCanvasItem * GimpCanvasItem *
gimp_canvas_handle_new (GimpDisplayShell *shell, gimp_canvas_handle_new (GimpDisplayShell *shell,
GimpHandleType type, GimpHandleType type,
GtkAnchorType anchor, GimpHandleAnchor anchor,
gdouble x, gdouble x,
gdouble y, gdouble y,
gint width, gint width,

View File

@ -51,7 +51,7 @@ GType gimp_canvas_handle_get_type (void) G_GNUC_CONST;
GimpCanvasItem * gimp_canvas_handle_new (GimpDisplayShell *shell, GimpCanvasItem * gimp_canvas_handle_new (GimpDisplayShell *shell,
GimpHandleType type, GimpHandleType type,
GtkAnchorType anchor, GimpHandleAnchor anchor,
gdouble x, gdouble x,
gdouble y, gdouble y,
gint width, gint width,

View File

@ -105,7 +105,7 @@ struct _GimpDisplayShellOverlay
{ {
gdouble image_x; gdouble image_x;
gdouble image_y; gdouble image_y;
GtkAnchorType anchor; GimpHandleAnchor anchor;
gint spacing_x; gint spacing_x;
gint spacing_y; gint spacing_y;
}; };
@ -1113,47 +1113,47 @@ gimp_display_shell_transform_overlay (GimpDisplayShell *shell,
switch (overlay->anchor) switch (overlay->anchor)
{ {
case GTK_ANCHOR_CENTER: case GIMP_HANDLE_ANCHOR_CENTER:
*x -= requisition.width / 2; *x -= requisition.width / 2;
*y -= requisition.height / 2; *y -= requisition.height / 2;
break; break;
case GTK_ANCHOR_NORTH: case GIMP_HANDLE_ANCHOR_NORTH:
*x -= requisition.width / 2; *x -= requisition.width / 2;
*y += overlay->spacing_y; *y += overlay->spacing_y;
break; break;
case GTK_ANCHOR_NORTH_WEST: case GIMP_HANDLE_ANCHOR_NORTH_WEST:
*x += overlay->spacing_x; *x += overlay->spacing_x;
*y += overlay->spacing_y; *y += overlay->spacing_y;
break; break;
case GTK_ANCHOR_NORTH_EAST: case GIMP_HANDLE_ANCHOR_NORTH_EAST:
*x -= requisition.width + overlay->spacing_x; *x -= requisition.width + overlay->spacing_x;
*y += overlay->spacing_y; *y += overlay->spacing_y;
break; break;
case GTK_ANCHOR_SOUTH: case GIMP_HANDLE_ANCHOR_SOUTH:
*x -= requisition.width / 2; *x -= requisition.width / 2;
*y -= requisition.height + overlay->spacing_y; *y -= requisition.height + overlay->spacing_y;
break; break;
case GTK_ANCHOR_SOUTH_WEST: case GIMP_HANDLE_ANCHOR_SOUTH_WEST:
*x += overlay->spacing_x; *x += overlay->spacing_x;
*y -= requisition.height + overlay->spacing_y; *y -= requisition.height + overlay->spacing_y;
break; break;
case GTK_ANCHOR_SOUTH_EAST: case GIMP_HANDLE_ANCHOR_SOUTH_EAST:
*x -= requisition.width + overlay->spacing_x; *x -= requisition.width + overlay->spacing_x;
*y -= requisition.height + overlay->spacing_y; *y -= requisition.height + overlay->spacing_y;
break; break;
case GTK_ANCHOR_WEST: case GIMP_HANDLE_ANCHOR_WEST:
*x += overlay->spacing_x; *x += overlay->spacing_x;
*y -= requisition.height / 2; *y -= requisition.height / 2;
break; break;
case GTK_ANCHOR_EAST: case GIMP_HANDLE_ANCHOR_EAST:
*x -= requisition.width + overlay->spacing_x; *x -= requisition.width + overlay->spacing_x;
*y -= requisition.height / 2; *y -= requisition.height / 2;
break; break;
@ -1184,7 +1184,7 @@ gimp_display_shell_add_overlay (GimpDisplayShell *shell,
GtkWidget *child, GtkWidget *child,
gdouble image_x, gdouble image_x,
gdouble image_y, gdouble image_y,
GtkAnchorType anchor, GimpHandleAnchor anchor,
gint spacing_x, gint spacing_x,
gint spacing_y) gint spacing_y)
{ {
@ -1219,7 +1219,7 @@ gimp_display_shell_move_overlay (GimpDisplayShell *shell,
GtkWidget *child, GtkWidget *child,
gdouble image_x, gdouble image_x,
gdouble image_y, gdouble image_y,
GtkAnchorType anchor, GimpHandleAnchor anchor,
gint spacing_x, gint spacing_x,
gint spacing_y) gint spacing_y)
{ {

View File

@ -230,14 +230,14 @@ void gimp_display_shell_add_overlay (GimpDisplayShell *shell,
GtkWidget *child, GtkWidget *child,
gdouble image_x, gdouble image_x,
gdouble image_y, gdouble image_y,
GtkAnchorType anchor, GimpHandleAnchor anchor,
gint spacing_x, gint spacing_x,
gint spacing_y); gint spacing_y);
void gimp_display_shell_move_overlay (GimpDisplayShell *shell, void gimp_display_shell_move_overlay (GimpDisplayShell *shell,
GtkWidget *child, GtkWidget *child,
gdouble image_x, gdouble image_x,
gdouble image_y, gdouble image_y,
GtkAnchorType anchor, GimpHandleAnchor anchor,
gint spacing_x, gint spacing_x,
gint spacing_y); gint spacing_y);

View File

@ -78,7 +78,7 @@ static inline void gimp_draw_tool_shift_to_north_west
gdouble y, gdouble y,
gint handle_width, gint handle_width,
gint handle_height, gint handle_height,
GtkAnchorType anchor, GimpHandleAnchor anchor,
gdouble *shifted_x, gdouble *shifted_x,
gdouble *shifted_y); gdouble *shifted_y);
static inline void gimp_draw_tool_shift_to_center static inline void gimp_draw_tool_shift_to_center
@ -86,7 +86,7 @@ static inline void gimp_draw_tool_shift_to_center
gdouble y, gdouble y,
gint handle_width, gint handle_width,
gint handle_height, gint handle_height,
GtkAnchorType anchor, GimpHandleAnchor anchor,
gdouble *shifted_x, gdouble *shifted_x,
gdouble *shifted_y); gdouble *shifted_y);
@ -651,7 +651,7 @@ gimp_draw_tool_add_handle (GimpDrawTool *draw_tool,
gdouble y, gdouble y,
gint width, gint width,
gint height, gint height,
GtkAnchorType anchor) GimpHandleAnchor anchor)
{ {
GimpCanvasItem *item; GimpCanvasItem *item;
@ -693,7 +693,7 @@ gimp_draw_tool_add_corner (GimpDrawTool *draw_tool,
gdouble y2, gdouble y2,
gint width, gint width,
gint height, gint height,
GtkAnchorType anchor) GimpHandleAnchor anchor)
{ {
GimpCanvasItem *item; GimpCanvasItem *item;
@ -863,7 +863,7 @@ gimp_draw_tool_on_handle (GimpDrawTool *draw_tool,
gdouble handle_y, gdouble handle_y,
gint width, gint width,
gint height, gint height,
GtkAnchorType anchor) GimpHandleAnchor anchor)
{ {
GimpDisplayShell *shell; GimpDisplayShell *shell;
gdouble tx, ty; gdouble tx, ty;
@ -988,7 +988,7 @@ gimp_draw_tool_on_vectors_handle (GimpDrawTool *draw_tool,
(*ret_anchor)->position.x, (*ret_anchor)->position.x,
(*ret_anchor)->position.y, (*ret_anchor)->position.y,
width, height, width, height,
GTK_ANCHOR_CENTER) && GIMP_HANDLE_ANCHOR_CENTER) &&
(*ret_anchor)->type == preferred) (*ret_anchor)->type == preferred)
{ {
if (ret_stroke) *ret_stroke = pref_stroke; if (ret_stroke) *ret_stroke = pref_stroke;
@ -1003,7 +1003,7 @@ gimp_draw_tool_on_vectors_handle (GimpDrawTool *draw_tool,
pref_anchor->position.x, pref_anchor->position.x,
pref_anchor->position.y, pref_anchor->position.y,
width, height, width, height,
GTK_ANCHOR_CENTER)) GIMP_HANDLE_ANCHOR_CENTER))
{ {
if (ret_anchor) *ret_anchor = pref_anchor; if (ret_anchor) *ret_anchor = pref_anchor;
if (ret_stroke) *ret_stroke = pref_stroke; if (ret_stroke) *ret_stroke = pref_stroke;
@ -1018,7 +1018,7 @@ gimp_draw_tool_on_vectors_handle (GimpDrawTool *draw_tool,
anchor->position.x, anchor->position.x,
anchor->position.y, anchor->position.y,
width, height, width, height,
GTK_ANCHOR_CENTER)) GIMP_HANDLE_ANCHOR_CENTER))
{ {
if (ret_anchor) if (ret_anchor)
*ret_anchor = anchor; *ret_anchor = anchor;
@ -1097,7 +1097,7 @@ gimp_draw_tool_on_vectors_curve (GimpDrawTool *draw_tool,
min_coords.x, min_coords.x,
min_coords.y, min_coords.y,
width, height, width, height,
GTK_ANCHOR_CENTER)) GIMP_HANDLE_ANCHOR_CENTER))
{ {
return TRUE; return TRUE;
} }
@ -1169,48 +1169,48 @@ gimp_draw_tool_shift_to_north_west (gdouble x,
gdouble y, gdouble y,
gint handle_width, gint handle_width,
gint handle_height, gint handle_height,
GtkAnchorType anchor, GimpHandleAnchor anchor,
gdouble *shifted_x, gdouble *shifted_x,
gdouble *shifted_y) gdouble *shifted_y)
{ {
switch (anchor) switch (anchor)
{ {
case GTK_ANCHOR_CENTER: case GIMP_HANDLE_ANCHOR_CENTER:
x -= (handle_width >> 1); x -= (handle_width >> 1);
y -= (handle_height >> 1); y -= (handle_height >> 1);
break; break;
case GTK_ANCHOR_NORTH: case GIMP_HANDLE_ANCHOR_NORTH:
x -= (handle_width >> 1); x -= (handle_width >> 1);
break; break;
case GTK_ANCHOR_NORTH_WEST: case GIMP_HANDLE_ANCHOR_NORTH_WEST:
/* nothing, this is the default */ /* nothing, this is the default */
break; break;
case GTK_ANCHOR_NORTH_EAST: case GIMP_HANDLE_ANCHOR_NORTH_EAST:
x -= handle_width; x -= handle_width;
break; break;
case GTK_ANCHOR_SOUTH: case GIMP_HANDLE_ANCHOR_SOUTH:
x -= (handle_width >> 1); x -= (handle_width >> 1);
y -= handle_height; y -= handle_height;
break; break;
case GTK_ANCHOR_SOUTH_WEST: case GIMP_HANDLE_ANCHOR_SOUTH_WEST:
y -= handle_height; y -= handle_height;
break; break;
case GTK_ANCHOR_SOUTH_EAST: case GIMP_HANDLE_ANCHOR_SOUTH_EAST:
x -= handle_width; x -= handle_width;
y -= handle_height; y -= handle_height;
break; break;
case GTK_ANCHOR_WEST: case GIMP_HANDLE_ANCHOR_WEST:
y -= (handle_height >> 1); y -= (handle_height >> 1);
break; break;
case GTK_ANCHOR_EAST: case GIMP_HANDLE_ANCHOR_EAST:
x -= handle_width; x -= handle_width;
y -= (handle_height >> 1); y -= (handle_height >> 1);
break; break;
@ -1231,49 +1231,49 @@ gimp_draw_tool_shift_to_center (gdouble x,
gdouble y, gdouble y,
gint handle_width, gint handle_width,
gint handle_height, gint handle_height,
GtkAnchorType anchor, GimpHandleAnchor anchor,
gdouble *shifted_x, gdouble *shifted_x,
gdouble *shifted_y) gdouble *shifted_y)
{ {
switch (anchor) switch (anchor)
{ {
case GTK_ANCHOR_CENTER: case GIMP_HANDLE_ANCHOR_CENTER:
/* nothing, this is the default */ /* nothing, this is the default */
break; break;
case GTK_ANCHOR_NORTH: case GIMP_HANDLE_ANCHOR_NORTH:
y += (handle_height >> 1); y += (handle_height >> 1);
break; break;
case GTK_ANCHOR_NORTH_WEST: case GIMP_HANDLE_ANCHOR_NORTH_WEST:
x += (handle_width >> 1); x += (handle_width >> 1);
y += (handle_height >> 1); y += (handle_height >> 1);
break; break;
case GTK_ANCHOR_NORTH_EAST: case GIMP_HANDLE_ANCHOR_NORTH_EAST:
x -= (handle_width >> 1); x -= (handle_width >> 1);
y += (handle_height >> 1); y += (handle_height >> 1);
break; break;
case GTK_ANCHOR_SOUTH: case GIMP_HANDLE_ANCHOR_SOUTH:
y -= (handle_height >> 1); y -= (handle_height >> 1);
break; break;
case GTK_ANCHOR_SOUTH_WEST: case GIMP_HANDLE_ANCHOR_SOUTH_WEST:
x += (handle_width >> 1); x += (handle_width >> 1);
y -= (handle_height >> 1); y -= (handle_height >> 1);
break; break;
case GTK_ANCHOR_SOUTH_EAST: case GIMP_HANDLE_ANCHOR_SOUTH_EAST:
x -= (handle_width >> 1); x -= (handle_width >> 1);
y -= (handle_height >> 1); y -= (handle_height >> 1);
break; break;
case GTK_ANCHOR_WEST: case GIMP_HANDLE_ANCHOR_WEST:
x += (handle_width >> 1); x += (handle_width >> 1);
break; break;
case GTK_ANCHOR_EAST: case GIMP_HANDLE_ANCHOR_EAST:
x -= (handle_width >> 1); x -= (handle_width >> 1);
break; break;

View File

@ -130,7 +130,7 @@ GimpCanvasItem * gimp_draw_tool_add_handle (GimpDrawTool *draw_too
gdouble y, gdouble y,
gint width, gint width,
gint height, gint height,
GtkAnchorType anchor); GimpHandleAnchor anchor);
GimpCanvasItem * gimp_draw_tool_add_corner (GimpDrawTool *draw_tool, GimpCanvasItem * gimp_draw_tool_add_corner (GimpDrawTool *draw_tool,
gboolean highlight, gboolean highlight,
gboolean put_outside, gboolean put_outside,
@ -140,7 +140,7 @@ GimpCanvasItem * gimp_draw_tool_add_corner (GimpDrawTool *draw_too
gdouble y2, gdouble y2,
gint width, gint width,
gint height, gint height,
GtkAnchorType anchor); GimpHandleAnchor anchor);
GimpCanvasItem * gimp_draw_tool_add_lines (GimpDrawTool *draw_tool, GimpCanvasItem * gimp_draw_tool_add_lines (GimpDrawTool *draw_tool,
const GimpVector2 *points, const GimpVector2 *points,
@ -181,7 +181,7 @@ gboolean gimp_draw_tool_on_handle (GimpDrawTool *draw_too
gdouble handle_y, gdouble handle_y,
gint width, gint width,
gint height, gint height,
GtkAnchorType anchor); GimpHandleAnchor anchor);
gboolean gimp_draw_tool_on_vectors_handle (GimpDrawTool *draw_tool, gboolean gimp_draw_tool_on_vectors_handle (GimpDrawTool *draw_tool,
GimpDisplay *display, GimpDisplay *display,
GimpVectors *vectors, GimpVectors *vectors,