[gimp] Add "lock_content" PDB getters and setters for drawables and vectors



commit 256ac5e62e71610e8ab9f1ddc87f6439719892e0
Author: Michael Natterer <mitch gimp org>
Date:   Fri Aug 21 14:30:41 2009 +0200

    Add "lock_content" PDB getters and setters for drawables and vectors

 app/pdb/drawable-cmds.c       |  111 +++++++++++++++++++++++++++++++++++++++++
 app/pdb/internal-procs.c      |    2 +-
 app/pdb/vectors-cmds.c        |  111 +++++++++++++++++++++++++++++++++++++++++
 libgimp/gimpdrawable_pdb.c    |   66 ++++++++++++++++++++++++
 libgimp/gimpdrawable_pdb.h    |    3 +
 libgimp/gimpvectors_pdb.c     |   66 ++++++++++++++++++++++++
 libgimp/gimpvectors_pdb.h     |    3 +
 tools/pdbgen/pdb/drawable.pdb |   50 ++++++++++++++++++
 tools/pdbgen/pdb/vectors.pdb  |   48 ++++++++++++++++++
 9 files changed, 459 insertions(+), 1 deletions(-)
---
diff --git a/app/pdb/drawable-cmds.c b/app/pdb/drawable-cmds.c
index fd362e1..a224910 100644
--- a/app/pdb/drawable-cmds.c
+++ b/app/pdb/drawable-cmds.c
@@ -725,6 +725,59 @@ drawable_set_linked_invoker (GimpProcedure      *procedure,
 }
 
 static GValueArray *
+drawable_get_lock_content_invoker (GimpProcedure      *procedure,
+                                   Gimp               *gimp,
+                                   GimpContext        *context,
+                                   GimpProgress       *progress,
+                                   const GValueArray  *args,
+                                   GError            **error)
+{
+  gboolean success = TRUE;
+  GValueArray *return_vals;
+  GimpDrawable *drawable;
+  gboolean lock_content = FALSE;
+
+  drawable = gimp_value_get_drawable (&args->values[0], gimp);
+
+  if (success)
+    {
+      lock_content = gimp_item_get_lock_content (GIMP_ITEM (drawable));
+    }
+
+  return_vals = gimp_procedure_get_return_values (procedure, success,
+                                                  error ? *error : NULL);
+
+  if (success)
+    g_value_set_boolean (&return_vals->values[1], lock_content);
+
+  return return_vals;
+}
+
+static GValueArray *
+drawable_set_lock_content_invoker (GimpProcedure      *procedure,
+                                   Gimp               *gimp,
+                                   GimpContext        *context,
+                                   GimpProgress       *progress,
+                                   const GValueArray  *args,
+                                   GError            **error)
+{
+  gboolean success = TRUE;
+  GimpDrawable *drawable;
+  gboolean lock_content;
+
+  drawable = gimp_value_get_drawable (&args->values[0], gimp);
+  lock_content = g_value_get_boolean (&args->values[1]);
+
+  if (success)
+    {
+      gimp_item_set_lock_content (GIMP_ITEM (drawable), lock_content, TRUE);
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GValueArray *
 drawable_get_tattoo_invoker (GimpProcedure      *procedure,
                              Gimp               *gimp,
                              GimpContext        *context,
@@ -2030,6 +2083,64 @@ register_drawable_procs (GimpPDB *pdb)
   g_object_unref (procedure);
 
   /*
+   * gimp-drawable-get-lock-content
+   */
+  procedure = gimp_procedure_new (drawable_get_lock_content_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-drawable-get-lock-content");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-drawable-get-lock-content",
+                                     "Get the 'lock content' state of the specified drawable.",
+                                     "This procedure returns the specified drawable's lock content state.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2009",
+                                     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 ("lock-content",
+                                                         "lock content",
+                                                         "Whether the drawable's pixels are locked",
+                                                         FALSE,
+                                                         GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-drawable-set-lock-content
+   */
+  procedure = gimp_procedure_new (drawable_set_lock_content_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-drawable-set-lock-content");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-drawable-set-lock-content",
+                                     "Set the 'lock content' state of the specified drawable.",
+                                     "This procedure sets the specified drawable's lock content state.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2009",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_drawable_id ("drawable",
+                                                            "drawable",
+                                                            "The drawable",
+                                                            pdb->gimp, FALSE,
+                                                            GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_boolean ("lock-content",
+                                                     "lock content",
+                                                     "The new drawable 'lock content' state",
+                                                     FALSE,
+                                                     GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
    * gimp-drawable-get-tattoo
    */
   procedure = gimp_procedure_new (drawable_get_tattoo_invoker);
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 7ed99c8..554e83a 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
 #include "internal-procs.h"
 
 
-/* 597 procedures registered total */
+/* 601 procedures registered total */
 
 void
 internal_procs_init (GimpPDB *pdb)
diff --git a/app/pdb/vectors-cmds.c b/app/pdb/vectors-cmds.c
index 87d84cc..61508fc 100644
--- a/app/pdb/vectors-cmds.c
+++ b/app/pdb/vectors-cmds.c
@@ -367,6 +367,59 @@ vectors_set_linked_invoker (GimpProcedure      *procedure,
 }
 
 static GValueArray *
+vectors_get_lock_content_invoker (GimpProcedure      *procedure,
+                                  Gimp               *gimp,
+                                  GimpContext        *context,
+                                  GimpProgress       *progress,
+                                  const GValueArray  *args,
+                                  GError            **error)
+{
+  gboolean success = TRUE;
+  GValueArray *return_vals;
+  GimpVectors *vectors;
+  gboolean lock_content = FALSE;
+
+  vectors = gimp_value_get_vectors (&args->values[0], gimp);
+
+  if (success)
+    {
+      lock_content = gimp_item_get_lock_content (GIMP_ITEM (vectors));
+    }
+
+  return_vals = gimp_procedure_get_return_values (procedure, success,
+                                                  error ? *error : NULL);
+
+  if (success)
+    g_value_set_boolean (&return_vals->values[1], lock_content);
+
+  return return_vals;
+}
+
+static GValueArray *
+vectors_set_lock_content_invoker (GimpProcedure      *procedure,
+                                  Gimp               *gimp,
+                                  GimpContext        *context,
+                                  GimpProgress       *progress,
+                                  const GValueArray  *args,
+                                  GError            **error)
+{
+  gboolean success = TRUE;
+  GimpVectors *vectors;
+  gboolean lock_content;
+
+  vectors = gimp_value_get_vectors (&args->values[0], gimp);
+  lock_content = g_value_get_boolean (&args->values[1]);
+
+  if (success)
+    {
+      gimp_item_set_lock_content (GIMP_ITEM (vectors), lock_content, TRUE);
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GValueArray *
 vectors_get_tattoo_invoker (GimpProcedure      *procedure,
                             Gimp               *gimp,
                             GimpContext        *context,
@@ -1790,6 +1843,64 @@ register_vectors_procs (GimpPDB *pdb)
   g_object_unref (procedure);
 
   /*
+   * gimp-vectors-get-lock-content
+   */
+  procedure = gimp_procedure_new (vectors_get_lock_content_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-vectors-get-lock-content");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-vectors-get-lock-content",
+                                     "Gets the 'lock content' state of the vectors object.",
+                                     "Gets the 'lock content' state of the vectors object.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2009",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_vectors_id ("vectors",
+                                                           "vectors",
+                                                           "The vectors object",
+                                                           pdb->gimp, FALSE,
+                                                           GIMP_PARAM_READWRITE));
+  gimp_procedure_add_return_value (procedure,
+                                   g_param_spec_boolean ("lock-content",
+                                                         "lock content",
+                                                         "Whether the path's strokes are locked",
+                                                         FALSE,
+                                                         GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-vectors-set-lock-content
+   */
+  procedure = gimp_procedure_new (vectors_set_lock_content_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-vectors-set-lock-content");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-vectors-set-lock-content",
+                                     "Sets the 'lock content' state of the vectors object.",
+                                     "Sets the 'lock content' state of the vectors object.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2009",
+                                     NULL);
+  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,
+                               g_param_spec_boolean ("lock-content",
+                                                     "lock content",
+                                                     "Whether the path's strokes are locked",
+                                                     FALSE,
+                                                     GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
    * gimp-vectors-get-tattoo
    */
   procedure = gimp_procedure_new (vectors_get_tattoo_invoker);
diff --git a/libgimp/gimpdrawable_pdb.c b/libgimp/gimpdrawable_pdb.c
index 15bc710..6727504 100644
--- a/libgimp/gimpdrawable_pdb.c
+++ b/libgimp/gimpdrawable_pdb.c
@@ -789,6 +789,72 @@ gimp_drawable_set_linked (gint32   drawable_ID,
 }
 
 /**
+ * gimp_drawable_get_lock_content:
+ * @drawable_ID: The drawable.
+ *
+ * Get the 'lock content' state of the specified drawable.
+ *
+ * This procedure returns the specified drawable's lock content state.
+ *
+ * Returns: Whether the drawable's pixels are locked.
+ *
+ * Since: GIMP 2.8
+ */
+gboolean
+gimp_drawable_get_lock_content (gint32 drawable_ID)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean lock_content = FALSE;
+
+  return_vals = gimp_run_procedure ("gimp-drawable-get-lock-content",
+                                    &nreturn_vals,
+                                    GIMP_PDB_DRAWABLE, drawable_ID,
+                                    GIMP_PDB_END);
+
+  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+    lock_content = return_vals[1].data.d_int32;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return lock_content;
+}
+
+/**
+ * gimp_drawable_set_lock_content:
+ * @drawable_ID: The drawable.
+ * @lock_content: The new drawable 'lock content' state.
+ *
+ * Set the 'lock content' state of the specified drawable.
+ *
+ * This procedure sets the specified drawable's lock content state.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: GIMP 2.8
+ */
+gboolean
+gimp_drawable_set_lock_content (gint32   drawable_ID,
+                                gboolean lock_content)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean success = TRUE;
+
+  return_vals = gimp_run_procedure ("gimp-drawable-set-lock-content",
+                                    &nreturn_vals,
+                                    GIMP_PDB_DRAWABLE, drawable_ID,
+                                    GIMP_PDB_INT32, lock_content,
+                                    GIMP_PDB_END);
+
+  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return success;
+}
+
+/**
  * gimp_drawable_get_tattoo:
  * @drawable_ID: The drawable.
  *
diff --git a/libgimp/gimpdrawable_pdb.h b/libgimp/gimpdrawable_pdb.h
index 8b49bc3..9bfc751 100644
--- a/libgimp/gimpdrawable_pdb.h
+++ b/libgimp/gimpdrawable_pdb.h
@@ -60,6 +60,9 @@ gboolean                 gimp_drawable_set_visible        (gint32
 gboolean                 gimp_drawable_get_linked         (gint32                      drawable_ID);
 gboolean                 gimp_drawable_set_linked         (gint32                      drawable_ID,
                                                            gboolean                    linked);
+gboolean                 gimp_drawable_get_lock_content   (gint32                      drawable_ID);
+gboolean                 gimp_drawable_set_lock_content   (gint32                      drawable_ID,
+                                                           gboolean                    lock_content);
 gint                     gimp_drawable_get_tattoo         (gint32                      drawable_ID);
 gboolean                 gimp_drawable_set_tattoo         (gint32                      drawable_ID,
                                                            gint                        tattoo);
diff --git a/libgimp/gimpvectors_pdb.c b/libgimp/gimpvectors_pdb.c
index b7d4450..740a902 100644
--- a/libgimp/gimpvectors_pdb.c
+++ b/libgimp/gimpvectors_pdb.c
@@ -395,6 +395,72 @@ gimp_vectors_set_linked (gint32   vectors_ID,
 }
 
 /**
+ * gimp_vectors_get_lock_content:
+ * @vectors_ID: The vectors object.
+ *
+ * Gets the 'lock content' state of the vectors object.
+ *
+ * Gets the 'lock content' state of the vectors object.
+ *
+ * Returns: Whether the path's strokes are locked.
+ *
+ * Since: GIMP 2.8
+ */
+gboolean
+gimp_vectors_get_lock_content (gint32 vectors_ID)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean lock_content = FALSE;
+
+  return_vals = gimp_run_procedure ("gimp-vectors-get-lock-content",
+                                    &nreturn_vals,
+                                    GIMP_PDB_VECTORS, vectors_ID,
+                                    GIMP_PDB_END);
+
+  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+    lock_content = return_vals[1].data.d_int32;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return lock_content;
+}
+
+/**
+ * gimp_vectors_set_lock_content:
+ * @vectors_ID: The vectors object.
+ * @lock_content: Whether the path's strokes are locked.
+ *
+ * Sets the 'lock content' state of the vectors object.
+ *
+ * Sets the 'lock content' state of the vectors object.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: GIMP 2.8
+ */
+gboolean
+gimp_vectors_set_lock_content (gint32   vectors_ID,
+                               gboolean lock_content)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean success = TRUE;
+
+  return_vals = gimp_run_procedure ("gimp-vectors-set-lock-content",
+                                    &nreturn_vals,
+                                    GIMP_PDB_VECTORS, vectors_ID,
+                                    GIMP_PDB_INT32, lock_content,
+                                    GIMP_PDB_END);
+
+  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return success;
+}
+
+/**
  * gimp_vectors_get_tattoo:
  * @vectors_ID: The vectors object.
  *
diff --git a/libgimp/gimpvectors_pdb.h b/libgimp/gimpvectors_pdb.h
index 67db719..24d37bc 100644
--- a/libgimp/gimpvectors_pdb.h
+++ b/libgimp/gimpvectors_pdb.h
@@ -44,6 +44,9 @@ gboolean              gimp_vectors_set_visible               (gint32
 gboolean              gimp_vectors_get_linked                (gint32                  vectors_ID);
 gboolean              gimp_vectors_set_linked                (gint32                  vectors_ID,
                                                               gboolean                linked);
+gboolean              gimp_vectors_get_lock_content          (gint32                  vectors_ID);
+gboolean              gimp_vectors_set_lock_content          (gint32                  vectors_ID,
+                                                              gboolean                lock_content);
 gint                  gimp_vectors_get_tattoo                (gint32                  vectors_ID);
 gboolean              gimp_vectors_set_tattoo                (gint32                  vectors_ID,
                                                               gint                    tattoo);
diff --git a/tools/pdbgen/pdb/drawable.pdb b/tools/pdbgen/pdb/drawable.pdb
index 02afe9a..ce18664 100644
--- a/tools/pdbgen/pdb/drawable.pdb
+++ b/tools/pdbgen/pdb/drawable.pdb
@@ -863,6 +863,55 @@ CODE
     );
 }
 
+sub drawable_get_lock_content {
+    $blurb = "Get the 'lock content' state of the specified drawable.";
+
+    $help = "This procedure returns the specified drawable's lock content state.";
+
+    &mitch_pdb_misc('2009', '2.8');
+
+    @inargs = (
+	{ name => 'drawable', type => 'drawable',
+	  desc => 'The drawable' }
+    );
+
+    @outargs = (
+	{ name => 'lock_content', type => 'boolean',
+	  desc => "Whether the drawable's pixels are locked" }
+    );
+
+    %invoke = (
+	code => <<'CODE'
+{
+  lock_content = gimp_item_get_lock_content (GIMP_ITEM (drawable));
+}
+CODE
+    );
+}
+
+sub drawable_set_lock_content {
+    $blurb = "Set the 'lock content' state of the specified drawable.";
+
+    $help = "This procedure sets the specified drawable's lock content state.";
+
+    &mitch_pdb_misc('2009', '2.8');
+
+    @inargs = (
+	{ name => 'drawable', type => 'drawable',
+	  desc => 'The drawable' },
+	{ name => 'lock_content', type => 'boolean',
+	  desc => "The new drawable 'lock content' state" }
+    );
+
+    %invoke = (
+	code => <<'CODE'
+{
+  gimp_item_set_lock_content (GIMP_ITEM (drawable), lock_content, TRUE);
+}
+CODE
+    );
+}
+
 sub drawable_get_tattoo {
     $blurb = "Get the tattoo of the specified drawable.";
 
@@ -1361,6 +1410,7 @@ CODE
             drawable_get_name drawable_set_name
             drawable_get_visible drawable_set_visible
             drawable_get_linked drawable_set_linked
+            drawable_get_lock_content drawable_set_lock_content
             drawable_get_tattoo drawable_set_tattoo
             drawable_mask_bounds
             drawable_mask_intersect
diff --git a/tools/pdbgen/pdb/vectors.pdb b/tools/pdbgen/pdb/vectors.pdb
index eaa1ec8..18e5fcf 100644
--- a/tools/pdbgen/pdb/vectors.pdb
+++ b/tools/pdbgen/pdb/vectors.pdb
@@ -322,6 +322,53 @@ CODE
     );
 }
 
+sub vectors_get_lock_content {
+    $blurb = "Gets the 'lock content' state of the vectors object.";
+    $help  = "Gets the 'lock content' state of the vectors object.";
+
+    &mitch_pdb_misc('2009', '2.8');
+
+    @inargs = (
+	{ name => 'vectors', type => 'vectors',
+	  desc => 'The vectors object' }
+    );
+
+    @outargs = (
+        { name => 'lock_content', type => 'boolean',
+          desc => "Whether the path's strokes are locked" }
+    );
+
+    %invoke = (
+        code => <<"CODE"
+{
+  lock_content = gimp_item_get_lock_content (GIMP_ITEM (vectors));
+}
+CODE
+    );
+}
+
+sub vectors_set_lock_content {
+    $blurb = "Sets the 'lock content' state of the vectors object.";
+    $help  = "Sets the 'lock content' state of the vectors object.";
+
+    &mitch_pdb_misc('2009', '2.8');
+
+    @inargs = (
+	{ name => 'vectors', type => 'vectors',
+	  desc => 'The vectors object' },
+	{ name => 'lock_content', type => 'boolean',
+	  desc => "Whether the path's strokes are locked" }
+    );
+
+    %invoke = (
+        code => <<"CODE"
+{
+  gimp_item_set_lock_content (GIMP_ITEM (vectors), lock_content, TRUE);
+}
+CODE
+    );
+}
+
 sub vectors_get_tattoo {
     $blurb = 'Get the tattoo of the vectors object.';
     $help  = 'Get the tattoo state of the vectors object.';
@@ -1447,6 +1494,7 @@ CODE
             vectors_get_name vectors_set_name
             vectors_get_visible vectors_set_visible
             vectors_get_linked vectors_set_linked
+            vectors_get_lock_content vectors_set_lock_content
             vectors_get_tattoo vectors_set_tattoo
             vectors_get_strokes 
             vectors_stroke_get_length



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