gimp/app/pdb/gimpprocedure.h

149 lines
7.8 KiB
C
Raw Normal View History

/* 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
1997-11-25 06:05:25 +08:00
* it under the terms of the GNU General Public License as published by
* 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
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1997-11-25 06:05:25 +08:00
*/
app/Makefile.am app/channel_pvt.h app/drawable_pvt.h app/gdisplayF.h 2000-12-29 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/channel_pvt.h * app/drawable_pvt.h * app/gdisplayF.h * app/gimpdrawableP.h * app/gimpimageP.h * app/layer_pvt.h * app/toolsF.h: removed these files. * app/apptypes.h * tools/pdbgen/enums.pl: added tons of opaque typedefs and enums. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/display.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/help.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb * app/*: chainsaw #include cleanup: - Never (never!!) include stuff in header files except where we need access to structures' contents (like derived objects). - Added prototypes and proper formating in many files. - The #include order in *all* *.c files is as follows: #include "config.h" #include <system stuff> #include <gtk/gtk.h> #include "apptypes.h" #include "gimp stuff" #include "libgimp stuff" #include "libgimp/gimpintl.h" By following this scheme we can easily see a file's dependencies from it's #include's and can grep for the inclusion to find out where a file is used. * tools/pdbgen/app.pl: changed to follow the include scheme above. * libgimp/Makefile.am * libgimp/gimpuitypes.h: new file, included from libgimp/gimpui.h and from app/apptypes.h. * libgimp/gimpcolorbutton.[ch] * libgimp/gimpdialog.[ch] * libgimp/gimphelpui.[ch] * libgimp/gimpparasite.[ch] * libgimp/gimppatheditor.[ch] * libgimp/gimpprotocol.c * libgimp/gimpquerybox.[ch] * libgimp/gimpsizeentry.[ch] * libgimp/gimptypes.h * libgimp/gimpui.h * libgimp/gimpunit.h * libgimp/gimpunitmenu.[ch] * libgimp/gimpwidgets.[ch]: changed accordingly. * plug-ins/FractalExplorer/Dialogs.c * plug-ins/gdyntext/message_window.c * plug-ins/imagemap/imap_default_dialog.c * plug-ins/imagemap/imap_file.c: these files used to include "libgimp/gimpui.h" without including "libgimp/gimp.h". This is no longer possible because the libgimpui headers don't inlcude "libgimp/gimpunit.h" any more.
2000-12-29 23:22:01 +08:00
#ifndef __GIMP_PROCEDURE_H__
#define __GIMP_PROCEDURE_H__
1997-11-25 06:05:25 +08:00
#include "core/gimpobject.h"
typedef GimpValueArray * (* GimpMarshalFunc) (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error);
1997-11-25 06:05:25 +08:00
#define GIMP_TYPE_PROCEDURE (gimp_procedure_get_type ())
#define GIMP_PROCEDURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PROCEDURE, GimpProcedure))
#define GIMP_PROCEDURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PROCEDURE, GimpProcedureClass))
#define GIMP_IS_PROCEDURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PROCEDURE))
#define GIMP_IS_PROCEDURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PROCEDURE))
#define GIMP_PROCEDURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PROCEDURE, GimpProcedureClass))
typedef struct _GimpProcedureClass GimpProcedureClass;
1997-11-25 06:05:25 +08:00
struct _GimpProcedure
1997-11-25 06:05:25 +08:00
{
app/plug-in/Makefile.am app/plug-in/plug-in-types.h removed... 2006-04-06 Michael Natterer <mitch@gimp.org> * app/plug-in/Makefile.am * app/plug-in/plug-in-types.h * app/plug-in/plug-in-proc-def.[ch]: removed... * app/pdb/Makefile.am * app/pdb/pdb-types.h * app/pdb/gimppluginprocedure.[ch]: ...and added here. Virtualized get_progname(). * app/pdb/gimptemporaryprocedure.[ch]: new class derived from GimpPlugInProcedure. * app/pdb/gimpprocedure.[ch] (struct GimpProcedure): remove union exec_method and all the structs it needed. Procedure execution is properly virtualized now. Removed gimp_procedure_initialize() and grow the args and values arrays dynamically in gimp_procedure_add_argument()/return_value(). Added marshal_func parameter to gimp_procedure_new(). * app/actions/plug-in-actions.c * app/actions/plug-in-commands.c * app/core/gimp-gui.c * app/dialogs/file-save-dialog.c * app/file/file-open.c * app/file/file-save.c * app/file/file-utils.c * app/gui/gui-vtable.c * app/menus/plug-in-menus.c * app/plug-in/plug-in-def.c * app/plug-in/plug-in-message.c * app/plug-in/plug-in-progress.c * app/plug-in/plug-in-rc.c * app/plug-in/plug-in-run.c * app/plug-in/plug-in.c * app/plug-in/plug-ins-query.c * app/plug-in/plug-ins.c * app/widgets/gimpfiledialog.c * app/widgets/gimpfileprocview.c * app/widgets/gimppluginaction.c * app/xcf/xcf.c * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/plug_in.pdb * tools/pdbgen/app.pl: changed accordingly. * app/pdb/*_cmds.c: regenerated. * app/pdb/gimp-pdb.c: added uglyness to make the app link again.
2006-04-06 18:01:30 +08:00
GimpObject parent_instance;
GimpPDBProcType proc_type; /* Type of procedure */
gboolean static_strings; /* Are the strings allocated? */
gchar *original_name; /* Uncanonicalized procedure name */
gchar *blurb; /* Short procedure description */
gchar *help; /* Detailed help instructions */
gchar *author; /* Author field */
gchar *copyright; /* Copyright field */
gchar *date; /* Date field */
gchar *deprecated; /* Replacement if deprecated */
gint32 num_args; /* Number of procedure arguments */
GParamSpec **args; /* Array of procedure arguments */
gint32 num_values; /* Number of return values */
GParamSpec **values; /* Array of return values */
GimpMarshalFunc marshal_func; /* Marshaller for internal procs */
1997-11-25 06:05:25 +08:00
};
struct _GimpProcedureClass
{
GimpObjectClass parent_class;
GimpValueArray * (* execute) (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
GimpValueArray *args,
GError **error);
void (* execute_async) (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
GimpValueArray *args,
GimpObject *display);
};
These changes enable help support for 3rd party plug-ins which install 2000-05-21 Michael Natterer <mitch@gimp.org> These changes enable help support for 3rd party plug-ins which install their help files outside GIMP's main help dir. Instead of calling gimp_help(), gimp_plugin_help_func() etc., all help callbacks now have to call gimp_standard_help_func() which has different implementations in the app and in libgimp. There is a new function gimp_plugin_help_register() which can be called during plug-in query. plug_in.c keeps a list of executable_name/help_path pairs. Plug-ins have to pass their exec. name to gimp_help() which uses the list to find the plug-in's help directory. * app/gimphelp.[ch]: gimp_help() now takes a help_path parameter. help_path == NULL means the standard help directory. Various changes to pass the help_path to the help browser. * app/gimprc.c: save the plug-in's help_path in the pluginrc file. * app/menus.c: ugly hack to enable help_paths in the "F1" callback. * app/plug_in.[ch]: many help_path related changes. Use g_basename() instead of strrchr(str,G_DIR_SEPARATOR), cosmetic cleanups. * app/internal_procs.c * app/gimphelp_cmds.c * tools/pdbgen/pdb/gimphelp.pdb: new procedure gimp_plugin_help_register(). gimp_help() takes a second parameter which is the executable name (not the help_path). * app/color_notebook.c * app/commands.c * app/lc_dialog.c * app/preferences_dialog.c * app/tools.c: call gimp_standard_help_func() instead of gimp_help(). * libgimp/gimp.c: new function gimp_get_progname() which returns the full path of the plug-in's executable. * libgimp/gimp.h: export the new function, removed gimp_plugin_help_func(), gimp_help() takes the executable name as second parameter. * libgimp/gimpcompat.h: added gimp_plugin_help_func(). * libgimp/gimphelp.c: a wrapper for gimp_plugin_help_register(), changed the calls to gimp_help. * libgimp/gimphelpui.[ch]: call gimp_standard_help_func() instead of gimp_help(). * plug-ins/helpbrowser/helpbrowser.c: now called with an additional help_path parameter. Various changes to enable help_path != gimp_standard_help_path. Unrelated stuff: * app/batch.h: added missing GPL header. * app/gimpunit.c: had a LGPL header, merged some fprintf's into one call. * app/procedural_db.[ch]: cosmetic: g* types, s/g_malloc/g_new/, prototypes, indentation. * app/resize.c: use less packing widgets. didn't find the "offset" redraw bug :(
2000-05-22 01:41:02 +08:00
GType gimp_procedure_get_type (void) G_GNUC_CONST;
GimpProcedure * gimp_procedure_new (GimpMarshalFunc marshal_func);
void gimp_procedure_set_strings (GimpProcedure *procedure,
const gchar *original_name,
const gchar *blurb,
const gchar *help,
const gchar *author,
const gchar *copyright,
const gchar *date,
const gchar *deprecated);
void gimp_procedure_set_static_strings (GimpProcedure *procedure,
const gchar *original_name,
const gchar *blurb,
const gchar *help,
const gchar *author,
const gchar *copyright,
const gchar *date,
const gchar *deprecated);
void gimp_procedure_take_strings (GimpProcedure *procedure,
gchar *original_name,
gchar *blurb,
gchar *help,
gchar *author,
gchar *copyright,
gchar *date,
gchar *deprecated);
void gimp_procedure_add_argument (GimpProcedure *procedure,
GParamSpec *pspec);
void gimp_procedure_add_return_value (GimpProcedure *procedure,
GParamSpec *pspec);
GimpValueArray * gimp_procedure_get_arguments (GimpProcedure *procedure);
GimpValueArray * gimp_procedure_get_return_values (GimpProcedure *procedure,
gboolean success,
const GError *error);
GimpProcedure * gimp_procedure_create_override (GimpProcedure *procedure,
GimpMarshalFunc new_marshal_func);
GimpValueArray * gimp_procedure_execute (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
GimpValueArray *args,
GError **error);
void gimp_procedure_execute_async (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
GimpValueArray *args,
GimpObject *display,
GError **error);
gint gimp_procedure_name_compare (GimpProcedure *proc1,
GimpProcedure *proc2);
2011-05-05 06:08:37 +08:00
#endif /* __GIMP_PROCEDURE_H__ */