From 3fe1753e1ae5b2fff5d7bee410a313ff89186cc3 Mon Sep 17 00:00:00 2001 From: Simon Budig Date: Sat, 12 Jun 2004 19:29:50 +0000 Subject: [PATCH] Make the Enter/Return key do the crop action. 2004-06-12 Simon Budig * app/tools/gimpcroptool.c: Make the Enter/Return key do the crop action. * app/tools/gimpeditselectiontool.c * app/tools/gimpvectortool.c: Make the _key_press functions safe for non-arrow keys. --- ChangeLog | 9 ++++++ app/tools/gimpcroptool.c | 29 +++++++++++++++--- app/tools/gimpeditselectiontool.c | 8 +++++ app/tools/gimpvectortool.c | 51 ++++++++++++++++++++----------- 4 files changed, 76 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index b7a4fe2c96..e6b74e55fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2004-06-12 Simon Budig + + * app/tools/gimpcroptool.c: Make the Enter/Return key do + the crop action. + + * app/tools/gimpeditselectiontool.c + * app/tools/gimpvectortool.c: Make the _key_press functions + safe for non-arrow keys. + 2004-06-12 Sven Neumann * app/composite/gimp-composite.[ch]: just some cleanup. diff --git a/app/tools/gimpcroptool.c b/app/tools/gimpcroptool.c index 0c912c231a..79a364f8e4 100644 --- a/app/tools/gimpcroptool.c +++ b/app/tools/gimpcroptool.c @@ -533,10 +533,31 @@ gimp_crop_tool_key_press (GimpTool *tool, switch (kevent->keyval) { - case GDK_Up : inc_y = -1; break; - case GDK_Left : inc_x = -1; break; - case GDK_Right : inc_x = 1; break; - case GDK_Down : inc_y = 1; break; + case GDK_Up: + inc_y = -1; + break; + case GDK_Left: + inc_x = -1; + break; + case GDK_Right: + inc_x = 1; + break; + case GDK_Down: + inc_y = 1; + break; + case GDK_KP_Enter: + case GDK_Return: + crop_tool_crop_image (gdisp->gimage, + GIMP_CONTEXT (options), + crop->x1, crop->y1, + crop->x2, crop->y2, + options->layer_only, + options->crop_mode); + /* Finish the tool */ + crop_response (NULL, GTK_RESPONSE_CANCEL, crop); + return; + default: + return; } /* If the shift key is down, move by an accelerated increment */ diff --git a/app/tools/gimpeditselectiontool.c b/app/tools/gimpeditselectiontool.c index ea514d8772..b04357bba9 100644 --- a/app/tools/gimpeditselectiontool.c +++ b/app/tools/gimpeditselectiontool.c @@ -1065,6 +1065,14 @@ gimp_edit_selection_tool_key_press (GimpTool *tool, GimpUndoType undo_type = GIMP_UNDO_GROUP_MASK; const gchar *undo_desc = NULL; + /* Bail out early if it is not an arrow key event */ + + if (kevent->keyval != GDK_Left && + kevent->keyval != GDK_Right && + kevent->keyval != GDK_Up && + kevent->keyval != GDK_Down) + return; + /* check for mask translation first because the translate_layer * modifiers match the translate_mask ones... */ diff --git a/app/tools/gimpvectortool.c b/app/tools/gimpvectortool.c index 25534bc59b..8b6555f14b 100644 --- a/app/tools/gimpvectortool.c +++ b/app/tools/gimpvectortool.c @@ -807,13 +807,6 @@ gimp_vector_tool_key_press (GimpTool *tool, if (gdisp == draw_tool->gdisp) { - xdist = FUNSCALEX (shell, pixels); - ydist = FUNSCALEY (shell, pixels); - - gimp_vector_tool_undo_push (vector_tool, _("Move Anchors")); - - gimp_vectors_freeze (vector_tool->vectors); - switch (kevent->keyval) { case GDK_KP_Enter: @@ -825,23 +818,47 @@ gimp_vector_tool_key_press (GimpTool *tool, case GDK_Delete: gimp_vector_tool_delete_selected_anchors (vector_tool); break; + case GDK_Left: - gimp_vector_tool_move_selected_anchors (vector_tool, -xdist, 0); - break; case GDK_Right: - gimp_vector_tool_move_selected_anchors (vector_tool, xdist, 0); - break; case GDK_Up: - gimp_vector_tool_move_selected_anchors (vector_tool, 0, -ydist); - break; case GDK_Down: - gimp_vector_tool_move_selected_anchors (vector_tool, 0, ydist); - break; + xdist = FUNSCALEX (shell, pixels); + ydist = FUNSCALEY (shell, pixels); + + gimp_vector_tool_undo_push (vector_tool, _("Move Anchors")); + + gimp_vectors_freeze (vector_tool->vectors); + + switch (kevent->keyval) + { + case GDK_Left: + gimp_vector_tool_move_selected_anchors (vector_tool, + -xdist, 0); + break; + case GDK_Right: + gimp_vector_tool_move_selected_anchors (vector_tool, + xdist, 0); + break; + case GDK_Up: + gimp_vector_tool_move_selected_anchors (vector_tool, + 0, -ydist); + break; + case GDK_Down: + gimp_vector_tool_move_selected_anchors (vector_tool, + 0, ydist); + break; + default: + break; + } + + gimp_vectors_thaw (vector_tool->vectors); + vector_tool->have_undo = FALSE; + break; + default: break; } - gimp_vectors_thaw (vector_tool->vectors); - vector_tool->have_undo = FALSE; gimp_image_flush (gdisp->gimage); }