[gimp] app: add attached-to checks to all raise and lower functions



commit 14b19ecce88ba5e654c5076d2002adb89f0dae6e
Author: Michael Natterer <mitch gimp org>
Date:   Thu Jul 8 21:08:18 2010 +0200

    app: add attached-to checks to all raise and lower functions

 app/pdb/image-cmds.c       |   50 +++++++++++++++++++++++++++++++++++--------
 tools/pdbgen/pdb/image.pdb |   50 +++++++++++++++++++++++++++++++++++--------
 2 files changed, 80 insertions(+), 20 deletions(-)
---
diff --git a/app/pdb/image-cmds.c b/app/pdb/image-cmds.c
index c52e260..4fc5cd7 100644
--- a/app/pdb/image-cmds.c
+++ b/app/pdb/image-cmds.c
@@ -1009,7 +1009,10 @@ image_raise_layer_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
-      success = gimp_image_raise_item (image, GIMP_ITEM (layer), error);
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), image, FALSE, error))
+        success = gimp_image_raise_item (image, GIMP_ITEM (layer), error);
+      else
+        success = FALSE;
     }
 
   return gimp_procedure_get_return_values (procedure, success,
@@ -1033,7 +1036,10 @@ image_lower_layer_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
-      success = gimp_image_lower_item (image, GIMP_ITEM (layer), error);
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), image, FALSE, error))
+        success = gimp_image_lower_item (image, GIMP_ITEM (layer), error);
+      else
+        success = FALSE;
     }
 
   return gimp_procedure_get_return_values (procedure, success,
@@ -1057,7 +1063,10 @@ image_raise_layer_to_top_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
-      success = gimp_image_raise_item_to_top (image, GIMP_ITEM (layer));
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), image, FALSE, error))
+        success = gimp_image_raise_item_to_top (image, GIMP_ITEM (layer));
+      else
+        success = FALSE;
     }
 
   return gimp_procedure_get_return_values (procedure, success,
@@ -1081,7 +1090,10 @@ image_lower_layer_to_bottom_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
-      success = gimp_image_lower_item_to_bottom (image, GIMP_ITEM (layer));
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), image, FALSE, error))
+        success = gimp_image_lower_item_to_bottom (image, GIMP_ITEM (layer));
+      else
+        success = FALSE;
     }
 
   return gimp_procedure_get_return_values (procedure, success,
@@ -1203,7 +1215,10 @@ image_raise_channel_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
-      success = gimp_image_raise_item (image, GIMP_ITEM (channel), error);
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (channel), image, FALSE, error))
+        success = gimp_image_raise_item (image, GIMP_ITEM (channel), error);
+      else
+        success = FALSE;
     }
 
   return gimp_procedure_get_return_values (procedure, success,
@@ -1227,7 +1242,10 @@ image_lower_channel_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
-      success = gimp_image_lower_item (image, GIMP_ITEM (channel), error);
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (channel), image, FALSE, error))
+        success = gimp_image_lower_item (image, GIMP_ITEM (channel), error);
+      else
+        success = FALSE;
     }
 
   return gimp_procedure_get_return_values (procedure, success,
@@ -1349,7 +1367,10 @@ image_raise_vectors_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
-      success = gimp_image_raise_item (image, GIMP_ITEM (vectors), error);
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (vectors), image, FALSE, error))
+        success = gimp_image_raise_item (image, GIMP_ITEM (vectors), error);
+      else
+        success = FALSE;
     }
 
   return gimp_procedure_get_return_values (procedure, success,
@@ -1373,7 +1394,10 @@ image_lower_vectors_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
-      success = gimp_image_lower_item (image, GIMP_ITEM (vectors), error);
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (vectors), image, FALSE, error))
+        success = gimp_image_lower_item (image, GIMP_ITEM (vectors), error);
+      else
+        success = FALSE;
     }
 
   return gimp_procedure_get_return_values (procedure, success,
@@ -1397,7 +1421,10 @@ image_raise_vectors_to_top_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
-      success = gimp_image_raise_item_to_top (image, GIMP_ITEM (vectors));
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (vectors), image, FALSE, error))
+        success = gimp_image_raise_item_to_top (image, GIMP_ITEM (vectors));
+      else
+        success = FALSE;
     }
 
   return gimp_procedure_get_return_values (procedure, success,
@@ -1421,7 +1448,10 @@ image_lower_vectors_to_bottom_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
-      success = gimp_image_lower_item_to_bottom (image, GIMP_ITEM (vectors));
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (vectors), image, FALSE, error))
+        success = gimp_image_lower_item_to_bottom (image, GIMP_ITEM (vectors));
+      else
+        success = FALSE;
     }
 
   return gimp_procedure_get_return_values (procedure, success,
diff --git a/tools/pdbgen/pdb/image.pdb b/tools/pdbgen/pdb/image.pdb
index a57fdb0..70cc1ec 100644
--- a/tools/pdbgen/pdb/image.pdb
+++ b/tools/pdbgen/pdb/image.pdb
@@ -780,7 +780,10 @@ HELP
     %invoke = (
 	code => <<'CODE'
 {
-  success = gimp_image_raise_item (image, GIMP_ITEM (layer), error);
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), image, FALSE, error))
+    success = gimp_image_raise_item (image, GIMP_ITEM (layer), error);
+  else
+    success = FALSE;
 }
 CODE
     );
@@ -806,7 +809,10 @@ HELP
     %invoke = (
 	code => <<'CODE'
 {
-  success = gimp_image_lower_item (image, GIMP_ITEM (layer), error);
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), image, FALSE, error))
+    success = gimp_image_lower_item (image, GIMP_ITEM (layer), error);
+  else
+    success = FALSE;
 }
 CODE
     );
@@ -835,7 +841,10 @@ HELP
     %invoke = (
 	code => <<'CODE'
 {
-  success = gimp_image_raise_item_to_top (image, GIMP_ITEM (layer));
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), image, FALSE, error))
+    success = gimp_image_raise_item_to_top (image, GIMP_ITEM (layer));
+  else
+    success = FALSE;
 }
 CODE
     );
@@ -864,7 +873,10 @@ HELP
     %invoke = (
 	code => <<'CODE'
 {
-  success = gimp_image_lower_item_to_bottom (image, GIMP_ITEM (layer));
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), image, FALSE, error))
+    success = gimp_image_lower_item_to_bottom (image, GIMP_ITEM (layer));
+  else
+    success = FALSE;
 }
 CODE
     );
@@ -1174,7 +1186,10 @@ HELP
     %invoke = (
 	code => <<'CODE'
 {
-  success = gimp_image_raise_item (image, GIMP_ITEM (channel), error);
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (channel), image, FALSE, error))
+    success = gimp_image_raise_item (image, GIMP_ITEM (channel), error);
+  else
+    success = FALSE;
 }
 CODE
     );
@@ -1201,7 +1216,10 @@ HELP
     %invoke = (
 	code => <<'CODE'
 {
-  success = gimp_image_lower_item (image, GIMP_ITEM (channel), error);
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (channel), image, FALSE, error))
+    success = gimp_image_lower_item (image, GIMP_ITEM (channel), error);
+  else
+    success = FALSE;
 }
 CODE
     );
@@ -1398,7 +1416,10 @@ HELP
     %invoke = (
 	code => <<'CODE'
 {
-  success = gimp_image_raise_item (image, GIMP_ITEM (vectors), error);
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (vectors), image, FALSE, error))
+    success = gimp_image_raise_item (image, GIMP_ITEM (vectors), error);
+  else
+    success = FALSE;
 }
 CODE
     );
@@ -1425,7 +1446,10 @@ HELP
     %invoke = (
 	code => <<'CODE'
 {
-  success = gimp_image_lower_item (image, GIMP_ITEM (vectors), error);
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (vectors), image, FALSE, error))
+    success = gimp_image_lower_item (image, GIMP_ITEM (vectors), error);
+  else
+    success = FALSE;
 }
 CODE
     );
@@ -1454,7 +1478,10 @@ HELP
     %invoke = (
 	code => <<'CODE'
 {
-  success = gimp_image_raise_item_to_top (image, GIMP_ITEM (vectors));
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (vectors), image, FALSE, error))
+    success = gimp_image_raise_item_to_top (image, GIMP_ITEM (vectors));
+  else
+    success = FALSE;
 }
 CODE
     );
@@ -1483,7 +1510,10 @@ HELP
     %invoke = (
 	code => <<'CODE'
 {
-  success = gimp_image_lower_item_to_bottom (image, GIMP_ITEM (vectors));
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (vectors), image, FALSE, error))
+    success = gimp_image_lower_item_to_bottom (image, GIMP_ITEM (vectors));
+  else
+    success = FALSE;
 }
 CODE
     );



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