[gimp] Remove GIMP_TYPE_INT16 and GimpParamSpecInt16



commit 350abba213cebfe5a8935704ce7b92a785202591
Author: Michael Natterer <mitch gimp org>
Date:   Thu Aug 15 14:17:17 2019 +0200

    Remove GIMP_TYPE_INT16 and GimpParamSpecInt16
    
    Use gint and GParamSpecInt with the right value range instead.

 app/pdb/gimp-pdb-compat.c                        |   1 -
 app/pdb/plug-in-compat-cmds.c                    |  44 ++++-----
 app/plug-in/gimpgpparams.c                       |   7 --
 devel-docs/libgimpbase/libgimpbase3-sections.txt |   9 --
 devel-docs/libgimpbase/libgimpbase3.types        |   2 -
 libgimp/gimp.c                                   |   1 -
 libgimp/gimpgpcompat.c                           |   9 +-
 libgimp/gimpgpparams-body.c                      |   9 +-
 libgimp/gimpgpparams.c                           |   7 --
 libgimpbase/gimpbase.def                         |   3 -
 libgimpbase/gimpparamspecs.c                     | 109 -----------------------
 libgimpbase/gimpparamspecs.h                     |  37 --------
 pdb/app.pl                                       |  10 +--
 pdb/pdb.pl                                       |   2 +-
 14 files changed, 35 insertions(+), 215 deletions(-)
---
diff --git a/app/pdb/gimp-pdb-compat.c b/app/pdb/gimp-pdb-compat.c
index 0902686dcc..b1f454f63a 100644
--- a/app/pdb/gimp-pdb-compat.c
+++ b/app/pdb/gimp-pdb-compat.c
@@ -55,7 +55,6 @@ gimp_pdb_compat_arg_type_from_gtype (GType type)
         { G_TYPE_ENUM,               GIMP_PDB_INT32       },
         { G_TYPE_BOOLEAN,            GIMP_PDB_INT32       },
 
-        { GIMP_TYPE_INT16,           GIMP_PDB_INT16       },
         { G_TYPE_UCHAR,              GIMP_PDB_INT8        },
         { G_TYPE_DOUBLE,             GIMP_PDB_FLOAT       },
 
diff --git a/app/pdb/plug-in-compat-cmds.c b/app/pdb/plug-in-compat-cmds.c
index 5c4bf643d5..2b72d65c42 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -7023,17 +7023,17 @@ register_plug_in_compat_procs (GimpPDB *pdb)
                                                             pdb->gimp, FALSE,
                                                             GIMP_PARAM_READWRITE));
   gimp_procedure_add_argument (procedure,
-                               gimp_param_spec_int16 ("width",
-                                                      "width",
-                                                      "Width of the passages",
-                                                      1, 1024, 1,
-                                                      GIMP_PARAM_READWRITE));
-  gimp_procedure_add_argument (procedure,
-                               gimp_param_spec_int16 ("height",
-                                                      "height",
-                                                      "Height of the passages",
-                                                      1, 1024, 1,
-                                                      GIMP_PARAM_READWRITE));
+                               g_param_spec_int ("width",
+                                                 "width",
+                                                 "Width of the passages",
+                                                 1, 1024, 1,
+                                                 GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_int ("height",
+                                                 "height",
+                                                 "Height of the passages",
+                                                 1, 1024, 1,
+                                                 GIMP_PARAM_READWRITE));
   gimp_procedure_add_argument (procedure,
                                g_param_spec_uchar ("tileable",
                                                    "tileable",
@@ -7053,17 +7053,17 @@ register_plug_in_compat_procs (GimpPDB *pdb)
                                                  G_MININT32, G_MAXINT32, 0,
                                                  GIMP_PARAM_READWRITE));
   gimp_procedure_add_argument (procedure,
-                               gimp_param_spec_int16 ("multiple",
-                                                      "multiple",
-                                                      "Multiple (use 57)",
-                                                      G_MININT16, G_MAXINT16, 0,
-                                                      GIMP_PARAM_READWRITE));
-  gimp_procedure_add_argument (procedure,
-                               gimp_param_spec_int16 ("offset",
-                                                      "offset",
-                                                      "Offset (use 1)",
-                                                      G_MININT16, G_MAXINT16, 0,
-                                                      GIMP_PARAM_READWRITE));
+                               g_param_spec_int ("multiple",
+                                                 "multiple",
+                                                 "Multiple (use 57)",
+                                                 G_MININT16, G_MAXINT16, 0,
+                                                 GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_int ("offset",
+                                                 "offset",
+                                                 "Offset (use 1)",
+                                                 G_MININT16, G_MAXINT16, 0,
+                                                 GIMP_PARAM_READWRITE));
   gimp_pdb_register_procedure (pdb, procedure);
   g_object_unref (procedure);
 
diff --git a/app/plug-in/gimpgpparams.c b/app/plug-in/gimpgpparams.c
index 7049aa1439..deda7238b7 100644
--- a/app/plug-in/gimpgpparams.c
+++ b/app/plug-in/gimpgpparams.c
@@ -90,13 +90,6 @@ _gimp_gp_param_def_to_param_spec (gpointer          gimp,
                                  param_def->meta.m_int.default_val,
                                  flags);
 
-      if (! strcmp (param_def->type_name, "GimpParamInt16"))
-        return gimp_param_spec_int16 (name, nick, blurb,
-                                      param_def->meta.m_int.min_val,
-                                      param_def->meta.m_int.max_val,
-                                      param_def->meta.m_int.default_val,
-                                      flags);
-
       if (! strcmp (param_def->type_name, "GParamUInt"))
         return g_param_spec_uint (name, nick, blurb,
                                   param_def->meta.m_int.min_val,
diff --git a/devel-docs/libgimpbase/libgimpbase3-sections.txt 
b/devel-docs/libgimpbase/libgimpbase3-sections.txt
index dc59dde9e6..6168cc6f40 100644
--- a/devel-docs/libgimpbase/libgimpbase3-sections.txt
+++ b/devel-docs/libgimpbase/libgimpbase3-sections.txt
@@ -296,7 +296,6 @@ GIMP_PARAM_STATIC_STRINGS
 GIMP_PARAM_READABLE
 GIMP_PARAM_WRITABLE
 GIMP_PARAM_READWRITE
-gimp_param_spec_int16
 gimp_param_spec_string
 gimp_array_new
 gimp_array_copy
@@ -344,7 +343,6 @@ gimp_value_take_rgb_array
 <SUBSECTION Standard>
 GIMP_IS_PARAM_SPEC_ARRAY
 GIMP_IS_PARAM_SPEC_FLOAT_ARRAY
-GIMP_IS_PARAM_SPEC_INT16
 GIMP_IS_PARAM_SPEC_INT16_ARRAY
 GIMP_IS_PARAM_SPEC_INT32_ARRAY
 GIMP_IS_PARAM_SPEC_INT8_ARRAY
@@ -353,7 +351,6 @@ GIMP_IS_PARAM_SPEC_STRING
 GIMP_IS_PARAM_SPEC_STRING_ARRAY
 GIMP_PARAM_SPEC_ARRAY
 GIMP_PARAM_SPEC_FLOAT_ARRAY
-GIMP_PARAM_SPEC_INT16
 GIMP_PARAM_SPEC_INT16_ARRAY
 GIMP_PARAM_SPEC_INT32_ARRAY
 GIMP_PARAM_SPEC_INT8_ARRAY
@@ -362,13 +359,11 @@ GIMP_PARAM_SPEC_STRING
 GIMP_PARAM_SPEC_STRING_ARRAY
 GIMP_TYPE_ARRAY
 GIMP_TYPE_FLOAT_ARRAY
-GIMP_TYPE_INT16
 GIMP_TYPE_INT16_ARRAY
 GIMP_TYPE_INT32_ARRAY
 GIMP_TYPE_INT8_ARRAY
 GIMP_TYPE_PARAM_ARRAY
 GIMP_TYPE_PARAM_FLOAT_ARRAY
-GIMP_TYPE_PARAM_INT16
 GIMP_TYPE_PARAM_INT16_ARRAY
 GIMP_TYPE_PARAM_INT32_ARRAY
 GIMP_TYPE_PARAM_INT8_ARRAY
@@ -379,7 +374,6 @@ GIMP_TYPE_RGB_ARRAY
 GIMP_TYPE_STRING_ARRAY
 GIMP_VALUE_HOLDS_ARRAY
 GIMP_VALUE_HOLDS_FLOAT_ARRAY
-GIMP_VALUE_HOLDS_INT16
 GIMP_VALUE_HOLDS_INT16_ARRAY
 GIMP_VALUE_HOLDS_INT32_ARRAY
 GIMP_VALUE_HOLDS_INT8_ARRAY
@@ -389,7 +383,6 @@ GimpArray
 GimpStringArray
 GimpParamSpecArray
 GimpParamSpecFloatArray
-GimpParamSpecInt16
 GimpParamSpecInt16Array
 GimpParamSpecInt32Array
 GimpParamSpecInt8Array
@@ -399,13 +392,11 @@ GimpParamSpecStringArray
 gimp_array_get_type
 gimp_float_array_get_type
 gimp_int16_array_get_type
-gimp_int16_get_type
 gimp_int32_array_get_type
 gimp_int8_array_get_type
 gimp_param_array_get_type
 gimp_param_float_array_get_type
 gimp_param_int16_array_get_type
-gimp_param_int16_get_type
 gimp_param_int32_array_get_type
 gimp_param_int8_array_get_type
 gimp_param_rgb_array_get_type
diff --git a/devel-docs/libgimpbase/libgimpbase3.types b/devel-docs/libgimpbase/libgimpbase3.types
index 9626887dca..b9a6fe365b 100644
--- a/devel-docs/libgimpbase/libgimpbase3.types
+++ b/devel-docs/libgimpbase/libgimpbase3.types
@@ -1,7 +1,6 @@
 gimp_array_get_type
 gimp_float_array_get_type
 gimp_int16_array_get_type
-gimp_int16_get_type
 gimp_int32_array_get_type
 gimp_int8_array_get_type
 gimp_memsize_get_type
@@ -9,7 +8,6 @@ gimp_metadata_get_type
 gimp_param_array_get_type
 gimp_param_float_array_get_type
 gimp_param_int16_array_get_type
-gimp_param_int16_get_type
 gimp_param_int32_array_get_type
 gimp_param_int8_array_get_type
 gimp_param_rgb_array_get_type
diff --git a/libgimp/gimp.c b/libgimp/gimp.c
index 16b16666aa..fa9eca2d79 100644
--- a/libgimp/gimp.c
+++ b/libgimp/gimp.c
@@ -447,7 +447,6 @@ _gimp_main_internal (GType                 plug_in_type,
     GType init_types[] =
     {
       G_TYPE_INT,              G_TYPE_PARAM_INT,
-      GIMP_TYPE_INT16,         GIMP_TYPE_PARAM_INT16,
       G_TYPE_UCHAR,            G_TYPE_PARAM_UCHAR,
 
       G_TYPE_STRING,           GIMP_TYPE_PARAM_STRING,
diff --git a/libgimp/gimpgpcompat.c b/libgimp/gimpgpcompat.c
index 098eca0d0a..e9196fa35d 100644
--- a/libgimp/gimpgpcompat.c
+++ b/libgimp/gimpgpcompat.c
@@ -52,9 +52,9 @@ _gimp_gp_compat_param_spec (GimpPDBArgType  arg_type,
       break;
 
     case GIMP_PDB_INT16:
-      pspec = gimp_param_spec_int16 (name, nick, blurb,
-                                     G_MININT16, G_MAXINT16, 0,
-                                     G_PARAM_READWRITE);
+      pspec = g_param_spec_int (name, nick, blurb,
+                                G_MININT16, G_MAXINT16, 0,
+                                G_PARAM_READWRITE);
       break;
 
     case GIMP_PDB_INT8:
@@ -192,7 +192,7 @@ _gimp_pdb_arg_type_to_gtype (GimpPDBArgType  type)
       return G_TYPE_INT;
 
     case GIMP_PDB_INT16:
-      return GIMP_TYPE_INT16;
+      return G_TYPE_INT;
 
     case GIMP_PDB_INT8:
       return G_TYPE_UCHAR;
@@ -284,7 +284,6 @@ _gimp_pdb_gtype_to_arg_type (GType type)
         { G_TYPE_ENUM,               GIMP_PDB_INT32       },
         { G_TYPE_BOOLEAN,            GIMP_PDB_INT32       },
 
-        { GIMP_TYPE_INT16,           GIMP_PDB_INT16       },
         { G_TYPE_UCHAR,              GIMP_PDB_INT8        },
         { G_TYPE_DOUBLE,             GIMP_PDB_FLOAT       },
 
diff --git a/libgimp/gimpgpparams-body.c b/libgimp/gimpgpparams-body.c
index 74ef4af94c..82796bf747 100644
--- a/libgimp/gimpgpparams-body.c
+++ b/libgimp/gimpgpparams-body.c
@@ -39,8 +39,7 @@ _gimp_param_spec_to_gp_param_def (GParamSpec *pspec,
 
   pspec_type = G_PARAM_SPEC_TYPE (pspec);
 
-  if (pspec_type == G_TYPE_PARAM_INT ||
-      pspec_type == GIMP_TYPE_PARAM_INT16)
+  if (pspec_type == G_TYPE_PARAM_INT)
     {
       GParamSpecInt *ispec = G_PARAM_SPEC_INT (pspec);
 
@@ -190,8 +189,7 @@ _gimp_gp_param_to_value (gpointer        gimp,
 
   g_value_init (value, type);
 
-  if (type == G_TYPE_INT      ||
-      type == GIMP_TYPE_INT16 ||
+  if (type == G_TYPE_INT ||
       type == GIMP_TYPE_UNIT)
     {
       g_value_set_int (value, param->data.d_int);
@@ -434,8 +432,7 @@ _gimp_value_to_gp_param (const GValue *value,
   else
     param->type_name = (gchar *) g_type_name (type);
 
-  if (type == G_TYPE_INT      ||
-      type == GIMP_TYPE_INT16 ||
+  if (type == G_TYPE_INT ||
       type == GIMP_TYPE_UNIT)
     {
       param->param_type = GP_PARAM_TYPE_INT;
diff --git a/libgimp/gimpgpparams.c b/libgimp/gimpgpparams.c
index 45001aa00c..0fc60091f7 100644
--- a/libgimp/gimpgpparams.c
+++ b/libgimp/gimpgpparams.c
@@ -81,13 +81,6 @@ _gimp_gp_param_def_to_param_spec (gpointer          gimp,
                                  param_def->meta.m_int.default_val,
                                  flags);
 
-      if (! strcmp (param_def->type_name, "GimpParamInt16"))
-        return gimp_param_spec_int16 (name, nick, blurb,
-                                      param_def->meta.m_int.min_val,
-                                      param_def->meta.m_int.max_val,
-                                      param_def->meta.m_int.default_val,
-                                      flags);
-
       if (! strcmp (param_def->type_name, "GParamUInt"))
         return g_param_spec_uint (name, nick, blurb,
                                   param_def->meta.m_int.min_val,
diff --git a/libgimpbase/gimpbase.def b/libgimpbase/gimpbase.def
index 52c8769113..90d1bf8e5a 100644
--- a/libgimpbase/gimpbase.def
+++ b/libgimpbase/gimpbase.def
@@ -67,7 +67,6 @@ EXPORTS
        gimp_installation_directory
        gimp_installation_directory_file
        gimp_int16_array_get_type
-       gimp_int16_get_type
        gimp_int32_array_get_type
        gimp_int8_array_get_type
        gimp_int8_get_type
@@ -110,7 +109,6 @@ EXPORTS
        gimp_param_array_get_type
        gimp_param_float_array_get_type
        gimp_param_int16_array_get_type
-       gimp_param_int16_get_type
        gimp_param_int32_array_get_type
        gimp_param_int8_array_get_type
        gimp_param_memsize_get_type
@@ -118,7 +116,6 @@ EXPORTS
        gimp_param_rgb_array_get_type
        gimp_param_spec_array
        gimp_param_spec_float_array
-       gimp_param_spec_int16
        gimp_param_spec_int16_array
        gimp_param_spec_int32_array
        gimp_param_spec_int8_array
diff --git a/libgimpbase/gimpparamspecs.c b/libgimpbase/gimpparamspecs.c
index a0027ce319..917d71c177 100644
--- a/libgimpbase/gimpparamspecs.c
+++ b/libgimpbase/gimpparamspecs.c
@@ -25,115 +25,6 @@
 #include "gimpbase.h"
 
 
-/*
- * GIMP_TYPE_INT16
- */
-
-GType
-gimp_int16_get_type (void)
-{
-  static GType type = 0;
-
-  if (! type)
-    {
-      const GTypeInfo info = { 0, };
-
-      type = g_type_register_static (G_TYPE_INT, "GimpInt16", &info, 0);
-    }
-
-  return type;
-}
-
-
-/*
- * GIMP_TYPE_PARAM_INT16
- */
-
-static void   gimp_param_int16_class_init (GParamSpecClass *klass);
-static void   gimp_param_int16_init       (GParamSpec      *pspec);
-
-GType
-gimp_param_int16_get_type (void)
-{
-  static GType type = 0;
-
-  if (! type)
-    {
-      const GTypeInfo info =
-      {
-        sizeof (GParamSpecClass),
-        NULL, NULL,
-        (GClassInitFunc) gimp_param_int16_class_init,
-        NULL, NULL,
-        sizeof (GimpParamSpecInt16),
-        0,
-        (GInstanceInitFunc) gimp_param_int16_init
-      };
-
-      type = g_type_register_static (G_TYPE_PARAM_INT,
-                                     "GimpParamInt16", &info, 0);
-    }
-
-  return type;
-}
-
-static void
-gimp_param_int16_class_init (GParamSpecClass *klass)
-{
-  klass->value_type = GIMP_TYPE_INT16;
-}
-
-static void
-gimp_param_int16_init (GParamSpec *pspec)
-{
-}
-
-/**
- * gimp_param_spec_int16:
- * @name:          Canonical name of the property specified.
- * @nick:          Nick name of the property specified.
- * @blurb:         Description of the property specified.
- * @minimum:       The minimum accepted value.
- * @maximum:       The maximum accepted value.
- * @default_value: The default value.
- * @flags:         Flags for the property specified.
- *
- * Creates a new #GimpParamSpecInt16 specifying a
- * #GIMP_TYPE_INT16 property.
- *
- * See g_param_spec_internal() for details on property names.
- *
- * Returns: (transfer full): The newly created #GimpParamSpecInt16.
- *
- * Since: 3.0
- **/
-GParamSpec *
-gimp_param_spec_int16 (const gchar *name,
-                       const gchar *nick,
-                       const gchar *blurb,
-                       gint         minimum,
-                       gint         maximum,
-                       gint         default_value,
-                       GParamFlags  flags)
-{
-  GParamSpecInt *ispec;
-
-  g_return_val_if_fail (minimum >= G_MININT16, NULL);
-  g_return_val_if_fail (maximum <= G_MAXINT16, NULL);
-  g_return_val_if_fail (default_value >= minimum &&
-                        default_value <= maximum, NULL);
-
-  ispec = g_param_spec_internal (GIMP_TYPE_PARAM_INT16,
-                                 name, nick, blurb, flags);
-
-  ispec->minimum       = minimum;
-  ispec->maximum       = maximum;
-  ispec->default_value = default_value;
-
-  return G_PARAM_SPEC (ispec);
-}
-
-
 /*
  * GIMP_TYPE_PARAM_STRING
  */
diff --git a/libgimpbase/gimpparamspecs.h b/libgimpbase/gimpparamspecs.h
index 58f5b8b2cf..e481e33227 100644
--- a/libgimpbase/gimpparamspecs.h
+++ b/libgimpbase/gimpparamspecs.h
@@ -74,43 +74,6 @@ G_BEGIN_DECLS
                                    GIMP_PARAM_STATIC_STRINGS)
 
 
-/*
- * GIMP_TYPE_INT16
- */
-
-#define GIMP_TYPE_INT16               (gimp_int16_get_type ())
-#define GIMP_VALUE_HOLDS_INT16(value) (G_TYPE_CHECK_VALUE_TYPE ((value),\
-                                       GIMP_TYPE_INT16))
-
-GType   gimp_int16_get_type           (void) G_GNUC_CONST;
-
-
-/*
- * GIMP_TYPE_PARAM_INT16
- */
-
-#define GIMP_TYPE_PARAM_INT16           (gimp_param_int16_get_type ())
-#define GIMP_PARAM_SPEC_INT16(pspec)    (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GIMP_TYPE_PARAM_INT16, 
GimpParamSpecInt16))
-#define GIMP_IS_PARAM_SPEC_INT16(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_INT16))
-
-typedef struct _GimpParamSpecInt16 GimpParamSpecInt16;
-
-struct _GimpParamSpecInt16
-{
-  GParamSpecInt parent_instance;
-};
-
-GType        gimp_param_int16_get_type (void) G_GNUC_CONST;
-
-GParamSpec * gimp_param_spec_int16     (const gchar *name,
-                                        const gchar *nick,
-                                        const gchar *blurb,
-                                        gint         minimum,
-                                        gint         maximum,
-                                        gint         default_value,
-                                        GParamFlags  flags);
-
-
 /*
  * GIMP_TYPE_PARAM_STRING
  */
diff --git a/pdb/app.pl b/pdb/app.pl
index 8a34336a48..b3e6829f95 100644
--- a/pdb/app.pl
+++ b/pdb/app.pl
@@ -385,11 +385,11 @@ CODE
        }
        $default = exists $arg->{default} ? $arg->{default} : defined $typeinfo[0] ? $typeinfo[0] : 0;
        $pspec = <<CODE;
-gimp_param_spec_int16 ("$name",
-                       "$nick",
-                       "$blurb",
-                       $min, $max, $default,
-                       $flags)
+g_param_spec_int ("$name",
+                  "$nick",
+                  "$blurb",
+                  $min, $max, $default,
+                  $flags)
 CODE
     }
     elsif ($pdbtype eq 'int8') {
diff --git a/pdb/pdb.pl b/pdb/pdb.pl
index 1adf230728..39b8d0c656 100644
--- a/pdb/pdb.pl
+++ b/pdb/pdb.pl
@@ -28,7 +28,7 @@ package Gimp::CodeGen::pdb;
                     take_value_func => 'g_value_set_int ($value, $var)' },
 
     int16       => { name            => 'INT16',
-                    gtype           => 'GIMP_TYPE_INT16',
+                    gtype           => 'G_TYPE_INT',
                     type            => 'gint16 ',
                     const_type      => 'gint16 ',
                     init_value      => '0',


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