Make the Enter/Return key do the crop action.

2004-06-12  Simon Budig  <simon@gimp.org>

	* 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.
This commit is contained in:
Simon Budig 2004-06-12 19:29:50 +00:00 committed by Simon Budig
parent 25855661f6
commit 3fe1753e1a
4 changed files with 76 additions and 21 deletions

View File

@ -1,3 +1,12 @@
2004-06-12 Simon Budig <simon@gimp.org>
* 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 <sven@gimp.org>
* app/composite/gimp-composite.[ch]: just some cleanup.

View File

@ -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 */

View File

@ -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...
*/

View File

@ -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);
}