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
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#include <string.h>
|
1999-04-25 03:12:12 +08:00
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
#include <glib-object.h>
|
1998-08-29 07:01:46 +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
|
|
|
|
2003-01-08 01:00:49 +08:00
|
|
|
#include "config/gimpguiconfig.h"
|
2002-11-19 04:50:31 +08:00
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
#include "base/tile.h"
|
|
|
|
|
2001-07-11 20:39:49 +08:00
|
|
|
#include "core/gimp.h"
|
2001-04-18 05:43:29 +08:00
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
#include "pdb/procedural_db.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-in-params.h"
|
2003-01-30 19:20:12 +08:00
|
|
|
#include "plug-in-run.h"
|
|
|
|
#include "plug-in-shm.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
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
/* local function prototypes */
|
1998-09-19 08:40:27 +08:00
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
static Argument * plug_in_temp_run (ProcRecord *proc_rec,
|
|
|
|
Argument *args,
|
|
|
|
gint argc);
|
|
|
|
static Argument * plug_in_get_return_vals (PlugIn *plug_in,
|
|
|
|
ProcRecord *proc_rec);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
/* public functions */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-07-16 20:49:04 +08:00
|
|
|
Argument *
|
2002-03-21 01:46:13 +08:00
|
|
|
plug_in_run (Gimp *gimp,
|
|
|
|
ProcRecord *proc_rec,
|
1997-11-25 06:05:25 +08:00
|
|
|
Argument *args,
|
2000-02-25 00:11:26 +08:00
|
|
|
gint argc,
|
2003-09-11 06:06:45 +08:00
|
|
|
gboolean synchronous,
|
2003-01-30 19:20:12 +08:00
|
|
|
gboolean destroy_return_vals,
|
2000-02-25 00:11:26 +08:00
|
|
|
gint gdisp_ID)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-01-30 19:20:12 +08:00
|
|
|
Argument *return_vals = NULL;
|
|
|
|
PlugIn *plug_in;
|
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);
|
|
|
|
g_return_val_if_fail (proc_rec != NULL, NULL);
|
|
|
|
g_return_val_if_fail (argc == 0 || args != NULL, NULL);
|
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
|
|
|
g_return_val_if_fail (proc_rec->proc_type != GIMP_EXTENSION ||
|
|
|
|
synchronous == FALSE, NULL);
|
2003-02-11 20:07:31 +08:00
|
|
|
|
2001-05-21 21:58:46 +08:00
|
|
|
if (proc_rec->proc_type == GIMP_TEMPORARY)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
1998-10-22 03:10:14 +08:00
|
|
|
return_vals = plug_in_temp_run (proc_rec, args, argc);
|
1997-11-25 06:05:25 +08:00
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
plug_in = plug_in_new (gimp, proc_rec,
|
|
|
|
proc_rec->exec_method.plug_in.filename);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
if (plug_in)
|
|
|
|
{
|
2003-02-03 21:21:31 +08:00
|
|
|
GPConfig config;
|
|
|
|
GPProcRun proc_run;
|
2003-11-08 01:29:02 +08:00
|
|
|
gint monitor;
|
2003-02-03 21:21:31 +08:00
|
|
|
|
|
|
|
if (! plug_in_open (plug_in))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-02-03 21:21:31 +08:00
|
|
|
plug_in_unref (plug_in);
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
2003-11-08 07:47:35 +08:00
|
|
|
config.version = GIMP_PROTOCOL_VERSION;
|
2003-02-03 21:21:31 +08:00
|
|
|
config.tile_width = TILE_WIDTH;
|
|
|
|
config.tile_height = TILE_HEIGHT;
|
|
|
|
config.shm_ID = plug_in_shm_get_ID (gimp);
|
|
|
|
config.gamma = gimp->config->gamma_val;
|
|
|
|
config.install_cmap = gimp->config->install_cmap;
|
|
|
|
config.show_tool_tips = GIMP_GUI_CONFIG (gimp->config)->show_tool_tips;
|
|
|
|
config.min_colors = CLAMP (gimp->config->min_colors, 27, 256);
|
|
|
|
config.gdisp_ID = gdisp_ID;
|
2003-11-08 01:29:02 +08:00
|
|
|
config.wm_name = g_get_prgname ();
|
|
|
|
config.wm_class = gimp_get_program_class (gimp);
|
|
|
|
config.display_name = gimp_get_display_name (gimp, gdisp_ID, &monitor);
|
|
|
|
config.monitor_number = monitor;
|
2003-02-03 21:21:31 +08:00
|
|
|
|
|
|
|
proc_run.name = proc_rec->name;
|
|
|
|
proc_run.nparams = argc;
|
|
|
|
proc_run.params = plug_in_args_to_params (args, argc, FALSE);
|
|
|
|
|
|
|
|
if (! gp_config_write (plug_in->my_write, &config, plug_in) ||
|
|
|
|
! gp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
|
|
|
|
! wire_flush (plug_in->my_write, plug_in))
|
|
|
|
{
|
2003-11-08 01:29:02 +08:00
|
|
|
g_free (config.display_name);
|
|
|
|
|
2003-02-03 21:21:31 +08:00
|
|
|
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
2003-11-08 01:29:02 +08:00
|
|
|
|
2003-02-03 21:21:31 +08:00
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
2003-11-08 01:29:02 +08:00
|
|
|
g_free (config.display_name);
|
|
|
|
|
2003-02-03 21:21:31 +08:00
|
|
|
plug_in_params_destroy (proc_run.params, proc_run.nparams, FALSE);
|
|
|
|
|
|
|
|
plug_in_ref (plug_in);
|
|
|
|
|
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 this is an extension,
|
|
|
|
* wait for an installation-confirmation message
|
2003-02-03 21:21:31 +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_rec->proc_type == GIMP_EXTENSION)
|
2003-02-03 21:21:31 +08:00
|
|
|
{
|
2003-06-24 02:27:03 +08:00
|
|
|
plug_in->ext_main_loop = g_main_loop_new (NULL, FALSE);
|
2003-02-03 21:21:31 +08:00
|
|
|
|
2003-06-24 02:27:03 +08:00
|
|
|
gimp_threads_leave (gimp);
|
|
|
|
g_main_loop_run (plug_in->ext_main_loop);
|
|
|
|
gimp_threads_enter (gimp);
|
2003-02-03 21:21:31 +08:00
|
|
|
|
2003-06-24 02:27:03 +08:00
|
|
|
g_main_loop_unref (plug_in->ext_main_loop);
|
|
|
|
plug_in->ext_main_loop = NULL;
|
2003-02-03 21:21:31 +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 this plug-in is requested to run synchronously,
|
|
|
|
* wait for its return values
|
2003-02-03 21:21:31 +08:00
|
|
|
*/
|
2003-06-24 02:27:03 +08:00
|
|
|
if (synchronous)
|
2003-02-03 21:21:31 +08:00
|
|
|
{
|
2003-06-24 02:27:03 +08:00
|
|
|
plug_in->recurse_main_loop = g_main_loop_new (NULL, FALSE);
|
|
|
|
|
|
|
|
gimp_threads_leave (gimp);
|
|
|
|
g_main_loop_run (plug_in->recurse_main_loop);
|
|
|
|
gimp_threads_enter (gimp);
|
|
|
|
|
|
|
|
g_main_loop_unref (plug_in->recurse_main_loop);
|
|
|
|
plug_in->recurse_main_loop = NULL;
|
2003-02-03 21:21:31 +08:00
|
|
|
|
|
|
|
return_vals = plug_in_get_return_vals (plug_in, proc_rec);
|
|
|
|
}
|
|
|
|
|
|
|
|
plug_in_unref (plug_in);
|
1997-11-25 06:05:25 +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
|
|
|
|
2000-05-17 20:29:38 +08:00
|
|
|
done:
|
2003-01-30 19:20:12 +08:00
|
|
|
if (return_vals && destroy_return_vals)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
procedural_db_destroy_args (return_vals, proc_rec->num_values);
|
|
|
|
return_vals = NULL;
|
|
|
|
}
|
2003-01-30 19:20:12 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
return return_vals;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-03-21 01:46:13 +08:00
|
|
|
plug_in_repeat (Gimp *gimp,
|
|
|
|
gint display_ID,
|
|
|
|
gint image_ID,
|
|
|
|
gint drawable_ID,
|
|
|
|
gboolean with_interface)
|
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
|
|
|
Argument *args;
|
|
|
|
gint i;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-02-11 20:07:31 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
|
|
|
if (gimp->last_plug_in)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
/* construct the procedures arguments */
|
1998-10-22 03:10:14 +08:00
|
|
|
args = g_new (Argument, 3);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1998-10-22 03:10:14 +08:00
|
|
|
/* initialize the first three argument types */
|
|
|
|
for (i = 0; i < 3; i++)
|
2003-02-11 20:07:31 +08:00
|
|
|
args[i].arg_type = gimp->last_plug_in->args[i].arg_type;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1998-10-22 03:10:14 +08:00
|
|
|
/* initialize the first three plug-in arguments */
|
2003-09-11 06:06:45 +08:00
|
|
|
args[0].value.pdb_int = (with_interface ?
|
2001-12-19 08:13:16 +08:00
|
|
|
GIMP_RUN_INTERACTIVE : GIMP_RUN_WITH_LAST_VALS);
|
2002-03-21 01:46:13 +08:00
|
|
|
args[1].value.pdb_int = image_ID;
|
|
|
|
args[2].value.pdb_int = drawable_ID;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* run the plug-in procedure */
|
2003-02-11 20:07:31 +08:00
|
|
|
plug_in_run (gimp, gimp->last_plug_in, args, 3, FALSE, TRUE, display_ID);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
g_free (args);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
/* private functions */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
static Argument *
|
|
|
|
plug_in_temp_run (ProcRecord *proc_rec,
|
|
|
|
Argument *args,
|
|
|
|
gint argc)
|
|
|
|
{
|
2003-02-03 21:21:31 +08:00
|
|
|
Argument *return_vals = NULL;
|
|
|
|
PlugIn *plug_in;
|
2000-05-11 05:21:23 +08:00
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
plug_in = (PlugIn *) proc_rec->exec_method.temporary.plug_in;
|
2000-05-11 05:21:23 +08:00
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
if (plug_in)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-02-03 21:21:31 +08:00
|
|
|
GPProcRun proc_run;
|
|
|
|
|
2003-02-18 22:08:14 +08:00
|
|
|
if (plug_in->current_temp_proc)
|
2000-05-11 05:21:23 +08:00
|
|
|
{
|
2003-01-30 19:20:12 +08:00
|
|
|
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
|
|
|
goto done;
|
2000-05-11 05:21:23 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-02-18 22:08:14 +08:00
|
|
|
plug_in->current_temp_proc = proc_rec;
|
2000-05-11 05:21:23 +08:00
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
proc_run.name = proc_rec->name;
|
|
|
|
proc_run.nparams = argc;
|
|
|
|
proc_run.params = plug_in_args_to_params (args, argc, FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
|
|
|
|
! wire_flush (plug_in->my_write, plug_in))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-01-30 19:20:12 +08:00
|
|
|
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
|
|
|
goto done;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2000-07-16 20:49:04 +08:00
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
plug_in_params_destroy (proc_run.params, proc_run.nparams, FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-02-03 21:21:31 +08:00
|
|
|
plug_in_ref (plug_in);
|
|
|
|
|
2003-06-24 02:27:03 +08:00
|
|
|
#ifdef ENABLE_TEMP_RETURN
|
2003-01-30 19:20:12 +08:00
|
|
|
plug_in_main_loop (plug_in);
|
2003-02-03 21:21:31 +08:00
|
|
|
|
2003-06-24 02:27:03 +08:00
|
|
|
return_vals = plug_in_get_return_vals (plug_in, proc_rec);
|
2003-01-30 19:20:12 +08:00
|
|
|
#else
|
|
|
|
return_vals = procedural_db_return_args (proc_rec, TRUE);
|
|
|
|
#endif
|
2003-01-18 02:07:37 +08:00
|
|
|
|
2003-02-18 22:08:14 +08:00
|
|
|
plug_in->current_temp_proc = NULL;
|
2003-02-03 21:21:31 +08:00
|
|
|
|
|
|
|
plug_in_unref (plug_in);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2002-05-21 18:58:50 +08:00
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
done:
|
|
|
|
return return_vals;
|
2002-02-12 15:59:16 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
static Argument *
|
|
|
|
plug_in_get_return_vals (PlugIn *plug_in,
|
|
|
|
ProcRecord *proc_rec)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-01-30 19:20:12 +08:00
|
|
|
Argument *return_vals;
|
|
|
|
gint nargs;
|
2002-05-17 01:41:38 +08:00
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
g_return_val_if_fail (plug_in != NULL, NULL);
|
|
|
|
g_return_val_if_fail (proc_rec != NULL, NULL);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
/* Return the status code plus the current return values. */
|
|
|
|
nargs = proc_rec->num_values + 1;
|
2003-02-03 21:21:31 +08:00
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
if (plug_in->return_vals && plug_in->n_return_vals == nargs)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-01-30 19:20:12 +08:00
|
|
|
return_vals = plug_in->return_vals;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2003-01-30 19:20:12 +08:00
|
|
|
else if (plug_in->return_vals)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-01-30 19:20:12 +08:00
|
|
|
/* Allocate new return values of the correct size. */
|
|
|
|
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
/* Copy all of the arguments we can. */
|
|
|
|
memcpy (return_vals, plug_in->return_vals,
|
|
|
|
sizeof (Argument) * MIN (plug_in->n_return_vals, nargs));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
/* Free the old argument pointer. This will cause a memory leak
|
2003-02-03 21:21:31 +08:00
|
|
|
* only if there were more values returned than we need (which
|
|
|
|
* shouldn't ever happen).
|
|
|
|
*/
|
2003-01-30 19:20:12 +08:00
|
|
|
g_free (plug_in->return_vals);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-01-30 19:20:12 +08:00
|
|
|
/* Just return a dummy set of values. */
|
|
|
|
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2002-02-12 10:41:01 +08:00
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
/* We have consumed any saved values, so clear them. */
|
|
|
|
plug_in->return_vals = NULL;
|
|
|
|
plug_in->n_return_vals = 0;
|
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
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
return return_vals;
|
|
|
|
}
|