Bug 612931 - Moving individual layer in layer group not possible with Move Tool in 'pick a layer' mode

When using GimpPickable::get_opacity_at(), don't consider group layers
as having content.
This commit is contained in:
Martin Nordholts 2011-08-20 15:01:46 +02:00
parent 743f6a5035
commit 80beaa6b5a
2 changed files with 26 additions and 3 deletions

View File

@ -65,6 +65,7 @@ struct _GimpGroupLayerPrivate
static void gimp_projectable_iface_init (GimpProjectableInterface *iface);
static void gimp_pickable_iface_init (GimpPickableInterface *iface);
static void gimp_group_layer_finalize (GObject *object);
static void gimp_group_layer_set_property (GObject *object,
@ -135,6 +136,11 @@ static void gimp_group_layer_convert_type (GimpDrawable *drawabl
static GeglNode * gimp_group_layer_get_graph (GimpProjectable *projectable);
static GList * gimp_group_layer_get_layers (GimpProjectable *projectable);
static gint gimp_group_layer_get_opacity_at
(GimpPickable *pickable,
gint x,
gint y);
static void gimp_group_layer_child_add (GimpContainer *container,
GimpLayer *child,
@ -168,7 +174,10 @@ static void gimp_group_layer_proj_update (GimpProjection *proj,
G_DEFINE_TYPE_WITH_CODE (GimpGroupLayer, gimp_group_layer, GIMP_TYPE_LAYER,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_PROJECTABLE,
gimp_projectable_iface_init))
gimp_projectable_iface_init)
G_IMPLEMENT_INTERFACE (GIMP_TYPE_PICKABLE,
gimp_pickable_iface_init))
#define parent_class gimp_group_layer_parent_class
@ -229,6 +238,12 @@ gimp_projectable_iface_init (GimpProjectableInterface *iface)
iface->get_channels = NULL;
}
static void
gimp_pickable_iface_init (GimpPickableInterface *iface)
{
iface->get_opacity_at = gimp_group_layer_get_opacity_at;
}
static void
gimp_group_layer_init (GimpGroupLayer *group)
{
@ -871,6 +886,15 @@ gimp_group_layer_get_layers (GimpProjectable *projectable)
return gimp_item_stack_get_item_iter (GIMP_ITEM_STACK (private->children));
}
static gint
gimp_group_layer_get_opacity_at (GimpPickable *pickable,
gint x,
gint y)
{
/* Only consider child layers as having content */
return 0;
}
/* public functions */

View File

@ -133,8 +133,7 @@ gimp_image_pick_text_layer (const GimpImage *image,
return GIMP_TEXT_LAYER (layer);
}
else if (! GIMP_IS_GROUP_LAYER (layer) &&
gimp_pickable_get_opacity_at (GIMP_PICKABLE (layer),
else if (gimp_pickable_get_opacity_at (GIMP_PICKABLE (layer),
x - off_x, y - off_y) > 63)
{
/* a normal layer covers any possible text layers below,