[gimp] pdb: add gimp-image-{freeze,thaw}-{layers,channels,vectors}



commit 40e3406b919153a500c89f0759eebc337d759a59
Author: Ell <ell_se yahoo com>
Date:   Mon May 7 02:21:49 2018 -0400

    pdb: add gimp-image-{freeze,thaw}-{layers,channels,vectors}
    
    These procedures freeze/thaw the corresponding containers of the
    image, allowing plug-ins that perform many changes affecting any of
    these containers to suppress updates to the corresponding dialogs,
    significantly improving performance.

 app/pdb/image-cmds.c     |  303 ++++++++++++++++++++++++++++++++++++++++++++++
 app/pdb/internal-procs.c |    2 +-
 libgimp/gimp.def         |    6 +
 libgimp/gimpimage_pdb.c  |  206 +++++++++++++++++++++++++++++++
 libgimp/gimpimage_pdb.h  |    6 +
 pdb/groups/image.pdb     |  205 +++++++++++++++++++++++++++++++-
 6 files changed, 725 insertions(+), 3 deletions(-)
---
diff --git a/app/pdb/image-cmds.c b/app/pdb/image-cmds.c
index 08da2a4..41c9626 100644
--- a/app/pdb/image-cmds.c
+++ b/app/pdb/image-cmds.c
@@ -896,6 +896,57 @@ image_remove_layer_invoker (GimpProcedure         *procedure,
 }
 
 static GimpValueArray *
+image_freeze_layers_invoker (GimpProcedure         *procedure,
+                             Gimp                  *gimp,
+                             GimpContext           *context,
+                             GimpProgress          *progress,
+                             const GimpValueArray  *args,
+                             GError               **error)
+{
+  gboolean success = TRUE;
+  GimpImage *image;
+
+  image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+  if (success)
+    {
+      GimpContainer *container = gimp_image_get_layers (image);
+
+      gimp_container_freeze (container);
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_thaw_layers_invoker (GimpProcedure         *procedure,
+                           Gimp                  *gimp,
+                           GimpContext           *context,
+                           GimpProgress          *progress,
+                           const GimpValueArray  *args,
+                           GError               **error)
+{
+  gboolean success = TRUE;
+  GimpImage *image;
+
+  image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+  if (success)
+    {
+      GimpContainer *container = gimp_image_get_layers (image);
+
+      if (gimp_container_frozen (container))
+        gimp_container_thaw (container);
+      else
+        success = FALSE;
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
 image_add_channel_invoker (GimpProcedure         *procedure,
                            Gimp                  *gimp,
                            GimpContext           *context,
@@ -999,6 +1050,57 @@ image_remove_channel_invoker (GimpProcedure         *procedure,
 }
 
 static GimpValueArray *
+image_freeze_channels_invoker (GimpProcedure         *procedure,
+                               Gimp                  *gimp,
+                               GimpContext           *context,
+                               GimpProgress          *progress,
+                               const GimpValueArray  *args,
+                               GError               **error)
+{
+  gboolean success = TRUE;
+  GimpImage *image;
+
+  image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+  if (success)
+    {
+      GimpContainer *container = gimp_image_get_channels (image);
+
+      gimp_container_freeze (container);
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_thaw_channels_invoker (GimpProcedure         *procedure,
+                             Gimp                  *gimp,
+                             GimpContext           *context,
+                             GimpProgress          *progress,
+                             const GimpValueArray  *args,
+                             GError               **error)
+{
+  gboolean success = TRUE;
+  GimpImage *image;
+
+  image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+  if (success)
+    {
+      GimpContainer *container = gimp_image_get_channels (image);
+
+      if (gimp_container_frozen (container))
+        gimp_container_thaw (container);
+      else
+        success = FALSE;
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
 image_add_vectors_invoker (GimpProcedure         *procedure,
                            Gimp                  *gimp,
                            GimpContext           *context,
@@ -1102,6 +1204,57 @@ image_remove_vectors_invoker (GimpProcedure         *procedure,
 }
 
 static GimpValueArray *
+image_freeze_vectors_invoker (GimpProcedure         *procedure,
+                              Gimp                  *gimp,
+                              GimpContext           *context,
+                              GimpProgress          *progress,
+                              const GimpValueArray  *args,
+                              GError               **error)
+{
+  gboolean success = TRUE;
+  GimpImage *image;
+
+  image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+  if (success)
+    {
+      GimpContainer *container = gimp_image_get_vectors (image);
+
+      gimp_container_freeze (container);
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
+image_thaw_vectors_invoker (GimpProcedure         *procedure,
+                            Gimp                  *gimp,
+                            GimpContext           *context,
+                            GimpProgress          *progress,
+                            const GimpValueArray  *args,
+                            GError               **error)
+{
+  gboolean success = TRUE;
+  GimpImage *image;
+
+  image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+  if (success)
+    {
+      GimpContainer *container = gimp_image_get_vectors (image);
+
+      if (gimp_container_frozen (container))
+        gimp_container_thaw (container);
+      else
+        success = FALSE;
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
 image_get_item_position_invoker (GimpProcedure         *procedure,
                                  Gimp                  *gimp,
                                  GimpContext           *context,
@@ -3563,6 +3716,56 @@ register_image_procs (GimpPDB *pdb)
   g_object_unref (procedure);
 
   /*
+   * gimp-image-freeze-layers
+   */
+  procedure = gimp_procedure_new (image_freeze_layers_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-image-freeze-layers");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-image-freeze-layers",
+                                     "Freeze the image's layer list.",
+                                     "This procedure freezes the layer list of the image, supressing any 
updates to the Layers dialog in response to changes to the image's layers. This can significantly improve 
performance while applying changes affecting the layer list.\n"
+                                     "\n"
+                                     "Each call to 'gimp-image-freeze-layers' should be matched by a 
corresponding call to 'gimp-image-thaw-layers', undoing its effects.",
+                                     "Ell",
+                                     "Ell",
+                                     "2018",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_image_id ("image",
+                                                         "image",
+                                                         "The image",
+                                                         pdb->gimp, FALSE,
+                                                         GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-image-thaw-layers
+   */
+  procedure = gimp_procedure_new (image_thaw_layers_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-image-thaw-layers");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-image-thaw-layers",
+                                     "Thaw the image's layer list.",
+                                     "This procedure thaws the layer list of the image, re-enabling updates 
to the Layers dialog.\n"
+                                     "\n"
+                                     "This procedure should match a corresponding call to 
'gimp-image-freeze-layers'.",
+                                     "Ell",
+                                     "Ell",
+                                     "2018",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_image_id ("image",
+                                                         "image",
+                                                         "The image",
+                                                         pdb->gimp, FALSE,
+                                                         GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
    * gimp-image-add-channel
    */
   procedure = gimp_procedure_new (image_add_channel_invoker);
@@ -3668,6 +3871,56 @@ register_image_procs (GimpPDB *pdb)
   g_object_unref (procedure);
 
   /*
+   * gimp-image-freeze-channels
+   */
+  procedure = gimp_procedure_new (image_freeze_channels_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-image-freeze-channels");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-image-freeze-channels",
+                                     "Freeze the image's channel list.",
+                                     "This procedure freezes the channel list of the image, supressing any 
updates to the Channels dialog in response to changes to the image's channels. This can significantly improve 
performance while applying changes affecting the channel list.\n"
+                                     "\n"
+                                     "Each call to 'gimp-image-freeze-channels' should be matched by a 
corresponding call to 'gimp-image-thaw-channels', undoing its effects.",
+                                     "Ell",
+                                     "Ell",
+                                     "2018",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_image_id ("image",
+                                                         "image",
+                                                         "The image",
+                                                         pdb->gimp, FALSE,
+                                                         GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-image-thaw-channels
+   */
+  procedure = gimp_procedure_new (image_thaw_channels_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-image-thaw-channels");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-image-thaw-channels",
+                                     "Thaw the image's channel list.",
+                                     "This procedure thaws the channel list of the image, re-enabling 
updates to the Channels dialog.\n"
+                                     "\n"
+                                     "This procedure should match a corresponing call to 
'gimp-image-freeze-channels'.",
+                                     "Ell",
+                                     "Ell",
+                                     "2018",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_image_id ("image",
+                                                         "image",
+                                                         "The image",
+                                                         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);
@@ -3773,6 +4026,56 @@ register_image_procs (GimpPDB *pdb)
   g_object_unref (procedure);
 
   /*
+   * gimp-image-freeze-vectors
+   */
+  procedure = gimp_procedure_new (image_freeze_vectors_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-image-freeze-vectors");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-image-freeze-vectors",
+                                     "Freeze the image's vectors list.",
+                                     "This procedure freezes the vectors list of the image, supressing any 
updates to the Paths dialog in response to changes to the image's vectors. This can significantly improve 
performance while applying changes affecting the vectors list.\n"
+                                     "\n"
+                                     "Each call to 'gimp-image-freeze-vectors' should be matched by a 
corresponding call to 'gimp-image-thaw-vectors', undoing its effects.",
+                                     "Ell",
+                                     "Ell",
+                                     "2018",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_image_id ("image",
+                                                         "image",
+                                                         "The image",
+                                                         pdb->gimp, FALSE,
+                                                         GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-image-thaw-vectors
+   */
+  procedure = gimp_procedure_new (image_thaw_vectors_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-image-thaw-vectors");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-image-thaw-vectors",
+                                     "Thaw the image's vectors list.",
+                                     "This procedure thaws the vectors list of the image, re-enabling 
updates to the Paths dialog.\n"
+                                     "\n"
+                                     "This procedure should match a corresponding call to 
'gimp-image-freeze-vectors'.",
+                                     "Ell",
+                                     "Ell",
+                                     "2018",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_image_id ("image",
+                                                         "image",
+                                                         "The image",
+                                                         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);
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 03f19a1..d38470a 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
 #include "internal-procs.h"
 
 
-/* 834 procedures registered total */
+/* 840 procedures registered total */
 
 void
 internal_procs_init (GimpPDB *pdb)
diff --git a/libgimp/gimp.def b/libgimp/gimp.def
index 5605a35..ac71cb0 100644
--- a/libgimp/gimp.def
+++ b/libgimp/gimp.def
@@ -445,6 +445,9 @@ EXPORTS
        gimp_image_flip
        gimp_image_floating_sel_attached_to
        gimp_image_free_shadow
+       gimp_image_freeze_channels
+       gimp_image_freeze_layers
+       gimp_image_freeze_vectors
        gimp_image_get_active_channel
        gimp_image_get_active_drawable
        gimp_image_get_active_layer
@@ -560,6 +563,9 @@ EXPORTS
        gimp_image_set_resolution
        gimp_image_set_tattoo_state
        gimp_image_set_unit
+       gimp_image_thaw_channels
+       gimp_image_thaw_layers
+       gimp_image_thaw_vectors
        gimp_image_undo_disable
        gimp_image_undo_enable
        gimp_image_undo_freeze
diff --git a/libgimp/gimpimage_pdb.c b/libgimp/gimpimage_pdb.c
index 4d6022b..f23f03d 100644
--- a/libgimp/gimpimage_pdb.c
+++ b/libgimp/gimpimage_pdb.c
@@ -928,6 +928,74 @@ gimp_image_remove_layer (gint32 image_ID,
 }
 
 /**
+ * gimp_image_freeze_layers:
+ * @image_ID: The image.
+ *
+ * Freeze the image's layer list.
+ *
+ * This procedure freezes the layer list of the image, supressing any
+ * updates to the Layers dialog in response to changes to the image's
+ * layers. This can significantly improve performance while applying
+ * changes affecting the layer list.
+ *
+ * Each call to gimp_image_freeze_layers() should be matched by a
+ * corresponding call to gimp_image_thaw_layers(), undoing its effects.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_freeze_layers (gint32 image_ID)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean success = TRUE;
+
+  return_vals = gimp_run_procedure ("gimp-image-freeze-layers",
+                                    &nreturn_vals,
+                                    GIMP_PDB_IMAGE, image_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_thaw_layers:
+ * @image_ID: The image.
+ *
+ * Thaw the image's layer list.
+ *
+ * This procedure thaws the layer list of the image, re-enabling
+ * updates to the Layers dialog.
+ *
+ * This procedure should match a corresponding call to
+ * gimp_image_freeze_layers().
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_thaw_layers (gint32 image_ID)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean success = TRUE;
+
+  return_vals = gimp_run_procedure ("gimp-image-thaw-layers",
+                                    &nreturn_vals,
+                                    GIMP_PDB_IMAGE, image_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_add_channel:
  * @image_ID: The image.
  * @channel_ID: The channel.
@@ -1037,6 +1105,75 @@ gimp_image_remove_channel (gint32 image_ID,
 }
 
 /**
+ * gimp_image_freeze_channels:
+ * @image_ID: The image.
+ *
+ * Freeze the image's channel list.
+ *
+ * This procedure freezes the channel list of the image, supressing any
+ * updates to the Channels dialog in response to changes to the image's
+ * channels. This can significantly improve performance while applying
+ * changes affecting the channel list.
+ *
+ * Each call to gimp_image_freeze_channels() should be matched by a
+ * corresponding call to gimp_image_thaw_channels(), undoing its
+ * effects.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_freeze_channels (gint32 image_ID)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean success = TRUE;
+
+  return_vals = gimp_run_procedure ("gimp-image-freeze-channels",
+                                    &nreturn_vals,
+                                    GIMP_PDB_IMAGE, image_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_thaw_channels:
+ * @image_ID: The image.
+ *
+ * Thaw the image's channel list.
+ *
+ * This procedure thaws the channel list of the image, re-enabling
+ * updates to the Channels dialog.
+ *
+ * This procedure should match a corresponing call to
+ * gimp_image_freeze_channels().
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_thaw_channels (gint32 image_ID)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean success = TRUE;
+
+  return_vals = gimp_run_procedure ("gimp-image-thaw-channels",
+                                    &nreturn_vals,
+                                    GIMP_PDB_IMAGE, image_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_add_vectors:
  * @image_ID: The image.
  * @vectors_ID: The vectors object.
@@ -1148,6 +1285,75 @@ gimp_image_remove_vectors (gint32 image_ID,
 }
 
 /**
+ * gimp_image_freeze_vectors:
+ * @image_ID: The image.
+ *
+ * Freeze the image's vectors list.
+ *
+ * This procedure freezes the vectors list of the image, supressing any
+ * updates to the Paths dialog in response to changes to the image's
+ * vectors. This can significantly improve performance while applying
+ * changes affecting the vectors list.
+ *
+ * Each call to gimp_image_freeze_vectors() should be matched by a
+ * corresponding call to gimp_image_thaw_vectors(), undoing its
+ * effects.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_freeze_vectors (gint32 image_ID)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean success = TRUE;
+
+  return_vals = gimp_run_procedure ("gimp-image-freeze-vectors",
+                                    &nreturn_vals,
+                                    GIMP_PDB_IMAGE, image_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_thaw_vectors:
+ * @image_ID: The image.
+ *
+ * Thaw the image's vectors list.
+ *
+ * This procedure thaws the vectors list of the image, re-enabling
+ * updates to the Paths dialog.
+ *
+ * This procedure should match a corresponding call to
+ * gimp_image_freeze_vectors().
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_thaw_vectors (gint32 image_ID)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean success = TRUE;
+
+  return_vals = gimp_run_procedure ("gimp-image-thaw-vectors",
+                                    &nreturn_vals,
+                                    GIMP_PDB_IMAGE, image_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_item_position:
  * @image_ID: The image.
  * @item_ID: The item.
diff --git a/libgimp/gimpimage_pdb.h b/libgimp/gimpimage_pdb.h
index f77d60c..3a6171e 100644
--- a/libgimp/gimpimage_pdb.h
+++ b/libgimp/gimpimage_pdb.h
@@ -81,6 +81,8 @@ gboolean                 gimp_image_insert_layer               (gint32
                                                                 gint                 position);
 gboolean                 gimp_image_remove_layer               (gint32               image_ID,
                                                                 gint32               layer_ID);
+gboolean                 gimp_image_freeze_layers              (gint32               image_ID);
+gboolean                 gimp_image_thaw_layers                (gint32               image_ID);
 GIMP_DEPRECATED_FOR(gimp_image_insert_channel)
 gboolean                 gimp_image_add_channel                (gint32               image_ID,
                                                                 gint32               channel_ID,
@@ -91,6 +93,8 @@ gboolean                 gimp_image_insert_channel             (gint32
                                                                 gint                 position);
 gboolean                 gimp_image_remove_channel             (gint32               image_ID,
                                                                 gint32               channel_ID);
+gboolean                 gimp_image_freeze_channels            (gint32               image_ID);
+gboolean                 gimp_image_thaw_channels              (gint32               image_ID);
 GIMP_DEPRECATED_FOR(gimp_image_insert_vectors)
 gboolean                 gimp_image_add_vectors                (gint32               image_ID,
                                                                 gint32               vectors_ID,
@@ -101,6 +105,8 @@ gboolean                 gimp_image_insert_vectors             (gint32
                                                                 gint                 position);
 gboolean                 gimp_image_remove_vectors             (gint32               image_ID,
                                                                 gint32               vectors_ID);
+gboolean                 gimp_image_freeze_vectors             (gint32               image_ID);
+gboolean                 gimp_image_thaw_vectors               (gint32               image_ID);
 gint                     gimp_image_get_item_position          (gint32               image_ID,
                                                                 gint32               item_ID);
 gboolean                 gimp_image_raise_item                 (gint32               image_ID,
diff --git a/pdb/groups/image.pdb b/pdb/groups/image.pdb
index 43afb02..a193c81 100644
--- a/pdb/groups/image.pdb
+++ b/pdb/groups/image.pdb
@@ -1019,6 +1019,72 @@ CODE
     );
 }
 
+sub image_freeze_layers {
+    $blurb = "Freeze the image's layer list.";
+
+    $help = <<'HELP';
+This procedure freezes the layer list of the image, supressing any
+updates to the Layers dialog in response to changes to the image's
+layers.  This can significantly improve performance while applying
+changes affecting the layer list.
+
+
+Each call to gimp_image_freeze_layers() should be matched by a
+corresponding call to gimp_image_thaw_layers(), undoing its
+effects.
+HELP
+
+    &ell_pdb_misc('2018');
+
+    @inargs = (
+    { name => 'image', type => 'image',
+      desc => 'The image' }
+    );
+
+    %invoke = (
+    code => <<'CODE'
+{
+  GimpContainer *container = gimp_image_get_layers (image);
+
+  gimp_container_freeze (container);
+}
+CODE
+    );
+}
+
+sub image_thaw_layers {
+    $blurb = "Thaw the image's layer list.";
+
+    $help = <<'HELP';
+This procedure thaws the layer list of the image, re-enabling
+updates to the Layers dialog.
+
+
+This procedure should match a corresponding call to
+gimp_image_freeze_layers().
+HELP
+
+    &ell_pdb_misc('2018');
+
+    @inargs = (
+    { name => 'image', type => 'image',
+      desc => 'The image' }
+    );
+
+    %invoke = (
+    code => <<'CODE'
+{
+  GimpContainer *container = gimp_image_get_layers (image);
+
+  if (gimp_container_frozen (container))
+    gimp_container_thaw (container);
+  else
+    success = FALSE;
+}
+CODE
+    );
+}
+
 sub image_add_channel {
     &std_pdb_deprecated ('gimp-image-insert-channel');
 
@@ -1123,6 +1189,72 @@ CODE
     );
 }
 
+sub image_freeze_channels {
+    $blurb = "Freeze the image's channel list.";
+
+    &ell_pdb_misc('2018');
+
+    $help = <<'HELP';
+This procedure freezes the channel list of the image, supressing any
+updates to the Channels dialog in response to changes to the image's
+channels.  This can significantly improve performance while applying
+changes affecting the channel list.
+
+
+Each call to gimp_image_freeze_channels() should be matched by a
+corresponding call to gimp_image_thaw_channels(), undoing its
+effects.
+HELP
+
+    @inargs = (
+    { name => 'image', type => 'image',
+      desc => 'The image' }
+    );
+
+    %invoke = (
+    code => <<'CODE'
+{
+  GimpContainer *container = gimp_image_get_channels (image);
+
+  gimp_container_freeze (container);
+}
+CODE
+    );
+}
+
+sub image_thaw_channels {
+    $blurb = "Thaw the image's channel list.";
+
+    &ell_pdb_misc('2018');
+
+    $help = <<'HELP';
+This procedure thaws the channel list of the image, re-enabling
+updates to the Channels dialog.
+
+
+This procedure should match a corresponing call to
+gimp_image_freeze_channels().
+HELP
+
+    @inargs = (
+    { name => 'image', type => 'image',
+      desc => 'The image' }
+    );
+
+    %invoke = (
+    code => <<'CODE'
+{
+  GimpContainer *container = gimp_image_get_channels (image);
+
+  if (gimp_container_frozen (container))
+    gimp_container_thaw (container);
+  else
+    success = FALSE;
+}
+CODE
+    );
+}
+
 sub image_add_vectors {
     &std_pdb_deprecated ('gimp-image-insert-vectors');
 
@@ -1225,6 +1357,72 @@ CODE
     );
 }
 
+sub image_freeze_vectors {
+    $blurb = "Freeze the image's vectors list.";
+
+    &ell_pdb_misc('2018');
+
+    $help = <<'HELP';
+This procedure freezes the vectors list of the image, supressing any
+updates to the Paths dialog in response to changes to the image's
+vectors.  This can significantly improve performance while applying
+changes affecting the vectors list.
+
+
+Each call to gimp_image_freeze_vectors() should be matched by a
+corresponding call to gimp_image_thaw_vectors(), undoing its
+effects.
+HELP
+
+    @inargs = (
+    { name => 'image', type => 'image',
+      desc => 'The image' }
+    );
+
+    %invoke = (
+    code => <<'CODE'
+{
+  GimpContainer *container = gimp_image_get_vectors (image);
+
+  gimp_container_freeze (container);
+}
+CODE
+    );
+}
+
+sub image_thaw_vectors {
+    $blurb = "Thaw the image's vectors list.";
+
+    &ell_pdb_misc('2018');
+
+    $help = <<'HELP';
+This procedure thaws the vectors list of the image, re-enabling
+updates to the Paths dialog.
+
+
+This procedure should match a corresponding call to
+gimp_image_freeze_vectors().
+HELP
+
+    @inargs = (
+    { name => 'image', type => 'image',
+      desc => 'The image' }
+    );
+
+    %invoke = (
+    code => <<'CODE'
+{
+  GimpContainer *container = gimp_image_get_vectors (image);
+
+  if (gimp_container_frozen (container))
+    gimp_container_thaw (container);
+  else
+    success = FALSE;
+}
+CODE
+    );
+}
+
 sub image_get_active_drawable {
     $blurb = "Get the image's active drawable";
 
@@ -2878,8 +3076,11 @@ CODE
             image_pick_color
             image_pick_correlate_layer
             image_add_layer image_insert_layer image_remove_layer
+            image_freeze_layers image_thaw_layers
             image_add_channel image_insert_channel image_remove_channel
+            image_freeze_channels image_thaw_channels
             image_add_vectors image_insert_vectors image_remove_vectors
+            image_freeze_vectors image_thaw_vectors
             image_get_item_position
             image_raise_item image_lower_item
             image_raise_item_to_top image_lower_item_to_bottom
@@ -2915,11 +3116,11 @@ CODE
             image_get_parasite
             image_get_parasite_list);
 
-# For the lib parameter EXCLUDE functions #43 and #44, which are
+# For the lib parameter EXCLUDE functions #45 and #46, which are
 # image_add_layer_mask and image_remove_layer_mask.
 # If adding or removing functions, make sure the range below is
 # updated correctly!
-%exports = (app => [@procs], lib => [@procs[0..38,41..81]]);
+%exports = (app => [@procs], lib => [@procs[0..44,47..87]]);
 
 $desc = 'Image';
 $doc_title = 'gimpimage';


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