1997-11-25 06:05:25 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2004-09-22 23:12:24 +08:00
|
|
|
* plug-ins.c
|
|
|
|
*
|
1997-11-25 06:05:25 +08:00
|
|
|
* 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
|
|
|
|
2003-09-11 06:06:45 +08:00
|
|
|
#include <glib-object.h>
|
1999-06-15 06:18:02 +08:00
|
|
|
|
2001-05-21 21:58:46 +08:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
|
|
|
#include "libgimpbase/gimpprotocol.h"
|
|
|
|
#include "libgimpbase/gimpwire.h"
|
2005-01-26 03:11:26 +08:00
|
|
|
#include "libgimpconfig/gimpconfig.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
|
2001-12-01 08:14:14 +08:00
|
|
|
#include "plug-in-types.h"
|
2001-05-22 04:30:16 +08:00
|
|
|
|
2002-11-19 04:50:31 +08:00
|
|
|
#include "config/gimpcoreconfig.h"
|
|
|
|
|
2001-07-11 20:39:49 +08:00
|
|
|
#include "core/gimp.h"
|
2001-10-17 19:33:43 +08:00
|
|
|
#include "core/gimpcontext.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpdrawable.h"
|
|
|
|
#include "core/gimpimage.h"
|
2001-04-18 05:43:29 +08:00
|
|
|
|
2006-04-05 01:47:22 +08:00
|
|
|
#include "pdb/gimp-pdb.h"
|
2006-04-06 18:01:30 +08:00
|
|
|
#include "pdb/gimppluginprocedure.h"
|
2006-03-31 17:15:08 +08:00
|
|
|
|
2001-12-01 08:14:14 +08:00
|
|
|
#include "plug-in.h"
|
2002-03-21 01:46:13 +08:00
|
|
|
#include "plug-ins.h"
|
2006-02-21 19:05:43 +08:00
|
|
|
#include "plug-in-data.h"
|
2002-03-21 01:46:13 +08:00
|
|
|
#include "plug-in-def.h"
|
|
|
|
#include "plug-in-params.h"
|
|
|
|
#include "plug-in-progress.h"
|
2001-12-28 07:45:12 +08:00
|
|
|
#include "plug-in-rc.h"
|
2003-01-30 19:20:12 +08:00
|
|
|
#include "plug-in-run.h"
|
2001-12-01 08:14:14 +08:00
|
|
|
|
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
|
|
|
|
2004-05-14 08:01:11 +08:00
|
|
|
#define STD_PLUGINS_DOMAIN GETTEXT_PACKAGE "-std-plug-ins"
|
2002-12-11 00:38:16 +08:00
|
|
|
|
|
|
|
|
2005-03-25 00:08:04 +08:00
|
|
|
typedef struct _PlugInLocaleDomain PlugInLocaleDomain;
|
|
|
|
typedef struct _PlugInHelpDomain PlugInHelpDomain;
|
2002-12-11 00:38:16 +08:00
|
|
|
|
2005-03-25 00:08:04 +08:00
|
|
|
struct _PlugInLocaleDomain
|
2002-12-11 00:38:16 +08:00
|
|
|
{
|
|
|
|
gchar *prog_name;
|
2003-08-29 02:49:11 +08:00
|
|
|
gchar *domain_name;
|
|
|
|
gchar *domain_path;
|
2002-12-11 00:38:16 +08:00
|
|
|
};
|
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
|
|
|
|
2005-03-25 00:08:04 +08:00
|
|
|
struct _PlugInHelpDomain
|
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
|
|
|
{
|
|
|
|
gchar *prog_name;
|
2003-08-29 02:49:11 +08:00
|
|
|
gchar *domain_name;
|
|
|
|
gchar *domain_uri;
|
2000-05-08 06:04:51 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
static void plug_ins_init_file (const GimpDatafileData *file_data,
|
|
|
|
gpointer data);
|
|
|
|
static void plug_ins_add_to_db (Gimp *gimp,
|
|
|
|
GimpContext *context);
|
|
|
|
static GimpPlugInProcedure * plug_ins_proc_def_insert (Gimp *gimp,
|
|
|
|
GimpPlugInProcedure *proc);
|
|
|
|
static gint plug_ins_file_proc_compare (gconstpointer a,
|
|
|
|
gconstpointer b,
|
|
|
|
gpointer data);
|
2000-07-16 20:49:04 +08:00
|
|
|
|
1999-05-07 04:56:07 +08:00
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
/* public functions */
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
void
|
2002-03-21 01:46:13 +08:00
|
|
|
plug_ins_init (Gimp *gimp,
|
2004-07-01 00:55:43 +08:00
|
|
|
GimpContext *context,
|
2002-03-21 01:46:13 +08:00
|
|
|
GimpInitStatusFunc status_callback)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-07-01 00:55:43 +08:00
|
|
|
gchar *filename;
|
|
|
|
gchar *basename;
|
|
|
|
gchar *path;
|
|
|
|
GSList *list;
|
|
|
|
GList *extensions = NULL;
|
2005-10-31 22:30:29 +08:00
|
|
|
gint n_plugins;
|
|
|
|
gint n_extensions;
|
|
|
|
gint nth;
|
2004-07-01 00:55:43 +08:00
|
|
|
GError *error = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-10-20 00:41:09 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2004-07-01 00:55:43 +08:00
|
|
|
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
2001-10-20 00:41:09 +08:00
|
|
|
g_return_if_fail (status_callback != NULL);
|
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
plug_in_init (gimp);
|
2000-07-16 20:49:04 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* search for binaries in the plug-in directory path */
|
2002-12-30 08:01:30 +08:00
|
|
|
path = gimp_config_path_expand (gimp->config->plug_in_path, TRUE, NULL);
|
|
|
|
|
|
|
|
gimp_datafiles_read_directories (path,
|
2002-10-23 22:55:07 +08:00
|
|
|
G_FILE_TEST_IS_EXECUTABLE,
|
2003-02-11 20:07:31 +08:00
|
|
|
plug_ins_init_file,
|
|
|
|
&gimp->plug_in_defs);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-12-30 08:01:30 +08:00
|
|
|
g_free (path);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* read the pluginrc file for cached data */
|
2002-11-19 04:50:31 +08:00
|
|
|
if (gimp->config->plug_in_rc_path)
|
1998-04-11 13:07:52 +08:00
|
|
|
{
|
2002-12-30 08:18:33 +08:00
|
|
|
filename = gimp_config_path_expand (gimp->config->plug_in_rc_path,
|
|
|
|
TRUE, NULL);
|
|
|
|
|
2004-02-01 18:52:23 +08:00
|
|
|
if (! g_path_is_absolute (filename))
|
2002-12-30 08:18:33 +08:00
|
|
|
{
|
2004-02-01 18:52:23 +08:00
|
|
|
gchar *str = g_build_filename (gimp_directory (), filename, NULL);
|
2003-11-08 07:47:35 +08:00
|
|
|
|
2002-12-30 08:18:33 +08:00
|
|
|
g_free (filename);
|
2004-02-01 18:52:23 +08:00
|
|
|
filename = str;
|
2002-12-30 08:18:33 +08:00
|
|
|
}
|
1998-04-11 13:07:52 +08:00
|
|
|
}
|
|
|
|
else
|
2002-03-21 01:46:13 +08:00
|
|
|
{
|
|
|
|
filename = gimp_personal_rc_file ("pluginrc");
|
|
|
|
}
|
1998-04-11 13:07:52 +08:00
|
|
|
|
2005-11-01 18:20:38 +08:00
|
|
|
status_callback (_("Resource configuration"),
|
2005-11-05 20:18:56 +08:00
|
|
|
gimp_filename_to_utf8 (filename), 0.0);
|
2003-11-08 07:47:35 +08:00
|
|
|
|
2005-11-07 06:01:25 +08:00
|
|
|
if (gimp->be_verbose)
|
|
|
|
g_print (_("Parsing '%s'\n"), gimp_filename_to_utf8 (filename));
|
|
|
|
|
2003-11-08 07:47:35 +08:00
|
|
|
if (! plug_in_rc_parse (gimp, filename, &error))
|
|
|
|
{
|
2004-02-09 02:49:58 +08:00
|
|
|
if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT)
|
|
|
|
g_message (error->message);
|
|
|
|
|
2004-02-03 23:12:11 +08:00
|
|
|
g_clear_error (&error);
|
2003-11-08 07:47:35 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2005-11-01 18:20:38 +08:00
|
|
|
/* query any plug-ins that have changed since we last wrote out
|
|
|
|
* the pluginrc file
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
2005-11-05 23:00:35 +08:00
|
|
|
status_callback (_("Querying new Plug-ins"), "", 0.0);
|
2002-08-27 23:23:36 +08:00
|
|
|
|
2005-10-31 22:30:29 +08:00
|
|
|
for (list = gimp->plug_in_defs, n_plugins = 0; list; list = list->next)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-05-14 08:01:11 +08:00
|
|
|
PlugInDef *plug_in_def = list->data;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
if (plug_in_def->needs_query)
|
2005-10-31 22:30:29 +08:00
|
|
|
n_plugins++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (n_plugins)
|
|
|
|
{
|
|
|
|
gimp->write_pluginrc = TRUE;
|
|
|
|
|
2005-11-06 05:56:33 +08:00
|
|
|
for (list = gimp->plug_in_defs, nth = 0; list; list = list->next)
|
2005-10-31 22:30:29 +08:00
|
|
|
{
|
|
|
|
PlugInDef *plug_in_def = list->data;
|
|
|
|
|
|
|
|
if (! plug_in_def->needs_query)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
basename = g_filename_display_basename (plug_in_def->prog);
|
2005-11-05 23:00:35 +08:00
|
|
|
status_callback (NULL, basename,
|
2005-11-06 05:56:33 +08:00
|
|
|
(gdouble) nth++ / (gdouble) n_plugins);
|
2005-10-31 22:30:29 +08:00
|
|
|
g_free (basename);
|
2000-08-15 23:42:14 +08:00
|
|
|
|
2001-12-01 08:14:14 +08:00
|
|
|
if (gimp->be_verbose)
|
2004-01-14 10:03:37 +08:00
|
|
|
g_print (_("Querying plug-in: '%s'\n"),
|
2004-01-19 09:08:43 +08:00
|
|
|
gimp_filename_to_utf8 (plug_in_def->prog));
|
2000-08-15 23:42:14 +08:00
|
|
|
|
2004-04-15 21:10:51 +08:00
|
|
|
plug_in_call_query (gimp, context, plug_in_def);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-04-16 06:16:21 +08:00
|
|
|
/* initialize the plug-ins */
|
2005-11-05 23:00:35 +08:00
|
|
|
status_callback (_("Initializing Plug-ins"), "", 0.0);
|
2004-04-16 06:16:21 +08:00
|
|
|
|
2005-10-31 22:30:29 +08:00
|
|
|
for (list = gimp->plug_in_defs, n_plugins = 0; list; list = list->next)
|
2004-04-16 06:16:21 +08:00
|
|
|
{
|
2004-05-14 08:01:11 +08:00
|
|
|
PlugInDef *plug_in_def = list->data;
|
2004-04-16 06:16:21 +08:00
|
|
|
|
|
|
|
if (plug_in_def->has_init)
|
2005-10-31 22:30:29 +08:00
|
|
|
n_plugins++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (n_plugins)
|
|
|
|
{
|
2005-11-06 05:56:33 +08:00
|
|
|
for (list = gimp->plug_in_defs, nth = 0; list; list = list->next)
|
2005-10-31 22:30:29 +08:00
|
|
|
{
|
|
|
|
PlugInDef *plug_in_def = list->data;
|
|
|
|
|
|
|
|
if (! plug_in_def->has_init)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
basename = g_filename_display_basename (plug_in_def->prog);
|
2005-11-05 23:00:35 +08:00
|
|
|
status_callback (NULL, basename,
|
2005-11-06 05:56:33 +08:00
|
|
|
(gdouble) nth++ / (gdouble) n_plugins);
|
2005-10-31 22:30:29 +08:00
|
|
|
g_free (basename);
|
|
|
|
|
|
|
|
if (gimp->be_verbose)
|
|
|
|
g_print (_("Initializing plug-in: '%s'\n"),
|
2004-04-16 06:16:21 +08:00
|
|
|
gimp_filename_to_utf8 (plug_in_def->prog));
|
|
|
|
|
2005-10-31 22:30:29 +08:00
|
|
|
plug_in_call_init (gimp, context, plug_in_def);
|
|
|
|
}
|
2004-04-16 06:16:21 +08:00
|
|
|
}
|
|
|
|
|
2005-11-05 23:00:35 +08:00
|
|
|
status_callback (NULL, "", 1.0);
|
2004-04-16 06:16:21 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* insert the proc defs */
|
2004-05-14 08:01:11 +08:00
|
|
|
for (list = gimp->plug_in_defs; list; list = list->next)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-05-14 08:01:11 +08:00
|
|
|
PlugInDef *plug_in_def = list->data;
|
|
|
|
GSList *list2;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-05-14 08:01:11 +08:00
|
|
|
for (list2 = plug_in_def->proc_defs; list2; list2 = list2->next)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2006-04-05 16:38:33 +08:00
|
|
|
GimpPlugInProcedure *proc = list2->data;
|
|
|
|
GimpPlugInProcedure *overridden_proc;
|
2003-01-18 02:07:37 +08:00
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
proc->mtime = plug_in_def->mtime;
|
2003-01-18 02:07:37 +08:00
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
overridden_proc = plug_ins_proc_def_insert (gimp, proc);
|
2003-01-18 02:07:37 +08:00
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
if (overridden_proc)
|
2003-01-18 02:07:37 +08:00
|
|
|
{
|
2004-05-14 08:01:11 +08:00
|
|
|
GSList *list3;
|
2003-01-18 02:07:37 +08:00
|
|
|
|
2004-02-11 21:18:51 +08:00
|
|
|
g_printerr ("removing duplicate PDB procedure \"%s\" "
|
|
|
|
"registered by '%s'\n",
|
2006-04-05 16:38:33 +08:00
|
|
|
GIMP_PROCEDURE (overridden_proc)->name,
|
|
|
|
gimp_filename_to_utf8 (overridden_proc->prog));
|
2003-01-18 02:07:37 +08:00
|
|
|
|
2003-11-08 07:47:35 +08:00
|
|
|
/* search the plugin list to see if any plugins had references to
|
2006-04-05 16:38:33 +08:00
|
|
|
* the overridden_proc.
|
2003-01-18 02:07:37 +08:00
|
|
|
*/
|
2004-05-14 08:01:11 +08:00
|
|
|
for (list3 = gimp->plug_in_defs; list3; list3 = list3->next)
|
2003-01-18 02:07:37 +08:00
|
|
|
{
|
2004-05-14 08:01:11 +08:00
|
|
|
PlugInDef *plug_in_def2 = list3->data;
|
2003-01-18 02:07:37 +08:00
|
|
|
|
|
|
|
plug_in_def2->proc_defs =
|
2006-04-05 16:38:33 +08:00
|
|
|
g_slist_remove (plug_in_def2->proc_defs, overridden_proc);
|
2003-01-18 02:07:37 +08:00
|
|
|
}
|
|
|
|
|
2004-02-01 18:52:23 +08:00
|
|
|
/* also remove it from the lists of load and save procs */
|
|
|
|
gimp->load_procs = g_slist_remove (gimp->load_procs,
|
2006-04-05 16:38:33 +08:00
|
|
|
overridden_proc);
|
2004-02-01 18:52:23 +08:00
|
|
|
gimp->save_procs = g_slist_remove (gimp->save_procs,
|
2006-04-05 16:38:33 +08:00
|
|
|
overridden_proc);
|
2004-02-01 18:52:23 +08:00
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
g_object_unref (overridden_proc);
|
2003-01-18 02:07:37 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* write the pluginrc file if necessary */
|
2003-02-11 20:07:31 +08:00
|
|
|
if (gimp->write_pluginrc)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-12-01 08:14:14 +08:00
|
|
|
if (gimp->be_verbose)
|
2005-11-01 18:20:38 +08:00
|
|
|
g_print (_("Writing '%s'\n"), gimp_filename_to_utf8 (filename));
|
2000-08-15 23:42:14 +08:00
|
|
|
|
2003-03-10 23:48:16 +08:00
|
|
|
if (! plug_in_rc_write (gimp->plug_in_defs, filename, &error))
|
|
|
|
{
|
|
|
|
g_message ("%s", error->message);
|
2004-02-03 23:12:11 +08:00
|
|
|
g_clear_error (&error);
|
2003-03-10 23:48:16 +08:00
|
|
|
}
|
|
|
|
|
2003-02-11 20:07:31 +08:00
|
|
|
gimp->write_pluginrc = FALSE;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
1999-03-07 20:56:03 +08:00
|
|
|
g_free (filename);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* add the plug-in procs to the procedure database */
|
2004-04-15 21:10:51 +08:00
|
|
|
plug_ins_add_to_db (gimp, context);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-12-11 00:38:16 +08:00
|
|
|
/* create help_path and locale_domain lists */
|
2004-05-14 08:01:11 +08:00
|
|
|
for (list = gimp->plug_in_defs; list; list = list->next)
|
2002-12-11 00:38:16 +08:00
|
|
|
{
|
2004-05-14 08:01:11 +08:00
|
|
|
PlugInDef *plug_in_def = list->data;
|
2002-12-11 00:38:16 +08:00
|
|
|
|
2003-08-29 02:49:11 +08:00
|
|
|
if (plug_in_def->locale_domain_name)
|
2005-03-25 00:08:04 +08:00
|
|
|
plug_ins_locale_domain_add (gimp,
|
|
|
|
plug_in_def->prog,
|
|
|
|
plug_in_def->locale_domain_name,
|
|
|
|
plug_in_def->locale_domain_path);
|
2002-12-11 00:38:16 +08:00
|
|
|
|
2003-08-29 02:49:11 +08:00
|
|
|
if (plug_in_def->help_domain_name)
|
2005-03-25 00:08:04 +08:00
|
|
|
plug_ins_help_domain_add (gimp,
|
|
|
|
plug_in_def->prog,
|
|
|
|
plug_in_def->help_domain_name,
|
|
|
|
plug_in_def->help_domain_uri);
|
2002-12-11 00:38:16 +08:00
|
|
|
}
|
|
|
|
|
2001-11-18 00:32:34 +08:00
|
|
|
if (! gimp->no_interface)
|
2004-07-17 05:47:06 +08:00
|
|
|
{
|
|
|
|
gimp->load_procs = g_slist_sort_with_data (gimp->load_procs,
|
|
|
|
plug_ins_file_proc_compare,
|
|
|
|
gimp);
|
|
|
|
gimp->save_procs = g_slist_sort_with_data (gimp->save_procs,
|
|
|
|
plug_ins_file_proc_compare,
|
|
|
|
gimp);
|
|
|
|
|
|
|
|
gimp_menus_init (gimp, gimp->plug_in_defs, STD_PLUGINS_DOMAIN);
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-04-15 19:35:31 +08:00
|
|
|
/* build list of automatically started extensions */
|
2004-05-14 08:01:11 +08:00
|
|
|
for (list = gimp->plug_in_proc_defs, nth = 0; list; list = list->next, nth++)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2006-04-05 16:38:33 +08:00
|
|
|
GimpPlugInProcedure *proc = list->data;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
if (proc->prog &&
|
|
|
|
GIMP_PROCEDURE (proc)->proc_type == GIMP_EXTENSION &&
|
|
|
|
GIMP_PROCEDURE (proc)->num_args == 0)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2006-04-05 16:38:33 +08:00
|
|
|
extensions = g_list_prepend (extensions, proc);
|
2003-04-15 19:35:31 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
extensions = g_list_reverse (extensions);
|
|
|
|
n_extensions = g_list_length (extensions);
|
|
|
|
|
|
|
|
/* run the available extensions */
|
|
|
|
if (extensions)
|
|
|
|
{
|
2004-02-01 18:52:23 +08:00
|
|
|
GList *list;
|
|
|
|
|
2005-11-05 23:00:35 +08:00
|
|
|
status_callback (_("Starting Extensions"), "", 0.0);
|
2003-04-15 19:35:31 +08:00
|
|
|
|
2004-05-14 08:01:11 +08:00
|
|
|
for (list = extensions, nth = 0; list; list = g_list_next (list), nth++)
|
2003-04-15 19:35:31 +08:00
|
|
|
{
|
2006-04-05 16:38:33 +08:00
|
|
|
GimpPlugInProcedure *proc = list->data;
|
|
|
|
GValueArray *args;
|
2003-04-15 19:35:31 +08:00
|
|
|
|
2001-12-01 08:14:14 +08:00
|
|
|
if (gimp->be_verbose)
|
2006-03-31 19:49:22 +08:00
|
|
|
g_print (_("Starting extension: '%s'\n"),
|
2006-04-05 16:38:33 +08:00
|
|
|
GIMP_PROCEDURE (proc)->name);
|
2000-08-15 23:42:14 +08:00
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
status_callback (NULL, GIMP_PROCEDURE (proc)->name,
|
2005-11-01 18:20:38 +08:00
|
|
|
(gdouble) nth / (gdouble) n_extensions);
|
1998-01-26 06:13:00 +08:00
|
|
|
|
2006-04-04 18:30:58 +08:00
|
|
|
args = g_value_array_new (0);
|
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
plug_in_run (gimp, context, NULL, GIMP_PROCEDURE (proc),
|
2006-04-04 18:30:58 +08:00
|
|
|
args, FALSE, TRUE, -1);
|
|
|
|
|
|
|
|
g_value_array_free (args);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2003-04-15 19:35:31 +08:00
|
|
|
|
|
|
|
g_list_free (extensions);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2000-08-15 23:42:14 +08:00
|
|
|
|
2005-11-05 23:00:35 +08:00
|
|
|
status_callback ("", "", 1.0);
|
|
|
|
|
2002-12-11 00:38:16 +08:00
|
|
|
/* free up stuff */
|
2004-05-14 08:01:11 +08:00
|
|
|
for (list = gimp->plug_in_defs; list; list = list->next)
|
|
|
|
plug_in_def_free (list->data, FALSE);
|
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-02-11 20:07:31 +08:00
|
|
|
g_slist_free (gimp->plug_in_defs);
|
|
|
|
gimp->plug_in_defs = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-03-21 01:46:13 +08:00
|
|
|
plug_ins_exit (Gimp *gimp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-01-18 02:07:37 +08:00
|
|
|
GSList *list;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
plug_in_exit (gimp);
|
2001-01-14 23:18:37 +08:00
|
|
|
|
2005-03-25 00:08:04 +08:00
|
|
|
for (list = gimp->plug_in_menu_branches; list; list = list->next)
|
|
|
|
{
|
|
|
|
PlugInMenuBranch *branch = list->data;
|
|
|
|
|
|
|
|
g_free (branch->prog_name);
|
|
|
|
g_free (branch->menu_path);
|
|
|
|
g_free (branch->menu_label);
|
|
|
|
g_free (branch);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_slist_free (gimp->plug_in_menu_branches);
|
|
|
|
gimp->plug_in_menu_branches = NULL;
|
|
|
|
|
2004-05-14 08:01:11 +08:00
|
|
|
for (list = gimp->plug_in_locale_domains; list; list = list->next)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2005-03-25 00:08:04 +08:00
|
|
|
PlugInLocaleDomain *domain = list->data;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2005-03-25 00:08:04 +08:00
|
|
|
g_free (domain->prog_name);
|
|
|
|
g_free (domain->domain_name);
|
|
|
|
g_free (domain->domain_path);
|
|
|
|
g_free (domain);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2003-02-11 20:07:31 +08:00
|
|
|
g_slist_free (gimp->plug_in_locale_domains);
|
|
|
|
gimp->plug_in_locale_domains = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-05-14 08:01:11 +08:00
|
|
|
for (list = gimp->plug_in_help_domains; list; list = list->next)
|
2003-01-18 02:07:37 +08:00
|
|
|
{
|
2005-03-25 00:08:04 +08:00
|
|
|
PlugInHelpDomain *domain = list->data;
|
2000-05-17 20:29:38 +08:00
|
|
|
|
2005-03-25 00:08:04 +08:00
|
|
|
g_free (domain->prog_name);
|
|
|
|
g_free (domain->domain_name);
|
|
|
|
g_free (domain->domain_uri);
|
|
|
|
g_free (domain);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2003-08-29 02:49:11 +08:00
|
|
|
g_slist_free (gimp->plug_in_help_domains);
|
|
|
|
gimp->plug_in_help_domains = NULL;
|
2006-02-21 19:05:43 +08:00
|
|
|
|
|
|
|
plug_in_data_free (gimp);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2006-04-05 16:38:33 +08:00
|
|
|
plug_ins_add_internal (Gimp *gimp,
|
|
|
|
GimpPlugInProcedure *proc)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-02-11 20:07:31 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2006-04-05 16:38:33 +08:00
|
|
|
g_return_if_fail (GIMP_IS_PLUG_IN_PROCEDURE (proc));
|
2003-01-18 02:07:37 +08:00
|
|
|
|
2003-02-11 20:07:31 +08:00
|
|
|
gimp->plug_in_proc_defs = g_slist_prepend (gimp->plug_in_proc_defs,
|
2006-04-05 16:38:33 +08:00
|
|
|
proc);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
GimpPlugInProcedure *
|
2004-05-14 08:01:11 +08:00
|
|
|
plug_ins_file_register_magic (Gimp *gimp,
|
|
|
|
const gchar *name,
|
|
|
|
const gchar *extensions,
|
|
|
|
const gchar *prefixes,
|
|
|
|
const gchar *magics)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2006-04-05 16:38:33 +08:00
|
|
|
GimpPlugInProcedure *proc;
|
|
|
|
GSList *list;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-02-11 20:07:31 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
2001-01-14 23:18:37 +08:00
|
|
|
g_return_val_if_fail (name != NULL, NULL);
|
|
|
|
|
2004-08-09 18:25:50 +08:00
|
|
|
if (gimp->current_plug_in && gimp->current_plug_in->plug_in_def)
|
2003-02-11 20:07:31 +08:00
|
|
|
list = gimp->current_plug_in->plug_in_def->proc_defs;
|
1997-11-25 06:05:25 +08:00
|
|
|
else
|
2003-02-11 20:07:31 +08:00
|
|
|
list = gimp->plug_in_proc_defs;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
proc = gimp_plug_in_procedure_find (list, name);
|
2005-05-05 02:53:58 +08:00
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
if (proc)
|
|
|
|
gimp_plug_in_procedure_set_file_proc (proc, extensions, prefixes, magics);
|
2005-05-05 02:53:58 +08:00
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
return proc;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
GimpPlugInProcedure *
|
2004-05-14 08:01:11 +08:00
|
|
|
plug_ins_file_register_mime (Gimp *gimp,
|
|
|
|
const gchar *name,
|
|
|
|
const gchar *mime_type)
|
|
|
|
{
|
2006-04-05 16:38:33 +08:00
|
|
|
GimpPlugInProcedure *proc;
|
|
|
|
GSList *list;
|
2004-05-14 08:01:11 +08:00
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
|
|
|
g_return_val_if_fail (name != NULL, NULL);
|
|
|
|
g_return_val_if_fail (mime_type != NULL, NULL);
|
|
|
|
|
2004-08-09 18:25:50 +08:00
|
|
|
if (gimp->current_plug_in && gimp->current_plug_in->plug_in_def)
|
2004-05-14 08:01:11 +08:00
|
|
|
list = gimp->current_plug_in->plug_in_def->proc_defs;
|
|
|
|
else
|
|
|
|
list = gimp->plug_in_proc_defs;
|
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
proc = gimp_plug_in_procedure_find (list, name);
|
2004-05-14 08:01:11 +08:00
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
if (proc)
|
|
|
|
gimp_plug_in_procedure_set_mime_type (proc, mime_type);
|
2004-05-14 08:01:11 +08:00
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
return proc;
|
2004-05-14 08:01:11 +08:00
|
|
|
}
|
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
GimpPlugInProcedure *
|
2004-11-14 01:06:06 +08:00
|
|
|
plug_ins_file_register_thumb_loader (Gimp *gimp,
|
|
|
|
const gchar *load_proc,
|
|
|
|
const gchar *thumb_proc)
|
|
|
|
{
|
2006-04-05 16:38:33 +08:00
|
|
|
GimpPlugInProcedure *proc;
|
|
|
|
GSList *list;
|
2004-11-14 01:06:06 +08:00
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
|
|
|
g_return_val_if_fail (load_proc, NULL);
|
|
|
|
g_return_val_if_fail (thumb_proc, NULL);
|
|
|
|
|
|
|
|
if (gimp->current_plug_in && gimp->current_plug_in->plug_in_def)
|
|
|
|
list = gimp->current_plug_in->plug_in_def->proc_defs;
|
|
|
|
else
|
|
|
|
list = gimp->plug_in_proc_defs;
|
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
proc = gimp_plug_in_procedure_find (list, load_proc);
|
2004-11-14 01:06:06 +08:00
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
if (proc)
|
|
|
|
gimp_plug_in_procedure_set_thumb_loader (proc, thumb_proc);
|
2004-11-14 01:06:06 +08:00
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
return proc;
|
2004-11-14 01:06:06 +08:00
|
|
|
}
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
void
|
2003-02-11 20:07:31 +08:00
|
|
|
plug_ins_def_add_from_rc (Gimp *gimp,
|
|
|
|
PlugInDef *plug_in_def)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-01-20 20:17:32 +08:00
|
|
|
GSList *list;
|
2003-01-18 02:07:37 +08:00
|
|
|
gchar *basename1;
|
2003-01-20 20:17:32 +08:00
|
|
|
|
2003-02-11 20:07:31 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2003-01-20 20:17:32 +08:00
|
|
|
g_return_if_fail (plug_in_def != NULL);
|
|
|
|
g_return_if_fail (plug_in_def->prog != NULL);
|
|
|
|
|
|
|
|
if (! g_path_is_absolute (plug_in_def->prog))
|
|
|
|
{
|
|
|
|
g_warning ("plug_ins_def_add_from_rc: filename not absolute (skipping)");
|
|
|
|
plug_in_def_free (plug_in_def, TRUE);
|
|
|
|
return;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-07-27 23:18:20 +08:00
|
|
|
basename1 = g_path_get_basename (plug_in_def->prog);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-07-16 20:49:04 +08:00
|
|
|
/* If this is a file load or save plugin, make sure we have
|
|
|
|
* something for one of the extensions, prefixes, or magic number.
|
|
|
|
* Other bits of code rely on detecting file plugins by the presence
|
|
|
|
* of one of these things, but Nick Lamb's alien/unknown format
|
|
|
|
* loader needs to be able to register no extensions, prefixes or
|
|
|
|
* magics. -- austin 13/Feb/99
|
|
|
|
*/
|
2004-05-14 08:01:11 +08:00
|
|
|
for (list = plug_in_def->proc_defs; list; list = list->next)
|
1999-02-14 09:53:23 +08:00
|
|
|
{
|
2006-04-05 16:38:33 +08:00
|
|
|
GimpPlugInProcedure *proc = list->data;
|
|
|
|
|
|
|
|
if (! proc->extensions &&
|
|
|
|
! proc->prefixes &&
|
|
|
|
! proc->magics &&
|
|
|
|
proc->menu_paths &&
|
|
|
|
(! strncmp (proc->menu_paths->data, "<Load>", 6) ||
|
|
|
|
! strncmp (proc->menu_paths->data, "<Save>", 6)))
|
1999-11-25 19:35:48 +08:00
|
|
|
{
|
2006-04-05 16:38:33 +08:00
|
|
|
proc->extensions = g_strdup ("");
|
1999-11-25 19:35:48 +08:00
|
|
|
}
|
|
|
|
}
|
1999-02-14 09:53:23 +08:00
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
/* Check if the entry mentioned in pluginrc matches an executable
|
|
|
|
* found in the plug_in_path.
|
|
|
|
*/
|
2004-05-14 08:01:11 +08:00
|
|
|
for (list = gimp->plug_in_defs; list; list = list->next)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-11-01 23:44:57 +08:00
|
|
|
PlugInDef *ondisk_plug_in_def = list->data;
|
2003-01-20 20:17:32 +08:00
|
|
|
gchar *basename2;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
basename2 = g_path_get_basename (ondisk_plug_in_def->prog);
|
|
|
|
|
|
|
|
if (! strcmp (basename1, basename2))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-01-18 02:07:37 +08:00
|
|
|
if (! g_ascii_strcasecmp (plug_in_def->prog,
|
|
|
|
ondisk_plug_in_def->prog) &&
|
|
|
|
(plug_in_def->mtime == ondisk_plug_in_def->mtime))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-01-18 02:07:37 +08:00
|
|
|
/* Use pluginrc entry, deleting ondisk entry */
|
2003-01-20 20:17:32 +08:00
|
|
|
list->data = plug_in_def;
|
2003-01-18 02:07:37 +08:00
|
|
|
plug_in_def_free (ondisk_plug_in_def, TRUE);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-01-18 02:07:37 +08:00
|
|
|
/* Use ondisk entry, deleting pluginrc entry */
|
|
|
|
plug_in_def_free (plug_in_def, TRUE);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2001-07-27 23:18:20 +08:00
|
|
|
|
|
|
|
g_free (basename2);
|
2002-03-22 23:21:18 +08:00
|
|
|
g_free (basename1);
|
2001-07-27 23:18:20 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
return;
|
|
|
|
}
|
2001-07-27 23:18:20 +08:00
|
|
|
|
|
|
|
g_free (basename2);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2001-07-27 23:18:20 +08:00
|
|
|
g_free (basename1);
|
|
|
|
|
2003-02-11 20:07:31 +08:00
|
|
|
gimp->write_pluginrc = TRUE;
|
2004-01-24 01:24:44 +08:00
|
|
|
g_printerr ("executable not found: '%s'\n",
|
|
|
|
gimp_filename_to_utf8 (plug_in_def->prog));
|
2000-02-24 02:07:53 +08:00
|
|
|
plug_in_def_free (plug_in_def, FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
void
|
2006-04-05 16:38:33 +08:00
|
|
|
plug_ins_temp_proc_def_add (Gimp *gimp,
|
|
|
|
GimpPlugInProcedure *proc)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-01-18 02:07:37 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2006-04-05 16:38:33 +08:00
|
|
|
g_return_if_fail (GIMP_IS_PLUG_IN_PROCEDURE (proc));
|
2001-01-14 23:18:37 +08:00
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
if (! gimp->no_interface)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2006-04-05 16:38:33 +08:00
|
|
|
if (proc->menu_label || proc->menu_paths)
|
|
|
|
gimp_menus_create_item (gimp, proc, NULL);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
/* Register the procedural database entry */
|
2006-04-05 16:38:33 +08:00
|
|
|
gimp_pdb_register (gimp, GIMP_PROCEDURE (proc));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
/* Add the definition to the global list */
|
2006-04-05 16:38:33 +08:00
|
|
|
gimp->plug_in_proc_defs = g_slist_prepend (gimp->plug_in_proc_defs, proc);
|
2003-01-18 02:07:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2006-04-05 16:38:33 +08:00
|
|
|
plug_ins_temp_proc_def_remove (Gimp *gimp,
|
|
|
|
GimpPlugInProcedure *proc)
|
2003-01-18 02:07:37 +08:00
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2006-04-05 16:38:33 +08:00
|
|
|
g_return_if_fail (GIMP_IS_PLUG_IN_PROCEDURE (proc));
|
2003-01-18 02:07:37 +08:00
|
|
|
|
|
|
|
if (! gimp->no_interface)
|
|
|
|
{
|
2006-04-05 16:38:33 +08:00
|
|
|
if (proc->menu_label || proc->menu_paths)
|
|
|
|
gimp_menus_delete_item (gimp, proc);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
/* Unregister the procedural database entry */
|
2006-04-05 16:38:33 +08:00
|
|
|
gimp_pdb_unregister (gimp, GIMP_PROCEDURE (proc)->name);
|
2003-01-18 02:07:37 +08:00
|
|
|
|
|
|
|
/* Remove the definition from the global list */
|
2006-04-05 16:38:33 +08:00
|
|
|
gimp->plug_in_proc_defs = g_slist_remove (gimp->plug_in_proc_defs, proc);
|
2003-01-18 02:07:37 +08:00
|
|
|
|
|
|
|
/* Destroy the definition */
|
2006-04-05 16:38:33 +08:00
|
|
|
g_object_unref (proc);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2005-03-25 00:08:04 +08:00
|
|
|
void
|
|
|
|
plug_ins_menu_branch_add (Gimp *gimp,
|
|
|
|
const gchar *prog_name,
|
|
|
|
const gchar *menu_path,
|
|
|
|
const gchar *menu_label)
|
|
|
|
{
|
|
|
|
PlugInMenuBranch *branch;
|
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
g_return_if_fail (prog_name != NULL);
|
|
|
|
g_return_if_fail (menu_path != NULL);
|
|
|
|
g_return_if_fail (menu_label != NULL);
|
|
|
|
|
|
|
|
branch = g_new (PlugInMenuBranch, 1);
|
|
|
|
|
|
|
|
branch->prog_name = g_strdup (prog_name);
|
|
|
|
branch->menu_path = g_strdup (menu_path);
|
|
|
|
branch->menu_label = g_strdup (menu_label);
|
|
|
|
|
|
|
|
gimp->plug_in_menu_branches = g_slist_append (gimp->plug_in_menu_branches,
|
|
|
|
branch);
|
|
|
|
|
|
|
|
#ifdef VERBOSE
|
|
|
|
g_print ("added menu branch \"%s\" at path \"%s\"\n",
|
|
|
|
branch->menu_label, branch->menu_path);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
plug_ins_locale_domain_add (Gimp *gimp,
|
|
|
|
const gchar *prog_name,
|
|
|
|
const gchar *domain_name,
|
|
|
|
const gchar *domain_path)
|
|
|
|
{
|
|
|
|
PlugInLocaleDomain *domain;
|
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
g_return_if_fail (prog_name != NULL);
|
|
|
|
g_return_if_fail (domain_name != NULL);
|
|
|
|
|
|
|
|
domain = g_new (PlugInLocaleDomain, 1);
|
|
|
|
|
|
|
|
domain->prog_name = g_strdup (prog_name);
|
|
|
|
domain->domain_name = g_strdup (domain_name);
|
|
|
|
domain->domain_path = g_strdup (domain_path);
|
|
|
|
|
|
|
|
gimp->plug_in_locale_domains = g_slist_prepend (gimp->plug_in_locale_domains,
|
|
|
|
domain);
|
|
|
|
|
|
|
|
#ifdef VERBOSE
|
|
|
|
g_print ("added locale domain \"%s\" for path \"%s\"\n",
|
|
|
|
domain->domain_name ? domain->domain_name : "(null)",
|
|
|
|
domain->domain_path ?
|
|
|
|
gimp_filename_to_utf8 (domain->domain_path) : "(null)");
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2002-12-11 00:38:16 +08:00
|
|
|
const gchar *
|
2003-01-18 02:07:37 +08:00
|
|
|
plug_ins_locale_domain (Gimp *gimp,
|
|
|
|
const gchar *prog_name,
|
2003-08-29 02:49:11 +08:00
|
|
|
const gchar **domain_path)
|
2002-12-11 00:38:16 +08:00
|
|
|
{
|
2003-08-29 02:49:11 +08:00
|
|
|
GSList *list;
|
2002-12-11 00:38:16 +08:00
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
2002-12-11 00:38:16 +08:00
|
|
|
|
2003-08-29 02:49:11 +08:00
|
|
|
if (domain_path)
|
|
|
|
*domain_path = gimp_locale_directory ();
|
2002-12-11 00:38:16 +08:00
|
|
|
|
2004-02-03 21:02:18 +08:00
|
|
|
/* A NULL prog_name is GIMP itself, return the default domain */
|
|
|
|
if (! prog_name)
|
|
|
|
return NULL;
|
|
|
|
|
2004-05-14 08:01:11 +08:00
|
|
|
for (list = gimp->plug_in_locale_domains; list; list = list->next)
|
2002-12-11 00:38:16 +08:00
|
|
|
{
|
2005-03-25 00:08:04 +08:00
|
|
|
PlugInLocaleDomain *domain = list->data;
|
2002-12-11 00:38:16 +08:00
|
|
|
|
2005-03-25 00:08:04 +08:00
|
|
|
if (domain && domain->prog_name &&
|
|
|
|
! strcmp (domain->prog_name, prog_name))
|
2002-12-11 00:38:16 +08:00
|
|
|
{
|
2005-03-25 00:08:04 +08:00
|
|
|
if (domain_path && domain->domain_path)
|
|
|
|
*domain_path = domain->domain_path;
|
2002-12-11 00:38:16 +08:00
|
|
|
|
2005-03-25 00:08:04 +08:00
|
|
|
return domain->domain_name;
|
2002-12-11 00:38:16 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return STD_PLUGINS_DOMAIN;
|
|
|
|
}
|
|
|
|
|
2005-03-25 00:08:04 +08:00
|
|
|
void
|
|
|
|
plug_ins_help_domain_add (Gimp *gimp,
|
|
|
|
const gchar *prog_name,
|
|
|
|
const gchar *domain_name,
|
|
|
|
const gchar *domain_uri)
|
|
|
|
{
|
|
|
|
PlugInHelpDomain *domain;
|
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
g_return_if_fail (prog_name != NULL);
|
|
|
|
g_return_if_fail (domain_name != NULL);
|
|
|
|
|
|
|
|
domain = g_new (PlugInHelpDomain, 1);
|
|
|
|
|
|
|
|
domain->prog_name = g_strdup (prog_name);
|
|
|
|
domain->domain_name = g_strdup (domain_name);
|
|
|
|
domain->domain_uri = g_strdup (domain_uri);
|
|
|
|
|
|
|
|
gimp->plug_in_help_domains = g_slist_prepend (gimp->plug_in_help_domains,
|
|
|
|
domain);
|
|
|
|
|
|
|
|
#ifdef VERBOSE
|
|
|
|
g_print ("added help domain \"%s\" for base uri \"%s\"\n",
|
|
|
|
domain->domain_name ? domain->domain_name : "(null)",
|
|
|
|
domain->domain_uri ? domain->domain_uri : "(null)");
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2002-12-11 00:38:16 +08:00
|
|
|
const gchar *
|
2003-08-29 02:49:11 +08:00
|
|
|
plug_ins_help_domain (Gimp *gimp,
|
|
|
|
const gchar *prog_name,
|
|
|
|
const gchar **domain_uri)
|
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-08-29 02:49:11 +08:00
|
|
|
GSList *list;
|
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-18 02:07:37 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
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-08-29 02:49:11 +08:00
|
|
|
if (domain_uri)
|
|
|
|
*domain_uri = NULL;
|
|
|
|
|
2004-02-03 21:02:18 +08:00
|
|
|
/* A NULL prog_name is GIMP itself, return the default domain */
|
|
|
|
if (! prog_name)
|
|
|
|
return NULL;
|
|
|
|
|
2004-05-14 08:01:11 +08:00
|
|
|
for (list = gimp->plug_in_help_domains; list; list = list->next)
|
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
|
|
|
{
|
2005-03-25 00:08:04 +08:00
|
|
|
PlugInHelpDomain *domain = list->data;
|
2003-08-29 02:49:11 +08:00
|
|
|
|
2005-03-25 00:08:04 +08:00
|
|
|
if (domain && domain->prog_name &&
|
|
|
|
! strcmp (domain->prog_name, prog_name))
|
2003-08-29 02:49:11 +08:00
|
|
|
{
|
2005-03-25 00:08:04 +08:00
|
|
|
if (domain_uri && domain->domain_uri)
|
|
|
|
*domain_uri = domain->domain_uri;
|
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
|
|
|
|
2005-03-25 00:08:04 +08:00
|
|
|
return domain->domain_name;
|
2003-08-29 02:49:11 +08:00
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2003-08-29 02:49:11 +08:00
|
|
|
gint
|
|
|
|
plug_ins_help_domains (Gimp *gimp,
|
|
|
|
gchar ***help_domains,
|
|
|
|
gchar ***help_uris)
|
|
|
|
{
|
|
|
|
GSList *list;
|
|
|
|
gint n_domains;
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), 0);
|
|
|
|
g_return_val_if_fail (help_domains != NULL, 0);
|
|
|
|
g_return_val_if_fail (help_uris != NULL, 0);
|
|
|
|
|
|
|
|
n_domains = g_slist_length (gimp->plug_in_help_domains);
|
|
|
|
|
|
|
|
*help_domains = g_new0 (gchar *, n_domains);
|
|
|
|
*help_uris = g_new0 (gchar *, n_domains);
|
|
|
|
|
2004-05-14 08:01:11 +08:00
|
|
|
for (list = gimp->plug_in_help_domains, i = 0; list; list = list->next, i++)
|
2003-08-29 02:49:11 +08:00
|
|
|
{
|
2005-03-25 00:08:04 +08:00
|
|
|
PlugInHelpDomain *domain = list->data;
|
2003-08-29 02:49:11 +08:00
|
|
|
|
2005-03-25 00:08:04 +08:00
|
|
|
(*help_domains)[i] = g_strdup (domain->domain_name);
|
|
|
|
(*help_uris)[i] = g_strdup (domain->domain_uri);
|
2003-08-29 02:49:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return n_domains;
|
|
|
|
}
|
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
|
|
|
|
/* private functions */
|
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
static void
|
2003-07-03 01:11:00 +08:00
|
|
|
plug_ins_init_file (const GimpDatafileData *file_data,
|
2004-07-17 05:47:06 +08:00
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-01-18 02:07:37 +08:00
|
|
|
PlugInDef *plug_in_def;
|
2004-07-17 05:47:06 +08:00
|
|
|
GSList **plug_in_defs = data;
|
2003-01-20 20:17:32 +08:00
|
|
|
GSList *list;
|
2003-01-18 02:07:37 +08:00
|
|
|
|
2004-05-14 08:01:11 +08:00
|
|
|
for (list = *plug_in_defs; list; list = list->next)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-01-20 20:17:32 +08:00
|
|
|
gchar *plug_in_name;
|
|
|
|
|
2005-11-01 18:20:38 +08:00
|
|
|
plug_in_def = list->data;
|
2002-03-21 01:46:13 +08:00
|
|
|
plug_in_name = g_path_get_basename (plug_in_def->prog);
|
|
|
|
|
2003-07-03 01:11:00 +08:00
|
|
|
if (g_ascii_strcasecmp (file_data->basename, plug_in_name) == 0)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-11-17 06:21:27 +08:00
|
|
|
g_printerr ("skipping duplicate plug-in: '%s'\n",
|
2004-01-19 09:08:43 +08:00
|
|
|
gimp_filename_to_utf8 (file_data->filename));
|
2003-01-18 02:07:37 +08:00
|
|
|
|
|
|
|
g_free (plug_in_name);
|
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
return;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
g_free (plug_in_name);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
plug_in_def = plug_in_def_new (file_data->filename);
|
|
|
|
|
|
|
|
plug_in_def_set_mtime (plug_in_def, file_data->mtime);
|
|
|
|
plug_in_def_set_needs_query (plug_in_def, TRUE);
|
Add gimpcolorspace object.
2000-01-04 Tor Lillqvist <tml@iki.fi>
* libgimp/makefile.{cygwin.msc}: Add gimpcolorspace object.
* libgimp/gimp.def: Add functions from it.
Fixes from Hans Breuer:
* app/datafiles.c: redefine the executable flag for Win32
to _S_IREAD, to get _all_ files from the plug-in dirs as
executables (including scripts)
* app/main.c: Win32-specific changes to allow building Gimp as a
console application, with all its benefits (like inheriting the
console), but hide it if the user doesn't want it. Also, if stdout
goes to a console, give the user a chance to read the help or
version messages. (tml: I am not convinced that it is better to
build gimp as a console application, but let's try it this way for
a while.)
* app/makefile.{cygwin,msc}: Build as console application, and
link with shell32 library.
* app/paint_core.c (paint_core_motion): Pass the value of a call
to the function gimage_active_drawable() to the paint_func,
instead of just passing the address of gimage_active_drawable...
(tml: This code is only called when the TOOL_TRACES_ON_WINDOW flag
is on, and only the clone tool sets that, and the clone tool's
paint_func doesn't use the drawable argument, so this hasn't
caused any trouble.)
* app/plug_in.c: On Win32, to support scripts, use new function
xspawn() instead of _spawnv. Add some more code to properly kill
plug-ins.
* libgimp/color_display.h: Add G_MODULE_EXPORT declarations.
2000-01-05 01:46:41 +08:00
|
|
|
|
2004-07-17 06:45:03 +08:00
|
|
|
*plug_in_defs = g_slist_prepend (*plug_in_defs, plug_in_def);
|
2002-03-21 01:46:13 +08:00
|
|
|
}
|
Add gimpcolorspace object.
2000-01-04 Tor Lillqvist <tml@iki.fi>
* libgimp/makefile.{cygwin.msc}: Add gimpcolorspace object.
* libgimp/gimp.def: Add functions from it.
Fixes from Hans Breuer:
* app/datafiles.c: redefine the executable flag for Win32
to _S_IREAD, to get _all_ files from the plug-in dirs as
executables (including scripts)
* app/main.c: Win32-specific changes to allow building Gimp as a
console application, with all its benefits (like inheriting the
console), but hide it if the user doesn't want it. Also, if stdout
goes to a console, give the user a chance to read the help or
version messages. (tml: I am not convinced that it is better to
build gimp as a console application, but let's try it this way for
a while.)
* app/makefile.{cygwin,msc}: Build as console application, and
link with shell32 library.
* app/paint_core.c (paint_core_motion): Pass the value of a call
to the function gimage_active_drawable() to the paint_func,
instead of just passing the address of gimage_active_drawable...
(tml: This code is only called when the TOOL_TRACES_ON_WINDOW flag
is on, and only the clone tool sets that, and the clone tool's
paint_func doesn't use the drawable argument, so this hasn't
caused any trouble.)
* app/plug_in.c: On Win32, to support scripts, use new function
xspawn() instead of _spawnv. Add some more code to properly kill
plug-ins.
* libgimp/color_display.h: Add G_MODULE_EXPORT declarations.
2000-01-05 01:46:41 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
static void
|
2004-04-15 21:10:51 +08:00
|
|
|
plug_ins_add_to_db (Gimp *gimp,
|
|
|
|
GimpContext *context)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2006-04-05 16:38:33 +08:00
|
|
|
GimpPlugInProcedure *proc;
|
|
|
|
GSList *list;
|
2002-03-21 01:46:13 +08:00
|
|
|
|
2004-05-14 08:01:11 +08:00
|
|
|
for (list = gimp->plug_in_proc_defs; list; list = list->next)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2006-04-05 16:38:33 +08:00
|
|
|
proc = list->data;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-04-06 18:01:30 +08:00
|
|
|
if (GIMP_PROCEDURE (proc)->proc_type != GIMP_INTERNAL)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2006-04-05 16:38:33 +08:00
|
|
|
gimp_pdb_register (gimp, GIMP_PROCEDURE (proc));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2006-04-06 18:01:30 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
g_printerr ("%s: NOT adding %s (prog = %s) to PDB\n",
|
|
|
|
G_STRFUNC, GIMP_PROCEDURE (proc)->name, proc->prog);
|
|
|
|
}
|
2002-03-21 01:46:13 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-02-11 20:07:31 +08:00
|
|
|
for (list = gimp->plug_in_proc_defs; list; list = list->next)
|
2002-03-21 01:46:13 +08:00
|
|
|
{
|
2006-04-05 16:38:33 +08:00
|
|
|
proc = list->data;
|
2002-03-21 01:46:13 +08:00
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
if (proc->file_proc)
|
2002-03-21 01:46:13 +08:00
|
|
|
{
|
2006-04-04 18:30:58 +08:00
|
|
|
GValueArray *return_vals;
|
2003-02-03 21:21:31 +08:00
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
if (proc->image_types)
|
2006-03-27 19:40:00 +08:00
|
|
|
{
|
|
|
|
return_vals =
|
2006-04-05 01:47:22 +08:00
|
|
|
gimp_pdb_run_proc (gimp, context, NULL,
|
|
|
|
"gimp-register-save-handler",
|
2006-04-05 16:38:33 +08:00
|
|
|
G_TYPE_STRING, GIMP_PROCEDURE (proc)->name,
|
|
|
|
G_TYPE_STRING, proc->extensions,
|
|
|
|
G_TYPE_STRING, proc->prefixes,
|
2006-04-05 01:47:22 +08:00
|
|
|
G_TYPE_NONE);
|
2006-03-27 19:40:00 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return_vals =
|
2006-04-05 01:47:22 +08:00
|
|
|
gimp_pdb_run_proc (gimp, context, NULL,
|
|
|
|
"gimp-register-magic-load-handler",
|
2006-04-05 16:38:33 +08:00
|
|
|
G_TYPE_STRING, GIMP_PROCEDURE (proc)->name,
|
|
|
|
G_TYPE_STRING, proc->extensions,
|
|
|
|
G_TYPE_STRING, proc->prefixes,
|
|
|
|
G_TYPE_STRING, proc->magics,
|
2006-04-05 01:47:22 +08:00
|
|
|
G_TYPE_NONE);
|
2006-03-27 19:40:00 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-04-04 18:30:58 +08:00
|
|
|
g_value_array_free (return_vals);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
static GimpPlugInProcedure *
|
|
|
|
plug_ins_proc_def_insert (Gimp *gimp,
|
|
|
|
GimpPlugInProcedure *proc)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-01-20 20:17:32 +08:00
|
|
|
GSList *list;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-05-14 08:01:11 +08:00
|
|
|
for (list = gimp->plug_in_proc_defs; list; list = list->next)
|
2001-09-03 21:03:34 +08:00
|
|
|
{
|
2006-04-05 16:38:33 +08:00
|
|
|
GimpPlugInProcedure *tmp_proc = list->data;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
if (strcmp (GIMP_PROCEDURE (proc)->name,
|
|
|
|
GIMP_PROCEDURE (tmp_proc)->name) == 0)
|
1999-03-07 20:56:03 +08:00
|
|
|
{
|
2006-04-05 16:38:33 +08:00
|
|
|
list->data = proc;
|
2001-09-03 21:03:34 +08:00
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
return tmp_proc;
|
2002-03-21 01:46:13 +08:00
|
|
|
}
|
2001-09-03 21:03:34 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
gimp->plug_in_proc_defs = g_slist_prepend (gimp->plug_in_proc_defs, proc);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
return NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2004-07-17 05:47:06 +08:00
|
|
|
|
|
|
|
static gint
|
|
|
|
plug_ins_file_proc_compare (gconstpointer a,
|
|
|
|
gconstpointer b,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2006-04-05 16:38:33 +08:00
|
|
|
Gimp *gimp = data;
|
|
|
|
const GimpPlugInProcedure *proc_a = a;
|
|
|
|
const GimpPlugInProcedure *proc_b = b;
|
|
|
|
gchar *label_a;
|
|
|
|
gchar *label_b;
|
|
|
|
gint retval = 0;
|
2004-07-17 05:47:06 +08:00
|
|
|
|
2005-08-03 06:52:23 +08:00
|
|
|
if (strncmp (proc_a->prog, "gimp-xcf", 8) == 0)
|
2004-07-17 05:47:06 +08:00
|
|
|
return -1;
|
2005-11-01 18:20:38 +08:00
|
|
|
|
2005-08-03 06:52:23 +08:00
|
|
|
if (strncmp (proc_b->prog, "gimp-xcf", 8) == 0)
|
2004-07-17 05:47:06 +08:00
|
|
|
return 1;
|
|
|
|
|
2006-04-05 16:38:33 +08:00
|
|
|
label_a = gimp_plug_in_procedure_get_label (proc_a,
|
|
|
|
plug_ins_locale_domain (gimp,
|
|
|
|
proc_a->prog,
|
|
|
|
NULL));
|
|
|
|
label_b = gimp_plug_in_procedure_get_label (proc_b,
|
|
|
|
plug_ins_locale_domain (gimp,
|
|
|
|
proc_b->prog,
|
|
|
|
NULL));
|
2004-07-17 05:47:06 +08:00
|
|
|
|
|
|
|
if (label_a && label_b)
|
|
|
|
retval = g_utf8_collate (label_a, label_b);
|
|
|
|
|
|
|
|
g_free (label_a);
|
|
|
|
g_free (label_b);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|