From f7bfea19d9eee16cad32cd3c80a8f4725fe411fd Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Thu, 8 Feb 2007 09:54:09 +0000 Subject: [PATCH] Unbreak rectangle select tool undo handling a bit: 2007-02-08 Michael Natterer Unbreak rectangle select tool undo handling a bit: * app/tools/gimprectangleselecttool.c (gimp_rect_select_tool_select): add boolean return value indicating if something was actually selected. (gimp_rect_select_tool_rectangle_changed): peek the newly pushed undo only if we selected something. svn path=/trunk/; revision=21866 --- ChangeLog | 10 ++++++++++ app/tools/gimprectangleselecttool.c | 19 ++++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 18b350544a..5ae2950980 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2007-02-08 Michael Natterer + + Unbreak rectangle select tool undo handling a bit: + + * app/tools/gimprectangleselecttool.c (gimp_rect_select_tool_select): + add boolean return value indicating if something was actually selected. + + (gimp_rect_select_tool_rectangle_changed): peek the newly pushed + undo only if we selected something. + 2007-02-08 Sven Neumann * libgimpwidgets/gimpratioentry.[ch]: added history and completion. diff --git a/app/tools/gimprectangleselecttool.c b/app/tools/gimprectangleselecttool.c index e812b4f887..db421621de 100644 --- a/app/tools/gimprectangleselecttool.c +++ b/app/tools/gimprectangleselecttool.c @@ -91,7 +91,7 @@ static void gimp_rect_select_tool_cursor_update (GimpTool *to GdkModifierType state, GimpDisplay *display); static void gimp_rect_select_tool_draw (GimpDrawTool *draw_tool); -static void gimp_rect_select_tool_select (GimpRectangleTool *rect_tool, +static gboolean gimp_rect_select_tool_select (GimpRectangleTool *rect_tool, gint x, gint y, gint w, @@ -483,7 +483,7 @@ gimp_rect_select_tool_cursor_update (GimpTool *tool, } -static void +static gboolean gimp_rect_select_tool_select (GimpRectangleTool *rectangle, gint x, gint y, @@ -517,6 +517,8 @@ gimp_rect_select_tool_select (GimpRectangleTool *rectangle, GIMP_RECT_SELECT_TOOL_GET_CLASS (rect_select)->select (rect_select, operation, x, y, w, h); + + return rectangle_exists; } static void @@ -743,11 +745,14 @@ gimp_rect_select_tool_rectangle_changed (GimpRectangleTool *rectangle) "y2", &y2, NULL); - gimp_rect_select_tool_select (rectangle, x1, y1, x2 - x1, y2 - y1); - - /* save the undo that we got when executing */ - rect_select->undo = gimp_undo_stack_peek (image->undo_stack); - rect_select->redo = NULL; + if (gimp_rect_select_tool_select (rectangle, x1, y1, x2 - x1, y2 - y1)) + { + /* save the undo that we got when executing, but only if + * we actually selected something + */ + rect_select->undo = gimp_undo_stack_peek (image->undo_stack); + rect_select->redo = NULL; + } if (! rect_select->use_saved_op) {