Commit 76d95a10 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

added new parameter "gboolean propagate_release" to

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

	* app/tools/gimpeditselectiontool.[ch]: added new parameter
	"gboolean propagate_release" to gimp_edit_slection_tool_start()
	and remember it in the GimpEditSelectionTool struct. If requested,
	propagate GimpTool::button_release() to the tool below in the tool
	stack.

	* app/tools/gimpselectiontool.c (gimp_selection_tool_start_edit):
	pass FALSE so we don't get the button_release().

	* app/tools/gimpmovetool.[ch]: pass TRUE so we get
	button_release(). If moving a layer or path in "pick active" mode,
	remember the old active layer/path and switch back to it in
	button_release(). Fixes bug #97734.

	Unrelated:

	* app/tools/gimpeditselectiontool.c
	(gimp_edit_selection_tool_motion): set "first_move" to FALSE only
	if a move actually happened. Fixes un-undoable moves at high zoom
	factors.
parent da1a2de8
2004-10-06 Michael Natterer <mitch@gimp.org>
* app/tools/gimpeditselectiontool.[ch]: added new parameter
"gboolean propagate_release" to gimp_edit_slection_tool_start()
and remember it in the GimpEditSelectionTool struct. If requested,
propagate GimpTool::button_release() to the tool below in the tool
stack.
* app/tools/gimpselectiontool.c (gimp_selection_tool_start_edit):
pass FALSE so we don't get the button_release().
* app/tools/gimpmovetool.[ch]: pass TRUE so we get
button_release(). If moving a layer or path in "pick active" mode,
remember the old active layer/path and switch back to it in
button_release(). Fixes bug #97734.
Unrelated:
* app/tools/gimpeditselectiontool.c
(gimp_edit_selection_tool_motion): set "first_move" to FALSE only
if a move actually happened. Fixes un-undoable moves at high zoom
factors.
2004-10-06 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpdnd.c (gimp_dnd_data_drag_begin): remember for
......
......@@ -91,6 +91,8 @@ struct _GimpEditSelectionTool
GimpTranslateMode edit_mode; /* Translate the mask or layer? */
gboolean first_move; /* Don't push undos after the first */
gboolean propagate_release;
};
struct _GimpEditSelectionToolClass
......@@ -206,7 +208,8 @@ void
gimp_edit_selection_tool_start (GimpTool *parent_tool,
GimpDisplay *gdisp,
GimpCoords *coords,
GimpTranslateMode edit_mode)
GimpTranslateMode edit_mode,
gboolean propagate_release)
{
GimpEditSelectionTool *edit_select;
GimpDisplayShell *shell;
......@@ -216,6 +219,8 @@ gimp_edit_selection_tool_start (GimpTool *parent_tool,
edit_select = g_object_new (GIMP_TYPE_EDIT_SELECTION_TOOL, NULL);
edit_select->propagate_release = propagate_release;
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
/* Make a check to see if it should be a floating selection translation */
......@@ -568,6 +573,14 @@ gimp_edit_selection_tool_button_release (GimpTool *tool,
edit_select->num_segs_in = 0;
edit_select->num_segs_out = 0;
if (edit_select->propagate_release &&
tool_manager_get_active (gdisp->gimage->gimp))
{
tool_manager_button_release_active (gdisp->gimage->gimp,
coords, time, state,
gdisp);
}
g_object_unref (edit_select);
}
......@@ -704,6 +717,8 @@ gimp_edit_selection_tool_motion (GimpTool *tool,
default:
g_warning ("esm / BAD FALLTHROUGH");
}
edit_select->first_move = FALSE;
}
gimp_projection_flush (gdisp->gimage->projection);
......@@ -711,8 +726,6 @@ gimp_edit_selection_tool_motion (GimpTool *tool,
/********************************************************************/
/********************************************************************/
edit_select->first_move = FALSE;
gimp_tool_pop_status (tool);
gimp_tool_push_status_coords (tool,
......
......@@ -23,7 +23,8 @@
void gimp_edit_selection_tool_start (GimpTool *parent_tool,
GimpDisplay *gdisp,
GimpCoords *coords,
GimpTranslateMode edit_mode);
GimpTranslateMode edit_mode,
gboolean propagate_release);
gboolean gimp_edit_selection_tool_key_press (GimpTool *tool,
......
......@@ -167,14 +167,17 @@ gimp_move_tool_init (GimpMoveTool *move_tool)
{
GimpTool *tool = GIMP_TOOL (move_tool);
move_tool->layer = NULL;
move_tool->guide = NULL;
move_tool->floating_layer = NULL;
move_tool->guide = NULL;
move_tool->moving_guide = FALSE;
move_tool->guide_position = -1;
move_tool->guide_orientation = GIMP_ORIENTATION_UNKNOWN;
move_tool->moving_guide = FALSE;
move_tool->guide_position = -1;
move_tool->guide_orientation = GIMP_ORIENTATION_UNKNOWN;
move_tool->saved_type = GIMP_TRANSFORM_TYPE_LAYER;
move_tool->saved_type = GIMP_TRANSFORM_TYPE_LAYER;
move_tool->old_active_layer = NULL;
move_tool->old_active_vectors = NULL;
gimp_tool_control_set_snap_to (tool->control, FALSE);
gimp_tool_control_set_handles_empty_image (tool->control, TRUE);
......@@ -229,9 +232,11 @@ gimp_move_tool_button_press (GimpTool *tool,
tool->gdisp = gdisp;
move->layer = NULL;
move->guide = NULL;
move->moving_guide = FALSE;
move->floating_layer = NULL;
move->guide = NULL;
move->moving_guide = FALSE;
move->old_active_layer = NULL;
move->old_active_vectors = NULL;
if (! options->move_current)
{
......@@ -243,6 +248,9 @@ gimp_move_tool_button_press (GimpTool *tool,
coords, 7, 7,
NULL, NULL, NULL, NULL, NULL, &vectors))
{
move->old_active_vectors =
gimp_image_get_active_vectors (gdisp->gimage);
gimp_image_set_active_vectors (gdisp->gimage, vectors);
}
else
......@@ -292,13 +300,16 @@ gimp_move_tool_button_press (GimpTool *tool,
/* If there is a floating selection, and this aint it,
* use the move tool to anchor it.
*/
move->layer = gimp_image_floating_sel (gdisp->gimage);
move->floating_layer = gimp_image_floating_sel (gdisp->gimage);
gimp_tool_control_activate (tool->control);
return;
}
else
{
move->old_active_layer =
gimp_image_get_active_layer (gdisp->gimage);
gimp_image_set_active_layer (gdisp->gimage, layer);
}
}
......@@ -316,13 +327,13 @@ gimp_move_tool_button_press (GimpTool *tool,
case GIMP_TRANSFORM_TYPE_PATH:
if (gimp_image_get_active_vectors (gdisp->gimage))
gimp_edit_selection_tool_start (tool, gdisp, coords,
GIMP_TRANSLATE_MODE_VECTORS);
GIMP_TRANSLATE_MODE_VECTORS, TRUE);
break;
case GIMP_TRANSFORM_TYPE_SELECTION:
if (! gimp_channel_is_empty (gimp_image_get_mask (gdisp->gimage)))
gimp_edit_selection_tool_start (tool, gdisp, coords,
GIMP_TRANSLATE_MODE_MASK);
GIMP_TRANSLATE_MODE_MASK, TRUE);
break;
case GIMP_TRANSFORM_TYPE_LAYER:
......@@ -331,13 +342,13 @@ gimp_move_tool_button_press (GimpTool *tool,
if (GIMP_IS_LAYER_MASK (drawable))
gimp_edit_selection_tool_start (tool, gdisp, coords,
GIMP_TRANSLATE_MODE_LAYER_MASK);
GIMP_TRANSLATE_MODE_LAYER_MASK, TRUE);
else if (GIMP_IS_CHANNEL (drawable))
gimp_edit_selection_tool_start (tool, gdisp, coords,
GIMP_TRANSLATE_MODE_CHANNEL);
GIMP_TRANSLATE_MODE_CHANNEL, TRUE);
else if (GIMP_IS_LAYER (drawable))
gimp_edit_selection_tool_start (tool, gdisp, coords,
GIMP_TRANSLATE_MODE_LAYER);
GIMP_TRANSLATE_MODE_LAYER, TRUE);
}
break;
}
......@@ -353,7 +364,8 @@ gimp_move_tool_button_release (GimpTool *tool,
GimpMoveTool *move = GIMP_MOVE_TOOL (tool);
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimp_tool_control_halt (tool->control);
if (gimp_tool_control_is_active (tool->control))
gimp_tool_control_halt (tool->control);
if (move->moving_guide)
{
......@@ -443,12 +455,26 @@ gimp_move_tool_button_release (GimpTool *tool,
}
else
{
if (move->old_active_layer)
{
gimp_image_set_active_layer (gdisp->gimage,
move->old_active_layer);
move->old_active_layer = NULL;
}
if (move->old_active_vectors)
{
gimp_image_set_active_vectors (gdisp->gimage,
move->old_active_vectors);
move->old_active_vectors = NULL;
}
/* Take care of the case where the user "cancels" the action */
if (! (state & GDK_BUTTON3_MASK))
{
if (move->layer)
if (move->floating_layer)
{
floating_sel_anchor (move->layer);
floating_sel_anchor (move->floating_layer);
gimp_image_flush (gdisp->gimage);
}
}
......
......@@ -38,7 +38,7 @@ struct _GimpMoveTool
{
GimpDrawTool parent_instance;
GimpLayer *layer;
GimpLayer *floating_layer;
GimpGuide *guide;
gboolean moving_guide;
......@@ -46,6 +46,9 @@ struct _GimpMoveTool
GimpOrientationType guide_orientation;
GimpTransformType saved_type;
GimpLayer *old_active_layer;
GimpVectors *old_active_vectors;
};
struct _GimpMoveToolClass
......
......@@ -293,17 +293,18 @@ gimp_selection_tool_start_edit (GimpSelectionTool *sel_tool,
{
case SELECTION_MOVE_MASK:
gimp_edit_selection_tool_start (tool, tool->gdisp, coords,
GIMP_TRANSLATE_MODE_MASK);
GIMP_TRANSLATE_MODE_MASK, FALSE);
return TRUE;
case SELECTION_MOVE:
gimp_edit_selection_tool_start (tool, tool->gdisp, coords,
GIMP_TRANSLATE_MODE_MASK_TO_LAYER);
GIMP_TRANSLATE_MODE_MASK_TO_LAYER, FALSE);
return TRUE;
case SELECTION_MOVE_COPY:
gimp_edit_selection_tool_start (tool, tool->gdisp, coords,
GIMP_TRANSLATE_MODE_MASK_COPY_TO_LAYER);
GIMP_TRANSLATE_MODE_MASK_COPY_TO_LAYER,
FALSE);
return TRUE;
default:
......
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