diff --git a/ChangeLog b/ChangeLog index 32c8b936e4..66d5c81ba3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,87 @@ +2001-07-10 Michael Natterer + + * app/app_procs.[ch]: removed the gimp_busy boolean, check whether + user_installation is needed here, not in user_install.c, parse + gtkrc an friends only if(!no_interface), create the Gimp object + before parsing gimp's rc files an pas it to the parse functions, + many other cleanups. + + * app/appenums.h: added MessageHandlerType and StackTraceMode. + + * app/appenv.h: removed MessageHandlerType, declare all global + variables from main.c (no more hidden global stuff please). + + * app/errors.[ch]: added the fatal message func here (from main.c), + removed the StackTraceMode enum. + + * app/gimprc.[ch]: renamed functions to gimprc_*(), pass a Gimp + pointer to some functions. + + * app/gimpunit.c + * app/unitrc.h: ok, this is ugly: renamed all functions to + _gimp_unit_*() and made them public. The unit list is part + of the Gimp object now, so pass a Gimp* to all functions. + + * app/libgimp_glue.[ch]: added EEKy wrappers for all gimp_unit_*() + functions which are used by widgets. + + * app/main.c: cleaned up the global variables, removed the fatal + message handler, call app_init() directly, not via the + user_install stuff, misc. cleanups. + + * app/user_install.[ch]: removed the check if user_installation is + needed (done by app_procs.c now). + + * app/core/gimp.[ch]: added the user_unit list and the "busy" + boolean. Moved gimp_[set|unset]_busy() here. Added + gimp_initialize() which is called after unitrc and gimprc are + parsed. + + * app/batch.c + * app/colormaps.c + * app/devices.c + * app/disp_callbacks.c + * app/gdisplay_ops.c + * app/gimphelp.c + * app/module_db.c + * app/nav_window.c + * app/plug_in.c + * app/core/gimpcontext.c + * app/core/gimpdatafiles.c + * app/core/gimpimage-convert.c + * app/core/gimpimage-duplicate.c + * app/core/gimpimage.c + * app/core/gimpparasite.c + * app/core/gimpparasitelist.h + * app/gui/file-open-dialog.c + * app/gui/gui.[ch] + * app/gui/info-dialog.c + * app/gui/info-window.c + * app/gui/preferences-dialog.c + * app/gui/session.c + * app/gui/tips-dialog.c + * app/gui/toolbox.c + * app/tools/gimpblendtool.c + * app/tools/gimpbucketfilltool.c + * app/tools/gimpcolorpickertool.c + * app/tools/gimpfuzzyselecttool.c + * app/tools/gimptransformtool.c + * app/tools/tool_manager.c + * app/widgets/gimpcolorpanel.c + * app/widgets/gimpcursor.c + * app/xcf/xcf-load.c + * app/xcf/xcf-save.c + * app/xcf/xcf.c + * tools/pdbgen/Makefile.am + * tools/pdbgen/app.pl + * tools/pdbgen/enums.pl + * tools/pdbgen/pdb/image.pdb + * tools/pdbgen/pdb/message.pdb + * tools/pdbgen/pdb/unit.pdb + * app/pdb/image_cmds.c + * app/pdb/message_cmds.c + * app/pdb/unit_cmds.c: changed accordingly, minor cleanups. + 2001-07-09 Michael Natterer * app/Makefile.am diff --git a/app/actions/plug-in-commands.c b/app/actions/plug-in-commands.c index 1a8d11c5d0..00c051bfa3 100644 --- a/app/actions/plug-in-commands.c +++ b/app/actions/plug-in-commands.c @@ -341,7 +341,7 @@ plug_in_init (void) filename = gimp_personal_rc_file ("pluginrc"); app_init_update_status (_("Resource configuration"), filename, -1); - parse_gimprc_file (filename); + gimprc_parse_file (filename); /* query any plug-ins that have changed since we last wrote out * the pluginrc file. diff --git a/app/app_procs.c b/app/app_procs.c index 88698f5307..71de4bf5b3 100644 --- a/app/app_procs.c +++ b/app/app_procs.c @@ -23,6 +23,11 @@ #ifdef HAVE_SYS_PARAM_H #include #endif +#include +#include +#ifdef HAVE_UNISTD_H +#include +#endif #include @@ -42,7 +47,6 @@ #include "tools/tool_manager.h" -#include "gui/color-notebook.h" #include "gui/file-open-dialog.h" #include "gui/gui.h" #include "gui/splash.h" @@ -51,16 +55,15 @@ #include "app_procs.h" #include "batch.h" #include "colormaps.h" +#include "docindex.h" +#include "errors.h" #include "gdisplay.h" -#include "gdisplay_ops.h" #include "gimprc.h" -#include "plug_in.h" #include "module_db.h" - +#include "plug_in.h" #include "undo.h" #include "unitrc.h" -#include "errors.h" -#include "docindex.h" +#include "user_install.h" #ifdef DISPLAY_FILTERS #include "gdisplay_color.h" @@ -72,9 +75,6 @@ Gimp *the_gimp = NULL; -/* FIXME: gimp_busy HACK */ -gboolean gimp_busy = FALSE; - static gboolean is_app_exit_finish_done = FALSE; @@ -89,38 +89,77 @@ app_init_update_status (const gchar *text1, } } -/* #define RESET_BAR() app_init_update_status("", "", 0) */ -#define RESET_BAR() - void app_init (gint gimp_argc, gchar **gimp_argv) { - const gchar *gtkrc; - gchar *filename; + const gchar *gimp_dir; + struct stat stat_buf; - /* parse the systemwide gtkrc */ - gtkrc = gimp_gtkrc (); + /* Create an instance of the "Gimp" object which is the root of the + * core object system + */ + the_gimp = gimp_new (); - if (be_verbose) - g_print (_("parsing \"%s\"\n"), gtkrc); + gtk_object_ref (GTK_OBJECT (the_gimp)); + gtk_object_sink (GTK_OBJECT (the_gimp)); - gtk_rc_parse (gtkrc); + /* Check if the usesr's gimp_directory exists + */ + gimp_dir = gimp_directory (); - /* parse the user gtkrc */ - filename = gimp_personal_rc_file ("gtkrc"); - - if (be_verbose) - g_print (_("parsing \"%s\"\n"), filename); - - gtk_rc_parse (filename); - - g_free (filename); - - if (gimprc_init ()) + if (stat (gimp_dir, &stat_buf) != 0) { - parse_unitrc (); /* this needs to be done before gimprc loading */ - parse_gimprc (); /* parse the local GIMP configuration file */ + /* not properly installed */ + + if (no_interface) + { + g_print (_("The GIMP is not properly installed for the current user\n")); + g_print (_("User installation was skipped because the '--nointerface' flag was encountered\n")); + g_print (_("To perform user installation, run the GIMP without the '--nointerface' flag\n")); + } + else + { + user_install_dialog_create (the_gimp); + + gtk_main (); + } + } + + if (! no_interface) + { + const gchar *gtkrc; + gchar *filename; + + /* parse the systemwide gtkrc */ + gtkrc = gimp_gtkrc (); + + if (be_verbose) + g_print (_("parsing \"%s\"\n"), gtkrc); + + gtk_rc_parse (gtkrc); + + /* parse the user gtkrc */ + filename = gimp_personal_rc_file ("gtkrc"); + + if (be_verbose) + g_print (_("parsing \"%s\"\n"), filename); + + gtk_rc_parse (filename); + + g_free (filename); + } + + /* The user_install dialog may have parsed unitrc and gimprc, so + * check gimprc_init()'s return value + */ + if (gimprc_init (the_gimp)) + { + /* this needs to be done before gimprc loading */ + gimp_unitrc_load (the_gimp); + + /* parse the local GIMP configuration file */ + gimprc_parse (the_gimp); } if (! no_interface) @@ -134,13 +173,10 @@ app_init (gint gimp_argc, /* initialize lowlevel stuff */ base_init (); - /* Create an instance of the "Gimp" object which is the root of the - * core object system + /* Create all members of the global Gimp instance which need an already + * parsed gimprc, e.g. the data factories */ - the_gimp = gimp_new (); - - gtk_object_ref (GTK_OBJECT (the_gimp)); - gtk_object_sink (GTK_OBJECT (the_gimp)); + gimp_initialize (the_gimp); tool_manager_init (the_gimp); @@ -155,27 +191,25 @@ app_init (gint gimp_argc, color_display_init (); #endif /* DISPLAY_FILTERS */ - RESET_BAR(); - if (gimprc.always_restore_session) - restore_session = TRUE; + /* Initialize the xcf file format routines + */ + xcf_init (the_gimp); - /* Now we are ready to draw the splash-screen-image to the start-up window */ + /* Now we are ready to draw the splash-screen-image + * to the start-up window + */ if (! no_interface && ! no_splash_image) { splash_logo_load (); } - RESET_BAR(); - xcf_init (the_gimp); /* initialize the xcf file format routines */ - - /* load all data files */ - gimp_restore (the_gimp); + /* Load all data files + */ + gimp_restore (the_gimp, no_data); plug_in_init (); /* initialize the plug in structures */ module_db_init (); /* load any modules we need */ - RESET_BAR(); - if (! no_interface) { if (! no_splash) @@ -185,14 +219,12 @@ app_init (gint gimp_argc, /* FIXME: This needs to go in preferences */ message_handler = MESSAGE_BOX; - } - if (! no_interface) - { gui_restore (the_gimp); } - /* Parse the rest of the command line arguments as images to load */ + /* Parse the rest of the command line arguments as images to load + */ if (gimp_argc > 0) while (gimp_argc--) { @@ -235,9 +267,7 @@ app_exit_finish (void) } module_db_free (); - gdisplays_delete (); plug_in_kill (); - save_unitrc (); tool_manager_exit (the_gimp); @@ -266,46 +296,3 @@ app_exit_finish_done (void) { return is_app_exit_finish_done; } - -void -gimp_set_busy (void) -{ - /* FIXME: gimp_busy HACK */ - gimp_busy = TRUE; - - gui_set_busy (the_gimp); -} - -static gboolean -gimp_idle_unset_busy (gpointer data) -{ - gimp_unset_busy (); - - *((guint *) data) = 0; - - return FALSE; -} - -void -gimp_set_busy_until_idle (void) -{ - static guint busy_idle_id = 0; - - if (! busy_idle_id) - { - gimp_set_busy (); - - busy_idle_id = g_idle_add_full (G_PRIORITY_HIGH, - gimp_idle_unset_busy, &busy_idle_id, - NULL); - } -} - -void -gimp_unset_busy (void) -{ - gui_unset_busy (the_gimp); - - /* FIXME: gimp_busy HACK */ - gimp_busy = FALSE; -} diff --git a/app/app_procs.h b/app/app_procs.h index 6b30c47de2..01188f5d47 100644 --- a/app/app_procs.h +++ b/app/app_procs.h @@ -26,19 +26,15 @@ extern Gimp *the_gimp; -void app_init_update_status (const gchar *label1, - const gchar *label2, - gdouble percentage); +void app_init_update_status (const gchar *label1, + const gchar *label2, + gdouble percentage); -void app_init (gint gimp_argc, - gchar **gimp_argv); -void app_exit (gboolean kill_it); -void app_exit_finish (void); -gboolean app_exit_finish_done (void); - -void gimp_set_busy (void); -void gimp_set_busy_until_idle (void); -void gimp_unset_busy (void); +void app_init (gint gimp_argc, + gchar **gimp_argv); +void app_exit (gboolean kill_it); +void app_exit_finish (void); +gboolean app_exit_finish_done (void); #endif /* __APP_PROCS_H__ */ diff --git a/app/appenums.h b/app/appenums.h index a2e499a148..102860b8d8 100644 --- a/app/appenums.h +++ b/app/appenums.h @@ -20,6 +20,20 @@ #define __APPENUMS_H__ +typedef enum +{ + MESSAGE_BOX, + CONSOLE, + ERROR_CONSOLE +} MessageHandlerType; + +typedef enum +{ + STACK_TRACE_NEVER, + STACK_TRACE_QUERY, + STACK_TRACE_ALWAYS +} StackTraceMode; + /* Brush application types */ typedef enum { diff --git a/app/appenv.h b/app/appenv.h index d868003ea7..d75a76a2e4 100644 --- a/app/appenv.h +++ b/app/appenv.h @@ -20,28 +20,25 @@ #define __APPENV_H__ -typedef enum -{ - MESSAGE_BOX, - CONSOLE, - ERROR_CONSOLE -} MessageHandlerType; +/* 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 gboolean double_speed; - -extern MessageHandlerType message_handler; - -/* FIXME: gimp_busy HACK */ -extern gboolean gimp_busy; +/* other global variables */ +extern gchar *prog_name; +extern MessageHandlerType message_handler; +extern gboolean double_speed; +extern gboolean use_mmx; #endif /* __APPENV_H__ */ diff --git a/app/batch.c b/app/batch.c index 5fb1263ca6..2e46877c55 100644 --- a/app/batch.c +++ b/app/batch.c @@ -51,11 +51,10 @@ static void batch_pserver (Gimp *gimp, static ProcRecord *eval_proc; + void batch_init (Gimp *gimp) { - extern gchar **batch_cmds; - gboolean read_from_stdin; gboolean perl_server_already_running = FALSE; gint i; diff --git a/app/colormaps.c b/app/colormaps.c index 368aa200ee..0107c60771 100644 --- a/app/colormaps.c +++ b/app/colormaps.c @@ -20,7 +20,7 @@ #include -#include "apptypes.h" +#include "core/core-types.h" #include "colormaps.h" #include "gimprc.h" diff --git a/app/core/gimp-parasites.c b/app/core/gimp-parasites.c index 53dfe78ba2..f981c539d6 100644 --- a/app/core/gimp-parasites.c +++ b/app/core/gimp-parasites.c @@ -149,7 +149,7 @@ gimp_parasiterc_load (Gimp *gimp) gchar *filename; filename = gimp_personal_rc_file ("parasiterc"); - parse_gimprc_file (filename); + gimprc_parse_file (filename); g_free (filename); } diff --git a/app/core/gimp-transform-region.c b/app/core/gimp-transform-region.c index 403c5dd5dc..f491d437bd 100644 --- a/app/core/gimp-transform-region.c +++ b/app/core/gimp-transform-region.c @@ -558,7 +558,7 @@ gimp_transform_tool_doit (GimpTransformTool *gt_tool, gboolean new_layer; gint i, x, y; - gimp_set_busy (); + gimp_set_busy (gdisp->gimage->gimp); tool = GIMP_TOOL (gt_tool); @@ -655,7 +655,7 @@ gimp_transform_tool_doit (GimpTransformTool *gt_tool, } } - gimp_unset_busy (); + gimp_unset_busy (gdisp->gimage->gimp); gdisplays_flush (); diff --git a/app/core/gimp.c b/app/core/gimp.c index b24e43c69f..7b3e347f04 100644 --- a/app/core/gimp.c +++ b/app/core/gimp.c @@ -45,16 +45,19 @@ #include "gimpparasite.h" #include "gimptoolinfo.h" -#include "appenv.h" #include "app_procs.h" +#include "unitrc.h" #include "libgimp/gimpintl.h" -static void gimp_class_init (GimpClass *klass); -static void gimp_init (Gimp *gimp); +static void gimp_class_init (GimpClass *klass); +static void gimp_init (Gimp *gimp); -static void gimp_destroy (GtkObject *object); +static void gimp_destroy (GtkObject *object); + +static void gimp_context_destroy_callback (GimpContext *context, + Gimp *gimp); static GimpObjectClass *parent_class = NULL; @@ -100,40 +103,15 @@ gimp_class_init (GimpClass *klass) static void gimp_init (Gimp *gimp) { - GimpContext *context; + gimp->create_display_func = NULL; + gimp->gui_set_busy_func = NULL; + gimp->gui_unset_busy_func = NULL; - static const GimpDataFactoryLoaderEntry brush_loader_entries[] = - { - { gimp_brush_load, GIMP_BRUSH_FILE_EXTENSION }, - { gimp_brush_load, GIMP_BRUSH_PIXMAP_FILE_EXTENSION }, - { gimp_brush_generated_load, GIMP_BRUSH_GENERATED_FILE_EXTENSION }, - { gimp_brush_pipe_load, GIMP_BRUSH_PIPE_FILE_EXTENSION } - }; - static gint n_brush_loader_entries = (sizeof (brush_loader_entries) / - sizeof (brush_loader_entries[0])); + gimp->busy = FALSE; + gimp->busy_idle_id = 0; - static const GimpDataFactoryLoaderEntry pattern_loader_entries[] = - { - { gimp_pattern_load, GIMP_PATTERN_FILE_EXTENSION } - }; - static gint n_pattern_loader_entries = (sizeof (pattern_loader_entries) / - sizeof (pattern_loader_entries[0])); - - static const GimpDataFactoryLoaderEntry gradient_loader_entries[] = - { - { gimp_gradient_load, GIMP_GRADIENT_FILE_EXTENSION }, - { gimp_gradient_load, NULL /* legacy loader */ } - }; - static gint n_gradient_loader_entries = (sizeof (gradient_loader_entries) / - sizeof (gradient_loader_entries[0])); - - static const GimpDataFactoryLoaderEntry palette_loader_entries[] = - { - { gimp_palette_load, GIMP_PALETTE_FILE_EXTENSION }, - { gimp_palette_load, NULL /* legacy loader */ } - }; - static gint n_palette_loader_entries = (sizeof (palette_loader_entries) / - sizeof (palette_loader_entries[0])); + gimp->user_units = NULL; + gimp->n_user_units = 0; gimp->images = gimp_list_new (GIMP_TYPE_IMAGE, GIMP_CONTAINER_POLICY_WEAK); @@ -146,47 +124,12 @@ gimp_init (Gimp *gimp) gtk_object_ref (GTK_OBJECT (gimp->named_buffers)); gtk_object_sink (GTK_OBJECT (gimp->named_buffers)); - gimp_parasites_init (gimp); + gimp->parasites = NULL; - gimp->brush_factory = - gimp_data_factory_new (GIMP_TYPE_BRUSH, - (const gchar **) &core_config->brush_path, - brush_loader_entries, - n_brush_loader_entries, - gimp_brush_new, - gimp_brush_get_standard); - gtk_object_ref (GTK_OBJECT (gimp->brush_factory)); - gtk_object_sink (GTK_OBJECT (gimp->brush_factory)); - - gimp->pattern_factory = - gimp_data_factory_new (GIMP_TYPE_PATTERN, - (const gchar **) &core_config->pattern_path, - pattern_loader_entries, - n_pattern_loader_entries, - gimp_pattern_new, - gimp_pattern_get_standard); - gtk_object_ref (GTK_OBJECT (gimp->pattern_factory)); - gtk_object_sink (GTK_OBJECT (gimp->pattern_factory)); - - gimp->gradient_factory = - gimp_data_factory_new (GIMP_TYPE_GRADIENT, - (const gchar **) &core_config->gradient_path, - gradient_loader_entries, - n_gradient_loader_entries, - gimp_gradient_new, - gimp_gradient_get_standard); - gtk_object_ref (GTK_OBJECT (gimp->gradient_factory)); - gtk_object_sink (GTK_OBJECT (gimp->gradient_factory)); - - gimp->palette_factory = - gimp_data_factory_new (GIMP_TYPE_PALETTE, - (const gchar **) &core_config->palette_path, - palette_loader_entries, - n_palette_loader_entries, - gimp_palette_new, - gimp_palette_get_standard); - gtk_object_ref (GTK_OBJECT (gimp->palette_factory)); - gtk_object_sink (GTK_OBJECT (gimp->palette_factory)); + gimp->brush_factory = NULL; + gimp->pattern_factory = NULL; + gimp->gradient_factory = NULL; + gimp->palette_factory = NULL; procedural_db_init (gimp); @@ -195,20 +138,15 @@ gimp_init (Gimp *gimp) gtk_object_ref (GTK_OBJECT (gimp->tool_info_list)); gtk_object_sink (GTK_OBJECT (gimp->tool_info_list)); - gimp_image_new_init (gimp); + gimp->image_base_type_names = NULL; + gimp->fill_type_names = NULL; + gimp->have_current_cut_buffer = FALSE; - gimp->standard_context = gimp_create_context (gimp, "Standard", NULL); - gtk_object_ref (GTK_OBJECT (gimp->standard_context)); - gtk_object_sink (GTK_OBJECT (gimp->standard_context)); - - /* TODO: load from disk */ - context = gimp_create_context (gimp, "Default", NULL); - gimp_set_default_context (gimp, context); - - context = gimp_create_context (gimp, "User", context); - gimp_set_user_context (gimp, context); - - gimp_set_current_context (gimp, context); + gimp->context_list = NULL; + gimp->standard_context = NULL; + gimp->default_context = NULL; + gimp->user_context = NULL; + gimp->current_context = NULL; } static void @@ -287,6 +225,15 @@ gimp_destroy (GtkObject *object) gimp->images = NULL; } + if (gimp->user_units) + { + g_list_foreach (gimp->user_units, (GFunc) g_free, NULL); + g_list_free (gimp->user_units); + + gimp->user_units = NULL; + gimp->n_user_units = 0; + } + if (GTK_OBJECT_CLASS (parent_class)->destroy) GTK_OBJECT_CLASS (parent_class)->destroy (object); } @@ -302,7 +249,107 @@ gimp_new (void) } void -gimp_restore (Gimp *gimp) +gimp_initialize (Gimp *gimp) +{ + GimpContext *context; + + static const GimpDataFactoryLoaderEntry brush_loader_entries[] = + { + { gimp_brush_load, GIMP_BRUSH_FILE_EXTENSION }, + { gimp_brush_load, GIMP_BRUSH_PIXMAP_FILE_EXTENSION }, + { gimp_brush_generated_load, GIMP_BRUSH_GENERATED_FILE_EXTENSION }, + { gimp_brush_pipe_load, GIMP_BRUSH_PIPE_FILE_EXTENSION } + }; + static gint n_brush_loader_entries = (sizeof (brush_loader_entries) / + sizeof (brush_loader_entries[0])); + + static const GimpDataFactoryLoaderEntry pattern_loader_entries[] = + { + { gimp_pattern_load, GIMP_PATTERN_FILE_EXTENSION } + }; + static gint n_pattern_loader_entries = (sizeof (pattern_loader_entries) / + sizeof (pattern_loader_entries[0])); + + static const GimpDataFactoryLoaderEntry gradient_loader_entries[] = + { + { gimp_gradient_load, GIMP_GRADIENT_FILE_EXTENSION }, + { gimp_gradient_load, NULL /* legacy loader */ } + }; + static gint n_gradient_loader_entries = (sizeof (gradient_loader_entries) / + sizeof (gradient_loader_entries[0])); + + static const GimpDataFactoryLoaderEntry palette_loader_entries[] = + { + { gimp_palette_load, GIMP_PALETTE_FILE_EXTENSION }, + { gimp_palette_load, NULL /* legacy loader */ } + }; + static gint n_palette_loader_entries = (sizeof (palette_loader_entries) / + sizeof (palette_loader_entries[0])); + + g_return_if_fail (gimp != NULL); + g_return_if_fail (GIMP_IS_GIMP (gimp)); + + gimp_parasites_init (gimp); + + gimp->brush_factory = + gimp_data_factory_new (GIMP_TYPE_BRUSH, + (const gchar **) &core_config->brush_path, + brush_loader_entries, + n_brush_loader_entries, + gimp_brush_new, + gimp_brush_get_standard); + gtk_object_ref (GTK_OBJECT (gimp->brush_factory)); + gtk_object_sink (GTK_OBJECT (gimp->brush_factory)); + + gimp->pattern_factory = + gimp_data_factory_new (GIMP_TYPE_PATTERN, + (const gchar **) &core_config->pattern_path, + pattern_loader_entries, + n_pattern_loader_entries, + gimp_pattern_new, + gimp_pattern_get_standard); + gtk_object_ref (GTK_OBJECT (gimp->pattern_factory)); + gtk_object_sink (GTK_OBJECT (gimp->pattern_factory)); + + gimp->gradient_factory = + gimp_data_factory_new (GIMP_TYPE_GRADIENT, + (const gchar **) &core_config->gradient_path, + gradient_loader_entries, + n_gradient_loader_entries, + gimp_gradient_new, + gimp_gradient_get_standard); + gtk_object_ref (GTK_OBJECT (gimp->gradient_factory)); + gtk_object_sink (GTK_OBJECT (gimp->gradient_factory)); + + gimp->palette_factory = + gimp_data_factory_new (GIMP_TYPE_PALETTE, + (const gchar **) &core_config->palette_path, + palette_loader_entries, + n_palette_loader_entries, + gimp_palette_new, + gimp_palette_get_standard); + gtk_object_ref (GTK_OBJECT (gimp->palette_factory)); + gtk_object_sink (GTK_OBJECT (gimp->palette_factory)); + + gimp_image_new_init (gimp); + + gimp->standard_context = gimp_create_context (gimp, "Standard", NULL); + gtk_object_ref (GTK_OBJECT (gimp->standard_context)); + gtk_object_sink (GTK_OBJECT (gimp->standard_context)); + + /* TODO: load from disk */ + context = gimp_create_context (gimp, "Default", NULL); + gimp_set_default_context (gimp, context); + + context = gimp_create_context (gimp, "User", context); + gimp_set_user_context (gimp, context); + + gimp_set_current_context (gimp, context); +} + +void +gimp_restore (Gimp *gimp, + gboolean no_data) { g_return_if_fail (gimp != NULL); g_return_if_fail (GIMP_IS_GIMP (gimp)); @@ -333,11 +380,71 @@ gimp_restore (Gimp *gimp) void gimp_shutdown (Gimp *gimp) { + g_return_if_fail (gimp != NULL); + g_return_if_fail (GIMP_IS_GIMP (gimp)); + gimp_data_factory_data_save (gimp->brush_factory); gimp_data_factory_data_save (gimp->pattern_factory); gimp_data_factory_data_save (gimp->gradient_factory); gimp_data_factory_data_save (gimp->palette_factory); gimp_parasiterc_save (gimp); + gimp_unitrc_save (gimp); +} + +void +gimp_set_busy (Gimp *gimp) +{ + g_return_if_fail (gimp != NULL); + g_return_if_fail (GIMP_IS_GIMP (gimp)); + + /* FIXME: gimp_busy HACK */ + gimp->busy = TRUE; + + if (gimp->gui_set_busy_func) + gimp->gui_set_busy_func (the_gimp); +} + +static gboolean +gimp_idle_unset_busy (gpointer data) +{ + Gimp *gimp; + + gimp = (Gimp *) data; + + gimp_unset_busy (gimp); + + gimp->busy_idle_id = 0; + + return FALSE; +} + +void +gimp_set_busy_until_idle (Gimp *gimp) +{ + g_return_if_fail (gimp != NULL); + g_return_if_fail (GIMP_IS_GIMP (gimp)); + + if (! gimp->busy_idle_id) + { + gimp_set_busy (gimp); + + gimp->busy_idle_id = g_idle_add_full (G_PRIORITY_HIGH, + gimp_idle_unset_busy, gimp, + NULL); + } +} + +void +gimp_unset_busy (Gimp *gimp) +{ + g_return_if_fail (gimp != NULL); + g_return_if_fail (GIMP_IS_GIMP (gimp)); + + if (gimp->gui_unset_busy_func) + gimp->gui_unset_busy_func (the_gimp); + + /* FIXME: gimp_busy HACK */ + gimp->busy = FALSE; } GimpImage * @@ -445,12 +552,26 @@ gimp_create_context (Gimp *gimp, gimp->context_list = g_list_prepend (gimp->context_list, context); + gtk_signal_connect (GTK_OBJECT (context), "destroy", + GTK_SIGNAL_FUNC (gimp_context_destroy_callback), + gimp); + return context; } +static void +gimp_context_destroy_callback (GimpContext *context, + Gimp *gimp) +{ + gimp->context_list = g_list_remove (gimp->context_list, context); +} + GimpContext * gimp_get_standard_context (Gimp *gimp) { + g_return_val_if_fail (gimp != NULL, NULL); + g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); + return gimp->standard_context; } @@ -458,12 +579,30 @@ void gimp_set_default_context (Gimp *gimp, GimpContext *context) { + g_return_if_fail (gimp != NULL); + g_return_if_fail (GIMP_IS_GIMP (gimp)); + g_return_if_fail (! context || GIMP_IS_CONTEXT (context)); + + if (gimp->default_context) + { + gtk_object_unref (GTK_OBJECT (gimp->default_context)); + } + gimp->default_context = context; + + if (gimp->default_context) + { + gtk_object_ref (GTK_OBJECT (gimp->default_context)); + gtk_object_sink (GTK_OBJECT (gimp->default_context)); + } } GimpContext * gimp_get_default_context (Gimp *gimp) { + g_return_val_if_fail (gimp != NULL, NULL); + g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); + return gimp->default_context; } @@ -471,12 +610,30 @@ void gimp_set_user_context (Gimp *gimp, GimpContext *context) { + g_return_if_fail (gimp != NULL); + g_return_if_fail (GIMP_IS_GIMP (gimp)); + g_return_if_fail (! context || GIMP_IS_CONTEXT (context)); + + if (gimp->user_context) + { + gtk_object_unref (GTK_OBJECT (gimp->user_context)); + } + gimp->user_context = context; + + if (gimp->user_context) + { + gtk_object_ref (GTK_OBJECT (gimp->user_context)); + gtk_object_sink (GTK_OBJECT (gimp->user_context)); + } } GimpContext * gimp_get_user_context (Gimp *gimp) { + g_return_val_if_fail (gimp != NULL, NULL); + g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); + return gimp->user_context; } @@ -484,11 +641,28 @@ void gimp_set_current_context (Gimp *gimp, GimpContext *context) { + g_return_if_fail (gimp != NULL); + g_return_if_fail (GIMP_IS_GIMP (gimp)); + g_return_if_fail (! context || GIMP_IS_CONTEXT (context)); + + if (gimp->current_context) + { + gtk_object_unref (GTK_OBJECT (gimp->current_context)); + } + gimp->current_context = context; + + if (gimp->current_context) + { + gtk_object_ref (GTK_OBJECT (gimp->current_context)); + } } GimpContext * gimp_get_current_context (Gimp *gimp) { + g_return_val_if_fail (gimp != NULL, NULL); + g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); + return gimp->current_context; } diff --git a/app/core/gimp.h b/app/core/gimp.h index cf7e93d145..6f2173d51c 100644 --- a/app/core/gimp.h +++ b/app/core/gimp.h @@ -25,6 +25,8 @@ typedef void (* GimpCreateDisplayFunc) (GimpImage *gimage); +typedef void (* GimpSetBusyFunc) (Gimp *gimp); +typedef void (* GimpUnsetBusyFunc) (Gimp *gimp); #define GIMP_TYPE_GIMP (gimp_get_type ()) @@ -41,6 +43,14 @@ struct _Gimp GimpObject parent_instance; GimpCreateDisplayFunc create_display_func; + GimpSetBusyFunc gui_set_busy_func; + GimpUnsetBusyFunc gui_unset_busy_func; + + gboolean busy; + guint busy_idle_id; + + GList *user_units; + gint n_user_units; GimpContainer *images; @@ -89,9 +99,16 @@ struct _GimpClass GtkType gimp_get_type (void); Gimp * gimp_new (void); -void gimp_restore (Gimp *gimp); +void gimp_initialize (Gimp *gimp); + +void gimp_restore (Gimp *gimp, + gboolean no_data); void gimp_shutdown (Gimp *gimp); +void gimp_set_busy (Gimp *gimp); +void gimp_set_busy_until_idle (Gimp *gimp); +void gimp_unset_busy (Gimp *gimp); + GimpImage * gimp_create_image (Gimp *gimp, gint width, gint height, diff --git a/app/core/gimpcontext.c b/app/core/gimpcontext.c index 7f9c6a47f5..a7e741e96f 100644 --- a/app/core/gimpcontext.c +++ b/app/core/gimpcontext.c @@ -560,9 +560,6 @@ gimp_context_destroy (GtkObject *object) if (context->parent) gimp_context_unset_parent (context); - context->gimp->context_list = g_list_remove (context->gimp->context_list, - context); - context->image = NULL; context->display = NULL; diff --git a/app/core/gimpdatafiles.c b/app/core/gimpdatafiles.c index e513dbf176..27f6837eaf 100644 --- a/app/core/gimpdatafiles.c +++ b/app/core/gimpdatafiles.c @@ -67,10 +67,11 @@ static struct stat filestat; static gboolean is_script (const gchar *filename) { - const gchar *ext = strrchr (filename, '.'); - gchar *pathext; static gchar **exts = NULL; - gint i; + + const gchar *ext = strrchr (filename, '.'); + gchar *pathext; + gint i; if (exts == NULL) { @@ -125,12 +126,12 @@ gimp_datafiles_read_directories (const gchar *path_str, GimpDataFileLoaderFunc loader_func, gpointer loader_data) { - gchar *local_path; - GList *path; - GList *list; - gchar *filename; - gint err; - DIR *dir; + gchar *local_path; + GList *path; + GList *list; + gchar *filename; + gint err; + DIR *dir; struct dirent *dir_ent; g_return_if_fail (path_str != NULL); diff --git a/app/core/gimpdrawable-blend.c b/app/core/gimpdrawable-blend.c index 72033584a3..ec5e2ccaf5 100644 --- a/app/core/gimpdrawable-blend.c +++ b/app/core/gimpdrawable-blend.c @@ -45,7 +45,6 @@ #include "widgets/gimpdnd.h" -#include "appenv.h" #include "app_procs.h" #include "errors.h" #include "gdisplay.h" @@ -923,7 +922,7 @@ blend (GimpImage *gimage, gint bytes; gint x1, y1, x2, y2; - gimp_set_busy (); + gimp_set_busy (gimage->gimp); has_selection = gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2); @@ -958,7 +957,7 @@ blend (GimpImage *gimage, /* free the temporary buffer */ tile_manager_destroy (buf_tiles); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); } static gdouble diff --git a/app/core/gimpdrawable-transform.c b/app/core/gimpdrawable-transform.c index 403c5dd5dc..f491d437bd 100644 --- a/app/core/gimpdrawable-transform.c +++ b/app/core/gimpdrawable-transform.c @@ -558,7 +558,7 @@ gimp_transform_tool_doit (GimpTransformTool *gt_tool, gboolean new_layer; gint i, x, y; - gimp_set_busy (); + gimp_set_busy (gdisp->gimage->gimp); tool = GIMP_TOOL (gt_tool); @@ -655,7 +655,7 @@ gimp_transform_tool_doit (GimpTransformTool *gt_tool, } } - gimp_unset_busy (); + gimp_unset_busy (gdisp->gimage->gimp); gdisplays_flush (); diff --git a/app/core/gimpimage-convert.c b/app/core/gimpimage-convert.c index d088846d7a..1637535715 100644 --- a/app/core/gimpimage-convert.c +++ b/app/core/gimpimage-convert.c @@ -107,6 +107,7 @@ #include "base/pixel-region.h" #include "base/tile-manager.h" +#include "gimp.h" #include "gimpdrawable.h" #include "gimpimage.h" #include "gimpimage-convert.h" @@ -115,10 +116,8 @@ #include "gimplayer.h" #include "gimppalette.h" -#include "app_procs.h" -#include "gdisplay.h" - #include "floating_sel.h" +#include "gdisplay.h" #include "undo.h" @@ -694,7 +693,7 @@ gimp_image_convert (GimpImage *gimage, theCustomPalette = custom_palette; - gimp_set_busy (); + gimp_set_busy (gimage->gimp); /* Get the floating layer if one exists */ floating_layer = gimp_image_floating_sel (gimage); @@ -947,7 +946,7 @@ gimp_image_convert (GimpImage *gimage, gimp_image_mode_changed (gimage); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); } static void diff --git a/app/core/gimpimage-duplicate.c b/app/core/gimpimage-duplicate.c index 1a7879883e..2818e8f7d7 100644 --- a/app/core/gimpimage-duplicate.c +++ b/app/core/gimpimage-duplicate.c @@ -44,7 +44,6 @@ #include "gimplist.h" #include "gimpparasitelist.h" -#include "app_procs.h" #include "floating_sel.h" #include "gdisplay.h" #include "path.h" @@ -73,7 +72,7 @@ gimp_image_duplicate (GimpImage *gimage) g_return_val_if_fail (gimage != NULL, NULL); g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); - gimp_set_busy_until_idle (); + gimp_set_busy_until_idle (gimage->gimp); /* Create a new image */ new_gimage = gimp_create_image (gimage->gimp, diff --git a/app/core/gimpimage-guides.c b/app/core/gimpimage-guides.c index 43e02b06fe..0dc3639d18 100644 --- a/app/core/gimpimage-guides.c +++ b/app/core/gimpimage-guides.c @@ -53,7 +53,6 @@ #include "gimpparasitelist.h" #include "gimpundostack.h" -#include "app_procs.h" #include "floating_sel.h" #include "gdisplay.h" #include "path.h" @@ -767,7 +766,7 @@ gimp_image_resize (GimpImage *gimage, GList *list; GList *guide_list; - gimp_set_busy (); + gimp_set_busy (gimage->gimp); g_assert (new_width > 0 && new_height > 0); @@ -853,7 +852,7 @@ gimp_image_resize (GimpImage *gimage, gimp_viewable_size_changed (GIMP_VIEWABLE (gimage)); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); } void @@ -880,7 +879,7 @@ gimp_image_scale (GimpImage *gimage, return; } - gimp_set_busy (); + gimp_set_busy (gimage->gimp); /* Get the floating layer if one exists */ floating_layer = gimp_image_floating_sel (gimage); @@ -981,7 +980,7 @@ gimp_image_scale (GimpImage *gimage, gimp_viewable_size_changed (GIMP_VIEWABLE (gimage)); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); } /** @@ -2341,11 +2340,11 @@ gimp_image_validate (TileManager *tm, gint x, y; gint w, h; - gimp_set_busy_until_idle (); - /* Get the gimage from the tilemanager */ gimage = (GimpImage *) tile_manager_get_user_data (tm); + gimp_set_busy_until_idle (gimage->gimp); + /* Find the coordinates of this tile */ tile_manager_get_tile_coordinates (tm, tile, &x, &y); w = tile_ewidth (tile); @@ -3021,12 +3020,12 @@ gimp_image_merge_visible_layers (GimpImage *gimage, if (merge_list && merge_list->next) { - gimp_set_busy (); + gimp_set_busy (gimage->gimp); layer = gimp_image_merge_layers (gimage, merge_list, merge_type); g_slist_free (merge_list); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); return layer; } @@ -3054,7 +3053,7 @@ gimp_image_flatten (GimpImage *gimage) g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); - gimp_set_busy (); + gimp_set_busy (gimage->gimp); /* if there's a floating selection, anchor it */ if (gimp_image_floating_sel (gimage)) @@ -3075,7 +3074,7 @@ gimp_image_flatten (GimpImage *gimage) gimp_image_alpha_changed (gimage); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); return layer; } @@ -3116,12 +3115,12 @@ gimp_image_merge_down (GimpImage *gimage, { merge_list = g_slist_prepend (merge_list, current_layer); - gimp_set_busy (); + gimp_set_busy (gimage->gimp); layer = gimp_image_merge_layers (gimage, merge_list, merge_type); g_slist_free (merge_list); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); return layer; } diff --git a/app/core/gimpimage-merge.c b/app/core/gimpimage-merge.c index 43e02b06fe..0dc3639d18 100644 --- a/app/core/gimpimage-merge.c +++ b/app/core/gimpimage-merge.c @@ -53,7 +53,6 @@ #include "gimpparasitelist.h" #include "gimpundostack.h" -#include "app_procs.h" #include "floating_sel.h" #include "gdisplay.h" #include "path.h" @@ -767,7 +766,7 @@ gimp_image_resize (GimpImage *gimage, GList *list; GList *guide_list; - gimp_set_busy (); + gimp_set_busy (gimage->gimp); g_assert (new_width > 0 && new_height > 0); @@ -853,7 +852,7 @@ gimp_image_resize (GimpImage *gimage, gimp_viewable_size_changed (GIMP_VIEWABLE (gimage)); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); } void @@ -880,7 +879,7 @@ gimp_image_scale (GimpImage *gimage, return; } - gimp_set_busy (); + gimp_set_busy (gimage->gimp); /* Get the floating layer if one exists */ floating_layer = gimp_image_floating_sel (gimage); @@ -981,7 +980,7 @@ gimp_image_scale (GimpImage *gimage, gimp_viewable_size_changed (GIMP_VIEWABLE (gimage)); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); } /** @@ -2341,11 +2340,11 @@ gimp_image_validate (TileManager *tm, gint x, y; gint w, h; - gimp_set_busy_until_idle (); - /* Get the gimage from the tilemanager */ gimage = (GimpImage *) tile_manager_get_user_data (tm); + gimp_set_busy_until_idle (gimage->gimp); + /* Find the coordinates of this tile */ tile_manager_get_tile_coordinates (tm, tile, &x, &y); w = tile_ewidth (tile); @@ -3021,12 +3020,12 @@ gimp_image_merge_visible_layers (GimpImage *gimage, if (merge_list && merge_list->next) { - gimp_set_busy (); + gimp_set_busy (gimage->gimp); layer = gimp_image_merge_layers (gimage, merge_list, merge_type); g_slist_free (merge_list); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); return layer; } @@ -3054,7 +3053,7 @@ gimp_image_flatten (GimpImage *gimage) g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); - gimp_set_busy (); + gimp_set_busy (gimage->gimp); /* if there's a floating selection, anchor it */ if (gimp_image_floating_sel (gimage)) @@ -3075,7 +3074,7 @@ gimp_image_flatten (GimpImage *gimage) gimp_image_alpha_changed (gimage); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); return layer; } @@ -3116,12 +3115,12 @@ gimp_image_merge_down (GimpImage *gimage, { merge_list = g_slist_prepend (merge_list, current_layer); - gimp_set_busy (); + gimp_set_busy (gimage->gimp); layer = gimp_image_merge_layers (gimage, merge_list, merge_type); g_slist_free (merge_list); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); return layer; } diff --git a/app/core/gimpimage-pick-color.c b/app/core/gimpimage-pick-color.c index 954449c8ab..d4f17fc6b3 100644 --- a/app/core/gimpimage-pick-color.c +++ b/app/core/gimpimage-pick-color.c @@ -36,7 +36,6 @@ #include "tool_manager.h" #include "tool_options.h" -#include "appenv.h" #include "gdisplay.h" #include "gimprc.h" diff --git a/app/core/gimpimage-projection.c b/app/core/gimpimage-projection.c index 43e02b06fe..0dc3639d18 100644 --- a/app/core/gimpimage-projection.c +++ b/app/core/gimpimage-projection.c @@ -53,7 +53,6 @@ #include "gimpparasitelist.h" #include "gimpundostack.h" -#include "app_procs.h" #include "floating_sel.h" #include "gdisplay.h" #include "path.h" @@ -767,7 +766,7 @@ gimp_image_resize (GimpImage *gimage, GList *list; GList *guide_list; - gimp_set_busy (); + gimp_set_busy (gimage->gimp); g_assert (new_width > 0 && new_height > 0); @@ -853,7 +852,7 @@ gimp_image_resize (GimpImage *gimage, gimp_viewable_size_changed (GIMP_VIEWABLE (gimage)); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); } void @@ -880,7 +879,7 @@ gimp_image_scale (GimpImage *gimage, return; } - gimp_set_busy (); + gimp_set_busy (gimage->gimp); /* Get the floating layer if one exists */ floating_layer = gimp_image_floating_sel (gimage); @@ -981,7 +980,7 @@ gimp_image_scale (GimpImage *gimage, gimp_viewable_size_changed (GIMP_VIEWABLE (gimage)); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); } /** @@ -2341,11 +2340,11 @@ gimp_image_validate (TileManager *tm, gint x, y; gint w, h; - gimp_set_busy_until_idle (); - /* Get the gimage from the tilemanager */ gimage = (GimpImage *) tile_manager_get_user_data (tm); + gimp_set_busy_until_idle (gimage->gimp); + /* Find the coordinates of this tile */ tile_manager_get_tile_coordinates (tm, tile, &x, &y); w = tile_ewidth (tile); @@ -3021,12 +3020,12 @@ gimp_image_merge_visible_layers (GimpImage *gimage, if (merge_list && merge_list->next) { - gimp_set_busy (); + gimp_set_busy (gimage->gimp); layer = gimp_image_merge_layers (gimage, merge_list, merge_type); g_slist_free (merge_list); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); return layer; } @@ -3054,7 +3053,7 @@ gimp_image_flatten (GimpImage *gimage) g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); - gimp_set_busy (); + gimp_set_busy (gimage->gimp); /* if there's a floating selection, anchor it */ if (gimp_image_floating_sel (gimage)) @@ -3075,7 +3074,7 @@ gimp_image_flatten (GimpImage *gimage) gimp_image_alpha_changed (gimage); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); return layer; } @@ -3116,12 +3115,12 @@ gimp_image_merge_down (GimpImage *gimage, { merge_list = g_slist_prepend (merge_list, current_layer); - gimp_set_busy (); + gimp_set_busy (gimage->gimp); layer = gimp_image_merge_layers (gimage, merge_list, merge_type); g_slist_free (merge_list); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); return layer; } diff --git a/app/core/gimpimage-resize.c b/app/core/gimpimage-resize.c index 43e02b06fe..0dc3639d18 100644 --- a/app/core/gimpimage-resize.c +++ b/app/core/gimpimage-resize.c @@ -53,7 +53,6 @@ #include "gimpparasitelist.h" #include "gimpundostack.h" -#include "app_procs.h" #include "floating_sel.h" #include "gdisplay.h" #include "path.h" @@ -767,7 +766,7 @@ gimp_image_resize (GimpImage *gimage, GList *list; GList *guide_list; - gimp_set_busy (); + gimp_set_busy (gimage->gimp); g_assert (new_width > 0 && new_height > 0); @@ -853,7 +852,7 @@ gimp_image_resize (GimpImage *gimage, gimp_viewable_size_changed (GIMP_VIEWABLE (gimage)); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); } void @@ -880,7 +879,7 @@ gimp_image_scale (GimpImage *gimage, return; } - gimp_set_busy (); + gimp_set_busy (gimage->gimp); /* Get the floating layer if one exists */ floating_layer = gimp_image_floating_sel (gimage); @@ -981,7 +980,7 @@ gimp_image_scale (GimpImage *gimage, gimp_viewable_size_changed (GIMP_VIEWABLE (gimage)); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); } /** @@ -2341,11 +2340,11 @@ gimp_image_validate (TileManager *tm, gint x, y; gint w, h; - gimp_set_busy_until_idle (); - /* Get the gimage from the tilemanager */ gimage = (GimpImage *) tile_manager_get_user_data (tm); + gimp_set_busy_until_idle (gimage->gimp); + /* Find the coordinates of this tile */ tile_manager_get_tile_coordinates (tm, tile, &x, &y); w = tile_ewidth (tile); @@ -3021,12 +3020,12 @@ gimp_image_merge_visible_layers (GimpImage *gimage, if (merge_list && merge_list->next) { - gimp_set_busy (); + gimp_set_busy (gimage->gimp); layer = gimp_image_merge_layers (gimage, merge_list, merge_type); g_slist_free (merge_list); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); return layer; } @@ -3054,7 +3053,7 @@ gimp_image_flatten (GimpImage *gimage) g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); - gimp_set_busy (); + gimp_set_busy (gimage->gimp); /* if there's a floating selection, anchor it */ if (gimp_image_floating_sel (gimage)) @@ -3075,7 +3074,7 @@ gimp_image_flatten (GimpImage *gimage) gimp_image_alpha_changed (gimage); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); return layer; } @@ -3116,12 +3115,12 @@ gimp_image_merge_down (GimpImage *gimage, { merge_list = g_slist_prepend (merge_list, current_layer); - gimp_set_busy (); + gimp_set_busy (gimage->gimp); layer = gimp_image_merge_layers (gimage, merge_list, merge_type); g_slist_free (merge_list); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); return layer; } diff --git a/app/core/gimpimage-scale.c b/app/core/gimpimage-scale.c index 43e02b06fe..0dc3639d18 100644 --- a/app/core/gimpimage-scale.c +++ b/app/core/gimpimage-scale.c @@ -53,7 +53,6 @@ #include "gimpparasitelist.h" #include "gimpundostack.h" -#include "app_procs.h" #include "floating_sel.h" #include "gdisplay.h" #include "path.h" @@ -767,7 +766,7 @@ gimp_image_resize (GimpImage *gimage, GList *list; GList *guide_list; - gimp_set_busy (); + gimp_set_busy (gimage->gimp); g_assert (new_width > 0 && new_height > 0); @@ -853,7 +852,7 @@ gimp_image_resize (GimpImage *gimage, gimp_viewable_size_changed (GIMP_VIEWABLE (gimage)); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); } void @@ -880,7 +879,7 @@ gimp_image_scale (GimpImage *gimage, return; } - gimp_set_busy (); + gimp_set_busy (gimage->gimp); /* Get the floating layer if one exists */ floating_layer = gimp_image_floating_sel (gimage); @@ -981,7 +980,7 @@ gimp_image_scale (GimpImage *gimage, gimp_viewable_size_changed (GIMP_VIEWABLE (gimage)); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); } /** @@ -2341,11 +2340,11 @@ gimp_image_validate (TileManager *tm, gint x, y; gint w, h; - gimp_set_busy_until_idle (); - /* Get the gimage from the tilemanager */ gimage = (GimpImage *) tile_manager_get_user_data (tm); + gimp_set_busy_until_idle (gimage->gimp); + /* Find the coordinates of this tile */ tile_manager_get_tile_coordinates (tm, tile, &x, &y); w = tile_ewidth (tile); @@ -3021,12 +3020,12 @@ gimp_image_merge_visible_layers (GimpImage *gimage, if (merge_list && merge_list->next) { - gimp_set_busy (); + gimp_set_busy (gimage->gimp); layer = gimp_image_merge_layers (gimage, merge_list, merge_type); g_slist_free (merge_list); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); return layer; } @@ -3054,7 +3053,7 @@ gimp_image_flatten (GimpImage *gimage) g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); - gimp_set_busy (); + gimp_set_busy (gimage->gimp); /* if there's a floating selection, anchor it */ if (gimp_image_floating_sel (gimage)) @@ -3075,7 +3074,7 @@ gimp_image_flatten (GimpImage *gimage) gimp_image_alpha_changed (gimage); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); return layer; } @@ -3116,12 +3115,12 @@ gimp_image_merge_down (GimpImage *gimage, { merge_list = g_slist_prepend (merge_list, current_layer); - gimp_set_busy (); + gimp_set_busy (gimage->gimp); layer = gimp_image_merge_layers (gimage, merge_list, merge_type); g_slist_free (merge_list); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); return layer; } diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c index 43e02b06fe..0dc3639d18 100644 --- a/app/core/gimpimage.c +++ b/app/core/gimpimage.c @@ -53,7 +53,6 @@ #include "gimpparasitelist.h" #include "gimpundostack.h" -#include "app_procs.h" #include "floating_sel.h" #include "gdisplay.h" #include "path.h" @@ -767,7 +766,7 @@ gimp_image_resize (GimpImage *gimage, GList *list; GList *guide_list; - gimp_set_busy (); + gimp_set_busy (gimage->gimp); g_assert (new_width > 0 && new_height > 0); @@ -853,7 +852,7 @@ gimp_image_resize (GimpImage *gimage, gimp_viewable_size_changed (GIMP_VIEWABLE (gimage)); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); } void @@ -880,7 +879,7 @@ gimp_image_scale (GimpImage *gimage, return; } - gimp_set_busy (); + gimp_set_busy (gimage->gimp); /* Get the floating layer if one exists */ floating_layer = gimp_image_floating_sel (gimage); @@ -981,7 +980,7 @@ gimp_image_scale (GimpImage *gimage, gimp_viewable_size_changed (GIMP_VIEWABLE (gimage)); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); } /** @@ -2341,11 +2340,11 @@ gimp_image_validate (TileManager *tm, gint x, y; gint w, h; - gimp_set_busy_until_idle (); - /* Get the gimage from the tilemanager */ gimage = (GimpImage *) tile_manager_get_user_data (tm); + gimp_set_busy_until_idle (gimage->gimp); + /* Find the coordinates of this tile */ tile_manager_get_tile_coordinates (tm, tile, &x, &y); w = tile_ewidth (tile); @@ -3021,12 +3020,12 @@ gimp_image_merge_visible_layers (GimpImage *gimage, if (merge_list && merge_list->next) { - gimp_set_busy (); + gimp_set_busy (gimage->gimp); layer = gimp_image_merge_layers (gimage, merge_list, merge_type); g_slist_free (merge_list); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); return layer; } @@ -3054,7 +3053,7 @@ gimp_image_flatten (GimpImage *gimage) g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); - gimp_set_busy (); + gimp_set_busy (gimage->gimp); /* if there's a floating selection, anchor it */ if (gimp_image_floating_sel (gimage)) @@ -3075,7 +3074,7 @@ gimp_image_flatten (GimpImage *gimage) gimp_image_alpha_changed (gimage); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); return layer; } @@ -3116,12 +3115,12 @@ gimp_image_merge_down (GimpImage *gimage, { merge_list = g_slist_prepend (merge_list, current_layer); - gimp_set_busy (); + gimp_set_busy (gimage->gimp); layer = gimp_image_merge_layers (gimage, merge_list, merge_type); g_slist_free (merge_list); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); return layer; } diff --git a/app/core/gimpparasite.c b/app/core/gimpparasite.c index 53dfe78ba2..f981c539d6 100644 --- a/app/core/gimpparasite.c +++ b/app/core/gimpparasite.c @@ -149,7 +149,7 @@ gimp_parasiterc_load (Gimp *gimp) gchar *filename; filename = gimp_personal_rc_file ("parasiterc"); - parse_gimprc_file (filename); + gimprc_parse_file (filename); g_free (filename); } diff --git a/app/core/gimpparasitelist.h b/app/core/gimpparasitelist.h index 698e3cbb5e..2f3d2da1b3 100644 --- a/app/core/gimpparasitelist.h +++ b/app/core/gimpparasitelist.h @@ -19,7 +19,7 @@ #define __GIMP_PARASITE_LIST_H__ -#include "core/gimpobject.h" +#include "gimpobject.h" #define GIMP_TYPE_PARASITE_LIST (gimp_parasite_list_get_type ()) @@ -64,7 +64,7 @@ void gimp_parasite_list_foreach (GimpParasiteList *list, GimpParasite * gimp_parasite_list_find (GimpParasiteList *list, const gchar *name); -void gimp_parasite_shift_parent (GimpParasite *parasite); +void gimp_parasite_shift_parent (GimpParasite *parasite); #endif /* __GIMP_PARASITE_LIST_H__ */ diff --git a/app/core/gimpprojection-construct.c b/app/core/gimpprojection-construct.c index 43e02b06fe..0dc3639d18 100644 --- a/app/core/gimpprojection-construct.c +++ b/app/core/gimpprojection-construct.c @@ -53,7 +53,6 @@ #include "gimpparasitelist.h" #include "gimpundostack.h" -#include "app_procs.h" #include "floating_sel.h" #include "gdisplay.h" #include "path.h" @@ -767,7 +766,7 @@ gimp_image_resize (GimpImage *gimage, GList *list; GList *guide_list; - gimp_set_busy (); + gimp_set_busy (gimage->gimp); g_assert (new_width > 0 && new_height > 0); @@ -853,7 +852,7 @@ gimp_image_resize (GimpImage *gimage, gimp_viewable_size_changed (GIMP_VIEWABLE (gimage)); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); } void @@ -880,7 +879,7 @@ gimp_image_scale (GimpImage *gimage, return; } - gimp_set_busy (); + gimp_set_busy (gimage->gimp); /* Get the floating layer if one exists */ floating_layer = gimp_image_floating_sel (gimage); @@ -981,7 +980,7 @@ gimp_image_scale (GimpImage *gimage, gimp_viewable_size_changed (GIMP_VIEWABLE (gimage)); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); } /** @@ -2341,11 +2340,11 @@ gimp_image_validate (TileManager *tm, gint x, y; gint w, h; - gimp_set_busy_until_idle (); - /* Get the gimage from the tilemanager */ gimage = (GimpImage *) tile_manager_get_user_data (tm); + gimp_set_busy_until_idle (gimage->gimp); + /* Find the coordinates of this tile */ tile_manager_get_tile_coordinates (tm, tile, &x, &y); w = tile_ewidth (tile); @@ -3021,12 +3020,12 @@ gimp_image_merge_visible_layers (GimpImage *gimage, if (merge_list && merge_list->next) { - gimp_set_busy (); + gimp_set_busy (gimage->gimp); layer = gimp_image_merge_layers (gimage, merge_list, merge_type); g_slist_free (merge_list); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); return layer; } @@ -3054,7 +3053,7 @@ gimp_image_flatten (GimpImage *gimage) g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); - gimp_set_busy (); + gimp_set_busy (gimage->gimp); /* if there's a floating selection, anchor it */ if (gimp_image_floating_sel (gimage)) @@ -3075,7 +3074,7 @@ gimp_image_flatten (GimpImage *gimage) gimp_image_alpha_changed (gimage); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); return layer; } @@ -3116,12 +3115,12 @@ gimp_image_merge_down (GimpImage *gimage, { merge_list = g_slist_prepend (merge_list, current_layer); - gimp_set_busy (); + gimp_set_busy (gimage->gimp); layer = gimp_image_merge_layers (gimage, merge_list, merge_type); g_slist_free (merge_list); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); return layer; } diff --git a/app/core/gimpunit.c b/app/core/gimpunit.c index 32eb838860..272c02ec00 100644 --- a/app/core/gimpunit.c +++ b/app/core/gimpunit.c @@ -30,7 +30,8 @@ #include "core/core-types.h" -#include "app_procs.h" +#include "core/gimp.h" + #include "gimprc.h" #include "unitrc.h" @@ -74,45 +75,45 @@ static GimpUnitDef gimp_unit_percent = FALSE, 0.0, 0, "percent", "%", "%", N_("percent"), N_("percent") }; -static GSList* user_units = NULL; -static gint number_of_user_units = 0; /* private functions */ static GimpUnitDef * -gimp_unit_get_user_unit (GimpUnit unit) +_gimp_unit_get_user_unit (Gimp *gimp, + GimpUnit unit) { - return g_slist_nth_data (user_units, unit - GIMP_UNIT_END); + return g_list_nth_data (gimp->user_units, unit - GIMP_UNIT_END); } /* public functions */ gint -gimp_unit_get_number_of_units (void) +_gimp_unit_get_number_of_units (Gimp *gimp) { - return GIMP_UNIT_END + number_of_user_units; + return GIMP_UNIT_END + gimp->n_user_units; } gint -gimp_unit_get_number_of_built_in_units (void) +_gimp_unit_get_number_of_built_in_units (Gimp *gimp) { return GIMP_UNIT_END; } - GimpUnit -gimp_unit_new (gchar *identifier, - gdouble factor, - gint digits, - gchar *symbol, - gchar *abbreviation, - gchar *singular, - gchar *plural) +_gimp_unit_new (Gimp *gimp, + gchar *identifier, + gdouble factor, + gint digits, + gchar *symbol, + gchar *abbreviation, + gchar *singular, + gchar *plural) { GimpUnitDef *user_unit; - user_unit = g_new (GimpUnitDef, 1); + user_unit = g_new0 (GimpUnitDef, 1); + user_unit->delete_on_exit = TRUE; user_unit->factor = factor; user_unit->digits = digits; @@ -122,70 +123,71 @@ gimp_unit_new (gchar *identifier, user_unit->singular = g_strdup (singular); user_unit->plural = g_strdup (plural); - user_units = g_slist_append (user_units, user_unit); - number_of_user_units++; + gimp->user_units = g_list_append (gimp->user_units, user_unit); + gimp->n_user_units++; - return GIMP_UNIT_END + number_of_user_units - 1; + return GIMP_UNIT_END + gimp->n_user_units - 1; } - gboolean -gimp_unit_get_deletion_flag (GimpUnit unit) +_gimp_unit_get_deletion_flag (Gimp *gimp, + GimpUnit unit) { g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) && - (unit < (GIMP_UNIT_END + number_of_user_units)), FALSE); + (unit < (GIMP_UNIT_END + gimp->n_user_units)), FALSE); if (unit < GIMP_UNIT_END) return FALSE; - return gimp_unit_get_user_unit (unit)->delete_on_exit; + return _gimp_unit_get_user_unit (gimp, unit)->delete_on_exit; } void -gimp_unit_set_deletion_flag (GimpUnit unit, - gboolean deletion_flag) +_gimp_unit_set_deletion_flag (Gimp *gimp, + GimpUnit unit, + gboolean deletion_flag) { g_return_if_fail ((unit >= GIMP_UNIT_END) && - (unit < (GIMP_UNIT_END + number_of_user_units))); + (unit < (GIMP_UNIT_END + gimp->n_user_units))); - gimp_unit_get_user_unit (unit)->delete_on_exit = + _gimp_unit_get_user_unit (gimp, unit)->delete_on_exit = deletion_flag ? TRUE : FALSE; } - gdouble -gimp_unit_get_factor (GimpUnit unit) +_gimp_unit_get_factor (Gimp *gimp, + GimpUnit unit) { g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) && - (unit < (GIMP_UNIT_END + number_of_user_units)), + (unit < (GIMP_UNIT_END + gimp->n_user_units)), gimp_unit_defs[GIMP_UNIT_INCH].factor); if (unit < GIMP_UNIT_END) return gimp_unit_defs[unit].factor; - return gimp_unit_get_user_unit (unit)->factor; + return _gimp_unit_get_user_unit (gimp, unit)->factor; } - gint -gimp_unit_get_digits (GimpUnit unit) +_gimp_unit_get_digits (Gimp *gimp, + GimpUnit unit) { g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) && - (unit < (GIMP_UNIT_END + number_of_user_units)), + (unit < (GIMP_UNIT_END + gimp->n_user_units)), gimp_unit_defs[GIMP_UNIT_INCH].digits); if (unit < GIMP_UNIT_END) return gimp_unit_defs[unit].digits; - return gimp_unit_get_user_unit (unit)->digits; + return _gimp_unit_get_user_unit (gimp, unit)->digits; } - gchar * -gimp_unit_get_identifier (GimpUnit unit) +_gimp_unit_get_identifier (Gimp *gimp, + GimpUnit unit) { g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) && - (unit < (GIMP_UNIT_END + number_of_user_units)) || + (unit < (GIMP_UNIT_END + gimp->n_user_units)) || (unit == GIMP_UNIT_PERCENT), gimp_unit_defs[GIMP_UNIT_INCH].identifier); @@ -195,15 +197,15 @@ gimp_unit_get_identifier (GimpUnit unit) if (unit == GIMP_UNIT_PERCENT) return gimp_unit_percent.identifier; - return gimp_unit_get_user_unit (unit)->identifier; + return _gimp_unit_get_user_unit (gimp, unit)->identifier; } - gchar * -gimp_unit_get_symbol (GimpUnit unit) +_gimp_unit_get_symbol (Gimp *gimp, + GimpUnit unit) { g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) && - (unit < (GIMP_UNIT_END + number_of_user_units)) || + (unit < (GIMP_UNIT_END + gimp->n_user_units)) || (unit == GIMP_UNIT_PERCENT), gimp_unit_defs[GIMP_UNIT_INCH].symbol); @@ -213,15 +215,15 @@ gimp_unit_get_symbol (GimpUnit unit) if (unit == GIMP_UNIT_PERCENT) return gimp_unit_percent.symbol; - return gimp_unit_get_user_unit (unit)->symbol; + return _gimp_unit_get_user_unit (gimp, unit)->symbol; } - gchar * -gimp_unit_get_abbreviation (GimpUnit unit) +_gimp_unit_get_abbreviation (Gimp *gimp, + GimpUnit unit) { g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) && - (unit < (GIMP_UNIT_END + number_of_user_units)) || + (unit < (GIMP_UNIT_END + gimp->n_user_units)) || (unit == GIMP_UNIT_PERCENT), gimp_unit_defs[GIMP_UNIT_INCH].abbreviation); @@ -231,15 +233,15 @@ gimp_unit_get_abbreviation (GimpUnit unit) if (unit == GIMP_UNIT_PERCENT) return gimp_unit_percent.abbreviation; - return gimp_unit_get_user_unit (unit)->abbreviation; + return _gimp_unit_get_user_unit (gimp, unit)->abbreviation; } - gchar * -gimp_unit_get_singular (GimpUnit unit) +_gimp_unit_get_singular (Gimp *gimp, + GimpUnit unit) { g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) && - (unit < (GIMP_UNIT_END + number_of_user_units)) || + (unit < (GIMP_UNIT_END + gimp->n_user_units)) || (unit == GIMP_UNIT_PERCENT), gettext (gimp_unit_defs[GIMP_UNIT_INCH].singular)); @@ -249,15 +251,15 @@ gimp_unit_get_singular (GimpUnit unit) if (unit == GIMP_UNIT_PERCENT) return gettext (gimp_unit_percent.singular); - return gettext (gimp_unit_get_user_unit (unit)->singular); + return gettext (_gimp_unit_get_user_unit (gimp, unit)->singular); } - gchar * -gimp_unit_get_plural (GimpUnit unit) +_gimp_unit_get_plural (Gimp *gimp, + GimpUnit unit) { g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) && - (unit < (GIMP_UNIT_END + number_of_user_units)) || + (unit < (GIMP_UNIT_END + gimp->n_user_units)) || (unit == GIMP_UNIT_PERCENT), gettext (gimp_unit_defs[GIMP_UNIT_INCH].plural)); @@ -267,25 +269,24 @@ gimp_unit_get_plural (GimpUnit unit) if (unit == GIMP_UNIT_PERCENT) return gettext (gimp_unit_percent.plural); - return gettext (gimp_unit_get_user_unit (unit)->plural); + return gettext (_gimp_unit_get_user_unit (gimp, unit)->plural); } /* unitrc functions **********/ void -parse_unitrc (void) +gimp_unitrc_load (Gimp *gimp) { gchar *filename; filename = gimp_personal_rc_file ("unitrc"); - parse_gimprc_file (filename); + gimprc_parse_file (filename); g_free (filename); } - void -save_unitrc (void) +gimp_unitrc_save (Gimp *gimp) { gint i; gchar *filename; diff --git a/app/core/gimpunit.h b/app/core/gimpunit.h index 3c194797a6..dea895acb4 100644 --- a/app/core/gimpunit.h +++ b/app/core/gimpunit.h @@ -16,12 +16,48 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __UNITRC_H__ -#define __UNITRC_H__ +#ifndef __APP_GIMP_UNIT_H__ +#define __APP_GIMP_UNIT_H__ -void parse_unitrc (void); -void save_unitrc (void); +void gimp_unitrc_load (Gimp *gimp); +void gimp_unitrc_save (Gimp *gimp); + +gint _gimp_unit_get_number_of_units (Gimp *gimp); +gint _gimp_unit_get_number_of_built_in_units (Gimp *gimp); + +GimpUnit _gimp_unit_new (Gimp *gimp, + gchar *identifier, + gdouble factor, + gint digits, + gchar *symbol, + gchar *abbreviation, + gchar *singular, + gchar *plural); + +gboolean _gimp_unit_get_deletion_flag (Gimp *gimp, + GimpUnit unit); +void _gimp_unit_set_deletion_flag (Gimp *gimp, + GimpUnit unit, + gboolean deletion_flag); + +gdouble _gimp_unit_get_factor (Gimp *gimp, + GimpUnit unit); + +gint _gimp_unit_get_digits (Gimp *gimp, + GimpUnit unit); + +gchar * _gimp_unit_get_identifier (Gimp *gimp, + GimpUnit unit); + +gchar * _gimp_unit_get_symbol (Gimp *gimp, + GimpUnit unit); +gchar * _gimp_unit_get_abbreviation (Gimp *gimp, + GimpUnit unit); +gchar * _gimp_unit_get_singular (Gimp *gimp, + GimpUnit unit); +gchar * _gimp_unit_get_plural (Gimp *gimp, + GimpUnit unit); -#endif /* __UNITRC_H__ */ +#endif /* __APP_GIMP_UNIT_H__ */ diff --git a/app/devices.c b/app/devices.c index d305efc8b1..45618fa0bf 100644 --- a/app/devices.c +++ b/app/devices.c @@ -324,7 +324,7 @@ devices_restore (void) /* Augment with information from rc file */ filename = gimp_personal_rc_file ("devicerc"); - parse_gimprc_file (filename); + gimprc_parse_file (filename); g_free (filename); if ((device_info = device_info_get_by_id (current_device)) == NULL) diff --git a/app/dialogs/file-open-dialog.c b/app/dialogs/file-open-dialog.c index 45416e66d1..426f459489 100644 --- a/app/dialogs/file-open-dialog.c +++ b/app/dialogs/file-open-dialog.c @@ -617,7 +617,7 @@ file_open_genbutton_callback (GtkWidget *widget, return; } - gimp_set_busy (); + gimp_set_busy (the_gimp); gtk_widget_set_sensitive (GTK_WIDGET (fileload), FALSE); /* new mult-file preview make: */ @@ -702,7 +702,7 @@ file_open_genbutton_callback (GtkWidget *widget, } gtk_widget_set_sensitive (GTK_WIDGET (fileload), TRUE); - gimp_unset_busy (); + gimp_unset_busy (the_gimp); } static void diff --git a/app/dialogs/info-dialog.c b/app/dialogs/info-dialog.c index d52409a4cb..a9b2105718 100644 --- a/app/dialogs/info-dialog.c +++ b/app/dialogs/info-dialog.c @@ -24,7 +24,7 @@ #include "libgimpwidgets/gimpwidgets.h" -#include "apptypes.h" +#include "core/core-types.h" #include "dialog_handler.h" #include "info-dialog.h" diff --git a/app/dialogs/info-window.c b/app/dialogs/info-window.c index c9240973b3..201b5b2bd6 100644 --- a/app/dialogs/info-window.c +++ b/app/dialogs/info-window.c @@ -45,6 +45,7 @@ #include "app_procs.h" #include "colormaps.h" #include "gdisplay.h" +#include "unitrc.h" #include "libgimp/gimpintl.h" @@ -501,12 +502,16 @@ info_window_update_extended (GDisplay *gdisp, else { /* width and height */ - unit_factor = gimp_unit_get_factor (gdisp->gimage->unit); - unit_digits = gimp_unit_get_digits (gdisp->gimage->unit); + unit_factor = _gimp_unit_get_factor (gdisp->gimage->gimp, + gdisp->gimage->unit); + unit_digits = _gimp_unit_get_digits (gdisp->gimage->gimp, + gdisp->gimage->unit); - if (iwd->unit_str != gimp_unit_get_abbreviation (gdisp->gimage->unit)) + if (iwd->unit_str != _gimp_unit_get_abbreviation (gdisp->gimage->gimp, + gdisp->gimage->unit)) { - iwd->unit_str = gimp_unit_get_abbreviation (gdisp->gimage->unit); + iwd->unit_str = _gimp_unit_get_abbreviation (gdisp->gimage->gimp, + gdisp->gimage->unit); gtk_label_set_text (GTK_LABEL (iwd->unit_labels[0]), iwd->unit_str); gtk_label_set_text (GTK_LABEL (iwd->unit_labels[1]), iwd->unit_str); @@ -608,8 +613,10 @@ info_window_update (GDisplay *gdisp) return; /* width and height */ - unit_factor = gimp_unit_get_factor (gdisp->gimage->unit); - unit_digits = gimp_unit_get_digits (gdisp->gimage->unit); + unit_factor = _gimp_unit_get_factor (gdisp->gimage->gimp, + gdisp->gimage->unit); + unit_digits = _gimp_unit_get_digits (gdisp->gimage->gimp, + gdisp->gimage->unit); g_snprintf (iwd->dimensions_str, MAX_BUF, _("%d x %d pixels"), @@ -618,7 +625,8 @@ info_window_update (GDisplay *gdisp) g_snprintf (format_buf, sizeof (format_buf), "%%.%df x %%.%df %s", unit_digits + 1, unit_digits + 1, - gimp_unit_get_plural (gdisp->gimage->unit)); + _gimp_unit_get_plural (gdisp->gimage->gimp, + gdisp->gimage->unit)); g_snprintf (iwd->real_dimensions_str, MAX_BUF, format_buf, gdisp->gimage->width * unit_factor / gdisp->gimage->xresolution, gdisp->gimage->height * unit_factor / gdisp->gimage->yresolution); diff --git a/app/dialogs/module-dialog.c b/app/dialogs/module-dialog.c index 4bff4cc337..1239a3fd0d 100644 --- a/app/dialogs/module-dialog.c +++ b/app/dialogs/module-dialog.c @@ -210,7 +210,7 @@ module_db_init (void) /* load the modulerc file */ filename = gimp_personal_rc_file ("modulerc"); - parse_gimprc_file (filename); + gimprc_parse_file (filename); g_free (filename); /* Load and initialize gimp modules */ diff --git a/app/dialogs/preferences-dialog.c b/app/dialogs/preferences-dialog.c index f00186fd7a..c6adadee47 100644 --- a/app/dialogs/preferences-dialog.c +++ b/app/dialogs/preferences-dialog.c @@ -813,7 +813,7 @@ prefs_save_callback (GtkWidget *widget, } - save_gimprc (&update, &remove); + gimprc_save (&update, &remove); if (gimprc.using_xserver_resolution) diff --git a/app/dialogs/tips-dialog.c b/app/dialogs/tips-dialog.c index b916e3ba66..2a000d222c 100644 --- a/app/dialogs/tips-dialog.c +++ b/app/dialogs/tips-dialog.c @@ -28,7 +28,7 @@ #include "libgimpbase/gimpbase.h" #include "libgimpwidgets/gimpwidgets.h" -#include "apptypes.h" +#include "core/core-types.h" #include "tips-dialog.h" @@ -208,7 +208,7 @@ tips_dialog_destroy (GtkWidget *widget, update = g_list_append (update, "show-tips"); remove = g_list_append (remove, "dont-show-tips"); old_show_tips = gimprc.show_tips; - save_gimprc (&update, &remove); + gimprc_save (&update, &remove); } g_list_free (update); g_list_free (remove); diff --git a/app/dialogs/user-install-dialog.c b/app/dialogs/user-install-dialog.c index a38860ad37..c5605f9624 100644 --- a/app/dialogs/user-install-dialog.c +++ b/app/dialogs/user-install-dialog.c @@ -74,9 +74,11 @@ #define PAGE_STYLE(widget) gtk_widget_set_style (widget, page_style) #define TITLE_STYLE(widget) gtk_widget_set_style (widget, title_style) -static void user_install_dialog_create (UserInstallCallback); -static void user_install_continue_callback (GtkWidget *widget, gpointer data); -static void user_install_cancel_callback (GtkWidget *widget, gpointer data); + +static void user_install_continue_callback (GtkWidget *widget, + gpointer data); +static void user_install_cancel_callback (GtkWidget *widget, + gpointer data); static gboolean user_install_run (void); static void user_install_tuning (void); @@ -85,39 +87,6 @@ static void user_install_resolution (void); static void user_install_resolution_done (void); -void -user_install_verify (UserInstallCallback user_install_callback) -{ - gboolean properly_installed = TRUE; - const gchar *filename; - struct stat stat_buf; - - /* gimp_directory now always returns something */ - filename = gimp_directory (); - - if (stat (filename, &stat_buf) != 0) - properly_installed = FALSE; - - /* If there is already a proper installation, invoke the callback */ - if (properly_installed) - { - (* user_install_callback) (); - } - /* Otherwise, prepare for installation */ - else if (no_interface) - { - g_print (_("The GIMP is not properly installed for the current user\n")); - g_print (_("User installation was skipped because the '--nointerface' flag was encountered\n")); - g_print (_("To perform user installation, run the GIMP without the '--nointerface' flag\n")); - - (* user_install_callback) (); - } - else - { - user_install_dialog_create (user_install_callback); - } -} - /* private stuff */ static GtkWidget *user_install_dialog = NULL; @@ -350,9 +319,10 @@ user_install_continue_callback (GtkWidget *widget, gpointer data) { static gint notebook_index = 0; - UserInstallCallback callback; - callback = (UserInstallCallback) data; + Gimp *gimp; + + gimp = (Gimp *) data; switch (notebook_index) { @@ -382,9 +352,9 @@ user_install_continue_callback (GtkWidget *widget, #ifdef G_OS_WIN32 FreeConsole (); #endif - gimprc_init (); - parse_unitrc (); - parse_gimprc (); + gimprc_init (gimp); + gimp_unitrc_load (gimp); + gimprc_parse (gimp); user_install_tuning (); break; @@ -401,7 +371,7 @@ user_install_continue_callback (GtkWidget *widget, gtk_style_unref (title_style); gtk_style_unref (page_style); - (* callback) (); + gtk_main_quit (); return; break; @@ -426,7 +396,7 @@ user_install_cancel_callback (GtkWidget *widget, gtk_widget_destroy (continue_button); user_install_notebook_set_page (GTK_NOTEBOOK (notebook), EEK_PAGE); - timeout = gtk_timeout_add (1024, (GtkFunction)gtk_exit, (gpointer)0); + timeout = gtk_timeout_add (1024, (GtkFunction) gtk_exit, (gpointer) 0); } static gint @@ -534,7 +504,7 @@ user_install_ctree_select_row (GtkWidget *widget, } void -user_install_dialog_create (UserInstallCallback callback) +user_install_dialog_create (Gimp *gimp) { GtkWidget *dialog; GtkWidget *vbox; @@ -553,9 +523,9 @@ user_install_dialog_create (UserInstallCallback callback) FALSE, FALSE, FALSE, _("Continue"), user_install_continue_callback, - callback, NULL, &continue_button, TRUE, FALSE, + gimp, NULL, &continue_button, TRUE, FALSE, _("Cancel"), user_install_cancel_callback, - callback, 1, &cancel_button, FALSE, TRUE, + gimp, 1, &cancel_button, FALSE, TRUE, NULL); @@ -939,11 +909,11 @@ quote_spaces (char *string) static gboolean user_install_run (void) { - FILE *pfp; - gchar buffer[2048]; - struct stat stat_buf; - gint err; - gboolean executable = TRUE; + FILE *pfp; + gchar buffer[2048]; + struct stat stat_buf; + gint err; + gboolean executable = TRUE; /* Generate output */ g_snprintf (buffer, sizeof (buffer), "%s" G_DIR_SEPARATOR_S USER_INSTALL, @@ -1328,7 +1298,7 @@ user_install_resolution_done (void) gimprc.monitor_yres = 0.0; } - save_gimprc (&update, &remove); + gimprc_save (&update, &remove); if (gimprc.using_xserver_resolution) gdisplay_xserver_resolution (&gimprc.monitor_xres, &gimprc.monitor_yres); diff --git a/app/dialogs/user-install-dialog.h b/app/dialogs/user-install-dialog.h index a1c6f1e259..b8ffaff1e1 100644 --- a/app/dialogs/user-install-dialog.h +++ b/app/dialogs/user-install-dialog.h @@ -16,15 +16,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __USER_INSTALL_H__ -#define __USER_INSTALL_H__ +#ifndef __USER_INSTALL_DIALOG_H__ +#define __USER_INSTALL_DIALOG_H__ -/* Install callback function */ -typedef void (* UserInstallCallback) (void); - -/* Function declarations */ -void user_install_verify (UserInstallCallback user_install_callback); +void user_install_dialog_create (Gimp *gimp); -#endif /* __USER_INSTALL_H__ */ +#endif /* __USER_INSTALL_DIALOG_H__ */ diff --git a/app/disp_callbacks.c b/app/disp_callbacks.c index 4a5d1fbe8f..0a2fa040f6 100644 --- a/app/disp_callbacks.c +++ b/app/disp_callbacks.c @@ -53,8 +53,6 @@ #include "gui/info-window.h" #include "gui/layer-select.h" -#include "appenv.h" -#include "app_procs.h" #include "devices.h" #include "dialog_handler.h" #include "disp_callbacks.h" @@ -224,7 +222,7 @@ gdisplay_canvas_events (GtkWidget *canvas, } /* Find out what device the event occurred upon */ - if (! gimp_busy && devices_check_change (event)) + if (! gdisp->gimage->gimp->busy && devices_check_change (event)) gdisplay_check_device_cursor (gdisp); switch (event->type) @@ -270,7 +268,7 @@ gdisplay_canvas_events (GtkWidget *canvas, state = bevent->state; /* ignore new mouse events */ - if (gimp_busy) + if (gdisp->gimage->gimp->busy) return TRUE; switch (bevent->button) @@ -409,8 +407,9 @@ gdisplay_canvas_events (GtkWidget *canvas, * * ugly: fuzzy_select sets busy cursors while ACTIVE. */ - if (gimp_busy && ! (GIMP_IS_FUZZY_SELECT_TOOL (active_tool) && - active_tool->state == ACTIVE)) + if (gdisp->gimage->gimp->busy && + ! (GIMP_IS_FUZZY_SELECT_TOOL (active_tool) && + active_tool->state == ACTIVE)) return TRUE; switch (bevent->button) @@ -482,8 +481,9 @@ gdisplay_canvas_events (GtkWidget *canvas, * * ugly: fuzzy_select sets busy cursors while ACTIVE. */ - if (gimp_busy && ! (GIMP_IS_FUZZY_SELECT_TOOL (active_tool) && - active_tool->state == ACTIVE)) + if (gdisp->gimage->gimp->busy && + ! (GIMP_IS_FUZZY_SELECT_TOOL (active_tool) && + active_tool->state == ACTIVE)) return TRUE; /* Ask for the pointer position, but ignore it except for cursor @@ -561,7 +561,7 @@ gdisplay_canvas_events (GtkWidget *canvas, state = kevent->state; /* ignore any key presses */ - if (gimp_busy) + if (gdisp->gimage->gimp->busy) return TRUE; switch (kevent->keyval) @@ -612,7 +612,7 @@ gdisplay_canvas_events (GtkWidget *canvas, state = kevent->state; /* ignore any key releases */ - if (gimp_busy) + if (gdisp->gimage->gimp->busy) return TRUE; switch (kevent->keyval) @@ -640,7 +640,7 @@ gdisplay_canvas_events (GtkWidget *canvas, } /* if we reached this point in gimp_busy mode, return now */ - if (gimp_busy) + if (gdisp->gimage->gimp->busy) return TRUE; /* Cursor update support */ @@ -684,7 +684,7 @@ gdisplay_hruler_button_press (GtkWidget *widget, gdisp = (GDisplay *) data; - if (gimp_busy) + if (gdisp->gimage->gimp->busy) return TRUE; if (event->button == 1) @@ -722,7 +722,7 @@ gdisplay_vruler_button_press (GtkWidget *widget, gdisp = (GDisplay *) data; - if (gimp_busy) + if (gdisp->gimage->gimp->busy) return TRUE; if (event->button == 1) @@ -784,7 +784,7 @@ gdisplay_origin_button_press (GtkWidget *widget, gdisp = (GDisplay *) data; - if (! gimp_busy && event->button == 1) + if (! gdisp->gimage->gimp->busy && event->button == 1) { gint x, y; @@ -824,11 +824,12 @@ gdisplay_drop_drawable (GtkWidget *widget, gint bytes; GimpImageBaseType type; - if (gimp_busy) + gdisp = (GDisplay *) data; + + if (gdisp->gimage->gimp->busy) return; drawable = GIMP_DRAWABLE (viewable); - gdisp = (GDisplay *) data; src_gimage = gimp_drawable_gimage (drawable); src_width = gimp_drawable_width (drawable); @@ -933,15 +934,17 @@ gdisplay_bucket_fill (GtkWidget *widget, TempBuf *pat_buf = NULL; gboolean new_buf = FALSE; - if (gimp_busy) - return; - gimage = ((GDisplay *) data)->gimage; - drawable = gimp_image_active_drawable (gimage); - if (!drawable) + + if (gimage->gimp->busy) return; - gimp_set_busy (); + drawable = gimp_image_active_drawable (gimage); + + if (! drawable) + return; + + gimp_set_busy (gimage->gimp); /* Get the bucket fill context */ tool_info = tool_manager_get_info_by_type (gimage->gimp, @@ -1023,7 +1026,7 @@ gdisplay_bucket_fill (GtkWidget *widget, if (new_buf) temp_buf_free (pat_buf); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); } void @@ -1062,11 +1065,12 @@ gdisplay_drop_buffer (GtkWidget *widget, GimpBuffer *buffer; GDisplay *gdisp; - if (gimp_busy) + gdisp = (GDisplay *) data; + + if (gdisp->gimage->gimp->busy) return; buffer = GIMP_BUFFER (viewable); - gdisp = (GDisplay *) data; /* FIXME: popup a menu for selecting "Paste Into" */ diff --git a/app/display/gimpdisplay-callbacks.c b/app/display/gimpdisplay-callbacks.c index 4a5d1fbe8f..0a2fa040f6 100644 --- a/app/display/gimpdisplay-callbacks.c +++ b/app/display/gimpdisplay-callbacks.c @@ -53,8 +53,6 @@ #include "gui/info-window.h" #include "gui/layer-select.h" -#include "appenv.h" -#include "app_procs.h" #include "devices.h" #include "dialog_handler.h" #include "disp_callbacks.h" @@ -224,7 +222,7 @@ gdisplay_canvas_events (GtkWidget *canvas, } /* Find out what device the event occurred upon */ - if (! gimp_busy && devices_check_change (event)) + if (! gdisp->gimage->gimp->busy && devices_check_change (event)) gdisplay_check_device_cursor (gdisp); switch (event->type) @@ -270,7 +268,7 @@ gdisplay_canvas_events (GtkWidget *canvas, state = bevent->state; /* ignore new mouse events */ - if (gimp_busy) + if (gdisp->gimage->gimp->busy) return TRUE; switch (bevent->button) @@ -409,8 +407,9 @@ gdisplay_canvas_events (GtkWidget *canvas, * * ugly: fuzzy_select sets busy cursors while ACTIVE. */ - if (gimp_busy && ! (GIMP_IS_FUZZY_SELECT_TOOL (active_tool) && - active_tool->state == ACTIVE)) + if (gdisp->gimage->gimp->busy && + ! (GIMP_IS_FUZZY_SELECT_TOOL (active_tool) && + active_tool->state == ACTIVE)) return TRUE; switch (bevent->button) @@ -482,8 +481,9 @@ gdisplay_canvas_events (GtkWidget *canvas, * * ugly: fuzzy_select sets busy cursors while ACTIVE. */ - if (gimp_busy && ! (GIMP_IS_FUZZY_SELECT_TOOL (active_tool) && - active_tool->state == ACTIVE)) + if (gdisp->gimage->gimp->busy && + ! (GIMP_IS_FUZZY_SELECT_TOOL (active_tool) && + active_tool->state == ACTIVE)) return TRUE; /* Ask for the pointer position, but ignore it except for cursor @@ -561,7 +561,7 @@ gdisplay_canvas_events (GtkWidget *canvas, state = kevent->state; /* ignore any key presses */ - if (gimp_busy) + if (gdisp->gimage->gimp->busy) return TRUE; switch (kevent->keyval) @@ -612,7 +612,7 @@ gdisplay_canvas_events (GtkWidget *canvas, state = kevent->state; /* ignore any key releases */ - if (gimp_busy) + if (gdisp->gimage->gimp->busy) return TRUE; switch (kevent->keyval) @@ -640,7 +640,7 @@ gdisplay_canvas_events (GtkWidget *canvas, } /* if we reached this point in gimp_busy mode, return now */ - if (gimp_busy) + if (gdisp->gimage->gimp->busy) return TRUE; /* Cursor update support */ @@ -684,7 +684,7 @@ gdisplay_hruler_button_press (GtkWidget *widget, gdisp = (GDisplay *) data; - if (gimp_busy) + if (gdisp->gimage->gimp->busy) return TRUE; if (event->button == 1) @@ -722,7 +722,7 @@ gdisplay_vruler_button_press (GtkWidget *widget, gdisp = (GDisplay *) data; - if (gimp_busy) + if (gdisp->gimage->gimp->busy) return TRUE; if (event->button == 1) @@ -784,7 +784,7 @@ gdisplay_origin_button_press (GtkWidget *widget, gdisp = (GDisplay *) data; - if (! gimp_busy && event->button == 1) + if (! gdisp->gimage->gimp->busy && event->button == 1) { gint x, y; @@ -824,11 +824,12 @@ gdisplay_drop_drawable (GtkWidget *widget, gint bytes; GimpImageBaseType type; - if (gimp_busy) + gdisp = (GDisplay *) data; + + if (gdisp->gimage->gimp->busy) return; drawable = GIMP_DRAWABLE (viewable); - gdisp = (GDisplay *) data; src_gimage = gimp_drawable_gimage (drawable); src_width = gimp_drawable_width (drawable); @@ -933,15 +934,17 @@ gdisplay_bucket_fill (GtkWidget *widget, TempBuf *pat_buf = NULL; gboolean new_buf = FALSE; - if (gimp_busy) - return; - gimage = ((GDisplay *) data)->gimage; - drawable = gimp_image_active_drawable (gimage); - if (!drawable) + + if (gimage->gimp->busy) return; - gimp_set_busy (); + drawable = gimp_image_active_drawable (gimage); + + if (! drawable) + return; + + gimp_set_busy (gimage->gimp); /* Get the bucket fill context */ tool_info = tool_manager_get_info_by_type (gimage->gimp, @@ -1023,7 +1026,7 @@ gdisplay_bucket_fill (GtkWidget *widget, if (new_buf) temp_buf_free (pat_buf); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); } void @@ -1062,11 +1065,12 @@ gdisplay_drop_buffer (GtkWidget *widget, GimpBuffer *buffer; GDisplay *gdisp; - if (gimp_busy) + gdisp = (GDisplay *) data; + + if (gdisp->gimage->gimp->busy) return; buffer = GIMP_BUFFER (viewable); - gdisp = (GDisplay *) data; /* FIXME: popup a menu for selecting "Paste Into" */ diff --git a/app/display/gimpdisplay-ops.c b/app/display/gimpdisplay-ops.c index ce7f4a109d..3321566647 100644 --- a/app/display/gimpdisplay-ops.c +++ b/app/display/gimpdisplay-ops.c @@ -24,9 +24,9 @@ #include "core/core-types.h" +#include "core/gimp.h" #include "core/gimpimage.h" -#include "appenv.h" #include "colormaps.h" #include "gdisplay_ops.h" #include "gimprc.h" @@ -117,7 +117,7 @@ gdisplay_close_window (GDisplay *gdisp, /* FIXME: gimp_busy HACK not really appropriate here because we only * want to prevent the busy image and display to be closed. --Mitch */ - if (gimp_busy) + if (gdisp->gimage->gimp->busy) return; /* If the image has been modified, give the user a chance to save diff --git a/app/display/gimpdisplayshell-callbacks.c b/app/display/gimpdisplayshell-callbacks.c index 4a5d1fbe8f..0a2fa040f6 100644 --- a/app/display/gimpdisplayshell-callbacks.c +++ b/app/display/gimpdisplayshell-callbacks.c @@ -53,8 +53,6 @@ #include "gui/info-window.h" #include "gui/layer-select.h" -#include "appenv.h" -#include "app_procs.h" #include "devices.h" #include "dialog_handler.h" #include "disp_callbacks.h" @@ -224,7 +222,7 @@ gdisplay_canvas_events (GtkWidget *canvas, } /* Find out what device the event occurred upon */ - if (! gimp_busy && devices_check_change (event)) + if (! gdisp->gimage->gimp->busy && devices_check_change (event)) gdisplay_check_device_cursor (gdisp); switch (event->type) @@ -270,7 +268,7 @@ gdisplay_canvas_events (GtkWidget *canvas, state = bevent->state; /* ignore new mouse events */ - if (gimp_busy) + if (gdisp->gimage->gimp->busy) return TRUE; switch (bevent->button) @@ -409,8 +407,9 @@ gdisplay_canvas_events (GtkWidget *canvas, * * ugly: fuzzy_select sets busy cursors while ACTIVE. */ - if (gimp_busy && ! (GIMP_IS_FUZZY_SELECT_TOOL (active_tool) && - active_tool->state == ACTIVE)) + if (gdisp->gimage->gimp->busy && + ! (GIMP_IS_FUZZY_SELECT_TOOL (active_tool) && + active_tool->state == ACTIVE)) return TRUE; switch (bevent->button) @@ -482,8 +481,9 @@ gdisplay_canvas_events (GtkWidget *canvas, * * ugly: fuzzy_select sets busy cursors while ACTIVE. */ - if (gimp_busy && ! (GIMP_IS_FUZZY_SELECT_TOOL (active_tool) && - active_tool->state == ACTIVE)) + if (gdisp->gimage->gimp->busy && + ! (GIMP_IS_FUZZY_SELECT_TOOL (active_tool) && + active_tool->state == ACTIVE)) return TRUE; /* Ask for the pointer position, but ignore it except for cursor @@ -561,7 +561,7 @@ gdisplay_canvas_events (GtkWidget *canvas, state = kevent->state; /* ignore any key presses */ - if (gimp_busy) + if (gdisp->gimage->gimp->busy) return TRUE; switch (kevent->keyval) @@ -612,7 +612,7 @@ gdisplay_canvas_events (GtkWidget *canvas, state = kevent->state; /* ignore any key releases */ - if (gimp_busy) + if (gdisp->gimage->gimp->busy) return TRUE; switch (kevent->keyval) @@ -640,7 +640,7 @@ gdisplay_canvas_events (GtkWidget *canvas, } /* if we reached this point in gimp_busy mode, return now */ - if (gimp_busy) + if (gdisp->gimage->gimp->busy) return TRUE; /* Cursor update support */ @@ -684,7 +684,7 @@ gdisplay_hruler_button_press (GtkWidget *widget, gdisp = (GDisplay *) data; - if (gimp_busy) + if (gdisp->gimage->gimp->busy) return TRUE; if (event->button == 1) @@ -722,7 +722,7 @@ gdisplay_vruler_button_press (GtkWidget *widget, gdisp = (GDisplay *) data; - if (gimp_busy) + if (gdisp->gimage->gimp->busy) return TRUE; if (event->button == 1) @@ -784,7 +784,7 @@ gdisplay_origin_button_press (GtkWidget *widget, gdisp = (GDisplay *) data; - if (! gimp_busy && event->button == 1) + if (! gdisp->gimage->gimp->busy && event->button == 1) { gint x, y; @@ -824,11 +824,12 @@ gdisplay_drop_drawable (GtkWidget *widget, gint bytes; GimpImageBaseType type; - if (gimp_busy) + gdisp = (GDisplay *) data; + + if (gdisp->gimage->gimp->busy) return; drawable = GIMP_DRAWABLE (viewable); - gdisp = (GDisplay *) data; src_gimage = gimp_drawable_gimage (drawable); src_width = gimp_drawable_width (drawable); @@ -933,15 +934,17 @@ gdisplay_bucket_fill (GtkWidget *widget, TempBuf *pat_buf = NULL; gboolean new_buf = FALSE; - if (gimp_busy) - return; - gimage = ((GDisplay *) data)->gimage; - drawable = gimp_image_active_drawable (gimage); - if (!drawable) + + if (gimage->gimp->busy) return; - gimp_set_busy (); + drawable = gimp_image_active_drawable (gimage); + + if (! drawable) + return; + + gimp_set_busy (gimage->gimp); /* Get the bucket fill context */ tool_info = tool_manager_get_info_by_type (gimage->gimp, @@ -1023,7 +1026,7 @@ gdisplay_bucket_fill (GtkWidget *widget, if (new_buf) temp_buf_free (pat_buf); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); } void @@ -1062,11 +1065,12 @@ gdisplay_drop_buffer (GtkWidget *widget, GimpBuffer *buffer; GDisplay *gdisp; - if (gimp_busy) + gdisp = (GDisplay *) data; + + if (gdisp->gimage->gimp->busy) return; buffer = GIMP_BUFFER (viewable); - gdisp = (GDisplay *) data; /* FIXME: popup a menu for selecting "Paste Into" */ diff --git a/app/display/gimpnavigationeditor.c b/app/display/gimpnavigationeditor.c index ba16e77ddd..9615127dbc 100644 --- a/app/display/gimpnavigationeditor.c +++ b/app/display/gimpnavigationeditor.c @@ -885,11 +885,11 @@ nav_dialog_update_preview (NavigationDialog *nav_dialog) gint xoff = 0; gint yoff = 0; - gimp_set_busy (); - gdisp = nav_dialog->gdisp; gimage = gdisp->gimage; + gimp_set_busy (gimage->gimp); + /* Min size is 2 */ pwidth = nav_dialog->pwidth; pheight = nav_dialog->pheight; @@ -1034,7 +1034,7 @@ nav_dialog_update_preview (NavigationDialog *nav_dialog) if (preview_buf_notdot) temp_buf_free (preview_buf_notdot); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); } static void diff --git a/app/display/gimpnavigationview.c b/app/display/gimpnavigationview.c index ba16e77ddd..9615127dbc 100644 --- a/app/display/gimpnavigationview.c +++ b/app/display/gimpnavigationview.c @@ -885,11 +885,11 @@ nav_dialog_update_preview (NavigationDialog *nav_dialog) gint xoff = 0; gint yoff = 0; - gimp_set_busy (); - gdisp = nav_dialog->gdisp; gimage = gdisp->gimage; + gimp_set_busy (gimage->gimp); + /* Min size is 2 */ pwidth = nav_dialog->pwidth; pheight = nav_dialog->pheight; @@ -1034,7 +1034,7 @@ nav_dialog_update_preview (NavigationDialog *nav_dialog) if (preview_buf_notdot) temp_buf_free (preview_buf_notdot); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); } static void diff --git a/app/errors.c b/app/errors.c index 1fbb76ff30..7c43312b27 100644 --- a/app/errors.c +++ b/app/errors.c @@ -33,7 +33,6 @@ #include "widgets/gimpwidgets-utils.h" #include "appenv.h" -#include "app_procs.h" #include "errorconsole.h" #include "errors.h" @@ -41,15 +40,12 @@ #include #endif -extern gchar *prog_name; - -StackTraceMode stack_trace_mode = STACK_TRACE_QUERY; void -gimp_message_func (const gchar *log_domain, - GLogLevelFlags log_level, - const gchar *message, - gpointer data) +gimp_message_log_func (const gchar *log_domain, + GLogLevelFlags flags, + const gchar *message, + gpointer data) { if (console_messages == FALSE) { @@ -74,16 +70,28 @@ gimp_message_func (const gchar *log_domain, } } +void +gimp_error_log_func (const gchar *domain, + GLogLevelFlags flags, + const gchar *message, + gpointer data) +{ + gimp_fatal_error ("%s", message); +} + void gimp_fatal_error (gchar *fmt, ...) { - va_list args; + va_list args; + gchar *message; + + va_start (args, fmt); + message = g_strdup_vprintf (fmt, args); + va_end (args); #ifndef G_OS_WIN32 - va_start (args, fmt); - g_printerr ("%s: fatal error: %s\n", prog_name, g_strdup_vprintf (fmt, args)); - va_end (args); + g_printerr ("%s: fatal error: %s\n", prog_name, message); switch (stack_trace_mode) { @@ -117,31 +125,27 @@ gimp_fatal_error (gchar *fmt, ...) #else /* g_on_error_* don't do anything reasonable on Win32. */ - gchar *msg; - va_start (args, fmt); - msg = g_strdup_vprintf (fmt, args); - va_end (args); - - MessageBox (NULL, msg, prog_name, MB_OK|MB_ICONERROR); - /* I don't dare do anything more. */ - ExitProcess (1); + MessageBox (NULL, message, prog_name, MB_OK|MB_ICONERROR); #endif /* ! G_OS_WIN32 */ - app_exit (TRUE); + gdk_exit (1); } void gimp_terminate (gchar *fmt, ...) { - va_list args; + va_list args; + gchar *message; + + va_start (args, fmt); + message = g_strdup_vprintf (fmt, args); + va_end (args); #ifndef G_OS_WIN32 - va_start (args, fmt); - g_printerr ("%s terminated: %s\n", prog_name, g_strdup_vprintf (fmt, args)); - va_end (args); + g_printerr ("%s terminated: %s\n", prog_name, message); if (use_debug_handler) { @@ -178,13 +182,8 @@ gimp_terminate (gchar *fmt, ...) #else /* g_on_error_* don't do anything reasonable on Win32. */ - gchar *msg; - va_start (args, fmt); - msg = g_strdup_vprintf (fmt, args); - va_end (args); - - MessageBox (NULL, msg, prog_name, MB_OK|MB_ICONERROR); + MessageBox (NULL, message, prog_name, MB_OK|MB_ICONERROR); #endif /* ! G_OS_WIN32 */ diff --git a/app/errors.h b/app/errors.h index c357801710..15b5fa6fda 100644 --- a/app/errors.h +++ b/app/errors.h @@ -20,24 +20,17 @@ #define __ERRORS_H__ -typedef enum -{ - STACK_TRACE_NEVER, - STACK_TRACE_QUERY, - STACK_TRACE_ALWAYS -} StackTraceMode; +void gimp_message_log_func (const gchar *log_domain, + GLogLevelFlags flags, + const gchar *message, + gpointer data); +void gimp_error_log_func (const gchar *domain, + GLogLevelFlags flags, + const gchar *message, + gpointer data); - -void gimp_message_func (const gchar *log_domain, - GLogLevelFlags log_level, - const gchar *message, - gpointer data); - -void gimp_fatal_error (gchar *, ...); -void gimp_terminate (gchar *, ...); - - -extern StackTraceMode stack_trace_mode; +void gimp_fatal_error (gchar *, ...); +void gimp_terminate (gchar *, ...); #endif /* __ERRORS_H__ */ diff --git a/app/gdisplay_ops.c b/app/gdisplay_ops.c index ce7f4a109d..3321566647 100644 --- a/app/gdisplay_ops.c +++ b/app/gdisplay_ops.c @@ -24,9 +24,9 @@ #include "core/core-types.h" +#include "core/gimp.h" #include "core/gimpimage.h" -#include "appenv.h" #include "colormaps.h" #include "gdisplay_ops.h" #include "gimprc.h" @@ -117,7 +117,7 @@ gdisplay_close_window (GDisplay *gdisp, /* FIXME: gimp_busy HACK not really appropriate here because we only * want to prevent the busy image and display to be closed. --Mitch */ - if (gimp_busy) + if (gdisp->gimage->gimp->busy) return; /* If the image has been modified, give the user a chance to save diff --git a/app/gimphelp.c b/app/gimphelp.c index 3b5524d961..8d71e3b475 100644 --- a/app/gimphelp.c +++ b/app/gimphelp.c @@ -164,7 +164,7 @@ gimp_help_internal_not_found_callback (GtkWidget *widget, gimprc.help_browser = HELP_BROWSER_NETSCAPE; update = g_list_append (update, "help-browser"); - save_gimprc (&update, &remove); + gimprc_save (&update, &remove); } gtk_main_quit (); diff --git a/app/gimprc.c b/app/gimprc.c index 083b034ad9..619fbd6ba6 100644 --- a/app/gimprc.c +++ b/app/gimprc.c @@ -371,11 +371,6 @@ static gint cur_token; static gint next_token; -/* extern variables */ -extern gchar *alternate_gimprc; -extern gchar *alternate_system_gimprc; - - static gchar * gimp_system_rc_file (void) { @@ -391,7 +386,7 @@ gimp_system_rc_file (void) } gboolean -gimprc_init (void) +gimprc_init (Gimp *gimp) { if (! parse_info.buffer) { @@ -512,7 +507,7 @@ parse_add_directory_tokens (void) } void -parse_gimprc (void) +gimprc_parse (Gimp *gimp) { gchar *libfilename; gchar *filename; @@ -524,7 +519,7 @@ parse_gimprc (void) else libfilename = g_strdup (gimp_system_rc_file ()); - if (! parse_gimprc_file (libfilename)) + if (! gimprc_parse_file (libfilename)) g_message ("Can't open '%s' for reading.", libfilename); if (alternate_gimprc != NULL) @@ -533,7 +528,7 @@ parse_gimprc (void) filename = gimp_personal_rc_file ("gimprc"); if (g_strcasecmp (filename, libfilename) != 0) - parse_gimprc_file (filename); + gimprc_parse_file (filename); g_free (filename); g_free (libfilename); @@ -582,7 +577,7 @@ parse_absolute_gimprc_file (char *filename) } gboolean -parse_gimprc_file (gchar *filename) +gimprc_parse_file (gchar *filename) { gchar *rfilename; gboolean parsed; @@ -772,7 +767,7 @@ save_gimprc_strings (gchar *token, } void -save_gimprc (GList **updated_options, +gimprc_save (GList **updated_options, GList **conflicting_options) { gchar timestamp[40]; diff --git a/app/gimprc.h b/app/gimprc.h index 8548e5ef27..356e07f4b8 100644 --- a/app/gimprc.h +++ b/app/gimprc.h @@ -19,6 +19,7 @@ #ifndef __GIMPRC_H__ #define __GIMPRC_H__ + typedef struct _GimpRc GimpRc; /* global gimprc variables - need some comments on this stuff */ @@ -67,14 +68,16 @@ struct _GimpRc extern GimpRc gimprc; -/* function prototypes */ -gboolean gimprc_init (void); /* this has to be called before any file - * is parsed - */ -void parse_gimprc (void); -gboolean parse_gimprc_file (gchar *filename); -void save_gimprc (GList **updated_options, +/* this has to be called before any file is parsed + */ +gboolean gimprc_init (Gimp *gimp); + +void gimprc_parse (Gimp *gimp); +void gimprc_save (GList **updated_options, GList **conflicting_options); + +gboolean gimprc_parse_file (gchar *filename); + gchar * gimprc_find_token (gchar *token); gchar * gimprc_value_to_str (gchar *name); void save_gimprc_strings (gchar *token, diff --git a/app/gimpunit.c b/app/gimpunit.c index 32eb838860..272c02ec00 100644 --- a/app/gimpunit.c +++ b/app/gimpunit.c @@ -30,7 +30,8 @@ #include "core/core-types.h" -#include "app_procs.h" +#include "core/gimp.h" + #include "gimprc.h" #include "unitrc.h" @@ -74,45 +75,45 @@ static GimpUnitDef gimp_unit_percent = FALSE, 0.0, 0, "percent", "%", "%", N_("percent"), N_("percent") }; -static GSList* user_units = NULL; -static gint number_of_user_units = 0; /* private functions */ static GimpUnitDef * -gimp_unit_get_user_unit (GimpUnit unit) +_gimp_unit_get_user_unit (Gimp *gimp, + GimpUnit unit) { - return g_slist_nth_data (user_units, unit - GIMP_UNIT_END); + return g_list_nth_data (gimp->user_units, unit - GIMP_UNIT_END); } /* public functions */ gint -gimp_unit_get_number_of_units (void) +_gimp_unit_get_number_of_units (Gimp *gimp) { - return GIMP_UNIT_END + number_of_user_units; + return GIMP_UNIT_END + gimp->n_user_units; } gint -gimp_unit_get_number_of_built_in_units (void) +_gimp_unit_get_number_of_built_in_units (Gimp *gimp) { return GIMP_UNIT_END; } - GimpUnit -gimp_unit_new (gchar *identifier, - gdouble factor, - gint digits, - gchar *symbol, - gchar *abbreviation, - gchar *singular, - gchar *plural) +_gimp_unit_new (Gimp *gimp, + gchar *identifier, + gdouble factor, + gint digits, + gchar *symbol, + gchar *abbreviation, + gchar *singular, + gchar *plural) { GimpUnitDef *user_unit; - user_unit = g_new (GimpUnitDef, 1); + user_unit = g_new0 (GimpUnitDef, 1); + user_unit->delete_on_exit = TRUE; user_unit->factor = factor; user_unit->digits = digits; @@ -122,70 +123,71 @@ gimp_unit_new (gchar *identifier, user_unit->singular = g_strdup (singular); user_unit->plural = g_strdup (plural); - user_units = g_slist_append (user_units, user_unit); - number_of_user_units++; + gimp->user_units = g_list_append (gimp->user_units, user_unit); + gimp->n_user_units++; - return GIMP_UNIT_END + number_of_user_units - 1; + return GIMP_UNIT_END + gimp->n_user_units - 1; } - gboolean -gimp_unit_get_deletion_flag (GimpUnit unit) +_gimp_unit_get_deletion_flag (Gimp *gimp, + GimpUnit unit) { g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) && - (unit < (GIMP_UNIT_END + number_of_user_units)), FALSE); + (unit < (GIMP_UNIT_END + gimp->n_user_units)), FALSE); if (unit < GIMP_UNIT_END) return FALSE; - return gimp_unit_get_user_unit (unit)->delete_on_exit; + return _gimp_unit_get_user_unit (gimp, unit)->delete_on_exit; } void -gimp_unit_set_deletion_flag (GimpUnit unit, - gboolean deletion_flag) +_gimp_unit_set_deletion_flag (Gimp *gimp, + GimpUnit unit, + gboolean deletion_flag) { g_return_if_fail ((unit >= GIMP_UNIT_END) && - (unit < (GIMP_UNIT_END + number_of_user_units))); + (unit < (GIMP_UNIT_END + gimp->n_user_units))); - gimp_unit_get_user_unit (unit)->delete_on_exit = + _gimp_unit_get_user_unit (gimp, unit)->delete_on_exit = deletion_flag ? TRUE : FALSE; } - gdouble -gimp_unit_get_factor (GimpUnit unit) +_gimp_unit_get_factor (Gimp *gimp, + GimpUnit unit) { g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) && - (unit < (GIMP_UNIT_END + number_of_user_units)), + (unit < (GIMP_UNIT_END + gimp->n_user_units)), gimp_unit_defs[GIMP_UNIT_INCH].factor); if (unit < GIMP_UNIT_END) return gimp_unit_defs[unit].factor; - return gimp_unit_get_user_unit (unit)->factor; + return _gimp_unit_get_user_unit (gimp, unit)->factor; } - gint -gimp_unit_get_digits (GimpUnit unit) +_gimp_unit_get_digits (Gimp *gimp, + GimpUnit unit) { g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) && - (unit < (GIMP_UNIT_END + number_of_user_units)), + (unit < (GIMP_UNIT_END + gimp->n_user_units)), gimp_unit_defs[GIMP_UNIT_INCH].digits); if (unit < GIMP_UNIT_END) return gimp_unit_defs[unit].digits; - return gimp_unit_get_user_unit (unit)->digits; + return _gimp_unit_get_user_unit (gimp, unit)->digits; } - gchar * -gimp_unit_get_identifier (GimpUnit unit) +_gimp_unit_get_identifier (Gimp *gimp, + GimpUnit unit) { g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) && - (unit < (GIMP_UNIT_END + number_of_user_units)) || + (unit < (GIMP_UNIT_END + gimp->n_user_units)) || (unit == GIMP_UNIT_PERCENT), gimp_unit_defs[GIMP_UNIT_INCH].identifier); @@ -195,15 +197,15 @@ gimp_unit_get_identifier (GimpUnit unit) if (unit == GIMP_UNIT_PERCENT) return gimp_unit_percent.identifier; - return gimp_unit_get_user_unit (unit)->identifier; + return _gimp_unit_get_user_unit (gimp, unit)->identifier; } - gchar * -gimp_unit_get_symbol (GimpUnit unit) +_gimp_unit_get_symbol (Gimp *gimp, + GimpUnit unit) { g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) && - (unit < (GIMP_UNIT_END + number_of_user_units)) || + (unit < (GIMP_UNIT_END + gimp->n_user_units)) || (unit == GIMP_UNIT_PERCENT), gimp_unit_defs[GIMP_UNIT_INCH].symbol); @@ -213,15 +215,15 @@ gimp_unit_get_symbol (GimpUnit unit) if (unit == GIMP_UNIT_PERCENT) return gimp_unit_percent.symbol; - return gimp_unit_get_user_unit (unit)->symbol; + return _gimp_unit_get_user_unit (gimp, unit)->symbol; } - gchar * -gimp_unit_get_abbreviation (GimpUnit unit) +_gimp_unit_get_abbreviation (Gimp *gimp, + GimpUnit unit) { g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) && - (unit < (GIMP_UNIT_END + number_of_user_units)) || + (unit < (GIMP_UNIT_END + gimp->n_user_units)) || (unit == GIMP_UNIT_PERCENT), gimp_unit_defs[GIMP_UNIT_INCH].abbreviation); @@ -231,15 +233,15 @@ gimp_unit_get_abbreviation (GimpUnit unit) if (unit == GIMP_UNIT_PERCENT) return gimp_unit_percent.abbreviation; - return gimp_unit_get_user_unit (unit)->abbreviation; + return _gimp_unit_get_user_unit (gimp, unit)->abbreviation; } - gchar * -gimp_unit_get_singular (GimpUnit unit) +_gimp_unit_get_singular (Gimp *gimp, + GimpUnit unit) { g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) && - (unit < (GIMP_UNIT_END + number_of_user_units)) || + (unit < (GIMP_UNIT_END + gimp->n_user_units)) || (unit == GIMP_UNIT_PERCENT), gettext (gimp_unit_defs[GIMP_UNIT_INCH].singular)); @@ -249,15 +251,15 @@ gimp_unit_get_singular (GimpUnit unit) if (unit == GIMP_UNIT_PERCENT) return gettext (gimp_unit_percent.singular); - return gettext (gimp_unit_get_user_unit (unit)->singular); + return gettext (_gimp_unit_get_user_unit (gimp, unit)->singular); } - gchar * -gimp_unit_get_plural (GimpUnit unit) +_gimp_unit_get_plural (Gimp *gimp, + GimpUnit unit) { g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) && - (unit < (GIMP_UNIT_END + number_of_user_units)) || + (unit < (GIMP_UNIT_END + gimp->n_user_units)) || (unit == GIMP_UNIT_PERCENT), gettext (gimp_unit_defs[GIMP_UNIT_INCH].plural)); @@ -267,25 +269,24 @@ gimp_unit_get_plural (GimpUnit unit) if (unit == GIMP_UNIT_PERCENT) return gettext (gimp_unit_percent.plural); - return gettext (gimp_unit_get_user_unit (unit)->plural); + return gettext (_gimp_unit_get_user_unit (gimp, unit)->plural); } /* unitrc functions **********/ void -parse_unitrc (void) +gimp_unitrc_load (Gimp *gimp) { gchar *filename; filename = gimp_personal_rc_file ("unitrc"); - parse_gimprc_file (filename); + gimprc_parse_file (filename); g_free (filename); } - void -save_unitrc (void) +gimp_unitrc_save (Gimp *gimp) { gint i; gchar *filename; diff --git a/app/gui/device-status-dialog.c b/app/gui/device-status-dialog.c index d305efc8b1..45618fa0bf 100644 --- a/app/gui/device-status-dialog.c +++ b/app/gui/device-status-dialog.c @@ -324,7 +324,7 @@ devices_restore (void) /* Augment with information from rc file */ filename = gimp_personal_rc_file ("devicerc"); - parse_gimprc_file (filename); + gimprc_parse_file (filename); g_free (filename); if ((device_info = device_info_get_by_id (current_device)) == NULL) diff --git a/app/gui/file-open-dialog.c b/app/gui/file-open-dialog.c index 45416e66d1..426f459489 100644 --- a/app/gui/file-open-dialog.c +++ b/app/gui/file-open-dialog.c @@ -617,7 +617,7 @@ file_open_genbutton_callback (GtkWidget *widget, return; } - gimp_set_busy (); + gimp_set_busy (the_gimp); gtk_widget_set_sensitive (GTK_WIDGET (fileload), FALSE); /* new mult-file preview make: */ @@ -702,7 +702,7 @@ file_open_genbutton_callback (GtkWidget *widget, } gtk_widget_set_sensitive (GTK_WIDGET (fileload), TRUE); - gimp_unset_busy (); + gimp_unset_busy (the_gimp); } static void diff --git a/app/gui/gui.c b/app/gui/gui.c index 17b02d26ea..d6ceae72d4 100644 --- a/app/gui/gui.c +++ b/app/gui/gui.c @@ -69,7 +69,10 @@ /* local function prototypes */ +static void gui_set_busy (Gimp *gimp); +static void gui_unset_busy (Gimp *gimp); static void gui_display_new (GimpImage *gimage); + static gint gui_rotate_the_shield_harmonics (GtkWidget *widget, GdkEvent *eevent, gpointer data); @@ -121,6 +124,11 @@ void gui_init (Gimp *gimp) { gimp->create_display_func = gui_display_new; + gimp->gui_set_busy_func = gui_set_busy; + gimp->gui_unset_busy_func = gui_unset_busy; + + if (gimprc.always_restore_session) + restore_session = TRUE; image_destroy_handler_id = gimp_container_add_handler (gimp->images, "destroy", @@ -243,6 +251,8 @@ gui_shutdown (Gimp *gimp) pattern_dialog_free (); palette_dialog_free (); gradient_dialog_free (); + + gdisplays_delete (); } void @@ -277,42 +287,6 @@ gui_exit (Gimp *gimp) image_update_handler_id = 0; } -void -gui_set_busy (Gimp *gimp) -{ - GDisplay *gdisp; - GSList *list; - - /* Canvases */ - for (list = display_list; list; list = g_slist_next (list)) - { - gdisp = (GDisplay *) list->data; - gdisplay_install_override_cursor (gdisp, GDK_WATCH); - } - - /* Dialogs */ - dialog_idle_all (); - - gdk_flush (); -} - -void -gui_unset_busy (Gimp *gimp) -{ - GDisplay *gdisp; - GSList *list; - - /* Canvases */ - for (list = display_list; list; list = g_slist_next (list)) - { - gdisp = (GDisplay *) list->data; - gdisplay_remove_override_cursor (gdisp); - } - - /* Dialogs */ - dialog_unidle_all (); -} - void gui_really_quit_dialog (void) { @@ -352,6 +326,42 @@ gui_display_new (GimpImage *gimage) NULL); } +static void +gui_set_busy (Gimp *gimp) +{ + GDisplay *gdisp; + GSList *list; + + /* Canvases */ + for (list = display_list; list; list = g_slist_next (list)) + { + gdisp = (GDisplay *) list->data; + gdisplay_install_override_cursor (gdisp, GDK_WATCH); + } + + /* Dialogs */ + dialog_idle_all (); + + gdk_flush (); +} + +static void +gui_unset_busy (Gimp *gimp) +{ + GDisplay *gdisp; + GSList *list; + + /* Canvases */ + for (list = display_list; list; list = g_slist_next (list)) + { + gdisp = (GDisplay *) list->data; + gdisplay_remove_override_cursor (gdisp); + } + + /* Dialogs */ + dialog_unidle_all (); +} + static gint gui_rotate_the_shield_harmonics (GtkWidget *widget, GdkEvent *eevent, diff --git a/app/gui/gui.h b/app/gui/gui.h index d90b0ea48a..793295d0bf 100644 --- a/app/gui/gui.h +++ b/app/gui/gui.h @@ -27,9 +27,6 @@ void gui_post_init (Gimp *gimp); void gui_shutdown (Gimp *gimp); void gui_exit (Gimp *gimp); -void gui_set_busy (Gimp *gimp); -void gui_unset_busy (Gimp *gimp); - void gui_really_quit_dialog (void); diff --git a/app/gui/info-dialog.c b/app/gui/info-dialog.c index d52409a4cb..a9b2105718 100644 --- a/app/gui/info-dialog.c +++ b/app/gui/info-dialog.c @@ -24,7 +24,7 @@ #include "libgimpwidgets/gimpwidgets.h" -#include "apptypes.h" +#include "core/core-types.h" #include "dialog_handler.h" #include "info-dialog.h" diff --git a/app/gui/info-window.c b/app/gui/info-window.c index c9240973b3..201b5b2bd6 100644 --- a/app/gui/info-window.c +++ b/app/gui/info-window.c @@ -45,6 +45,7 @@ #include "app_procs.h" #include "colormaps.h" #include "gdisplay.h" +#include "unitrc.h" #include "libgimp/gimpintl.h" @@ -501,12 +502,16 @@ info_window_update_extended (GDisplay *gdisp, else { /* width and height */ - unit_factor = gimp_unit_get_factor (gdisp->gimage->unit); - unit_digits = gimp_unit_get_digits (gdisp->gimage->unit); + unit_factor = _gimp_unit_get_factor (gdisp->gimage->gimp, + gdisp->gimage->unit); + unit_digits = _gimp_unit_get_digits (gdisp->gimage->gimp, + gdisp->gimage->unit); - if (iwd->unit_str != gimp_unit_get_abbreviation (gdisp->gimage->unit)) + if (iwd->unit_str != _gimp_unit_get_abbreviation (gdisp->gimage->gimp, + gdisp->gimage->unit)) { - iwd->unit_str = gimp_unit_get_abbreviation (gdisp->gimage->unit); + iwd->unit_str = _gimp_unit_get_abbreviation (gdisp->gimage->gimp, + gdisp->gimage->unit); gtk_label_set_text (GTK_LABEL (iwd->unit_labels[0]), iwd->unit_str); gtk_label_set_text (GTK_LABEL (iwd->unit_labels[1]), iwd->unit_str); @@ -608,8 +613,10 @@ info_window_update (GDisplay *gdisp) return; /* width and height */ - unit_factor = gimp_unit_get_factor (gdisp->gimage->unit); - unit_digits = gimp_unit_get_digits (gdisp->gimage->unit); + unit_factor = _gimp_unit_get_factor (gdisp->gimage->gimp, + gdisp->gimage->unit); + unit_digits = _gimp_unit_get_digits (gdisp->gimage->gimp, + gdisp->gimage->unit); g_snprintf (iwd->dimensions_str, MAX_BUF, _("%d x %d pixels"), @@ -618,7 +625,8 @@ info_window_update (GDisplay *gdisp) g_snprintf (format_buf, sizeof (format_buf), "%%.%df x %%.%df %s", unit_digits + 1, unit_digits + 1, - gimp_unit_get_plural (gdisp->gimage->unit)); + _gimp_unit_get_plural (gdisp->gimage->gimp, + gdisp->gimage->unit)); g_snprintf (iwd->real_dimensions_str, MAX_BUF, format_buf, gdisp->gimage->width * unit_factor / gdisp->gimage->xresolution, gdisp->gimage->height * unit_factor / gdisp->gimage->yresolution); diff --git a/app/gui/input-dialog.c b/app/gui/input-dialog.c index d305efc8b1..45618fa0bf 100644 --- a/app/gui/input-dialog.c +++ b/app/gui/input-dialog.c @@ -324,7 +324,7 @@ devices_restore (void) /* Augment with information from rc file */ filename = gimp_personal_rc_file ("devicerc"); - parse_gimprc_file (filename); + gimprc_parse_file (filename); g_free (filename); if ((device_info = device_info_get_by_id (current_device)) == NULL) diff --git a/app/gui/module-browser.c b/app/gui/module-browser.c index 4bff4cc337..1239a3fd0d 100644 --- a/app/gui/module-browser.c +++ b/app/gui/module-browser.c @@ -210,7 +210,7 @@ module_db_init (void) /* load the modulerc file */ filename = gimp_personal_rc_file ("modulerc"); - parse_gimprc_file (filename); + gimprc_parse_file (filename); g_free (filename); /* Load and initialize gimp modules */ diff --git a/app/gui/plug-in-commands.c b/app/gui/plug-in-commands.c index 1a8d11c5d0..00c051bfa3 100644 --- a/app/gui/plug-in-commands.c +++ b/app/gui/plug-in-commands.c @@ -341,7 +341,7 @@ plug_in_init (void) filename = gimp_personal_rc_file ("pluginrc"); app_init_update_status (_("Resource configuration"), filename, -1); - parse_gimprc_file (filename); + gimprc_parse_file (filename); /* query any plug-ins that have changed since we last wrote out * the pluginrc file. diff --git a/app/gui/plug-in-menus.c b/app/gui/plug-in-menus.c index 1a8d11c5d0..00c051bfa3 100644 --- a/app/gui/plug-in-menus.c +++ b/app/gui/plug-in-menus.c @@ -341,7 +341,7 @@ plug_in_init (void) filename = gimp_personal_rc_file ("pluginrc"); app_init_update_status (_("Resource configuration"), filename, -1); - parse_gimprc_file (filename); + gimprc_parse_file (filename); /* query any plug-ins that have changed since we last wrote out * the pluginrc file. diff --git a/app/gui/preferences-dialog.c b/app/gui/preferences-dialog.c index f00186fd7a..c6adadee47 100644 --- a/app/gui/preferences-dialog.c +++ b/app/gui/preferences-dialog.c @@ -813,7 +813,7 @@ prefs_save_callback (GtkWidget *widget, } - save_gimprc (&update, &remove); + gimprc_save (&update, &remove); if (gimprc.using_xserver_resolution) diff --git a/app/gui/session.c b/app/gui/session.c index 2cebc9d11f..ca0dec630c 100644 --- a/app/gui/session.c +++ b/app/gui/session.c @@ -73,7 +73,7 @@ session_init (void) filename = gimp_personal_rc_file ("sessionrc"); app_init_update_status (NULL, filename, -1); - if (! parse_gimprc_file (filename)) + if (! gimprc_parse_file (filename)) { /* always show L&C&P, Tool Options and Brushes on first invocation */ diff --git a/app/gui/tips-dialog.c b/app/gui/tips-dialog.c index b916e3ba66..2a000d222c 100644 --- a/app/gui/tips-dialog.c +++ b/app/gui/tips-dialog.c @@ -28,7 +28,7 @@ #include "libgimpbase/gimpbase.h" #include "libgimpwidgets/gimpwidgets.h" -#include "apptypes.h" +#include "core/core-types.h" #include "tips-dialog.h" @@ -208,7 +208,7 @@ tips_dialog_destroy (GtkWidget *widget, update = g_list_append (update, "show-tips"); remove = g_list_append (remove, "dont-show-tips"); old_show_tips = gimprc.show_tips; - save_gimprc (&update, &remove); + gimprc_save (&update, &remove); } g_list_free (update); g_list_free (remove); diff --git a/app/gui/toolbox.c b/app/gui/toolbox.c index b349d6bf84..d28275026b 100644 --- a/app/gui/toolbox.c +++ b/app/gui/toolbox.c @@ -56,7 +56,6 @@ #include "menus.h" #include "app_procs.h" -#include "appenv.h" #include "gimprc.h" #include "libgimp/gimpintl.h" @@ -587,7 +586,7 @@ toolbox_drop_buffer (GtkWidget *widget, GimpViewable *viewable, gpointer data) { - if (gimp_busy) + if (the_gimp->busy) return; gimp_edit_paste_as_new (the_gimp, NULL, GIMP_BUFFER (viewable)->tiles); diff --git a/app/gui/user-install-dialog.c b/app/gui/user-install-dialog.c index a38860ad37..c5605f9624 100644 --- a/app/gui/user-install-dialog.c +++ b/app/gui/user-install-dialog.c @@ -74,9 +74,11 @@ #define PAGE_STYLE(widget) gtk_widget_set_style (widget, page_style) #define TITLE_STYLE(widget) gtk_widget_set_style (widget, title_style) -static void user_install_dialog_create (UserInstallCallback); -static void user_install_continue_callback (GtkWidget *widget, gpointer data); -static void user_install_cancel_callback (GtkWidget *widget, gpointer data); + +static void user_install_continue_callback (GtkWidget *widget, + gpointer data); +static void user_install_cancel_callback (GtkWidget *widget, + gpointer data); static gboolean user_install_run (void); static void user_install_tuning (void); @@ -85,39 +87,6 @@ static void user_install_resolution (void); static void user_install_resolution_done (void); -void -user_install_verify (UserInstallCallback user_install_callback) -{ - gboolean properly_installed = TRUE; - const gchar *filename; - struct stat stat_buf; - - /* gimp_directory now always returns something */ - filename = gimp_directory (); - - if (stat (filename, &stat_buf) != 0) - properly_installed = FALSE; - - /* If there is already a proper installation, invoke the callback */ - if (properly_installed) - { - (* user_install_callback) (); - } - /* Otherwise, prepare for installation */ - else if (no_interface) - { - g_print (_("The GIMP is not properly installed for the current user\n")); - g_print (_("User installation was skipped because the '--nointerface' flag was encountered\n")); - g_print (_("To perform user installation, run the GIMP without the '--nointerface' flag\n")); - - (* user_install_callback) (); - } - else - { - user_install_dialog_create (user_install_callback); - } -} - /* private stuff */ static GtkWidget *user_install_dialog = NULL; @@ -350,9 +319,10 @@ user_install_continue_callback (GtkWidget *widget, gpointer data) { static gint notebook_index = 0; - UserInstallCallback callback; - callback = (UserInstallCallback) data; + Gimp *gimp; + + gimp = (Gimp *) data; switch (notebook_index) { @@ -382,9 +352,9 @@ user_install_continue_callback (GtkWidget *widget, #ifdef G_OS_WIN32 FreeConsole (); #endif - gimprc_init (); - parse_unitrc (); - parse_gimprc (); + gimprc_init (gimp); + gimp_unitrc_load (gimp); + gimprc_parse (gimp); user_install_tuning (); break; @@ -401,7 +371,7 @@ user_install_continue_callback (GtkWidget *widget, gtk_style_unref (title_style); gtk_style_unref (page_style); - (* callback) (); + gtk_main_quit (); return; break; @@ -426,7 +396,7 @@ user_install_cancel_callback (GtkWidget *widget, gtk_widget_destroy (continue_button); user_install_notebook_set_page (GTK_NOTEBOOK (notebook), EEK_PAGE); - timeout = gtk_timeout_add (1024, (GtkFunction)gtk_exit, (gpointer)0); + timeout = gtk_timeout_add (1024, (GtkFunction) gtk_exit, (gpointer) 0); } static gint @@ -534,7 +504,7 @@ user_install_ctree_select_row (GtkWidget *widget, } void -user_install_dialog_create (UserInstallCallback callback) +user_install_dialog_create (Gimp *gimp) { GtkWidget *dialog; GtkWidget *vbox; @@ -553,9 +523,9 @@ user_install_dialog_create (UserInstallCallback callback) FALSE, FALSE, FALSE, _("Continue"), user_install_continue_callback, - callback, NULL, &continue_button, TRUE, FALSE, + gimp, NULL, &continue_button, TRUE, FALSE, _("Cancel"), user_install_cancel_callback, - callback, 1, &cancel_button, FALSE, TRUE, + gimp, 1, &cancel_button, FALSE, TRUE, NULL); @@ -939,11 +909,11 @@ quote_spaces (char *string) static gboolean user_install_run (void) { - FILE *pfp; - gchar buffer[2048]; - struct stat stat_buf; - gint err; - gboolean executable = TRUE; + FILE *pfp; + gchar buffer[2048]; + struct stat stat_buf; + gint err; + gboolean executable = TRUE; /* Generate output */ g_snprintf (buffer, sizeof (buffer), "%s" G_DIR_SEPARATOR_S USER_INSTALL, @@ -1328,7 +1298,7 @@ user_install_resolution_done (void) gimprc.monitor_yres = 0.0; } - save_gimprc (&update, &remove); + gimprc_save (&update, &remove); if (gimprc.using_xserver_resolution) gdisplay_xserver_resolution (&gimprc.monitor_xres, &gimprc.monitor_yres); diff --git a/app/gui/user-install-dialog.h b/app/gui/user-install-dialog.h index a1c6f1e259..b8ffaff1e1 100644 --- a/app/gui/user-install-dialog.h +++ b/app/gui/user-install-dialog.h @@ -16,15 +16,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __USER_INSTALL_H__ -#define __USER_INSTALL_H__ +#ifndef __USER_INSTALL_DIALOG_H__ +#define __USER_INSTALL_DIALOG_H__ -/* Install callback function */ -typedef void (* UserInstallCallback) (void); - -/* Function declarations */ -void user_install_verify (UserInstallCallback user_install_callback); +void user_install_dialog_create (Gimp *gimp); -#endif /* __USER_INSTALL_H__ */ +#endif /* __USER_INSTALL_DIALOG_H__ */ diff --git a/app/libgimp_glue.c b/app/libgimp_glue.c index e3cca38a0c..454abf9aa4 100644 --- a/app/libgimp_glue.c +++ b/app/libgimp_glue.c @@ -28,6 +28,7 @@ #include "core/gimpcontext.h" #include "app_procs.h" +#include "unitrc.h" #include "libgimp_glue.h" @@ -70,3 +71,97 @@ gimp_palette_get_background (GimpRGB *color) return TRUE; } + +gint +gimp_unit_get_number_of_units (void) +{ + return _gimp_unit_get_number_of_units (the_gimp); +} + +gint +gimp_unit_get_number_of_built_in_units (void) +{ + return GIMP_UNIT_END; +} + +GimpUnit +gimp_unit_new (gchar *identifier, + gdouble factor, + gint digits, + gchar *symbol, + gchar *abbreviation, + gchar *singular, + gchar *plural) +{ + return _gimp_unit_new (the_gimp, + identifier, + factor, + digits, + symbol, + abbreviation, + singular, + plural); +} + + +gboolean +gimp_unit_get_deletion_flag (GimpUnit unit) +{ + return _gimp_unit_get_deletion_flag (the_gimp, unit); +} + +void +gimp_unit_set_deletion_flag (GimpUnit unit, + gboolean deletion_flag) +{ + _gimp_unit_set_deletion_flag (the_gimp, unit, deletion_flag); +} + + +gdouble +gimp_unit_get_factor (GimpUnit unit) +{ + return _gimp_unit_get_factor (the_gimp, unit); +} + + +gint +gimp_unit_get_digits (GimpUnit unit) +{ + return _gimp_unit_get_digits (the_gimp, unit); +} + + +gchar * +gimp_unit_get_identifier (GimpUnit unit) +{ + return _gimp_unit_get_identifier (the_gimp, unit); +} + + +gchar * +gimp_unit_get_symbol (GimpUnit unit) +{ + return _gimp_unit_get_symbol (the_gimp, unit); +} + + +gchar * +gimp_unit_get_abbreviation (GimpUnit unit) +{ + return _gimp_unit_get_abbreviation (the_gimp, unit); +} + + +gchar * +gimp_unit_get_singular (GimpUnit unit) +{ + return _gimp_unit_get_singular (the_gimp, unit); +} + + +gchar * +gimp_unit_get_plural (GimpUnit unit) +{ + return _gimp_unit_get_plural (the_gimp, unit); +} diff --git a/app/libgimp_glue.h b/app/libgimp_glue.h index 8a2ba4d436..fc8aaf8f75 100644 --- a/app/libgimp_glue.h +++ b/app/libgimp_glue.h @@ -26,10 +26,30 @@ */ -gboolean gimp_palette_set_foreground (const GimpRGB *color); -gboolean gimp_palette_get_foreground (GimpRGB *color); -gboolean gimp_palette_set_background (const GimpRGB *color); -gboolean gimp_palette_get_background (GimpRGB *color); +gboolean gimp_palette_set_foreground (const GimpRGB *color); +gboolean gimp_palette_get_foreground (GimpRGB *color); +gboolean gimp_palette_set_background (const GimpRGB *color); +gboolean gimp_palette_get_background (GimpRGB *color); + +gint gimp_unit_get_number_of_units (void); +gint gimp_unit_get_number_of_built_in_units (void); +GimpUnit gimp_unit_new (gchar *identifier, + gdouble factor, + gint digits, + gchar *symbol, + gchar *abbreviation, + gchar *singular, + gchar *plural); +gboolean gimp_unit_get_deletion_flag (GimpUnit unit); +void gimp_unit_set_deletion_flag (GimpUnit unit, + gboolean deletion_flag); +gdouble gimp_unit_get_factor (GimpUnit unit); +gint gimp_unit_get_digits (GimpUnit unit); +gchar * gimp_unit_get_identifier (GimpUnit unit); +gchar * gimp_unit_get_symbol (GimpUnit unit); +gchar * gimp_unit_get_abbreviation (GimpUnit unit); +gchar * gimp_unit_get_singular (GimpUnit unit); +gchar * gimp_unit_get_plural (GimpUnit unit); #endif /* __LIBGIMP_GLUE_H__ */ diff --git a/app/main.c b/app/main.c index eb71b8a034..da248bdffe 100644 --- a/app/main.c +++ b/app/main.c @@ -45,52 +45,43 @@ #include "appenv.h" #include "app_procs.h" #include "errors.h" -#include "user_install.h" #include "libgimp/gimpintl.h" #ifdef G_OS_WIN32 #include #else -static void gimp_sigfatal_handler (gint sig_num); -static void gimp_sigchld_handler (gint sig_num); +static void gimp_sigfatal_handler (gint sig_num); +static void gimp_sigchld_handler (gint sig_num); #endif -static void init (void); -static void gimp_error_handler (const gchar *domain, - GLogLevelFlags flags, - const gchar *msg, - gpointer user_data); - -/* GLOBAL data */ -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; -gboolean double_speed = FALSE; -gboolean use_mmx = FALSE; - /* TODO: this should probably go into a header file */ #ifdef HAVE_ASM_MMX -unsigned long intel_cpu_features(void); +unsigned long intel_cpu_features (void); #endif -MessageHandlerType message_handler = CONSOLE; -gchar *prog_name = NULL; /* The path name we are invoked with */ -gchar *alternate_gimprc = NULL; -gchar *alternate_system_gimprc = NULL; -gchar **batch_cmds = NULL; +/* 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; +/* other global variables */ +gchar *prog_name = NULL; /* our executable name */ +MessageHandlerType message_handler = CONSOLE; +gboolean double_speed = FALSE; +gboolean use_mmx = FALSE; -/* LOCAL data */ -static gint gimp_argc = 0; -static gchar **gimp_argv = NULL; /* * argv processing: @@ -101,7 +92,6 @@ static gchar **gimp_argv = NULL; * unparsed args are treated as images to load on * startup. * - * * The GTK switches are processed first (X switches are * processed here, not by any X routines). Then the * general GIMP switches are processed. Any args @@ -117,11 +107,11 @@ int main (int argc, char **argv) { - gboolean show_version = FALSE; - gboolean show_help = FALSE; - gint i, j; + gboolean show_version = FALSE; + gboolean show_help = FALSE; + gint i, j; #ifdef HAVE_PUTENV - gchar *display_env; + gchar *display_env; #endif g_atexit (g_mem_profile); @@ -306,7 +296,9 @@ main (int argc, #endif if (show_version) - g_print ( "%s %s\n", _("GIMP version"), GIMP_VERSION); + { + g_print ( "%s %s\n", _("GIMP version"), GIMP_VERSION); + } if (show_help) { @@ -355,31 +347,40 @@ main (int argc, g_log_set_handler ("Gimp", G_LOG_LEVEL_MESSAGE, - gimp_message_func, + gimp_message_log_func, NULL); g_log_set_handler ("Gimp-Base", G_LOG_LEVEL_MESSAGE, - gimp_message_func, + gimp_message_log_func, NULL); g_log_set_handler ("Gimp-Core", G_LOG_LEVEL_MESSAGE, - gimp_message_func, + gimp_message_log_func, NULL); g_log_set_handler ("Gimp-PDB", G_LOG_LEVEL_MESSAGE, - gimp_message_func, + gimp_message_log_func, + NULL); + g_log_set_handler ("Gimp-XCF", + G_LOG_LEVEL_MESSAGE, + gimp_message_log_func, NULL); g_log_set_handler ("Gimp-Widgets", G_LOG_LEVEL_MESSAGE, - gimp_message_func, + gimp_message_log_func, NULL); g_log_set_handler ("Gimp-Tools", G_LOG_LEVEL_MESSAGE, - gimp_message_func, + gimp_message_log_func, NULL); g_log_set_handler ("Gimp-GUI", G_LOG_LEVEL_MESSAGE, - gimp_message_func, + gimp_message_log_func, + NULL); + + g_log_set_handler (NULL, + G_LOG_LEVEL_ERROR | G_LOG_FLAG_FATAL, + gimp_error_log_func, NULL); #ifndef G_OS_WIN32 @@ -412,25 +413,18 @@ main (int argc, #endif /* G_OS_WIN32 */ - g_log_set_handler (NULL, - G_LOG_LEVEL_ERROR | G_LOG_FLAG_FATAL, - gimp_error_handler, - NULL); - - /* Keep the command line arguments--for use in gimp_init */ - gimp_argc = argc - 1; - gimp_argv = argv + 1; - - /* Check the user_installation */ - user_install_verify (init); + /* Initialize the application */ + app_init (argc - 1, + argv + 1); /* Main application loop */ - if (!app_exit_finish_done ()) + if (! app_exit_finish_done ()) gtk_main (); return 0; } + #ifdef G_OS_WIN32 /* In case we build this as a windowed application */ @@ -450,27 +444,12 @@ WinMain (struct HINSTANCE__ *hInstance, return main (__argc, __argv); } -#endif +#endif /* G_OS_WIN32 */ -static void -init (void) -{ - /* Continue initializing */ - app_init (gimp_argc, gimp_argv); -} - - -static void -gimp_error_handler (const gchar *domain, - GLogLevelFlags flags, - const gchar *msg, - gpointer user_data) -{ - gimp_fatal_error ("%s", msg); -} #ifndef G_OS_WIN32 + /* gimp core signal handler for fatal signals */ static void @@ -512,4 +491,4 @@ gimp_sigchld_handler (gint sig_num) } } -#endif /* !G_OS_WIN32 */ +#endif /* ! G_OS_WIN32 */ diff --git a/app/menus/plug-in-menus.c b/app/menus/plug-in-menus.c index 1a8d11c5d0..00c051bfa3 100644 --- a/app/menus/plug-in-menus.c +++ b/app/menus/plug-in-menus.c @@ -341,7 +341,7 @@ plug_in_init (void) filename = gimp_personal_rc_file ("pluginrc"); app_init_update_status (_("Resource configuration"), filename, -1); - parse_gimprc_file (filename); + gimprc_parse_file (filename); /* query any plug-ins that have changed since we last wrote out * the pluginrc file. diff --git a/app/module_db.c b/app/module_db.c index 4bff4cc337..1239a3fd0d 100644 --- a/app/module_db.c +++ b/app/module_db.c @@ -210,7 +210,7 @@ module_db_init (void) /* load the modulerc file */ filename = gimp_personal_rc_file ("modulerc"); - parse_gimprc_file (filename); + gimprc_parse_file (filename); g_free (filename); /* Load and initialize gimp modules */ diff --git a/app/nav_window.c b/app/nav_window.c index ba16e77ddd..9615127dbc 100644 --- a/app/nav_window.c +++ b/app/nav_window.c @@ -885,11 +885,11 @@ nav_dialog_update_preview (NavigationDialog *nav_dialog) gint xoff = 0; gint yoff = 0; - gimp_set_busy (); - gdisp = nav_dialog->gdisp; gimage = gdisp->gimage; + gimp_set_busy (gimage->gimp); + /* Min size is 2 */ pwidth = nav_dialog->pwidth; pheight = nav_dialog->pheight; @@ -1034,7 +1034,7 @@ nav_dialog_update_preview (NavigationDialog *nav_dialog) if (preview_buf_notdot) temp_buf_free (preview_buf_notdot); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); } static void diff --git a/app/pdb/image_cmds.c b/app/pdb/image_cmds.c index c49535737f..00ef7aef34 100644 --- a/app/pdb/image_cmds.c +++ b/app/pdb/image_cmds.c @@ -351,7 +351,7 @@ image_resize_invoker (Gimp *gimp, if (success) { - gimp_set_busy_until_idle (); + gimp_set_busy_until_idle (gimp); gimp_image_resize (gimage, new_width, new_height, offx, offy); } @@ -426,7 +426,7 @@ image_scale_invoker (Gimp *gimp, if (success) { - gimp_set_busy_until_idle (); + gimp_set_busy_until_idle (gimp); gimp_image_scale (gimage, new_width, new_height); } @@ -3789,7 +3789,7 @@ image_set_unit_invoker (Gimp *gimp, success = FALSE; unit = args[1].value.pdb_int; - if (unit < GIMP_UNIT_INCH || unit >= gimp_unit_get_number_of_units ()) + if (unit < GIMP_UNIT_INCH || unit >= _gimp_unit_get_number_of_units (gimp)) success = FALSE; if (success) diff --git a/app/pdb/message_cmds.c b/app/pdb/message_cmds.c index 40921d7388..ac702ad1d7 100644 --- a/app/pdb/message_cmds.c +++ b/app/pdb/message_cmds.c @@ -28,6 +28,7 @@ #include "core/core-types.h" #include "procedural_db.h" +#include "appenums.h" #include "appenv.h" static ProcRecord message_proc; diff --git a/app/pdb/unit_cmds.c b/app/pdb/unit_cmds.c index 0b1c252af3..a9f5a8fc5b 100644 --- a/app/pdb/unit_cmds.c +++ b/app/pdb/unit_cmds.c @@ -28,6 +28,7 @@ #include "core/core-types.h" #include "procedural_db.h" +#include "unitrc.h" #include "libgimpbase/gimpunit.h" @@ -68,7 +69,7 @@ unit_get_number_of_units_invoker (Gimp *gimp, Argument *return_args; return_args = procedural_db_return_args (&unit_get_number_of_units_proc, TRUE); - return_args[1].value.pdb_int = gimp_unit_get_number_of_units (); + return_args[1].value.pdb_int = _gimp_unit_get_number_of_units (gimp); return return_args; } @@ -105,7 +106,7 @@ unit_get_number_of_built_in_units_invoker (Gimp *gimp, Argument *return_args; return_args = procedural_db_return_args (&unit_get_number_of_built_in_units_proc, TRUE); - return_args[1].value.pdb_int = gimp_unit_get_number_of_units (); + return_args[1].value.pdb_int = _gimp_unit_get_number_of_units (gimp); return return_args; } @@ -175,8 +176,8 @@ unit_new_invoker (Gimp *gimp, success = FALSE; if (success) - unit = gimp_unit_new (identifier, factor, digits, symbol, abbreviation, - singular, plural); + unit = _gimp_unit_new (gimp, identifier, factor, digits, symbol, abbreviation, + singular, plural); return_args = procedural_db_return_args (&unit_new_proc, success); @@ -259,13 +260,13 @@ unit_get_deletion_flag_invoker (Gimp *gimp, GimpUnit unit; unit = args[0].value.pdb_int; - if (unit < GIMP_UNIT_PIXEL || unit >= gimp_unit_get_number_of_units ()) + if (unit < GIMP_UNIT_PIXEL || unit >= _gimp_unit_get_number_of_units (gimp)) success = FALSE; return_args = procedural_db_return_args (&unit_get_deletion_flag_proc, success); if (success) - return_args[1].value.pdb_int = gimp_unit_get_deletion_flag (unit); + return_args[1].value.pdb_int = _gimp_unit_get_deletion_flag (gimp, unit); return return_args; } @@ -313,13 +314,13 @@ unit_set_deletion_flag_invoker (Gimp *gimp, gboolean deletion_flag; unit = args[0].value.pdb_int; - if (unit < GIMP_UNIT_PIXEL || unit >= gimp_unit_get_number_of_units ()) + if (unit < GIMP_UNIT_PIXEL || unit >= _gimp_unit_get_number_of_units (gimp)) success = FALSE; deletion_flag = args[1].value.pdb_int ? TRUE : FALSE; if (success) - gimp_unit_set_deletion_flag (unit, deletion_flag); + _gimp_unit_set_deletion_flag (gimp, unit, deletion_flag); return procedural_db_return_args (&unit_set_deletion_flag_proc, success); } @@ -363,13 +364,13 @@ unit_get_identifier_invoker (Gimp *gimp, GimpUnit unit; unit = args[0].value.pdb_int; - if (unit < GIMP_UNIT_PIXEL || unit >= gimp_unit_get_number_of_units ()) + if (unit < GIMP_UNIT_PIXEL || unit >= _gimp_unit_get_number_of_units (gimp)) success = FALSE; return_args = procedural_db_return_args (&unit_get_identifier_proc, success); if (success) - return_args[1].value.pdb_pointer = g_strdup (gimp_unit_get_identifier (unit)); + return_args[1].value.pdb_pointer = g_strdup (_gimp_unit_get_identifier (gimp, unit)); return return_args; } @@ -417,13 +418,13 @@ unit_get_factor_invoker (Gimp *gimp, GimpUnit unit; unit = args[0].value.pdb_int; - if (unit < GIMP_UNIT_PIXEL || unit >= gimp_unit_get_number_of_units ()) + if (unit < GIMP_UNIT_PIXEL || unit >= _gimp_unit_get_number_of_units (gimp)) success = FALSE; return_args = procedural_db_return_args (&unit_get_factor_proc, success); if (success) - return_args[1].value.pdb_float = gimp_unit_get_factor (unit); + return_args[1].value.pdb_float = _gimp_unit_get_factor (gimp, unit); return return_args; } @@ -471,13 +472,13 @@ unit_get_digits_invoker (Gimp *gimp, GimpUnit unit; unit = args[0].value.pdb_int; - if (unit < GIMP_UNIT_PIXEL || unit >= gimp_unit_get_number_of_units ()) + if (unit < GIMP_UNIT_PIXEL || unit >= _gimp_unit_get_number_of_units (gimp)) success = FALSE; return_args = procedural_db_return_args (&unit_get_digits_proc, success); if (success) - return_args[1].value.pdb_int = gimp_unit_get_digits (unit); + return_args[1].value.pdb_int = _gimp_unit_get_digits (gimp, unit); return return_args; } @@ -525,13 +526,13 @@ unit_get_symbol_invoker (Gimp *gimp, GimpUnit unit; unit = args[0].value.pdb_int; - if (unit < GIMP_UNIT_PIXEL || unit >= gimp_unit_get_number_of_units ()) + if (unit < GIMP_UNIT_PIXEL || unit >= _gimp_unit_get_number_of_units (gimp)) success = FALSE; return_args = procedural_db_return_args (&unit_get_symbol_proc, success); if (success) - return_args[1].value.pdb_pointer = g_strdup (gimp_unit_get_symbol (unit)); + return_args[1].value.pdb_pointer = g_strdup (_gimp_unit_get_symbol (gimp, unit)); return return_args; } @@ -579,13 +580,13 @@ unit_get_abbreviation_invoker (Gimp *gimp, GimpUnit unit; unit = args[0].value.pdb_int; - if (unit < GIMP_UNIT_PIXEL || unit >= gimp_unit_get_number_of_units ()) + if (unit < GIMP_UNIT_PIXEL || unit >= _gimp_unit_get_number_of_units (gimp)) success = FALSE; return_args = procedural_db_return_args (&unit_get_abbreviation_proc, success); if (success) - return_args[1].value.pdb_pointer = g_strdup (gimp_unit_get_abbreviation (unit)); + return_args[1].value.pdb_pointer = g_strdup (_gimp_unit_get_abbreviation (gimp, unit)); return return_args; } @@ -633,13 +634,13 @@ unit_get_singular_invoker (Gimp *gimp, GimpUnit unit; unit = args[0].value.pdb_int; - if (unit < GIMP_UNIT_PIXEL || unit >= gimp_unit_get_number_of_units ()) + if (unit < GIMP_UNIT_PIXEL || unit >= _gimp_unit_get_number_of_units (gimp)) success = FALSE; return_args = procedural_db_return_args (&unit_get_singular_proc, success); if (success) - return_args[1].value.pdb_pointer = g_strdup (gimp_unit_get_singular (unit)); + return_args[1].value.pdb_pointer = g_strdup (_gimp_unit_get_singular (gimp, unit)); return return_args; } @@ -687,13 +688,13 @@ unit_get_plural_invoker (Gimp *gimp, GimpUnit unit; unit = args[0].value.pdb_int; - if (unit < GIMP_UNIT_PIXEL || unit >= gimp_unit_get_number_of_units ()) + if (unit < GIMP_UNIT_PIXEL || unit >= _gimp_unit_get_number_of_units (gimp)) success = FALSE; return_args = procedural_db_return_args (&unit_get_plural_proc, success); if (success) - return_args[1].value.pdb_pointer = g_strdup (gimp_unit_get_plural (unit)); + return_args[1].value.pdb_pointer = g_strdup (_gimp_unit_get_plural (gimp, unit)); return return_args; } diff --git a/app/plug-in/gimpplugin-message.c b/app/plug-in/gimpplugin-message.c index 1a8d11c5d0..00c051bfa3 100644 --- a/app/plug-in/gimpplugin-message.c +++ b/app/plug-in/gimpplugin-message.c @@ -341,7 +341,7 @@ plug_in_init (void) filename = gimp_personal_rc_file ("pluginrc"); app_init_update_status (_("Resource configuration"), filename, -1); - parse_gimprc_file (filename); + gimprc_parse_file (filename); /* query any plug-ins that have changed since we last wrote out * the pluginrc file. diff --git a/app/plug-in/gimpplugin-progress.c b/app/plug-in/gimpplugin-progress.c index 1a8d11c5d0..00c051bfa3 100644 --- a/app/plug-in/gimpplugin-progress.c +++ b/app/plug-in/gimpplugin-progress.c @@ -341,7 +341,7 @@ plug_in_init (void) filename = gimp_personal_rc_file ("pluginrc"); app_init_update_status (_("Resource configuration"), filename, -1); - parse_gimprc_file (filename); + gimprc_parse_file (filename); /* query any plug-ins that have changed since we last wrote out * the pluginrc file. diff --git a/app/plug-in/gimpplugin.c b/app/plug-in/gimpplugin.c index 1a8d11c5d0..00c051bfa3 100644 --- a/app/plug-in/gimpplugin.c +++ b/app/plug-in/gimpplugin.c @@ -341,7 +341,7 @@ plug_in_init (void) filename = gimp_personal_rc_file ("pluginrc"); app_init_update_status (_("Resource configuration"), filename, -1); - parse_gimprc_file (filename); + gimprc_parse_file (filename); /* query any plug-ins that have changed since we last wrote out * the pluginrc file. diff --git a/app/plug-in/gimppluginmanager-call.c b/app/plug-in/gimppluginmanager-call.c index 1a8d11c5d0..00c051bfa3 100644 --- a/app/plug-in/gimppluginmanager-call.c +++ b/app/plug-in/gimppluginmanager-call.c @@ -341,7 +341,7 @@ plug_in_init (void) filename = gimp_personal_rc_file ("pluginrc"); app_init_update_status (_("Resource configuration"), filename, -1); - parse_gimprc_file (filename); + gimprc_parse_file (filename); /* query any plug-ins that have changed since we last wrote out * the pluginrc file. diff --git a/app/plug-in/gimppluginmanager-run.c b/app/plug-in/gimppluginmanager-run.c index 1a8d11c5d0..00c051bfa3 100644 --- a/app/plug-in/gimppluginmanager-run.c +++ b/app/plug-in/gimppluginmanager-run.c @@ -341,7 +341,7 @@ plug_in_init (void) filename = gimp_personal_rc_file ("pluginrc"); app_init_update_status (_("Resource configuration"), filename, -1); - parse_gimprc_file (filename); + gimprc_parse_file (filename); /* query any plug-ins that have changed since we last wrote out * the pluginrc file. diff --git a/app/plug-in/gimppluginmanager.c b/app/plug-in/gimppluginmanager.c index 1a8d11c5d0..00c051bfa3 100644 --- a/app/plug-in/gimppluginmanager.c +++ b/app/plug-in/gimppluginmanager.c @@ -341,7 +341,7 @@ plug_in_init (void) filename = gimp_personal_rc_file ("pluginrc"); app_init_update_status (_("Resource configuration"), filename, -1); - parse_gimprc_file (filename); + gimprc_parse_file (filename); /* query any plug-ins that have changed since we last wrote out * the pluginrc file. diff --git a/app/plug-in/gimppluginshm.c b/app/plug-in/gimppluginshm.c index 1a8d11c5d0..00c051bfa3 100644 --- a/app/plug-in/gimppluginshm.c +++ b/app/plug-in/gimppluginshm.c @@ -341,7 +341,7 @@ plug_in_init (void) filename = gimp_personal_rc_file ("pluginrc"); app_init_update_status (_("Resource configuration"), filename, -1); - parse_gimprc_file (filename); + gimprc_parse_file (filename); /* query any plug-ins that have changed since we last wrote out * the pluginrc file. diff --git a/app/plug-in/plug-in-def.c b/app/plug-in/plug-in-def.c index 1a8d11c5d0..00c051bfa3 100644 --- a/app/plug-in/plug-in-def.c +++ b/app/plug-in/plug-in-def.c @@ -341,7 +341,7 @@ plug_in_init (void) filename = gimp_personal_rc_file ("pluginrc"); app_init_update_status (_("Resource configuration"), filename, -1); - parse_gimprc_file (filename); + gimprc_parse_file (filename); /* query any plug-ins that have changed since we last wrote out * the pluginrc file. diff --git a/app/plug-in/plug-in-message.c b/app/plug-in/plug-in-message.c index 1a8d11c5d0..00c051bfa3 100644 --- a/app/plug-in/plug-in-message.c +++ b/app/plug-in/plug-in-message.c @@ -341,7 +341,7 @@ plug_in_init (void) filename = gimp_personal_rc_file ("pluginrc"); app_init_update_status (_("Resource configuration"), filename, -1); - parse_gimprc_file (filename); + gimprc_parse_file (filename); /* query any plug-ins that have changed since we last wrote out * the pluginrc file. diff --git a/app/plug-in/plug-in-params.c b/app/plug-in/plug-in-params.c index 1a8d11c5d0..00c051bfa3 100644 --- a/app/plug-in/plug-in-params.c +++ b/app/plug-in/plug-in-params.c @@ -341,7 +341,7 @@ plug_in_init (void) filename = gimp_personal_rc_file ("pluginrc"); app_init_update_status (_("Resource configuration"), filename, -1); - parse_gimprc_file (filename); + gimprc_parse_file (filename); /* query any plug-ins that have changed since we last wrote out * the pluginrc file. diff --git a/app/plug-in/plug-in-progress.c b/app/plug-in/plug-in-progress.c index 1a8d11c5d0..00c051bfa3 100644 --- a/app/plug-in/plug-in-progress.c +++ b/app/plug-in/plug-in-progress.c @@ -341,7 +341,7 @@ plug_in_init (void) filename = gimp_personal_rc_file ("pluginrc"); app_init_update_status (_("Resource configuration"), filename, -1); - parse_gimprc_file (filename); + gimprc_parse_file (filename); /* query any plug-ins that have changed since we last wrote out * the pluginrc file. diff --git a/app/plug-in/plug-in-run.c b/app/plug-in/plug-in-run.c index 1a8d11c5d0..00c051bfa3 100644 --- a/app/plug-in/plug-in-run.c +++ b/app/plug-in/plug-in-run.c @@ -341,7 +341,7 @@ plug_in_init (void) filename = gimp_personal_rc_file ("pluginrc"); app_init_update_status (_("Resource configuration"), filename, -1); - parse_gimprc_file (filename); + gimprc_parse_file (filename); /* query any plug-ins that have changed since we last wrote out * the pluginrc file. diff --git a/app/plug-in/plug-in-shm.c b/app/plug-in/plug-in-shm.c index 1a8d11c5d0..00c051bfa3 100644 --- a/app/plug-in/plug-in-shm.c +++ b/app/plug-in/plug-in-shm.c @@ -341,7 +341,7 @@ plug_in_init (void) filename = gimp_personal_rc_file ("pluginrc"); app_init_update_status (_("Resource configuration"), filename, -1); - parse_gimprc_file (filename); + gimprc_parse_file (filename); /* query any plug-ins that have changed since we last wrote out * the pluginrc file. diff --git a/app/plug-in/plug-in.c b/app/plug-in/plug-in.c index 1a8d11c5d0..00c051bfa3 100644 --- a/app/plug-in/plug-in.c +++ b/app/plug-in/plug-in.c @@ -341,7 +341,7 @@ plug_in_init (void) filename = gimp_personal_rc_file ("pluginrc"); app_init_update_status (_("Resource configuration"), filename, -1); - parse_gimprc_file (filename); + gimprc_parse_file (filename); /* query any plug-ins that have changed since we last wrote out * the pluginrc file. diff --git a/app/plug-in/plug-ins.c b/app/plug-in/plug-ins.c index 1a8d11c5d0..00c051bfa3 100644 --- a/app/plug-in/plug-ins.c +++ b/app/plug-in/plug-ins.c @@ -341,7 +341,7 @@ plug_in_init (void) filename = gimp_personal_rc_file ("pluginrc"); app_init_update_status (_("Resource configuration"), filename, -1); - parse_gimprc_file (filename); + gimprc_parse_file (filename); /* query any plug-ins that have changed since we last wrote out * the pluginrc file. diff --git a/app/plug_in.c b/app/plug_in.c index 1a8d11c5d0..00c051bfa3 100644 --- a/app/plug_in.c +++ b/app/plug_in.c @@ -341,7 +341,7 @@ plug_in_init (void) filename = gimp_personal_rc_file ("pluginrc"); app_init_update_status (_("Resource configuration"), filename, -1); - parse_gimprc_file (filename); + gimprc_parse_file (filename); /* query any plug-ins that have changed since we last wrote out * the pluginrc file. diff --git a/app/tools/gimpblendtool.c b/app/tools/gimpblendtool.c index 72033584a3..ec5e2ccaf5 100644 --- a/app/tools/gimpblendtool.c +++ b/app/tools/gimpblendtool.c @@ -45,7 +45,6 @@ #include "widgets/gimpdnd.h" -#include "appenv.h" #include "app_procs.h" #include "errors.h" #include "gdisplay.h" @@ -923,7 +922,7 @@ blend (GimpImage *gimage, gint bytes; gint x1, y1, x2, y2; - gimp_set_busy (); + gimp_set_busy (gimage->gimp); has_selection = gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2); @@ -958,7 +957,7 @@ blend (GimpImage *gimage, /* free the temporary buffer */ tile_manager_destroy (buf_tiles); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); } static gdouble diff --git a/app/tools/gimpbucketfilltool.c b/app/tools/gimpbucketfilltool.c index 9df98726e5..001350022a 100644 --- a/app/tools/gimpbucketfilltool.c +++ b/app/tools/gimpbucketfilltool.c @@ -39,11 +39,7 @@ #include "core/gimpimage-mask.h" #include "core/gimppattern.h" -#include "appenv.h" -#include "app_procs.h" -#include "gdisplay.h" -#include "gimprc.h" -#include "undo.h" +#include "pdb/procedural_db.h" #include "gimpbucketfilltool.h" #include "gimpfuzzyselecttool.h" @@ -51,7 +47,9 @@ #include "paint_options.h" #include "tool_manager.h" -#include "pdb/procedural_db.h" +#include "gdisplay.h" +#include "gimprc.h" +#include "undo.h" #include "libgimp/gimpintl.h" @@ -535,7 +533,7 @@ bucket_fill (GimpImage *gimage, pat_buf = pattern->mask; } - gimp_set_busy (); + gimp_set_busy (gimage->gimp); bytes = gimp_drawable_bytes (drawable); has_alpha = gimp_drawable_has_alpha (drawable); @@ -611,7 +609,7 @@ bucket_fill (GimpImage *gimage, if (new_buf) temp_buf_free (pat_buf); - gimp_unset_busy (); + gimp_unset_busy (gimage->gimp); } static void diff --git a/app/tools/gimpcolorpickertool.c b/app/tools/gimpcolorpickertool.c index 954449c8ab..d4f17fc6b3 100644 --- a/app/tools/gimpcolorpickertool.c +++ b/app/tools/gimpcolorpickertool.c @@ -36,7 +36,6 @@ #include "tool_manager.h" #include "tool_options.h" -#include "appenv.h" #include "gdisplay.h" #include "gimprc.h" diff --git a/app/tools/gimpfuzzyselecttool.c b/app/tools/gimpfuzzyselecttool.c index 7ccdfa1772..22ea029ed6 100644 --- a/app/tools/gimpfuzzyselecttool.c +++ b/app/tools/gimpfuzzyselecttool.c @@ -31,15 +31,12 @@ #include "base/tile-manager.h" #include "base/tile.h" +#include "core/gimp.h" #include "core/gimpchannel.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" #include "core/gimpimage-mask.h" -#include "app_procs.h" -#include "gdisplay.h" -#include "gimprc.h" - #include "gimpeditselectiontool.h" #include "gimpfuzzyselecttool.h" #include "gimptool.h" @@ -47,6 +44,9 @@ #include "tool_options.h" #include "tool_manager.h" +#include "gdisplay.h" +#include "gimprc.h" + #include "libgimp/gimpintl.h" #define WANT_FUZZY_SELECT_BITS @@ -631,7 +631,7 @@ fuzzy_select_calculate (GimpFuzzySelectTool *fuzzy_sel, drawable = gimp_image_active_drawable (gdisp->gimage); - gimp_set_busy (); + gimp_set_busy (gdisp->gimage->gimp); use_offsets = fuzzy_options->sample_merged ? FALSE : TRUE; @@ -677,7 +677,7 @@ fuzzy_select_calculate (GimpFuzzySelectTool *fuzzy_sel, /* free boundary segments */ g_free (bsegs); - gimp_unset_busy (); + gimp_unset_busy (gdisp->gimage->gimp); return segs; } diff --git a/app/tools/gimpregionselecttool.c b/app/tools/gimpregionselecttool.c index 7ccdfa1772..22ea029ed6 100644 --- a/app/tools/gimpregionselecttool.c +++ b/app/tools/gimpregionselecttool.c @@ -31,15 +31,12 @@ #include "base/tile-manager.h" #include "base/tile.h" +#include "core/gimp.h" #include "core/gimpchannel.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" #include "core/gimpimage-mask.h" -#include "app_procs.h" -#include "gdisplay.h" -#include "gimprc.h" - #include "gimpeditselectiontool.h" #include "gimpfuzzyselecttool.h" #include "gimptool.h" @@ -47,6 +44,9 @@ #include "tool_options.h" #include "tool_manager.h" +#include "gdisplay.h" +#include "gimprc.h" + #include "libgimp/gimpintl.h" #define WANT_FUZZY_SELECT_BITS @@ -631,7 +631,7 @@ fuzzy_select_calculate (GimpFuzzySelectTool *fuzzy_sel, drawable = gimp_image_active_drawable (gdisp->gimage); - gimp_set_busy (); + gimp_set_busy (gdisp->gimage->gimp); use_offsets = fuzzy_options->sample_merged ? FALSE : TRUE; @@ -677,7 +677,7 @@ fuzzy_select_calculate (GimpFuzzySelectTool *fuzzy_sel, /* free boundary segments */ g_free (bsegs); - gimp_unset_busy (); + gimp_unset_busy (gdisp->gimage->gimp); return segs; } diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c index 403c5dd5dc..f491d437bd 100644 --- a/app/tools/gimptransformtool.c +++ b/app/tools/gimptransformtool.c @@ -558,7 +558,7 @@ gimp_transform_tool_doit (GimpTransformTool *gt_tool, gboolean new_layer; gint i, x, y; - gimp_set_busy (); + gimp_set_busy (gdisp->gimage->gimp); tool = GIMP_TOOL (gt_tool); @@ -655,7 +655,7 @@ gimp_transform_tool_doit (GimpTransformTool *gt_tool, } } - gimp_unset_busy (); + gimp_unset_busy (gdisp->gimage->gimp); gdisplays_flush (); diff --git a/app/tools/tool_manager.c b/app/tools/tool_manager.c index 960ebe6bfb..7c8d2ac1a7 100644 --- a/app/tools/tool_manager.c +++ b/app/tools/tool_manager.c @@ -49,7 +49,6 @@ #include "gimppenciltool.h" #include "gimpsmudgetool.h" -#include "appenv.h" #include "app_procs.h" #include "gdisplay.h" #include "gimprc.h" @@ -581,7 +580,7 @@ tool_manager_tool_changed (GimpContext *user_context, tool_manager = (GimpToolManager *) data; /* FIXME: gimp_busy HACK */ - if (gimp_busy) + if (user_context->gimp->busy) { /* there may be contexts waiting for the user_context's "tool_changed" * signal, so stop emitting it. diff --git a/app/unitrc.h b/app/unitrc.h index 3c194797a6..dea895acb4 100644 --- a/app/unitrc.h +++ b/app/unitrc.h @@ -16,12 +16,48 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __UNITRC_H__ -#define __UNITRC_H__ +#ifndef __APP_GIMP_UNIT_H__ +#define __APP_GIMP_UNIT_H__ -void parse_unitrc (void); -void save_unitrc (void); +void gimp_unitrc_load (Gimp *gimp); +void gimp_unitrc_save (Gimp *gimp); + +gint _gimp_unit_get_number_of_units (Gimp *gimp); +gint _gimp_unit_get_number_of_built_in_units (Gimp *gimp); + +GimpUnit _gimp_unit_new (Gimp *gimp, + gchar *identifier, + gdouble factor, + gint digits, + gchar *symbol, + gchar *abbreviation, + gchar *singular, + gchar *plural); + +gboolean _gimp_unit_get_deletion_flag (Gimp *gimp, + GimpUnit unit); +void _gimp_unit_set_deletion_flag (Gimp *gimp, + GimpUnit unit, + gboolean deletion_flag); + +gdouble _gimp_unit_get_factor (Gimp *gimp, + GimpUnit unit); + +gint _gimp_unit_get_digits (Gimp *gimp, + GimpUnit unit); + +gchar * _gimp_unit_get_identifier (Gimp *gimp, + GimpUnit unit); + +gchar * _gimp_unit_get_symbol (Gimp *gimp, + GimpUnit unit); +gchar * _gimp_unit_get_abbreviation (Gimp *gimp, + GimpUnit unit); +gchar * _gimp_unit_get_singular (Gimp *gimp, + GimpUnit unit); +gchar * _gimp_unit_get_plural (Gimp *gimp, + GimpUnit unit); -#endif /* __UNITRC_H__ */ +#endif /* __APP_GIMP_UNIT_H__ */ diff --git a/app/user_install.c b/app/user_install.c index a38860ad37..c5605f9624 100644 --- a/app/user_install.c +++ b/app/user_install.c @@ -74,9 +74,11 @@ #define PAGE_STYLE(widget) gtk_widget_set_style (widget, page_style) #define TITLE_STYLE(widget) gtk_widget_set_style (widget, title_style) -static void user_install_dialog_create (UserInstallCallback); -static void user_install_continue_callback (GtkWidget *widget, gpointer data); -static void user_install_cancel_callback (GtkWidget *widget, gpointer data); + +static void user_install_continue_callback (GtkWidget *widget, + gpointer data); +static void user_install_cancel_callback (GtkWidget *widget, + gpointer data); static gboolean user_install_run (void); static void user_install_tuning (void); @@ -85,39 +87,6 @@ static void user_install_resolution (void); static void user_install_resolution_done (void); -void -user_install_verify (UserInstallCallback user_install_callback) -{ - gboolean properly_installed = TRUE; - const gchar *filename; - struct stat stat_buf; - - /* gimp_directory now always returns something */ - filename = gimp_directory (); - - if (stat (filename, &stat_buf) != 0) - properly_installed = FALSE; - - /* If there is already a proper installation, invoke the callback */ - if (properly_installed) - { - (* user_install_callback) (); - } - /* Otherwise, prepare for installation */ - else if (no_interface) - { - g_print (_("The GIMP is not properly installed for the current user\n")); - g_print (_("User installation was skipped because the '--nointerface' flag was encountered\n")); - g_print (_("To perform user installation, run the GIMP without the '--nointerface' flag\n")); - - (* user_install_callback) (); - } - else - { - user_install_dialog_create (user_install_callback); - } -} - /* private stuff */ static GtkWidget *user_install_dialog = NULL; @@ -350,9 +319,10 @@ user_install_continue_callback (GtkWidget *widget, gpointer data) { static gint notebook_index = 0; - UserInstallCallback callback; - callback = (UserInstallCallback) data; + Gimp *gimp; + + gimp = (Gimp *) data; switch (notebook_index) { @@ -382,9 +352,9 @@ user_install_continue_callback (GtkWidget *widget, #ifdef G_OS_WIN32 FreeConsole (); #endif - gimprc_init (); - parse_unitrc (); - parse_gimprc (); + gimprc_init (gimp); + gimp_unitrc_load (gimp); + gimprc_parse (gimp); user_install_tuning (); break; @@ -401,7 +371,7 @@ user_install_continue_callback (GtkWidget *widget, gtk_style_unref (title_style); gtk_style_unref (page_style); - (* callback) (); + gtk_main_quit (); return; break; @@ -426,7 +396,7 @@ user_install_cancel_callback (GtkWidget *widget, gtk_widget_destroy (continue_button); user_install_notebook_set_page (GTK_NOTEBOOK (notebook), EEK_PAGE); - timeout = gtk_timeout_add (1024, (GtkFunction)gtk_exit, (gpointer)0); + timeout = gtk_timeout_add (1024, (GtkFunction) gtk_exit, (gpointer) 0); } static gint @@ -534,7 +504,7 @@ user_install_ctree_select_row (GtkWidget *widget, } void -user_install_dialog_create (UserInstallCallback callback) +user_install_dialog_create (Gimp *gimp) { GtkWidget *dialog; GtkWidget *vbox; @@ -553,9 +523,9 @@ user_install_dialog_create (UserInstallCallback callback) FALSE, FALSE, FALSE, _("Continue"), user_install_continue_callback, - callback, NULL, &continue_button, TRUE, FALSE, + gimp, NULL, &continue_button, TRUE, FALSE, _("Cancel"), user_install_cancel_callback, - callback, 1, &cancel_button, FALSE, TRUE, + gimp, 1, &cancel_button, FALSE, TRUE, NULL); @@ -939,11 +909,11 @@ quote_spaces (char *string) static gboolean user_install_run (void) { - FILE *pfp; - gchar buffer[2048]; - struct stat stat_buf; - gint err; - gboolean executable = TRUE; + FILE *pfp; + gchar buffer[2048]; + struct stat stat_buf; + gint err; + gboolean executable = TRUE; /* Generate output */ g_snprintf (buffer, sizeof (buffer), "%s" G_DIR_SEPARATOR_S USER_INSTALL, @@ -1328,7 +1298,7 @@ user_install_resolution_done (void) gimprc.monitor_yres = 0.0; } - save_gimprc (&update, &remove); + gimprc_save (&update, &remove); if (gimprc.using_xserver_resolution) gdisplay_xserver_resolution (&gimprc.monitor_xres, &gimprc.monitor_yres); diff --git a/app/user_install.h b/app/user_install.h index a1c6f1e259..b8ffaff1e1 100644 --- a/app/user_install.h +++ b/app/user_install.h @@ -16,15 +16,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __USER_INSTALL_H__ -#define __USER_INSTALL_H__ +#ifndef __USER_INSTALL_DIALOG_H__ +#define __USER_INSTALL_DIALOG_H__ -/* Install callback function */ -typedef void (* UserInstallCallback) (void); - -/* Function declarations */ -void user_install_verify (UserInstallCallback user_install_callback); +void user_install_dialog_create (Gimp *gimp); -#endif /* __USER_INSTALL_H__ */ +#endif /* __USER_INSTALL_DIALOG_H__ */ diff --git a/app/widgets/gimpcolorpanel.c b/app/widgets/gimpcolorpanel.c index 79d901188d..3c427a9290 100644 --- a/app/widgets/gimpcolorpanel.c +++ b/app/widgets/gimpcolorpanel.c @@ -28,8 +28,6 @@ #include "gimpcolorpanel.h" -#include "appenv.h" - struct _GimpColorPanel { @@ -39,6 +37,7 @@ struct _GimpColorPanel gboolean color_notebook_active; }; + /* local function prototypes */ static void gimp_color_panel_class_init (GimpColorPanelClass *klass); static void gimp_color_panel_init (GimpColorPanel *panel); diff --git a/app/widgets/gimpcursor.c b/app/widgets/gimpcursor.c index 8006513eaa..a5ecd56293 100644 --- a/app/widgets/gimpcursor.c +++ b/app/widgets/gimpcursor.c @@ -24,7 +24,7 @@ #include "gimpcursor.h" -/* standard gimp cursors */ +/* standard gimp cursors */ #include "cursors/mouse.xbm" #include "cursors/mouse_mask.xbm" #include "cursors/crosshair.xbm" @@ -38,7 +38,7 @@ #include "cursors/dropper.xbm" #include "cursors/dropper_mask.xbm" -/* stock tool cursors */ +/* stock tool cursors */ #include "cursors/rect_select_small.xbm" #include "cursors/rect_select_small_mask.xbm" #include "cursors/ellipse_select_small.xbm" @@ -100,7 +100,7 @@ #include "cursors/measure_small.xbm" #include "cursors/measure_small_mask.xbm" -/* modifiers */ +/* modifiers */ #include "cursors/plus.xbm" #include "cursors/plus_mask.xbm" #include "cursors/minus.xbm" @@ -175,7 +175,7 @@ static GimpBitmapCursor gimp_cursors[] = }; static GimpBitmapCursor gimp_stock_tool_cursors[] = -/* these have to match up with the enum in appenums.h */ +/* these have to match up with the enum in widgets-types.h */ { { NULL, NULL, @@ -335,7 +335,7 @@ static GimpBitmapCursor gimp_stock_tool_cursors[] = }; static GimpBitmapCursor gimp_modifier_cursors[] = -/* these have to match up with the enum in appenums.h */ +/* these have to match up with the enum in widgets-types.h */ { { NULL, NULL, diff --git a/app/widgets/gimpdeviceinfo.c b/app/widgets/gimpdeviceinfo.c index d305efc8b1..45618fa0bf 100644 --- a/app/widgets/gimpdeviceinfo.c +++ b/app/widgets/gimpdeviceinfo.c @@ -324,7 +324,7 @@ devices_restore (void) /* Augment with information from rc file */ filename = gimp_personal_rc_file ("devicerc"); - parse_gimprc_file (filename); + gimprc_parse_file (filename); g_free (filename); if ((device_info = device_info_get_by_id (current_device)) == NULL) diff --git a/app/widgets/gimpdevices.c b/app/widgets/gimpdevices.c index d305efc8b1..45618fa0bf 100644 --- a/app/widgets/gimpdevices.c +++ b/app/widgets/gimpdevices.c @@ -324,7 +324,7 @@ devices_restore (void) /* Augment with information from rc file */ filename = gimp_personal_rc_file ("devicerc"); - parse_gimprc_file (filename); + gimprc_parse_file (filename); g_free (filename); if ((device_info = device_info_get_by_id (current_device)) == NULL) diff --git a/app/widgets/gimphelp.c b/app/widgets/gimphelp.c index 3b5524d961..8d71e3b475 100644 --- a/app/widgets/gimphelp.c +++ b/app/widgets/gimphelp.c @@ -164,7 +164,7 @@ gimp_help_internal_not_found_callback (GtkWidget *widget, gimprc.help_browser = HELP_BROWSER_NETSCAPE; update = g_list_append (update, "help-browser"); - save_gimprc (&update, &remove); + gimprc_save (&update, &remove); } gtk_main_quit (); diff --git a/app/widgets/gimptoolbox.c b/app/widgets/gimptoolbox.c index b349d6bf84..d28275026b 100644 --- a/app/widgets/gimptoolbox.c +++ b/app/widgets/gimptoolbox.c @@ -56,7 +56,6 @@ #include "menus.h" #include "app_procs.h" -#include "appenv.h" #include "gimprc.h" #include "libgimp/gimpintl.h" @@ -587,7 +586,7 @@ toolbox_drop_buffer (GtkWidget *widget, GimpViewable *viewable, gpointer data) { - if (gimp_busy) + if (the_gimp->busy) return; gimp_edit_paste_as_new (the_gimp, NULL, GIMP_BUFFER (viewable)->tiles); diff --git a/app/xcf/xcf-load.c b/app/xcf/xcf-load.c index a55009dd75..dcb3d23609 100644 --- a/app/xcf/xcf-load.c +++ b/app/xcf/xcf-load.c @@ -511,7 +511,7 @@ xcf_load_image_props (XcfInfo *info, info->cp += xcf_read_int32 (info->fp, &unit, 1); if ((unit <= GIMP_UNIT_PIXEL) || - (unit >= gimp_unit_get_number_of_built_in_units())) + (unit >= _gimp_unit_get_number_of_built_in_units (gimage->gimp))) { g_message ("Warning, unit out of range in XCF file, falling back to inches"); unit = GIMP_UNIT_INCH; @@ -546,17 +546,19 @@ xcf_load_image_props (XcfInfo *info, if (unit_strings[i] == NULL) unit_strings[i] = g_strdup (""); - num_units = gimp_unit_get_number_of_units (); - - for (unit = gimp_unit_get_number_of_built_in_units (); + num_units = _gimp_unit_get_number_of_units (gimage->gimp); + + for (unit = _gimp_unit_get_number_of_built_in_units (gimage->gimp); unit < num_units; unit++) { /* if the factor and the identifier match some unit * in unitrc, use the unitrc unit */ - if ((ABS (gimp_unit_get_factor (unit) - factor) < 1e-5) && + if ((ABS (_gimp_unit_get_factor (gimage->gimp, + unit) - factor) < 1e-5) && (strcmp (unit_strings[0], - gimp_unit_get_identifier (unit)) == 0)) + _gimp_unit_get_identifier (gimage->gimp, + unit)) == 0)) { break; } @@ -564,13 +566,14 @@ xcf_load_image_props (XcfInfo *info, /* no match */ if (unit == num_units) - unit = gimp_unit_new (unit_strings[0], - factor, - digits, - unit_strings[1], - unit_strings[2], - unit_strings[3], - unit_strings[4]); + unit = _gimp_unit_new (gimage->gimp, + unit_strings[0], + factor, + digits, + unit_strings[1], + unit_strings[2], + unit_strings[3], + unit_strings[4]); gimage->unit = unit; diff --git a/app/xcf/xcf-save.c b/app/xcf/xcf-save.c index d93154c093..8e8039e191 100644 --- a/app/xcf/xcf-save.c +++ b/app/xcf/xcf-save.c @@ -49,6 +49,7 @@ #include "floating_sel.h" #include "path.h" #include "pathP.h" +#include "unitrc.h" static void xcf_save_image_props (XcfInfo *info, @@ -60,6 +61,7 @@ static void xcf_save_channel_props (XcfInfo *info, GimpImage *gimage, GimpChannel *channel); static void xcf_save_prop (XcfInfo *info, + GimpImage *gimage, PropType prop_type, ...); static void xcf_save_layer (XcfInfo *info, @@ -250,31 +252,31 @@ xcf_save_image_props (XcfInfo *info, { /* check and see if we should save the colormap property */ if (gimage->cmap) - xcf_save_prop (info, PROP_COLORMAP, gimage->num_cols, gimage->cmap); + xcf_save_prop (info, gimage, PROP_COLORMAP, gimage->num_cols, gimage->cmap); if (info->compression != COMPRESS_NONE) - xcf_save_prop (info, PROP_COMPRESSION, info->compression); + xcf_save_prop (info, gimage, PROP_COMPRESSION, info->compression); if (gimage->guides) - xcf_save_prop (info, PROP_GUIDES, gimage->guides); + xcf_save_prop (info, gimage, PROP_GUIDES, gimage->guides); - xcf_save_prop (info, PROP_RESOLUTION, + xcf_save_prop (info, gimage, PROP_RESOLUTION, gimage->xresolution, gimage->yresolution); - xcf_save_prop (info, PROP_TATTOO, gimage->tattoo_state); + xcf_save_prop (info, gimage, PROP_TATTOO, gimage->tattoo_state); if (gimp_parasite_list_length (gimage->parasites) > 0) - xcf_save_prop (info, PROP_PARASITES, gimage->parasites); + xcf_save_prop (info, gimage, PROP_PARASITES, gimage->parasites); - if (gimage->unit < gimp_unit_get_number_of_built_in_units ()) - xcf_save_prop (info, PROP_UNIT, gimage->unit); + if (gimage->unit < _gimp_unit_get_number_of_built_in_units (gimage->gimp)) + xcf_save_prop (info, gimage, PROP_UNIT, gimage->unit); - xcf_save_prop (info, PROP_PATHS, gimage->paths); + xcf_save_prop (info, gimage, PROP_PATHS, gimage->paths); - if (gimage->unit >= gimp_unit_get_number_of_built_in_units ()) - xcf_save_prop (info, PROP_USER_UNIT, gimage->unit); + if (gimage->unit >= _gimp_unit_get_number_of_built_in_units (gimage->gimp)) + xcf_save_prop (info, gimage, PROP_USER_UNIT, gimage->unit); - xcf_save_prop (info, PROP_END); + xcf_save_prop (info, gimage, PROP_END); } static void @@ -283,43 +285,45 @@ xcf_save_layer_props (XcfInfo *info, GimpLayer *layer) { if (layer == gimp_image_get_active_layer (gimage)) - xcf_save_prop (info, PROP_ACTIVE_LAYER); + xcf_save_prop (info, gimage, PROP_ACTIVE_LAYER); if (layer == gimp_image_floating_sel (gimage)) { info->floating_sel_drawable = layer->fs.drawable; - xcf_save_prop (info, PROP_FLOATING_SELECTION); + xcf_save_prop (info, gimage, PROP_FLOATING_SELECTION); } - xcf_save_prop (info, PROP_OPACITY, layer->opacity); - xcf_save_prop (info, PROP_VISIBLE, + xcf_save_prop (info, gimage, PROP_OPACITY, layer->opacity); + xcf_save_prop (info, gimage, PROP_VISIBLE, gimp_drawable_get_visible (GIMP_DRAWABLE (layer))); - xcf_save_prop (info, PROP_LINKED, layer->linked); - xcf_save_prop (info, PROP_PRESERVE_TRANSPARENCY, layer->preserve_trans); + xcf_save_prop (info, gimage, PROP_LINKED, layer->linked); + xcf_save_prop (info, gimage, PROP_PRESERVE_TRANSPARENCY, + layer->preserve_trans); if (layer->mask) { - xcf_save_prop (info, PROP_APPLY_MASK, layer->mask->apply_mask); - xcf_save_prop (info, PROP_EDIT_MASK, layer->mask->edit_mask); - xcf_save_prop (info, PROP_SHOW_MASK, layer->mask->show_mask); + xcf_save_prop (info, gimage, PROP_APPLY_MASK, layer->mask->apply_mask); + xcf_save_prop (info, gimage, PROP_EDIT_MASK, layer->mask->edit_mask); + xcf_save_prop (info, gimage, PROP_SHOW_MASK, layer->mask->show_mask); } else { - xcf_save_prop (info, PROP_APPLY_MASK, FALSE); - xcf_save_prop (info, PROP_EDIT_MASK, FALSE); - xcf_save_prop (info, PROP_SHOW_MASK, FALSE); + xcf_save_prop (info, gimage, PROP_APPLY_MASK, FALSE); + xcf_save_prop (info, gimage, PROP_EDIT_MASK, FALSE); + xcf_save_prop (info, gimage, PROP_SHOW_MASK, FALSE); } - xcf_save_prop (info, PROP_OFFSETS, + xcf_save_prop (info, gimage, PROP_OFFSETS, GIMP_DRAWABLE (layer)->offset_x, GIMP_DRAWABLE (layer)->offset_y); - xcf_save_prop (info, PROP_MODE, layer->mode); - xcf_save_prop (info, PROP_TATTOO, GIMP_DRAWABLE (layer)->tattoo); + xcf_save_prop (info, gimage, PROP_MODE, layer->mode); + xcf_save_prop (info, gimage, PROP_TATTOO, GIMP_DRAWABLE (layer)->tattoo); if (gimp_parasite_list_length (GIMP_DRAWABLE (layer)->parasites) > 0) - xcf_save_prop (info, PROP_PARASITES, GIMP_DRAWABLE (layer)->parasites); + xcf_save_prop (info, gimage, PROP_PARASITES, + GIMP_DRAWABLE (layer)->parasites); - xcf_save_prop (info, PROP_END); + xcf_save_prop (info, gimage, PROP_END); } static void @@ -330,25 +334,27 @@ xcf_save_channel_props (XcfInfo *info, guchar col[3]; if (channel == gimp_image_get_active_channel (gimage)) - xcf_save_prop (info, PROP_ACTIVE_CHANNEL); + xcf_save_prop (info, gimage, PROP_ACTIVE_CHANNEL); if (channel == gimage->selection_mask) - xcf_save_prop (info, PROP_SELECTION); + xcf_save_prop (info, gimage, PROP_SELECTION); - xcf_save_prop (info, PROP_OPACITY, (gint) (channel->color.a * 255.999)); - xcf_save_prop (info, PROP_VISIBLE, + xcf_save_prop (info, gimage, PROP_OPACITY, + (gint) (channel->color.a * 255.999)); + xcf_save_prop (info, gimage, PROP_VISIBLE, gimp_drawable_get_visible (GIMP_DRAWABLE (channel))); - xcf_save_prop (info, PROP_SHOW_MASKED, channel->show_masked); + xcf_save_prop (info, gimage, PROP_SHOW_MASKED, channel->show_masked); gimp_rgb_get_uchar (&channel->color, &col[0], &col[1], &col[2]); - xcf_save_prop (info, PROP_COLOR, col); + xcf_save_prop (info, gimage, PROP_COLOR, col); - xcf_save_prop (info, PROP_TATTOO, GIMP_DRAWABLE (channel)->tattoo); + xcf_save_prop (info, gimage, PROP_TATTOO, GIMP_DRAWABLE (channel)->tattoo); if (gimp_parasite_list_length (GIMP_DRAWABLE (channel)->parasites) > 0) - xcf_save_prop (info, PROP_PARASITES, GIMP_DRAWABLE (channel)->parasites); + xcf_save_prop (info, gimage, PROP_PARASITES, + GIMP_DRAWABLE (channel)->parasites); - xcf_save_prop (info, PROP_END); + xcf_save_prop (info, gimage, PROP_END); } static void @@ -440,8 +446,9 @@ write_bzpaths (PathList *paths, } static void -xcf_save_prop (XcfInfo *info, - PropType prop_type, +xcf_save_prop (XcfInfo *info, + GimpImage *gimage, + PropType prop_type, ...) { guint32 size; @@ -770,13 +777,13 @@ xcf_save_prop (XcfInfo *info, unit = va_arg (args, guint32); /* write the entire unit definition */ - unit_strings[0] = gimp_unit_get_identifier (unit); - factor = gimp_unit_get_factor (unit); - digits = gimp_unit_get_digits (unit); - unit_strings[1] = gimp_unit_get_symbol (unit); - unit_strings[2] = gimp_unit_get_abbreviation (unit); - unit_strings[3] = gimp_unit_get_singular (unit); - unit_strings[4] = gimp_unit_get_plural (unit); + unit_strings[0] = _gimp_unit_get_identifier (gimage->gimp, unit); + factor = _gimp_unit_get_factor (gimage->gimp, unit); + digits = _gimp_unit_get_digits (gimage->gimp, unit); + unit_strings[1] = _gimp_unit_get_symbol (gimage->gimp, unit); + unit_strings[2] = _gimp_unit_get_abbreviation (gimage->gimp, unit); + unit_strings[3] = _gimp_unit_get_singular (gimage->gimp, unit); + unit_strings[4] = _gimp_unit_get_plural (gimage->gimp, unit); size = 2 * 4 + diff --git a/app/xcf/xcf.c b/app/xcf/xcf.c index 5cdb62db99..b403093e60 100644 --- a/app/xcf/xcf.c +++ b/app/xcf/xcf.c @@ -27,6 +27,7 @@ #include "core/core-types.h" +#include "core/gimp.h" #include "core/gimpimage.h" #include "xcf.h" @@ -35,7 +36,6 @@ #include "xcf-read.h" #include "xcf-save.h" -#include "app_procs.h" #include "plug_in.h" #include "libgimp/gimpintl.h" @@ -193,7 +193,7 @@ xcf_load_invoker (Gimp *gimp, gboolean success; gchar id[14]; - gimp_set_busy (); + gimp_set_busy (gimp); gimage = NULL; @@ -263,7 +263,7 @@ xcf_load_invoker (Gimp *gimp, if (success) return_args[1].value.pdb_int = gimp_image_get_ID (gimage); - gimp_unset_busy (); + gimp_unset_busy (gimp); return return_args; } @@ -278,7 +278,7 @@ xcf_save_invoker (Gimp *gimp, gchar *filename; gboolean success; - gimp_set_busy (); + gimp_set_busy (gimp); success = FALSE; @@ -313,7 +313,7 @@ xcf_save_invoker (Gimp *gimp, return_args = procedural_db_return_args (&xcf_plug_in_save_proc.db_info, success); - gimp_unset_busy (); + gimp_unset_busy (gimp); return return_args; } diff --git a/libgimpbase/gimpdatafiles.c b/libgimpbase/gimpdatafiles.c index e513dbf176..27f6837eaf 100644 --- a/libgimpbase/gimpdatafiles.c +++ b/libgimpbase/gimpdatafiles.c @@ -67,10 +67,11 @@ static struct stat filestat; static gboolean is_script (const gchar *filename) { - const gchar *ext = strrchr (filename, '.'); - gchar *pathext; static gchar **exts = NULL; - gint i; + + const gchar *ext = strrchr (filename, '.'); + gchar *pathext; + gint i; if (exts == NULL) { @@ -125,12 +126,12 @@ gimp_datafiles_read_directories (const gchar *path_str, GimpDataFileLoaderFunc loader_func, gpointer loader_data) { - gchar *local_path; - GList *path; - GList *list; - gchar *filename; - gint err; - DIR *dir; + gchar *local_path; + GList *path; + GList *list; + gchar *filename; + gint err; + DIR *dir; struct dirent *dir_ent; g_return_if_fail (path_str != NULL); diff --git a/tools/pdbgen/Makefile.am b/tools/pdbgen/Makefile.am index 32ef1eb097..d6912c8520 100644 --- a/tools/pdbgen/Makefile.am +++ b/tools/pdbgen/Makefile.am @@ -50,8 +50,6 @@ EXTRA_DIST = \ enum_headers = \ ../../libgimpbase/gimpbasetypes.h \ ../../app/appenums.h \ - ../../app/appenv.h \ - ../../app/errors.h \ ../../app/paint-funcs/paint-funcs.h \ ../../app/base/base-types.h \ ../../app/core/core-types.h \ diff --git a/tools/pdbgen/app.pl b/tools/pdbgen/app.pl index b31d115878..b02cf417ba 100644 --- a/tools/pdbgen/app.pl +++ b/tools/pdbgen/app.pl @@ -269,7 +269,7 @@ sub marshal_inargs { $typeinfo[0] = 'GIMP_UNIT_PIXEL' unless defined $typeinfo[0]; $result .= &make_arg_test($_, sub { ${$_[0]} = "!(${$_[0]})" }, "$var < $typeinfo[0] || $var >= " . - 'gimp_unit_get_number_of_units ()'); + '_gimp_unit_get_number_of_units (gimp)'); } elsif ($pdbtype eq 'enum' && !$enums{$typeinfo[0]}->{contig}) { if (!exists $_->{no_success} || exists $_->{on_success} || diff --git a/tools/pdbgen/enums.pl b/tools/pdbgen/enums.pl index 660b3e6cec..315df6cad9 100644 --- a/tools/pdbgen/enums.pl +++ b/tools/pdbgen/enums.pl @@ -128,6 +128,23 @@ package Gimp::CodeGen::enums; GIMP_PDB_SUCCESS => 'PDB_SUCCESS', GIMP_PDB_CANCEL => 'PDB_CANCEL' } }, + MessageHandlerType => + { contig => 1, + header => 'appenums.h', + symbols => [ qw(MESSAGE_BOX CONSOLE ERROR_CONSOLE) ], + mapping => { MESSAGE_BOX => '0', + CONSOLE => '1', + ERROR_CONSOLE => '2' } + }, + StackTraceMode => + { contig => 1, + header => 'appenums.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' } + }, BrushApplicationMode => { contig => 1, header => 'appenums.h', @@ -202,23 +219,6 @@ package Gimp::CodeGen::enums; RUN_NONINTERACTIVE => '1', RUN_WITH_LAST_VALS => '2' } }, - MessageHandlerType => - { contig => 1, - header => 'appenv.h', - symbols => [ qw(MESSAGE_BOX CONSOLE ERROR_CONSOLE) ], - mapping => { MESSAGE_BOX => '0', - CONSOLE => '1', - ERROR_CONSOLE => '2' } - }, - StackTraceMode => - { contig => 1, - header => 'errors.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' } - }, LayerModeEffects => { contig => 1, header => 'base/base-types.h', diff --git a/tools/pdbgen/pdb/image.pdb b/tools/pdbgen/pdb/image.pdb index c3016371a0..40685fe082 100644 --- a/tools/pdbgen/pdb/image.pdb +++ b/tools/pdbgen/pdb/image.pdb @@ -297,7 +297,7 @@ HELP headers => [ qw("app_procs.h") ], code => <<'CODE' { - gimp_set_busy_until_idle (); + gimp_set_busy_until_idle (gimp); gimp_image_resize (gimage, new_width, new_height, offx, offy); } CODE @@ -325,7 +325,7 @@ HELP %invoke = ( code => <<'CODE' { - gimp_set_busy_until_idle (); + gimp_set_busy_until_idle (gimp); gimp_image_scale (gimage, new_width, new_height); } CODE diff --git a/tools/pdbgen/pdb/message.pdb b/tools/pdbgen/pdb/message.pdb index aea98002d4..db953fd5cb 100644 --- a/tools/pdbgen/pdb/message.pdb +++ b/tools/pdbgen/pdb/message.pdb @@ -76,6 +76,8 @@ HELP %invoke = ( code => 'message_handler = handler;' ); } +@headers = qw("appenv.h"); + @procs = qw(message message_get_handler message_set_handler); %exports = (app => [@procs], lib => [@procs]); diff --git a/tools/pdbgen/pdb/unit.pdb b/tools/pdbgen/pdb/unit.pdb index 4cc5dc0fd5..3a078d0684 100644 --- a/tools/pdbgen/pdb/unit.pdb +++ b/tools/pdbgen/pdb/unit.pdb @@ -43,7 +43,7 @@ sub unit_prop_proc { @outargs = ( { name => $prop, type => $type, desc => "The unit's $desc", - alias => "gimp_unit_get_$prop (unit)", + alias => "_gimp_unit_get_$prop (gimp, unit)", no_declare => 1 } ); @@ -62,7 +62,7 @@ sub unit_get_number_of_units { @outargs = ( { name => 'num_units', type => 'int32', libdef => 'GIMP_UNIT_END', desc => 'The number of units', wrap => 1, - alias => 'gimp_unit_get_number_of_units ()', no_declare => 1 } + alias => '_gimp_unit_get_number_of_units (gimp)', no_declare => 1 } ); } @@ -78,7 +78,7 @@ HELP @outargs = ( { name => 'num_units', type => 'int32', libdef => 'GIMP_UNIT_END', desc => 'The number of built-in units', wrap => 1, - alias => 'gimp_unit_get_number_of_units ()', no_declare => 1 } + alias => '_gimp_unit_get_number_of_units (gimp)', no_declare => 1 } ); } @@ -118,8 +118,8 @@ HELP %invoke = ( code => <<'CODE' -unit = gimp_unit_new (identifier, factor, digits, symbol, abbreviation, - singular, plural); +unit = _gimp_unit_new (gimp, identifier, factor, digits, symbol, abbreviation, + singular, plural); CODE ); } @@ -150,7 +150,7 @@ HELP desc => 'The new deletion flag of the unit' } ); - %invoke = ( code => 'gimp_unit_set_deletion_flag (unit, deletion_flag);' ); + %invoke = ( code => '_gimp_unit_set_deletion_flag (gimp, unit, deletion_flag);' ); } sub unit_get_identifier { @@ -214,7 +214,7 @@ HELP &unit_prop_proc('plural', 'string', 'plural form'); } -@headers = qw("libgimpbase/gimpunit.h"); +@headers = qw("libgimpbase/gimpunit.h" "unitrc.h"); @procs = qw(unit_get_number_of_units unit_get_number_of_built_in_units unit_new unit_get_deletion_flag unit_set_deletion_flag