app/pdb/Makefile.am removed...

2006-04-04  Michael Natterer  <mitch@gimp.org>

	* app/pdb/Makefile.am
	* app/pdb/gimpargument.[ch]: removed...

	* app/pdb/gimp-pdb-compat.[ch]: ...and added with renamed functions.
	Added gimp_pdb_compat_param_spec().

	* app/pdb/gimpprocedure.[ch]: removed gimp_procedure_add_compat_arg()
	and _add_compat_value(). Use gimp_pdb_compat_param_spec() plus
	gimp_procedure_add_argument()/return_value() instead.

	* app/pdb/procedural-db-query.c
	* app/pdb/procedural_db.c
	* app/plug-in/plug-in-message.c
	* app/plug-in/plug-in-params.c
	* app/plug-in/plug-in-rc.c
	* tools/pdbgen/pdb/procedural_db.pdb: changed accordingly.

	* app/xcf/xcf.c: no need to use compat functions here.

	* app/pdb/procedural_db_cmds.c: regnerated.
This commit is contained in:
Michael Natterer 2006-04-04 15:54:51 +00:00 committed by Michael Natterer
parent 3f52325f49
commit c7943a28ab
20 changed files with 507 additions and 520 deletions

View File

@ -1,3 +1,26 @@
2006-04-04 Michael Natterer <mitch@gimp.org>
* app/pdb/Makefile.am
* app/pdb/gimpargument.[ch]: removed...
* app/pdb/gimp-pdb-compat.[ch]: ...and added with renamed functions.
Added gimp_pdb_compat_param_spec().
* app/pdb/gimpprocedure.[ch]: removed gimp_procedure_add_compat_arg()
and _add_compat_value(). Use gimp_pdb_compat_param_spec() plus
gimp_procedure_add_argument()/return_value() instead.
* app/pdb/procedural-db-query.c
* app/pdb/procedural_db.c
* app/plug-in/plug-in-message.c
* app/plug-in/plug-in-params.c
* app/plug-in/plug-in-rc.c
* tools/pdbgen/pdb/procedural_db.pdb: changed accordingly.
* app/xcf/xcf.c: no need to use compat functions here.
* app/pdb/procedural_db_cmds.c: regnerated.
2006-04-04 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpcontainertreeview-dnd.c

View File

@ -5,8 +5,8 @@ noinst_LIBRARIES = libapppdb.a
libapppdb_a_SOURCES = \
pdb-types.h \
\
gimpargument.c \
gimpargument.h \
gimp-pdb-compat.c \
gimp-pdb-compat.h \
gimpprocedure.c \
gimpprocedure.h \
\

344
app/pdb/gimp-pdb-compat.c Normal file
View File

@ -0,0 +1,344 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <glib-object.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpcolor/gimpcolor.h"
#include "pdb-types.h"
#include "core/gimp.h"
#include "core/gimpparamspecs.h"
#include "gimp-pdb-compat.h"
/* public functions */
GParamSpec *
gimp_pdb_compat_param_spec (Gimp *gimp,
GimpPDBArgType arg_type,
const gchar *name,
const gchar *desc)
{
GParamSpec *pspec = NULL;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (name != NULL, NULL);
switch (arg_type)
{
case GIMP_PDB_INT32:
pspec = gimp_param_spec_int32 (name, name, desc,
G_MININT32, G_MAXINT32, 0,
G_PARAM_READWRITE);
break;
case GIMP_PDB_INT16:
pspec = gimp_param_spec_int16 (name, name, desc,
G_MININT16, G_MAXINT16, 0,
G_PARAM_READWRITE);
break;
case GIMP_PDB_INT8:
pspec = gimp_param_spec_int8 (name, name, desc,
0, G_MAXUINT8, 0,
G_PARAM_READWRITE);
break;
case GIMP_PDB_FLOAT:
pspec = g_param_spec_double (name, name, desc,
-G_MAXDOUBLE, G_MAXDOUBLE, 0.0,
G_PARAM_READWRITE);
break;
case GIMP_PDB_STRING:
pspec = gimp_param_spec_string (name, name, desc,
TRUE, TRUE,
NULL,
G_PARAM_READWRITE);
break;
case GIMP_PDB_INT32ARRAY:
pspec = gimp_param_spec_int32_array (name, name, desc,
G_PARAM_READWRITE);
break;
case GIMP_PDB_INT16ARRAY:
pspec = gimp_param_spec_int16_array (name, name, desc,
G_PARAM_READWRITE);
break;
case GIMP_PDB_INT8ARRAY:
pspec = gimp_param_spec_int8_array (name, name, desc,
G_PARAM_READWRITE);
break;
case GIMP_PDB_FLOATARRAY:
pspec = gimp_param_spec_float_array (name, name, desc,
G_PARAM_READWRITE);
break;
case GIMP_PDB_STRINGARRAY:
pspec = gimp_param_spec_string_array (name, name, desc,
G_PARAM_READWRITE);
break;
case GIMP_PDB_COLOR:
pspec = gimp_param_spec_rgb (name, name, desc,
NULL,
G_PARAM_READWRITE);
break;
case GIMP_PDB_REGION:
break;
case GIMP_PDB_DISPLAY:
pspec = gimp_param_spec_display_id (name, name, desc,
gimp,
G_PARAM_READWRITE);
break;
case GIMP_PDB_IMAGE:
pspec = gimp_param_spec_image_id (name, name, desc,
gimp,
G_PARAM_READWRITE);
break;
case GIMP_PDB_LAYER:
pspec = gimp_param_spec_layer_id (name, name, desc,
gimp,
G_PARAM_READWRITE);
break;
case GIMP_PDB_CHANNEL:
pspec = gimp_param_spec_channel_id (name, name, desc,
gimp,
G_PARAM_READWRITE);
break;
case GIMP_PDB_DRAWABLE:
pspec = gimp_param_spec_drawable_id (name, name, desc,
gimp,
G_PARAM_READWRITE);
break;
case GIMP_PDB_SELECTION:
pspec = gimp_param_spec_selection_id (name, name, desc,
gimp,
G_PARAM_READWRITE);
break;
case GIMP_PDB_BOUNDARY:
break;
case GIMP_PDB_VECTORS:
pspec = gimp_param_spec_vectors_id (name, name, desc,
gimp,
G_PARAM_READWRITE);
break;
case GIMP_PDB_PARASITE:
pspec = gimp_param_spec_parasite (name, name, desc,
G_PARAM_READWRITE);
break;
case GIMP_PDB_STATUS:
pspec = g_param_spec_enum (name, name, desc,
GIMP_TYPE_PDB_STATUS_TYPE,
GIMP_PDB_EXECUTION_ERROR,
G_PARAM_READWRITE);
break;
case GIMP_PDB_END:
break;
}
if (! pspec)
g_warning ("%s: returning NULL for %s (%s)",
G_STRFUNC, name, gimp_pdb_compat_arg_type_to_string (arg_type));
return pspec;
}
GType
gimp_pdb_compat_arg_type_to_gtype (GimpPDBArgType type)
{
switch (type)
{
case GIMP_PDB_INT32:
return GIMP_TYPE_INT32;
case GIMP_PDB_INT16:
return GIMP_TYPE_INT16;
case GIMP_PDB_INT8:
return GIMP_TYPE_INT8;
case GIMP_PDB_FLOAT:
return G_TYPE_DOUBLE;
case GIMP_PDB_STRING:
return G_TYPE_STRING;
case GIMP_PDB_INT32ARRAY:
return GIMP_TYPE_INT32_ARRAY;
case GIMP_PDB_INT16ARRAY:
return GIMP_TYPE_INT16_ARRAY;
case GIMP_PDB_INT8ARRAY:
return GIMP_TYPE_INT8_ARRAY;
case GIMP_PDB_FLOATARRAY:
return GIMP_TYPE_FLOAT_ARRAY;
case GIMP_PDB_STRINGARRAY:
return GIMP_TYPE_STRING_ARRAY;
case GIMP_PDB_COLOR:
return GIMP_TYPE_RGB;
case GIMP_PDB_REGION:
case GIMP_PDB_BOUNDARY:
break;
case GIMP_PDB_DISPLAY:
return GIMP_TYPE_DISPLAY_ID;
case GIMP_PDB_IMAGE:
return GIMP_TYPE_IMAGE_ID;
case GIMP_PDB_LAYER:
return GIMP_TYPE_LAYER_ID;
case GIMP_PDB_CHANNEL:
return GIMP_TYPE_CHANNEL_ID;
case GIMP_PDB_DRAWABLE:
return GIMP_TYPE_DRAWABLE_ID;
case GIMP_PDB_SELECTION:
return GIMP_TYPE_SELECTION_ID;
case GIMP_PDB_VECTORS:
return GIMP_TYPE_VECTORS_ID;
case GIMP_PDB_PARASITE:
return GIMP_TYPE_PARASITE;
case GIMP_PDB_STATUS:
return GIMP_TYPE_PDB_STATUS_TYPE;
case GIMP_PDB_END:
break;
}
g_warning ("%s: returning G_TYPE_NONE for %d (%s)",
G_STRFUNC, type, gimp_pdb_compat_arg_type_to_string (type));
return G_TYPE_NONE;
}
GimpPDBArgType
gimp_pdb_compat_arg_type_from_gtype (GType type)
{
static GQuark pdb_type_quark = 0;
GimpPDBArgType pdb_type;
if (! pdb_type_quark)
{
struct
{
GType g_type;
GimpPDBArgType pdb_type;
}
type_mapping[] =
{
{ GIMP_TYPE_INT32, GIMP_PDB_INT32 },
{ G_TYPE_INT, GIMP_PDB_INT32 },
{ G_TYPE_UINT, GIMP_PDB_INT32 },
{ G_TYPE_ENUM, GIMP_PDB_INT32 },
{ G_TYPE_BOOLEAN, GIMP_PDB_INT32 },
{ GIMP_TYPE_INT16, GIMP_PDB_INT16 },
{ GIMP_TYPE_INT8, GIMP_PDB_INT8 },
{ G_TYPE_DOUBLE, GIMP_PDB_FLOAT },
{ G_TYPE_STRING, GIMP_PDB_STRING },
{ GIMP_TYPE_INT32_ARRAY, GIMP_PDB_INT32ARRAY },
{ GIMP_TYPE_INT16_ARRAY, GIMP_PDB_INT16ARRAY },
{ GIMP_TYPE_INT8_ARRAY, GIMP_PDB_INT8ARRAY },
{ GIMP_TYPE_FLOAT_ARRAY, GIMP_PDB_FLOATARRAY },
{ GIMP_TYPE_STRING_ARRAY, GIMP_PDB_STRINGARRAY },
{ GIMP_TYPE_RGB, GIMP_PDB_COLOR },
{ GIMP_TYPE_DISPLAY_ID, GIMP_PDB_DISPLAY },
{ GIMP_TYPE_IMAGE_ID, GIMP_PDB_IMAGE },
{ GIMP_TYPE_LAYER_ID, GIMP_PDB_LAYER },
{ GIMP_TYPE_CHANNEL_ID, GIMP_PDB_CHANNEL },
{ GIMP_TYPE_DRAWABLE_ID, GIMP_PDB_DRAWABLE },
{ GIMP_TYPE_SELECTION_ID, GIMP_PDB_SELECTION },
{ GIMP_TYPE_LAYER_MASK_ID, GIMP_PDB_CHANNEL },
{ GIMP_TYPE_VECTORS_ID, GIMP_PDB_VECTORS },
{ GIMP_TYPE_PARASITE, GIMP_PDB_PARASITE },
{ GIMP_TYPE_PDB_STATUS_TYPE, GIMP_PDB_STATUS }
};
gint i;
pdb_type_quark = g_quark_from_static_string ("gimp-pdb-type");
for (i = 0; i < G_N_ELEMENTS (type_mapping); i++)
g_type_set_qdata (type_mapping[i].g_type, pdb_type_quark,
GINT_TO_POINTER (type_mapping[i].pdb_type));
}
pdb_type = GPOINTER_TO_INT (g_type_get_qdata (type, pdb_type_quark));
#if 0
g_printerr ("%s: arg_type = %p (%s) -> %d (%s)\n",
G_STRFUNC,
(gpointer) type, g_type_name (type),
pdb_type, gimp_pdb_arg_type_to_string (pdb_type));
#endif
return pdb_type;
}
gchar *
gimp_pdb_compat_arg_type_to_string (GimpPDBArgType type)
{
const gchar *name;
if (! gimp_enum_get_value (GIMP_TYPE_PDB_ARG_TYPE, type,
&name, NULL, NULL, NULL))
{
return g_strdup_printf ("(PDB type %d unknown)", type);
}
return g_strdup (name);
}

View File

@ -16,15 +16,18 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_ARGUMENT_H__
#define __GIMP_ARGUMENT_H__
#ifndef __GIMP_PDB_COMPAT_H__
#define __GIMP_PDB_COMPAT_H__
void gimp_argument_init_compat (GValue *value,
GimpPDBArgType type);
GParamSpec * gimp_pdb_compat_param_spec (Gimp *gimp,
GimpPDBArgType arg_type,
const gchar *name,
const gchar *desc);
GimpPDBArgType gimp_argument_type_to_pdb_arg_type (GType type);
gchar * gimp_pdb_arg_type_to_string (GimpPDBArgType type);
GType gimp_pdb_compat_arg_type_to_gtype (GimpPDBArgType type);
GimpPDBArgType gimp_pdb_compat_arg_type_from_gtype (GType type);
gchar * gimp_pdb_compat_arg_type_to_string (GimpPDBArgType type);
#endif /* __GIMP_ARGUMENT_H__ */

View File

@ -36,8 +36,8 @@
#include "core/gimp.h"
#include "gimpargument.h"
#include "gimpprocedure.h"
#include "gimp-pdb-compat.h"
#include "procedural_db.h"
#include "procedural-db-query.h"
@ -409,7 +409,7 @@ procedural_db_print_entry (gpointer key,
fprintf (file, "( ");
arg_type = gimp_argument_type_to_pdb_arg_type (pspec->value_type);
arg_type = gimp_pdb_compat_arg_type_from_gtype (pspec->value_type);
arg_value = g_enum_get_value (arg_class, arg_type);
@ -429,7 +429,7 @@ procedural_db_print_entry (gpointer key,
fprintf (file, "( ");
arg_type = gimp_argument_type_to_pdb_arg_type (pspec->value_type);
arg_type = gimp_pdb_compat_arg_type_from_gtype (pspec->value_type);
arg_value = g_enum_get_value (arg_class, arg_type);

View File

@ -41,7 +41,6 @@
#include "plug-in/plug-in-run.h"
#include "gimpargument.h"
#include "gimpprocedure.h"
#include "internal_procs.h"
#include "procedural_db.h"

View File

@ -1,214 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <glib-object.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpcolor/gimpcolor.h"
#include "pdb-types.h"
#include "core/gimpparamspecs.h"
#include "gimpargument.h"
/* public functions */
void
gimp_argument_init_compat (GValue *value,
GimpPDBArgType type)
{
g_return_if_fail (value != NULL);
switch (type)
{
case GIMP_PDB_INT32:
g_value_init (value, GIMP_TYPE_INT32);
break;
case GIMP_PDB_INT16:
g_value_init (value, GIMP_TYPE_INT16);
break;
case GIMP_PDB_INT8:
g_value_init (value, GIMP_TYPE_INT8);
break;
case GIMP_PDB_FLOAT:
g_value_init (value, G_TYPE_DOUBLE);
break;
case GIMP_PDB_STRING:
g_value_init (value, G_TYPE_STRING);
break;
case GIMP_PDB_INT32ARRAY:
g_value_init (value, GIMP_TYPE_INT32_ARRAY);
break;
case GIMP_PDB_INT16ARRAY:
g_value_init (value, GIMP_TYPE_INT16_ARRAY);
break;
case GIMP_PDB_INT8ARRAY:
g_value_init (value, GIMP_TYPE_INT8_ARRAY);
break;
case GIMP_PDB_FLOATARRAY:
g_value_init (value, GIMP_TYPE_FLOAT_ARRAY);
break;
case GIMP_PDB_STRINGARRAY:
g_value_init (value, GIMP_TYPE_STRING_ARRAY);
break;
case GIMP_PDB_COLOR:
g_value_init (value, GIMP_TYPE_RGB);
break;
case GIMP_PDB_REGION:
case GIMP_PDB_BOUNDARY:
break;
case GIMP_PDB_DISPLAY:
g_value_init (value, GIMP_TYPE_DISPLAY_ID);
break;
case GIMP_PDB_IMAGE:
g_value_init (value, GIMP_TYPE_IMAGE_ID);
break;
case GIMP_PDB_LAYER:
g_value_init (value, GIMP_TYPE_LAYER_ID);
break;
case GIMP_PDB_CHANNEL:
g_value_init (value, GIMP_TYPE_CHANNEL_ID);
break;
case GIMP_PDB_DRAWABLE:
g_value_init (value, GIMP_TYPE_DRAWABLE_ID);
break;
case GIMP_PDB_SELECTION:
g_value_init (value, GIMP_TYPE_SELECTION_ID);
break;
case GIMP_PDB_VECTORS:
g_value_init (value, GIMP_TYPE_VECTORS_ID);
break;
case GIMP_PDB_PARASITE:
g_value_init (value, GIMP_TYPE_PARASITE);
break;
case GIMP_PDB_STATUS:
g_value_init (value, GIMP_TYPE_PDB_STATUS_TYPE);
break;
case GIMP_PDB_END:
break;
}
}
GimpPDBArgType
gimp_argument_type_to_pdb_arg_type (GType type)
{
static GQuark pdb_type_quark = 0;
GimpPDBArgType pdb_type;
if (! pdb_type_quark)
{
struct
{
GType g_type;
GimpPDBArgType pdb_type;
}
type_mapping[] =
{
{ GIMP_TYPE_INT32, GIMP_PDB_INT32 },
{ G_TYPE_INT, GIMP_PDB_INT32 },
{ G_TYPE_UINT, GIMP_PDB_INT32 },
{ G_TYPE_ENUM, GIMP_PDB_INT32 },
{ G_TYPE_BOOLEAN, GIMP_PDB_INT32 },
{ GIMP_TYPE_INT16, GIMP_PDB_INT16 },
{ GIMP_TYPE_INT8, GIMP_PDB_INT8 },
{ G_TYPE_DOUBLE, GIMP_PDB_FLOAT },
{ G_TYPE_STRING, GIMP_PDB_STRING },
{ GIMP_TYPE_INT32_ARRAY, GIMP_PDB_INT32ARRAY },
{ GIMP_TYPE_INT16_ARRAY, GIMP_PDB_INT16ARRAY },
{ GIMP_TYPE_INT8_ARRAY, GIMP_PDB_INT8ARRAY },
{ GIMP_TYPE_FLOAT_ARRAY, GIMP_PDB_FLOATARRAY },
{ GIMP_TYPE_STRING_ARRAY, GIMP_PDB_STRINGARRAY },
{ GIMP_TYPE_RGB, GIMP_PDB_COLOR },
{ GIMP_TYPE_DISPLAY_ID, GIMP_PDB_DISPLAY },
{ GIMP_TYPE_IMAGE_ID, GIMP_PDB_IMAGE },
{ GIMP_TYPE_LAYER_ID, GIMP_PDB_LAYER },
{ GIMP_TYPE_CHANNEL_ID, GIMP_PDB_CHANNEL },
{ GIMP_TYPE_DRAWABLE_ID, GIMP_PDB_DRAWABLE },
{ GIMP_TYPE_SELECTION_ID, GIMP_PDB_SELECTION },
{ GIMP_TYPE_LAYER_MASK_ID, GIMP_PDB_CHANNEL },
{ GIMP_TYPE_VECTORS_ID, GIMP_PDB_VECTORS },
{ GIMP_TYPE_PARASITE, GIMP_PDB_PARASITE },
{ GIMP_TYPE_PDB_STATUS_TYPE, GIMP_PDB_STATUS }
};
gint i;
pdb_type_quark = g_quark_from_static_string ("gimp-pdb-type");
for (i = 0; i < G_N_ELEMENTS (type_mapping); i++)
g_type_set_qdata (type_mapping[i].g_type, pdb_type_quark,
GINT_TO_POINTER (type_mapping[i].pdb_type));
}
pdb_type = GPOINTER_TO_INT (g_type_get_qdata (type, pdb_type_quark));
#if 0
g_printerr ("%s: arg_type = %p (%s) -> %d (%s)\n",
G_STRFUNC,
(gpointer) type, g_type_name (type),
pdb_type, gimp_pdb_arg_type_to_string (pdb_type));
#endif
return pdb_type;
}
gchar *
gimp_pdb_arg_type_to_string (GimpPDBArgType type)
{
const gchar *name;
if (! gimp_enum_get_value (GIMP_TYPE_PDB_ARG_TYPE, type,
&name, NULL, NULL, NULL))
{
return g_strdup_printf ("(PDB type %d unknown)", type);
}
return g_strdup (name);
}

View File

@ -36,8 +36,8 @@
#include "core/gimp.h"
#include "gimpargument.h"
#include "gimpprocedure.h"
#include "gimp-pdb-compat.h"
#include "procedural_db.h"
#include "procedural-db-query.h"
@ -409,7 +409,7 @@ procedural_db_print_entry (gpointer key,
fprintf (file, "( ");
arg_type = gimp_argument_type_to_pdb_arg_type (pspec->value_type);
arg_type = gimp_pdb_compat_arg_type_from_gtype (pspec->value_type);
arg_value = g_enum_get_value (arg_class, arg_type);
@ -429,7 +429,7 @@ procedural_db_print_entry (gpointer key,
fprintf (file, "( ");
arg_type = gimp_argument_type_to_pdb_arg_type (pspec->value_type);
arg_type = gimp_pdb_compat_arg_type_from_gtype (pspec->value_type);
arg_value = g_enum_get_value (arg_class, arg_type);

View File

@ -41,7 +41,6 @@
#include "plug-in/plug-in-run.h"
#include "gimpargument.h"
#include "gimpprocedure.h"
#include "internal_procs.h"
#include "procedural_db.h"

View File

@ -40,7 +40,6 @@
#include "plug-in/plug-in-run.h"
#include "gimpargument.h"
#include "gimpprocedure.h"
#include "gimp-intl.h"
@ -423,181 +422,6 @@ gimp_procedure_add_return_value (GimpProcedure *procedure,
G_STRFUNC, procedure->num_values, procedure->name);
}
static GParamSpec *
gimp_procedure_compat_pspec (Gimp *gimp,
GimpPDBArgType arg_type,
const gchar *name,
const gchar *desc)
{
GParamSpec *pspec = NULL;
switch (arg_type)
{
case GIMP_PDB_INT32:
pspec = gimp_param_spec_int32 (name, name, desc,
G_MININT32, G_MAXINT32, 0,
G_PARAM_READWRITE);
break;
case GIMP_PDB_INT16:
pspec = gimp_param_spec_int16 (name, name, desc,
G_MININT16, G_MAXINT16, 0,
G_PARAM_READWRITE);
break;
case GIMP_PDB_INT8:
pspec = gimp_param_spec_int8 (name, name, desc,
0, G_MAXUINT8, 0,
G_PARAM_READWRITE);
break;
case GIMP_PDB_FLOAT:
pspec = g_param_spec_double (name, name, desc,
-G_MAXDOUBLE, G_MAXDOUBLE, 0.0,
G_PARAM_READWRITE);
break;
case GIMP_PDB_STRING:
pspec = gimp_param_spec_string (name, name, desc,
TRUE, TRUE,
NULL,
G_PARAM_READWRITE);
break;
case GIMP_PDB_INT32ARRAY:
pspec = gimp_param_spec_int32_array (name, name, desc,
G_PARAM_READWRITE);
break;
case GIMP_PDB_INT16ARRAY:
pspec = gimp_param_spec_int16_array (name, name, desc,
G_PARAM_READWRITE);
break;
case GIMP_PDB_INT8ARRAY:
pspec = gimp_param_spec_int8_array (name, name, desc,
G_PARAM_READWRITE);
break;
case GIMP_PDB_FLOATARRAY:
pspec = gimp_param_spec_float_array (name, name, desc,
G_PARAM_READWRITE);
break;
case GIMP_PDB_STRINGARRAY:
pspec = gimp_param_spec_string_array (name, name, desc,
G_PARAM_READWRITE);
break;
case GIMP_PDB_COLOR:
pspec = gimp_param_spec_rgb (name, name, desc,
NULL,
G_PARAM_READWRITE);
break;
case GIMP_PDB_REGION:
break;
case GIMP_PDB_DISPLAY:
pspec = gimp_param_spec_display_id (name, name, desc,
gimp,
G_PARAM_READWRITE);
break;
case GIMP_PDB_IMAGE:
pspec = gimp_param_spec_image_id (name, name, desc,
gimp,
G_PARAM_READWRITE);
break;
case GIMP_PDB_LAYER:
pspec = gimp_param_spec_layer_id (name, name, desc,
gimp,
G_PARAM_READWRITE);
break;
case GIMP_PDB_CHANNEL:
pspec = gimp_param_spec_channel_id (name, name, desc,
gimp,
G_PARAM_READWRITE);
break;
case GIMP_PDB_DRAWABLE:
pspec = gimp_param_spec_drawable_id (name, name, desc,
gimp,
G_PARAM_READWRITE);
break;
case GIMP_PDB_SELECTION:
pspec = gimp_param_spec_selection_id (name, name, desc,
gimp,
G_PARAM_READWRITE);
break;
case GIMP_PDB_BOUNDARY:
break;
case GIMP_PDB_VECTORS:
pspec = gimp_param_spec_vectors_id (name, name, desc,
gimp,
G_PARAM_READWRITE);
break;
case GIMP_PDB_PARASITE:
pspec = gimp_param_spec_parasite (name, name, desc,
G_PARAM_READWRITE);
break;
case GIMP_PDB_STATUS:
pspec = g_param_spec_enum (name, name, desc,
GIMP_TYPE_PDB_STATUS_TYPE,
GIMP_PDB_EXECUTION_ERROR,
G_PARAM_READWRITE);
break;
case GIMP_PDB_END:
break;
}
if (! pspec)
g_warning ("%s: returning NULL for %s (%s)",
G_STRFUNC, name, gimp_pdb_arg_type_to_string (arg_type));
return pspec;
}
void
gimp_procedure_add_compat_arg (GimpProcedure *procedure,
Gimp *gimp,
GimpPDBArgType arg_type,
const gchar *name,
const gchar *desc)
{
g_return_if_fail (GIMP_IS_PROCEDURE (procedure));
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (name != NULL);
gimp_procedure_add_argument (procedure,
gimp_procedure_compat_pspec (gimp, arg_type,
name, desc));
}
void
gimp_procedure_add_compat_value (GimpProcedure *procedure,
Gimp *gimp,
GimpPDBArgType arg_type,
const gchar *name,
const gchar *desc)
{
g_return_if_fail (GIMP_IS_PROCEDURE (procedure));
g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (name != NULL);
gimp_procedure_add_return_value (procedure,
gimp_procedure_compat_pspec (gimp, arg_type,
name, desc));
}
/* private functions */

View File

@ -113,7 +113,7 @@ void gimp_procedure_set_strings (GimpProcedure *procedure,
gchar *copyright,
gchar *date,
gchar *deprecated);
void gimp_procedure_set_static_strings (GimpProcedure *procedure,
void gimp_procedure_set_static_strings (GimpProcedure *procedure,
gchar *name,
gchar *original_name,
gchar *blurb,
@ -122,7 +122,7 @@ void gimp_procedure_set_static_strings (GimpProcedure *procedure,
gchar *copyright,
gchar *date,
gchar *deprecated);
void gimp_procedure_take_strings (GimpProcedure *procedure,
void gimp_procedure_take_strings (GimpProcedure *procedure,
gchar *name,
gchar *original_name,
gchar *blurb,
@ -137,17 +137,6 @@ void gimp_procedure_add_argument (GimpProcedure *procedure,
void gimp_procedure_add_return_value (GimpProcedure *procedure,
GParamSpec *pspec);
void gimp_procedure_add_compat_arg (GimpProcedure *procedure,
Gimp *gimp,
GimpPDBArgType arg_type,
const gchar *name,
const gchar *desc);
void gimp_procedure_add_compat_value (GimpProcedure *procedure,
Gimp *gimp,
GimpPDBArgType arg_type,
const gchar *name,
const gchar *desc);
GValueArray * gimp_procedure_get_arguments (GimpProcedure *procedure);
GValueArray * gimp_procedure_get_return_values (GimpProcedure *procedure,
gboolean success);

View File

@ -36,8 +36,8 @@
#include "core/gimp.h"
#include "gimpargument.h"
#include "gimpprocedure.h"
#include "gimp-pdb-compat.h"
#include "procedural_db.h"
#include "procedural-db-query.h"
@ -409,7 +409,7 @@ procedural_db_print_entry (gpointer key,
fprintf (file, "( ");
arg_type = gimp_argument_type_to_pdb_arg_type (pspec->value_type);
arg_type = gimp_pdb_compat_arg_type_from_gtype (pspec->value_type);
arg_value = g_enum_get_value (arg_class, arg_type);
@ -429,7 +429,7 @@ procedural_db_print_entry (gpointer key,
fprintf (file, "( ");
arg_type = gimp_argument_type_to_pdb_arg_type (pspec->value_type);
arg_type = gimp_pdb_compat_arg_type_from_gtype (pspec->value_type);
arg_value = g_enum_get_value (arg_class, arg_type);

View File

@ -41,7 +41,6 @@
#include "plug-in/plug-in-run.h"
#include "gimpargument.h"
#include "gimpprocedure.h"
#include "internal_procs.h"
#include "procedural_db.h"

View File

@ -31,7 +31,7 @@
#include "core/gimpparamspecs.h"
#include "core/gimp.h"
#include "gimpargument.h"
#include "gimp-pdb-compat.h"
#include "plug-in/plug-in-data.h"
#include "procedural-db-query.h"
@ -609,7 +609,7 @@ procedural_db_proc_arg_invoker (GimpProcedure *procedure,
{
GParamSpec *pspec = proc->args[arg_num];
arg_type = gimp_argument_type_to_pdb_arg_type (G_PARAM_SPEC_VALUE_TYPE (pspec));
arg_type = gimp_pdb_compat_arg_type_from_gtype (G_PARAM_SPEC_VALUE_TYPE (pspec));
arg_name = g_strdup (g_param_spec_get_name (pspec));
arg_desc = g_strdup (g_param_spec_get_blurb (pspec));
}
@ -688,7 +688,7 @@ procedural_db_proc_val_invoker (GimpProcedure *procedure,
{
GParamSpec *pspec = proc->values[val_num];
val_type = gimp_argument_type_to_pdb_arg_type (G_PARAM_SPEC_VALUE_TYPE (pspec));
val_type = gimp_pdb_compat_arg_type_from_gtype (G_PARAM_SPEC_VALUE_TYPE (pspec));
val_name = g_strdup (g_param_spec_get_name (pspec));
val_desc = g_strdup (g_param_spec_get_blurb (pspec));
}

View File

@ -37,6 +37,7 @@
#include "core/gimpdrawable.h"
#include "pdb/gimpprocedure.h"
#include "pdb/gimp-pdb-compat.h"
#include "pdb/procedural_db.h"
#include "plug-in.h"
@ -716,11 +717,11 @@ plug_in_handle_proc_install (PlugIn *plug_in,
{
canonical = gimp_canonicalize_identifier (proc_install->params[i].name);
gimp_procedure_add_compat_arg (procedure,
plug_in->gimp,
proc_install->params[i].type,
canonical,
proc_install->params[i].description);
gimp_procedure_add_argument (procedure,
gimp_pdb_compat_param_spec (plug_in->gimp,
proc_install->params[i].type,
canonical,
proc_install->params[i].description));
g_free (canonical);
}
@ -729,11 +730,11 @@ plug_in_handle_proc_install (PlugIn *plug_in,
{
canonical = gimp_canonicalize_identifier (proc_install->return_vals[i].name);
gimp_procedure_add_compat_value (procedure,
plug_in->gimp,
proc_install->return_vals[i].type,
canonical,
proc_install->return_vals[i].description);
gimp_procedure_add_return_value (procedure,
gimp_pdb_compat_param_spec (plug_in->gimp,
proc_install->return_vals[i].type,
canonical,
proc_install->return_vals[i].description));
g_free (canonical);
}

View File

@ -37,6 +37,7 @@
#include "core/gimpdrawable.h"
#include "pdb/gimpprocedure.h"
#include "pdb/gimp-pdb-compat.h"
#include "pdb/procedural_db.h"
#include "plug-in.h"
@ -716,11 +717,11 @@ plug_in_handle_proc_install (PlugIn *plug_in,
{
canonical = gimp_canonicalize_identifier (proc_install->params[i].name);
gimp_procedure_add_compat_arg (procedure,
plug_in->gimp,
proc_install->params[i].type,
canonical,
proc_install->params[i].description);
gimp_procedure_add_argument (procedure,
gimp_pdb_compat_param_spec (plug_in->gimp,
proc_install->params[i].type,
canonical,
proc_install->params[i].description));
g_free (canonical);
}
@ -729,11 +730,11 @@ plug_in_handle_proc_install (PlugIn *plug_in,
{
canonical = gimp_canonicalize_identifier (proc_install->return_vals[i].name);
gimp_procedure_add_compat_value (procedure,
plug_in->gimp,
proc_install->return_vals[i].type,
canonical,
proc_install->return_vals[i].description);
gimp_procedure_add_return_value (procedure,
gimp_pdb_compat_param_spec (plug_in->gimp,
proc_install->return_vals[i].type,
canonical,
proc_install->return_vals[i].description));
g_free (canonical);
}

View File

@ -30,7 +30,7 @@
#include "core/gimpparamspecs.h"
#include "pdb/gimpargument.h"
#include "pdb/gimp-pdb-compat.h"
#include "pdb/procedural_db.h"
#include "plug-in.h"
@ -57,42 +57,32 @@ plug_in_params_to_args (GParamSpec **pspecs,
for (i = 0; i < n_params; i++)
{
GValue value = { 0, };
GimpPDBArgType arg_type;
gint count;
GValue value = { 0, };
GType type;
gint count;
if (i == 0 && return_values)
type = gimp_pdb_compat_arg_type_to_gtype (params[i].type);
if (i > 0 || ! return_values)
{
gimp_argument_init_compat (&value, params[i].type);
}
else
{
GParamSpec *spec;
gint spec_index = i;
GimpPDBArgType spec_arg_type;
gint pspec_index = i;
GimpPDBArgType pspec_arg_type;
if (return_values)
spec_index--;
pspec_index--;
spec = pspecs[spec_index];
pspec_arg_type = gimp_pdb_compat_arg_type_from_gtype
(G_PARAM_SPEC_VALUE_TYPE (pspecs[pspec_index]));
spec_arg_type = gimp_argument_type_to_pdb_arg_type
(G_PARAM_SPEC_VALUE_TYPE (spec));
if (spec_index < n_pspecs &&
spec_arg_type == params[i].type)
if (pspec_index < n_pspecs && pspec_arg_type == params[i].type)
{
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (spec));
}
else
{
gimp_argument_init_compat (&value, params[i].type);
type = G_PARAM_SPEC_VALUE_TYPE (pspecs[pspec_index]);
}
}
arg_type = gimp_argument_type_to_pdb_arg_type (G_VALUE_TYPE (&value));
g_value_init (&value, type);
switch (arg_type)
switch (gimp_pdb_compat_arg_type_from_gtype (type))
{
case GIMP_PDB_INT32:
if (G_VALUE_HOLDS_INT (&value))
@ -267,7 +257,8 @@ plug_in_args_to_params (GValueArray *args,
{
GValue *value = &args->values[i];
params[i].type = gimp_argument_type_to_pdb_arg_type (G_VALUE_TYPE (value));
params[i].type =
gimp_pdb_compat_arg_type_from_gtype (G_VALUE_TYPE (value));
switch (params[i].type)
{

View File

@ -31,8 +31,8 @@
#include "core/gimp.h"
#include "pdb/gimpargument.h"
#include "pdb/gimpprocedure.h"
#include "pdb/gimp-pdb-compat.h"
#include "plug-ins.h"
#include "plug-in-def.h"
@ -610,6 +610,7 @@ plug_in_proc_arg_deserialize (GScanner *scanner,
gint arg_type;
gchar *name = NULL;
gchar *desc = NULL;
GParamSpec *pspec;
if (! gimp_scanner_parse_token (scanner, G_TOKEN_LEFT_PAREN))
{
@ -648,10 +649,12 @@ plug_in_proc_arg_deserialize (GScanner *scanner,
token = G_TOKEN_LEFT_PAREN;
pspec = gimp_pdb_compat_param_spec (gimp, arg_type, name, desc);
if (return_value)
gimp_procedure_add_compat_value (procedure, gimp, arg_type, name, desc);
gimp_procedure_add_return_value (procedure, pspec);
else
gimp_procedure_add_compat_arg (procedure, gimp, arg_type, name, desc);
gimp_procedure_add_argument (procedure, pspec);
error:
@ -886,7 +889,7 @@ plug_in_rc_write (GSList *plug_in_defs,
gimp_config_writer_open (writer, "proc-arg");
gimp_config_writer_printf (writer, "%d",
gimp_argument_type_to_pdb_arg_type (G_PARAM_SPEC_VALUE_TYPE (pspec)));
gimp_pdb_compat_arg_type_from_gtype (G_PARAM_SPEC_VALUE_TYPE (pspec)));
gimp_config_writer_string (writer,
g_param_spec_get_name (pspec));
@ -902,7 +905,7 @@ plug_in_rc_write (GSList *plug_in_defs,
gimp_config_writer_open (writer, "proc-arg");
gimp_config_writer_printf (writer, "%d",
gimp_argument_type_to_pdb_arg_type (G_PARAM_SPEC_VALUE_TYPE (pspec)));
gimp_pdb_compat_arg_type_from_gtype (G_PARAM_SPEC_VALUE_TYPE (pspec)));
gimp_config_writer_string (writer,
g_param_spec_get_name (pspec));

View File

@ -33,7 +33,6 @@
#include "core/gimpimage.h"
#include "core/gimpparamspecs.h"
#include "pdb/gimpargument.h"
#include "pdb/gimpprocedure.h"
#include "pdb/procedural_db.h"
@ -155,27 +154,41 @@ xcf_init (Gimp *gimp)
"1995-1996",
NULL);
gimp_procedure_add_compat_arg (procedure, gimp,
GIMP_PDB_INT32,
"dummy-param",
"dummy parameter");
gimp_procedure_add_compat_arg (procedure, gimp,
GIMP_PDB_IMAGE,
"image",
"Input image");
gimp_procedure_add_compat_arg (procedure, gimp,
GIMP_PDB_DRAWABLE,
"drawable",
"Active drawable of input image");
gimp_procedure_add_compat_arg (procedure, gimp,
GIMP_PDB_STRING,
"filename",
"The name of the file to save the image in, "
"in the on-disk character set and encoding");
gimp_procedure_add_compat_arg (procedure, gimp,
GIMP_PDB_STRING,
"raw_filename",
"The basename of the file, in UTF-8");
gimp_procedure_add_argument (procedure,
gimp_param_spec_int32 ("dummy-param",
"Dummy Param",
"Dummy parameter",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_image_id ("image",
"Image",
"Input image",
gimp,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"Drawable",
"Active drawable of input image",
gimp,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_string ("filename",
"Filename",
"The name of the file "
"to save the image in, "
"in the on-disk "
"character set and "
"encoding",
TRUE, FALSE, NULL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_string ("raw-filename",
"Raw filename",
"The basename of the "
"file, in UTF-8",
FALSE, FALSE, NULL,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
xcf_plug_in_save_proc.image_types_val =
@ -201,23 +214,35 @@ xcf_init (Gimp *gimp)
"1995-1996",
NULL);
gimp_procedure_add_compat_arg (procedure, gimp,
GIMP_PDB_INT32,
"dummy-param",
"dummy parameter");
gimp_procedure_add_compat_arg (procedure, gimp,
GIMP_PDB_STRING,
"filename",
"The name of the file to load, "
"in the on-disk character set and encoding");
gimp_procedure_add_compat_arg (procedure, gimp,
GIMP_PDB_STRING,
"raw-filename",
"The basename of the file, in UTF-8");
gimp_procedure_add_compat_value (procedure, gimp,
GIMP_PDB_IMAGE,
"image",
"Output image");
gimp_procedure_add_argument (procedure,
gimp_param_spec_int32 ("dummy-param",
"Dummy Param",
"Dummy parameter",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_string ("filename",
"Filename",
"The name of the file "
"to load, in the "
"on-disk character "
"set and encoding",
TRUE, FALSE, NULL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_string ("raw-filename",
"Raw filename",
"The basename of the "
"file, in UTF-8",
FALSE, FALSE, NULL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gimp_param_spec_image_id ("image",
"Image",
"Output image",
gimp,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
xcf_plug_in_load_proc.image_types_val =
plug_ins_image_types_parse (xcf_plug_in_load_proc.image_types);

View File

@ -248,7 +248,7 @@ HELP
{
GParamSpec *pspec = proc->args[arg_num];
arg_type = gimp_argument_type_to_pdb_arg_type (G_PARAM_SPEC_VALUE_TYPE (pspec));
arg_type = gimp_pdb_compat_arg_type_from_gtype (G_PARAM_SPEC_VALUE_TYPE (pspec));
arg_name = g_strdup (g_param_spec_get_name (pspec));
arg_desc = g_strdup (g_param_spec_get_blurb (pspec));
}
@ -315,7 +315,7 @@ HELP
{
GParamSpec *pspec = proc->values[val_num];
val_type = gimp_argument_type_to_pdb_arg_type (G_PARAM_SPEC_VALUE_TYPE (pspec));
val_type = gimp_pdb_compat_arg_type_from_gtype (G_PARAM_SPEC_VALUE_TYPE (pspec));
val_name = g_strdup (g_param_spec_get_name (pspec));
val_desc = g_strdup (g_param_spec_get_blurb (pspec));
}
@ -450,7 +450,7 @@ CODE
@headers = qw("libgimpbase/gimpbase.h" "core/gimp.h" "plug-in/plug-in-data.h"
"gimpargument.h" "procedural-db-query.h");
"gimp-pdb-compat.h" "procedural-db-query.h");
@procs = qw(procedural_db_temp_name procedural_db_dump
procedural_db_query procedural_db_proc_info