Commit b1dddcdc authored by Michael Natterer's avatar Michael Natterer 😴

app: add #defines of standard handle sizes to gimpcanvashandle.h

The same values as in gimpdrawtool.h, tool widgets in display/ must
not include the draw tool header from tools/.
parent f5a6c859
......@@ -25,6 +25,13 @@
#include "gimpcanvasitem.h"
#define GIMP_CANVAS_HANDLE_SIZE_CIRCLE 13
#define GIMP_CANVAS_HANDLE_SIZE_CROSS 15
#define GIMP_CANVAS_HANDLE_SIZE_CROSSHAIR 43
#define GIMP_CANVAS_HANDLE_SIZE_LARGE 25
#define GIMP_CANVAS_HANDLE_SIZE_SMALL 7
#define GIMP_TYPE_CANVAS_HANDLE (gimp_canvas_handle_get_type ())
#define GIMP_CANVAS_HANDLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_CANVAS_HANDLE, GimpCanvasHandle))
#define GIMP_CANVAS_HANDLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_CANVAS_HANDLE, GimpCanvasHandleClass))
......
......@@ -47,9 +47,6 @@
#include "gimp-intl.h"
#define GIMP_TOOL_HANDLE_SIZE_CROSS 15 /* FIXME */
#define ARC_RADIUS 30
/* possible measure functions */
......@@ -322,6 +319,7 @@ gimp_tool_compass_constructed (GObject *object)
GimpToolWidget *widget = GIMP_TOOL_WIDGET (object);
GimpToolCompassPrivate *private = compass->private;
GimpCanvasGroup *stroke_group;
gint i;
G_OBJECT_CLASS (parent_class)->constructed (object);
......@@ -357,29 +355,18 @@ gimp_tool_compass_constructed (GObject *object)
gimp_tool_widget_pop_group (widget);
private->handles[0] = gimp_tool_widget_add_handle (widget,
GIMP_HANDLE_CIRCLE,
private->x[0],
private->y[0],
GIMP_TOOL_HANDLE_SIZE_CROSS,
GIMP_TOOL_HANDLE_SIZE_CROSS,
GIMP_HANDLE_ANCHOR_CENTER);
private->handles[1] = gimp_tool_widget_add_handle (widget,
GIMP_HANDLE_CROSS,
private->x[1],
private->y[1],
GIMP_TOOL_HANDLE_SIZE_CROSS,
GIMP_TOOL_HANDLE_SIZE_CROSS,
GIMP_HANDLE_ANCHOR_CENTER);
private->handles[2] = gimp_tool_widget_add_handle (widget,
GIMP_HANDLE_CROSS,
private->x[2],
private->y[2],
GIMP_TOOL_HANDLE_SIZE_CROSS,
GIMP_TOOL_HANDLE_SIZE_CROSS,
GIMP_HANDLE_ANCHOR_CENTER);
for (i = 0; i < 3; i++)
{
private->handles[i] =
gimp_tool_widget_add_handle (widget,
i == 0 ?
GIMP_HANDLE_CIRCLE : GIMP_HANDLE_CROSS,
private->x[i],
private->y[i],
GIMP_CANVAS_HANDLE_SIZE_CROSS,
GIMP_CANVAS_HANDLE_SIZE_CROSS,
GIMP_HANDLE_ANCHOR_CENTER);
}
gimp_tool_compass_changed (widget);
}
......@@ -525,7 +512,7 @@ gimp_tool_compass_changed (GimpToolWidget *widget)
draw_arc == private->n_points - 1 &&
angle2 != 0.0);
target = FUNSCALEX (shell, (GIMP_TOOL_HANDLE_SIZE_CROSS >> 1));
target = FUNSCALEX (shell, (GIMP_CANVAS_HANDLE_SIZE_CROSS >> 1));
arc_radius = FUNSCALEX (shell, ARC_RADIUS);
gimp_canvas_line_set (private->angle_line,
......
......@@ -40,9 +40,6 @@
#include "gimp-intl.h"
#define GIMP_TOOL_HANDLE_SIZE_CIRCLE 13
enum
{
PROP_0,
......@@ -359,8 +356,8 @@ gimp_tool_handle_grid_constructed (GObject *object)
gimp_tool_widget_add_handle (widget,
GIMP_HANDLE_CIRCLE,
0, 0,
GIMP_TOOL_HANDLE_SIZE_CIRCLE,
GIMP_TOOL_HANDLE_SIZE_CIRCLE,
GIMP_CANVAS_HANDLE_SIZE_CIRCLE,
GIMP_CANVAS_HANDLE_SIZE_CIRCLE,
GIMP_HANDLE_ANCHOR_CENTER);
}
......@@ -900,7 +897,7 @@ gimp_tool_handle_grid_get_cursor (GimpToolWidget *widget,
static gint
calc_handle_diameter (gdouble distance)
{
#define HANDLE_DIAMETER (2 * GIMP_TOOL_HANDLE_SIZE_CIRCLE)
#define HANDLE_DIAMETER (2 * GIMP_CANVAS_HANDLE_SIZE_CIRCLE)
#define POINT_GRAB_THRESHOLD_SQ (SQR (HANDLE_DIAMETER / 2))
#define FULL_HANDLE_THRESHOLD_SQ (POINT_GRAB_THRESHOLD_SQ * 9)
#define PARTIAL_HANDLE_THRESHOLD_SQ (FULL_HANDLE_THRESHOLD_SQ * 5)
......@@ -913,7 +910,7 @@ calc_handle_diameter (gdouble distance)
size = CLAMP (size, 0.0, 1.0);
return (gint) CLAMP ((size * HANDLE_DIAMETER),
GIMP_TOOL_HANDLE_SIZE_CIRCLE,
GIMP_CANVAS_HANDLE_SIZE_CIRCLE,
HANDLE_DIAMETER);
}
......
......@@ -43,7 +43,6 @@
#define MIN_HANDLE_SIZE 6
#define GIMP_TOOL_HANDLE_SIZE_LARGE 25 /* FIXME */
enum
......@@ -2212,9 +2211,9 @@ gimp_tool_transform_grid_calc_handles (GimpToolTransformGrid *grid,
y2 = MAX4 (dy1, dy2, dy3, dy4);
*handle_w = CLAMP ((x2 - x1) / 3,
MIN_HANDLE_SIZE, GIMP_TOOL_HANDLE_SIZE_LARGE);
MIN_HANDLE_SIZE, GIMP_CANVAS_HANDLE_SIZE_LARGE);
*handle_h = CLAMP ((y2 - y1) / 3,
MIN_HANDLE_SIZE, GIMP_TOOL_HANDLE_SIZE_LARGE);
MIN_HANDLE_SIZE, GIMP_CANVAS_HANDLE_SIZE_LARGE);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment