mirror of https://github.com/GNOME/gimp.git
app: introduce enum GimpHandleAnchor as replacement for GtkAnchorType
because the latter is gone in GTK+ 3.0
This commit is contained in:
parent
0e9442b7c0
commit
5b64b83569
|
@ -74,6 +74,49 @@ gimp_handle_type_get_type (void)
|
|||
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
|
||||
gimp_zoom_focus_get_type (void)
|
||||
{
|
||||
|
|
|
@ -45,6 +45,24 @@ typedef enum
|
|||
} 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 ())
|
||||
|
||||
GType gimp_zoom_focus_get_type (void) G_GNUC_CONST;
|
||||
|
|
|
@ -51,14 +51,14 @@ typedef struct _GimpCanvasCornerPrivate GimpCanvasCornerPrivate;
|
|||
|
||||
struct _GimpCanvasCornerPrivate
|
||||
{
|
||||
gdouble x;
|
||||
gdouble y;
|
||||
gdouble width;
|
||||
gdouble height;
|
||||
GtkAnchorType anchor;
|
||||
gint corner_width;
|
||||
gint corner_height;
|
||||
gboolean outside;
|
||||
gdouble x;
|
||||
gdouble y;
|
||||
gdouble width;
|
||||
gdouble height;
|
||||
GimpHandleAnchor anchor;
|
||||
gint corner_width;
|
||||
gint corner_height;
|
||||
gboolean outside;
|
||||
};
|
||||
|
||||
#define GET_PRIVATE(corner) \
|
||||
|
@ -128,8 +128,8 @@ gimp_canvas_corner_class_init (GimpCanvasCornerClass *klass)
|
|||
|
||||
g_object_class_install_property (object_class, PROP_ANCHOR,
|
||||
g_param_spec_enum ("anchor", NULL, NULL,
|
||||
GTK_TYPE_ANCHOR_TYPE,
|
||||
GTK_ANCHOR_CENTER,
|
||||
GIMP_TYPE_HANDLE_ANCHOR,
|
||||
GIMP_HANDLE_ANCHOR_CENTER,
|
||||
GIMP_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_CORNER_WIDTH,
|
||||
|
@ -280,10 +280,10 @@ gimp_canvas_corner_transform (GimpCanvasItem *item,
|
|||
|
||||
switch (private->anchor)
|
||||
{
|
||||
case GTK_ANCHOR_CENTER:
|
||||
case GIMP_HANDLE_ANCHOR_CENTER:
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_NORTH_WEST:
|
||||
case GIMP_HANDLE_ANCHOR_NORTH_WEST:
|
||||
if (private->outside)
|
||||
{
|
||||
*x = rx - private->corner_width;
|
||||
|
@ -296,7 +296,7 @@ gimp_canvas_corner_transform (GimpCanvasItem *item,
|
|||
}
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_NORTH_EAST:
|
||||
case GIMP_HANDLE_ANCHOR_NORTH_EAST:
|
||||
if (private->outside)
|
||||
{
|
||||
*x = rx + rw;
|
||||
|
@ -309,7 +309,7 @@ gimp_canvas_corner_transform (GimpCanvasItem *item,
|
|||
}
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_SOUTH_WEST:
|
||||
case GIMP_HANDLE_ANCHOR_SOUTH_WEST:
|
||||
if (private->outside)
|
||||
{
|
||||
*x = rx - private->corner_width;
|
||||
|
@ -322,7 +322,7 @@ gimp_canvas_corner_transform (GimpCanvasItem *item,
|
|||
}
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_SOUTH_EAST:
|
||||
case GIMP_HANDLE_ANCHOR_SOUTH_EAST:
|
||||
if (private->outside)
|
||||
{
|
||||
*x = rx + rw;
|
||||
|
@ -335,7 +335,7 @@ gimp_canvas_corner_transform (GimpCanvasItem *item,
|
|||
}
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_NORTH:
|
||||
case GIMP_HANDLE_ANCHOR_NORTH:
|
||||
if (private->outside)
|
||||
{
|
||||
*x = rx;
|
||||
|
@ -349,7 +349,7 @@ gimp_canvas_corner_transform (GimpCanvasItem *item,
|
|||
}
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_SOUTH:
|
||||
case GIMP_HANDLE_ANCHOR_SOUTH:
|
||||
if (private->outside)
|
||||
{
|
||||
*x = rx;
|
||||
|
@ -363,7 +363,7 @@ gimp_canvas_corner_transform (GimpCanvasItem *item,
|
|||
}
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_WEST:
|
||||
case GIMP_HANDLE_ANCHOR_WEST:
|
||||
if (private->outside)
|
||||
{
|
||||
*x = rx - private->corner_width;
|
||||
|
@ -377,7 +377,7 @@ gimp_canvas_corner_transform (GimpCanvasItem *item,
|
|||
}
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_EAST:
|
||||
case GIMP_HANDLE_ANCHOR_EAST:
|
||||
if (private->outside)
|
||||
{
|
||||
*x = rx + rw;
|
||||
|
@ -432,7 +432,7 @@ gimp_canvas_corner_new (GimpDisplayShell *shell,
|
|||
gdouble y,
|
||||
gdouble width,
|
||||
gdouble height,
|
||||
GtkAnchorType anchor,
|
||||
GimpHandleAnchor anchor,
|
||||
gint corner_width,
|
||||
gint corner_height,
|
||||
gboolean outside)
|
||||
|
|
|
@ -54,7 +54,7 @@ GimpCanvasItem * gimp_canvas_corner_new (GimpDisplayShell *shell,
|
|||
gdouble y,
|
||||
gdouble width,
|
||||
gdouble height,
|
||||
GtkAnchorType anchor,
|
||||
GimpHandleAnchor anchor,
|
||||
gint corner_width,
|
||||
gint corner_height,
|
||||
gboolean outside);
|
||||
|
|
|
@ -53,14 +53,14 @@ typedef struct _GimpCanvasHandlePrivate GimpCanvasHandlePrivate;
|
|||
|
||||
struct _GimpCanvasHandlePrivate
|
||||
{
|
||||
GimpHandleType type;
|
||||
GtkAnchorType anchor;
|
||||
gdouble x;
|
||||
gdouble y;
|
||||
gint width;
|
||||
gint height;
|
||||
gdouble start_angle;
|
||||
gdouble slice_angle;;
|
||||
GimpHandleType type;
|
||||
GimpHandleAnchor anchor;
|
||||
gdouble x;
|
||||
gdouble y;
|
||||
gint width;
|
||||
gint height;
|
||||
gdouble start_angle;
|
||||
gdouble slice_angle;;
|
||||
};
|
||||
|
||||
#define GET_PRIVATE(handle) \
|
||||
|
@ -112,8 +112,8 @@ gimp_canvas_handle_class_init (GimpCanvasHandleClass *klass)
|
|||
|
||||
g_object_class_install_property (object_class, PROP_ANCHOR,
|
||||
g_param_spec_enum ("anchor", NULL, NULL,
|
||||
GTK_TYPE_ANCHOR_TYPE,
|
||||
GTK_ANCHOR_CENTER,
|
||||
GIMP_TYPE_HANDLE_ANCHOR,
|
||||
GIMP_HANDLE_ANCHOR_CENTER,
|
||||
GIMP_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_X,
|
||||
|
@ -256,42 +256,42 @@ gimp_canvas_handle_shift_to_north_west (GtkAnchorType anchor,
|
|||
{
|
||||
switch (anchor)
|
||||
{
|
||||
case GTK_ANCHOR_CENTER:
|
||||
case GIMP_HANDLE_ANCHOR_CENTER:
|
||||
x -= handle_width / 2;
|
||||
y -= handle_height / 2;
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_NORTH:
|
||||
case GIMP_HANDLE_ANCHOR_NORTH:
|
||||
x -= handle_width / 2;
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_NORTH_WEST:
|
||||
case GIMP_HANDLE_ANCHOR_NORTH_WEST:
|
||||
/* nothing, this is the default */
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_NORTH_EAST:
|
||||
case GIMP_HANDLE_ANCHOR_NORTH_EAST:
|
||||
x -= handle_width;
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_SOUTH:
|
||||
case GIMP_HANDLE_ANCHOR_SOUTH:
|
||||
x -= handle_width / 2;
|
||||
y -= handle_height;
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_SOUTH_WEST:
|
||||
case GIMP_HANDLE_ANCHOR_SOUTH_WEST:
|
||||
y -= handle_height;
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_SOUTH_EAST:
|
||||
case GIMP_HANDLE_ANCHOR_SOUTH_EAST:
|
||||
x -= handle_width;
|
||||
y -= handle_height;
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_WEST:
|
||||
case GIMP_HANDLE_ANCHOR_WEST:
|
||||
y -= handle_height / 2;
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_EAST:
|
||||
case GIMP_HANDLE_ANCHOR_EAST:
|
||||
x -= handle_width;
|
||||
y -= handle_height / 2;
|
||||
break;
|
||||
|
@ -318,43 +318,43 @@ gimp_canvas_handle_shift_to_center (GtkAnchorType anchor,
|
|||
{
|
||||
switch (anchor)
|
||||
{
|
||||
case GTK_ANCHOR_CENTER:
|
||||
case GIMP_HANDLE_ANCHOR_CENTER:
|
||||
/* nothing, this is the default */
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_NORTH:
|
||||
case GIMP_HANDLE_ANCHOR_NORTH:
|
||||
y += height / 2;
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_NORTH_WEST:
|
||||
case GIMP_HANDLE_ANCHOR_NORTH_WEST:
|
||||
x += width / 2;
|
||||
y += height / 2;
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_NORTH_EAST:
|
||||
case GIMP_HANDLE_ANCHOR_NORTH_EAST:
|
||||
x -= width / 2;
|
||||
y += height / 2;
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_SOUTH:
|
||||
case GIMP_HANDLE_ANCHOR_SOUTH:
|
||||
y -= height / 2;
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_SOUTH_WEST:
|
||||
case GIMP_HANDLE_ANCHOR_SOUTH_WEST:
|
||||
x += width / 2;
|
||||
y -= height / 2;
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_SOUTH_EAST:
|
||||
case GIMP_HANDLE_ANCHOR_SOUTH_EAST:
|
||||
x -= width / 2;
|
||||
y -= height / 2;
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_WEST:
|
||||
case GIMP_HANDLE_ANCHOR_WEST:
|
||||
x += width / 2;
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_EAST:
|
||||
case GIMP_HANDLE_ANCHOR_EAST:
|
||||
x -= width / 2;
|
||||
break;
|
||||
|
||||
|
@ -506,7 +506,7 @@ gimp_canvas_handle_get_extents (GimpCanvasItem *item,
|
|||
GimpCanvasItem *
|
||||
gimp_canvas_handle_new (GimpDisplayShell *shell,
|
||||
GimpHandleType type,
|
||||
GtkAnchorType anchor,
|
||||
GimpHandleAnchor anchor,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
gint width,
|
||||
|
|
|
@ -51,7 +51,7 @@ GType gimp_canvas_handle_get_type (void) G_GNUC_CONST;
|
|||
|
||||
GimpCanvasItem * gimp_canvas_handle_new (GimpDisplayShell *shell,
|
||||
GimpHandleType type,
|
||||
GtkAnchorType anchor,
|
||||
GimpHandleAnchor anchor,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
gint width,
|
||||
|
|
|
@ -103,11 +103,11 @@ typedef struct _GimpDisplayShellOverlay GimpDisplayShellOverlay;
|
|||
|
||||
struct _GimpDisplayShellOverlay
|
||||
{
|
||||
gdouble image_x;
|
||||
gdouble image_y;
|
||||
GtkAnchorType anchor;
|
||||
gint spacing_x;
|
||||
gint spacing_y;
|
||||
gdouble image_x;
|
||||
gdouble image_y;
|
||||
GimpHandleAnchor anchor;
|
||||
gint spacing_x;
|
||||
gint spacing_y;
|
||||
};
|
||||
|
||||
|
||||
|
@ -1113,47 +1113,47 @@ gimp_display_shell_transform_overlay (GimpDisplayShell *shell,
|
|||
|
||||
switch (overlay->anchor)
|
||||
{
|
||||
case GTK_ANCHOR_CENTER:
|
||||
case GIMP_HANDLE_ANCHOR_CENTER:
|
||||
*x -= requisition.width / 2;
|
||||
*y -= requisition.height / 2;
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_NORTH:
|
||||
case GIMP_HANDLE_ANCHOR_NORTH:
|
||||
*x -= requisition.width / 2;
|
||||
*y += overlay->spacing_y;
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_NORTH_WEST:
|
||||
case GIMP_HANDLE_ANCHOR_NORTH_WEST:
|
||||
*x += overlay->spacing_x;
|
||||
*y += overlay->spacing_y;
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_NORTH_EAST:
|
||||
case GIMP_HANDLE_ANCHOR_NORTH_EAST:
|
||||
*x -= requisition.width + overlay->spacing_x;
|
||||
*y += overlay->spacing_y;
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_SOUTH:
|
||||
case GIMP_HANDLE_ANCHOR_SOUTH:
|
||||
*x -= requisition.width / 2;
|
||||
*y -= requisition.height + overlay->spacing_y;
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_SOUTH_WEST:
|
||||
case GIMP_HANDLE_ANCHOR_SOUTH_WEST:
|
||||
*x += overlay->spacing_x;
|
||||
*y -= requisition.height + overlay->spacing_y;
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_SOUTH_EAST:
|
||||
case GIMP_HANDLE_ANCHOR_SOUTH_EAST:
|
||||
*x -= requisition.width + overlay->spacing_x;
|
||||
*y -= requisition.height + overlay->spacing_y;
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_WEST:
|
||||
case GIMP_HANDLE_ANCHOR_WEST:
|
||||
*x += overlay->spacing_x;
|
||||
*y -= requisition.height / 2;
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_EAST:
|
||||
case GIMP_HANDLE_ANCHOR_EAST:
|
||||
*x -= requisition.width + overlay->spacing_x;
|
||||
*y -= requisition.height / 2;
|
||||
break;
|
||||
|
@ -1184,7 +1184,7 @@ gimp_display_shell_add_overlay (GimpDisplayShell *shell,
|
|||
GtkWidget *child,
|
||||
gdouble image_x,
|
||||
gdouble image_y,
|
||||
GtkAnchorType anchor,
|
||||
GimpHandleAnchor anchor,
|
||||
gint spacing_x,
|
||||
gint spacing_y)
|
||||
{
|
||||
|
@ -1219,7 +1219,7 @@ gimp_display_shell_move_overlay (GimpDisplayShell *shell,
|
|||
GtkWidget *child,
|
||||
gdouble image_x,
|
||||
gdouble image_y,
|
||||
GtkAnchorType anchor,
|
||||
GimpHandleAnchor anchor,
|
||||
gint spacing_x,
|
||||
gint spacing_y)
|
||||
{
|
||||
|
|
|
@ -230,14 +230,14 @@ void gimp_display_shell_add_overlay (GimpDisplayShell *shell,
|
|||
GtkWidget *child,
|
||||
gdouble image_x,
|
||||
gdouble image_y,
|
||||
GtkAnchorType anchor,
|
||||
GimpHandleAnchor anchor,
|
||||
gint spacing_x,
|
||||
gint spacing_y);
|
||||
void gimp_display_shell_move_overlay (GimpDisplayShell *shell,
|
||||
GtkWidget *child,
|
||||
gdouble image_x,
|
||||
gdouble image_y,
|
||||
GtkAnchorType anchor,
|
||||
GimpHandleAnchor anchor,
|
||||
gint spacing_x,
|
||||
gint spacing_y);
|
||||
|
||||
|
|
|
@ -59,36 +59,36 @@
|
|||
#define USE_TIMEOUT 1
|
||||
|
||||
|
||||
static void gimp_draw_tool_dispose (GObject *object);
|
||||
static void gimp_draw_tool_dispose (GObject *object);
|
||||
|
||||
static gboolean gimp_draw_tool_has_display (GimpTool *tool,
|
||||
GimpDisplay *display);
|
||||
static GimpDisplay * gimp_draw_tool_has_image (GimpTool *tool,
|
||||
GimpImage *image);
|
||||
static void gimp_draw_tool_control (GimpTool *tool,
|
||||
GimpToolAction action,
|
||||
GimpDisplay *display);
|
||||
static gboolean gimp_draw_tool_has_display (GimpTool *tool,
|
||||
GimpDisplay *display);
|
||||
static GimpDisplay * gimp_draw_tool_has_image (GimpTool *tool,
|
||||
GimpImage *image);
|
||||
static void gimp_draw_tool_control (GimpTool *tool,
|
||||
GimpToolAction action,
|
||||
GimpDisplay *display);
|
||||
|
||||
static void gimp_draw_tool_draw (GimpDrawTool *draw_tool);
|
||||
static void gimp_draw_tool_undraw (GimpDrawTool *draw_tool);
|
||||
static void gimp_draw_tool_real_draw (GimpDrawTool *draw_tool);
|
||||
static void gimp_draw_tool_draw (GimpDrawTool *draw_tool);
|
||||
static void gimp_draw_tool_undraw (GimpDrawTool *draw_tool);
|
||||
static void gimp_draw_tool_real_draw (GimpDrawTool *draw_tool);
|
||||
|
||||
static inline void gimp_draw_tool_shift_to_north_west
|
||||
(gdouble x,
|
||||
gdouble y,
|
||||
gint handle_width,
|
||||
gint handle_height,
|
||||
GtkAnchorType anchor,
|
||||
gdouble *shifted_x,
|
||||
gdouble *shifted_y);
|
||||
(gdouble x,
|
||||
gdouble y,
|
||||
gint handle_width,
|
||||
gint handle_height,
|
||||
GimpHandleAnchor anchor,
|
||||
gdouble *shifted_x,
|
||||
gdouble *shifted_y);
|
||||
static inline void gimp_draw_tool_shift_to_center
|
||||
(gdouble x,
|
||||
gdouble y,
|
||||
gint handle_width,
|
||||
gint handle_height,
|
||||
GtkAnchorType anchor,
|
||||
gdouble *shifted_x,
|
||||
gdouble *shifted_y);
|
||||
(gdouble x,
|
||||
gdouble y,
|
||||
gint handle_width,
|
||||
gint handle_height,
|
||||
GimpHandleAnchor anchor,
|
||||
gdouble *shifted_x,
|
||||
gdouble *shifted_y);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpDrawTool, gimp_draw_tool, GIMP_TYPE_TOOL)
|
||||
|
@ -645,13 +645,13 @@ gimp_draw_tool_add_arc (GimpDrawTool *draw_tool,
|
|||
}
|
||||
|
||||
GimpCanvasItem *
|
||||
gimp_draw_tool_add_handle (GimpDrawTool *draw_tool,
|
||||
GimpHandleType type,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
gint width,
|
||||
gint height,
|
||||
GtkAnchorType anchor)
|
||||
gimp_draw_tool_add_handle (GimpDrawTool *draw_tool,
|
||||
GimpHandleType type,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
gint width,
|
||||
gint height,
|
||||
GimpHandleAnchor anchor)
|
||||
{
|
||||
GimpCanvasItem *item;
|
||||
|
||||
|
@ -684,16 +684,16 @@ gimp_draw_tool_add_handle (GimpDrawTool *draw_tool,
|
|||
* rectangle outline, taking care of not drawing over an already drawn line.
|
||||
**/
|
||||
GimpCanvasItem *
|
||||
gimp_draw_tool_add_corner (GimpDrawTool *draw_tool,
|
||||
gboolean highlight,
|
||||
gboolean put_outside,
|
||||
gdouble x1,
|
||||
gdouble y1,
|
||||
gdouble x2,
|
||||
gdouble y2,
|
||||
gint width,
|
||||
gint height,
|
||||
GtkAnchorType anchor)
|
||||
gimp_draw_tool_add_corner (GimpDrawTool *draw_tool,
|
||||
gboolean highlight,
|
||||
gboolean put_outside,
|
||||
gdouble x1,
|
||||
gdouble y1,
|
||||
gdouble x2,
|
||||
gdouble y2,
|
||||
gint width,
|
||||
gint height,
|
||||
GimpHandleAnchor anchor)
|
||||
{
|
||||
GimpCanvasItem *item;
|
||||
|
||||
|
@ -854,16 +854,16 @@ gimp_draw_tool_add_text_cursor (GimpDrawTool *draw_tool,
|
|||
}
|
||||
|
||||
gboolean
|
||||
gimp_draw_tool_on_handle (GimpDrawTool *draw_tool,
|
||||
GimpDisplay *display,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
GimpHandleType type,
|
||||
gdouble handle_x,
|
||||
gdouble handle_y,
|
||||
gint width,
|
||||
gint height,
|
||||
GtkAnchorType anchor)
|
||||
gimp_draw_tool_on_handle (GimpDrawTool *draw_tool,
|
||||
GimpDisplay *display,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
GimpHandleType type,
|
||||
gdouble handle_x,
|
||||
gdouble handle_y,
|
||||
gint width,
|
||||
gint height,
|
||||
GimpHandleAnchor anchor)
|
||||
{
|
||||
GimpDisplayShell *shell;
|
||||
gdouble tx, ty;
|
||||
|
@ -988,7 +988,7 @@ gimp_draw_tool_on_vectors_handle (GimpDrawTool *draw_tool,
|
|||
(*ret_anchor)->position.x,
|
||||
(*ret_anchor)->position.y,
|
||||
width, height,
|
||||
GTK_ANCHOR_CENTER) &&
|
||||
GIMP_HANDLE_ANCHOR_CENTER) &&
|
||||
(*ret_anchor)->type == preferred)
|
||||
{
|
||||
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.y,
|
||||
width, height,
|
||||
GTK_ANCHOR_CENTER))
|
||||
GIMP_HANDLE_ANCHOR_CENTER))
|
||||
{
|
||||
if (ret_anchor) *ret_anchor = pref_anchor;
|
||||
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.y,
|
||||
width, height,
|
||||
GTK_ANCHOR_CENTER))
|
||||
GIMP_HANDLE_ANCHOR_CENTER))
|
||||
{
|
||||
if (ret_anchor)
|
||||
*ret_anchor = anchor;
|
||||
|
@ -1097,7 +1097,7 @@ gimp_draw_tool_on_vectors_curve (GimpDrawTool *draw_tool,
|
|||
min_coords.x,
|
||||
min_coords.y,
|
||||
width, height,
|
||||
GTK_ANCHOR_CENTER))
|
||||
GIMP_HANDLE_ANCHOR_CENTER))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1165,52 +1165,52 @@ gimp_draw_tool_on_vectors (GimpDrawTool *draw_tool,
|
|||
/* private functions */
|
||||
|
||||
static inline void
|
||||
gimp_draw_tool_shift_to_north_west (gdouble x,
|
||||
gdouble y,
|
||||
gint handle_width,
|
||||
gint handle_height,
|
||||
GtkAnchorType anchor,
|
||||
gdouble *shifted_x,
|
||||
gdouble *shifted_y)
|
||||
gimp_draw_tool_shift_to_north_west (gdouble x,
|
||||
gdouble y,
|
||||
gint handle_width,
|
||||
gint handle_height,
|
||||
GimpHandleAnchor anchor,
|
||||
gdouble *shifted_x,
|
||||
gdouble *shifted_y)
|
||||
{
|
||||
switch (anchor)
|
||||
{
|
||||
case GTK_ANCHOR_CENTER:
|
||||
case GIMP_HANDLE_ANCHOR_CENTER:
|
||||
x -= (handle_width >> 1);
|
||||
y -= (handle_height >> 1);
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_NORTH:
|
||||
case GIMP_HANDLE_ANCHOR_NORTH:
|
||||
x -= (handle_width >> 1);
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_NORTH_WEST:
|
||||
case GIMP_HANDLE_ANCHOR_NORTH_WEST:
|
||||
/* nothing, this is the default */
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_NORTH_EAST:
|
||||
case GIMP_HANDLE_ANCHOR_NORTH_EAST:
|
||||
x -= handle_width;
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_SOUTH:
|
||||
case GIMP_HANDLE_ANCHOR_SOUTH:
|
||||
x -= (handle_width >> 1);
|
||||
y -= handle_height;
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_SOUTH_WEST:
|
||||
case GIMP_HANDLE_ANCHOR_SOUTH_WEST:
|
||||
y -= handle_height;
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_SOUTH_EAST:
|
||||
case GIMP_HANDLE_ANCHOR_SOUTH_EAST:
|
||||
x -= handle_width;
|
||||
y -= handle_height;
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_WEST:
|
||||
case GIMP_HANDLE_ANCHOR_WEST:
|
||||
y -= (handle_height >> 1);
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_EAST:
|
||||
case GIMP_HANDLE_ANCHOR_EAST:
|
||||
x -= handle_width;
|
||||
y -= (handle_height >> 1);
|
||||
break;
|
||||
|
@ -1227,53 +1227,53 @@ gimp_draw_tool_shift_to_north_west (gdouble x,
|
|||
}
|
||||
|
||||
static inline void
|
||||
gimp_draw_tool_shift_to_center (gdouble x,
|
||||
gdouble y,
|
||||
gint handle_width,
|
||||
gint handle_height,
|
||||
GtkAnchorType anchor,
|
||||
gdouble *shifted_x,
|
||||
gdouble *shifted_y)
|
||||
gimp_draw_tool_shift_to_center (gdouble x,
|
||||
gdouble y,
|
||||
gint handle_width,
|
||||
gint handle_height,
|
||||
GimpHandleAnchor anchor,
|
||||
gdouble *shifted_x,
|
||||
gdouble *shifted_y)
|
||||
{
|
||||
switch (anchor)
|
||||
{
|
||||
case GTK_ANCHOR_CENTER:
|
||||
case GIMP_HANDLE_ANCHOR_CENTER:
|
||||
/* nothing, this is the default */
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_NORTH:
|
||||
case GIMP_HANDLE_ANCHOR_NORTH:
|
||||
y += (handle_height >> 1);
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_NORTH_WEST:
|
||||
case GIMP_HANDLE_ANCHOR_NORTH_WEST:
|
||||
x += (handle_width >> 1);
|
||||
y += (handle_height >> 1);
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_NORTH_EAST:
|
||||
case GIMP_HANDLE_ANCHOR_NORTH_EAST:
|
||||
x -= (handle_width >> 1);
|
||||
y += (handle_height >> 1);
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_SOUTH:
|
||||
case GIMP_HANDLE_ANCHOR_SOUTH:
|
||||
y -= (handle_height >> 1);
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_SOUTH_WEST:
|
||||
case GIMP_HANDLE_ANCHOR_SOUTH_WEST:
|
||||
x += (handle_width >> 1);
|
||||
y -= (handle_height >> 1);
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_SOUTH_EAST:
|
||||
case GIMP_HANDLE_ANCHOR_SOUTH_EAST:
|
||||
x -= (handle_width >> 1);
|
||||
y -= (handle_height >> 1);
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_WEST:
|
||||
case GIMP_HANDLE_ANCHOR_WEST:
|
||||
x += (handle_width >> 1);
|
||||
break;
|
||||
|
||||
case GTK_ANCHOR_EAST:
|
||||
case GIMP_HANDLE_ANCHOR_EAST:
|
||||
x -= (handle_width >> 1);
|
||||
break;
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ GimpCanvasItem * gimp_draw_tool_add_handle (GimpDrawTool *draw_too
|
|||
gdouble y,
|
||||
gint width,
|
||||
gint height,
|
||||
GtkAnchorType anchor);
|
||||
GimpHandleAnchor anchor);
|
||||
GimpCanvasItem * gimp_draw_tool_add_corner (GimpDrawTool *draw_tool,
|
||||
gboolean highlight,
|
||||
gboolean put_outside,
|
||||
|
@ -140,7 +140,7 @@ GimpCanvasItem * gimp_draw_tool_add_corner (GimpDrawTool *draw_too
|
|||
gdouble y2,
|
||||
gint width,
|
||||
gint height,
|
||||
GtkAnchorType anchor);
|
||||
GimpHandleAnchor anchor);
|
||||
|
||||
GimpCanvasItem * gimp_draw_tool_add_lines (GimpDrawTool *draw_tool,
|
||||
const GimpVector2 *points,
|
||||
|
@ -181,7 +181,7 @@ gboolean gimp_draw_tool_on_handle (GimpDrawTool *draw_too
|
|||
gdouble handle_y,
|
||||
gint width,
|
||||
gint height,
|
||||
GtkAnchorType anchor);
|
||||
GimpHandleAnchor anchor);
|
||||
gboolean gimp_draw_tool_on_vectors_handle (GimpDrawTool *draw_tool,
|
||||
GimpDisplay *display,
|
||||
GimpVectors *vectors,
|
||||
|
|
Loading…
Reference in New Issue