From 3a2cbab0dbd3ce3429a0dd6ca101b9637e9cfb99 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Mon, 14 Apr 2008 12:50:21 +0000 Subject: [PATCH] simplify and fix logic to do the "right" thing. Hard to describe, try 2008-04-14 Michael Natterer * app/tools/gimppolygonselecttool.c (gimp_polygon_select_tool_button_release): simplify and fix logic to do the "right" thing. Hard to describe, try youself ;) svn path=/trunk/; revision=25485 --- ChangeLog | 6 ++++ app/tools/gimppolygonselecttool.c | 59 +++++++++++++++---------------- 2 files changed, 34 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1307f8802f..d12d85c726 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-04-14 Michael Natterer + + * app/tools/gimppolygonselecttool.c + (gimp_polygon_select_tool_button_release): simplify and fix logic + to do the "right" thing. Hard to describe, try youself ;) + 2008-04-14 Sven Neumann * app/display/gimpstatusbar.c: introduced a #define for the spacing diff --git a/app/tools/gimppolygonselecttool.c b/app/tools/gimppolygonselecttool.c index aa4c420586..f1bc166464 100644 --- a/app/tools/gimppolygonselecttool.c +++ b/app/tools/gimppolygonselecttool.c @@ -389,31 +389,6 @@ gimp_polygon_select_tool_button_release (GimpTool *tool, switch (release_type) { - case GIMP_BUTTON_RELEASE_CLICK: - if (gimp_polygon_select_tool_should_close (poly_sel_tool, - display, - coords)) - { - gimp_polygon_select_tool_commit (poly_sel_tool, display); - break; - } - - /* Fall through */ - - case GIMP_BUTTON_RELEASE_NORMAL: - if (! poly_sel_tool->grabbed_point) - { - gimp_polygon_select_tool_add_point (poly_sel_tool, - coords->x, coords->y); - } - else - { - /* We don't need to do anything since the grabbed point have - * already been moved in _motion. - */ - } - break; - case GIMP_BUTTON_RELEASE_CANCEL: if (poly_sel_tool->grabbed_point) { @@ -422,16 +397,38 @@ gimp_polygon_select_tool_button_release (GimpTool *tool, break; case GIMP_BUTTON_RELEASE_NO_MOTION: - if (gimp_image_floating_sel (display->image)) + if (poly_sel_tool->n_points == 0) { - /* If there is a floating selection, anchor it */ - floating_sel_anchor (gimp_image_floating_sel (display->image)); + if (gimp_image_floating_sel (display->image)) + { + /* If there is a floating selection, anchor it */ + floating_sel_anchor (gimp_image_floating_sel (display->image)); + } + else + { + /* Otherwise, clear the selection mask */ + gimp_channel_clear (gimp_image_get_mask (display->image), NULL, TRUE); + } + + gimp_image_flush (display->image); + break; } - else + + /* else fall through */ + + default: + if (gimp_polygon_select_tool_should_close (poly_sel_tool, + display, + coords)) { - /* Otherwise, clear the selection mask */ - gimp_channel_clear (gimp_image_get_mask (display->image), NULL, TRUE); + gimp_polygon_select_tool_commit (poly_sel_tool, display); } + else if (! poly_sel_tool->grabbed_point) + { + gimp_polygon_select_tool_add_point (poly_sel_tool, + coords->x, coords->y); + } + break; }