[gimp] plug-ins, pdb: remove the tile-glass plug-in and add a PDB compat procedure



commit 2ce79d3b1392d9a62b8754f870f0ff7c890e78bb
Author: Michael Natterer <mitch gimp org>
Date:   Fri May 16 22:11:28 2014 +0200

    plug-ins, pdb: remove the tile-glass plug-in and add a PDB compat procedure

 app/pdb/internal-procs.c            |    2 +-
 app/pdb/plug-in-compat-cmds.c       |   93 +++++++
 plug-ins/common/.gitignore          |    2 -
 plug-ins/common/Makefile.am         |   18 --
 plug-ins/common/gimprc.common       |    1 -
 plug-ins/common/plugin-defs.pl      |    1 -
 plug-ins/common/tile-glass.c        |  500 -----------------------------------
 po-plug-ins/POTFILES.in             |    1 -
 tools/pdbgen/pdb/plug_in_compat.pdb |   53 ++++
 9 files changed, 147 insertions(+), 524 deletions(-)
---
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index bdcdb30..ae47b35 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
 #include "internal-procs.h"
 
 
-/* 728 procedures registered total */
+/* 729 procedures registered total */
 
 void
 internal_procs_init (GimpPDB *pdb)
diff --git a/app/pdb/plug-in-compat-cmds.c b/app/pdb/plug-in-compat-cmds.c
index 66f1fe9..79a2dab 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -843,6 +843,51 @@ plug_in_gauss_rle2_invoker (GimpProcedure         *procedure,
 }
 
 static GimpValueArray *
+plug_in_glasstile_invoker (GimpProcedure         *procedure,
+                           Gimp                  *gimp,
+                           GimpContext           *context,
+                           GimpProgress          *progress,
+                           const GimpValueArray  *args,
+                           GError               **error)
+{
+  gboolean success = TRUE;
+  GimpDrawable *drawable;
+  gint32 tilex;
+  gint32 tiley;
+
+  drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+  tilex = g_value_get_int (gimp_value_array_index (args, 3));
+  tiley = g_value_get_int (gimp_value_array_index (args, 4));
+
+  if (success)
+    {
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+                                     GIMP_PDB_ITEM_CONTENT, error) &&
+          gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+        {
+          GeglNode *node;
+
+          node = gegl_node_new_child (NULL,
+                                      "operation",   "gegl:tile-glass",
+                                      "tile-width",  tilex,
+                                      "tile-height", tiley,
+                                      NULL);
+
+          gimp_drawable_apply_operation (drawable, progress,
+                                         C_("undo-type", "Glass Tile"),
+                                         node);
+
+          g_object_unref (node);
+        }
+      else
+        success = FALSE;
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
 plug_in_hsv_noise_invoker (GimpProcedure         *procedure,
                            Gimp                  *gimp,
                            GimpContext           *context,
@@ -3010,6 +3055,54 @@ register_plug_in_compat_procs (GimpPDB *pdb)
   g_object_unref (procedure);
 
   /*
+   * gimp-plug-in-glasstile
+   */
+  procedure = gimp_procedure_new (plug_in_glasstile_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "plug-in-glasstile");
+  gimp_procedure_set_static_strings (procedure,
+                                     "plug-in-glasstile",
+                                     "Simulate distortion caused by square glass tiles",
+                                     "Divide the image into square glassblocks in which the image is 
refracted.",
+                                     "Compatibility procedure. Please see 'gegl:tile-glass' for credits.",
+                                     "Compatibility procedure. Please see 'gegl:tile-glass' for credits.",
+                                     "2014",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_enum ("run-mode",
+                                                  "run mode",
+                                                  "The run mode",
+                                                  GIMP_TYPE_RUN_MODE,
+                                                  GIMP_RUN_INTERACTIVE,
+                                                  GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_image_id ("image",
+                                                         "image",
+                                                         "Input image (unused)",
+                                                         pdb->gimp, FALSE,
+                                                         GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_drawable_id ("drawable",
+                                                            "drawable",
+                                                            "Input drawable",
+                                                            pdb->gimp, FALSE,
+                                                            GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_int32 ("tilex",
+                                                      "tilex",
+                                                      "Tile width",
+                                                      10, 500, 10,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_int32 ("tiley",
+                                                      "tiley",
+                                                      "Tile height",
+                                                      10, 500, 10,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
    * gimp-plug-in-hsv-noise
    */
   procedure = gimp_procedure_new (plug_in_hsv_noise_invoker);
diff --git a/plug-ins/common/.gitignore b/plug-ins/common/.gitignore
index bf5f77d..1f2aad2 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -214,8 +214,6 @@
 /sphere-designer.exe
 /tile
 /tile.exe
-/tile-glass
-/tile-glass.exe
 /tile-paper
 /tile-paper.exe
 /tile-small
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index a7a10df..d9363be 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -150,7 +150,6 @@ libexec_PROGRAMS = \
        sparkle \
        sphere-designer \
        tile \
-       tile-glass \
        tile-paper \
        tile-small \
        unit-editor \
@@ -2051,23 +2050,6 @@ tile_LDADD = \
        $(INTLLIBS)             \
        $(tile_RC)
 
-tile_glass_SOURCES = \
-       tile-glass.c
-
-tile_glass_LDADD = \
-       $(libgimpui)            \
-       $(libgimpwidgets)       \
-       $(libgimpmodule)        \
-       $(libgimp)              \
-       $(libgimpmath)          \
-       $(libgimpconfig)        \
-       $(libgimpcolor)         \
-       $(libgimpbase)          \
-       $(GTK_LIBS)             \
-       $(RT_LIBS)              \
-       $(INTLLIBS)             \
-       $(tile_glass_RC)
-
 tile_paper_SOURCES = \
        tile-paper.c
 
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index f36ca16..801047d 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -104,7 +104,6 @@ softglow_RC = softglow.rc.o
 sparkle_RC = sparkle.rc.o
 sphere_designer_RC = sphere-designer.rc.o
 tile_RC = tile.rc.o
-tile_glass_RC = tile-glass.rc.o
 tile_paper_RC = tile-paper.rc.o
 tile_small_RC = tile-small.rc.o
 unit_editor_RC = unit-editor.rc.o
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index b5da6a1..c55ecda 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -105,7 +105,6 @@
     'sparkle' => { ui => 1 },
     'sphere-designer' => { ui => 1 },
     'tile' => { ui => 1 },
-    'tile-glass' => { ui => 1 },
     'tile-paper' => { ui => 1 },
     'tile-small' => { ui => 1 },
     'unit-editor' => { ui => 1 },
diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in
index ba24bba..e61f5a1 100644
--- a/po-plug-ins/POTFILES.in
+++ b/po-plug-ins/POTFILES.in
@@ -112,7 +112,6 @@ plug-ins/common/softglow.c
 plug-ins/common/sparkle.c
 plug-ins/common/sphere-designer.c
 plug-ins/common/tile.c
-plug-ins/common/tile-glass.c
 plug-ins/common/tile-paper.c
 plug-ins/common/tile-small.c
 plug-ins/common/unit-editor.c
diff --git a/tools/pdbgen/pdb/plug_in_compat.pdb b/tools/pdbgen/pdb/plug_in_compat.pdb
index e421f8e..440965f 100644
--- a/tools/pdbgen/pdb/plug_in_compat.pdb
+++ b/tools/pdbgen/pdb/plug_in_compat.pdb
@@ -839,6 +839,58 @@ CODE
     );
 }
 
+sub plug_in_glasstile {
+    $blurb = 'Simulate distortion caused by square glass tiles';
+
+    $help = <<'HELP';
+Divide the image into square glassblocks in which the image is
+refracted.
+HELP
+
+    &std_pdb_compat('gegl:tile-glass');
+    $date = '2014';
+
+    @inargs = (
+       { name => 'run_mode', type => 'enum GimpRunMode', dead => 1,
+         desc => 'The run mode' },
+       { name => 'image', type => 'image', dead => 1,
+         desc => 'Input image (unused)' },
+       { name => 'drawable', type => 'drawable',
+         desc => 'Input drawable' },
+       { name => 'tilex', type => '10 <= int32 <= 500',
+         desc => 'Tile width' },
+       { name => 'tiley', type => '10 <= int32 <= 500',
+         desc => 'Tile height' },
+    );
+
+    %invoke = (
+       code => <<'CODE'
+{
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+                                 GIMP_PDB_ITEM_CONTENT, error) &&
+      gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
+    {
+      GeglNode *node;
+
+      node = gegl_node_new_child (NULL,
+                                  "operation",   "gegl:tile-glass",
+                                  "tile-width",  tilex,
+                                  "tile-height", tiley,
+                                  NULL);
+
+      gimp_drawable_apply_operation (drawable, progress,
+                                     C_("undo-type", "Glass Tile"),
+                                     node);
+
+      g_object_unref (node);
+    }
+  else
+    success = FALSE;
+}
+CODE
+    );
+}
+
 sub plug_in_hsv_noise {
     $blurb = 'Randomize hue, saturation and value independently';
 
@@ -2472,6 +2524,7 @@ CODE
             plug_in_gauss_iir2
             plug_in_gauss_rle
             plug_in_gauss_rle2
+            plug_in_glasstile
             plug_in_hsv_noise
             plug_in_laplace
             plug_in_lens_distortion


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