[gimp] app: connect to GimpToolWidget::snap-offsets in GimpDrawTool
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: connect to GimpToolWidget::snap-offsets in GimpDrawTool
- Date: Mon, 26 Jun 2017 18:38:30 +0000 (UTC)
commit 72f8d7d6ac89cb1f07c5c626a456ff7c55b98b7f
Author: Michael Natterer <mitch gimp org>
Date: Mon Jun 26 20:37:51 2017 +0200
app: connect to GimpToolWidget::snap-offsets in GimpDrawTool
and remove the callback from all subclasses.
app/tools/gimpcroptool.c | 24 ------------------------
app/tools/gimpdrawtool.c | 30 ++++++++++++++++++++++++++++++
app/tools/gimpperspectiveclonetool.c | 25 -------------------------
app/tools/gimptransformtool.c | 24 ------------------------
4 files changed, 30 insertions(+), 73 deletions(-)
---
diff --git a/app/tools/gimpcroptool.c b/app/tools/gimpcroptool.c
index ac1165b..7d45e08 100644
--- a/app/tools/gimpcroptool.c
+++ b/app/tools/gimpcroptool.c
@@ -94,12 +94,6 @@ static void gimp_crop_tool_rectangle_status_coords (GimpToolWidget
gdouble y,
const gchar *help,
GimpCropTool *crop_tool);
-static void gimp_crop_tool_rectangle_snap_offsets (GimpToolRectangle *rectangle,
- gint x,
- gint y,
- gint width,
- gint height,
- GimpCropTool *crop_tool);
static void gimp_crop_tool_rectangle_change_complete (GimpToolRectangle *rectangle,
GimpCropTool *crop_tool);
@@ -285,9 +279,6 @@ gimp_crop_tool_button_press (GimpTool *tool,
g_signal_connect (widget, "status-coords",
G_CALLBACK (gimp_crop_tool_rectangle_status_coords),
crop_tool);
- g_signal_connect (widget, "snap-offsets",
- G_CALLBACK (gimp_crop_tool_rectangle_snap_offsets),
- crop_tool);
g_signal_connect (widget, "change-complete",
G_CALLBACK (gimp_crop_tool_rectangle_change_complete),
crop_tool);
@@ -476,21 +467,6 @@ gimp_crop_tool_rectangle_status_coords (GimpToolWidget *rectangle,
}
static void
-gimp_crop_tool_rectangle_snap_offsets (GimpToolRectangle *rectangle,
- gint offset_x,
- gint offset_y,
- gint width,
- gint height,
- GimpCropTool *crop_tool)
-{
- GimpTool *tool = GIMP_TOOL (crop_tool);
-
- gimp_tool_control_set_snap_offsets (tool->control,
- offset_x, offset_y,
- width, height);
-}
-
-static void
gimp_crop_tool_rectangle_change_complete (GimpToolRectangle *rectangle,
GimpCropTool *crop_tool)
{
diff --git a/app/tools/gimpdrawtool.c b/app/tools/gimpdrawtool.c
index 84b365c..afefeb2 100644
--- a/app/tools/gimpdrawtool.c
+++ b/app/tools/gimpdrawtool.c
@@ -52,6 +52,7 @@
#include "display/gimptoolwidget.h"
#include "gimpdrawtool.h"
+#include "gimptoolcontrol.h"
#define DRAW_TIMEOUT 4
@@ -80,6 +81,14 @@ static void gimp_draw_tool_oper_update (GimpTool *tool,
gboolean proximity,
GimpDisplay *display);
+static void gimp_draw_tool_widget_snap_offsets
+ (GimpToolWidget *widget,
+ gint offset_x,
+ gint offset_y,
+ gint width,
+ gint height,
+ GimpTool *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);
@@ -239,6 +248,19 @@ gimp_draw_tool_oper_update (GimpTool *tool,
}
}
+static void
+gimp_draw_tool_widget_snap_offsets (GimpToolWidget *widget,
+ gint offset_x,
+ gint offset_y,
+ gint width,
+ gint height,
+ GimpTool *tool)
+{
+ gimp_tool_control_set_snap_offsets (tool->control,
+ offset_x, offset_y,
+ width, height);
+}
+
#ifdef USE_TIMEOUT
static gboolean
gimp_draw_tool_draw_timeout (GimpDrawTool *draw_tool)
@@ -507,6 +529,10 @@ gimp_draw_tool_set_widget (GimpDrawTool *draw_tool,
if (draw_tool->widget)
{
+ g_signal_handlers_disconnect_by_func (draw_tool->widget,
+ gimp_draw_tool_widget_snap_offsets,
+ draw_tool);
+
if (gimp_draw_tool_is_active (draw_tool))
{
GimpCanvasItem *item = gimp_tool_widget_get_item (draw_tool->widget);
@@ -529,6 +555,10 @@ gimp_draw_tool_set_widget (GimpDrawTool *draw_tool,
gimp_draw_tool_add_item (draw_tool, item);
}
+
+ g_signal_connect (draw_tool->widget, "snap-offsets",
+ G_CALLBACK (gimp_draw_tool_widget_snap_offsets),
+ draw_tool);
}
}
diff --git a/app/tools/gimpperspectiveclonetool.c b/app/tools/gimpperspectiveclonetool.c
index 39886e4..dfb9d5a 100644
--- a/app/tools/gimpperspectiveclonetool.c
+++ b/app/tools/gimpperspectiveclonetool.c
@@ -115,13 +115,6 @@ static void gimp_perspective_clone_tool_recalc_matrix (GimpPerspectiveClone
static void gimp_perspective_clone_tool_widget_changed (GimpToolWidget *widget,
GimpPerspectiveCloneTool *clone_tool);
-static void gimp_perspective_clone_tool_widget_snap_offsets
- (GimpToolWidget *widget,
- gint offset_x,
- gint offset_y,
- gint width,
- gint height,
- GimpPerspectiveCloneTool *clone_tool);
static void gimp_perspective_clone_tool_widget_status (GimpToolWidget *widget,
const gchar *status,
GimpPerspectiveCloneTool *clone_tool);
@@ -238,9 +231,6 @@ gimp_perspective_clone_tool_initialize (GimpTool *tool,
g_signal_connect (clone_tool->widget, "changed",
G_CALLBACK (gimp_perspective_clone_tool_widget_changed),
clone_tool);
- g_signal_connect (clone_tool->widget, "snap-offsets",
- G_CALLBACK (gimp_perspective_clone_tool_widget_snap_offsets),
- clone_tool);
g_signal_connect (clone_tool->widget, "status",
G_CALLBACK (gimp_perspective_clone_tool_widget_status),
clone_tool);
@@ -828,21 +818,6 @@ gimp_perspective_clone_tool_widget_changed (GimpToolWidget *widget,
}
static void
-gimp_perspective_clone_tool_widget_snap_offsets (GimpToolWidget *widget,
- gint offset_x,
- gint offset_y,
- gint width,
- gint height,
- GimpPerspectiveCloneTool *clone_tool)
-{
- GimpTool *tool = GIMP_TOOL (clone_tool);
-
- gimp_tool_control_set_snap_offsets (tool->control,
- offset_x, offset_y,
- width, height);
-}
-
-static void
gimp_perspective_clone_tool_widget_status (GimpToolWidget *widget,
const gchar *status,
GimpPerspectiveCloneTool *clone_tool)
diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c
index 7d418c0..6cabb1b 100644
--- a/app/tools/gimptransformtool.c
+++ b/app/tools/gimptransformtool.c
@@ -124,12 +124,6 @@ static void gimp_transform_tool_widget_changed (GimpToolWidget
static void gimp_transform_tool_widget_response (GimpToolWidget *widget,
gint response_id,
GimpTransformTool *tr_tool);
-static void gimp_transform_tool_widget_snap_offsets (GimpToolWidget *widget,
- gint offset_x,
- gint offset_y,
- gint width,
- gint height,
- GimpTransformTool *tr_tool);
static void gimp_transform_tool_widget_status (GimpToolWidget *widget,
const gchar *status,
GimpTransformTool *tr_tool);
@@ -1080,21 +1074,6 @@ gimp_transform_tool_widget_response (GimpToolWidget *widget,
}
static void
-gimp_transform_tool_widget_snap_offsets (GimpToolWidget *widget,
- gint offset_x,
- gint offset_y,
- gint width,
- gint height,
- GimpTransformTool *tr_tool)
-{
- GimpTool *tool = GIMP_TOOL (tr_tool);
-
- gimp_tool_control_set_snap_offsets (tool->control,
- offset_x, offset_y,
- width, height);
-}
-
-static void
gimp_transform_tool_widget_status (GimpToolWidget *widget,
const gchar *status,
GimpTransformTool *tr_tool)
@@ -1347,9 +1326,6 @@ gimp_transform_tool_get_widget (GimpTransformTool *tr_tool)
g_signal_connect (widget, "response",
G_CALLBACK (gimp_transform_tool_widget_response),
tr_tool);
- g_signal_connect (widget, "snap-offsets",
- G_CALLBACK (gimp_transform_tool_widget_snap_offsets),
- tr_tool);
g_signal_connect (widget, "status",
G_CALLBACK (gimp_transform_tool_widget_status),
tr_tool);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]