[gimp] app: connect to GimpToolWidget::status and ::status-coords in GimpDrawTool
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: connect to GimpToolWidget::status and ::status-coords in GimpDrawTool
- Date: Mon, 26 Jun 2017 18:49:54 +0000 (UTC)
commit a89e6eeaea080548725debb4647d346118409530
Author: Michael Natterer <mitch gimp org>
Date: Mon Jun 26 20:49:14 2017 +0200
app: connect to GimpToolWidget::status and ::status-coords in GimpDrawTool
and remove the callbacks from subclasses.
app/tools/gimpcroptool.c | 50 -----------------
app/tools/gimpdrawtool.c | 117 +++++++++++++++++++++++++++++----------
app/tools/gimpfreeselecttool.c | 23 --------
app/tools/gimptransformtool.c | 23 --------
app/tools/gimpvectortool.c | 23 --------
5 files changed, 87 insertions(+), 149 deletions(-)
---
diff --git a/app/tools/gimpcroptool.c b/app/tools/gimpcroptool.c
index 7d45e08..d1dc647 100644
--- a/app/tools/gimpcroptool.c
+++ b/app/tools/gimpcroptool.c
@@ -84,16 +84,6 @@ static void gimp_crop_tool_rectangle_changed (GimpToolWidget
static void gimp_crop_tool_rectangle_response (GimpToolWidget *rectangle,
gint response_id,
GimpCropTool *crop_tool);
-static void gimp_crop_tool_rectangle_status (GimpToolWidget *rectangle,
- const gchar *status,
- GimpCropTool *crop_tool);
-static void gimp_crop_tool_rectangle_status_coords (GimpToolWidget *rectangle,
- const gchar *title,
- gdouble x,
- const gchar *separator,
- gdouble y,
- const gchar *help,
- GimpCropTool *crop_tool);
static void gimp_crop_tool_rectangle_change_complete (GimpToolRectangle *rectangle,
GimpCropTool *crop_tool);
@@ -273,12 +263,6 @@ gimp_crop_tool_button_press (GimpTool *tool,
g_signal_connect (widget, "response",
G_CALLBACK (gimp_crop_tool_rectangle_response),
crop_tool);
- g_signal_connect (widget, "status",
- G_CALLBACK (gimp_crop_tool_rectangle_status),
- crop_tool);
- g_signal_connect (widget, "status-coords",
- G_CALLBACK (gimp_crop_tool_rectangle_status_coords),
- crop_tool);
g_signal_connect (widget, "change-complete",
G_CALLBACK (gimp_crop_tool_rectangle_change_complete),
crop_tool);
@@ -433,40 +417,6 @@ gimp_crop_tool_rectangle_response (GimpToolWidget *rectangle,
}
static void
-gimp_crop_tool_rectangle_status (GimpToolWidget *rectangle,
- const gchar *status,
- GimpCropTool *crop_tool)
-{
- GimpTool *tool = GIMP_TOOL (crop_tool);
-
- if (status)
- {
- gimp_tool_replace_status (tool, tool->display, "%s", status);
- }
- else
- {
- gimp_tool_pop_status (tool, tool->display);
- }
-}
-
-static void
-gimp_crop_tool_rectangle_status_coords (GimpToolWidget *rectangle,
- const gchar *title,
- gdouble x,
- const gchar *separator,
- gdouble y,
- const gchar *help,
- GimpCropTool *crop_tool)
-{
- GimpTool *tool = GIMP_TOOL (crop_tool);
-
- gimp_tool_pop_status (tool, tool->display);
- gimp_tool_push_status_coords (tool, tool->display,
- gimp_tool_control_get_precision (tool->control),
- title, x, separator, y, help);
-}
-
-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 afefeb2..5b28db4 100644
--- a/app/tools/gimpdrawtool.c
+++ b/app/tools/gimpdrawtool.c
@@ -60,38 +60,49 @@
#define MINIMUM_DRAW_INTERVAL 50000 /* 50000 microseconds == 20 fps */
-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_key_press (GimpTool *tool,
- GdkEventKey *kevent,
- GimpDisplay *display);
-static gboolean gimp_draw_tool_key_release (GimpTool *tool,
- GdkEventKey *kevent,
- GimpDisplay *display);
-static void gimp_draw_tool_oper_update (GimpTool *tool,
- const GimpCoords *coords,
- GdkModifierType state,
- gboolean proximity,
- GimpDisplay *display);
-
+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_key_press (GimpTool *tool,
+ GdkEventKey *kevent,
+ GimpDisplay *display);
+static gboolean gimp_draw_tool_key_release (GimpTool *tool,
+ GdkEventKey *kevent,
+ GimpDisplay *display);
+static void gimp_draw_tool_oper_update (GimpTool *tool,
+ const GimpCoords *coords,
+ GdkModifierType state,
+ gboolean proximity,
+ GimpDisplay *display);
+
+static void gimp_draw_tool_widget_status (GimpToolWidget *widget,
+ const gchar *status,
+ GimpTool *tool);
+static void gimp_draw_tool_widget_status_coords
+ (GimpToolWidget *widget,
+ const gchar *title,
+ gdouble x,
+ const gchar *separator,
+ gdouble y,
+ const gchar *help,
+ GimpTool *tool);
static void gimp_draw_tool_widget_snap_offsets
- (GimpToolWidget *widget,
- gint offset_x,
- gint offset_y,
- gint width,
- gint height,
- GimpTool *tool);
+ (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);
+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);
G_DEFINE_TYPE (GimpDrawTool, gimp_draw_tool, GIMP_TYPE_TOOL)
@@ -249,6 +260,40 @@ gimp_draw_tool_oper_update (GimpTool *tool,
}
static void
+gimp_draw_tool_widget_status (GimpToolWidget *rectangle,
+ const gchar *status,
+ GimpTool *tool)
+{
+ GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
+
+ if (status)
+ {
+ gimp_tool_replace_status (tool, draw_tool->display, "%s", status);
+ }
+ else
+ {
+ gimp_tool_pop_status (tool, draw_tool->display);
+ }
+}
+
+static void
+gimp_draw_tool_widget_status_coords (GimpToolWidget *rectangle,
+ const gchar *title,
+ gdouble x,
+ const gchar *separator,
+ gdouble y,
+ const gchar *help,
+ GimpTool *tool)
+{
+ GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
+
+ gimp_tool_pop_status (tool, draw_tool->display);
+ gimp_tool_push_status_coords (tool, draw_tool->display,
+ gimp_tool_control_get_precision (tool->control),
+ title, x, separator, y, help);
+}
+
+static void
gimp_draw_tool_widget_snap_offsets (GimpToolWidget *widget,
gint offset_x,
gint offset_y,
@@ -530,6 +575,12 @@ 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_status,
+ draw_tool);
+ g_signal_handlers_disconnect_by_func (draw_tool->widget,
+ gimp_draw_tool_widget_status_coords,
+ draw_tool);
+ g_signal_handlers_disconnect_by_func (draw_tool->widget,
gimp_draw_tool_widget_snap_offsets,
draw_tool);
@@ -556,6 +607,12 @@ gimp_draw_tool_set_widget (GimpDrawTool *draw_tool,
gimp_draw_tool_add_item (draw_tool, item);
}
+ g_signal_connect (draw_tool->widget, "status",
+ G_CALLBACK (gimp_draw_tool_widget_status),
+ draw_tool);
+ g_signal_connect (draw_tool->widget, "status-coords",
+ G_CALLBACK (gimp_draw_tool_widget_status_coords),
+ draw_tool);
g_signal_connect (draw_tool->widget, "snap-offsets",
G_CALLBACK (gimp_draw_tool_widget_snap_offsets),
draw_tool);
diff --git a/app/tools/gimpfreeselecttool.c b/app/tools/gimpfreeselecttool.c
index 6f0f14f..212bce5 100644
--- a/app/tools/gimpfreeselecttool.c
+++ b/app/tools/gimpfreeselecttool.c
@@ -108,9 +108,6 @@ static void gimp_free_select_tool_polygon_changed (GimpToolWidget
static void gimp_free_select_tool_polygon_response (GimpToolWidget *polygon,
gint response_id,
GimpFreeSelectTool *fst);
-static void gimp_free_select_tool_polygon_status (GimpToolWidget *polygon,
- const gchar *status,
- GimpFreeSelectTool *fst);
G_DEFINE_TYPE (GimpFreeSelectTool, gimp_free_select_tool,
@@ -343,9 +340,6 @@ gimp_free_select_tool_button_press (GimpTool *tool,
g_signal_connect (private->polygon, "response",
G_CALLBACK (gimp_free_select_tool_polygon_response),
fst);
- g_signal_connect (private->polygon, "status",
- G_CALLBACK (gimp_free_select_tool_polygon_status),
- fst);
gimp_draw_tool_start (draw_tool, display);
@@ -520,20 +514,3 @@ gimp_free_select_tool_polygon_response (GimpToolWidget *polygon,
break;
}
}
-
-static void
-gimp_free_select_tool_polygon_status (GimpToolWidget *polygon,
- const gchar *status,
- GimpFreeSelectTool *fst)
-{
- GimpTool *tool = GIMP_TOOL (fst);
-
- if (status)
- {
- gimp_tool_replace_status (tool, tool->display, "%s", status);
- }
- else
- {
- gimp_tool_pop_status (tool, tool->display);
- }
-}
diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c
index 6cabb1b..dd65115 100644
--- a/app/tools/gimptransformtool.c
+++ b/app/tools/gimptransformtool.c
@@ -124,9 +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_status (GimpToolWidget *widget,
- const gchar *status,
- GimpTransformTool *tr_tool);
static void gimp_transform_tool_halt (GimpTransformTool *tr_tool);
static gboolean gimp_transform_tool_bounds (GimpTransformTool *tr_tool,
@@ -1074,23 +1071,6 @@ gimp_transform_tool_widget_response (GimpToolWidget *widget,
}
static void
-gimp_transform_tool_widget_status (GimpToolWidget *widget,
- const gchar *status,
- GimpTransformTool *tr_tool)
-{
- GimpTool *tool = GIMP_TOOL (tr_tool);
-
- if (status)
- {
- gimp_tool_replace_status (tool, tool->display, "%s", status);
- }
- else
- {
- gimp_tool_pop_status (tool, tool->display);
- }
-}
-
-static void
gimp_transform_tool_halt (GimpTransformTool *tr_tool)
{
GimpTool *tool = GIMP_TOOL (tr_tool);
@@ -1326,9 +1306,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, "status",
- G_CALLBACK (gimp_transform_tool_widget_status),
- tr_tool);
}
return widget;
diff --git a/app/tools/gimpvectortool.c b/app/tools/gimpvectortool.c
index c221194..923c5f9 100644
--- a/app/tools/gimpvectortool.c
+++ b/app/tools/gimpvectortool.c
@@ -104,9 +104,6 @@ static void gimp_vector_tool_halt (GimpVectorTool *vector_
static void gimp_vector_tool_path_changed (GimpToolWidget *path,
GimpVectorTool *vector_tool);
-static void gimp_vector_tool_path_status (GimpToolWidget *path,
- const gchar *status,
- GimpVectorTool *vector_tool);
static void gimp_vector_tool_path_begin_change
(GimpToolWidget *path,
const gchar *desc,
@@ -415,9 +412,6 @@ gimp_vector_tool_start (GimpVectorTool *vector_tool,
g_signal_connect (widget, "changed",
G_CALLBACK (gimp_vector_tool_path_changed),
vector_tool);
- g_signal_connect (widget, "status",
- G_CALLBACK (gimp_vector_tool_path_status),
- vector_tool);
g_signal_connect (widget, "begin-change",
G_CALLBACK (gimp_vector_tool_path_begin_change),
vector_tool);
@@ -484,23 +478,6 @@ gimp_vector_tool_path_changed (GimpToolWidget *path,
}
static void
-gimp_vector_tool_path_status (GimpToolWidget *path,
- const gchar *status,
- GimpVectorTool *vector_tool)
-{
- GimpTool *tool = GIMP_TOOL (vector_tool);
-
- if (status)
- {
- gimp_tool_replace_status (tool, tool->display, "%s", status);
- }
- else
- {
- gimp_tool_pop_status (tool, tool->display);
- }
-}
-
-static void
gimp_vector_tool_path_begin_change (GimpToolWidget *path,
const gchar *desc,
GimpVectorTool *vector_tool)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]