[gimp] libgimp: add item based API for positions (raise, lower etc.)



commit 0d35e8de6d79607c0c7fc820884367e39c85fe41
Author: Michael Natterer <mitch gimp org>
Date:   Fri Aug 27 16:11:06 2010 +0200

    libgimp: add item based API for positions (raise, lower etc.)
    
    and deprecate the resp. functions for layers, channels and vectors.

 app/pdb/image-cmds.c       |  912 +++++++++++++++++++++++++++++---------------
 app/pdb/internal-procs.c   |    2 +-
 libgimp/gimpimage_pdb.c    |  455 ++++++++++++++--------
 libgimp/gimpimage_pdb.h    |   32 +-
 tools/pdbgen/pdb/image.pdb |  288 +++++++++------
 5 files changed, 1087 insertions(+), 602 deletions(-)
---
diff --git a/app/pdb/image-cmds.c b/app/pdb/image-cmds.c
index 254062d..e5a6918 100644
--- a/app/pdb/image-cmds.c
+++ b/app/pdb/image-cmds.c
@@ -44,6 +44,7 @@
 #include "core/gimpimage-rotate.h"
 #include "core/gimpimage-scale.h"
 #include "core/gimpimage.h"
+#include "core/gimpitem.h"
 #include "core/gimplayer.h"
 #include "core/gimplayermask.h"
 #include "core/gimpparamspecs.h"
@@ -957,6 +958,272 @@ image_remove_layer_invoker (GimpProcedure      *procedure,
 }
 
 static GValueArray *
+image_add_channel_invoker (GimpProcedure      *procedure,
+                           Gimp               *gimp,
+                           GimpContext        *context,
+                           GimpProgress       *progress,
+                           const GValueArray  *args,
+                           GError            **error)
+{
+  gboolean success = TRUE;
+  GimpImage *image;
+  GimpChannel *channel;
+  gint32 position;
+
+  image = gimp_value_get_image (&args->values[0], gimp);
+  channel = gimp_value_get_channel (&args->values[1], gimp);
+  position = g_value_get_int (&args->values[2]);
+
+  if (success)
+    {
+      if (gimp_pdb_item_is_floating (GIMP_ITEM (channel), image, error))
+        {
+          /* FIXME tree */
+          success = gimp_image_add_channel (image, channel,
+                                            NULL, MAX (position, -1), TRUE);
+        }
+      else
+        {
+          success = FALSE;
+        }
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GValueArray *
+image_remove_channel_invoker (GimpProcedure      *procedure,
+                              Gimp               *gimp,
+                              GimpContext        *context,
+                              GimpProgress       *progress,
+                              const GValueArray  *args,
+                              GError            **error)
+{
+  gboolean success = TRUE;
+  GimpImage *image;
+  GimpChannel *channel;
+
+  image = gimp_value_get_image (&args->values[0], gimp);
+  channel = gimp_value_get_channel (&args->values[1], gimp);
+
+  if (success)
+    {
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (channel), image, FALSE, error))
+        gimp_image_remove_channel (image, channel, TRUE, NULL);
+      else
+        success = FALSE;
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GValueArray *
+image_add_vectors_invoker (GimpProcedure      *procedure,
+                           Gimp               *gimp,
+                           GimpContext        *context,
+                           GimpProgress       *progress,
+                           const GValueArray  *args,
+                           GError            **error)
+{
+  gboolean success = TRUE;
+  GimpImage *image;
+  GimpVectors *vectors;
+  gint32 position;
+
+  image = gimp_value_get_image (&args->values[0], gimp);
+  vectors = gimp_value_get_vectors (&args->values[1], gimp);
+  position = g_value_get_int (&args->values[2]);
+
+  if (success)
+    {
+      if (gimp_pdb_item_is_floating (GIMP_ITEM (vectors), image, error))
+        {
+          /* FIXME tree */
+          success = gimp_image_add_vectors (image, vectors,
+                                            NULL, MAX (position, -1), TRUE);
+        }
+      else
+        {
+          success = FALSE;
+        }
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GValueArray *
+image_remove_vectors_invoker (GimpProcedure      *procedure,
+                              Gimp               *gimp,
+                              GimpContext        *context,
+                              GimpProgress       *progress,
+                              const GValueArray  *args,
+                              GError            **error)
+{
+  gboolean success = TRUE;
+  GimpImage *image;
+  GimpVectors *vectors;
+
+  image = gimp_value_get_image (&args->values[0], gimp);
+  vectors = gimp_value_get_vectors (&args->values[1], gimp);
+
+  if (success)
+    {
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (vectors), image, FALSE, error))
+        gimp_image_remove_vectors (image, vectors, TRUE, NULL);
+      else
+        success = FALSE;
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GValueArray *
+image_get_item_position_invoker (GimpProcedure      *procedure,
+                                 Gimp               *gimp,
+                                 GimpContext        *context,
+                                 GimpProgress       *progress,
+                                 const GValueArray  *args,
+                                 GError            **error)
+{
+  gboolean success = TRUE;
+  GValueArray *return_vals;
+  GimpImage *image;
+  GimpItem *item;
+  gint32 position = 0;
+
+  image = gimp_value_get_image (&args->values[0], gimp);
+  item = gimp_value_get_item (&args->values[1], gimp);
+
+  if (success)
+    {
+      if (gimp_pdb_item_is_in_tree (item, image, FALSE, error))
+        position = gimp_item_get_index (item);
+      else
+        success = FALSE;
+    }
+
+  return_vals = gimp_procedure_get_return_values (procedure, success,
+                                                  error ? *error : NULL);
+
+  if (success)
+    g_value_set_int (&return_vals->values[1], position);
+
+  return return_vals;
+}
+
+static GValueArray *
+image_raise_item_invoker (GimpProcedure      *procedure,
+                          Gimp               *gimp,
+                          GimpContext        *context,
+                          GimpProgress       *progress,
+                          const GValueArray  *args,
+                          GError            **error)
+{
+  gboolean success = TRUE;
+  GimpImage *image;
+  GimpItem *item;
+
+  image = gimp_value_get_image (&args->values[0], gimp);
+  item = gimp_value_get_item (&args->values[1], gimp);
+
+  if (success)
+    {
+      if (gimp_pdb_item_is_in_tree (item, image, FALSE, error))
+        success = gimp_image_raise_item (image, item, error);
+      else
+        success = FALSE;
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GValueArray *
+image_lower_item_invoker (GimpProcedure      *procedure,
+                          Gimp               *gimp,
+                          GimpContext        *context,
+                          GimpProgress       *progress,
+                          const GValueArray  *args,
+                          GError            **error)
+{
+  gboolean success = TRUE;
+  GimpImage *image;
+  GimpItem *item;
+
+  image = gimp_value_get_image (&args->values[0], gimp);
+  item = gimp_value_get_item (&args->values[1], gimp);
+
+  if (success)
+    {
+      if (gimp_pdb_item_is_in_tree (item, image, FALSE, error))
+        success = gimp_image_lower_item (image, item, error);
+      else
+        success = FALSE;
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GValueArray *
+image_raise_item_to_top_invoker (GimpProcedure      *procedure,
+                                 Gimp               *gimp,
+                                 GimpContext        *context,
+                                 GimpProgress       *progress,
+                                 const GValueArray  *args,
+                                 GError            **error)
+{
+  gboolean success = TRUE;
+  GimpImage *image;
+  GimpItem *item;
+
+  image = gimp_value_get_image (&args->values[0], gimp);
+  item = gimp_value_get_item (&args->values[1], gimp);
+
+  if (success)
+    {
+      if (gimp_pdb_item_is_in_tree (item, image, FALSE, error))
+        success = gimp_image_raise_item_to_top (image, item);
+      else
+        success = FALSE;
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GValueArray *
+image_lower_item_to_bottom_invoker (GimpProcedure      *procedure,
+                                    Gimp               *gimp,
+                                    GimpContext        *context,
+                                    GimpProgress       *progress,
+                                    const GValueArray  *args,
+                                    GError            **error)
+{
+  gboolean success = TRUE;
+  GimpImage *image;
+  GimpItem *item;
+
+  image = gimp_value_get_image (&args->values[0], gimp);
+  item = gimp_value_get_item (&args->values[1], gimp);
+
+  if (success)
+    {
+      if (gimp_pdb_item_is_in_tree (item, image, FALSE, error))
+        success = gimp_image_lower_item_to_bottom (image, item);
+      else
+        success = FALSE;
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GValueArray *
 image_get_layer_position_invoker (GimpProcedure      *procedure,
                                   Gimp               *gimp,
                                   GimpContext        *context,
@@ -1101,68 +1368,6 @@ image_lower_layer_to_bottom_invoker (GimpProcedure      *procedure,
 }
 
 static GValueArray *
-image_add_channel_invoker (GimpProcedure      *procedure,
-                           Gimp               *gimp,
-                           GimpContext        *context,
-                           GimpProgress       *progress,
-                           const GValueArray  *args,
-                           GError            **error)
-{
-  gboolean success = TRUE;
-  GimpImage *image;
-  GimpChannel *channel;
-  gint32 position;
-
-  image = gimp_value_get_image (&args->values[0], gimp);
-  channel = gimp_value_get_channel (&args->values[1], gimp);
-  position = g_value_get_int (&args->values[2]);
-
-  if (success)
-    {
-      if (gimp_pdb_item_is_floating (GIMP_ITEM (channel), image, error))
-        {
-          /* FIXME tree */
-          success = gimp_image_add_channel (image, channel,
-                                            NULL, MAX (position, -1), TRUE);
-        }
-      else
-        {
-          success = FALSE;
-        }
-    }
-
-  return gimp_procedure_get_return_values (procedure, success,
-                                           error ? *error : NULL);
-}
-
-static GValueArray *
-image_remove_channel_invoker (GimpProcedure      *procedure,
-                              Gimp               *gimp,
-                              GimpContext        *context,
-                              GimpProgress       *progress,
-                              const GValueArray  *args,
-                              GError            **error)
-{
-  gboolean success = TRUE;
-  GimpImage *image;
-  GimpChannel *channel;
-
-  image = gimp_value_get_image (&args->values[0], gimp);
-  channel = gimp_value_get_channel (&args->values[1], gimp);
-
-  if (success)
-    {
-      if (gimp_pdb_item_is_attached (GIMP_ITEM (channel), image, FALSE, error))
-        gimp_image_remove_channel (image, channel, TRUE, NULL);
-      else
-        success = FALSE;
-    }
-
-  return gimp_procedure_get_return_values (procedure, success,
-                                           error ? *error : NULL);
-}
-
-static GValueArray *
 image_get_channel_position_invoker (GimpProcedure      *procedure,
                                     Gimp               *gimp,
                                     GimpContext        *context,
@@ -1253,68 +1458,6 @@ image_lower_channel_invoker (GimpProcedure      *procedure,
 }
 
 static GValueArray *
-image_add_vectors_invoker (GimpProcedure      *procedure,
-                           Gimp               *gimp,
-                           GimpContext        *context,
-                           GimpProgress       *progress,
-                           const GValueArray  *args,
-                           GError            **error)
-{
-  gboolean success = TRUE;
-  GimpImage *image;
-  GimpVectors *vectors;
-  gint32 position;
-
-  image = gimp_value_get_image (&args->values[0], gimp);
-  vectors = gimp_value_get_vectors (&args->values[1], gimp);
-  position = g_value_get_int (&args->values[2]);
-
-  if (success)
-    {
-      if (gimp_pdb_item_is_floating (GIMP_ITEM (vectors), image, error))
-        {
-          /* FIXME tree */
-          success = gimp_image_add_vectors (image, vectors,
-                                            NULL, MAX (position, -1), TRUE);
-        }
-      else
-        {
-          success = FALSE;
-        }
-    }
-
-  return gimp_procedure_get_return_values (procedure, success,
-                                           error ? *error : NULL);
-}
-
-static GValueArray *
-image_remove_vectors_invoker (GimpProcedure      *procedure,
-                              Gimp               *gimp,
-                              GimpContext        *context,
-                              GimpProgress       *progress,
-                              const GValueArray  *args,
-                              GError            **error)
-{
-  gboolean success = TRUE;
-  GimpImage *image;
-  GimpVectors *vectors;
-
-  image = gimp_value_get_image (&args->values[0], gimp);
-  vectors = gimp_value_get_vectors (&args->values[1], gimp);
-
-  if (success)
-    {
-      if (gimp_pdb_item_is_attached (GIMP_ITEM (vectors), image, FALSE, error))
-        gimp_image_remove_vectors (image, vectors, TRUE, NULL);
-      else
-        success = FALSE;
-    }
-
-  return gimp_procedure_get_return_values (procedure, success,
-                                           error ? *error : NULL);
-}
-
-static GValueArray *
 image_get_vectors_position_invoker (GimpProcedure      *procedure,
                                     Gimp               *gimp,
                                     GimpContext        *context,
@@ -3458,18 +3601,117 @@ register_image_procs (GimpPDB *pdb)
   g_object_unref (procedure);
 
   /*
-   * gimp-image-get-layer-position
+   * gimp-image-add-channel
    */
-  procedure = gimp_procedure_new (image_get_layer_position_invoker);
+  procedure = gimp_procedure_new (image_add_channel_invoker);
   gimp_object_set_static_name (GIMP_OBJECT (procedure),
-                               "gimp-image-get-layer-position");
+                               "gimp-image-add-channel");
   gimp_procedure_set_static_strings (procedure,
-                                     "gimp-image-get-layer-position",
-                                     "Returns the position of the layer in the layer stack.",
-                                     "This procedure determines the position of the specified layer in the images layer stack. If the layer doesn't exist in the image, an error is returned.",
+                                     "gimp-image-add-channel",
+                                     "Add the specified channel to the image.",
+                                     "This procedure adds the specified channel to the image at the given position. If the position is specified as -1, then the channel is inserted above the active channel or, if no channel is active, at the top of the channel stack.",
+                                     "Spencer Kimball & Peter Mattis",
+                                     "Spencer Kimball & Peter Mattis",
+                                     "1995-1996",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_image_id ("image",
+                                                         "image",
+                                                         "The image",
+                                                         pdb->gimp, FALSE,
+                                                         GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_channel_id ("channel",
+                                                           "channel",
+                                                           "The channel",
+                                                           pdb->gimp, FALSE,
+                                                           GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_int32 ("position",
+                                                      "position",
+                                                      "The channel position",
+                                                      G_MININT32, G_MAXINT32, 0,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-image-remove-channel
+   */
+  procedure = gimp_procedure_new (image_remove_channel_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-image-remove-channel");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-image-remove-channel",
+                                     "Remove the specified channel from the image.",
+                                     "This procedure removes the specified channel from the image. If the channel doesn't exist, an error is returned.",
+                                     "Spencer Kimball & Peter Mattis",
+                                     "Spencer Kimball & Peter Mattis",
+                                     "1995-1996",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_image_id ("image",
+                                                         "image",
+                                                         "The image",
+                                                         pdb->gimp, FALSE,
+                                                         GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_channel_id ("channel",
+                                                           "channel",
+                                                           "The channel",
+                                                           pdb->gimp, FALSE,
+                                                           GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-image-add-vectors
+   */
+  procedure = gimp_procedure_new (image_add_vectors_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-image-add-vectors");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-image-add-vectors",
+                                     "Add the specified vectors object to the image.",
+                                     "This procedure adds the specified vectors object to the image at the given position. If the position is specified as -1, then the vectors object is inserted at the top of the vectors stack.",
+                                     "Spencer Kimball & Peter Mattis",
+                                     "Spencer Kimball & Peter Mattis",
+                                     "1995-1996",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_image_id ("image",
+                                                         "image",
+                                                         "The image",
+                                                         pdb->gimp, FALSE,
+                                                         GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_vectors_id ("vectors",
+                                                           "vectors",
+                                                           "The vectors object",
+                                                           pdb->gimp, FALSE,
+                                                           GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_int32 ("position",
+                                                      "position",
+                                                      "The vectors objects position",
+                                                      G_MININT32, G_MAXINT32, 0,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-image-remove-vectors
+   */
+  procedure = gimp_procedure_new (image_remove_vectors_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-image-remove-vectors");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-image-remove-vectors",
+                                     "Remove the specified path from the image.",
+                                     "This procedure removes the specified path from the image. If the path doesn't exist, an error is returned.",
                                      "Simon Budig",
                                      "Simon Budig",
-                                     "2006",
+                                     "2005",
                                      NULL);
   gimp_procedure_add_argument (procedure,
                                gimp_param_spec_image_id ("image",
@@ -3478,33 +3720,62 @@ register_image_procs (GimpPDB *pdb)
                                                          pdb->gimp, FALSE,
                                                          GIMP_PARAM_READWRITE));
   gimp_procedure_add_argument (procedure,
-                               gimp_param_spec_layer_id ("layer",
-                                                         "layer",
-                                                         "The layer",
+                               gimp_param_spec_vectors_id ("vectors",
+                                                           "vectors",
+                                                           "The vectors object",
+                                                           pdb->gimp, FALSE,
+                                                           GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-image-get-item-position
+   */
+  procedure = gimp_procedure_new (image_get_item_position_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-image-get-item-position");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-image-get-item-position",
+                                     "Returns the position of the item in its level of its item tree.",
+                                     "This procedure determines the position of the specified item in its level in its item tree in the image. If the item doesn't exist in the image, or the item is not part of an item tree, an error is returned.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2010",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_image_id ("image",
+                                                         "image",
+                                                         "The image",
                                                          pdb->gimp, FALSE,
                                                          GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_item_id ("item",
+                                                        "item",
+                                                        "The item",
+                                                        pdb->gimp, FALSE,
+                                                        GIMP_PARAM_READWRITE));
   gimp_procedure_add_return_value (procedure,
                                    gimp_param_spec_int32 ("position",
                                                           "position",
-                                                          "The position of the layer in the layer stack",
+                                                          "The position of the item in its level in the item tree",
                                                           G_MININT32, G_MAXINT32, 0,
                                                           GIMP_PARAM_READWRITE));
   gimp_pdb_register_procedure (pdb, procedure);
   g_object_unref (procedure);
 
   /*
-   * gimp-image-raise-layer
+   * gimp-image-raise-item
    */
-  procedure = gimp_procedure_new (image_raise_layer_invoker);
+  procedure = gimp_procedure_new (image_raise_item_invoker);
   gimp_object_set_static_name (GIMP_OBJECT (procedure),
-                               "gimp-image-raise-layer");
+                               "gimp-image-raise-item");
   gimp_procedure_set_static_strings (procedure,
-                                     "gimp-image-raise-layer",
-                                     "Raise the specified layer in the image's layer stack",
-                                     "This procedure raises the specified layer one step in the existing layer stack. The procecure call will fail if there is no layer above it.",
-                                     "Spencer Kimball & Peter Mattis",
-                                     "Spencer Kimball & Peter Mattis",
-                                     "1995-1996",
+                                     "gimp-image-raise-item",
+                                     "Raise the specified item in its level in its item tree",
+                                     "This procedure raises the specified item one step in the item tree. The procecure call will fail if there is no item above it.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2010",
                                      NULL);
   gimp_procedure_add_argument (procedure,
                                gimp_param_spec_image_id ("image",
@@ -3513,27 +3784,56 @@ register_image_procs (GimpPDB *pdb)
                                                          pdb->gimp, FALSE,
                                                          GIMP_PARAM_READWRITE));
   gimp_procedure_add_argument (procedure,
-                               gimp_param_spec_layer_id ("layer",
-                                                         "layer",
-                                                         "The layer to raise",
+                               gimp_param_spec_item_id ("item",
+                                                        "item",
+                                                        "The item to raise",
+                                                        pdb->gimp, FALSE,
+                                                        GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-image-lower-item
+   */
+  procedure = gimp_procedure_new (image_lower_item_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-image-lower-item");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-image-lower-item",
+                                     "Lower the specified item in its level in its item tree",
+                                     "This procedure lowers the specified item one step in the item tree. The procecure call will fail if there is no item below it.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2010",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_image_id ("image",
+                                                         "image",
+                                                         "The image",
                                                          pdb->gimp, FALSE,
                                                          GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_item_id ("item",
+                                                        "item",
+                                                        "The item to lower",
+                                                        pdb->gimp, FALSE,
+                                                        GIMP_PARAM_READWRITE));
   gimp_pdb_register_procedure (pdb, procedure);
   g_object_unref (procedure);
 
   /*
-   * gimp-image-lower-layer
+   * gimp-image-raise-item-to-top
    */
-  procedure = gimp_procedure_new (image_lower_layer_invoker);
+  procedure = gimp_procedure_new (image_raise_item_to_top_invoker);
   gimp_object_set_static_name (GIMP_OBJECT (procedure),
-                               "gimp-image-lower-layer");
+                               "gimp-image-raise-item-to-top");
   gimp_procedure_set_static_strings (procedure,
-                                     "gimp-image-lower-layer",
-                                     "Lower the specified layer in the image's layer stack",
-                                     "This procedure lowers the specified layer one step in the existing layer stack. The procecure call will fail if there is no layer below it.",
-                                     "Spencer Kimball & Peter Mattis",
-                                     "Spencer Kimball & Peter Mattis",
-                                     "1995-1996",
+                                     "gimp-image-raise-item-to-top",
+                                     "Raise the specified item to the top of its level in its item tree",
+                                     "This procedure raises the specified item to top of its level in the item tree. It will not move the item if there is no item above it.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2010",
                                      NULL);
   gimp_procedure_add_argument (procedure,
                                gimp_param_spec_image_id ("image",
@@ -3542,28 +3842,92 @@ register_image_procs (GimpPDB *pdb)
                                                          pdb->gimp, FALSE,
                                                          GIMP_PARAM_READWRITE));
   gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_item_id ("item",
+                                                        "item",
+                                                        "The item to raise to top",
+                                                        pdb->gimp, FALSE,
+                                                        GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-image-lower-item-to-bottom
+   */
+  procedure = gimp_procedure_new (image_lower_item_to_bottom_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-image-lower-item-to-bottom");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-image-lower-item-to-bottom",
+                                     "Lower the specified item to the bottom of its level in its item tree",
+                                     "This procedure lowers the specified item to bottom of its level in the item tree. It will not move the layer if there is no layer below it.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2010",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_image_id ("image",
+                                                         "image",
+                                                         "The image",
+                                                         pdb->gimp, FALSE,
+                                                         GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_item_id ("item",
+                                                        "item",
+                                                        "The item to lower to bottom",
+                                                        pdb->gimp, FALSE,
+                                                        GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-image-get-layer-position
+   */
+  procedure = gimp_procedure_new (image_get_layer_position_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-image-get-layer-position");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-image-get-layer-position",
+                                     "Deprecated: Use 'gimp-image-get-item-position' instead.",
+                                     "Deprecated: Use 'gimp-image-get-item-position' instead.",
+                                     "Simon Budig",
+                                     "Simon Budig",
+                                     "2006",
+                                     "gimp-image-get-item-position");
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_image_id ("image",
+                                                         "image",
+                                                         "The image",
+                                                         pdb->gimp, FALSE,
+                                                         GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
                                gimp_param_spec_layer_id ("layer",
                                                          "layer",
-                                                         "The layer to lower",
+                                                         "The layer",
                                                          pdb->gimp, FALSE,
                                                          GIMP_PARAM_READWRITE));
+  gimp_procedure_add_return_value (procedure,
+                                   gimp_param_spec_int32 ("position",
+                                                          "position",
+                                                          "The position of the layer in the layer stack",
+                                                          G_MININT32, G_MAXINT32, 0,
+                                                          GIMP_PARAM_READWRITE));
   gimp_pdb_register_procedure (pdb, procedure);
   g_object_unref (procedure);
 
   /*
-   * gimp-image-raise-layer-to-top
+   * gimp-image-raise-layer
    */
-  procedure = gimp_procedure_new (image_raise_layer_to_top_invoker);
+  procedure = gimp_procedure_new (image_raise_layer_invoker);
   gimp_object_set_static_name (GIMP_OBJECT (procedure),
-                               "gimp-image-raise-layer-to-top");
+                               "gimp-image-raise-layer");
   gimp_procedure_set_static_strings (procedure,
-                                     "gimp-image-raise-layer-to-top",
-                                     "Raise the specified layer in the image's layer stack to top of stack",
-                                     "This procedure raises the specified layer to top of the existing layer stack. It will not move the layer if there is no layer above it.",
-                                     "Wolfgang Hofer, Sven Neumann",
-                                     "Wolfgang Hofer",
-                                     "1998",
-                                     NULL);
+                                     "gimp-image-raise-layer",
+                                     "Deprecated: Use 'gimp-image-raise-item' instead.",
+                                     "Deprecated: Use 'gimp-image-raise-item' instead.",
+                                     "",
+                                     "",
+                                     "",
+                                     "gimp-image-raise-item");
   gimp_procedure_add_argument (procedure,
                                gimp_param_spec_image_id ("image",
                                                          "image",
@@ -3573,26 +3937,26 @@ register_image_procs (GimpPDB *pdb)
   gimp_procedure_add_argument (procedure,
                                gimp_param_spec_layer_id ("layer",
                                                          "layer",
-                                                         "The layer to raise to top",
+                                                         "The layer to raise",
                                                          pdb->gimp, FALSE,
                                                          GIMP_PARAM_READWRITE));
   gimp_pdb_register_procedure (pdb, procedure);
   g_object_unref (procedure);
 
   /*
-   * gimp-image-lower-layer-to-bottom
+   * gimp-image-lower-layer
    */
-  procedure = gimp_procedure_new (image_lower_layer_to_bottom_invoker);
+  procedure = gimp_procedure_new (image_lower_layer_invoker);
   gimp_object_set_static_name (GIMP_OBJECT (procedure),
-                               "gimp-image-lower-layer-to-bottom");
+                               "gimp-image-lower-layer");
   gimp_procedure_set_static_strings (procedure,
-                                     "gimp-image-lower-layer-to-bottom",
-                                     "Lower the specified layer in the image's layer stack to bottom of stack",
-                                     "This procedure lowers the specified layer to bottom of the existing layer stack. It will not move the layer if there is no layer below it.",
-                                     "Wolfgang Hofer, Sven Neumann",
-                                     "Wolfgang Hofer",
-                                     "1998",
-                                     NULL);
+                                     "gimp-image-lower-layer",
+                                     "Deprecated: Use 'gimp-image-lower-item' instead.",
+                                     "Deprecated: Use 'gimp-image-lower-item' instead.",
+                                     "",
+                                     "",
+                                     "",
+                                     "gimp-image-lower-item");
   gimp_procedure_add_argument (procedure,
                                gimp_param_spec_image_id ("image",
                                                          "image",
@@ -3602,26 +3966,26 @@ register_image_procs (GimpPDB *pdb)
   gimp_procedure_add_argument (procedure,
                                gimp_param_spec_layer_id ("layer",
                                                          "layer",
-                                                         "The layer to lower to bottom",
+                                                         "The layer to lower",
                                                          pdb->gimp, FALSE,
                                                          GIMP_PARAM_READWRITE));
   gimp_pdb_register_procedure (pdb, procedure);
   g_object_unref (procedure);
 
   /*
-   * gimp-image-add-channel
+   * gimp-image-raise-layer-to-top
    */
-  procedure = gimp_procedure_new (image_add_channel_invoker);
+  procedure = gimp_procedure_new (image_raise_layer_to_top_invoker);
   gimp_object_set_static_name (GIMP_OBJECT (procedure),
-                               "gimp-image-add-channel");
+                               "gimp-image-raise-layer-to-top");
   gimp_procedure_set_static_strings (procedure,
-                                     "gimp-image-add-channel",
-                                     "Add the specified channel to the image.",
-                                     "This procedure adds the specified channel to the image at the given position. If the position is specified as -1, then the channel is inserted above the active channel or, if no channel is active, at the top of the channel stack.",
-                                     "Spencer Kimball & Peter Mattis",
-                                     "Spencer Kimball & Peter Mattis",
-                                     "1995-1996",
-                                     NULL);
+                                     "gimp-image-raise-layer-to-top",
+                                     "Deprecated: Use 'gimp-image-raise-item-to-top' instead.",
+                                     "Deprecated: Use 'gimp-image-raise-item-to-top' instead.",
+                                     "",
+                                     "",
+                                     "",
+                                     "gimp-image-raise-item-to-top");
   gimp_procedure_add_argument (procedure,
                                gimp_param_spec_image_id ("image",
                                                          "image",
@@ -3629,34 +3993,28 @@ register_image_procs (GimpPDB *pdb)
                                                          pdb->gimp, FALSE,
                                                          GIMP_PARAM_READWRITE));
   gimp_procedure_add_argument (procedure,
-                               gimp_param_spec_channel_id ("channel",
-                                                           "channel",
-                                                           "The channel",
-                                                           pdb->gimp, FALSE,
-                                                           GIMP_PARAM_READWRITE));
-  gimp_procedure_add_argument (procedure,
-                               gimp_param_spec_int32 ("position",
-                                                      "position",
-                                                      "The channel position",
-                                                      G_MININT32, G_MAXINT32, 0,
-                                                      GIMP_PARAM_READWRITE));
+                               gimp_param_spec_layer_id ("layer",
+                                                         "layer",
+                                                         "The layer to raise to top",
+                                                         pdb->gimp, FALSE,
+                                                         GIMP_PARAM_READWRITE));
   gimp_pdb_register_procedure (pdb, procedure);
   g_object_unref (procedure);
 
   /*
-   * gimp-image-remove-channel
+   * gimp-image-lower-layer-to-bottom
    */
-  procedure = gimp_procedure_new (image_remove_channel_invoker);
+  procedure = gimp_procedure_new (image_lower_layer_to_bottom_invoker);
   gimp_object_set_static_name (GIMP_OBJECT (procedure),
-                               "gimp-image-remove-channel");
+                               "gimp-image-lower-layer-to-bottom");
   gimp_procedure_set_static_strings (procedure,
-                                     "gimp-image-remove-channel",
-                                     "Remove the specified channel from the image.",
-                                     "This procedure removes the specified channel from the image. If the channel doesn't exist, an error is returned.",
-                                     "Spencer Kimball & Peter Mattis",
-                                     "Spencer Kimball & Peter Mattis",
-                                     "1995-1996",
-                                     NULL);
+                                     "gimp-image-lower-layer-to-bottom",
+                                     "Deprecated: Use 'gimp-image-lower-item-to-bottom' instead.",
+                                     "Deprecated: Use 'gimp-image-lower-item-to-bottom' instead.",
+                                     "",
+                                     "",
+                                     "",
+                                     "gimp-image-lower-item-to-bottom");
   gimp_procedure_add_argument (procedure,
                                gimp_param_spec_image_id ("image",
                                                          "image",
@@ -3664,11 +4022,11 @@ register_image_procs (GimpPDB *pdb)
                                                          pdb->gimp, FALSE,
                                                          GIMP_PARAM_READWRITE));
   gimp_procedure_add_argument (procedure,
-                               gimp_param_spec_channel_id ("channel",
-                                                           "channel",
-                                                           "The channel",
-                                                           pdb->gimp, FALSE,
-                                                           GIMP_PARAM_READWRITE));
+                               gimp_param_spec_layer_id ("layer",
+                                                         "layer",
+                                                         "The layer to lower to bottom",
+                                                         pdb->gimp, FALSE,
+                                                         GIMP_PARAM_READWRITE));
   gimp_pdb_register_procedure (pdb, procedure);
   g_object_unref (procedure);
 
@@ -3680,12 +4038,12 @@ register_image_procs (GimpPDB *pdb)
                                "gimp-image-get-channel-position");
   gimp_procedure_set_static_strings (procedure,
                                      "gimp-image-get-channel-position",
-                                     "Returns the position of the channel in the channel stack.",
-                                     "This procedure determines the position of the specified channel in the images channel stack. If the channel doesn't exist in the image, an error is returned.",
+                                     "Deprecated: Use 'gimp-image-get-item-position' instead.",
+                                     "Deprecated: Use 'gimp-image-get-item-position' instead.",
                                      "Simon Budig",
                                      "Simon Budig",
                                      "2006",
-                                     NULL);
+                                     "gimp-image-get-item-position");
   gimp_procedure_add_argument (procedure,
                                gimp_param_spec_image_id ("image",
                                                          "image",
@@ -3715,12 +4073,12 @@ register_image_procs (GimpPDB *pdb)
                                "gimp-image-raise-channel");
   gimp_procedure_set_static_strings (procedure,
                                      "gimp-image-raise-channel",
-                                     "Raise the specified channel in the image's channel stack",
-                                     "This procedure raises the specified channel one step in the existing channel stack. The procecure call will fail if there is no channel above it.",
-                                     "Spencer Kimball & Peter Mattis",
-                                     "Spencer Kimball & Peter Mattis",
-                                     "1995-1996",
-                                     NULL);
+                                     "Deprecated: Use 'gimp-image-raise-item' instead.",
+                                     "Deprecated: Use 'gimp-image-raise-item' instead.",
+                                     "",
+                                     "",
+                                     "",
+                                     "gimp-image-raise-item");
   gimp_procedure_add_argument (procedure,
                                gimp_param_spec_image_id ("image",
                                                          "image",
@@ -3744,12 +4102,12 @@ register_image_procs (GimpPDB *pdb)
                                "gimp-image-lower-channel");
   gimp_procedure_set_static_strings (procedure,
                                      "gimp-image-lower-channel",
-                                     "Lower the specified channel in the image's channel stack",
-                                     "This procedure lowers the specified channel one step in the existing channel stack. The procecure call will fail if there is no channel below it.",
-                                     "Spencer Kimball & Peter Mattis",
-                                     "Spencer Kimball & Peter Mattis",
-                                     "1995-1996",
-                                     NULL);
+                                     "Deprecated: Use 'gimp-image-lower-item' instead.",
+                                     "Deprecated: Use 'gimp-image-lower-item' instead.",
+                                     "",
+                                     "",
+                                     "",
+                                     "gimp-image-lower-item");
   gimp_procedure_add_argument (procedure,
                                gimp_param_spec_image_id ("image",
                                                          "image",
@@ -3766,70 +4124,6 @@ register_image_procs (GimpPDB *pdb)
   g_object_unref (procedure);
 
   /*
-   * gimp-image-add-vectors
-   */
-  procedure = gimp_procedure_new (image_add_vectors_invoker);
-  gimp_object_set_static_name (GIMP_OBJECT (procedure),
-                               "gimp-image-add-vectors");
-  gimp_procedure_set_static_strings (procedure,
-                                     "gimp-image-add-vectors",
-                                     "Add the specified vectors object to the image.",
-                                     "This procedure adds the specified vectors object to the image at the given position. If the position is specified as -1, then the vectors object is inserted at the top of the vectors stack.",
-                                     "Spencer Kimball & Peter Mattis",
-                                     "Spencer Kimball & Peter Mattis",
-                                     "1995-1996",
-                                     NULL);
-  gimp_procedure_add_argument (procedure,
-                               gimp_param_spec_image_id ("image",
-                                                         "image",
-                                                         "The image",
-                                                         pdb->gimp, FALSE,
-                                                         GIMP_PARAM_READWRITE));
-  gimp_procedure_add_argument (procedure,
-                               gimp_param_spec_vectors_id ("vectors",
-                                                           "vectors",
-                                                           "The vectors object",
-                                                           pdb->gimp, FALSE,
-                                                           GIMP_PARAM_READWRITE));
-  gimp_procedure_add_argument (procedure,
-                               gimp_param_spec_int32 ("position",
-                                                      "position",
-                                                      "The vectors objects position",
-                                                      G_MININT32, G_MAXINT32, 0,
-                                                      GIMP_PARAM_READWRITE));
-  gimp_pdb_register_procedure (pdb, procedure);
-  g_object_unref (procedure);
-
-  /*
-   * gimp-image-remove-vectors
-   */
-  procedure = gimp_procedure_new (image_remove_vectors_invoker);
-  gimp_object_set_static_name (GIMP_OBJECT (procedure),
-                               "gimp-image-remove-vectors");
-  gimp_procedure_set_static_strings (procedure,
-                                     "gimp-image-remove-vectors",
-                                     "Remove the specified path from the image.",
-                                     "This procedure removes the specified path from the image. If the path doesn't exist, an error is returned.",
-                                     "Simon Budig",
-                                     "Simon Budig",
-                                     "2005",
-                                     NULL);
-  gimp_procedure_add_argument (procedure,
-                               gimp_param_spec_image_id ("image",
-                                                         "image",
-                                                         "The image",
-                                                         pdb->gimp, FALSE,
-                                                         GIMP_PARAM_READWRITE));
-  gimp_procedure_add_argument (procedure,
-                               gimp_param_spec_vectors_id ("vectors",
-                                                           "vectors",
-                                                           "The vectors object",
-                                                           pdb->gimp, FALSE,
-                                                           GIMP_PARAM_READWRITE));
-  gimp_pdb_register_procedure (pdb, procedure);
-  g_object_unref (procedure);
-
-  /*
    * gimp-image-get-vectors-position
    */
   procedure = gimp_procedure_new (image_get_vectors_position_invoker);
@@ -3837,12 +4131,12 @@ register_image_procs (GimpPDB *pdb)
                                "gimp-image-get-vectors-position");
   gimp_procedure_set_static_strings (procedure,
                                      "gimp-image-get-vectors-position",
-                                     "Returns the position of the vectors object in the vectors objects stack.",
-                                     "This procedure determines the position of the specified vectors object in the images vectors object stack. If the vectors object doesn't exist in the image, an error is returned.",
+                                     "Deprecated: Use 'gimp-image-get-item-position' instead.",
+                                     "Deprecated: Use 'gimp-image-get-item-position' instead.",
                                      "Simon Budig",
                                      "Simon Budig",
                                      "2006",
-                                     NULL);
+                                     "gimp-image-get-item-position");
   gimp_procedure_add_argument (procedure,
                                gimp_param_spec_image_id ("image",
                                                          "image",
@@ -3872,12 +4166,12 @@ register_image_procs (GimpPDB *pdb)
                                "gimp-image-raise-vectors");
   gimp_procedure_set_static_strings (procedure,
                                      "gimp-image-raise-vectors",
-                                     "Raise the specified vectors in the image's vectors stack",
-                                     "This procedure raises the specified vectors one step in the existing vectors stack. The procecure call will fail if there is no vectors above it.",
+                                     "Deprecated: Use 'gimp-image-raise-item' instead.",
+                                     "Deprecated: Use 'gimp-image-raise-item' instead.",
                                      "Simon Budig",
                                      "Simon Budig",
                                      "2005",
-                                     NULL);
+                                     "gimp-image-raise-item");
   gimp_procedure_add_argument (procedure,
                                gimp_param_spec_image_id ("image",
                                                          "image",
@@ -3901,12 +4195,12 @@ register_image_procs (GimpPDB *pdb)
                                "gimp-image-lower-vectors");
   gimp_procedure_set_static_strings (procedure,
                                      "gimp-image-lower-vectors",
-                                     "Lower the specified vectors in the image's vectors stack",
-                                     "This procedure lowers the specified vectors one step in the existing vectors stack. The procecure call will fail if there is no vectors below it.",
+                                     "Deprecated: Use 'gimp-image-lower-item' instead.",
+                                     "Deprecated: Use 'gimp-image-lower-item' instead.",
                                      "Simon Budig",
                                      "Simon Budig",
                                      "2005",
-                                     NULL);
+                                     "gimp-image-lower-item");
   gimp_procedure_add_argument (procedure,
                                gimp_param_spec_image_id ("image",
                                                          "image",
@@ -3930,12 +4224,12 @@ register_image_procs (GimpPDB *pdb)
                                "gimp-image-raise-vectors-to-top");
   gimp_procedure_set_static_strings (procedure,
                                      "gimp-image-raise-vectors-to-top",
-                                     "Raise the specified vectors in the image's vectors stack to top of stack",
-                                     "This procedure raises the specified vectors to top of the existing vectors stack. It will not move the vectors if there is no vectors above it.",
+                                     "Deprecated: Use 'gimp-image-raise-item-to-top' instead.",
+                                     "Deprecated: Use 'gimp-image-raise-item-to-top' instead.",
                                      "Simon Budig",
                                      "Simon Budig",
                                      "2005",
-                                     NULL);
+                                     "gimp-image-raise-item-to-top");
   gimp_procedure_add_argument (procedure,
                                gimp_param_spec_image_id ("image",
                                                          "image",
@@ -3959,12 +4253,12 @@ register_image_procs (GimpPDB *pdb)
                                "gimp-image-lower-vectors-to-bottom");
   gimp_procedure_set_static_strings (procedure,
                                      "gimp-image-lower-vectors-to-bottom",
-                                     "Lower the specified vectors in the image's vectors stack to bottom of stack",
-                                     "This procedure lowers the specified vectors to bottom of the existing vectors stack. It will not move the vectors if there is no vectors below it.",
+                                     "Deprecated: Use 'gimp-image-lower-item-to-bottom' instead.",
+                                     "Deprecated: Use 'gimp-image-lower-item-to-bottom' instead.",
                                      "Simon Budig",
                                      "Simon Budig",
                                      "2005",
-                                     NULL);
+                                     "gimp-image-lower-item-to-bottom");
   gimp_procedure_add_argument (procedure,
                                gimp_param_spec_image_id ("image",
                                                          "image",
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 6b91b85..b5b13f0 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
 #include "internal-procs.h"
 
 
-/* 621 procedures registered total */
+/* 626 procedures registered total */
 
 void
 internal_procs_init (GimpPDB *pdb)
diff --git a/libgimp/gimpimage_pdb.c b/libgimp/gimpimage_pdb.c
index 9c37631..55469ae 100644
--- a/libgimp/gimpimage_pdb.c
+++ b/libgimp/gimpimage_pdb.c
@@ -1043,67 +1043,67 @@ gimp_image_remove_layer (gint32 image_ID,
 }
 
 /**
- * gimp_image_get_layer_position:
+ * gimp_image_add_channel:
  * @image_ID: The image.
- * @layer_ID: The layer.
- *
- * Returns the position of the layer in the layer stack.
+ * @channel_ID: The channel.
+ * @position: The channel position.
  *
- * This procedure determines the position of the specified layer in the
- * images layer stack. If the layer doesn't exist in the image, an
- * error is returned.
+ * Add the specified channel to the image.
  *
- * Returns: The position of the layer in the layer stack.
+ * This procedure adds the specified channel to the image at the given
+ * position. If the position is specified as -1, then the channel is
+ * inserted above the active channel or, if no channel is active, at
+ * the top of the channel stack.
  *
- * Since: GIMP 2.4
+ * Returns: TRUE on success.
  */
-gint
-gimp_image_get_layer_position (gint32 image_ID,
-                               gint32 layer_ID)
+gboolean
+gimp_image_add_channel (gint32 image_ID,
+                        gint32 channel_ID,
+                        gint   position)
 {
   GimpParam *return_vals;
   gint nreturn_vals;
-  gint position = 0;
+  gboolean success = TRUE;
 
-  return_vals = gimp_run_procedure ("gimp-image-get-layer-position",
+  return_vals = gimp_run_procedure ("gimp-image-add-channel",
                                     &nreturn_vals,
                                     GIMP_PDB_IMAGE, image_ID,
-                                    GIMP_PDB_LAYER, layer_ID,
+                                    GIMP_PDB_CHANNEL, channel_ID,
+                                    GIMP_PDB_INT32, position,
                                     GIMP_PDB_END);
 
-  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
-    position = return_vals[1].data.d_int32;
+  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
 
   gimp_destroy_params (return_vals, nreturn_vals);
 
-  return position;
+  return success;
 }
 
 /**
- * gimp_image_raise_layer:
+ * gimp_image_remove_channel:
  * @image_ID: The image.
- * @layer_ID: The layer to raise.
+ * @channel_ID: The channel.
  *
- * Raise the specified layer in the image's layer stack
+ * Remove the specified channel from the image.
  *
- * This procedure raises the specified layer one step in the existing
- * layer stack. The procecure call will fail if there is no layer above
- * it.
+ * This procedure removes the specified channel from the image. If the
+ * channel doesn't exist, an error is returned.
  *
  * Returns: TRUE on success.
  */
 gboolean
-gimp_image_raise_layer (gint32 image_ID,
-                        gint32 layer_ID)
+gimp_image_remove_channel (gint32 image_ID,
+                           gint32 channel_ID)
 {
   GimpParam *return_vals;
   gint nreturn_vals;
   gboolean success = TRUE;
 
-  return_vals = gimp_run_procedure ("gimp-image-raise-layer",
+  return_vals = gimp_run_procedure ("gimp-image-remove-channel",
                                     &nreturn_vals,
                                     GIMP_PDB_IMAGE, image_ID,
-                                    GIMP_PDB_LAYER, layer_ID,
+                                    GIMP_PDB_CHANNEL, channel_ID,
                                     GIMP_PDB_END);
 
   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
@@ -1114,30 +1114,33 @@ gimp_image_raise_layer (gint32 image_ID,
 }
 
 /**
- * gimp_image_lower_layer:
+ * gimp_image_add_vectors:
  * @image_ID: The image.
- * @layer_ID: The layer to lower.
+ * @vectors_ID: The vectors object.
+ * @position: The vectors objects position.
  *
- * Lower the specified layer in the image's layer stack
+ * Add the specified vectors object to the image.
  *
- * This procedure lowers the specified layer one step in the existing
- * layer stack. The procecure call will fail if there is no layer below
- * it.
+ * This procedure adds the specified vectors object to the image at the
+ * given position. If the position is specified as -1, then the vectors
+ * object is inserted at the top of the vectors stack.
  *
  * Returns: TRUE on success.
  */
 gboolean
-gimp_image_lower_layer (gint32 image_ID,
-                        gint32 layer_ID)
+gimp_image_add_vectors (gint32 image_ID,
+                        gint32 vectors_ID,
+                        gint   position)
 {
   GimpParam *return_vals;
   gint nreturn_vals;
   gboolean success = TRUE;
 
-  return_vals = gimp_run_procedure ("gimp-image-lower-layer",
+  return_vals = gimp_run_procedure ("gimp-image-add-vectors",
                                     &nreturn_vals,
                                     GIMP_PDB_IMAGE, image_ID,
-                                    GIMP_PDB_LAYER, layer_ID,
+                                    GIMP_PDB_VECTORS, vectors_ID,
+                                    GIMP_PDB_INT32, position,
                                     GIMP_PDB_END);
 
   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
@@ -1148,30 +1151,31 @@ gimp_image_lower_layer (gint32 image_ID,
 }
 
 /**
- * gimp_image_raise_layer_to_top:
+ * gimp_image_remove_vectors:
  * @image_ID: The image.
- * @layer_ID: The layer to raise to top.
+ * @vectors_ID: The vectors object.
  *
- * Raise the specified layer in the image's layer stack to top of stack
+ * Remove the specified path from the image.
  *
- * This procedure raises the specified layer to top of the existing
- * layer stack. It will not move the layer if there is no layer above
- * it.
+ * This procedure removes the specified path from the image. If the
+ * path doesn't exist, an error is returned.
  *
  * Returns: TRUE on success.
+ *
+ * Since: GIMP 2.4
  */
 gboolean
-gimp_image_raise_layer_to_top (gint32 image_ID,
-                               gint32 layer_ID)
+gimp_image_remove_vectors (gint32 image_ID,
+                           gint32 vectors_ID)
 {
   GimpParam *return_vals;
   gint nreturn_vals;
   gboolean success = TRUE;
 
-  return_vals = gimp_run_procedure ("gimp-image-raise-layer-to-top",
+  return_vals = gimp_run_procedure ("gimp-image-remove-vectors",
                                     &nreturn_vals,
                                     GIMP_PDB_IMAGE, image_ID,
-                                    GIMP_PDB_LAYER, layer_ID,
+                                    GIMP_PDB_VECTORS, vectors_ID,
                                     GIMP_PDB_END);
 
   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
@@ -1182,31 +1186,69 @@ gimp_image_raise_layer_to_top (gint32 image_ID,
 }
 
 /**
- * gimp_image_lower_layer_to_bottom:
+ * gimp_image_get_item_position:
  * @image_ID: The image.
- * @layer_ID: The layer to lower to bottom.
+ * @item_ID: The item.
  *
- * Lower the specified layer in the image's layer stack to bottom of
- * stack
+ * Returns the position of the item in its level of its item tree.
  *
- * This procedure lowers the specified layer to bottom of the existing
- * layer stack. It will not move the layer if there is no layer below
- * it.
+ * This procedure determines the position of the specified item in its
+ * level in its item tree in the image. If the item doesn't exist in
+ * the image, or the item is not part of an item tree, an error is
+ * returned.
+ *
+ * Returns: The position of the item in its level in the item tree.
+ *
+ * Since: GIMP 2.8
+ */
+gint
+gimp_image_get_item_position (gint32 image_ID,
+                              gint32 item_ID)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gint position = 0;
+
+  return_vals = gimp_run_procedure ("gimp-image-get-item-position",
+                                    &nreturn_vals,
+                                    GIMP_PDB_IMAGE, image_ID,
+                                    GIMP_PDB_ITEM, item_ID,
+                                    GIMP_PDB_END);
+
+  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+    position = return_vals[1].data.d_int32;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return position;
+}
+
+/**
+ * gimp_image_raise_item:
+ * @image_ID: The image.
+ * @item_ID: The item to raise.
+ *
+ * Raise the specified item in its level in its item tree
+ *
+ * This procedure raises the specified item one step in the item tree.
+ * The procecure call will fail if there is no item above it.
  *
  * Returns: TRUE on success.
+ *
+ * Since: GIMP 2.8
  */
 gboolean
-gimp_image_lower_layer_to_bottom (gint32 image_ID,
-                                  gint32 layer_ID)
+gimp_image_raise_item (gint32 image_ID,
+                       gint32 item_ID)
 {
   GimpParam *return_vals;
   gint nreturn_vals;
   gboolean success = TRUE;
 
-  return_vals = gimp_run_procedure ("gimp-image-lower-layer-to-bottom",
+  return_vals = gimp_run_procedure ("gimp-image-raise-item",
                                     &nreturn_vals,
                                     GIMP_PDB_IMAGE, image_ID,
-                                    GIMP_PDB_LAYER, layer_ID,
+                                    GIMP_PDB_ITEM, item_ID,
                                     GIMP_PDB_END);
 
   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
@@ -1217,34 +1259,31 @@ gimp_image_lower_layer_to_bottom (gint32 image_ID,
 }
 
 /**
- * gimp_image_add_channel:
+ * gimp_image_lower_item:
  * @image_ID: The image.
- * @channel_ID: The channel.
- * @position: The channel position.
+ * @item_ID: The item to lower.
  *
- * Add the specified channel to the image.
+ * Lower the specified item in its level in its item tree
  *
- * This procedure adds the specified channel to the image at the given
- * position. If the position is specified as -1, then the channel is
- * inserted above the active channel or, if no channel is active, at
- * the top of the channel stack.
+ * This procedure lowers the specified item one step in the item tree.
+ * The procecure call will fail if there is no item below it.
  *
  * Returns: TRUE on success.
+ *
+ * Since: GIMP 2.8
  */
 gboolean
-gimp_image_add_channel (gint32 image_ID,
-                        gint32 channel_ID,
-                        gint   position)
+gimp_image_lower_item (gint32 image_ID,
+                       gint32 item_ID)
 {
   GimpParam *return_vals;
   gint nreturn_vals;
   gboolean success = TRUE;
 
-  return_vals = gimp_run_procedure ("gimp-image-add-channel",
+  return_vals = gimp_run_procedure ("gimp-image-lower-item",
                                     &nreturn_vals,
                                     GIMP_PDB_IMAGE, image_ID,
-                                    GIMP_PDB_CHANNEL, channel_ID,
-                                    GIMP_PDB_INT32, position,
+                                    GIMP_PDB_ITEM, item_ID,
                                     GIMP_PDB_END);
 
   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
@@ -1255,29 +1294,31 @@ gimp_image_add_channel (gint32 image_ID,
 }
 
 /**
- * gimp_image_remove_channel:
+ * gimp_image_raise_item_to_top:
  * @image_ID: The image.
- * @channel_ID: The channel.
+ * @item_ID: The item to raise to top.
  *
- * Remove the specified channel from the image.
+ * Raise the specified item to the top of its level in its item tree
  *
- * This procedure removes the specified channel from the image. If the
- * channel doesn't exist, an error is returned.
+ * This procedure raises the specified item to top of its level in the
+ * item tree. It will not move the item if there is no item above it.
  *
  * Returns: TRUE on success.
+ *
+ * Since: GIMP 2.8
  */
 gboolean
-gimp_image_remove_channel (gint32 image_ID,
-                           gint32 channel_ID)
+gimp_image_raise_item_to_top (gint32 image_ID,
+                              gint32 item_ID)
 {
   GimpParam *return_vals;
   gint nreturn_vals;
   gboolean success = TRUE;
 
-  return_vals = gimp_run_procedure ("gimp-image-remove-channel",
+  return_vals = gimp_run_procedure ("gimp-image-raise-item-to-top",
                                     &nreturn_vals,
                                     GIMP_PDB_IMAGE, image_ID,
-                                    GIMP_PDB_CHANNEL, channel_ID,
+                                    GIMP_PDB_ITEM, item_ID,
                                     GIMP_PDB_END);
 
   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
@@ -1288,32 +1329,64 @@ gimp_image_remove_channel (gint32 image_ID,
 }
 
 /**
- * gimp_image_get_channel_position:
+ * gimp_image_lower_item_to_bottom:
  * @image_ID: The image.
- * @channel_ID: The channel.
+ * @item_ID: The item to lower to bottom.
  *
- * Returns the position of the channel in the channel stack.
+ * Lower the specified item to the bottom of its level in its item tree
  *
- * This procedure determines the position of the specified channel in
- * the images channel stack. If the channel doesn't exist in the image,
- * an error is returned.
+ * This procedure lowers the specified item to bottom of its level in
+ * the item tree. It will not move the layer if there is no layer below
+ * it.
  *
- * Returns: The position of the channel in the channel stack.
+ * Returns: TRUE on success.
+ *
+ * Since: GIMP 2.8
+ */
+gboolean
+gimp_image_lower_item_to_bottom (gint32 image_ID,
+                                 gint32 item_ID)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean success = TRUE;
+
+  return_vals = gimp_run_procedure ("gimp-image-lower-item-to-bottom",
+                                    &nreturn_vals,
+                                    GIMP_PDB_IMAGE, image_ID,
+                                    GIMP_PDB_ITEM, item_ID,
+                                    GIMP_PDB_END);
+
+  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return success;
+}
+
+/**
+ * gimp_image_get_layer_position:
+ * @image_ID: The image.
+ * @layer_ID: The layer.
+ *
+ * Deprecated: Use gimp_image_get_item_position() instead.
+ *
+ * Returns: The position of the layer in the layer stack.
  *
  * Since: GIMP 2.4
  */
 gint
-gimp_image_get_channel_position (gint32 image_ID,
-                                 gint32 channel_ID)
+gimp_image_get_layer_position (gint32 image_ID,
+                               gint32 layer_ID)
 {
   GimpParam *return_vals;
   gint nreturn_vals;
   gint position = 0;
 
-  return_vals = gimp_run_procedure ("gimp-image-get-channel-position",
+  return_vals = gimp_run_procedure ("gimp-image-get-layer-position",
                                     &nreturn_vals,
                                     GIMP_PDB_IMAGE, image_ID,
-                                    GIMP_PDB_CHANNEL, channel_ID,
+                                    GIMP_PDB_LAYER, layer_ID,
                                     GIMP_PDB_END);
 
   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
@@ -1325,30 +1398,26 @@ gimp_image_get_channel_position (gint32 image_ID,
 }
 
 /**
- * gimp_image_raise_channel:
+ * gimp_image_raise_layer:
  * @image_ID: The image.
- * @channel_ID: The channel to raise.
- *
- * Raise the specified channel in the image's channel stack
+ * @layer_ID: The layer to raise.
  *
- * This procedure raises the specified channel one step in the existing
- * channel stack. The procecure call will fail if there is no channel
- * above it.
+ * Deprecated: Use gimp_image_raise_item() instead.
  *
  * Returns: TRUE on success.
  */
 gboolean
-gimp_image_raise_channel (gint32 image_ID,
-                          gint32 channel_ID)
+gimp_image_raise_layer (gint32 image_ID,
+                        gint32 layer_ID)
 {
   GimpParam *return_vals;
   gint nreturn_vals;
   gboolean success = TRUE;
 
-  return_vals = gimp_run_procedure ("gimp-image-raise-channel",
+  return_vals = gimp_run_procedure ("gimp-image-raise-layer",
                                     &nreturn_vals,
                                     GIMP_PDB_IMAGE, image_ID,
-                                    GIMP_PDB_CHANNEL, channel_ID,
+                                    GIMP_PDB_LAYER, layer_ID,
                                     GIMP_PDB_END);
 
   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
@@ -1359,30 +1428,26 @@ gimp_image_raise_channel (gint32 image_ID,
 }
 
 /**
- * gimp_image_lower_channel:
+ * gimp_image_lower_layer:
  * @image_ID: The image.
- * @channel_ID: The channel to lower.
- *
- * Lower the specified channel in the image's channel stack
+ * @layer_ID: The layer to lower.
  *
- * This procedure lowers the specified channel one step in the existing
- * channel stack. The procecure call will fail if there is no channel
- * below it.
+ * Deprecated: Use gimp_image_lower_item() instead.
  *
  * Returns: TRUE on success.
  */
 gboolean
-gimp_image_lower_channel (gint32 image_ID,
-                          gint32 channel_ID)
+gimp_image_lower_layer (gint32 image_ID,
+                        gint32 layer_ID)
 {
   GimpParam *return_vals;
   gint nreturn_vals;
   gboolean success = TRUE;
 
-  return_vals = gimp_run_procedure ("gimp-image-lower-channel",
+  return_vals = gimp_run_procedure ("gimp-image-lower-layer",
                                     &nreturn_vals,
                                     GIMP_PDB_IMAGE, image_ID,
-                                    GIMP_PDB_CHANNEL, channel_ID,
+                                    GIMP_PDB_LAYER, layer_ID,
                                     GIMP_PDB_END);
 
   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
@@ -1393,33 +1458,56 @@ gimp_image_lower_channel (gint32 image_ID,
 }
 
 /**
- * gimp_image_add_vectors:
+ * gimp_image_raise_layer_to_top:
  * @image_ID: The image.
- * @vectors_ID: The vectors object.
- * @position: The vectors objects position.
+ * @layer_ID: The layer to raise to top.
  *
- * Add the specified vectors object to the image.
+ * Deprecated: Use gimp_image_raise_item_to_top() instead.
  *
- * This procedure adds the specified vectors object to the image at the
- * given position. If the position is specified as -1, then the vectors
- * object is inserted at the top of the vectors stack.
+ * Returns: TRUE on success.
+ */
+gboolean
+gimp_image_raise_layer_to_top (gint32 image_ID,
+                               gint32 layer_ID)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean success = TRUE;
+
+  return_vals = gimp_run_procedure ("gimp-image-raise-layer-to-top",
+                                    &nreturn_vals,
+                                    GIMP_PDB_IMAGE, image_ID,
+                                    GIMP_PDB_LAYER, layer_ID,
+                                    GIMP_PDB_END);
+
+  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return success;
+}
+
+/**
+ * gimp_image_lower_layer_to_bottom:
+ * @image_ID: The image.
+ * @layer_ID: The layer to lower to bottom.
+ *
+ * Deprecated: Use gimp_image_lower_item_to_bottom() instead.
  *
  * Returns: TRUE on success.
  */
 gboolean
-gimp_image_add_vectors (gint32 image_ID,
-                        gint32 vectors_ID,
-                        gint   position)
+gimp_image_lower_layer_to_bottom (gint32 image_ID,
+                                  gint32 layer_ID)
 {
   GimpParam *return_vals;
   gint nreturn_vals;
   gboolean success = TRUE;
 
-  return_vals = gimp_run_procedure ("gimp-image-add-vectors",
+  return_vals = gimp_run_procedure ("gimp-image-lower-layer-to-bottom",
                                     &nreturn_vals,
                                     GIMP_PDB_IMAGE, image_ID,
-                                    GIMP_PDB_VECTORS, vectors_ID,
-                                    GIMP_PDB_INT32, position,
+                                    GIMP_PDB_LAYER, layer_ID,
                                     GIMP_PDB_END);
 
   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
@@ -1430,31 +1518,89 @@ gimp_image_add_vectors (gint32 image_ID,
 }
 
 /**
- * gimp_image_remove_vectors:
+ * gimp_image_get_channel_position:
  * @image_ID: The image.
- * @vectors_ID: The vectors object.
+ * @channel_ID: The channel.
  *
- * Remove the specified path from the image.
+ * Deprecated: Use gimp_image_get_item_position() instead.
  *
- * This procedure removes the specified path from the image. If the
- * path doesn't exist, an error is returned.
+ * Returns: The position of the channel in the channel stack.
+ *
+ * Since: GIMP 2.4
+ */
+gint
+gimp_image_get_channel_position (gint32 image_ID,
+                                 gint32 channel_ID)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gint position = 0;
+
+  return_vals = gimp_run_procedure ("gimp-image-get-channel-position",
+                                    &nreturn_vals,
+                                    GIMP_PDB_IMAGE, image_ID,
+                                    GIMP_PDB_CHANNEL, channel_ID,
+                                    GIMP_PDB_END);
+
+  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+    position = return_vals[1].data.d_int32;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return position;
+}
+
+/**
+ * gimp_image_raise_channel:
+ * @image_ID: The image.
+ * @channel_ID: The channel to raise.
+ *
+ * Deprecated: Use gimp_image_raise_item() instead.
  *
  * Returns: TRUE on success.
+ */
+gboolean
+gimp_image_raise_channel (gint32 image_ID,
+                          gint32 channel_ID)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean success = TRUE;
+
+  return_vals = gimp_run_procedure ("gimp-image-raise-channel",
+                                    &nreturn_vals,
+                                    GIMP_PDB_IMAGE, image_ID,
+                                    GIMP_PDB_CHANNEL, channel_ID,
+                                    GIMP_PDB_END);
+
+  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return success;
+}
+
+/**
+ * gimp_image_lower_channel:
+ * @image_ID: The image.
+ * @channel_ID: The channel to lower.
  *
- * Since: GIMP 2.4
+ * Deprecated: Use gimp_image_lower_item() instead.
+ *
+ * Returns: TRUE on success.
  */
 gboolean
-gimp_image_remove_vectors (gint32 image_ID,
-                           gint32 vectors_ID)
+gimp_image_lower_channel (gint32 image_ID,
+                          gint32 channel_ID)
 {
   GimpParam *return_vals;
   gint nreturn_vals;
   gboolean success = TRUE;
 
-  return_vals = gimp_run_procedure ("gimp-image-remove-vectors",
+  return_vals = gimp_run_procedure ("gimp-image-lower-channel",
                                     &nreturn_vals,
                                     GIMP_PDB_IMAGE, image_ID,
-                                    GIMP_PDB_VECTORS, vectors_ID,
+                                    GIMP_PDB_CHANNEL, channel_ID,
                                     GIMP_PDB_END);
 
   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
@@ -1469,12 +1615,7 @@ gimp_image_remove_vectors (gint32 image_ID,
  * @image_ID: The image.
  * @vectors_ID: The vectors object.
  *
- * Returns the position of the vectors object in the vectors objects
- * stack.
- *
- * This procedure determines the position of the specified vectors
- * object in the images vectors object stack. If the vectors object
- * doesn't exist in the image, an error is returned.
+ * Deprecated: Use gimp_image_get_item_position() instead.
  *
  * Returns: The position of the vectors object in the vectors stack.
  *
@@ -1507,11 +1648,7 @@ gimp_image_get_vectors_position (gint32 image_ID,
  * @image_ID: The image.
  * @vectors_ID: The vectors object to raise.
  *
- * Raise the specified vectors in the image's vectors stack
- *
- * This procedure raises the specified vectors one step in the existing
- * vectors stack. The procecure call will fail if there is no vectors
- * above it.
+ * Deprecated: Use gimp_image_raise_item() instead.
  *
  * Returns: TRUE on success.
  *
@@ -1543,11 +1680,7 @@ gimp_image_raise_vectors (gint32 image_ID,
  * @image_ID: The image.
  * @vectors_ID: The vectors object to lower.
  *
- * Lower the specified vectors in the image's vectors stack
- *
- * This procedure lowers the specified vectors one step in the existing
- * vectors stack. The procecure call will fail if there is no vectors
- * below it.
+ * Deprecated: Use gimp_image_lower_item() instead.
  *
  * Returns: TRUE on success.
  *
@@ -1579,12 +1712,7 @@ gimp_image_lower_vectors (gint32 image_ID,
  * @image_ID: The image.
  * @vectors_ID: The vectors object to raise to top.
  *
- * Raise the specified vectors in the image's vectors stack to top of
- * stack
- *
- * This procedure raises the specified vectors to top of the existing
- * vectors stack. It will not move the vectors if there is no vectors
- * above it.
+ * Deprecated: Use gimp_image_raise_item_to_top() instead.
  *
  * Returns: TRUE on success.
  *
@@ -1616,12 +1744,7 @@ gimp_image_raise_vectors_to_top (gint32 image_ID,
  * @image_ID: The image.
  * @vectors_ID: The vectors object to lower to bottom.
  *
- * Lower the specified vectors in the image's vectors stack to bottom
- * of stack
- *
- * This procedure lowers the specified vectors to bottom of the
- * existing vectors stack. It will not move the vectors if there is no
- * vectors below it.
+ * Deprecated: Use gimp_image_lower_item_to_bottom() instead.
  *
  * Returns: TRUE on success.
  *
diff --git a/libgimp/gimpimage_pdb.h b/libgimp/gimpimage_pdb.h
index 9e5c67d..611d9b4 100644
--- a/libgimp/gimpimage_pdb.h
+++ b/libgimp/gimpimage_pdb.h
@@ -89,6 +89,27 @@ gboolean                 gimp_image_add_layer                (gint32
                                                               gint                    position);
 gboolean                 gimp_image_remove_layer             (gint32                  image_ID,
                                                               gint32                  layer_ID);
+gboolean                 gimp_image_add_channel              (gint32                  image_ID,
+                                                              gint32                  channel_ID,
+                                                              gint                    position);
+gboolean                 gimp_image_remove_channel           (gint32                  image_ID,
+                                                              gint32                  channel_ID);
+gboolean                 gimp_image_add_vectors              (gint32                  image_ID,
+                                                              gint32                  vectors_ID,
+                                                              gint                    position);
+gboolean                 gimp_image_remove_vectors           (gint32                  image_ID,
+                                                              gint32                  vectors_ID);
+gint                     gimp_image_get_item_position        (gint32                  image_ID,
+                                                              gint32                  item_ID);
+gboolean                 gimp_image_raise_item               (gint32                  image_ID,
+                                                              gint32                  item_ID);
+gboolean                 gimp_image_lower_item               (gint32                  image_ID,
+                                                              gint32                  item_ID);
+gboolean                 gimp_image_raise_item_to_top        (gint32                  image_ID,
+                                                              gint32                  item_ID);
+gboolean                 gimp_image_lower_item_to_bottom     (gint32                  image_ID,
+                                                              gint32                  item_ID);
+#ifndef GIMP_DISABLE_DEPRECATED
 gint                     gimp_image_get_layer_position       (gint32                  image_ID,
                                                               gint32                  layer_ID);
 gboolean                 gimp_image_raise_layer              (gint32                  image_ID,
@@ -99,22 +120,12 @@ gboolean                 gimp_image_raise_layer_to_top       (gint32
                                                               gint32                  layer_ID);
 gboolean                 gimp_image_lower_layer_to_bottom    (gint32                  image_ID,
                                                               gint32                  layer_ID);
-gboolean                 gimp_image_add_channel              (gint32                  image_ID,
-                                                              gint32                  channel_ID,
-                                                              gint                    position);
-gboolean                 gimp_image_remove_channel           (gint32                  image_ID,
-                                                              gint32                  channel_ID);
 gint                     gimp_image_get_channel_position     (gint32                  image_ID,
                                                               gint32                  channel_ID);
 gboolean                 gimp_image_raise_channel            (gint32                  image_ID,
                                                               gint32                  channel_ID);
 gboolean                 gimp_image_lower_channel            (gint32                  image_ID,
                                                               gint32                  channel_ID);
-gboolean                 gimp_image_add_vectors              (gint32                  image_ID,
-                                                              gint32                  vectors_ID,
-                                                              gint                    position);
-gboolean                 gimp_image_remove_vectors           (gint32                  image_ID,
-                                                              gint32                  vectors_ID);
 gint                     gimp_image_get_vectors_position     (gint32                  image_ID,
                                                               gint32                  vectors_ID);
 gboolean                 gimp_image_raise_vectors            (gint32                  image_ID,
@@ -125,6 +136,7 @@ gboolean                 gimp_image_raise_vectors_to_top     (gint32
                                                               gint32                  vectors_ID);
 gboolean                 gimp_image_lower_vectors_to_bottom  (gint32                  image_ID,
                                                               gint32                  vectors_ID);
+#endif /* GIMP_DISABLE_DEPRECATED */
 gint32                   gimp_image_flatten                  (gint32                  image_ID);
 gint32                   gimp_image_merge_visible_layers     (gint32                  image_ID,
                                                               GimpMergeType           merge_type);
diff --git a/tools/pdbgen/pdb/image.pdb b/tools/pdbgen/pdb/image.pdb
index 70cc1ec..94d4262 100644
--- a/tools/pdbgen/pdb/image.pdb
+++ b/tools/pdbgen/pdb/image.pdb
@@ -722,15 +722,164 @@ CODE
     );
 }
 
-sub image_get_layer_position {
-    $blurb = 'Returns the position of the layer in the layer stack.';
+sub image_get_item_position {
+    $blurb = 'Returns the position of the item in its level of its item tree.';
+
+    $help = <<'HELP';
+This procedure determines the position of the specified item in its
+level in its item tree in the image. If the item doesn't exist in the
+image, or the item is not part of an item tree, an error is returned.
+HELP
+
+    &mitch_pdb_misc('2010', '2.8');
+
+    @inargs = (
+	{ name => 'image', type => 'image',
+	  desc => 'The image' },
+	{ name => 'item', type => 'item',
+	  desc => 'The item' }
+    );
+
+    @outargs = (
+	{ name => 'position', type => 'int32',
+	  desc => "The position of the item in its level in the item tree" }
+    );
+
+
+    %invoke = (
+	code => <<'CODE'
+{
+  if (gimp_pdb_item_is_in_tree (item, image, FALSE, error))
+    position = gimp_item_get_index (item);
+  else
+    success = FALSE;
+}
+CODE
+    );
+}
+
+sub image_raise_item {
+    $blurb = "Raise the specified item in its level in its item tree";
+
+    $help = <<'HELP';
+This procedure raises the specified item one step in the item tree.
+The procecure call will fail if there is no item above it.
+HELP
+
+    &mitch_pdb_misc('2010', '2.8');
+
+    @inargs = (
+	{ name => 'image', type => 'image',
+	  desc => 'The image' },
+	{ name => 'item', type => 'item',
+	  desc => 'The item to raise' }
+    );
+
+    %invoke = (
+	code => <<'CODE'
+{
+  if (gimp_pdb_item_is_in_tree (item, image, FALSE, error))
+    success = gimp_image_raise_item (image, item, error);
+  else
+    success = FALSE;
+}
+CODE
+    );
+}
+
+sub image_lower_item {
+    $blurb = "Lower the specified item in its level in its item tree";
+
+    $help = <<'HELP';
+This procedure lowers the specified item one step in the item tree.
+The procecure call will fail if there is no item below it.
+HELP
+
+    &mitch_pdb_misc('2010', '2.8');
+
+    @inargs = (
+	{ name => 'image', type => 'image',
+	  desc => 'The image' },
+	{ name => 'item', type => 'item',
+	  desc => 'The item to lower' }
+    );
+
+    %invoke = (
+	code => <<'CODE'
+{
+  if (gimp_pdb_item_is_in_tree (item, image, FALSE, error))
+    success = gimp_image_lower_item (image, item, error);
+  else
+    success = FALSE;
+}
+CODE
+    );
+}
+
+sub image_raise_item_to_top {
+    $blurb = <<'BLURB';
+Raise the specified item to the top of its level in its item tree
+BLURB
 
     $help = <<'HELP';
-This procedure determines the position of the specified layer in the
-images layer stack. If the layer doesn't exist in the image, an error
-is returned.
+This procedure raises the specified item to top of its level in the
+item tree. It will not move the item if there is no item above it.
 HELP
 
+    &mitch_pdb_misc('2010', '2.8');
+
+    @inargs = (
+	{ name => 'image', type => 'image',
+	  desc => 'The image' },
+	{ name => 'item', type => 'item',
+	  desc => 'The item to raise to top' }
+    );
+
+    %invoke = (
+	code => <<'CODE'
+{
+  if (gimp_pdb_item_is_in_tree (item, image, FALSE, error))
+    success = gimp_image_raise_item_to_top (image, item);
+  else
+    success = FALSE;
+}
+CODE
+    );
+}
+
+sub image_lower_item_to_bottom {
+    $blurb = <<'BLURB';
+Lower the specified item to the bottom of its level in its item tree
+BLURB
+
+    $help = <<'HELP';
+This procedure lowers the specified item to bottom of its level in the
+item tree. It will not move the layer if there is no layer below it.
+HELP
+
+    &mitch_pdb_misc('2010', '2.8');
+
+    @inargs = (
+	{ name => 'image', type => 'image',
+	  desc => 'The image' },
+	{ name => 'item', type => 'item',
+	  desc => 'The item to lower to bottom' }
+    );
+
+    %invoke = (
+	code => <<'CODE'
+{
+  if (gimp_pdb_item_is_in_tree (item, image, FALSE, error))
+    success = gimp_image_lower_item_to_bottom (image, item);
+  else
+    success = FALSE;
+}
+CODE
+    );
+}
+
+sub image_get_layer_position {
+    &std_pdb_deprecated('gimp-image-get-item-position');
     &simon_pdb_misc('2006', '2.4');
 
     @inargs = (
@@ -761,14 +910,7 @@ CODE
 }
 
 sub image_raise_layer {
-    $blurb = "Raise the specified layer in the image's layer stack";
-
-    $help = <<'HELP';
-This procedure raises the specified layer one step in the existing layer stack.
-The procecure call will fail if there is no layer above it.
-HELP
-
-    &std_pdb_misc;
+    &std_pdb_deprecated('gimp-image-raise-item');
 
     @inargs = (
 	{ name => 'image', type => 'image',
@@ -790,14 +932,7 @@ CODE
 }
 
 sub image_lower_layer {
-    $blurb = "Lower the specified layer in the image's layer stack";
-
-    $help = <<'HELP';
-This procedure lowers the specified layer one step in the existing layer stack.
-The procecure call will fail if there is no layer below it.
-HELP
-
-    &std_pdb_misc;
+    &std_pdb_deprecated('gimp-image-lower-item');
 
     @inargs = (
 	{ name => 'image', type => 'image',
@@ -819,17 +954,7 @@ CODE
 }
 
 sub image_raise_layer_to_top {
-    $blurb = <<'BLURB';
-Raise the specified layer in the image's layer stack to top of stack
-BLURB
-
-    $help = <<'HELP';
-This procedure raises the specified layer to top of the existing layer stack.
-It will not move the layer if there is no layer above it.
-HELP
-
-    &wolfgang_pdb_misc('1998');
-    $author .= ", Sven Neumann";
+    &std_pdb_deprecated('gimp-image-raise-item-to-top');
 
     @inargs = (
 	{ name => 'image', type => 'image',
@@ -851,17 +976,7 @@ CODE
 }
 
 sub image_lower_layer_to_bottom {
-    $blurb = <<'BLURB';
-Lower the specified layer in the image's layer stack to bottom of stack
-BLURB
-
-    $help = <<'HELP';
-This procedure lowers the specified layer to bottom of the existing layer stack.
-It will not move the layer if there is no layer below it.
-HELP
-
-    &wolfgang_pdb_misc('1998');
-    $author .= ", Sven Neumann";
+    &std_pdb_deprecated('gimp-image-lower-item-to-bottom');
 
     @inargs = (
 	{ name => 'image', type => 'image',
@@ -1128,14 +1243,7 @@ CODE
 }
 
 sub image_get_channel_position {
-    $blurb = 'Returns the position of the channel in the channel stack.';
-
-    $help = <<'HELP';
-This procedure determines the position of the specified channel in
-the images channel stack. If the channel doesn't exist in the image,
-an error is returned.
-HELP
-
+    &std_pdb_deprecated('gimp-image-get-item-position');
     &simon_pdb_misc('2006', '2.4');
 
     @inargs = (
@@ -1166,15 +1274,7 @@ CODE
 }
 
 sub image_raise_channel {
-    $blurb = "Raise the specified channel in the image's channel stack";
-
-    $help = <<'HELP';
-This procedure raises the specified channel one step in the existing
-channel stack. The procecure call will fail if there is no channel
-above it.
-HELP
-
-    &std_pdb_misc;
+    &std_pdb_deprecated('gimp-image-raise-item');
 
     @inargs = (
 	{ name => 'image', type => 'image',
@@ -1196,15 +1296,7 @@ CODE
 }
 
 sub image_lower_channel {
-    $blurb = "Lower the specified channel in the image's channel stack";
-
-    $help = <<'HELP';
-This procedure lowers the specified channel one step in the existing
-channel stack. The procecure call will fail if there is no channel
-below it.
-HELP
-
-    &std_pdb_misc;
+    &std_pdb_deprecated('gimp-image-lower-item');
 
     @inargs = (
 	{ name => 'image', type => 'image',
@@ -1358,14 +1450,7 @@ CODE
 }
 
 sub image_get_vectors_position {
-    $blurb = 'Returns the position of the vectors object in the vectors objects stack.';
-
-    $help = <<'HELP';
-This procedure determines the position of the specified vectors object in the
-images vectors object stack. If the vectors object doesn't exist in the image,
-an error is returned.
-HELP
-
+    &std_pdb_deprecated('gimp-image-get-item-position');
     &simon_pdb_misc('2006', '2.4');
 
     @inargs = (
@@ -1396,14 +1481,7 @@ CODE
 }
 
 sub image_raise_vectors {
-    $blurb = "Raise the specified vectors in the image's vectors stack";
-
-    $help = <<'HELP';
-This procedure raises the specified vectors one step in the existing
-vectors stack. The procecure call will fail if there is no vectors
-above it.
-HELP
-
+    &std_pdb_deprecated('gimp-image-raise-item');
     &simon_pdb_misc('2005', '2.4');
 
     @inargs = (
@@ -1426,14 +1504,7 @@ CODE
 }
 
 sub image_lower_vectors {
-    $blurb = "Lower the specified vectors in the image's vectors stack";
-
-    $help = <<'HELP';
-This procedure lowers the specified vectors one step in the existing
-vectors stack. The procecure call will fail if there is no vectors
-below it.
-HELP
-
+    &std_pdb_deprecated('gimp-image-lower-item');
     &simon_pdb_misc('2005', '2.4');
 
     @inargs = (
@@ -1456,16 +1527,7 @@ CODE
 }
 
 sub image_raise_vectors_to_top {
-    $blurb = <<'BLURB';
-Raise the specified vectors in the image's vectors stack to top of stack
-BLURB
-
-    $help = <<'HELP';
-This procedure raises the specified vectors to top of the existing
-vectors stack. It will not move the vectors if there is no vectors
-above it.
-HELP
-
+    &std_pdb_deprecated('gimp-image-raise-item-to-top');
     &simon_pdb_misc('2005', '2.4');
 
     @inargs = (
@@ -1488,16 +1550,7 @@ CODE
 }
 
 sub image_lower_vectors_to_bottom {
-    $blurb = <<'BLURB';
-Lower the specified vectors in the image's vectors stack to bottom of stack
-BLURB
-
-    $help = <<'HELP';
-This procedure lowers the specified vectors to bottom of the existing
-vectors stack. It will not move the vectors if there is no vectors
-below it.
-HELP
-
+    &std_pdb_deprecated('gimp-image-lower-item-to-bottom');
     &simon_pdb_misc('2005', '2.4');
 
     @inargs = (
@@ -2725,13 +2778,16 @@ CODE
             image_pick_color
             image_pick_correlate_layer
             image_add_layer image_remove_layer
+            image_add_channel image_remove_channel
+            image_add_vectors image_remove_vectors
+            image_get_item_position
+            image_raise_item image_lower_item
+            image_raise_item_to_top image_lower_item_to_bottom
 	    image_get_layer_position
             image_raise_layer image_lower_layer
             image_raise_layer_to_top image_lower_layer_to_bottom
-            image_add_channel image_remove_channel
 	    image_get_channel_position
             image_raise_channel image_lower_channel
-            image_add_vectors image_remove_vectors
 	    image_get_vectors_position
             image_raise_vectors image_lower_vectors
             image_raise_vectors_to_top image_lower_vectors_to_bottom
@@ -2756,7 +2812,7 @@ CODE
             image_get_channel_by_tattoo
             image_get_vectors_by_tattoo);
 
-%exports = (app => [ procs], lib => [ procs[0  46,49..77]]);
+%exports = (app => [ procs], lib => [ procs[0  51,54..82]]);
 
 $desc = 'Image';
 $doc_title = 'gimpimage';



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