Changed plug-in menu registration again to allow passing just the menu

2004-05-07  Michael Natterer  <mitch@gimp.org>

	Changed plug-in menu registration again to allow passing just the
	menu item's label (not the full path) in gimp_install_procedure()
	and only the path (excluding the item's label) in
	gimp_plugin_menu_register(). Matches the internal action system
	better and makes translating the menu paths much easier.

	(Of yourse it's still possible to use the old syntax for backward
	compatibility).

	* app/plug-in/plug-in-proc.[ch]: added "gchar *menu_label".

	* app/plug-in/plug-in-params.[ch]: added new functions
	plug_in_param_defs_check() and plug_in_proc_args_check() which
	check if a procedure's parameters match its menu location
	(e.g. <Image> needs RUN-MODE, IMAGE, DRAWABLE).

	* app/plug-in/plug-in-message.c (plug_in_handle_proc_install): if
	registering an old-style (full) menu_path, use
	plug_in_param_defs_check(), set proc_def->menu_label otherwise.

	* tools/pdbgen/pdb/plug_in.pdb (plugin_menu_register): use
	plug_in_proc_args_check() on the passed menu_path and make sugre
	old and new style menu registration are not mixed.

	* app/pdb/plug_in_cmds.c: regenerated.

	* app/plug-in/plug-in-rc.c: save/restore "menu_label".

	* app/actions/file-dialog-actions.c
	* app/actions/plug-in-actions.c
	* app/menus/plug-in-menus.c: changed action/menu creation
	accordingly. Some hacks needed to allow both old and new style
	menu_label/menu_paths.

	* app/plug-in/plug-in.c
	* app/widgets/gimpfiledialog.c
	* app/xcf/xcf.c: changed accordingly.

	* plug-ins/common/align_layers.c
	* plug-ins/common/animationplay.c
	* plug-ins/common/animoptimize.c
	* plug-ins/common/apply_lens.c
	* plug-ins/common/autocrop.c
	* plug-ins/common/autostretch_hsv.c
	* plug-ins/common/blinds.c
	* plug-ins/common/blur.c
	* plug-ins/common/borderaverage.c
	* plug-ins/common/bumpmap.c
	* plug-ins/common/c_astretch.c
	* plug-ins/common/ccanalyze.c
	* plug-ins/common/channel_mixer.c
	* plug-ins/common/checkerboard.c
	* plug-ins/common/color_enhance.c
	* plug-ins/common/colorify.c
	* plug-ins/common/colortoalpha.c
	* plug-ins/common/compose.c
	* plug-ins/common/convmatrix.c
	* plug-ins/common/cubism.c
	* plug-ins/common/curve_bend.c
	* plug-ins/common/decompose.c
	* plug-ins/common/deinterlace.c
	* plug-ins/common/depthmerge.c
	* plug-ins/common/destripe.c
	* plug-ins/common/diffraction.c
	* plug-ins/common/displace.c
	* plug-ins/common/edge.c
	* plug-ins/common/emboss.c
	* plug-ins/common/engrave.c
	* plug-ins/common/exchange.c
	* plug-ins/common/film.c
	* plug-ins/common/flarefx.c
	* plug-ins/common/fractaltrace.c
	* plug-ins/common/screenshot.c: ported the first few plug-ins
	to the new registration scheme.
This commit is contained in:
Michael Natterer 2004-05-07 00:30:24 +00:00 committed by Michael Natterer
parent 4844990eb1
commit ca179a7757
58 changed files with 714 additions and 335 deletions

View File

@ -1,3 +1,80 @@
2004-05-07 Michael Natterer <mitch@gimp.org>
Changed plug-in menu registration again to allow passing just the
menu item's label (not the full path) in gimp_install_procedure()
and only the path (excluding the item's label) in
gimp_plugin_menu_register(). Matches the internal action system
better and makes translating the menu paths much easier.
(Of yourse it's still possible to use the old syntax for backward
compatibility).
* app/plug-in/plug-in-proc.[ch]: added "gchar *menu_label".
* app/plug-in/plug-in-params.[ch]: added new functions
plug_in_param_defs_check() and plug_in_proc_args_check() which
check if a procedure's parameters match its menu location
(e.g. <Image> needs RUN-MODE, IMAGE, DRAWABLE).
* app/plug-in/plug-in-message.c (plug_in_handle_proc_install): if
registering an old-style (full) menu_path, use
plug_in_param_defs_check(), set proc_def->menu_label otherwise.
* tools/pdbgen/pdb/plug_in.pdb (plugin_menu_register): use
plug_in_proc_args_check() on the passed menu_path and make sure
old and new style menu registration are not mixed.
* app/pdb/plug_in_cmds.c: regenerated.
* app/plug-in/plug-in-rc.c: save/restore "menu_label".
* app/actions/file-dialog-actions.c
* app/actions/plug-in-actions.c
* app/menus/plug-in-menus.c: changed action/menu creation
accordingly. Some hacks needed to allow both old and new style
menu_label/menu_paths.
* app/plug-in/plug-in.c
* app/widgets/gimpfiledialog.c
* app/xcf/xcf.c: changed accordingly.
* plug-ins/common/align_layers.c
* plug-ins/common/animationplay.c
* plug-ins/common/animoptimize.c
* plug-ins/common/apply_lens.c
* plug-ins/common/autocrop.c
* plug-ins/common/autostretch_hsv.c
* plug-ins/common/blinds.c
* plug-ins/common/blur.c
* plug-ins/common/borderaverage.c
* plug-ins/common/bumpmap.c
* plug-ins/common/c_astretch.c
* plug-ins/common/ccanalyze.c
* plug-ins/common/channel_mixer.c
* plug-ins/common/checkerboard.c
* plug-ins/common/color_enhance.c
* plug-ins/common/colorify.c
* plug-ins/common/colortoalpha.c
* plug-ins/common/compose.c
* plug-ins/common/convmatrix.c
* plug-ins/common/cubism.c
* plug-ins/common/curve_bend.c
* plug-ins/common/decompose.c
* plug-ins/common/deinterlace.c
* plug-ins/common/depthmerge.c
* plug-ins/common/destripe.c
* plug-ins/common/diffraction.c
* plug-ins/common/displace.c
* plug-ins/common/edge.c
* plug-ins/common/emboss.c
* plug-ins/common/engrave.c
* plug-ins/common/exchange.c
* plug-ins/common/film.c
* plug-ins/common/flarefx.c
* plug-ins/common/fractaltrace.c
* plug-ins/common/screenshot.c: ported the first few plug-ins
to the new registration scheme.
2004-05-06 Manish Singh <yosh@gimp.org>
* tools/pdbgen/pdb/app.pl: make libgimp* headers always included

View File

@ -51,6 +51,7 @@ file_dialog_actions_setup (GimpActionGroup *group,
const gchar *stock_id = NULL;
gchar *help_id;
GimpPlugInActionEntry entry;
gchar *label;
gboolean is_xcf;
if (! file_proc->menu_paths)
@ -77,9 +78,14 @@ file_dialog_actions_setup (GimpActionGroup *group,
help_id = plug_in_proc_def_get_help_id (file_proc, help_domain);
}
if (file_proc->menu_label)
label = file_proc->menu_label;
else
label = strrchr (file_proc->menu_paths->data, '/') + 1;
entry.name = file_proc->db_info.name;
entry.stock_id = stock_id;
entry.label = strstr (file_proc->menu_paths->data, "/") + 1;
entry.label = label;
entry.accelerator = file_proc->accelerator;
entry.tooltip = NULL;
entry.proc_def = file_proc;

View File

@ -269,18 +269,32 @@ plug_in_actions_add_proc (GimpActionGroup *group,
help_id = plug_in_proc_def_get_help_id (proc_def, help_domain);
path_original = g_strdup (proc_def->menu_paths->data);
path_translated = g_strdup (dgettext (locale_domain, path_original));
if (proc_def->menu_label)
{
path_original = g_strdup (proc_def->menu_label);
path_translated = g_strdup (dgettext (locale_domain, path_original));
p1 = strrchr (path_original, '/');
p2 = strrchr (path_translated, '/');
p1 = path_original;
p2 = path_translated;
}
else
{
path_original = g_strdup (proc_def->menu_paths->data);
path_translated = g_strdup (dgettext (locale_domain, path_original));
p1 = strrchr (path_original, '/');
p2 = strrchr (path_translated, '/');
}
if (p1 && p2)
{
GimpPlugInActionEntry entry;
gchar *label;
label = p2 + 1;
if (proc_def->menu_label)
label = proc_def->menu_label;
else
label = p2 + 1;
entry.name = proc_def->db_info.name;
entry.stock_id = NULL;
@ -298,10 +312,22 @@ plug_in_actions_add_proc (GimpActionGroup *group,
gimp_action_group_add_plug_in_actions (group, &entry, 1,
G_CALLBACK (plug_in_run_cmd_callback));
*p1 = '\0';
*p2 = '\0';
if (proc_def->menu_label)
{
GList *list;
plug_in_actions_build_path (group, path_original, path_translated);
for (list = proc_def->menu_paths; list; list = g_list_next (list))
plug_in_actions_build_path (group,
list->data,
dgettext (locale_domain, list->data));
}
else
{
*p1 = '\0';
*p2 = '\0';
plug_in_actions_build_path (group, path_original, path_translated);
}
}
g_free (path_original);

View File

@ -41,7 +41,7 @@
/* local function prototypes */
static gboolean plug_in_menus_tree_traverse (const gchar *menu_path,
static gboolean plug_in_menus_tree_traverse (gchar *menu_path,
PlugInProcDef *proc_def,
GimpUIManager *manager);
static void plug_in_menus_build_path (GimpUIManager *manager,
@ -140,6 +140,7 @@ plug_in_menus_setup (GimpUIManager *manager,
{
const gchar *progname;
const gchar *locale_domain;
gchar *stripped;
gchar *key;
progname = plug_in_proc_def_get_progname (proc_def);
@ -147,7 +148,17 @@ plug_in_menus_setup (GimpUIManager *manager,
locale_domain = plug_ins_locale_domain (manager->gimp,
progname, NULL);
key = gimp_strip_uline (dgettext (locale_domain, path->data));
stripped = gimp_strip_uline (dgettext (locale_domain,
path->data));
if (proc_def->menu_label)
key = g_strdup_printf ("%s/%s",
stripped, proc_def->menu_label);
else
key = g_strdup (stripped);
g_free (stripped);
g_tree_insert (menu_entries, key, proc_def);
}
}
@ -172,7 +183,9 @@ plug_in_menus_add_proc (GimpUIManager *manager,
const gchar *menu_path)
{
gchar *path;
gchar *p;
gchar *action_path;
gchar *merge_key;
guint merge_id;
g_return_if_fail (GIMP_IS_UI_MANAGER (manager));
g_return_if_fail (ui_path != NULL);
@ -180,49 +193,43 @@ plug_in_menus_add_proc (GimpUIManager *manager,
path = g_strdup (menu_path);
p = strrchr (path, '/');
if (p)
if (! proc_def->menu_label)
{
gchar *action_path;
gchar *merge_key;
guint merge_id;
gchar *p = strrchr (path, '/');
*p = '\0';
merge_key = g_strdup_printf ("%s-merge-id", proc_def->db_info.name);
merge_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (manager),
merge_key));
if (! merge_id)
{
merge_id = gtk_ui_manager_new_merge_id (GTK_UI_MANAGER (manager));
g_object_set_data (G_OBJECT (manager), merge_key,
GUINT_TO_POINTER (merge_id));
}
g_free (merge_key);
plug_in_menus_build_path (manager, ui_path, merge_id, path);
action_path = g_strdup_printf ("%s%s", ui_path, strchr (path, '/'));
#if 0
g_print ("adding UI for '%s' (@ %s)\n",
proc_def->db_info.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,
GTK_UI_MANAGER_MENUITEM,
FALSE);
g_free (action_path);
}
merge_key = g_strdup_printf ("%s-merge-id", proc_def->db_info.name);
merge_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (manager),
merge_key));
if (! merge_id)
{
merge_id = gtk_ui_manager_new_merge_id (GTK_UI_MANAGER (manager));
g_object_set_data (G_OBJECT (manager), merge_key,
GUINT_TO_POINTER (merge_id));
}
g_free (merge_key);
plug_in_menus_build_path (manager, ui_path, merge_id, path);
action_path = g_strdup_printf ("%s%s", ui_path, strchr (path, '/'));
#if 0
g_print ("adding UI for '%s' (@ %s)\n",
proc_def->db_info.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,
GTK_UI_MANAGER_MENUITEM,
FALSE);
g_free (action_path);
g_free (path);
}
@ -249,12 +256,18 @@ plug_in_menus_remove_proc (GimpUIManager *manager,
/* private functions */
static gboolean
plug_in_menus_tree_traverse (const gchar *menu_path,
plug_in_menus_tree_traverse (gchar *menu_path,
PlugInProcDef *proc_def,
GimpUIManager *manager)
{
const gchar *ui_path = g_object_get_data (G_OBJECT (manager), "ui-path");
if (proc_def->menu_label)
{
gchar *p = strrchr (menu_path, '/');
*p = '\0';
}
plug_in_menus_add_proc (manager, ui_path, proc_def, menu_path);
return FALSE;

View File

@ -73,6 +73,7 @@ plug_in_proc_def_free (PlugInProcDef *proc_def)
g_free (proc_def->db_info.values);
g_free (proc_def->prog);
g_free (proc_def->menu_label);
g_list_foreach (proc_def->menu_paths, (GFunc) g_free, NULL);
g_list_free (proc_def->menu_paths);
@ -144,9 +145,9 @@ plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
}
gint
plug_in_proc_def_compare_menu_path (gconstpointer a,
gconstpointer b,
gpointer user_data)
plug_in_proc_def_compare_menu_path (gconstpointer a,
gconstpointer b,
gpointer user_data)
{
Gimp *gimp = GIMP (user_data);
const PlugInProcDef *proc_def_a = a;

View File

@ -27,6 +27,7 @@
struct _PlugInProcDef
{
gchar *prog;
gchar *menu_label;
GList *menu_paths;
gchar *accelerator;
gchar *extensions;

View File

@ -28,12 +28,14 @@
#include "libgimpbase/gimpbasetypes.h"
#include "libgimpbase/gimpbase.h"
#include "libgimpbase/gimpprotocol.h"
#include "pdb-types.h"
#include "procedural_db.h"
#include "core/gimp.h"
#include "plug-in/plug-in-def.h"
#include "plug-in/plug-in-params.h"
#include "plug-in/plug-in-proc.h"
#include "plug-in/plug-in-progress.h"
#include "plug-in/plug-in.h"
@ -525,8 +527,46 @@ plugin_menu_register_invoker (Gimp *gimp,
if (! strcmp (procedure_name, proc_def->db_info.name))
{
proc_def->menu_paths = g_list_append (proc_def->menu_paths,
g_strdup (menu_path));
if (proc_def->menu_label)
{
GError *error = NULL;
if (! plug_in_proc_args_check (gimp->current_plug_in->name,
gimp->current_plug_in->prog,
procedure_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,
&error))
{
g_message (error->message);
g_clear_error (&error);
success = FALSE;
}
else
{
proc_def->menu_paths = g_list_append (proc_def->menu_paths,
g_strdup (menu_path));
}
}
else
{
g_message ("Plug-In \"%s\"\n(%s)\n\n"
"attempted to install additional menu_path \"%s\"\n"
"for procedure \"%s\".\n"
"However the menu_path given in "
"gimp_install_procedure() already contained "
"a path. To make this work, pass just the menu's "
"label to gimp_install_procedure().",
gimp_filename_to_utf8 (gimp->current_plug_in->name),
gimp_filename_to_utf8 (gimp->current_plug_in->prog),
menu_path, procedure_name);
success = FALSE;
}
break;
}

View File

@ -543,92 +543,25 @@ plug_in_handle_proc_install (PlugIn *plug_in,
* --only sanity check arguments when the procedure requests a menu path
*/
if (proc_install->menu_path)
if (proc_install->menu_path && proc_install->menu_path[0] == '<')
{
if (strncmp (proc_install->menu_path, "<Toolbox>", 9) == 0)
{
if ((proc_install->nparams < 1) ||
(proc_install->params[0].type != GIMP_PDB_INT32))
{
g_message ("Plug-In \"%s\"\n(%s)\n\n"
"attempted to install <Toolbox> procedure \"%s\" "
"which does not take the standard <Toolbox> Plug-In "
"args.\n"
"(INT32)",
gimp_filename_to_utf8 (plug_in->name),
gimp_filename_to_utf8 (plug_in->prog),
proc_install->name);
return;
}
}
else if (strncmp (proc_install->menu_path, "<Image>", 7) == 0)
{
if ((proc_install->nparams < 3) ||
(proc_install->params[0].type != GIMP_PDB_INT32) ||
(proc_install->params[1].type != GIMP_PDB_IMAGE) ||
(proc_install->params[2].type != GIMP_PDB_DRAWABLE))
{
g_message ("Plug-In \"%s\"\n(%s)\n\n"
"attempted to install <Image> procedure \"%s\" "
"which does not take the standard <Image> Plug-In "
"args.\n"
"(INT32, IMAGE, DRAWABLE)",
gimp_filename_to_utf8 (plug_in->name),
gimp_filename_to_utf8 (plug_in->prog),
proc_install->name);
return;
}
}
else if (strncmp (proc_install->menu_path, "<Load>", 6) == 0)
{
if ((proc_install->nparams < 3) ||
(proc_install->params[0].type != GIMP_PDB_INT32) ||
(proc_install->params[1].type != GIMP_PDB_STRING) ||
(proc_install->params[2].type != GIMP_PDB_STRING))
{
g_message ("Plug-In \"%s\"\n(%s)\n\n"
"attempted to install <Load> procedure \"%s\" "
"which does not take the standard <Load> Plug-In "
"args.\n"
"(INT32, STRING, STRING)",
gimp_filename_to_utf8 (plug_in->name),
gimp_filename_to_utf8 (plug_in->prog),
proc_install->name);
return;
}
}
else if (strncmp (proc_install->menu_path, "<Save>", 6) == 0)
{
if ((proc_install->nparams < 5) ||
(proc_install->params[0].type != GIMP_PDB_INT32) ||
(proc_install->params[1].type != GIMP_PDB_IMAGE) ||
(proc_install->params[2].type != GIMP_PDB_DRAWABLE) ||
(proc_install->params[3].type != GIMP_PDB_STRING) ||
(proc_install->params[4].type != GIMP_PDB_STRING))
{
g_message ("Plug-In \"%s\"\n(%s)\n\n"
"attempted to install <Save> procedure \"%s\" "
"which does not take the standard <Save> Plug-In "
"args.\n"
"(INT32, IMAGE, DRAWABLE, STRING, STRING)",
gimp_filename_to_utf8 (plug_in->name),
gimp_filename_to_utf8 (plug_in->prog),
proc_install->name);
return;
}
}
else
{
g_message ("Plug-In \"%s\"\n(%s)\n\n"
"attempted to install procedure \"%s\" "
"in an invalid menu location.\n"
"Use either \"<Toolbox>\", \"<Image>\", "
"\"<Load>\", or \"<Save>\".",
gimp_filename_to_utf8 (plug_in->name),
gimp_filename_to_utf8 (plug_in->prog),
proc_install->name);
return;
}
GError *error = NULL;
if (! plug_in_param_defs_check (plug_in->name,
plug_in->prog,
proc_install->name,
proc_install->menu_path,
proc_install->params,
proc_install->nparams,
proc_install->return_vals,
proc_install->nreturn_vals,
&error))
{
g_message (error->message);
g_clear_error (&error);
return;
}
}
/* Sanity check for array arguments */
@ -746,12 +679,17 @@ plug_in_handle_proc_install (PlugIn *plug_in,
proc_def = plug_in_proc_def_new ();
proc_def->prog = g_strdup (prog);
if (proc_install->menu_path)
proc_def->menu_paths = g_list_append (proc_def->menu_paths,
g_strdup (proc_install->menu_path));
{
if (proc_install->menu_path[0] == '<')
proc_def->menu_paths =
g_list_append (proc_def->menu_paths,
g_strdup (proc_install->menu_path));
else
proc_def->menu_label = g_strdup (proc_install->menu_path);
}
proc_def->prog = g_strdup (prog);
proc_def->accelerator = NULL;
proc_def->extensions = NULL;
proc_def->prefixes = NULL;

View File

@ -890,7 +890,6 @@ gchar *
plug_in_get_undo_desc (PlugIn *plug_in)
{
PlugInProcDef *proc_def;
gchar *stripped;
gchar *undo_desc;
g_return_val_if_fail (plug_in != NULL, NULL);
@ -904,17 +903,28 @@ plug_in_get_undo_desc (PlugIn *plug_in)
else
proc_def = NULL;
if (proc_def && proc_def->menu_paths)
if (proc_def && (proc_def->menu_label || proc_def->menu_paths))
{
const gchar *path;
gchar *stripped;
gchar *ellipses;
path = dgettext (plug_ins_locale_domain (plug_in->gimp,
plug_in->prog, NULL),
proc_def->menu_paths->data);
if (proc_def->menu_label)
path = dgettext (plug_ins_locale_domain (plug_in->gimp,
plug_in->prog, NULL),
proc_def->menu_label);
else
path = dgettext (plug_ins_locale_domain (plug_in->gimp,
plug_in->prog, NULL),
proc_def->menu_paths->data);
stripped = gimp_strip_uline (path);
if (proc_def->menu_label)
undo_desc = g_strdup (stripped);
else
undo_desc = g_strdup (strrchr (stripped, '/') + 1);
stripped = gimp_strip_uline (path);
undo_desc = g_path_get_basename (stripped);
g_free (stripped);
ellipses = strstr (undo_desc, "...");

View File

@ -73,6 +73,7 @@ plug_in_proc_def_free (PlugInProcDef *proc_def)
g_free (proc_def->db_info.values);
g_free (proc_def->prog);
g_free (proc_def->menu_label);
g_list_foreach (proc_def->menu_paths, (GFunc) g_free, NULL);
g_list_free (proc_def->menu_paths);
@ -144,9 +145,9 @@ plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
}
gint
plug_in_proc_def_compare_menu_path (gconstpointer a,
gconstpointer b,
gpointer user_data)
plug_in_proc_def_compare_menu_path (gconstpointer a,
gconstpointer b,
gpointer user_data)
{
Gimp *gimp = GIMP (user_data);
const PlugInProcDef *proc_def_a = a;

View File

@ -27,6 +27,7 @@
struct _PlugInProcDef
{
gchar *prog;
gchar *menu_label;
GList *menu_paths;
gchar *accelerator;
gchar *extensions;

View File

@ -543,92 +543,25 @@ plug_in_handle_proc_install (PlugIn *plug_in,
* --only sanity check arguments when the procedure requests a menu path
*/
if (proc_install->menu_path)
if (proc_install->menu_path && proc_install->menu_path[0] == '<')
{
if (strncmp (proc_install->menu_path, "<Toolbox>", 9) == 0)
{
if ((proc_install->nparams < 1) ||
(proc_install->params[0].type != GIMP_PDB_INT32))
{
g_message ("Plug-In \"%s\"\n(%s)\n\n"
"attempted to install <Toolbox> procedure \"%s\" "
"which does not take the standard <Toolbox> Plug-In "
"args.\n"
"(INT32)",
gimp_filename_to_utf8 (plug_in->name),
gimp_filename_to_utf8 (plug_in->prog),
proc_install->name);
return;
}
}
else if (strncmp (proc_install->menu_path, "<Image>", 7) == 0)
{
if ((proc_install->nparams < 3) ||
(proc_install->params[0].type != GIMP_PDB_INT32) ||
(proc_install->params[1].type != GIMP_PDB_IMAGE) ||
(proc_install->params[2].type != GIMP_PDB_DRAWABLE))
{
g_message ("Plug-In \"%s\"\n(%s)\n\n"
"attempted to install <Image> procedure \"%s\" "
"which does not take the standard <Image> Plug-In "
"args.\n"
"(INT32, IMAGE, DRAWABLE)",
gimp_filename_to_utf8 (plug_in->name),
gimp_filename_to_utf8 (plug_in->prog),
proc_install->name);
return;
}
}
else if (strncmp (proc_install->menu_path, "<Load>", 6) == 0)
{
if ((proc_install->nparams < 3) ||
(proc_install->params[0].type != GIMP_PDB_INT32) ||
(proc_install->params[1].type != GIMP_PDB_STRING) ||
(proc_install->params[2].type != GIMP_PDB_STRING))
{
g_message ("Plug-In \"%s\"\n(%s)\n\n"
"attempted to install <Load> procedure \"%s\" "
"which does not take the standard <Load> Plug-In "
"args.\n"
"(INT32, STRING, STRING)",
gimp_filename_to_utf8 (plug_in->name),
gimp_filename_to_utf8 (plug_in->prog),
proc_install->name);
return;
}
}
else if (strncmp (proc_install->menu_path, "<Save>", 6) == 0)
{
if ((proc_install->nparams < 5) ||
(proc_install->params[0].type != GIMP_PDB_INT32) ||
(proc_install->params[1].type != GIMP_PDB_IMAGE) ||
(proc_install->params[2].type != GIMP_PDB_DRAWABLE) ||
(proc_install->params[3].type != GIMP_PDB_STRING) ||
(proc_install->params[4].type != GIMP_PDB_STRING))
{
g_message ("Plug-In \"%s\"\n(%s)\n\n"
"attempted to install <Save> procedure \"%s\" "
"which does not take the standard <Save> Plug-In "
"args.\n"
"(INT32, IMAGE, DRAWABLE, STRING, STRING)",
gimp_filename_to_utf8 (plug_in->name),
gimp_filename_to_utf8 (plug_in->prog),
proc_install->name);
return;
}
}
else
{
g_message ("Plug-In \"%s\"\n(%s)\n\n"
"attempted to install procedure \"%s\" "
"in an invalid menu location.\n"
"Use either \"<Toolbox>\", \"<Image>\", "
"\"<Load>\", or \"<Save>\".",
gimp_filename_to_utf8 (plug_in->name),
gimp_filename_to_utf8 (plug_in->prog),
proc_install->name);
return;
}
GError *error = NULL;
if (! plug_in_param_defs_check (plug_in->name,
plug_in->prog,
proc_install->name,
proc_install->menu_path,
proc_install->params,
proc_install->nparams,
proc_install->return_vals,
proc_install->nreturn_vals,
&error))
{
g_message (error->message);
g_clear_error (&error);
return;
}
}
/* Sanity check for array arguments */
@ -746,12 +679,17 @@ plug_in_handle_proc_install (PlugIn *plug_in,
proc_def = plug_in_proc_def_new ();
proc_def->prog = g_strdup (prog);
if (proc_install->menu_path)
proc_def->menu_paths = g_list_append (proc_def->menu_paths,
g_strdup (proc_install->menu_path));
{
if (proc_install->menu_path[0] == '<')
proc_def->menu_paths =
g_list_append (proc_def->menu_paths,
g_strdup (proc_install->menu_path));
else
proc_def->menu_label = g_strdup (proc_install->menu_path);
}
proc_def->prog = g_strdup (prog);
proc_def->accelerator = NULL;
proc_def->extensions = NULL;
proc_def->prefixes = NULL;

View File

@ -450,3 +450,137 @@ plug_in_args_destroy (Argument *args,
else
g_free (args);
}
gboolean
plug_in_param_defs_check (const gchar *plug_in_name,
const gchar *plug_in_prog,
const gchar *procedure_name,
const gchar *menu_path,
GPParamDef *params,
guint32 n_args,
GPParamDef *return_vals,
guint32 n_return_vals,
GError **error)
{
return plug_in_proc_args_check (plug_in_name,
plug_in_prog,
procedure_name,
menu_path,
(ProcArg *) params,
n_args,
(ProcArg *) return_vals,
n_return_vals,
error);
}
gboolean
plug_in_proc_args_check (const gchar *plug_in_name,
const gchar *plug_in_prog,
const gchar *procedure_name,
const gchar *menu_path,
ProcArg *args,
guint32 n_args,
ProcArg *return_vals,
guint32 n_return_vals,
GError **error)
{
g_return_val_if_fail (plug_in_name != NULL, FALSE);
g_return_val_if_fail (plug_in_prog != NULL, FALSE);
g_return_val_if_fail (procedure_name != NULL, FALSE);
g_return_val_if_fail (menu_path != NULL, FALSE);
g_return_val_if_fail (args == NULL || n_args > 0, FALSE);
g_return_val_if_fail (return_vals == NULL || n_return_vals > 0, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
if (strncmp (menu_path, "<Toolbox>", 9) == 0)
{
if ((n_args < 1) ||
(args[0].arg_type != GIMP_PDB_INT32))
{
g_set_error (error, 0, 0,
"Plug-In \"%s\"\n(%s)\n\n"
"attempted to install <Toolbox> procedure \"%s\" "
"which does not take the standard <Toolbox> Plug-In "
"args.\n"
"(INT32)",
gimp_filename_to_utf8 (plug_in_name),
gimp_filename_to_utf8 (plug_in_prog),
procedure_name);
return FALSE;
}
}
else if (strncmp (menu_path, "<Image>", 7) == 0)
{
if ((n_args < 3) ||
(args[0].arg_type != GIMP_PDB_INT32) ||
(args[1].arg_type != GIMP_PDB_IMAGE) ||
(args[2].arg_type != GIMP_PDB_DRAWABLE))
{
g_set_error (error, 0, 0,
"Plug-In \"%s\"\n(%s)\n\n"
"attempted to install <Image> procedure \"%s\" "
"which does not take the standard <Image> Plug-In "
"args.\n"
"(INT32, IMAGE, DRAWABLE)",
gimp_filename_to_utf8 (plug_in_name),
gimp_filename_to_utf8 (plug_in_prog),
procedure_name);
return FALSE;
}
}
else if (strncmp (menu_path, "<Load>", 6) == 0)
{
if ((n_args < 3) ||
(args[0].arg_type != GIMP_PDB_INT32) ||
(args[1].arg_type != GIMP_PDB_STRING) ||
(args[2].arg_type != GIMP_PDB_STRING))
{
g_set_error (error, 0, 0,
"Plug-In \"%s\"\n(%s)\n\n"
"attempted to install <Load> procedure \"%s\" "
"which does not take the standard <Load> Plug-In "
"args.\n"
"(INT32, STRING, STRING)",
gimp_filename_to_utf8 (plug_in_name),
gimp_filename_to_utf8 (plug_in_prog),
procedure_name);
return FALSE;
}
}
else if (strncmp (menu_path, "<Save>", 6) == 0)
{
if ((n_args < 5) ||
(args[0].arg_type != GIMP_PDB_INT32) ||
(args[1].arg_type != GIMP_PDB_IMAGE) ||
(args[2].arg_type != GIMP_PDB_DRAWABLE) ||
(args[3].arg_type != GIMP_PDB_STRING) ||
(args[4].arg_type != GIMP_PDB_STRING))
{
g_set_error (error, 0, 0,
"Plug-In \"%s\"\n(%s)\n\n"
"attempted to install <Save> procedure \"%s\" "
"which does not take the standard <Save> Plug-In "
"args.\n"
"(INT32, IMAGE, DRAWABLE, STRING, STRING)",
gimp_filename_to_utf8 (plug_in_name),
gimp_filename_to_utf8 (plug_in_prog),
procedure_name);
return FALSE;
}
}
else
{
g_set_error (error, 0, 0,
"Plug-In \"%s\"\n(%s)\n\n"
"attempted to install procedure \"%s\" "
"in an invalid menu location.\n"
"Use either \"<Toolbox>\", \"<Image>\", "
"\"<Load>\", or \"<Save>\".",
gimp_filename_to_utf8 (plug_in_name),
gimp_filename_to_utf8 (plug_in_prog),
procedure_name);
return FALSE;
}
return TRUE;
}

View File

@ -20,19 +20,38 @@
#define __PLUG_IN_PARAMS_H__
Argument * plug_in_params_to_args (GPParam *params,
gint nparams,
gboolean full_copy);
GPParam * plug_in_args_to_params (Argument *args,
gint nargs,
gboolean full_copy);
Argument * plug_in_params_to_args (GPParam *params,
gint n_params,
gboolean full_copy);
GPParam * plug_in_args_to_params (Argument *args,
gint n_args,
gboolean full_copy);
void plug_in_params_destroy (GPParam *params,
gint nparams,
gboolean full_destroy);
void plug_in_args_destroy (Argument *args,
gint nargs,
gboolean full_destroy);
void plug_in_params_destroy (GPParam *params,
gint n_params,
gboolean full_destroy);
void plug_in_args_destroy (Argument *args,
gint n_args,
gboolean full_destroy);
gboolean plug_in_param_defs_check (const gchar *plug_in_name,
const gchar *plug_in_prog,
const gchar *procedure_name,
const gchar *menu_path,
GPParamDef *params,
guint32 n_args,
GPParamDef *return_vals,
guint32 n_return_vals,
GError **error);
gboolean plug_in_proc_args_check (const gchar *plug_in_name,
const gchar *plug_in_prog,
const gchar *procedure_name,
const gchar *menu_path,
ProcArg *args,
guint32 n_args,
ProcArg *return_vals,
guint32 n_return_vals,
GError **error);
#endif /* __PLUG_IN_PARAMS_H__ */

View File

@ -73,6 +73,7 @@ plug_in_proc_def_free (PlugInProcDef *proc_def)
g_free (proc_def->db_info.values);
g_free (proc_def->prog);
g_free (proc_def->menu_label);
g_list_foreach (proc_def->menu_paths, (GFunc) g_free, NULL);
g_list_free (proc_def->menu_paths);
@ -144,9 +145,9 @@ plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
}
gint
plug_in_proc_def_compare_menu_path (gconstpointer a,
gconstpointer b,
gpointer user_data)
plug_in_proc_def_compare_menu_path (gconstpointer a,
gconstpointer b,
gpointer user_data)
{
Gimp *gimp = GIMP (user_data);
const PlugInProcDef *proc_def_a = a;

View File

@ -27,6 +27,7 @@
struct _PlugInProcDef
{
gchar *prog;
gchar *menu_label;
GList *menu_paths;
gchar *accelerator;
gchar *extensions;

View File

@ -73,6 +73,7 @@ plug_in_proc_def_free (PlugInProcDef *proc_def)
g_free (proc_def->db_info.values);
g_free (proc_def->prog);
g_free (proc_def->menu_label);
g_list_foreach (proc_def->menu_paths, (GFunc) g_free, NULL);
g_list_free (proc_def->menu_paths);
@ -144,9 +145,9 @@ plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
}
gint
plug_in_proc_def_compare_menu_path (gconstpointer a,
gconstpointer b,
gpointer user_data)
plug_in_proc_def_compare_menu_path (gconstpointer a,
gconstpointer b,
gpointer user_data)
{
Gimp *gimp = GIMP (user_data);
const PlugInProcDef *proc_def_a = a;

View File

@ -27,6 +27,7 @@
struct _PlugInProcDef
{
gchar *prog;
gchar *menu_label;
GList *menu_paths;
gchar *accelerator;
gchar *extensions;

View File

@ -286,6 +286,8 @@ plug_in_proc_def_deserialize (GScanner *scanner,
return G_TOKEN_STRING;
if (! gimp_scanner_parse_string (scanner, &proc_def->db_info.date))
return G_TOKEN_STRING;
if (! gimp_scanner_parse_string (scanner, &proc_def->menu_label))
return G_TOKEN_STRING;
if (! gimp_scanner_parse_int (scanner, &n_menu_paths))
return G_TOKEN_STRING;
@ -513,6 +515,8 @@ plug_in_rc_write (GSList *plug_in_defs,
gimp_config_writer_linefeed (writer);
gimp_config_writer_string (writer, proc_def->db_info.date);
gimp_config_writer_linefeed (writer);
gimp_config_writer_string (writer, proc_def->menu_label);
gimp_config_writer_linefeed (writer);
gimp_config_writer_printf (writer, "%d",
g_list_length (proc_def->menu_paths));

View File

@ -890,7 +890,6 @@ gchar *
plug_in_get_undo_desc (PlugIn *plug_in)
{
PlugInProcDef *proc_def;
gchar *stripped;
gchar *undo_desc;
g_return_val_if_fail (plug_in != NULL, NULL);
@ -904,17 +903,28 @@ plug_in_get_undo_desc (PlugIn *plug_in)
else
proc_def = NULL;
if (proc_def && proc_def->menu_paths)
if (proc_def && (proc_def->menu_label || proc_def->menu_paths))
{
const gchar *path;
gchar *stripped;
gchar *ellipses;
path = dgettext (plug_ins_locale_domain (plug_in->gimp,
plug_in->prog, NULL),
proc_def->menu_paths->data);
if (proc_def->menu_label)
path = dgettext (plug_ins_locale_domain (plug_in->gimp,
plug_in->prog, NULL),
proc_def->menu_label);
else
path = dgettext (plug_ins_locale_domain (plug_in->gimp,
plug_in->prog, NULL),
proc_def->menu_paths->data);
stripped = gimp_strip_uline (path);
if (proc_def->menu_label)
undo_desc = g_strdup (stripped);
else
undo_desc = g_strdup (strrchr (stripped, '/') + 1);
stripped = gimp_strip_uline (path);
undo_desc = g_path_get_basename (stripped);
g_free (stripped);
ellipses = strstr (undo_desc, "...");

View File

@ -239,7 +239,10 @@ gimp_file_dialog_new (Gimp *gimp,
gchar *name;
GSList *ext;
name = strrchr (file_proc->menu_paths->data, '/') + 1;
if (file_proc->menu_label)
name = file_proc->menu_label;
else
name = strrchr (file_proc->menu_paths->data, '/') + 1;
filter = gtk_file_filter_new ();
gtk_file_filter_set_name (filter, name);

View File

@ -81,6 +81,7 @@ static ProcArg xcf_load_return_vals[] =
static PlugInProcDef xcf_plug_in_load_proc =
{
"gimp_xcf_load",
"XCF (GIMP)",
NULL,
NULL,
"xcf",
@ -130,6 +131,7 @@ static ProcArg xcf_save_args[] =
static PlugInProcDef xcf_plug_in_save_proc =
{
"gimp_xcf_save",
"XCF (GIMP)",
NULL,
NULL,
"xcf",
@ -181,8 +183,8 @@ xcf_init (Gimp *gimp)
procedural_db_register (gimp, &xcf_plug_in_save_proc.db_info);
procedural_db_register (gimp, &xcf_plug_in_load_proc.db_info);
xcf_plug_in_save_proc.menu_paths = g_list_append (NULL, "<Save>/XCF (GIMP)");
xcf_plug_in_load_proc.menu_paths = g_list_append (NULL, "<Load>/XCF (GIMP)");
xcf_plug_in_save_proc.menu_paths = g_list_append (NULL, "<Save>");
xcf_plug_in_load_proc.menu_paths = g_list_append (NULL, "<Load>");
xcf_plug_in_save_proc.image_types_val =
plug_ins_image_types_parse (xcf_plug_in_save_proc.image_types);

View File

@ -136,11 +136,14 @@ query (void)
"Shuji Narazaki <narazaki@InetQ.or.jp>",
"Shuji Narazaki",
"1997",
N_("<Image>/Layer/Align _Visible Layers..."),
N_("Align _Visible Layers..."),
"RGB*,GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
gimp_plugin_menu_register (PLUG_IN_NAME,
N_("<Image>/Layer"));
}
static void

View File

@ -211,7 +211,7 @@ static gint ncolours;
static GtkWidget *psbutton;
/* for shaping */
typedef struct
typedef struct
{
gint x, y;
} CursorOffset;
@ -240,11 +240,14 @@ query (void)
"Adam D. Moss <adam@gimp.org>",
"Adam D. Moss <adam@gimp.org>",
"1997, 1998...",
N_("<Image>/Filters/Animation/_Playback..."),
N_("_Playback..."),
"RGB*, INDEXED*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
gimp_plugin_menu_register ("plug_in_animationplay",
N_("<Image>/Filters/Animation"));
}
static void

View File

@ -193,7 +193,7 @@ query (void)
"Adam D. Moss <adam@gimp.org>",
"Adam D. Moss <adam@gimp.org>",
"1997-2003",
N_("<Image>/Filters/Animation/Optimize (for _GIF)"),
N_("Optimize (for _GIF)"),
"RGB*, INDEXED*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (args),
@ -211,7 +211,7 @@ query (void)
"Adam D. Moss <adam@gimp.org>",
"Adam D. Moss <adam@gimp.org>",
"1997-2001",
N_("<Image>/Filters/Animation/_Optimize (Difference)"),
N_("_Optimize (Difference)"),
"RGB*, INDEXED*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (args),
@ -228,13 +228,20 @@ query (void)
"Adam D. Moss <adam@gimp.org>",
"Adam D. Moss <adam@gimp.org>",
"1997-2001",
N_("<Image>/Filters/Animation/_UnOptimize"),
N_("_UnOptimize"),
"RGB*, INDEXED*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (args),
G_N_ELEMENTS (return_args),
args, return_args);
gimp_plugin_menu_register ("plug_in_animationoptimize",
N_("<Image>/Filters/Animation"));
gimp_plugin_menu_register ("plug_in_animationoptimize_diff",
N_("<Image>/Filters/Animation"));
gimp_plugin_menu_register ("plug_in_animationunoptimize",
N_("<Image>/Filters/Animation"));
#ifdef EXPERIMENTAL_BACKDROP_CODE
gimp_install_procedure ("plug_in_animation_remove_backdrop",
"This procedure attempts to remove the backdrop"
@ -244,7 +251,7 @@ query (void)
"Adam D. Moss <adam@gimp.org>",
"Adam D. Moss <adam@gimp.org>",
"2001",
N_("<Image>/Filters/Animation/_Remove Backdrop"),
N_("_Remove Backdrop"),
"RGB*, INDEXED*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (args),
@ -260,12 +267,17 @@ query (void)
"Adam D. Moss <adam@gimp.org>",
"Adam D. Moss <adam@gimp.org>",
"2001",
N_("<Image>/Filters/Animation/_Find Backdrop"),
N_("_Find Backdrop"),
"RGB*, INDEXED*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (args),
G_N_ELEMENTS (return_args),
args, return_args);
gimp_plugin_menu_register ("plug_in_animation_remove_backdrop",
N_("<Image>/Filters/Animation"));
gimp_plugin_menu_register ("plug_in_animation_find_backdrop",
N_("<Image>/Filters/Animation"));
#endif
}

View File

@ -119,11 +119,14 @@ query (void)
"Morten Eriksen",
"Morten Eriksen",
"1997",
N_("<Image>/Filters/Glass Effects/Apply _Lens..."),
N_("Apply _Lens..."),
"RGB*, GRAY*, INDEXED*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
gimp_plugin_menu_register ("plug_in_applylens",
N_("<Image>/Filters/Glass Effects"));
}
static void

View File

@ -72,11 +72,14 @@ query (void)
"Tim Newsome",
"Tim Newsome",
"1997",
N_("<Image>/Image/Crop/_Autocrop"),
N_("_Autocrop"),
"RGB*, GRAY*, INDEXED*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
gimp_plugin_menu_register ("plug_in_autocrop",
N_("<Image>/Image/Crop"));
}
static void

View File

@ -89,11 +89,14 @@ query (void)
"Scott Goehring and Federico Mena Quintero",
"Scott Goehring and Federico Mena Quintero",
"1997",
N_("<Image>/Layer/Colors/Auto/Stretch _HSV"),
N_("Stretch _HSV"),
"RGB*, INDEXED*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
gimp_plugin_menu_register ("plug_in_autostretch_hsv",
N_("<Image>/Layer/Colors/Auto"));
}
static void

View File

@ -164,11 +164,14 @@ query (void)
"Andy Thomas",
"Andy Thomas",
"1997",
N_("<Image>/Filters/Distorts/_Blinds..."),
N_("_Blinds..."),
"RGB*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
gimp_plugin_menu_register ("plug_in_blinds",
N_("<Image>/Filters/Distorts"));
}
static void

View File

@ -180,23 +180,26 @@ query (void)
const gchar *copyright_date = "1995-1998";
gimp_install_procedure ("plug_in_blur_randomize",
(gchar *) blurb,
(gchar *) help,
(gchar *) author,
(gchar *) copyrights,
(gchar *) copyright_date,
N_("<Image>/Filters/Blur/_Blur..."),
blurb,
help,
author,
copyrights,
copyright_date,
N_("_Blur..."),
"RGB*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
gimp_plugin_menu_register ("plug_in_blur_randomize",
N_("<Image>/Filters/Blur"));
gimp_install_procedure (PLUG_IN_NAME,
(gchar *) blurb,
(gchar *) help,
(gchar *) author,
(gchar *) copyrights,
(gchar *) copyright_date,
blurb,
help,
author,
copyrights,
copyright_date,
NULL,
"RGB*, GRAY*",
GIMP_PLUGIN,

View File

@ -96,12 +96,15 @@ query (void)
"Philipp Klaus",
"Internet Access AG",
"1998",
N_("<Image>/Filters/Colors/_Border Average..."),
N_("_Border Average..."),
"RGB*",
GIMP_PLUGIN,
G_N_ELEMENTS (args),
G_N_ELEMENTS (return_vals),
args, return_vals);
gimp_plugin_menu_register ("plug_in_borderaverage",
N_("<Image>/Filters/Colors"));
}
static void

View File

@ -369,12 +369,15 @@ query (void)
"Federico Mena Quintero, Jens Lautenbacher & Sven Neumann",
"Federico Mena Quintero, Jens Lautenbacher & Sven Neumann",
PLUG_IN_VERSION,
N_("<Image>/Filters/Map/_Bump Map..."),
N_("_Bump Map..."),
"RGB*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
gimp_plugin_menu_register ("plug_in_bump_map",
N_("<Image>/Filters/Map"));
gimp_install_procedure ("plug_in_bump_map_tiled",
"Create an embossing effect using a tiled image "
"as a bump map",

View File

@ -85,11 +85,14 @@ query (void)
"Federico Mena Quintero",
"Federico Mena Quintero",
"1996",
N_("<Image>/Layer/Colors/Auto/_Stretch Contrast"),
N_("_Stretch Contrast"),
"RGB*, GRAY*, INDEXED*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
gimp_plugin_menu_register ("plug_in_c_astretch",
N_("<Image>/Layer/Colors/Auto"));
}
static void

View File

@ -188,14 +188,16 @@ query (void)
"robert@experimental.net",
"robert@experimental.net",
"June 20th, 1997",
N_("<Image>/Filters/Colors/Colorcube A_nalysis..."),
N_("Colorcube A_nalysis..."),
"RGB*, GRAY*, INDEXED*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), G_N_ELEMENTS (return_vals),
args, return_vals);
gimp_plugin_menu_register ("plug_in_ccanalyze",
N_("<Image>/Layer/Colors/Info/Colorcube A_nalysis..."));
N_("<Image>/Filters/Colors"));
gimp_plugin_menu_register ("plug_in_ccanalyze",
N_("<Image>/Layer/Colors/Info"));
}
/* main function */

View File

@ -223,11 +223,14 @@ query (void)
"Martin Guldahl <mguldahl@xmission.com>",
"Martin Guldahl <mguldahl@xmission.com>",
"2002",
N_("<Image>/Filters/Colors/Channel Mi_xer.."),
N_("Channel Mi_xer.."),
"RGB*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
gimp_plugin_menu_register (PLUG_IN_NAME,
N_("<Image>/Filters/Colors"));
}
/*----------------------------------------------------------------------

View File

@ -91,11 +91,14 @@ query (void)
"Brent Burton & the Edward Blevins",
"Brent Burton & the Edward Blevins",
"1997",
N_("<Image>/Filters/Render/Pattern/_Checkerboard..."),
N_("_Checkerboard..."),
"RGB*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
gimp_plugin_menu_register ("plug_in_checkerboard",
N_("<Image>/Filters/Render/Pattern"));
}
static void

View File

@ -89,11 +89,14 @@ query (void)
"Martin Weber",
"Martin Weber",
"1997",
N_("<Image>/Layer/Colors/Auto/_Color Enhance"),
N_("_Color Enhance"),
"RGB*, INDEXED*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
gimp_plugin_menu_register ("plug_in_color_enhance",
N_("<Image>/Layer/Colors/Auto"));
}
static void

View File

@ -118,11 +118,14 @@ query (void)
"Francisco Bustamante",
"Francisco Bustamante",
PLUG_IN_VERSION,
N_("<Image>/Filters/Colors/_Colorify..."),
N_("_Colorify..."),
"RGB*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
gimp_plugin_menu_register (PLUG_IN_NAME,
N_("<Image>/Filters/Colors"));
}
static void

View File

@ -96,14 +96,16 @@ query (void)
"Seth Burgess",
"Seth Burgess <sjburges@gimp.org>",
"7th Aug 1999",
N_("<Image>/Filters/Colors/Color to _Alpha..."),
N_("Color to _Alpha..."),
"RGB*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
gimp_plugin_menu_register ("plug_in_colortoalpha",
N_("<Image>/Layer/Transparency/Modify/Color to _Alpha..."));
N_("<Image>/Filters/Colors"));
gimp_plugin_menu_register ("plug_in_colortoalpha",
N_("<Image>/Layer/Transparency/Modify"));
}
static void

View File

@ -291,13 +291,18 @@ query (void)
"Peter Kirchgessner",
"Peter Kirchgessner (peter@kirchgessner.net)",
"1997",
N_("<Image>/Filters/Colors/C_ompose..."),
N_("C_ompose..."),
"GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (args),
G_N_ELEMENTS (return_vals),
args, return_vals);
gimp_plugin_menu_register ("plug_in_compose",
N_("<Image>/Filters/Colors"));
gimp_plugin_menu_register ("plug_in_compose",
N_("<Image>/Image/Mode"));
gimp_install_procedure ("plug_in_drawable_compose",
"Compose an image from multiple drawables of gray images",
"This function creates a new image from "

View File

@ -191,11 +191,14 @@ query (void)
"Lauri Alanko",
"Lauri Alanko",
"1997",
N_("<Image>/Filters/Generic/_Convolution Matrix..."),
N_("_Convolution Matrix..."),
"RGB*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
gimp_plugin_menu_register ("plug_in_convmatrix",
N_("<Image>/Filters/Generic"));
}
static void

View File

@ -142,11 +142,14 @@ query (void)
"Spencer Kimball & Tracy Scott",
"Spencer Kimball & Tracy Scott",
"1996",
N_("<Image>/Filters/Artistic/_Cubism..."),
N_("_Cubism..."),
"RGB*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
gimp_plugin_menu_register ("plug_in_cubism",
N_("<Image>/Filters/Artistic"));
}
static void

View File

@ -574,7 +574,7 @@ query (void)
PLUG_IN_AUTHOR,
PLUG_IN_COPYRIGHT,
PLUG_IN_VERSION,
N_("<Image>/Filters/Distorts/_Curve Bend..."),
N_("_Curve Bend..."),
PLUG_IN_IMAGE_TYPES,
GIMP_PLUGIN,
G_N_ELEMENTS (args),
@ -582,6 +582,9 @@ query (void)
args,
return_vals);
gimp_plugin_menu_register (PLUG_IN_NAME,
N_("<Image>/Filters/Distorts"));
/* the installation of the Iterator procedure for the bend plugin */
gimp_install_procedure (PLUG_IN_ITER_NAME,
"This procedure calculates the modified values for one iterationstep for the call of plug_in_curve_bend",

View File

@ -239,12 +239,17 @@ query (void)
"Peter Kirchgessner",
"Peter Kirchgessner (peter@kirchgessner.net)",
"1997",
N_("<Image>/Filters/Colors/_Decompose..."),
N_("_Decompose..."),
"RGB*",
GIMP_PLUGIN,
G_N_ELEMENTS (args),
G_N_ELEMENTS (return_vals),
args, return_vals);
gimp_plugin_menu_register ("plug_in_decompose",
N_("<Image>/Filters/Colors"));
gimp_plugin_menu_register ("plug_in_decompose",
N_("<Image>/Image/Mode"));
}
static void

View File

@ -88,11 +88,14 @@ query (void)
"Andrew Kieschnick",
"Andrew Kieschnick",
"1997",
N_("<Image>/Filters/Enhance/_Deinterlace..."),
N_("_Deinterlace..."),
"RGB*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
gimp_plugin_menu_register ("plug_in_deinterlace",
N_("<Image>/Filters/Enhance"));
}
static void

View File

@ -196,11 +196,14 @@ query (void)
"Sean Cier",
"Sean Cier",
PLUG_IN_VERSION,
N_("<Image>/Filters/Combine/_Depth Merge..."),
N_("_Depth Merge..."),
"RGB*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
gimp_plugin_menu_register (PLUG_IN_NAME,
N_("<Image>/Filters/Combine"));
}
static void

View File

@ -152,11 +152,14 @@ query (void)
"Marc Lehmann <pcg@goof.com>",
"Marc Lehmann <pcg@goof.com>",
PLUG_IN_VERSION,
N_("<Image>/Filters/Enhance/Des_tripe..."),
N_("Des_tripe..."),
"RGB*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
gimp_plugin_menu_register (PLUG_IN_NAME,
N_("<Image>/Filters/Enhance"));
}
static void

View File

@ -181,11 +181,14 @@ query (void)
"Federico Mena Quintero",
"Federico Mena Quintero & David Bleecker",
"April 1997, 0.5",
N_("<Image>/Filters/Render/Pattern/_Diffraction Patterns..."),
N_("_Diffraction Patterns..."),
"RGB*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
gimp_plugin_menu_register ("plug_in_diffraction",
N_("<Image>/Filters/Render/Pattern"));
}
static void

View File

@ -148,11 +148,14 @@ query (void)
"Spencer Kimball",
"Stephen Robert Norris",
"1996",
N_("<Image>/Filters/Map/_Displace..."),
N_("_Displace..."),
"RGB*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
gimp_plugin_menu_register ("plug_in_displace",
N_("<Image>/Filters/Map"));
}
static void

View File

@ -136,7 +136,7 @@ query (void)
{ GIMP_PDB_INT32, "edgemode", "Edge detection algorithm: { SOBEL (0), PREWITT (1), GRADIENT (2), ROBERTS (3), DIFFERENTIAL (4), LAPLACE (5) }" }
};
gchar *help_string =
const gchar *help_string =
"Perform edge detection on the contents of the specified drawable."
"AMOUNT is an arbitrary constant, WRAPMODE is like displace plug-in "
"(useful for tilable image). EDGEMODE sets the kind of matrix "
@ -149,11 +149,14 @@ query (void)
"Peter Mattis & (ported to 1.0 by) Eiichi Takamori",
"Peter Mattis",
"1996",
N_("<Image>/Filters/Edge-Detect/_Edge..."),
N_("_Edge..."),
"RGB*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
gimp_plugin_menu_register ("plug_in_edge",
N_("<Image>/Filters/Edge-Detect"));
}
static void

View File

@ -151,11 +151,14 @@ query (void)
"Eric L. Hernes, John Schlag",
"Eric L. Hernes",
"1997",
N_("<Image>/Filters/Distorts/_Emboss..."),
N_("_Emboss..."),
"RGB*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
gimp_plugin_menu_register ("plug_in_emboss",
N_("<Image>/Filters/Distorts"));
}
static void

View File

@ -103,11 +103,14 @@ query (void)
"Spencer Kimball & Peter Mattis, Eiichi Takamori, Torsten Martinsen",
"Spencer Kimball & Peter Mattis, Eiichi Takamori, Torsten Martinsen",
"1995,1996,1997",
N_("<Image>/Filters/Distorts/En_grave..."),
N_("En_grave..."),
"RGBA, GRAYA",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
gimp_plugin_menu_register ("plug_in_engrave",
N_("<Image>/Filters/Distorts"));
}
static void

View File

@ -135,11 +135,14 @@ query (void)
"robert@experimental.net",
"robert@experimental.net",
"June 17th, 1997",
N_("<Image>/Filters/Colors/Map/_Color Exchange..."),
N_("_Color Exchange..."),
"RGB*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
gimp_plugin_menu_register ("plug_in_exchange",
N_("<Image>/Filters/Colors/Map"));
}
/* main function */

View File

@ -244,12 +244,15 @@ query (void)
"Peter Kirchgessner",
"Peter Kirchgessner (peter@kirchgessner.net)",
"1997",
N_("<Image>/Filters/Combine/_Film..."),
N_("_Film..."),
"INDEXED*, GRAY*, RGB*",
GIMP_PLUGIN,
G_N_ELEMENTS (args),
G_N_ELEMENTS (return_vals),
args, return_vals);
gimp_plugin_menu_register ("plug_in_film",
N_("<Image>/Filters/Combine"));
}
static void

View File

@ -186,13 +186,15 @@ query (void)
"Karl-Johan Andersson", /* Author */
"Karl-Johan Andersson", /* Copyright */
"May 2000",
/* don't translate '<Image>' entry,
* it is keyword for the gtk toolkit */
N_("<Image>/Filters/Light Effects/_FlareFX..."),
N_("_FlareFX..."),
"RGB*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
gimp_plugin_menu_register ("plug_in_flarefx",
/* don't translate '<Image>' */
N_("<Image>/Filters/Light Effects"));
}
static void

View File

@ -128,11 +128,14 @@ query (void)
"Hirotsuna Mizuno <s1041150@u-aizu.ac.jp>",
"Copyright (C) 1997 Hirotsuna Mizuno",
PLUG_IN_VERSION,
N_("<Image>/Filters/Map/_Fractal Trace..."),
N_("_Fractal Trace..."),
"RGB*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
gimp_plugin_menu_register (PLUG_IN_NAME,
N_("<Image>/Filters/Map"));
}
/******************************************************************************/

View File

@ -136,15 +136,15 @@ query (void)
"Sven Neumann <sven@gimp.org>, Henrik Brix Andersen <brix@gimp.org>",
"1998 - 2003",
"v0.9.7 (2003/11/15)",
N_("<Toolbox>/File/Acquire/_Screen Shot..."),
N_("_Screen Shot..."),
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (args),
G_N_ELEMENTS (return_vals),
args, return_vals);
gimp_plugin_menu_register (PLUG_IN_NAME,
N_("<Image>/File/Acquire/_Screen Shot..."));
gimp_plugin_menu_register (PLUG_IN_NAME, N_("<Toolbox>/File/Acquire"));
/* gimp_plugin_menu_register (PLUG_IN_NAME, N_("<Image>/File/Acquire")); */
}
static void

View File

@ -319,8 +319,46 @@ HELP
if (! strcmp (procedure_name, proc_def->db_info.name))
{
proc_def->menu_paths = g_list_append (proc_def->menu_paths,
g_strdup (menu_path));
if (proc_def->menu_label)
{
GError *error = NULL;
if (! plug_in_proc_args_check (gimp->current_plug_in->name,
gimp->current_plug_in->prog,
procedure_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,
&error))
{
g_message (error->message);
g_clear_error (&error);
success = FALSE;
}
else
{
proc_def->menu_paths = g_list_append (proc_def->menu_paths,
g_strdup (menu_path));
}
}
else
{
g_message ("Plug-In \"%s\"\n(%s)\n\n"
"attempted to install additional menu_path \"%s\"\n"
"for procedure \"%s\".\n"
"However the menu_path given in "
"gimp_install_procedure() already contained "
"a path. To make this work, pass just the menu's "
"label to gimp_install_procedure().",
gimp_filename_to_utf8 (gimp->current_plug_in->name),
gimp_filename_to_utf8 (gimp->current_plug_in->prog),
menu_path, procedure_name);
success = FALSE;
}
break;
}
@ -344,10 +382,11 @@ match_strings (regex_t *preg,
}
CODE
@headers = qw(<string.h> <stdlib.h> "regexrepl/regex.h" "core/gimp.h"
@headers = qw(<string.h> <stdlib.h> "regexrepl/regex.h"
"libgimpbase/gimpprotocol.h" "core/gimp.h"
"plug-in/plug-in.h" "plug-in/plug-ins.h"
"plug-in/plug-in-def.h" "plug-in/plug-in-proc.h"
"plug-in/plug-in-progress.h");
"plug-in/plug-in-def.h" "plug-in/plug-in-params.h"
"plug-in/plug-in-proc.h" "plug-in/plug-in-progress.h");
@procs = qw(progress_init progress_update plugins_query
plugin_domain_register plugin_help_register plugin_menu_register);