From fc9c7fa36a9d30cb7639f9db34f6b82602b42e31 Mon Sep 17 00:00:00 2001 From: Pere Pujal i Carabantes Date: Wed, 18 May 2011 19:53:48 +0000 Subject: [PATCH] Fixing #300881 AKA drawing shapes at release. Removing ghost previews if you try to change the current shape before completing it. --- src/tuxpaint.c | 48 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/src/tuxpaint.c b/src/tuxpaint.c index fb5767bc4..c4b3d1a69 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -4274,6 +4274,14 @@ static void mainloop(void) { cur_shape = cur_thing; + /* Remove ghost previews an reset the tool */ + if(shape_tool_mode != SHAPE_TOOL_MODE_DONE) + { + shape_tool_mode = SHAPE_TOOL_MODE_DONE; + update_canvas(0, 0, canvas->w, canvas->h); + } + + draw_tux_text(TUX_GREAT, shape_tips[cur_shape], 1); if (do_draw) @@ -4482,19 +4490,23 @@ static void mainloop(void) { /* Draw the shape with the brush! */ - /* (Arbitrarily large...) */ - reset_brush_counter(); + /* Only draw here in mouse accessibility mode as there IS a mouse */ + /* See #300881 for the reasons that this is deplaced to draw in mouse release */ + if(mouseaccessibility) + { + /* (Arbitrarily large...) */ + reset_brush_counter(); - playsound(screen, 1, SND_LINE_END, 1, event.button.x, - SNDDIST_NEAR); - do_shape(shape_ctr_x, shape_ctr_y, shape_outer_x, shape_outer_y, - shape_rotation(shape_ctr_x, shape_ctr_y, - event.button.x - r_canvas.x, - event.button.y - r_canvas.y), 1); - - shape_tool_mode = SHAPE_TOOL_MODE_DONE; - draw_tux_text(TUX_GREAT, tool_tips[TOOL_SHAPES], 1); + playsound(screen, 1, SND_LINE_END, 1, event.button.x, + SNDDIST_NEAR); + do_shape(shape_ctr_x, shape_ctr_y, shape_outer_x, shape_outer_y, + shape_rotation(shape_ctr_x, shape_ctr_y, + event.button.x - r_canvas.x, + event.button.y - r_canvas.y), 1); + shape_tool_mode = SHAPE_TOOL_MODE_DONE; + draw_tux_text(TUX_GREAT, tool_tips[TOOL_SHAPES], 1); + } } else if (shape_tool_mode == SHAPE_TOOL_MODE_STRETCH) /* Only reached in accessibility mode */ @@ -5014,6 +5026,20 @@ static void mainloop(void) draw_tux_text(TUX_GREAT, tool_tips[TOOL_SHAPES], 1); } } + else if (shape_tool_mode == SHAPE_TOOL_MODE_ROTATE) + { + reset_brush_counter(); + + playsound(screen, 1, SND_LINE_END, 1, event.button.x, + SNDDIST_NEAR); + do_shape(shape_ctr_x, shape_ctr_y, shape_outer_x, shape_outer_y, + shape_rotation(shape_ctr_x, shape_ctr_y, + event.button.x - r_canvas.x, + event.button.y - r_canvas.y), 1); + + shape_tool_mode = SHAPE_TOOL_MODE_DONE; + draw_tux_text(TUX_GREAT, tool_tips[TOOL_SHAPES], 1); + } } } else if (cur_tool == TOOL_MAGIC && (magics[cur_magic].mode == MODE_PAINT || magics[cur_magic].mode == MODE_ONECLICK || magics[cur_magic].mode == MODE_PAINT_WITH_PREVIEW))