app: move shutdown code from gimp_measure_tool_halt() to control(HALT)

This commit is contained in:
Michael Natterer 2011-04-01 14:49:25 +02:00
parent 931d2110c6
commit 8ca28f19a3

View file

@ -100,8 +100,6 @@ static void gimp_measure_tool_cursor_update (GimpTool *tool,
static void gimp_measure_tool_draw (GimpDrawTool *draw_tool); static void gimp_measure_tool_draw (GimpDrawTool *draw_tool);
static void gimp_measure_tool_halt (GimpMeasureTool *measure);
static gdouble gimp_measure_tool_get_angle (gint dx, static gdouble gimp_measure_tool_get_angle (gint dx,
gint dy, gint dy,
gdouble xres, gdouble xres,
@ -173,6 +171,8 @@ gimp_measure_tool_control (GimpTool *tool,
GimpToolAction action, GimpToolAction action,
GimpDisplay *display) GimpDisplay *display)
{ {
GimpMeasureTool *measure = GIMP_MEASURE_TOOL (tool);
switch (action) switch (action)
{ {
case GIMP_TOOL_ACTION_PAUSE: case GIMP_TOOL_ACTION_PAUSE:
@ -180,7 +180,8 @@ gimp_measure_tool_control (GimpTool *tool,
break; break;
case GIMP_TOOL_ACTION_HALT: case GIMP_TOOL_ACTION_HALT:
gimp_measure_tool_halt (GIMP_MEASURE_TOOL (tool)); if (measure->dialog)
gtk_widget_destroy (measure->dialog);
break; break;
} }
@ -482,7 +483,7 @@ gimp_measure_tool_key_press (GimpTool *tool,
switch (kevent->keyval) switch (kevent->keyval)
{ {
case GDK_KEY_Escape: case GDK_KEY_Escape:
gimp_measure_tool_halt (GIMP_MEASURE_TOOL (tool)); gimp_tool_control (tool, GIMP_TOOL_ACTION_HALT, display);
return TRUE; return TRUE;
default: default:
@ -824,25 +825,6 @@ gimp_measure_tool_draw (GimpDrawTool *draw_tool)
} }
} }
static void
gimp_measure_tool_halt (GimpMeasureTool *measure)
{
GimpTool *tool = GIMP_TOOL (measure);
if (measure->dialog)
gtk_widget_destroy (measure->dialog);
gimp_tool_pop_status (tool, tool->display);
if (gimp_draw_tool_is_active (GIMP_DRAW_TOOL (measure)))
gimp_draw_tool_stop (GIMP_DRAW_TOOL (measure));
if (gimp_tool_control_is_active (tool->control))
gimp_tool_control_halt (tool->control);
tool->display = NULL;
}
static gdouble static gdouble
gimp_measure_tool_get_angle (gint dx, gimp_measure_tool_get_angle (gint dx,
gint dy, gint dy,