[gimp] app: In GimpBlendTool, don't start the draw tool too early.
- From: Michael Henning <mhenning src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: In GimpBlendTool, don't start the draw tool too early.
- Date: Tue, 2 Sep 2014 22:58:36 +0000 (UTC)
commit 36d719c9862892ec64383699e7778264f06dd4be
Author: Michael Henning <drawoc darkrefraction com>
Date: Tue Sep 2 18:49:41 2014 -0400
app: In GimpBlendTool, don't start the draw tool too early.
Also simplify some related logic and rename related functions to
be clearer.
app/tools/gimpblendtool.c | 128 +++++++++++++++++++-------------------------
1 files changed, 55 insertions(+), 73 deletions(-)
---
diff --git a/app/tools/gimpblendtool.c b/app/tools/gimpblendtool.c
index 540d2ae..07924dc 100644
--- a/app/tools/gimpblendtool.c
+++ b/app/tools/gimpblendtool.c
@@ -115,9 +115,9 @@ static void gimp_blend_tool_update_item_hilight (GimpBlendTool *blend_
static GimpBlendToolPoint gimp_blend_tool_get_point_under_cursor (GimpBlendTool *blend_tool);
-static void gimp_blend_tool_start (GimpBlendTool *bt,
+static void gimp_blend_tool_start_preview (GimpBlendTool *bt,
GimpDisplay *display);
-static void gimp_blend_tool_halt (GimpBlendTool *bt);
+static void gimp_blend_tool_halt_preview (GimpBlendTool *bt);
static void gimp_blend_tool_commit (GimpBlendTool *bt);
static void gimp_blend_tool_push_status (GimpBlendTool *blend_tool,
@@ -274,7 +274,7 @@ gimp_blend_tool_control (GimpTool *tool,
break;
case GIMP_TOOL_ACTION_HALT:
- gimp_blend_tool_halt (blend_tool);
+ gimp_blend_tool_halt_preview (blend_tool);
break;
case GIMP_TOOL_ACTION_COMMIT:
@@ -316,7 +316,7 @@ gimp_blend_tool_button_press (GimpTool *tool,
if (tool->display && display != tool->display)
{
gimp_tool_pop_status (tool, tool->display);
- gimp_blend_tool_halt (blend_tool);
+ gimp_blend_tool_halt_preview (blend_tool);
}
blend_tool->grabbed_point = gimp_blend_tool_get_point_under_cursor (blend_tool);
@@ -345,14 +345,6 @@ gimp_blend_tool_button_press (GimpTool *tool,
gimp_blend_tool_point_motion (blend_tool,
state & gimp_get_constrain_behavior_mask ());
- /*
- * gimp_blend_tool_start comes after determining what point is grabbed, so
- * whenever we're starting the tool, gimp_blend_tool_get_point_under_cursor()
- * returns POINT_NONE
- */
- if (! tool->display)
- gimp_blend_tool_start (blend_tool, display);
-
tool->display = display;
gimp_blend_tool_update_items (blend_tool);
@@ -419,11 +411,8 @@ gimp_blend_tool_motion (GimpTool *tool,
if (blend_tool->grabbed_point == POINT_INIT_MODE)
{
- GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (blend_tool);
-
- gimp_draw_tool_pause (draw_tool);
blend_tool->grabbed_point = POINT_END;
- gimp_draw_tool_resume (draw_tool);
+ gimp_blend_tool_start_preview (blend_tool, display);
}
/* Move the whole line if alt is pressed */
@@ -447,8 +436,7 @@ gimp_blend_tool_motion (GimpTool *tool,
gimp_tool_pop_status (tool, display);
gimp_blend_tool_push_status (blend_tool, state, display);
- if (GIMP_IS_CANVAS_LINE (blend_tool->line))
- gimp_blend_tool_update_items (blend_tool);
+ gimp_blend_tool_update_items (blend_tool);
gimp_blend_tool_update_preview_coords (blend_tool);
gimp_image_map_apply (blend_tool->image_map, NULL);
@@ -584,64 +572,58 @@ gimp_blend_tool_draw (GimpDrawTool *draw_tool)
{
GimpBlendTool *blend_tool = GIMP_BLEND_TOOL (draw_tool);
- if (blend_tool->grabbed_point != POINT_FILL_MODE &&
- blend_tool->grabbed_point != POINT_INIT_MODE)
- {
- blend_tool->line =
- gimp_draw_tool_add_line (draw_tool,
- blend_tool->start_x,
- blend_tool->start_y,
- blend_tool->end_x,
- blend_tool->end_y);
-
- gimp_canvas_item_set_visible (blend_tool->line, SHOW_LINE);
-
- blend_tool->start_handle_circle =
- gimp_draw_tool_add_handle (draw_tool,
- GIMP_HANDLE_CIRCLE,
- blend_tool->start_x,
- blend_tool->start_y,
- HANDLE_DIAMETER,
- HANDLE_DIAMETER,
- GIMP_HANDLE_ANCHOR_CENTER);
-
- blend_tool->start_handle_cross =
- gimp_draw_tool_add_handle (draw_tool,
- GIMP_HANDLE_CROSS,
- blend_tool->start_x,
- blend_tool->start_y,
- HANDLE_CROSS_DIAMETER,
- HANDLE_CROSS_DIAMETER,
- GIMP_HANDLE_ANCHOR_CENTER);
-
- blend_tool->end_handle_circle =
- gimp_draw_tool_add_handle (draw_tool,
- GIMP_HANDLE_CIRCLE,
- blend_tool->end_x,
- blend_tool->end_y,
- HANDLE_DIAMETER,
- HANDLE_DIAMETER,
- GIMP_HANDLE_ANCHOR_CENTER);
-
- blend_tool->end_handle_cross =
- gimp_draw_tool_add_handle (draw_tool,
- GIMP_HANDLE_CROSS,
- blend_tool->end_x,
- blend_tool->end_y,
- HANDLE_CROSS_DIAMETER,
- HANDLE_CROSS_DIAMETER,
- GIMP_HANDLE_ANCHOR_CENTER);
+ blend_tool->line =
+ gimp_draw_tool_add_line (draw_tool,
+ blend_tool->start_x,
+ blend_tool->start_y,
+ blend_tool->end_x,
+ blend_tool->end_y);
+
+ gimp_canvas_item_set_visible (blend_tool->line, SHOW_LINE);
+
+ blend_tool->start_handle_circle =
+ gimp_draw_tool_add_handle (draw_tool,
+ GIMP_HANDLE_CIRCLE,
+ blend_tool->start_x,
+ blend_tool->start_y,
+ HANDLE_DIAMETER,
+ HANDLE_DIAMETER,
+ GIMP_HANDLE_ANCHOR_CENTER);
+
+ blend_tool->start_handle_cross =
+ gimp_draw_tool_add_handle (draw_tool,
+ GIMP_HANDLE_CROSS,
+ blend_tool->start_x,
+ blend_tool->start_y,
+ HANDLE_CROSS_DIAMETER,
+ HANDLE_CROSS_DIAMETER,
+ GIMP_HANDLE_ANCHOR_CENTER);
+
+ blend_tool->end_handle_circle =
+ gimp_draw_tool_add_handle (draw_tool,
+ GIMP_HANDLE_CIRCLE,
+ blend_tool->end_x,
+ blend_tool->end_y,
+ HANDLE_DIAMETER,
+ HANDLE_DIAMETER,
+ GIMP_HANDLE_ANCHOR_CENTER);
+
+ blend_tool->end_handle_cross =
+ gimp_draw_tool_add_handle (draw_tool,
+ GIMP_HANDLE_CROSS,
+ blend_tool->end_x,
+ blend_tool->end_y,
+ HANDLE_CROSS_DIAMETER,
+ HANDLE_CROSS_DIAMETER,
+ GIMP_HANDLE_ANCHOR_CENTER);
- gimp_blend_tool_update_item_hilight (blend_tool);
- }
+ gimp_blend_tool_update_item_hilight (blend_tool);
}
static void
gimp_blend_tool_update_items (GimpBlendTool *blend_tool)
{
- if (gimp_draw_tool_is_active (GIMP_DRAW_TOOL (blend_tool)) &&
- blend_tool->grabbed_point != POINT_FILL_MODE &&
- blend_tool->grabbed_point != POINT_INIT_MODE)
+ if (gimp_draw_tool_is_active (GIMP_DRAW_TOOL (blend_tool)))
{
gimp_canvas_line_set (blend_tool->line,
blend_tool->start_x,
@@ -765,8 +747,8 @@ gimp_blend_tool_get_point_under_cursor (GimpBlendTool *blend_tool)
}
static void
-gimp_blend_tool_start (GimpBlendTool *blend_tool,
- GimpDisplay *display)
+gimp_blend_tool_start_preview (GimpBlendTool *blend_tool,
+ GimpDisplay *display)
{
GimpTool *tool = GIMP_TOOL (blend_tool);
GimpImage *image = gimp_display_get_image (display);
@@ -793,7 +775,7 @@ gimp_blend_tool_start (GimpBlendTool *blend_tool,
}
static void
-gimp_blend_tool_halt (GimpBlendTool *blend_tool)
+gimp_blend_tool_halt_preview (GimpBlendTool *blend_tool)
{
GimpTool *tool = GIMP_TOOL (blend_tool);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]