2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
1997-11-25 06:05:25 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2006-05-03 02:27:31 +08:00
|
|
|
* gimppluginmanager-call.c
|
2004-09-22 23:12:24 +08:00
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
1997-11-25 06:05:25 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
1997-11-25 06:05:25 +08:00
|
|
|
* (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
|
2009-01-18 06:28:01 +08:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
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
|
|
|
|
2012-03-30 01:19:01 +08:00
|
|
|
#include <gegl.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
|
|
|
|
2006-06-01 23:34:58 +08:00
|
|
|
#include "composite/gimp-composite.h"
|
|
|
|
|
2001-07-11 20:39:49 +08:00
|
|
|
#include "core/gimp.h"
|
2004-08-11 02:47:21 +08:00
|
|
|
#include "core/gimpprogress.h"
|
2001-04-18 05:43:29 +08:00
|
|
|
|
2010-09-05 04:17:01 +08:00
|
|
|
#include "pdb/gimppdbcontext.h"
|
|
|
|
|
2006-05-04 02:05:06 +08:00
|
|
|
#include "gimpplugin.h"
|
|
|
|
#include "gimpplugin-message.h"
|
2007-02-19 09:16:05 +08:00
|
|
|
#include "gimpplugindef.h"
|
2008-08-16 21:57:57 +08:00
|
|
|
#include "gimppluginerror.h"
|
2006-04-29 06:26:51 +08:00
|
|
|
#include "gimppluginmanager.h"
|
2006-05-03 02:27:31 +08:00
|
|
|
#define __YES_I_NEED_GIMP_PLUG_IN_MANAGER_CALL__
|
|
|
|
#include "gimppluginmanager-call.h"
|
2006-05-05 05:49:04 +08:00
|
|
|
#include "gimppluginshm.h"
|
2006-08-06 05:21:01 +08:00
|
|
|
#include "gimptemporaryprocedure.h"
|
2002-03-21 01:46:13 +08:00
|
|
|
#include "plug-in-params.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
|
|
|
/* public functions */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-05-03 02:27:31 +08:00
|
|
|
void
|
|
|
|
gimp_plug_in_manager_call_query (GimpPlugInManager *manager,
|
|
|
|
GimpContext *context,
|
2007-02-19 09:16:05 +08:00
|
|
|
GimpPlugInDef *plug_in_def)
|
2006-05-03 02:27:31 +08:00
|
|
|
{
|
2006-05-04 02:05:06 +08:00
|
|
|
GimpPlugIn *plug_in;
|
2006-05-03 02:27:31 +08:00
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
|
2010-09-05 04:17:01 +08:00
|
|
|
g_return_if_fail (GIMP_IS_PDB_CONTEXT (context));
|
2007-02-19 09:16:05 +08:00
|
|
|
g_return_if_fail (GIMP_IS_PLUG_IN_DEF (plug_in_def));
|
2006-05-03 02:27:31 +08:00
|
|
|
|
2006-05-04 02:05:06 +08:00
|
|
|
plug_in = gimp_plug_in_new (manager, context, NULL,
|
|
|
|
NULL, plug_in_def->prog);
|
2006-05-03 02:27:31 +08:00
|
|
|
|
|
|
|
if (plug_in)
|
|
|
|
{
|
|
|
|
plug_in->plug_in_def = plug_in_def;
|
|
|
|
|
2006-05-04 02:05:06 +08:00
|
|
|
if (gimp_plug_in_open (plug_in, GIMP_PLUG_IN_CALL_QUERY, TRUE))
|
2006-05-03 02:27:31 +08:00
|
|
|
{
|
|
|
|
while (plug_in->open)
|
|
|
|
{
|
|
|
|
GimpWireMessage msg;
|
|
|
|
|
|
|
|
if (! gimp_wire_read_msg (plug_in->my_read, &msg, plug_in))
|
|
|
|
{
|
2006-05-04 02:05:06 +08:00
|
|
|
gimp_plug_in_close (plug_in, TRUE);
|
2006-05-03 02:27:31 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-05-04 02:05:06 +08:00
|
|
|
gimp_plug_in_handle_message (plug_in, &msg);
|
2006-05-03 02:27:31 +08:00
|
|
|
gimp_wire_destroy (&msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-04 02:05:06 +08:00
|
|
|
g_object_unref (plug_in);
|
2006-05-03 02:27:31 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_plug_in_manager_call_init (GimpPlugInManager *manager,
|
|
|
|
GimpContext *context,
|
2007-02-19 09:16:05 +08:00
|
|
|
GimpPlugInDef *plug_in_def)
|
2006-05-03 02:27:31 +08:00
|
|
|
{
|
2006-05-04 02:05:06 +08:00
|
|
|
GimpPlugIn *plug_in;
|
2006-05-03 02:27:31 +08:00
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
|
2010-09-05 04:17:01 +08:00
|
|
|
g_return_if_fail (GIMP_IS_PDB_CONTEXT (context));
|
2007-02-19 09:16:05 +08:00
|
|
|
g_return_if_fail (GIMP_IS_PLUG_IN_DEF (plug_in_def));
|
2006-05-03 02:27:31 +08:00
|
|
|
|
2006-05-04 02:05:06 +08:00
|
|
|
plug_in = gimp_plug_in_new (manager, context, NULL,
|
|
|
|
NULL, plug_in_def->prog);
|
2006-05-03 02:27:31 +08:00
|
|
|
|
|
|
|
if (plug_in)
|
|
|
|
{
|
|
|
|
plug_in->plug_in_def = plug_in_def;
|
|
|
|
|
2006-05-04 02:05:06 +08:00
|
|
|
if (gimp_plug_in_open (plug_in, GIMP_PLUG_IN_CALL_INIT, TRUE))
|
2006-05-03 02:27:31 +08:00
|
|
|
{
|
|
|
|
while (plug_in->open)
|
|
|
|
{
|
|
|
|
GimpWireMessage msg;
|
|
|
|
|
|
|
|
if (! gimp_wire_read_msg (plug_in->my_read, &msg, plug_in))
|
|
|
|
{
|
2006-05-04 02:05:06 +08:00
|
|
|
gimp_plug_in_close (plug_in, TRUE);
|
2006-05-03 02:27:31 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-05-04 02:05:06 +08:00
|
|
|
gimp_plug_in_handle_message (plug_in, &msg);
|
2006-05-03 02:27:31 +08:00
|
|
|
gimp_wire_destroy (&msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-04 02:05:06 +08:00
|
|
|
g_object_unref (plug_in);
|
2006-05-03 02:27:31 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-04-04 18:30:58 +08:00
|
|
|
GValueArray *
|
2006-05-03 02:27:31 +08:00
|
|
|
gimp_plug_in_manager_call_run (GimpPlugInManager *manager,
|
|
|
|
GimpContext *context,
|
|
|
|
GimpProgress *progress,
|
|
|
|
GimpPlugInProcedure *procedure,
|
|
|
|
GValueArray *args,
|
|
|
|
gboolean synchronous,
|
2006-05-05 16:29:33 +08:00
|
|
|
GimpObject *display)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2006-04-04 18:30:58 +08:00
|
|
|
GValueArray *return_vals = NULL;
|
2006-05-04 02:05:06 +08:00
|
|
|
GimpPlugIn *plug_in;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-04-29 06:26:51 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), NULL);
|
2010-09-05 04:17:01 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_PDB_CONTEXT (context), NULL);
|
2004-08-11 02:47:21 +08:00
|
|
|
g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL);
|
2006-04-08 02:23:20 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_PLUG_IN_PROCEDURE (procedure), NULL);
|
2006-04-04 18:30:58 +08:00
|
|
|
g_return_val_if_fail (args != NULL, NULL);
|
2006-05-05 16:29:33 +08:00
|
|
|
g_return_val_if_fail (display == NULL || GIMP_IS_OBJECT (display), NULL);
|
2003-02-11 20:07:31 +08:00
|
|
|
|
2008-06-10 17:16:48 +08:00
|
|
|
plug_in = gimp_plug_in_new (manager, context, progress, procedure, NULL);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
if (plug_in)
|
|
|
|
{
|
2006-04-29 06:26:51 +08:00
|
|
|
GimpCoreConfig *core_config = manager->gimp->config;
|
|
|
|
GimpDisplayConfig *display_config = GIMP_DISPLAY_CONFIG (core_config);
|
|
|
|
GimpGuiConfig *gui_config = GIMP_GUI_CONFIG (core_config);
|
2004-10-05 00:21:52 +08:00
|
|
|
GPConfig config;
|
|
|
|
GPProcRun proc_run;
|
2006-05-05 16:29:33 +08:00
|
|
|
gint display_ID;
|
2004-10-05 00:21:52 +08:00
|
|
|
gint monitor;
|
2003-02-03 21:21:31 +08:00
|
|
|
|
2006-05-04 02:05:06 +08:00
|
|
|
if (! gimp_plug_in_open (plug_in, GIMP_PLUG_IN_CALL_RUN, FALSE))
|
2006-04-12 20:49:29 +08:00
|
|
|
{
|
2009-09-01 04:47:18 +08:00
|
|
|
const gchar *name = gimp_object_get_name (plug_in);
|
2008-08-16 21:57:57 +08:00
|
|
|
GError *error = g_error_new (GIMP_PLUG_IN_ERROR,
|
|
|
|
GIMP_PLUG_IN_EXECUTION_FAILED,
|
|
|
|
_("Failed to run plug-in \"%s\""),
|
|
|
|
name);
|
|
|
|
|
2006-05-04 02:05:06 +08:00
|
|
|
g_object_unref (plug_in);
|
2008-08-16 21:57:57 +08:00
|
|
|
|
|
|
|
return_vals = gimp_procedure_get_return_values (GIMP_PROCEDURE (procedure),
|
|
|
|
FALSE, error);
|
|
|
|
g_error_free (error);
|
|
|
|
|
|
|
|
return return_vals;
|
2003-02-03 21:21:31 +08:00
|
|
|
}
|
|
|
|
|
2006-05-05 16:29:33 +08:00
|
|
|
display_ID = display ? gimp_get_display_ID (manager->gimp, display) : -1;
|
|
|
|
|
2004-10-05 00:21:52 +08:00
|
|
|
config.version = GIMP_PROTOCOL_VERSION;
|
2012-03-28 01:57:58 +08:00
|
|
|
config.tile_width = GIMP_PLUG_IN_TILE_WIDTH;
|
|
|
|
config.tile_height = GIMP_PLUG_IN_TILE_HEIGHT;
|
2006-05-05 05:49:04 +08:00
|
|
|
config.shm_ID = (manager->shm ?
|
|
|
|
gimp_plug_in_shm_get_ID (manager->shm) : -1);
|
2004-10-05 00:21:52 +08:00
|
|
|
config.check_size = display_config->transparency_size;
|
|
|
|
config.check_type = display_config->transparency_type;
|
|
|
|
config.show_help_button = (gui_config->use_help &&
|
|
|
|
gui_config->show_help_button);
|
2006-06-01 23:34:58 +08:00
|
|
|
config.use_cpu_accel = gimp_composite_use_cpu_accel ();
|
2004-10-05 00:21:52 +08:00
|
|
|
config.gimp_reserved_5 = 0;
|
|
|
|
config.gimp_reserved_6 = 0;
|
|
|
|
config.gimp_reserved_7 = 0;
|
|
|
|
config.gimp_reserved_8 = 0;
|
2010-10-19 16:13:01 +08:00
|
|
|
config.install_cmap = FALSE;
|
2006-03-11 00:40:09 +08:00
|
|
|
config.show_tooltips = gui_config->show_tooltips;
|
2010-10-19 16:13:01 +08:00
|
|
|
config.min_colors = 144;
|
2006-03-29 01:55:52 +08:00
|
|
|
config.gdisp_ID = display_ID;
|
2004-10-05 00:21:52 +08:00
|
|
|
config.app_name = (gchar *) g_get_application_name ();
|
2006-04-29 06:26:51 +08:00
|
|
|
config.wm_class = (gchar *) gimp_get_program_class (manager->gimp);
|
|
|
|
config.display_name = gimp_get_display_name (manager->gimp,
|
2006-03-29 01:55:52 +08:00
|
|
|
display_ID, &monitor);
|
2004-10-05 00:21:52 +08:00
|
|
|
config.monitor_number = monitor;
|
2008-03-28 00:30:29 +08:00
|
|
|
config.timestamp = gimp_get_user_time (manager->gimp);
|
2003-02-03 21:21:31 +08:00
|
|
|
|
2006-04-08 02:23:20 +08:00
|
|
|
proc_run.name = GIMP_PROCEDURE (procedure)->original_name;
|
2006-04-04 18:30:58 +08:00
|
|
|
proc_run.nparams = args->n_values;
|
|
|
|
proc_run.params = plug_in_args_to_params (args, FALSE);
|
2003-02-03 21:21:31 +08:00
|
|
|
|
|
|
|
if (! gp_config_write (plug_in->my_write, &config, plug_in) ||
|
|
|
|
! gp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
|
2005-12-13 22:11:56 +08:00
|
|
|
! gimp_wire_flush (plug_in->my_write, plug_in))
|
2003-02-03 21:21:31 +08:00
|
|
|
{
|
2009-09-01 04:47:18 +08:00
|
|
|
const gchar *name = gimp_object_get_name (plug_in);
|
2008-08-16 21:57:57 +08:00
|
|
|
GError *error = g_error_new (GIMP_PLUG_IN_ERROR,
|
|
|
|
GIMP_PLUG_IN_EXECUTION_FAILED,
|
|
|
|
_("Failed to run plug-in \"%s\""),
|
|
|
|
name);
|
|
|
|
|
2003-11-09 00:47:49 +08:00
|
|
|
g_free (config.display_name);
|
2006-04-10 01:19:58 +08:00
|
|
|
g_free (proc_run.params);
|
2006-04-05 21:23:21 +08:00
|
|
|
|
2006-05-04 02:05:06 +08:00
|
|
|
g_object_unref (plug_in);
|
2008-08-16 21:57:57 +08:00
|
|
|
|
|
|
|
return_vals = gimp_procedure_get_return_values (GIMP_PROCEDURE (procedure),
|
|
|
|
FALSE, error);
|
|
|
|
g_error_free (error);
|
|
|
|
|
|
|
|
return return_vals;
|
2003-02-03 21:21:31 +08:00
|
|
|
}
|
|
|
|
|
2003-11-08 01:29:02 +08:00
|
|
|
g_free (config.display_name);
|
2006-04-10 01:19:58 +08:00
|
|
|
g_free (proc_run.params);
|
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 is an extension,
|
|
|
|
* wait for an installation-confirmation message
|
2003-02-03 21:21:31 +08:00
|
|
|
*/
|
2006-04-08 02:23:20 +08:00
|
|
|
if (GIMP_PROCEDURE (procedure)->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
|
|
|
|
2006-04-29 06:26:51 +08:00
|
|
|
gimp_threads_leave (manager->gimp);
|
2003-06-24 02:27:03 +08:00
|
|
|
g_main_loop_run (plug_in->ext_main_loop);
|
2006-04-29 06:26:51 +08:00
|
|
|
gimp_threads_enter (manager->gimp);
|
2003-02-03 21:21:31 +08:00
|
|
|
|
2006-05-04 02:05:06 +08:00
|
|
|
/* main_loop is quit in gimp_plug_in_handle_extension_ack() */
|
2006-04-05 21:23:21 +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
|
|
|
{
|
2006-05-04 02:05:06 +08:00
|
|
|
GimpPlugInProcFrame *proc_frame = &plug_in->main_proc_frame;
|
2006-04-05 21:23:21 +08:00
|
|
|
|
|
|
|
proc_frame->main_loop = g_main_loop_new (NULL, FALSE);
|
2003-06-24 02:27:03 +08:00
|
|
|
|
2006-04-29 06:26:51 +08:00
|
|
|
gimp_threads_leave (manager->gimp);
|
2006-04-05 21:23:21 +08:00
|
|
|
g_main_loop_run (proc_frame->main_loop);
|
2006-04-29 06:26:51 +08:00
|
|
|
gimp_threads_enter (manager->gimp);
|
2003-06-24 02:27:03 +08:00
|
|
|
|
2006-05-04 02:05:06 +08:00
|
|
|
/* main_loop is quit in gimp_plug_in_handle_proc_return() */
|
2003-02-03 21:21:31 +08:00
|
|
|
|
2006-04-05 21:23:21 +08:00
|
|
|
g_main_loop_unref (proc_frame->main_loop);
|
|
|
|
proc_frame->main_loop = NULL;
|
|
|
|
|
2008-08-17 20:08:52 +08:00
|
|
|
return_vals = gimp_plug_in_proc_frame_get_return_values (proc_frame);
|
2003-02-03 21:21:31 +08:00
|
|
|
}
|
|
|
|
|
2006-05-04 02:05:06 +08:00
|
|
|
g_object_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
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
return return_vals;
|
|
|
|
}
|
|
|
|
|
2006-04-08 02:23:20 +08:00
|
|
|
GValueArray *
|
2006-05-03 02:27:31 +08:00
|
|
|
gimp_plug_in_manager_call_run_temp (GimpPlugInManager *manager,
|
|
|
|
GimpContext *context,
|
|
|
|
GimpProgress *progress,
|
|
|
|
GimpTemporaryProcedure *procedure,
|
|
|
|
GValueArray *args)
|
2003-01-30 19:20:12 +08:00
|
|
|
{
|
2008-08-22 00:27:06 +08:00
|
|
|
GValueArray *return_vals = NULL;
|
|
|
|
GimpPlugIn *plug_in;
|
2000-05-11 05:21:23 +08:00
|
|
|
|
2006-04-29 06:26:51 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), NULL);
|
2010-09-05 04:17:01 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_PDB_CONTEXT (context), NULL);
|
2006-04-08 02:23:20 +08:00
|
|
|
g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_TEMPORARY_PROCEDURE (procedure), NULL);
|
|
|
|
g_return_val_if_fail (args != NULL, NULL);
|
|
|
|
|
|
|
|
plug_in = procedure->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
|
|
|
{
|
2006-05-04 02:05:06 +08:00
|
|
|
GimpPlugInProcFrame *proc_frame;
|
|
|
|
GPProcRun proc_run;
|
2003-02-03 21:21:31 +08:00
|
|
|
|
2006-05-04 02:05:06 +08:00
|
|
|
proc_frame = gimp_plug_in_proc_frame_push (plug_in, context, progress,
|
2006-05-04 16:23:20 +08:00
|
|
|
procedure);
|
2000-05-11 05:21:23 +08:00
|
|
|
|
2006-04-08 02:23:20 +08:00
|
|
|
proc_run.name = GIMP_PROCEDURE (procedure)->original_name;
|
2006-04-04 18:30:58 +08:00
|
|
|
proc_run.nparams = args->n_values;
|
|
|
|
proc_run.params = plug_in_args_to_params (args, 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) ||
|
2006-04-12 20:49:29 +08:00
|
|
|
! gimp_wire_flush (plug_in->my_write, plug_in))
|
|
|
|
{
|
2009-09-01 04:47:18 +08:00
|
|
|
const gchar *name = gimp_object_get_name (plug_in);
|
2008-08-16 21:57:57 +08:00
|
|
|
GError *error = g_error_new (GIMP_PLUG_IN_ERROR,
|
|
|
|
GIMP_PLUG_IN_EXECUTION_FAILED,
|
|
|
|
_("Failed to run plug-in \"%s\""),
|
|
|
|
name);
|
|
|
|
|
2006-04-10 01:19:58 +08:00
|
|
|
g_free (proc_run.params);
|
2006-05-04 02:05:06 +08:00
|
|
|
gimp_plug_in_proc_frame_pop (plug_in);
|
2004-01-20 08:54:43 +08:00
|
|
|
|
2008-08-16 21:57:57 +08:00
|
|
|
return_vals = gimp_procedure_get_return_values (GIMP_PROCEDURE (procedure),
|
|
|
|
FALSE, error);
|
|
|
|
g_error_free (error);
|
2006-04-05 21:23:21 +08:00
|
|
|
|
2008-08-16 21:57:57 +08:00
|
|
|
return return_vals;
|
2006-04-12 20:49:29 +08:00
|
|
|
}
|
2000-07-16 20:49:04 +08:00
|
|
|
|
2006-04-10 01:19:58 +08:00
|
|
|
g_free (proc_run.params);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-05-04 02:05:06 +08:00
|
|
|
g_object_ref (plug_in);
|
|
|
|
gimp_plug_in_proc_frame_ref (proc_frame);
|
2003-02-03 21:21:31 +08:00
|
|
|
|
2006-05-04 02:05:06 +08:00
|
|
|
gimp_plug_in_main_loop (plug_in);
|
2003-02-03 21:21:31 +08:00
|
|
|
|
2004-12-15 06:42:00 +08:00
|
|
|
/* main_loop is quit and proc_frame is popped in
|
2006-05-04 02:05:06 +08:00
|
|
|
* gimp_plug_in_handle_temp_proc_return()
|
2004-12-15 06:42:00 +08:00
|
|
|
*/
|
2003-02-03 21:21:31 +08:00
|
|
|
|
2008-08-17 20:08:52 +08:00
|
|
|
return_vals = gimp_plug_in_proc_frame_get_return_values (proc_frame);
|
2006-04-05 21:23:21 +08:00
|
|
|
|
2006-05-04 02:05:06 +08:00
|
|
|
gimp_plug_in_proc_frame_unref (proc_frame, plug_in);
|
|
|
|
g_object_unref (plug_in);
|
2008-08-16 21:57:57 +08:00
|
|
|
}
|
2008-08-22 00:27:06 +08:00
|
|
|
|
|
|
|
return return_vals;
|
2002-02-12 15:59:16 +08:00
|
|
|
}
|