1997-11-25 06:05:25 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
1998-04-13 13:44:11 +08:00
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
2000-07-16 20:49:04 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "config.h"
|
1999-03-07 20:56:03 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
#include "string.h"
|
1999-06-22 04:04:04 +08:00
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
#include <gtk/gtk.h>
|
1999-06-15 06:18:02 +08:00
|
|
|
|
2001-05-21 21:58:46 +08:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
#include "gui-types.h"
|
2001-05-22 04:30:16 +08:00
|
|
|
|
2003-02-11 20:07:31 +08:00
|
|
|
#include "core/gimp.h"
|
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
#include "plug-in/plug-ins.h"
|
|
|
|
#include "plug-in/plug-in-def.h"
|
|
|
|
#include "plug-in/plug-in-proc.h"
|
2003-01-30 19:20:12 +08:00
|
|
|
#include "plug-in/plug-in-run.h"
|
2001-12-01 08:14:14 +08:00
|
|
|
|
2001-11-28 03:27:55 +08:00
|
|
|
#include "widgets/gimpitemfactory.h"
|
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
#include "plug-in-commands.h"
|
|
|
|
#include "plug-in-menus.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-05-11 07:30:09 +08:00
|
|
|
#include "libgimpbase/gimpenv.h"
|
2003-03-26 00:38:19 +08:00
|
|
|
#include "gimp-intl.h"
|
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
|
|
|
|
Bit of a large checkin this - it's basically three things: 1 - GimpModules
Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk>
Bit of a large checkin this - it's basically three things:
1 - GimpModules using gmodules to dynamically load and
initialise modules at gimp start of day.
2 - Color selectors now register themselves with a color
notebook.
3 - progress bars have been cleaned up a bit, so now have
progress indictations on all transform tool and gradient
fill operations. Not done bucket fill, but that seems to
be the next candidate.
New directories:
* modules/: new directory for dynamically loadable modules.
New files:
* modules/.cvsignore
* modules/Makefile.am
* modules/colorsel_gtk.c: GTK color selector wrapped up as a
color selector the gimp can use.
* app/gimpprogress.[ch]: progress bars within gimp core, either as
popups, or in the status bar. This is mainly code moved out
of plug-in.c
* app/color_notebook.[ch]: color selector notebook, implementing
very similar interface to color_select.h so it can be used as
a drop-in replacement for it.
* libgimp/color_selector.h: API color selectors need to implement
to become a page in the color_notebook.
* libgimp/gimpmodule.h: API gimp modules need to implement to be
initialised by gimp at start of day.
Modified files:
* Makefile.am: add modules/ to SUBDIRS
* libgimp/Makefile.am: install gimpmodule.h and color_selector.h
* app/gimprc.[ch]: recognise module-path variable.
* gimprc.in: set module-path variable to something sensible
(currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules").
* app/Makefile.am: build color notebook and gimpprogress
* app/app_procs.c: register internal GIMP color selector with
color notebook.
* app/asupsample.c: call progress function less frequently for
better performance.
* app/asupsample.h: progress_func_t typedef moved to gimpprogress.h
* app/blend.c: make callbacks to a progress function
* app/color_area.c: use a color notebook rather than a color selector
* app/color_panel.c: ditto
* app/color_select.c: export color selector interface for notebook
* app/color_select.h: color_select_init() prototype
* app/flip_tool.c: flip the image every time, rather than every
second click.
* app/interface.c: move progress bar stuff out to
gimpprogress.c. Make the code actually work while we're at it.
* app/interface.h: move prototypes for progress functions out to
gimpprogress.h
* app/plug_in.c: load and initialise modules (if possible). Move
progress bar handling code out to gimpprogress.c
* app/plug_in.h: keep only a gimp_progress * for each plugin, not
a whole bunch of GtkWidgets.
* app/scale_tool.c
* app/rotate_tool.c
* app/shear_tool.c
* app/perspective_tool.c: progress bar during operation.
De-sensitise the dialog to discourage the user from running
two transforms in parallel.
* app/transform_core.c: recalculate grid coords when bounding box
changes. Only initialise the action area of the dialog once,
to avoid multiple "ok" / "reset" buttons appearing. Undraw
transform tool with correct matrix to get rid of handle
remains on screen. Call a progress function as we apply the
transform matrix. A few new i18n markups. Invalidate
floating selection marching ants after applying matrix.
* app/transform_core.h: transform_core_do() takes an optional
progress callback argument (and data).
* plug-ins/oilify/oilify.c: send progress bar updates after every
pixel region, not only if they processed a multiple of 5
pixels (which was quite unlikely, and therefore gave a jerky
progress indication).
1999-01-11 08:57:33 +08:00
|
|
|
|
2002-12-11 00:38:16 +08:00
|
|
|
typedef struct _PlugInMenuEntry PlugInMenuEntry;
|
|
|
|
|
|
|
|
struct _PlugInMenuEntry
|
|
|
|
{
|
|
|
|
PlugInProcDef *proc_def;
|
|
|
|
const gchar *domain;
|
|
|
|
const gchar *help_path;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* local function prototypes */
|
|
|
|
|
|
|
|
static gboolean plug_in_menu_tree_traverse_func (gpointer foo,
|
|
|
|
PlugInMenuEntry *menu_entry,
|
2003-01-11 01:55:53 +08:00
|
|
|
GimpItemFactory *item_factory);
|
2002-12-11 00:38:16 +08:00
|
|
|
static gchar * plug_in_escape_uline (const gchar *menu_path);
|
|
|
|
|
|
|
|
|
|
|
|
/* public functions */
|
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
void
|
2003-01-18 02:07:37 +08:00
|
|
|
plug_in_menus_init (Gimp *gimp,
|
|
|
|
GSList *plug_in_defs,
|
2002-12-11 00:38:16 +08:00
|
|
|
const gchar *std_plugins_domain)
|
These changes enable help support for 3rd party plug-ins which install
2000-05-21 Michael Natterer <mitch@gimp.org>
These changes enable help support for 3rd party plug-ins which
install their help files outside GIMP's main help dir.
Instead of calling gimp_help(), gimp_plugin_help_func() etc.,
all help callbacks now have to call gimp_standard_help_func()
which has different implementations in the app and in libgimp.
There is a new function gimp_plugin_help_register() which can
be called during plug-in query. plug_in.c keeps a list of
executable_name/help_path pairs. Plug-ins have to pass their
exec. name to gimp_help() which uses the list to find the plug-in's
help directory.
* app/gimphelp.[ch]: gimp_help() now takes a help_path parameter.
help_path == NULL means the standard help directory. Various
changes to pass the help_path to the help browser.
* app/gimprc.c: save the plug-in's help_path in the pluginrc file.
* app/menus.c: ugly hack to enable help_paths in the "F1" callback.
* app/plug_in.[ch]: many help_path related changes. Use g_basename()
instead of strrchr(str,G_DIR_SEPARATOR), cosmetic cleanups.
* app/internal_procs.c
* app/gimphelp_cmds.c
* tools/pdbgen/pdb/gimphelp.pdb: new procedure
gimp_plugin_help_register(). gimp_help() takes a second parameter
which is the executable name (not the help_path).
* app/color_notebook.c
* app/commands.c
* app/lc_dialog.c
* app/preferences_dialog.c
* app/tools.c: call gimp_standard_help_func() instead of gimp_help().
* libgimp/gimp.c: new function gimp_get_progname() which returns
the full path of the plug-in's executable.
* libgimp/gimp.h: export the new function,
removed gimp_plugin_help_func(), gimp_help() takes the executable
name as second parameter.
* libgimp/gimpcompat.h: added gimp_plugin_help_func().
* libgimp/gimphelp.c: a wrapper for gimp_plugin_help_register(),
changed the calls to gimp_help.
* libgimp/gimphelpui.[ch]: call gimp_standard_help_func() instead
of gimp_help().
* plug-ins/helpbrowser/helpbrowser.c: now called with an additional
help_path parameter. Various changes to enable
help_path != gimp_standard_help_path.
Unrelated stuff:
* app/batch.h: added missing GPL header.
* app/gimpunit.c: had a LGPL header, merged some fprintf's into
one call.
* app/procedural_db.[ch]: cosmetic: g* types, s/g_malloc/g_new/,
prototypes, indentation.
* app/resize.c: use less packing widgets. didn't find the "offset"
redraw bug :(
2000-05-22 01:41:02 +08:00
|
|
|
{
|
2003-01-13 22:08:10 +08:00
|
|
|
GSList *domains = NULL;
|
|
|
|
GSList *tmp;
|
2002-12-11 00:38:16 +08:00
|
|
|
|
|
|
|
g_return_if_fail (std_plugins_domain != NULL);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
domains = g_slist_append (domains, (gpointer) std_plugins_domain);
|
2000-07-16 20:49:04 +08:00
|
|
|
|
2002-12-11 00:38:16 +08:00
|
|
|
bindtextdomain (std_plugins_domain, gimp_locale_directory ());
|
|
|
|
bind_textdomain_codeset (std_plugins_domain, "UTF-8");
|
Bit of a large checkin this - it's basically three things: 1 - GimpModules
Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk>
Bit of a large checkin this - it's basically three things:
1 - GimpModules using gmodules to dynamically load and
initialise modules at gimp start of day.
2 - Color selectors now register themselves with a color
notebook.
3 - progress bars have been cleaned up a bit, so now have
progress indictations on all transform tool and gradient
fill operations. Not done bucket fill, but that seems to
be the next candidate.
New directories:
* modules/: new directory for dynamically loadable modules.
New files:
* modules/.cvsignore
* modules/Makefile.am
* modules/colorsel_gtk.c: GTK color selector wrapped up as a
color selector the gimp can use.
* app/gimpprogress.[ch]: progress bars within gimp core, either as
popups, or in the status bar. This is mainly code moved out
of plug-in.c
* app/color_notebook.[ch]: color selector notebook, implementing
very similar interface to color_select.h so it can be used as
a drop-in replacement for it.
* libgimp/color_selector.h: API color selectors need to implement
to become a page in the color_notebook.
* libgimp/gimpmodule.h: API gimp modules need to implement to be
initialised by gimp at start of day.
Modified files:
* Makefile.am: add modules/ to SUBDIRS
* libgimp/Makefile.am: install gimpmodule.h and color_selector.h
* app/gimprc.[ch]: recognise module-path variable.
* gimprc.in: set module-path variable to something sensible
(currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules").
* app/Makefile.am: build color notebook and gimpprogress
* app/app_procs.c: register internal GIMP color selector with
color notebook.
* app/asupsample.c: call progress function less frequently for
better performance.
* app/asupsample.h: progress_func_t typedef moved to gimpprogress.h
* app/blend.c: make callbacks to a progress function
* app/color_area.c: use a color notebook rather than a color selector
* app/color_panel.c: ditto
* app/color_select.c: export color selector interface for notebook
* app/color_select.h: color_select_init() prototype
* app/flip_tool.c: flip the image every time, rather than every
second click.
* app/interface.c: move progress bar stuff out to
gimpprogress.c. Make the code actually work while we're at it.
* app/interface.h: move prototypes for progress functions out to
gimpprogress.h
* app/plug_in.c: load and initialise modules (if possible). Move
progress bar handling code out to gimpprogress.c
* app/plug_in.h: keep only a gimp_progress * for each plugin, not
a whole bunch of GtkWidgets.
* app/scale_tool.c
* app/rotate_tool.c
* app/shear_tool.c
* app/perspective_tool.c: progress bar during operation.
De-sensitise the dialog to discourage the user from running
two transforms in parallel.
* app/transform_core.c: recalculate grid coords when bounding box
changes. Only initialise the action area of the dialog once,
to avoid multiple "ok" / "reset" buttons appearing. Undraw
transform tool with correct matrix to get rid of handle
remains on screen. Call a progress function as we apply the
transform matrix. A few new i18n markups. Invalidate
floating selection marching ants after applying matrix.
* app/transform_core.h: transform_core_do() takes an optional
progress callback argument (and data).
* plug-ins/oilify/oilify.c: send progress bar updates after every
pixel region, not only if they processed a multiple of 5
pixels (which was quite unlikely, and therefore gave a jerky
progress indication).
1999-01-11 08:57:33 +08:00
|
|
|
|
2002-12-11 00:38:16 +08:00
|
|
|
for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp))
|
2002-03-21 01:46:13 +08:00
|
|
|
{
|
2003-01-13 22:08:10 +08:00
|
|
|
PlugInDef *plug_in_def;
|
2002-12-11 00:38:16 +08:00
|
|
|
const gchar *locale_domain;
|
|
|
|
const gchar *locale_path;
|
|
|
|
GSList *list;
|
|
|
|
|
2003-01-13 22:08:10 +08:00
|
|
|
plug_in_def = (PlugInDef *) tmp->data;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-12-11 00:38:16 +08:00
|
|
|
if (! plug_in_def->proc_defs)
|
|
|
|
continue;
|
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
locale_domain = plug_ins_locale_domain (gimp,
|
|
|
|
plug_in_def->prog,
|
2002-12-11 00:38:16 +08:00
|
|
|
&locale_path);
|
|
|
|
|
|
|
|
for (list = domains; list; list = list->next)
|
|
|
|
{
|
|
|
|
if (! strcmp (locale_domain, (gchar *) list->data))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! list)
|
|
|
|
{
|
|
|
|
domains = g_slist_append (domains, (gpointer) locale_domain);
|
|
|
|
|
|
|
|
bindtextdomain (locale_domain, locale_path);
|
|
|
|
bind_textdomain_codeset (locale_domain, "UTF-8");
|
|
|
|
}
|
|
|
|
}
|
1999-05-07 04:56:07 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
g_slist_free (domains);
|
|
|
|
}
|
1999-05-07 04:56:07 +08:00
|
|
|
|
2002-12-11 00:38:16 +08:00
|
|
|
void
|
2003-01-18 02:07:37 +08:00
|
|
|
plug_in_menus_create (GimpItemFactory *item_factory,
|
|
|
|
GSList *proc_defs)
|
2002-09-23 17:48:52 +08:00
|
|
|
{
|
2002-12-11 00:38:16 +08:00
|
|
|
PlugInProcDef *proc_def;
|
|
|
|
GSList *procs;
|
|
|
|
GTree *menu_entries;
|
2002-09-23 17:48:52 +08:00
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
g_return_if_fail (GIMP_IS_ITEM_FACTORY (item_factory));
|
2002-12-11 00:38:16 +08:00
|
|
|
g_return_if_fail (proc_defs != NULL);
|
2002-09-23 17:48:52 +08:00
|
|
|
|
2002-12-11 00:38:16 +08:00
|
|
|
menu_entries = g_tree_new_full ((GCompareDataFunc) g_utf8_collate, NULL,
|
|
|
|
NULL, g_free);
|
2002-09-23 17:48:52 +08:00
|
|
|
|
2002-12-11 00:38:16 +08:00
|
|
|
for (procs = proc_defs; procs; procs = procs->next)
|
2002-09-23 17:48:52 +08:00
|
|
|
{
|
2002-12-11 00:38:16 +08:00
|
|
|
proc_def = procs->data;
|
2002-09-23 17:48:52 +08:00
|
|
|
|
2002-12-11 00:38:16 +08:00
|
|
|
if (proc_def->prog &&
|
|
|
|
proc_def->menu_path &&
|
|
|
|
! proc_def->extensions &&
|
|
|
|
! proc_def->prefixes &&
|
|
|
|
! proc_def->magics)
|
|
|
|
{
|
|
|
|
PlugInMenuEntry *menu_entry;
|
2003-01-18 02:07:37 +08:00
|
|
|
const gchar *progname;
|
2002-12-11 00:38:16 +08:00
|
|
|
const gchar *locale_domain;
|
2003-01-18 02:07:37 +08:00
|
|
|
const gchar *help_path;
|
|
|
|
|
|
|
|
progname = plug_in_proc_def_get_progname (proc_def);
|
2002-09-23 17:48:52 +08:00
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
locale_domain = plug_ins_locale_domain (item_factory->gimp,
|
|
|
|
progname, NULL);
|
|
|
|
help_path = plug_ins_help_path (item_factory->gimp,
|
|
|
|
progname);
|
2002-09-23 17:48:52 +08:00
|
|
|
|
2002-12-11 00:38:16 +08:00
|
|
|
menu_entry = g_new0 (PlugInMenuEntry, 1);
|
2002-09-23 17:48:52 +08:00
|
|
|
|
2002-12-11 00:38:16 +08:00
|
|
|
menu_entry->proc_def = proc_def;
|
|
|
|
menu_entry->domain = locale_domain;
|
2003-01-18 02:07:37 +08:00
|
|
|
menu_entry->help_path = help_path;
|
2002-12-11 00:38:16 +08:00
|
|
|
|
|
|
|
g_tree_insert (menu_entries,
|
|
|
|
dgettext (locale_domain, proc_def->menu_path),
|
|
|
|
menu_entry);
|
|
|
|
}
|
2002-09-23 17:48:52 +08:00
|
|
|
}
|
|
|
|
|
2002-12-11 00:38:16 +08:00
|
|
|
g_tree_foreach (menu_entries,
|
|
|
|
(GTraverseFunc) plug_in_menu_tree_traverse_func,
|
2003-01-11 01:55:53 +08:00
|
|
|
item_factory);
|
2002-12-11 00:38:16 +08:00
|
|
|
g_tree_destroy (menu_entries);
|
2002-09-23 17:48:52 +08:00
|
|
|
}
|
|
|
|
|
2002-12-11 00:38:16 +08:00
|
|
|
void
|
2003-01-18 02:07:37 +08:00
|
|
|
plug_in_menus_create_entry (GimpItemFactory *item_factory,
|
|
|
|
PlugInProcDef *proc_def,
|
|
|
|
const gchar *locale_domain,
|
|
|
|
const gchar *help_path)
|
1999-05-07 04:56:07 +08:00
|
|
|
{
|
2002-03-21 01:46:13 +08:00
|
|
|
GimpItemFactoryEntry entry;
|
2002-09-23 17:48:52 +08:00
|
|
|
gchar *menu_path;
|
2002-03-21 01:46:13 +08:00
|
|
|
gchar *help_page;
|
|
|
|
gchar *basename;
|
|
|
|
gchar *lowercase_page;
|
2000-07-16 20:49:04 +08:00
|
|
|
|
2003-01-11 01:55:53 +08:00
|
|
|
g_return_if_fail (item_factory == NULL ||
|
|
|
|
GIMP_IS_ITEM_FACTORY (item_factory));
|
2002-03-21 01:46:13 +08:00
|
|
|
|
2002-12-11 00:38:16 +08:00
|
|
|
basename = g_path_get_basename (proc_def->prog);
|
|
|
|
|
|
|
|
if (help_path)
|
1999-05-07 04:56:07 +08:00
|
|
|
{
|
2002-12-11 00:38:16 +08:00
|
|
|
help_page = g_strconcat (help_path,
|
2002-03-21 01:46:13 +08:00
|
|
|
"@", /* HACK: locale subdir */
|
|
|
|
basename,
|
|
|
|
".html",
|
|
|
|
NULL);
|
1999-05-07 04:56:07 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-03-21 01:46:13 +08:00
|
|
|
help_page = g_strconcat ("filters/", /* _not_ G_DIR_SEPARATOR_S */
|
|
|
|
basename,
|
|
|
|
".html",
|
|
|
|
NULL);
|
1999-05-07 04:56:07 +08:00
|
|
|
}
|
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
g_free (basename);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
lowercase_page = g_ascii_strdown (help_page, -1);
|
2001-10-20 00:41:09 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
g_free (help_page);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-12-11 00:38:16 +08:00
|
|
|
menu_path = plug_in_escape_uline (strstr (proc_def->menu_path, "/"));
|
2002-09-23 17:48:52 +08:00
|
|
|
|
|
|
|
entry.entry.path = menu_path;
|
2002-12-11 00:38:16 +08:00
|
|
|
entry.entry.accelerator = proc_def->accelerator;
|
2002-03-21 01:46:13 +08:00
|
|
|
entry.entry.callback = plug_in_run_cmd_callback;
|
|
|
|
entry.entry.callback_action = 0;
|
|
|
|
entry.entry.item_type = NULL;
|
|
|
|
entry.quark_string = NULL;
|
|
|
|
entry.help_page = lowercase_page;
|
|
|
|
entry.description = NULL;
|
2000-07-16 20:49:04 +08:00
|
|
|
|
2003-01-11 01:55:53 +08:00
|
|
|
if (item_factory)
|
2002-12-11 00:38:16 +08:00
|
|
|
{
|
2003-01-11 01:55:53 +08:00
|
|
|
gchar *factory_path;
|
|
|
|
|
|
|
|
factory_path = GTK_ITEM_FACTORY (item_factory)->path;
|
|
|
|
|
|
|
|
if (! strncmp (proc_def->menu_path,
|
|
|
|
factory_path, strlen (factory_path)))
|
2002-12-11 00:38:16 +08:00
|
|
|
{
|
2003-01-11 01:55:53 +08:00
|
|
|
gimp_item_factory_create_item (item_factory,
|
2002-12-11 00:38:16 +08:00
|
|
|
&entry,
|
2003-01-18 02:07:37 +08:00
|
|
|
locale_domain,
|
2002-12-11 00:38:16 +08:00
|
|
|
&proc_def->db_info, 2,
|
|
|
|
TRUE, FALSE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GList *list;
|
|
|
|
|
|
|
|
for (list = gimp_item_factories_from_path (proc_def->menu_path);
|
|
|
|
list;
|
|
|
|
list = g_list_next (list))
|
|
|
|
{
|
2003-01-11 01:55:53 +08:00
|
|
|
item_factory = list->data;
|
2002-12-11 00:38:16 +08:00
|
|
|
|
|
|
|
gimp_item_factory_create_item (item_factory,
|
|
|
|
&entry,
|
2003-01-18 02:07:37 +08:00
|
|
|
locale_domain,
|
2002-12-11 00:38:16 +08:00
|
|
|
&proc_def->db_info, 2,
|
|
|
|
TRUE, FALSE);
|
|
|
|
}
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-09-23 17:48:52 +08:00
|
|
|
g_free (menu_path);
|
2002-08-27 22:45:05 +08:00
|
|
|
g_free (lowercase_page);
|
2002-03-21 01:46:13 +08:00
|
|
|
}
|
2000-08-15 23:42:14 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
void
|
2003-01-18 02:07:37 +08:00
|
|
|
plug_in_menus_delete_entry (const gchar *menu_path)
|
2002-03-21 01:46:13 +08:00
|
|
|
{
|
2002-12-11 00:38:16 +08:00
|
|
|
GList *list;
|
|
|
|
|
|
|
|
g_return_if_fail (menu_path != NULL);
|
2000-08-15 23:42:14 +08:00
|
|
|
|
2002-12-11 00:38:16 +08:00
|
|
|
for (list = gimp_item_factories_from_path (menu_path);
|
|
|
|
list;
|
|
|
|
list = g_list_next (list))
|
|
|
|
{
|
|
|
|
GtkItemFactory *item_factory = list->data;
|
2000-08-15 23:42:14 +08:00
|
|
|
|
2002-12-11 00:38:16 +08:00
|
|
|
gtk_item_factory_delete_item (GTK_ITEM_FACTORY (item_factory), menu_path);
|
|
|
|
}
|
2002-03-21 01:46:13 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
void
|
2003-01-13 22:08:10 +08:00
|
|
|
plug_in_menus_update (GimpItemFactory *item_factory,
|
|
|
|
GimpImageType type)
|
2002-03-21 01:46:13 +08:00
|
|
|
{
|
2002-12-11 00:38:16 +08:00
|
|
|
PlugInProcDef *proc_def;
|
|
|
|
GSList *tmp;
|
2003-01-11 01:55:53 +08:00
|
|
|
gchar *factory_path;
|
|
|
|
gboolean is_image_factory = FALSE;
|
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_ITEM_FACTORY (item_factory));
|
|
|
|
|
|
|
|
factory_path = GTK_ITEM_FACTORY (item_factory)->path;
|
2002-12-11 00:38:16 +08:00
|
|
|
|
2003-01-11 01:55:53 +08:00
|
|
|
if (! strcmp (factory_path, "<Image>"))
|
|
|
|
is_image_factory = TRUE;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-02-11 20:07:31 +08:00
|
|
|
for (tmp = item_factory->gimp->plug_in_proc_defs;
|
|
|
|
tmp;
|
|
|
|
tmp = g_slist_next (tmp))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-03-21 01:46:13 +08:00
|
|
|
proc_def = tmp->data;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
if (proc_def->image_types_val && proc_def->menu_path)
|
2002-12-11 00:38:16 +08:00
|
|
|
{
|
2003-01-11 01:55:53 +08:00
|
|
|
gboolean sensitive;
|
|
|
|
|
2002-12-11 00:38:16 +08:00
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case GIMP_RGB_IMAGE:
|
|
|
|
sensitive = proc_def->image_types_val & PLUG_IN_RGB_IMAGE;
|
|
|
|
break;
|
|
|
|
case GIMP_RGBA_IMAGE:
|
|
|
|
sensitive = proc_def->image_types_val & PLUG_IN_RGBA_IMAGE;
|
|
|
|
break;
|
|
|
|
case GIMP_GRAY_IMAGE:
|
|
|
|
sensitive = proc_def->image_types_val & PLUG_IN_GRAY_IMAGE;
|
|
|
|
break;
|
|
|
|
case GIMP_GRAYA_IMAGE:
|
|
|
|
sensitive = proc_def->image_types_val & PLUG_IN_GRAYA_IMAGE;
|
|
|
|
break;
|
|
|
|
case GIMP_INDEXED_IMAGE:
|
|
|
|
sensitive = proc_def->image_types_val & PLUG_IN_INDEXED_IMAGE;
|
|
|
|
break;
|
|
|
|
case GIMP_INDEXEDA_IMAGE:
|
|
|
|
sensitive = proc_def->image_types_val & PLUG_IN_INDEXEDA_IMAGE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
sensitive = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2003-01-11 01:55:53 +08:00
|
|
|
if (! strncmp (proc_def->menu_path, factory_path,
|
|
|
|
strlen (factory_path)))
|
|
|
|
{
|
|
|
|
gimp_item_factory_set_sensitive (GTK_ITEM_FACTORY (item_factory),
|
2002-12-11 00:38:16 +08:00
|
|
|
proc_def->menu_path,
|
|
|
|
sensitive);
|
2003-01-11 01:55:53 +08:00
|
|
|
}
|
2002-02-12 10:41:01 +08:00
|
|
|
|
2003-02-11 20:07:31 +08:00
|
|
|
if (is_image_factory &&
|
|
|
|
item_factory->gimp->last_plug_in &&
|
|
|
|
item_factory->gimp->last_plug_in == &proc_def->db_info)
|
2002-12-11 00:38:16 +08:00
|
|
|
{
|
2003-02-18 22:08:14 +08:00
|
|
|
const gchar *progname;
|
|
|
|
const gchar *path;
|
|
|
|
gchar *basename;
|
|
|
|
gchar *ellipses;
|
|
|
|
gchar *repeat;
|
|
|
|
gchar *reshow;
|
2002-02-12 10:41:01 +08:00
|
|
|
|
2003-02-18 22:08:14 +08:00
|
|
|
progname = plug_in_proc_def_get_progname (proc_def);
|
|
|
|
|
|
|
|
path = dgettext (plug_ins_locale_domain (item_factory->gimp,
|
|
|
|
progname, NULL),
|
|
|
|
proc_def->menu_path);
|
|
|
|
|
|
|
|
basename = g_path_get_basename (path);
|
2002-02-12 10:41:01 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
ellipses = strstr (basename, "...");
|
2000-08-15 23:42:14 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
if (ellipses && ellipses == (basename + strlen (basename) - 3))
|
|
|
|
*ellipses = '\0';
|
2000-08-15 23:42:14 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
repeat = g_strdup_printf (_("Repeat \"%s\""), basename);
|
|
|
|
reshow = g_strdup_printf (_("Re-show \"%s\""), basename);
|
1998-01-26 06:13:00 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
g_free (basename);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-01-11 01:55:53 +08:00
|
|
|
gimp_item_factory_set_label (GTK_ITEM_FACTORY (item_factory),
|
|
|
|
"/Filters/Repeat Last", repeat);
|
|
|
|
gimp_item_factory_set_label (GTK_ITEM_FACTORY (item_factory),
|
|
|
|
"/Filters/Re-Show Last", reshow);
|
2000-08-15 23:42:14 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
g_free (repeat);
|
|
|
|
g_free (reshow);
|
1998-01-26 06:13:00 +08:00
|
|
|
|
2003-01-11 01:55:53 +08:00
|
|
|
gimp_item_factory_set_sensitive (GTK_ITEM_FACTORY (item_factory),
|
|
|
|
"/Filters/Repeat Last",
|
|
|
|
sensitive);
|
|
|
|
gimp_item_factory_set_sensitive (GTK_ITEM_FACTORY (item_factory),
|
|
|
|
"/Filters/Re-Show Last",
|
|
|
|
sensitive);
|
2002-03-21 01:46:13 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
2000-08-15 23:42:14 +08:00
|
|
|
|
2003-02-11 20:07:31 +08:00
|
|
|
if (is_image_factory && ! item_factory->gimp->last_plug_in)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-01-11 01:55:53 +08:00
|
|
|
gimp_item_factory_set_label (GTK_ITEM_FACTORY (item_factory),
|
|
|
|
"/Filters/Repeat Last",
|
|
|
|
_("Repeat Last"));
|
|
|
|
gimp_item_factory_set_label (GTK_ITEM_FACTORY (item_factory),
|
|
|
|
"/Filters/Re-Show Last",
|
|
|
|
_("Re-Show Last"));
|
|
|
|
|
|
|
|
gimp_item_factory_set_sensitive (GTK_ITEM_FACTORY (item_factory),
|
|
|
|
"/Filters/Repeat Last", FALSE);
|
|
|
|
gimp_item_factory_set_sensitive (GTK_ITEM_FACTORY (item_factory),
|
|
|
|
"/Filters/Re-Show Last", FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2001-05-17 02:09:45 +08:00
|
|
|
}
|
2002-12-11 00:38:16 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* private functions */
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
plug_in_menu_tree_traverse_func (gpointer foo,
|
|
|
|
PlugInMenuEntry *menu_entry,
|
2003-01-11 01:55:53 +08:00
|
|
|
GimpItemFactory *item_factory)
|
2002-12-11 00:38:16 +08:00
|
|
|
{
|
2003-01-18 02:07:37 +08:00
|
|
|
plug_in_menus_create_entry (item_factory,
|
|
|
|
menu_entry->proc_def,
|
|
|
|
menu_entry->domain,
|
|
|
|
menu_entry->help_path);
|
2002-12-11 00:38:16 +08:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gchar *
|
|
|
|
plug_in_escape_uline (const gchar *menu_path)
|
|
|
|
{
|
|
|
|
gchar *uline;
|
|
|
|
gchar *escaped;
|
|
|
|
gchar *tmp;
|
|
|
|
|
|
|
|
escaped = g_strdup (menu_path);
|
|
|
|
|
|
|
|
uline = strchr (escaped, '_');
|
|
|
|
|
|
|
|
while (uline)
|
|
|
|
{
|
|
|
|
tmp = escaped;
|
|
|
|
escaped = g_new (gchar, strlen (tmp) + 2);
|
|
|
|
|
|
|
|
if (uline > tmp)
|
|
|
|
strncpy (escaped, tmp, (uline - tmp));
|
|
|
|
|
|
|
|
escaped[uline - tmp] = '_';
|
|
|
|
strcpy (&escaped[uline - tmp + 1], uline);
|
|
|
|
|
|
|
|
uline = strchr (escaped + (uline - tmp) + 2, '_');
|
|
|
|
|
|
|
|
g_free (tmp);
|
|
|
|
}
|
|
|
|
|
|
|
|
return escaped;
|
|
|
|
}
|