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
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
2006-02-21 00:38:09 +08:00
|
|
|
#include <string.h>
|
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
#include <gtk/gtk.h>
|
2000-07-16 20:49:04 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
1999-10-04 00:54:17 +08:00
|
|
|
|
2004-04-20 21:25:55 +08:00
|
|
|
#include "actions-types.h"
|
2000-07-16 20:49:04 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
#include "core/gimp.h"
|
2006-04-08 02:23:20 +08:00
|
|
|
#include "core/gimp-utils.h"
|
2006-05-18 01:34:17 +08:00
|
|
|
#include "core/gimpcontainer.h"
|
|
|
|
#include "core/gimpcontext.h"
|
2004-03-16 09:12:21 +08:00
|
|
|
#include "core/gimpdrawable.h"
|
2002-03-21 01:46:13 +08:00
|
|
|
#include "core/gimpimage.h"
|
|
|
|
#include "core/gimpitem.h"
|
2006-03-30 07:56:07 +08:00
|
|
|
#include "core/gimpparamspecs.h"
|
2004-08-11 02:47:21 +08:00
|
|
|
#include "core/gimpprogress.h"
|
1999-10-04 00:54:17 +08:00
|
|
|
|
2006-04-29 06:26:51 +08:00
|
|
|
#include "plug-in/gimppluginmanager.h"
|
|
|
|
#include "plug-in/gimppluginmanager-data.h"
|
2006-08-09 00:14:13 +08:00
|
|
|
#include "plug-in/gimppluginmanager-history.h"
|
2000-05-08 06:04:51 +08:00
|
|
|
|
2006-03-31 19:49:22 +08:00
|
|
|
#include "pdb/gimpprocedure.h"
|
2006-03-31 17:15:08 +08:00
|
|
|
|
2006-05-18 01:34:17 +08:00
|
|
|
#include "widgets/gimpbufferview.h"
|
|
|
|
#include "widgets/gimpcontainerview.h"
|
|
|
|
#include "widgets/gimpdatafactoryview.h"
|
|
|
|
#include "widgets/gimpfontview.h"
|
2004-07-27 05:07:15 +08:00
|
|
|
#include "widgets/gimphelp-ids.h"
|
2006-06-17 01:02:14 +08:00
|
|
|
#include "widgets/gimpimageeditor.h"
|
|
|
|
#include "widgets/gimpitemtreeview.h"
|
2004-10-13 23:48:44 +08:00
|
|
|
#include "widgets/gimpmessagebox.h"
|
|
|
|
#include "widgets/gimpmessagedialog.h"
|
2004-07-27 05:07:15 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
#include "display/gimpdisplay.h"
|
2000-05-08 06:04:51 +08:00
|
|
|
|
2004-05-03 22:03:51 +08:00
|
|
|
#include "actions.h"
|
2002-03-21 01:46:13 +08:00
|
|
|
#include "plug-in-commands.h"
|
2000-05-08 06:04:51 +08:00
|
|
|
|
2004-07-27 05:07:15 +08:00
|
|
|
#include "gimp-intl.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* local function prototypes */
|
|
|
|
|
2006-09-06 17:11:55 +08:00
|
|
|
static void plug_in_procedure_execute (GimpPlugInProcedure *procedure,
|
|
|
|
Gimp *gimp,
|
|
|
|
GimpDisplay *display,
|
|
|
|
GValueArray *args,
|
|
|
|
gint n_args);
|
|
|
|
|
2006-11-18 00:56:37 +08:00
|
|
|
static gint plug_in_collect_data_args (GtkAction *action,
|
|
|
|
GimpObject *object,
|
|
|
|
GParamSpec **pspecs,
|
|
|
|
GValueArray *args,
|
|
|
|
gint n_args);
|
|
|
|
static gint plug_in_collect_image_args (GtkAction *action,
|
|
|
|
GimpImage *image,
|
|
|
|
GParamSpec **pspecs,
|
|
|
|
GValueArray *args,
|
|
|
|
gint n_args);
|
|
|
|
static gint plug_in_collect_item_args (GtkAction *action,
|
|
|
|
GimpImage *image,
|
|
|
|
GimpItem *item,
|
|
|
|
GParamSpec **pspecs,
|
|
|
|
GValueArray *args,
|
|
|
|
gint n_args);
|
|
|
|
static gint plug_in_collect_drawable_args (GtkAction *action,
|
|
|
|
GimpImage *image,
|
|
|
|
GParamSpec **pspecs,
|
|
|
|
GValueArray *args,
|
|
|
|
gint n_args);
|
|
|
|
static void plug_in_reset_all_response (GtkWidget *dialog,
|
|
|
|
gint response_id,
|
|
|
|
Gimp *gimp);
|
2004-07-27 05:07:15 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* public functions */
|
2000-02-24 04:25:24 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
void
|
2006-04-05 16:38:33 +08:00
|
|
|
plug_in_run_cmd_callback (GtkAction *action,
|
|
|
|
GimpPlugInProcedure *proc,
|
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2006-04-05 16:38:33 +08:00
|
|
|
GimpProcedure *procedure = GIMP_PROCEDURE (proc);
|
2004-04-29 20:52:29 +08:00
|
|
|
Gimp *gimp;
|
2006-04-04 18:30:58 +08:00
|
|
|
GValueArray *args;
|
2006-04-05 16:38:33 +08:00
|
|
|
gint n_args = 0;
|
|
|
|
GimpDisplay *display = NULL;
|
2006-04-04 04:54:55 +08:00
|
|
|
return_if_no_gimp (gimp, data);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-03-31 17:15:08 +08:00
|
|
|
args = gimp_procedure_get_arguments (procedure);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
Changed the semantics of GIMP_EXTENSION and (to some extent) of
2003-06-19 Michael Natterer <mitch@gimp.org>
Changed the semantics of GIMP_EXTENSION and (to some extent)
of GIMP_PLUGIN:
The old meaning of EXTENSION was "I live in the toolbox" and
PLUGIN meant "I take RUN-MODE,IMAGE,DRAWABLE args (but only if I
am invoked interactively)". This is completely useless, since
living in the toolbox means having "<Toolbox>" in the menu_path
and taking RUN-MODE,IMAGE,DRAWABLE means just that, regardless of
what type of procedure we are.
The new meaning of GIMP_PLUGIN is just "I am an ordinary procedure,
I am invoked, do my job and finish", while GIMP_EXTENSION means
"I will install temporary procedures and I will keep running to
keep them available".
(A GIMP_EXTENSION *must* call gimp_extension_ack() now to tell the
core that it's ready to run, or the core will block waiting for
the message !!!).
* configure.in: bumped version number to 1.3.16.
* libgimpbase/gimpprotocol.h: increased protocol version number so
old extensions will refuse to load.
* app/gui/plug-in-commands.c (plug_in_run_cmd_callback): don't
blindly pass RUN-MODE,IMAGE,DRAWABLE to GIMP_PLUGIN procedures but
look at their parameters and pass them either RUN-MODE, or
RUN-MODE,IMAGE, or RUN-MODE,IMAGE,DRAWABLE.
* app/pdb/procedural_db.c: cleaned up, better error reporting,
replaced an impossible error message by g_return_if_fail()
* app/plug-in/plug-in-message.c (plug_in_handle_proc_install):
better error messages.
* app/plug-in/plug-in-params.c: allocate parameter arrays using
g_new0() so we don't have to worry about uninitialized stuff
later.
* app/plug-in/plug-in-run.c (plug_in_run): wait for
gimp_extension_ack() installation confirmation for ALL extensions,
not just for automatically started ones.
* app/plug-in/plug-ins.c: cleanup.
* libgimp/gimp.[ch]: cleaned up and API-documented massively. Made
all magic values given in the GPConfig message static and added
accessor functions for them. Added gimp_tile_width()/height().
Added new function gimp_extension_enable() which turns on
asynchronous processing of temp_proc run requests without having
to enter an endless gimp_extension_process() loop. Moved all
private functions to the end of the file. Added tons of
g_return_if_fail() all over the place. Call gimp_run_procedure2()
from gimp_run_procedure() instead of duplicating the
code. Indentation, spacing, stuff...
* libgimp/gimptile.[ch]: removed gimp_tile_width()/height().
* libgimp/gimpdrawable.c
* libgimp/gimppixelrgn.c
* libgimp/gimptile.c: use the gimp_tile_width()/height() accessor
functions.
* libgimp/gimp.def: added gimp_extension_enable.
* libgimp/gimpmenu.c: removed evil code which connected to
_readchannel manually and use gimp_extension_enable() for watching
temp_procs.
* plug-ins/helpbrowser/helpbrowser.c: removed the same evil code
here and call gimp_extension_enable(). Call gimp_extension_ack()
to let the core know that the temp_proc is installed.
* plug-ins/script-fu/script-fu.c: made all procedures except the
permanently running "extension_script_fu" ordinary GIMP_PLUGIN
procedures.
* plug-ins/common/curve_bend.c
* plug-ins/common/plugindetails.c
* plug-ins/common/screenshot.c
* plug-ins/common/uniteditor.c
* plug-ins/common/winclipboard.c
* plug-ins/dbbrowser/dbbrowser.c
* plug-ins/gfli/gfli.c
* plug-ins/twain/twain.c
* plug-ins/webbrowser/webbrowser.c
* plug-ins/winsnap/winsnap.c: made them all ordinary GIMP_PLUGIN
procedures and renamed them from "extension_*" to "plug_in_*".
Random cleanups.
* app/widgets/gimphelp.c
* plug-ins/maze/maze_face.c: call "plug_in_web_browser" now.
2003-06-20 01:12:00 +08:00
|
|
|
/* initialize the first argument */
|
2006-04-04 18:30:58 +08:00
|
|
|
g_value_set_int (&args->values[n_args], GIMP_RUN_INTERACTIVE);
|
2005-01-08 03:36:43 +08:00
|
|
|
n_args++;
|
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
|
|
|
|
2006-03-31 17:15:08 +08:00
|
|
|
switch (procedure->proc_type)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_EXTENSION:
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PLUGIN:
|
|
|
|
case GIMP_TEMPORARY:
|
2006-05-18 01:34:17 +08:00
|
|
|
if (GIMP_IS_DATA_FACTORY_VIEW (data) ||
|
|
|
|
GIMP_IS_FONT_VIEW (data) ||
|
|
|
|
GIMP_IS_BUFFER_VIEW (data))
|
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
|
|
|
{
|
2006-05-18 01:34:17 +08:00
|
|
|
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (data);
|
|
|
|
GimpContainer *container;
|
|
|
|
GimpContext *context;
|
|
|
|
GimpObject *object;
|
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
|
|
|
|
2006-05-18 01:34:17 +08:00
|
|
|
container = gimp_container_view_get_container (editor->view);
|
|
|
|
context = gimp_container_view_get_context (editor->view);
|
2003-06-20 22:05:17 +08:00
|
|
|
|
2006-05-18 01:34:17 +08:00
|
|
|
object = gimp_context_get_by_type (context,
|
|
|
|
container->children_type);
|
|
|
|
|
|
|
|
n_args = plug_in_collect_data_args (action, object,
|
2006-11-18 00:56:37 +08:00
|
|
|
procedure->args,
|
2006-05-18 01:34:17 +08:00
|
|
|
args, n_args);
|
|
|
|
}
|
2006-06-17 01:02:14 +08:00
|
|
|
else if (GIMP_IS_IMAGE_EDITOR (data))
|
|
|
|
{
|
|
|
|
GimpImageEditor *editor = GIMP_IMAGE_EDITOR (data);
|
|
|
|
GimpImage *image;
|
|
|
|
|
|
|
|
image = gimp_image_editor_get_image (editor);
|
|
|
|
|
|
|
|
n_args = plug_in_collect_image_args (action, image,
|
2006-11-18 00:56:37 +08:00
|
|
|
procedure->args,
|
2006-06-17 01:02:14 +08:00
|
|
|
args, n_args);
|
|
|
|
}
|
|
|
|
else if (GIMP_IS_ITEM_TREE_VIEW (data))
|
|
|
|
{
|
|
|
|
GimpItemTreeView *view = GIMP_ITEM_TREE_VIEW (data);
|
|
|
|
GimpImage *image;
|
|
|
|
GimpItem *item;
|
|
|
|
|
|
|
|
image = gimp_item_tree_view_get_image (view);
|
|
|
|
|
|
|
|
if (image)
|
|
|
|
item = GIMP_ITEM_TREE_VIEW_GET_CLASS (view)->get_active_item (image);
|
|
|
|
else
|
|
|
|
item = NULL;
|
|
|
|
|
|
|
|
n_args = plug_in_collect_item_args (action, image, item,
|
2006-11-18 00:56:37 +08:00
|
|
|
procedure->args,
|
2006-06-17 01:02:14 +08:00
|
|
|
args, n_args);
|
|
|
|
}
|
2006-05-18 01:34:17 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
display = action_data_get_display (data);
|
|
|
|
|
2006-08-08 23:36:16 +08:00
|
|
|
n_args = plug_in_collect_drawable_args (action,
|
|
|
|
display ?
|
|
|
|
display->image : NULL,
|
2006-11-18 00:56:37 +08:00
|
|
|
procedure->args,
|
2006-06-17 01:02:14 +08:00
|
|
|
args, n_args);
|
2006-04-12 20:49:29 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
|
2006-09-06 17:11:55 +08:00
|
|
|
case GIMP_INTERNAL:
|
|
|
|
g_warning ("Unhandled procedure type.");
|
2006-05-18 01:34:17 +08:00
|
|
|
n_args = -1;
|
2006-09-06 17:11:55 +08:00
|
|
|
break;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2006-05-18 01:34:17 +08:00
|
|
|
if (n_args >= 1)
|
2006-09-06 17:11:55 +08:00
|
|
|
plug_in_procedure_execute (proc, gimp, display, args, n_args);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-04-04 18:30:58 +08:00
|
|
|
g_value_array_free (args);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
1999-05-04 03:22:58 +08:00
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
plug_in_repeat_cmd_callback (GtkAction *action,
|
|
|
|
gint value,
|
|
|
|
gpointer data)
|
2001-05-17 02:09:45 +08:00
|
|
|
{
|
2006-09-06 17:11:55 +08:00
|
|
|
GimpPlugInProcedure *procedure;
|
|
|
|
Gimp *gimp;
|
|
|
|
GimpDisplay *display;
|
2006-10-30 06:19:33 +08:00
|
|
|
GimpRunMode run_mode;
|
2006-04-06 16:19:01 +08:00
|
|
|
return_if_no_gimp (gimp, data);
|
2006-04-04 04:54:55 +08:00
|
|
|
return_if_no_display (display, data);
|
2001-10-24 23:56:33 +08:00
|
|
|
|
2006-10-30 06:19:33 +08:00
|
|
|
run_mode = (GimpRunMode) value;
|
2001-05-17 02:09:45 +08:00
|
|
|
|
2006-10-30 06:19:33 +08:00
|
|
|
procedure = gimp_plug_in_manager_history_nth (gimp->plug_in_manager, 0);
|
2006-04-06 16:19:01 +08:00
|
|
|
|
|
|
|
if (procedure)
|
|
|
|
{
|
2006-09-06 17:11:55 +08:00
|
|
|
GValueArray *args;
|
2006-08-08 23:36:16 +08:00
|
|
|
gint n_args;
|
2006-04-06 16:19:01 +08:00
|
|
|
|
2006-09-06 17:11:55 +08:00
|
|
|
args = gimp_procedure_get_arguments (GIMP_PROCEDURE (procedure));
|
|
|
|
|
2006-10-30 06:19:33 +08:00
|
|
|
g_value_set_int (&args->values[0], run_mode);
|
2006-04-06 16:19:01 +08:00
|
|
|
|
2006-11-18 00:56:37 +08:00
|
|
|
n_args = plug_in_collect_drawable_args (action, display->image,
|
|
|
|
GIMP_PROCEDURE (procedure)->args,
|
|
|
|
args, 1);
|
2006-04-27 19:10:05 +08:00
|
|
|
|
2006-09-06 17:11:55 +08:00
|
|
|
plug_in_procedure_execute (procedure, gimp, display, args, n_args);
|
2006-04-06 16:19:01 +08:00
|
|
|
|
|
|
|
g_value_array_free (args);
|
|
|
|
}
|
2001-05-17 02:09:45 +08:00
|
|
|
}
|
2004-07-27 05:07:15 +08:00
|
|
|
|
2006-10-30 06:03:59 +08:00
|
|
|
void
|
|
|
|
plug_in_history_cmd_callback (GtkAction *action,
|
|
|
|
GimpPlugInProcedure *procedure,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
Gimp *gimp;
|
|
|
|
GimpDisplay *display;
|
|
|
|
GValueArray *args;
|
|
|
|
gint n_args;
|
|
|
|
return_if_no_gimp (gimp, data);
|
|
|
|
return_if_no_display (display, data);
|
|
|
|
|
|
|
|
args = gimp_procedure_get_arguments (GIMP_PROCEDURE (procedure));
|
|
|
|
|
|
|
|
g_value_set_int (&args->values[0], GIMP_RUN_INTERACTIVE);
|
|
|
|
|
2006-11-18 00:56:37 +08:00
|
|
|
n_args = plug_in_collect_drawable_args (action, display->image,
|
|
|
|
GIMP_PROCEDURE (procedure)->args,
|
|
|
|
args, 1);
|
2006-10-30 06:03:59 +08:00
|
|
|
|
|
|
|
plug_in_procedure_execute (procedure, gimp, display, args, n_args);
|
|
|
|
|
|
|
|
g_value_array_free (args);
|
|
|
|
}
|
|
|
|
|
2004-07-27 05:07:15 +08:00
|
|
|
void
|
|
|
|
plug_in_reset_all_cmd_callback (GtkAction *action,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2006-04-04 04:54:55 +08:00
|
|
|
Gimp *gimp;
|
2004-10-13 23:48:44 +08:00
|
|
|
GtkWidget *dialog;
|
2006-04-04 04:54:55 +08:00
|
|
|
return_if_no_gimp (gimp, data);
|
2004-07-27 05:07:15 +08:00
|
|
|
|
2004-10-13 23:48:44 +08:00
|
|
|
dialog = gimp_message_dialog_new (_("Reset all Filters"), GIMP_STOCK_QUESTION,
|
|
|
|
NULL, 0,
|
|
|
|
gimp_standard_help_func, NULL,
|
|
|
|
|
|
|
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
|
|
|
GIMP_STOCK_RESET, GTK_RESPONSE_OK,
|
|
|
|
|
|
|
|
NULL);
|
|
|
|
|
2005-02-10 19:00:46 +08:00
|
|
|
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
|
|
|
|
GTK_RESPONSE_OK,
|
|
|
|
GTK_RESPONSE_CANCEL,
|
|
|
|
-1);
|
|
|
|
|
2004-10-13 23:48:44 +08:00
|
|
|
g_signal_connect (dialog, "response",
|
|
|
|
G_CALLBACK (plug_in_reset_all_response),
|
|
|
|
gimp);
|
|
|
|
|
|
|
|
gimp_message_box_set_primary_text (GIMP_MESSAGE_DIALOG (dialog)->box,
|
|
|
|
_("Do you really want to reset all "
|
|
|
|
"filters to default values?"));
|
|
|
|
|
|
|
|
gtk_widget_show (dialog);
|
2004-07-27 05:07:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* private functions */
|
|
|
|
|
2006-09-06 17:11:55 +08:00
|
|
|
static void
|
|
|
|
plug_in_procedure_execute (GimpPlugInProcedure *procedure,
|
|
|
|
Gimp *gimp,
|
|
|
|
GimpDisplay *display,
|
|
|
|
GValueArray *args,
|
|
|
|
gint n_args)
|
|
|
|
{
|
|
|
|
gimp_value_array_truncate (args, n_args);
|
|
|
|
|
|
|
|
/* run the plug-in procedure */
|
|
|
|
gimp_procedure_execute_async (GIMP_PROCEDURE (procedure), gimp,
|
|
|
|
gimp_get_user_context (gimp),
|
|
|
|
GIMP_PROGRESS (display), args,
|
|
|
|
GIMP_OBJECT (display));
|
|
|
|
|
|
|
|
/* remember only image plug-ins */
|
|
|
|
if (GIMP_PROCEDURE (procedure)->num_args >= 2 &&
|
|
|
|
GIMP_IS_PARAM_SPEC_IMAGE_ID (GIMP_PROCEDURE (procedure)->args[1]))
|
|
|
|
{
|
|
|
|
gimp_plug_in_manager_history_add (gimp->plug_in_manager, procedure);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-18 01:34:17 +08:00
|
|
|
static gint
|
2006-11-18 00:56:37 +08:00
|
|
|
plug_in_collect_data_args (GtkAction *action,
|
|
|
|
GimpObject *object,
|
|
|
|
GParamSpec **pspecs,
|
|
|
|
GValueArray *args,
|
|
|
|
gint n_args)
|
2006-05-18 01:34:17 +08:00
|
|
|
{
|
|
|
|
if (args->n_values > n_args &&
|
2006-11-18 00:56:37 +08:00
|
|
|
GIMP_IS_PARAM_SPEC_STRING (pspecs[n_args]))
|
2006-05-18 01:34:17 +08:00
|
|
|
{
|
|
|
|
if (object)
|
|
|
|
{
|
|
|
|
g_value_set_string (&args->values[n_args],
|
|
|
|
gimp_object_get_name (object));
|
|
|
|
n_args++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_warning ("Uh-oh, no active data object for the plug-in!");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return n_args;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
2006-11-18 00:56:37 +08:00
|
|
|
plug_in_collect_image_args (GtkAction *action,
|
|
|
|
GimpImage *image,
|
|
|
|
GParamSpec **pspecs,
|
|
|
|
GValueArray *args,
|
|
|
|
gint n_args)
|
2006-05-18 01:34:17 +08:00
|
|
|
{
|
|
|
|
if (args->n_values > n_args &&
|
2006-11-18 00:56:37 +08:00
|
|
|
GIMP_IS_PARAM_SPEC_IMAGE_ID (pspecs[n_args]))
|
2006-05-18 01:34:17 +08:00
|
|
|
{
|
2006-06-17 01:02:14 +08:00
|
|
|
if (image)
|
|
|
|
{
|
|
|
|
gimp_value_set_image (&args->values[n_args], image);
|
|
|
|
n_args++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_warning ("Uh-oh, no active image for the plug-in!");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return n_args;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
2006-11-18 00:56:37 +08:00
|
|
|
plug_in_collect_item_args (GtkAction *action,
|
|
|
|
GimpImage *image,
|
|
|
|
GimpItem *item,
|
|
|
|
GParamSpec **pspecs,
|
|
|
|
GValueArray *args,
|
|
|
|
gint n_args)
|
2006-06-17 01:02:14 +08:00
|
|
|
{
|
|
|
|
if (args->n_values > n_args &&
|
2006-11-18 00:56:37 +08:00
|
|
|
GIMP_IS_PARAM_SPEC_IMAGE_ID (pspecs[n_args]))
|
2006-06-17 01:02:14 +08:00
|
|
|
{
|
|
|
|
if (image)
|
2006-05-18 01:34:17 +08:00
|
|
|
{
|
2006-06-17 01:02:14 +08:00
|
|
|
gimp_value_set_image (&args->values[n_args], image);
|
2006-05-18 01:34:17 +08:00
|
|
|
n_args++;
|
|
|
|
|
|
|
|
if (args->n_values > n_args &&
|
2006-11-18 00:56:37 +08:00
|
|
|
GIMP_IS_PARAM_SPEC_ITEM_ID (pspecs[n_args]))
|
2006-05-18 01:34:17 +08:00
|
|
|
{
|
2006-11-18 00:56:37 +08:00
|
|
|
if (item &&
|
|
|
|
g_type_is_a (G_TYPE_FROM_INSTANCE (item),
|
|
|
|
GIMP_PARAM_SPEC_ITEM_ID (pspecs[n_args])->item_type))
|
2006-06-17 01:02:14 +08:00
|
|
|
{
|
|
|
|
gimp_value_set_item (&args->values[n_args], item);
|
|
|
|
n_args++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_warning ("Uh-oh, no active item for the plug-in!");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-05-18 01:34:17 +08:00
|
|
|
|
2006-06-17 01:02:14 +08:00
|
|
|
return n_args;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
2006-11-18 00:56:37 +08:00
|
|
|
plug_in_collect_drawable_args (GtkAction *action,
|
|
|
|
GimpImage *image,
|
|
|
|
GParamSpec **pspecs,
|
|
|
|
GValueArray *args,
|
|
|
|
gint n_args)
|
2006-06-17 01:02:14 +08:00
|
|
|
{
|
|
|
|
if (args->n_values > n_args &&
|
2006-11-18 00:56:37 +08:00
|
|
|
GIMP_IS_PARAM_SPEC_IMAGE_ID (pspecs[n_args]))
|
2006-06-17 01:02:14 +08:00
|
|
|
{
|
|
|
|
if (image)
|
|
|
|
{
|
|
|
|
gimp_value_set_image (&args->values[n_args], image);
|
|
|
|
n_args++;
|
|
|
|
|
|
|
|
if (args->n_values > n_args &&
|
2006-11-18 00:56:37 +08:00
|
|
|
GIMP_IS_PARAM_SPEC_DRAWABLE_ID (pspecs[n_args]))
|
2006-06-17 01:02:14 +08:00
|
|
|
{
|
|
|
|
GimpDrawable *drawable = gimp_image_active_drawable (image);
|
2006-05-18 01:34:17 +08:00
|
|
|
|
|
|
|
if (drawable)
|
|
|
|
{
|
|
|
|
gimp_value_set_drawable (&args->values[n_args], drawable);
|
|
|
|
n_args++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_warning ("Uh-oh, no active drawable for the plug-in!");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return n_args;
|
|
|
|
}
|
|
|
|
|
2004-07-27 05:07:15 +08:00
|
|
|
static void
|
2004-10-13 23:48:44 +08:00
|
|
|
plug_in_reset_all_response (GtkWidget *dialog,
|
|
|
|
gint response_id,
|
|
|
|
Gimp *gimp)
|
2004-07-27 05:07:15 +08:00
|
|
|
{
|
2004-10-13 23:48:44 +08:00
|
|
|
gtk_widget_destroy (dialog);
|
2004-07-27 05:07:15 +08:00
|
|
|
|
2004-10-13 23:48:44 +08:00
|
|
|
if (response_id == GTK_RESPONSE_OK)
|
2006-04-29 06:26:51 +08:00
|
|
|
gimp_plug_in_manager_data_free (gimp->plug_in_manager);
|
2004-07-27 05:07:15 +08:00
|
|
|
}
|