Commit dbd941c9 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

dispatch GDK_Escape to GimpTool::key_press().

2004-10-01  Michael Natterer  <mitch@gimp.org>

	* app/display/gimpdisplayshell-callbacks.c
	(gimp_display_shell_tool_events): dispatch GDK_Escape to
	GimpTool::key_press().

	* app/tools/gimpcroptool.c (gimp_crop_tool_key_press)
	* app/tools/gimpimagemaptool.c (gimp_image_map_tool_key_press):
	* app/tools/gimptransformtool.c (gimp_transform_tool_key_press):
	cancel the tool on <Escape>.
parent 9925247a
2004-10-01 Michael Natterer <mitch@gimp.org>
* app/display/gimpdisplayshell-callbacks.c
(gimp_display_shell_tool_events): dispatch GDK_Escape to
GimpTool::key_press().
* app/tools/gimpcroptool.c (gimp_crop_tool_key_press)
* app/tools/gimpimagemaptool.c (gimp_image_map_tool_key_press):
* app/tools/gimptransformtool.c (gimp_transform_tool_key_press):
cancel the tool on <Escape>.
2004-10-01 Sven Neumann <sven@gimp.org>
* plug-ins/dbbrowser/plugin-browser.c: it's Plug-In, not Plugin.
......
......@@ -1187,6 +1187,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
case GDK_KP_Enter:
case GDK_BackSpace:
case GDK_Delete:
case GDK_Escape:
case GDK_Left:
case GDK_Right:
case GDK_Up:
......
......@@ -537,6 +537,10 @@ gimp_crop_tool_key_press (GimpTool *tool,
crop_response (NULL, options->crop_mode, crop);
return TRUE;
case GDK_Escape:
crop_response (NULL, GTK_RESPONSE_CANCEL, crop);
return TRUE;
default:
return FALSE;
}
......
......@@ -22,6 +22,7 @@
#include <errno.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpwidgets/gimpwidgets.h"
......@@ -63,6 +64,9 @@ static gboolean gimp_image_map_tool_initialize (GimpTool *tool,
static void gimp_image_map_tool_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *gdisp);
static gboolean gimp_image_map_tool_key_press (GimpTool *tool,
GdkEventKey *kevent,
GimpDisplay *gdisp);
static gboolean gimp_image_map_tool_pick_color (GimpColorTool *color_tool,
gint x,
......@@ -138,6 +142,7 @@ gimp_image_map_tool_class_init (GimpImageMapToolClass *klass)
tool_class->initialize = gimp_image_map_tool_initialize;
tool_class->control = gimp_image_map_tool_control;
tool_class->key_press = gimp_image_map_tool_key_press;
color_tool_class->pick = gimp_image_map_tool_pick_color;
......@@ -316,6 +321,36 @@ gimp_image_map_tool_control (GimpTool *tool,
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
}
static gboolean
gimp_image_map_tool_key_press (GimpTool *tool,
GdkEventKey *kevent,
GimpDisplay *gdisp)
{
GimpImageMapTool *image_map_tool = GIMP_IMAGE_MAP_TOOL (tool);
if (gdisp == tool->gdisp)
{
switch (kevent->keyval)
{
case GDK_KP_Enter:
case GDK_Return:
gimp_image_map_tool_response (NULL, GTK_RESPONSE_OK, image_map_tool);
return TRUE;
case GDK_Delete:
case GDK_BackSpace:
gimp_image_map_tool_response (NULL, RESPONSE_RESET, image_map_tool);
return TRUE;
case GDK_Escape:
gimp_image_map_tool_response (NULL, GTK_RESPONSE_CANCEL, image_map_tool);
return TRUE;
}
}
return FALSE;
}
static gboolean
gimp_image_map_tool_pick_color (GimpColorTool *color_tool,
gint x,
......
......@@ -530,7 +530,7 @@ gimp_transform_tool_key_press (GimpTool *tool,
GimpDisplay *gdisp)
{
GimpTransformTool *trans_tool = GIMP_TRANSFORM_TOOL (tool);
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
if (gdisp == draw_tool->gdisp)
{
......@@ -545,6 +545,10 @@ gimp_transform_tool_key_press (GimpTool *tool,
case GDK_BackSpace:
gimp_transform_tool_response (NULL, RESPONSE_RESET, trans_tool);
return TRUE;
case GDK_Escape:
gimp_transform_tool_response (NULL, GTK_RESPONSE_CANCEL, trans_tool);
return TRUE;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment