Commit b3c20ed2 authored by Michael Natterer's avatar Michael Natterer Committed by Michael Natterer

prefix with GIMP_TOOL_ACTION_

2006-05-21  Michael Natterer  <mitch@gimp.org>

	* app/tools/tools-enums.h (enum GimpToolAction): prefix with
	GIMP_TOOL_ACTION_

	* app/display/gimpdisplay.c
	* app/display/gimpdisplayshell.c
	* app/tools/gimpaligntool.c
	* app/tools/gimpcolorpickertool.c
	* app/tools/gimpcolortool.c
	* app/tools/gimpcroptool.c
	* app/tools/gimpdrawtool.c
	* app/tools/gimpforegroundselecttool.c
	* app/tools/gimpfreeselecttool.c
	* app/tools/gimpimagemaptool.c
	* app/tools/gimpiscissorstool.c
	* app/tools/gimpmeasuretool.c
	* app/tools/gimpmovetool.c
	* app/tools/gimpnewrectselecttool.c
	* app/tools/gimppainttool.c
	* app/tools/gimpselectiontool.c
	* app/tools/gimptexttool.c
	* app/tools/gimptool.c
	* app/tools/gimptransformtool.c
	* app/tools/gimpvectortool.c
	* app/tools/tool_manager.c: changed accordingly. Introduce a
	common style for GimpTool::control()'s switch() block. Some
	minor cleanups.
parent 57df85fa
2006-05-21 Michael Natterer <mitch@gimp.org>
* app/tools/tools-enums.h (enum GimpToolAction): prefix with
GIMP_TOOL_ACTION_
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell.c
* app/tools/gimpaligntool.c
* app/tools/gimpcolorpickertool.c
* app/tools/gimpcolortool.c
* app/tools/gimpcroptool.c
* app/tools/gimpdrawtool.c
* app/tools/gimpforegroundselecttool.c
* app/tools/gimpfreeselecttool.c
* app/tools/gimpimagemaptool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/tools/gimpnewrectselecttool.c
* app/tools/gimppainttool.c
* app/tools/gimpselectiontool.c
* app/tools/gimptexttool.c
* app/tools/gimptool.c
* app/tools/gimptransformtool.c
* app/tools/gimpvectortool.c
* app/tools/tool_manager.c: changed accordingly. Introduce a
common style for GimpTool::control()'s switch() block. Some
minor cleanups.
2006-05-21 Michael Natterer <mitch@gimp.org>
* app/tools/tool_manager.c (tool_manager_image_clean_dirty): don't
......
......@@ -382,7 +382,8 @@ gimp_display_delete (GimpDisplay *display)
GIMP_OBJECT (display));
/* stop any active tool */
tool_manager_control_active (display->image->gimp, HALT, display);
tool_manager_control_active (display->image->gimp, GIMP_TOOL_ACTION_HALT,
display);
active_tool = tool_manager_get_active (display->image->gimp);
......@@ -459,7 +460,8 @@ gimp_display_reconnect (GimpDisplay *display,
g_return_if_fail (GIMP_IS_IMAGE (image));
/* stop any active tool */
tool_manager_control_active (display->image->gimp, HALT, display);
tool_manager_control_active (display->image->gimp, GIMP_TOOL_ACTION_HALT,
display);
gimp_display_shell_disconnect (GIMP_DISPLAY_SHELL (display->shell));
......
......@@ -1400,7 +1400,8 @@ gimp_display_shell_pause (GimpDisplayShell *shell)
if (shell->paused_count == 1)
{
/* pause the currently active tool */
tool_manager_control_active (shell->display->image->gimp, PAUSE,
tool_manager_control_active (shell->display->image->gimp,
GIMP_TOOL_ACTION_PAUSE,
shell->display);
gimp_display_shell_draw_vectors (shell);
......@@ -1429,7 +1430,8 @@ gimp_display_shell_resume (GimpDisplayShell *shell)
gimp_display_shell_draw_vectors (shell);
/* start the currently active tool */
tool_manager_control_active (shell->display->image->gimp, RESUME,
tool_manager_control_active (shell->display->image->gimp,
GIMP_TOOL_ACTION_RESUME,
shell->display);
}
}
......
......@@ -224,19 +224,14 @@ gimp_align_tool_control (GimpTool *tool,
switch (action)
{
case PAUSE:
case GIMP_TOOL_ACTION_PAUSE:
case GIMP_TOOL_ACTION_RESUME:
break;
case RESUME:
break;
case HALT:
case GIMP_TOOL_ACTION_HALT:
clear_selected_items (align_tool);
gimp_tool_pop_status (tool, display);
break;
default:
break;
}
GIMP_TOOL_CLASS (parent_class)->control (tool, action, display);
......
......@@ -276,7 +276,11 @@ gimp_paint_tool_control (GimpTool *tool,
switch (action)
{
case HALT:
case GIMP_TOOL_ACTION_PAUSE:
case GIMP_TOOL_ACTION_RESUME:
break;
case GIMP_TOOL_ACTION_HALT:
gimp_paint_core_paint (paint_tool->core,
drawable,
GIMP_PAINT_OPTIONS (tool->tool_info->tool_options),
......@@ -306,9 +310,6 @@ gimp_paint_tool_control (GimpTool *tool,
}
#endif
break;
default:
break;
}
GIMP_TOOL_CLASS (parent_class)->control (tool, action, display);
......
......@@ -174,14 +174,15 @@ gimp_color_picker_tool_control (GimpTool *tool,
switch (action)
{
case HALT:
case GIMP_TOOL_ACTION_PAUSE:
case GIMP_TOOL_ACTION_RESUME:
break;
case GIMP_TOOL_ACTION_HALT:
if (picker_tool->dialog)
gimp_color_picker_tool_info_response (NULL, GTK_RESPONSE_CLOSE,
picker_tool);
break;
default:
break;
}
GIMP_TOOL_CLASS (parent_class)->control (tool, action, display);
......
......@@ -187,25 +187,22 @@ gimp_color_tool_control (GimpTool *tool,
switch (action)
{
case PAUSE:
case GIMP_TOOL_ACTION_PAUSE:
break;
case RESUME:
case GIMP_TOOL_ACTION_RESUME:
if (color_tool->sample_point &&
gimp_display_shell_get_show_sample_points (GIMP_DISPLAY_SHELL (shell)))
gimp_display_shell_draw_sample_point (GIMP_DISPLAY_SHELL (shell),
color_tool->sample_point, TRUE);
break;
case HALT:
case GIMP_TOOL_ACTION_HALT:
if (color_tool->sample_point &&
gimp_display_shell_get_show_sample_points (GIMP_DISPLAY_SHELL (shell)))
gimp_display_shell_draw_sample_point (GIMP_DISPLAY_SHELL (shell),
color_tool->sample_point, FALSE);
break;
default:
break;
}
GIMP_TOOL_CLASS (parent_class)->control (tool, action, display);
......
......@@ -171,20 +171,17 @@ gimp_crop_tool_control (GimpTool *tool,
switch (action)
{
case PAUSE:
case GIMP_TOOL_ACTION_PAUSE:
break;
case RESUME:
case GIMP_TOOL_ACTION_RESUME:
gimp_rectangle_tool_configure (rectangle);
break;
case HALT:
case GIMP_TOOL_ACTION_HALT:
gimp_rectangle_tool_response (NULL, GTK_RESPONSE_CANCEL,
rectangle);
break;
default:
break;
}
GIMP_TOOL_CLASS (parent_class)->control (tool, action, display);
......
......@@ -127,20 +127,17 @@ gimp_draw_tool_control (GimpTool *tool,
switch (action)
{
case PAUSE:
case GIMP_TOOL_ACTION_PAUSE:
gimp_draw_tool_pause (draw_tool);
break;
case RESUME:
case GIMP_TOOL_ACTION_RESUME:
gimp_draw_tool_resume (draw_tool);
break;
case HALT:
case GIMP_TOOL_ACTION_HALT:
gimp_draw_tool_stop (draw_tool);
break;
default:
break;
}
GIMP_TOOL_CLASS (parent_class)->control (tool, action, display);
......
......@@ -241,7 +241,11 @@ gimp_foreground_select_tool_control (GimpTool *tool,
switch (action)
{
case HALT:
case GIMP_TOOL_ACTION_PAUSE:
case GIMP_TOOL_ACTION_RESUME:
break;
case GIMP_TOOL_ACTION_HALT:
{
GList *list;
......@@ -265,9 +269,6 @@ gimp_foreground_select_tool_control (GimpTool *tool,
}
}
break;
default:
break;
}
GIMP_TOOL_CLASS (parent_class)->control (tool, action, display);
......@@ -402,7 +403,7 @@ gimp_foreground_select_tool_key_press (GimpTool *tool,
return TRUE;
case GDK_Escape:
gimp_tool_control (tool, HALT, display);
gimp_tool_control (tool, GIMP_TOOL_ACTION_HALT, display);
return TRUE;
default:
......@@ -756,7 +757,7 @@ gimp_foreground_select_tool_apply (GimpForegroundSelectTool *fg_select,
options->feather_radius,
options->feather_radius);
gimp_tool_control (tool, HALT, display);
gimp_tool_control (tool, GIMP_TOOL_ACTION_HALT, display);
gimp_image_flush (display->image);
}
......
......@@ -155,11 +155,12 @@ gimp_free_select_tool_control (GimpTool *tool,
{
switch (action)
{
case HALT:
GIMP_FREE_SELECT_TOOL (tool)->num_points = 0;
case GIMP_TOOL_ACTION_PAUSE:
case GIMP_TOOL_ACTION_RESUME:
break;
default:
case GIMP_TOOL_ACTION_HALT:
GIMP_FREE_SELECT_TOOL (tool)->num_points = 0;
break;
}
......
......@@ -330,14 +330,15 @@ gimp_image_map_tool_control (GimpTool *tool,
switch (action)
{
case HALT:
case GIMP_TOOL_ACTION_PAUSE:
case GIMP_TOOL_ACTION_RESUME:
break;
case GIMP_TOOL_ACTION_HALT:
if (image_map_tool->shell)
gtk_dialog_response (GTK_DIALOG (image_map_tool->shell),
GTK_RESPONSE_CANCEL);
break;
default:
break;
}
GIMP_TOOL_CLASS (parent_class)->control (tool, action, display);
......
......@@ -365,18 +365,13 @@ gimp_iscissors_tool_control (GimpTool *tool,
switch (action)
{
case PAUSE:
case GIMP_TOOL_ACTION_PAUSE:
case GIMP_TOOL_ACTION_RESUME:
break;
case RESUME:
break;
case HALT:
case GIMP_TOOL_ACTION_HALT:
gimp_iscissors_tool_reset (iscissors);
break;
default:
break;
}
}
......
......@@ -155,16 +155,13 @@ gimp_measure_tool_control (GimpTool *tool,
{
switch (action)
{
case PAUSE:
case RESUME:
case GIMP_TOOL_ACTION_PAUSE:
case GIMP_TOOL_ACTION_RESUME:
break;
case HALT:
case GIMP_TOOL_ACTION_HALT:
gimp_measure_tool_halt (GIMP_MEASURE_TOOL (tool));
break;
default:
break;
}
GIMP_TOOL_CLASS (parent_class)->control (tool, action, display);
......
......@@ -172,25 +172,22 @@ gimp_move_tool_control (GimpTool *tool,
switch (action)
{
case PAUSE:
case GIMP_TOOL_ACTION_PAUSE:
break;
case RESUME:
case GIMP_TOOL_ACTION_RESUME:
if (move->guide &&
gimp_display_shell_get_show_guides (GIMP_DISPLAY_SHELL (shell)))
gimp_display_shell_draw_guide (GIMP_DISPLAY_SHELL (shell),
move->guide, TRUE);
break;
case HALT:
case GIMP_TOOL_ACTION_HALT:
if (move->guide &&
gimp_display_shell_get_show_guides (GIMP_DISPLAY_SHELL (shell)))
gimp_display_shell_draw_guide (GIMP_DISPLAY_SHELL (shell),
move->guide, FALSE);
break;
default:
break;
}
GIMP_TOOL_CLASS (parent_class)->control (tool, action, display);
......
......@@ -195,20 +195,17 @@ gimp_new_rect_select_tool_control (GimpTool *tool,
switch (action)
{
case PAUSE:
case GIMP_TOOL_ACTION_PAUSE:
break;
case RESUME:
case GIMP_TOOL_ACTION_RESUME:
gimp_rectangle_tool_configure (rectangle);
break;
case HALT:
case GIMP_TOOL_ACTION_HALT:
gimp_rectangle_tool_response (NULL, GIMP_RECTANGLE_MODE_EXECUTE,
rectangle);
break;
default:
break;
}
GIMP_TOOL_CLASS (parent_class)->control (tool, action, display);
......
......@@ -276,7 +276,11 @@ gimp_paint_tool_control (GimpTool *tool,
switch (action)
{
case HALT:
case GIMP_TOOL_ACTION_PAUSE:
case GIMP_TOOL_ACTION_RESUME:
break;
case GIMP_TOOL_ACTION_HALT:
gimp_paint_core_paint (paint_tool->core,
drawable,
GIMP_PAINT_OPTIONS (tool->tool_info->tool_options),
......@@ -306,9 +310,6 @@ gimp_paint_tool_control (GimpTool *tool,
}
#endif
break;
default:
break;
}
GIMP_TOOL_CLASS (parent_class)->control (tool, action, display);
......
......@@ -195,20 +195,17 @@ gimp_new_rect_select_tool_control (GimpTool *tool,
switch (action)
{
case PAUSE:
case GIMP_TOOL_ACTION_PAUSE:
break;
case RESUME:
case GIMP_TOOL_ACTION_RESUME:
gimp_rectangle_tool_configure (rectangle);
break;
case HALT:
case GIMP_TOOL_ACTION_HALT:
gimp_rectangle_tool_response (NULL, GIMP_RECTANGLE_MODE_EXECUTE,
rectangle);
break;
default:
break;
}
GIMP_TOOL_CLASS (parent_class)->control (tool, action, display);
......
......@@ -89,8 +89,16 @@ gimp_selection_tool_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *display)
{
if (action == HALT)
gimp_tool_pop_status (tool, display);
switch (action)
{
case GIMP_TOOL_ACTION_PAUSE:
case GIMP_TOOL_ACTION_RESUME:
break;
case GIMP_TOOL_ACTION_HALT:
gimp_tool_pop_status (tool, display);
break;
}
GIMP_TOOL_CLASS (parent_class)->control (tool, action, display);
}
......
......@@ -242,11 +242,11 @@ gimp_text_tool_control (GimpTool *tool,
switch (action)
{
case PAUSE:
case RESUME:
case GIMP_TOOL_ACTION_PAUSE:
case GIMP_TOOL_ACTION_RESUME:
break;
case HALT:
case GIMP_TOOL_ACTION_HALT:
gimp_text_tool_set_drawable (text_tool, NULL, FALSE);
break;
}
......
......@@ -221,7 +221,7 @@ gimp_tool_real_button_press (GimpTool *tool,
GdkModifierType state,
GimpDisplay *display)
{
tool->display = display;
tool->display = display;
tool->drawable = gimp_image_active_drawable (display->image);
gimp_tool_control_activate (tool->control);
......@@ -306,14 +306,14 @@ gimp_tool_control (GimpTool *tool,
switch (action)
{
case PAUSE:
case GIMP_TOOL_ACTION_PAUSE:
if (! gimp_tool_control_is_paused (tool->control))
GIMP_TOOL_GET_CLASS (tool)->control (tool, action, display);
gimp_tool_control_pause (tool->control);
break;
case RESUME:
case GIMP_TOOL_ACTION_RESUME:
if (gimp_tool_control_is_paused (tool->control))
{
gimp_tool_control_resume (tool->control);
......@@ -328,7 +328,7 @@ gimp_tool_control (GimpTool *tool,
}
break;
case HALT:
case GIMP_TOOL_ACTION_HALT:
GIMP_TOOL_GET_CLASS (tool)->control (tool, action, display);
if (gimp_tool_control_is_active (tool->control))
......
......@@ -370,21 +370,18 @@ gimp_transform_tool_control (GimpTool *tool,
switch (action)
{
case PAUSE:
case GIMP_TOOL_ACTION_PAUSE:
break;
case RESUME:
case GIMP_TOOL_ACTION_RESUME:
gimp_transform_tool_bounds (tr_tool, display);
gimp_transform_tool_recalc (tr_tool, display);
break;
case HALT:
case GIMP_TOOL_ACTION_HALT:
gimp_transform_tool_halt (tr_tool);
return; /* don't upchain */
break;
default:
break;
}
GIMP_TOOL_CLASS (parent_class)->control (tool, action, display);
......
......@@ -222,19 +222,14 @@ gimp_vector_tool_control (GimpTool *tool,
switch (action)
{
case PAUSE:
case GIMP_TOOL_ACTION_PAUSE:
case GIMP_TOOL_ACTION_RESUME:
break;
case RESUME:
break;
case HALT:
case GIMP_TOOL_ACTION_HALT:
gimp_vector_tool_set_vectors (vector_tool, NULL);
gimp_tool_pop_status (tool, display);
break;
default:
break;
}
GIMP_TOOL_CLASS (parent_class)->control (tool, action, display);
......@@ -247,14 +242,12 @@ gimp_vector_tool_button_press (GimpTool *tool,
GdkModifierType state,
GimpDisplay *display)
{
GimpDrawTool *draw_tool;
GimpVectorTool *vector_tool;
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
GimpVectorTool *vector_tool = GIMP_VECTOR_TOOL (tool);
GimpVectorOptions *options;
GimpVectors *vectors;
draw_tool = GIMP_DRAW_TOOL (tool);
vector_tool = GIMP_VECTOR_TOOL (tool);
options = GIMP_VECTOR_OPTIONS (tool->tool_info->tool_options);
options = GIMP_VECTOR_OPTIONS (tool->tool_info->tool_options);
/* do nothing if we are an FINISHED state */
if (vector_tool->function == VECTORS_FINISHED)
......@@ -643,12 +636,11 @@ gimp_vector_tool_motion (GimpTool *tool,
GdkModifierType state,
GimpDisplay *display)
{
GimpVectorTool *vector_tool;
GimpVectorTool *vector_tool = GIMP_VECTOR_TOOL (tool);
GimpVectorOptions *options;
GimpAnchor *anchor;
vector_tool = GIMP_VECTOR_TOOL (tool);
options = GIMP_VECTOR_OPTIONS (tool->tool_info->tool_options);
options = GIMP_VECTOR_OPTIONS (tool->tool_info->tool_options);
if (vector_tool->function == VECTORS_FINISHED)
return;
......@@ -752,7 +744,6 @@ gimp_vector_tool_key_press (GimpTool *tool,
GimpVectorTool *vector_tool = GIMP_VECTOR_TOOL (tool);
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
GimpVectorOptions *options;
GimpDisplayShell *shell;
gdouble xdist, ydist;
gdouble pixels = 1.0;
......
......@@ -155,7 +155,7 @@ tool_manager_select_tool (Gimp *gimp,
if (! display && GIMP_IS_DRAW_TOOL (active_tool))
display = GIMP_DRAW_TOOL (active_tool)->display;
tool_manager_control_active (gimp, HALT, display);
tool_manager_control_active (gimp, GIMP_TOOL_ACTION_HALT, display);
tool_manager_focus_display_active (gimp, NULL);
g_object_unref (tool_manager->active_tool);
......@@ -255,7 +255,7 @@ tool_manager_control_active (Gimp *gimp,
{
gimp_tool_control (tool, action, display);
}
else if (action == HALT)
else if (action == GIMP_TOOL_ACTION_HALT)
{
if (gimp_tool_control_is_active (tool->control))
gimp_tool_control_halt (tool->control);
......@@ -560,6 +560,7 @@ tool_manager_image_clean_dirty (GimpImage *image,
display = GIMP_DRAW_TOOL (tool)->display;
if (display && display->image == image)
tool_manager_control_active (image->gimp, HALT, display);
tool_manager_control_active (image->gimp, GIMP_TOOL_ACTION_HALT,
display);
}
}
......@@ -137,9 +137,9 @@ typedef enum /*< skip >*/
/* Tool control actions */
typedef enum /*< skip >*/
{
PAUSE,
RESUME,
HALT
GIMP_TOOL_ACTION_PAUSE,
GIMP_TOOL_ACTION_RESUME,
GIMP_TOOL_ACTION_HALT
} GimpToolAction;
/* Modes of GimpEditSelectionTool */
......
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