[gimp] app: add #defines of standard handle sizes to gimpcanvashandle.h
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add #defines of standard handle sizes to gimpcanvashandle.h
- Date: Mon, 19 Jun 2017 08:47:25 +0000 (UTC)
commit b1dddcdc8fa9b3a3b0186e5a0f9d42b409c1196a
Author: Michael Natterer <mitch gimp org>
Date: Mon Jun 19 10:46:05 2017 +0200
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/.
app/display/gimpcanvashandle.h | 7 ++++++
app/display/gimptoolcompass.c | 41 ++++++++++++-----------------------
app/display/gimptoolhandlegrid.c | 11 +++------
app/display/gimptooltransformgrid.c | 5 +--
4 files changed, 27 insertions(+), 37 deletions(-)
---
diff --git a/app/display/gimpcanvashandle.h b/app/display/gimpcanvashandle.h
index df7a90a..06a0e3b 100644
--- a/app/display/gimpcanvashandle.h
+++ b/app/display/gimpcanvashandle.h
@@ -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))
diff --git a/app/display/gimptoolcompass.c b/app/display/gimptoolcompass.c
index e5c0774..2c04d6b 100644
--- a/app/display/gimptoolcompass.c
+++ b/app/display/gimptoolcompass.c
@@ -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,
diff --git a/app/display/gimptoolhandlegrid.c b/app/display/gimptoolhandlegrid.c
index 4e09c13..fdd99ac 100644
--- a/app/display/gimptoolhandlegrid.c
+++ b/app/display/gimptoolhandlegrid.c
@@ -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);
}
diff --git a/app/display/gimptooltransformgrid.c b/app/display/gimptooltransformgrid.c
index cf7f99c..c6de7c4 100644
--- a/app/display/gimptooltransformgrid.c
+++ b/app/display/gimptooltransformgrid.c
@@ -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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]