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
|
|
|
|
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"
|
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"
|
2004-02-09 02:49:58 +08:00
|
|
|
#include "config/gimpconfig-error.h"
|
2002-12-30 08:01:30 +08:00
|
|
|
#include "config/gimpconfig-path.h"
|
2002-11-19 04:50:31 +08:00
|
|
|
|
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
|
|
|
|
2001-12-01 08:14:14 +08:00
|
|
|
#include "plug-in.h"
|
2002-03-21 01:46:13 +08:00
|
|
|
#include "plug-ins.h"
|
|
|
|
#include "plug-in-def.h"
|
|
|
|
#include "plug-in-params.h"
|
2001-12-19 08:13:16 +08:00
|
|
|
#include "plug-in-proc.h"
|
2002-03-21 01:46:13 +08:00
|
|
|
#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
|
|
|
|
|
|
|
|
|
|
|
typedef struct _PlugInLocaleDomainDef PlugInLocaleDomainDef;
|
2003-08-29 02:49:11 +08:00
|
|
|
typedef struct _PlugInHelpDomainDef PlugInHelpDomainDef;
|
2002-12-11 00:38:16 +08:00
|
|
|
|
|
|
|
struct _PlugInLocaleDomainDef
|
|
|
|
{
|
|
|
|
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
|
|
|
|
2003-08-29 02:49:11 +08:00
|
|
|
struct _PlugInHelpDomainDef
|
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
|
|
|
};
|
|
|
|
|
|
|
|
|
2004-07-17 05:47:06 +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 PlugInProcDef * plug_ins_proc_def_insert (Gimp *gimp,
|
|
|
|
PlugInProcDef *proc_def);
|
|
|
|
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;
|
|
|
|
gdouble n_plugins;
|
|
|
|
gdouble n_extensions;
|
|
|
|
gdouble nth;
|
|
|
|
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);
|
|
|
|
|
2002-12-30 08:18:33 +08:00
|
|
|
|
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
|
|
|
|
2004-01-14 10:03:37 +08:00
|
|
|
(* status_callback) (_("Resource configuration"),
|
2004-01-19 09:08:43 +08:00
|
|
|
gimp_filename_to_utf8 (filename), -1);
|
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
|
|
|
|
2003-03-10 23:48:16 +08:00
|
|
|
/* Query any plug-ins that have changed since we last wrote out
|
1997-11-25 06:05:25 +08:00
|
|
|
* the pluginrc file.
|
|
|
|
*/
|
2002-08-27 23:23:36 +08:00
|
|
|
(* status_callback) (_("Querying new Plug-ins"), "", 0);
|
2003-02-11 20:07:31 +08:00
|
|
|
n_plugins = g_slist_length (gimp->plug_in_defs);
|
2002-08-27 23:23:36 +08:00
|
|
|
|
2004-05-14 08:01:11 +08:00
|
|
|
for (list = gimp->plug_in_defs, nth = 0; list; list = list->next, nth++)
|
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-05-04 04:18:03 +08:00
|
|
|
basename = g_path_get_basename (plug_in_def->prog);
|
2004-01-19 09:08:43 +08:00
|
|
|
(* status_callback) (NULL, gimp_filename_to_utf8 (basename),
|
2004-01-14 10:03:37 +08:00
|
|
|
nth / n_plugins);
|
2003-05-04 04:18:03 +08:00
|
|
|
g_free (basename);
|
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
if (plug_in_def->needs_query)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-02-11 20:07:31 +08:00
|
|
|
gimp->write_pluginrc = TRUE;
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-04-15 19:35:31 +08:00
|
|
|
(* status_callback) (NULL, NULL, 1.0);
|
|
|
|
|
2004-04-16 06:16:21 +08:00
|
|
|
/* initialize the plug-ins */
|
|
|
|
(* status_callback) (_("Initializing Plug-ins"), "", 0);
|
|
|
|
|
2004-05-14 08:01:11 +08:00
|
|
|
for (list = gimp->plug_in_defs, nth = 0; list; list = list->next, nth++)
|
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
|
|
|
|
|
|
|
basename = g_path_get_basename (plug_in_def->prog);
|
|
|
|
(* status_callback) (NULL, gimp_filename_to_utf8 (basename),
|
|
|
|
nth / n_plugins);
|
|
|
|
g_free (basename);
|
|
|
|
|
|
|
|
if (plug_in_def->has_init)
|
|
|
|
{
|
|
|
|
if (gimp->be_verbose)
|
|
|
|
g_print (_("Initializing plug-in: '%s'\n"),
|
|
|
|
gimp_filename_to_utf8 (plug_in_def->prog));
|
|
|
|
|
|
|
|
plug_in_call_init (gimp, context, plug_in_def);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
(* status_callback) (NULL, NULL, 1.0);
|
|
|
|
|
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
|
|
|
{
|
2004-05-14 08:01:11 +08:00
|
|
|
PlugInProcDef *proc_def = list2->data;
|
2003-01-18 02:07:37 +08:00
|
|
|
PlugInProcDef *overridden_proc_def;
|
|
|
|
|
2002-12-11 00:38:16 +08:00
|
|
|
proc_def->mtime = plug_in_def->mtime;
|
2003-01-18 02:07:37 +08:00
|
|
|
|
2003-02-11 20:07:31 +08:00
|
|
|
overridden_proc_def = plug_ins_proc_def_insert (gimp, proc_def);
|
2003-01-18 02:07:37 +08:00
|
|
|
|
|
|
|
if (overridden_proc_def)
|
|
|
|
{
|
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",
|
|
|
|
overridden_proc_def->db_info.name,
|
|
|
|
gimp_filename_to_utf8 (overridden_proc_def->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
|
2003-01-18 02:07:37 +08:00
|
|
|
* the overridden_proc_def.
|
|
|
|
*/
|
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 =
|
|
|
|
g_slist_remove (plug_in_def2->proc_defs,
|
|
|
|
overridden_proc_def);
|
|
|
|
}
|
|
|
|
|
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,
|
|
|
|
overridden_proc_def);
|
|
|
|
gimp->save_procs = g_slist_remove (gimp->save_procs,
|
|
|
|
overridden_proc_def);
|
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
plug_in_proc_def_free (overridden_proc_def);
|
|
|
|
}
|
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)
|
2004-01-14 10:03:37 +08:00
|
|
|
g_print (_("Writing '%s'\n"),
|
2004-01-19 09:08:43 +08:00
|
|
|
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)
|
2002-12-11 00:38:16 +08:00
|
|
|
{
|
2003-08-29 02:49:11 +08:00
|
|
|
PlugInLocaleDomainDef *def;
|
2002-12-11 00:38:16 +08:00
|
|
|
|
2003-08-29 02:49:11 +08:00
|
|
|
def = g_new (PlugInLocaleDomainDef, 1);
|
2002-12-11 00:38:16 +08:00
|
|
|
|
2003-08-29 02:49:11 +08:00
|
|
|
def->prog_name = g_strdup (plug_in_def->prog);
|
|
|
|
def->domain_name = g_strdup (plug_in_def->locale_domain_name);
|
|
|
|
def->domain_path = g_strdup (plug_in_def->locale_domain_path);
|
2002-12-11 00:38:16 +08:00
|
|
|
|
2003-02-11 20:07:31 +08:00
|
|
|
gimp->plug_in_locale_domains =
|
2003-08-29 02:49:11 +08:00
|
|
|
g_slist_prepend (gimp->plug_in_locale_domains, def);
|
|
|
|
|
2003-11-17 06:21:27 +08:00
|
|
|
#ifdef VERBOSE
|
2003-08-29 02:49:11 +08:00
|
|
|
g_print ("added locale domain \"%s\" for path \"%s\"\n",
|
2003-11-17 05:20:14 +08:00
|
|
|
def->domain_name ? def->domain_name : "(null)",
|
2004-01-24 01:24:44 +08:00
|
|
|
def->domain_path ?
|
|
|
|
gimp_filename_to_utf8 (def->domain_path) : "(null)");
|
2003-11-17 06:21:27 +08:00
|
|
|
#endif
|
2002-12-11 00:38:16 +08:00
|
|
|
}
|
|
|
|
|
2003-08-29 02:49:11 +08:00
|
|
|
if (plug_in_def->help_domain_name)
|
2002-12-11 00:38:16 +08:00
|
|
|
{
|
2003-08-29 02:49:11 +08:00
|
|
|
PlugInHelpDomainDef *def;
|
|
|
|
|
|
|
|
def = g_new (PlugInHelpDomainDef, 1);
|
2002-12-11 00:38:16 +08:00
|
|
|
|
2003-08-29 02:49:11 +08:00
|
|
|
def->prog_name = g_strdup (plug_in_def->prog);
|
|
|
|
def->domain_name = g_strdup (plug_in_def->help_domain_name);
|
|
|
|
def->domain_uri = g_strdup (plug_in_def->help_domain_uri);
|
2002-12-11 00:38:16 +08:00
|
|
|
|
2003-08-29 02:49:11 +08:00
|
|
|
gimp->plug_in_help_domains =
|
|
|
|
g_slist_prepend (gimp->plug_in_help_domains, def);
|
2002-12-11 00:38:16 +08:00
|
|
|
|
2003-11-17 06:21:27 +08:00
|
|
|
#ifdef VERBOSE
|
2003-08-29 02:49:11 +08:00
|
|
|
g_print ("added help domain \"%s\" for base uri \"%s\"\n",
|
2003-11-17 06:21:27 +08:00
|
|
|
def->domain_name ? def->domain_name : "(null)",
|
|
|
|
def->domain_uri ? def->domain_uri : "(null)");
|
|
|
|
#endif
|
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
|
|
|
{
|
2004-05-14 08:01:11 +08:00
|
|
|
PlugInProcDef *proc_def = list->data;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
Changed the semantics of GIMP_EXTENSION and (to some extent) of
2003-06-19 Michael Natterer <mitch@gimp.org>
Changed the semantics of GIMP_EXTENSION and (to some extent)
of GIMP_PLUGIN:
The old meaning of EXTENSION was "I live in the toolbox" and
PLUGIN meant "I take RUN-MODE,IMAGE,DRAWABLE args (but only if I
am invoked interactively)". This is completely useless, since
living in the toolbox means having "<Toolbox>" in the menu_path
and taking RUN-MODE,IMAGE,DRAWABLE means just that, regardless of
what type of procedure we are.
The new meaning of GIMP_PLUGIN is just "I am an ordinary procedure,
I am invoked, do my job and finish", while GIMP_EXTENSION means
"I will install temporary procedures and I will keep running to
keep them available".
(A GIMP_EXTENSION *must* call gimp_extension_ack() now to tell the
core that it's ready to run, or the core will block waiting for
the message !!!).
* configure.in: bumped version number to 1.3.16.
* libgimpbase/gimpprotocol.h: increased protocol version number so
old extensions will refuse to load.
* app/gui/plug-in-commands.c (plug_in_run_cmd_callback): don't
blindly pass RUN-MODE,IMAGE,DRAWABLE to GIMP_PLUGIN procedures but
look at their parameters and pass them either RUN-MODE, or
RUN-MODE,IMAGE, or RUN-MODE,IMAGE,DRAWABLE.
* app/pdb/procedural_db.c: cleaned up, better error reporting,
replaced an impossible error message by g_return_if_fail()
* app/plug-in/plug-in-message.c (plug_in_handle_proc_install):
better error messages.
* app/plug-in/plug-in-params.c: allocate parameter arrays using
g_new0() so we don't have to worry about uninitialized stuff
later.
* app/plug-in/plug-in-run.c (plug_in_run): wait for
gimp_extension_ack() installation confirmation for ALL extensions,
not just for automatically started ones.
* app/plug-in/plug-ins.c: cleanup.
* libgimp/gimp.[ch]: cleaned up and API-documented massively. Made
all magic values given in the GPConfig message static and added
accessor functions for them. Added gimp_tile_width()/height().
Added new function gimp_extension_enable() which turns on
asynchronous processing of temp_proc run requests without having
to enter an endless gimp_extension_process() loop. Moved all
private functions to the end of the file. Added tons of
g_return_if_fail() all over the place. Call gimp_run_procedure2()
from gimp_run_procedure() instead of duplicating the
code. Indentation, spacing, stuff...
* libgimp/gimptile.[ch]: removed gimp_tile_width()/height().
* libgimp/gimpdrawable.c
* libgimp/gimppixelrgn.c
* libgimp/gimptile.c: use the gimp_tile_width()/height() accessor
functions.
* libgimp/gimp.def: added gimp_extension_enable.
* libgimp/gimpmenu.c: removed evil code which connected to
_readchannel manually and use gimp_extension_enable() for watching
temp_procs.
* plug-ins/helpbrowser/helpbrowser.c: removed the same evil code
here and call gimp_extension_enable(). Call gimp_extension_ack()
to let the core know that the temp_proc is installed.
* plug-ins/script-fu/script-fu.c: made all procedures except the
permanently running "extension_script_fu" ordinary GIMP_PLUGIN
procedures.
* plug-ins/common/curve_bend.c
* plug-ins/common/plugindetails.c
* plug-ins/common/screenshot.c
* plug-ins/common/uniteditor.c
* plug-ins/common/winclipboard.c
* plug-ins/dbbrowser/dbbrowser.c
* plug-ins/gfli/gfli.c
* plug-ins/twain/twain.c
* plug-ins/webbrowser/webbrowser.c
* plug-ins/winsnap/winsnap.c: made them all ordinary GIMP_PLUGIN
procedures and renamed them from "extension_*" to "plug_in_*".
Random cleanups.
* app/widgets/gimphelp.c
* plug-ins/maze/maze_face.c: call "plug_in_web_browser" now.
2003-06-20 01:12:00 +08:00
|
|
|
if (proc_def->prog &&
|
|
|
|
proc_def->db_info.proc_type == GIMP_EXTENSION &&
|
|
|
|
proc_def->db_info.num_args == 0)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-04-15 19:35:31 +08:00
|
|
|
extensions = g_list_prepend (extensions, proc_def);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2003-04-15 19:35:31 +08:00
|
|
|
(* status_callback) (_("Starting Extensions"), "", 0);
|
|
|
|
|
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
|
|
|
{
|
2004-02-01 18:52:23 +08:00
|
|
|
PlugInProcDef *proc_def = list->data;
|
2003-04-15 19:35:31 +08:00
|
|
|
|
2001-12-01 08:14:14 +08:00
|
|
|
if (gimp->be_verbose)
|
2003-11-14 23:33:40 +08:00
|
|
|
g_print (_("Starting extension: '%s'\n"), proc_def->db_info.name);
|
2000-08-15 23:42:14 +08:00
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
(* status_callback) (NULL, proc_def->db_info.name, nth / n_plugins);
|
1998-01-26 06:13:00 +08:00
|
|
|
|
2004-08-11 02:47:21 +08:00
|
|
|
plug_in_run (gimp, context, NULL, &proc_def->db_info,
|
2004-04-15 21:10:51 +08:00
|
|
|
NULL, 0, FALSE, TRUE, -1);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2003-04-15 19:35:31 +08:00
|
|
|
|
|
|
|
(* status_callback) (NULL, NULL, 1.0);
|
|
|
|
|
|
|
|
g_list_free (extensions);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2000-08-15 23:42:14 +08:00
|
|
|
|
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
|
|
|
|
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
|
|
|
{
|
2003-08-29 02:49:11 +08:00
|
|
|
PlugInLocaleDomainDef *def = list->data;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-08-29 02:49:11 +08:00
|
|
|
g_free (def->prog_name);
|
|
|
|
g_free (def->domain_name);
|
|
|
|
g_free (def->domain_path);
|
|
|
|
g_free (def);
|
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
|
|
|
{
|
2003-08-29 02:49:11 +08:00
|
|
|
PlugInHelpDomainDef *def = list->data;
|
2000-05-17 20:29:38 +08:00
|
|
|
|
2003-08-29 02:49:11 +08:00
|
|
|
g_free (def->prog_name);
|
|
|
|
g_free (def->domain_name);
|
|
|
|
g_free (def->domain_uri);
|
|
|
|
g_free (def);
|
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;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-02-11 20:07:31 +08:00
|
|
|
plug_ins_add_internal (Gimp *gimp,
|
|
|
|
PlugInProcDef *proc_def)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-02-11 20:07:31 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2003-01-18 02:07:37 +08:00
|
|
|
g_return_if_fail (proc_def != NULL);
|
|
|
|
|
2003-02-11 20:07:31 +08:00
|
|
|
gimp->plug_in_proc_defs = g_slist_prepend (gimp->plug_in_proc_defs,
|
|
|
|
proc_def);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-05-17 20:29:38 +08:00
|
|
|
PlugInProcDef *
|
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
|
|
|
{
|
2003-01-18 02:07:37 +08:00
|
|
|
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
|
|
|
|
2004-05-14 08:01:11 +08:00
|
|
|
for (; list; list = list->next)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-05-14 08:01:11 +08:00
|
|
|
PlugInProcDef *proc_def = list->data;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
if (strcmp (proc_def->db_info.name, name) == 0)
|
|
|
|
{
|
|
|
|
if (proc_def->extensions != extensions)
|
|
|
|
{
|
2004-05-14 08:01:11 +08:00
|
|
|
if (proc_def->extensions)
|
|
|
|
g_free (proc_def->extensions);
|
1997-11-25 06:05:25 +08:00
|
|
|
proc_def->extensions = g_strdup (extensions);
|
|
|
|
}
|
2002-03-21 01:46:13 +08:00
|
|
|
|
|
|
|
proc_def->extensions_list =
|
|
|
|
plug_ins_extensions_parse (proc_def->extensions);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
if (proc_def->prefixes != prefixes)
|
|
|
|
{
|
2004-05-14 08:01:11 +08:00
|
|
|
if (proc_def->prefixes)
|
|
|
|
g_free (proc_def->prefixes);
|
1997-11-25 06:05:25 +08:00
|
|
|
proc_def->prefixes = g_strdup (prefixes);
|
|
|
|
}
|
2002-03-21 01:46:13 +08:00
|
|
|
|
|
|
|
proc_def->prefixes_list =
|
|
|
|
plug_ins_extensions_parse (proc_def->prefixes);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
if (proc_def->magics != magics)
|
|
|
|
{
|
2004-05-14 08:01:11 +08:00
|
|
|
if (proc_def->magics)
|
|
|
|
g_free (proc_def->magics);
|
1997-11-25 06:05:25 +08:00
|
|
|
proc_def->magics = g_strdup (magics);
|
|
|
|
}
|
2002-03-21 01:46:13 +08:00
|
|
|
|
|
|
|
proc_def->magics_list =
|
|
|
|
plug_ins_extensions_parse (proc_def->magics);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
return proc_def;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2004-05-14 08:01:11 +08:00
|
|
|
PlugInProcDef *
|
|
|
|
plug_ins_file_register_mime (Gimp *gimp,
|
|
|
|
const gchar *name,
|
|
|
|
const gchar *mime_type)
|
|
|
|
{
|
|
|
|
GSList *list;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
for (; list; list = list->next)
|
|
|
|
{
|
|
|
|
PlugInProcDef *proc_def = list->data;
|
|
|
|
|
|
|
|
if (strcmp (proc_def->db_info.name, name) == 0)
|
|
|
|
{
|
|
|
|
if (proc_def->mime_type)
|
|
|
|
g_free (proc_def->mime_type);
|
|
|
|
proc_def->mime_type = g_strdup (mime_type);
|
|
|
|
|
2004-08-09 18:25:50 +08:00
|
|
|
return proc_def;
|
|
|
|
}
|
2004-05-14 08:01:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2003-01-18 02:07:37 +08:00
|
|
|
PlugInProcDef *proc_def;
|
|
|
|
|
2003-01-20 20:17:32 +08:00
|
|
|
proc_def = (PlugInProcDef *) list->data;
|
1999-02-14 09:53:23 +08:00
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
if (! proc_def->extensions &&
|
|
|
|
! proc_def->prefixes &&
|
|
|
|
! proc_def->magics &&
|
2004-05-06 21:51:56 +08:00
|
|
|
proc_def->menu_paths &&
|
|
|
|
(! strncmp (proc_def->menu_paths->data, "<Load>", 6) ||
|
|
|
|
! strncmp (proc_def->menu_paths->data, "<Save>", 6)))
|
1999-11-25 19:35:48 +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
|
|
|
proc_def->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
|
|
|
{
|
2003-01-18 02:07:37 +08:00
|
|
|
PlugInDef *ondisk_plug_in_def;
|
2003-01-20 20:17:32 +08:00
|
|
|
gchar *basename2;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-01-20 20:17:32 +08:00
|
|
|
ondisk_plug_in_def = (PlugInDef *) list->data;
|
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
|
|
|
|
plug_ins_temp_proc_def_add (Gimp *gimp,
|
2003-08-26 00:28:46 +08:00
|
|
|
PlugInProcDef *proc_def)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-01-18 02:07:37 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
g_return_if_fail (proc_def != NULL);
|
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
|
|
|
{
|
2004-05-06 21:51:56 +08:00
|
|
|
if (proc_def->menu_paths)
|
2004-04-26 23:01:00 +08:00
|
|
|
gimp_menus_create_entry (gimp, proc_def);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
/* Register the procedural database entry */
|
|
|
|
procedural_db_register (gimp, &proc_def->db_info);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
/* Add the definition to the global list */
|
2004-07-17 06:45:03 +08:00
|
|
|
gimp->plug_in_proc_defs = g_slist_prepend (gimp->plug_in_proc_defs, proc_def);
|
2003-01-18 02:07:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
plug_ins_temp_proc_def_remove (Gimp *gimp,
|
|
|
|
PlugInProcDef *proc_def)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
g_return_if_fail (proc_def != NULL);
|
|
|
|
|
|
|
|
if (! gimp->no_interface)
|
|
|
|
{
|
2004-05-06 21:51:56 +08:00
|
|
|
if (proc_def->menu_paths)
|
2004-04-25 16:22:22 +08:00
|
|
|
gimp_menus_delete_entry (gimp, proc_def);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
/* Unregister the procedural database entry */
|
|
|
|
procedural_db_unregister (gimp, proc_def->db_info.name);
|
|
|
|
|
|
|
|
/* Remove the definition from the global list */
|
2003-02-11 20:07:31 +08:00
|
|
|
gimp->plug_in_proc_defs = g_slist_remove (gimp->plug_in_proc_defs, proc_def);
|
2003-01-18 02:07:37 +08:00
|
|
|
|
|
|
|
/* Destroy the definition */
|
|
|
|
plug_in_proc_def_free (proc_def);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2003-08-29 02:49:11 +08:00
|
|
|
PlugInLocaleDomainDef *def = list->data;
|
2002-12-11 00:38:16 +08:00
|
|
|
|
2003-08-29 02:49:11 +08:00
|
|
|
if (def && def->prog_name && ! strcmp (def->prog_name, prog_name))
|
2002-12-11 00:38:16 +08:00
|
|
|
{
|
2003-08-29 02:49:11 +08:00
|
|
|
if (domain_path && def->domain_path)
|
|
|
|
*domain_path = def->domain_path;
|
2002-12-11 00:38:16 +08:00
|
|
|
|
2003-08-29 02:49:11 +08:00
|
|
|
return def->domain_name;
|
2002-12-11 00:38:16 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return STD_PLUGINS_DOMAIN;
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
{
|
2003-08-29 02:49:11 +08:00
|
|
|
PlugInHelpDomainDef *def = list->data;
|
|
|
|
|
|
|
|
if (def && def->prog_name && ! strcmp (def->prog_name, prog_name))
|
|
|
|
{
|
|
|
|
if (domain_uri && def->domain_uri)
|
|
|
|
*domain_uri = def->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
|
|
|
return def->domain_name;
|
|
|
|
}
|
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
|
|
|
{
|
|
|
|
PlugInHelpDomainDef *def = list->data;
|
|
|
|
|
2003-11-21 22:10:52 +08:00
|
|
|
(*help_domains)[i] = g_strdup (def->domain_name);
|
|
|
|
(*help_uris)[i] = g_strdup (def->domain_uri);
|
2003-08-29 02:49:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return n_domains;
|
|
|
|
}
|
|
|
|
|
2003-02-18 22:08:14 +08:00
|
|
|
PlugInProcDef *
|
|
|
|
plug_ins_proc_def_find (Gimp *gimp,
|
|
|
|
ProcRecord *proc_rec)
|
|
|
|
{
|
|
|
|
GSList *list;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
|
|
|
g_return_val_if_fail (proc_rec != NULL, NULL);
|
|
|
|
|
2004-05-14 08:01:11 +08:00
|
|
|
for (list = gimp->plug_in_proc_defs; list; list = list->next)
|
2003-02-18 22:08:14 +08:00
|
|
|
{
|
|
|
|
PlugInProcDef *proc_def;
|
|
|
|
|
|
|
|
proc_def = (PlugInProcDef *) list->data;
|
|
|
|
|
|
|
|
if (proc_rec == &proc_def->db_info)
|
|
|
|
return proc_def;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
GSList *
|
|
|
|
plug_ins_extensions_parse (gchar *extensions)
|
|
|
|
{
|
2004-02-01 18:52:23 +08:00
|
|
|
GSList *list = NULL;
|
2003-01-18 02:07:37 +08:00
|
|
|
|
|
|
|
/* EXTENSIONS can be NULL. Avoid calling strtok if it is. */
|
|
|
|
if (extensions)
|
|
|
|
{
|
2004-02-01 18:52:23 +08:00
|
|
|
gchar *extension;
|
|
|
|
gchar *next_token;
|
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
extensions = g_strdup (extensions);
|
2004-02-01 18:52:23 +08:00
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
next_token = extensions;
|
|
|
|
extension = strtok (next_token, " \t,");
|
2004-02-01 18:52:23 +08:00
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
while (extension)
|
|
|
|
{
|
|
|
|
list = g_slist_prepend (list, g_strdup (extension));
|
|
|
|
extension = strtok (NULL, " \t,");
|
|
|
|
}
|
2004-02-01 18:52:23 +08:00
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
g_free (extensions);
|
|
|
|
}
|
|
|
|
|
|
|
|
return g_slist_reverse (list);
|
|
|
|
}
|
|
|
|
|
|
|
|
PlugInImageType
|
|
|
|
plug_ins_image_types_parse (gchar *image_types)
|
|
|
|
{
|
|
|
|
gchar *type_spec = image_types;
|
|
|
|
PlugInImageType types = 0;
|
|
|
|
|
2004-02-01 18:52:23 +08:00
|
|
|
/* If the plug_in registers with image_type == NULL or "", return 0
|
2003-11-08 07:47:35 +08:00
|
|
|
* By doing so it won't be touched by plug_in_set_menu_sensitivity()
|
2003-01-18 02:07:37 +08:00
|
|
|
*/
|
2004-02-01 18:52:23 +08:00
|
|
|
if (! image_types)
|
2003-01-18 02:07:37 +08:00
|
|
|
return types;
|
|
|
|
|
|
|
|
while (*image_types)
|
|
|
|
{
|
|
|
|
while (*image_types &&
|
|
|
|
((*image_types == ' ') ||
|
|
|
|
(*image_types == '\t') ||
|
|
|
|
(*image_types == ',')))
|
|
|
|
image_types++;
|
|
|
|
|
|
|
|
if (*image_types)
|
|
|
|
{
|
|
|
|
if (strncmp (image_types, "RGBA", 4) == 0)
|
|
|
|
{
|
|
|
|
types |= PLUG_IN_RGBA_IMAGE;
|
|
|
|
image_types += 4;
|
|
|
|
}
|
|
|
|
else if (strncmp (image_types, "RGB*", 4) == 0)
|
|
|
|
{
|
|
|
|
types |= PLUG_IN_RGB_IMAGE | PLUG_IN_RGBA_IMAGE;
|
|
|
|
image_types += 4;
|
|
|
|
}
|
|
|
|
else if (strncmp (image_types, "RGB", 3) == 0)
|
|
|
|
{
|
|
|
|
types |= PLUG_IN_RGB_IMAGE;
|
|
|
|
image_types += 3;
|
|
|
|
}
|
|
|
|
else if (strncmp (image_types, "GRAYA", 5) == 0)
|
|
|
|
{
|
|
|
|
types |= PLUG_IN_GRAYA_IMAGE;
|
|
|
|
image_types += 5;
|
|
|
|
}
|
|
|
|
else if (strncmp (image_types, "GRAY*", 5) == 0)
|
|
|
|
{
|
|
|
|
types |= PLUG_IN_GRAY_IMAGE | PLUG_IN_GRAYA_IMAGE;
|
|
|
|
image_types += 5;
|
|
|
|
}
|
|
|
|
else if (strncmp (image_types, "GRAY", 4) == 0)
|
|
|
|
{
|
|
|
|
types |= PLUG_IN_GRAY_IMAGE;
|
|
|
|
image_types += 4;
|
|
|
|
}
|
|
|
|
else if (strncmp (image_types, "INDEXEDA", 8) == 0)
|
|
|
|
{
|
|
|
|
types |= PLUG_IN_INDEXEDA_IMAGE;
|
|
|
|
image_types += 8;
|
|
|
|
}
|
|
|
|
else if (strncmp (image_types, "INDEXED*", 8) == 0)
|
|
|
|
{
|
|
|
|
types |= PLUG_IN_INDEXED_IMAGE | PLUG_IN_INDEXEDA_IMAGE;
|
|
|
|
image_types += 8;
|
|
|
|
}
|
|
|
|
else if (strncmp (image_types, "INDEXED", 7) == 0)
|
|
|
|
{
|
|
|
|
types |= PLUG_IN_INDEXED_IMAGE;
|
|
|
|
image_types += 7;
|
|
|
|
}
|
|
|
|
else if (strncmp (image_types, "*", 1) == 0)
|
|
|
|
{
|
|
|
|
types |= PLUG_IN_RGB_IMAGE | PLUG_IN_RGBA_IMAGE
|
|
|
|
| PLUG_IN_GRAY_IMAGE | PLUG_IN_GRAYA_IMAGE
|
|
|
|
| PLUG_IN_INDEXED_IMAGE | PLUG_IN_INDEXEDA_IMAGE;
|
|
|
|
image_types += 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-02-11 21:18:51 +08:00
|
|
|
g_printerr ("image_type contains unrecognizable parts: '%s'\n",
|
|
|
|
type_spec);
|
2004-01-24 01:24:44 +08:00
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
while (*image_types &&
|
|
|
|
((*image_types != ' ') ||
|
|
|
|
(*image_types != '\t') ||
|
|
|
|
(*image_types != ',')))
|
|
|
|
image_types++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return types;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 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;
|
|
|
|
|
|
|
|
plug_in_def = (PlugInDef *) list->data;
|
2001-05-17 02:09:45 +08:00
|
|
|
|
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
|
|
|
{
|
2002-03-21 01:46:13 +08:00
|
|
|
PlugInProcDef *proc_def;
|
2003-01-20 20:17:32 +08:00
|
|
|
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
|
|
|
{
|
2004-05-14 08:01:11 +08:00
|
|
|
proc_def = list->data;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
if (proc_def->prog && (proc_def->db_info.proc_type != GIMP_INTERNAL))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-03-21 01:46:13 +08:00
|
|
|
proc_def->db_info.exec_method.plug_in.filename = proc_def->prog;
|
|
|
|
procedural_db_register (gimp, &proc_def->db_info);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
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
|
|
|
{
|
2004-05-14 08:01:11 +08:00
|
|
|
proc_def = list->data;
|
2002-03-21 01:46:13 +08:00
|
|
|
|
|
|
|
if (proc_def->extensions || proc_def->prefixes || proc_def->magics)
|
|
|
|
{
|
2004-05-14 08:01:11 +08:00
|
|
|
Argument args[4];
|
2003-02-03 21:21:31 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
args[0].arg_type = GIMP_PDB_STRING;
|
|
|
|
args[0].value.pdb_pointer = proc_def->db_info.name;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
args[1].arg_type = GIMP_PDB_STRING;
|
|
|
|
args[1].value.pdb_pointer = proc_def->extensions;
|
2001-08-30 01:48:28 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
args[2].arg_type = GIMP_PDB_STRING;
|
|
|
|
args[2].value.pdb_pointer = proc_def->prefixes;
|
1999-03-07 20:56:03 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
args[3].arg_type = GIMP_PDB_STRING;
|
|
|
|
args[3].value.pdb_pointer = proc_def->magics;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-08-11 02:47:21 +08:00
|
|
|
g_free (procedural_db_execute (gimp, context, NULL,
|
2004-05-14 08:01:11 +08:00
|
|
|
proc_def->image_types ?
|
|
|
|
"gimp_register_save_handler" :
|
|
|
|
"gimp_register_magic_load_handler",
|
|
|
|
args));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
static PlugInProcDef *
|
2003-02-11 20:07:31 +08:00
|
|
|
plug_ins_proc_def_insert (Gimp *gimp,
|
|
|
|
PlugInProcDef *proc_def)
|
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
|
|
|
{
|
2004-02-01 18:52:23 +08:00
|
|
|
PlugInProcDef *tmp_proc_def = list->data;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
if (strcmp (proc_def->db_info.name, tmp_proc_def->db_info.name) == 0)
|
1999-03-07 20:56:03 +08:00
|
|
|
{
|
2003-01-20 20:17:32 +08:00
|
|
|
list->data = proc_def;
|
2001-09-03 21:03:34 +08:00
|
|
|
|
2003-01-18 02:07:37 +08:00
|
|
|
return tmp_proc_def;
|
2002-03-21 01:46:13 +08:00
|
|
|
}
|
2001-09-03 21:03:34 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-05-14 08:01:11 +08:00
|
|
|
gimp->plug_in_proc_defs = g_slist_prepend (gimp->plug_in_proc_defs,
|
|
|
|
proc_def);
|
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)
|
|
|
|
{
|
|
|
|
Gimp *gimp = data;
|
|
|
|
const PlugInProcDef *proc_a = a;
|
|
|
|
const PlugInProcDef *proc_b = b;
|
|
|
|
gchar *label_a;
|
|
|
|
gchar *label_b;
|
|
|
|
gint retval = 0;
|
|
|
|
|
|
|
|
if (strncmp (proc_a->prog, "gimp_xcf", 8) == 0)
|
|
|
|
return -1;
|
|
|
|
if (strncmp (proc_b->prog, "gimp_xcf", 8) == 0)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
label_a = plug_in_proc_def_get_label (proc_a,
|
|
|
|
plug_ins_locale_domain (gimp,
|
|
|
|
proc_a->prog,
|
|
|
|
NULL));
|
|
|
|
label_b = plug_in_proc_def_get_label (proc_b,
|
|
|
|
plug_ins_locale_domain (gimp,
|
|
|
|
proc_b->prog,
|
|
|
|
NULL));
|
|
|
|
|
|
|
|
if (label_a && label_b)
|
|
|
|
retval = g_utf8_collate (label_a, label_b);
|
|
|
|
|
|
|
|
g_free (label_a);
|
|
|
|
g_free (label_b);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|