1997-11-25 06:05:25 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
1998-04-13 13:44:11 +08:00
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
2000-07-16 20:49:04 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "config.h"
|
1999-03-07 20:56:03 +08:00
|
|
|
|
2002-03-28 08:10:56 +08:00
|
|
|
#include <string.h>
|
|
|
|
|
2003-01-30 19:20:12 +08:00
|
|
|
#include <glib-object.h>
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
|
|
|
#include "libgimpbase/gimpprotocol.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
#include "plug-in-types.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
#include "pdb/procedural_db.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
#include "plug-in.h"
|
|
|
|
#include "plug-in-params.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
Argument *
|
2003-01-20 20:17:32 +08:00
|
|
|
plug_in_params_to_args (GPParam *params,
|
|
|
|
gint nparams,
|
|
|
|
gboolean full_copy)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-07-16 20:49:04 +08:00
|
|
|
Argument *args;
|
|
|
|
gchar **stringarray;
|
2001-01-25 09:20:05 +08:00
|
|
|
gint count;
|
|
|
|
gint i, j;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
if (! (params && nparams))
|
1997-11-25 06:05:25 +08:00
|
|
|
return NULL;
|
|
|
|
|
Changed the semantics of GIMP_EXTENSION and (to some extent) of
2003-06-19 Michael Natterer <mitch@gimp.org>
Changed the semantics of GIMP_EXTENSION and (to some extent)
of GIMP_PLUGIN:
The old meaning of EXTENSION was "I live in the toolbox" and
PLUGIN meant "I take RUN-MODE,IMAGE,DRAWABLE args (but only if I
am invoked interactively)". This is completely useless, since
living in the toolbox means having "<Toolbox>" in the menu_path
and taking RUN-MODE,IMAGE,DRAWABLE means just that, regardless of
what type of procedure we are.
The new meaning of GIMP_PLUGIN is just "I am an ordinary procedure,
I am invoked, do my job and finish", while GIMP_EXTENSION means
"I will install temporary procedures and I will keep running to
keep them available".
(A GIMP_EXTENSION *must* call gimp_extension_ack() now to tell the
core that it's ready to run, or the core will block waiting for
the message !!!).
* configure.in: bumped version number to 1.3.16.
* libgimpbase/gimpprotocol.h: increased protocol version number so
old extensions will refuse to load.
* app/gui/plug-in-commands.c (plug_in_run_cmd_callback): don't
blindly pass RUN-MODE,IMAGE,DRAWABLE to GIMP_PLUGIN procedures but
look at their parameters and pass them either RUN-MODE, or
RUN-MODE,IMAGE, or RUN-MODE,IMAGE,DRAWABLE.
* app/pdb/procedural_db.c: cleaned up, better error reporting,
replaced an impossible error message by g_return_if_fail()
* app/plug-in/plug-in-message.c (plug_in_handle_proc_install):
better error messages.
* app/plug-in/plug-in-params.c: allocate parameter arrays using
g_new0() so we don't have to worry about uninitialized stuff
later.
* app/plug-in/plug-in-run.c (plug_in_run): wait for
gimp_extension_ack() installation confirmation for ALL extensions,
not just for automatically started ones.
* app/plug-in/plug-ins.c: cleanup.
* libgimp/gimp.[ch]: cleaned up and API-documented massively. Made
all magic values given in the GPConfig message static and added
accessor functions for them. Added gimp_tile_width()/height().
Added new function gimp_extension_enable() which turns on
asynchronous processing of temp_proc run requests without having
to enter an endless gimp_extension_process() loop. Moved all
private functions to the end of the file. Added tons of
g_return_if_fail() all over the place. Call gimp_run_procedure2()
from gimp_run_procedure() instead of duplicating the
code. Indentation, spacing, stuff...
* libgimp/gimptile.[ch]: removed gimp_tile_width()/height().
* libgimp/gimpdrawable.c
* libgimp/gimppixelrgn.c
* libgimp/gimptile.c: use the gimp_tile_width()/height() accessor
functions.
* libgimp/gimp.def: added gimp_extension_enable.
* libgimp/gimpmenu.c: removed evil code which connected to
_readchannel manually and use gimp_extension_enable() for watching
temp_procs.
* plug-ins/helpbrowser/helpbrowser.c: removed the same evil code
here and call gimp_extension_enable(). Call gimp_extension_ack()
to let the core know that the temp_proc is installed.
* plug-ins/script-fu/script-fu.c: made all procedures except the
permanently running "extension_script_fu" ordinary GIMP_PLUGIN
procedures.
* plug-ins/common/curve_bend.c
* plug-ins/common/plugindetails.c
* plug-ins/common/screenshot.c
* plug-ins/common/uniteditor.c
* plug-ins/common/winclipboard.c
* plug-ins/dbbrowser/dbbrowser.c
* plug-ins/gfli/gfli.c
* plug-ins/twain/twain.c
* plug-ins/webbrowser/webbrowser.c
* plug-ins/winsnap/winsnap.c: made them all ordinary GIMP_PLUGIN
procedures and renamed them from "extension_*" to "plug_in_*".
Random cleanups.
* app/widgets/gimphelp.c
* plug-ins/maze/maze_face.c: call "plug_in_web_browser" now.
2003-06-20 01:12:00 +08:00
|
|
|
args = g_new0 (Argument, nparams);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
for (i = 0; i < nparams; i++)
|
|
|
|
{
|
|
|
|
args[i].arg_type = params[i].type;
|
|
|
|
|
|
|
|
switch (args[i].arg_type)
|
|
|
|
{
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_INT32:
|
1997-11-25 06:05:25 +08:00
|
|
|
args[i].value.pdb_int = params[i].data.d_int32;
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_INT16:
|
1997-11-25 06:05:25 +08:00
|
|
|
args[i].value.pdb_int = params[i].data.d_int16;
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_INT8:
|
1997-11-25 06:05:25 +08:00
|
|
|
args[i].value.pdb_int = params[i].data.d_int8;
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_FLOAT:
|
1997-11-25 06:05:25 +08:00
|
|
|
args[i].value.pdb_float = params[i].data.d_float;
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_STRING:
|
1997-11-25 06:05:25 +08:00
|
|
|
if (full_copy)
|
|
|
|
args[i].value.pdb_pointer = g_strdup (params[i].data.d_string);
|
|
|
|
else
|
|
|
|
args[i].value.pdb_pointer = params[i].data.d_string;
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_INT32ARRAY:
|
1997-11-25 06:05:25 +08:00
|
|
|
if (full_copy)
|
|
|
|
{
|
|
|
|
count = args[i-1].value.pdb_int;
|
|
|
|
args[i].value.pdb_pointer = g_new (gint32, count);
|
2001-01-25 09:20:05 +08:00
|
|
|
memcpy (args[i].value.pdb_pointer,
|
|
|
|
params[i].data.d_int32array, count * 4);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
args[i].value.pdb_pointer = params[i].data.d_int32array;
|
|
|
|
}
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_INT16ARRAY:
|
1997-11-25 06:05:25 +08:00
|
|
|
if (full_copy)
|
|
|
|
{
|
|
|
|
count = args[i-1].value.pdb_int;
|
|
|
|
args[i].value.pdb_pointer = g_new (gint16, count);
|
2001-01-25 09:20:05 +08:00
|
|
|
memcpy (args[i].value.pdb_pointer,
|
|
|
|
params[i].data.d_int16array, count * 2);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
args[i].value.pdb_pointer = params[i].data.d_int16array;
|
|
|
|
}
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_INT8ARRAY:
|
1997-11-25 06:05:25 +08:00
|
|
|
if (full_copy)
|
|
|
|
{
|
|
|
|
count = args[i-1].value.pdb_int;
|
|
|
|
args[i].value.pdb_pointer = g_new (gint8, count);
|
2001-01-25 09:20:05 +08:00
|
|
|
memcpy (args[i].value.pdb_pointer,
|
|
|
|
params[i].data.d_int8array, count);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
args[i].value.pdb_pointer = params[i].data.d_int8array;
|
|
|
|
}
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_FLOATARRAY:
|
1997-11-25 06:05:25 +08:00
|
|
|
if (full_copy)
|
|
|
|
{
|
|
|
|
count = args[i-1].value.pdb_int;
|
|
|
|
args[i].value.pdb_pointer = g_new (gdouble, count);
|
2001-01-25 09:20:05 +08:00
|
|
|
memcpy (args[i].value.pdb_pointer,
|
|
|
|
params[i].data.d_floatarray, count * 8);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
args[i].value.pdb_pointer = params[i].data.d_floatarray;
|
|
|
|
}
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_STRINGARRAY:
|
1997-11-25 06:05:25 +08:00
|
|
|
if (full_copy)
|
|
|
|
{
|
2001-01-25 09:20:05 +08:00
|
|
|
args[i].value.pdb_pointer = g_new (gchar *,
|
|
|
|
args[i-1].value.pdb_int);
|
1997-11-25 06:05:25 +08:00
|
|
|
stringarray = args[i].value.pdb_pointer;
|
|
|
|
|
|
|
|
for (j = 0; j < args[i-1].value.pdb_int; j++)
|
|
|
|
stringarray[j] = g_strdup (params[i].data.d_stringarray[j]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
args[i].value.pdb_pointer = params[i].data.d_stringarray;
|
|
|
|
}
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_COLOR:
|
2001-01-25 09:20:05 +08:00
|
|
|
args[i].value.pdb_color = params[i].data.d_color;
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_REGION:
|
1999-09-23 19:49:16 +08:00
|
|
|
g_message ("the \"region\" arg type is not currently supported");
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_DISPLAY:
|
1997-11-25 06:05:25 +08:00
|
|
|
args[i].value.pdb_int = params[i].data.d_display;
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_IMAGE:
|
1997-11-25 06:05:25 +08:00
|
|
|
args[i].value.pdb_int = params[i].data.d_image;
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_LAYER:
|
1997-11-25 06:05:25 +08:00
|
|
|
args[i].value.pdb_int = params[i].data.d_layer;
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_CHANNEL:
|
1997-11-25 06:05:25 +08:00
|
|
|
args[i].value.pdb_int = params[i].data.d_channel;
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_DRAWABLE:
|
1997-11-25 06:05:25 +08:00
|
|
|
args[i].value.pdb_int = params[i].data.d_drawable;
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_SELECTION:
|
1997-11-25 06:05:25 +08:00
|
|
|
args[i].value.pdb_int = params[i].data.d_selection;
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_BOUNDARY:
|
1997-11-25 06:05:25 +08:00
|
|
|
args[i].value.pdb_int = params[i].data.d_boundary;
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_PATH:
|
1997-11-25 06:05:25 +08:00
|
|
|
args[i].value.pdb_int = params[i].data.d_path;
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_PARASITE:
|
1998-10-08 16:15:21 +08:00
|
|
|
if (full_copy)
|
2000-05-27 06:28:40 +08:00
|
|
|
args[i].value.pdb_pointer =
|
|
|
|
gimp_parasite_copy ((GimpParasite *) &(params[i].data.d_parasite));
|
1998-10-08 16:15:21 +08:00
|
|
|
else
|
2001-01-25 09:20:05 +08:00
|
|
|
args[i].value.pdb_pointer = (gpointer) &(params[i].data.d_parasite);
|
1998-10-08 16:15:21 +08:00
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_STATUS:
|
1997-11-25 06:05:25 +08:00
|
|
|
args[i].value.pdb_int = params[i].data.d_status;
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_END:
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return args;
|
|
|
|
}
|
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
GPParam *
|
1997-11-25 06:05:25 +08:00
|
|
|
plug_in_args_to_params (Argument *args,
|
2000-07-16 20:49:04 +08:00
|
|
|
gint nargs,
|
|
|
|
gboolean full_copy)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-07-16 20:49:04 +08:00
|
|
|
GPParam *params;
|
|
|
|
gchar **stringarray;
|
2001-01-25 09:20:05 +08:00
|
|
|
gint i, j;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
if (! (args && nargs))
|
1997-11-25 06:05:25 +08:00
|
|
|
return NULL;
|
|
|
|
|
Changed the semantics of GIMP_EXTENSION and (to some extent) of
2003-06-19 Michael Natterer <mitch@gimp.org>
Changed the semantics of GIMP_EXTENSION and (to some extent)
of GIMP_PLUGIN:
The old meaning of EXTENSION was "I live in the toolbox" and
PLUGIN meant "I take RUN-MODE,IMAGE,DRAWABLE args (but only if I
am invoked interactively)". This is completely useless, since
living in the toolbox means having "<Toolbox>" in the menu_path
and taking RUN-MODE,IMAGE,DRAWABLE means just that, regardless of
what type of procedure we are.
The new meaning of GIMP_PLUGIN is just "I am an ordinary procedure,
I am invoked, do my job and finish", while GIMP_EXTENSION means
"I will install temporary procedures and I will keep running to
keep them available".
(A GIMP_EXTENSION *must* call gimp_extension_ack() now to tell the
core that it's ready to run, or the core will block waiting for
the message !!!).
* configure.in: bumped version number to 1.3.16.
* libgimpbase/gimpprotocol.h: increased protocol version number so
old extensions will refuse to load.
* app/gui/plug-in-commands.c (plug_in_run_cmd_callback): don't
blindly pass RUN-MODE,IMAGE,DRAWABLE to GIMP_PLUGIN procedures but
look at their parameters and pass them either RUN-MODE, or
RUN-MODE,IMAGE, or RUN-MODE,IMAGE,DRAWABLE.
* app/pdb/procedural_db.c: cleaned up, better error reporting,
replaced an impossible error message by g_return_if_fail()
* app/plug-in/plug-in-message.c (plug_in_handle_proc_install):
better error messages.
* app/plug-in/plug-in-params.c: allocate parameter arrays using
g_new0() so we don't have to worry about uninitialized stuff
later.
* app/plug-in/plug-in-run.c (plug_in_run): wait for
gimp_extension_ack() installation confirmation for ALL extensions,
not just for automatically started ones.
* app/plug-in/plug-ins.c: cleanup.
* libgimp/gimp.[ch]: cleaned up and API-documented massively. Made
all magic values given in the GPConfig message static and added
accessor functions for them. Added gimp_tile_width()/height().
Added new function gimp_extension_enable() which turns on
asynchronous processing of temp_proc run requests without having
to enter an endless gimp_extension_process() loop. Moved all
private functions to the end of the file. Added tons of
g_return_if_fail() all over the place. Call gimp_run_procedure2()
from gimp_run_procedure() instead of duplicating the
code. Indentation, spacing, stuff...
* libgimp/gimptile.[ch]: removed gimp_tile_width()/height().
* libgimp/gimpdrawable.c
* libgimp/gimppixelrgn.c
* libgimp/gimptile.c: use the gimp_tile_width()/height() accessor
functions.
* libgimp/gimp.def: added gimp_extension_enable.
* libgimp/gimpmenu.c: removed evil code which connected to
_readchannel manually and use gimp_extension_enable() for watching
temp_procs.
* plug-ins/helpbrowser/helpbrowser.c: removed the same evil code
here and call gimp_extension_enable(). Call gimp_extension_ack()
to let the core know that the temp_proc is installed.
* plug-ins/script-fu/script-fu.c: made all procedures except the
permanently running "extension_script_fu" ordinary GIMP_PLUGIN
procedures.
* plug-ins/common/curve_bend.c
* plug-ins/common/plugindetails.c
* plug-ins/common/screenshot.c
* plug-ins/common/uniteditor.c
* plug-ins/common/winclipboard.c
* plug-ins/dbbrowser/dbbrowser.c
* plug-ins/gfli/gfli.c
* plug-ins/twain/twain.c
* plug-ins/webbrowser/webbrowser.c
* plug-ins/winsnap/winsnap.c: made them all ordinary GIMP_PLUGIN
procedures and renamed them from "extension_*" to "plug_in_*".
Random cleanups.
* app/widgets/gimphelp.c
* plug-ins/maze/maze_face.c: call "plug_in_web_browser" now.
2003-06-20 01:12:00 +08:00
|
|
|
params = g_new0 (GPParam, nargs);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
for (i = 0; i < nargs; i++)
|
|
|
|
{
|
|
|
|
params[i].type = args[i].arg_type;
|
|
|
|
|
|
|
|
switch (args[i].arg_type)
|
|
|
|
{
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_INT32:
|
1997-11-25 06:05:25 +08:00
|
|
|
params[i].data.d_int32 = args[i].value.pdb_int;
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_INT16:
|
1997-11-25 06:05:25 +08:00
|
|
|
params[i].data.d_int16 = args[i].value.pdb_int;
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_INT8:
|
1997-11-25 06:05:25 +08:00
|
|
|
params[i].data.d_int8 = args[i].value.pdb_int;
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_FLOAT:
|
1997-11-25 06:05:25 +08:00
|
|
|
params[i].data.d_float = args[i].value.pdb_float;
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_STRING:
|
1997-11-25 06:05:25 +08:00
|
|
|
if (full_copy)
|
|
|
|
params[i].data.d_string = g_strdup (args[i].value.pdb_pointer);
|
|
|
|
else
|
|
|
|
params[i].data.d_string = args[i].value.pdb_pointer;
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_INT32ARRAY:
|
1997-11-25 06:05:25 +08:00
|
|
|
if (full_copy)
|
|
|
|
{
|
|
|
|
params[i].data.d_int32array = g_new (gint32, params[i-1].data.d_int32);
|
|
|
|
memcpy (params[i].data.d_int32array,
|
|
|
|
args[i].value.pdb_pointer,
|
|
|
|
params[i-1].data.d_int32 * 4);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
params[i].data.d_int32array = args[i].value.pdb_pointer;
|
|
|
|
}
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_INT16ARRAY:
|
1997-11-25 06:05:25 +08:00
|
|
|
if (full_copy)
|
|
|
|
{
|
|
|
|
params[i].data.d_int16array = g_new (gint16, params[i-1].data.d_int32);
|
|
|
|
memcpy (params[i].data.d_int16array,
|
|
|
|
args[i].value.pdb_pointer,
|
|
|
|
params[i-1].data.d_int32 * 2);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
params[i].data.d_int16array = args[i].value.pdb_pointer;
|
|
|
|
}
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_INT8ARRAY:
|
1997-11-25 06:05:25 +08:00
|
|
|
if (full_copy)
|
|
|
|
{
|
|
|
|
params[i].data.d_int8array = g_new (gint8, params[i-1].data.d_int32);
|
|
|
|
memcpy (params[i].data.d_int8array,
|
|
|
|
args[i].value.pdb_pointer,
|
|
|
|
params[i-1].data.d_int32);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
params[i].data.d_int8array = args[i].value.pdb_pointer;
|
|
|
|
}
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_FLOATARRAY:
|
1997-11-25 06:05:25 +08:00
|
|
|
if (full_copy)
|
|
|
|
{
|
|
|
|
params[i].data.d_floatarray = g_new (gdouble, params[i-1].data.d_int32);
|
|
|
|
memcpy (params[i].data.d_floatarray,
|
|
|
|
args[i].value.pdb_pointer,
|
|
|
|
params[i-1].data.d_int32 * 8);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
params[i].data.d_floatarray = args[i].value.pdb_pointer;
|
|
|
|
}
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_STRINGARRAY:
|
1997-11-25 06:05:25 +08:00
|
|
|
if (full_copy)
|
|
|
|
{
|
|
|
|
params[i].data.d_stringarray = g_new (gchar*, params[i-1].data.d_int32);
|
|
|
|
stringarray = args[i].value.pdb_pointer;
|
|
|
|
|
|
|
|
for (j = 0; j < params[i-1].data.d_int32; j++)
|
|
|
|
params[i].data.d_stringarray[j] = g_strdup (stringarray[j]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
params[i].data.d_stringarray = args[i].value.pdb_pointer;
|
|
|
|
}
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_COLOR:
|
2001-01-25 09:20:05 +08:00
|
|
|
params[i].data.d_color = args[i].value.pdb_color;
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_REGION:
|
1999-09-23 19:49:16 +08:00
|
|
|
g_message ("the \"region\" arg type is not currently supported");
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_DISPLAY:
|
1997-11-25 06:05:25 +08:00
|
|
|
params[i].data.d_display = args[i].value.pdb_int;
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_IMAGE:
|
1997-11-25 06:05:25 +08:00
|
|
|
params[i].data.d_image = args[i].value.pdb_int;
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_LAYER:
|
1997-11-25 06:05:25 +08:00
|
|
|
params[i].data.d_layer = args[i].value.pdb_int;
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_CHANNEL:
|
1997-11-25 06:05:25 +08:00
|
|
|
params[i].data.d_channel = args[i].value.pdb_int;
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_DRAWABLE:
|
1997-11-25 06:05:25 +08:00
|
|
|
params[i].data.d_drawable = args[i].value.pdb_int;
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_SELECTION:
|
1997-11-25 06:05:25 +08:00
|
|
|
params[i].data.d_selection = args[i].value.pdb_int;
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_BOUNDARY:
|
1997-11-25 06:05:25 +08:00
|
|
|
params[i].data.d_boundary = args[i].value.pdb_int;
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_PATH:
|
1997-11-25 06:05:25 +08:00
|
|
|
params[i].data.d_path = args[i].value.pdb_int;
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_PARASITE:
|
1998-10-08 16:15:21 +08:00
|
|
|
if (full_copy)
|
|
|
|
{
|
2000-05-27 06:28:40 +08:00
|
|
|
GimpParasite *tmp;
|
2000-07-16 20:49:04 +08:00
|
|
|
|
2000-05-27 06:28:40 +08:00
|
|
|
tmp = gimp_parasite_copy (args[i].value.pdb_pointer);
|
1998-10-08 16:15:21 +08:00
|
|
|
if (tmp == NULL)
|
2000-05-27 06:28:40 +08:00
|
|
|
{
|
2000-07-16 20:49:04 +08:00
|
|
|
params[i].data.d_parasite.name = 0;
|
2000-05-27 06:28:40 +08:00
|
|
|
params[i].data.d_parasite.flags = 0;
|
2000-07-16 20:49:04 +08:00
|
|
|
params[i].data.d_parasite.size = 0;
|
|
|
|
params[i].data.d_parasite.data = 0;
|
2000-05-27 06:28:40 +08:00
|
|
|
}
|
1998-10-08 16:15:21 +08:00
|
|
|
else
|
2000-05-27 06:28:40 +08:00
|
|
|
{
|
|
|
|
memcpy (¶ms[i].data.d_parasite, tmp,
|
|
|
|
sizeof (GimpParasite));
|
|
|
|
g_free (tmp);
|
|
|
|
}
|
1998-10-08 16:15:21 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (args[i].value.pdb_pointer == NULL)
|
2000-05-27 06:28:40 +08:00
|
|
|
{
|
2000-07-16 20:49:04 +08:00
|
|
|
params[i].data.d_parasite.name = 0;
|
2000-05-27 06:28:40 +08:00
|
|
|
params[i].data.d_parasite.flags = 0;
|
2000-07-16 20:49:04 +08:00
|
|
|
params[i].data.d_parasite.size = 0;
|
|
|
|
params[i].data.d_parasite.data = 0;
|
2000-05-27 06:28:40 +08:00
|
|
|
}
|
1998-10-08 16:15:21 +08:00
|
|
|
else
|
|
|
|
memcpy (¶ms[i].data.d_parasite,
|
2000-05-27 06:28:40 +08:00
|
|
|
(GimpParasite *) (args[i].value.pdb_pointer),
|
|
|
|
sizeof (GimpParasite));
|
1998-10-08 16:15:21 +08:00
|
|
|
}
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_STATUS:
|
1997-11-25 06:05:25 +08:00
|
|
|
params[i].data.d_status = args[i].value.pdb_int;
|
|
|
|
break;
|
2001-05-21 21:58:46 +08:00
|
|
|
case GIMP_PDB_END:
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return params;
|
|
|
|
}
|
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
void
|
2003-01-20 20:17:32 +08:00
|
|
|
plug_in_params_destroy (GPParam *params,
|
2000-02-25 00:11:26 +08:00
|
|
|
gint nparams,
|
|
|
|
gboolean full_destroy)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-02-25 00:11:26 +08:00
|
|
|
gint i, j;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-12-28 01:58:30 +08:00
|
|
|
if (full_destroy)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-12-28 01:58:30 +08:00
|
|
|
for (i = 0; i < nparams; i++)
|
|
|
|
{
|
|
|
|
switch (params[i].type)
|
|
|
|
{
|
|
|
|
case GIMP_PDB_INT32:
|
|
|
|
case GIMP_PDB_INT16:
|
|
|
|
case GIMP_PDB_INT8:
|
|
|
|
case GIMP_PDB_FLOAT:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_PDB_STRING:
|
|
|
|
g_free (params[i].data.d_string);
|
|
|
|
break;
|
|
|
|
case GIMP_PDB_INT32ARRAY:
|
|
|
|
g_free (params[i].data.d_int32array);
|
|
|
|
break;
|
|
|
|
case GIMP_PDB_INT16ARRAY:
|
|
|
|
g_free (params[i].data.d_int16array);
|
|
|
|
break;
|
|
|
|
case GIMP_PDB_INT8ARRAY:
|
|
|
|
g_free (params[i].data.d_int8array);
|
|
|
|
break;
|
|
|
|
case GIMP_PDB_FLOATARRAY:
|
|
|
|
g_free (params[i].data.d_floatarray);
|
|
|
|
break;
|
|
|
|
case GIMP_PDB_STRINGARRAY:
|
|
|
|
for (j = 0; j < params[i-1].data.d_int32; j++)
|
|
|
|
g_free (params[i].data.d_stringarray[j]);
|
|
|
|
g_free (params[i].data.d_stringarray);
|
|
|
|
break;
|
|
|
|
case GIMP_PDB_COLOR:
|
|
|
|
break;
|
|
|
|
case GIMP_PDB_REGION:
|
|
|
|
g_message ("the \"region\" arg type is not currently supported");
|
|
|
|
break;
|
|
|
|
case GIMP_PDB_DISPLAY:
|
|
|
|
case GIMP_PDB_IMAGE:
|
|
|
|
case GIMP_PDB_LAYER:
|
|
|
|
case GIMP_PDB_CHANNEL:
|
|
|
|
case GIMP_PDB_DRAWABLE:
|
|
|
|
case GIMP_PDB_SELECTION:
|
|
|
|
case GIMP_PDB_BOUNDARY:
|
|
|
|
case GIMP_PDB_PATH:
|
|
|
|
break;
|
|
|
|
case GIMP_PDB_PARASITE:
|
|
|
|
if (params[i].data.d_parasite.data)
|
|
|
|
{
|
|
|
|
g_free (params[i].data.d_parasite.name);
|
|
|
|
g_free (params[i].data.d_parasite.data);
|
|
|
|
params[i].data.d_parasite.name = 0;
|
|
|
|
params[i].data.d_parasite.data = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GIMP_PDB_STATUS:
|
|
|
|
break;
|
|
|
|
case GIMP_PDB_END:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
g_free (params);
|
|
|
|
}
|
|
|
|
|
2002-03-21 01:46:13 +08:00
|
|
|
void
|
1997-11-25 06:05:25 +08:00
|
|
|
plug_in_args_destroy (Argument *args,
|
2003-01-20 20:17:32 +08:00
|
|
|
gint nargs,
|
|
|
|
gboolean full_destroy)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-12-28 01:58:30 +08:00
|
|
|
if (full_destroy)
|
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
|
|
|
procedural_db_destroy_args (args, nargs);
|
1997-11-25 06:05:25 +08:00
|
|
|
else
|
Changed the semantics of GIMP_EXTENSION and (to some extent) of
2003-06-19 Michael Natterer <mitch@gimp.org>
Changed the semantics of GIMP_EXTENSION and (to some extent)
of GIMP_PLUGIN:
The old meaning of EXTENSION was "I live in the toolbox" and
PLUGIN meant "I take RUN-MODE,IMAGE,DRAWABLE args (but only if I
am invoked interactively)". This is completely useless, since
living in the toolbox means having "<Toolbox>" in the menu_path
and taking RUN-MODE,IMAGE,DRAWABLE means just that, regardless of
what type of procedure we are.
The new meaning of GIMP_PLUGIN is just "I am an ordinary procedure,
I am invoked, do my job and finish", while GIMP_EXTENSION means
"I will install temporary procedures and I will keep running to
keep them available".
(A GIMP_EXTENSION *must* call gimp_extension_ack() now to tell the
core that it's ready to run, or the core will block waiting for
the message !!!).
* configure.in: bumped version number to 1.3.16.
* libgimpbase/gimpprotocol.h: increased protocol version number so
old extensions will refuse to load.
* app/gui/plug-in-commands.c (plug_in_run_cmd_callback): don't
blindly pass RUN-MODE,IMAGE,DRAWABLE to GIMP_PLUGIN procedures but
look at their parameters and pass them either RUN-MODE, or
RUN-MODE,IMAGE, or RUN-MODE,IMAGE,DRAWABLE.
* app/pdb/procedural_db.c: cleaned up, better error reporting,
replaced an impossible error message by g_return_if_fail()
* app/plug-in/plug-in-message.c (plug_in_handle_proc_install):
better error messages.
* app/plug-in/plug-in-params.c: allocate parameter arrays using
g_new0() so we don't have to worry about uninitialized stuff
later.
* app/plug-in/plug-in-run.c (plug_in_run): wait for
gimp_extension_ack() installation confirmation for ALL extensions,
not just for automatically started ones.
* app/plug-in/plug-ins.c: cleanup.
* libgimp/gimp.[ch]: cleaned up and API-documented massively. Made
all magic values given in the GPConfig message static and added
accessor functions for them. Added gimp_tile_width()/height().
Added new function gimp_extension_enable() which turns on
asynchronous processing of temp_proc run requests without having
to enter an endless gimp_extension_process() loop. Moved all
private functions to the end of the file. Added tons of
g_return_if_fail() all over the place. Call gimp_run_procedure2()
from gimp_run_procedure() instead of duplicating the
code. Indentation, spacing, stuff...
* libgimp/gimptile.[ch]: removed gimp_tile_width()/height().
* libgimp/gimpdrawable.c
* libgimp/gimppixelrgn.c
* libgimp/gimptile.c: use the gimp_tile_width()/height() accessor
functions.
* libgimp/gimp.def: added gimp_extension_enable.
* libgimp/gimpmenu.c: removed evil code which connected to
_readchannel manually and use gimp_extension_enable() for watching
temp_procs.
* plug-ins/helpbrowser/helpbrowser.c: removed the same evil code
here and call gimp_extension_enable(). Call gimp_extension_ack()
to let the core know that the temp_proc is installed.
* plug-ins/script-fu/script-fu.c: made all procedures except the
permanently running "extension_script_fu" ordinary GIMP_PLUGIN
procedures.
* plug-ins/common/curve_bend.c
* plug-ins/common/plugindetails.c
* plug-ins/common/screenshot.c
* plug-ins/common/uniteditor.c
* plug-ins/common/winclipboard.c
* plug-ins/dbbrowser/dbbrowser.c
* plug-ins/gfli/gfli.c
* plug-ins/twain/twain.c
* plug-ins/webbrowser/webbrowser.c
* plug-ins/winsnap/winsnap.c: made them all ordinary GIMP_PLUGIN
procedures and renamed them from "extension_*" to "plug_in_*".
Random cleanups.
* app/widgets/gimphelp.c
* plug-ins/maze/maze_face.c: call "plug_in_web_browser" now.
2003-06-20 01:12:00 +08:00
|
|
|
g_free (args);
|
2001-05-17 02:09:45 +08:00
|
|
|
}
|