From 77863d8868663a02dd8da052c80b5cfc96e75125 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Sat, 1 Dec 2001 00:14:14 +0000 Subject: [PATCH] app/Makefile.am removed... 2001-11-30 Michael Natterer * app/Makefile.am * app/plug_in.[ch]: removed... * app/plug-in/Makefile.am * app/plug-in/plug-in-types.h * app/plug-in/plug-in.[ch]: ...and added here. * app/appenv.h: removed StackTraceMode and MessageHandlerType... * libgimpbase/gimpbasetypes.h: ...and added them here. * tools/pdbgen/Makefile.am: don't scan "app/apptypes.h" for enums. * tools/pdbgen/enumcode.pl: added a general check to prevent enums which are defined in libgimp* from being written to "libgimp/gimpenums.c". * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated. * app/core/core-types.h: include "pdb/pdb-types.h" so including "core/core-types.h" gets the whole core type space. * app/core/gimp.[ch]: added a "stack_trace_mode" parameter to the constructor and store it in the Gimp struct because the value is also passed to plug-ins and nobody should include "appenv.h". * app/gimprc.[ch]: pass the alternate_system_gimprc and alternate_gimprc filenames from the command line to gimprc_prase() so we don't need to include "appenv.h". * app/batch.[ch]: pass the "batch_cmds" as parameter, don't include "append.h". * app/app_procs.c: pass more parameters around. * app/devices.c * app/errors.c * app/gimphelp.c * app/main.c * app/core/gimpgradient.c * app/display/gimpdisplay.c * app/display/gimpdisplayshell.c * app/file/file-open.c * app/file/file-save.c * app/file/file-utils.c * app/gui/commands.c * app/gui/error-console-dialog.c * app/gui/file-dialog-utils.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/paths-dialog.c * app/gui/user-install-dialog.c * app/tools/gimpbezierselecttool.c * app/tools/xinput_airbrush.c * app/xcf/xcf.c * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/help.pdb * tools/pdbgen/pdb/message.pdb * tools/pdbgen/pdb/plug_in.pdb: changed accordingly: - changed "plug-in.h" include where needed. - don't call gimp_fatal_error() directly, it's called via the log handler when calling g_error(). - don't incude "errors.h" except from main.c. - changed stack_trace and message_handler enum names. - get "stack_trace_mode" from Gimp. - removed many inclusions of "appenv.h". * app/pdb/fileops_cmds.c * app/pdb/help_cmds.c * app/pdb/message_cmds.c * app/pdb/plug_in_cmds.c * app/pdb/procedural_db.c: regenerated. --- ChangeLog | 78 + app/Makefile.am | 8 - app/actions/help-commands.c | 4 +- app/actions/plug-in-commands.c | 21 +- app/app_procs.c | 21 +- app/appenv.h | 43 +- app/batch.c | 4 +- app/batch.h | 3 +- app/core/core-types.h | 1 + app/core/gimp.c | 15 +- app/core/gimp.h | 4 +- app/core/gimpgradient.c | 2 - app/core/gimpprojection.c | 1 - app/devices.c | 7 +- app/dialogs/file-dialog-utils.c | 4 +- app/dialogs/file-open-dialog.c | 3 +- app/dialogs/file-save-dialog.c | 3 +- app/dialogs/user-install-dialog.c | 2 +- app/display/gimpdisplay.c | 1 - app/display/gimpdisplayshell-draw.c | 6 +- app/display/gimpdisplayshell.c | 6 +- app/errors.c | 16 +- app/file/file-open.c | 5 +- app/file/file-save.c | 5 +- app/file/file-utils.c | 6 +- app/gimphelp.c | 13 +- app/gimprc.c | 23 +- app/gimprc.h | 4 +- app/gui/commands.c | 4 +- app/gui/device-status-dialog.c | 7 +- app/gui/error-console-dialog.c | 6 +- app/gui/file-dialog-utils.c | 4 +- app/gui/file-open-dialog.c | 3 +- app/gui/file-save-dialog.c | 3 +- app/gui/help-commands.c | 4 +- app/gui/input-dialog.c | 7 +- app/gui/paths-dialog.c | 7 +- app/gui/plug-in-commands.c | 21 +- app/gui/plug-in-menus.c | 21 +- app/gui/user-install-dialog.c | 2 +- app/main.c | 53 +- app/menus/plug-in-menus.c | 21 +- app/pdb/fileops_cmds.c | 2 +- app/pdb/gimp-pdb.c | 2 +- app/pdb/gimppdb.c | 2 +- app/pdb/gimpprocedure.c | 2 +- app/pdb/help_cmds.c | 2 +- app/pdb/message_cmds.c | 4 +- app/pdb/plug_in_cmds.c | 2 +- app/pdb/procedural_db.c | 2 +- app/plug-in/Makefile.am | 4 +- app/plug-in/gimpplugin-message.c | 21 +- app/plug-in/gimpplugin-progress.c | 21 +- app/plug-in/gimpplugin-progress.h | 7 +- app/plug-in/gimpplugin.c | 21 +- app/plug-in/gimpplugin.h | 7 +- app/plug-in/gimppluginmanager-call.c | 21 +- app/plug-in/gimppluginmanager-run.c | 21 +- app/plug-in/gimppluginmanager.c | 21 +- app/plug-in/gimppluginmanager.h | 7 +- app/plug-in/gimppluginshm.c | 21 +- app/plug-in/plug-in-def.c | 21 +- app/plug-in/plug-in-def.h | 7 +- app/plug-in/plug-in-message.c | 21 +- app/plug-in/plug-in-params.c | 21 +- app/plug-in/plug-in-params.h | 7 +- app/plug-in/plug-in-progress.c | 21 +- app/plug-in/plug-in-progress.h | 7 +- app/plug-in/plug-in-run.c | 21 +- app/plug-in/plug-in-shm.c | 21 +- app/plug-in/plug-in-types.h | 1 - app/plug-in/plug-in.c | 21 +- app/plug-in/plug-in.h | 7 +- app/plug-in/plug-ins.c | 21 +- app/plug-in/plug-ins.h | 7 +- app/plug_in.c | 3773 ---------------------- app/plug_in.h | 196 -- app/tools/gimpbezierselecttool.c | 25 +- app/tools/xinput_airbrush.c | 2 - app/widgets/gimpdeviceinfo.c | 7 +- app/widgets/gimpdevices.c | 7 +- app/widgets/gimphelp.c | 13 +- app/xcf/xcf.c | 6 +- libgimp/gimpenums.h | 14 - libgimpbase/gimpbasetypes.h | 14 + plug-ins/script-fu/script-fu-constants.c | 16 +- po/ChangeLog | 4 + po/POTFILES.in | 3 +- tools/pdbgen/Makefile.am | 21 +- tools/pdbgen/enumcode.pl | 2 +- tools/pdbgen/enums.pl | 32 +- tools/pdbgen/pdb/fileops.pdb | 4 +- tools/pdbgen/pdb/help.pdb | 2 +- tools/pdbgen/pdb/message.pdb | 4 +- tools/pdbgen/pdb/plug_in.pdb | 6 +- 95 files changed, 559 insertions(+), 4458 deletions(-) delete mode 100644 app/plug_in.c delete mode 100644 app/plug_in.h diff --git a/ChangeLog b/ChangeLog index 9ca3a83e42..cf3c2862b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,81 @@ +2001-11-30 Michael Natterer + + * app/Makefile.am + * app/plug_in.[ch]: removed... + + * app/plug-in/Makefile.am + * app/plug-in/plug-in-types.h + * app/plug-in/plug-in.[ch]: ...and added here. + + * app/appenv.h: removed StackTraceMode and MessageHandlerType... + + * libgimpbase/gimpbasetypes.h: ...and added them here. + + * tools/pdbgen/Makefile.am: don't scan "app/apptypes.h" for enums. + + * tools/pdbgen/enumcode.pl: added a general check to prevent + enums which are defined in libgimp* from being written to + "libgimp/gimpenums.c". + + * libgimp/gimpenums.h + * plug-ins/script-fu/script-fu-constants.c + * tools/pdbgen/enums.pl: regenerated. + + * app/core/core-types.h: include "pdb/pdb-types.h" so including + "core/core-types.h" gets the whole core type space. + + * app/core/gimp.[ch]: added a "stack_trace_mode" parameter to the + constructor and store it in the Gimp struct because the value is + also passed to plug-ins and nobody should include "appenv.h". + + * app/gimprc.[ch]: pass the alternate_system_gimprc and + alternate_gimprc filenames from the command line to gimprc_prase() + so we don't need to include "appenv.h". + + * app/batch.[ch]: pass the "batch_cmds" as parameter, don't + include "append.h". + + * app/app_procs.c: pass more parameters around. + + * app/devices.c + * app/errors.c + * app/gimphelp.c + * app/main.c + * app/core/gimpgradient.c + * app/display/gimpdisplay.c + * app/display/gimpdisplayshell.c + * app/file/file-open.c + * app/file/file-save.c + * app/file/file-utils.c + * app/gui/commands.c + * app/gui/error-console-dialog.c + * app/gui/file-dialog-utils.c + * app/gui/file-open-dialog.c + * app/gui/file-save-dialog.c + * app/gui/paths-dialog.c + * app/gui/user-install-dialog.c + * app/tools/gimpbezierselecttool.c + * app/tools/xinput_airbrush.c + * app/xcf/xcf.c + * tools/pdbgen/pdb/fileops.pdb + * tools/pdbgen/pdb/help.pdb + * tools/pdbgen/pdb/message.pdb + * tools/pdbgen/pdb/plug_in.pdb: changed accordingly: + + - changed "plug-in.h" include where needed. + - don't call gimp_fatal_error() directly, it's called via the log + handler when calling g_error(). + - don't incude "errors.h" except from main.c. + - changed stack_trace and message_handler enum names. + - get "stack_trace_mode" from Gimp. + - removed many inclusions of "appenv.h". + + * app/pdb/fileops_cmds.c + * app/pdb/help_cmds.c + * app/pdb/message_cmds.c + * app/pdb/plug_in_cmds.c + * app/pdb/procedural_db.c: regenerated. + 2001-11-30 Michael Natterer * app/display/Makefile.am diff --git a/app/Makefile.am b/app/Makefile.am index ae50991e03..8f82a31d8e 100644 --- a/app/Makefile.am +++ b/app/Makefile.am @@ -57,13 +57,6 @@ config_sources = \ gimprc.c \ gimprc.h -## -## stuff for plug-in/ -## -plug_in_sources = \ - plug_in.c \ - plug_in.h - ## ## stuff which is about to be replaced by new subsystems ## @@ -101,7 +94,6 @@ gimp_1_3_SOURCES = @STRIP_BEGIN@ \ $(core_ui_sources) \ $(core_sources) \ $(config_sources) \ - $(plug_in_sources) \ $(bye_sources) \ $(stuff_sources) \ @STRIP_END@ diff --git a/app/actions/help-commands.c b/app/actions/help-commands.c index 6d82a2aeaf..2a2d42f7e8 100644 --- a/app/actions/help-commands.c +++ b/app/actions/help-commands.c @@ -24,9 +24,9 @@ #include "core/core-types.h" -#include "commands.h" +#include "plug-in/plug-in.h" -#include "plug_in.h" +#include "commands.h" /***** Filters *****/ diff --git a/app/actions/plug-in-commands.c b/app/actions/plug-in-commands.c index e85060d12b..c2e0e21c9f 100644 --- a/app/actions/plug-in-commands.c +++ b/app/actions/plug-in-commands.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "display/display-types.h" +#include "plug-in-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -96,6 +96,8 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "widgets/widgets-types.h" + #include "widgets/gimpitemfactory.h" #include "display/gimpdisplay.h" @@ -104,12 +106,11 @@ #include "gui/gradient-select.h" #include "gui/pattern-select.h" +#include "plug-in.h" + #include "app_procs.h" -#include "appenv.h" -#include "errors.h" #include "gimpprogress.h" #include "gimprc.h" -#include "plug_in.h" #include "libgimp/gimpintl.h" @@ -382,7 +383,7 @@ plug_in_init (Gimp *gimp, { write_pluginrc = TRUE; - if (be_verbose) + if (gimp->be_verbose) g_print (_("query plug-in: \"%s\"\n"), plug_in_def->prog); plug_in_query (plug_in_def); @@ -422,7 +423,7 @@ plug_in_init (Gimp *gimp, /* write the pluginrc file if necessary */ if (write_pluginrc) { - if (be_verbose) + if (gimp->be_verbose) g_print (_("writing \"%s\"\n"), filename); plug_in_write_rc (filename); @@ -440,7 +441,7 @@ plug_in_init (Gimp *gimp, } /* run the available extensions */ - if (be_verbose) + if (gimp->be_verbose) g_print (_("Starting extensions: ")); (* status_callback) (_("Extensions"), "", 0); @@ -457,7 +458,7 @@ plug_in_init (Gimp *gimp, (proc_def->db_info.num_args == 0) && (proc_def->db_info.proc_type == GIMP_EXTENSION)) { - if (be_verbose) + if (gimp->be_verbose) g_print ("%s ", proc_def->db_info.name); (* status_callback) (NULL, proc_def->db_info.name, nth / nplugins); @@ -466,7 +467,7 @@ plug_in_init (Gimp *gimp, } } - if (be_verbose) + if (gimp->be_verbose) g_print ("\n"); /* create help path list and free up stuff */ @@ -1087,7 +1088,7 @@ plug_in_open (PlugIn *plug_in) plug_in->args[4] = g_strdup ("-run"); } - plug_in->args[5] = g_strdup_printf ("%d", (gint) stack_trace_mode); + plug_in->args[5] = g_strdup_printf ("%d", the_gimp->stack_trace_mode); /* Fork another process. We'll remember the process id * so that we can later use it to kill the filter if diff --git a/app/app_procs.c b/app/app_procs.c index f29283cf3e..747b923cfa 100644 --- a/app/app_procs.c +++ b/app/app_procs.c @@ -41,6 +41,8 @@ #include "core/gimpdatafactory.h" #include "core/gimpunit.h" +#include "plug-in/plug-in.h" + #include "file/file-open.h" #include "display/gimpdisplay-foreach.h" @@ -54,15 +56,9 @@ #include "appenv.h" #include "app_procs.h" #include "batch.h" -#include "errors.h" #include "gimprc.h" -#include "plug_in.h" #include "undo.h" -#ifdef DISPLAY_FILTERS -#include "gdisplay_color.h" -#endif /* DISPLAY_FILTERS */ - #include "libgimp/gimpintl.h" @@ -91,7 +87,10 @@ app_init (gint gimp_argc, /* Create an instance of the "Gimp" object which is the root of the * core object system */ - the_gimp = gimp_new (be_verbose, no_data, no_interface); + the_gimp = gimp_new (be_verbose, + no_data, + no_interface, + stack_trace_mode); /* Check if the user's gimp_directory exists */ @@ -124,7 +123,7 @@ app_init (gint gimp_argc, gimp_unitrc_load (the_gimp); /* parse the local GIMP configuration file */ - gimprc_parse (the_gimp); + gimprc_parse (the_gimp, alternate_system_gimprc, alternate_gimprc); } /* initialize lowlevel stuff */ @@ -167,7 +166,7 @@ app_init (gint gimp_argc, splash_destroy (); /* FIXME: This needs to go in preferences */ - message_handler = MESSAGE_BOX; + message_handler = GIMP_MESSAGE_BOX; gui_restore (the_gimp, restore_session); } @@ -187,7 +186,7 @@ app_init (gint gimp_argc, } } - batch_init (the_gimp); + batch_init (the_gimp, batch_cmds); if (! no_interface) { @@ -224,7 +223,7 @@ app_init_update_status (const gchar *text1, static void app_exit_finish (void) { - message_handler = CONSOLE; + message_handler = GIMP_CONSOLE; if (! no_interface) { diff --git a/app/appenv.h b/app/appenv.h index d0acd8838c..85c902f911 100644 --- a/app/appenv.h +++ b/app/appenv.h @@ -20,38 +20,23 @@ #define __APPENV_H__ -typedef enum -{ - MESSAGE_BOX, - CONSOLE, - ERROR_CONSOLE -} MessageHandlerType; - -typedef enum -{ - STACK_TRACE_NEVER, - STACK_TRACE_QUERY, - STACK_TRACE_ALWAYS -} StackTraceMode; - - /* command line options */ -extern gboolean no_interface; -extern gboolean no_splash; -extern gboolean no_splash_image; -extern gboolean no_data; -extern gboolean be_verbose; -extern gboolean use_debug_handler; -extern gboolean console_messages; -extern gboolean restore_session; -extern StackTraceMode stack_trace_mode; -extern gchar *alternate_gimprc; -extern gchar *alternate_system_gimprc; -extern gchar **batch_cmds; +extern gboolean no_interface; +extern gboolean no_splash; +extern gboolean no_splash_image; +extern gboolean no_data; +extern gboolean be_verbose; +extern gboolean use_debug_handler; +extern gboolean console_messages; +extern gboolean restore_session; +extern GimpStackTraceMode stack_trace_mode; +extern gchar *alternate_gimprc; +extern gchar *alternate_system_gimprc; +extern gchar **batch_cmds; /* other global variables */ -extern gchar *prog_name; -extern MessageHandlerType message_handler; +extern gchar *prog_name; +extern GimpMessageHandlerType message_handler; #endif /* __APPENV_H__ */ diff --git a/app/batch.c b/app/batch.c index f951ac43d8..0765885066 100644 --- a/app/batch.c +++ b/app/batch.c @@ -31,7 +31,6 @@ #include "core/core-types.h" -#include "appenv.h" #include "app_procs.h" #include "batch.h" @@ -50,7 +49,8 @@ static ProcRecord *eval_proc; void -batch_init (Gimp *gimp) +batch_init (Gimp *gimp, + gchar **batch_cmds) { gboolean read_from_stdin = FALSE; gboolean perl_server_already_running = FALSE; diff --git a/app/batch.h b/app/batch.h index 57da6e70cb..6f84a28475 100644 --- a/app/batch.h +++ b/app/batch.h @@ -20,7 +20,8 @@ #define __BATCH_H__ -void batch_init (Gimp *gimp); +void batch_init (Gimp *gimp, + gchar **batch_cmds); #endif /* __BATCH_H__ */ diff --git a/app/core/core-types.h b/app/core/core-types.h index 1d2e8ff988..ccf65e6632 100644 --- a/app/core/core-types.h +++ b/app/core/core-types.h @@ -24,6 +24,7 @@ #include "libgimpmath/gimpmath.h" #include "base/base-types.h" +#include "pdb/pdb-types.h" #include "plug-in/plug-in-types.h" #include "undo_types.h" /* EEK */ diff --git a/app/core/gimp.c b/app/core/gimp.c index b4f9b82606..8a4bd8b514 100644 --- a/app/core/gimp.c +++ b/app/core/gimp.c @@ -120,6 +120,7 @@ gimp_init (Gimp *gimp) gimp->be_verbose = FALSE; gimp->no_data = FALSE; gimp->no_interface = FALSE; + gimp->stack_trace_mode = GIMP_STACK_TRACE_NEVER; gimp->main_loops = NULL; @@ -320,17 +321,19 @@ gimp_finalize (GObject *object) } Gimp * -gimp_new (gboolean be_verbose, - gboolean no_data, - gboolean no_interface) +gimp_new (gboolean be_verbose, + gboolean no_data, + gboolean no_interface, + GimpStackTraceMode stack_trace_mode) { Gimp *gimp; gimp = g_object_new (GIMP_TYPE_GIMP, NULL); - gimp->be_verbose = be_verbose ? TRUE : FALSE; - gimp->no_data = no_data ? TRUE : FALSE; - gimp->no_interface = no_interface ? TRUE : FALSE; + gimp->be_verbose = be_verbose ? TRUE : FALSE; + gimp->no_data = no_data ? TRUE : FALSE; + gimp->no_interface = no_interface ? TRUE : FALSE; + gimp->stack_trace_mode = stack_trace_mode; return gimp; } diff --git a/app/core/gimp.h b/app/core/gimp.h index 3456c57a6d..b14e7b083e 100644 --- a/app/core/gimp.h +++ b/app/core/gimp.h @@ -49,6 +49,7 @@ struct _Gimp gboolean be_verbose; gboolean no_data; gboolean no_interface; + GimpStackTraceMode stack_trace_mode; GList *main_loops; @@ -128,7 +129,8 @@ GType gimp_get_type (void) G_GNUC_CONST; Gimp * gimp_new (gboolean be_verbose, gboolean no_data, - gboolean no_interface); + gboolean no_interface, + GimpStackTraceMode stack_trace_mode); void gimp_initialize (Gimp *gimp, GimpInitStatusFunc status_callback); diff --git a/app/core/gimpgradient.c b/app/core/gimpgradient.c index 323da99e90..82f66b236f 100644 --- a/app/core/gimpgradient.c +++ b/app/core/gimpgradient.c @@ -36,8 +36,6 @@ #include "gimpimage.h" #include "gimpgradient.h" -#include "errors.h" - #include "libgimp/gimpintl.h" diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c index 11a1d51bec..7fe1d87bfd 100644 --- a/app/core/gimpprojection.c +++ b/app/core/gimpprojection.c @@ -44,7 +44,6 @@ #include "gimprc.h" #include "nav_window.h" -#include "plug_in.h" #include "libgimp/gimpintl.h" diff --git a/app/devices.c b/app/devices.c index bf499214df..cebcb08048 100644 --- a/app/devices.c +++ b/app/devices.c @@ -41,7 +41,6 @@ #include "widgets/gimpdnd.h" #include "widgets/gimppreview.h" -#include "appenv.h" #include "app_procs.h" #include "devices.h" #include "gimprc.h" @@ -464,7 +463,7 @@ devices_rc_update (gchar *name, { gimp_context_set_brush (device_info->context, brush); } - else if (no_data) + else if (the_gimp->no_data) { g_free (device_info->context->brush_name); device_info->context->brush_name = g_strdup (brush_name); @@ -483,7 +482,7 @@ devices_rc_update (gchar *name, { gimp_context_set_pattern (device_info->context, pattern); } - else if (no_data) + else if (the_gimp->no_data) { g_free (device_info->context->pattern_name); device_info->context->pattern_name = g_strdup (pattern_name); @@ -502,7 +501,7 @@ devices_rc_update (gchar *name, { gimp_context_set_gradient (device_info->context, gradient); } - else if (no_data) + else if (the_gimp->no_data) { g_free (device_info->context->gradient_name); device_info->context->gradient_name = g_strdup (gradient_name); diff --git a/app/dialogs/file-dialog-utils.c b/app/dialogs/file-dialog-utils.c index bc14b4cf83..23b2e13d35 100644 --- a/app/dialogs/file-dialog-utils.c +++ b/app/dialogs/file-dialog-utils.c @@ -25,9 +25,11 @@ #include "gui-types.h" +#include "plug-in/plug-in.h" + #include "widgets/gimpitemfactory.h" -#include "plug_in.h" +#include "file-dialog-utils.h" void diff --git a/app/dialogs/file-open-dialog.c b/app/dialogs/file-open-dialog.c index d969467c45..b0d57cea83 100644 --- a/app/dialogs/file-open-dialog.c +++ b/app/dialogs/file-open-dialog.c @@ -48,6 +48,8 @@ #include "core/gimpdocuments.h" #include "core/gimpimage.h" +#include "plug-in/plug-in.h" + #include "file/file-open.h" #include "file/file-utils.h" @@ -56,7 +58,6 @@ #include "file-dialog-utils.h" #include "file-open-dialog.h" -#include "plug_in.h" #include "undo.h" #include "libgimp/gimpintl.h" diff --git a/app/dialogs/file-save-dialog.c b/app/dialogs/file-save-dialog.c index 0d58d378c4..374b4794b0 100644 --- a/app/dialogs/file-save-dialog.c +++ b/app/dialogs/file-save-dialog.c @@ -38,6 +38,8 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "plug-in/plug-in.h" + #include "file/file-save.h" #include "file/file-utils.h" @@ -47,7 +49,6 @@ #include "file-save-dialog.h" #include "gimprc.h" -#include "plug_in.h" #include "undo.h" #include "libgimp/gimpintl.h" diff --git a/app/dialogs/user-install-dialog.c b/app/dialogs/user-install-dialog.c index 58c6de387b..d7936f9b67 100644 --- a/app/dialogs/user-install-dialog.c +++ b/app/dialogs/user-install-dialog.c @@ -352,7 +352,7 @@ user_install_continue_callback (GtkWidget *widget, #endif gimprc_init (gimp); gimp_unitrc_load (gimp); - gimprc_parse (gimp); + gimprc_parse (gimp, alternate_system_gimprc, alternate_gimprc); user_install_tuning (); break; diff --git a/app/display/gimpdisplay.c b/app/display/gimpdisplay.c index 11a1d51bec..7fe1d87bfd 100644 --- a/app/display/gimpdisplay.c +++ b/app/display/gimpdisplay.c @@ -44,7 +44,6 @@ #include "gimprc.h" #include "nav_window.h" -#include "plug_in.h" #include "libgimp/gimpintl.h" diff --git a/app/display/gimpdisplayshell-draw.c b/app/display/gimpdisplayshell-draw.c index 53a83eb4a2..b84c6e6fe9 100644 --- a/app/display/gimpdisplayshell-draw.c +++ b/app/display/gimpdisplayshell-draw.c @@ -25,7 +25,6 @@ #include "libgimpwidgets/gimpwidgets.h" #include "display-types.h" -#include "gui/gui-types.h" /* FIXME */ #include "base/temp-buf.h" @@ -40,12 +39,16 @@ #include "core/gimplayermask.h" #include "core/gimppattern.h" +#include "plug-in/plug-in.h" + #include "widgets/gimpcolorpanel.h" #include "widgets/gimpcursor.h" #include "widgets/gimpdnd.h" #include "widgets/gimpitemfactory.h" #include "widgets/gimpwidgets-utils.h" +#include "gui/gui-types.h" /* FIXME */ + #include "gui/info-window.h" #include "tools/tools-types.h" @@ -63,7 +66,6 @@ #include "gimprc.h" #include "nav_window.h" -#include "plug_in.h" #include "undo.h" #ifdef DISPLAY_FILTERS diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c index 53a83eb4a2..b84c6e6fe9 100644 --- a/app/display/gimpdisplayshell.c +++ b/app/display/gimpdisplayshell.c @@ -25,7 +25,6 @@ #include "libgimpwidgets/gimpwidgets.h" #include "display-types.h" -#include "gui/gui-types.h" /* FIXME */ #include "base/temp-buf.h" @@ -40,12 +39,16 @@ #include "core/gimplayermask.h" #include "core/gimppattern.h" +#include "plug-in/plug-in.h" + #include "widgets/gimpcolorpanel.h" #include "widgets/gimpcursor.h" #include "widgets/gimpdnd.h" #include "widgets/gimpitemfactory.h" #include "widgets/gimpwidgets-utils.h" +#include "gui/gui-types.h" /* FIXME */ + #include "gui/info-window.h" #include "tools/tools-types.h" @@ -63,7 +66,6 @@ #include "gimprc.h" #include "nav_window.h" -#include "plug_in.h" #include "undo.h" #ifdef DISPLAY_FILTERS diff --git a/app/errors.c b/app/errors.c index 6b0abbd954..781ac472fb 100644 --- a/app/errors.c +++ b/app/errors.c @@ -54,11 +54,11 @@ gimp_message_log_func (const gchar *log_domain, { switch (message_handler) { - case MESSAGE_BOX: + case GIMP_MESSAGE_BOX: gimp_message_box ((gchar *) message, NULL, NULL); break; - case ERROR_CONSOLE: + case GIMP_ERROR_CONSOLE: gimp_dialog_factory_dialog_raise (global_dock_factory, "gimp:error-console", -1); error_console_add ((gchar *) message); @@ -100,10 +100,10 @@ gimp_fatal_error (const gchar *fmt, ...) switch (stack_trace_mode) { - case STACK_TRACE_NEVER: + case GIMP_STACK_TRACE_NEVER: break; - case STACK_TRACE_QUERY: + case GIMP_STACK_TRACE_QUERY: { sigset_t sigset; @@ -113,7 +113,7 @@ gimp_fatal_error (const gchar *fmt, ...) } break; - case STACK_TRACE_ALWAYS: + case GIMP_STACK_TRACE_ALWAYS: { sigset_t sigset; @@ -156,10 +156,10 @@ gimp_terminate (const gchar *fmt, ...) { switch (stack_trace_mode) { - case STACK_TRACE_NEVER: + case GIMP_STACK_TRACE_NEVER: break; - case STACK_TRACE_QUERY: + case GIMP_STACK_TRACE_QUERY: { sigset_t sigset; @@ -169,7 +169,7 @@ gimp_terminate (const gchar *fmt, ...) } break; - case STACK_TRACE_ALWAYS: + case GIMP_STACK_TRACE_ALWAYS: { sigset_t sigset; diff --git a/app/file/file-open.c b/app/file/file-open.c index be44ca1417..aad2caf8e4 100644 --- a/app/file/file-open.c +++ b/app/file/file-open.c @@ -41,10 +41,13 @@ #include "core/gimpimage.h" #include "core/gimpdocuments.h" +#include "pdb/procedural_db.h" + +#include "plug-in/plug-in.h" + #include "file-open.h" #include "file-utils.h" -#include "plug_in.h" #include "undo.h" #include "libgimp/gimpintl.h" diff --git a/app/file/file-save.c b/app/file/file-save.c index 207d95f7b0..6b3e59c9d8 100644 --- a/app/file/file-save.c +++ b/app/file/file-save.c @@ -43,10 +43,13 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "pdb/procedural_db.h" + +#include "plug-in/plug-in.h" + #include "file-save.h" #include "file-utils.h" -#include "plug_in.h" #include "undo.h" #include "libgimp/gimpintl.h" diff --git a/app/file/file-utils.c b/app/file/file-utils.c index bf117156c2..b3260f5f1a 100644 --- a/app/file/file-utils.c +++ b/app/file/file-utils.c @@ -50,9 +50,11 @@ #include "core/gimpimage.h" -#include "file-utils.h" +#include "pdb/procedural_db.h" -#include "plug_in.h" +#include "plug-in/plug-in.h" + +#include "file-utils.h" static PlugInProcDef * diff --git a/app/gimphelp.c b/app/gimphelp.c index 299140cc4f..1f7d50f728 100644 --- a/app/gimphelp.c +++ b/app/gimphelp.c @@ -34,10 +34,11 @@ #include "core/core-types.h" +#include "plug-in/plug-in.h" + #include "app_procs.h" #include "gimphelp.h" #include "gimprc.h" -#include "plug_in.h" #include "libgimp/gimpintl.h" @@ -54,7 +55,9 @@ struct _GimpIdleHelp gchar *help_data; }; + /* local function prototypes */ + static gint gimp_idle_help (gpointer data); static gboolean gimp_help_internal (const gchar *help_path, const gchar *current_locale, @@ -63,9 +66,8 @@ static void gimp_help_netscape (const gchar *help_path, const gchar *current_locale, const gchar *help_data); -/**********************/ + /* public functions */ -/**********************/ /* The standard help function */ void @@ -95,9 +97,8 @@ gimp_help (const gchar *help_path, } } -/*********************/ -/* local functions */ -/*********************/ + +/* private functions */ static gboolean gimp_idle_help (gpointer data) diff --git a/app/gimprc.c b/app/gimprc.c index 2350492fd3..e3aebfabc8 100644 --- a/app/gimprc.c +++ b/app/gimprc.c @@ -47,21 +47,20 @@ #include "core/gimpparasite.h" #include "core/gimptoolinfo.h" -#include "tools/gimptool.h" +#include "plug-in/plug-in.h" #include "widgets/gimpdialogfactory.h" +#include "tools/gimptool.h" + #include "gui/color-notebook.h" #include "gui/menus.h" #include "app_procs.h" -#include "appenv.h" #include "devices.h" -#include "errors.h" #include "general.h" #include "gimphelp.h" #include "gimprc.h" -#include "plug_in.h" #include "libgimp/gimpintl.h" @@ -455,23 +454,25 @@ parse_add_directory_tokens (void) } void -gimprc_parse (Gimp *gimp) +gimprc_parse (Gimp *gimp, + const gchar *cmdline_system_gimprc, + const gchar *cmdline_gimprc) { gchar *libfilename; gchar *filename; parse_add_directory_tokens (); - if (alternate_system_gimprc) - libfilename = g_strdup (alternate_system_gimprc); + if (cmdline_system_gimprc) + libfilename = g_strdup (cmdline_system_gimprc); else libfilename = g_strdup (gimp_system_rc_file ()); if (! gimprc_parse_file (libfilename)) g_message ("Can't open '%s' for reading.", libfilename); - if (alternate_gimprc != NULL) - filename = g_strdup (alternate_gimprc); + if (cmdline_gimprc != NULL) + filename = g_strdup (cmdline_gimprc); else filename = gimp_personal_rc_file ("gimprc"); @@ -496,7 +497,7 @@ parse_absolute_gimprc_file (const gchar *filename) if (! parse_info.fp) return FALSE; - if (be_verbose) + if (the_gimp->be_verbose) g_print (_("parsing \"%s\"\n"), filename); cur_token = -1; @@ -1986,7 +1987,7 @@ transform_path (gchar *path, } else { - gimp_terminate ("transform_path(): gimprc token referenced but not defined: %s", token); + g_error ("gimprc token referenced but not defined: %s", token); } } tmp2 = transform_path ((gchar *) tmp2, FALSE); diff --git a/app/gimprc.h b/app/gimprc.h index 6946ac9e84..85abacea5a 100644 --- a/app/gimprc.h +++ b/app/gimprc.h @@ -75,7 +75,9 @@ extern GimpRc gimprc; */ gboolean gimprc_init (Gimp *gimp); -void gimprc_parse (Gimp *gimp); +void gimprc_parse (Gimp *gimp, + const gchar *cmdline_system_gimprc, + const gchar *cmdline_gimprc); void gimprc_save (GList **updated_options, GList **conflicting_options); diff --git a/app/gui/commands.c b/app/gui/commands.c index 6d82a2aeaf..2a2d42f7e8 100644 --- a/app/gui/commands.c +++ b/app/gui/commands.c @@ -24,9 +24,9 @@ #include "core/core-types.h" -#include "commands.h" +#include "plug-in/plug-in.h" -#include "plug_in.h" +#include "commands.h" /***** Filters *****/ diff --git a/app/gui/device-status-dialog.c b/app/gui/device-status-dialog.c index bf499214df..cebcb08048 100644 --- a/app/gui/device-status-dialog.c +++ b/app/gui/device-status-dialog.c @@ -41,7 +41,6 @@ #include "widgets/gimpdnd.h" #include "widgets/gimppreview.h" -#include "appenv.h" #include "app_procs.h" #include "devices.h" #include "gimprc.h" @@ -464,7 +463,7 @@ devices_rc_update (gchar *name, { gimp_context_set_brush (device_info->context, brush); } - else if (no_data) + else if (the_gimp->no_data) { g_free (device_info->context->brush_name); device_info->context->brush_name = g_strdup (brush_name); @@ -483,7 +482,7 @@ devices_rc_update (gchar *name, { gimp_context_set_pattern (device_info->context, pattern); } - else if (no_data) + else if (the_gimp->no_data) { g_free (device_info->context->pattern_name); device_info->context->pattern_name = g_strdup (pattern_name); @@ -502,7 +501,7 @@ devices_rc_update (gchar *name, { gimp_context_set_gradient (device_info->context, gradient); } - else if (no_data) + else if (the_gimp->no_data) { g_free (device_info->context->gradient_name); device_info->context->gradient_name = g_strdup (gradient_name); diff --git a/app/gui/error-console-dialog.c b/app/gui/error-console-dialog.c index 453cb6d661..5885ba3cb5 100644 --- a/app/gui/error-console-dialog.c +++ b/app/gui/error-console-dialog.c @@ -165,7 +165,7 @@ error_console_create (void) menu); /* FIXME: interact with preferences */ - message_handler = ERROR_CONSOLE; + message_handler = GIMP_ERROR_CONSOLE; return error_console; } @@ -177,7 +177,7 @@ error_console_add (const gchar *errormsg) { g_warning ("%s: error_console widget is NULL", G_STRLOC); - message_handler = MESSAGE_BOX; + message_handler = GIMP_MESSAGE_BOX; g_message (errormsg); return; @@ -207,7 +207,7 @@ error_console_destroy_callback (gpointer data) error_console = NULL; /* FIXME: interact with preferences */ - message_handler = MESSAGE_BOX; + message_handler = GIMP_MESSAGE_BOX; } static gboolean diff --git a/app/gui/file-dialog-utils.c b/app/gui/file-dialog-utils.c index bc14b4cf83..23b2e13d35 100644 --- a/app/gui/file-dialog-utils.c +++ b/app/gui/file-dialog-utils.c @@ -25,9 +25,11 @@ #include "gui-types.h" +#include "plug-in/plug-in.h" + #include "widgets/gimpitemfactory.h" -#include "plug_in.h" +#include "file-dialog-utils.h" void diff --git a/app/gui/file-open-dialog.c b/app/gui/file-open-dialog.c index d969467c45..b0d57cea83 100644 --- a/app/gui/file-open-dialog.c +++ b/app/gui/file-open-dialog.c @@ -48,6 +48,8 @@ #include "core/gimpdocuments.h" #include "core/gimpimage.h" +#include "plug-in/plug-in.h" + #include "file/file-open.h" #include "file/file-utils.h" @@ -56,7 +58,6 @@ #include "file-dialog-utils.h" #include "file-open-dialog.h" -#include "plug_in.h" #include "undo.h" #include "libgimp/gimpintl.h" diff --git a/app/gui/file-save-dialog.c b/app/gui/file-save-dialog.c index 0d58d378c4..374b4794b0 100644 --- a/app/gui/file-save-dialog.c +++ b/app/gui/file-save-dialog.c @@ -38,6 +38,8 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "plug-in/plug-in.h" + #include "file/file-save.h" #include "file/file-utils.h" @@ -47,7 +49,6 @@ #include "file-save-dialog.h" #include "gimprc.h" -#include "plug_in.h" #include "undo.h" #include "libgimp/gimpintl.h" diff --git a/app/gui/help-commands.c b/app/gui/help-commands.c index 6d82a2aeaf..2a2d42f7e8 100644 --- a/app/gui/help-commands.c +++ b/app/gui/help-commands.c @@ -24,9 +24,9 @@ #include "core/core-types.h" -#include "commands.h" +#include "plug-in/plug-in.h" -#include "plug_in.h" +#include "commands.h" /***** Filters *****/ diff --git a/app/gui/input-dialog.c b/app/gui/input-dialog.c index bf499214df..cebcb08048 100644 --- a/app/gui/input-dialog.c +++ b/app/gui/input-dialog.c @@ -41,7 +41,6 @@ #include "widgets/gimpdnd.h" #include "widgets/gimppreview.h" -#include "appenv.h" #include "app_procs.h" #include "devices.h" #include "gimprc.h" @@ -464,7 +463,7 @@ devices_rc_update (gchar *name, { gimp_context_set_brush (device_info->context, brush); } - else if (no_data) + else if (the_gimp->no_data) { g_free (device_info->context->brush_name); device_info->context->brush_name = g_strdup (brush_name); @@ -483,7 +482,7 @@ devices_rc_update (gchar *name, { gimp_context_set_pattern (device_info->context, pattern); } - else if (no_data) + else if (the_gimp->no_data) { g_free (device_info->context->pattern_name); device_info->context->pattern_name = g_strdup (pattern_name); @@ -502,7 +501,7 @@ devices_rc_update (gchar *name, { gimp_context_set_gradient (device_info->context, gradient); } - else if (no_data) + else if (the_gimp->no_data) { g_free (device_info->context->gradient_name); device_info->context->gradient_name = g_strdup (gradient_name); diff --git a/app/gui/paths-dialog.c b/app/gui/paths-dialog.c index 811f9ffa12..556d69f1c5 100644 --- a/app/gui/paths-dialog.c +++ b/app/gui/paths-dialog.c @@ -37,6 +37,10 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "pdb/procedural_db.h" + +#include "plug-in/plug-in.h" + #include "widgets/gimpitemfactory.h" #include "display/gimpdisplay.h" @@ -44,14 +48,13 @@ #include "tools/gimpbezierselecttool.h" -#include "ops_buttons.h" #include "paths-dialog.h" #include "gimprc.h" +#include "ops_buttons.h" #include "path.h" #include "pathP.h" #include "path_transform.h" -#include "plug_in.h" #include "undo.h" #include "libgimp/gimpintl.h" diff --git a/app/gui/plug-in-commands.c b/app/gui/plug-in-commands.c index e85060d12b..c2e0e21c9f 100644 --- a/app/gui/plug-in-commands.c +++ b/app/gui/plug-in-commands.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "display/display-types.h" +#include "plug-in-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -96,6 +96,8 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "widgets/widgets-types.h" + #include "widgets/gimpitemfactory.h" #include "display/gimpdisplay.h" @@ -104,12 +106,11 @@ #include "gui/gradient-select.h" #include "gui/pattern-select.h" +#include "plug-in.h" + #include "app_procs.h" -#include "appenv.h" -#include "errors.h" #include "gimpprogress.h" #include "gimprc.h" -#include "plug_in.h" #include "libgimp/gimpintl.h" @@ -382,7 +383,7 @@ plug_in_init (Gimp *gimp, { write_pluginrc = TRUE; - if (be_verbose) + if (gimp->be_verbose) g_print (_("query plug-in: \"%s\"\n"), plug_in_def->prog); plug_in_query (plug_in_def); @@ -422,7 +423,7 @@ plug_in_init (Gimp *gimp, /* write the pluginrc file if necessary */ if (write_pluginrc) { - if (be_verbose) + if (gimp->be_verbose) g_print (_("writing \"%s\"\n"), filename); plug_in_write_rc (filename); @@ -440,7 +441,7 @@ plug_in_init (Gimp *gimp, } /* run the available extensions */ - if (be_verbose) + if (gimp->be_verbose) g_print (_("Starting extensions: ")); (* status_callback) (_("Extensions"), "", 0); @@ -457,7 +458,7 @@ plug_in_init (Gimp *gimp, (proc_def->db_info.num_args == 0) && (proc_def->db_info.proc_type == GIMP_EXTENSION)) { - if (be_verbose) + if (gimp->be_verbose) g_print ("%s ", proc_def->db_info.name); (* status_callback) (NULL, proc_def->db_info.name, nth / nplugins); @@ -466,7 +467,7 @@ plug_in_init (Gimp *gimp, } } - if (be_verbose) + if (gimp->be_verbose) g_print ("\n"); /* create help path list and free up stuff */ @@ -1087,7 +1088,7 @@ plug_in_open (PlugIn *plug_in) plug_in->args[4] = g_strdup ("-run"); } - plug_in->args[5] = g_strdup_printf ("%d", (gint) stack_trace_mode); + plug_in->args[5] = g_strdup_printf ("%d", the_gimp->stack_trace_mode); /* Fork another process. We'll remember the process id * so that we can later use it to kill the filter if diff --git a/app/gui/plug-in-menus.c b/app/gui/plug-in-menus.c index e85060d12b..c2e0e21c9f 100644 --- a/app/gui/plug-in-menus.c +++ b/app/gui/plug-in-menus.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "display/display-types.h" +#include "plug-in-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -96,6 +96,8 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "widgets/widgets-types.h" + #include "widgets/gimpitemfactory.h" #include "display/gimpdisplay.h" @@ -104,12 +106,11 @@ #include "gui/gradient-select.h" #include "gui/pattern-select.h" +#include "plug-in.h" + #include "app_procs.h" -#include "appenv.h" -#include "errors.h" #include "gimpprogress.h" #include "gimprc.h" -#include "plug_in.h" #include "libgimp/gimpintl.h" @@ -382,7 +383,7 @@ plug_in_init (Gimp *gimp, { write_pluginrc = TRUE; - if (be_verbose) + if (gimp->be_verbose) g_print (_("query plug-in: \"%s\"\n"), plug_in_def->prog); plug_in_query (plug_in_def); @@ -422,7 +423,7 @@ plug_in_init (Gimp *gimp, /* write the pluginrc file if necessary */ if (write_pluginrc) { - if (be_verbose) + if (gimp->be_verbose) g_print (_("writing \"%s\"\n"), filename); plug_in_write_rc (filename); @@ -440,7 +441,7 @@ plug_in_init (Gimp *gimp, } /* run the available extensions */ - if (be_verbose) + if (gimp->be_verbose) g_print (_("Starting extensions: ")); (* status_callback) (_("Extensions"), "", 0); @@ -457,7 +458,7 @@ plug_in_init (Gimp *gimp, (proc_def->db_info.num_args == 0) && (proc_def->db_info.proc_type == GIMP_EXTENSION)) { - if (be_verbose) + if (gimp->be_verbose) g_print ("%s ", proc_def->db_info.name); (* status_callback) (NULL, proc_def->db_info.name, nth / nplugins); @@ -466,7 +467,7 @@ plug_in_init (Gimp *gimp, } } - if (be_verbose) + if (gimp->be_verbose) g_print ("\n"); /* create help path list and free up stuff */ @@ -1087,7 +1088,7 @@ plug_in_open (PlugIn *plug_in) plug_in->args[4] = g_strdup ("-run"); } - plug_in->args[5] = g_strdup_printf ("%d", (gint) stack_trace_mode); + plug_in->args[5] = g_strdup_printf ("%d", the_gimp->stack_trace_mode); /* Fork another process. We'll remember the process id * so that we can later use it to kill the filter if diff --git a/app/gui/user-install-dialog.c b/app/gui/user-install-dialog.c index 58c6de387b..d7936f9b67 100644 --- a/app/gui/user-install-dialog.c +++ b/app/gui/user-install-dialog.c @@ -352,7 +352,7 @@ user_install_continue_callback (GtkWidget *widget, #endif gimprc_init (gimp); gimp_unitrc_load (gimp); - gimprc_parse (gimp); + gimprc_parse (gimp, alternate_system_gimprc, alternate_gimprc); user_install_tuning (); break; diff --git a/app/main.c b/app/main.c index 89a5eb544e..f12fcb9a0b 100644 --- a/app/main.c +++ b/app/main.c @@ -62,23 +62,23 @@ static void gimp_sigchld_handler (gint sig_num); /* command line options */ -gboolean no_interface = FALSE; -gboolean no_data = FALSE; -gboolean no_splash = FALSE; -gboolean no_splash_image = FALSE; -gboolean be_verbose = FALSE; -gboolean use_shm = FALSE; -gboolean use_debug_handler = FALSE; -gboolean console_messages = FALSE; -gboolean restore_session = FALSE; -StackTraceMode stack_trace_mode = STACK_TRACE_QUERY; -gchar *alternate_gimprc = NULL; -gchar *alternate_system_gimprc = NULL; -gchar **batch_cmds = NULL; +gboolean no_interface = FALSE; +gboolean no_data = FALSE; +gboolean no_splash = FALSE; +gboolean no_splash_image = FALSE; +gboolean be_verbose = FALSE; +gboolean use_shm = FALSE; +gboolean use_debug_handler = FALSE; +gboolean console_messages = FALSE; +gboolean restore_session = FALSE; +GimpStackTraceMode stack_trace_mode = GIMP_STACK_TRACE_QUERY; +gchar *alternate_gimprc = NULL; +gchar *alternate_system_gimprc = NULL; +gchar **batch_cmds = NULL; /* other global variables */ -gchar *prog_name = NULL; /* our executable name */ -MessageHandlerType message_handler = CONSOLE; +gchar *prog_name = NULL; /* our executable name */ +GimpMessageHandlerType message_handler = GIMP_CONSOLE; /* @@ -298,11 +298,11 @@ main (int argc, else { if (! strcmp (argv[i], "never")) - stack_trace_mode = STACK_TRACE_NEVER; + stack_trace_mode = GIMP_STACK_TRACE_NEVER; else if (! strcmp (argv[i], "query")) - stack_trace_mode = STACK_TRACE_QUERY; + stack_trace_mode = GIMP_STACK_TRACE_QUERY; else if (! strcmp (argv[i], "always")) - stack_trace_mode = STACK_TRACE_ALWAYS; + stack_trace_mode = GIMP_STACK_TRACE_ALWAYS; else show_help = TRUE; @@ -403,6 +403,14 @@ main (int argc, G_LOG_LEVEL_MESSAGE, gimp_message_log_func, NULL); + g_log_set_handler ("Gimp-PDB", + G_LOG_LEVEL_MESSAGE, + gimp_message_log_func, + NULL); + g_log_set_handler ("Gimp-Plug-In", + G_LOG_LEVEL_MESSAGE, + gimp_message_log_func, + NULL); g_log_set_handler ("Gimp-File", G_LOG_LEVEL_MESSAGE, gimp_message_log_func, @@ -411,19 +419,15 @@ main (int argc, G_LOG_LEVEL_MESSAGE, gimp_message_log_func, NULL); - g_log_set_handler ("Gimp-PDB", - G_LOG_LEVEL_MESSAGE, - gimp_message_log_func, - NULL); g_log_set_handler ("Gimp-Widgets", G_LOG_LEVEL_MESSAGE, gimp_message_log_func, NULL); - g_log_set_handler ("Gimp-Tools", + g_log_set_handler ("Gimp-Display", G_LOG_LEVEL_MESSAGE, gimp_message_log_func, NULL); - g_log_set_handler ("Gimp-Display", + g_log_set_handler ("Gimp-Tools", G_LOG_LEVEL_MESSAGE, gimp_message_log_func, NULL); @@ -499,7 +503,6 @@ WinMain (struct HINSTANCE__ *hInstance, #ifndef G_OS_WIN32 - /* gimp core signal handler for fatal signals */ static void diff --git a/app/menus/plug-in-menus.c b/app/menus/plug-in-menus.c index e85060d12b..c2e0e21c9f 100644 --- a/app/menus/plug-in-menus.c +++ b/app/menus/plug-in-menus.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "display/display-types.h" +#include "plug-in-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -96,6 +96,8 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "widgets/widgets-types.h" + #include "widgets/gimpitemfactory.h" #include "display/gimpdisplay.h" @@ -104,12 +106,11 @@ #include "gui/gradient-select.h" #include "gui/pattern-select.h" +#include "plug-in.h" + #include "app_procs.h" -#include "appenv.h" -#include "errors.h" #include "gimpprogress.h" #include "gimprc.h" -#include "plug_in.h" #include "libgimp/gimpintl.h" @@ -382,7 +383,7 @@ plug_in_init (Gimp *gimp, { write_pluginrc = TRUE; - if (be_verbose) + if (gimp->be_verbose) g_print (_("query plug-in: \"%s\"\n"), plug_in_def->prog); plug_in_query (plug_in_def); @@ -422,7 +423,7 @@ plug_in_init (Gimp *gimp, /* write the pluginrc file if necessary */ if (write_pluginrc) { - if (be_verbose) + if (gimp->be_verbose) g_print (_("writing \"%s\"\n"), filename); plug_in_write_rc (filename); @@ -440,7 +441,7 @@ plug_in_init (Gimp *gimp, } /* run the available extensions */ - if (be_verbose) + if (gimp->be_verbose) g_print (_("Starting extensions: ")); (* status_callback) (_("Extensions"), "", 0); @@ -457,7 +458,7 @@ plug_in_init (Gimp *gimp, (proc_def->db_info.num_args == 0) && (proc_def->db_info.proc_type == GIMP_EXTENSION)) { - if (be_verbose) + if (gimp->be_verbose) g_print ("%s ", proc_def->db_info.name); (* status_callback) (NULL, proc_def->db_info.name, nth / nplugins); @@ -466,7 +467,7 @@ plug_in_init (Gimp *gimp, } } - if (be_verbose) + if (gimp->be_verbose) g_print ("\n"); /* create help path list and free up stuff */ @@ -1087,7 +1088,7 @@ plug_in_open (PlugIn *plug_in) plug_in->args[4] = g_strdup ("-run"); } - plug_in->args[5] = g_strdup_printf ("%d", (gint) stack_trace_mode); + plug_in->args[5] = g_strdup_printf ("%d", the_gimp->stack_trace_mode); /* Fork another process. We'll remember the process id * so that we can later use it to kill the filter if diff --git a/app/pdb/fileops_cmds.c b/app/pdb/fileops_cmds.c index c8601ab08d..ce6e9fc9fe 100644 --- a/app/pdb/fileops_cmds.c +++ b/app/pdb/fileops_cmds.c @@ -45,7 +45,7 @@ #include "core/gimp.h" #include "core/gimpimage.h" #include "file/file-utils.h" -#include "plug_in.h" +#include "plug-in/plug-in.h" static ProcRecord file_load_proc; static ProcRecord file_save_proc; diff --git a/app/pdb/gimp-pdb.c b/app/pdb/gimp-pdb.c index 519fc9c3ff..4df012cfcd 100644 --- a/app/pdb/gimp-pdb.c +++ b/app/pdb/gimp-pdb.c @@ -28,7 +28,7 @@ #include "core/gimp.h" -#include "plug_in.h" +#include "plug-in/plug-in.h" #include "procedural_db.h" diff --git a/app/pdb/gimppdb.c b/app/pdb/gimppdb.c index 519fc9c3ff..4df012cfcd 100644 --- a/app/pdb/gimppdb.c +++ b/app/pdb/gimppdb.c @@ -28,7 +28,7 @@ #include "core/gimp.h" -#include "plug_in.h" +#include "plug-in/plug-in.h" #include "procedural_db.h" diff --git a/app/pdb/gimpprocedure.c b/app/pdb/gimpprocedure.c index 519fc9c3ff..4df012cfcd 100644 --- a/app/pdb/gimpprocedure.c +++ b/app/pdb/gimpprocedure.c @@ -28,7 +28,7 @@ #include "core/gimp.h" -#include "plug_in.h" +#include "plug-in/plug-in.h" #include "procedural_db.h" diff --git a/app/pdb/help_cmds.c b/app/pdb/help_cmds.c index e8811d3916..6eac6c6eb7 100644 --- a/app/pdb/help_cmds.c +++ b/app/pdb/help_cmds.c @@ -30,7 +30,7 @@ #include "procedural_db.h" #include "gimphelp.h" -#include "plug_in.h" +#include "plug-in/plug-in.h" static ProcRecord help_proc; diff --git a/app/pdb/message_cmds.c b/app/pdb/message_cmds.c index 21762e16bb..50a01d2df9 100644 --- a/app/pdb/message_cmds.c +++ b/app/pdb/message_cmds.c @@ -30,6 +30,8 @@ #include "appenv.h" +#include "libgimpbase/gimpbasetypes.h" + static ProcRecord message_proc; static ProcRecord message_get_handler_proc; static ProcRecord message_set_handler_proc; @@ -129,7 +131,7 @@ message_set_handler_invoker (Gimp *gimp, gint32 handler; handler = args[0].value.pdb_int; - if (handler < MESSAGE_BOX || handler > ERROR_CONSOLE) + if (handler < GIMP_MESSAGE_BOX || handler > GIMP_ERROR_CONSOLE) success = FALSE; if (success) diff --git a/app/pdb/plug_in_cmds.c b/app/pdb/plug_in_cmds.c index e8db6841d2..8bee62e130 100644 --- a/app/pdb/plug_in_cmds.c +++ b/app/pdb/plug_in_cmds.c @@ -31,7 +31,7 @@ #include "procedural_db.h" #include "core/gimp.h" -#include "plug_in.h" +#include "plug-in/plug-in.h" #ifdef HAVE_GLIBC_REGEX #include diff --git a/app/pdb/procedural_db.c b/app/pdb/procedural_db.c index 519fc9c3ff..4df012cfcd 100644 --- a/app/pdb/procedural_db.c +++ b/app/pdb/procedural_db.c @@ -28,7 +28,7 @@ #include "core/gimp.h" -#include "plug_in.h" +#include "plug-in/plug-in.h" #include "procedural_db.h" diff --git a/app/plug-in/Makefile.am b/app/plug-in/Makefile.am index e986904aa9..441c6f8d3b 100644 --- a/app/plug-in/Makefile.am +++ b/app/plug-in/Makefile.am @@ -4,9 +4,9 @@ noinst_LIBRARIES = libappplug-in.a libappplug_in_a_SOURCES = @STRIP_BEGIN@ \ plug-in-types.h \ + plug-in.c \ + plug-in.h \ @STRIP_END@ -## plug-in.c \ -## plug-in.h \ AM_CPPFLAGS = @STRIP_BEGIN@ \ -DG_LOG_DOMAIN=\"Gimp-Plug-In\" \ diff --git a/app/plug-in/gimpplugin-message.c b/app/plug-in/gimpplugin-message.c index e85060d12b..c2e0e21c9f 100644 --- a/app/plug-in/gimpplugin-message.c +++ b/app/plug-in/gimpplugin-message.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "display/display-types.h" +#include "plug-in-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -96,6 +96,8 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "widgets/widgets-types.h" + #include "widgets/gimpitemfactory.h" #include "display/gimpdisplay.h" @@ -104,12 +106,11 @@ #include "gui/gradient-select.h" #include "gui/pattern-select.h" +#include "plug-in.h" + #include "app_procs.h" -#include "appenv.h" -#include "errors.h" #include "gimpprogress.h" #include "gimprc.h" -#include "plug_in.h" #include "libgimp/gimpintl.h" @@ -382,7 +383,7 @@ plug_in_init (Gimp *gimp, { write_pluginrc = TRUE; - if (be_verbose) + if (gimp->be_verbose) g_print (_("query plug-in: \"%s\"\n"), plug_in_def->prog); plug_in_query (plug_in_def); @@ -422,7 +423,7 @@ plug_in_init (Gimp *gimp, /* write the pluginrc file if necessary */ if (write_pluginrc) { - if (be_verbose) + if (gimp->be_verbose) g_print (_("writing \"%s\"\n"), filename); plug_in_write_rc (filename); @@ -440,7 +441,7 @@ plug_in_init (Gimp *gimp, } /* run the available extensions */ - if (be_verbose) + if (gimp->be_verbose) g_print (_("Starting extensions: ")); (* status_callback) (_("Extensions"), "", 0); @@ -457,7 +458,7 @@ plug_in_init (Gimp *gimp, (proc_def->db_info.num_args == 0) && (proc_def->db_info.proc_type == GIMP_EXTENSION)) { - if (be_verbose) + if (gimp->be_verbose) g_print ("%s ", proc_def->db_info.name); (* status_callback) (NULL, proc_def->db_info.name, nth / nplugins); @@ -466,7 +467,7 @@ plug_in_init (Gimp *gimp, } } - if (be_verbose) + if (gimp->be_verbose) g_print ("\n"); /* create help path list and free up stuff */ @@ -1087,7 +1088,7 @@ plug_in_open (PlugIn *plug_in) plug_in->args[4] = g_strdup ("-run"); } - plug_in->args[5] = g_strdup_printf ("%d", (gint) stack_trace_mode); + plug_in->args[5] = g_strdup_printf ("%d", the_gimp->stack_trace_mode); /* Fork another process. We'll remember the process id * so that we can later use it to kill the filter if diff --git a/app/plug-in/gimpplugin-progress.c b/app/plug-in/gimpplugin-progress.c index e85060d12b..c2e0e21c9f 100644 --- a/app/plug-in/gimpplugin-progress.c +++ b/app/plug-in/gimpplugin-progress.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "display/display-types.h" +#include "plug-in-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -96,6 +96,8 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "widgets/widgets-types.h" + #include "widgets/gimpitemfactory.h" #include "display/gimpdisplay.h" @@ -104,12 +106,11 @@ #include "gui/gradient-select.h" #include "gui/pattern-select.h" +#include "plug-in.h" + #include "app_procs.h" -#include "appenv.h" -#include "errors.h" #include "gimpprogress.h" #include "gimprc.h" -#include "plug_in.h" #include "libgimp/gimpintl.h" @@ -382,7 +383,7 @@ plug_in_init (Gimp *gimp, { write_pluginrc = TRUE; - if (be_verbose) + if (gimp->be_verbose) g_print (_("query plug-in: \"%s\"\n"), plug_in_def->prog); plug_in_query (plug_in_def); @@ -422,7 +423,7 @@ plug_in_init (Gimp *gimp, /* write the pluginrc file if necessary */ if (write_pluginrc) { - if (be_verbose) + if (gimp->be_verbose) g_print (_("writing \"%s\"\n"), filename); plug_in_write_rc (filename); @@ -440,7 +441,7 @@ plug_in_init (Gimp *gimp, } /* run the available extensions */ - if (be_verbose) + if (gimp->be_verbose) g_print (_("Starting extensions: ")); (* status_callback) (_("Extensions"), "", 0); @@ -457,7 +458,7 @@ plug_in_init (Gimp *gimp, (proc_def->db_info.num_args == 0) && (proc_def->db_info.proc_type == GIMP_EXTENSION)) { - if (be_verbose) + if (gimp->be_verbose) g_print ("%s ", proc_def->db_info.name); (* status_callback) (NULL, proc_def->db_info.name, nth / nplugins); @@ -466,7 +467,7 @@ plug_in_init (Gimp *gimp, } } - if (be_verbose) + if (gimp->be_verbose) g_print ("\n"); /* create help path list and free up stuff */ @@ -1087,7 +1088,7 @@ plug_in_open (PlugIn *plug_in) plug_in->args[4] = g_strdup ("-run"); } - plug_in->args[5] = g_strdup_printf ("%d", (gint) stack_trace_mode); + plug_in->args[5] = g_strdup_printf ("%d", the_gimp->stack_trace_mode); /* Fork another process. We'll remember the process id * so that we can later use it to kill the filter if diff --git a/app/plug-in/gimpplugin-progress.h b/app/plug-in/gimpplugin-progress.h index 1ca0517ea9..2cf2bc16f3 100644 --- a/app/plug-in/gimpplugin-progress.h +++ b/app/plug-in/gimpplugin-progress.h @@ -23,12 +23,7 @@ #include /* time_t */ #include /* pid_t */ - -/* FIXME: move the plugin stuff to plug-in/ */ - -#include "plug-in/plug-in-types.h" - -#include "pdb/procedural_db.h" +#include "pdb/procedural_db.h" /* ProcRecord */ #define WRITE_BUFFER_SIZE 512 diff --git a/app/plug-in/gimpplugin.c b/app/plug-in/gimpplugin.c index e85060d12b..c2e0e21c9f 100644 --- a/app/plug-in/gimpplugin.c +++ b/app/plug-in/gimpplugin.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "display/display-types.h" +#include "plug-in-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -96,6 +96,8 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "widgets/widgets-types.h" + #include "widgets/gimpitemfactory.h" #include "display/gimpdisplay.h" @@ -104,12 +106,11 @@ #include "gui/gradient-select.h" #include "gui/pattern-select.h" +#include "plug-in.h" + #include "app_procs.h" -#include "appenv.h" -#include "errors.h" #include "gimpprogress.h" #include "gimprc.h" -#include "plug_in.h" #include "libgimp/gimpintl.h" @@ -382,7 +383,7 @@ plug_in_init (Gimp *gimp, { write_pluginrc = TRUE; - if (be_verbose) + if (gimp->be_verbose) g_print (_("query plug-in: \"%s\"\n"), plug_in_def->prog); plug_in_query (plug_in_def); @@ -422,7 +423,7 @@ plug_in_init (Gimp *gimp, /* write the pluginrc file if necessary */ if (write_pluginrc) { - if (be_verbose) + if (gimp->be_verbose) g_print (_("writing \"%s\"\n"), filename); plug_in_write_rc (filename); @@ -440,7 +441,7 @@ plug_in_init (Gimp *gimp, } /* run the available extensions */ - if (be_verbose) + if (gimp->be_verbose) g_print (_("Starting extensions: ")); (* status_callback) (_("Extensions"), "", 0); @@ -457,7 +458,7 @@ plug_in_init (Gimp *gimp, (proc_def->db_info.num_args == 0) && (proc_def->db_info.proc_type == GIMP_EXTENSION)) { - if (be_verbose) + if (gimp->be_verbose) g_print ("%s ", proc_def->db_info.name); (* status_callback) (NULL, proc_def->db_info.name, nth / nplugins); @@ -466,7 +467,7 @@ plug_in_init (Gimp *gimp, } } - if (be_verbose) + if (gimp->be_verbose) g_print ("\n"); /* create help path list and free up stuff */ @@ -1087,7 +1088,7 @@ plug_in_open (PlugIn *plug_in) plug_in->args[4] = g_strdup ("-run"); } - plug_in->args[5] = g_strdup_printf ("%d", (gint) stack_trace_mode); + plug_in->args[5] = g_strdup_printf ("%d", the_gimp->stack_trace_mode); /* Fork another process. We'll remember the process id * so that we can later use it to kill the filter if diff --git a/app/plug-in/gimpplugin.h b/app/plug-in/gimpplugin.h index 1ca0517ea9..2cf2bc16f3 100644 --- a/app/plug-in/gimpplugin.h +++ b/app/plug-in/gimpplugin.h @@ -23,12 +23,7 @@ #include /* time_t */ #include /* pid_t */ - -/* FIXME: move the plugin stuff to plug-in/ */ - -#include "plug-in/plug-in-types.h" - -#include "pdb/procedural_db.h" +#include "pdb/procedural_db.h" /* ProcRecord */ #define WRITE_BUFFER_SIZE 512 diff --git a/app/plug-in/gimppluginmanager-call.c b/app/plug-in/gimppluginmanager-call.c index e85060d12b..c2e0e21c9f 100644 --- a/app/plug-in/gimppluginmanager-call.c +++ b/app/plug-in/gimppluginmanager-call.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "display/display-types.h" +#include "plug-in-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -96,6 +96,8 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "widgets/widgets-types.h" + #include "widgets/gimpitemfactory.h" #include "display/gimpdisplay.h" @@ -104,12 +106,11 @@ #include "gui/gradient-select.h" #include "gui/pattern-select.h" +#include "plug-in.h" + #include "app_procs.h" -#include "appenv.h" -#include "errors.h" #include "gimpprogress.h" #include "gimprc.h" -#include "plug_in.h" #include "libgimp/gimpintl.h" @@ -382,7 +383,7 @@ plug_in_init (Gimp *gimp, { write_pluginrc = TRUE; - if (be_verbose) + if (gimp->be_verbose) g_print (_("query plug-in: \"%s\"\n"), plug_in_def->prog); plug_in_query (plug_in_def); @@ -422,7 +423,7 @@ plug_in_init (Gimp *gimp, /* write the pluginrc file if necessary */ if (write_pluginrc) { - if (be_verbose) + if (gimp->be_verbose) g_print (_("writing \"%s\"\n"), filename); plug_in_write_rc (filename); @@ -440,7 +441,7 @@ plug_in_init (Gimp *gimp, } /* run the available extensions */ - if (be_verbose) + if (gimp->be_verbose) g_print (_("Starting extensions: ")); (* status_callback) (_("Extensions"), "", 0); @@ -457,7 +458,7 @@ plug_in_init (Gimp *gimp, (proc_def->db_info.num_args == 0) && (proc_def->db_info.proc_type == GIMP_EXTENSION)) { - if (be_verbose) + if (gimp->be_verbose) g_print ("%s ", proc_def->db_info.name); (* status_callback) (NULL, proc_def->db_info.name, nth / nplugins); @@ -466,7 +467,7 @@ plug_in_init (Gimp *gimp, } } - if (be_verbose) + if (gimp->be_verbose) g_print ("\n"); /* create help path list and free up stuff */ @@ -1087,7 +1088,7 @@ plug_in_open (PlugIn *plug_in) plug_in->args[4] = g_strdup ("-run"); } - plug_in->args[5] = g_strdup_printf ("%d", (gint) stack_trace_mode); + plug_in->args[5] = g_strdup_printf ("%d", the_gimp->stack_trace_mode); /* Fork another process. We'll remember the process id * so that we can later use it to kill the filter if diff --git a/app/plug-in/gimppluginmanager-run.c b/app/plug-in/gimppluginmanager-run.c index e85060d12b..c2e0e21c9f 100644 --- a/app/plug-in/gimppluginmanager-run.c +++ b/app/plug-in/gimppluginmanager-run.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "display/display-types.h" +#include "plug-in-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -96,6 +96,8 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "widgets/widgets-types.h" + #include "widgets/gimpitemfactory.h" #include "display/gimpdisplay.h" @@ -104,12 +106,11 @@ #include "gui/gradient-select.h" #include "gui/pattern-select.h" +#include "plug-in.h" + #include "app_procs.h" -#include "appenv.h" -#include "errors.h" #include "gimpprogress.h" #include "gimprc.h" -#include "plug_in.h" #include "libgimp/gimpintl.h" @@ -382,7 +383,7 @@ plug_in_init (Gimp *gimp, { write_pluginrc = TRUE; - if (be_verbose) + if (gimp->be_verbose) g_print (_("query plug-in: \"%s\"\n"), plug_in_def->prog); plug_in_query (plug_in_def); @@ -422,7 +423,7 @@ plug_in_init (Gimp *gimp, /* write the pluginrc file if necessary */ if (write_pluginrc) { - if (be_verbose) + if (gimp->be_verbose) g_print (_("writing \"%s\"\n"), filename); plug_in_write_rc (filename); @@ -440,7 +441,7 @@ plug_in_init (Gimp *gimp, } /* run the available extensions */ - if (be_verbose) + if (gimp->be_verbose) g_print (_("Starting extensions: ")); (* status_callback) (_("Extensions"), "", 0); @@ -457,7 +458,7 @@ plug_in_init (Gimp *gimp, (proc_def->db_info.num_args == 0) && (proc_def->db_info.proc_type == GIMP_EXTENSION)) { - if (be_verbose) + if (gimp->be_verbose) g_print ("%s ", proc_def->db_info.name); (* status_callback) (NULL, proc_def->db_info.name, nth / nplugins); @@ -466,7 +467,7 @@ plug_in_init (Gimp *gimp, } } - if (be_verbose) + if (gimp->be_verbose) g_print ("\n"); /* create help path list and free up stuff */ @@ -1087,7 +1088,7 @@ plug_in_open (PlugIn *plug_in) plug_in->args[4] = g_strdup ("-run"); } - plug_in->args[5] = g_strdup_printf ("%d", (gint) stack_trace_mode); + plug_in->args[5] = g_strdup_printf ("%d", the_gimp->stack_trace_mode); /* Fork another process. We'll remember the process id * so that we can later use it to kill the filter if diff --git a/app/plug-in/gimppluginmanager.c b/app/plug-in/gimppluginmanager.c index e85060d12b..c2e0e21c9f 100644 --- a/app/plug-in/gimppluginmanager.c +++ b/app/plug-in/gimppluginmanager.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "display/display-types.h" +#include "plug-in-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -96,6 +96,8 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "widgets/widgets-types.h" + #include "widgets/gimpitemfactory.h" #include "display/gimpdisplay.h" @@ -104,12 +106,11 @@ #include "gui/gradient-select.h" #include "gui/pattern-select.h" +#include "plug-in.h" + #include "app_procs.h" -#include "appenv.h" -#include "errors.h" #include "gimpprogress.h" #include "gimprc.h" -#include "plug_in.h" #include "libgimp/gimpintl.h" @@ -382,7 +383,7 @@ plug_in_init (Gimp *gimp, { write_pluginrc = TRUE; - if (be_verbose) + if (gimp->be_verbose) g_print (_("query plug-in: \"%s\"\n"), plug_in_def->prog); plug_in_query (plug_in_def); @@ -422,7 +423,7 @@ plug_in_init (Gimp *gimp, /* write the pluginrc file if necessary */ if (write_pluginrc) { - if (be_verbose) + if (gimp->be_verbose) g_print (_("writing \"%s\"\n"), filename); plug_in_write_rc (filename); @@ -440,7 +441,7 @@ plug_in_init (Gimp *gimp, } /* run the available extensions */ - if (be_verbose) + if (gimp->be_verbose) g_print (_("Starting extensions: ")); (* status_callback) (_("Extensions"), "", 0); @@ -457,7 +458,7 @@ plug_in_init (Gimp *gimp, (proc_def->db_info.num_args == 0) && (proc_def->db_info.proc_type == GIMP_EXTENSION)) { - if (be_verbose) + if (gimp->be_verbose) g_print ("%s ", proc_def->db_info.name); (* status_callback) (NULL, proc_def->db_info.name, nth / nplugins); @@ -466,7 +467,7 @@ plug_in_init (Gimp *gimp, } } - if (be_verbose) + if (gimp->be_verbose) g_print ("\n"); /* create help path list and free up stuff */ @@ -1087,7 +1088,7 @@ plug_in_open (PlugIn *plug_in) plug_in->args[4] = g_strdup ("-run"); } - plug_in->args[5] = g_strdup_printf ("%d", (gint) stack_trace_mode); + plug_in->args[5] = g_strdup_printf ("%d", the_gimp->stack_trace_mode); /* Fork another process. We'll remember the process id * so that we can later use it to kill the filter if diff --git a/app/plug-in/gimppluginmanager.h b/app/plug-in/gimppluginmanager.h index 1ca0517ea9..2cf2bc16f3 100644 --- a/app/plug-in/gimppluginmanager.h +++ b/app/plug-in/gimppluginmanager.h @@ -23,12 +23,7 @@ #include /* time_t */ #include /* pid_t */ - -/* FIXME: move the plugin stuff to plug-in/ */ - -#include "plug-in/plug-in-types.h" - -#include "pdb/procedural_db.h" +#include "pdb/procedural_db.h" /* ProcRecord */ #define WRITE_BUFFER_SIZE 512 diff --git a/app/plug-in/gimppluginshm.c b/app/plug-in/gimppluginshm.c index e85060d12b..c2e0e21c9f 100644 --- a/app/plug-in/gimppluginshm.c +++ b/app/plug-in/gimppluginshm.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "display/display-types.h" +#include "plug-in-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -96,6 +96,8 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "widgets/widgets-types.h" + #include "widgets/gimpitemfactory.h" #include "display/gimpdisplay.h" @@ -104,12 +106,11 @@ #include "gui/gradient-select.h" #include "gui/pattern-select.h" +#include "plug-in.h" + #include "app_procs.h" -#include "appenv.h" -#include "errors.h" #include "gimpprogress.h" #include "gimprc.h" -#include "plug_in.h" #include "libgimp/gimpintl.h" @@ -382,7 +383,7 @@ plug_in_init (Gimp *gimp, { write_pluginrc = TRUE; - if (be_verbose) + if (gimp->be_verbose) g_print (_("query plug-in: \"%s\"\n"), plug_in_def->prog); plug_in_query (plug_in_def); @@ -422,7 +423,7 @@ plug_in_init (Gimp *gimp, /* write the pluginrc file if necessary */ if (write_pluginrc) { - if (be_verbose) + if (gimp->be_verbose) g_print (_("writing \"%s\"\n"), filename); plug_in_write_rc (filename); @@ -440,7 +441,7 @@ plug_in_init (Gimp *gimp, } /* run the available extensions */ - if (be_verbose) + if (gimp->be_verbose) g_print (_("Starting extensions: ")); (* status_callback) (_("Extensions"), "", 0); @@ -457,7 +458,7 @@ plug_in_init (Gimp *gimp, (proc_def->db_info.num_args == 0) && (proc_def->db_info.proc_type == GIMP_EXTENSION)) { - if (be_verbose) + if (gimp->be_verbose) g_print ("%s ", proc_def->db_info.name); (* status_callback) (NULL, proc_def->db_info.name, nth / nplugins); @@ -466,7 +467,7 @@ plug_in_init (Gimp *gimp, } } - if (be_verbose) + if (gimp->be_verbose) g_print ("\n"); /* create help path list and free up stuff */ @@ -1087,7 +1088,7 @@ plug_in_open (PlugIn *plug_in) plug_in->args[4] = g_strdup ("-run"); } - plug_in->args[5] = g_strdup_printf ("%d", (gint) stack_trace_mode); + plug_in->args[5] = g_strdup_printf ("%d", the_gimp->stack_trace_mode); /* Fork another process. We'll remember the process id * so that we can later use it to kill the filter if diff --git a/app/plug-in/plug-in-def.c b/app/plug-in/plug-in-def.c index e85060d12b..c2e0e21c9f 100644 --- a/app/plug-in/plug-in-def.c +++ b/app/plug-in/plug-in-def.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "display/display-types.h" +#include "plug-in-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -96,6 +96,8 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "widgets/widgets-types.h" + #include "widgets/gimpitemfactory.h" #include "display/gimpdisplay.h" @@ -104,12 +106,11 @@ #include "gui/gradient-select.h" #include "gui/pattern-select.h" +#include "plug-in.h" + #include "app_procs.h" -#include "appenv.h" -#include "errors.h" #include "gimpprogress.h" #include "gimprc.h" -#include "plug_in.h" #include "libgimp/gimpintl.h" @@ -382,7 +383,7 @@ plug_in_init (Gimp *gimp, { write_pluginrc = TRUE; - if (be_verbose) + if (gimp->be_verbose) g_print (_("query plug-in: \"%s\"\n"), plug_in_def->prog); plug_in_query (plug_in_def); @@ -422,7 +423,7 @@ plug_in_init (Gimp *gimp, /* write the pluginrc file if necessary */ if (write_pluginrc) { - if (be_verbose) + if (gimp->be_verbose) g_print (_("writing \"%s\"\n"), filename); plug_in_write_rc (filename); @@ -440,7 +441,7 @@ plug_in_init (Gimp *gimp, } /* run the available extensions */ - if (be_verbose) + if (gimp->be_verbose) g_print (_("Starting extensions: ")); (* status_callback) (_("Extensions"), "", 0); @@ -457,7 +458,7 @@ plug_in_init (Gimp *gimp, (proc_def->db_info.num_args == 0) && (proc_def->db_info.proc_type == GIMP_EXTENSION)) { - if (be_verbose) + if (gimp->be_verbose) g_print ("%s ", proc_def->db_info.name); (* status_callback) (NULL, proc_def->db_info.name, nth / nplugins); @@ -466,7 +467,7 @@ plug_in_init (Gimp *gimp, } } - if (be_verbose) + if (gimp->be_verbose) g_print ("\n"); /* create help path list and free up stuff */ @@ -1087,7 +1088,7 @@ plug_in_open (PlugIn *plug_in) plug_in->args[4] = g_strdup ("-run"); } - plug_in->args[5] = g_strdup_printf ("%d", (gint) stack_trace_mode); + plug_in->args[5] = g_strdup_printf ("%d", the_gimp->stack_trace_mode); /* Fork another process. We'll remember the process id * so that we can later use it to kill the filter if diff --git a/app/plug-in/plug-in-def.h b/app/plug-in/plug-in-def.h index 1ca0517ea9..2cf2bc16f3 100644 --- a/app/plug-in/plug-in-def.h +++ b/app/plug-in/plug-in-def.h @@ -23,12 +23,7 @@ #include /* time_t */ #include /* pid_t */ - -/* FIXME: move the plugin stuff to plug-in/ */ - -#include "plug-in/plug-in-types.h" - -#include "pdb/procedural_db.h" +#include "pdb/procedural_db.h" /* ProcRecord */ #define WRITE_BUFFER_SIZE 512 diff --git a/app/plug-in/plug-in-message.c b/app/plug-in/plug-in-message.c index e85060d12b..c2e0e21c9f 100644 --- a/app/plug-in/plug-in-message.c +++ b/app/plug-in/plug-in-message.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "display/display-types.h" +#include "plug-in-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -96,6 +96,8 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "widgets/widgets-types.h" + #include "widgets/gimpitemfactory.h" #include "display/gimpdisplay.h" @@ -104,12 +106,11 @@ #include "gui/gradient-select.h" #include "gui/pattern-select.h" +#include "plug-in.h" + #include "app_procs.h" -#include "appenv.h" -#include "errors.h" #include "gimpprogress.h" #include "gimprc.h" -#include "plug_in.h" #include "libgimp/gimpintl.h" @@ -382,7 +383,7 @@ plug_in_init (Gimp *gimp, { write_pluginrc = TRUE; - if (be_verbose) + if (gimp->be_verbose) g_print (_("query plug-in: \"%s\"\n"), plug_in_def->prog); plug_in_query (plug_in_def); @@ -422,7 +423,7 @@ plug_in_init (Gimp *gimp, /* write the pluginrc file if necessary */ if (write_pluginrc) { - if (be_verbose) + if (gimp->be_verbose) g_print (_("writing \"%s\"\n"), filename); plug_in_write_rc (filename); @@ -440,7 +441,7 @@ plug_in_init (Gimp *gimp, } /* run the available extensions */ - if (be_verbose) + if (gimp->be_verbose) g_print (_("Starting extensions: ")); (* status_callback) (_("Extensions"), "", 0); @@ -457,7 +458,7 @@ plug_in_init (Gimp *gimp, (proc_def->db_info.num_args == 0) && (proc_def->db_info.proc_type == GIMP_EXTENSION)) { - if (be_verbose) + if (gimp->be_verbose) g_print ("%s ", proc_def->db_info.name); (* status_callback) (NULL, proc_def->db_info.name, nth / nplugins); @@ -466,7 +467,7 @@ plug_in_init (Gimp *gimp, } } - if (be_verbose) + if (gimp->be_verbose) g_print ("\n"); /* create help path list and free up stuff */ @@ -1087,7 +1088,7 @@ plug_in_open (PlugIn *plug_in) plug_in->args[4] = g_strdup ("-run"); } - plug_in->args[5] = g_strdup_printf ("%d", (gint) stack_trace_mode); + plug_in->args[5] = g_strdup_printf ("%d", the_gimp->stack_trace_mode); /* Fork another process. We'll remember the process id * so that we can later use it to kill the filter if diff --git a/app/plug-in/plug-in-params.c b/app/plug-in/plug-in-params.c index e85060d12b..c2e0e21c9f 100644 --- a/app/plug-in/plug-in-params.c +++ b/app/plug-in/plug-in-params.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "display/display-types.h" +#include "plug-in-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -96,6 +96,8 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "widgets/widgets-types.h" + #include "widgets/gimpitemfactory.h" #include "display/gimpdisplay.h" @@ -104,12 +106,11 @@ #include "gui/gradient-select.h" #include "gui/pattern-select.h" +#include "plug-in.h" + #include "app_procs.h" -#include "appenv.h" -#include "errors.h" #include "gimpprogress.h" #include "gimprc.h" -#include "plug_in.h" #include "libgimp/gimpintl.h" @@ -382,7 +383,7 @@ plug_in_init (Gimp *gimp, { write_pluginrc = TRUE; - if (be_verbose) + if (gimp->be_verbose) g_print (_("query plug-in: \"%s\"\n"), plug_in_def->prog); plug_in_query (plug_in_def); @@ -422,7 +423,7 @@ plug_in_init (Gimp *gimp, /* write the pluginrc file if necessary */ if (write_pluginrc) { - if (be_verbose) + if (gimp->be_verbose) g_print (_("writing \"%s\"\n"), filename); plug_in_write_rc (filename); @@ -440,7 +441,7 @@ plug_in_init (Gimp *gimp, } /* run the available extensions */ - if (be_verbose) + if (gimp->be_verbose) g_print (_("Starting extensions: ")); (* status_callback) (_("Extensions"), "", 0); @@ -457,7 +458,7 @@ plug_in_init (Gimp *gimp, (proc_def->db_info.num_args == 0) && (proc_def->db_info.proc_type == GIMP_EXTENSION)) { - if (be_verbose) + if (gimp->be_verbose) g_print ("%s ", proc_def->db_info.name); (* status_callback) (NULL, proc_def->db_info.name, nth / nplugins); @@ -466,7 +467,7 @@ plug_in_init (Gimp *gimp, } } - if (be_verbose) + if (gimp->be_verbose) g_print ("\n"); /* create help path list and free up stuff */ @@ -1087,7 +1088,7 @@ plug_in_open (PlugIn *plug_in) plug_in->args[4] = g_strdup ("-run"); } - plug_in->args[5] = g_strdup_printf ("%d", (gint) stack_trace_mode); + plug_in->args[5] = g_strdup_printf ("%d", the_gimp->stack_trace_mode); /* Fork another process. We'll remember the process id * so that we can later use it to kill the filter if diff --git a/app/plug-in/plug-in-params.h b/app/plug-in/plug-in-params.h index 1ca0517ea9..2cf2bc16f3 100644 --- a/app/plug-in/plug-in-params.h +++ b/app/plug-in/plug-in-params.h @@ -23,12 +23,7 @@ #include /* time_t */ #include /* pid_t */ - -/* FIXME: move the plugin stuff to plug-in/ */ - -#include "plug-in/plug-in-types.h" - -#include "pdb/procedural_db.h" +#include "pdb/procedural_db.h" /* ProcRecord */ #define WRITE_BUFFER_SIZE 512 diff --git a/app/plug-in/plug-in-progress.c b/app/plug-in/plug-in-progress.c index e85060d12b..c2e0e21c9f 100644 --- a/app/plug-in/plug-in-progress.c +++ b/app/plug-in/plug-in-progress.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "display/display-types.h" +#include "plug-in-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -96,6 +96,8 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "widgets/widgets-types.h" + #include "widgets/gimpitemfactory.h" #include "display/gimpdisplay.h" @@ -104,12 +106,11 @@ #include "gui/gradient-select.h" #include "gui/pattern-select.h" +#include "plug-in.h" + #include "app_procs.h" -#include "appenv.h" -#include "errors.h" #include "gimpprogress.h" #include "gimprc.h" -#include "plug_in.h" #include "libgimp/gimpintl.h" @@ -382,7 +383,7 @@ plug_in_init (Gimp *gimp, { write_pluginrc = TRUE; - if (be_verbose) + if (gimp->be_verbose) g_print (_("query plug-in: \"%s\"\n"), plug_in_def->prog); plug_in_query (plug_in_def); @@ -422,7 +423,7 @@ plug_in_init (Gimp *gimp, /* write the pluginrc file if necessary */ if (write_pluginrc) { - if (be_verbose) + if (gimp->be_verbose) g_print (_("writing \"%s\"\n"), filename); plug_in_write_rc (filename); @@ -440,7 +441,7 @@ plug_in_init (Gimp *gimp, } /* run the available extensions */ - if (be_verbose) + if (gimp->be_verbose) g_print (_("Starting extensions: ")); (* status_callback) (_("Extensions"), "", 0); @@ -457,7 +458,7 @@ plug_in_init (Gimp *gimp, (proc_def->db_info.num_args == 0) && (proc_def->db_info.proc_type == GIMP_EXTENSION)) { - if (be_verbose) + if (gimp->be_verbose) g_print ("%s ", proc_def->db_info.name); (* status_callback) (NULL, proc_def->db_info.name, nth / nplugins); @@ -466,7 +467,7 @@ plug_in_init (Gimp *gimp, } } - if (be_verbose) + if (gimp->be_verbose) g_print ("\n"); /* create help path list and free up stuff */ @@ -1087,7 +1088,7 @@ plug_in_open (PlugIn *plug_in) plug_in->args[4] = g_strdup ("-run"); } - plug_in->args[5] = g_strdup_printf ("%d", (gint) stack_trace_mode); + plug_in->args[5] = g_strdup_printf ("%d", the_gimp->stack_trace_mode); /* Fork another process. We'll remember the process id * so that we can later use it to kill the filter if diff --git a/app/plug-in/plug-in-progress.h b/app/plug-in/plug-in-progress.h index 1ca0517ea9..2cf2bc16f3 100644 --- a/app/plug-in/plug-in-progress.h +++ b/app/plug-in/plug-in-progress.h @@ -23,12 +23,7 @@ #include /* time_t */ #include /* pid_t */ - -/* FIXME: move the plugin stuff to plug-in/ */ - -#include "plug-in/plug-in-types.h" - -#include "pdb/procedural_db.h" +#include "pdb/procedural_db.h" /* ProcRecord */ #define WRITE_BUFFER_SIZE 512 diff --git a/app/plug-in/plug-in-run.c b/app/plug-in/plug-in-run.c index e85060d12b..c2e0e21c9f 100644 --- a/app/plug-in/plug-in-run.c +++ b/app/plug-in/plug-in-run.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "display/display-types.h" +#include "plug-in-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -96,6 +96,8 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "widgets/widgets-types.h" + #include "widgets/gimpitemfactory.h" #include "display/gimpdisplay.h" @@ -104,12 +106,11 @@ #include "gui/gradient-select.h" #include "gui/pattern-select.h" +#include "plug-in.h" + #include "app_procs.h" -#include "appenv.h" -#include "errors.h" #include "gimpprogress.h" #include "gimprc.h" -#include "plug_in.h" #include "libgimp/gimpintl.h" @@ -382,7 +383,7 @@ plug_in_init (Gimp *gimp, { write_pluginrc = TRUE; - if (be_verbose) + if (gimp->be_verbose) g_print (_("query plug-in: \"%s\"\n"), plug_in_def->prog); plug_in_query (plug_in_def); @@ -422,7 +423,7 @@ plug_in_init (Gimp *gimp, /* write the pluginrc file if necessary */ if (write_pluginrc) { - if (be_verbose) + if (gimp->be_verbose) g_print (_("writing \"%s\"\n"), filename); plug_in_write_rc (filename); @@ -440,7 +441,7 @@ plug_in_init (Gimp *gimp, } /* run the available extensions */ - if (be_verbose) + if (gimp->be_verbose) g_print (_("Starting extensions: ")); (* status_callback) (_("Extensions"), "", 0); @@ -457,7 +458,7 @@ plug_in_init (Gimp *gimp, (proc_def->db_info.num_args == 0) && (proc_def->db_info.proc_type == GIMP_EXTENSION)) { - if (be_verbose) + if (gimp->be_verbose) g_print ("%s ", proc_def->db_info.name); (* status_callback) (NULL, proc_def->db_info.name, nth / nplugins); @@ -466,7 +467,7 @@ plug_in_init (Gimp *gimp, } } - if (be_verbose) + if (gimp->be_verbose) g_print ("\n"); /* create help path list and free up stuff */ @@ -1087,7 +1088,7 @@ plug_in_open (PlugIn *plug_in) plug_in->args[4] = g_strdup ("-run"); } - plug_in->args[5] = g_strdup_printf ("%d", (gint) stack_trace_mode); + plug_in->args[5] = g_strdup_printf ("%d", the_gimp->stack_trace_mode); /* Fork another process. We'll remember the process id * so that we can later use it to kill the filter if diff --git a/app/plug-in/plug-in-shm.c b/app/plug-in/plug-in-shm.c index e85060d12b..c2e0e21c9f 100644 --- a/app/plug-in/plug-in-shm.c +++ b/app/plug-in/plug-in-shm.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "display/display-types.h" +#include "plug-in-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -96,6 +96,8 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "widgets/widgets-types.h" + #include "widgets/gimpitemfactory.h" #include "display/gimpdisplay.h" @@ -104,12 +106,11 @@ #include "gui/gradient-select.h" #include "gui/pattern-select.h" +#include "plug-in.h" + #include "app_procs.h" -#include "appenv.h" -#include "errors.h" #include "gimpprogress.h" #include "gimprc.h" -#include "plug_in.h" #include "libgimp/gimpintl.h" @@ -382,7 +383,7 @@ plug_in_init (Gimp *gimp, { write_pluginrc = TRUE; - if (be_verbose) + if (gimp->be_verbose) g_print (_("query plug-in: \"%s\"\n"), plug_in_def->prog); plug_in_query (plug_in_def); @@ -422,7 +423,7 @@ plug_in_init (Gimp *gimp, /* write the pluginrc file if necessary */ if (write_pluginrc) { - if (be_verbose) + if (gimp->be_verbose) g_print (_("writing \"%s\"\n"), filename); plug_in_write_rc (filename); @@ -440,7 +441,7 @@ plug_in_init (Gimp *gimp, } /* run the available extensions */ - if (be_verbose) + if (gimp->be_verbose) g_print (_("Starting extensions: ")); (* status_callback) (_("Extensions"), "", 0); @@ -457,7 +458,7 @@ plug_in_init (Gimp *gimp, (proc_def->db_info.num_args == 0) && (proc_def->db_info.proc_type == GIMP_EXTENSION)) { - if (be_verbose) + if (gimp->be_verbose) g_print ("%s ", proc_def->db_info.name); (* status_callback) (NULL, proc_def->db_info.name, nth / nplugins); @@ -466,7 +467,7 @@ plug_in_init (Gimp *gimp, } } - if (be_verbose) + if (gimp->be_verbose) g_print ("\n"); /* create help path list and free up stuff */ @@ -1087,7 +1088,7 @@ plug_in_open (PlugIn *plug_in) plug_in->args[4] = g_strdup ("-run"); } - plug_in->args[5] = g_strdup_printf ("%d", (gint) stack_trace_mode); + plug_in->args[5] = g_strdup_printf ("%d", the_gimp->stack_trace_mode); /* Fork another process. We'll remember the process id * so that we can later use it to kill the filter if diff --git a/app/plug-in/plug-in-types.h b/app/plug-in/plug-in-types.h index ca87fa6bf1..22cfdf34c7 100644 --- a/app/plug-in/plug-in-types.h +++ b/app/plug-in/plug-in-types.h @@ -21,7 +21,6 @@ #include "core/core-types.h" -#include "pdb/pdb-types.h" typedef enum diff --git a/app/plug-in/plug-in.c b/app/plug-in/plug-in.c index e85060d12b..c2e0e21c9f 100644 --- a/app/plug-in/plug-in.c +++ b/app/plug-in/plug-in.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "display/display-types.h" +#include "plug-in-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -96,6 +96,8 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "widgets/widgets-types.h" + #include "widgets/gimpitemfactory.h" #include "display/gimpdisplay.h" @@ -104,12 +106,11 @@ #include "gui/gradient-select.h" #include "gui/pattern-select.h" +#include "plug-in.h" + #include "app_procs.h" -#include "appenv.h" -#include "errors.h" #include "gimpprogress.h" #include "gimprc.h" -#include "plug_in.h" #include "libgimp/gimpintl.h" @@ -382,7 +383,7 @@ plug_in_init (Gimp *gimp, { write_pluginrc = TRUE; - if (be_verbose) + if (gimp->be_verbose) g_print (_("query plug-in: \"%s\"\n"), plug_in_def->prog); plug_in_query (plug_in_def); @@ -422,7 +423,7 @@ plug_in_init (Gimp *gimp, /* write the pluginrc file if necessary */ if (write_pluginrc) { - if (be_verbose) + if (gimp->be_verbose) g_print (_("writing \"%s\"\n"), filename); plug_in_write_rc (filename); @@ -440,7 +441,7 @@ plug_in_init (Gimp *gimp, } /* run the available extensions */ - if (be_verbose) + if (gimp->be_verbose) g_print (_("Starting extensions: ")); (* status_callback) (_("Extensions"), "", 0); @@ -457,7 +458,7 @@ plug_in_init (Gimp *gimp, (proc_def->db_info.num_args == 0) && (proc_def->db_info.proc_type == GIMP_EXTENSION)) { - if (be_verbose) + if (gimp->be_verbose) g_print ("%s ", proc_def->db_info.name); (* status_callback) (NULL, proc_def->db_info.name, nth / nplugins); @@ -466,7 +467,7 @@ plug_in_init (Gimp *gimp, } } - if (be_verbose) + if (gimp->be_verbose) g_print ("\n"); /* create help path list and free up stuff */ @@ -1087,7 +1088,7 @@ plug_in_open (PlugIn *plug_in) plug_in->args[4] = g_strdup ("-run"); } - plug_in->args[5] = g_strdup_printf ("%d", (gint) stack_trace_mode); + plug_in->args[5] = g_strdup_printf ("%d", the_gimp->stack_trace_mode); /* Fork another process. We'll remember the process id * so that we can later use it to kill the filter if diff --git a/app/plug-in/plug-in.h b/app/plug-in/plug-in.h index 1ca0517ea9..2cf2bc16f3 100644 --- a/app/plug-in/plug-in.h +++ b/app/plug-in/plug-in.h @@ -23,12 +23,7 @@ #include /* time_t */ #include /* pid_t */ - -/* FIXME: move the plugin stuff to plug-in/ */ - -#include "plug-in/plug-in-types.h" - -#include "pdb/procedural_db.h" +#include "pdb/procedural_db.h" /* ProcRecord */ #define WRITE_BUFFER_SIZE 512 diff --git a/app/plug-in/plug-ins.c b/app/plug-in/plug-ins.c index e85060d12b..c2e0e21c9f 100644 --- a/app/plug-in/plug-ins.c +++ b/app/plug-in/plug-ins.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "display/display-types.h" +#include "plug-in-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -96,6 +96,8 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "widgets/widgets-types.h" + #include "widgets/gimpitemfactory.h" #include "display/gimpdisplay.h" @@ -104,12 +106,11 @@ #include "gui/gradient-select.h" #include "gui/pattern-select.h" +#include "plug-in.h" + #include "app_procs.h" -#include "appenv.h" -#include "errors.h" #include "gimpprogress.h" #include "gimprc.h" -#include "plug_in.h" #include "libgimp/gimpintl.h" @@ -382,7 +383,7 @@ plug_in_init (Gimp *gimp, { write_pluginrc = TRUE; - if (be_verbose) + if (gimp->be_verbose) g_print (_("query plug-in: \"%s\"\n"), plug_in_def->prog); plug_in_query (plug_in_def); @@ -422,7 +423,7 @@ plug_in_init (Gimp *gimp, /* write the pluginrc file if necessary */ if (write_pluginrc) { - if (be_verbose) + if (gimp->be_verbose) g_print (_("writing \"%s\"\n"), filename); plug_in_write_rc (filename); @@ -440,7 +441,7 @@ plug_in_init (Gimp *gimp, } /* run the available extensions */ - if (be_verbose) + if (gimp->be_verbose) g_print (_("Starting extensions: ")); (* status_callback) (_("Extensions"), "", 0); @@ -457,7 +458,7 @@ plug_in_init (Gimp *gimp, (proc_def->db_info.num_args == 0) && (proc_def->db_info.proc_type == GIMP_EXTENSION)) { - if (be_verbose) + if (gimp->be_verbose) g_print ("%s ", proc_def->db_info.name); (* status_callback) (NULL, proc_def->db_info.name, nth / nplugins); @@ -466,7 +467,7 @@ plug_in_init (Gimp *gimp, } } - if (be_verbose) + if (gimp->be_verbose) g_print ("\n"); /* create help path list and free up stuff */ @@ -1087,7 +1088,7 @@ plug_in_open (PlugIn *plug_in) plug_in->args[4] = g_strdup ("-run"); } - plug_in->args[5] = g_strdup_printf ("%d", (gint) stack_trace_mode); + plug_in->args[5] = g_strdup_printf ("%d", the_gimp->stack_trace_mode); /* Fork another process. We'll remember the process id * so that we can later use it to kill the filter if diff --git a/app/plug-in/plug-ins.h b/app/plug-in/plug-ins.h index 1ca0517ea9..2cf2bc16f3 100644 --- a/app/plug-in/plug-ins.h +++ b/app/plug-in/plug-ins.h @@ -23,12 +23,7 @@ #include /* time_t */ #include /* pid_t */ - -/* FIXME: move the plugin stuff to plug-in/ */ - -#include "plug-in/plug-in-types.h" - -#include "pdb/procedural_db.h" +#include "pdb/procedural_db.h" /* ProcRecord */ #define WRITE_BUFFER_SIZE 512 diff --git a/app/plug_in.c b/app/plug_in.c deleted file mode 100644 index e85060d12b..0000000000 --- a/app/plug_in.c +++ /dev/null @@ -1,3773 +0,0 @@ -/* 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 - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#ifdef HAVE_SYS_PARAM_H -#include -#endif - -#include - -#include -#include -#include -#include -#include -#ifdef HAVE_SYS_WAIT_H -#include -#endif -#ifdef HAVE_SYS_TIME_H -#include -#endif -#include -#include -#include -#ifdef HAVE_UNISTD_H -#include -#endif - -#if defined(G_OS_WIN32) || defined(G_WITH_CYGWIN) -#define STRICT -#include -#include - -#ifdef G_OS_WIN32 -#include -#include -#ifndef S_ISREG -#define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG) -#endif -#endif - -#ifdef G_WITH_CYGWIN -#define O_TEXT 0x0100 /* text file */ -#define _O_TEXT 0x0100 /* text file */ -#define O_BINARY 0x0200 /* binary file */ -#define _O_BINARY 0x0200 /* binary file */ -#endif - -#endif - -#ifdef __EMX__ -#include -#include -#define _O_BINARY O_BINARY -#define _P_NOWAIT P_NOWAIT -#define xspawnv spawnv -#endif - -#ifdef HAVE_IPC_H -#include -#endif - -#ifdef HAVE_SHM_H -#include -#endif - -#include "libgimpbase/gimpbase.h" -#include "libgimpbase/gimpprotocol.h" -#include "libgimpbase/gimpwire.h" - -#include "display/display-types.h" - -#include "base/tile.h" -#include "base/tile-manager.h" - -#include "core/gimp.h" -#include "core/gimpcontext.h" -#include "core/gimpcoreconfig.h" -#include "core/gimpdatafiles.h" -#include "core/gimpdrawable.h" -#include "core/gimpimage.h" - -#include "widgets/gimpitemfactory.h" - -#include "display/gimpdisplay.h" - -#include "gui/brush-select.h" -#include "gui/gradient-select.h" -#include "gui/pattern-select.h" - -#include "app_procs.h" -#include "appenv.h" -#include "errors.h" -#include "gimpprogress.h" -#include "gimprc.h" -#include "plug_in.h" - -#include "libgimp/gimpintl.h" - - -struct _PlugInDef -{ - gchar *prog; - GSList *proc_defs; - gchar *locale_domain; - gchar *locale_path; - gchar *help_path; - time_t mtime; - gboolean query; -}; - - -typedef struct _PlugInBlocked PlugInBlocked; - -struct _PlugInBlocked -{ - PlugIn *plug_in; - gchar *proc_name; -}; - - -typedef struct _PlugInMenuEntry PlugInMenuEntry; - -struct _PlugInMenuEntry -{ - PlugInProcDef *proc_def; - gchar *domain; - gchar *help_path; -}; - - -typedef struct _PlugInHelpPathDef PlugInHelpPathDef; - -struct _PlugInHelpPathDef -{ - gchar *prog_name; - gchar *help_path; -}; - - -static gboolean plug_in_write (GIOChannel *channel, - guint8 *buf, - gulong count); -static gboolean plug_in_flush (GIOChannel *channel); -static void plug_in_push (PlugIn *plug_in); -static void plug_in_pop (void); -static gboolean plug_in_recv_message (GIOChannel *channel, - GIOCondition cond, - gpointer data); -static void plug_in_handle_message (WireMessage *msg); -static void plug_in_handle_quit (void); -static void plug_in_handle_tile_req (GPTileReq *tile_req); -static void plug_in_handle_proc_run (GPProcRun *proc_run); -static void plug_in_handle_proc_return (GPProcReturn *proc_return); -static void plug_in_handle_proc_install (GPProcInstall *proc_install); -static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall); -static void plug_in_write_rc (const gchar *filename); -static void plug_in_init_file (const gchar *filename, - gpointer loader_data); -static void plug_in_query (PlugInDef *plug_in_def); -static void plug_in_add_to_db (void); -static void plug_in_make_menu (void); -static gint plug_in_make_menu_entry (gpointer foo, - PlugInMenuEntry *menu_entry, - gpointer bar); -static void plug_in_callback (GtkWidget *widget, - gpointer client_data); -static void plug_in_proc_def_insert (PlugInProcDef *proc_def, - void (* superceed_fn) (void *)); -static void plug_in_proc_def_dead (void *freed_proc_def); -static void plug_in_proc_def_remove (PlugInProcDef *proc_def); -static void plug_in_proc_def_destroy (PlugInProcDef *proc_def, - gboolean data_only); - -static Argument * plug_in_temp_run (ProcRecord *proc_rec, - Argument *args, - gint argc); -static Argument * plug_in_params_to_args (GPParam *params, - gint nparams, - gboolean full_copy); -static GPParam * plug_in_args_to_params (Argument *args, - gint nargs, - gboolean full_copy); -static void plug_in_params_destroy (GPParam *params, - gint nparams, - gboolean full_destroy); -static void plug_in_args_destroy (Argument *args, - gint nargs, - gboolean full_destroy); -static void plug_in_init_shm (void); - -static gchar * plug_in_search_in_path (gchar *search_path, - gchar *filename); - - -PlugIn *current_plug_in = NULL; -GSList *proc_defs = NULL; - -static GSList *plug_in_defs = NULL; -static GSList *gimprc_proc_defs = NULL; -static GSList *open_plug_ins = NULL; -static GSList *blocked_plug_ins = NULL; - -static GSList *help_path_defs = NULL; - -static GSList *plug_in_stack = NULL; -static GIOChannel *current_readchannel = NULL; -static GIOChannel *current_writechannel = NULL; -static gint current_write_buffer_index = 0; -static gchar *current_write_buffer = NULL; -static Argument *current_return_vals = NULL; -static gint current_return_nvals = 0; - -static ProcRecord *last_plug_in = NULL; - -static gint shm_ID = -1; -static guchar *shm_addr = NULL; - -#if defined(G_OS_WIN32) || defined(G_WITH_CYGWIN) -static HANDLE shm_handle; -#endif - -static gboolean write_pluginrc = FALSE; - -static gchar *std_plugins_domain = "gimp-std-plugins"; - - -static void -plug_in_init_shm (void) -{ - /* allocate a piece of shared memory for use in transporting tiles - * to plug-ins. if we can't allocate a piece of shared memory then - * we'll fall back on sending the data over the pipe. - */ - -#ifdef HAVE_SHM_H - shm_ID = shmget (IPC_PRIVATE, TILE_WIDTH * TILE_HEIGHT * 4, IPC_CREAT | 0777); - - if (shm_ID == -1) - g_message ("shmget() failed: Disabling shared memory tile transport."); - else - { - shm_addr = (guchar *) shmat (shm_ID, NULL, 0); - if (shm_addr == (guchar *) -1) - { - g_message ("shmat() failed: Disabling shared memory tile transport."); - shmctl (shm_ID, IPC_RMID, NULL); - shm_ID = -1; - } - -#ifdef IPC_RMID_DEFERRED_RELEASE - if (shm_addr != (guchar *) -1) - shmctl (shm_ID, IPC_RMID, NULL); -#endif - } -#else -#if defined(G_OS_WIN32) || defined(G_WITH_CYGWIN) - /* Use Win32 shared memory mechanisms for - * transfering tile data. - */ - gint pid; - gchar fileMapName[MAX_PATH]; - gint tileByteSize = TILE_WIDTH * TILE_HEIGHT * 4; - - /* Our shared memory id will be our process ID */ - pid = GetCurrentProcessId (); - - /* From the id, derive the file map name */ - g_snprintf (fileMapName, sizeof (fileMapName), "GIMP%d.SHM", pid); - - /* Create the file mapping into paging space */ - shm_handle = CreateFileMapping ((HANDLE) 0xFFFFFFFF, NULL, - PAGE_READWRITE, 0, - tileByteSize, fileMapName); - - if (shm_handle) - { - /* Map the shared memory into our address space for use */ - shm_addr = (guchar *) MapViewOfFile(shm_handle, - FILE_MAP_ALL_ACCESS, - 0, 0, tileByteSize); - - /* Verify that we mapped our view */ - if (shm_addr) - shm_ID = pid; - else - { - g_warning ("MapViewOfFile error: %d... disabling shared memory transport\n", GetLastError()); - } - } - else - { - g_warning ("CreateFileMapping error: %d... disabling shared memory transport\n", GetLastError()); - } -#endif -#endif -} - -void -plug_in_init (Gimp *gimp, - GimpInitStatusFunc status_callback) -{ - extern gboolean use_shm; - - gchar *filename; - gchar *basename; - GSList *tmp; - GSList *tmp2; - PlugInDef *plug_in_def; - PlugInProcDef *proc_def; - gfloat nplugins; - gfloat nth; - - g_return_if_fail (GIMP_IS_GIMP (gimp)); - g_return_if_fail (status_callback != NULL); - - /* initialize the gimp protocol library and set the read and - * write handlers. - */ - gp_init (); - wire_set_writer (plug_in_write); - wire_set_flusher (plug_in_flush); - - /* allocate a piece of shared memory for use in transporting tiles - * to plug-ins. if we can't allocate a piece of shared memory then - * we'll fall back on sending the data over the pipe. - */ - if (use_shm) - plug_in_init_shm (); - - /* search for binaries in the plug-in directory path */ - gimp_datafiles_read_directories (the_gimp->config->plug_in_path, - MODE_EXECUTABLE, - plug_in_init_file, NULL); - - /* read the pluginrc file for cached data */ - filename = NULL; - if (the_gimp->config->pluginrc_path) - { - if (g_path_is_absolute (the_gimp->config->pluginrc_path)) - filename = g_strdup (the_gimp->config->pluginrc_path); - else - filename = g_build_filename (gimp_directory (), - the_gimp->config->pluginrc_path, - NULL); - } - else - filename = gimp_personal_rc_file ("pluginrc"); - - (* status_callback) (_("Resource configuration"), filename, -1); - gimprc_parse_file (filename); - - /* query any plug-ins that have changed since we last wrote out - * the pluginrc file. - */ - tmp = plug_in_defs; - (* status_callback) (_("Plug-ins"), "", 0); - nplugins = g_slist_length (tmp); - nth = 0; - while (tmp) - { - plug_in_def = tmp->data; - tmp = tmp->next; - - if (plug_in_def->query) - { - write_pluginrc = TRUE; - - if (be_verbose) - g_print (_("query plug-in: \"%s\"\n"), plug_in_def->prog); - - plug_in_query (plug_in_def); - } - - basename = g_path_get_basename (plug_in_def->prog); - (* status_callback) (NULL, basename, nth / nplugins); - nth++; - g_free (basename); - } - - /* insert the proc defs */ - for (tmp = gimprc_proc_defs; tmp; tmp = g_slist_next (tmp)) - { - proc_def = g_new (PlugInProcDef, 1); - *proc_def = *((PlugInProcDef*) tmp->data); - plug_in_proc_def_insert (proc_def, NULL); - } - - tmp = plug_in_defs; - while (tmp) - { - plug_in_def = tmp->data; - tmp = tmp->next; - - tmp2 = plug_in_def->proc_defs; - while (tmp2) - { - proc_def = tmp2->data; - tmp2 = tmp2->next; - - proc_def->mtime = plug_in_def->mtime; - plug_in_proc_def_insert (proc_def, plug_in_proc_def_dead); - } - } - - /* write the pluginrc file if necessary */ - if (write_pluginrc) - { - if (be_verbose) - g_print (_("writing \"%s\"\n"), filename); - - plug_in_write_rc (filename); - } - - g_free (filename); - - /* add the plug-in procs to the procedure database */ - plug_in_add_to_db (); - - if (! gimp->no_interface) - { - /* make the menu */ - plug_in_make_menu (); - } - - /* run the available extensions */ - if (be_verbose) - g_print (_("Starting extensions: ")); - - (* status_callback) (_("Extensions"), "", 0); - - tmp = proc_defs; - nplugins = g_slist_length (tmp); nth = 0; - - while (tmp) - { - proc_def = tmp->data; - tmp = tmp->next; - - if (proc_def->prog && - (proc_def->db_info.num_args == 0) && - (proc_def->db_info.proc_type == GIMP_EXTENSION)) - { - if (be_verbose) - g_print ("%s ", proc_def->db_info.name); - - (* status_callback) (NULL, proc_def->db_info.name, nth / nplugins); - - plug_in_run (&proc_def->db_info, NULL, 0, FALSE, TRUE, -1); - } - } - - if (be_verbose) - g_print ("\n"); - - /* create help path list and free up stuff */ - for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp)) - { - plug_in_def = tmp->data; - - if (plug_in_def->help_path) - { - PlugInHelpPathDef *help_path_def; - - help_path_def = g_new (PlugInHelpPathDef, 1); - - help_path_def->prog_name = g_strdup (plug_in_def->prog); - help_path_def->help_path = g_strdup (plug_in_def->help_path); - - help_path_defs = g_slist_prepend (help_path_defs, help_path_def); - } - - plug_in_def_free (plug_in_def, FALSE); - } - - g_slist_free (plug_in_defs); - plug_in_defs = NULL; -} - - -void -plug_in_kill (void) -{ - GSList *tmp; - PlugIn *plug_in; - -#if defined(G_OS_WIN32) || defined(G_WITH_CYGWIN) - CloseHandle (shm_handle); -#else -#ifdef HAVE_SHM_H -#ifndef IPC_RMID_DEFERRED_RELEASE - if (shm_ID != -1) - { - shmdt ((gchar *) shm_addr); - shmctl (shm_ID, IPC_RMID, NULL); - } -#else /* IPC_RMID_DEFERRED_RELEASE */ - if (shm_ID != -1) - shmdt ((gchar *) shm_addr); -#endif -#endif -#endif - - tmp = open_plug_ins; - while (tmp) - { - plug_in = tmp->data; - tmp = tmp->next; - - plug_in_destroy (plug_in); - } -} - -void -plug_in_add (gchar *prog, - gchar *menu_path, - gchar *accelerator) -{ - PlugInProcDef *proc_def; - GSList *tmp; - - g_return_if_fail (prog != NULL); - - if (strncmp ("plug_in_", prog, 8) != 0) - { - gchar *t = g_strdup_printf ("plug_in_%s", prog); - g_free (prog); - prog = t; - } - - tmp = gimprc_proc_defs; - while (tmp) - { - proc_def = tmp->data; - tmp = tmp->next; - - if (strcmp (proc_def->db_info.name, prog) == 0) - { - if (proc_def->db_info.name) - g_free (proc_def->db_info.name); - if (proc_def->menu_path) - g_free (proc_def->menu_path); - if (proc_def->accelerator) - g_free (proc_def->accelerator); - if (proc_def->extensions) - g_free (proc_def->extensions); - if (proc_def->prefixes) - g_free (proc_def->prefixes); - if (proc_def->magics) - g_free (proc_def->magics); - if (proc_def->image_types) - g_free (proc_def->image_types); - - proc_def->db_info.name = prog; - proc_def->menu_path = menu_path; - proc_def->accelerator = accelerator; - proc_def->prefixes = NULL; - proc_def->extensions = NULL; - proc_def->magics = NULL; - proc_def->image_types = NULL; - return; - } - } - - proc_def = g_new0 (PlugInProcDef, 1); - proc_def->db_info.name = prog; - proc_def->menu_path = menu_path; - proc_def->accelerator = accelerator; - - gimprc_proc_defs = g_slist_prepend (gimprc_proc_defs, proc_def); -} - -gchar * -plug_in_image_types (gchar *name) -{ - PlugInDef *plug_in_def; - PlugInProcDef *proc_def; - GSList *tmp; - - g_return_val_if_fail (name != NULL, NULL); - - if (current_plug_in) - { - plug_in_def = current_plug_in->user_data; - tmp = plug_in_def->proc_defs; - } - else - { - tmp = proc_defs; - } - - while (tmp) - { - proc_def = tmp->data; - tmp = tmp->next; - - if (strcmp (proc_def->db_info.name, name) == 0) - return proc_def->image_types; - } - - return NULL; -} - -GSList * -plug_in_extensions_parse (gchar *extensions) -{ - GSList *list; - gchar *extension; - gchar *next_token; - - list = NULL; - - /* EXTENSIONS can be NULL. Avoid calling strtok if it is. */ - if (extensions) - { - extensions = g_strdup (extensions); - next_token = extensions; - extension = strtok (next_token, " \t,"); - while (extension) - { - list = g_slist_prepend (list, g_strdup (extension)); - extension = strtok (NULL, " \t,"); - } - g_free (extensions); - } - - return g_slist_reverse (list); -} - -void -plug_in_add_internal (PlugInProcDef *proc_def) -{ - proc_defs = g_slist_prepend (proc_defs, proc_def); -} - -PlugInProcDef * -plug_in_file_handler (gchar *name, - gchar *extensions, - gchar *prefixes, - gchar *magics) -{ - PlugInDef *plug_in_def; - PlugInProcDef *proc_def; - GSList *tmp; - - g_return_val_if_fail (name != NULL, NULL); - - if (current_plug_in) - { - plug_in_def = current_plug_in->user_data; - tmp = plug_in_def->proc_defs; - } - else - { - tmp = proc_defs; - } - - while (tmp) - { - proc_def = tmp->data; - tmp = tmp->next; - - if (strcmp (proc_def->db_info.name, name) == 0) - { - /* EXTENSIONS can be proc_def->extensions */ - if (proc_def->extensions != extensions) - { - if (proc_def->extensions) - g_free (proc_def->extensions); - proc_def->extensions = g_strdup (extensions); - } - proc_def->extensions_list = plug_in_extensions_parse (proc_def->extensions); - - /* PREFIXES can be proc_def->prefixes */ - if (proc_def->prefixes != prefixes) - { - if (proc_def->prefixes) - g_free (proc_def->prefixes); - proc_def->prefixes = g_strdup (prefixes); - } - proc_def->prefixes_list = plug_in_extensions_parse (proc_def->prefixes); - - /* MAGICS can be proc_def->magics */ - if (proc_def->magics != magics) - { - if (proc_def->magics) - g_free (proc_def->magics); - proc_def->magics = g_strdup (magics); - } - proc_def->magics_list = plug_in_extensions_parse (proc_def->magics); - return proc_def; - } - } - - return NULL; -} - - -PlugInDef * -plug_in_def_new (const gchar *prog) -{ - PlugInDef *plug_in_def; - - g_return_val_if_fail (prog != NULL, NULL); - - plug_in_def = g_new (PlugInDef, 1); - - plug_in_def->prog = g_strdup (prog); - plug_in_def->proc_defs = NULL; - plug_in_def->locale_domain = NULL; - plug_in_def->locale_path = NULL; - plug_in_def->help_path = NULL; - plug_in_def->mtime = 0; - plug_in_def->query = FALSE; - - return plug_in_def; -} - - -void -plug_in_def_free (PlugInDef *plug_in_def, - gboolean free_proc_defs) -{ - GSList *list; - - g_free (plug_in_def->prog); - if (plug_in_def->locale_domain) - g_free (plug_in_def->locale_domain); - if (plug_in_def->locale_path) - g_free (plug_in_def->locale_path); - if (plug_in_def->help_path) - g_free (plug_in_def->help_path); - - if (free_proc_defs) - { - for (list = plug_in_def->proc_defs; list; list = list->next) - plug_in_proc_def_destroy ((PlugInProcDef *)(list->data), FALSE); - } - - if (plug_in_def->proc_defs) - g_slist_free (plug_in_def->proc_defs); - - g_free (plug_in_def); -} - -void -plug_in_def_add_proc_def (PlugInDef *plug_in_def, - PlugInProcDef *proc_def) -{ - proc_def->mtime = plug_in_def->mtime; - proc_def->prog = g_strdup (plug_in_def->prog); - - plug_in_def->proc_defs = g_slist_append (plug_in_def->proc_defs, - proc_def); -} - -void -plug_in_def_add (PlugInDef *plug_in_def) -{ - PlugInDef *tplug_in_def; - PlugInProcDef *proc_def; - GSList *tmp; - gchar *basename1; - gchar *basename2; - - basename1 = g_path_get_basename (plug_in_def->prog); - - /* If this is a file load or save plugin, make sure we have - * something for one of the extensions, prefixes, or magic number. - * Other bits of code rely on detecting file plugins by the presence - * of one of these things, but Nick Lamb's alien/unknown format - * loader needs to be able to register no extensions, prefixes or - * magics. -- austin 13/Feb/99 - */ - for (tmp = plug_in_def->proc_defs; tmp; tmp = g_slist_next (tmp)) - { - proc_def = tmp->data; - - if (!proc_def->extensions && !proc_def->prefixes && !proc_def->magics && - proc_def->menu_path && - (!strncmp (proc_def->menu_path, "", 6) || - !strncmp (proc_def->menu_path, "", 6))) - { - proc_def->extensions = g_strdup (""); - } - } - - for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp)) - { - tplug_in_def = tmp->data; - - basename2 = g_path_get_basename (tplug_in_def->prog); - - if (strcmp (basename1, basename2) == 0) - { - if ((g_ascii_strcasecmp (plug_in_def->prog, tplug_in_def->prog) == 0) && - (plug_in_def->mtime == tplug_in_def->mtime)) - { - /* Use cached plug-in entry */ - tmp->data = plug_in_def; - plug_in_def_free (tplug_in_def, TRUE); - } - else - { - plug_in_def_free (plug_in_def, TRUE); - } - - g_free (basename2); - - return; - } - - g_free (basename2); - } - - g_free (basename1); - - write_pluginrc = TRUE; - g_print ("\"%s\" executable not found\n", plug_in_def->prog); - plug_in_def_free (plug_in_def, FALSE); -} - -gchar * -plug_in_menu_path (gchar *name) -{ - PlugInDef *plug_in_def; - PlugInProcDef *proc_def; - GSList *tmp, *tmp2; - - g_return_val_if_fail (name != NULL, NULL); - - for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp)) - { - plug_in_def = tmp->data; - - for (tmp2 = plug_in_def->proc_defs; tmp2; tmp2 = g_slist_next (tmp2)) - { - proc_def = tmp2->data; - - if (strcmp (proc_def->db_info.name, name) == 0) - return proc_def->menu_path; - } - } - - for (tmp = proc_defs; tmp; tmp = g_slist_next (tmp)) - { - proc_def = tmp->data; - - if (strcmp (proc_def->db_info.name, name) == 0) - return proc_def->menu_path; - } - - return NULL; -} - -gchar * -plug_in_help_path (gchar *prog_name) -{ - PlugInHelpPathDef *help_path_def; - GSList *list; - - if (!prog_name || !strlen (prog_name)) - return NULL; - - for (list = help_path_defs; list; list = g_slist_next (list)) - { - help_path_def = (PlugInHelpPathDef *) list->data; - - if (help_path_def && - help_path_def->prog_name && - strcmp (help_path_def->prog_name, prog_name) == 0) - return help_path_def->help_path; - } - - return NULL; -} - -PlugIn * -plug_in_new (gchar *name) -{ - PlugIn *plug_in; - gchar *path; - - if (! g_path_is_absolute (name)) - { - path = plug_in_search_in_path (the_gimp->config->plug_in_path, name); - - if (! path) - { - g_message (_("Unable to locate Plug-In: \"%s\""), name); - return NULL; - } - } - else - { - path = name; - } - - plug_in = g_new (PlugIn, 1); - - plug_in->open = FALSE; - plug_in->query = FALSE; - plug_in->synchronous = FALSE; - plug_in->recurse = FALSE; - plug_in->busy = FALSE; - plug_in->pid = 0; - plug_in->args[0] = g_strdup (path); - plug_in->args[1] = g_strdup ("-gimp"); - plug_in->args[2] = NULL; - plug_in->args[3] = NULL; - plug_in->args[4] = NULL; - plug_in->args[5] = NULL; - plug_in->args[6] = NULL; - plug_in->my_read = NULL; - plug_in->my_write = NULL; - plug_in->his_read = NULL; - plug_in->his_write = NULL; - plug_in->input_id = 0; - plug_in->write_buffer_index = 0; - plug_in->temp_proc_defs = NULL; - plug_in->progress = NULL; - plug_in->user_data = NULL; - - return plug_in; -} - -void -plug_in_destroy (PlugIn *plug_in) -{ - if (plug_in) - { - if (plug_in->open) - plug_in_close (plug_in, TRUE); - - if (plug_in->args[0]) - g_free (plug_in->args[0]); - if (plug_in->args[1]) - g_free (plug_in->args[1]); - if (plug_in->args[2]) - g_free (plug_in->args[2]); - if (plug_in->args[3]) - g_free (plug_in->args[3]); - if (plug_in->args[4]) - g_free (plug_in->args[4]); - if (plug_in->args[5]) - g_free (plug_in->args[5]); - - if (plug_in->progress) - progress_end (plug_in->progress); - plug_in->progress = NULL; - - if (plug_in == current_plug_in) - plug_in_pop (); - - g_free (plug_in); - } -} - -#ifdef G_OS_WIN32 -/* The Microsoft _spawnv() does not allow to run scripts. But - * this is essential to get scripting extension up and running. - * Following the replacement function xspawnv(). - */ -gint -xspawnv (gint mode, - const gchar *cmdname, - const gchar *const *argv) -{ - gchar sExecutable[_MAX_PATH*2]; - gchar** sArgsList; - gchar sCmndLine[1024]; - gchar* sPath; - HINSTANCE hInst; - gint i; - gint pid; - - /* only use it if _spawnv fails */ - pid = _spawnv (mode, cmdname, argv); - if (pid != -1) return pid; - - /* stuff parameters into one cmndline */ - sCmndLine[0] = 0; - for (i = 1; argv[i] != NULL; i++) - { - strcat (sCmndLine, argv[i]); - strcat (sCmndLine, " "); - } - /* remove last blank */ - sCmndLine[strlen (sCmndLine)-1] = 0; - - /* do we really need _spawnv (ShelExecute seems not to do it)*/ - if (32 <= (int) FindExecutable (cmdname, - gimp_directory (), - sExecutable)) - { - /* g_print("_spawnlp %s %s %s", sExecutable, cmdname, sCmndLine); */ - - pid = _spawnlp (mode, sExecutable, "-c", cmdname, sCmndLine, NULL); - } - else - { - g_warning ("Execution error for: %s", cmdname); - return -1; - } - return pid; -} - -#endif /* G_OS_WIN32 */ - -gboolean -plug_in_open (PlugIn *plug_in) -{ - gint my_read[2]; - gint my_write[2]; - - if (plug_in) - { - /* Open two pipes. (Bidirectional communication). - */ - if ((pipe (my_read) == -1) || (pipe (my_write) == -1)) - { - g_message ("pipe() failed: Unable to start Plug-In \"%s\"\n(%s)", - g_path_get_basename (plug_in->args[0]), - plug_in->args[0]); - return FALSE; - } - -#if defined(G_WITH_CYGWIN) || defined(__EMX__) - /* Set to binary mode */ - setmode (my_read[0], _O_BINARY); - setmode (my_write[0], _O_BINARY); - setmode (my_read[1], _O_BINARY); - setmode (my_write[1], _O_BINARY); -#endif - - plug_in->my_read = g_io_channel_unix_new (my_read[0]); - plug_in->my_write = g_io_channel_unix_new (my_write[1]); - plug_in->his_read = g_io_channel_unix_new (my_write[0]); - plug_in->his_write = g_io_channel_unix_new (my_read[1]); - - g_io_channel_set_encoding (plug_in->my_read, NULL, NULL); - g_io_channel_set_encoding (plug_in->my_write, NULL, NULL); - g_io_channel_set_encoding (plug_in->his_read, NULL, NULL); - g_io_channel_set_encoding (plug_in->his_write, NULL, NULL); - - g_io_channel_set_buffered (plug_in->my_read, FALSE); - g_io_channel_set_buffered (plug_in->my_write, FALSE); - g_io_channel_set_buffered (plug_in->his_read, FALSE); - g_io_channel_set_buffered (plug_in->his_write, FALSE); - - g_io_channel_set_close_on_unref (plug_in->my_read, TRUE); - g_io_channel_set_close_on_unref (plug_in->my_write, TRUE); - g_io_channel_set_close_on_unref (plug_in->his_read, TRUE); - g_io_channel_set_close_on_unref (plug_in->his_write, TRUE); - - /* Remember the file descriptors for the pipes. - */ - plug_in->args[2] = - g_strdup_printf ("%d", g_io_channel_unix_get_fd (plug_in->his_read)); - plug_in->args[3] = - g_strdup_printf ("%d", g_io_channel_unix_get_fd (plug_in->his_write)); - - /* Set the rest of the command line arguments. - */ - if (plug_in->query) - { - plug_in->args[4] = g_strdup ("-query"); - } - else - { - plug_in->args[4] = g_strdup ("-run"); - } - - plug_in->args[5] = g_strdup_printf ("%d", (gint) stack_trace_mode); - - /* Fork another process. We'll remember the process id - * so that we can later use it to kill the filter if - * necessary. - */ -#ifdef __EMX__ - fcntl (my_read[0], F_SETFD, 1); - fcntl (my_write[1], F_SETFD, 1); -#endif -#if defined(G_OS_WIN32) || defined (G_WITH_CYGWIN) || defined(__EMX__) - plug_in->pid = xspawnv (_P_NOWAIT, plug_in->args[0], plug_in->args); - if (plug_in->pid == -1) -#else - plug_in->pid = fork (); - - if (plug_in->pid == 0) - { - g_io_channel_unref (plug_in->my_read); - plug_in->my_read = NULL; - - g_io_channel_unref (plug_in->my_write); - plug_in->my_write = NULL; - - /* Execute the filter. The "_exit" call should never - * be reached, unless some strange error condition - * exists. - */ - execvp (plug_in->args[0], plug_in->args); - _exit (1); - } - else if (plug_in->pid == -1) -#endif - { - g_message ("fork() failed: Unable to run Plug-In: \"%s\"\n(%s)", - g_path_get_basename (plug_in->args[0]), - plug_in->args[0]); - plug_in_destroy (plug_in); - return FALSE; - } - - g_io_channel_unref (plug_in->his_read); - plug_in->his_read = NULL; - - g_io_channel_unref (plug_in->his_write); - plug_in->his_write = NULL; - - if (!plug_in->synchronous) - { - plug_in->input_id = - g_io_add_watch (plug_in->my_read, - G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP, - plug_in_recv_message, - plug_in); - - open_plug_ins = g_slist_prepend (open_plug_ins, plug_in); - } - - plug_in->open = TRUE; - return TRUE; - } - - return FALSE; -} - -void -plug_in_close (PlugIn *plug_in, - gboolean kill_it) -{ - gint status; -#ifndef G_OS_WIN32 - struct timeval tv; -#endif - - g_return_if_fail (plug_in != NULL); - g_return_if_fail (plug_in->open == TRUE); - - if (! plug_in->open) - return; - - plug_in->open = FALSE; - - /* Ask the filter to exit gracefully */ - if (kill_it && plug_in->pid) - { - plug_in_push (plug_in); - gp_quit_write (current_writechannel); - plug_in_pop (); - - /* give the plug-in some time (10 ms) */ -#ifndef G_OS_WIN32 - tv.tv_sec = 0; - tv.tv_usec = 100; /* But this is 0.1 ms? */ - select (0, NULL, NULL, NULL, &tv); -#else - Sleep (10); -#endif - } - - /* If necessary, kill the filter. */ -#ifndef G_OS_WIN32 - if (kill_it && plug_in->pid) - status = kill (plug_in->pid, SIGKILL); - - /* Wait for the process to exit. This will happen - * immediately if it was just killed. - */ - if (plug_in->pid) - waitpid (plug_in->pid, &status, 0); -#else - if (kill_it && plug_in->pid) - { - /* Trying to avoid TerminateProcess (does mostly work). - * Otherwise some of our needed DLLs may get into an unstable state - * (see Win32 API docs). - */ - DWORD dwExitCode = STILL_ACTIVE; - DWORD dwTries = 10; - while ((STILL_ACTIVE == dwExitCode) - && GetExitCodeProcess((HANDLE) plug_in->pid, &dwExitCode) - && (dwTries > 0)) - { - Sleep(10); - dwTries--; - } - if (STILL_ACTIVE == dwExitCode) - { - g_warning("Terminating %s ...", plug_in->args[0]); - TerminateProcess ((HANDLE) plug_in->pid, 0); - } - } -#endif - - plug_in->pid = 0; - - /* Remove the input handler. */ - if (plug_in->input_id) - { - g_source_remove (plug_in->input_id); - plug_in->input_id = 0; - } - - /* Close the pipes. */ - if (plug_in->my_read != NULL) - { - g_io_channel_unref (plug_in->my_read); - plug_in->my_read = NULL; - } - if (plug_in->my_write != NULL) - { - g_io_channel_unref (plug_in->my_write); - plug_in->my_write = NULL; - } - if (plug_in->his_read != NULL) - { - g_io_channel_unref (plug_in->his_read); - plug_in->his_read = NULL; - } - if (plug_in->his_write != NULL) - { - g_io_channel_unref (plug_in->his_write); - plug_in->his_write = NULL; - } - - wire_clear_error (); - - /* Destroy the progress dialog if it exists. */ - if (plug_in->progress) - { - progress_end (plug_in->progress); - plug_in->progress = NULL; - } - - if (plug_in->recurse) - { - gimp_main_loop_quit (the_gimp); - - plug_in->recurse = FALSE; - } - - plug_in->synchronous = FALSE; - - /* Unregister any temporary procedures. */ - if (plug_in->temp_proc_defs) - { - g_slist_foreach (plug_in->temp_proc_defs, - (GFunc) plug_in_proc_def_remove, - NULL); - g_slist_free (plug_in->temp_proc_defs); - plug_in->temp_proc_defs = NULL; - } - - /* Close any dialogs that this plugin might have opened */ - brush_select_dialogs_check (); - pattern_select_dialogs_check (); - gradient_select_dialogs_check (); - - open_plug_ins = g_slist_remove (open_plug_ins, plug_in); -} - -static Argument * -plug_in_get_current_return_vals (ProcRecord *proc_rec) -{ - Argument *return_vals; - gint nargs; - - /* Return the status code plus the current return values. */ - nargs = proc_rec->num_values + 1; - if (current_return_vals && current_return_nvals == nargs) - { - return_vals = current_return_vals; - } - else if (current_return_vals) - { - /* Allocate new return values of the correct size. */ - return_vals = procedural_db_return_args (proc_rec, FALSE); - - /* Copy all of the arguments we can. */ - memcpy (return_vals, current_return_vals, - sizeof (Argument) * MIN (current_return_nvals, nargs)); - - /* Free the old argument pointer. This will cause a memory leak - only if there were more values returned than we need (which - shouldn't ever happen). */ - g_free (current_return_vals); - } - else - { - /* Just return a dummy set of values. */ - return_vals = procedural_db_return_args (proc_rec, FALSE); - } - - /* We have consumed any saved values, so clear them. */ - current_return_nvals = 0; - current_return_vals = NULL; - - return return_vals; -} - -Argument * -plug_in_run (ProcRecord *proc_rec, - Argument *args, - gint argc, - gboolean synchronous, - gboolean destroy_values, - gint gdisp_ID) -{ - GPConfig config; - GPProcRun proc_run; - Argument *return_vals; - PlugIn *plug_in; - - return_vals = NULL; - - if (proc_rec->proc_type == GIMP_TEMPORARY) - { - return_vals = plug_in_temp_run (proc_rec, args, argc); - goto done; - } - - plug_in = plug_in_new (proc_rec->exec_method.plug_in.filename); - - if (plug_in) - { - if (plug_in_open (plug_in)) - { - plug_in->recurse = synchronous; - - plug_in_push (plug_in); - - config.version = GP_VERSION; - config.tile_width = TILE_WIDTH; - config.tile_height = TILE_HEIGHT; - config.shm_ID = shm_ID; - config.gamma = gimprc.gamma_val; - config.install_cmap = gimprc.install_cmap; - config.unused = 0; - config.min_colors = CLAMP (gimprc.min_colors, 27, 256); - config.gdisp_ID = gdisp_ID; - - proc_run.name = proc_rec->name; - proc_run.nparams = argc; - proc_run.params = plug_in_args_to_params (args, argc, FALSE); - - if (!gp_config_write (current_writechannel, &config) || - !gp_proc_run_write (current_writechannel, &proc_run) || - !wire_flush (current_writechannel)) - { - return_vals = procedural_db_return_args (proc_rec, FALSE); - goto done; - } - - plug_in_pop (); - - plug_in_params_destroy (proc_run.params, proc_run.nparams, FALSE); - - /* If this is an automatically installed extension, wait for an - * installation-confirmation message - */ - if ((proc_rec->proc_type == GIMP_EXTENSION) && - (proc_rec->num_args == 0)) - { - gimp_main_loop (the_gimp); - } - - if (plug_in->recurse) - { - gimp_main_loop (the_gimp); - - return_vals = plug_in_get_current_return_vals (proc_rec); - } - } - } - - done: - if (return_vals && destroy_values) - { - procedural_db_destroy_args (return_vals, proc_rec->num_values); - return_vals = NULL; - } - return return_vals; -} - -void -plug_in_repeat (gboolean with_interface) -{ - GimpDisplay *gdisplay; - Argument *args; - gint i; - - if (last_plug_in) - { - gdisplay = gimp_context_get_display (gimp_get_user_context (the_gimp)); - - if (! gdisplay) - return; - - /* construct the procedures arguments */ - args = g_new (Argument, 3); - - /* initialize the first three argument types */ - for (i = 0; i < 3; i++) - args[i].arg_type = last_plug_in->args[i].arg_type; - - /* initialize the first three plug-in arguments */ - args[0].value.pdb_int = (with_interface ? RUN_INTERACTIVE : RUN_WITH_LAST_VALS); - args[1].value.pdb_int = gimp_image_get_ID (gdisplay->gimage); - args[2].value.pdb_int = gimp_drawable_get_ID (gimp_image_active_drawable (gdisplay->gimage)); - - /* run the plug-in procedure */ - plug_in_run (last_plug_in, args, 3, FALSE, TRUE, gdisplay->ID); - - g_free (args); - } -} - -void -plug_in_set_menu_sensitivity (GimpImageType type) -{ - PlugInProcDef *proc_def; - GSList *tmp; - gboolean sensitive = FALSE; - - for (tmp = proc_defs; tmp; tmp = g_slist_next (tmp)) - { - proc_def = tmp->data; - - if (proc_def->image_types_val && proc_def->menu_path) - { - switch (type) - { - case RGB_GIMAGE: - sensitive = proc_def->image_types_val & PLUG_IN_RGB_IMAGE; - break; - case RGBA_GIMAGE: - sensitive = proc_def->image_types_val & PLUG_IN_RGBA_IMAGE; - break; - case GRAY_GIMAGE: - sensitive = proc_def->image_types_val & PLUG_IN_GRAY_IMAGE; - break; - case GRAYA_GIMAGE: - sensitive = proc_def->image_types_val & PLUG_IN_GRAYA_IMAGE; - break; - case INDEXED_GIMAGE: - sensitive = proc_def->image_types_val & PLUG_IN_INDEXED_IMAGE; - break; - case INDEXEDA_GIMAGE: - sensitive = proc_def->image_types_val & PLUG_IN_INDEXEDA_IMAGE; - break; - default: - sensitive = FALSE; - break; - } - - gimp_menu_item_set_sensitive (proc_def->menu_path, sensitive); - - if (last_plug_in && (last_plug_in == &(proc_def->db_info))) - { - gchar *basename; - gchar *repeat; - gchar *reshow; - - basename = g_path_get_basename (proc_def->menu_path); - - repeat = g_strdup_printf (_("Repeat \"%s\""), basename); - reshow = g_strdup_printf (_("Re-show \"%s\""), basename); - - g_free (basename); - - gimp_menu_item_set_label ("/Filters/Repeat Last", repeat); - gimp_menu_item_set_label ("/Filters/Re-Show Last", reshow); - - g_free (repeat); - g_free (reshow); - - gimp_menu_item_set_sensitive ("/Filters/Repeat Last", - sensitive); - gimp_menu_item_set_sensitive ("/Filters/Re-Show Last", - sensitive); - } - } - } - - if (! last_plug_in) - { - gimp_menu_item_set_label ("/Filters/Repeat Last", - _("Repeat Last")); - gimp_menu_item_set_label ("/Filters/Re-Show Last", - _("Re-Show Last")); - - gimp_menu_item_set_sensitive ("/Filters/Repeat Last", FALSE); - gimp_menu_item_set_sensitive ("/Filters/Re-Show Last", FALSE); - } -} - -void -plug_in_def_set_mtime (PlugInDef *plug_in_def, - time_t mtime) -{ - plug_in_def->mtime = mtime; -} - -void -plug_in_def_set_locale_domain_name (PlugInDef *plug_in_def, - const gchar *domain_name) -{ - if (plug_in_def->locale_domain) - g_free (plug_in_def->locale_domain); - plug_in_def->locale_domain = g_strdup (domain_name); -} - -void -plug_in_def_set_locale_domain_path (PlugInDef *plug_in_def, - const gchar *domain_path) -{ - if (plug_in_def->locale_path) - g_free (plug_in_def->locale_path); - plug_in_def->locale_path = g_strdup (domain_path); -} - -void -plug_in_def_set_help_path (PlugInDef *plug_in_def, - const gchar *help_path) -{ - if (plug_in_def->help_path) - g_free (plug_in_def->help_path); - plug_in_def->help_path = g_strdup (help_path); -} - -static gboolean -plug_in_recv_message (GIOChannel *channel, - GIOCondition cond, - gpointer data) -{ - gboolean got_message = FALSE; - - if ((PlugIn *) data != current_plug_in) - plug_in_push ((PlugIn *) data); - - if (current_readchannel == NULL) - return TRUE; - - if (cond & (G_IO_IN | G_IO_PRI)) - { - WireMessage msg; - - memset (&msg, 0, sizeof (WireMessage)); - - if (!wire_read_msg (current_readchannel, &msg)) - { - plug_in_close (current_plug_in, TRUE); - } - else - { - plug_in_handle_message (&msg); - wire_destroy (&msg); - got_message = TRUE; - } - - } - - if (cond & (G_IO_ERR | G_IO_HUP)) - { - if (current_plug_in->open) - { - plug_in_close (current_plug_in, TRUE); - } - } - - if (!got_message) - g_message (_("Plug-In crashed: \"%s\"\n(%s)\n\n" - "The dying Plug-In may have messed up GIMP's internal state.\n" - "You may want to save your images and restart GIMP\n" - "to be on the safe side."), - g_path_get_basename (current_plug_in->args[0]), - current_plug_in->args[0]); - - if (!current_plug_in->open) - plug_in_destroy (current_plug_in); - else - plug_in_pop (); - - return TRUE; -} - -static void -plug_in_handle_message (WireMessage *msg) -{ - switch (msg->type) - { - case GP_QUIT: - plug_in_handle_quit (); - break; - case GP_CONFIG: - g_warning ("plug_in_handle_message(): " - "received a config message (should not happen)"); - plug_in_close (current_plug_in, TRUE); - break; - case GP_TILE_REQ: - plug_in_handle_tile_req (msg->data); - break; - case GP_TILE_ACK: - g_warning ("plug_in_handle_message(): " - "received a tile ack message (should not happen)"); - plug_in_close (current_plug_in, TRUE); - break; - case GP_TILE_DATA: - g_warning ("plug_in_handle_message(): " - "received a tile data message (should not happen)"); - plug_in_close (current_plug_in, TRUE); - break; - case GP_PROC_RUN: - plug_in_handle_proc_run (msg->data); - break; - case GP_PROC_RETURN: - plug_in_handle_proc_return (msg->data); - plug_in_close (current_plug_in, FALSE); - break; - case GP_TEMP_PROC_RUN: - g_warning ("plug_in_handle_message(): " - "received a temp proc run message (should not happen)"); - plug_in_close (current_plug_in, TRUE); - break; - case GP_TEMP_PROC_RETURN: - plug_in_handle_proc_return (msg->data); - gimp_main_loop_quit (the_gimp); - break; - case GP_PROC_INSTALL: - plug_in_handle_proc_install (msg->data); - break; - case GP_PROC_UNINSTALL: - plug_in_handle_proc_uninstall (msg->data); - break; - case GP_EXTENSION_ACK: - gimp_main_loop_quit (the_gimp); - break; - } -} - -static void -plug_in_handle_quit (void) -{ - plug_in_close (current_plug_in, FALSE); -} - -static void -plug_in_handle_tile_req (GPTileReq *tile_req) -{ - GPTileData tile_data; - GPTileData *tile_info; - WireMessage msg; - TileManager *tm; - Tile *tile; - - if (tile_req->drawable_ID == -1) - { - tile_data.drawable_ID = -1; - tile_data.tile_num = 0; - tile_data.shadow = 0; - tile_data.bpp = 0; - tile_data.width = 0; - tile_data.height = 0; - tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE; - tile_data.data = NULL; - - if (!gp_tile_data_write (current_writechannel, &tile_data)) - { - g_warning ("plug_in_handle_tile_req: ERROR"); - plug_in_close (current_plug_in, TRUE); - return; - } - - if (!wire_read_msg (current_readchannel, &msg)) - { - g_warning ("plug_in_handle_tile_req: ERROR"); - plug_in_close (current_plug_in, TRUE); - return; - } - - if (msg.type != GP_TILE_DATA) - { - g_warning ("expected tile data and received: %d", msg.type); - plug_in_close (current_plug_in, TRUE); - return; - } - - tile_info = msg.data; - - if (tile_info->shadow) - tm = gimp_drawable_shadow (gimp_drawable_get_by_ID (the_gimp, tile_info->drawable_ID)); - else - tm = gimp_drawable_data (gimp_drawable_get_by_ID (the_gimp, tile_info->drawable_ID)); - - if (!tm) - { - g_warning ("plug-in requested invalid drawable (killing)"); - plug_in_close (current_plug_in, TRUE); - return; - } - - tile = tile_manager_get (tm, tile_info->tile_num, TRUE, TRUE); - if (!tile) - { - g_warning ("plug-in requested invalid tile (killing)"); - plug_in_close (current_plug_in, TRUE); - return; - } - - if (tile_data.use_shm) - memcpy (tile_data_pointer (tile, 0, 0), shm_addr, tile_size (tile)); - else - memcpy (tile_data_pointer (tile, 0, 0), tile_info->data, tile_size (tile)); - - tile_release (tile, TRUE); - - wire_destroy (&msg); - if (!gp_tile_ack_write (current_writechannel)) - { - g_warning ("plug_in_handle_tile_req: ERROR"); - plug_in_close (current_plug_in, TRUE); - return; - } - } - else - { - if (tile_req->shadow) - tm = gimp_drawable_shadow (gimp_drawable_get_by_ID (the_gimp, tile_req->drawable_ID)); - else - tm = gimp_drawable_data (gimp_drawable_get_by_ID (the_gimp, tile_req->drawable_ID)); - - if (!tm) - { - g_warning ("plug-in requested invalid drawable (killing)"); - plug_in_close (current_plug_in, TRUE); - return; - } - - tile = tile_manager_get (tm, tile_req->tile_num, TRUE, FALSE); - if (!tile) - { - g_warning ("plug-in requested invalid tile (killing)"); - plug_in_close (current_plug_in, TRUE); - return; - } - - tile_data.drawable_ID = tile_req->drawable_ID; - tile_data.tile_num = tile_req->tile_num; - tile_data.shadow = tile_req->shadow; - tile_data.bpp = tile_bpp (tile); - tile_data.width = tile_ewidth (tile); - tile_data.height = tile_eheight (tile); - tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE; - - if (tile_data.use_shm) - memcpy (shm_addr, tile_data_pointer (tile, 0, 0), tile_size (tile)); - else - tile_data.data = tile_data_pointer (tile, 0, 0); - - if (!gp_tile_data_write (current_writechannel, &tile_data)) - { - g_message ("plug_in_handle_tile_req: ERROR"); - plug_in_close (current_plug_in, TRUE); - return; - } - - tile_release (tile, FALSE); - - if (!wire_read_msg (current_readchannel, &msg)) - { - g_message ("plug_in_handle_tile_req: ERROR"); - plug_in_close (current_plug_in, TRUE); - return; - } - - if (msg.type != GP_TILE_ACK) - { - g_warning ("expected tile ack and received: %d", msg.type); - plug_in_close (current_plug_in, TRUE); - return; - } - - wire_destroy (&msg); - } -} - -static void -plug_in_handle_proc_run (GPProcRun *proc_run) -{ - GPProcReturn proc_return; - ProcRecord *proc_rec; - Argument *args; - Argument *return_vals; - PlugInBlocked *blocked; - - args = plug_in_params_to_args (proc_run->params, proc_run->nparams, FALSE); - proc_rec = procedural_db_lookup (the_gimp, proc_run->name); - - if (proc_rec) - { - return_vals = procedural_db_execute (the_gimp, proc_run->name, args); - } - else - { - /* if the name lookup failed, construct a - * dummy "executiuon error" return value --Michael - */ - return_vals = g_new (Argument, 1); - return_vals[0].arg_type = GIMP_PDB_STATUS; - return_vals[0].value.pdb_int = GIMP_PDB_EXECUTION_ERROR; - } - - if (return_vals) - { - proc_return.name = proc_run->name; - - if (proc_rec) - { - proc_return.nparams = proc_rec->num_values + 1; - proc_return.params = plug_in_args_to_params (return_vals, proc_rec->num_values + 1, FALSE); - } - else - { - proc_return.nparams = 1; - proc_return.params = plug_in_args_to_params (return_vals, 1, FALSE); - } - - if (!gp_proc_return_write (current_writechannel, &proc_return)) - { - g_warning ("plug_in_handle_proc_run: ERROR"); - plug_in_close (current_plug_in, TRUE); - return; - } - - plug_in_args_destroy (args, proc_run->nparams, FALSE); - plug_in_args_destroy (return_vals, (proc_rec ? (proc_rec->num_values + 1) : 1), TRUE); - plug_in_params_destroy (proc_return.params, proc_return.nparams, FALSE); - } - else - { - blocked = g_new (PlugInBlocked, 1); - blocked->plug_in = current_plug_in; - blocked->proc_name = g_strdup (proc_run->name); - blocked_plug_ins = g_slist_prepend (blocked_plug_ins, blocked); - } -} - -static void -plug_in_handle_proc_return (GPProcReturn *proc_return) -{ - PlugInBlocked *blocked; - GSList *tmp; - - if (current_plug_in->recurse) - { - current_return_vals = plug_in_params_to_args (proc_return->params, - proc_return->nparams, - TRUE); - current_return_nvals = proc_return->nparams; - } - else - { - tmp = blocked_plug_ins; - while (tmp) - { - blocked = tmp->data; - tmp = tmp->next; - - if (blocked->proc_name && proc_return->name && - strcmp (blocked->proc_name, proc_return->name) == 0) - { - plug_in_push (blocked->plug_in); - if (!gp_proc_return_write (current_writechannel, proc_return)) - { - g_message ("plug_in_handle_proc_run: ERROR"); - plug_in_close (current_plug_in, TRUE); - return; - } - plug_in_pop (); - - blocked_plug_ins = g_slist_remove (blocked_plug_ins, blocked); - g_free (blocked->proc_name); - g_free (blocked); - break; - } - } - } -} - -static void -plug_in_handle_proc_install (GPProcInstall *proc_install) -{ - PlugInDef *plug_in_def = NULL; - PlugInProcDef *proc_def; - ProcRecord *proc = NULL; - PlugInMenuEntry *menu_entry; - GSList *tmp = NULL; - gchar *prog = NULL; - gboolean add_proc_def; - gboolean valid; - gint i; - - /* Argument checking - * --only sanity check arguments when the procedure requests a menu path - */ - - if (proc_install->menu_path) - { - if (strncmp (proc_install->menu_path, "", 9) == 0) - { - if ((proc_install->nparams < 1) || - (proc_install->params[0].type != GIMP_PDB_INT32)) - { - g_message ("Plug-In \"%s\"\n(%s)\n" - "attempted to install procedure \"%s\"\n" - "which does not take the standard Plug-In args.", - g_path_get_basename (current_plug_in->args[0]), - current_plug_in->args[0], - proc_install->name); - return; - } - } - else if (strncmp (proc_install->menu_path, "", 7) == 0) - { - if ((proc_install->nparams < 3) || - (proc_install->params[0].type != GIMP_PDB_INT32) || - (proc_install->params[1].type != GIMP_PDB_IMAGE) || - (proc_install->params[2].type != GIMP_PDB_DRAWABLE)) - { - g_message ("Plug-In \"%s\"\n(%s)\n" - "attempted to install procedure \"%s\"\n" - "which does not take the standard Plug-In args.", - g_path_get_basename (current_plug_in->args[0]), - current_plug_in->args[0], - proc_install->name); - return; - } - } - else if (strncmp (proc_install->menu_path, "", 6) == 0) - { - if ((proc_install->nparams < 3) || - (proc_install->params[0].type != GIMP_PDB_INT32) || - (proc_install->params[1].type != GIMP_PDB_STRING) || - (proc_install->params[2].type != GIMP_PDB_STRING)) - { - g_message ("Plug-In \"%s\"\n(%s)\n" - "attempted to install procedure \"%s\"\n" - "which does not take the standard Plug-In args.", - g_path_get_basename (current_plug_in->args[0]), - current_plug_in->args[0], - proc_install->name); - return; - } - } - else if (strncmp (proc_install->menu_path, "", 6) == 0) - { - if ((proc_install->nparams < 5) || - (proc_install->params[0].type != GIMP_PDB_INT32) || - (proc_install->params[1].type != GIMP_PDB_IMAGE) || - (proc_install->params[2].type != GIMP_PDB_DRAWABLE) || - (proc_install->params[3].type != GIMP_PDB_STRING) || - (proc_install->params[4].type != GIMP_PDB_STRING)) - { - g_message ("Plug-In \"%s\"\n(%s)\n" - "attempted to install procedure \"%s\"\n" - "which does not take the standard Plug-In args.", - g_path_get_basename (current_plug_in->args[0]), - current_plug_in->args[0], - proc_install->name); - return; - } - } - else - { - g_message ("Plug-In \"%s\"\n(%s)\n" - "attempted to install procedure \"%s\"\n" - "in an invalid menu location.\n" - "Use either \"\", \"\", " - "\"\", or \"\".", - g_path_get_basename (current_plug_in->args[0]), - current_plug_in->args[0], - proc_install->name); - return; - } - } - - /* Sanity check for array arguments */ - - for (i = 1; i < proc_install->nparams; i++) - { - if ((proc_install->params[i].type == GIMP_PDB_INT32ARRAY || - proc_install->params[i].type == GIMP_PDB_INT8ARRAY || - proc_install->params[i].type == GIMP_PDB_FLOATARRAY || - proc_install->params[i].type == GIMP_PDB_STRINGARRAY) - && - proc_install->params[i-1].type != GIMP_PDB_INT32) - { - g_message ("Plug-In \"%s\"\n(%s)\n" - "attempted to install procedure \"%s\"\n" - "which fails to comply with the array parameter\n" - "passing standard. Argument %d is noncompliant.", - g_path_get_basename (current_plug_in->args[0]), - current_plug_in->args[0], - proc_install->name, i); - return; - } - } - - /* Sanity check strings for UTF-8 validity */ - valid = FALSE; - - if ((proc_install->menu_path == NULL || - g_utf8_validate (proc_install->menu_path, -1, NULL)) && - (g_utf8_validate (proc_install->name, -1, NULL)) && - (proc_install->blurb == NULL || - g_utf8_validate (proc_install->blurb, -1, NULL)) && - (proc_install->help == NULL || - g_utf8_validate (proc_install->help, -1, NULL)) && - (proc_install->author == NULL || - g_utf8_validate (proc_install->author, -1, NULL)) && - (proc_install->copyright == NULL || - g_utf8_validate (proc_install->copyright, -1, NULL)) && - (proc_install->date == NULL || - g_utf8_validate (proc_install->date, -1, NULL))) - { - valid = TRUE; - - for (i = 0; i < proc_install->nparams && valid; i++) - { - if (! (g_utf8_validate (proc_install->params[i].name, -1, NULL) && - (proc_install->params[i].description == NULL || - g_utf8_validate (proc_install->params[i].description, -1, NULL)))) - valid = FALSE; - } - for (i = 0; i < proc_install->nreturn_vals && valid; i++) - { - if (! (g_utf8_validate (proc_install->return_vals[i].name, -1, NULL) && - (proc_install->return_vals[i].description == NULL || - g_utf8_validate (proc_install->return_vals[i].description, -1, NULL)))) - valid = FALSE; - } - } - - if (!valid) - { - g_message ("Plug-In \"%s\"\n(%s)\n" - "attempted to install a procedure with invalid UTF-8 strings.\n", - g_path_get_basename (current_plug_in->args[0]), - current_plug_in->args[0]); - return; - } - - /* Initialization */ - - proc_def = NULL; - - switch (proc_install->type) - { - case GIMP_PLUGIN: - case GIMP_EXTENSION: - plug_in_def = current_plug_in->user_data; - prog = plug_in_def->prog; - - tmp = plug_in_def->proc_defs; - break; - - case GIMP_TEMPORARY: - prog = "none"; - - tmp = current_plug_in->temp_proc_defs; - break; - } - - while (tmp) - { - proc_def = tmp->data; - tmp = tmp->next; - - if (strcmp (proc_def->db_info.name, proc_install->name) == 0) - { - if (proc_install->type == GIMP_TEMPORARY) - plug_in_proc_def_remove (proc_def); - else - plug_in_proc_def_destroy (proc_def, TRUE); /* destroys data_only */ - - break; - } - - proc_def = NULL; - } - - add_proc_def = FALSE; - if (!proc_def) - { - add_proc_def = TRUE; - proc_def = g_new (PlugInProcDef, 1); - } - - proc_def->prog = g_strdup (prog); - - proc_def->menu_path = g_strdup (proc_install->menu_path); - proc_def->accelerator = NULL; - proc_def->extensions = NULL; - proc_def->prefixes = NULL; - proc_def->magics = NULL; - proc_def->image_types = g_strdup (proc_install->image_types); - proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types); - /* Install temp one use todays time */ - proc_def->mtime = time (NULL); - - proc = &proc_def->db_info; - - /* The procedural database procedure */ - - proc->name = g_strdup (proc_install->name); - proc->blurb = g_strdup (proc_install->blurb); - proc->help = g_strdup (proc_install->help); - proc->author = g_strdup (proc_install->author); - proc->copyright = g_strdup (proc_install->copyright); - proc->date = g_strdup (proc_install->date); - proc->proc_type = proc_install->type; - - proc->num_args = proc_install->nparams; - proc->num_values = proc_install->nreturn_vals; - - proc->args = g_new (ProcArg, proc->num_args); - proc->values = g_new (ProcArg, proc->num_values); - - for (i = 0; i < proc->num_args; i++) - { - proc->args[i].arg_type = proc_install->params[i].type; - proc->args[i].name = g_strdup (proc_install->params[i].name); - proc->args[i].description = g_strdup (proc_install->params[i].description); - } - - for (i = 0; i < proc->num_values; i++) - { - proc->values[i].arg_type = proc_install->return_vals[i].type; - proc->values[i].name = g_strdup (proc_install->return_vals[i].name); - proc->values[i].description = g_strdup (proc_install->return_vals[i].description); - } - - switch (proc_install->type) - { - case GIMP_PLUGIN: - case GIMP_EXTENSION: - if (add_proc_def) - plug_in_def->proc_defs = g_slist_prepend (plug_in_def->proc_defs, proc_def); - break; - - case GIMP_TEMPORARY: - if (add_proc_def) - current_plug_in->temp_proc_defs = - g_slist_prepend (current_plug_in->temp_proc_defs, proc_def); - - proc_defs = g_slist_append (proc_defs, proc_def); - proc->exec_method.temporary.plug_in = (void *) current_plug_in; - procedural_db_register (the_gimp, proc); - - if (! the_gimp->no_interface) - { - /* If there is a menu path specified, create a menu entry */ - if (proc_install->menu_path) - { - menu_entry = g_new (PlugInMenuEntry, 1); - menu_entry->proc_def = proc_def; - - /* Below we use a hack to allow translations of Script-Fu paths. - * Would be nice if we could solve this properly, but I haven't - * found a way yet ... (Sven) - */ - if (plug_in_def && plug_in_def->locale_domain) - menu_entry->domain = plug_in_def->locale_domain; - else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0) - menu_entry->domain = "gimp-script-fu"; - else - menu_entry->domain = std_plugins_domain; - - if (plug_in_def) - menu_entry->help_path = plug_in_def->help_path; - else - menu_entry->help_path = NULL; - - /* plug_in_make_menu_entry frees the menu_entry for us */ - plug_in_make_menu_entry (NULL, menu_entry, NULL); - } - } - break; - } -} - -static void -plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall) -{ - PlugInProcDef *proc_def; - GSList *tmp; - - tmp = current_plug_in->temp_proc_defs; - while (tmp) - { - proc_def = tmp->data; - tmp = tmp->next; - - if (strcmp (proc_def->db_info.name, proc_uninstall->name) == 0) - { - current_plug_in->temp_proc_defs = g_slist_remove (current_plug_in->temp_proc_defs, proc_def); - plug_in_proc_def_remove (proc_def); - break; - } - } -} - -static gboolean -plug_in_write (GIOChannel *channel, - guint8 *buf, - gulong count) -{ - gulong bytes; - - while (count > 0) - { - if ((current_write_buffer_index + count) >= WRITE_BUFFER_SIZE) - { - bytes = WRITE_BUFFER_SIZE - current_write_buffer_index; - memcpy (¤t_write_buffer[current_write_buffer_index], buf, bytes); - current_write_buffer_index += bytes; - if (!wire_flush (channel)) - return FALSE; - } - else - { - bytes = count; - memcpy (¤t_write_buffer[current_write_buffer_index], buf, bytes); - current_write_buffer_index += bytes; - } - - buf += bytes; - count -= bytes; - } - - return TRUE; -} - -static gboolean -plug_in_flush (GIOChannel *channel) -{ - GIOStatus status; - GError *error = NULL; - gint count; - guint bytes; - - if (current_write_buffer_index > 0) - { - count = 0; - while (count != current_write_buffer_index) - { - do - { - bytes = 0; - status = g_io_channel_write_chars (channel, - ¤t_write_buffer[count], - (current_write_buffer_index - count), - &bytes, - &error); - } - while (status == G_IO_STATUS_AGAIN); - - if (status != G_IO_STATUS_NORMAL) - { - if (error) - { - g_warning ("%s: plug_in_flush(): error: %s", - g_get_prgname (), error->message); - g_error_free (error); - } - else - { - g_warning ("%s: plug_in_flush(): error", - g_get_prgname ()); - } - - return FALSE; - } - - count += bytes; - } - - current_write_buffer_index = 0; - } - - return TRUE; -} - -static void -plug_in_push (PlugIn *plug_in) -{ - if (plug_in) - { - current_plug_in = plug_in; - plug_in_stack = g_slist_prepend (plug_in_stack, current_plug_in); - - current_readchannel = current_plug_in->my_read; - current_writechannel = current_plug_in->my_write; - current_write_buffer_index = current_plug_in->write_buffer_index; - current_write_buffer = current_plug_in->write_buffer; - } - else - { - current_readchannel = NULL; - current_writechannel = NULL; - current_write_buffer_index = 0; - current_write_buffer = NULL; - } -} - -static void -plug_in_pop (void) -{ - GSList *tmp; - - if (current_plug_in) - { - current_plug_in->write_buffer_index = current_write_buffer_index; - - tmp = plug_in_stack; - plug_in_stack = plug_in_stack->next; - tmp->next = NULL; - g_slist_free (tmp); - } - - if (plug_in_stack) - { - current_plug_in = plug_in_stack->data; - current_readchannel = current_plug_in->my_read; - current_writechannel = current_plug_in->my_write; - current_write_buffer_index = current_plug_in->write_buffer_index; - current_write_buffer = current_plug_in->write_buffer; - } - else - { - current_plug_in = NULL; - current_readchannel = NULL; - current_writechannel = NULL; - current_write_buffer_index = 0; - current_write_buffer = NULL; - } -} - -static void -plug_in_write_rc_string (FILE *fp, - gchar *str) -{ - fputc ('"', fp); - - if (str) - while (*str) - { - if (*str == '\n') - { - fputc ('\\', fp); - fputc ('n', fp); - } - else if (*str == '\r') - { - fputc ('\\', fp); - fputc ('r', fp); - } - else if (*str == '\032') /* ^Z is problematic on Windows */ - { - fputc ('\\', fp); - fputc ('z', fp); - } - else - { - if ((*str == '"') || (*str == '\\')) - fputc ('\\', fp); - fputc (*str, fp); - } - str += 1; - } - - fputc ('"', fp); -} - -static void -plug_in_write_rc (const gchar *filename) -{ - FILE *fp; - PlugInDef *plug_in_def; - PlugInProcDef *proc_def; - GSList *tmp; - GSList *tmp2; - gint i; - - fp = fopen (filename, "w"); - if (!fp) - return; - - tmp = plug_in_defs; - while (tmp) - { - plug_in_def = tmp->data; - tmp = tmp->next; - - if (plug_in_def->proc_defs) - { - fprintf (fp, "(plug-in-def "); - plug_in_write_rc_string (fp, plug_in_def->prog); - fprintf (fp, " %ld", (long) plug_in_def->mtime); - tmp2 = plug_in_def->proc_defs; - if (tmp2) - fprintf (fp, "\n"); - - while (tmp2) - { - proc_def = tmp2->data; - tmp2 = tmp2->next; - - fprintf (fp, "\t(proc-def \"%s\" %d\n", - proc_def->db_info.name, proc_def->db_info.proc_type); - fprintf (fp, "\t\t"); - plug_in_write_rc_string (fp, proc_def->db_info.blurb); - fprintf (fp, "\n\t\t"); - plug_in_write_rc_string (fp, proc_def->db_info.help); - fprintf (fp, "\n\t\t"); - plug_in_write_rc_string (fp, proc_def->db_info.author); - fprintf (fp, "\n\t\t"); - plug_in_write_rc_string (fp, proc_def->db_info.copyright); - fprintf (fp, "\n\t\t"); - plug_in_write_rc_string (fp, proc_def->db_info.date); - fprintf (fp, "\n\t\t"); - plug_in_write_rc_string (fp, proc_def->menu_path); - fprintf (fp, "\n\t\t"); - plug_in_write_rc_string (fp, proc_def->extensions); - fprintf (fp, "\n\t\t"); - plug_in_write_rc_string (fp, proc_def->prefixes); - fprintf (fp, "\n\t\t"); - plug_in_write_rc_string (fp, proc_def->magics); - fprintf (fp, "\n\t\t"); - plug_in_write_rc_string (fp, proc_def->image_types); - fprintf (fp, "\n\t\t%d %d\n", - proc_def->db_info.num_args, proc_def->db_info.num_values); - - for (i = 0; i < proc_def->db_info.num_args; i++) - { - fprintf (fp, "\t\t(proc-arg %d ", - proc_def->db_info.args[i].arg_type); - - plug_in_write_rc_string (fp, proc_def->db_info.args[i].name); - plug_in_write_rc_string (fp, proc_def->db_info.args[i].description); - - fprintf (fp, ")%s", - (proc_def->db_info.num_values || - (i < (proc_def->db_info.num_args - 1))) ? "\n" : ""); - } - - for (i = 0; i < proc_def->db_info.num_values; i++) - { - fprintf (fp, "\t\t(proc-arg %d ", - proc_def->db_info.values[i].arg_type); - - plug_in_write_rc_string (fp, proc_def->db_info.values[i].name); - plug_in_write_rc_string (fp, proc_def->db_info.values[i].description); - - fprintf (fp, ")%s", (i < (proc_def->db_info.num_values - 1)) ? "\n" : ""); - } - - fprintf (fp, ")"); - - if (tmp2) - fprintf (fp, "\n"); - } - - if (plug_in_def->locale_domain) - { - fprintf (fp, "\n\t(locale-def \"%s\"", plug_in_def->locale_domain); - if (plug_in_def->locale_path) - fprintf (fp, " \"%s\")", plug_in_def->locale_path); - else - fprintf (fp, ")"); - } - - if (plug_in_def->help_path) - { - fprintf (fp, "\n\t(help-def \"%s\")", plug_in_def->help_path); - } - - fprintf (fp, ")\n"); - - if (tmp) - fprintf (fp, "\n"); - } - - } - - fclose (fp); -} - -static void -plug_in_init_file (const gchar *filename, - gpointer loader_data) -{ - GSList *tmp; - PlugInDef *plug_in_def; - gchar *plug_in_name; - gchar *basename; - - basename = g_path_get_basename (filename); - - plug_in_def = NULL; - tmp = plug_in_defs; - - while (tmp) - { - plug_in_def = tmp->data; - tmp = tmp->next; - - plug_in_name = g_path_get_basename (plug_in_def->prog); - - if (g_ascii_strcasecmp (basename, plug_in_name) == 0) - { - g_print ("duplicate plug-in: \"%s\" (skipping)\n", filename); - return; - } - - g_free (plug_in_name); - - plug_in_def = NULL; - } - - g_free (basename); - - plug_in_def = plug_in_def_new (filename); - plug_in_def->mtime = gimp_datafile_mtime (); - plug_in_def->query = TRUE; - - plug_in_defs = g_slist_append (plug_in_defs, plug_in_def); -} - -static void -plug_in_query (PlugInDef *plug_in_def) -{ - PlugIn *plug_in; - WireMessage msg; - - plug_in = plug_in_new (plug_in_def->prog); - if (plug_in) - { - plug_in->query = TRUE; - plug_in->synchronous = TRUE; - plug_in->user_data = plug_in_def; - - if (plug_in_open (plug_in)) - { - plug_in_push (plug_in); - - while (plug_in->open) - { - if (!wire_read_msg (current_readchannel, &msg)) - plug_in_close (current_plug_in, TRUE); - else - { - plug_in_handle_message (&msg); - wire_destroy (&msg); - } - } - - plug_in_pop (); - plug_in_destroy (plug_in); - } - } -} - -static void -plug_in_add_to_db (void) -{ - PlugInProcDef *proc_def; - Argument args[4]; - Argument *return_vals; - GSList *tmp; - - tmp = proc_defs; - - while (tmp) - { - proc_def = tmp->data; - tmp = tmp->next; - - if (proc_def->prog && (proc_def->db_info.proc_type != GIMP_INTERNAL)) - { - proc_def->db_info.exec_method.plug_in.filename = proc_def->prog; - procedural_db_register (the_gimp, &proc_def->db_info); - } - } - - for (tmp = proc_defs; tmp; tmp = tmp->next) - { - proc_def = tmp->data; - - if (proc_def->extensions || proc_def->prefixes || proc_def->magics) - { - args[0].arg_type = GIMP_PDB_STRING; - args[0].value.pdb_pointer = proc_def->db_info.name; - - args[1].arg_type = GIMP_PDB_STRING; - args[1].value.pdb_pointer = proc_def->extensions; - - args[2].arg_type = GIMP_PDB_STRING; - args[2].value.pdb_pointer = proc_def->prefixes; - - args[3].arg_type = GIMP_PDB_STRING; - args[3].value.pdb_pointer = proc_def->magics; - - if (proc_def->image_types) - { - return_vals = - procedural_db_execute (the_gimp, - "gimp_register_save_handler", - args); - g_free (return_vals); - } - else - { - return_vals = - procedural_db_execute (the_gimp, - "gimp_register_magic_load_handler", - args); - g_free (return_vals); - } - } - } -} - -/* The following function has to be a GTraverseFunction, - * but is also called directly. Please note that it frees the - * menu_entry strcuture. --Sven - */ -static gint -plug_in_make_menu_entry (gpointer foo, - PlugInMenuEntry *menu_entry, - gpointer bar) -{ - GimpItemFactoryEntry entry; - gchar *help_page; - gchar *basename; - gchar *lowercase_page; - - basename = g_path_get_basename (menu_entry->proc_def->prog); - - if (menu_entry->help_path) - { - help_page = g_strconcat (menu_entry->help_path, - "@", /* HACK: locale subdir */ - basename, - ".html", - NULL); - } - else - { - help_page = g_strconcat ("filters/", /* _not_ G_DIR_SEPARATOR_S */ - basename, - ".html", - NULL); - } - - g_free (basename); - - lowercase_page = g_ascii_strdown (help_page, -1); - - g_free (help_page); - - entry.entry.path = menu_entry->proc_def->menu_path; - entry.entry.accelerator = menu_entry->proc_def->accelerator; - entry.entry.callback = plug_in_callback; - entry.entry.callback_action = 0; - entry.entry.item_type = NULL; - entry.quark_string = NULL; - entry.help_page = lowercase_page; - entry.description = NULL; - - gimp_menu_item_create (&entry, - menu_entry->domain, - &menu_entry->proc_def->db_info); - g_free (menu_entry); - - return FALSE; -} - -static void -plug_in_make_menu (void) -{ - PlugInDef *plug_in_def; - PlugInProcDef *proc_def; - PlugInMenuEntry *menu_entry; - GSList *domains = NULL; - GSList *procs; - GSList *tmp; - GTree *menu_entries; - -#ifdef ENABLE_NLS - bindtextdomain (std_plugins_domain, LOCALEDIR); - bind_textdomain_codeset (std_plugins_domain, "UTF-8"); - domains = g_slist_append (domains, std_plugins_domain); -#endif - -#ifdef ENABLE_NLS - menu_entries = g_tree_new ((GCompareFunc) strcoll); -#else - menu_entries = g_tree_new ((GCompareFunc) strcmp); -#endif - - tmp = plug_in_defs; - while (tmp) - { - plug_in_def = tmp->data; - tmp = tmp->next; - - procs = plug_in_def->proc_defs; - - if (!procs) - continue; - -#ifdef ENABLE_NLS - { - gchar *domain; - GSList *list; - gboolean found = FALSE; - - if (plug_in_def->locale_domain) - { - domain = plug_in_def->locale_domain; - for (list = domains; list && !found; list = list->next) - { - if (strcmp (domain, (gchar*)(list->data)) == 0) - found = TRUE; - } - if (!found) - { - domains = g_slist_append (domains, domain); - if (plug_in_def->locale_path) - bindtextdomain (domain, plug_in_def->locale_path); - else - bindtextdomain (domain, LOCALEDIR); - bind_textdomain_codeset (domain, "UTF-8"); - } - } - } -#endif /* ENABLE_NLS */ - - while (procs) - { - proc_def = procs->data; - procs = procs->next; - - if (proc_def->prog && proc_def->menu_path && (!proc_def->extensions && - !proc_def->prefixes && - !proc_def->magics)) - { - menu_entry = g_new (PlugInMenuEntry, 1); - menu_entry->proc_def = proc_def; - menu_entry->domain = plug_in_def->locale_domain ? - plug_in_def->locale_domain : std_plugins_domain; - menu_entry->help_path = plug_in_def->help_path; - - g_tree_insert (menu_entries, - dgettext (menu_entry->domain, proc_def->menu_path), - menu_entry); - } - } - } - - g_tree_traverse (menu_entries, - (GTraverseFunc) plug_in_make_menu_entry, G_IN_ORDER, NULL); - g_tree_destroy (menu_entries); - - g_slist_free (domains); -} - - -static void -plug_in_callback (GtkWidget *widget, - gpointer client_data) -{ - GimpDisplay *gdisplay; - ProcRecord *proc_rec; - Argument *args; - gint i; - gint gdisp_ID = -1; - gint argc = 0; /* calm down a gcc warning. */ - - /* get the active gdisplay */ - gdisplay = gimp_context_get_display (gimp_get_user_context (the_gimp)); - - proc_rec = (ProcRecord *) client_data; - - /* construct the procedures arguments */ - args = g_new0 (Argument, proc_rec->num_args); - - /* initialize the argument types */ - for (i = 0; i < proc_rec->num_args; i++) - args[i].arg_type = proc_rec->args[i].arg_type; - - switch (proc_rec->proc_type) - { - case GIMP_EXTENSION: - /* initialize the first argument */ - args[0].value.pdb_int = RUN_INTERACTIVE; - argc = 1; - break; - - case GIMP_PLUGIN: - if (gdisplay) - { - gdisp_ID = gdisplay->ID; - - /* initialize the first 3 plug-in arguments */ - args[0].value.pdb_int = RUN_INTERACTIVE; - args[1].value.pdb_int = gimp_image_get_ID (gdisplay->gimage); - args[2].value.pdb_int = gimp_drawable_get_ID (gimp_image_active_drawable (gdisplay->gimage)); - argc = 3; - } - else - { - g_warning ("Uh-oh, no active gdisplay for the plug-in!"); - g_free (args); - return; - } - break; - - case GIMP_TEMPORARY: - args[0].value.pdb_int = RUN_INTERACTIVE; - argc = 1; - if (proc_rec->num_args >= 3 && - proc_rec->args[1].arg_type == GIMP_PDB_IMAGE && - proc_rec->args[2].arg_type == GIMP_PDB_DRAWABLE) - { - if (gdisplay) - { - gdisp_ID = gdisplay->ID; - - args[1].value.pdb_int = gimp_image_get_ID (gdisplay->gimage); - args[2].value.pdb_int = gimp_drawable_get_ID (gimp_image_active_drawable (gdisplay->gimage)); - argc = 3; - } - else - { - g_warning ("Uh-oh, no active gdisplay for the temporary procedure!"); - g_free (args); - return; - } - } - break; - - default: - g_error ("Unknown procedure type."); - g_free (args); - return; - } - - /* run the plug-in procedure */ - plug_in_run (proc_rec, args, argc, FALSE, TRUE, gdisp_ID); - - if (proc_rec->proc_type == GIMP_PLUGIN) - last_plug_in = proc_rec; - - g_free (args); -} - -static void -plug_in_proc_def_insert (PlugInProcDef *proc_def, - void (*superceed_fn)(void*)) -{ - PlugInProcDef *tmp_proc_def; - GSList *tmp; - GSList *prev; - GSList *list; - - prev = NULL; - tmp = proc_defs; - - while (tmp) - { - tmp_proc_def = tmp->data; - - if (strcmp (proc_def->db_info.name, tmp_proc_def->db_info.name) == 0) - { - tmp->data = proc_def; - - if (proc_def->menu_path) - g_free (proc_def->menu_path); - if (proc_def->accelerator) - g_free (proc_def->accelerator); - - proc_def->menu_path = tmp_proc_def->menu_path; - proc_def->accelerator = tmp_proc_def->accelerator; - - tmp_proc_def->menu_path = NULL; - tmp_proc_def->accelerator = NULL; - - if (superceed_fn) - (* superceed_fn) (tmp_proc_def); - - plug_in_proc_def_destroy (tmp_proc_def, FALSE); - return; - } - else if (!proc_def->menu_path || - (tmp_proc_def->menu_path && - (strcmp (proc_def->menu_path, tmp_proc_def->menu_path) < 0))) - { - list = g_slist_alloc (); - list->data = proc_def; - - list->next = tmp; - if (prev) - prev->next = list; - else - proc_defs = list; - return; - } - - prev = tmp; - tmp = tmp->next; - } - - proc_defs = g_slist_append (proc_defs, proc_def); -} - -/* called when plug_in_proc_def_insert causes a proc_def to be - * overridden and thus g_free()d. - */ -static void -plug_in_proc_def_dead (void *freed_proc_def) -{ - GSList *tmp; - PlugInDef *plug_in_def; - PlugInProcDef *proc_def = freed_proc_def; - - g_warning ("removing duplicate PDB procedure \"%s\"", - proc_def->db_info.name); - - /* search the plugin list to see if any plugins had references to - * the recently freed proc_def. - */ - for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp)) - { - plug_in_def = tmp->data; - - plug_in_def->proc_defs = g_slist_remove (plug_in_def->proc_defs, - freed_proc_def); - } -} - -static void -plug_in_proc_def_remove (PlugInProcDef *proc_def) -{ - if (! the_gimp->no_interface) - { - /* Destroy the menu item */ - if (proc_def->menu_path) - { - gimp_menu_item_destroy (proc_def->menu_path); - } - } - - /* Unregister the procedural database entry */ - procedural_db_unregister (the_gimp, proc_def->db_info.name); - - /* Remove the defintion from the global list */ - proc_defs = g_slist_remove (proc_defs, proc_def); - - /* Destroy the definition */ - plug_in_proc_def_destroy (proc_def, TRUE); -} - -static void -plug_in_proc_def_destroy (PlugInProcDef *proc_def, - gboolean data_only) -{ - gint i; - - if (proc_def->prog) - g_free (proc_def->prog); - if (proc_def->menu_path) - g_free (proc_def->menu_path); - if (proc_def->accelerator) - g_free (proc_def->accelerator); - if (proc_def->extensions) - g_free (proc_def->extensions); - if (proc_def->prefixes) - g_free (proc_def->prefixes); - if (proc_def->magics) - g_free (proc_def->magics); - if (proc_def->image_types) - g_free (proc_def->image_types); - if (proc_def->db_info.name) - g_free (proc_def->db_info.name); - if (proc_def->db_info.blurb) - g_free (proc_def->db_info.blurb); - if (proc_def->db_info.help) - g_free (proc_def->db_info.help); - if (proc_def->db_info.author) - g_free (proc_def->db_info.author); - if (proc_def->db_info.copyright) - g_free (proc_def->db_info.copyright); - if (proc_def->db_info.date) - g_free (proc_def->db_info.date); - - for (i = 0; i < proc_def->db_info.num_args; i++) - { - if (proc_def->db_info.args[i].name) - g_free (proc_def->db_info.args[i].name); - if (proc_def->db_info.args[i].description) - g_free (proc_def->db_info.args[i].description); - } - - for (i = 0; i < proc_def->db_info.num_values; i++) - { - if (proc_def->db_info.values[i].name) - g_free (proc_def->db_info.values[i].name); - if (proc_def->db_info.values[i].description) - g_free (proc_def->db_info.values[i].description); - } - - if (proc_def->db_info.args) - g_free (proc_def->db_info.args); - if (proc_def->db_info.values) - g_free (proc_def->db_info.values); - - if (!data_only) - g_free (proc_def); -} - -static Argument * -plug_in_temp_run (ProcRecord *proc_rec, - Argument *args, - gint argc) -{ - Argument *return_vals; - PlugIn *plug_in; - GPProcRun proc_run; - gint old_recurse; - - return_vals = NULL; - - plug_in = (PlugIn *) proc_rec->exec_method.temporary.plug_in; - - if (plug_in) - { - if (plug_in->busy) - { - return_vals = procedural_db_return_args (proc_rec, FALSE); - goto done; - } - - plug_in->busy = TRUE; - plug_in_push (plug_in); - - proc_run.name = proc_rec->name; - proc_run.nparams = argc; - proc_run.params = plug_in_args_to_params (args, argc, FALSE); - - if (!gp_temp_proc_run_write (current_writechannel, &proc_run) || - !wire_flush (current_writechannel)) - { - return_vals = procedural_db_return_args (proc_rec, FALSE); - goto done; - } - - plug_in_pop (); - - plug_in_params_destroy (proc_run.params, proc_run.nparams, FALSE); - - old_recurse = plug_in->recurse; - plug_in->recurse = TRUE; - -/* gtk_main (); */ - -/* return_vals = plug_in_get_current_return_vals (proc_rec); */ - return_vals = procedural_db_return_args (proc_rec, TRUE); - plug_in->recurse = old_recurse; - plug_in->busy = FALSE; - } - -done: - return return_vals; -} - -static Argument* -plug_in_params_to_args (GPParam *params, - gint nparams, - gboolean full_copy) -{ - Argument *args; - gchar **stringarray; - gint count; - gint i, j; - - if (nparams == 0) - return NULL; - - args = g_new (Argument, nparams); - - for (i = 0; i < nparams; i++) - { - args[i].arg_type = params[i].type; - - switch (args[i].arg_type) - { - case GIMP_PDB_INT32: - args[i].value.pdb_int = params[i].data.d_int32; - break; - case GIMP_PDB_INT16: - args[i].value.pdb_int = params[i].data.d_int16; - break; - case GIMP_PDB_INT8: - args[i].value.pdb_int = params[i].data.d_int8; - break; - case GIMP_PDB_FLOAT: - args[i].value.pdb_float = params[i].data.d_float; - break; - case GIMP_PDB_STRING: - 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; - case GIMP_PDB_INT32ARRAY: - if (full_copy) - { - count = args[i-1].value.pdb_int; - args[i].value.pdb_pointer = g_new (gint32, count); - memcpy (args[i].value.pdb_pointer, - params[i].data.d_int32array, count * 4); - } - else - { - args[i].value.pdb_pointer = params[i].data.d_int32array; - } - break; - case GIMP_PDB_INT16ARRAY: - if (full_copy) - { - count = args[i-1].value.pdb_int; - args[i].value.pdb_pointer = g_new (gint16, count); - memcpy (args[i].value.pdb_pointer, - params[i].data.d_int16array, count * 2); - } - else - { - args[i].value.pdb_pointer = params[i].data.d_int16array; - } - break; - case GIMP_PDB_INT8ARRAY: - if (full_copy) - { - count = args[i-1].value.pdb_int; - args[i].value.pdb_pointer = g_new (gint8, count); - memcpy (args[i].value.pdb_pointer, - params[i].data.d_int8array, count); - } - else - { - args[i].value.pdb_pointer = params[i].data.d_int8array; - } - break; - case GIMP_PDB_FLOATARRAY: - if (full_copy) - { - count = args[i-1].value.pdb_int; - args[i].value.pdb_pointer = g_new (gdouble, count); - memcpy (args[i].value.pdb_pointer, - params[i].data.d_floatarray, count * 8); - } - else - { - args[i].value.pdb_pointer = params[i].data.d_floatarray; - } - break; - case GIMP_PDB_STRINGARRAY: - if (full_copy) - { - args[i].value.pdb_pointer = g_new (gchar *, - args[i-1].value.pdb_int); - 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; - case GIMP_PDB_COLOR: - args[i].value.pdb_color = params[i].data.d_color; - break; - case GIMP_PDB_REGION: - g_message ("the \"region\" arg type is not currently supported"); - break; - case GIMP_PDB_DISPLAY: - args[i].value.pdb_int = params[i].data.d_display; - break; - case GIMP_PDB_IMAGE: - args[i].value.pdb_int = params[i].data.d_image; - break; - case GIMP_PDB_LAYER: - args[i].value.pdb_int = params[i].data.d_layer; - break; - case GIMP_PDB_CHANNEL: - args[i].value.pdb_int = params[i].data.d_channel; - break; - case GIMP_PDB_DRAWABLE: - args[i].value.pdb_int = params[i].data.d_drawable; - break; - case GIMP_PDB_SELECTION: - args[i].value.pdb_int = params[i].data.d_selection; - break; - case GIMP_PDB_BOUNDARY: - args[i].value.pdb_int = params[i].data.d_boundary; - break; - case GIMP_PDB_PATH: - args[i].value.pdb_int = params[i].data.d_path; - break; - case GIMP_PDB_PARASITE: - if (full_copy) - args[i].value.pdb_pointer = - gimp_parasite_copy ((GimpParasite *) &(params[i].data.d_parasite)); - else - args[i].value.pdb_pointer = (gpointer) &(params[i].data.d_parasite); - break; - case GIMP_PDB_STATUS: - args[i].value.pdb_int = params[i].data.d_status; - break; - case GIMP_PDB_END: - break; - } - } - - return args; -} - -static GPParam* -plug_in_args_to_params (Argument *args, - gint nargs, - gboolean full_copy) -{ - GPParam *params; - gchar **stringarray; - gint i, j; - - if (nargs == 0) - return NULL; - - params = g_new (GPParam, nargs); - - for (i = 0; i < nargs; i++) - { - params[i].type = args[i].arg_type; - - switch (args[i].arg_type) - { - case GIMP_PDB_INT32: - params[i].data.d_int32 = args[i].value.pdb_int; - break; - case GIMP_PDB_INT16: - params[i].data.d_int16 = args[i].value.pdb_int; - break; - case GIMP_PDB_INT8: - params[i].data.d_int8 = args[i].value.pdb_int; - break; - case GIMP_PDB_FLOAT: - params[i].data.d_float = args[i].value.pdb_float; - break; - case GIMP_PDB_STRING: - 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; - case GIMP_PDB_INT32ARRAY: - 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; - case GIMP_PDB_INT16ARRAY: - 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; - case GIMP_PDB_INT8ARRAY: - 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; - case GIMP_PDB_FLOATARRAY: - 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; - case GIMP_PDB_STRINGARRAY: - 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; - case GIMP_PDB_COLOR: - params[i].data.d_color = args[i].value.pdb_color; - break; - case GIMP_PDB_REGION: - g_message ("the \"region\" arg type is not currently supported"); - break; - case GIMP_PDB_DISPLAY: - params[i].data.d_display = args[i].value.pdb_int; - break; - case GIMP_PDB_IMAGE: - params[i].data.d_image = args[i].value.pdb_int; - break; - case GIMP_PDB_LAYER: - params[i].data.d_layer = args[i].value.pdb_int; - break; - case GIMP_PDB_CHANNEL: - params[i].data.d_channel = args[i].value.pdb_int; - break; - case GIMP_PDB_DRAWABLE: - params[i].data.d_drawable = args[i].value.pdb_int; - break; - case GIMP_PDB_SELECTION: - params[i].data.d_selection = args[i].value.pdb_int; - break; - case GIMP_PDB_BOUNDARY: - params[i].data.d_boundary = args[i].value.pdb_int; - break; - case GIMP_PDB_PATH: - params[i].data.d_path = args[i].value.pdb_int; - break; - case GIMP_PDB_PARASITE: - if (full_copy) - { - GimpParasite *tmp; - - tmp = gimp_parasite_copy (args[i].value.pdb_pointer); - if (tmp == NULL) - { - params[i].data.d_parasite.name = 0; - params[i].data.d_parasite.flags = 0; - params[i].data.d_parasite.size = 0; - params[i].data.d_parasite.data = 0; - } - else - { - memcpy (¶ms[i].data.d_parasite, tmp, - sizeof (GimpParasite)); - g_free (tmp); - } - } - else - { - if (args[i].value.pdb_pointer == NULL) - { - params[i].data.d_parasite.name = 0; - params[i].data.d_parasite.flags = 0; - params[i].data.d_parasite.size = 0; - params[i].data.d_parasite.data = 0; - } - else - memcpy (¶ms[i].data.d_parasite, - (GimpParasite *) (args[i].value.pdb_pointer), - sizeof (GimpParasite)); - } - break; - case GIMP_PDB_STATUS: - params[i].data.d_status = args[i].value.pdb_int; - break; - case GIMP_PDB_END: - break; - } - } - - return params; -} - -static void -plug_in_params_destroy (GPParam *params, - gint nparams, - gboolean full_destroy) -{ - gint i, j; - - 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: - if (full_destroy) - g_free (params[i].data.d_string); - break; - case GIMP_PDB_INT32ARRAY: - if (full_destroy) - g_free (params[i].data.d_int32array); - break; - case GIMP_PDB_INT16ARRAY: - if (full_destroy) - g_free (params[i].data.d_int16array); - break; - case GIMP_PDB_INT8ARRAY: - if (full_destroy) - g_free (params[i].data.d_int8array); - break; - case GIMP_PDB_FLOATARRAY: - if (full_destroy) - g_free (params[i].data.d_floatarray); - break; - case GIMP_PDB_STRINGARRAY: - if (full_destroy) - { - 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 (full_destroy) - 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; - } - } - - g_free (params); -} - -static void -plug_in_args_destroy (Argument *args, - gint nargs, - gboolean full_destroy) -{ - gchar **stringarray; - gint count; - gint i, j; - - for (i = 0; i < nargs; i++) - { - switch (args[i].arg_type) - { - case GIMP_PDB_INT32: - case GIMP_PDB_INT16: - case GIMP_PDB_INT8: - case GIMP_PDB_FLOAT: - break; - case GIMP_PDB_STRING: - if (full_destroy) - g_free (args[i].value.pdb_pointer); - break; - case GIMP_PDB_INT32ARRAY: - if (full_destroy) - g_free (args[i].value.pdb_pointer); - break; - case GIMP_PDB_INT16ARRAY: - if (full_destroy) - g_free (args[i].value.pdb_pointer); - break; - case GIMP_PDB_INT8ARRAY: - if (full_destroy) - g_free (args[i].value.pdb_pointer); - break; - case GIMP_PDB_FLOATARRAY: - if (full_destroy) - g_free (args[i].value.pdb_pointer); - break; - case GIMP_PDB_STRINGARRAY: - if (full_destroy) - { - count = args[i-1].value.pdb_int; - stringarray = args[i].value.pdb_pointer; - - for (j = 0; j < count; j++) - g_free (stringarray[j]); - - g_free (args[i].value.pdb_pointer); - } - 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 (full_destroy) - { - gimp_parasite_free ((GimpParasite *) (args[i].value.pdb_pointer)); - args[i].value.pdb_pointer = NULL; - } - break; - case GIMP_PDB_STATUS: - break; - case GIMP_PDB_END: - break; - } - } - - g_free (args); -} - -gint -plug_in_image_types_parse (gchar *image_types) -{ - gchar *type_spec = image_types; - gint types = 0; - - /* - * If the plug_in registers with image_type == NULL or "", return 0 - * By doing so it won't be touched by plug_in_set_menu_sensitivity() - */ - if (!image_types) - return types; - - while (*image_types) - { - while (*image_types && - ((*image_types == ' ') || - (*image_types == '\t') || - (*image_types == ','))) - image_types++; - - if (*image_types) - { - if (strncmp (image_types, "RGBA", 4) == 0) - { - types |= PLUG_IN_RGBA_IMAGE; - image_types += 4; - } - else if (strncmp (image_types, "RGB*", 4) == 0) - { - types |= PLUG_IN_RGB_IMAGE | PLUG_IN_RGBA_IMAGE; - image_types += 4; - } - else if (strncmp (image_types, "RGB", 3) == 0) - { - types |= PLUG_IN_RGB_IMAGE; - image_types += 3; - } - else if (strncmp (image_types, "GRAYA", 5) == 0) - { - types |= PLUG_IN_GRAYA_IMAGE; - image_types += 5; - } - else if (strncmp (image_types, "GRAY*", 5) == 0) - { - types |= PLUG_IN_GRAY_IMAGE | PLUG_IN_GRAYA_IMAGE; - image_types += 5; - } - else if (strncmp (image_types, "GRAY", 4) == 0) - { - types |= PLUG_IN_GRAY_IMAGE; - image_types += 4; - } - else if (strncmp (image_types, "INDEXEDA", 8) == 0) - { - types |= PLUG_IN_INDEXEDA_IMAGE; - image_types += 8; - } - else if (strncmp (image_types, "INDEXED*", 8) == 0) - { - types |= PLUG_IN_INDEXED_IMAGE | PLUG_IN_INDEXEDA_IMAGE; - image_types += 8; - } - else if (strncmp (image_types, "INDEXED", 7) == 0) - { - types |= PLUG_IN_INDEXED_IMAGE; - image_types += 7; - } - else if (strncmp (image_types, "*", 1) == 0) - { - types |= PLUG_IN_RGB_IMAGE | PLUG_IN_RGBA_IMAGE - | PLUG_IN_GRAY_IMAGE | PLUG_IN_GRAYA_IMAGE - | PLUG_IN_INDEXED_IMAGE | PLUG_IN_INDEXEDA_IMAGE; - image_types += 1; - } - else - { - g_warning ("image_type contains unrecognizable parts: '%s'", type_spec); - while (*image_types && - ((*image_types != ' ') || - (*image_types != '\t') || - (*image_types != ','))) - image_types++; - } - } - } - - return types; -} - -static void -plug_in_progress_cancel (GtkWidget *widget, - PlugIn *plug_in) -{ - plug_in_destroy (plug_in); -} - -void -plug_in_progress_init (PlugIn *plug_in, - gchar *message, - gint gdisp_ID) -{ - GimpDisplay *gdisp = NULL; - - if (!message) - message = plug_in->args[0]; - - if (gdisp_ID > 0) - gdisp = gimp_display_get_by_ID (the_gimp, gdisp_ID); - - if (plug_in->progress) - plug_in->progress = progress_restart (plug_in->progress, message, - G_CALLBACK (plug_in_progress_cancel), - plug_in); - else - plug_in->progress = progress_start (gdisp, message, TRUE, - G_CALLBACK (plug_in_progress_cancel), - plug_in); -} - -void -plug_in_progress_update (PlugIn *plug_in, - gdouble percentage) -{ - if (!plug_in->progress) - plug_in_progress_init (plug_in, NULL, -1); - - progress_update (plug_in->progress, percentage); -} - -static gchar * -plug_in_search_in_path (gchar *search_path, - gchar *filename) -{ - gchar *local_path; - gchar *token; - gchar *next_token; - gchar *path; - struct stat buf; - gint err; - - local_path = g_strdup (search_path); - next_token = local_path; - token = strtok (next_token, G_SEARCHPATH_SEPARATOR_S); - - while (token) - { - path = g_build_filename (token, filename, NULL); - - err = stat (path, &buf); - if (!err && S_ISREG (buf.st_mode)) - { - token = path; - break; - } - - g_free (path); - - token = strtok (NULL, G_SEARCHPATH_SEPARATOR_S); - } - - g_free (local_path); - - return token; -} diff --git a/app/plug_in.h b/app/plug_in.h deleted file mode 100644 index 1ca0517ea9..0000000000 --- a/app/plug_in.h +++ /dev/null @@ -1,196 +0,0 @@ -/* 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 - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef __PLUG_IN_H__ -#define __PLUG_IN_H__ - - -#include /* time_t */ -#include /* pid_t */ - - -/* FIXME: move the plugin stuff to plug-in/ */ - -#include "plug-in/plug-in-types.h" - -#include "pdb/procedural_db.h" - - -#define WRITE_BUFFER_SIZE 512 - -#define PLUG_IN_RGB_IMAGE 0x01 -#define PLUG_IN_GRAY_IMAGE 0x02 -#define PLUG_IN_INDEXED_IMAGE 0x04 -#define PLUG_IN_RGBA_IMAGE 0x08 -#define PLUG_IN_GRAYA_IMAGE 0x10 -#define PLUG_IN_INDEXEDA_IMAGE 0x20 - - -struct _PlugIn -{ - guint open : 1; /* Is the plug-in open* */ - guint query : 1; /* Are we querying the plug-in? */ - guint synchronous : 1; /* Is the plug-in running synchronously? */ - guint recurse : 1; /* Have we called 'gtk_main' recursively? */ - guint busy : 1; /* Is the plug-in busy with a temp proc? */ - pid_t pid; /* Plug-ins process id */ - gchar *args[7]; /* Plug-ins command line arguments */ - - GIOChannel *my_read; /* App's read and write channels */ - GIOChannel *my_write; - GIOChannel *his_read; /* Plug-in's read and write channels */ - GIOChannel *his_write; -#ifdef G_OS_WIN32 - guint his_thread_id; /* Plug-in's thread ID */ - gint his_read_fd; /* Plug-in's read pipe fd */ -#endif - - guint32 input_id; /* Id of input proc */ - - gchar write_buffer[WRITE_BUFFER_SIZE]; /* Buffer for writing */ - gint write_buffer_index; /* Buffer index for writing */ - - GSList *temp_proc_defs; /* Temporary procedures */ - - GimpProgress *progress; /* Progress dialog */ - - PlugInDef *user_data; /* DON'T USE!! */ -}; - -struct _PlugInProcDef -{ - gchar *prog; - gchar *menu_path; - gchar *accelerator; - gchar *extensions; - gchar *prefixes; - gchar *magics; - gchar *image_types; - gint image_types_val; - ProcRecord db_info; - GSList *extensions_list; - GSList *prefixes_list; - GSList *magics_list; - time_t mtime; -}; - - -/* Initialize the plug-ins */ -void plug_in_init (Gimp *gimp, - GimpInitStatusFunc status_callback); - -/* Kill all running plug-ins */ -void plug_in_kill (void); - -/* Add a plug-in to the list of valid plug-ins and query the plug-in - * for information if necessary. - */ -void plug_in_add (gchar *name, - gchar *menu_path, - gchar *accelerator); - -/* Get the "image_types" the plug-in works on. */ -gchar * plug_in_image_types (gchar *name); - -/* Add in the file load/save handler fields procedure. */ -PlugInProcDef * plug_in_file_handler (gchar *name, - gchar *extensions, - gchar *prefixes, - gchar *magics); - -/* Add a plug-in definition. */ -void plug_in_def_add (PlugInDef *plug_in_def); - -/* Allocate and free a plug-in definition. */ -PlugInDef * plug_in_def_new (const gchar *prog); -void plug_in_def_free (PlugInDef *plug_in_def, - gboolean free_proc_defs); - -void plug_in_def_set_mtime (PlugInDef *plug_in_def, - time_t mtime); -void plug_in_def_set_locale_domain_name (PlugInDef *plug_in_def, - const gchar *domain_name); -void plug_in_def_set_locale_domain_path (PlugInDef *plug_in_def, - const gchar *domain_path); -void plug_in_def_set_help_path (PlugInDef *plug_in_def, - const gchar *help_path); -void plug_in_def_add_proc_def (PlugInDef *plug_in_def, - PlugInProcDef *proc_def); - -/* Retrieve a plug-ins menu path */ -gchar * plug_in_menu_path (gchar *name); - -/* Retrieve a plug-ins help path */ -gchar * plug_in_help_path (gchar *prog_name); - -/* Create a new plug-in structure */ -PlugIn * plug_in_new (gchar *name); - -/* Destroy a plug-in structure. - * This will close the plug-in first if necessary. - */ -void plug_in_destroy (PlugIn *plug_in); - - -/* Open a plug-in. This cause the plug-in to run. - * If returns TRUE, you must destroy the plugin. - * If returns FALSE, you must not destroy the plugin. - */ -gboolean plug_in_open (PlugIn *plug_in); - -/* Close a plug-in. This kills the plug-in and releases its resources. */ -void plug_in_close (PlugIn *plug_in, - gboolean kill_it); - -/* Run a plug-in as if it were a procedure database procedure */ -Argument * plug_in_run (ProcRecord *proc_rec, - Argument *args, - gint argc, - gboolean synchronous, - gboolean destroy_values, - gint gdisp_ID); - -/* Run the last plug-in again with the same arguments. Extensions - * are exempt from this "privelege". - */ -void plug_in_repeat (gboolean with_interface); - -/* Set the sensitivity for plug-in menu items based on the image type. */ -void plug_in_set_menu_sensitivity (GimpImageType type); - - -/* Register an internal plug-in. This is for file load-save - * handlers, which are organized around the plug-in data structure. - * This could all be done a little better, but oh well. -josh - */ -void plug_in_add_internal (PlugInProcDef *proc_def); -GSList * plug_in_extensions_parse (gchar *extensions); -gint plug_in_image_types_parse (gchar *image_types); - -void plug_in_progress_init (PlugIn *plug_in, - gchar *message, - gint gdisp_ID); -void plug_in_progress_update (PlugIn *plug_in, - gdouble percentage); - - -extern PlugIn *current_plug_in; -extern GSList *proc_defs; - - -#endif /* __PLUG_IN_H__ */ diff --git a/app/tools/gimpbezierselecttool.c b/app/tools/gimpbezierselecttool.c index 7a569a3af2..db759b78e0 100644 --- a/app/tools/gimpbezierselecttool.c +++ b/app/tools/gimpbezierselecttool.c @@ -53,7 +53,6 @@ #include "tool_manager.h" #include "app_procs.h" -#include "errors.h" #include "gimprc.h" #include "path.h" #include "pathP.h" @@ -628,9 +627,8 @@ gimp_bezier_select_tool_button_press (GimpTool *tool, break; case BEZIER_EDIT: - if (!bezier_sel->closed) - gimp_fatal_error ("gimp_bezier_select_tool_button_press(): Tried to edit " - "on open bezier curve in edit selection"); + if (! bezier_sel->closed) + g_error ("Tried to edit on open bezier curve in edit selection"); /* erase the handles */ bezier_sel->draw_mode = BEZIER_DRAW_ALL; @@ -897,8 +895,7 @@ gimp_bezier_select_tool_motion (GimpTool *tool, } if (! anchor) - gimp_fatal_error ("bezier_select_motion(): Encountered orphaned " - "bezier control point"); + g_error ("Encountered orphaned bezier control point"); if (opposite_control) { @@ -2404,8 +2401,8 @@ bezier_draw_segment (GimpBezierSelectTool *bezier_sel, for (i = 0; i < 4; i++) { - if (!points) - gimp_fatal_error ("bezier_draw_segment(): Bad bezier segment"); + if (! points) + g_error ("Bad bezier segment"); switch (space) { @@ -2422,7 +2419,7 @@ bezier_draw_segment (GimpBezierSelectTool *bezier_sel, geometry[i][1] = points->sy; break; default: - gimp_fatal_error ("bezier_draw_segment(): Unknown coordinate space: %d", space); + g_error ("Unknown coordinate space: %d", space); break; } @@ -2568,8 +2565,8 @@ bezier_convert (GimpBezierSelectTool *bezier_sel, gint x, x2, w; gint i, j; - if (!bezier_sel->closed) - gimp_fatal_error ("bezier_convert(): tried to convert an open bezier curve"); + if (! bezier_sel->closed) + g_error ("tried to convert an open bezier curve"); /* destroy previous mask */ if (bezier_sel->mask) @@ -3074,7 +3071,7 @@ test_add_point_on_segment (GimpBezierSelectTool *bezier_sel, geometry[i][1] = points->sy; break; default: - gimp_fatal_error ("test_add_point_on_segment(): Unknown coordinate space: %d", space); + g_error ("Unknown coordinate space: %d", space); break; } @@ -3606,8 +3603,8 @@ bezier_draw_segment_for_distance (GimpBezierSelectTool *bezier_sel, for (i = 0; i < 4; i++) { - if (!points) - gimp_fatal_error ("bezier_draw_segment_for_distance(): Bad bezier segment"); + if (! points) + g_error ("Bad bezier segment"); geometry[i][0] = points->x; geometry[i][1] = points->y; diff --git a/app/tools/xinput_airbrush.c b/app/tools/xinput_airbrush.c index 4b05444162..57146d0e42 100644 --- a/app/tools/xinput_airbrush.c +++ b/app/tools/xinput_airbrush.c @@ -21,8 +21,6 @@ #include #include -#include "appenv.h" - #include "airbrush_blob.h" #include "drawable.h" #include "draw_core.h" diff --git a/app/widgets/gimpdeviceinfo.c b/app/widgets/gimpdeviceinfo.c index bf499214df..cebcb08048 100644 --- a/app/widgets/gimpdeviceinfo.c +++ b/app/widgets/gimpdeviceinfo.c @@ -41,7 +41,6 @@ #include "widgets/gimpdnd.h" #include "widgets/gimppreview.h" -#include "appenv.h" #include "app_procs.h" #include "devices.h" #include "gimprc.h" @@ -464,7 +463,7 @@ devices_rc_update (gchar *name, { gimp_context_set_brush (device_info->context, brush); } - else if (no_data) + else if (the_gimp->no_data) { g_free (device_info->context->brush_name); device_info->context->brush_name = g_strdup (brush_name); @@ -483,7 +482,7 @@ devices_rc_update (gchar *name, { gimp_context_set_pattern (device_info->context, pattern); } - else if (no_data) + else if (the_gimp->no_data) { g_free (device_info->context->pattern_name); device_info->context->pattern_name = g_strdup (pattern_name); @@ -502,7 +501,7 @@ devices_rc_update (gchar *name, { gimp_context_set_gradient (device_info->context, gradient); } - else if (no_data) + else if (the_gimp->no_data) { g_free (device_info->context->gradient_name); device_info->context->gradient_name = g_strdup (gradient_name); diff --git a/app/widgets/gimpdevices.c b/app/widgets/gimpdevices.c index bf499214df..cebcb08048 100644 --- a/app/widgets/gimpdevices.c +++ b/app/widgets/gimpdevices.c @@ -41,7 +41,6 @@ #include "widgets/gimpdnd.h" #include "widgets/gimppreview.h" -#include "appenv.h" #include "app_procs.h" #include "devices.h" #include "gimprc.h" @@ -464,7 +463,7 @@ devices_rc_update (gchar *name, { gimp_context_set_brush (device_info->context, brush); } - else if (no_data) + else if (the_gimp->no_data) { g_free (device_info->context->brush_name); device_info->context->brush_name = g_strdup (brush_name); @@ -483,7 +482,7 @@ devices_rc_update (gchar *name, { gimp_context_set_pattern (device_info->context, pattern); } - else if (no_data) + else if (the_gimp->no_data) { g_free (device_info->context->pattern_name); device_info->context->pattern_name = g_strdup (pattern_name); @@ -502,7 +501,7 @@ devices_rc_update (gchar *name, { gimp_context_set_gradient (device_info->context, gradient); } - else if (no_data) + else if (the_gimp->no_data) { g_free (device_info->context->gradient_name); device_info->context->gradient_name = g_strdup (gradient_name); diff --git a/app/widgets/gimphelp.c b/app/widgets/gimphelp.c index 299140cc4f..1f7d50f728 100644 --- a/app/widgets/gimphelp.c +++ b/app/widgets/gimphelp.c @@ -34,10 +34,11 @@ #include "core/core-types.h" +#include "plug-in/plug-in.h" + #include "app_procs.h" #include "gimphelp.h" #include "gimprc.h" -#include "plug_in.h" #include "libgimp/gimpintl.h" @@ -54,7 +55,9 @@ struct _GimpIdleHelp gchar *help_data; }; + /* local function prototypes */ + static gint gimp_idle_help (gpointer data); static gboolean gimp_help_internal (const gchar *help_path, const gchar *current_locale, @@ -63,9 +66,8 @@ static void gimp_help_netscape (const gchar *help_path, const gchar *current_locale, const gchar *help_data); -/**********************/ + /* public functions */ -/**********************/ /* The standard help function */ void @@ -95,9 +97,8 @@ gimp_help (const gchar *help_path, } } -/*********************/ -/* local functions */ -/*********************/ + +/* private functions */ static gboolean gimp_idle_help (gpointer data) diff --git a/app/xcf/xcf.c b/app/xcf/xcf.c index 3123df011e..20018e0e12 100644 --- a/app/xcf/xcf.c +++ b/app/xcf/xcf.c @@ -30,14 +30,16 @@ #include "core/gimp.h" #include "core/gimpimage.h" +#include "pdb/procedural_db.h" + +#include "plug-in/plug-in.h" + #include "xcf.h" #include "xcf-private.h" #include "xcf-load.h" #include "xcf-read.h" #include "xcf-save.h" -#include "plug_in.h" - #include "libgimp/gimpintl.h" diff --git a/libgimp/gimpenums.h b/libgimp/gimpenums.h index 74df023bd2..0ec4a2706c 100644 --- a/libgimp/gimpenums.h +++ b/libgimp/gimpenums.h @@ -245,13 +245,6 @@ typedef enum GIMP_FLATTEN_IMAGE } GimpMergeType; -typedef enum -{ - GIMP_MESSAGE_BOX, - GIMP_CONSOLE, - GIMP_ERROR_CONSOLE -} GimpMessageHandlerType; - typedef enum { GIMP_HORIZONTAL, @@ -285,13 +278,6 @@ typedef enum GIMP_POINTS } GimpSizeType; -typedef enum -{ - GIMP_STACK_TRACE_NEVER, - GIMP_STACK_TRACE_QUERY, - GIMP_STACK_TRACE_ALWAYS -} GimpStackTraceMode; - G_END_DECLS diff --git a/libgimpbase/gimpbasetypes.h b/libgimpbase/gimpbasetypes.h index b61cca7bc5..ce9407ec4a 100644 --- a/libgimpbase/gimpbasetypes.h +++ b/libgimpbase/gimpbasetypes.h @@ -90,6 +90,20 @@ typedef enum /*< chop=GIMP_ >*/ GIMP_PDB_CANCEL } GimpPDBStatusType; +typedef enum /*< chop=GIMP_ >*/ +{ + GIMP_MESSAGE_BOX, + GIMP_CONSOLE, + GIMP_ERROR_CONSOLE +} GimpMessageHandlerType; + +typedef enum /*< chop=GIMP_ >*/ +{ + GIMP_STACK_TRACE_NEVER, + GIMP_STACK_TRACE_QUERY, + GIMP_STACK_TRACE_ALWAYS +} GimpStackTraceMode; + G_END_DECLS diff --git a/plug-ins/script-fu/script-fu-constants.c b/plug-ins/script-fu/script-fu-constants.c index 01b3e2295f..e5549d93ef 100644 --- a/plug-ins/script-fu/script-fu-constants.c +++ b/plug-ins/script-fu/script-fu-constants.c @@ -103,6 +103,10 @@ init_generated_constants (void) setvar (cintern ("INDEXED-IMAGE"), flocons (4), NIL); setvar (cintern ("INDEXEDA-IMAGE"), flocons (5), NIL); + setvar (cintern ("MESSAGE-BOX"), flocons (0), NIL); + setvar (cintern ("CONSOLE"), flocons (1), NIL); + setvar (cintern ("ERROR-CONSOLE"), flocons (2), NIL); + setvar (cintern ("OFFSET-BACKGROUND"), flocons (0), NIL); setvar (cintern ("OFFSET-TRANSPARENT"), flocons (1), NIL); @@ -141,6 +145,10 @@ init_generated_constants (void) setvar (cintern ("PDB-SUCCESS"), flocons (3), NIL); setvar (cintern ("PDB-CANCEL"), flocons (4), NIL); + setvar (cintern ("STACK-TRACE-NEVER"), flocons (0), NIL); + setvar (cintern ("STACK-TRACE-QUERY"), flocons (1), NIL); + setvar (cintern ("STACK-TRACE-ALWAYS"), flocons (2), NIL); + setvar (cintern ("SHADOWS"), flocons (0), NIL); setvar (cintern ("MIDTONES"), flocons (1), NIL); setvar (cintern ("HIGHLIGHTS"), flocons (2), NIL); @@ -211,10 +219,6 @@ init_generated_constants (void) setvar (cintern ("CLIP-TO-BOTTOM-LAYER"), flocons (2), NIL); setvar (cintern ("FLATTEN-IMAGE"), flocons (3), NIL); - setvar (cintern ("MESSAGE-BOX"), flocons (0), NIL); - setvar (cintern ("CONSOLE"), flocons (1), NIL); - setvar (cintern ("ERROR-CONSOLE"), flocons (2), NIL); - setvar (cintern ("HORIZONTAL"), flocons (0), NIL); setvar (cintern ("VERTICAL"), flocons (1), NIL); setvar (cintern ("UNKNOWN"), flocons (2), NIL); @@ -233,9 +237,5 @@ init_generated_constants (void) setvar (cintern ("PIXELS"), flocons (0), NIL); setvar (cintern ("POINTS"), flocons (1), NIL); - setvar (cintern ("STACK-TRACE-NEVER"), flocons (0), NIL); - setvar (cintern ("STACK-TRACE-QUERY"), flocons (1), NIL); - setvar (cintern ("STACK-TRACE-ALWAYS"), flocons (2), NIL); - return; } diff --git a/po/ChangeLog b/po/ChangeLog index 384d5b1df0..66d4de9c07 100644 --- a/po/ChangeLog +++ b/po/ChangeLog @@ -1,3 +1,7 @@ +2001-11-30 Michael Natterer + + * POTFILES.in: app/plug_in.c -> app/plug-in/plug-in.c + 2001-11-30 Michael Natterer * POTFILES.in: updated. diff --git a/po/POTFILES.in b/po/POTFILES.in index 28bb3ac44e..e484c695f8 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -9,7 +9,6 @@ app/gimpprogress.c app/gimprc.c app/main.c app/nav_window.c -app/plug_in.c app/undo.c app/undo_history.c @@ -89,6 +88,8 @@ app/pdb/internal_procs.c app/pdb/procedural_db.c app/pdb/procedural_db_cmds.c +app/plug-in/plug-in.c + app/tools/gimpairbrushtool.c app/tools/gimpbezierselecttool.c app/tools/gimpblendtool.c diff --git a/tools/pdbgen/Makefile.am b/tools/pdbgen/Makefile.am index 899e3e92d0..897dbbdca2 100644 --- a/tools/pdbgen/Makefile.am +++ b/tools/pdbgen/Makefile.am @@ -50,17 +50,16 @@ EXTRA_DIST = \ $(pdb_sources) enum_headers = \ - ../../libgimpbase/gimpbasetypes.h \ - ../../app/appenv.h \ - ../../app/paint-funcs/paint-funcs.h \ - ../../app/base/base-types.h \ - ../../app/core/core-types.h \ - ../../app/plug-in/plug-in-types.h \ - ../../app/tools/tools-types.h \ - ../../app/tools/gimpclonetool.h \ - ../../app/tools/gimpconvolvetool.h \ - ../../app/tools/gimpdodgeburntool.h \ - ../../app/tools/gimphuesaturationtool.h \ + ../../libgimpbase/gimpbasetypes.h \ + ../../app/paint-funcs/paint-funcs-types.h \ + ../../app/base/base-types.h \ + ../../app/core/core-types.h \ + ../../app/plug-in/plug-in-types.h \ + ../../app/tools/tools-types.h \ + ../../app/tools/gimpclonetool.h \ + ../../app/tools/gimpconvolvetool.h \ + ../../app/tools/gimpdodgeburntool.h \ + ../../app/tools/gimphuesaturationtool.h \ ../../app/tools/gimptexttool.h pdb_scripts = \ diff --git a/tools/pdbgen/enumcode.pl b/tools/pdbgen/enumcode.pl index 52757ad48b..f3dcf76306 100755 --- a/tools/pdbgen/enumcode.pl +++ b/tools/pdbgen/enumcode.pl @@ -122,7 +122,7 @@ G_BEGIN_DECLS HEADER foreach (sort keys %enums) { - if (!/GimpPDB/ && !/GimpUnit/) { + if (! ($enums{$_}->{header} =~ /libgimp/)) { print ENUMFILE "typedef enum\n{\n"; my $enum = $enums{$_}; my $body = ""; foreach $symbol (@{$enum->{symbols}}) { diff --git a/tools/pdbgen/enums.pl b/tools/pdbgen/enums.pl index 0c3c5b2e09..03a3166956 100644 --- a/tools/pdbgen/enums.pl +++ b/tools/pdbgen/enums.pl @@ -128,22 +128,28 @@ package Gimp::CodeGen::enums; GIMP_PDB_SUCCESS => 'PDB_SUCCESS', GIMP_PDB_CANCEL => 'PDB_CANCEL' } }, - MessageHandlerType => + GimpMessageHandlerType => { contig => 1, - header => 'appenv.h', - symbols => [ qw(MESSAGE_BOX CONSOLE ERROR_CONSOLE) ], - mapping => { MESSAGE_BOX => '0', - CONSOLE => '1', - ERROR_CONSOLE => '2' } + header => 'libgimpbase/gimpbasetypes.h', + symbols => [ qw(GIMP_MESSAGE_BOX GIMP_CONSOLE GIMP_ERROR_CONSOLE) ], + mapping => { GIMP_MESSAGE_BOX => '0', + GIMP_CONSOLE => '1', + GIMP_ERROR_CONSOLE => '2' }, + nicks => { GIMP_MESSAGE_BOX => 'MESSAGE_BOX', + GIMP_CONSOLE => 'CONSOLE', + GIMP_ERROR_CONSOLE => 'ERROR_CONSOLE' } }, - StackTraceMode => + GimpStackTraceMode => { contig => 1, - header => 'appenv.h', - symbols => [ qw(STACK_TRACE_NEVER STACK_TRACE_QUERY - STACK_TRACE_ALWAYS) ], - mapping => { STACK_TRACE_NEVER => '0', - STACK_TRACE_QUERY => '1', - STACK_TRACE_ALWAYS => '2' } + header => 'libgimpbase/gimpbasetypes.h', + symbols => [ qw(GIMP_STACK_TRACE_NEVER GIMP_STACK_TRACE_QUERY + GIMP_STACK_TRACE_ALWAYS) ], + mapping => { GIMP_STACK_TRACE_NEVER => '0', + GIMP_STACK_TRACE_QUERY => '1', + GIMP_STACK_TRACE_ALWAYS => '2' }, + nicks => { GIMP_STACK_TRACE_NEVER => 'STACK_TRACE_NEVER', + GIMP_STACK_TRACE_QUERY => 'STACK_TRACE_QUERY', + GIMP_STACK_TRACE_ALWAYS => 'STACK_TRACE_ALWAYS' } }, LayerModeEffects => { contig => 1, diff --git a/tools/pdbgen/pdb/fileops.pdb b/tools/pdbgen/pdb/fileops.pdb index c5c4565784..7515bce4c7 100644 --- a/tools/pdbgen/pdb/fileops.pdb +++ b/tools/pdbgen/pdb/fileops.pdb @@ -415,8 +415,8 @@ CODE ); } -@headers = qw("core/gimp.h" "file/file-utils.h" "plug_in.h" - ); +@headers = qw( "core/gimp.h" + "plug-in/plug-in.h" "file/file-utils.h"); @procs = qw(file_load file_save file_load_thumbnail file_save_thumbnail temp_name register_magic_load_handler register_load_handler diff --git a/tools/pdbgen/pdb/help.pdb b/tools/pdbgen/pdb/help.pdb index 94452aedd1..1bb302620c 100644 --- a/tools/pdbgen/pdb/help.pdb +++ b/tools/pdbgen/pdb/help.pdb @@ -50,7 +50,7 @@ HELP ); } -@headers = qw( "gimphelp.h" "plug_in.h"); +@headers = qw( "plug-in/plug-in.h" "gimphelp.h"); @procs = qw(help); %exports = (app => [@procs], lib => [@procs]); diff --git a/tools/pdbgen/pdb/message.pdb b/tools/pdbgen/pdb/message.pdb index db953fd5cb..34e4d2449a 100644 --- a/tools/pdbgen/pdb/message.pdb +++ b/tools/pdbgen/pdb/message.pdb @@ -52,7 +52,7 @@ HELP &pdb_misc; @outargs = ( - { name => 'handler', type => 'enum MessageHandlerType', + { name => 'handler', type => 'enum GimpMessageHandlerType', desc => 'The current handler type: { %%desc%% }', alias => 'message_handler', no_declare => 1 } ); @@ -69,7 +69,7 @@ HELP &pdb_misc; @inargs = ( - { name => 'handler', type => 'enum MessageHandlerType', + { name => 'handler', type => 'enum GimpMessageHandlerType', desc => 'The new handler type: { %%desc%% }' } ); diff --git a/tools/pdbgen/pdb/plug_in.pdb b/tools/pdbgen/pdb/plug_in.pdb index 4672df017a..e13035eba3 100644 --- a/tools/pdbgen/pdb/plug_in.pdb +++ b/tools/pdbgen/pdb/plug_in.pdb @@ -324,9 +324,6 @@ CODE } -@headers = qw("core/gimp.h" "plug_in.h" "regexrepl/regex.h" - ); - $extra{app}->{code} = <<'CODE'; static int match_strings (regex_t *preg, @@ -336,6 +333,9 @@ match_strings (regex_t *preg, } CODE +@headers = qw( "regexrepl/regex.h" + "core/gimp.h" "plug-in/plug-in.h"); + @procs = qw(progress_init progress_update temp_PDB_name plugins_query plugin_domain_register plugin_help_register); %exports = (app => [@procs], lib => [@procs[0..2,4,5]]);