Bug 677823 - Shift + mouse click to link all layers does not work
This got lost during layer group porting, reimplement it, but restrict
"all layers" to the clicked layer's branch in the tree.
(cherry picked from commit 67b5a509b6)
This commit is contained in:
parent
8ec18b847c
commit
687fbf4583
3 changed files with 92 additions and 3 deletions
|
|
@ -70,7 +70,7 @@ gimp_item_toggle_exclusive_visible (GimpItem *item,
|
|||
undo = gimp_image_undo_can_compress (image, GIMP_TYPE_UNDO_STACK,
|
||||
GIMP_UNDO_GROUP_ITEM_VISIBILITY);
|
||||
|
||||
if (undo && (g_object_get_data (G_OBJECT (undo), "exclusive-item") ==
|
||||
if (undo && (g_object_get_data (G_OBJECT (undo), "exclusive-visible-item") ==
|
||||
(gpointer) item))
|
||||
push_undo = FALSE;
|
||||
|
||||
|
|
@ -84,7 +84,7 @@ gimp_item_toggle_exclusive_visible (GimpItem *item,
|
|||
GIMP_UNDO_GROUP_ITEM_VISIBILITY);
|
||||
|
||||
if (undo)
|
||||
g_object_set_data (G_OBJECT (undo), "exclusive-item",
|
||||
g_object_set_data (G_OBJECT (undo), "exclusive-visible-item",
|
||||
(gpointer) item);
|
||||
}
|
||||
|
||||
|
|
@ -125,6 +125,93 @@ gimp_item_toggle_exclusive_visible (GimpItem *item,
|
|||
g_list_free (ancestry);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_item_toggle_exclusive_linked (GimpItem *item,
|
||||
GimpContext *context)
|
||||
{
|
||||
GList *on = NULL;
|
||||
GList *off = NULL;
|
||||
GList *list;
|
||||
|
||||
g_return_if_fail (GIMP_IS_ITEM (item));
|
||||
g_return_if_fail (gimp_item_is_attached (item));
|
||||
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
||||
|
||||
for (list = gimp_item_get_container_iter (item);
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
GimpItem *other = list->data;
|
||||
|
||||
if (other != item)
|
||||
{
|
||||
if (gimp_item_get_linked (other))
|
||||
on = g_list_prepend (on, other);
|
||||
else
|
||||
off = g_list_prepend (off, other);
|
||||
}
|
||||
}
|
||||
|
||||
if (on || off || ! gimp_item_get_linked (item))
|
||||
{
|
||||
GimpImage *image = gimp_item_get_image (item);
|
||||
GimpUndo *undo;
|
||||
gboolean push_undo = TRUE;
|
||||
|
||||
undo = gimp_image_undo_can_compress (image, GIMP_TYPE_UNDO_STACK,
|
||||
GIMP_UNDO_GROUP_ITEM_LINKED);
|
||||
|
||||
if (undo && (g_object_get_data (G_OBJECT (undo), "exclusive-linked-item") ==
|
||||
(gpointer) item))
|
||||
push_undo = FALSE;
|
||||
|
||||
if (push_undo)
|
||||
{
|
||||
if (gimp_image_undo_group_start (image,
|
||||
GIMP_UNDO_GROUP_ITEM_LINKED,
|
||||
_("Set Item Exclusive Linked")))
|
||||
{
|
||||
undo = gimp_image_undo_can_compress (image, GIMP_TYPE_UNDO_STACK,
|
||||
GIMP_UNDO_GROUP_ITEM_LINKED);
|
||||
|
||||
if (undo)
|
||||
g_object_set_data (G_OBJECT (undo), "exclusive-linked-item",
|
||||
(gpointer) item);
|
||||
}
|
||||
|
||||
gimp_image_undo_push_item_linked (image, NULL, item);
|
||||
|
||||
for (list = on; list; list = g_list_next (list))
|
||||
gimp_image_undo_push_item_linked (image, NULL, list->data);
|
||||
|
||||
for (list = off; list; list = g_list_next (list))
|
||||
gimp_image_undo_push_item_linked (image, NULL, list->data);
|
||||
|
||||
gimp_image_undo_group_end (image);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_undo_refresh_preview (undo, context);
|
||||
}
|
||||
|
||||
if (off || ! gimp_item_get_linked (item))
|
||||
{
|
||||
gimp_item_set_linked (item, TRUE, FALSE);
|
||||
|
||||
for (list = off; list; list = g_list_next (list))
|
||||
gimp_item_set_linked (list->data, TRUE, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (list = on; list; list = g_list_next (list))
|
||||
gimp_item_set_linked (list->data, FALSE, FALSE);
|
||||
}
|
||||
|
||||
g_list_free (on);
|
||||
g_list_free (off);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
void gimp_item_toggle_exclusive_visible (GimpItem *item,
|
||||
GimpContext *context);
|
||||
void gimp_item_toggle_exclusive_linked (GimpItem *item,
|
||||
GimpContext *context);
|
||||
|
||||
|
||||
#endif /* __GIMP_ITEM_EXCLUSIVE_H__ */
|
||||
|
|
|
|||
|
|
@ -1491,7 +1491,7 @@ gimp_item_tree_view_toggle_clicked (GtkCellRendererToggle *toggle,
|
|||
|
||||
case GIMP_UNDO_ITEM_LINKED:
|
||||
setter = gimp_item_set_linked;
|
||||
exclusive = NULL;
|
||||
exclusive = gimp_item_toggle_exclusive_linked;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
|||
Loading…
Reference in a new issue