[gimp] Allow scaling of group layers even though they appear locked



commit 40cf6fa62ad0097e14119b428a243f01f9a6d722
Author: Michael Natterer <mitch gimp org>
Date:   Tue Aug 25 14:31:33 2009 +0200

    Allow scaling of group layers even though they appear locked

 app/actions/layers-actions.c |    6 +++++-
 app/pdb/layer-cmds.c         |   10 ++++++++--
 tools/pdbgen/pdb/layer.pdb   |   10 ++++++++--
 3 files changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/app/actions/layers-actions.c b/app/actions/layers-actions.c
index c1ba256..637aff1 100644
--- a/app/actions/layers-actions.c
+++ b/app/actions/layers-actions.c
@@ -503,6 +503,7 @@ layers_actions_update (GimpActionGroup *group,
   gboolean       can_lock_alpha = FALSE;
   gboolean       text_layer     = FALSE;
   gboolean       writable       = FALSE;
+  gboolean       children       = FALSE;
   GList         *next           = NULL;
   GList         *next_visible   = NULL;
   GList         *prev           = NULL;
@@ -527,6 +528,9 @@ layers_actions_update (GimpActionGroup *group,
           alpha          = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
           writable       = ! gimp_item_get_lock_content (GIMP_ITEM (layer));
 
+          if (gimp_viewable_get_children (GIMP_VIEWABLE (layer)))
+            children = TRUE;
+
           layer_list = gimp_item_get_container_iter (GIMP_ITEM (layer));
 
           list = g_list_find (layer_list, layer);
@@ -591,7 +595,7 @@ layers_actions_update (GimpActionGroup *group,
 
   SET_SENSITIVE ("layers-resize",          writable && !ac);
   SET_SENSITIVE ("layers-resize-to-image", writable && !ac);
-  SET_SENSITIVE ("layers-scale",           writable && !ac);
+  SET_SENSITIVE ("layers-scale",           (writable || children) && !ac);
 
   SET_SENSITIVE ("layers-crop",            writable && sel);
 
diff --git a/app/pdb/layer-cmds.c b/app/pdb/layer-cmds.c
index e64bf7a..aede46e 100644
--- a/app/pdb/layer-cmds.c
+++ b/app/pdb/layer-cmds.c
@@ -288,7 +288,10 @@ layer_scale_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
-      if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), TRUE, error))
+      /*  group items are transformable even though they appear locked  */
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), FALSE, error) &&
+          (gimp_viewable_get_children (GIMP_VIEWABLE (layer)) ||
+           gimp_pdb_item_is_writable (GIMP_ITEM (layer), error)))
         {
           if (progress)
             gimp_progress_start (progress, _("Scaling"), FALSE);
@@ -333,7 +336,10 @@ layer_scale_full_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
-      if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), TRUE, error))
+      /*  group items are transformable even though they appear locked  */
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), FALSE, error) &&
+          (gimp_viewable_get_children (GIMP_VIEWABLE (layer)) ||
+           gimp_pdb_item_is_writable (GIMP_ITEM (layer), error)))
         {
           if (progress)
             gimp_progress_start (progress, _("Scaling"), FALSE);
diff --git a/tools/pdbgen/pdb/layer.pdb b/tools/pdbgen/pdb/layer.pdb
index 6f04d60..8a3439f 100644
--- a/tools/pdbgen/pdb/layer.pdb
+++ b/tools/pdbgen/pdb/layer.pdb
@@ -343,7 +343,10 @@ HELP
     %invoke = (
 	code => <<'CODE'
 {
-  if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), TRUE, error))
+  /*  group items are transformable even though they appear locked  */
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), FALSE, error) &&
+      (gimp_viewable_get_children (GIMP_VIEWABLE (layer)) ||
+       gimp_pdb_item_is_writable (GIMP_ITEM (layer), error)))
     {
       if (progress)
         gimp_progress_start (progress, _("Scaling"), FALSE);
@@ -394,7 +397,10 @@ HELP
     %invoke = (
 	code => <<'CODE'
 {
-  if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), TRUE, error))
+  /*  group items are transformable even though they appear locked  */
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), FALSE, error) &&
+      (gimp_viewable_get_children (GIMP_VIEWABLE (layer)) ||
+       gimp_pdb_item_is_writable (GIMP_ITEM (layer), error)))
     {
       if (progress)
         gimp_progress_start (progress, _("Scaling"), FALSE);



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