removed again (tools must not draw outside GimpDrawTool::draw()).

2004-06-28  Michael Natterer  <mitch@gimp.org>

	* app/tools/gimpclonetool.c (gimp_clone_tool_button_release):
	removed again (tools must not draw outside GimpDrawTool::draw()).

	(gimp_clone_tool_draw): removed check for gimp_draw_tool_is_active()
	because the draw function would not be called if the draw tool was
	inactive. Simplified check for whether or not to draw the src
	location.

	* app/tools/gimppainttool.c (gimp_paint_tool_button_release):
	pause/resume the draw tool across all button_release actions so
	tools (clone) have a chance to draw different things depending on
	gimp_tool_control_is_active(tool->control). Fixes bug #145022.
This commit is contained in:
Michael Natterer 2004-06-28 11:36:00 +00:00 committed by Michael Natterer
parent 33fb67bcdb
commit c186126083
5 changed files with 47 additions and 116 deletions

View File

@ -1,3 +1,18 @@
2004-06-28 Michael Natterer <mitch@gimp.org>
* app/tools/gimpclonetool.c (gimp_clone_tool_button_release):
removed again (tools must not draw outside GimpDrawTool::draw()).
(gimp_clone_tool_draw): removed check for gimp_draw_tool_is_active()
because the draw function would not be called if the draw tool was
inactive. Simplified check for whether or not to draw the src
location.
* app/tools/gimppainttool.c (gimp_paint_tool_button_release):
pause/resume the draw tool across all button_release actions so
tools (clone) have a chance to draw different things depending on
gimp_tool_control_is_active(tool->control). Fixes bug #145022.
2004-06-28 Sven Neumann <sven@gimp.org>
* app/actions/actions.c (action_select_object): added missing

View File

@ -483,6 +483,8 @@ gimp_paint_tool_button_release (GimpTool *tool,
drawable = gimp_image_active_drawable (gdisp->gimage);
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
/* Let the specific painting function finish up */
gimp_paint_core_paint (core, drawable, paint_options, FINISH_PAINT, time);
@ -499,6 +501,8 @@ gimp_paint_tool_button_release (GimpTool *tool,
gimp_paint_core_finish (core, drawable);
gimp_image_flush (gdisp->gimage);
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
}
static void

View File

@ -60,11 +60,6 @@ static void gimp_clone_tool_motion (GimpTool *tool,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp);
static void gimp_clone_tool_button_release (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp);
static void gimp_clone_tool_cursor_update (GimpTool *tool,
GimpCoords *coords,
@ -135,7 +130,6 @@ gimp_clone_tool_class_init (GimpCloneToolClass *klass)
tool_class->button_press = gimp_clone_tool_button_press;
tool_class->motion = gimp_clone_tool_motion;
tool_class->button_release = gimp_clone_tool_button_release;
tool_class->cursor_update = gimp_clone_tool_cursor_update;
draw_tool_class->draw = gimp_clone_tool_draw;
@ -184,40 +178,6 @@ gimp_clone_tool_motion (GimpTool *tool,
GIMP_TOOL_CLASS (parent_class)->motion (tool, coords, time, state, gdisp);
}
static void
gimp_clone_tool_button_release (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp)
{
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
GimpClone *clone;
clone = GIMP_CLONE (paint_tool->core);
if ((state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) == GDK_CONTROL_MASK)
{}
else if (clone->src_drawable && ! clone->first_stroke )
{
gint off_x;
gint off_y;
gimp_item_offsets (GIMP_ITEM (clone->src_drawable),
&off_x, &off_y);
gimp_draw_tool_draw_handle (GIMP_DRAW_TOOL (tool),
GIMP_HANDLE_CROSS,
clone->src_x + off_x,
clone->src_y + off_y,
TARGET_WIDTH, TARGET_WIDTH,
GTK_ANCHOR_CENTER,
FALSE);
}
GIMP_TOOL_CLASS (parent_class)->button_release (tool, coords, time, state, gdisp);
}
void
gimp_clone_tool_cursor_update (GimpTool *tool,
GimpCoords *coords,
@ -262,31 +222,25 @@ gimp_clone_tool_draw (GimpDrawTool *draw_tool)
if (gimp_tool_control_is_active (tool->control))
{
GimpClone *clone = GIMP_CLONE (GIMP_PAINT_TOOL (draw_tool)->core);
GimpCloneOptions *options;
options = (GimpCloneOptions *) tool->tool_info->tool_options;
if (gimp_draw_tool_is_active (draw_tool) &&
options->clone_type == GIMP_IMAGE_CLONE)
if (options->clone_type == GIMP_IMAGE_CLONE && clone->src_drawable)
{
GimpClone *clone = GIMP_CLONE (GIMP_PAINT_TOOL (draw_tool)->core);
gint off_x;
gint off_y;
if (clone->src_drawable && ! clone->first_stroke )
{
gint off_x;
gint off_y;
gimp_item_offsets (GIMP_ITEM (clone->src_drawable), &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (clone->src_drawable),
&off_x, &off_y);
gimp_draw_tool_draw_handle (draw_tool,
GIMP_HANDLE_CROSS,
clone->src_x + off_x,
clone->src_y + off_y,
TARGET_WIDTH, TARGET_WIDTH,
GTK_ANCHOR_CENTER,
FALSE);
}
gimp_draw_tool_draw_handle (draw_tool,
GIMP_HANDLE_CROSS,
clone->src_x + off_x,
clone->src_y + off_y,
TARGET_WIDTH, TARGET_WIDTH,
GTK_ANCHOR_CENTER,
FALSE);
}
}

View File

@ -483,6 +483,8 @@ gimp_paint_tool_button_release (GimpTool *tool,
drawable = gimp_image_active_drawable (gdisp->gimage);
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
/* Let the specific painting function finish up */
gimp_paint_core_paint (core, drawable, paint_options, FINISH_PAINT, time);
@ -499,6 +501,8 @@ gimp_paint_tool_button_release (GimpTool *tool,
gimp_paint_core_finish (core, drawable);
gimp_image_flush (gdisp->gimage);
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
}
static void

View File

@ -60,11 +60,6 @@ static void gimp_clone_tool_motion (GimpTool *tool,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp);
static void gimp_clone_tool_button_release (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp);
static void gimp_clone_tool_cursor_update (GimpTool *tool,
GimpCoords *coords,
@ -135,7 +130,6 @@ gimp_clone_tool_class_init (GimpCloneToolClass *klass)
tool_class->button_press = gimp_clone_tool_button_press;
tool_class->motion = gimp_clone_tool_motion;
tool_class->button_release = gimp_clone_tool_button_release;
tool_class->cursor_update = gimp_clone_tool_cursor_update;
draw_tool_class->draw = gimp_clone_tool_draw;
@ -184,40 +178,6 @@ gimp_clone_tool_motion (GimpTool *tool,
GIMP_TOOL_CLASS (parent_class)->motion (tool, coords, time, state, gdisp);
}
static void
gimp_clone_tool_button_release (GimpTool *tool,
GimpCoords *coords,
guint32 time,
GdkModifierType state,
GimpDisplay *gdisp)
{
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
GimpClone *clone;
clone = GIMP_CLONE (paint_tool->core);
if ((state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) == GDK_CONTROL_MASK)
{}
else if (clone->src_drawable && ! clone->first_stroke )
{
gint off_x;
gint off_y;
gimp_item_offsets (GIMP_ITEM (clone->src_drawable),
&off_x, &off_y);
gimp_draw_tool_draw_handle (GIMP_DRAW_TOOL (tool),
GIMP_HANDLE_CROSS,
clone->src_x + off_x,
clone->src_y + off_y,
TARGET_WIDTH, TARGET_WIDTH,
GTK_ANCHOR_CENTER,
FALSE);
}
GIMP_TOOL_CLASS (parent_class)->button_release (tool, coords, time, state, gdisp);
}
void
gimp_clone_tool_cursor_update (GimpTool *tool,
GimpCoords *coords,
@ -262,31 +222,25 @@ gimp_clone_tool_draw (GimpDrawTool *draw_tool)
if (gimp_tool_control_is_active (tool->control))
{
GimpClone *clone = GIMP_CLONE (GIMP_PAINT_TOOL (draw_tool)->core);
GimpCloneOptions *options;
options = (GimpCloneOptions *) tool->tool_info->tool_options;
if (gimp_draw_tool_is_active (draw_tool) &&
options->clone_type == GIMP_IMAGE_CLONE)
if (options->clone_type == GIMP_IMAGE_CLONE && clone->src_drawable)
{
GimpClone *clone = GIMP_CLONE (GIMP_PAINT_TOOL (draw_tool)->core);
gint off_x;
gint off_y;
if (clone->src_drawable && ! clone->first_stroke )
{
gint off_x;
gint off_y;
gimp_item_offsets (GIMP_ITEM (clone->src_drawable), &off_x, &off_y);
gimp_item_offsets (GIMP_ITEM (clone->src_drawable),
&off_x, &off_y);
gimp_draw_tool_draw_handle (draw_tool,
GIMP_HANDLE_CROSS,
clone->src_x + off_x,
clone->src_y + off_y,
TARGET_WIDTH, TARGET_WIDTH,
GTK_ANCHOR_CENTER,
FALSE);
}
gimp_draw_tool_draw_handle (draw_tool,
GIMP_HANDLE_CROSS,
clone->src_x + off_x,
clone->src_y + off_y,
TARGET_WIDTH, TARGET_WIDTH,
GTK_ANCHOR_CENTER,
FALSE);
}
}