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 <signal.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2003-01-30 19:20:12 +08:00
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
1999-03-07 20:56:03 +08:00
|
|
|
#ifdef HAVE_SYS_WAIT_H
|
1997-11-25 06:05:25 +08:00
|
|
|
#include <sys/wait.h>
|
1999-03-07 20:56:03 +08:00
|
|
|
#endif
|
2003-01-30 19:20:12 +08:00
|
|
|
|
1999-03-07 20:56:03 +08:00
|
|
|
#ifdef HAVE_SYS_TIME_H
|
1997-11-25 06:05:25 +08:00
|
|
|
#include <sys/time.h>
|
1999-03-07 21:23:06 +08:00
|
|
|
#endif
|
2002-02-18 22:34:50 +08:00
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
#ifdef HAVE_SYS_PARAM_H
|
|
|
|
#include <sys/param.h>
|
1999-03-07 20:56:03 +08:00
|
|
|
#endif
|
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
1999-10-07 05:27:18 +08:00
|
|
|
#if defined(G_OS_WIN32) || defined(G_WITH_CYGWIN)
|
2003-01-20 20:17:32 +08:00
|
|
|
|
1999-03-07 20:56:03 +08:00
|
|
|
#define STRICT
|
|
|
|
#include <windows.h>
|
|
|
|
#include <process.h>
|
|
|
|
|
1999-10-05 03:26:07 +08:00
|
|
|
#ifdef G_OS_WIN32
|
1999-03-07 20:56:03 +08:00
|
|
|
#include <fcntl.h>
|
|
|
|
#include <io.h>
|
|
|
|
#endif
|
|
|
|
|
1999-10-07 05:27:18 +08:00
|
|
|
#ifdef G_WITH_CYGWIN
|
1999-03-07 20:56:03 +08:00
|
|
|
#define O_TEXT 0x0100 /* text file */
|
|
|
|
#define _O_TEXT 0x0100 /* text file */
|
|
|
|
#define O_BINARY 0x0200 /* binary file */
|
|
|
|
#define _O_BINARY 0x0200 /* binary file */
|
|
|
|
#endif
|
|
|
|
|
2003-01-20 20:17:32 +08:00
|
|
|
#endif /* G_OS_WIN32 || G_WITH_CYGWIN */
|
1999-03-07 20:56:03 +08:00
|
|
|
|
1999-04-25 03:12:12 +08:00
|
|
|
#ifdef __EMX__
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <process.h>
|
|
|
|
#define _O_BINARY O_BINARY
|
|
|
|
#define _P_NOWAIT P_NOWAIT
|
|
|
|
#endif
|
|
|
|
|
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
|
|
|
|
2001-05-15 19:25:25 +08:00
|
|
|
#include "base/tile.h"
|
|
|
|
#include "base/tile-manager.h"
|
|
|
|
|
2001-07-11 20:39:49 +08:00
|
|
|
#include "core/gimp.h"
|
2002-11-12 11:34:11 +08:00
|
|
|
#include "core/gimpenvirontable.h"
|
2001-04-18 05:43:29 +08:00
|
|
|
|
|
|
|
#include "gui/brush-select.h"
|
|
|
|
#include "gui/gradient-select.h"
|
2002-03-13 05:02:10 +08:00
|
|
|
#include "gui/palette-select.h"
|
2001-04-18 05:43:29 +08:00
|
|
|
#include "gui/pattern-select.h"
|
|
|
|
|
2001-12-01 08:14:14 +08:00
|
|
|
#include "plug-in.h"
|
2002-03-21 01:46:13 +08:00
|
|
|
#include "plug-ins.h"
|
2003-02-11 09:21:21 +08:00
|
|
|
#include "plug-in-debug.h"
|
2002-03-21 01:46:13 +08:00
|
|
|
#include "plug-in-def.h"
|
2003-01-30 19:20:12 +08:00
|
|
|
#include "plug-in-message.h"
|
2002-03-21 01:46:13 +08:00
|
|
|
#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"
|
2003-01-30 19:20:12 +08:00
|
|
|
#include "plug-in-shm.h"
|
2001-12-01 08:14:14 +08:00
|
|
|
|
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
|
|
|
#include "libgimp/gimpintl.h"
|
|
|
|
|
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 funcion prototypes */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
static gboolean plug_in_write (GIOChannel *channel,
|
|
|
|
guint8 *buf,
|
|
|
|
gulong count,
|
|
|
|
gpointer user_data);
|
|
|
|
static gboolean plug_in_flush (GIOChannel *channel,
|
|
|
|
gpointer user_data);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
static gboolean plug_in_recv_message (GIOChannel *channel,
|
|
|
|
GIOCondition cond,
|
|
|
|
gpointer data);
|
1999-03-07 20:56:03 +08:00
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
static void plug_in_prep_for_exec (gpointer data);
|
1999-05-07 04:56:07 +08:00
|
|
|
|
2002-06-13 20:02:06 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
void
|
2002-03-21 01:46:13 +08:00
|
|
|
plug_in_init (Gimp *gimp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-10-20 00:41:09 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* initialize the gimp protocol library and set the read and
|
|
|
|
* write handlers.
|
|
|
|
*/
|
|
|
|
gp_init ();
|
|
|
|
wire_set_writer (plug_in_write);
|
|
|
|
wire_set_flusher (plug_in_flush);
|
|
|
|
|
|
|
|
/* allocate a piece of shared memory for use in transporting tiles
|
|
|
|
* to plug-ins. if we can't allocate a piece of shared memory then
|
|
|
|
* we'll fall back on sending the data over the pipe.
|
|
|
|
*/
|
2002-12-01 20:16:03 +08:00
|
|
|
if (gimp->use_shm)
|
2003-01-30 19:20:12 +08:00
|
|
|
plug_in_shm_init (gimp);
|
2003-02-11 09:21:21 +08:00
|
|
|
|
|
|
|
plug_in_debug_init (gimp);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-01-30 19:20:12 +08:00
|
|
|
plug_in_exit (Gimp *gimp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-01-30 19:20:12 +08:00
|
|
|
GSList *list;
|
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
2003-02-11 09:21:21 +08:00
|
|
|
plug_in_debug_exit (gimp);
|
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
if (gimp->use_shm)
|
|
|
|
plug_in_shm_exit (gimp);
|
|
|
|
|
2003-02-11 20:07:31 +08:00
|
|
|
list = gimp->open_plug_ins;
|
2003-01-30 19:20:12 +08:00
|
|
|
while (list)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-01-30 19:20:12 +08:00
|
|
|
PlugIn *plug_in;
|
|
|
|
|
|
|
|
plug_in = (PlugIn *) list->data;
|
|
|
|
|
|
|
|
list = list->next;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-02-03 21:21:31 +08:00
|
|
|
if (plug_in->open)
|
|
|
|
plug_in_close (plug_in, TRUE);
|
|
|
|
|
|
|
|
plug_in_unref (plug_in);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-03-21 01:46:13 +08:00
|
|
|
plug_in_call_query (Gimp *gimp,
|
|
|
|
PlugInDef *plug_in_def)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-01-30 19:20:12 +08:00
|
|
|
PlugIn *plug_in;
|
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
g_return_if_fail (plug_in_def != NULL);
|
2001-01-14 23:18:37 +08:00
|
|
|
|
2003-02-18 22:08:14 +08:00
|
|
|
plug_in = plug_in_new (gimp, NULL, plug_in_def->prog);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
if (plug_in)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-03-21 01:46:13 +08:00
|
|
|
plug_in->query = TRUE;
|
|
|
|
plug_in->synchronous = TRUE;
|
2003-01-18 02:07:37 +08:00
|
|
|
plug_in->plug_in_def = plug_in_def;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
if (plug_in_open (plug_in))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-03-21 01:46:13 +08:00
|
|
|
while (plug_in->open)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-01-30 19:20:12 +08:00
|
|
|
WireMessage msg;
|
|
|
|
|
2002-05-17 01:41:38 +08:00
|
|
|
if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
|
2002-03-21 01:46:13 +08:00
|
|
|
{
|
2002-05-16 19:45:30 +08:00
|
|
|
plug_in_close (plug_in, TRUE);
|
2002-03-21 01:46:13 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-05-16 19:45:30 +08:00
|
|
|
plug_in_handle_message (plug_in, &msg);
|
2002-03-21 01:46:13 +08:00
|
|
|
wire_destroy (&msg);
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
2003-01-30 19:20:12 +08:00
|
|
|
|
2003-02-03 21:21:31 +08:00
|
|
|
plug_in_unref (plug_in);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2001-11-25 04:31:15 +08:00
|
|
|
}
|
2000-02-24 02:07:53 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
void
|
2002-03-21 01:46:13 +08:00
|
|
|
plug_in_call_init (Gimp *gimp,
|
|
|
|
PlugInDef *plug_in_def)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-01-30 19:20:12 +08:00
|
|
|
PlugIn *plug_in;
|
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
g_return_if_fail (plug_in_def != NULL);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-02-18 22:08:14 +08:00
|
|
|
plug_in = plug_in_new (gimp, NULL, plug_in_def->prog);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
if (plug_in)
|
1999-02-14 09:53:23 +08:00
|
|
|
{
|
2002-03-21 01:46:13 +08:00
|
|
|
plug_in->init = TRUE;
|
|
|
|
plug_in->synchronous = TRUE;
|
2003-01-18 02:07:37 +08:00
|
|
|
plug_in->plug_in_def = plug_in_def;
|
1999-02-14 09:53:23 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
if (plug_in_open (plug_in))
|
1999-11-25 19:35:48 +08:00
|
|
|
{
|
2002-03-21 01:46:13 +08:00
|
|
|
while (plug_in->open)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-01-30 19:20:12 +08:00
|
|
|
WireMessage msg;
|
|
|
|
|
2002-05-17 01:41:38 +08:00
|
|
|
if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
|
2002-03-21 01:46:13 +08:00
|
|
|
{
|
2002-05-16 19:45:30 +08:00
|
|
|
plug_in_close (plug_in, TRUE);
|
2002-03-21 01:46:13 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-05-16 19:45:30 +08:00
|
|
|
plug_in_handle_message (plug_in, &msg);
|
2002-03-21 01:46:13 +08:00
|
|
|
wire_destroy (&msg);
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
2003-01-30 19:20:12 +08:00
|
|
|
|
2003-02-03 21:21:31 +08:00
|
|
|
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
|
|
|
PlugIn *
|
2003-02-11 09:21:21 +08:00
|
|
|
plug_in_new (Gimp *gimp,
|
2003-02-18 22:08:14 +08:00
|
|
|
ProcRecord *proc_rec,
|
2003-02-11 09:21:21 +08:00
|
|
|
const gchar *prog)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
PlugIn *plug_in;
|
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
2003-02-11 09:21:21 +08:00
|
|
|
g_return_val_if_fail (prog != NULL, NULL);
|
|
|
|
g_return_val_if_fail (g_path_is_absolute (prog), NULL);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
plug_in = g_new0 (PlugIn, 1);
|
|
|
|
|
|
|
|
plug_in->gimp = gimp;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-02-03 21:21:31 +08:00
|
|
|
plug_in->ref_count = 1;
|
|
|
|
|
2003-02-18 22:08:14 +08:00
|
|
|
plug_in->proc_rec = proc_rec;
|
|
|
|
|
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
|
|
|
plug_in->open = FALSE;
|
|
|
|
plug_in->query = FALSE;
|
2002-02-12 10:41:01 +08:00
|
|
|
plug_in->init = 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
|
|
|
plug_in->synchronous = FALSE;
|
|
|
|
plug_in->recurse = FALSE;
|
2003-02-03 21:21:31 +08:00
|
|
|
plug_in->starting_ext = 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
|
|
|
plug_in->pid = 0;
|
2003-01-30 19:20:12 +08:00
|
|
|
|
2003-02-11 09:21:21 +08:00
|
|
|
plug_in->name = g_path_get_basename (prog);
|
|
|
|
plug_in->prog = g_strdup (prog);
|
2003-01-30 19:20:12 +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
|
|
|
plug_in->my_read = NULL;
|
|
|
|
plug_in->my_write = NULL;
|
|
|
|
plug_in->his_read = NULL;
|
|
|
|
plug_in->his_write = NULL;
|
2003-01-30 19:20:12 +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
|
|
|
plug_in->input_id = 0;
|
1997-11-25 06:05:25 +08:00
|
|
|
plug_in->write_buffer_index = 0;
|
2003-01-30 19:20:12 +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
|
|
|
plug_in->temp_proc_defs = NULL;
|
2003-02-18 22:08:14 +08:00
|
|
|
plug_in->current_temp_proc = NULL;
|
2003-01-30 19:20:12 +08:00
|
|
|
|
|
|
|
plug_in->main_loops = NULL;
|
|
|
|
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
|
|
|
plug_in->progress = NULL;
|
2003-01-18 02:07:37 +08:00
|
|
|
plug_in->plug_in_def = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
return plug_in;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-02-03 21:21:31 +08:00
|
|
|
plug_in_ref (PlugIn *plug_in)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-01-20 20:17:32 +08:00
|
|
|
g_return_if_fail (plug_in != NULL);
|
|
|
|
|
2003-02-03 21:21:31 +08:00
|
|
|
plug_in->ref_count++;
|
|
|
|
}
|
2003-01-20 20:17:32 +08:00
|
|
|
|
2003-02-03 21:21:31 +08:00
|
|
|
void
|
|
|
|
plug_in_unref (PlugIn *plug_in)
|
|
|
|
{
|
|
|
|
g_return_if_fail (plug_in != NULL);
|
2003-01-20 20:17:32 +08:00
|
|
|
|
2003-02-03 21:21:31 +08:00
|
|
|
plug_in->ref_count--;
|
2003-01-20 20:17:32 +08:00
|
|
|
|
2003-02-03 21:21:31 +08:00
|
|
|
if (plug_in->ref_count < 1)
|
|
|
|
{
|
|
|
|
if (plug_in->open)
|
|
|
|
plug_in_close (plug_in, TRUE);
|
|
|
|
|
2003-02-11 09:21:21 +08:00
|
|
|
g_free (plug_in->name);
|
|
|
|
g_free (plug_in->prog);
|
2003-02-03 21:21:31 +08:00
|
|
|
|
|
|
|
if (plug_in->progress)
|
|
|
|
plug_in_progress_end (plug_in);
|
|
|
|
|
|
|
|
g_free (plug_in);
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2002-11-17 03:01:46 +08:00
|
|
|
static void
|
|
|
|
plug_in_prep_for_exec (gpointer data)
|
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-11-17 03:01:46 +08:00
|
|
|
#if !defined(G_OS_WIN32) && !defined (G_WITH_CYGWIN) && !defined(__EMX__)
|
|
|
|
PlugIn *plug_in = data;
|
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-11-17 03:01:46 +08:00
|
|
|
g_io_channel_unref (plug_in->my_read);
|
|
|
|
plug_in->my_read = NULL;
|
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-11-17 03:01:46 +08:00
|
|
|
g_io_channel_unref (plug_in->my_write);
|
|
|
|
plug_in->my_write = NULL;
|
|
|
|
#endif
|
|
|
|
}
|
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
|
|
|
|
2000-02-25 00:11:26 +08:00
|
|
|
gboolean
|
1997-11-25 06:05:25 +08:00
|
|
|
plug_in_open (PlugIn *plug_in)
|
|
|
|
{
|
2003-02-11 09:21:21 +08:00
|
|
|
gint my_read[2];
|
|
|
|
gint my_write[2];
|
|
|
|
gchar **envp;
|
|
|
|
gchar *args[7], **argv, **debug_argv;
|
|
|
|
gchar *read_fd, *write_fd;
|
|
|
|
gchar *mode, *stm;
|
|
|
|
GError *error = NULL;
|
|
|
|
Gimp *gimp;
|
|
|
|
gboolean debug;
|
|
|
|
guint debug_flag;
|
|
|
|
guint spawn_flags;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
g_return_val_if_fail (plug_in != NULL, FALSE);
|
|
|
|
|
2003-02-11 09:21:21 +08:00
|
|
|
gimp = plug_in->gimp;
|
|
|
|
|
2003-01-20 20:17:32 +08:00
|
|
|
/* Open two pipes. (Bidirectional communication).
|
|
|
|
*/
|
|
|
|
if ((pipe (my_read) == -1) || (pipe (my_write) == -1))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-01-20 20:17:32 +08:00
|
|
|
g_message ("pipe() failed: Unable to start Plug-In \"%s\"\n(%s)",
|
2003-02-11 09:21:21 +08:00
|
|
|
plug_in->name,
|
|
|
|
plug_in->prog);
|
2003-01-20 20:17:32 +08:00
|
|
|
return FALSE;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-10-07 05:27:18 +08:00
|
|
|
#if defined(G_WITH_CYGWIN) || defined(__EMX__)
|
2003-01-20 20:17:32 +08:00
|
|
|
/* Set to binary mode */
|
|
|
|
setmode (my_read[0], _O_BINARY);
|
|
|
|
setmode (my_write[0], _O_BINARY);
|
|
|
|
setmode (my_read[1], _O_BINARY);
|
|
|
|
setmode (my_write[1], _O_BINARY);
|
1999-03-07 20:56:03 +08:00
|
|
|
#endif
|
|
|
|
|
2003-01-20 20:17:32 +08:00
|
|
|
plug_in->my_read = g_io_channel_unix_new (my_read[0]);
|
|
|
|
plug_in->my_write = g_io_channel_unix_new (my_write[1]);
|
|
|
|
plug_in->his_read = g_io_channel_unix_new (my_write[0]);
|
|
|
|
plug_in->his_write = g_io_channel_unix_new (my_read[1]);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-01-20 20:17:32 +08:00
|
|
|
g_io_channel_set_encoding (plug_in->my_read, NULL, NULL);
|
|
|
|
g_io_channel_set_encoding (plug_in->my_write, NULL, NULL);
|
|
|
|
g_io_channel_set_encoding (plug_in->his_read, NULL, NULL);
|
|
|
|
g_io_channel_set_encoding (plug_in->his_write, NULL, NULL);
|
2001-08-30 01:48:28 +08:00
|
|
|
|
2003-01-20 20:17:32 +08:00
|
|
|
g_io_channel_set_buffered (plug_in->my_read, FALSE);
|
|
|
|
g_io_channel_set_buffered (plug_in->my_write, FALSE);
|
|
|
|
g_io_channel_set_buffered (plug_in->his_read, FALSE);
|
|
|
|
g_io_channel_set_buffered (plug_in->his_write, FALSE);
|
2001-08-30 09:09:58 +08:00
|
|
|
|
2003-01-20 20:17:32 +08:00
|
|
|
g_io_channel_set_close_on_unref (plug_in->my_read, TRUE);
|
|
|
|
g_io_channel_set_close_on_unref (plug_in->my_write, TRUE);
|
|
|
|
g_io_channel_set_close_on_unref (plug_in->his_read, TRUE);
|
|
|
|
g_io_channel_set_close_on_unref (plug_in->his_write, TRUE);
|
2001-08-30 01:48:28 +08:00
|
|
|
|
2003-01-20 20:17:32 +08:00
|
|
|
/* Remember the file descriptors for the pipes.
|
|
|
|
*/
|
2003-02-11 09:21:21 +08:00
|
|
|
read_fd =
|
2003-01-20 20:17:32 +08:00
|
|
|
g_strdup_printf ("%d", g_io_channel_unix_get_fd (plug_in->his_read));
|
2003-02-11 09:21:21 +08:00
|
|
|
write_fd =
|
2003-01-20 20:17:32 +08:00
|
|
|
g_strdup_printf ("%d", g_io_channel_unix_get_fd (plug_in->his_write));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-01-20 20:17:32 +08:00
|
|
|
/* Set the rest of the command line arguments.
|
|
|
|
* FIXME: this is ugly. Pass in the mode as a separate argument?
|
|
|
|
*/
|
|
|
|
if (plug_in->query)
|
|
|
|
{
|
2003-02-11 09:21:21 +08:00
|
|
|
mode = "-query";
|
|
|
|
debug_flag = GIMP_DEBUG_WRAP_QUERY;
|
2003-01-20 20:17:32 +08:00
|
|
|
}
|
|
|
|
else if (plug_in->init)
|
|
|
|
{
|
2003-02-11 09:21:21 +08:00
|
|
|
mode = "-init";
|
|
|
|
debug_flag = GIMP_DEBUG_WRAP_INIT;
|
2003-01-20 20:17:32 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-02-11 09:21:21 +08:00
|
|
|
mode = "-run";
|
|
|
|
debug_flag = GIMP_DEBUG_WRAP_RUN;
|
2003-01-20 20:17:32 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-02-11 09:21:21 +08:00
|
|
|
stm = g_strdup_printf ("%d", plug_in->gimp->stack_trace_mode);
|
2000-07-16 20:49:04 +08:00
|
|
|
|
1999-04-25 03:12:12 +08:00
|
|
|
#ifdef __EMX__
|
2003-01-20 20:17:32 +08:00
|
|
|
fcntl (my_read[0], F_SETFD, 1);
|
|
|
|
fcntl (my_write[1], F_SETFD, 1);
|
1999-04-25 03:12:12 +08:00
|
|
|
#endif
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-02-11 09:21:21 +08:00
|
|
|
args[0] = plug_in->prog;
|
|
|
|
args[1] = "-gimp";
|
|
|
|
args[2] = read_fd;
|
|
|
|
args[3] = write_fd;
|
|
|
|
args[4] = mode;
|
|
|
|
args[5] = stm;
|
|
|
|
args[6] = NULL;
|
|
|
|
|
|
|
|
argv = args;
|
|
|
|
envp = gimp_environ_table_get_envp (plug_in->gimp->environ_table);
|
2003-03-22 00:50:55 +08:00
|
|
|
spawn_flags = (G_SPAWN_LEAVE_DESCRIPTORS_OPEN |
|
|
|
|
G_SPAWN_DO_NOT_REAP_CHILD |
|
|
|
|
G_SPAWN_CHILD_INHERITS_STDIN);
|
2003-02-11 09:21:21 +08:00
|
|
|
|
|
|
|
debug = FALSE;
|
|
|
|
|
|
|
|
if (gimp->plug_in_debug)
|
|
|
|
{
|
|
|
|
debug_argv = plug_in_debug_argv (gimp, plug_in->name, debug_flag, args);
|
|
|
|
|
|
|
|
if (debug_argv)
|
|
|
|
{
|
|
|
|
debug = TRUE;
|
|
|
|
argv = debug_argv;
|
|
|
|
spawn_flags |= G_SPAWN_SEARCH_PATH;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-02-03 21:21:31 +08:00
|
|
|
/* Fork another process. We'll remember the process id so that we
|
|
|
|
* can later use it to kill the filter if necessary.
|
2003-01-20 20:17:32 +08:00
|
|
|
*/
|
2003-02-11 09:21:21 +08:00
|
|
|
if (! g_spawn_async (NULL, argv, envp, spawn_flags,
|
2003-01-20 20:17:32 +08:00
|
|
|
plug_in_prep_for_exec, plug_in,
|
|
|
|
&plug_in->pid,
|
|
|
|
&error))
|
|
|
|
{
|
|
|
|
g_message ("Unable to run Plug-In: \"%s\"\n(%s)\n%s",
|
2003-02-11 09:21:21 +08:00
|
|
|
plug_in->name,
|
|
|
|
plug_in->prog,
|
2003-01-20 20:17:32 +08:00
|
|
|
error->message);
|
|
|
|
g_error_free (error);
|
2003-02-11 09:21:21 +08:00
|
|
|
goto cleanup;
|
2003-01-20 20:17:32 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-01-20 20:17:32 +08:00
|
|
|
g_io_channel_unref (plug_in->his_read);
|
2003-01-30 19:20:12 +08:00
|
|
|
plug_in->his_read = NULL;
|
2001-08-30 01:48:28 +08:00
|
|
|
|
2003-01-20 20:17:32 +08:00
|
|
|
g_io_channel_unref (plug_in->his_write);
|
|
|
|
plug_in->his_write = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-01-20 20:17:32 +08:00
|
|
|
if (! plug_in->synchronous)
|
|
|
|
{
|
|
|
|
plug_in->input_id = g_io_add_watch (plug_in->my_read,
|
|
|
|
G_IO_IN | G_IO_PRI |
|
|
|
|
G_IO_ERR | G_IO_HUP,
|
|
|
|
plug_in_recv_message,
|
|
|
|
plug_in);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-02-11 20:07:31 +08:00
|
|
|
gimp->open_plug_ins = g_slist_prepend (gimp->open_plug_ins, plug_in);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2003-01-20 20:17:32 +08:00
|
|
|
plug_in->open = TRUE;
|
2003-02-11 09:21:21 +08:00
|
|
|
|
|
|
|
cleanup:
|
|
|
|
|
|
|
|
if (debug)
|
|
|
|
g_free (argv);
|
|
|
|
|
|
|
|
g_free (read_fd);
|
|
|
|
g_free (write_fd);
|
|
|
|
g_free (stm);
|
|
|
|
|
|
|
|
return plug_in->open;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-02-25 00:11:26 +08:00
|
|
|
plug_in_close (PlugIn *plug_in,
|
|
|
|
gboolean kill_it)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-02-11 20:07:31 +08:00
|
|
|
Gimp *gimp;
|
|
|
|
gint status;
|
1999-10-05 03:26:07 +08:00
|
|
|
#ifndef G_OS_WIN32
|
1997-11-25 06:05:25 +08:00
|
|
|
struct timeval tv;
|
1999-03-07 20:56:03 +08:00
|
|
|
#endif
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-09-03 21:03:34 +08:00
|
|
|
g_return_if_fail (plug_in != NULL);
|
|
|
|
g_return_if_fail (plug_in->open == TRUE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-02-11 20:07:31 +08:00
|
|
|
gimp = plug_in->gimp;
|
|
|
|
|
2001-09-03 21:03:34 +08:00
|
|
|
if (! plug_in->open)
|
|
|
|
return;
|
|
|
|
|
|
|
|
plug_in->open = FALSE;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-09-03 21:03:34 +08:00
|
|
|
/* Ask the filter to exit gracefully */
|
|
|
|
if (kill_it && plug_in->pid)
|
|
|
|
{
|
2002-05-17 01:41:38 +08:00
|
|
|
gp_quit_write (plug_in->my_write, plug_in);
|
2001-09-03 21:03:34 +08:00
|
|
|
|
|
|
|
/* give the plug-in some time (10 ms) */
|
1999-10-05 03:26:07 +08:00
|
|
|
#ifndef G_OS_WIN32
|
2001-09-03 21:03:34 +08:00
|
|
|
tv.tv_sec = 0;
|
|
|
|
tv.tv_usec = 100; /* But this is 0.1 ms? */
|
|
|
|
select (0, NULL, NULL, NULL, &tv);
|
1999-03-07 20:56:03 +08:00
|
|
|
#else
|
2001-09-03 21:03:34 +08:00
|
|
|
Sleep (10);
|
1999-03-07 20:56:03 +08:00
|
|
|
#endif
|
2001-09-03 21:03:34 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-09-03 21:03:34 +08:00
|
|
|
/* If necessary, kill the filter. */
|
1999-10-05 03:26:07 +08:00
|
|
|
#ifndef G_OS_WIN32
|
2001-09-03 21:03:34 +08:00
|
|
|
if (kill_it && plug_in->pid)
|
|
|
|
status = kill (plug_in->pid, SIGKILL);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-09-03 21:03:34 +08:00
|
|
|
/* Wait for the process to exit. This will happen
|
|
|
|
* immediately if it was just killed.
|
|
|
|
*/
|
|
|
|
if (plug_in->pid)
|
|
|
|
waitpid (plug_in->pid, &status, 0);
|
1999-03-07 20:56:03 +08:00
|
|
|
#else
|
2001-09-03 21:03:34 +08:00
|
|
|
if (kill_it && plug_in->pid)
|
|
|
|
{
|
|
|
|
/* Trying to avoid TerminateProcess (does mostly work).
|
|
|
|
* Otherwise some of our needed DLLs may get into an unstable state
|
|
|
|
* (see Win32 API docs).
|
|
|
|
*/
|
|
|
|
DWORD dwExitCode = STILL_ACTIVE;
|
|
|
|
DWORD dwTries = 10;
|
|
|
|
while ((STILL_ACTIVE == dwExitCode)
|
2003-01-20 20:17:32 +08:00
|
|
|
&& GetExitCodeProcess ((HANDLE) plug_in->pid, &dwExitCode)
|
2001-09-03 21:03:34 +08:00
|
|
|
&& (dwTries > 0))
|
1999-03-07 20:56:03 +08:00
|
|
|
{
|
2001-09-03 21:03:34 +08:00
|
|
|
Sleep(10);
|
|
|
|
dwTries--;
|
1999-03-07 20:56:03 +08:00
|
|
|
}
|
2001-09-03 21:03:34 +08:00
|
|
|
if (STILL_ACTIVE == dwExitCode)
|
1999-03-07 20:56:03 +08:00
|
|
|
{
|
2003-02-11 09:21:21 +08:00
|
|
|
g_warning ("Terminating %s ...", plug_in->prog);
|
2001-09-03 21:03:34 +08:00
|
|
|
TerminateProcess ((HANDLE) plug_in->pid, 0);
|
1999-03-07 20:56:03 +08:00
|
|
|
}
|
2001-09-03 21:03:34 +08:00
|
|
|
}
|
|
|
|
#endif
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-09-03 21:03:34 +08:00
|
|
|
plug_in->pid = 0;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-09-03 21:03:34 +08:00
|
|
|
/* Remove the input handler. */
|
|
|
|
if (plug_in->input_id)
|
|
|
|
{
|
|
|
|
g_source_remove (plug_in->input_id);
|
1997-11-25 06:05:25 +08:00
|
|
|
plug_in->input_id = 0;
|
2001-09-03 21:03:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Close the pipes. */
|
|
|
|
if (plug_in->my_read != NULL)
|
|
|
|
{
|
|
|
|
g_io_channel_unref (plug_in->my_read);
|
1999-03-07 20:56:03 +08:00
|
|
|
plug_in->my_read = NULL;
|
2001-09-03 21:03:34 +08:00
|
|
|
}
|
|
|
|
if (plug_in->my_write != NULL)
|
|
|
|
{
|
|
|
|
g_io_channel_unref (plug_in->my_write);
|
1999-03-07 20:56:03 +08:00
|
|
|
plug_in->my_write = NULL;
|
2001-09-03 21:03:34 +08:00
|
|
|
}
|
|
|
|
if (plug_in->his_read != NULL)
|
|
|
|
{
|
|
|
|
g_io_channel_unref (plug_in->his_read);
|
1999-03-07 20:56:03 +08:00
|
|
|
plug_in->his_read = NULL;
|
2001-09-03 21:03:34 +08:00
|
|
|
}
|
|
|
|
if (plug_in->his_write != NULL)
|
|
|
|
{
|
|
|
|
g_io_channel_unref (plug_in->his_write);
|
1999-03-07 20:56:03 +08:00
|
|
|
plug_in->his_write = NULL;
|
2001-09-03 21:03:34 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-09-03 21:03:34 +08:00
|
|
|
wire_clear_error ();
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-09-03 21:03:34 +08:00
|
|
|
if (plug_in->progress)
|
2002-03-21 01:46:13 +08:00
|
|
|
plug_in_progress_end (plug_in);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-09-03 21:03:34 +08:00
|
|
|
if (plug_in->recurse)
|
|
|
|
{
|
2003-01-30 19:20:12 +08:00
|
|
|
while (plug_in->main_loops)
|
|
|
|
{
|
|
|
|
g_warning ("plug_in_close: quitting stale main loop\n");
|
|
|
|
plug_in_main_loop_quit (plug_in);
|
|
|
|
}
|
2001-11-18 00:32:34 +08:00
|
|
|
|
2001-09-03 21:03:34 +08:00
|
|
|
plug_in->recurse = FALSE;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-09-03 21:03:34 +08:00
|
|
|
plug_in->synchronous = FALSE;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-09-03 21:03:34 +08:00
|
|
|
/* Unregister any temporary procedures. */
|
|
|
|
if (plug_in->temp_proc_defs)
|
|
|
|
{
|
2003-01-18 02:07:37 +08:00
|
|
|
GSList *list;
|
|
|
|
|
|
|
|
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
|
|
|
plug_ins_temp_proc_def_remove (plug_in->gimp,
|
|
|
|
(PlugInProcDef *) list->data);
|
|
|
|
|
2001-09-03 21:03:34 +08:00
|
|
|
g_slist_free (plug_in->temp_proc_defs);
|
|
|
|
plug_in->temp_proc_defs = NULL;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-09-03 21:03:34 +08:00
|
|
|
/* Close any dialogs that this plugin might have opened */
|
|
|
|
brush_select_dialogs_check ();
|
|
|
|
gradient_select_dialogs_check ();
|
2002-03-13 05:02:10 +08:00
|
|
|
palette_select_dialogs_check ();
|
|
|
|
pattern_select_dialogs_check ();
|
1998-09-19 08:40:27 +08:00
|
|
|
|
2003-02-11 20:07:31 +08:00
|
|
|
gimp->open_plug_ins = g_slist_remove (gimp->open_plug_ins, plug_in);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
1999-03-07 20:56:03 +08:00
|
|
|
static gboolean
|
2000-07-16 20:49:04 +08:00
|
|
|
plug_in_recv_message (GIOChannel *channel,
|
|
|
|
GIOCondition cond,
|
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-03-21 01:46:13 +08:00
|
|
|
PlugIn *plug_in;
|
|
|
|
gboolean got_message = FALSE;
|
2000-05-11 05:21:23 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
plug_in = (PlugIn *) data;
|
|
|
|
|
2002-05-16 19:45:30 +08:00
|
|
|
if (plug_in->my_read == NULL)
|
1999-03-07 20:56:03 +08:00
|
|
|
return TRUE;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-05-11 05:21:23 +08:00
|
|
|
if (cond & (G_IO_IN | G_IO_PRI))
|
|
|
|
{
|
|
|
|
WireMessage msg;
|
|
|
|
|
|
|
|
memset (&msg, 0, sizeof (WireMessage));
|
|
|
|
|
2002-05-17 01:41:38 +08:00
|
|
|
if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
|
2000-05-11 05:21:23 +08:00
|
|
|
{
|
2002-03-21 01:46:13 +08:00
|
|
|
plug_in_close (plug_in, TRUE);
|
2000-05-11 05:21:23 +08:00
|
|
|
}
|
2002-03-21 01:46:13 +08:00
|
|
|
else
|
2000-05-11 05:21:23 +08:00
|
|
|
{
|
2002-03-21 01:46:13 +08:00
|
|
|
plug_in_handle_message (plug_in, &msg);
|
2000-05-11 05:21:23 +08:00
|
|
|
wire_destroy (&msg);
|
|
|
|
got_message = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cond & (G_IO_ERR | G_IO_HUP))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-03-21 01:46:13 +08:00
|
|
|
if (plug_in->open)
|
2000-05-11 05:21:23 +08:00
|
|
|
{
|
2002-03-21 01:46:13 +08:00
|
|
|
plug_in_close (plug_in, TRUE);
|
2000-05-11 05:21:23 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
if (! got_message)
|
2000-05-17 20:29:38 +08:00
|
|
|
g_message (_("Plug-In crashed: \"%s\"\n(%s)\n\n"
|
|
|
|
"The dying Plug-In may have messed up GIMP's internal state.\n"
|
|
|
|
"You may want to save your images and restart GIMP\n"
|
|
|
|
"to be on the safe side."),
|
2003-02-11 09:21:21 +08:00
|
|
|
plug_in->name,
|
|
|
|
plug_in->prog);
|
2000-05-11 05:21:23 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
if (! plug_in->open)
|
2003-02-03 21:21:31 +08:00
|
|
|
plug_in_unref (plug_in);
|
2000-05-11 05:21:23 +08:00
|
|
|
|
1999-03-07 20:56:03 +08:00
|
|
|
return TRUE;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-02-25 00:11:26 +08:00
|
|
|
static gboolean
|
1999-03-07 20:56:03 +08:00
|
|
|
plug_in_write (GIOChannel *channel,
|
|
|
|
guint8 *buf,
|
2002-05-17 01:41:38 +08:00
|
|
|
gulong count,
|
|
|
|
gpointer user_data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-05-17 01:41:38 +08:00
|
|
|
PlugIn *plug_in;
|
|
|
|
gulong bytes;
|
|
|
|
|
|
|
|
plug_in = (PlugIn *) user_data;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
while (count > 0)
|
|
|
|
{
|
2002-05-17 01:41:38 +08:00
|
|
|
if ((plug_in->write_buffer_index + count) >= WRITE_BUFFER_SIZE)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-05-17 01:41:38 +08:00
|
|
|
bytes = WRITE_BUFFER_SIZE - plug_in->write_buffer_index;
|
|
|
|
memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
|
|
|
|
buf, bytes);
|
|
|
|
plug_in->write_buffer_index += bytes;
|
|
|
|
if (! wire_flush (channel, plug_in))
|
1997-11-25 06:05:25 +08:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
bytes = count;
|
2002-05-17 01:41:38 +08:00
|
|
|
memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
|
|
|
|
buf, bytes);
|
|
|
|
plug_in->write_buffer_index += bytes;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
buf += bytes;
|
|
|
|
count -= bytes;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2000-02-25 00:11:26 +08:00
|
|
|
static gboolean
|
2002-05-17 01:41:38 +08:00
|
|
|
plug_in_flush (GIOChannel *channel,
|
|
|
|
gpointer user_data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-01-30 19:20:12 +08:00
|
|
|
PlugIn *plug_in;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-05-17 01:41:38 +08:00
|
|
|
plug_in = (PlugIn *) user_data;
|
|
|
|
|
|
|
|
if (plug_in->write_buffer_index > 0)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-01-30 19:20:12 +08:00
|
|
|
GIOStatus status;
|
|
|
|
GError *error = NULL;
|
|
|
|
gint count;
|
|
|
|
gsize bytes;
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
count = 0;
|
2002-05-17 01:41:38 +08:00
|
|
|
while (count != plug_in->write_buffer_index)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-08-30 01:48:28 +08:00
|
|
|
do
|
|
|
|
{
|
|
|
|
bytes = 0;
|
|
|
|
status = g_io_channel_write_chars (channel,
|
2002-05-17 01:41:38 +08:00
|
|
|
&plug_in->write_buffer[count],
|
|
|
|
(plug_in->write_buffer_index - count),
|
2001-08-30 01:48:28 +08:00
|
|
|
&bytes,
|
|
|
|
&error);
|
|
|
|
}
|
|
|
|
while (status == G_IO_STATUS_AGAIN);
|
|
|
|
|
|
|
|
if (status != G_IO_STATUS_NORMAL)
|
2001-08-30 09:09:58 +08:00
|
|
|
{
|
|
|
|
if (error)
|
|
|
|
{
|
|
|
|
g_warning ("%s: plug_in_flush(): error: %s",
|
|
|
|
g_get_prgname (), error->message);
|
|
|
|
g_error_free (error);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_warning ("%s: plug_in_flush(): error",
|
|
|
|
g_get_prgname ());
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
count += bytes;
|
|
|
|
}
|
|
|
|
|
2002-05-17 01:41:38 +08:00
|
|
|
plug_in->write_buffer_index = 0;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
void
|
2003-02-11 20:07:31 +08:00
|
|
|
plug_in_push (Gimp *gimp,
|
|
|
|
PlugIn *plug_in)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-02-11 20:07:31 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2002-03-21 01:46:13 +08:00
|
|
|
g_return_if_fail (plug_in != NULL);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-02-11 20:07:31 +08:00
|
|
|
gimp->current_plug_in = plug_in;
|
2002-03-21 01:46:13 +08:00
|
|
|
|
2003-02-11 20:07:31 +08:00
|
|
|
gimp->plug_in_stack = g_slist_prepend (gimp->plug_in_stack,
|
|
|
|
gimp->current_plug_in);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
void
|
2003-02-11 20:07:31 +08:00
|
|
|
plug_in_pop (Gimp *gimp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
GSList *tmp;
|
|
|
|
|
2003-02-11 20:07:31 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
|
|
|
|
if (gimp->current_plug_in)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-02-11 20:07:31 +08:00
|
|
|
tmp = gimp->plug_in_stack;
|
|
|
|
gimp->plug_in_stack = gimp->plug_in_stack->next;
|
1997-11-25 06:05:25 +08:00
|
|
|
tmp->next = NULL;
|
|
|
|
g_slist_free (tmp);
|
|
|
|
}
|
|
|
|
|
2003-02-11 20:07:31 +08:00
|
|
|
if (gimp->plug_in_stack)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-02-11 20:07:31 +08:00
|
|
|
gimp->current_plug_in = gimp->plug_in_stack->data;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-02-11 20:07:31 +08:00
|
|
|
gimp->current_plug_in = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
void
|
|
|
|
plug_in_main_loop (PlugIn *plug_in)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-01-30 19:20:12 +08:00
|
|
|
GMainLoop *main_loop;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
g_return_if_fail (plug_in != NULL);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
main_loop = g_main_loop_new (NULL, FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
plug_in->main_loops = g_list_prepend (plug_in->main_loops, main_loop);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-02-03 21:21:31 +08:00
|
|
|
gimp_threads_leave (plug_in->gimp);
|
2003-01-30 19:20:12 +08:00
|
|
|
g_main_loop_run (main_loop);
|
2003-02-03 21:21:31 +08:00
|
|
|
gimp_threads_enter (plug_in->gimp);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
g_main_loop_unref (main_loop);
|
|
|
|
}
|
2001-08-30 01:48:28 +08:00
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
void
|
|
|
|
plug_in_main_loop_quit (PlugIn *plug_in)
|
|
|
|
{
|
|
|
|
g_return_if_fail (plug_in != NULL);
|
2001-08-30 01:48:28 +08:00
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
if (! plug_in->main_loops)
|
|
|
|
{
|
|
|
|
g_warning ("plug_in_main_loop_quit: called without a main loop running");
|
|
|
|
return;
|
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-30 19:20:12 +08:00
|
|
|
g_main_loop_quit ((GMainLoop *) plug_in->main_loops->data);
|
|
|
|
|
|
|
|
plug_in->main_loops = g_list_remove (plug_in->main_loops,
|
|
|
|
plug_in->main_loops->data);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2003-02-18 22:08:14 +08:00
|
|
|
|
|
|
|
gchar *
|
|
|
|
plug_in_get_undo_desc (PlugIn *plug_in)
|
|
|
|
{
|
|
|
|
PlugInProcDef *proc_def;
|
|
|
|
gchar *undo_desc;
|
|
|
|
|
|
|
|
g_return_val_if_fail (plug_in != NULL, NULL);
|
|
|
|
|
|
|
|
if (plug_in->current_temp_proc)
|
|
|
|
proc_def = plug_ins_proc_def_find (plug_in->gimp,
|
|
|
|
plug_in->current_temp_proc);
|
|
|
|
else if (plug_in->proc_rec)
|
|
|
|
proc_def = plug_ins_proc_def_find (plug_in->gimp,
|
|
|
|
plug_in->proc_rec);
|
|
|
|
else
|
|
|
|
proc_def = NULL;
|
|
|
|
|
|
|
|
if (proc_def && proc_def->menu_path)
|
|
|
|
{
|
|
|
|
const gchar *path;
|
|
|
|
gchar *ellipses;
|
|
|
|
|
|
|
|
path = dgettext (plug_ins_locale_domain (plug_in->gimp,
|
|
|
|
plug_in->prog, NULL),
|
|
|
|
proc_def->menu_path);
|
|
|
|
|
|
|
|
undo_desc = g_path_get_basename (path);
|
|
|
|
|
|
|
|
ellipses = strstr (undo_desc, "...");
|
|
|
|
|
|
|
|
if (ellipses && ellipses == (undo_desc + strlen (undo_desc) - 3))
|
|
|
|
*ellipses = '\0';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
undo_desc = g_filename_to_utf8 (plug_in->name, -1, NULL, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
return undo_desc;
|
|
|
|
}
|