[gimp] pdb: deprecate gimp-drawable-is-text-layer and add gimp-item-is-text-layer



commit 38b9b4117e8bc6980312506ee2dd86afd248c064
Author: Michael Natterer <mitch gimp org>
Date:   Wed Sep 15 21:51:53 2010 +0200

    pdb: deprecate gimp-drawable-is-text-layer and add gimp-item-is-text-layer

 app/pdb/drawable-cmds.c       |   58 ----------------------------------------
 app/pdb/gimp-pdb-compat.c     |    1 +
 app/pdb/item-cmds.c           |   59 +++++++++++++++++++++++++++++++++++++++++
 libgimp/gimp.def              |    1 +
 libgimp/gimpdrawable.c        |   16 +++++++++++
 libgimp/gimpdrawable.h        |    1 +
 libgimp/gimpdrawable_pdb.c    |   33 -----------------------
 libgimp/gimpdrawable_pdb.h    |    1 -
 libgimp/gimpitem_pdb.c        |   32 ++++++++++++++++++++++
 libgimp/gimpitem_pdb.h        |    1 +
 tools/pdbgen/pdb/drawable.pdb |   31 +---------------------
 tools/pdbgen/pdb/item.pdb     |   30 +++++++++++++++++++++
 12 files changed, 142 insertions(+), 122 deletions(-)
---
diff --git a/app/pdb/drawable-cmds.c b/app/pdb/drawable-cmds.c
index de783c5..e3171e0 100644
--- a/app/pdb/drawable-cmds.c
+++ b/app/pdb/drawable-cmds.c
@@ -51,35 +51,6 @@
 
 
 static GValueArray *
-drawable_is_text_layer_invoker (GimpProcedure      *procedure,
-                                Gimp               *gimp,
-                                GimpContext        *context,
-                                GimpProgress       *progress,
-                                const GValueArray  *args,
-                                GError            **error)
-{
-  gboolean success = TRUE;
-  GValueArray *return_vals;
-  GimpDrawable *drawable;
-  gboolean text_layer = FALSE;
-
-  drawable = gimp_value_get_drawable (&args->values[0], gimp);
-
-  if (success)
-    {
-      text_layer = gimp_drawable_is_text_layer (drawable);
-    }
-
-  return_vals = gimp_procedure_get_return_values (procedure, success,
-                                                  error ? *error : NULL);
-
-  if (success)
-    g_value_set_boolean (&return_vals->values[1], text_layer);
-
-  return return_vals;
-}
-
-static GValueArray *
 drawable_type_invoker (GimpProcedure      *procedure,
                        Gimp               *gimp,
                        GimpContext        *context,
@@ -949,35 +920,6 @@ register_drawable_procs (GimpPDB *pdb)
   GimpProcedure *procedure;
 
   /*
-   * gimp-drawable-is-text-layer
-   */
-  procedure = gimp_procedure_new (drawable_is_text_layer_invoker);
-  gimp_object_set_static_name (GIMP_OBJECT (procedure),
-                               "gimp-drawable-is-text-layer");
-  gimp_procedure_set_static_strings (procedure,
-                                     "gimp-drawable-is-text-layer",
-                                     "Returns whether the drawable is a text layer.",
-                                     "This procedure returns TRUE if the specified drawable is a text layer.",
-                                     "Marcus Heese <heese cip ifi lmu de>",
-                                     "Marcus Heese",
-                                     "2008",
-                                     NULL);
-  gimp_procedure_add_argument (procedure,
-                               gimp_param_spec_drawable_id ("drawable",
-                                                            "drawable",
-                                                            "The drawable",
-                                                            pdb->gimp, FALSE,
-                                                            GIMP_PARAM_READWRITE));
-  gimp_procedure_add_return_value (procedure,
-                                   g_param_spec_boolean ("text-layer",
-                                                         "text layer",
-                                                         "TRUE if the drawable is a text layer, FALSE otherwise.",
-                                                         FALSE,
-                                                         GIMP_PARAM_READWRITE));
-  gimp_pdb_register_procedure (pdb, procedure);
-  g_object_unref (procedure);
-
-  /*
    * gimp-drawable-type
    */
   procedure = gimp_procedure_new (drawable_type_invoker);
diff --git a/app/pdb/gimp-pdb-compat.c b/app/pdb/gimp-pdb-compat.c
index 28117a6..c976420 100644
--- a/app/pdb/gimp-pdb-compat.c
+++ b/app/pdb/gimp-pdb-compat.c
@@ -428,6 +428,7 @@ gimp_pdb_compat_procs_register (GimpPDB           *pdb,
     /*  deprecations since 2.6  */
     { "gimp-drawable-is-valid",          "gimp-item-is-valid"              },
     { "gimp-drawable-is-layer",          "gimp-item-is-layer"              },
+    { "gimp-drawable-is-text-layer",     "gimp-item-is-text-layer"         },
     { "gimp-drawable-is-layer-mask",     "gimp-item-is-layer-mask"         },
     { "gimp-drawable-is-channel",        "gimp-item-is-channel"            },
     { "gimp-drawable-delete",            "gimp-item-delete"                },
diff --git a/app/pdb/item-cmds.c b/app/pdb/item-cmds.c
index 1644a29..96c2cd5 100644
--- a/app/pdb/item-cmds.c
+++ b/app/pdb/item-cmds.c
@@ -180,6 +180,36 @@ item_is_layer_invoker (GimpProcedure      *procedure,
 }
 
 static GValueArray *
+item_is_text_layer_invoker (GimpProcedure      *procedure,
+                            Gimp               *gimp,
+                            GimpContext        *context,
+                            GimpProgress       *progress,
+                            const GValueArray  *args,
+                            GError            **error)
+{
+  gboolean success = TRUE;
+  GValueArray *return_vals;
+  GimpItem *item;
+  gboolean text_layer = FALSE;
+
+  item = gimp_value_get_item (&args->values[0], gimp);
+
+  if (success)
+    {
+      text_layer = (GIMP_IS_DRAWABLE (item) &&
+                    gimp_drawable_is_text_layer (GIMP_DRAWABLE (item)));
+    }
+
+  return_vals = gimp_procedure_get_return_values (procedure, success,
+                                                  error ? *error : NULL);
+
+  if (success)
+    g_value_set_boolean (&return_vals->values[1], text_layer);
+
+  return return_vals;
+}
+
+static GValueArray *
 item_is_channel_invoker (GimpProcedure      *procedure,
                          Gimp               *gimp,
                          GimpContext        *context,
@@ -857,6 +887,35 @@ register_item_procs (GimpPDB *pdb)
   g_object_unref (procedure);
 
   /*
+   * gimp-item-is-text-layer
+   */
+  procedure = gimp_procedure_new (item_is_text_layer_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-item-is-text-layer");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-item-is-text-layer",
+                                     "Returns whether the item is a text layer.",
+                                     "This procedure returns TRUE if the specified item is a text layer.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2010",
+                                     NULL);
+  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,
+                                   g_param_spec_boolean ("text-layer",
+                                                         "text layer",
+                                                         "TRUE if the item is a text layer, FALSE otherwise.",
+                                                         FALSE,
+                                                         GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
    * gimp-item-is-channel
    */
   procedure = gimp_procedure_new (item_is_channel_invoker);
diff --git a/libgimp/gimp.def b/libgimp/gimp.def
index 3ac6b63..a868743 100644
--- a/libgimp/gimp.def
+++ b/libgimp/gimp.def
@@ -446,6 +446,7 @@ EXPORTS
 	gimp_item_is_layer
 	gimp_item_is_layer_mask
 	gimp_item_is_selection
+	gimp_item_is_text_layer
 	gimp_item_is_valid
 	gimp_item_is_vectors
 	gimp_item_parasite_attach
diff --git a/libgimp/gimpdrawable.c b/libgimp/gimpdrawable.c
index 5da38b4..11cdf66 100644
--- a/libgimp/gimpdrawable.c
+++ b/libgimp/gimpdrawable.c
@@ -352,6 +352,22 @@ gimp_drawable_is_layer (gint32 drawable_ID)
 }
 
 /**
+ * gimp_drawable_is_text_layer:
+ * @drawable_ID: The drawable.
+ *
+ * Deprecated: Use gimp_item_is_text_layer() instead.
+ *
+ * Returns: TRUE if the drawable is a text layer, FALSE otherwise.
+ *
+ * Since: GIMP 2.6
+ */
+gboolean
+gimp_drawable_is_text_layer (gint32 drawable_ID)
+{
+  return gimp_item_is_text_layer (drawable_ID);
+}
+
+/**
  * gimp_drawable_is_layer_mask:
  * @drawable_ID: The drawable.
  *
diff --git a/libgimp/gimpdrawable.h b/libgimp/gimpdrawable.h
index e846ab9..002a38f 100644
--- a/libgimp/gimpdrawable.h
+++ b/libgimp/gimpdrawable.h
@@ -71,6 +71,7 @@ guchar       * gimp_drawable_get_sub_thumbnail_data (gint32         drawable_ID,
 #ifndef GIMP_DISABLE_DEPRECATED
 gboolean       gimp_drawable_is_valid               (gint32         drawable_ID);
 gboolean       gimp_drawable_is_layer               (gint32         drawable_ID);
+gboolean       gimp_drawable_is_text_layer          (gint32         drawable_ID);
 gboolean       gimp_drawable_is_layer_mask          (gint32         drawable_ID);
 gboolean       gimp_drawable_is_channel             (gint32         drawable_ID);
 gboolean       gimp_drawable_delete                 (gint32         drawable_ID);
diff --git a/libgimp/gimpdrawable_pdb.c b/libgimp/gimpdrawable_pdb.c
index f055905..f5e4199 100644
--- a/libgimp/gimpdrawable_pdb.c
+++ b/libgimp/gimpdrawable_pdb.c
@@ -40,39 +40,6 @@
 
 
 /**
- * gimp_drawable_is_text_layer:
- * @drawable_ID: The drawable.
- *
- * Returns whether the drawable is a text layer.
- *
- * This procedure returns TRUE if the specified drawable is a text
- * layer.
- *
- * Returns: TRUE if the drawable is a text layer, FALSE otherwise.
- *
- * Since: GIMP 2.6
- */
-gboolean
-gimp_drawable_is_text_layer (gint32 drawable_ID)
-{
-  GimpParam *return_vals;
-  gint nreturn_vals;
-  gboolean text_layer = FALSE;
-
-  return_vals = gimp_run_procedure ("gimp-drawable-is-text-layer",
-                                    &nreturn_vals,
-                                    GIMP_PDB_DRAWABLE, drawable_ID,
-                                    GIMP_PDB_END);
-
-  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
-    text_layer = return_vals[1].data.d_int32;
-
-  gimp_destroy_params (return_vals, nreturn_vals);
-
-  return text_layer;
-}
-
-/**
  * gimp_drawable_type:
  * @drawable_ID: The drawable.
  *
diff --git a/libgimp/gimpdrawable_pdb.h b/libgimp/gimpdrawable_pdb.h
index 7f3330c..0cfd721 100644
--- a/libgimp/gimpdrawable_pdb.h
+++ b/libgimp/gimpdrawable_pdb.h
@@ -28,7 +28,6 @@ G_BEGIN_DECLS
 /* For information look into the C source or the html documentation */
 
 
-gboolean                 gimp_drawable_is_text_layer      (gint32                      drawable_ID);
 GimpImageType            gimp_drawable_type               (gint32                      drawable_ID);
 GimpImageType            gimp_drawable_type_with_alpha    (gint32                      drawable_ID);
 gboolean                 gimp_drawable_has_alpha          (gint32                      drawable_ID);
diff --git a/libgimp/gimpitem_pdb.c b/libgimp/gimpitem_pdb.c
index 20b2b39..be995c8 100644
--- a/libgimp/gimpitem_pdb.c
+++ b/libgimp/gimpitem_pdb.c
@@ -201,6 +201,38 @@ gimp_item_is_layer (gint32 item_ID)
 }
 
 /**
+ * gimp_item_is_text_layer:
+ * @item_ID: The item.
+ *
+ * Returns whether the item is a text layer.
+ *
+ * This procedure returns TRUE if the specified item is a text layer.
+ *
+ * Returns: TRUE if the item is a text layer, FALSE otherwise.
+ *
+ * Since: GIMP 2.8
+ */
+gboolean
+gimp_item_is_text_layer (gint32 item_ID)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean text_layer = FALSE;
+
+  return_vals = gimp_run_procedure ("gimp-item-is-text-layer",
+                                    &nreturn_vals,
+                                    GIMP_PDB_ITEM, item_ID,
+                                    GIMP_PDB_END);
+
+  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+    text_layer = return_vals[1].data.d_int32;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return text_layer;
+}
+
+/**
  * gimp_item_is_channel:
  * @item_ID: The item.
  *
diff --git a/libgimp/gimpitem_pdb.h b/libgimp/gimpitem_pdb.h
index 1f5d3c1..e101935 100644
--- a/libgimp/gimpitem_pdb.h
+++ b/libgimp/gimpitem_pdb.h
@@ -33,6 +33,7 @@ gint32   gimp_item_get_image        (gint32          item_ID);
 gboolean gimp_item_delete           (gint32          item_ID);
 gboolean gimp_item_is_drawable      (gint32          item_ID);
 gboolean gimp_item_is_layer         (gint32          item_ID);
+gboolean gimp_item_is_text_layer    (gint32          item_ID);
 gboolean gimp_item_is_channel       (gint32          item_ID);
 gboolean gimp_item_is_layer_mask    (gint32          item_ID);
 gboolean gimp_item_is_selection     (gint32          item_ID);
diff --git a/tools/pdbgen/pdb/drawable.pdb b/tools/pdbgen/pdb/drawable.pdb
index 8660ef6..af30b70 100644
--- a/tools/pdbgen/pdb/drawable.pdb
+++ b/tools/pdbgen/pdb/drawable.pdb
@@ -551,34 +551,6 @@ CODE
     );
 }
 
-sub drawable_is_text_layer {
-    $blurb = 'Returns whether the drawable is a text layer.';
-
-    $help = <<'HELP';
-This procedure returns TRUE if the specified drawable is a text layer.
-HELP
-
-    &marcus_pdb_misc('2008', '2.6');
-
-    @inargs = (
-        { name => 'drawable', type => 'drawable',
-	  desc => 'The drawable' }
-    );
-
-    @outargs = (
-        { name => 'text_layer', type => 'boolean',
-	  desc => 'TRUE if the drawable is a text layer, FALSE otherwise.' }
-    );
-
-    %invoke = (
-        code => <<'CODE'
-{
-  text_layer = gimp_drawable_is_text_layer (drawable);
-}
-CODE
-    );
-}
-
 sub drawable_get_pixel {
     $blurb = 'Gets the value of the pixel at the specified coordinates.';
 
@@ -973,8 +945,7 @@ CODE
               "gimppdb-utils.h"
               "gimp-intl.h");
 
- procs = qw(drawable_is_text_layer
-	    drawable_type
+ procs = qw(drawable_type
             drawable_type_with_alpha
             drawable_has_alpha
             drawable_is_rgb
diff --git a/tools/pdbgen/pdb/item.pdb b/tools/pdbgen/pdb/item.pdb
index 4736857..1ea0fa4 100644
--- a/tools/pdbgen/pdb/item.pdb
+++ b/tools/pdbgen/pdb/item.pdb
@@ -165,6 +165,35 @@ CODE
     );
 }
 
+sub item_is_text_layer {
+    $blurb = 'Returns whether the item is a text layer.';
+
+    $help = <<'HELP';
+This procedure returns TRUE if the specified item is a text layer.
+HELP
+
+    &mitch_pdb_misc('2010', '2.8');
+
+    @inargs = (
+        { name => 'item', type => 'item',
+	  desc => 'The item' }
+    );
+
+    @outargs = (
+        { name => 'text_layer', type => 'boolean',
+	  desc => 'TRUE if the item is a text layer, FALSE otherwise.' }
+    );
+
+    %invoke = (
+        code => <<'CODE'
+{
+  text_layer = (GIMP_IS_DRAWABLE (item) &&
+                gimp_drawable_is_text_layer (GIMP_DRAWABLE (item)));
+}
+CODE
+    );
+}
+
 sub item_is_channel {
     $blurb = 'Returns whether the item is a channel.';
 
@@ -708,6 +737,7 @@ CODE
             item_delete
             item_is_drawable
             item_is_layer
+            item_is_text_layer
 	    item_is_channel
 	    item_is_layer_mask
 	    item_is_selection



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