gimp r25337 - in trunk: . app/pdb libgimp tools/pdbgen tools/pdbgen/pdb



Author: neo
Date: Wed Apr  2 20:29:17 2008
New Revision: 25337
URL: http://svn.gnome.org/viewvc/gimp?rev=25337&view=rev

Log:
2008-04-02  Sven Neumann  <sven gimp org>

	* tools/pdbgen/stddefs.pdb: added shortcut for contributions 
from 
	Marcus Heese.

	* tools/pdbgen/pdb/drawable.pdb: added 
gimp_drawable_is_text_layer(),
	taken from the patch attached to bug #164539.

	* app/pdb/internal_procs.c
	* app/pdb/drawable_cmds.c
	* libgimp/gimpdrawable_pdb.[ch]: regenerated.

	* libgimp/gimp.def: updated.



Modified:
   trunk/ChangeLog
   trunk/app/pdb/drawable_cmds.c
   trunk/app/pdb/internal_procs.c
   trunk/libgimp/gimp.def
   trunk/libgimp/gimpdrawable_pdb.c
   trunk/libgimp/gimpdrawable_pdb.h
   trunk/tools/pdbgen/pdb/drawable.pdb
   trunk/tools/pdbgen/stddefs.pdb

Modified: trunk/app/pdb/drawable_cmds.c
==============================================================================
--- trunk/app/pdb/drawable_cmds.c	(original)
+++ trunk/app/pdb/drawable_cmds.c	Wed Apr  2 20:29:17 2008
@@ -100,6 +100,34 @@
 }
 
 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);
+
+  if (success)
+    g_value_set_boolean (&return_vals->values[1], text_layer);
+
+  return return_vals;
+}
+
+static GValueArray *
 drawable_is_layer_mask_invoker (GimpProcedure      *procedure,
                                 Gimp               *gimp,
                                 GimpContext        *context,
@@ -1270,7 +1298,35 @@
   gimp_procedure_add_return_value (procedure,
                                    g_param_spec_boolean ("layer",
                                                          "layer",
-                                                         "TRUE if the drawable is a layer",
+                                                         "TRUE if the drawable is a layer, FALSE otherwise",
+                                                         FALSE,
+                                                         GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (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",
+                                     "",
+                                     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);
@@ -1298,7 +1354,7 @@
   gimp_procedure_add_return_value (procedure,
                                    g_param_spec_boolean ("layer-mask",
                                                          "layer mask",
-                                                         "TRUE if the drawable is a layer mask",
+                                                         "TRUE if the drawable is a layer mask, FALSE otherwise",
                                                          FALSE,
                                                          GIMP_PARAM_READWRITE));
   gimp_pdb_register_procedure (pdb, procedure);
@@ -1326,7 +1382,7 @@
   gimp_procedure_add_return_value (procedure,
                                    g_param_spec_boolean ("channel",
                                                          "channel",
-                                                         "TRUE if the drawable is a channel",
+                                                         "TRUE if the drawable is a channel, FALSE otherwise",
                                                          FALSE,
                                                          GIMP_PARAM_READWRITE));
   gimp_pdb_register_procedure (pdb, procedure);

Modified: trunk/app/pdb/internal_procs.c
==============================================================================
--- trunk/app/pdb/internal_procs.c	(original)
+++ trunk/app/pdb/internal_procs.c	Wed Apr  2 20:29:17 2008
@@ -29,7 +29,7 @@
 #include "internal_procs.h"
 
 
-/* 554 procedures registered total */
+/* 555 procedures registered total */
 
 void
 internal_procs_init (GimpPDB *pdb)

Modified: trunk/libgimp/gimp.def
==============================================================================
--- trunk/libgimp/gimp.def	(original)
+++ trunk/libgimp/gimp.def	Wed Apr  2 20:29:17 2008
@@ -142,6 +142,7 @@
 	gimp_drawable_is_layer
 	gimp_drawable_is_layer_mask
 	gimp_drawable_is_rgb
+	gimp_drawable_is_text_layer
 	gimp_drawable_is_valid
 	gimp_drawable_mask_bounds
 	gimp_drawable_mask_intersect

Modified: trunk/libgimp/gimpdrawable_pdb.c
==============================================================================
--- trunk/libgimp/gimpdrawable_pdb.c	(original)
+++ trunk/libgimp/gimpdrawable_pdb.c	Wed Apr  2 20:29:17 2008
@@ -71,7 +71,7 @@
  *
  * This procedure returns TRUE if the specified drawable is a layer.
  *
- * Returns: TRUE if the drawable is a layer.
+ * Returns: TRUE if the drawable is a layer, FALSE otherwise.
  */
 gboolean
 gimp_drawable_is_layer (gint32 drawable_ID)
@@ -94,6 +94,39 @@
 }
 
 /**
+ * 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 2008
+ */
+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_is_layer_mask:
  * @drawable_ID: The drawable.
  *
@@ -102,7 +135,7 @@
  * This procedure returns TRUE if the specified drawable is a layer
  * mask.
  *
- * Returns: TRUE if the drawable is a layer mask.
+ * Returns: TRUE if the drawable is a layer mask, FALSE otherwise.
  */
 gboolean
 gimp_drawable_is_layer_mask (gint32 drawable_ID)
@@ -132,7 +165,7 @@
  *
  * This procedure returns TRUE if the specified drawable is a channel.
  *
- * Returns: TRUE if the drawable is a channel.
+ * Returns: TRUE if the drawable is a channel, FALSE otherwise.
  */
 gboolean
 gimp_drawable_is_channel (gint32 drawable_ID)

Modified: trunk/libgimp/gimpdrawable_pdb.h
==============================================================================
--- trunk/libgimp/gimpdrawable_pdb.h	(original)
+++ trunk/libgimp/gimpdrawable_pdb.h	Wed Apr  2 20:29:17 2008
@@ -31,6 +31,7 @@
 
 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);
 GimpImageType            gimp_drawable_type               (gint32                      drawable_ID);

Modified: trunk/tools/pdbgen/pdb/drawable.pdb
==============================================================================
--- trunk/tools/pdbgen/pdb/drawable.pdb	(original)
+++ trunk/tools/pdbgen/pdb/drawable.pdb	Wed Apr  2 20:29:17 2008
@@ -578,7 +578,7 @@
 
     @outargs = (
 	{ name => 'layer', type => 'boolean',
-	  desc => 'TRUE if the drawable is a layer' }
+	  desc => 'TRUE if the drawable is a layer, FALSE otherwise' }
     );
 
     %invoke = (
@@ -590,6 +590,34 @@
     );
 }
 
+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_is_layer_mask {
     $blurb = 'Returns whether the drawable is a layer mask.';
 
@@ -606,7 +634,7 @@
 
     @outargs = (
 	{ name => 'layer_mask', type => 'boolean',
-	  desc => 'TRUE if the drawable is a layer mask' }
+	  desc => 'TRUE if the drawable is a layer mask, FALSE otherwise' }
     );
 
     %invoke = (
@@ -634,7 +662,7 @@
 
     @outargs = (
 	{ name => 'channel', type => 'boolean',
-	  desc => 'TRUE if the drawable is a channel' }
+	  desc => 'TRUE if the drawable is a channel, FALSE otherwise' }
     );
 
     %invoke = (
@@ -1276,7 +1304,8 @@
               "gimp-intl.h");
 
 @procs = qw(drawable_is_valid
-            drawable_is_layer drawable_is_layer_mask drawable_is_channel
+            drawable_is_layer drawable_is_text_layer
+	    drawable_is_layer_mask drawable_is_channel
 	    drawable_type  drawable_type_with_alpha drawable_has_alpha
             drawable_is_rgb drawable_is_gray drawable_is_indexed
             drawable_bpp

Modified: trunk/tools/pdbgen/stddefs.pdb
==============================================================================
--- trunk/tools/pdbgen/stddefs.pdb	(original)
+++ trunk/tools/pdbgen/stddefs.pdb	Wed Apr  2 20:29:17 2008
@@ -94,6 +94,10 @@
     contrib_pdb_misc('Marc Lehmann', '', @_);
 }
 
+sub marcus_pdb_misc {
+    contrib_pdb_misc('Marcus Heese', 'heese cip ifi lmu de', '', @_);
+}
+
 sub martin_pdb_misc {
     contrib_pdb_misc('Martin Nordholts', '', @_);
 }



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