Make Enter/Return apply the transformation, Backspace/Delete resets the

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

	* app/tools/gimptransformtool.c: Make Enter/Return apply the
	transformation, Backspace/Delete resets the transformation.

	* app/tools/gimpcroptool.c: Simplify the key_press callback.
This commit is contained in:
Simon Budig 2004-06-12 20:10:40 +00:00 committed by Simon Budig
parent 3fe1753e1a
commit d76b2183aa
3 changed files with 43 additions and 10 deletions

View File

@ -1,3 +1,10 @@
2004-06-12 Simon Budig <simon@gimp.org>
* app/tools/gimptransformtool.c: Make Enter/Return apply the
transformation, Backspace/Delete resets the transformation.
* app/tools/gimpcroptool.c: Simplify the key_press callback.
2004-06-12 Simon Budig <simon@gimp.org>
* app/tools/gimpcroptool.c: Make the Enter/Return key do

View File

@ -547,14 +547,7 @@ gimp_crop_tool_key_press (GimpTool *tool,
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);
crop_response (NULL, options->crop_mode, crop);
return;
default:
return;

View File

@ -21,6 +21,7 @@
#include <stdlib.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include "libgimpmath/gimpmath.h"
#include "libgimpwidgets/gimpwidgets.h"
@ -96,6 +97,9 @@ static void gimp_transform_tool_motion (GimpTool *tool,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp);
static void gimp_transform_tool_key_press (GimpTool *tool,
GdkEventKey *kevent,
GimpDisplay *gdisp);
static void gimp_transform_tool_modifier_key (GimpTool *tool,
GdkModifierType key,
gboolean press,
@ -193,6 +197,7 @@ gimp_transform_tool_class_init (GimpTransformToolClass *klass)
tool_class->button_press = gimp_transform_tool_button_press;
tool_class->button_release = gimp_transform_tool_button_release;
tool_class->motion = gimp_transform_tool_motion;
tool_class->key_press = gimp_transform_tool_key_press;
tool_class->modifier_key = gimp_transform_tool_modifier_key;
tool_class->oper_update = gimp_transform_tool_oper_update;
tool_class->cursor_update = gimp_transform_tool_cursor_update;
@ -493,6 +498,36 @@ gimp_transform_tool_motion (GimpTool *tool,
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
}
#define RESPONSE_RESET 1
static void
gimp_transform_tool_key_press (GimpTool *tool,
GdkEventKey *kevent,
GimpDisplay *gdisp)
{
GimpTransformTool *trans_tool = GIMP_TRANSFORM_TOOL (tool);
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
if (gdisp == draw_tool->gdisp)
{
switch (kevent->keyval)
{
case GDK_KP_Enter:
case GDK_Return:
gimp_transform_tool_response (NULL, GTK_RESPONSE_OK, trans_tool);
break;
case GDK_Delete:
case GDK_BackSpace:
gimp_transform_tool_response (NULL, RESPONSE_RESET, trans_tool);
break;
default:
break;
}
}
}
static void
gimp_transform_tool_modifier_key (GimpTool *tool,
GdkModifierType key,
@ -1242,8 +1277,6 @@ gimp_transform_tool_grid_recalc (GimpTransformTool *tr_tool)
}
}
#define RESPONSE_RESET 1
static void
gimp_transform_tool_dialog (GimpTransformTool *tr_tool)
{