[gimp] Bug 612931 - Moving individual layer in layer group not possible with Move Tool in 'pick a layer' mo



commit 80beaa6b5a78feca3f8173f27a838120f25eca0f
Author: Martin Nordholts <martinn src gnome org>
Date:   Sat Aug 20 15:01:46 2011 +0200

    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.

 app/core/gimpgrouplayer.c       |   26 +++++++++++++++++++++++++-
 app/core/gimpimage-pick-layer.c |    3 +--
 2 files changed, 26 insertions(+), 3 deletions(-)
---
diff --git a/app/core/gimpgrouplayer.c b/app/core/gimpgrouplayer.c
index ba6ac85..3c726d2 100644
--- a/app/core/gimpgrouplayer.c
+++ b/app/core/gimpgrouplayer.c
@@ -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
 
@@ -230,6 +239,12 @@ gimp_projectable_iface_init (GimpProjectableInterface *iface)
 }
 
 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)
 {
   GimpGroupLayerPrivate *private = GET_PRIVATE (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  */
 
diff --git a/app/core/gimpimage-pick-layer.c b/app/core/gimpimage-pick-layer.c
index 1f6446e..70e5c91 100644
--- a/app/core/gimpimage-pick-layer.c
+++ b/app/core/gimpimage-pick-layer.c
@@ -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,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]