app/tools/tools-types.h chain up unconditionally in control(),

2002-02-18  Michael Natterer  <mitch@gimp.org>

	* app/tools/tools-types.h
	* app/tools/*.[ch]: chain up unconditionally in control(),
	s/ToolAction/GimpToolAction/g, s/ToolState/GimpToolState/g.

	* app/tools/gimpbezierselecttool.c
	* app/tools/gimpinktool.c
	* app/tools/gimppainttool.c: don't touch tool->paused_count
	(setting it to 0 was a hack which should no longer be needed).

	* app/tools/gimpdrawtool.c: check if the draw tool has actually
	been started (draw_tool->gdisp != NULL) before calling it's
	draw() function.

	* app/tools/tool_manager.c: simplified tool_manager_control_active():
	simply call gimp_tool_control() if gdisp == tool->gdisp.

	* app/tools/gimptool.[ch]: gimp_tool_control(): do all the PAUSE,
	RESUME and HALT voodoo here.

	* app/tools/gimppainttool.c: implemented #9902 (Drawing straight
	lines does not work between different views). It's an evil hack,
	but clearly marked in the source.
This commit is contained in:
Michael Natterer 2002-02-18 17:00:09 +00:00 committed by Michael Natterer
parent fe2c9e8bbf
commit bec4c72534
34 changed files with 402 additions and 293 deletions

View File

@ -1,3 +1,28 @@
2002-02-18 Michael Natterer <mitch@gimp.org>
* app/tools/tools-types.h
* app/tools/*.[ch]: chain up unconditionally in control(),
s/ToolAction/GimpToolAction/g, s/ToolState/GimpToolState/g.
* app/tools/gimpbezierselecttool.c
* app/tools/gimpinktool.c
* app/tools/gimppainttool.c: don't touch tool->paused_count
(setting it to 0 was a hack which should no longer be needed).
* app/tools/gimpdrawtool.c: check if the draw tool has actually
been started (draw_tool->gdisp != NULL) before calling it's
draw() function.
* app/tools/tool_manager.c: simplified tool_manager_control_active():
simply call gimp_tool_control() if gdisp == tool->gdisp.
* app/tools/gimptool.[ch]: gimp_tool_control(): do all the PAUSE,
RESUME and HALT voodoo here.
* app/tools/gimppainttool.c: implemented #9902 (Drawing straight
lines does not work between different views). It's an evil hack,
but clearly marked in the source.
2002-02-18 Sven Neumann <sven@gimp.org> 2002-02-18 Sven Neumann <sven@gimp.org>
* app/app_procs.c * app/app_procs.c

View File

@ -55,11 +55,11 @@
static void gimp_color_balance_tool_class_init (GimpColorBalanceToolClass *klass); static void gimp_color_balance_tool_class_init (GimpColorBalanceToolClass *klass);
static void gimp_color_balance_tool_init (GimpColorBalanceTool *bc_tool); static void gimp_color_balance_tool_init (GimpColorBalanceTool *bc_tool);
static void gimp_color_balance_tool_initialize (GimpTool *tool, static void gimp_color_balance_tool_initialize (GimpTool *tool,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void gimp_color_balance_tool_control (GimpTool *tool, static void gimp_color_balance_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static ColorBalanceDialog * color_balance_dialog_new (void); static ColorBalanceDialog * color_balance_dialog_new (void);
@ -198,9 +198,9 @@ gimp_color_balance_tool_initialize (GimpTool *tool,
} }
static void static void
gimp_color_balance_tool_control (GimpTool *tool, gimp_color_balance_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp) GimpDisplay *gdisp)
{ {
switch (action) switch (action)
{ {
@ -218,8 +218,7 @@ gimp_color_balance_tool_control (GimpTool *tool,
break; break;
} }
if (GIMP_TOOL_CLASS (parent_class)->control) GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
} }

View File

@ -97,7 +97,7 @@ static void gimp_curves_tool_init (GimpCurvesTool *bc_tool);
static void gimp_curves_tool_initialize (GimpTool *tool, static void gimp_curves_tool_initialize (GimpTool *tool,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void gimp_curves_tool_control (GimpTool *tool, static void gimp_curves_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void gimp_curves_tool_button_press (GimpTool *tool, static void gimp_curves_tool_button_press (GimpTool *tool,
GimpCoords *coords, GimpCoords *coords,
@ -336,9 +336,9 @@ gimp_curves_tool_initialize (GimpTool *tool,
} }
static void static void
gimp_curves_tool_control (GimpTool *tool, gimp_curves_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp) GimpDisplay *gdisp)
{ {
switch (action) switch (action)
{ {
@ -356,8 +356,7 @@ gimp_curves_tool_control (GimpTool *tool,
break; break;
} }
if (GIMP_TOOL_CLASS (parent_class)->control) GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
} }
static void static void

View File

@ -68,11 +68,11 @@
static void gimp_hue_saturation_tool_class_init (GimpHueSaturationToolClass *klass); static void gimp_hue_saturation_tool_class_init (GimpHueSaturationToolClass *klass);
static void gimp_hue_saturation_tool_init (GimpHueSaturationTool *bc_tool); static void gimp_hue_saturation_tool_init (GimpHueSaturationTool *bc_tool);
static void gimp_hue_saturation_tool_initialize (GimpTool *tool, static void gimp_hue_saturation_tool_initialize (GimpTool *tool,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void gimp_hue_saturation_tool_control (GimpTool *tool, static void gimp_hue_saturation_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static HueSaturationDialog * hue_saturation_dialog_new (void); static HueSaturationDialog * hue_saturation_dialog_new (void);
@ -224,9 +224,9 @@ gimp_hue_saturation_tool_initialize (GimpTool *tool,
} }
static void static void
gimp_hue_saturation_tool_control (GimpTool *tool, gimp_hue_saturation_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp) GimpDisplay *gdisp)
{ {
switch (action) switch (action)
{ {
@ -244,8 +244,7 @@ gimp_hue_saturation_tool_control (GimpTool *tool,
break; break;
} }
if (GIMP_TOOL_CLASS (parent_class)->control) GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
} }

View File

@ -61,11 +61,11 @@
static void gimp_threshold_tool_class_init (GimpThresholdToolClass *klass); static void gimp_threshold_tool_class_init (GimpThresholdToolClass *klass);
static void gimp_threshold_tool_init (GimpThresholdTool *threshold_tool); static void gimp_threshold_tool_init (GimpThresholdTool *threshold_tool);
static void gimp_threshold_tool_initialize (GimpTool *tool, static void gimp_threshold_tool_initialize (GimpTool *tool,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void gimp_threshold_tool_control (GimpTool *tool, static void gimp_threshold_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static ThresholdDialog * threshold_dialog_new (void); static ThresholdDialog * threshold_dialog_new (void);
@ -214,9 +214,9 @@ gimp_threshold_tool_initialize (GimpTool *tool,
} }
static void static void
gimp_threshold_tool_control (GimpTool *tool, gimp_threshold_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp) GimpDisplay *gdisp)
{ {
switch (action) switch (action)
{ {
@ -234,8 +234,7 @@ gimp_threshold_tool_control (GimpTool *tool,
break; break;
} }
if (GIMP_TOOL_CLASS (parent_class)->control) GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
} }

View File

@ -123,7 +123,7 @@ static void gimp_ink_tool_init (GimpInkTool *tool);
static void gimp_ink_tool_finalize (GObject *object); static void gimp_ink_tool_finalize (GObject *object);
static void gimp_ink_tool_control (GimpTool *tool, static void gimp_ink_tool_control (GimpTool *tool,
ToolAction tool_action, GimpToolAction action,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void gimp_ink_tool_button_press (GimpTool *tool, static void gimp_ink_tool_button_press (GimpTool *tool,
GimpCoords *coords, GimpCoords *coords,
@ -342,9 +342,9 @@ gimp_ink_tool_finalize (GObject *object)
} }
static void static void
gimp_ink_tool_control (GimpTool *tool, gimp_ink_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp) GimpDisplay *gdisp)
{ {
GimpInkTool *ink_tool; GimpInkTool *ink_tool;
@ -365,6 +365,8 @@ gimp_ink_tool_control (GimpTool *tool,
default: default:
break; break;
} }
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
} }
static void static void
@ -387,9 +389,8 @@ gimp_ink_tool_button_press (GimpTool *tool,
ink_init (ink_tool, drawable, coords->x, coords->y); ink_init (ink_tool, drawable, coords->x, coords->y);
tool->state = ACTIVE; tool->state = ACTIVE;
tool->gdisp = gdisp; tool->gdisp = gdisp;
tool->paused_count = 0;
/* pause the current selection */ /* pause the current selection */
gimp_image_selection_control (gdisp->gimage, GIMP_SELECTION_PAUSE); gimp_image_selection_control (gdisp->gimage, GIMP_SELECTION_PAUSE);

View File

@ -135,7 +135,7 @@ static void gimp_bezier_select_tool_motion (GimpTool *tool,
GdkModifierType state, GdkModifierType state,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void gimp_bezier_select_tool_control (GimpTool *tool, static void gimp_bezier_select_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void gimp_bezier_select_tool_cursor_update (GimpTool *tool, static void gimp_bezier_select_tool_cursor_update (GimpTool *tool,
GimpCoords *coords, GimpCoords *coords,
@ -1915,9 +1915,9 @@ gimp_bezier_select_tool_cursor_update (GimpTool *tool,
} }
static void static void
gimp_bezier_select_tool_control (GimpTool *tool, gimp_bezier_select_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp) GimpDisplay *gdisp)
{ {
GimpBezierSelectTool * bezier_sel; GimpBezierSelectTool * bezier_sel;
@ -1925,15 +1925,15 @@ gimp_bezier_select_tool_control (GimpTool *tool,
switch (action) switch (action)
{ {
case PAUSE : case PAUSE:
gimp_draw_tool_pause ((GimpDrawTool *) bezier_sel); gimp_draw_tool_pause ((GimpDrawTool *) bezier_sel);
break; break;
case RESUME : case RESUME:
gimp_draw_tool_resume ((GimpDrawTool *) bezier_sel); gimp_draw_tool_resume ((GimpDrawTool *) bezier_sel);
break; break;
case HALT : case HALT:
gimp_draw_tool_stop ((GimpDrawTool *) bezier_sel); gimp_draw_tool_stop ((GimpDrawTool *) bezier_sel);
bezier_select_reset (bezier_sel); bezier_select_reset (bezier_sel);
break; break;
@ -2814,10 +2814,9 @@ bezier_paste_bezierselect_to_current (GimpDisplay *gdisp,
tool = tool_manager_get_active (gdisp->gimage->gimp); tool = tool_manager_get_active (gdisp->gimage->gimp);
tool->state = ACTIVE; tool->state = ACTIVE;
tool->gdisp = gdisp; tool->gdisp = gdisp;
tool->drawable = gimp_image_active_drawable (gdisp->gimage); tool->drawable = gimp_image_active_drawable (gdisp->gimage);
tool->paused_count = 0;
bezier_select_reset (curSel); bezier_select_reset (curSel);

View File

@ -79,11 +79,11 @@ struct _BrightnessContrastDialog
static void gimp_brightness_contrast_tool_class_init (GimpBrightnessContrastToolClass *klass); static void gimp_brightness_contrast_tool_class_init (GimpBrightnessContrastToolClass *klass);
static void gimp_brightness_contrast_tool_init (GimpBrightnessContrastTool *bc_tool); static void gimp_brightness_contrast_tool_init (GimpBrightnessContrastTool *bc_tool);
static void gimp_brightness_contrast_tool_initialize (GimpTool *tool, static void gimp_brightness_contrast_tool_initialize (GimpTool *tool,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void gimp_brightness_contrast_tool_control (GimpTool *tool, static void gimp_brightness_contrast_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static BrightnessContrastDialog * brightness_contrast_dialog_new (void); static BrightnessContrastDialog * brightness_contrast_dialog_new (void);
@ -209,9 +209,9 @@ gimp_brightness_contrast_tool_initialize (GimpTool *tool,
} }
static void static void
gimp_brightness_contrast_tool_control (GimpTool *tool, gimp_brightness_contrast_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp) GimpDisplay *gdisp)
{ {
switch (action) switch (action)
{ {
@ -229,8 +229,7 @@ gimp_brightness_contrast_tool_control (GimpTool *tool,
break; break;
} }
if (GIMP_TOOL_CLASS (parent_class)->control) GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
} }
/********************************/ /********************************/

View File

@ -62,8 +62,8 @@ static void gimp_paint_tool_init (GimpPaintTool *paint_tool);
static void gimp_paint_tool_finalize (GObject *object); static void gimp_paint_tool_finalize (GObject *object);
static void gimp_paint_tool_control (GimpTool *tool, static void gimp_paint_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void gimp_paint_tool_button_press (GimpTool *tool, static void gimp_paint_tool_button_press (GimpTool *tool,
GimpCoords *coords, GimpCoords *coords,
@ -178,9 +178,9 @@ gimp_paint_tool_finalize (GObject *object)
} }
static void static void
gimp_paint_tool_control (GimpTool *tool, gimp_paint_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp) GimpDisplay *gdisp)
{ {
GimpPaintTool *paint_tool; GimpPaintTool *paint_tool;
GimpDrawable *drawable; GimpDrawable *drawable;
@ -202,6 +202,31 @@ gimp_paint_tool_control (GimpTool *tool,
(PaintOptions *) tool->tool_info->tool_options, (PaintOptions *) tool->tool_info->tool_options,
FINISH_PAINT); FINISH_PAINT);
gimp_paint_core_cleanup (paint_tool->core); gimp_paint_core_cleanup (paint_tool->core);
#if 0
/* evil hack i'm thinking about... --mitch */
{
/* HALT means the current display is going to go away (TM),
* so try to find another display of the same image to make
* straight line drawing continue to work...
*/
GSList *list;
for (list = display_list; list; list = g_slist_next (list))
{
GimpDisplay *tmp_disp;
tmp_disp = (GimpDisplay *) list->data;
if (tmp_disp != gdisp && tmp_disp->gimage == gdisp->gimage)
{
tool->gdisp = tmp_disp;
break;
}
}
}
#endif
break; break;
default: default:
@ -223,9 +248,9 @@ gimp_paint_tool_button_press (GimpTool *tool,
GimpPaintCore *core; GimpPaintCore *core;
PaintOptions *paint_options; PaintOptions *paint_options;
GimpBrush *current_brush; GimpBrush *current_brush;
gboolean draw_line;
GimpDrawable *drawable; GimpDrawable *drawable;
GimpCoords curr_coords; GimpCoords curr_coords;
gboolean draw_line = FALSE;
draw_tool = GIMP_DRAW_TOOL (tool); draw_tool = GIMP_DRAW_TOOL (tool);
paint_tool = GIMP_PAINT_TOOL (tool); paint_tool = GIMP_PAINT_TOOL (tool);
@ -250,11 +275,22 @@ gimp_paint_tool_button_press (GimpTool *tool,
if (draw_tool->gdisp) if (draw_tool->gdisp)
gimp_draw_tool_stop (draw_tool); gimp_draw_tool_stop (draw_tool);
if (tool->gdisp &&
tool->gdisp != gdisp &&
tool->gdisp->gimage == gdisp->gimage)
{
/* if this is a different display, but the same image, HACK around
* in tool internals AFTER stopping the current draw_tool, so
* straight line drawing works across different views of the
* same image.
*/
tool->gdisp = gdisp;
}
if (! gimp_paint_core_start (core, drawable, &curr_coords)) if (! gimp_paint_core_start (core, drawable, &curr_coords))
return; return;
draw_line = FALSE;
if ((gdisp != tool->gdisp) || ! (state & GDK_SHIFT_MASK)) if ((gdisp != tool->gdisp) || ! (state & GDK_SHIFT_MASK))
{ {
/* if this is a new image, reinit the core vals */ /* if this is a new image, reinit the core vals */
@ -280,9 +316,8 @@ gimp_paint_tool_button_press (GimpTool *tool,
} }
} }
tool->state = ACTIVE; tool->state = ACTIVE;
tool->gdisp = gdisp; tool->gdisp = gdisp;
tool->paused_count = 0;
/* pause the current selection */ /* pause the current selection */
gimp_image_selection_control (gdisp->gimage, GIMP_SELECTION_PAUSE); gimp_image_selection_control (gdisp->gimage, GIMP_SELECTION_PAUSE);
@ -460,6 +495,19 @@ gimp_paint_tool_cursor_update (GimpTool *tool,
gimp_statusbar_pop (GIMP_STATUSBAR (shell->statusbar), gimp_statusbar_pop (GIMP_STATUSBAR (shell->statusbar),
g_type_name (G_TYPE_FROM_INSTANCE (tool))); g_type_name (G_TYPE_FROM_INSTANCE (tool)));
if (tool->gdisp &&
tool->gdisp != gdisp &&
tool->gdisp->gimage == gdisp->gimage)
{
/* if this is a different display, but the same image, HACK around
* in tool internals AFTER stopping the current draw_tool, so
* straight line drawing works across different views of the
* same image.
*/
tool->gdisp = gdisp;
}
if ((layer = gimp_image_get_active_layer (gdisp->gimage))) if ((layer = gimp_image_get_active_layer (gdisp->gimage)))
{ {
if (gdisp == tool->gdisp && (state & GDK_SHIFT_MASK)) if (gdisp == tool->gdisp && (state & GDK_SHIFT_MASK))

View File

@ -97,7 +97,7 @@ static void by_color_select_initialize (GimpTool *tool,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void by_color_select_control (GimpTool *tool, static void by_color_select_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void by_color_select_button_press (GimpTool *tool, static void by_color_select_button_press (GimpTool *tool,
GimpCoords *coords, GimpCoords *coords,
@ -246,9 +246,9 @@ gimp_by_color_select_tool_init (GimpByColorSelectTool *by_color_select)
} }
static void static void
by_color_select_control (GimpTool *tool, by_color_select_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp) GimpDisplay *gdisp)
{ {
switch (action) switch (action)
{ {
@ -266,6 +266,8 @@ by_color_select_control (GimpTool *tool,
default: default:
break; break;
} }
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
} }
void void

View File

@ -55,11 +55,11 @@
static void gimp_color_balance_tool_class_init (GimpColorBalanceToolClass *klass); static void gimp_color_balance_tool_class_init (GimpColorBalanceToolClass *klass);
static void gimp_color_balance_tool_init (GimpColorBalanceTool *bc_tool); static void gimp_color_balance_tool_init (GimpColorBalanceTool *bc_tool);
static void gimp_color_balance_tool_initialize (GimpTool *tool, static void gimp_color_balance_tool_initialize (GimpTool *tool,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void gimp_color_balance_tool_control (GimpTool *tool, static void gimp_color_balance_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static ColorBalanceDialog * color_balance_dialog_new (void); static ColorBalanceDialog * color_balance_dialog_new (void);
@ -198,9 +198,9 @@ gimp_color_balance_tool_initialize (GimpTool *tool,
} }
static void static void
gimp_color_balance_tool_control (GimpTool *tool, gimp_color_balance_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp) GimpDisplay *gdisp)
{ {
switch (action) switch (action)
{ {
@ -218,8 +218,7 @@ gimp_color_balance_tool_control (GimpTool *tool,
break; break;
} }
if (GIMP_TOOL_CLASS (parent_class)->control) GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
} }

View File

@ -87,7 +87,7 @@ static void gimp_color_picker_tool_init (GimpColorPickerTool *co
static void gimp_color_picker_tool_finalize (GObject *object); static void gimp_color_picker_tool_finalize (GObject *object);
static void gimp_color_picker_tool_control (GimpTool *tool, static void gimp_color_picker_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void gimp_color_picker_tool_button_press (GimpTool *tool, static void gimp_color_picker_tool_button_press (GimpTool *tool,
GimpCoords *coords, GimpCoords *coords,
@ -242,9 +242,9 @@ gimp_color_picker_tool_finalize (GObject *object)
} }
static void static void
gimp_color_picker_tool_control (GimpTool *tool, gimp_color_picker_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp) GimpDisplay *gdisp)
{ {
switch (action) switch (action)
{ {
@ -262,8 +262,7 @@ gimp_color_picker_tool_control (GimpTool *tool,
break; break;
} }
if (GIMP_TOOL_CLASS (parent_class)->control) GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
} }
static void static void

View File

@ -90,7 +90,7 @@ static void gimp_crop_tool_init (GimpCropTool *crop_tool);
static void gimp_crop_tool_finalize (GObject *object); static void gimp_crop_tool_finalize (GObject *object);
static void gimp_crop_tool_control (GimpTool *tool, static void gimp_crop_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void gimp_crop_tool_button_press (GimpTool *tool, static void gimp_crop_tool_button_press (GimpTool *tool,
GimpCoords *coords, GimpCoords *coords,
@ -267,9 +267,9 @@ gimp_crop_tool_finalize (GObject *object)
} }
static void static void
gimp_crop_tool_control (GimpTool *tool, gimp_crop_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp) GimpDisplay *gdisp)
{ {
GimpCropTool *crop_tool; GimpCropTool *crop_tool;

View File

@ -97,7 +97,7 @@ static void gimp_curves_tool_init (GimpCurvesTool *bc_tool);
static void gimp_curves_tool_initialize (GimpTool *tool, static void gimp_curves_tool_initialize (GimpTool *tool,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void gimp_curves_tool_control (GimpTool *tool, static void gimp_curves_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void gimp_curves_tool_button_press (GimpTool *tool, static void gimp_curves_tool_button_press (GimpTool *tool,
GimpCoords *coords, GimpCoords *coords,
@ -336,9 +336,9 @@ gimp_curves_tool_initialize (GimpTool *tool,
} }
static void static void
gimp_curves_tool_control (GimpTool *tool, gimp_curves_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp) GimpDisplay *gdisp)
{ {
switch (action) switch (action)
{ {
@ -356,8 +356,7 @@ gimp_curves_tool_control (GimpTool *tool,
break; break;
} }
if (GIMP_TOOL_CLASS (parent_class)->control) GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
} }
static void static void

View File

@ -36,9 +36,11 @@ static void gimp_draw_tool_init (GimpDrawTool *draw_tool);
static void gimp_draw_tool_finalize (GObject *object); static void gimp_draw_tool_finalize (GObject *object);
static void gimp_draw_tool_control (GimpTool *tool, static void gimp_draw_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void gimp_draw_tool_draw (GimpDrawTool *draw_tool);
static inline void gimp_draw_tool_shift_to_north_west static inline void gimp_draw_tool_shift_to_north_west
(gdouble x, (gdouble x,
gdouble y, gdouble y,
@ -139,9 +141,9 @@ gimp_draw_tool_finalize (GObject *object)
} }
static void static void
gimp_draw_tool_control (GimpTool *tool, gimp_draw_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp) GimpDisplay *gdisp)
{ {
GimpDrawTool *draw_tool; GimpDrawTool *draw_tool;
@ -168,6 +170,15 @@ gimp_draw_tool_control (GimpTool *tool,
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp); GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
} }
static void
gimp_draw_tool_draw (GimpDrawTool *draw_tool)
{
if (draw_tool->gdisp)
{
GIMP_DRAW_TOOL_GET_CLASS (draw_tool)->draw (draw_tool);
}
}
void void
gimp_draw_tool_start (GimpDrawTool *draw_tool, gimp_draw_tool_start (GimpDrawTool *draw_tool,
GimpDisplay *gdisp) GimpDisplay *gdisp)
@ -197,7 +208,7 @@ gimp_draw_tool_start (GimpDrawTool *draw_tool,
draw_tool->cap_style, draw_tool->cap_style,
draw_tool->join_style); draw_tool->join_style);
GIMP_DRAW_TOOL_GET_CLASS (draw_tool)->draw (draw_tool); gimp_draw_tool_draw (draw_tool);
draw_tool->draw_state = GIMP_DRAW_TOOL_STATE_VISIBLE; draw_tool->draw_state = GIMP_DRAW_TOOL_STATE_VISIBLE;
} }
@ -209,7 +220,7 @@ gimp_draw_tool_stop (GimpDrawTool *draw_tool)
if (draw_tool->draw_state == GIMP_DRAW_TOOL_STATE_VISIBLE) if (draw_tool->draw_state == GIMP_DRAW_TOOL_STATE_VISIBLE)
{ {
GIMP_DRAW_TOOL_GET_CLASS (draw_tool)->draw (draw_tool); gimp_draw_tool_draw (draw_tool);
} }
draw_tool->draw_state = GIMP_DRAW_TOOL_STATE_INVISIBLE; draw_tool->draw_state = GIMP_DRAW_TOOL_STATE_INVISIBLE;
@ -234,7 +245,7 @@ gimp_draw_tool_pause (GimpDrawTool *draw_tool)
{ {
draw_tool->draw_state = GIMP_DRAW_TOOL_STATE_INVISIBLE; draw_tool->draw_state = GIMP_DRAW_TOOL_STATE_INVISIBLE;
GIMP_DRAW_TOOL_GET_CLASS (draw_tool)->draw (draw_tool); gimp_draw_tool_draw (draw_tool);
} }
draw_tool->paused_count++; draw_tool->paused_count++;
@ -253,7 +264,7 @@ gimp_draw_tool_resume (GimpDrawTool *draw_tool)
{ {
draw_tool->draw_state = GIMP_DRAW_TOOL_STATE_VISIBLE; draw_tool->draw_state = GIMP_DRAW_TOOL_STATE_VISIBLE;
GIMP_DRAW_TOOL_GET_CLASS (draw_tool)->draw (draw_tool); gimp_draw_tool_draw (draw_tool);
} }
} }
else else

View File

@ -101,7 +101,7 @@ static void gimp_edit_selection_tool_class_init (GimpEditSelectionToolClass *
static void gimp_edit_selection_tool_init (GimpEditSelectionTool *edit_selection_tool); static void gimp_edit_selection_tool_init (GimpEditSelectionTool *edit_selection_tool);
static void gimp_edit_selection_tool_control (GimpTool *tool, static void gimp_edit_selection_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void gimp_edit_selection_tool_button_release (GimpTool *tool, static void gimp_edit_selection_tool_button_release (GimpTool *tool,
GimpCoords *coords, GimpCoords *coords,
@ -730,9 +730,9 @@ gimp_edit_selection_tool_draw (GimpDrawTool *draw_tool)
} }
static void static void
gimp_edit_selection_tool_control (GimpTool *tool, gimp_edit_selection_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp) GimpDisplay *gdisp)
{ {
switch (action) switch (action)
{ {

View File

@ -86,7 +86,7 @@ static void gimp_histogram_tool_init (GimpHistogramTool *bc_tool);
static void gimp_histogram_tool_initialize (GimpTool *tool, static void gimp_histogram_tool_initialize (GimpTool *tool,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void gimp_histogram_tool_control (GimpTool *tool, static void gimp_histogram_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static HistogramToolDialog * histogram_tool_dialog_new (void); static HistogramToolDialog * histogram_tool_dialog_new (void);
@ -224,9 +224,9 @@ gimp_histogram_tool_initialize (GimpTool *tool,
} }
static void static void
gimp_histogram_tool_control (GimpTool *tool, gimp_histogram_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp) GimpDisplay *gdisp)
{ {
switch (action) switch (action)
{ {
@ -245,8 +245,7 @@ gimp_histogram_tool_control (GimpTool *tool,
break; break;
} }
if (GIMP_TOOL_CLASS (parent_class)->control) GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
} }

View File

@ -68,11 +68,11 @@
static void gimp_hue_saturation_tool_class_init (GimpHueSaturationToolClass *klass); static void gimp_hue_saturation_tool_class_init (GimpHueSaturationToolClass *klass);
static void gimp_hue_saturation_tool_init (GimpHueSaturationTool *bc_tool); static void gimp_hue_saturation_tool_init (GimpHueSaturationTool *bc_tool);
static void gimp_hue_saturation_tool_initialize (GimpTool *tool, static void gimp_hue_saturation_tool_initialize (GimpTool *tool,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void gimp_hue_saturation_tool_control (GimpTool *tool, static void gimp_hue_saturation_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static HueSaturationDialog * hue_saturation_dialog_new (void); static HueSaturationDialog * hue_saturation_dialog_new (void);
@ -224,9 +224,9 @@ gimp_hue_saturation_tool_initialize (GimpTool *tool,
} }
static void static void
gimp_hue_saturation_tool_control (GimpTool *tool, gimp_hue_saturation_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp) GimpDisplay *gdisp)
{ {
switch (action) switch (action)
{ {
@ -244,8 +244,7 @@ gimp_hue_saturation_tool_control (GimpTool *tool,
break; break;
} }
if (GIMP_TOOL_CLASS (parent_class)->control) GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
} }

View File

@ -123,7 +123,7 @@ static void gimp_ink_tool_init (GimpInkTool *tool);
static void gimp_ink_tool_finalize (GObject *object); static void gimp_ink_tool_finalize (GObject *object);
static void gimp_ink_tool_control (GimpTool *tool, static void gimp_ink_tool_control (GimpTool *tool,
ToolAction tool_action, GimpToolAction action,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void gimp_ink_tool_button_press (GimpTool *tool, static void gimp_ink_tool_button_press (GimpTool *tool,
GimpCoords *coords, GimpCoords *coords,
@ -342,9 +342,9 @@ gimp_ink_tool_finalize (GObject *object)
} }
static void static void
gimp_ink_tool_control (GimpTool *tool, gimp_ink_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp) GimpDisplay *gdisp)
{ {
GimpInkTool *ink_tool; GimpInkTool *ink_tool;
@ -365,6 +365,8 @@ gimp_ink_tool_control (GimpTool *tool,
default: default:
break; break;
} }
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
} }
static void static void
@ -387,9 +389,8 @@ gimp_ink_tool_button_press (GimpTool *tool,
ink_init (ink_tool, drawable, coords->x, coords->y); ink_init (ink_tool, drawable, coords->x, coords->y);
tool->state = ACTIVE; tool->state = ACTIVE;
tool->gdisp = gdisp; tool->gdisp = gdisp;
tool->paused_count = 0;
/* pause the current selection */ /* pause the current selection */
gimp_image_selection_control (gdisp->gimage, GIMP_SELECTION_PAUSE); gimp_image_selection_control (gdisp->gimage, GIMP_SELECTION_PAUSE);

View File

@ -119,7 +119,7 @@ static void gimp_iscissors_tool_init (GimpIscissorsTool *iscissors)
static void gimp_iscissors_tool_finalize (GObject *object); static void gimp_iscissors_tool_finalize (GObject *object);
static void gimp_iscissors_tool_control (GimpTool *tool, static void gimp_iscissors_tool_control (GimpTool *tool,
ToolAction tool_action, GimpToolAction action,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void gimp_iscissors_tool_button_press (GimpTool *tool, static void gimp_iscissors_tool_button_press (GimpTool *tool,
GimpCoords *coords, GimpCoords *coords,
@ -360,9 +360,9 @@ gimp_iscissors_tool_finalize (GObject *object)
} }
static void static void
gimp_iscissors_tool_control (GimpTool *tool, gimp_iscissors_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp) GimpDisplay *gdisp)
{ {
GimpIscissorsTool *iscissors; GimpIscissorsTool *iscissors;
Iscissors_draw draw; Iscissors_draw draw;

View File

@ -131,11 +131,11 @@ struct _LevelsDialog
static void gimp_levels_tool_class_init (GimpLevelsToolClass *klass); static void gimp_levels_tool_class_init (GimpLevelsToolClass *klass);
static void gimp_levels_tool_init (GimpLevelsTool *bc_tool); static void gimp_levels_tool_init (GimpLevelsTool *bc_tool);
static void gimp_levels_tool_initialize (GimpTool *tool, static void gimp_levels_tool_initialize (GimpTool *tool,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void gimp_levels_tool_control (GimpTool *tool, static void gimp_levels_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static LevelsDialog * levels_dialog_new (void); static LevelsDialog * levels_dialog_new (void);
@ -329,9 +329,9 @@ gimp_levels_tool_initialize (GimpTool *tool,
} }
static void static void
gimp_levels_tool_control (GimpTool *tool, gimp_levels_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp) GimpDisplay *gdisp)
{ {
switch (action) switch (action)
{ {
@ -349,8 +349,7 @@ gimp_levels_tool_control (GimpTool *tool,
break; break;
} }
if (GIMP_TOOL_CLASS (parent_class)->control) GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
} }
void void

View File

@ -78,7 +78,7 @@ static void gimp_measure_tool_class_init (GimpMeasureToolClass *klass);
static void gimp_measure_tool_init (GimpMeasureTool *tool); static void gimp_measure_tool_init (GimpMeasureTool *tool);
static void gimp_measure_tool_control (GimpTool *tool, static void gimp_measure_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void gimp_measure_tool_button_press (GimpTool *tool, static void gimp_measure_tool_button_press (GimpTool *tool,
GimpCoords *coords, GimpCoords *coords,
@ -202,9 +202,9 @@ gimp_measure_tool_init (GimpMeasureTool *measure_tool)
} }
static void static void
gimp_measure_tool_control (GimpTool *tool, gimp_measure_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp) GimpDisplay *gdisp)
{ {
GimpMeasureTool *measure_tool; GimpMeasureTool *measure_tool;

View File

@ -68,7 +68,7 @@ static void gimp_move_tool_class_init (GimpMoveToolClass *klass);
static void gimp_move_tool_init (GimpMoveTool *move_tool); static void gimp_move_tool_init (GimpMoveTool *move_tool);
static void gimp_move_tool_control (GimpTool *tool, static void gimp_move_tool_control (GimpTool *tool,
ToolAction tool_action, GimpToolAction action,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void gimp_move_tool_button_press (GimpTool *tool, static void gimp_move_tool_button_press (GimpTool *tool,
GimpCoords *coords, GimpCoords *coords,
@ -192,9 +192,9 @@ gimp_move_tool_init (GimpMoveTool *move_tool)
} }
static void static void
gimp_move_tool_control (GimpTool *tool, gimp_move_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp) GimpDisplay *gdisp)
{ {
GimpMoveTool *move_tool; GimpMoveTool *move_tool;

View File

@ -62,8 +62,8 @@ static void gimp_paint_tool_init (GimpPaintTool *paint_tool);
static void gimp_paint_tool_finalize (GObject *object); static void gimp_paint_tool_finalize (GObject *object);
static void gimp_paint_tool_control (GimpTool *tool, static void gimp_paint_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void gimp_paint_tool_button_press (GimpTool *tool, static void gimp_paint_tool_button_press (GimpTool *tool,
GimpCoords *coords, GimpCoords *coords,
@ -178,9 +178,9 @@ gimp_paint_tool_finalize (GObject *object)
} }
static void static void
gimp_paint_tool_control (GimpTool *tool, gimp_paint_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp) GimpDisplay *gdisp)
{ {
GimpPaintTool *paint_tool; GimpPaintTool *paint_tool;
GimpDrawable *drawable; GimpDrawable *drawable;
@ -202,6 +202,31 @@ gimp_paint_tool_control (GimpTool *tool,
(PaintOptions *) tool->tool_info->tool_options, (PaintOptions *) tool->tool_info->tool_options,
FINISH_PAINT); FINISH_PAINT);
gimp_paint_core_cleanup (paint_tool->core); gimp_paint_core_cleanup (paint_tool->core);
#if 0
/* evil hack i'm thinking about... --mitch */
{
/* HALT means the current display is going to go away (TM),
* so try to find another display of the same image to make
* straight line drawing continue to work...
*/
GSList *list;
for (list = display_list; list; list = g_slist_next (list))
{
GimpDisplay *tmp_disp;
tmp_disp = (GimpDisplay *) list->data;
if (tmp_disp != gdisp && tmp_disp->gimage == gdisp->gimage)
{
tool->gdisp = tmp_disp;
break;
}
}
}
#endif
break; break;
default: default:
@ -223,9 +248,9 @@ gimp_paint_tool_button_press (GimpTool *tool,
GimpPaintCore *core; GimpPaintCore *core;
PaintOptions *paint_options; PaintOptions *paint_options;
GimpBrush *current_brush; GimpBrush *current_brush;
gboolean draw_line;
GimpDrawable *drawable; GimpDrawable *drawable;
GimpCoords curr_coords; GimpCoords curr_coords;
gboolean draw_line = FALSE;
draw_tool = GIMP_DRAW_TOOL (tool); draw_tool = GIMP_DRAW_TOOL (tool);
paint_tool = GIMP_PAINT_TOOL (tool); paint_tool = GIMP_PAINT_TOOL (tool);
@ -250,11 +275,22 @@ gimp_paint_tool_button_press (GimpTool *tool,
if (draw_tool->gdisp) if (draw_tool->gdisp)
gimp_draw_tool_stop (draw_tool); gimp_draw_tool_stop (draw_tool);
if (tool->gdisp &&
tool->gdisp != gdisp &&
tool->gdisp->gimage == gdisp->gimage)
{
/* if this is a different display, but the same image, HACK around
* in tool internals AFTER stopping the current draw_tool, so
* straight line drawing works across different views of the
* same image.
*/
tool->gdisp = gdisp;
}
if (! gimp_paint_core_start (core, drawable, &curr_coords)) if (! gimp_paint_core_start (core, drawable, &curr_coords))
return; return;
draw_line = FALSE;
if ((gdisp != tool->gdisp) || ! (state & GDK_SHIFT_MASK)) if ((gdisp != tool->gdisp) || ! (state & GDK_SHIFT_MASK))
{ {
/* if this is a new image, reinit the core vals */ /* if this is a new image, reinit the core vals */
@ -280,9 +316,8 @@ gimp_paint_tool_button_press (GimpTool *tool,
} }
} }
tool->state = ACTIVE; tool->state = ACTIVE;
tool->gdisp = gdisp; tool->gdisp = gdisp;
tool->paused_count = 0;
/* pause the current selection */ /* pause the current selection */
gimp_image_selection_control (gdisp->gimage, GIMP_SELECTION_PAUSE); gimp_image_selection_control (gdisp->gimage, GIMP_SELECTION_PAUSE);
@ -460,6 +495,19 @@ gimp_paint_tool_cursor_update (GimpTool *tool,
gimp_statusbar_pop (GIMP_STATUSBAR (shell->statusbar), gimp_statusbar_pop (GIMP_STATUSBAR (shell->statusbar),
g_type_name (G_TYPE_FROM_INSTANCE (tool))); g_type_name (G_TYPE_FROM_INSTANCE (tool)));
if (tool->gdisp &&
tool->gdisp != gdisp &&
tool->gdisp->gimage == gdisp->gimage)
{
/* if this is a different display, but the same image, HACK around
* in tool internals AFTER stopping the current draw_tool, so
* straight line drawing works across different views of the
* same image.
*/
tool->gdisp = gdisp;
}
if ((layer = gimp_image_get_active_layer (gdisp->gimage))) if ((layer = gimp_image_get_active_layer (gdisp->gimage)))
{ {
if (gdisp == tool->gdisp && (state & GDK_SHIFT_MASK)) if (gdisp == tool->gdisp && (state & GDK_SHIFT_MASK))

View File

@ -47,7 +47,7 @@ static void gimp_path_tool_init (GimpPathTool *tool);
static void gimp_path_tool_finalize (GObject *object); static void gimp_path_tool_finalize (GObject *object);
static void gimp_path_tool_control (GimpTool *tool, static void gimp_path_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void gimp_path_tool_button_press (GimpTool *tool, static void gimp_path_tool_button_press (GimpTool *tool,
@ -229,9 +229,9 @@ gimp_path_tool_finalize (GObject *object)
} }
static void static void
gimp_path_tool_control (GimpTool *tool, gimp_path_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp) GimpDisplay *gdisp)
{ {
GimpPathTool *path_tool; GimpPathTool *path_tool;
@ -257,8 +257,7 @@ gimp_path_tool_control (GimpTool *tool,
break; break;
} }
if (GIMP_TOOL_CLASS (parent_class)->control) GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
} }
static void static void

View File

@ -66,11 +66,11 @@ struct _PosterizeDialog
static void gimp_posterize_tool_class_init (GimpPosterizeToolClass *klass); static void gimp_posterize_tool_class_init (GimpPosterizeToolClass *klass);
static void gimp_posterize_tool_init (GimpPosterizeTool *bc_tool); static void gimp_posterize_tool_init (GimpPosterizeTool *bc_tool);
static void gimp_posterize_tool_initialize (GimpTool *tool, static void gimp_posterize_tool_initialize (GimpTool *tool,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void gimp_posterize_tool_control (GimpTool *tool, static void gimp_posterize_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static PosterizeDialog * posterize_dialog_new (void); static PosterizeDialog * posterize_dialog_new (void);
@ -193,9 +193,9 @@ gimp_posterize_tool_initialize (GimpTool *tool,
} }
static void static void
gimp_posterize_tool_control (GimpTool *tool, gimp_posterize_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp) GimpDisplay *gdisp)
{ {
switch (action) switch (action)
{ {
@ -213,8 +213,7 @@ gimp_posterize_tool_control (GimpTool *tool,
break; break;
} }
if (GIMP_TOOL_CLASS (parent_class)->control) GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
} }
/**********************/ /**********************/

View File

@ -95,7 +95,7 @@ static void gimp_text_tool_init (GimpTextTool *tool);
static void gimp_text_tool_finalize (GObject *object); static void gimp_text_tool_finalize (GObject *object);
static void text_tool_control (GimpTool *tool, static void text_tool_control (GimpTool *tool,
ToolAction tool_action, GimpToolAction action,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void text_tool_button_press (GimpTool *tool, static void text_tool_button_press (GimpTool *tool,
GimpCoords *coords, GimpCoords *coords,
@ -224,9 +224,9 @@ gimp_text_tool_finalize (GObject *object)
} }
static void static void
text_tool_control (GimpTool *tool, text_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp) GimpDisplay *gdisp)
{ {
switch (action) switch (action)
{ {

View File

@ -61,11 +61,11 @@
static void gimp_threshold_tool_class_init (GimpThresholdToolClass *klass); static void gimp_threshold_tool_class_init (GimpThresholdToolClass *klass);
static void gimp_threshold_tool_init (GimpThresholdTool *threshold_tool); static void gimp_threshold_tool_init (GimpThresholdTool *threshold_tool);
static void gimp_threshold_tool_initialize (GimpTool *tool, static void gimp_threshold_tool_initialize (GimpTool *tool,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void gimp_threshold_tool_control (GimpTool *tool, static void gimp_threshold_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static ThresholdDialog * threshold_dialog_new (void); static ThresholdDialog * threshold_dialog_new (void);
@ -214,9 +214,9 @@ gimp_threshold_tool_initialize (GimpTool *tool,
} }
static void static void
gimp_threshold_tool_control (GimpTool *tool, gimp_threshold_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp) GimpDisplay *gdisp)
{ {
switch (action) switch (action)
{ {
@ -234,8 +234,7 @@ gimp_threshold_tool_control (GimpTool *tool,
break; break;
} }
if (GIMP_TOOL_CLASS (parent_class)->control) GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
} }

View File

@ -43,7 +43,7 @@ static void gimp_tool_init (GimpTool *tool);
static void gimp_tool_real_initialize (GimpTool *tool, static void gimp_tool_real_initialize (GimpTool *tool,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void gimp_tool_real_control (GimpTool *tool, static void gimp_tool_real_control (GimpTool *tool,
ToolAction tool_action, GimpToolAction action,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void gimp_tool_real_button_press (GimpTool *tool, static void gimp_tool_real_button_press (GimpTool *tool,
GimpCoords *coords, GimpCoords *coords,
@ -134,20 +134,16 @@ gimp_tool_init (GimpTool *tool)
tool->state = INACTIVE; tool->state = INACTIVE;
tool->paused_count = 0; tool->paused_count = 0;
tool->scroll_lock = FALSE; /* Allow scrolling */
tool->auto_snap_to = TRUE; /* Snap to guides */
tool->handle_empty_image = FALSE; /* Don't work without
* active drawable
*/
tool->perfectmouse = FALSE;
tool->preserve = TRUE; /* Preserve across drawable
* changes
*/
tool->gdisp = NULL; tool->gdisp = NULL;
tool->drawable = NULL; tool->drawable = NULL;
tool->scroll_lock = FALSE; /* Allow scrolling */
tool->auto_snap_to = TRUE; /* Snap to guides */
tool->preserve = TRUE; /* Preserve across drawable change */
tool->handle_empty_image = FALSE; /* Require active drawable */
tool->perfectmouse = FALSE; /* Use MOTION_HINT compression */
tool->cursor = GIMP_MOUSE_CURSOR; tool->cursor = GIMP_MOUSE_CURSOR;
tool->tool_cursor = GIMP_TOOL_CURSOR_NONE; tool->tool_cursor = GIMP_TOOL_CURSOR_NONE;
tool->cursor_modifier = GIMP_CURSOR_MODIFIER_NONE; tool->cursor_modifier = GIMP_CURSOR_MODIFIER_NONE;
@ -169,13 +165,47 @@ gimp_tool_initialize (GimpTool *tool,
} }
void void
gimp_tool_control (GimpTool *tool, gimp_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp) GimpDisplay *gdisp)
{ {
g_return_if_fail (GIMP_IS_TOOL (tool)); g_return_if_fail (GIMP_IS_TOOL (tool));
GIMP_TOOL_GET_CLASS (tool)->control (tool, action, gdisp); switch (action)
{
case PAUSE:
if (tool->paused_count == 0)
{
GIMP_TOOL_GET_CLASS (tool)->control (tool, action, gdisp);
}
tool->paused_count++;
break;
case RESUME:
if (tool->paused_count > 0)
{
tool->paused_count--;
if (tool->paused_count == 0)
{
GIMP_TOOL_GET_CLASS (tool)->control (tool, action, gdisp);
}
}
else
{
g_warning ("gimp_tool_control(): "
"unable to RESUME tool with tool->paused_count == 0");
}
break;
case HALT:
GIMP_TOOL_GET_CLASS (tool)->control (tool, action, gdisp);
tool->state = INACTIVE;
tool->paused_count = 0;
break;
}
} }
void void
@ -351,9 +381,9 @@ gimp_tool_real_initialize (GimpTool *tool,
} }
static void static void
gimp_tool_real_control (GimpTool *tool, gimp_tool_real_control (GimpTool *tool,
ToolAction tool_action, GimpToolAction action,
GimpDisplay *gdisp) GimpDisplay *gdisp)
{ {
} }
@ -434,11 +464,3 @@ gimp_tool_real_cursor_update (GimpTool *tool,
tool->cursor_modifier); tool->cursor_modifier);
} }
} }
#define STUB(x) void * x (void){g_message ("stub function %s called",#x); return NULL;}
STUB(clone_non_gui)
STUB(clone_non_gui_default)
STUB(convolve_non_gui)
STUB(convolve_non_gui_default)

View File

@ -41,27 +41,26 @@ typedef struct _GimpToolClass GimpToolClass;
struct _GimpTool struct _GimpTool
{ {
GimpObject parent_instance; GimpObject parent_instance;
GimpToolInfo *tool_info; GimpToolInfo *tool_info;
gint ID; /* unique tool ID */ gint ID; /* unique tool ID */
ToolState state; /* state of tool activity */ GimpToolState state; /* state of tool activity */
gint paused_count; /* paused control count */ gint paused_count; /* paused control count */
gboolean scroll_lock; /* allow scrolling or not */
gboolean auto_snap_to; /* snap to guides automatically */
gboolean handle_empty_image; /* invoke the tool on images without GimpDisplay *gdisp; /* pointer to currently active gdisp */
* active drawable GimpDrawable *drawable; /* pointer to the tool's current drawable */
*/
gboolean perfectmouse; /* tool is affected by gimprc's
* "prefectmouse" setting
*/
gboolean preserve; /* Preserve this tool across drawable changes */ gboolean scroll_lock; /* allow scrolling or not */
GimpDisplay *gdisp; /* pointer to currently active gdisp */ gboolean auto_snap_to; /* snap to guides automatically */
GimpDrawable *drawable; /* pointer to the tool's current drawable */ gboolean preserve; /* Preserve this tool across drawable *
* changes */
gboolean handle_empty_image; /* invoke the tool on images without *
* active drawable */
gboolean perfectmouse; /* tool is affected by gimprc's *
* "prefectmouse" setting */
GdkCursorType cursor; GdkCursorType cursor;
GimpToolCursorType tool_cursor; GimpToolCursorType tool_cursor;
@ -83,7 +82,7 @@ struct _GimpToolClass
void (* initialize) (GimpTool *tool, void (* initialize) (GimpTool *tool,
GimpDisplay *gdisp); GimpDisplay *gdisp);
void (* control) (GimpTool *tool, void (* control) (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp); GimpDisplay *gdisp);
void (* button_press) (GimpTool *tool, void (* button_press) (GimpTool *tool,
@ -127,7 +126,7 @@ GType gimp_tool_get_type (void) G_GNUC_CONST;
void gimp_tool_initialize (GimpTool *tool, void gimp_tool_initialize (GimpTool *tool,
GimpDisplay *gdisp); GimpDisplay *gdisp);
void gimp_tool_control (GimpTool *tool, void gimp_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp); GimpDisplay *gdisp);
void gimp_tool_button_press (GimpTool *tool, void gimp_tool_button_press (GimpTool *tool,

View File

@ -69,7 +69,7 @@ static void gimp_transform_tool_class_init (GimpTransformToolClass *tool);
static void gimp_transform_tool_finalize (GObject *object); static void gimp_transform_tool_finalize (GObject *object);
static void gimp_transform_tool_control (GimpTool *tool, static void gimp_transform_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp); GimpDisplay *gdisp);
static void gimp_transform_tool_button_press (GimpTool *tool, static void gimp_transform_tool_button_press (GimpTool *tool,
GimpCoords *coords, GimpCoords *coords,
@ -247,9 +247,9 @@ gimp_transform_tool_finalize (GObject *object)
} }
static void static void
gimp_transform_tool_control (GimpTool *tool, gimp_transform_tool_control (GimpTool *tool,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp) GimpDisplay *gdisp)
{ {
GimpTransformTool *transform_tool; GimpTransformTool *transform_tool;

View File

@ -326,9 +326,9 @@ tool_manager_initialize_active (Gimp *gimp,
} }
void void
tool_manager_control_active (Gimp *gimp, tool_manager_control_active (Gimp *gimp,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp) GimpDisplay *gdisp)
{ {
GimpToolManager *tool_manager; GimpToolManager *tool_manager;
@ -341,42 +341,9 @@ tool_manager_control_active (Gimp *gimp,
if (tool_manager->active_tool->gdisp == gdisp) if (tool_manager->active_tool->gdisp == gdisp)
{ {
switch (action) gimp_tool_control (tool_manager->active_tool,
{ action,
case PAUSE: gdisp);
if (tool_manager->active_tool->paused_count == 0)
{
gimp_tool_control (tool_manager->active_tool,
action,
gdisp);
}
tool_manager->active_tool->paused_count++;
break;
case RESUME:
tool_manager->active_tool->paused_count--;
if (tool_manager->active_tool->paused_count == 0)
{
gimp_tool_control (tool_manager->active_tool,
action,
gdisp);
}
break;
case HALT:
gimp_tool_control (tool_manager->active_tool,
action,
gdisp);
tool_manager->active_tool->state = INACTIVE;
tool_manager->active_tool->paused_count = 0;
break;
default:
break;
}
} }
else if (action == HALT) else if (action == HALT)
{ {

View File

@ -39,7 +39,7 @@ void tool_manager_pop_tool (Gimp *gimp);
void tool_manager_initialize_active (Gimp *gimp, void tool_manager_initialize_active (Gimp *gimp,
GimpDisplay *gdisp); GimpDisplay *gdisp);
void tool_manager_control_active (Gimp *gimp, void tool_manager_control_active (Gimp *gimp,
ToolAction action, GimpToolAction action,
GimpDisplay *gdisp); GimpDisplay *gdisp);
void tool_manager_button_press_active (Gimp *gimp, void tool_manager_button_press_active (Gimp *gimp,
GimpCoords *coords, GimpCoords *coords,

View File

@ -83,7 +83,7 @@ typedef enum /*< pdb-skip >*/
{ {
INACTIVE, INACTIVE,
ACTIVE ACTIVE
} ToolState; } GimpToolState;
/* Tool control actions */ /* Tool control actions */
typedef enum /*< pdb-skip >*/ typedef enum /*< pdb-skip >*/
@ -91,7 +91,7 @@ typedef enum /*< pdb-skip >*/
PAUSE, PAUSE,
RESUME, RESUME,
HALT HALT
} ToolAction; } GimpToolAction;
/* possible transform functions */ /* possible transform functions */
typedef enum /*< pdb-skip >*/ typedef enum /*< pdb-skip >*/