Commit e0e82558 authored by Ell's avatar Ell
Browse files

Issue #2308 - Strange behavior when switching active layer during transform

Replace GimpTransformTool's 'drawable' field with an 'item' field,
and have GimpTransformGridTool set it to the active item, to which
the transformation is applied, during its initialization.  In
gimp_transform_tool_get_active_item(), return the value of the
transform tool's 'item' field, if not NULL, instead of the image's
active item.  This makes sure we apply that transform-grid tools
apply the transformation for the item for which they were
activated, even if the image's active item has changed.

(cherry picked from commit 3eaae585)
parent 32c2aa11
......@@ -252,10 +252,10 @@ gimp_transform_grid_tool_initialize (GimpTool *tool,
if (! item)
return FALSE;
tool->display = display;
tool->drawable = drawable;
tool->display = display;
tool->drawable = drawable;
tr_tool->drawable = drawable;
tr_tool->item = item;
/* Initialize the transform_grid tool dialog */
if (! tg_tool->gui)
......@@ -873,10 +873,10 @@ gimp_transform_grid_tool_halt (GimpTransformGridTool *tg_tool)
gimp_transform_grid_tool_show_active_item (tg_tool);
tool->display = NULL;
tool->drawable = NULL;
tool->display = NULL;
tool->drawable = NULL;
tr_tool->drawable = NULL;
tr_tool->item = NULL;
}
static void
......
......@@ -458,6 +458,9 @@ gimp_transform_tool_get_active_item (GimpTransformTool *tr_tool,
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
if (tr_tool->item)
return tr_tool->item;
switch (options->type)
{
case GIMP_TRANSFORM_TYPE_LAYER:
......@@ -510,7 +513,7 @@ gimp_transform_tool_check_active_item (GimpTransformTool *tr_tool,
locked_message = _("The active layer's position and size are locked.");
if (! gimp_item_is_visible (item) &&
GIMP_DRAWABLE (item) != tr_tool->drawable) /* see bug #759194 */
item != tr_tool->item) /* see bug #759194 */
{
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
_("The active layer is not visible."));
......
......@@ -47,7 +47,7 @@ struct _GimpTransformTool
{
GimpDrawTool parent_instance;
GimpDrawable *drawable;
GimpItem *item;
gint x1, y1; /* upper left hand coordinate */
gint x2, y2; /* lower right hand coords */
......
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