added gimp_procedure_new() and gimp_procedure_free() functions.

2006-03-31  Michael Natterer  <mitch@gimp.org>

	* app/pdb/gimpprocedure.[ch]: added gimp_procedure_new() and
	gimp_procedure_free() functions.

	* app/plug-in/plug-in-proc-def.h (struct PlugInProcDef): use a
	ProcRecord pointer instead of including the entire struct.

	* app/plug-in/plug-in-proc-def.c: use the new() and free()
	functions above to allocate/free the ProcRecord.

	* app/actions/plug-in-actions.c
	* app/actions/plug-in-commands.c
	* app/menus/plug-in-menus.c
	* app/plug-in/plug-in-message.c
	* app/plug-in/plug-in-rc.c
	* app/plug-in/plug-in-run.c
	* app/plug-in/plug-in.c
	* app/plug-in/plug-ins-query.c
	* app/plug-in/plug-ins.c
	* app/xcf/xcf.c: changed accordingly.

	Unrelated:

	* app/pdb/gimpprocedure.c (gimp_procedure_execute): be more verbose
	when warning about out-of-bounds parameter values.

	* tools/pdbgen/pdb/fileops.pdb: allow GIMP_RUN_WITH_LAST_VALS for
	file_save because indirect saving (e.g. remote or compressed)
	needs it.

	* app/pdb/fileops_cmds.c: regenerated.
This commit is contained in:
Michael Natterer 2006-03-31 11:49:22 +00:00 committed by Michael Natterer
parent 20a48412bc
commit 49da8cb2d1
27 changed files with 375 additions and 284 deletions

View File

@ -1,3 +1,36 @@
2006-03-31 Michael Natterer <mitch@gimp.org>
* app/pdb/gimpprocedure.[ch]: added gimp_procedure_new() and
gimp_procedure_free() functions.
* app/plug-in/plug-in-proc-def.h (struct PlugInProcDef): use a
ProcRecord pointer instead of including the entire struct.
* app/plug-in/plug-in-proc-def.c: use the new() and free()
functions above to allocate/free the ProcRecord.
* app/actions/plug-in-actions.c
* app/actions/plug-in-commands.c
* app/menus/plug-in-menus.c
* app/plug-in/plug-in-message.c
* app/plug-in/plug-in-rc.c
* app/plug-in/plug-in-run.c
* app/plug-in/plug-in.c
* app/plug-in/plug-ins-query.c
* app/plug-in/plug-ins.c
* app/xcf/xcf.c: changed accordingly.
Unrelated:
* app/pdb/gimpprocedure.c (gimp_procedure_execute): be more verbose
when warning about out-of-bounds parameter values.
* tools/pdbgen/pdb/fileops.pdb: allow GIMP_RUN_WITH_LAST_VALS for
file_save because indirect saving (e.g. remote or compressed)
needs it.
* app/pdb/fileops_cmds.c: regenerated.
2006-03-31 Sven Neumann <sven@gimp.org>
* app/paint-funcs/scale-funcs.c: fixed compiler warning and

View File

@ -33,6 +33,8 @@
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "pdb/gimpprocedure.h"
#include "plug-in/plug-ins.h"
#include "plug-in/plug-in-proc-def.h"
@ -217,7 +219,7 @@ plug_in_actions_update (GimpActionGroup *group,
gboolean sensitive = plug_in_proc_def_get_sensitive (proc_def, type);
gimp_action_group_set_action_sensitive (group,
proc_def->db_info.name,
proc_def->procedure->name,
sensitive);
}
}
@ -296,10 +298,10 @@ plug_in_actions_add_proc (GimpActionGroup *group,
label = p2 + 1;
}
if (proc_def->db_info.blurb)
tooltip = dgettext (locale_domain, proc_def->db_info.blurb);
if (proc_def->procedure->blurb)
tooltip = dgettext (locale_domain, proc_def->procedure->blurb);
entry.name = proc_def->db_info.name;
entry.name = proc_def->procedure->name;
entry.stock_id = plug_in_proc_def_get_stock_id (proc_def);
entry.label = label;
entry.accelerator = NULL;
@ -308,7 +310,8 @@ plug_in_actions_add_proc (GimpActionGroup *group,
entry.help_id = plug_in_proc_def_get_help_id (proc_def, help_domain);
#if 0
g_print ("adding plug-in action '%s' (%s)\n", proc_def->db_info.name, label);
g_print ("adding plug-in action '%s' (%s)\n",
proc_def->procedure->name, label);
#endif
gimp_action_group_add_plug_in_actions (group, &entry, 1,
@ -375,13 +378,13 @@ plug_in_actions_remove_proc (GimpActionGroup *group,
g_return_if_fail (proc_def != NULL);
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
proc_def->db_info.name);
proc_def->procedure->name);
if (action)
{
#if 0
g_print ("removing plug-in action '%s'\n",
proc_def->db_info.name);
proc_def->procedure->name);
#endif
gtk_action_group_remove_action (GTK_ACTION_GROUP (group), action);

View File

@ -37,6 +37,7 @@
#include "plug-in/plug-in-run.h"
#include "plug-in/plug-in-proc-def.h"
#include "pdb/gimpprocedure.h"
#include "pdb/procedural_db.h"
#include "widgets/gimphelp-ids.h"
@ -75,7 +76,7 @@ plug_in_run_cmd_callback (GtkAction *action,
if (! gimp)
return;
procedure = &proc_def->db_info;
procedure = proc_def->procedure;
args = gimp_procedure_get_arguments (procedure);

View File

@ -30,6 +30,8 @@
#include "core/gimp.h"
#include "pdb/gimpprocedure.h"
#include "plug-in/plug-ins.h"
#include "plug-in/plug-in-def.h"
#include "plug-in/plug-in-proc-def.h"
@ -266,7 +268,7 @@ plug_in_menus_add_proc (GimpUIManager *manager,
*p = '\0';
}
merge_key = g_strdup_printf ("%s-merge-id", proc_def->db_info.name);
merge_key = g_strdup_printf ("%s-merge-id", proc_def->procedure->name);
merge_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (manager),
merge_key));
@ -303,13 +305,13 @@ plug_in_menus_add_proc (GimpUIManager *manager,
#if 0
g_print ("adding menu item for '%s' (@ %s)\n",
proc_def->db_info.name, action_path);
proc_def->procedure->name, action_path);
#endif
gtk_ui_manager_add_ui (GTK_UI_MANAGER (manager), merge_id,
action_path,
proc_def->db_info.name,
proc_def->db_info.name,
proc_def->procedure->name,
proc_def->procedure->name,
GTK_UI_MANAGER_MENUITEM,
FALSE);
@ -327,7 +329,7 @@ plug_in_menus_remove_proc (GimpUIManager *manager,
g_return_if_fail (GIMP_IS_UI_MANAGER (manager));
g_return_if_fail (proc_def != NULL);
merge_key = g_strdup_printf ("%s-merge-id", proc_def->db_info.name);
merge_key = g_strdup_printf ("%s-merge-id", proc_def->procedure->name);
merge_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (manager),
merge_key));
g_free (merge_key);

View File

@ -187,14 +187,12 @@ register_fileops_procs (Gimp *gimp)
procedure = gimp_procedure_init (&file_save_proc, 5, 0);
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
gimp_param_spec_enum ("run-mode",
"run mode",
"The run mode: { GIMP_RUN_INTERACTIVE (0), GIMP_RUN_NONINTERACTIVE (1) }",
GIMP_TYPE_RUN_MODE,
GIMP_RUN_INTERACTIVE,
GIMP_PARAM_READWRITE));
gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->args[0].pspec),
GIMP_RUN_WITH_LAST_VALS);
g_param_spec_enum ("run-mode",
"run mode",
"The run mode: { GIMP_RUN_INTERACTIVE (0), GIMP_RUN_NONINTERACTIVE (1), GIMP_RUN_WITH_LAST_VALS (2) }",
GIMP_TYPE_RUN_MODE,
GIMP_RUN_INTERACTIVE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_IMAGE,
gimp_param_spec_image_id ("image",
@ -502,14 +500,14 @@ file_load_invoker (ProcRecord *proc_record,
for (i = 3; i < proc->num_args; i++)
if (proc->args[i].type == GIMP_PDB_STRING)
g_value_set_string (&new_args[i].value, "");
g_value_set_static_string (&new_args[i].value, "");
return_vals = procedural_db_execute (gimp, context, progress,
proc->name,
new_args, proc->num_args,
&n_return_vals);
procedural_db_destroy_args (new_args, proc->num_args, FALSE);
procedural_db_destroy_args (new_args, proc->num_args, TRUE);
return return_vals;
}
@ -722,14 +720,14 @@ file_save_invoker (ProcRecord *proc_record,
for (i = 5; i < proc->num_args; i++)
if (proc->args[i].type == GIMP_PDB_STRING)
g_value_set_string (&new_args[i].value, "");
g_value_set_static_string (&new_args[i].value, "");
return_vals = procedural_db_execute (gimp, context, progress,
proc->name,
new_args, proc->num_args,
&n_return_vals);
procedural_db_destroy_args (new_args, proc->num_args, FALSE);
procedural_db_destroy_args (new_args, proc->num_args, TRUE);
return return_vals;
}
@ -826,7 +824,9 @@ temp_name_invoker (ProcRecord *proc_record,
extension = (gchar *) g_value_get_string (&args[0].value);
if (success)
{
name = gimp_get_temp_filename (gimp, extension);
}
return_vals = gimp_procedure_get_return_values (proc_record, success);

View File

@ -31,6 +31,7 @@
#include "core/gimp.h"
#include "pdb/gimpprocedure.h"
#include "pdb/procedural_db.h"
#include "plug-in.h"
@ -47,6 +48,8 @@ plug_in_proc_def_new (void)
proc_def->icon_data_length = -1;
proc_def->procedure = gimp_procedure_new ();
return proc_def;
}
@ -57,22 +60,7 @@ plug_in_proc_def_free (PlugInProcDef *proc_def)
g_return_if_fail (proc_def != NULL);
g_free (proc_def->db_info.name);
g_free (proc_def->db_info.original_name);
g_free (proc_def->db_info.blurb);
g_free (proc_def->db_info.help);
g_free (proc_def->db_info.author);
g_free (proc_def->db_info.copyright);
g_free (proc_def->db_info.date);
for (i = 0; i < proc_def->db_info.num_args; i++)
g_param_spec_unref (proc_def->db_info.args[i].pspec);
for (i = 0; i < proc_def->db_info.num_values; i++)
g_param_spec_unref (proc_def->db_info.values[i].pspec);
g_free (proc_def->db_info.args);
g_free (proc_def->db_info.values);
gimp_procedure_free (proc_def->procedure);
g_free (proc_def->prog);
g_free (proc_def->menu_label);
@ -112,7 +100,7 @@ plug_in_proc_def_find (GSList *list,
{
PlugInProcDef *proc_def = l->data;
if (! strcmp (proc_name, proc_def->db_info.name))
if (! strcmp (proc_name, proc_def->procedure->name))
return proc_def;
}
@ -124,7 +112,7 @@ plug_in_proc_def_get_proc (const PlugInProcDef *proc_def)
{
g_return_val_if_fail (proc_def != NULL, NULL);
return &proc_def->db_info;
return proc_def->procedure;
}
const gchar *
@ -132,14 +120,14 @@ plug_in_proc_def_get_progname (const PlugInProcDef *proc_def)
{
g_return_val_if_fail (proc_def != NULL, NULL);
switch (proc_def->db_info.proc_type)
switch (proc_def->procedure->proc_type)
{
case GIMP_PLUGIN:
case GIMP_EXTENSION:
return proc_def->prog;
case GIMP_TEMPORARY:
return ((PlugIn *) proc_def->db_info.exec_method.temporary.plug_in)->prog;
return ((PlugIn *) proc_def->procedure->exec_method.temporary.plug_in)->prog;
default:
break;
@ -276,9 +264,9 @@ plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
g_return_val_if_fail (proc_def != NULL, NULL);
if (help_domain)
return g_strconcat (help_domain, "?", proc_def->db_info.name, NULL);
return g_strconcat (help_domain, "?", proc_def->procedure->name, NULL);
return g_strdup (proc_def->db_info.name);
return g_strdup (proc_def->procedure->name);
}
gboolean

View File

@ -25,8 +25,6 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "pdb/gimpprocedure.h" /* ProcRecord */
struct _PlugInProcDef
{
@ -41,7 +39,8 @@ struct _PlugInProcDef
PlugInImageType image_types_val;
time_t mtime;
gboolean installed_during_init;
ProcRecord db_info;
ProcRecord *procedure;
/* file proc specific members */
gboolean file_proc;

View File

@ -48,6 +48,61 @@
/* public functions */
ProcRecord *
gimp_procedure_new (void)
{
ProcRecord *procedure = g_new0 (ProcRecord, 1);
return procedure;
}
void
gimp_procedure_free (ProcRecord *procedure)
{
gint i;
g_return_if_fail (procedure != NULL);
g_free (procedure->name);
g_free (procedure->original_name);
g_free (procedure->blurb);
g_free (procedure->help);
g_free (procedure->author);
g_free (procedure->copyright);
g_free (procedure->date);
for (i = 0; i < procedure->num_args; i++)
g_param_spec_unref (procedure->args[i].pspec);
for (i = 0; i < procedure->num_values; i++)
g_param_spec_unref (procedure->values[i].pspec);
g_free (procedure->args);
g_free (procedure->values);
g_free (procedure);
}
ProcRecord *
gimp_procedure_init (ProcRecord *procedure,
gint n_arguments,
gint n_return_values)
{
g_return_val_if_fail (procedure != NULL, procedure);
g_return_val_if_fail (procedure->args == NULL, procedure);
g_return_val_if_fail (procedure->values == NULL, procedure);
g_return_val_if_fail (n_arguments >= 0, procedure);
g_return_val_if_fail (n_return_values >= 0, procedure);
procedure->num_args = n_arguments;
procedure->args = g_new0 (ProcArg, n_arguments);
procedure->num_values = n_return_values;
procedure->values = g_new0 (ProcArg, n_return_values);
return procedure;
}
Argument *
gimp_procedure_execute (ProcRecord *procedure,
Gimp *gimp,
@ -86,24 +141,59 @@ gimp_procedure_execute (ProcRecord *procedure,
return return_vals;
}
else if (! (procedure->args[i].pspec->flags & GIMP_PARAM_NO_VALIDATE) &&
g_param_value_validate (procedure->args[i].pspec,
&args[i].value))
else if (! (procedure->args[i].pspec->flags & GIMP_PARAM_NO_VALIDATE))
{
gchar *type_name = procedural_db_type_name (procedure->args[i].type);
GValue string_value = { 0, };
g_message (_("PDB calling error for procedure '%s':\n"
"Argument '%s' (#%d, type %s) out of bounds."),
procedure->name,
g_param_spec_get_name (procedure->args[i].pspec),
i + 1, type_name);
g_value_init (&string_value, G_TYPE_STRING);
g_free (type_name);
if (g_value_type_transformable (args[i].value.g_type,
G_TYPE_STRING))
g_value_transform (&args[i].value, &string_value);
else
g_value_set_static_string (&string_value,
"<not transformable to string>");
return_vals = gimp_procedure_get_return_values (procedure, FALSE);
g_value_set_enum (&return_vals->value, GIMP_PDB_CALLING_ERROR);
if (g_param_value_validate (procedure->args[i].pspec,
&args[i].value))
{
gchar *type_name;
gchar *old_value;
gchar *new_value;
return return_vals;
type_name = procedural_db_type_name (procedure->args[i].type);
old_value = g_value_dup_string (&string_value);
if (g_value_type_transformable (args[i].value.g_type,
G_TYPE_STRING))
g_value_transform (&args[i].value, &string_value);
else
g_value_set_static_string (&string_value,
"<not transformable to string>");
new_value = g_value_dup_string (&string_value);
g_value_unset (&string_value);
g_message (_("PDB calling error for procedure '%s':\n"
"Argument '%s' (#%d, type %s) out of bounds "
"(value '%s' was changed to '%s')"),
procedure->name,
g_param_spec_get_name (procedure->args[i].pspec),
i + 1, type_name,
old_value, new_value);
g_free (type_name);
g_free (old_value);
g_free (new_value);
return_vals = gimp_procedure_get_return_values (procedure, FALSE);
g_value_set_enum (&return_vals->value, GIMP_PDB_CALLING_ERROR);
return return_vals;
}
g_value_unset (&string_value);
}
}
@ -188,26 +278,6 @@ gimp_procedure_get_return_values (const ProcRecord *procedure,
return args;
}
ProcRecord *
gimp_procedure_init (ProcRecord *procedure,
gint n_arguments,
gint n_return_values)
{
g_return_val_if_fail (procedure != NULL, procedure);
g_return_val_if_fail (procedure->args == NULL, procedure);
g_return_val_if_fail (procedure->values == NULL, procedure);
g_return_val_if_fail (n_arguments >= 0, procedure);
g_return_val_if_fail (n_return_values >= 0, procedure);
procedure->num_args = n_arguments;
procedure->args = g_new0 (ProcArg, n_arguments);
procedure->num_values = n_return_values;
procedure->values = g_new0 (ProcArg, n_return_values);
return procedure;
}
void
gimp_procedure_add_argument (ProcRecord *procedure,
GimpPDBArgType arg_type,

View File

@ -95,6 +95,9 @@ struct _ProcRecord
/* Functions */
ProcRecord * gimp_procedure_new (void);
void gimp_procedure_free (ProcRecord *procedure);
ProcRecord * gimp_procedure_init (ProcRecord *procedure,
gint n_arguments,
gint n_return_vals);

View File

@ -36,6 +36,7 @@
#include "core/gimp.h"
#include "core/gimpdrawable.h"
#include "pdb/gimpprocedure.h"
#include "pdb/procedural_db.h"
#include "plug-in.h"
@ -737,7 +738,7 @@ plug_in_handle_proc_install (PlugIn *plug_in,
/* The procedural database procedure */
proc = &proc_def->db_info;
proc = proc_def->procedure;
proc->name = canonical;
proc->original_name = g_strdup (proc_install->name);

View File

@ -76,6 +76,8 @@
#include "core/gimpinterpreterdb.h"
#include "core/gimpprogress.h"
#include "pdb/gimpprocedure.h"
#include "plug-in.h"
#include "plug-ins.h"
#include "plug-in-debug.h"
@ -1054,10 +1056,10 @@ plug_in_menu_register (PlugIn *plug_in,
plug_in->prog,
proc_name,
menu_path,
proc_def->db_info.args,
proc_def->db_info.num_args,
proc_def->db_info.values,
proc_def->db_info.num_values,
proc_def->procedure->args,
proc_def->procedure->num_args,
proc_def->procedure->values,
proc_def->procedure->num_values,
&error))
{
g_message (error->message);
@ -1066,7 +1068,7 @@ plug_in_menu_register (PlugIn *plug_in,
return FALSE;
}
switch (proc_def->db_info.proc_type)
switch (proc_def->procedure->proc_type)
{
case GIMP_INTERNAL:
return FALSE;
@ -1083,7 +1085,7 @@ plug_in_menu_register (PlugIn *plug_in,
proc_def->menu_paths = g_list_append (proc_def->menu_paths,
g_strdup (menu_path));
if (proc_def->db_info.proc_type == GIMP_TEMPORARY
if (proc_def->procedure->proc_type == GIMP_TEMPORARY
&& ! plug_in->gimp->no_interface)
{
gimp_menus_create_item (plug_in->gimp, proc_def, menu_path);

View File

@ -38,6 +38,7 @@
#include "core/gimpcontext.h"
#include "core/gimpprogress.h"
#include "pdb/gimpprocedure.h"
#include "pdb/procedural_db.h"
#include "plug-in.h"
@ -220,8 +221,7 @@ plug_in_repeat (Gimp *gimp,
if (proc_def)
{
/* construct the procedures arguments */
args = gimp_procedure_get_arguments (&proc_def->db_info);
args = gimp_procedure_get_arguments (proc_def->procedure);
g_value_set_int (&args[0].value,
with_interface ?
@ -230,11 +230,11 @@ plug_in_repeat (Gimp *gimp,
g_value_set_int (&args[2].value, drawable_ID);
/* run the plug-in procedure */
plug_in_run (gimp, context, progress, &proc_def->db_info,
args, 3 /* not proc_def->db_info.num_args */,
plug_in_run (gimp, context, progress, proc_def->procedure,
args, 3 /* not proc_def->procedure->num_args */,
FALSE, TRUE, display_ID);
procedural_db_destroy_args (args, proc_def->db_info.num_args, TRUE);
procedural_db_destroy_args (args, proc_def->procedure->num_args, TRUE);
}
}

View File

@ -36,6 +36,7 @@
#include "core/gimp.h"
#include "pdb/gimpprocedure.h"
#include "pdb/procedural_db.h"
#include "plug-in-proc-def.h"
@ -135,7 +136,7 @@ plug_ins_query (Gimp *gimp,
for (list = matched; list; list = g_slist_next (list))
{
PlugInProcDef *proc_def = list->data;
ProcRecord *proc_rec = &proc_def->db_info;
ProcRecord *proc_rec = proc_def->procedure;
gchar *name;
if (proc_def->menu_label)

View File

@ -38,6 +38,7 @@
#include "core/gimpcontext.h"
#include "core/gimpprogress.h"
#include "pdb/gimpprocedure.h"
#include "pdb/procedural_db.h"
#include "plug-in.h"
@ -220,8 +221,7 @@ plug_in_repeat (Gimp *gimp,
if (proc_def)
{
/* construct the procedures arguments */
args = gimp_procedure_get_arguments (&proc_def->db_info);
args = gimp_procedure_get_arguments (proc_def->procedure);
g_value_set_int (&args[0].value,
with_interface ?
@ -230,11 +230,11 @@ plug_in_repeat (Gimp *gimp,
g_value_set_int (&args[2].value, drawable_ID);
/* run the plug-in procedure */
plug_in_run (gimp, context, progress, &proc_def->db_info,
args, 3 /* not proc_def->db_info.num_args */,
plug_in_run (gimp, context, progress, proc_def->procedure,
args, 3 /* not proc_def->procedure->num_args */,
FALSE, TRUE, display_ID);
procedural_db_destroy_args (args, proc_def->db_info.num_args, TRUE);
procedural_db_destroy_args (args, proc_def->procedure->num_args, TRUE);
}
}

View File

@ -38,6 +38,7 @@
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "pdb/gimpprocedure.h"
#include "pdb/procedural_db.h"
#include "plug-in.h"
@ -244,7 +245,7 @@ plug_ins_init (Gimp *gimp,
g_printerr ("removing duplicate PDB procedure \"%s\" "
"registered by '%s'\n",
overridden_proc_def->db_info.name,
overridden_proc_def->procedure->name,
gimp_filename_to_utf8 (overridden_proc_def->prog));
/* search the plugin list to see if any plugins had references to
@ -325,9 +326,9 @@ plug_ins_init (Gimp *gimp,
{
PlugInProcDef *proc_def = list->data;
if (proc_def->prog &&
proc_def->db_info.proc_type == GIMP_EXTENSION &&
proc_def->db_info.num_args == 0)
if (proc_def->prog &&
proc_def->procedure->proc_type == GIMP_EXTENSION &&
proc_def->procedure->num_args == 0)
{
extensions = g_list_prepend (extensions, proc_def);
}
@ -348,12 +349,13 @@ plug_ins_init (Gimp *gimp,
PlugInProcDef *proc_def = list->data;
if (gimp->be_verbose)
g_print (_("Starting extension: '%s'\n"), proc_def->db_info.name);
g_print (_("Starting extension: '%s'\n"),
proc_def->procedure->name);
status_callback (NULL, proc_def->db_info.name,
status_callback (NULL, proc_def->procedure->name,
(gdouble) nth / (gdouble) n_extensions);
plug_in_run (gimp, context, NULL, &proc_def->db_info,
plug_in_run (gimp, context, NULL, proc_def->procedure,
NULL, 0, FALSE, TRUE, -1);
}
@ -646,7 +648,7 @@ plug_ins_temp_proc_def_add (Gimp *gimp,
}
/* Register the procedural database entry */
procedural_db_register (gimp, &proc_def->db_info);
procedural_db_register (gimp, proc_def->procedure);
/* Add the definition to the global list */
gimp->plug_in_proc_defs = g_slist_prepend (gimp->plug_in_proc_defs, proc_def);
@ -666,7 +668,7 @@ plug_ins_temp_proc_def_remove (Gimp *gimp,
}
/* Unregister the procedural database entry */
procedural_db_unregister (gimp, proc_def->db_info.name);
procedural_db_unregister (gimp, proc_def->procedure->name);
/* Remove the definition from the global list */
gimp->plug_in_proc_defs = g_slist_remove (gimp->plug_in_proc_defs, proc_def);
@ -868,7 +870,7 @@ plug_ins_proc_def_find (Gimp *gimp,
{
PlugInProcDef *proc_def = list->data;
if (proc_rec == &proc_def->db_info)
if (proc_rec == proc_def->procedure)
return proc_def;
}
@ -1044,10 +1046,10 @@ plug_ins_add_to_db (Gimp *gimp,
{
proc_def = list->data;
if (proc_def->prog && (proc_def->db_info.proc_type != GIMP_INTERNAL))
if (proc_def->prog && (proc_def->procedure->proc_type != GIMP_INTERNAL))
{
proc_def->db_info.exec_method.plug_in.filename = proc_def->prog;
procedural_db_register (gimp, &proc_def->db_info);
proc_def->procedure->exec_method.plug_in.filename = proc_def->prog;
procedural_db_register (gimp, proc_def->procedure);
}
}
@ -1066,7 +1068,7 @@ plug_ins_add_to_db (Gimp *gimp,
procedural_db_run_proc (gimp, context, NULL,
"gimp-register-save-handler",
&n_return_vals,
GIMP_PDB_STRING, proc_def->db_info.name,
GIMP_PDB_STRING, proc_def->procedure->name,
GIMP_PDB_STRING, proc_def->extensions,
GIMP_PDB_STRING, proc_def->prefixes,
GIMP_PDB_END);
@ -1077,7 +1079,7 @@ plug_ins_add_to_db (Gimp *gimp,
procedural_db_run_proc (gimp, context, NULL,
"gimp-register-magic-load-handler",
&n_return_vals,
GIMP_PDB_STRING, proc_def->db_info.name,
GIMP_PDB_STRING, proc_def->procedure->name,
GIMP_PDB_STRING, proc_def->extensions,
GIMP_PDB_STRING, proc_def->prefixes,
GIMP_PDB_STRING, proc_def->magics,
@ -1099,7 +1101,7 @@ plug_ins_proc_def_insert (Gimp *gimp,
{
PlugInProcDef *tmp_proc_def = list->data;
if (strcmp (proc_def->db_info.name, tmp_proc_def->db_info.name) == 0)
if (strcmp (proc_def->procedure->name, tmp_proc_def->procedure->name) == 0)
{
list->data = proc_def;

View File

@ -31,6 +31,7 @@
#include "core/gimp.h"
#include "pdb/gimpprocedure.h"
#include "pdb/procedural_db.h"
#include "plug-in.h"
@ -47,6 +48,8 @@ plug_in_proc_def_new (void)
proc_def->icon_data_length = -1;
proc_def->procedure = gimp_procedure_new ();
return proc_def;
}
@ -57,22 +60,7 @@ plug_in_proc_def_free (PlugInProcDef *proc_def)
g_return_if_fail (proc_def != NULL);
g_free (proc_def->db_info.name);
g_free (proc_def->db_info.original_name);
g_free (proc_def->db_info.blurb);
g_free (proc_def->db_info.help);
g_free (proc_def->db_info.author);
g_free (proc_def->db_info.copyright);
g_free (proc_def->db_info.date);
for (i = 0; i < proc_def->db_info.num_args; i++)
g_param_spec_unref (proc_def->db_info.args[i].pspec);
for (i = 0; i < proc_def->db_info.num_values; i++)
g_param_spec_unref (proc_def->db_info.values[i].pspec);
g_free (proc_def->db_info.args);
g_free (proc_def->db_info.values);
gimp_procedure_free (proc_def->procedure);
g_free (proc_def->prog);
g_free (proc_def->menu_label);
@ -112,7 +100,7 @@ plug_in_proc_def_find (GSList *list,
{
PlugInProcDef *proc_def = l->data;
if (! strcmp (proc_name, proc_def->db_info.name))
if (! strcmp (proc_name, proc_def->procedure->name))
return proc_def;
}
@ -124,7 +112,7 @@ plug_in_proc_def_get_proc (const PlugInProcDef *proc_def)
{
g_return_val_if_fail (proc_def != NULL, NULL);
return &proc_def->db_info;
return proc_def->procedure;
}
const gchar *
@ -132,14 +120,14 @@ plug_in_proc_def_get_progname (const PlugInProcDef *proc_def)
{
g_return_val_if_fail (proc_def != NULL, NULL);
switch (proc_def->db_info.proc_type)
switch (proc_def->procedure->proc_type)
{
case GIMP_PLUGIN:
case GIMP_EXTENSION:
return proc_def->prog;
case GIMP_TEMPORARY:
return ((PlugIn *) proc_def->db_info.exec_method.temporary.plug_in)->prog;
return ((PlugIn *) proc_def->procedure->exec_method.temporary.plug_in)->prog;
default:
break;
@ -276,9 +264,9 @@ plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
g_return_val_if_fail (proc_def != NULL, NULL);
if (help_domain)
return g_strconcat (help_domain, "?", proc_def->db_info.name, NULL);
return g_strconcat (help_domain, "?", proc_def->procedure->name, NULL);
return g_strdup (proc_def->db_info.name);
return g_strdup (proc_def->procedure->name);
}
gboolean

View File

@ -25,8 +25,6 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "pdb/gimpprocedure.h" /* ProcRecord */
struct _PlugInProcDef
{
@ -41,7 +39,8 @@ struct _PlugInProcDef
PlugInImageType image_types_val;
time_t mtime;
gboolean installed_during_init;
ProcRecord db_info;
ProcRecord *procedure;
/* file proc specific members */
gboolean file_proc;

View File

@ -36,6 +36,7 @@
#include "core/gimp.h"
#include "core/gimpdrawable.h"
#include "pdb/gimpprocedure.h"
#include "pdb/procedural_db.h"
#include "plug-in.h"
@ -737,7 +738,7 @@ plug_in_handle_proc_install (PlugIn *plug_in,
/* The procedural database procedure */
proc = &proc_def->db_info;
proc = proc_def->procedure;
proc->name = canonical;
proc->original_name = g_strdup (proc_install->name);

View File

@ -31,6 +31,7 @@
#include "core/gimp.h"
#include "pdb/gimpprocedure.h"
#include "pdb/procedural_db.h"
#include "plug-in.h"
@ -47,6 +48,8 @@ plug_in_proc_def_new (void)
proc_def->icon_data_length = -1;
proc_def->procedure = gimp_procedure_new ();
return proc_def;
}
@ -57,22 +60,7 @@ plug_in_proc_def_free (PlugInProcDef *proc_def)
g_return_if_fail (proc_def != NULL);
g_free (proc_def->db_info.name);
g_free (proc_def->db_info.original_name);
g_free (proc_def->db_info.blurb);
g_free (proc_def->db_info.help);
g_free (proc_def->db_info.author);
g_free (proc_def->db_info.copyright);
g_free (proc_def->db_info.date);
for (i = 0; i < proc_def->db_info.num_args; i++)
g_param_spec_unref (proc_def->db_info.args[i].pspec);
for (i = 0; i < proc_def->db_info.num_values; i++)
g_param_spec_unref (proc_def->db_info.values[i].pspec);
g_free (proc_def->db_info.args);
g_free (proc_def->db_info.values);
gimp_procedure_free (proc_def->procedure);
g_free (proc_def->prog);
g_free (proc_def->menu_label);
@ -112,7 +100,7 @@ plug_in_proc_def_find (GSList *list,
{
PlugInProcDef *proc_def = l->data;
if (! strcmp (proc_name, proc_def->db_info.name))
if (! strcmp (proc_name, proc_def->procedure->name))
return proc_def;
}
@ -124,7 +112,7 @@ plug_in_proc_def_get_proc (const PlugInProcDef *proc_def)
{
g_return_val_if_fail (proc_def != NULL, NULL);
return &proc_def->db_info;
return proc_def->procedure;
}
const gchar *
@ -132,14 +120,14 @@ plug_in_proc_def_get_progname (const PlugInProcDef *proc_def)
{
g_return_val_if_fail (proc_def != NULL, NULL);
switch (proc_def->db_info.proc_type)
switch (proc_def->procedure->proc_type)
{
case GIMP_PLUGIN:
case GIMP_EXTENSION:
return proc_def->prog;
case GIMP_TEMPORARY:
return ((PlugIn *) proc_def->db_info.exec_method.temporary.plug_in)->prog;
return ((PlugIn *) proc_def->procedure->exec_method.temporary.plug_in)->prog;
default:
break;
@ -276,9 +264,9 @@ plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
g_return_val_if_fail (proc_def != NULL, NULL);
if (help_domain)
return g_strconcat (help_domain, "?", proc_def->db_info.name, NULL);
return g_strconcat (help_domain, "?", proc_def->procedure->name, NULL);
return g_strdup (proc_def->db_info.name);
return g_strdup (proc_def->procedure->name);
}
gboolean

View File

@ -25,8 +25,6 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "pdb/gimpprocedure.h" /* ProcRecord */
struct _PlugInProcDef
{
@ -41,7 +39,8 @@ struct _PlugInProcDef
PlugInImageType image_types_val;
time_t mtime;
gboolean installed_during_init;
ProcRecord db_info;
ProcRecord *procedure;
/* file proc specific members */
gboolean file_proc;

View File

@ -31,6 +31,7 @@
#include "core/gimp.h"
#include "pdb/gimpprocedure.h"
#include "pdb/procedural_db.h"
#include "plug-ins.h"
@ -313,29 +314,31 @@ plug_in_proc_def_deserialize (GScanner *scanner,
Gimp *gimp,
PlugInProcDef *proc_def)
{
GTokenType token;
gint n_args;
gint n_return_vals;
gint n_menu_paths;
gint i;
ProcRecord *procedure;
GTokenType token;
gint n_args;
gint n_return_vals;
gint n_menu_paths;
gint i;
if (! gimp_scanner_parse_string (scanner, &proc_def->db_info.original_name))
procedure = proc_def->procedure;
if (! gimp_scanner_parse_string (scanner, &procedure->original_name))
return G_TOKEN_STRING;
proc_def->db_info.name =
gimp_canonicalize_identifier (proc_def->db_info.original_name);
procedure->name = gimp_canonicalize_identifier (procedure->original_name);
if (! gimp_scanner_parse_int (scanner, (gint *) &proc_def->db_info.proc_type))
if (! gimp_scanner_parse_int (scanner, (gint *) &procedure->proc_type))
return G_TOKEN_INT;
if (! gimp_scanner_parse_string (scanner, &proc_def->db_info.blurb))
if (! gimp_scanner_parse_string (scanner, &procedure->blurb))
return G_TOKEN_STRING;
if (! gimp_scanner_parse_string (scanner, &proc_def->db_info.help))
if (! gimp_scanner_parse_string (scanner, &procedure->help))
return G_TOKEN_STRING;
if (! gimp_scanner_parse_string (scanner, &proc_def->db_info.author))
if (! gimp_scanner_parse_string (scanner, &procedure->author))
return G_TOKEN_STRING;
if (! gimp_scanner_parse_string (scanner, &proc_def->db_info.copyright))
if (! gimp_scanner_parse_string (scanner, &procedure->copyright))
return G_TOKEN_STRING;
if (! gimp_scanner_parse_string (scanner, &proc_def->db_info.date))
if (! gimp_scanner_parse_string (scanner, &procedure->date))
return G_TOKEN_STRING;
if (! gimp_scanner_parse_string (scanner, &proc_def->menu_label))
return G_TOKEN_STRING;
@ -369,20 +372,18 @@ plug_in_proc_def_deserialize (GScanner *scanner,
if (! gimp_scanner_parse_int (scanner, (gint *) &n_return_vals))
return G_TOKEN_INT;
gimp_procedure_init (&proc_def->db_info, n_args, n_return_vals);
gimp_procedure_init (procedure, n_args, n_return_vals);
for (i = 0; i < n_args; i++)
{
token = plug_in_proc_arg_deserialize (scanner, gimp,
&proc_def->db_info, FALSE);
token = plug_in_proc_arg_deserialize (scanner, gimp, procedure, FALSE);
if (token != G_TOKEN_LEFT_PAREN)
return token;
}
for (i = 0; i < n_return_vals; i++)
{
token = plug_in_proc_arg_deserialize (scanner, gimp,
&proc_def->db_info, TRUE);
token = plug_in_proc_arg_deserialize (scanner, gimp, procedure, TRUE);
if (token != G_TOKEN_LEFT_PAREN)
return token;
}
@ -490,7 +491,7 @@ plug_in_icon_deserialize (GScanner *scanner,
if (! gimp_scanner_parse_string_no_validate (scanner, &icon_name))
return G_TOKEN_STRING;
icon_data = icon_name;
icon_data = (guint8 *) icon_name;
break;
case GIMP_ICON_TYPE_INLINE_PIXBUF:
@ -504,7 +505,7 @@ plug_in_icon_deserialize (GScanner *scanner,
proc_def->icon_type = icon_type;
proc_def->icon_data_length = icon_data_length;
proc_def->icon_data = icon_data;
proc_def->icon_data = (gchar *) icon_data;
if (! gimp_scanner_parse_token (scanner, G_TOKEN_RIGHT_PAREN))
return G_TOKEN_RIGHT_PAREN;
@ -730,12 +731,7 @@ plug_in_rc_write (GSList *plug_in_defs,
{
GimpConfigWriter *writer;
GEnumClass *enum_class;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
GSList *list;
GSList *list2;
GList *list3;
gint i;
writer = gimp_config_writer_new_file (filename,
FALSE,
@ -756,37 +752,41 @@ plug_in_rc_write (GSList *plug_in_defs,
for (list = plug_in_defs; list; list = list->next)
{
plug_in_def = list->data;
PlugInDef *plug_in_def = list->data;
if (plug_in_def->proc_defs)
{
GSList *list2;
gimp_config_writer_open (writer, "plug-in-def");
gimp_config_writer_string (writer, plug_in_def->prog);
gimp_config_writer_printf (writer, "%ld", plug_in_def->mtime);
for (list2 = plug_in_def->proc_defs; list2; list2 = list2->next)
{
GEnumValue *enum_value;
proc_def = list2->data;
PlugInProcDef *proc_def = list2->data;
ProcRecord *procedure = proc_def->procedure;
GEnumValue *enum_value;
GList *list3;
gint i;
if (proc_def->installed_during_init)
continue;
gimp_config_writer_open (writer, "proc-def");
gimp_config_writer_printf (writer, "\"%s\" %d",
proc_def->db_info.original_name,
proc_def->db_info.proc_type);
procedure->original_name,
procedure->proc_type);
gimp_config_writer_linefeed (writer);
gimp_config_writer_string (writer, proc_def->db_info.blurb);
gimp_config_writer_string (writer, procedure->blurb);
gimp_config_writer_linefeed (writer);
gimp_config_writer_string (writer, proc_def->db_info.help);
gimp_config_writer_string (writer, procedure->help);
gimp_config_writer_linefeed (writer);
gimp_config_writer_string (writer, proc_def->db_info.author);
gimp_config_writer_string (writer, procedure->author);
gimp_config_writer_linefeed (writer);
gimp_config_writer_string (writer, proc_def->db_info.copyright);
gimp_config_writer_string (writer, procedure->copyright);
gimp_config_writer_linefeed (writer);
gimp_config_writer_string (writer, proc_def->db_info.date);
gimp_config_writer_string (writer, procedure->date);
gimp_config_writer_linefeed (writer);
gimp_config_writer_string (writer, proc_def->menu_label);
gimp_config_writer_linefeed (writer);
@ -815,7 +815,7 @@ plug_in_rc_write (GSList *plug_in_defs,
case GIMP_ICON_TYPE_INLINE_PIXBUF:
gimp_config_writer_data (writer, proc_def->icon_data_length,
proc_def->icon_data);
(guint8 *) proc_def->icon_data);
break;
}
@ -876,33 +876,33 @@ plug_in_rc_write (GSList *plug_in_defs,
gimp_config_writer_linefeed (writer);
gimp_config_writer_printf (writer, "%d %d",
proc_def->db_info.num_args,
proc_def->db_info.num_values);
procedure->num_args,
procedure->num_values);
for (i = 0; i < proc_def->db_info.num_args; i++)
for (i = 0; i < procedure->num_args; i++)
{
gimp_config_writer_open (writer, "proc-arg");
gimp_config_writer_printf (writer, "%d",
proc_def->db_info.args[i].type);
procedure->args[i].type);
gimp_config_writer_string (writer,
g_param_spec_get_name (proc_def->db_info.args[i].pspec));
g_param_spec_get_name (procedure->args[i].pspec));
gimp_config_writer_string (writer,
g_param_spec_get_blurb (proc_def->db_info.args[i].pspec));
g_param_spec_get_blurb (procedure->args[i].pspec));
gimp_config_writer_close (writer);
}
for (i = 0; i < proc_def->db_info.num_values; i++)
for (i = 0; i < procedure->num_values; i++)
{
gimp_config_writer_open (writer, "proc-arg");
gimp_config_writer_printf (writer, "%d",
proc_def->db_info.values[i].type);
procedure->values[i].type);
gimp_config_writer_string (writer,
g_param_spec_get_name (proc_def->db_info.values[i].pspec));
g_param_spec_get_name (procedure->values[i].pspec));
gimp_config_writer_string (writer,
g_param_spec_get_blurb (proc_def->db_info.values[i].pspec));
g_param_spec_get_blurb (procedure->values[i].pspec));
gimp_config_writer_close (writer);
}

View File

@ -38,6 +38,7 @@
#include "core/gimpcontext.h"
#include "core/gimpprogress.h"
#include "pdb/gimpprocedure.h"
#include "pdb/procedural_db.h"
#include "plug-in.h"
@ -220,8 +221,7 @@ plug_in_repeat (Gimp *gimp,
if (proc_def)
{
/* construct the procedures arguments */
args = gimp_procedure_get_arguments (&proc_def->db_info);
args = gimp_procedure_get_arguments (proc_def->procedure);
g_value_set_int (&args[0].value,
with_interface ?
@ -230,11 +230,11 @@ plug_in_repeat (Gimp *gimp,
g_value_set_int (&args[2].value, drawable_ID);
/* run the plug-in procedure */
plug_in_run (gimp, context, progress, &proc_def->db_info,
args, 3 /* not proc_def->db_info.num_args */,
plug_in_run (gimp, context, progress, proc_def->procedure,
args, 3 /* not proc_def->procedure->num_args */,
FALSE, TRUE, display_ID);
procedural_db_destroy_args (args, proc_def->db_info.num_args, TRUE);
procedural_db_destroy_args (args, proc_def->procedure->num_args, TRUE);
}
}

View File

@ -76,6 +76,8 @@
#include "core/gimpinterpreterdb.h"
#include "core/gimpprogress.h"
#include "pdb/gimpprocedure.h"
#include "plug-in.h"
#include "plug-ins.h"
#include "plug-in-debug.h"
@ -1054,10 +1056,10 @@ plug_in_menu_register (PlugIn *plug_in,
plug_in->prog,
proc_name,
menu_path,
proc_def->db_info.args,
proc_def->db_info.num_args,
proc_def->db_info.values,
proc_def->db_info.num_values,
proc_def->procedure->args,
proc_def->procedure->num_args,
proc_def->procedure->values,
proc_def->procedure->num_values,
&error))
{
g_message (error->message);
@ -1066,7 +1068,7 @@ plug_in_menu_register (PlugIn *plug_in,
return FALSE;
}
switch (proc_def->db_info.proc_type)
switch (proc_def->procedure->proc_type)
{
case GIMP_INTERNAL:
return FALSE;
@ -1083,7 +1085,7 @@ plug_in_menu_register (PlugIn *plug_in,
proc_def->menu_paths = g_list_append (proc_def->menu_paths,
g_strdup (menu_path));
if (proc_def->db_info.proc_type == GIMP_TEMPORARY
if (proc_def->procedure->proc_type == GIMP_TEMPORARY
&& ! plug_in->gimp->no_interface)
{
gimp_menus_create_item (plug_in->gimp, proc_def, menu_path);

View File

@ -36,6 +36,7 @@
#include "core/gimp.h"
#include "pdb/gimpprocedure.h"
#include "pdb/procedural_db.h"
#include "plug-in-proc-def.h"
@ -135,7 +136,7 @@ plug_ins_query (Gimp *gimp,
for (list = matched; list; list = g_slist_next (list))
{
PlugInProcDef *proc_def = list->data;
ProcRecord *proc_rec = &proc_def->db_info;
ProcRecord *proc_rec = proc_def->procedure;
gchar *name;
if (proc_def->menu_label)

View File

@ -38,6 +38,7 @@
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "pdb/gimpprocedure.h"
#include "pdb/procedural_db.h"
#include "plug-in.h"
@ -244,7 +245,7 @@ plug_ins_init (Gimp *gimp,
g_printerr ("removing duplicate PDB procedure \"%s\" "
"registered by '%s'\n",
overridden_proc_def->db_info.name,
overridden_proc_def->procedure->name,
gimp_filename_to_utf8 (overridden_proc_def->prog));
/* search the plugin list to see if any plugins had references to
@ -325,9 +326,9 @@ plug_ins_init (Gimp *gimp,
{
PlugInProcDef *proc_def = list->data;
if (proc_def->prog &&
proc_def->db_info.proc_type == GIMP_EXTENSION &&
proc_def->db_info.num_args == 0)
if (proc_def->prog &&
proc_def->procedure->proc_type == GIMP_EXTENSION &&
proc_def->procedure->num_args == 0)
{
extensions = g_list_prepend (extensions, proc_def);
}
@ -348,12 +349,13 @@ plug_ins_init (Gimp *gimp,
PlugInProcDef *proc_def = list->data;
if (gimp->be_verbose)
g_print (_("Starting extension: '%s'\n"), proc_def->db_info.name);
g_print (_("Starting extension: '%s'\n"),
proc_def->procedure->name);
status_callback (NULL, proc_def->db_info.name,
status_callback (NULL, proc_def->procedure->name,
(gdouble) nth / (gdouble) n_extensions);
plug_in_run (gimp, context, NULL, &proc_def->db_info,
plug_in_run (gimp, context, NULL, proc_def->procedure,
NULL, 0, FALSE, TRUE, -1);
}
@ -646,7 +648,7 @@ plug_ins_temp_proc_def_add (Gimp *gimp,
}
/* Register the procedural database entry */
procedural_db_register (gimp, &proc_def->db_info);
procedural_db_register (gimp, proc_def->procedure);
/* Add the definition to the global list */
gimp->plug_in_proc_defs = g_slist_prepend (gimp->plug_in_proc_defs, proc_def);
@ -666,7 +668,7 @@ plug_ins_temp_proc_def_remove (Gimp *gimp,
}
/* Unregister the procedural database entry */
procedural_db_unregister (gimp, proc_def->db_info.name);
procedural_db_unregister (gimp, proc_def->procedure->name);
/* Remove the definition from the global list */
gimp->plug_in_proc_defs = g_slist_remove (gimp->plug_in_proc_defs, proc_def);
@ -868,7 +870,7 @@ plug_ins_proc_def_find (Gimp *gimp,
{
PlugInProcDef *proc_def = list->data;
if (proc_rec == &proc_def->db_info)
if (proc_rec == proc_def->procedure)
return proc_def;
}
@ -1044,10 +1046,10 @@ plug_ins_add_to_db (Gimp *gimp,
{
proc_def = list->data;
if (proc_def->prog && (proc_def->db_info.proc_type != GIMP_INTERNAL))
if (proc_def->prog && (proc_def->procedure->proc_type != GIMP_INTERNAL))
{
proc_def->db_info.exec_method.plug_in.filename = proc_def->prog;
procedural_db_register (gimp, &proc_def->db_info);
proc_def->procedure->exec_method.plug_in.filename = proc_def->prog;
procedural_db_register (gimp, proc_def->procedure);
}
}
@ -1066,7 +1068,7 @@ plug_ins_add_to_db (Gimp *gimp,
procedural_db_run_proc (gimp, context, NULL,
"gimp-register-save-handler",
&n_return_vals,
GIMP_PDB_STRING, proc_def->db_info.name,
GIMP_PDB_STRING, proc_def->procedure->name,
GIMP_PDB_STRING, proc_def->extensions,
GIMP_PDB_STRING, proc_def->prefixes,
GIMP_PDB_END);
@ -1077,7 +1079,7 @@ plug_ins_add_to_db (Gimp *gimp,
procedural_db_run_proc (gimp, context, NULL,
"gimp-register-magic-load-handler",
&n_return_vals,
GIMP_PDB_STRING, proc_def->db_info.name,
GIMP_PDB_STRING, proc_def->procedure->name,
GIMP_PDB_STRING, proc_def->extensions,
GIMP_PDB_STRING, proc_def->prefixes,
GIMP_PDB_STRING, proc_def->magics,
@ -1099,7 +1101,7 @@ plug_ins_proc_def_insert (Gimp *gimp,
{
PlugInProcDef *tmp_proc_def = list->data;
if (strcmp (proc_def->db_info.name, tmp_proc_def->db_info.name) == 0)
if (strcmp (proc_def->procedure->name, tmp_proc_def->procedure->name) == 0)
{
list->data = proc_def;

View File

@ -64,6 +64,23 @@ static Argument * xcf_save_invoker (ProcRecord *procedure,
Argument *args);
static ProcRecord xcf_load_procedure =
{
"gimp-xcf-load",
"gimp-xcf-load",
"loads file saved in the .xcf file format",
"The xcf file format has been designed specifically for loading and "
"saving tiled and layered images in the GIMP. This procedure will load "
"the specified file.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { xcf_load_invoker } }
};
static PlugInProcDef xcf_plug_in_load_proc =
{
"gimp-xcf-load",
@ -76,21 +93,7 @@ static PlugInProcDef xcf_plug_in_load_proc =
0, /* ignored for load */
0,
FALSE,
{
"gimp-xcf-load",
"gimp-xcf-load",
"loads file saved in the .xcf file format",
"The xcf file format has been designed specifically for loading and "
"saving tiled and layered images in the GIMP. This procedure will load "
"the specified file.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { xcf_load_invoker } },
},
&xcf_load_procedure,
TRUE,
"xcf",
"",
@ -101,6 +104,23 @@ static PlugInProcDef xcf_plug_in_load_proc =
NULL /* fill me in at runtime */
};
static ProcRecord xcf_save_procedure =
{
"gimp-xcf-save",
"gimp-xcf-save",
"saves file in the .xcf file format",
"The xcf file format has been designed specifically for loading and "
"saving tiled and layered images in the GIMP. This procedure will save "
"the specified image in the xcf file format.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { xcf_save_invoker } }
};
static PlugInProcDef xcf_plug_in_save_proc =
{
"gimp-xcf-save",
@ -113,21 +133,7 @@ static PlugInProcDef xcf_plug_in_save_proc =
0, /* fill me in at runtime */
0,
FALSE,
{
"gimp-xcf-save",
"gimp-xcf-save",
"saves file in the .xcf file format",
"The xcf file format has been designed specifically for loading and "
"saving tiled and layered images in the GIMP. This procedure will save "
"the specified image in the xcf file format.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { xcf_save_invoker } },
},
&xcf_save_procedure,
TRUE,
"xcf",
"",
@ -162,7 +168,7 @@ xcf_init (Gimp *gimp)
* though they are internal. The only thing it requires is using a
* PlugInProcDef struct. -josh
*/
procedure = gimp_procedure_init (&xcf_plug_in_save_proc.db_info, 5, 0);
procedure = gimp_procedure_init (&xcf_save_procedure, 5, 0);
gimp_procedure_add_compat_arg (procedure, gimp,
GIMP_PDB_INT32,
"dummy-param",
@ -189,7 +195,7 @@ xcf_init (Gimp *gimp)
plug_ins_image_types_parse (xcf_plug_in_save_proc.image_types);
plug_ins_add_internal (gimp, &xcf_plug_in_save_proc);
procedure = gimp_procedure_init (&xcf_plug_in_load_proc.db_info, 3, 1);
procedure = gimp_procedure_init (&xcf_load_procedure, 3, 1);
gimp_procedure_add_compat_arg (procedure, gimp,
GIMP_PDB_INT32,
"dummy-param",
@ -318,7 +324,7 @@ xcf_save_invoker (ProcRecord *procedure,
Argument *return_vals;
GimpImage *image;
const gchar *filename;
gboolean success = FALSE;
gboolean success = FALSE;
gimp_set_busy (gimp);

View File

@ -82,14 +82,14 @@ HELP
for (i = 3; i < proc->num_args; i++)
if (proc->args[i].type == GIMP_PDB_STRING)
g_value_set_string (&new_args[i].value, "");
g_value_set_static_string (&new_args[i].value, "");
return_vals = procedural_db_execute (gimp, context, progress,
proc->name,
new_args, proc->num_args,
&n_return_vals);
procedural_db_destroy_args (new_args, proc->num_args, FALSE);
procedural_db_destroy_args (new_args, proc->num_args, TRUE);
return return_vals;
}
@ -161,8 +161,7 @@ HELP
&josh_pdb_misc('1997');
@inargs = (
{ name => 'run_mode',
type => 'enum GimpRunMode (no GIMP_RUN_WITH_LAST_VALS)',
{ name => 'run_mode', type => 'enum GimpRunMode',
desc => 'The run mode: %%desc%%' },
{ name => 'image', type => 'image',
desc => 'Input image' },
@ -174,7 +173,6 @@ HELP
desc => 'The name as entered by the user' }
);
%invoke = (
headers => [ qw(<string.h>) ],
no_marshalling => 1,
@ -211,14 +209,14 @@ HELP
for (i = 5; i < proc->num_args; i++)
if (proc->args[i].type == GIMP_PDB_STRING)
g_value_set_string (&new_args[i].value, "");
g_value_set_static_string (&new_args[i].value, "");
return_vals = procedural_db_execute (gimp, context, progress,
proc->name,
new_args, proc->num_args,
&n_return_vals);
procedural_db_destroy_args (new_args, proc->num_args, FALSE);
procedural_db_destroy_args (new_args, proc->num_args, TRUE);
return return_vals;
}
@ -388,7 +386,9 @@ HELP
%invoke = (
headers => [ qw("core/gimp-utils.h") ],
code => <<'CODE'
{
name = gimp_get_temp_filename (gimp, extension);
}
CODE
);
}