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
|
|
|
|
*
|
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
|
|
|
|
2006-02-21 00:38:09 +08:00
|
|
|
#include <string.h>
|
|
|
|
|
2008-10-10 04:24:04 +08:00
|
|
|
#include <gegl.h>
|
2002-03-21 01:46:13 +08:00
|
|
|
#include <gtk/gtk.h>
|
2000-07-16 20:49:04 +08:00
|
|
|
|
2012-05-04 06:50:23 +08:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
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"
|
2015-12-30 18:53:52 +08:00
|
|
|
#include "core/gimp-filter-history.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"
|
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 */
|
|
|
|
|
2015-12-30 18:53:52 +08:00
|
|
|
#if 0
|
2016-01-01 00:05:35 +08:00
|
|
|
static void plug_in_procedure_execute (GimpProcedure *procedure,
|
2006-09-06 17:11:55 +08:00
|
|
|
Gimp *gimp,
|
|
|
|
GimpDisplay *display,
|
2012-05-04 06:50:23 +08:00
|
|
|
GimpValueArray *args,
|
2006-09-06 17:11:55 +08:00
|
|
|
gint n_args);
|
2015-12-30 18:53:52 +08:00
|
|
|
#endif
|
2006-09-06 17:11:55 +08:00
|
|
|
|
2012-05-04 06:50:23 +08:00
|
|
|
static gint plug_in_collect_data_args (GtkAction *action,
|
|
|
|
GimpObject *object,
|
|
|
|
GParamSpec **pspecs,
|
|
|
|
GimpValueArray *args,
|
|
|
|
gint n_args);
|
|
|
|
static gint plug_in_collect_image_args (GtkAction *action,
|
|
|
|
GimpImage *image,
|
|
|
|
GParamSpec **pspecs,
|
|
|
|
GimpValueArray *args,
|
|
|
|
gint n_args);
|
|
|
|
static gint plug_in_collect_item_args (GtkAction *action,
|
|
|
|
GimpImage *image,
|
|
|
|
GimpItem *item,
|
|
|
|
GParamSpec **pspecs,
|
|
|
|
GimpValueArray *args,
|
|
|
|
gint n_args);
|
2015-12-30 18:53:52 +08:00
|
|
|
#if 0
|
2012-05-04 06:50:23 +08:00
|
|
|
static gint plug_in_collect_display_args (GtkAction *action,
|
|
|
|
GimpDisplay *display,
|
|
|
|
GParamSpec **pspecs,
|
|
|
|
GimpValueArray *args,
|
|
|
|
gint n_args);
|
2015-12-30 18:53:52 +08:00
|
|
|
#endif
|
2012-05-04 06:50:23 +08:00
|
|
|
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
|
2016-01-01 00:05:35 +08:00
|
|
|
plug_in_run_cmd_callback (GtkAction *action,
|
|
|
|
GimpProcedure *procedure,
|
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2012-05-04 06:50:23 +08:00
|
|
|
Gimp *gimp;
|
|
|
|
GimpValueArray *args;
|
|
|
|
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 */
|
2012-05-04 06:50:23 +08:00
|
|
|
g_value_set_int (gimp_value_array_index (args, 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,
|
2008-11-21 07:43:58 +08:00
|
|
|
gimp_container_get_children_type (container));
|
2006-05-18 01:34:17 +08:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2007-04-12 23:56:57 +08:00
|
|
|
n_args = plug_in_collect_display_args (action,
|
|
|
|
display,
|
|
|
|
procedure->args,
|
|
|
|
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)
|
2016-01-01 00:05:35 +08:00
|
|
|
plug_in_procedure_execute (procedure, gimp, display, args, n_args);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2012-05-04 06:50:23 +08:00
|
|
|
gimp_value_array_unref (args);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
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 */
|
|
|
|
|
2015-12-30 18:53:52 +08:00
|
|
|
/* FIXME history */
|
|
|
|
void
|
2016-01-01 00:05:35 +08:00
|
|
|
plug_in_procedure_execute (GimpProcedure *procedure,
|
|
|
|
Gimp *gimp,
|
|
|
|
GimpDisplay *display,
|
|
|
|
GimpValueArray *args,
|
|
|
|
gint n_args)
|
2006-09-06 17:11:55 +08:00
|
|
|
{
|
2007-12-03 02:05:54 +08:00
|
|
|
GError *error = NULL;
|
|
|
|
|
2006-09-06 17:11:55 +08:00
|
|
|
gimp_value_array_truncate (args, n_args);
|
|
|
|
|
|
|
|
/* run the plug-in procedure */
|
2016-01-01 00:05:35 +08:00
|
|
|
gimp_procedure_execute_async (procedure, gimp,
|
2006-09-06 17:11:55 +08:00
|
|
|
gimp_get_user_context (gimp),
|
|
|
|
GIMP_PROGRESS (display), args,
|
2007-12-03 02:05:54 +08:00
|
|
|
GIMP_OBJECT (display), &error);
|
2006-09-06 17:11:55 +08:00
|
|
|
|
2007-12-03 02:05:54 +08:00
|
|
|
if (error)
|
|
|
|
{
|
2008-11-04 20:33:09 +08:00
|
|
|
gimp_message_literal (gimp,
|
2013-09-15 00:59:20 +08:00
|
|
|
G_OBJECT (display), GIMP_MESSAGE_ERROR,
|
|
|
|
error->message);
|
2007-12-03 02:05:54 +08:00
|
|
|
g_error_free (error);
|
|
|
|
}
|
|
|
|
else
|
2006-09-06 17:11:55 +08:00
|
|
|
{
|
2007-12-03 02:05:54 +08:00
|
|
|
/* remember only image plug-ins */
|
2016-01-01 00:05:35 +08:00
|
|
|
if (procedure->num_args >= 2 &&
|
|
|
|
GIMP_IS_PARAM_SPEC_IMAGE_ID (procedure->args[1]))
|
2007-12-03 02:05:54 +08:00
|
|
|
{
|
2015-12-30 18:53:52 +08:00
|
|
|
gimp_filter_history_add (gimp, procedure);
|
2007-12-03 02:05:54 +08:00
|
|
|
}
|
2006-09-06 17:11:55 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-18 01:34:17 +08:00
|
|
|
static gint
|
2012-05-04 06:50:23 +08:00
|
|
|
plug_in_collect_data_args (GtkAction *action,
|
|
|
|
GimpObject *object,
|
|
|
|
GParamSpec **pspecs,
|
|
|
|
GimpValueArray *args,
|
|
|
|
gint n_args)
|
2006-05-18 01:34:17 +08:00
|
|
|
{
|
2012-05-04 06:50:23 +08:00
|
|
|
if (gimp_value_array_length (args) > 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)
|
|
|
|
{
|
2012-05-04 06:50:23 +08:00
|
|
|
g_value_set_string (gimp_value_array_index (args, n_args),
|
2006-05-18 01:34:17 +08:00
|
|
|
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
|
2012-05-04 06:50:23 +08:00
|
|
|
plug_in_collect_image_args (GtkAction *action,
|
|
|
|
GimpImage *image,
|
|
|
|
GParamSpec **pspecs,
|
|
|
|
GimpValueArray *args,
|
|
|
|
gint n_args)
|
2006-05-18 01:34:17 +08:00
|
|
|
{
|
2012-05-04 06:50:23 +08:00
|
|
|
if (gimp_value_array_length (args) > 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)
|
|
|
|
{
|
2012-05-04 06:50:23 +08:00
|
|
|
gimp_value_set_image (gimp_value_array_index (args, n_args), image);
|
2006-06-17 01:02:14 +08:00
|
|
|
n_args++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_warning ("Uh-oh, no active image for the plug-in!");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return n_args;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
2012-05-04 06:50:23 +08:00
|
|
|
plug_in_collect_item_args (GtkAction *action,
|
|
|
|
GimpImage *image,
|
|
|
|
GimpItem *item,
|
|
|
|
GParamSpec **pspecs,
|
|
|
|
GimpValueArray *args,
|
|
|
|
gint n_args)
|
2006-06-17 01:02:14 +08:00
|
|
|
{
|
2012-05-04 06:50:23 +08:00
|
|
|
if (gimp_value_array_length (args) > 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
|
|
|
{
|
2012-05-04 06:50:23 +08:00
|
|
|
gimp_value_set_image (gimp_value_array_index (args, n_args), image);
|
2006-05-18 01:34:17 +08:00
|
|
|
n_args++;
|
|
|
|
|
2012-05-04 06:50:23 +08:00
|
|
|
if (gimp_value_array_length (args) > 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
|
|
|
{
|
2012-05-04 06:50:23 +08:00
|
|
|
gimp_value_set_item (gimp_value_array_index (args, n_args),
|
|
|
|
item);
|
2006-06-17 01:02:14 +08:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2015-12-30 18:53:52 +08:00
|
|
|
/* FIXME history */
|
|
|
|
gint
|
2012-05-04 06:50:23 +08:00
|
|
|
plug_in_collect_display_args (GtkAction *action,
|
|
|
|
GimpDisplay *display,
|
|
|
|
GParamSpec **pspecs,
|
|
|
|
GimpValueArray *args,
|
|
|
|
gint n_args)
|
2006-06-17 01:02:14 +08:00
|
|
|
{
|
2012-05-04 06:50:23 +08:00
|
|
|
if (gimp_value_array_length (args) > n_args &&
|
2007-04-12 23:56:57 +08:00
|
|
|
GIMP_IS_PARAM_SPEC_DISPLAY_ID (pspecs[n_args]))
|
|
|
|
{
|
|
|
|
if (display)
|
|
|
|
{
|
2012-05-04 06:50:23 +08:00
|
|
|
gimp_value_set_display (gimp_value_array_index (args, n_args),
|
|
|
|
GIMP_OBJECT (display));
|
2007-04-12 23:56:57 +08:00
|
|
|
n_args++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_warning ("Uh-oh, no active display for the plug-in!");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-04 06:50:23 +08:00
|
|
|
if (gimp_value_array_length (args) > 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
|
|
|
{
|
2009-10-07 01:20:44 +08:00
|
|
|
GimpImage *image = display ? gimp_display_get_image (display) : NULL;
|
2007-04-12 23:56:57 +08:00
|
|
|
|
2006-06-17 01:02:14 +08:00
|
|
|
if (image)
|
|
|
|
{
|
2012-05-04 06:50:23 +08:00
|
|
|
gimp_value_set_image (gimp_value_array_index (args, n_args),
|
|
|
|
image);
|
2006-06-17 01:02:14 +08:00
|
|
|
n_args++;
|
|
|
|
|
2012-05-04 06:50:23 +08:00
|
|
|
if (gimp_value_array_length (args) > 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
|
|
|
{
|
2007-07-19 22:59:51 +08:00
|
|
|
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
|
2006-05-18 01:34:17 +08:00
|
|
|
|
|
|
|
if (drawable)
|
|
|
|
{
|
2012-05-04 06:50:23 +08:00
|
|
|
gimp_value_set_drawable (gimp_value_array_index (args, n_args),
|
|
|
|
drawable);
|
2006-05-18 01:34:17 +08:00
|
|
|
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
|
|
|
}
|