From 1bcd3e1834fdb9ff94b98a3e9a2ddd57aa17aa86 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Sat, 7 Jul 2001 12:17:23 +0000 Subject: [PATCH] app/Makefile.am removed. 2001-07-07 Michael Natterer * app/Makefile.am * app/context_manager.[ch]: removed. * app/app_procs.c: call tool_mananger instead of context_manager functions, pass "the_gimp" to some more functions. * app/drawable.[ch]: pass a GimpContext to drawable_fill(). * app/errors.c: behave according to "stack_trace_mode" when using the debugging signal handler. * app/gimprc.[ch]: removed the core/ config variables. * app/selection.c: set the selection's state to INVISIBLE in selection_pause(). * app/core/Makefile.am * app/core/gimpcoreconfig.[ch]: new files (the configuration variables used by core/). * app/core/gimpcontext.[ch]: removed the global contexts (user, default, ...) and their functions. It's no longer possible to pass NULL to the context functions to manipulate the current context (gimpcontext.c doesn't know the current context any more). * app/core/gimp.[ch]: added them here. The functions are now called gimp_[set|get]_*_context(). Added gimp_create_context() which is the only function to create contexts now. * app/gui/dialogs.[ch] * app/gui/gui.[ch]: pass "gimp" to all functions. * app/tools/tool_manager.[ch] * app/tools/tools.[ch]: pass "gimp" to lots of functions. Added the "global_tool_context" logic and the global/non-global paint options switching from the context_manager. Pass "gimp" to all tools' "register" functions. * app/tools/*: changed accordingly. * app/devices.c * app/disp_callbacks.c * app/file-open.[ch] * app/file-save.c * app/gdisplay.c * app/gimage.c * app/libgimp_glue.c * app/module_db.c * app/nav_window.c * app/plug_in.c * app/qmask.c * app/undo.c * app/base/base-config.c * app/core/gimpbrushpipe.c * app/core/gimpdrawable-offset.c * app/core/gimpgradient.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-mask.c * app/core/gimpimage-new.c * app/core/gimpimage.c * app/core/gimppalette.c * app/core/gimptoolinfo.[ch] * app/core/gimpundo.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-area.c * app/gui/dialogs-constructors.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/gradient-editor.c * app/gui/gradient-select.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/menus.c * app/gui/palette-editor.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/paths-dialog.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/resize-dialog.c * app/gui/test-commands.c * app/gui/tool-options-dialog.c * app/gui/toolbox.c * app/gui/tools-commands.c * app/xcf/xcf-load.c * app/xcf/xcf-save.c * app/widgets/gimpchannellistview.c * app/widgets/gimpdnd.c * app/widgets/gimpdrawablelistview.[ch] * app/widgets/gimpimagedock.c * app/widgets/gimplayerlistview.c * app/pdb/brushes_cmds.c * app/pdb/drawable_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/gradients_cmds.c * app/pdb/palette_cmds.c * app/pdb/patterns_cmds.c * app/pdb/procedural_db.c * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/palette.pdb * tools/pdbgen/pdb/patterns.pdb: changed accordingly: remove usage of gimp_context_[get|set]_*(NULL), create contexts with gimp_create_context(). Get the user/current context with gimp_get_[user|current]_context(). Added/removed access to the global "the_gimp" variable in some places. Get the core's config variables from "core_config". --- ChangeLog | 113 ++++++ app/Makefile.am | 2 - app/actions/channels-commands.c | 6 +- app/actions/layers-commands.c | 6 +- app/actions/plug-in-commands.c | 14 +- app/actions/qmask-commands.c | 7 +- app/actions/quick-mask-commands.c | 7 +- app/actions/tools-commands.c | 24 +- app/app_procs.c | 21 +- app/base/base-config.c | 13 +- app/base/color-balance.c | 5 +- app/base/color-balance.h | 2 +- app/base/curves.c | 5 +- app/base/curves.h | 2 +- app/base/hue-saturation.c | 5 +- app/base/hue-saturation.h | 2 +- app/base/threshold.c | 5 +- app/base/threshold.h | 2 +- app/context_manager.c | 243 ------------- app/context_manager.h | 35 -- app/core/Makefile.am | 2 + app/core/gimp-transform-region.c | 3 +- app/core/gimp.c | 117 +++++- app/core/gimp.h | 56 ++- app/core/gimpbrushpipe-load.c | 1 - app/core/gimpbrushpipe.c | 1 - app/core/gimpcontext.c | 151 +------- app/core/gimpcontext.h | 47 +-- app/core/gimpcoreconfig.c | 59 +++ app/core/gimpcoreconfig.h | 59 +++ app/core/gimpdrawable-blend.c | 45 ++- app/core/gimpdrawable-offset.c | 11 +- app/core/gimpdrawable-transform.c | 3 +- app/core/gimpgradient.c | 1 - app/core/gimpimage-duplicate.c | 1 + app/core/gimpimage-guides.c | 12 +- app/core/gimpimage-mask.c | 3 +- app/core/gimpimage-merge.c | 12 +- app/core/gimpimage-new.c | 20 +- app/core/gimpimage-pick-color.c | 5 +- app/core/gimpimage-projection.c | 12 +- app/core/gimpimage-qmask.c | 7 +- app/core/gimpimage-quick-mask.c | 7 +- app/core/gimpimage-resize.c | 12 +- app/core/gimpimage-scale.c | 12 +- app/core/gimpimage-undo-push.c | 6 +- app/core/gimpimage.c | 12 +- app/core/gimppalette-load.c | 2 - app/core/gimppalette-save.c | 2 - app/core/gimppalette.c | 2 - app/core/gimpprojection-construct.c | 12 +- app/core/gimpprojection.c | 12 +- app/core/gimptoolinfo.c | 15 +- app/core/gimptoolinfo.h | 3 +- app/core/gimpundo.c | 8 +- app/devices.c | 18 +- app/dialogs/dialogs-constructors.c | 6 +- app/dialogs/dialogs.c | 26 +- app/dialogs/dialogs.h | 4 +- app/dialogs/file-open-dialog.c | 15 +- app/dialogs/image-new-dialog.c | 41 ++- app/dialogs/info-window.c | 9 +- app/dialogs/module-dialog.c | 9 +- app/dialogs/palette-import-dialog.c | 11 +- app/dialogs/preferences-dialog.c | 436 ++++++++++++----------- app/dialogs/resize-dialog.c | 5 +- app/disp_callbacks.c | 25 +- app/display/gimpdisplay-callbacks.c | 25 +- app/display/gimpdisplay-selection.c | 2 + app/display/gimpdisplay.c | 12 +- app/display/gimpdisplayshell-callbacks.c | 25 +- app/display/gimpdisplayshell-qmask.c | 7 +- app/display/gimpdisplayshell-selection.c | 2 + app/display/gimpnavigationeditor.c | 2 +- app/display/gimpnavigationview.c | 2 +- app/drawable.c | 5 +- app/drawable.h | 2 + app/errors.c | 31 +- app/file-open.c | 7 +- app/file-open.h | 3 +- app/file-save.c | 4 +- app/file/file-open.c | 7 +- app/file/file-open.h | 3 +- app/file/file-save.c | 4 +- app/gdisplay.c | 12 +- app/gimage.c | 4 +- app/gimprc.c | 195 +++++----- app/gimprc.h | 21 -- app/gui/brush-select.c | 8 +- app/gui/channels-commands.c | 6 +- app/gui/color-area.c | 37 +- app/gui/device-status-dialog.c | 18 +- app/gui/dialogs-constructors.c | 6 +- app/gui/dialogs.c | 26 +- app/gui/dialogs.h | 4 +- app/gui/file-new-dialog.c | 41 ++- app/gui/file-open-dialog.c | 15 +- app/gui/gradient-editor.c | 12 +- app/gui/gradient-select.c | 8 +- app/gui/gui.c | 53 ++- app/gui/gui.h | 12 +- app/gui/info-window.c | 9 +- app/gui/input-dialog.c | 18 +- app/gui/layers-commands.c | 6 +- app/gui/menus.c | 4 +- app/gui/module-browser.c | 9 +- app/gui/palette-editor.c | 26 +- app/gui/palette-import-dialog.c | 11 +- app/gui/palette-select.c | 8 +- app/gui/paths-dialog.c | 3 +- app/gui/pattern-select.c | 8 +- app/gui/plug-in-commands.c | 14 +- app/gui/plug-in-menus.c | 14 +- app/gui/preferences-dialog.c | 436 ++++++++++++----------- app/gui/qmask-commands.c | 7 +- app/gui/resize-dialog.c | 5 +- app/gui/test-commands.c | 24 +- app/gui/tool-options-dialog.c | 17 +- app/gui/toolbox.c | 11 +- app/gui/tools-commands.c | 24 +- app/libgimp_glue.c | 10 +- app/menus/menus.c | 4 +- app/menus/plug-in-menus.c | 14 +- app/module_db.c | 9 +- app/nav_window.c | 2 +- app/paint/gimpairbrush.c | 22 +- app/paint/gimpairbrush.h | 3 +- app/paint/gimpclone.c | 40 ++- app/paint/gimpclone.h | 2 +- app/paint/gimpconvolve.c | 12 +- app/paint/gimpconvolve.h | 2 +- app/paint/gimpdodgeburn.c | 11 +- app/paint/gimpdodgeburn.h | 2 +- app/paint/gimperaser.c | 23 +- app/paint/gimperaser.h | 2 +- app/paint/gimpink.c | 13 +- app/paint/gimpink.h | 2 +- app/paint/gimppaintbrush.c | 15 +- app/paint/gimppaintbrush.h | 2 +- app/paint/gimppaintcore.c | 39 +- app/paint/gimppencil.c | 17 +- app/paint/gimppencil.h | 2 +- app/paint/gimpsmudge.c | 12 +- app/paint/gimpsmudge.h | 3 +- app/paint/gimpsourcecore.c | 40 ++- app/paint/gimpsourcecore.h | 2 +- app/pdb/brushes_cmds.c | 19 +- app/pdb/drawable_cmds.c | 3 +- app/pdb/gimp-pdb.c | 1 - app/pdb/gimppdb.c | 1 - app/pdb/gimpprocedure.c | 1 - app/pdb/gradient_select_cmds.c | 2 +- app/pdb/gradients_cmds.c | 10 +- app/pdb/palette_cmds.c | 12 +- app/pdb/patterns_cmds.c | 6 +- app/pdb/procedural_db.c | 1 - app/plug-in/gimpplugin-message.c | 14 +- app/plug-in/gimpplugin-progress.c | 14 +- app/plug-in/gimpplugin.c | 14 +- app/plug-in/gimppluginmanager-call.c | 14 +- app/plug-in/gimppluginmanager-run.c | 14 +- app/plug-in/gimppluginmanager.c | 14 +- app/plug-in/gimppluginshm.c | 14 +- app/plug-in/plug-in-def.c | 14 +- app/plug-in/plug-in-message.c | 14 +- app/plug-in/plug-in-params.c | 14 +- app/plug-in/plug-in-progress.c | 14 +- app/plug-in/plug-in-run.c | 14 +- app/plug-in/plug-in-shm.c | 14 +- app/plug-in/plug-in.c | 14 +- app/plug-in/plug-ins.c | 14 +- app/plug_in.c | 14 +- app/qmask.c | 7 +- app/selection.c | 2 + app/tools/gimpairbrushtool.c | 22 +- app/tools/gimpairbrushtool.h | 3 +- app/tools/gimpbezierselecttool.c | 30 +- app/tools/gimpbezierselecttool.h | 3 +- app/tools/gimpblendtool.c | 45 ++- app/tools/gimpblendtool.h | 4 +- app/tools/gimpbrightnesscontrasttool.c | 5 +- app/tools/gimpbrightnesscontrasttool.h | 2 +- app/tools/gimpbrushtool.c | 39 +- app/tools/gimpbucketfilltool.c | 16 +- app/tools/gimpbucketfilltool.h | 2 +- app/tools/gimpbycolorselecttool.c | 7 +- app/tools/gimpbycolorselecttool.h | 2 +- app/tools/gimpclonetool.c | 40 ++- app/tools/gimpclonetool.h | 2 +- app/tools/gimpcolorbalancetool.c | 5 +- app/tools/gimpcolorbalancetool.h | 2 +- app/tools/gimpcolorpickertool.c | 5 +- app/tools/gimpcolorpickertool.h | 23 +- app/tools/gimpconvolvetool.c | 12 +- app/tools/gimpconvolvetool.h | 2 +- app/tools/gimpcroptool.c | 5 +- app/tools/gimpcroptool.h | 16 +- app/tools/gimpcurvestool.c | 5 +- app/tools/gimpcurvestool.h | 2 +- app/tools/gimpdodgeburntool.c | 11 +- app/tools/gimpdodgeburntool.h | 2 +- app/tools/gimpellipseselecttool.c | 13 +- app/tools/gimpellipseselecttool.h | 2 +- app/tools/gimperasertool.c | 23 +- app/tools/gimperasertool.h | 2 +- app/tools/gimpfliptool.c | 5 +- app/tools/gimpfliptool.h | 5 +- app/tools/gimpfreeselecttool.c | 6 +- app/tools/gimpfreeselecttool.h | 2 +- app/tools/gimpfuzzyselecttool.c | 6 +- app/tools/gimpfuzzyselecttool.h | 2 +- app/tools/gimphistogramtool.c | 5 +- app/tools/gimphistogramtool.h | 2 +- app/tools/gimphuesaturationtool.c | 5 +- app/tools/gimphuesaturationtool.h | 2 +- app/tools/gimpinktool.c | 13 +- app/tools/gimpinktool.h | 2 +- app/tools/gimpiscissorstool.c | 5 +- app/tools/gimpiscissorstool.h | 2 +- app/tools/gimplevelstool.c | 5 +- app/tools/gimplevelstool.h | 2 +- app/tools/gimpmagnifytool.c | 5 +- app/tools/gimpmagnifytool.h | 2 +- app/tools/gimpmeasuretool.c | 5 +- app/tools/gimpmeasuretool.h | 2 +- app/tools/gimpmovetool.c | 5 +- app/tools/gimpmovetool.h | 4 +- app/tools/gimppaintbrushtool.c | 15 +- app/tools/gimppaintbrushtool.h | 2 +- app/tools/gimppaintoptions-gui.c | 10 +- app/tools/gimppainttool.c | 39 +- app/tools/gimppathtool.c | 5 +- app/tools/gimppathtool.h | 2 +- app/tools/gimppenciltool.c | 17 +- app/tools/gimppenciltool.h | 2 +- app/tools/gimpperspectivetool.c | 6 +- app/tools/gimpperspectivetool.h | 21 +- app/tools/gimpposterizetool.c | 5 +- app/tools/gimpposterizetool.h | 2 +- app/tools/gimprectselecttool.c | 17 +- app/tools/gimprectselecttool.h | 2 +- app/tools/gimpregionselecttool.c | 6 +- app/tools/gimpregionselecttool.h | 2 +- app/tools/gimprotatetool.c | 6 +- app/tools/gimprotatetool.h | 4 +- app/tools/gimpscaletool.c | 6 +- app/tools/gimpscaletool.h | 3 +- app/tools/gimpsheartool.c | 5 +- app/tools/gimpsheartool.h | 16 +- app/tools/gimpsmudgetool.c | 12 +- app/tools/gimpsmudgetool.h | 3 +- app/tools/gimpsourcetool.c | 40 ++- app/tools/gimpsourcetool.h | 2 +- app/tools/gimptexttool.c | 5 +- app/tools/gimptexttool.h | 4 +- app/tools/gimpthresholdtool.c | 5 +- app/tools/gimpthresholdtool.h | 2 +- app/tools/gimptransformtool.c | 3 +- app/tools/paint_options.c | 10 +- app/tools/tool_manager.c | 269 ++++++++++---- app/tools/tool_manager.h | 20 +- app/tools/tools.c | 80 ++--- app/tools/tools.h | 4 +- app/undo.c | 6 +- app/widgets/gimpdeviceinfo.c | 18 +- app/widgets/gimpdevices.c | 18 +- app/widgets/gimpgradienteditor.c | 12 +- app/widgets/gimpitemfactory.c | 4 +- app/widgets/gimppaletteeditor.c | 26 +- app/widgets/gimptoolbox-color-area.c | 37 +- app/widgets/gimptoolbox.c | 11 +- app/widgets/gimptooloptionseditor.c | 17 +- 272 files changed, 2751 insertions(+), 2220 deletions(-) delete mode 100644 app/context_manager.c delete mode 100644 app/context_manager.h create mode 100644 app/core/gimpcoreconfig.c create mode 100644 app/core/gimpcoreconfig.h diff --git a/ChangeLog b/ChangeLog index f30537644d..646c8227bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,116 @@ +2001-07-07 Michael Natterer + + * app/Makefile.am + * app/context_manager.[ch]: removed. + + * app/app_procs.c: call tool_mananger instead of context_manager + functions, pass "the_gimp" to some more functions. + + * app/drawable.[ch]: pass a GimpContext to drawable_fill(). + + * app/errors.c: behave according to "stack_trace_mode" when using + the debugging signal handler. + + * app/gimprc.[ch]: removed the core/ config variables. + + * app/selection.c: set the selection's state to INVISIBLE in + selection_pause(). + + * app/core/Makefile.am + * app/core/gimpcoreconfig.[ch]: new files (the configuration + variables used by core/). + + * app/core/gimpcontext.[ch]: removed the global contexts (user, + default, ...) and their functions. It's no longer possible to pass + NULL to the context functions to manipulate the current context + (gimpcontext.c doesn't know the current context any more). + + * app/core/gimp.[ch]: added them here. The functions are now called + gimp_[set|get]_*_context(). Added gimp_create_context() which is + the only function to create contexts now. + + * app/gui/dialogs.[ch] + * app/gui/gui.[ch]: pass "gimp" to all functions. + + * app/tools/tool_manager.[ch] + * app/tools/tools.[ch]: pass "gimp" to lots of functions. Added + the "global_tool_context" logic and the global/non-global paint + options switching from the context_manager. Pass "gimp" to all + tools' "register" functions. + + * app/tools/*: changed accordingly. + + * app/devices.c + * app/disp_callbacks.c + * app/file-open.[ch] + * app/file-save.c + * app/gdisplay.c + * app/gimage.c + * app/libgimp_glue.c + * app/module_db.c + * app/nav_window.c + * app/plug_in.c + * app/qmask.c + * app/undo.c + * app/base/base-config.c + * app/core/gimpbrushpipe.c + * app/core/gimpdrawable-offset.c + * app/core/gimpgradient.c + * app/core/gimpimage-duplicate.c + * app/core/gimpimage-mask.c + * app/core/gimpimage-new.c + * app/core/gimpimage.c + * app/core/gimppalette.c + * app/core/gimptoolinfo.[ch] + * app/core/gimpundo.c + * app/gui/brush-select.c + * app/gui/channels-commands.c + * app/gui/color-area.c + * app/gui/dialogs-constructors.c + * app/gui/file-new-dialog.c + * app/gui/file-open-dialog.c + * app/gui/gradient-editor.c + * app/gui/gradient-select.c + * app/gui/info-window.c + * app/gui/layers-commands.c + * app/gui/menus.c + * app/gui/palette-editor.c + * app/gui/palette-import-dialog.c + * app/gui/palette-select.c + * app/gui/paths-dialog.c + * app/gui/pattern-select.c + * app/gui/preferences-dialog.c + * app/gui/resize-dialog.c + * app/gui/test-commands.c + * app/gui/tool-options-dialog.c + * app/gui/toolbox.c + * app/gui/tools-commands.c + * app/xcf/xcf-load.c + * app/xcf/xcf-save.c + * app/widgets/gimpchannellistview.c + * app/widgets/gimpdnd.c + * app/widgets/gimpdrawablelistview.[ch] + * app/widgets/gimpimagedock.c + * app/widgets/gimplayerlistview.c + * app/pdb/brushes_cmds.c + * app/pdb/drawable_cmds.c + * app/pdb/gradient_select_cmds.c + * app/pdb/gradients_cmds.c + * app/pdb/palette_cmds.c + * app/pdb/patterns_cmds.c + * app/pdb/procedural_db.c + * tools/pdbgen/pdb/brushes.pdb + * tools/pdbgen/pdb/drawable.pdb + * tools/pdbgen/pdb/gradient_select.pdb + * tools/pdbgen/pdb/gradients.pdb + * tools/pdbgen/pdb/palette.pdb + * tools/pdbgen/pdb/patterns.pdb: changed accordingly: remove usage + of gimp_context_[get|set]_*(NULL), create contexts with + gimp_create_context(). Get the user/current context with + gimp_get_[user|current]_context(). Added/removed access to the + global "the_gimp" variable in some places. Get the core's config + variables from "core_config". + 2001-07-06 Dave Neary * app/gimprc.c: Removed some C89 & gcc extention stuff which broke diff --git a/app/Makefile.am b/app/Makefile.am index 1ad1ac9547..d1c24b6a56 100644 --- a/app/Makefile.am +++ b/app/Makefile.am @@ -79,8 +79,6 @@ gimp_SOURCES = @STRIP_BEGIN@ \ ## ## stuff for core/ ## - context_manager.c \ - context_manager.h \ datafiles.c \ datafiles.h \ drawable.c \ diff --git a/app/actions/channels-commands.c b/app/actions/channels-commands.c index 4e62ba0dec..c0c396cdce 100644 --- a/app/actions/channels-commands.c +++ b/app/actions/channels-commands.c @@ -25,6 +25,7 @@ #include "core/core-types.h" +#include "core/gimp.h" #include "core/gimpchannel.h" #include "core/gimpimage.h" #include "core/gimpimage-mask.h" @@ -37,6 +38,7 @@ #include "gdisplay.h" #include "menus.h" +#include "app_procs.h" #include "drawable.h" #include "libgimp/gimpintl.h" @@ -314,7 +316,9 @@ new_channel_query_ok_callback (GtkWidget *widget, channel_name, &channel_color); - drawable_fill (GIMP_DRAWABLE (new_channel), TRANSPARENT_FILL); + drawable_fill (GIMP_DRAWABLE (new_channel), + gimp_get_user_context (the_gimp), + TRANSPARENT_FILL); gimp_image_add_channel (gimage, new_channel, -1); gdisplays_flush (); diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c index 7a8121e981..36b0d63324 100644 --- a/app/actions/layers-commands.c +++ b/app/actions/layers-commands.c @@ -30,6 +30,7 @@ #include "paint-funcs/paint-funcs.h" +#include "core/gimp.h" #include "core/gimpimage.h" #include "core/gimpimage-mask.h" #include "core/gimplayer.h" @@ -42,6 +43,7 @@ #include "menus.h" #include "resize-dialog.h" +#include "app_procs.h" #include "drawable.h" #include "gdisplay.h" #include "floating_sel.h" @@ -542,7 +544,9 @@ new_layer_query_ok_callback (GtkWidget *widget, layer_name, OPAQUE_OPACITY, NORMAL_MODE); if (layer) { - drawable_fill (GIMP_DRAWABLE (layer), fill_type); + drawable_fill (GIMP_DRAWABLE (layer), + gimp_get_user_context (the_gimp), + fill_type); gimp_image_add_layer (gimage, layer, -1); /* End the group undo */ diff --git a/app/actions/plug-in-commands.c b/app/actions/plug-in-commands.c index a9145841c2..94d5ee9622 100644 --- a/app/actions/plug-in-commands.c +++ b/app/actions/plug-in-commands.c @@ -89,6 +89,7 @@ #include "base/tile.h" #include "base/tile-manager.h" +#include "core/gimpcoreconfig.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" @@ -322,18 +323,19 @@ plug_in_init (void) plug_in_init_shm (); /* search for binaries in the plug-in directory path */ - gimp_datafiles_read_directories (gimprc.plug_in_path, MODE_EXECUTABLE, + gimp_datafiles_read_directories (core_config->plug_in_path, MODE_EXECUTABLE, plug_in_init_file, NULL); /* read the pluginrc file for cached data */ filename = NULL; - if (gimprc.pluginrc_path) + if (core_config->pluginrc_path) { - if (g_path_is_absolute (gimprc.pluginrc_path)) - filename = g_strdup (gimprc.pluginrc_path); + if (g_path_is_absolute (core_config->pluginrc_path)) + filename = g_strdup (core_config->pluginrc_path); else filename = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s", - gimp_directory (), gimprc.pluginrc_path); + gimp_directory (), + core_config->pluginrc_path); } else filename = gimp_personal_rc_file ("pluginrc"); @@ -853,7 +855,7 @@ plug_in_new (gchar *name) if (! g_path_is_absolute (name)) { - path = plug_in_search_in_path (gimprc.plug_in_path, name); + path = plug_in_search_in_path (core_config->plug_in_path, name); if (! path) { diff --git a/app/actions/qmask-commands.c b/app/actions/qmask-commands.c index 88179c8537..4161b32b02 100644 --- a/app/actions/qmask-commands.c +++ b/app/actions/qmask-commands.c @@ -29,6 +29,7 @@ #include "core/core-types.h" +#include "core/gimp.h" #include "core/gimpchannel.h" #include "core/gimpcontext.h" #include "core/gimpimage.h" @@ -36,6 +37,7 @@ #include "widgets/gimpcolorpanel.h" +#include "app_procs.h" #include "drawable.h" #include "floating_sel.h" #include "gdisplay.h" @@ -238,7 +240,10 @@ qmask_activate (GtkWidget *widget, "Qmask", &color); gimp_image_add_channel (gimg, gmask, 0); - drawable_fill (GIMP_DRAWABLE (gmask), TRANSPARENT_FILL); + + drawable_fill (GIMP_DRAWABLE (gmask), + gimp_get_user_context (gimg->gimp), + TRANSPARENT_FILL); } else { diff --git a/app/actions/quick-mask-commands.c b/app/actions/quick-mask-commands.c index 88179c8537..4161b32b02 100644 --- a/app/actions/quick-mask-commands.c +++ b/app/actions/quick-mask-commands.c @@ -29,6 +29,7 @@ #include "core/core-types.h" +#include "core/gimp.h" #include "core/gimpchannel.h" #include "core/gimpcontext.h" #include "core/gimpimage.h" @@ -36,6 +37,7 @@ #include "widgets/gimpcolorpanel.h" +#include "app_procs.h" #include "drawable.h" #include "floating_sel.h" #include "gdisplay.h" @@ -238,7 +240,10 @@ qmask_activate (GtkWidget *widget, "Qmask", &color); gimp_image_add_channel (gimg, gmask, 0); - drawable_fill (GIMP_DRAWABLE (gmask), TRANSPARENT_FILL); + + drawable_fill (GIMP_DRAWABLE (gmask), + gimp_get_user_context (gimg->gimp), + TRANSPARENT_FILL); } else { diff --git a/app/actions/tools-commands.c b/app/actions/tools-commands.c index fb7129c070..e9c948febf 100644 --- a/app/actions/tools-commands.c +++ b/app/actions/tools-commands.c @@ -42,14 +42,14 @@ void tools_default_colors_cmd_callback (GtkWidget *widget, gpointer data) { - gimp_context_set_default_colors (gimp_context_get_user ()); + gimp_context_set_default_colors (gimp_get_user_context (the_gimp)); } void tools_swap_colors_cmd_callback (GtkWidget *widget, gpointer data) { - gimp_context_swap_colors (gimp_context_get_user ()); + gimp_context_swap_colors (gimp_get_user_context (the_gimp)); } void @@ -61,19 +61,19 @@ tools_swap_contexts_cmd_callback (GtkWidget *widget, if (! swap_context) { - swap_context = gimp_context_new (the_gimp, - "Swap Context", - gimp_context_get_user ()); - temp_context = gimp_context_new (the_gimp, - "Temp Context", - NULL); + swap_context = gimp_create_context (the_gimp, + "Swap Context", + gimp_get_user_context (the_gimp)); + temp_context = gimp_create_context (the_gimp, + "Temp Context", + NULL); } - gimp_context_copy_args (gimp_context_get_user (), + gimp_context_copy_args (gimp_get_user_context (the_gimp), temp_context, GIMP_CONTEXT_ALL_ARGS_MASK); gimp_context_copy_args (swap_context, - gimp_context_get_user (), + gimp_get_user_context (the_gimp), GIMP_CONTEXT_ALL_ARGS_MASK); gimp_context_copy_args (temp_context, swap_context, @@ -91,10 +91,10 @@ tools_select_cmd_callback (GtkWidget *widget, tool_type = (GtkType) action; - tool_info = tool_manager_get_info_by_type (tool_type); + tool_info = tool_manager_get_info_by_type (the_gimp, tool_type); gdisp = gdisplay_active (); - gimp_context_set_tool (gimp_context_get_user (), tool_info); + gimp_context_set_tool (gimp_get_user_context (the_gimp), tool_info); #ifdef __GNUC__ #warning FIXME (let the tool manager to this stuff) diff --git a/app/app_procs.c b/app/app_procs.c index e670ed3927..7953ae0054 100644 --- a/app/app_procs.c +++ b/app/app_procs.c @@ -40,7 +40,7 @@ #include "xcf/xcf.h" -#include "tools/tools.h" +#include "tools/tool_manager.h" #include "gui/color-notebook.h" #include "gui/file-open-dialog.h" @@ -51,7 +51,6 @@ #include "app_procs.h" #include "batch.h" #include "colormaps.h" -#include "context_manager.h" #include "gdisplay.h" #include "gdisplay_ops.h" #include "gimprc.h" @@ -143,8 +142,7 @@ app_init (gint gimp_argc, gtk_object_ref (GTK_OBJECT (the_gimp)); gtk_object_sink (GTK_OBJECT (the_gimp)); - /* Initialize the context system before loading any data */ - context_manager_init (); + tool_manager_init (the_gimp); /* Initialize the procedural database * We need to do this first because any of the init @@ -191,7 +189,7 @@ app_init (gint gimp_argc, if (! no_interface) { - gui_restore (); + gui_restore (the_gimp); } /* Parse the rest of the command line arguments as images to load */ @@ -207,7 +205,7 @@ app_init (gint gimp_argc, if (! no_interface) { - gui_post_init (); + gui_post_init (the_gimp); } } @@ -233,20 +231,19 @@ app_exit_finish (void) if (! no_interface) { - gui_shutdown (); + gui_shutdown (the_gimp); } module_db_free (); gdisplays_delete (); - context_manager_free (); plug_in_kill (); save_unitrc (); - tools_exit (); + tool_manager_exit (the_gimp); if (! no_interface) { - gui_exit (); + gui_exit (the_gimp); } xcf_exit (); @@ -276,7 +273,7 @@ gimp_set_busy (void) /* FIXME: gimp_busy HACK */ gimp_busy = TRUE; - gui_set_busy (); + gui_set_busy (the_gimp); } static gboolean @@ -307,7 +304,7 @@ gimp_set_busy_until_idle (void) void gimp_unset_busy (void) { - gui_unset_busy (); + gui_unset_busy (the_gimp); /* FIXME: gimp_busy HACK */ gimp_busy = FALSE; diff --git a/app/base/base-config.c b/app/base/base-config.c index 6916e08023..95da70399a 100644 --- a/app/base/base-config.c +++ b/app/base/base-config.c @@ -27,12 +27,13 @@ static GimpBaseConfig static_base_config = { - NULL, /* temp_path */ - NULL, /* swap_path */ - 33554432, /* tile_cache_size */ - FALSE, /* stingy_memory_usage */ - LINEAR_INTERPOLATION, /* interpolation_type */ - 1, /* num_processors */ + .temp_path = NULL, + .swap_path = NULL, + + .tile_cache_size = 33554432, + .stingy_memory_use = FALSE, + .interpolation_type = LINEAR_INTERPOLATION, + .num_processors = 1 }; diff --git a/app/base/color-balance.c b/app/base/color-balance.c index dde2c36b7f..dc2da406f2 100644 --- a/app/base/color-balance.c +++ b/app/base/color-balance.c @@ -104,9 +104,10 @@ static GimpImageMapToolClass *parent_class = NULL; /* functions */ void -gimp_color_balance_tool_register (void) +gimp_color_balance_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_COLOR_BALANCE_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_COLOR_BALANCE_TOOL, FALSE, "gimp:color_balance_tool", _("Color Balance"), diff --git a/app/base/color-balance.h b/app/base/color-balance.h index c023214563..3a37ba396c 100644 --- a/app/base/color-balance.h +++ b/app/base/color-balance.h @@ -79,7 +79,7 @@ struct _ColorBalanceDialog }; -void gimp_color_balance_tool_register (void); +void gimp_color_balance_tool_register (Gimp *gimp); GtkType gimp_color_balance_tool_get_type (void); diff --git a/app/base/curves.c b/app/base/curves.c index 477cdc2d3f..a2fba29fe7 100644 --- a/app/base/curves.c +++ b/app/base/curves.c @@ -200,9 +200,10 @@ static CRMatrix CR_basis = /* functions */ void -gimp_curves_tool_register (void) +gimp_curves_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_CURVES_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_CURVES_TOOL, FALSE, "gimp:curves_tool", _("Curves"), diff --git a/app/base/curves.h b/app/base/curves.h index 335149b3df..e760141a27 100644 --- a/app/base/curves.h +++ b/app/base/curves.h @@ -85,7 +85,7 @@ struct _CurvesDialog }; -void gimp_curves_tool_register (void); +void gimp_curves_tool_register (Gimp *gimp); GtkType gimp_curves_tool_get_type (void); diff --git a/app/base/hue-saturation.c b/app/base/hue-saturation.c index 324714a4e7..bcd8b6a48d 100644 --- a/app/base/hue-saturation.c +++ b/app/base/hue-saturation.c @@ -128,9 +128,10 @@ static gint default_colors[6][3] = /* functions */ void -gimp_hue_saturation_tool_register (void) +gimp_hue_saturation_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_HUE_SATURATION_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_HUE_SATURATION_TOOL, FALSE, "gimp:hue_saturation_tool", _("Hue-Saturation"), diff --git a/app/base/hue-saturation.h b/app/base/hue-saturation.h index f3c3b71b14..af8aeda2cb 100644 --- a/app/base/hue-saturation.h +++ b/app/base/hue-saturation.h @@ -80,7 +80,7 @@ struct _HueSaturationDialog }; -void gimp_hue_saturation_tool_register (void); +void gimp_hue_saturation_tool_register (Gimp *gimp); GtkType gimp_hue_saturation_tool_get_type (void); diff --git a/app/base/threshold.c b/app/base/threshold.c index 49755da096..725c8b33af 100644 --- a/app/base/threshold.c +++ b/app/base/threshold.c @@ -111,9 +111,10 @@ static GimpImageMapToolClass *parent_class = NULL; /* functions */ void -gimp_threshold_tool_register (void) +gimp_threshold_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_THRESHOLD_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_THRESHOLD_TOOL, FALSE, "gimp:threshold_tool", _("Threshold"), diff --git a/app/base/threshold.h b/app/base/threshold.h index ace2d979b5..39219ef1ba 100644 --- a/app/base/threshold.h +++ b/app/base/threshold.h @@ -67,7 +67,7 @@ struct _ThresholdDialog }; -void gimp_threshold_tool_register (void); +void gimp_threshold_tool_register (Gimp *gimp); GtkType gimp_threshold_tool_get_type (void); diff --git a/app/context_manager.c b/app/context_manager.c deleted file mode 100644 index f50e5e36ec..0000000000 --- a/app/context_manager.c +++ /dev/null @@ -1,243 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include - -#include "core/core-types.h" - -#include "core/gimp.h" -#include "core/gimpcontext.h" -#include "core/gimplist.h" -#include "core/gimpimage.h" -#include "core/gimptoolinfo.h" - -#include "tools/gimptool.h" -#include "tools/paint_options.h" -#include "tools/tool_manager.h" -#include "tools/tools.h" - -#include "gui/brush-select.h" - -#include "appenv.h" -#include "app_procs.h" -#include "context_manager.h" -#include "gdisplay.h" -#include "gimprc.h" - - -#define PAINT_OPTIONS_MASK GIMP_CONTEXT_OPACITY_MASK | \ - GIMP_CONTEXT_PAINT_MODE_MASK - - -/* - * the global tool context - */ -GimpContext *global_tool_context = NULL; - - - -static void -context_manager_display_changed (GimpContext *context, - GDisplay *display, - gpointer data) -{ - gdisplay_set_menu_sensitivity (display); -} - -static void -context_manager_tool_changed (GimpContext *user_context, - GimpToolInfo *tool_info, - gpointer data) -{ - if (! tool_info) - return; - - /* FIXME: gimp_busy HACK */ - if (gimp_busy) - { - /* there may be contexts waiting for the user_context's "tool_changed" - * signal, so stop emitting it. - */ - gtk_signal_emit_stop_by_name (GTK_OBJECT (user_context), "tool_changed"); - - if (GTK_OBJECT (active_tool)->klass->type != tool_info->tool_type) - { - gtk_signal_handler_block_by_func (GTK_OBJECT (user_context), - context_manager_tool_changed, - NULL); - - /* explicitly set the current tool */ - gimp_context_set_tool (user_context, - tool_manager_get_info_by_tool (active_tool)); - - gtk_signal_handler_unblock_by_func (GTK_OBJECT (user_context), - context_manager_tool_changed, - NULL); - } - } - else - { - GimpTool *new_tool = NULL; - GimpContext *tool_context = NULL; - - if (tool_info->tool_type != GTK_TYPE_NONE) - { - new_tool = gtk_type_new (tool_info->tool_type); - } - else - { - g_warning ("%s(): tool_info contains no valid GtkType", - G_GNUC_FUNCTION); - return; - } - - if (! gimprc.global_paint_options) - { - if (active_tool && - (tool_context = tool_manager_get_info_by_tool (active_tool)->context)) - { - gimp_context_unset_parent (tool_context); - } - - if ((tool_context = tool_info->context)) - { - gimp_context_copy_args (tool_context, user_context, - PAINT_OPTIONS_MASK); - gimp_context_set_parent (tool_context, user_context); - } - } - - tool_manager_select_tool (new_tool); - } -} - -void -context_manager_init (void) -{ - GimpContext *standard_context; - GimpContext *default_context; - GimpContext *user_context; - GimpContext *tool_context; - - /* Implicitly create the standard context */ - standard_context = gimp_context_get_standard (the_gimp); - - /* TODO: load from disk */ - default_context = gimp_context_new (the_gimp, "Default", NULL); - - gimp_context_set_default (default_context); - - /* Initialize the user context with the default context's values */ - user_context = gimp_context_new (default_context->gimp, - "User", default_context); - gimp_context_set_user (user_context); - - /* Update the tear-off menus */ - gtk_signal_connect (GTK_OBJECT (user_context), "display_changed", - GTK_SIGNAL_FUNC (context_manager_display_changed), - NULL); - - /* Update the tool system */ - gtk_signal_connect (GTK_OBJECT (user_context), "tool_changed", - GTK_SIGNAL_FUNC (context_manager_tool_changed), - NULL); - - /* Make the user contect the currently active context */ - gimp_context_set_current (user_context); - - /* Create a context to store the paint options of the - * global paint options mode - */ - global_tool_context = gimp_context_new (user_context->gimp, - "Global Tool Context", user_context); - - /* TODO: add foreground, background, brush, pattern, gradient */ - gimp_context_define_args (global_tool_context, PAINT_OPTIONS_MASK, FALSE); - - /* register internal tools */ - tools_init (); - - if (! gimprc.global_paint_options && active_tool && - (tool_context = tool_manager_get_info_by_tool (active_tool)->context)) - { - gimp_context_set_parent (tool_context, user_context); - } - else if (gimprc.global_paint_options) - { - gimp_context_set_parent (global_tool_context, user_context); - } - - gimp_container_thaw (the_gimp->tool_info_list); -} - -void -context_manager_free (void) -{ - gtk_object_unref (GTK_OBJECT (global_tool_context)); - global_tool_context = NULL; - - gtk_object_unref (GTK_OBJECT (gimp_context_get_user ())); - gimp_context_set_user (NULL); - gimp_context_set_current (NULL); - - /* TODO: Save to disk before destroying */ - gtk_object_unref (GTK_OBJECT (gimp_context_get_default ())); - gimp_context_set_default (NULL); -} - -void -context_manager_set_global_paint_options (gboolean global) -{ - GimpToolInfo *tool_info; - GimpContext *context; - - if (global == gimprc.global_paint_options) - return; - - paint_options_set_global (global); - - /* NULL is the main brush selection */ - brush_select_show_paint_options (NULL, global); - - tool_info = gimp_context_get_tool (gimp_context_get_user ()); - - if (global) - { - if (tool_info && (context = tool_info->context)) - { - gimp_context_unset_parent (context); - } - - gimp_context_copy_args (global_tool_context, gimp_context_get_user (), - PAINT_OPTIONS_MASK); - gimp_context_set_parent (global_tool_context, gimp_context_get_user ()); - } - else - { - gimp_context_unset_parent (global_tool_context); - - if (tool_info && (context = tool_info->context)) - { - gimp_context_copy_args (context, gimp_context_get_user (), - GIMP_CONTEXT_PAINT_ARGS_MASK); - gimp_context_set_parent (context, gimp_context_get_user ()); - } - } -} diff --git a/app/context_manager.h b/app/context_manager.h deleted file mode 100644 index 567108b54d..0000000000 --- a/app/context_manager.h +++ /dev/null @@ -1,35 +0,0 @@ -/* The GIMP -- an image manipulation program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef __CONTEXT_MANAGER_H__ -#define __CONTEXT_MANAGER_H__ - - -/* - * the global tool context - */ -extern GimpContext *global_tool_context; - - -void context_manager_init (void); -void context_manager_free (void); - -void context_manager_set_global_paint_options (gboolean global); - - -#endif /* __CONTEXT_MANAGER_H__ */ diff --git a/app/core/Makefile.am b/app/core/Makefile.am index c788d4a46d..65a6318947 100644 --- a/app/core/Makefile.am +++ b/app/core/Makefile.am @@ -21,6 +21,8 @@ libappcore_a_SOURCES = @STRIP_BEGIN@ \ gimpcontainer.h \ gimpcontext.c \ gimpcontext.h \ + gimpcoreconfig.c \ + gimpcoreconfig.h \ gimpdata.c \ gimpdata.h \ gimpdatafactory.c \ diff --git a/app/core/gimp-transform-region.c b/app/core/gimp-transform-region.c index 7c11e684da..a673dbcffe 100644 --- a/app/core/gimp-transform-region.c +++ b/app/core/gimp-transform-region.c @@ -35,6 +35,7 @@ #include "paint-funcs/paint-funcs.h" +#include "core/gimp.h" #include "core/gimpchannel.h" #include "core/gimpcontext.h" #include "core/gimpdrawable.h" @@ -455,7 +456,7 @@ gimp_transform_tool_button_press (GimpTool *tool, GtkType tool_type; tool_type = - gimp_context_get_tool (gimp_context_get_user ())->tool_type; + gimp_context_get_tool (gimp_get_user_context (gdisp->gimage->gimp))->tool_type; gimp_dialog_create_action_area (GTK_DIALOG (transform_info->shell), diff --git a/app/core/gimp.c b/app/core/gimp.c index 6f33d580c3..ccb0abc379 100644 --- a/app/core/gimp.c +++ b/app/core/gimp.c @@ -33,6 +33,8 @@ #include "gimpbrushgenerated.h" #include "gimpbrushpipe.h" #include "gimpbuffer.h" +#include "gimpcontext.h" +#include "gimpcoreconfig.h" #include "gimpdatafactory.h" #include "gimpgradient.h" #include "gimpimage.h" @@ -46,7 +48,6 @@ #include "app_procs.h" #include "gimage.h" #include "gimpparasite.h" -#include "gimprc.h" #include "libgimp/gimpintl.h" @@ -100,6 +101,8 @@ gimp_class_init (GimpClass *klass) static void gimp_init (Gimp *gimp) { + GimpContext *context; + static const GimpDataFactoryLoaderEntry brush_loader_entries[] = { { gimp_brush_load, GIMP_BRUSH_FILE_EXTENSION }, @@ -135,14 +138,12 @@ gimp_init (Gimp *gimp) gimp->images = gimp_list_new (GIMP_TYPE_IMAGE, GIMP_CONTAINER_POLICY_WEAK); - gtk_object_ref (GTK_OBJECT (gimp->images)); gtk_object_sink (GTK_OBJECT (gimp->images)); gimp->global_buffer = NULL; gimp->named_buffers = gimp_list_new (GIMP_TYPE_BUFFER, GIMP_CONTAINER_POLICY_STRONG); - gtk_object_ref (GTK_OBJECT (gimp->named_buffers)); gtk_object_sink (GTK_OBJECT (gimp->named_buffers)); @@ -150,45 +151,41 @@ gimp_init (Gimp *gimp) gimp->brush_factory = gimp_data_factory_new (GIMP_TYPE_BRUSH, - (const gchar **) &gimprc.brush_path, + (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 **) &gimprc.pattern_path, + (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 **) &gimprc.gradient_path, + (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 **) &gimprc.palette_path, + (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)); @@ -196,11 +193,23 @@ gimp_init (Gimp *gimp) gimp->tool_info_list = gimp_list_new (GIMP_TYPE_TOOL_INFO, GIMP_CONTAINER_POLICY_STRONG); - gtk_object_ref (GTK_OBJECT (gimp->tool_info_list)); gtk_object_sink (GTK_OBJECT (gimp->tool_info_list)); 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); } static void @@ -210,6 +219,17 @@ gimp_destroy (GtkObject *object) gimp = GIMP (object); + gimp_set_current_context (gimp, NULL); + + gimp_set_user_context (gimp, NULL); + gimp_set_default_context (gimp, NULL); + + if (gimp->standard_context) + { + gtk_object_unref (GTK_OBJECT (gimp->standard_context)); + gimp->standard_context = NULL; + } + gimp_image_new_exit (gimp); if (gimp->tool_info_list) @@ -337,14 +357,14 @@ gimp_create_image (Gimp *gimp, gimp_container_add (gimp->images, GIMP_OBJECT (gimage)); - if (attach_comment && gimprc.default_comment) + if (attach_comment && core_config->default_comment) { GimpParasite *parasite; parasite = gimp_parasite_new ("gimp-comment", GIMP_PARASITE_PERSISTENT, - strlen (gimprc.default_comment) + 1, - gimprc.default_comment); + strlen (core_config->default_comment) + 1, + core_config->default_comment); gimp_image_parasite_attach (gimage, parasite); gimp_parasite_free (parasite); } @@ -362,3 +382,70 @@ gimp_create_display (Gimp *gimp, if (gimp->create_display_func) gimp->create_display_func (gimage); } + +GimpContext * +gimp_create_context (Gimp *gimp, + const gchar *name, + GimpContext *template) +{ + GimpContext *context; + + g_return_val_if_fail (gimp != NULL, NULL); + g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); + g_return_val_if_fail (!template || GIMP_IS_CONTEXT (template), NULL); + + /* FIXME: need unique names here */ + if (! name) + name = "Unnamed"; + + context = gimp_context_new (gimp, name, template); + + gimp->context_list = g_list_prepend (gimp->context_list, context); + + return context; +} + +GimpContext * +gimp_get_standard_context (Gimp *gimp) +{ + return gimp->standard_context; +} + +void +gimp_set_default_context (Gimp *gimp, + GimpContext *context) +{ + gimp->default_context = context; +} + +GimpContext * +gimp_get_default_context (Gimp *gimp) +{ + return gimp->default_context; +} + +void +gimp_set_user_context (Gimp *gimp, + GimpContext *context) +{ + gimp->user_context = context; +} + +GimpContext * +gimp_get_user_context (Gimp *gimp) +{ + return gimp->user_context; +} + +void +gimp_set_current_context (Gimp *gimp, + GimpContext *context) +{ + gimp->current_context = context; +} + +GimpContext * +gimp_get_current_context (Gimp *gimp) +{ + return gimp->current_context; +} diff --git a/app/core/gimp.h b/app/core/gimp.h index 04e3100920..3e25b75c0d 100644 --- a/app/core/gimp.h +++ b/app/core/gimp.h @@ -63,6 +63,21 @@ struct _Gimp GList *fill_type_names; GimpImageNewValues image_new_last_values; gboolean have_current_cut_buffer; + + /* the list of all contexts */ + GList *context_list; + + /* the hardcoded standard context */ + GimpContext *standard_context; + + /* the default context which is initialized from gimprc */ + GimpContext *default_context; + + /* the context used by the interface */ + GimpContext *user_context; + + /* the currently active context */ + GimpContext *current_context; }; struct _GimpClass @@ -71,19 +86,38 @@ struct _GimpClass }; -GtkType gimp_get_type (void); -Gimp * gimp_new (void); +GtkType gimp_get_type (void); +Gimp * gimp_new (void); + +void gimp_restore (Gimp *gimp); +void gimp_shutdown (Gimp *gimp); + +GimpImage * gimp_create_image (Gimp *gimp, + gint width, + gint height, + GimpImageBaseType type, + gboolean attach_comment); + +void gimp_create_display (Gimp *gimp, + GimpImage *gimage); + +GimpContext * gimp_create_context (Gimp *gimp, + const gchar *name, + GimpContext *template); + +GimpContext * gimp_get_standard_context (Gimp *gimp); + +void gimp_set_default_context (Gimp *gimp, + GimpContext *context); +GimpContext * gimp_get_default_context (Gimp *gimp); -void gimp_restore (Gimp *gimp); -void gimp_shutdown (Gimp *gimp); +void gimp_set_user_context (Gimp *gimp, + GimpContext *context); +GimpContext * gimp_get_user_context (Gimp *gimp); -GimpImage * gimp_create_image (Gimp *gimp, - gint width, - gint height, - GimpImageBaseType type, - gboolean attach_comment); -void gimp_create_display (Gimp *gimp, - GimpImage *gimage); +void gimp_set_current_context (Gimp *gimp, + GimpContext *context); +GimpContext * gimp_get_current_context (Gimp *gimp); #endif /* __GIMP_H__ */ diff --git a/app/core/gimpbrushpipe-load.c b/app/core/gimpbrushpipe-load.c index 1df04d07e2..1ab927e2c9 100644 --- a/app/core/gimpbrushpipe-load.c +++ b/app/core/gimpbrushpipe-load.c @@ -50,7 +50,6 @@ #include "gimpbrush-header.h" #include "gimpbrushpipe.h" #include "gimppattern-header.h" -#include "gimprc.h" /* this needs to go away */ #include "tools/gimppainttool.h" diff --git a/app/core/gimpbrushpipe.c b/app/core/gimpbrushpipe.c index 1df04d07e2..1ab927e2c9 100644 --- a/app/core/gimpbrushpipe.c +++ b/app/core/gimpbrushpipe.c @@ -50,7 +50,6 @@ #include "gimpbrush-header.h" #include "gimpbrushpipe.h" #include "gimppattern-header.h" -#include "gimprc.h" /* this needs to go away */ #include "tools/gimppainttool.h" diff --git a/app/core/gimpcontext.c b/app/core/gimpcontext.c index eeae895ea7..7f9c6a47f5 100644 --- a/app/core/gimpcontext.c +++ b/app/core/gimpcontext.c @@ -35,6 +35,7 @@ #include "gimpbuffer.h" #include "gimpcontainer.h" #include "gimpcontext.h" +#include "gimpcoreconfig.h" #include "gimpdatafactory.h" #include "gimpgradient.h" #include "gimpimage.h" @@ -44,7 +45,6 @@ #include "gimptoolinfo.h" #include "gdisplay.h" -#include "gimprc.h" typedef void (* GimpContextCopyArgFunc) (GimpContext *src, @@ -59,9 +59,6 @@ typedef void (* GimpContextCopyArgFunc) (GimpContext *src, g_return_val_if_fail ((context) != NULL, (val)); \ g_return_val_if_fail (GIMP_IS_CONTEXT (context), (val)) -#define context_check_current(context) \ - ((context) = (context) ? (context) : current_context) - #define context_find_defined(context,arg_mask) \ while (!(((context)->defined_args) & arg_mask) && (context)->parent) \ (context) = (context)->parent @@ -318,21 +315,6 @@ static guint gimp_context_signals[LAST_SIGNAL] = { 0 }; static GimpObjectClass * parent_class = NULL; -/* the currently active context */ -static GimpContext *current_context = NULL; - -/* the context user by the interface */ -static GimpContext *user_context = NULL; - -/* the default context which is initialized from gimprc */ -static GimpContext *default_context = NULL; - -/* the hardcoded standard context */ -static GimpContext *standard_context = NULL; - -/* the list of all contexts */ -static GSList *context_list = NULL; - /*****************************************************************************/ /* private functions *******************************************************/ @@ -566,8 +548,6 @@ gimp_context_init (GimpContext *context) context->palette_name = NULL; context->buffer = NULL; - - context_list = g_slist_prepend (context_list, context); } static void @@ -580,7 +560,8 @@ gimp_context_destroy (GtkObject *object) if (context->parent) gimp_context_unset_parent (context); - context_list = g_slist_remove (context_list, context); + context->gimp->context_list = g_list_remove (context->gimp->context_list, + context); context->image = NULL; context->display = NULL; @@ -797,16 +778,13 @@ gimp_context_new (Gimp *gimp, g_return_val_if_fail (gimp != NULL, NULL); g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); + g_return_val_if_fail (name != NULL, NULL); g_return_val_if_fail (!template || GIMP_IS_CONTEXT (template), NULL); context = gtk_type_new (GIMP_TYPE_CONTEXT); context->gimp = gimp; - /* FIXME: need unique names here */ - if (! name) - name = "Unnamed"; - gimp_object_set_name (GIMP_OBJECT (context), name); gtk_signal_connect_while_alive (GTK_OBJECT (gimp->images), "remove", @@ -890,68 +868,9 @@ gimp_context_new (Gimp *gimp, return context; } -/*****************************************************************************/ -/* getting/setting the special contexts ************************************/ - -GimpContext * -gimp_context_get_current (void) -{ - return current_context; -} - -void -gimp_context_set_current (GimpContext *context) -{ - current_context = context; -} - -GimpContext * -gimp_context_get_user (void) -{ - return user_context; -} - -void -gimp_context_set_user (GimpContext *context) -{ - user_context = context; -} - -GimpContext * -gimp_context_get_default (void) -{ - return default_context; -} - -void -gimp_context_set_default (GimpContext *context) -{ - default_context = context; -} - -GimpContext * -gimp_context_get_standard (Gimp *gimp) -{ - g_return_val_if_fail (gimp != NULL, NULL); - g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); - - if (! standard_context) - { - standard_context = gimp_context_new (gimp, "Standard", NULL); - - gtk_quit_add_destroy (TRUE, GTK_OBJECT (standard_context)); - } - - return standard_context; -} - -/*****************************************************************************/ -/* functions manipulating a single context *********************************/ - const gchar * gimp_context_get_name (const GimpContext *context) { - context_check_current (context); context_return_val_if_fail (context, NULL); return gimp_object_get_name (GIMP_OBJECT (context)); @@ -961,7 +880,6 @@ void gimp_context_set_name (GimpContext *context, const gchar *name) { - context_check_current (context); context_return_if_fail (context); if (! name) @@ -973,7 +891,6 @@ gimp_context_set_name (GimpContext *context, GimpContext * gimp_context_get_parent (const GimpContext *context) { - context_check_current (context); context_return_val_if_fail (context, NULL); return context->parent; @@ -985,7 +902,6 @@ gimp_context_set_parent (GimpContext *context, { GimpContextArgType arg; - context_check_current (context); context_return_if_fail (context); g_return_if_fail (!parent || GIMP_IS_CONTEXT (parent)); @@ -1008,7 +924,6 @@ gimp_context_set_parent (GimpContext *context, void gimp_context_unset_parent (GimpContext *context) { - context_check_current (context); context_return_if_fail (context); if (context->parent) @@ -1029,7 +944,6 @@ gimp_context_define_arg (GimpContext *context, { GimpContextArgMask mask; - context_check_current (context); context_return_if_fail (context); g_return_if_fail ((arg >= 0) && (arg < GIMP_CONTEXT_NUM_ARGS)); @@ -1067,7 +981,6 @@ gboolean gimp_context_arg_defined (GimpContext *context, GimpContextArgType arg) { - context_check_current (context); context_return_val_if_fail (context, FALSE); return (context->defined_args & (1 << arg)) ? TRUE : FALSE; @@ -1080,7 +993,6 @@ gimp_context_define_args (GimpContext *context, { GimpContextArgType arg; - context_check_current (context); context_return_if_fail (context); for (arg = 0; arg < GIMP_CONTEXT_NUM_ARGS; arg++) @@ -1095,9 +1007,7 @@ gimp_context_copy_arg (GimpContext *src, GimpContext *dest, GimpContextArgType arg) { - context_check_current (src); context_return_if_fail (src); - context_check_current (dest); context_return_if_fail (dest); g_return_if_fail ((arg >= 0) && (arg < GIMP_CONTEXT_NUM_ARGS)); @@ -1111,9 +1021,7 @@ gimp_context_copy_args (GimpContext *src, { GimpContextArgType arg; - context_check_current (src); context_return_if_fail (src); - context_check_current (dest); context_return_if_fail (dest); for (arg = 0; arg < GIMP_CONTEXT_NUM_ARGS; arg++) @@ -1163,7 +1071,6 @@ gimp_context_get_by_type (GimpContext *context, GimpContextArgType arg; GimpObject *object = NULL; - context_check_current (context); context_return_val_if_fail (context, NULL); g_return_val_if_fail ((arg = gimp_context_type_to_arg (type)) != -1, NULL); @@ -1181,7 +1088,6 @@ gimp_context_set_by_type (GimpContext *context, { GimpContextArgType arg; - context_check_current (context); context_return_if_fail (context); g_return_if_fail ((arg = gimp_context_type_to_arg (type)) != -1); @@ -1197,7 +1103,6 @@ gimp_context_changed_by_type (GimpContext *context, GimpContextArgType arg; GimpObject *object; - context_check_current (context); context_return_if_fail (context); g_return_if_fail ((arg = gimp_context_type_to_arg (type)) != -1); @@ -1214,7 +1119,6 @@ gimp_context_changed_by_type (GimpContext *context, GimpImage * gimp_context_get_image (GimpContext *context) { - context_check_current (context); context_return_val_if_fail (context, NULL); return context->image; @@ -1224,7 +1128,6 @@ void gimp_context_set_image (GimpContext *context, GimpImage *image) { - context_check_current (context); context_return_if_fail (context); context_find_defined (context, GIMP_CONTEXT_IMAGE_MASK); @@ -1234,7 +1137,6 @@ gimp_context_set_image (GimpContext *context, void gimp_context_image_changed (GimpContext *context) { - context_check_current (context); context_return_if_fail (context); gtk_signal_emit (GTK_OBJECT (context), @@ -1277,7 +1179,6 @@ gimp_context_copy_image (GimpContext *src, GDisplay * gimp_context_get_display (GimpContext *context) { - context_check_current (context); context_return_val_if_fail (context, NULL); return context->display; @@ -1287,7 +1188,6 @@ void gimp_context_set_display (GimpContext *context, GDisplay *display) { - context_check_current (context); context_return_if_fail (context); context_find_defined (context, GIMP_CONTEXT_DISPLAY_MASK); @@ -1297,7 +1197,6 @@ gimp_context_set_display (GimpContext *context, void gimp_context_display_changed (GimpContext *context) { - context_check_current (context); context_return_if_fail (context); gtk_signal_emit (GTK_OBJECT (context), @@ -1358,7 +1257,6 @@ gimp_context_get_tool (GimpContext *context) { g_return_val_if_fail (! context || GIMP_IS_CONTEXT (context), NULL); - context_check_current (context); context_return_val_if_fail (context, NULL); return context->tool_info; @@ -1371,7 +1269,6 @@ gimp_context_set_tool (GimpContext *context, g_return_if_fail (! context || GIMP_IS_CONTEXT (context)); g_return_if_fail (! tool_info || GIMP_IS_TOOL_INFO (tool_info)); - context_check_current (context); context_return_if_fail (context); context_find_defined (context, GIMP_CONTEXT_TOOL_MASK); @@ -1383,7 +1280,6 @@ gimp_context_tool_changed (GimpContext *context) { g_return_if_fail (! context || GIMP_IS_CONTEXT (context)); - context_check_current (context); context_return_if_fail (context); gtk_signal_emit (GTK_OBJECT (context), @@ -1514,7 +1410,6 @@ void gimp_context_get_foreground (GimpContext *context, GimpRGB *color) { - context_check_current (context); context_return_if_fail (context); g_return_if_fail (color != NULL); @@ -1526,7 +1421,6 @@ void gimp_context_set_foreground (GimpContext *context, const GimpRGB *color) { - context_check_current (context); context_return_if_fail (context); context_find_defined (context, GIMP_CONTEXT_FOREGROUND_MASK); @@ -1538,7 +1432,6 @@ gimp_context_set_foreground (GimpContext *context, void gimp_context_foreground_changed (GimpContext *context) { - context_check_current (context); context_return_if_fail (context); gtk_signal_emit (GTK_OBJECT (context), @@ -1572,7 +1465,6 @@ void gimp_context_get_background (GimpContext *context, GimpRGB *color) { - context_check_current (context); context_return_if_fail (context); g_return_if_fail (color != NULL); @@ -1584,7 +1476,6 @@ void gimp_context_set_background (GimpContext *context, const GimpRGB *color) { - context_check_current (context); context_return_if_fail (context); context_find_defined (context, GIMP_CONTEXT_BACKGROUND_MASK); @@ -1596,7 +1487,6 @@ gimp_context_set_background (GimpContext *context, void gimp_context_background_changed (GimpContext *context) { - context_check_current (context); context_return_if_fail (context); gtk_signal_emit (GTK_OBJECT (context), @@ -1635,7 +1525,6 @@ gimp_context_set_default_colors (GimpContext *context) bg_context = context; - context_check_current (context); context_return_if_fail (context); context_find_defined (context, GIMP_CONTEXT_FOREGROUND_MASK); context_find_defined (bg_context, GIMP_CONTEXT_BACKGROUND_MASK); @@ -1656,7 +1545,6 @@ gimp_context_swap_colors (GimpContext *context) bg_context = context; - context_check_current (context); context_return_if_fail (context); context_find_defined (context, GIMP_CONTEXT_FOREGROUND_MASK); context_find_defined (bg_context, GIMP_CONTEXT_BACKGROUND_MASK); @@ -1674,7 +1562,6 @@ gimp_context_swap_colors (GimpContext *context) gdouble gimp_context_get_opacity (GimpContext *context) { - context_check_current (context); context_return_val_if_fail (context, 1.0); return context->opacity; @@ -1684,7 +1571,6 @@ void gimp_context_set_opacity (GimpContext *context, gdouble opacity) { - context_check_current (context); context_return_if_fail (context); context_find_defined (context, GIMP_CONTEXT_OPACITY_MASK); @@ -1694,7 +1580,6 @@ gimp_context_set_opacity (GimpContext *context, void gimp_context_opacity_changed (GimpContext *context) { - context_check_current (context); context_return_if_fail (context); gtk_signal_emit (GTK_OBJECT (context), @@ -1728,7 +1613,6 @@ gimp_context_get_paint_mode (GimpContext *context) { g_return_val_if_fail (! context || GIMP_IS_CONTEXT (context), NORMAL_MODE); - context_check_current (context); context_return_val_if_fail (context, 0); return context->paint_mode; @@ -1740,7 +1624,6 @@ gimp_context_set_paint_mode (GimpContext *context, { g_return_if_fail (! context || GIMP_IS_CONTEXT (context)); - context_check_current (context); context_return_if_fail (context); context_find_defined (context, GIMP_CONTEXT_PAINT_MODE_MASK); @@ -1752,7 +1635,6 @@ gimp_context_paint_mode_changed (GimpContext *context) { g_return_if_fail (! context || GIMP_IS_CONTEXT (context)); - context_check_current (context); context_return_if_fail (context); gtk_signal_emit (GTK_OBJECT (context), @@ -1788,7 +1670,6 @@ gimp_context_get_brush (GimpContext *context) { g_return_val_if_fail (! context || GIMP_IS_CONTEXT (context), NULL); - context_check_current (context); context_return_val_if_fail (context, NULL); return context->brush; @@ -1801,7 +1682,6 @@ gimp_context_set_brush (GimpContext *context, g_return_if_fail (! context || GIMP_IS_CONTEXT (context)); g_return_if_fail (! brush || GIMP_IS_BRUSH (brush)); - context_check_current (context); context_return_if_fail (context); context_find_defined (context, GIMP_CONTEXT_BRUSH_MASK); @@ -1813,7 +1693,6 @@ gimp_context_brush_changed (GimpContext *context) { g_return_if_fail (! context || GIMP_IS_CONTEXT (context)); - context_check_current (context); context_return_if_fail (context); gtk_signal_emit (GTK_OBJECT (context), @@ -1840,7 +1719,7 @@ gimp_context_brush_list_thaw (GimpContainer *container, GimpBrush *brush; if (! context->brush_name) - context->brush_name = g_strdup (gimprc.default_brush); + context->brush_name = g_strdup (core_config->default_brush); if ((brush = (GimpBrush *) gimp_container_get_child_by_name (container, @@ -1960,7 +1839,6 @@ static GimpPattern *standard_pattern = NULL; GimpPattern * gimp_context_get_pattern (GimpContext *context) { - context_check_current (context); context_return_val_if_fail (context, NULL); return context->pattern; @@ -1970,7 +1848,6 @@ void gimp_context_set_pattern (GimpContext *context, GimpPattern *pattern) { - context_check_current (context); context_return_if_fail (context); context_find_defined (context, GIMP_CONTEXT_PATTERN_MASK); @@ -1980,7 +1857,6 @@ gimp_context_set_pattern (GimpContext *context, void gimp_context_pattern_changed (GimpContext *context) { - context_check_current (context); context_return_if_fail (context); gtk_signal_emit (GTK_OBJECT (context), @@ -2007,7 +1883,7 @@ gimp_context_pattern_list_thaw (GimpContainer *container, GimpPattern *pattern; if (! context->pattern_name) - context->pattern_name = g_strdup (gimprc.default_pattern); + context->pattern_name = g_strdup (core_config->default_pattern); if ((pattern = (GimpPattern *) gimp_container_get_child_by_name (container, @@ -2125,7 +2001,6 @@ static GimpGradient *standard_gradient = NULL; GimpGradient * gimp_context_get_gradient (GimpContext *context) { - context_check_current (context); context_return_val_if_fail (context, NULL); return context->gradient; @@ -2135,7 +2010,6 @@ void gimp_context_set_gradient (GimpContext *context, GimpGradient *gradient) { - context_check_current (context); context_return_if_fail (context); context_find_defined (context, GIMP_CONTEXT_GRADIENT_MASK); @@ -2145,7 +2019,6 @@ gimp_context_set_gradient (GimpContext *context, void gimp_context_gradient_changed (GimpContext *context) { - context_check_current (context); context_return_if_fail (context); gtk_signal_emit (GTK_OBJECT (context), @@ -2172,7 +2045,7 @@ gimp_context_gradient_list_thaw (GimpContainer *container, GimpGradient *gradient; if (! context->gradient_name) - context->gradient_name = g_strdup (gimprc.default_gradient); + context->gradient_name = g_strdup (core_config->default_gradient); if ((gradient = (GimpGradient *) gimp_container_get_child_by_name (container, @@ -2275,7 +2148,6 @@ static GimpPalette *standard_palette = NULL; GimpPalette * gimp_context_get_palette (GimpContext *context) { - context_check_current (context); context_return_val_if_fail (context, NULL); return context->palette; @@ -2285,7 +2157,6 @@ void gimp_context_set_palette (GimpContext *context, GimpPalette *palette) { - context_check_current (context); context_return_if_fail (context); context_find_defined (context, GIMP_CONTEXT_PALETTE_MASK); @@ -2295,7 +2166,6 @@ gimp_context_set_palette (GimpContext *context, void gimp_context_palette_changed (GimpContext *context) { - context_check_current (context); context_return_if_fail (context); gtk_signal_emit (GTK_OBJECT (context), @@ -2322,7 +2192,7 @@ gimp_context_palette_list_thaw (GimpContainer *container, GimpPalette *palette; if (! context->palette_name) - context->palette_name = g_strdup (gimprc.default_palette); + context->palette_name = g_strdup (core_config->default_palette); if ((palette = (GimpPalette *) gimp_container_get_child_by_name (container, @@ -2426,7 +2296,6 @@ static GimpBuffer *standard_buffer = NULL; GimpBuffer * gimp_context_get_buffer (GimpContext *context) { - context_check_current (context); context_return_val_if_fail (context, NULL); return context->buffer; @@ -2436,7 +2305,6 @@ void gimp_context_set_buffer (GimpContext *context, GimpBuffer *buffer) { - context_check_current (context); context_return_if_fail (context); context_find_defined (context, GIMP_CONTEXT_BUFFER_MASK); @@ -2446,7 +2314,6 @@ gimp_context_set_buffer (GimpContext *context, void gimp_context_buffer_changed (GimpContext *context) { - context_check_current (context); context_return_if_fail (context); gtk_signal_emit (GTK_OBJECT (context), @@ -2476,7 +2343,7 @@ gimp_context_buffer_list_thaw (GimpContainer *container, GimpBuffer *buffer; if (! context->buffer_name) - context->buffer_name = g_strdup (gimprc.default_buffer); + context->buffer_name = g_strdup (core_config->default_buffer); if ((buffer = (GimpBuffer *) gimp_container_get_child_by_name (container, diff --git a/app/core/gimpcontext.h b/app/core/gimpcontext.h index a98160a8a0..c1dd4a15df 100644 --- a/app/core/gimpcontext.h +++ b/app/core/gimpcontext.h @@ -26,12 +26,6 @@ #include "gimpobject.h" -#define GIMP_TYPE_CONTEXT (gimp_context_get_type ()) -#define GIMP_CONTEXT(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_CONTEXT, GimpContext)) -#define GIMP_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_CAST (klass, GIMP_TYPE_CONTEXT, GimpContextClass)) -#define GIMP_IS_CONTEXT(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_CONTEXT)) -#define GIMP_IS_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CONTEXT)) - typedef enum { GIMP_CONTEXT_ARG_IMAGE, @@ -80,6 +74,14 @@ typedef enum GIMP_CONTEXT_PAINT_ARGS_MASK) } GimpContextArgMask; + +#define GIMP_TYPE_CONTEXT (gimp_context_get_type ()) +#define GIMP_CONTEXT(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_CONTEXT, GimpContext)) +#define GIMP_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_CAST (klass, GIMP_TYPE_CONTEXT, GimpContextClass)) +#define GIMP_IS_CONTEXT(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_CONTEXT)) +#define GIMP_IS_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CONTEXT)) + + typedef struct _GimpContextClass GimpContextClass; struct _GimpContext @@ -151,38 +153,13 @@ struct _GimpContextClass GimpBuffer *buffer); }; -GtkType gimp_context_get_type (void); -GimpContext * gimp_context_new (Gimp *gimp, - const gchar *name, - GimpContext *template); - -/* TODO: - gimp_context_find () - * - * probably interacting with the context manager: - * - gimp_context_push () which will call gimp_context_set_parent() - * - gimp_context_push_new () to do a GL-style push - * - gimp_context_pop () - * - * a proper mechanism to prevent silly operations like pushing - * the user context to some client stack etc. - */ - -/* to be used by the context management system only - */ -void gimp_context_set_current (GimpContext *context); -void gimp_context_set_user (GimpContext *context); -void gimp_context_set_default (GimpContext *context); +GtkType gimp_context_get_type (void); -/* these are always available - */ -GimpContext * gimp_context_get_current (void); -GimpContext * gimp_context_get_user (void); -GimpContext * gimp_context_get_default (void); -GimpContext * gimp_context_get_standard (Gimp *gimp); +GimpContext * gimp_context_new (Gimp *gimp, + const gchar *name, + GimpContext *template); -/* functions for manipulating a single context - */ const gchar * gimp_context_get_name (const GimpContext *context); void gimp_context_set_name (GimpContext *context, const gchar *name); diff --git a/app/core/gimpcoreconfig.c b/app/core/gimpcoreconfig.c new file mode 100644 index 0000000000..eaafc41ae9 --- /dev/null +++ b/app/core/gimpcoreconfig.c @@ -0,0 +1,59 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "core-types.h" + +#include "gimpcoreconfig.h" + + +static GimpCoreConfig static_core_config = +{ + /* plug_in_path */ NULL, + /* module_path */ NULL, + + /* brush_path */ NULL, + /* pattern_path */ NULL, + /* palette_path */ NULL, + /* gradient_path */ NULL, + + /* default_brush */ NULL, + /* default_pattern */ NULL, + /* default_palette */ NULL, + /* default_gradient */ NULL, + + /* default_comment */ NULL, + /* default_type */ RGB, + /* default_width */ 256, + /* default_height */ 256, + /* default_units */ GIMP_UNIT_INCH, + /* default_xresolution */ 72.0, + /* default_yresolution */ 72.0, + /* default_resolution_units */ GIMP_UNIT_INCH, + + /* levels_of_undo */ 5, + /* pluginrc_path */ NULL, + /* module_db_load_inhibit */ NULL, + /* thumbnail_mode */ 1 +}; + + +GimpCoreConfig *core_config = &static_core_config; diff --git a/app/core/gimpcoreconfig.h b/app/core/gimpcoreconfig.h new file mode 100644 index 0000000000..c50060a9a7 --- /dev/null +++ b/app/core/gimpcoreconfig.h @@ -0,0 +1,59 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __GIMP_CORE_CONFIG_H__ +#define __GIMP_CORE_CONFIG_H__ + + +typedef struct _GimpCoreConfig GimpCoreConfig; + +struct _GimpCoreConfig +{ + gchar *plug_in_path; + gchar *module_path; + + gchar *brush_path; + gchar *pattern_path; + gchar *palette_path; + gchar *gradient_path; + + gchar *default_brush; + gchar *default_pattern; + gchar *default_palette; + gchar *default_gradient; + + gchar *default_comment; + GimpImageBaseType default_type; + gint default_width; + gint default_height; + GimpUnit default_units; + gdouble default_xresolution; + gdouble default_yresolution; + GimpUnit default_resolution_units; + + gint levels_of_undo; + gchar *pluginrc_path; + gchar *module_db_load_inhibit; + gint thumbnail_mode; +}; + + +extern GimpCoreConfig *core_config; + + +#endif /* __GIMP_CORE_CONFIG_H__ */ diff --git a/app/core/gimpdrawable-blend.c b/app/core/gimpdrawable-blend.c index f5e53cdfd3..ffc371d346 100644 --- a/app/core/gimpdrawable-blend.c +++ b/app/core/gimpdrawable-blend.c @@ -35,6 +35,7 @@ #include "paint-funcs/paint-funcs.h" +#include "core/gimp.h" #include "core/gimpcontext.h" #include "core/gimpdrawable.h" #include "core/gimpgradient.h" @@ -108,14 +109,15 @@ struct _BlendOptions typedef struct { - gdouble offset; - gdouble sx, sy; - BlendMode blend_mode; - GradientType gradient_type; - GimpRGB fg, bg; - gdouble dist; - gdouble vec[2]; - RepeatFunc repeat_func; + GimpGradient *gradient; + gdouble offset; + gdouble sx, sy; + BlendMode blend_mode; + GradientType gradient_type; + GimpRGB fg, bg; + gdouble dist; + gdouble vec[2]; + RepeatFunc repeat_func; } RenderBlendData; typedef struct @@ -272,9 +274,10 @@ static guint blend_n_targets = (sizeof (blend_target_table) / void -gimp_blend_tool_register (void) +gimp_blend_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_BLEND_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_BLEND_TOOL, TRUE, "gimp:blend_tool", _("Blend"), @@ -480,9 +483,9 @@ gimp_blend_tool_button_release (GimpTool *tool, blend (gimage, gimp_image_active_drawable (gimage), blend_options->blend_mode, - gimp_context_get_paint_mode (NULL), + gimp_context_get_paint_mode (gimp_get_current_context (gimage->gimp)), blend_options->gradient_type, - gimp_context_get_opacity (NULL) * 100, + gimp_context_get_opacity (gimp_get_current_context (gimage->gimp)) * 100, blend_options->offset, blend_options->repeat, blend_options->supersample, @@ -875,7 +878,8 @@ blend_options_drop_gradient (GtkWidget *widget, options = (BlendOptions *) data; - gimp_context_set_gradient (gimp_context_get_user (), GIMP_GRADIENT (viewable)); + gimp_context_set_gradient (gimp_get_user_context (the_gimp), + GIMP_GRADIENT (viewable)); gtk_option_menu_set_history (GTK_OPTION_MENU (options->blend_mode_w), CUSTOM_MODE); @@ -887,7 +891,8 @@ blend_options_drop_tool (GtkWidget *widget, GimpViewable *viewable, gpointer data) { - gimp_context_set_tool (gimp_context_get_user (), GIMP_TOOL_INFO (viewable)); + gimp_context_set_tool (gimp_get_user_context (the_gimp), + GIMP_TOOL_INFO (viewable)); } @@ -1474,8 +1479,7 @@ gradient_render_pixel (double x, if (rbd->blend_mode == CUSTOM_MODE) { - gimp_gradient_get_color_at (gimp_context_get_gradient (NULL), - factor, color); + gimp_gradient_get_color_at (rbd->gradient, factor, color); } else { @@ -1554,14 +1558,19 @@ gradient_fill_region (GimpImage *gimage, gpointer *pr; guchar *data; GimpRGB color; + GimpContext *context; + + context = gimp_get_current_context (gimage->gimp); + + rbd.gradient = gimp_context_get_gradient (context); /* Get foreground and background colors, normalized */ - gimp_context_get_foreground (NULL, &rbd.fg); + gimp_context_get_foreground (context, &rbd.fg); /* rbd.fg.a = 1.0; */ /* Foreground is always opaque */ - gimp_context_get_background (NULL, &rbd.bg); + gimp_context_get_background (context, &rbd.bg); /* rbd.bg.a = 1.0; */ /* opaque, for now */ diff --git a/app/core/gimpdrawable-offset.c b/app/core/gimpdrawable-offset.c index 7e59aadf1b..02f41f0097 100644 --- a/app/core/gimpdrawable-offset.c +++ b/app/core/gimpdrawable-offset.c @@ -32,12 +32,14 @@ #include "paint-funcs/paint-funcs.h" -#include "drawable.h" +#include "gimp.h" #include "gimpcontext.h" #include "gimpdrawable.h" #include "gimpdrawable-offset.h" #include "gimpimage.h" +#include "drawable.h" + void gimp_drawable_offset (GimpDrawable *drawable, @@ -224,9 +226,12 @@ gimp_drawable_offset (GimpDrawable *drawable, { if (fill_type == OFFSET_BACKGROUND) { - GimpRGB color; + Gimp *gimp; + GimpRGB color; + + gimp = gimp_drawable_gimage (drawable)->gimp; - gimp_context_get_background (NULL, &color); + gimp_context_get_background (gimp_get_current_context (gimp), &color); gimp_rgb_get_uchar (&color, &fill[0], &fill[1], &fill[2]); diff --git a/app/core/gimpdrawable-transform.c b/app/core/gimpdrawable-transform.c index 7c11e684da..a673dbcffe 100644 --- a/app/core/gimpdrawable-transform.c +++ b/app/core/gimpdrawable-transform.c @@ -35,6 +35,7 @@ #include "paint-funcs/paint-funcs.h" +#include "core/gimp.h" #include "core/gimpchannel.h" #include "core/gimpcontext.h" #include "core/gimpdrawable.h" @@ -455,7 +456,7 @@ gimp_transform_tool_button_press (GimpTool *tool, GtkType tool_type; tool_type = - gimp_context_get_tool (gimp_context_get_user ())->tool_type; + gimp_context_get_tool (gimp_get_user_context (gdisp->gimage->gimp))->tool_type; gimp_dialog_create_action_area (GTK_DIALOG (transform_info->shell), diff --git a/app/core/gimpgradient.c b/app/core/gimpgradient.c index 0c0861f30f..b2b45327f9 100644 --- a/app/core/gimpgradient.c +++ b/app/core/gimpgradient.c @@ -36,7 +36,6 @@ #include "gimpgradient.h" #include "errors.h" -#include "gimprc.h" #include "libgimp/gimpintl.h" diff --git a/app/core/gimpimage-duplicate.c b/app/core/gimpimage-duplicate.c index e75de1d21a..7156e041b6 100644 --- a/app/core/gimpimage-duplicate.c +++ b/app/core/gimpimage-duplicate.c @@ -34,6 +34,7 @@ /* FIXME: remove the Path <-> BezierSelect dependency */ #include "tools/tools-types.h" +#include "gimp.h" #include "gimpchannel.h" #include "gimpcontext.h" #include "gimpimage.h" diff --git a/app/core/gimpimage-guides.c b/app/core/gimpimage-guides.c index 3d09a28b9c..708fd3d3e6 100644 --- a/app/core/gimpimage-guides.c +++ b/app/core/gimpimage-guides.c @@ -40,6 +40,7 @@ #include "gimp.h" #include "gimpcontext.h" +#include "gimpcoreconfig.h" #include "gimpimage.h" #include "gimpimage-colorhash.h" #include "gimpimage-mask.h" @@ -55,7 +56,6 @@ #include "drawable.h" #include "floating_sel.h" #include "gdisplay.h" -#include "gimprc.h" #include "parasitelist.h" #include "path.h" #include "undo.h" @@ -394,9 +394,9 @@ gimp_image_init (GimpImage *gimage) gimage->width = 0; gimage->height = 0; - gimage->xresolution = gimprc.default_xresolution; - gimage->yresolution = gimprc.default_yresolution; - gimage->unit = gimprc.default_units; + gimage->xresolution = core_config->default_xresolution; + gimage->yresolution = core_config->default_yresolution; + gimage->unit = core_config->default_units; gimage->base_type = RGB; gimage->cmap = NULL; @@ -1294,7 +1294,7 @@ gimp_image_get_foreground (const GimpImage *gimage, GimpRGB color; guchar pfg[3]; - gimp_context_get_foreground (NULL, &color); + gimp_context_get_foreground (gimp_get_current_context (gimage->gimp), &color); gimp_rgb_get_uchar (&color, &pfg[0], &pfg[1], &pfg[2]); @@ -1310,7 +1310,7 @@ gimp_image_get_background (const GimpImage *gimage, guchar pbg[3]; /* Get the palette color */ - gimp_context_get_background (NULL, &color); + gimp_context_get_background (gimp_get_current_context (gimage->gimp), &color); gimp_rgb_get_uchar (&color, &pbg[0], &pbg[1], &pbg[2]); diff --git a/app/core/gimpimage-mask.c b/app/core/gimpimage-mask.c index 1c215bf175..0e09d0f567 100644 --- a/app/core/gimpimage-mask.c +++ b/app/core/gimpimage-mask.c @@ -41,7 +41,6 @@ #include "drawable.h" #include "floating_sel.h" #include "gdisplay.h" -#include "gimprc.h" #include "undo.h" #include "pdb/procedural_db.h" @@ -639,7 +638,7 @@ gimage_mask_stroke (GimpImage *gimage, /* Stroke with the correct tool */ return_vals = procedural_db_run_proc (gimage->gimp, - tool_manager_active_get_PDB_string (), + tool_manager_active_get_PDB_string (gimage->gimp), &nreturn_vals, GIMP_PDB_DRAWABLE, gimp_drawable_get_ID (drawable), GIMP_PDB_INT32, (gint32) cpnt, diff --git a/app/core/gimpimage-merge.c b/app/core/gimpimage-merge.c index 3d09a28b9c..708fd3d3e6 100644 --- a/app/core/gimpimage-merge.c +++ b/app/core/gimpimage-merge.c @@ -40,6 +40,7 @@ #include "gimp.h" #include "gimpcontext.h" +#include "gimpcoreconfig.h" #include "gimpimage.h" #include "gimpimage-colorhash.h" #include "gimpimage-mask.h" @@ -55,7 +56,6 @@ #include "drawable.h" #include "floating_sel.h" #include "gdisplay.h" -#include "gimprc.h" #include "parasitelist.h" #include "path.h" #include "undo.h" @@ -394,9 +394,9 @@ gimp_image_init (GimpImage *gimage) gimage->width = 0; gimage->height = 0; - gimage->xresolution = gimprc.default_xresolution; - gimage->yresolution = gimprc.default_yresolution; - gimage->unit = gimprc.default_units; + gimage->xresolution = core_config->default_xresolution; + gimage->yresolution = core_config->default_yresolution; + gimage->unit = core_config->default_units; gimage->base_type = RGB; gimage->cmap = NULL; @@ -1294,7 +1294,7 @@ gimp_image_get_foreground (const GimpImage *gimage, GimpRGB color; guchar pfg[3]; - gimp_context_get_foreground (NULL, &color); + gimp_context_get_foreground (gimp_get_current_context (gimage->gimp), &color); gimp_rgb_get_uchar (&color, &pfg[0], &pfg[1], &pfg[2]); @@ -1310,7 +1310,7 @@ gimp_image_get_background (const GimpImage *gimage, guchar pbg[3]; /* Get the palette color */ - gimp_context_get_background (NULL, &color); + gimp_context_get_background (gimp_get_current_context (gimage->gimp), &color); gimp_rgb_get_uchar (&color, &pbg[0], &pbg[1], &pbg[2]); diff --git a/app/core/gimpimage-new.c b/app/core/gimpimage-new.c index be7aab1232..a43c5d6b11 100644 --- a/app/core/gimpimage-new.c +++ b/app/core/gimpimage-new.c @@ -29,13 +29,13 @@ #include "paint-funcs/paint-funcs.h" #include "gimp.h" +#include "gimpcoreconfig.h" #include "gimpdrawable.h" #include "gimpimage.h" #include "gimpimage-new.h" #include "gimplayer.h" #include "drawable.h" -#include "gimprc.h" #include "libgimp/gimpintl.h" @@ -90,13 +90,13 @@ gimp_image_new_init (Gimp *gimp) /* Set the last values used to default values. */ - gimp->image_new_last_values.width = gimprc.default_width; - gimp->image_new_last_values.height = gimprc.default_height; - gimp->image_new_last_values.unit = gimprc.default_units; - gimp->image_new_last_values.xresolution = gimprc.default_xresolution; - gimp->image_new_last_values.yresolution = gimprc.default_yresolution; - gimp->image_new_last_values.res_unit = gimprc.default_resolution_units; - gimp->image_new_last_values.type = gimprc.default_type; + gimp->image_new_last_values.width = core_config->default_width; + gimp->image_new_last_values.height = core_config->default_height; + gimp->image_new_last_values.unit = core_config->default_units; + gimp->image_new_last_values.xresolution = core_config->default_xresolution; + gimp->image_new_last_values.yresolution = core_config->default_yresolution; + gimp->image_new_last_values.res_unit = core_config->default_resolution_units; + gimp->image_new_last_values.type = core_config->default_type; gimp->image_new_last_values.fill_type = BACKGROUND_FILL; gimp->have_current_cut_buffer = FALSE; @@ -271,7 +271,9 @@ gimp_image_new_create_image (Gimp *gimp, gimp_image_add_layer (gimage, layer, 0); gimp_image_undo_enable (gimage); - drawable_fill (GIMP_DRAWABLE (layer), values->fill_type); + drawable_fill (GIMP_DRAWABLE (layer), + gimp_get_current_context (gimp), + values->fill_type); gimp_image_clean_all (gimage); diff --git a/app/core/gimpimage-pick-color.c b/app/core/gimpimage-pick-color.c index 24d2a04558..954449c8ab 100644 --- a/app/core/gimpimage-pick-color.c +++ b/app/core/gimpimage-pick-color.c @@ -151,9 +151,10 @@ static GimpDrawToolClass *parent_class = NULL; void -gimp_color_picker_tool_register (void) +gimp_color_picker_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_COLOR_PICKER_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_COLOR_PICKER_TOOL, FALSE, "gimp:color_picker_tool", _("Color Picker"), diff --git a/app/core/gimpimage-projection.c b/app/core/gimpimage-projection.c index 3d09a28b9c..708fd3d3e6 100644 --- a/app/core/gimpimage-projection.c +++ b/app/core/gimpimage-projection.c @@ -40,6 +40,7 @@ #include "gimp.h" #include "gimpcontext.h" +#include "gimpcoreconfig.h" #include "gimpimage.h" #include "gimpimage-colorhash.h" #include "gimpimage-mask.h" @@ -55,7 +56,6 @@ #include "drawable.h" #include "floating_sel.h" #include "gdisplay.h" -#include "gimprc.h" #include "parasitelist.h" #include "path.h" #include "undo.h" @@ -394,9 +394,9 @@ gimp_image_init (GimpImage *gimage) gimage->width = 0; gimage->height = 0; - gimage->xresolution = gimprc.default_xresolution; - gimage->yresolution = gimprc.default_yresolution; - gimage->unit = gimprc.default_units; + gimage->xresolution = core_config->default_xresolution; + gimage->yresolution = core_config->default_yresolution; + gimage->unit = core_config->default_units; gimage->base_type = RGB; gimage->cmap = NULL; @@ -1294,7 +1294,7 @@ gimp_image_get_foreground (const GimpImage *gimage, GimpRGB color; guchar pfg[3]; - gimp_context_get_foreground (NULL, &color); + gimp_context_get_foreground (gimp_get_current_context (gimage->gimp), &color); gimp_rgb_get_uchar (&color, &pfg[0], &pfg[1], &pfg[2]); @@ -1310,7 +1310,7 @@ gimp_image_get_background (const GimpImage *gimage, guchar pbg[3]; /* Get the palette color */ - gimp_context_get_background (NULL, &color); + gimp_context_get_background (gimp_get_current_context (gimage->gimp), &color); gimp_rgb_get_uchar (&color, &pbg[0], &pbg[1], &pbg[2]); diff --git a/app/core/gimpimage-qmask.c b/app/core/gimpimage-qmask.c index 88179c8537..4161b32b02 100644 --- a/app/core/gimpimage-qmask.c +++ b/app/core/gimpimage-qmask.c @@ -29,6 +29,7 @@ #include "core/core-types.h" +#include "core/gimp.h" #include "core/gimpchannel.h" #include "core/gimpcontext.h" #include "core/gimpimage.h" @@ -36,6 +37,7 @@ #include "widgets/gimpcolorpanel.h" +#include "app_procs.h" #include "drawable.h" #include "floating_sel.h" #include "gdisplay.h" @@ -238,7 +240,10 @@ qmask_activate (GtkWidget *widget, "Qmask", &color); gimp_image_add_channel (gimg, gmask, 0); - drawable_fill (GIMP_DRAWABLE (gmask), TRANSPARENT_FILL); + + drawable_fill (GIMP_DRAWABLE (gmask), + gimp_get_user_context (gimg->gimp), + TRANSPARENT_FILL); } else { diff --git a/app/core/gimpimage-quick-mask.c b/app/core/gimpimage-quick-mask.c index 88179c8537..4161b32b02 100644 --- a/app/core/gimpimage-quick-mask.c +++ b/app/core/gimpimage-quick-mask.c @@ -29,6 +29,7 @@ #include "core/core-types.h" +#include "core/gimp.h" #include "core/gimpchannel.h" #include "core/gimpcontext.h" #include "core/gimpimage.h" @@ -36,6 +37,7 @@ #include "widgets/gimpcolorpanel.h" +#include "app_procs.h" #include "drawable.h" #include "floating_sel.h" #include "gdisplay.h" @@ -238,7 +240,10 @@ qmask_activate (GtkWidget *widget, "Qmask", &color); gimp_image_add_channel (gimg, gmask, 0); - drawable_fill (GIMP_DRAWABLE (gmask), TRANSPARENT_FILL); + + drawable_fill (GIMP_DRAWABLE (gmask), + gimp_get_user_context (gimg->gimp), + TRANSPARENT_FILL); } else { diff --git a/app/core/gimpimage-resize.c b/app/core/gimpimage-resize.c index 3d09a28b9c..708fd3d3e6 100644 --- a/app/core/gimpimage-resize.c +++ b/app/core/gimpimage-resize.c @@ -40,6 +40,7 @@ #include "gimp.h" #include "gimpcontext.h" +#include "gimpcoreconfig.h" #include "gimpimage.h" #include "gimpimage-colorhash.h" #include "gimpimage-mask.h" @@ -55,7 +56,6 @@ #include "drawable.h" #include "floating_sel.h" #include "gdisplay.h" -#include "gimprc.h" #include "parasitelist.h" #include "path.h" #include "undo.h" @@ -394,9 +394,9 @@ gimp_image_init (GimpImage *gimage) gimage->width = 0; gimage->height = 0; - gimage->xresolution = gimprc.default_xresolution; - gimage->yresolution = gimprc.default_yresolution; - gimage->unit = gimprc.default_units; + gimage->xresolution = core_config->default_xresolution; + gimage->yresolution = core_config->default_yresolution; + gimage->unit = core_config->default_units; gimage->base_type = RGB; gimage->cmap = NULL; @@ -1294,7 +1294,7 @@ gimp_image_get_foreground (const GimpImage *gimage, GimpRGB color; guchar pfg[3]; - gimp_context_get_foreground (NULL, &color); + gimp_context_get_foreground (gimp_get_current_context (gimage->gimp), &color); gimp_rgb_get_uchar (&color, &pfg[0], &pfg[1], &pfg[2]); @@ -1310,7 +1310,7 @@ gimp_image_get_background (const GimpImage *gimage, guchar pbg[3]; /* Get the palette color */ - gimp_context_get_background (NULL, &color); + gimp_context_get_background (gimp_get_current_context (gimage->gimp), &color); gimp_rgb_get_uchar (&color, &pbg[0], &pbg[1], &pbg[2]); diff --git a/app/core/gimpimage-scale.c b/app/core/gimpimage-scale.c index 3d09a28b9c..708fd3d3e6 100644 --- a/app/core/gimpimage-scale.c +++ b/app/core/gimpimage-scale.c @@ -40,6 +40,7 @@ #include "gimp.h" #include "gimpcontext.h" +#include "gimpcoreconfig.h" #include "gimpimage.h" #include "gimpimage-colorhash.h" #include "gimpimage-mask.h" @@ -55,7 +56,6 @@ #include "drawable.h" #include "floating_sel.h" #include "gdisplay.h" -#include "gimprc.h" #include "parasitelist.h" #include "path.h" #include "undo.h" @@ -394,9 +394,9 @@ gimp_image_init (GimpImage *gimage) gimage->width = 0; gimage->height = 0; - gimage->xresolution = gimprc.default_xresolution; - gimage->yresolution = gimprc.default_yresolution; - gimage->unit = gimprc.default_units; + gimage->xresolution = core_config->default_xresolution; + gimage->yresolution = core_config->default_yresolution; + gimage->unit = core_config->default_units; gimage->base_type = RGB; gimage->cmap = NULL; @@ -1294,7 +1294,7 @@ gimp_image_get_foreground (const GimpImage *gimage, GimpRGB color; guchar pfg[3]; - gimp_context_get_foreground (NULL, &color); + gimp_context_get_foreground (gimp_get_current_context (gimage->gimp), &color); gimp_rgb_get_uchar (&color, &pfg[0], &pfg[1], &pfg[2]); @@ -1310,7 +1310,7 @@ gimp_image_get_background (const GimpImage *gimage, guchar pbg[3]; /* Get the palette color */ - gimp_context_get_background (NULL, &color); + gimp_context_get_background (gimp_get_current_context (gimage->gimp), &color); gimp_rgb_get_uchar (&color, &pbg[0], &pbg[1], &pbg[2]); diff --git a/app/core/gimpimage-undo-push.c b/app/core/gimpimage-undo-push.c index 59d69e8107..d474762af2 100644 --- a/app/core/gimpimage-undo-push.c +++ b/app/core/gimpimage-undo-push.c @@ -36,6 +36,7 @@ #include "core/gimpchannel.h" #include "core/gimpcontainer.h" +#include "core/gimpcoreconfig.h" #include "core/gimpimage.h" #include "core/gimpimage-mask.h" #include "core/gimplayer.h" @@ -54,7 +55,6 @@ #include "gdisplay.h" #include "gdisplay_ops.h" #include "gimpparasite.h" -#include "gimprc.h" #include "parasitelist.h" #include "path_transform.h" #include "undo.h" @@ -314,13 +314,13 @@ static gboolean undo_free_up_space (GimpImage *gimage) { /* If there are 0 levels of undo return FALSE. */ - if (gimprc.levels_of_undo == 0) + if (core_config->levels_of_undo == 0) return FALSE; /* Delete the item on the bottom of the stack if we have the maximum * levels of undo already */ - while (gimage->undo_levels >= gimprc.levels_of_undo) + while (gimage->undo_levels >= core_config->levels_of_undo) gimage->undo_stack = remove_stack_bottom (gimage); return TRUE; diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c index 3d09a28b9c..708fd3d3e6 100644 --- a/app/core/gimpimage.c +++ b/app/core/gimpimage.c @@ -40,6 +40,7 @@ #include "gimp.h" #include "gimpcontext.h" +#include "gimpcoreconfig.h" #include "gimpimage.h" #include "gimpimage-colorhash.h" #include "gimpimage-mask.h" @@ -55,7 +56,6 @@ #include "drawable.h" #include "floating_sel.h" #include "gdisplay.h" -#include "gimprc.h" #include "parasitelist.h" #include "path.h" #include "undo.h" @@ -394,9 +394,9 @@ gimp_image_init (GimpImage *gimage) gimage->width = 0; gimage->height = 0; - gimage->xresolution = gimprc.default_xresolution; - gimage->yresolution = gimprc.default_yresolution; - gimage->unit = gimprc.default_units; + gimage->xresolution = core_config->default_xresolution; + gimage->yresolution = core_config->default_yresolution; + gimage->unit = core_config->default_units; gimage->base_type = RGB; gimage->cmap = NULL; @@ -1294,7 +1294,7 @@ gimp_image_get_foreground (const GimpImage *gimage, GimpRGB color; guchar pfg[3]; - gimp_context_get_foreground (NULL, &color); + gimp_context_get_foreground (gimp_get_current_context (gimage->gimp), &color); gimp_rgb_get_uchar (&color, &pfg[0], &pfg[1], &pfg[2]); @@ -1310,7 +1310,7 @@ gimp_image_get_background (const GimpImage *gimage, guchar pbg[3]; /* Get the palette color */ - gimp_context_get_background (NULL, &color); + gimp_context_get_background (gimp_get_current_context (gimage->gimp), &color); gimp_rgb_get_uchar (&color, &pbg[0], &pbg[1], &pbg[2]); diff --git a/app/core/gimppalette-load.c b/app/core/gimppalette-load.c index 3a625dfc09..a7b6ba57b9 100644 --- a/app/core/gimppalette-load.c +++ b/app/core/gimppalette-load.c @@ -35,8 +35,6 @@ #include "gimppalette.h" -#include "gimprc.h" - #include "libgimp/gimpintl.h" diff --git a/app/core/gimppalette-save.c b/app/core/gimppalette-save.c index 3a625dfc09..a7b6ba57b9 100644 --- a/app/core/gimppalette-save.c +++ b/app/core/gimppalette-save.c @@ -35,8 +35,6 @@ #include "gimppalette.h" -#include "gimprc.h" - #include "libgimp/gimpintl.h" diff --git a/app/core/gimppalette.c b/app/core/gimppalette.c index 3a625dfc09..a7b6ba57b9 100644 --- a/app/core/gimppalette.c +++ b/app/core/gimppalette.c @@ -35,8 +35,6 @@ #include "gimppalette.h" -#include "gimprc.h" - #include "libgimp/gimpintl.h" diff --git a/app/core/gimpprojection-construct.c b/app/core/gimpprojection-construct.c index 3d09a28b9c..708fd3d3e6 100644 --- a/app/core/gimpprojection-construct.c +++ b/app/core/gimpprojection-construct.c @@ -40,6 +40,7 @@ #include "gimp.h" #include "gimpcontext.h" +#include "gimpcoreconfig.h" #include "gimpimage.h" #include "gimpimage-colorhash.h" #include "gimpimage-mask.h" @@ -55,7 +56,6 @@ #include "drawable.h" #include "floating_sel.h" #include "gdisplay.h" -#include "gimprc.h" #include "parasitelist.h" #include "path.h" #include "undo.h" @@ -394,9 +394,9 @@ gimp_image_init (GimpImage *gimage) gimage->width = 0; gimage->height = 0; - gimage->xresolution = gimprc.default_xresolution; - gimage->yresolution = gimprc.default_yresolution; - gimage->unit = gimprc.default_units; + gimage->xresolution = core_config->default_xresolution; + gimage->yresolution = core_config->default_yresolution; + gimage->unit = core_config->default_units; gimage->base_type = RGB; gimage->cmap = NULL; @@ -1294,7 +1294,7 @@ gimp_image_get_foreground (const GimpImage *gimage, GimpRGB color; guchar pfg[3]; - gimp_context_get_foreground (NULL, &color); + gimp_context_get_foreground (gimp_get_current_context (gimage->gimp), &color); gimp_rgb_get_uchar (&color, &pfg[0], &pfg[1], &pfg[2]); @@ -1310,7 +1310,7 @@ gimp_image_get_background (const GimpImage *gimage, guchar pbg[3]; /* Get the palette color */ - gimp_context_get_background (NULL, &color); + gimp_context_get_background (gimp_get_current_context (gimage->gimp), &color); gimp_rgb_get_uchar (&color, &pbg[0], &pbg[1], &pbg[2]); diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c index 2bb31c197b..768db9c7d9 100644 --- a/app/core/gimpprojection.c +++ b/app/core/gimpprojection.c @@ -31,6 +31,7 @@ #include "base/temp-buf.h" +#include "core/gimp.h" #include "core/gimpchannel.h" #include "core/gimpcontainer.h" #include "core/gimpcontext.h" @@ -51,6 +52,7 @@ #include "gui/menus.h" #include "nav_window.h" +#include "app_procs.h" #include "appenv.h" #include "colormaps.h" #include "gimprc.h" @@ -785,8 +787,12 @@ gdisplay_flush_whenever (GDisplay *gdisp, qmask_buttons_update (gdisp); /* ensure the consistency of the tear-off menus */ - if (!now && gimp_context_get_display (gimp_context_get_user ()) == gdisp) - gdisplay_set_menu_sensitivity (gdisp); + if (! now && + gimp_context_get_display (gimp_get_user_context + (gdisp->gimage->gimp)) == gdisp) + { + gdisplay_set_menu_sensitivity (gdisp); + } } void @@ -2229,7 +2235,7 @@ gdisplay_active (void) gdk_event_free (event); } - return gimp_context_get_display (gimp_context_get_user ()); + return gimp_context_get_display (gimp_get_user_context (the_gimp)); } GDisplay * diff --git a/app/core/gimptoolinfo.c b/app/core/gimptoolinfo.c index 4133ac7db7..d68cf1ab2f 100644 --- a/app/core/gimptoolinfo.c +++ b/app/core/gimptoolinfo.c @@ -24,11 +24,10 @@ #include "base/temp-buf.h" +#include "gimp.h" #include "gimpcontext.h" #include "gimptoolinfo.h" -#include "context_manager.h" - /* GRMPF */ #include "tools/tools-types.h" #include "tools/gimprectselecttool.h" @@ -201,7 +200,8 @@ gimp_tool_info_get_new_preview (GimpViewable *viewable, } GimpToolInfo * -gimp_tool_info_new (GtkType tool_type, +gimp_tool_info_new (GimpContext *context, + GtkType tool_type, gboolean tool_context, const gchar *identifier, const gchar *blurb, @@ -233,9 +233,9 @@ gimp_tool_info_new (GtkType tool_type, if (tool_context) { - tool_info->context = gimp_context_new (global_tool_context->gimp, - identifier, - global_tool_context); + tool_info->context = gimp_create_context (context->gimp, + identifier, + context); } return tool_info; @@ -249,7 +249,8 @@ gimp_tool_info_get_standard (void) if (! standard_tool_info) { standard_tool_info = - gimp_tool_info_new (GIMP_TYPE_RECT_SELECT_TOOL, + gimp_tool_info_new (NULL, + GIMP_TYPE_RECT_SELECT_TOOL, FALSE, "gimp:standard_tool", "Standard Tool", diff --git a/app/core/gimptoolinfo.h b/app/core/gimptoolinfo.h index d203e7f5ee..cf6bef4cb0 100644 --- a/app/core/gimptoolinfo.h +++ b/app/core/gimptoolinfo.h @@ -67,7 +67,8 @@ struct _GimpToolInfoClass GtkType gimp_tool_info_get_type (void); -GimpToolInfo * gimp_tool_info_new (GtkType tool_type, +GimpToolInfo * gimp_tool_info_new (GimpContext *context, + GtkType tool_type, gboolean tool_context, const gchar *identifier, const gchar *blurb, diff --git a/app/core/gimpundo.c b/app/core/gimpundo.c index a63f6e6fb8..ad8fb159ec 100644 --- a/app/core/gimpundo.c +++ b/app/core/gimpundo.c @@ -27,8 +27,6 @@ #include "gimpimage.h" #include "gimpundo.h" -#include "gimprc.h" - enum { @@ -200,9 +198,11 @@ static void gimp_undo_real_push (GimpUndo *undo, GimpImage *gimage) { + /* FIXME: need core_config->undo_preview_size */ + undo->preview = gimp_viewable_get_preview (GIMP_VIEWABLE (gimage), - gimprc.preview_size, - gimprc.preview_size); + 24, + 24); } static void diff --git a/app/devices.c b/app/devices.c index fa9a9962c2..d305efc8b1 100644 --- a/app/devices.c +++ b/app/devices.c @@ -301,12 +301,13 @@ devices_init (void) device_info->num_axes = gdk_info->num_axes; device_info->axes = NULL; - device_info->context = gimp_context_new (the_gimp, - device_info->name, NULL); + device_info->context = gimp_create_context (the_gimp, + device_info->name, NULL); gimp_context_define_args (device_info->context, DEVICE_CONTEXT_MASK, FALSE); - gimp_context_copy_args (gimp_context_get_user (), device_info->context, + gimp_context_copy_args (gimp_get_user_context (the_gimp), + device_info->context, DEVICE_CONTEXT_MASK); device_status_context_connect (device_info->context, device_info->device); @@ -331,7 +332,7 @@ devices_restore (void) suppress_update = TRUE; - context = gimp_context_get_user (); + context = gimp_get_user_context (the_gimp); gimp_context_copy_args (device_info->context, context, DEVICE_CONTEXT_MASK); gimp_context_set_parent (device_info->context, context); @@ -389,12 +390,13 @@ devices_rc_update (gchar *name, else device_info->mode = GDK_MODE_DISABLED; - device_info->context = gimp_context_new (the_gimp, - device_info->name, NULL); + device_info->context = gimp_create_context (the_gimp, + device_info->name, NULL); gimp_context_define_args (device_info->context, DEVICE_CONTEXT_MASK, FALSE); - gimp_context_copy_args (gimp_context_get_user (), device_info->context, + gimp_context_copy_args (gimp_get_user_context (the_gimp), + device_info->context, DEVICE_CONTEXT_MASK); device_status_context_connect (device_info->context, device_info->device); @@ -534,7 +536,7 @@ select_device (guint32 new_device) current_device = new_device; - context = gimp_context_get_user (); + context = gimp_get_user_context (the_gimp); gimp_context_copy_args (device_info->context, context, DEVICE_CONTEXT_MASK); gimp_context_set_parent (device_info->context, context); diff --git a/app/dialogs/dialogs-constructors.c b/app/dialogs/dialogs-constructors.c index 376ab7172c..6cbc6a6451 100644 --- a/app/dialogs/dialogs-constructors.c +++ b/app/dialogs/dialogs-constructors.c @@ -567,7 +567,8 @@ dialogs_layer_list_view_new (GimpDialogFactory *factory, gimage = gimp_context_get_image (context); view = gimp_drawable_list_view_new - (gimage, + (gimprc.preview_size, + gimage, GIMP_TYPE_LAYER, "active_layer_changed", (GimpGetContainerFunc) gimp_image_get_layers, @@ -602,7 +603,8 @@ dialogs_channel_list_view_new (GimpDialogFactory *factory, gimage = gimp_context_get_image (context); view = gimp_drawable_list_view_new - (gimage, + (gimprc.preview_size, + gimage, GIMP_TYPE_CHANNEL, "active_channel_changed", (GimpGetContainerFunc) gimp_image_get_channels, diff --git a/app/dialogs/dialogs.c b/app/dialogs/dialogs.c index 48d73bc397..4814a89801 100644 --- a/app/dialogs/dialogs.c +++ b/app/dialogs/dialogs.c @@ -20,9 +20,9 @@ #include -#include "apptypes.h" #include "widgets/widgets-types.h" +#include "core/gimp.h" #include "core/gimpcontext.h" #include "widgets/gimpdialogfactory.h" @@ -88,25 +88,21 @@ static const gint n_dock_entries = (sizeof (dock_entries) / /* public functions */ void -dialogs_init (void) +dialogs_init (Gimp *gimp) { gint i; - global_dialog_factory = - gimp_dialog_factory_new ("toplevel", - gimp_context_get_user (), - NULL, - NULL); - + global_dialog_factory = gimp_dialog_factory_new ("toplevel", + gimp_get_user_context (gimp), + NULL, + NULL); gtk_object_ref (GTK_OBJECT (global_dialog_factory)); gtk_object_sink (GTK_OBJECT (global_dialog_factory)); - global_dock_factory = - gimp_dialog_factory_new ("dock", - gimp_context_get_user (), - menus_get_dialogs_factory (), - dialogs_dock_new); - + global_dock_factory = gimp_dialog_factory_new ("dock", + gimp_get_user_context (gimp), + menus_get_dialogs_factory (), + dialogs_dock_new); gtk_object_ref (GTK_OBJECT (global_dock_factory)); gtk_object_sink (GTK_OBJECT (global_dock_factory)); @@ -128,7 +124,7 @@ dialogs_init (void) } void -dialogs_exit (void) +dialogs_exit (Gimp *gimp) { gtk_object_unref (GTK_OBJECT (global_dialog_factory)); gtk_object_unref (GTK_OBJECT (global_dock_factory)); diff --git a/app/dialogs/dialogs.h b/app/dialogs/dialogs.h index 2d78189333..f76272b174 100644 --- a/app/dialogs/dialogs.h +++ b/app/dialogs/dialogs.h @@ -24,8 +24,8 @@ extern GimpDialogFactory *global_dialog_factory; extern GimpDialogFactory *global_dock_factory; -void dialogs_init (void); -void dialogs_exit (void); +void dialogs_init (Gimp *gimp); +void dialogs_exit (Gimp *gimp); #endif /* __DIALOGS_H__ */ diff --git a/app/dialogs/file-open-dialog.c b/app/dialogs/file-open-dialog.c index c0f026284f..8c71cc8616 100644 --- a/app/dialogs/file-open-dialog.c +++ b/app/dialogs/file-open-dialog.c @@ -44,6 +44,7 @@ #include "core/gimp.h" #include "core/gimpcontext.h" +#include "core/gimpcoreconfig.h" #include "core/gimpimage.h" #include "file-dialog-utils.h" @@ -54,7 +55,6 @@ #include "dialog_handler.h" #include "docindex.h" #include "gdisplay.h" -#include "gimprc.h" #include "file-open.h" #include "file-utils.h" #include "plug_in.h" @@ -245,7 +245,8 @@ file_open_with_proc_and_display (gchar *filename, gchar *absolute; gint status; - if ((gimage = file_open_image (filename, + if ((gimage = file_open_image (the_gimp, + filename, raw_filename, _("Open"), file_proc, @@ -605,7 +606,7 @@ set_preview (const gchar *fullfname, } else { - switch (gimprc.thumbnail_mode) + switch (core_config->thumbnail_mode) { case 0: gtk_label_set_text (GTK_LABEL(open_options_label), @@ -717,7 +718,8 @@ file_open_genbutton_callback (GtkWidget *widget, { /* Is not directory. */ gint dummy; - gimage_to_be_thumbed = file_open_image (full_filename, + gimage_to_be_thumbed = file_open_image (the_gimp, + full_filename, list->data, NULL, NULL, @@ -730,7 +732,7 @@ file_open_genbutton_callback (GtkWidget *widget, RGBbuf = make_RGBbuf_from_tempbuf (tempbuf, &RGBbuf_w, &RGBbuf_h); - if (gimprc.thumbnail_mode) + if (core_config->thumbnail_mode) { file_save_thumbnail (gimage_to_be_thumbed, full_filename, tempbuf); @@ -934,7 +936,8 @@ file_revert_confirm_callback (GtkWidget *widget, filename = gimp_object_get_name (GIMP_OBJECT (old_gimage)); - new_gimage = file_open_image (filename, filename, + new_gimage = file_open_image (old_gimage->gimp, + filename, filename, _("Revert"), NULL, RUN_INTERACTIVE, diff --git a/app/dialogs/image-new-dialog.c b/app/dialogs/image-new-dialog.c index 592f8e2504..aa44e55bd6 100644 --- a/app/dialogs/image-new-dialog.c +++ b/app/dialogs/image-new-dialog.c @@ -26,6 +26,7 @@ #include "core/core-types.h" +#include "core/gimpcoreconfig.h" #include "core/gimpimage-new.h" #include "file-new-dialog.h" @@ -120,29 +121,30 @@ file_new_reset_callback (GtkWidget *widget, gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (info->couple_resolutions), - ABS (gimprc.default_xresolution - gimprc.default_yresolution) < GIMP_MIN_RESOLUTION); + ABS (core_config->default_xresolution - + core_config->default_yresolution) < GIMP_MIN_RESOLUTION); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (info->resolution_se), - 0, gimprc.default_xresolution); + 0, core_config->default_xresolution); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (info->resolution_se), - 1, gimprc.default_yresolution); + 1, core_config->default_yresolution); gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (info->resolution_se), - gimprc.default_resolution_units); + core_config->default_resolution_units); gtk_signal_handler_unblock_by_data (GTK_OBJECT (info->resolution_se), info); gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (info->size_se), - 0, gimprc.default_xresolution, TRUE); + 0, core_config->default_xresolution, TRUE); gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (info->size_se), - 1, gimprc.default_yresolution, TRUE); + 1, core_config->default_yresolution, TRUE); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (info->size_se), - 0, gimprc.default_width); + 0, core_config->default_width); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (info->size_se), - 1, gimprc.default_height); + 1, core_config->default_height); gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (info->size_se), - gimprc.default_units); + core_config->default_units); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (info->type_w[gimprc.default_type]), + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (info->type_w[core_config->default_type]), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (info->fill_type_w[BACKGROUND_FILL]), TRUE); @@ -534,7 +536,8 @@ file_new_dialog_create (GimpImage *gimage) gtk_widget_set_usize (spinbutton, 75, 0); info->resolution_se = - gimp_size_entry_new (1, gimprc.default_resolution_units, _("pixels/%a"), + gimp_size_entry_new (1, core_config->default_resolution_units, + _("pixels/%a"), FALSE, FALSE, FALSE, 75, GIMP_SIZE_ENTRY_UPDATE_RESOLUTION); gtk_table_set_col_spacing (GTK_TABLE (info->resolution_se), 1, 2); @@ -591,8 +594,10 @@ file_new_dialog_create (GimpImage *gimage) gtk_widget_show (radio_box); group = NULL; - list = g_list_first (gimp_image_new_get_base_type_names (the_gimp)); - while (list) + + for (list = gimp_image_new_get_base_type_names (the_gimp); + list; + list = g_list_next (list)) { GimpImageBaseTypeName *name_info; @@ -613,8 +618,6 @@ file_new_dialog_create (GimpImage *gimage) gtk_widget_show (button); info->type_w[name_info->type] = button; - - list = g_list_next (list); } /* frame for Fill Type */ @@ -628,8 +631,10 @@ file_new_dialog_create (GimpImage *gimage) gtk_widget_show (radio_box); group = NULL; - list = g_list_first (gimp_image_new_get_fill_type_names (the_gimp)); - while (list) + + for (list = gimp_image_new_get_fill_type_names (the_gimp); + list; + list = g_list_next (list)) { GimpFillTypeName *name_info; @@ -651,8 +656,6 @@ file_new_dialog_create (GimpImage *gimage) gtk_widget_show (button); info->fill_type_w[name_info->type] = button; - - list = g_list_next (list); } gimp_size_entry_grab_focus (GIMP_SIZE_ENTRY (info->size_se)); diff --git a/app/dialogs/info-window.c b/app/dialogs/info-window.c index 5f4060d03a..c9240973b3 100644 --- a/app/dialogs/info-window.c +++ b/app/dialogs/info-window.c @@ -39,11 +39,12 @@ #include "tools/gimpcolorpickertool.h" /* need icon of color picker tool */ #include "tools/tool_manager.h" -#include "gdisplay.h" #include "info-dialog.h" #include "info-window.h" +#include "app_procs.h" #include "colormaps.h" +#include "gdisplay.h" #include "libgimp/gimpintl.h" @@ -182,7 +183,7 @@ info_window_create_extended (InfoDialog *info_win) gtk_container_add (GTK_CONTAINER (frame), table); gtk_widget_show (table); - preview = gimp_preview_new (GIMP_VIEWABLE (tool_manager_get_info_by_type (GIMP_TYPE_MOVE_TOOL)), 22, 0, FALSE); + preview = gimp_preview_new (GIMP_VIEWABLE (tool_manager_get_info_by_type (the_gimp, GIMP_TYPE_MOVE_TOOL)), 22, 0, FALSE); gtk_table_attach (GTK_TABLE (table), preview, 0, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 2, 2); gtk_widget_show (preview); @@ -242,7 +243,7 @@ info_window_create_extended (InfoDialog *info_win) gtk_container_add (GTK_CONTAINER (frame), table); gtk_widget_show (table); - preview = gimp_preview_new (GIMP_VIEWABLE (tool_manager_get_info_by_type (GIMP_TYPE_COLOR_PICKER_TOOL)), 22, 0, FALSE); + preview = gimp_preview_new (GIMP_VIEWABLE (tool_manager_get_info_by_type (the_gimp, GIMP_TYPE_COLOR_PICKER_TOOL)), 22, 0, FALSE); gtk_table_attach (GTK_TABLE (table), preview, 0, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 2, 2); gtk_widget_show (preview); @@ -420,7 +421,7 @@ info_window_follow_auto (void) GimpContext *context; GDisplay *gdisp; - context = gimp_context_get_user (); + context = gimp_get_user_context (the_gimp); gdisp = gimp_context_get_display (context); diff --git a/app/dialogs/module-dialog.c b/app/dialogs/module-dialog.c index 7d707d1665..fc8ee3106f 100644 --- a/app/dialogs/module-dialog.c +++ b/app/dialogs/module-dialog.c @@ -38,12 +38,13 @@ #include "core/core-types.h" +#include "core/gimpcoreconfig.h" #include "core/gimplist.h" #include "appenv.h" #include "module_db.h" -#include "gimprc.h" #include "datafiles.h" +#include "gimprc.h" #include "libgimp/gimpmodule.h" @@ -217,7 +218,7 @@ module_db_init (void) modules = gimp_list_new (MODULE_INFO_TYPE, GIMP_CONTAINER_POLICY_WEAK); if (g_module_supported ()) - gimp_datafiles_read_directories (gimprc.module_path, 0 /* no flags */, + gimp_datafiles_read_directories (core_config->module_path, 0 /* no flags */, module_initialize, NULL); #ifdef DUMP_DB gimp_container_foreach (modules, print_module_info, NULL); @@ -615,7 +616,7 @@ module_initialize (const gchar *filename, mod->refs = 0; mod->load_inhibit = module_inhibited (mod->fullpath, - gimprc.module_db_load_inhibit); + core_config->module_db_load_inhibit); if (!mod->load_inhibit) { if (be_verbose) @@ -1137,7 +1138,7 @@ browser_refresh_callback (GtkWidget *widget, kill_list = NULL; /* walk filesystem and add new things we find */ - gimp_datafiles_read_directories (gimprc.module_path, 0 /* no flags */, + gimp_datafiles_read_directories (core_config->module_path, 0 /* no flags */, module_initialize, NULL); } diff --git a/app/dialogs/palette-import-dialog.c b/app/dialogs/palette-import-dialog.c index de4e538acc..ff4643e29a 100644 --- a/app/dialogs/palette-import-dialog.c +++ b/app/dialogs/palette-import-dialog.c @@ -405,7 +405,7 @@ palette_import_grad_callback (GtkWidget *widget, { GimpGradient *gradient; - gradient = gimp_context_get_gradient (gimp_context_get_user ()); + gradient = gimp_context_get_gradient (gimp_get_user_context (the_gimp)); import_dialog->import_type = GRAD_IMPORT; if (import_dialog->image_list) @@ -571,7 +571,7 @@ palette_import_import_callback (GtkWidget *widget, else palette_name = g_strdup (palette_name); - gradient = gimp_context_get_gradient (gimp_context_get_user ()); + gradient = gimp_context_get_gradient (gimp_get_user_context (the_gimp)); n_colors = (gint) import_dialog->sample->value; threshold = (gint) import_dialog->threshold->value; @@ -677,7 +677,7 @@ palette_import_dialog_new (void) { GimpGradient* gradient; - gradient = gimp_context_get_gradient (gimp_context_get_current ()); + gradient = gimp_context_get_gradient (gimp_get_user_context (the_gimp)); gtk_entry_set_text (GTK_ENTRY (entry), gradient ? GIMP_OBJECT (gradient)->name : _("new_import")); } @@ -783,9 +783,10 @@ palette_import_dialog_new (void) /* Fill with the selected gradient */ palette_import_fill_grad_preview - (image, gimp_context_get_gradient (gimp_context_get_user ())); + (image, gimp_context_get_gradient (gimp_get_user_context (the_gimp))); import_dialog->import_type = GRAD_IMPORT; - gtk_signal_connect (GTK_OBJECT (gimp_context_get_user ()), "gradient_changed", + gtk_signal_connect (GTK_OBJECT (gimp_get_user_context (the_gimp)), + "gradient_changed", GTK_SIGNAL_FUNC (palette_import_gradient_update), NULL); diff --git a/app/dialogs/preferences-dialog.c b/app/dialogs/preferences-dialog.c index c4a64a4120..f00186fd7a 100644 --- a/app/dialogs/preferences-dialog.c +++ b/app/dialogs/preferences-dialog.c @@ -26,23 +26,25 @@ #include "libgimpbase/gimpbase.h" #include "libgimpwidgets/gimpwidgets.h" -#include "core/core-types.h" +#include "tools/tools-types.h" #include "base/base-config.h" #include "base/tile-cache.h" #include "core/gimp.h" #include "core/gimpcontainer.h" +#include "core/gimpcoreconfig.h" #include "core/gimpimage.h" -#include "gdisplay.h" +#include "tools/tool_manager.h" + #include "layer-select.h" #include "resolution-calibrate-dialog.h" #include "session.h" #include "app_procs.h" #include "colormaps.h" -#include "context_manager.h" +#include "gdisplay.h" #include "gdisplay_ops.h" #include "gimphelp.h" #include "gimprc.h" @@ -173,12 +175,12 @@ static gboolean edit_info_window_follows_mouse; static gboolean edit_disable_tearoff_menus; static gchar * edit_temp_path = NULL; static gchar * edit_swap_path = NULL; +static gchar * edit_plug_in_path = NULL; +static gchar * edit_module_path = NULL; static gchar * edit_brush_path = NULL; static gchar * edit_pattern_path = NULL; static gchar * edit_palette_path = NULL; static gchar * edit_gradient_path = NULL; -static gchar * edit_plug_in_path = NULL; -static gchar * edit_module_path = NULL; /* variables which will be changed _after_ closing the dialog */ static guint edit_tile_cache_size; @@ -269,10 +271,10 @@ static PrefsState prefs_check_settings (void) { /* First, check for invalid values... */ - if (gimprc.levels_of_undo < 0) + if (core_config->levels_of_undo < 0) { g_message (_("Error: Levels of undo must be zero or greater.")); - gimprc.levels_of_undo = old_levels_of_undo; + core_config->levels_of_undo = old_levels_of_undo; return PREFS_CORRUPT; } if (gimprc.marching_speed < 50) @@ -281,38 +283,38 @@ prefs_check_settings (void) gimprc.marching_speed = old_marching_speed; return PREFS_CORRUPT; } - if (gimprc.default_width < 1) + if (core_config->default_width < 1) { g_message (_("Error: Default width must be one or greater.")); - gimprc.default_width = old_default_width; + core_config->default_width = old_default_width; return PREFS_CORRUPT; } - if (gimprc.default_height < 1) + if (core_config->default_height < 1) { g_message (_("Error: Default height must be one or greater.")); - gimprc.default_height = old_default_height; + core_config->default_height = old_default_height; return PREFS_CORRUPT; } - if (gimprc.default_units < GIMP_UNIT_INCH || - gimprc.default_units >= gimp_unit_get_number_of_units ()) + if (core_config->default_units < GIMP_UNIT_INCH || + core_config->default_units >= gimp_unit_get_number_of_units ()) { g_message (_("Error: Default unit must be within unit range.")); - gimprc.default_units = old_default_units; + core_config->default_units = old_default_units; return PREFS_CORRUPT; } - if (gimprc.default_xresolution < GIMP_MIN_RESOLUTION || - gimprc.default_yresolution < GIMP_MIN_RESOLUTION) + if (core_config->default_xresolution < GIMP_MIN_RESOLUTION || + core_config->default_yresolution < GIMP_MIN_RESOLUTION) { g_message (_("Error: Default resolution must not be zero.")); - gimprc.default_xresolution = old_default_xresolution; - gimprc.default_yresolution = old_default_yresolution; + core_config->default_xresolution = old_default_xresolution; + core_config->default_yresolution = old_default_yresolution; return PREFS_CORRUPT; } - if (gimprc.default_resolution_units < GIMP_UNIT_INCH || - gimprc.default_resolution_units >= gimp_unit_get_number_of_units ()) + if (core_config->default_resolution_units < GIMP_UNIT_INCH || + core_config->default_resolution_units >= gimp_unit_get_number_of_units ()) { g_message (_("Error: Default resolution unit must be within unit range.")); - gimprc.default_resolution_units = old_default_resolution_units; + core_config->default_resolution_units = old_default_resolution_units; return PREFS_CORRUPT; } if (gimprc.monitor_xres < GIMP_MIN_RESOLUTION || @@ -350,12 +352,12 @@ prefs_check_settings (void) prefs_strcmp (old_temp_path, edit_temp_path) || prefs_strcmp (old_swap_path, edit_swap_path) || + prefs_strcmp (old_plug_in_path, edit_plug_in_path) || + prefs_strcmp (old_module_path, edit_module_path) || prefs_strcmp (old_brush_path, edit_brush_path) || prefs_strcmp (old_pattern_path, edit_pattern_path) || prefs_strcmp (old_palette_path, edit_palette_path) || - prefs_strcmp (old_gradient_path, edit_gradient_path) || - prefs_strcmp (old_plug_in_path, edit_plug_in_path) || - prefs_strcmp (old_module_path, edit_module_path)) + prefs_strcmp (old_gradient_path, edit_gradient_path)) { return PREFS_RESTART; } @@ -528,14 +530,15 @@ prefs_save_callback (GtkWidget *widget, save_temp_path = base_config->temp_path; save_swap_path = base_config->swap_path; - save_brush_path = gimprc.brush_path; - save_pattern_path = gimprc.pattern_path; - save_palette_path = gimprc.palette_path; - save_gradient_path = gimprc.gradient_path; - save_plug_in_path = gimprc.plug_in_path; - save_module_path = gimprc.module_path; - if (gimprc.levels_of_undo != old_levels_of_undo) + save_plug_in_path = core_config->plug_in_path; + save_module_path = core_config->module_path; + save_brush_path = core_config->brush_path; + save_pattern_path = core_config->pattern_path; + save_palette_path = core_config->palette_path; + save_gradient_path = core_config->gradient_path; + + if (core_config->levels_of_undo != old_levels_of_undo) { update = g_list_append (update, "undo-levels"); } @@ -596,32 +599,32 @@ prefs_save_callback (GtkWidget *widget, { update = g_list_append (update, "always-restore-session"); } - if (gimprc.default_width != old_default_width || - gimprc.default_height != old_default_height) + if (core_config->default_width != old_default_width || + core_config->default_height != old_default_height) { update = g_list_append (update, "default-image-size"); } - if (gimprc.default_units != old_default_units) + if (core_config->default_units != old_default_units) { update = g_list_append (update, "default-units"); } - if (ABS (gimprc.default_xresolution - old_default_xresolution) > GIMP_MIN_RESOLUTION) + if (ABS (core_config->default_xresolution - old_default_xresolution) > GIMP_MIN_RESOLUTION) { update = g_list_append (update, "default-xresolution"); } - if (ABS (gimprc.default_yresolution - old_default_yresolution) > GIMP_MIN_RESOLUTION) + if (ABS (core_config->default_yresolution - old_default_yresolution) > GIMP_MIN_RESOLUTION) { update = g_list_append (update, "default-yresolution"); } - if (gimprc.default_resolution_units != old_default_resolution_units) + if (core_config->default_resolution_units != old_default_resolution_units) { update = g_list_append (update, "default-resolution-units"); } - if (gimprc.default_type != old_default_type) + if (core_config->default_type != old_default_type) { update = g_list_append (update, "default-image-type"); } - if (prefs_strcmp (gimprc.default_comment, old_default_comment)) + if (prefs_strcmp (core_config->default_comment, old_default_comment)) { update = g_list_append (update, "default-comment"); } @@ -680,7 +683,7 @@ prefs_save_callback (GtkWidget *widget, { update = g_list_append (update, "max-new-image-size"); } - if (gimprc.thumbnail_mode != old_thumbnail_mode) + if (core_config->thumbnail_mode != old_thumbnail_mode) { update = g_list_append (update, "thumbnail-mode"); } @@ -771,36 +774,36 @@ prefs_save_callback (GtkWidget *widget, base_config->swap_path = edit_swap_path; update = g_list_append (update, "swap-path"); } + if (prefs_strcmp (old_plug_in_path, edit_plug_in_path)) + { + core_config->plug_in_path = edit_plug_in_path; + update = g_list_append (update, "plug-in-path"); + } + if (prefs_strcmp (old_module_path, edit_module_path)) + { + core_config->module_path = edit_module_path; + update = g_list_append (update, "module-path"); + } if (prefs_strcmp (old_brush_path, edit_brush_path)) { - gimprc.brush_path = edit_brush_path; + core_config->brush_path = edit_brush_path; update = g_list_append (update, "brush-path"); } if (prefs_strcmp (old_pattern_path, edit_pattern_path)) { - gimprc.pattern_path = edit_pattern_path; + core_config->pattern_path = edit_pattern_path; update = g_list_append (update, "pattern-path"); } if (prefs_strcmp (old_palette_path, edit_palette_path)) { - gimprc.palette_path = edit_palette_path; + core_config->palette_path = edit_palette_path; update = g_list_append (update, "palette-path"); } if (prefs_strcmp (old_gradient_path, edit_gradient_path)) { - gimprc.gradient_path = edit_gradient_path; + core_config->gradient_path = edit_gradient_path; update = g_list_append (update, "gradient-path"); } - if (prefs_strcmp (old_plug_in_path, edit_plug_in_path)) - { - gimprc.plug_in_path = edit_plug_in_path; - update = g_list_append (update, "plug-in-path"); - } - if (prefs_strcmp (old_module_path, edit_module_path)) - { - gimprc.module_path = edit_module_path; - update = g_list_append (update, "module-path"); - } /* values which are changed on "OK" or "Save" */ if (edit_tile_cache_size != old_tile_cache_size) @@ -814,8 +817,8 @@ prefs_save_callback (GtkWidget *widget, if (gimprc.using_xserver_resolution) - gdisplay_xserver_resolution (&(gimprc.monitor_xres), - &(gimprc.monitor_yres)); + gdisplay_xserver_resolution (&gimprc.monitor_xres, + &gimprc.monitor_yres); /* restore variables which must not change */ base_config->stingy_memory_use = save_stingy_memory_use; @@ -827,14 +830,15 @@ prefs_save_callback (GtkWidget *widget, gimprc.nav_window_per_display = save_nav_window_per_display; gimprc.info_window_follows_mouse = save_info_window_follows_mouse; - base_config->temp_path = save_temp_path; - base_config->swap_path = save_swap_path; - gimprc.brush_path = save_brush_path; - gimprc.pattern_path = save_pattern_path; - gimprc.palette_path = save_palette_path; - gimprc.gradient_path = save_gradient_path; - gimprc.plug_in_path = save_plug_in_path; - gimprc.module_path = save_module_path; + base_config->temp_path = save_temp_path; + base_config->swap_path = save_swap_path; + + core_config->plug_in_path = save_plug_in_path; + core_config->module_path = save_module_path; + core_config->brush_path = save_brush_path; + core_config->pattern_path = save_pattern_path; + core_config->palette_path = save_palette_path; + core_config->gradient_path = save_gradient_path; /* no need to restore values which are only changed on "OK" and "Save" */ @@ -850,39 +854,40 @@ prefs_cancel_callback (GtkWidget *widget, prefs_dlg = NULL; /* restore ordinary gimprc variables */ - base_config->interpolation_type = old_interpolation_type; - base_config->num_processors = old_num_processors; - - gimprc.levels_of_undo = old_levels_of_undo; - gimprc.marching_speed = old_marching_speed; - gimprc.allow_resize_windows = old_allow_resize_windows; - gimprc.auto_save = old_auto_save; - gimprc.no_cursor_updating = old_no_cursor_updating; - gimprc.perfectmouse = old_perfectmouse; - gimprc.show_tool_tips = old_show_tool_tips; - gimprc.show_rulers = old_show_rulers; - gimprc.show_statusbar = old_show_statusbar; - gimprc.confirm_on_close = old_confirm_on_close; - gimprc.save_session_info = old_save_session_info; - gimprc.save_device_status = old_save_device_status; - gimprc.default_width = old_default_width; - gimprc.default_height = old_default_height; - gimprc.default_units = old_default_units; - gimprc.default_xresolution = old_default_xresolution; - gimprc.default_yresolution = old_default_yresolution; - gimprc.default_resolution_units = old_default_resolution_units; - gimprc.default_type = old_default_type; - gimprc.default_dot_for_dot = old_default_dot_for_dot; - gimprc.monitor_xres = old_monitor_xres; - gimprc.monitor_yres = old_monitor_yres; - gimprc.using_xserver_resolution = old_using_xserver_resolution; - gimprc.max_new_image_size = old_max_new_image_size; - gimprc.thumbnail_mode = old_thumbnail_mode; - gimprc.trust_dirty_flag = old_trust_dirty_flag; - gimprc.use_help = old_use_help; - gimprc.help_browser = old_help_browser; - gimprc.cursor_mode = old_cursor_mode; - gimprc.default_threshold = old_default_threshold; + base_config->interpolation_type = old_interpolation_type; + base_config->num_processors = old_num_processors; + + core_config->default_type = old_default_type; + core_config->default_width = old_default_width; + core_config->default_height = old_default_height; + core_config->default_units = old_default_units; + core_config->default_xresolution = old_default_xresolution; + core_config->default_yresolution = old_default_yresolution; + core_config->default_resolution_units = old_default_resolution_units; + core_config->levels_of_undo = old_levels_of_undo; + core_config->thumbnail_mode = old_thumbnail_mode; + + gimprc.marching_speed = old_marching_speed; + gimprc.allow_resize_windows = old_allow_resize_windows; + gimprc.auto_save = old_auto_save; + gimprc.no_cursor_updating = old_no_cursor_updating; + gimprc.perfectmouse = old_perfectmouse; + gimprc.show_tool_tips = old_show_tool_tips; + gimprc.show_rulers = old_show_rulers; + gimprc.show_statusbar = old_show_statusbar; + gimprc.confirm_on_close = old_confirm_on_close; + gimprc.save_session_info = old_save_session_info; + gimprc.save_device_status = old_save_device_status; + gimprc.default_dot_for_dot = old_default_dot_for_dot; + gimprc.monitor_xres = old_monitor_xres; + gimprc.monitor_yres = old_monitor_yres; + gimprc.using_xserver_resolution = old_using_xserver_resolution; + gimprc.max_new_image_size = old_max_new_image_size; + gimprc.trust_dirty_flag = old_trust_dirty_flag; + gimprc.use_help = old_use_help; + gimprc.help_browser = old_help_browser; + gimprc.cursor_mode = old_cursor_mode; + gimprc.default_threshold = old_default_threshold; /* restore variables which need some magic */ if (gimprc.preview_size != old_preview_size) @@ -911,10 +916,10 @@ prefs_cancel_callback (GtkWidget *widget, gdisplays_flush (); } - prefs_strset (&(gimprc.image_title_format), old_image_title_format); - prefs_strset (&(gimprc.default_comment), old_default_comment); + prefs_strset (&gimprc.image_title_format, old_image_title_format); + prefs_strset (&core_config->default_comment, old_default_comment); - context_manager_set_global_paint_options (old_global_paint_options); + tool_manager_set_global_paint_options (the_gimp, old_global_paint_options); /* restore values which need a restart */ edit_stingy_memory_use = old_stingy_memory_use; @@ -929,12 +934,13 @@ prefs_cancel_callback (GtkWidget *widget, prefs_strset (&edit_temp_path, old_temp_path); prefs_strset (&edit_swap_path, old_swap_path); + + prefs_strset (&edit_plug_in_path, old_plug_in_path); + prefs_strset (&edit_module_path, old_module_path); prefs_strset (&edit_brush_path, old_brush_path); prefs_strset (&edit_pattern_path, old_pattern_path); prefs_strset (&edit_palette_path, old_palette_path); prefs_strset (&edit_gradient_path, old_gradient_path); - prefs_strset (&edit_plug_in_path, old_plug_in_path); - prefs_strset (&edit_module_path, old_module_path); /* no need to restore values which are only changed on "OK" and "Save" */ } @@ -948,19 +954,19 @@ prefs_toggle_callback (GtkWidget *widget, val = (gint *) data; /* toggle buttos */ - if (data == &(gimprc.allow_resize_windows) || - data == &(gimprc.auto_save) || - data == &(gimprc.no_cursor_updating) || - data == &(gimprc.perfectmouse) || - data == &(gimprc.show_tool_tips) || - data == &(gimprc.show_rulers) || - data == &(gimprc.show_statusbar) || - data == &(gimprc.confirm_on_close) || - data == &(gimprc.save_session_info) || - data == &(gimprc.save_device_status) || - data == &(gimprc.always_restore_session) || - data == &(gimprc.default_dot_for_dot) || - data == &(gimprc.use_help) || + if (data == &gimprc.allow_resize_windows || + data == &gimprc.auto_save || + data == &gimprc.no_cursor_updating || + data == &gimprc.perfectmouse || + data == &gimprc.show_tool_tips || + data == &gimprc.show_rulers || + data == &gimprc.show_statusbar || + data == &gimprc.confirm_on_close || + data == &gimprc.save_session_info || + data == &gimprc.save_device_status || + data == &gimprc.always_restore_session || + data == &gimprc.default_dot_for_dot || + data == &gimprc.use_help || data == &edit_stingy_memory_use || data == &edit_install_cmap || @@ -974,19 +980,19 @@ prefs_toggle_callback (GtkWidget *widget, } /* radio buttons */ - else if (data == &(gimprc.thumbnail_mode) || - data == &base_config->interpolation_type || - data == &(gimprc.trust_dirty_flag) || - data == &(gimprc.help_browser) || - data == &(gimprc.cursor_mode) || - data == &(gimprc.default_type)) + else if (data == &base_config->interpolation_type || + data == &core_config->default_type || + data == &core_config->thumbnail_mode || + data == &gimprc.trust_dirty_flag || + data == &gimprc.help_browser || + data == &gimprc.cursor_mode) { *val = (gint) gtk_object_get_user_data (GTK_OBJECT (widget)); } /* values which need some magic */ - else if ((data == &(gimprc.transparency_type)) || - (data == &(gimprc.transparency_size))) + else if ((data == &gimprc.transparency_type) || + (data == &gimprc.transparency_size)) { *val = (gint) gtk_object_get_user_data (GTK_OBJECT (widget)); @@ -997,10 +1003,10 @@ prefs_toggle_callback (GtkWidget *widget, gdisplays_expose_full (); gdisplays_flush (); } - else if (data == &(gimprc.global_paint_options)) + else if (data == &gimprc.global_paint_options) { - context_manager_set_global_paint_options - (GTK_TOGGLE_BUTTON (widget)->active); + tool_manager_set_global_paint_options (the_gimp, + GTK_TOGGLE_BUTTON (widget)->active); } /* no matching varible found */ @@ -1104,11 +1110,11 @@ static void prefs_default_size_callback (GtkWidget *widget, gpointer data) { - gimprc.default_width = + core_config->default_width = RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0)); - gimprc.default_height = + core_config->default_height = RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1)); - gimprc.default_units = gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (widget)); + core_config->default_units = gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (widget)); } static void @@ -1153,15 +1159,15 @@ prefs_default_resolution_callback (GtkWidget *widget, gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size_sizeentry), 1, yres, FALSE); - gimprc.default_width = + core_config->default_width = RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (size_sizeentry), 0)); - gimprc.default_height = + core_config->default_height = RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (size_sizeentry), 1)); - gimprc.default_xresolution = xres; - gimprc.default_yresolution = yres; + core_config->default_xresolution = xres; + core_config->default_yresolution = yres; - gimprc.default_resolution_units = + core_config->default_resolution_units = gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (widget)); } @@ -1175,8 +1181,8 @@ prefs_res_source_callback (GtkWidget *widget, if (GTK_TOGGLE_BUTTON (widget)->active) { - gdisplay_xserver_resolution (&(gimprc.monitor_xres), - &(gimprc.monitor_yres)); + gdisplay_xserver_resolution (&gimprc.monitor_xres, + &gimprc.monitor_yres); gimprc.using_xserver_resolution = TRUE; } else @@ -1404,12 +1410,13 @@ preferences_dialog_create (void) edit_temp_path = prefs_strdup (base_config->temp_path); edit_swap_path = prefs_strdup (base_config->swap_path); - edit_plug_in_path = prefs_strdup (gimprc.plug_in_path); - edit_module_path = prefs_strdup (gimprc.module_path); - edit_brush_path = prefs_strdup (gimprc.brush_path); - edit_pattern_path = prefs_strdup (gimprc.pattern_path); - edit_palette_path = prefs_strdup (gimprc.palette_path); - edit_gradient_path = prefs_strdup (gimprc.gradient_path); + + edit_plug_in_path = prefs_strdup (core_config->plug_in_path); + edit_module_path = prefs_strdup (core_config->module_path); + edit_brush_path = prefs_strdup (core_config->brush_path); + edit_pattern_path = prefs_strdup (core_config->pattern_path); + edit_palette_path = prefs_strdup (core_config->palette_path); + edit_gradient_path = prefs_strdup (core_config->gradient_path); } /* assign edit variables for values which get changed on "OK" and "Save" @@ -1421,10 +1428,19 @@ preferences_dialog_create (void) old_interpolation_type = base_config->interpolation_type; old_num_processors = base_config->num_processors; + old_default_type = core_config->default_type; + old_default_width = core_config->default_width; + old_default_height = core_config->default_height; + old_default_units = core_config->default_units; + old_default_xresolution = core_config->default_xresolution; + old_default_yresolution = core_config->default_yresolution; + old_default_resolution_units = core_config->default_resolution_units; + old_levels_of_undo = core_config->levels_of_undo; + old_thumbnail_mode = core_config->thumbnail_mode; + old_perfectmouse = gimprc.perfectmouse; old_transparency_type = gimprc.transparency_type; old_transparency_size = gimprc.transparency_size; - old_levels_of_undo = gimprc.levels_of_undo; old_marching_speed = gimprc.marching_speed; old_allow_resize_windows = gimprc.allow_resize_windows; old_auto_save = gimprc.auto_save; @@ -1438,20 +1454,12 @@ preferences_dialog_create (void) old_save_session_info = gimprc.save_session_info; old_save_device_status = gimprc.save_device_status; old_always_restore_session = gimprc.always_restore_session; - old_default_width = gimprc.default_width; - old_default_height = gimprc.default_height; - old_default_units = gimprc.default_units; - old_default_xresolution = gimprc.default_xresolution; - old_default_yresolution = gimprc.default_yresolution; - old_default_resolution_units = gimprc.default_resolution_units; - old_default_type = gimprc.default_type; old_default_dot_for_dot = gimprc.default_dot_for_dot; old_monitor_xres = gimprc.monitor_xres; old_monitor_yres = gimprc.monitor_yres; old_using_xserver_resolution = gimprc.using_xserver_resolution; old_global_paint_options = gimprc.global_paint_options; old_max_new_image_size = gimprc.max_new_image_size; - old_thumbnail_mode = gimprc.thumbnail_mode; old_trust_dirty_flag = gimprc.trust_dirty_flag; old_use_help = gimprc.use_help; old_help_browser = gimprc.help_browser; @@ -1459,7 +1467,7 @@ preferences_dialog_create (void) old_default_threshold = gimprc.default_threshold; prefs_strset (&old_image_title_format, gimprc.image_title_format); - prefs_strset (&old_default_comment, gimprc.default_comment); + prefs_strset (&old_default_comment, core_config->default_comment); /* values which will need a restart */ old_stingy_memory_use = edit_stingy_memory_use; @@ -1559,7 +1567,8 @@ preferences_dialog_create (void) gtk_widget_show (hbox); sizeentry = - gimp_size_entry_new (2, gimprc.default_units, "%p", FALSE, FALSE, TRUE, 75, + gimp_size_entry_new (2, core_config->default_units, "%p", + FALSE, FALSE, TRUE, 75, GIMP_SIZE_ENTRY_UPDATE_SIZE); gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry), @@ -1569,10 +1578,10 @@ preferences_dialog_create (void) gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry), _("Pixels"), 1, 4, 0.0); - gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), - 0, gimprc.default_xresolution, FALSE); - gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), - 1, gimprc.default_yresolution, FALSE); + gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0, + core_config->default_xresolution, FALSE); + gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 1, + core_config->default_yresolution, FALSE); gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0, GIMP_MIN_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE); @@ -1580,9 +1589,9 @@ preferences_dialog_create (void) (GIMP_SIZE_ENTRY (sizeentry), 1, GIMP_MIN_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0, - gimprc.default_width); + core_config->default_width); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1, - gimprc.default_height); + core_config->default_height); gtk_signal_connect (GTK_OBJECT (sizeentry), "unit_changed", GTK_SIGNAL_FUNC (prefs_default_size_callback), @@ -1608,13 +1617,14 @@ preferences_dialog_create (void) pixels_per_unit = g_strconcat (_("Pixels"), "/%s", NULL); - sizeentry2 = - gimp_size_entry_new (2, gimprc.default_resolution_units, pixels_per_unit, - FALSE, FALSE, TRUE, 75, - GIMP_SIZE_ENTRY_UPDATE_RESOLUTION); + sizeentry2 = gimp_size_entry_new (2, core_config->default_resolution_units, + pixels_per_unit, + FALSE, FALSE, TRUE, 75, + GIMP_SIZE_ENTRY_UPDATE_RESOLUTION); button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM); - if (ABS (gimprc.default_xresolution - gimprc.default_yresolution) < GIMP_MIN_RESOLUTION) + if (ABS (core_config->default_xresolution - + core_config->default_yresolution) < GIMP_MIN_RESOLUTION) gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (button), TRUE); gtk_table_attach_defaults (GTK_TABLE (sizeentry2), button, 1, 3, 3, 4); gtk_widget_show (button); @@ -1633,10 +1643,10 @@ preferences_dialog_create (void) gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry2), 1, GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION); - gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry2), - 0, gimprc.default_xresolution); - gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry2), - 1, gimprc.default_yresolution); + gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry2), 0, + core_config->default_xresolution); + gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry2), 1, + core_config->default_yresolution); gtk_signal_connect (GTK_OBJECT (sizeentry2), "unit_changed", (GtkSignalFunc) prefs_default_resolution_callback, @@ -1664,8 +1674,8 @@ preferences_dialog_create (void) optionmenu = gimp_option_menu_new2 (FALSE, prefs_toggle_callback, - &(gimprc.default_type), (gpointer) - gimprc.default_type, + &core_config->default_type, + (gpointer) core_config->default_type, _("RGB"), (gpointer) RGB, NULL, _("Grayscale"), (gpointer) GRAY, NULL, @@ -1682,7 +1692,7 @@ preferences_dialog_create (void) hbox = gimp_mem_size_entry_new (GTK_ADJUSTMENT (adjustment)); gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", GTK_SIGNAL_FUNC (gimp_uint_adjustment_update), - &(gimprc.max_new_image_size)); + &gimprc.max_new_image_size); gimp_table_attach_aligned (GTK_TABLE (table), 0, 1, _("Maximum Image Size:"), 1.0, 0.5, hbox, 1, TRUE); @@ -1710,10 +1720,11 @@ preferences_dialog_create (void) text = gtk_text_new (NULL, NULL); gtk_text_set_editable (GTK_TEXT (text), TRUE); - gtk_text_insert (GTK_TEXT (text), NULL, NULL, NULL, gimprc.default_comment, -1); + gtk_text_insert (GTK_TEXT (text), NULL, NULL, NULL, + core_config->default_comment, -1); gtk_signal_connect (GTK_OBJECT (text), "changed", GTK_SIGNAL_FUNC (prefs_text_callback), - &(gimprc.default_comment)); + &core_config->default_comment); gtk_container_add (GTK_CONTAINER (hbox), text); gtk_widget_show (text); @@ -1746,7 +1757,8 @@ preferences_dialog_create (void) optionmenu = gimp_option_menu_new2 (FALSE, prefs_toggle_callback, - &(gimprc.transparency_type), (gpointer) gimprc.transparency_type, + &gimprc.transparency_type, + (gpointer) gimprc.transparency_type, _("Light Checks"), (gpointer) LIGHT_CHECKS, NULL, _("Mid-Tone Checks"), (gpointer) GRAY_CHECKS, NULL, @@ -1762,8 +1774,8 @@ preferences_dialog_create (void) optionmenu = gimp_option_menu_new2 (FALSE, prefs_toggle_callback, - &(gimprc.transparency_size), (gpointer) - gimprc.transparency_size, + &gimprc.transparency_size, + (gpointer) gimprc.transparency_size, _("Small"), (gpointer) SMALL_CHECKS, NULL, _("Medium"), (gpointer) MEDIUM_CHECKS, NULL, @@ -1853,8 +1865,8 @@ preferences_dialog_create (void) optionmenu = gimp_option_menu_new2 (FALSE, prefs_preview_size_callback, - &(gimprc.preview_size), (gpointer) - gimprc.preview_size, + &gimprc.preview_size, + (gpointer) gimprc.preview_size, _("None"), (gpointer) 0, NULL, _("Tiny"), (gpointer) 24, NULL, @@ -1870,8 +1882,8 @@ preferences_dialog_create (void) optionmenu = gimp_option_menu_new2 (FALSE, prefs_nav_preview_size_callback, - &(gimprc.nav_preview_size), (gpointer) - gimprc.nav_preview_size, + &gimprc.nav_preview_size, + (gpointer) gimprc.nav_preview_size, _("Small"), (gpointer) 48, NULL, _("Medium"), (gpointer) 80, NULL, @@ -1956,7 +1968,7 @@ preferences_dialog_create (void) gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC (prefs_toggle_callback), - &(gimprc.show_tool_tips)); + &gimprc.show_tool_tips); gtk_widget_show (button); button = @@ -1966,7 +1978,7 @@ preferences_dialog_create (void) gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC (prefs_toggle_callback), - &(gimprc.use_help)); + &gimprc.use_help); gtk_widget_show (button); vbox2 = prefs_frame_new (_("Help Browser"), GTK_BOX (vbox)); @@ -1979,7 +1991,8 @@ preferences_dialog_create (void) optionmenu = gimp_option_menu_new2 (FALSE, prefs_toggle_callback, - &(gimprc.help_browser), (gpointer) gimprc.help_browser, + &gimprc.help_browser, + (gpointer) gimprc.help_browser, _("Internal"), (gpointer) HELP_BROWSER_GIMP, NULL, _("Netscape"), (gpointer) HELP_BROWSER_NETSCAPE, NULL, @@ -2009,7 +2022,7 @@ preferences_dialog_create (void) gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC (prefs_toggle_callback), - &(gimprc.default_dot_for_dot)); + &gimprc.default_dot_for_dot); gtk_widget_show (button); button = gtk_check_button_new_with_label(_("Resize Window on Zoom")); @@ -2018,7 +2031,7 @@ preferences_dialog_create (void) gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC (prefs_toggle_callback), - &(gimprc.allow_resize_windows)); + &gimprc.allow_resize_windows); gtk_widget_show (button); button = gtk_check_button_new_with_label(_("Show Rulers")); @@ -2027,7 +2040,7 @@ preferences_dialog_create (void) gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC (prefs_toggle_callback), - &(gimprc.show_rulers)); + &gimprc.show_rulers); gtk_widget_show (button); button = gtk_check_button_new_with_label(_("Show Statusbar")); @@ -2036,7 +2049,7 @@ preferences_dialog_create (void) gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC (prefs_toggle_callback), - &(gimprc.show_statusbar)); + &gimprc.show_statusbar); gtk_widget_show (button); table = gtk_table_new (2, 2, FALSE); @@ -2047,12 +2060,11 @@ preferences_dialog_create (void) gtk_widget_show (table); spinbutton = - gimp_spin_button_new (&adjustment, - gimprc.marching_speed, 50.0, 32000.0, 10.0, 100.0, 1.0, - 1.0, 0.0); + gimp_spin_button_new (&adjustment, gimprc.marching_speed, + 50.0, 32000.0, 10.0, 100.0, 1.0, 1.0, 0.0); gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", GTK_SIGNAL_FUNC (gimp_int_adjustment_update), - &(gimprc.marching_speed)); + &gimprc.marching_speed); gimp_table_attach_aligned (GTK_TABLE (table), 0, 0, _("Marching Ants Speed:"), 1.0, 0.5, spinbutton, 1, TRUE); @@ -2091,7 +2103,7 @@ preferences_dialog_create (void) gtk_signal_connect (GTK_OBJECT (GTK_COMBO (combo)->entry), "changed", GTK_SIGNAL_FUNC (prefs_string_callback), - &(gimprc.image_title_format)); + &gimprc.image_title_format); gimp_table_attach_aligned (GTK_TABLE (table), 0, 1, _("Image Title Format:"), 1.0, 0.5, @@ -2107,7 +2119,7 @@ preferences_dialog_create (void) gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC (prefs_toggle_callback), - &(gimprc.perfectmouse)); + &gimprc.perfectmouse); gtk_widget_show (button); button = gtk_check_button_new_with_label (_("Disable Cursor Updating")); @@ -2116,7 +2128,7 @@ preferences_dialog_create (void) gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC (prefs_toggle_callback), - &(gimprc.no_cursor_updating)); + &gimprc.no_cursor_updating); gtk_widget_show (button); table = gtk_table_new (1, 2, FALSE); @@ -2127,7 +2139,7 @@ preferences_dialog_create (void) optionmenu = gimp_option_menu_new2 (FALSE, prefs_toggle_callback, - &(gimprc.cursor_mode), + &gimprc.cursor_mode, (gpointer) gimprc.cursor_mode, _("Tool Icon"), @@ -2164,7 +2176,7 @@ preferences_dialog_create (void) gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC (prefs_toggle_callback), - &(gimprc.global_paint_options)); + &gimprc.global_paint_options); gtk_widget_show (button); vbox2 = prefs_frame_new (_("Finding Contiguous Regions"), GTK_BOX (vbox)); @@ -2178,12 +2190,11 @@ preferences_dialog_create (void) /* Default threshold */ spinbutton = - gimp_spin_button_new (&adjustment, - gimprc.default_threshold, 0.0, 255.0, - 1.0, 5.0, 0.0, 1.0, 0.0); + gimp_spin_button_new (&adjustment, gimprc.default_threshold, + 0.0, 255.0, 1.0, 5.0, 0.0, 1.0, 0.0); gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", GTK_SIGNAL_FUNC (gimp_int_adjustment_update), - &(gimprc.default_threshold)); + &gimprc.default_threshold); gimp_table_attach_aligned (GTK_TABLE (table), 0, 0, _("Default Threshold:"), 1.0, 0.5, spinbutton, 1, TRUE); @@ -2227,12 +2238,11 @@ preferences_dialog_create (void) gtk_widget_show (table); /* Levels of Undo */ - spinbutton = - gimp_spin_button_new (&adjustment, - gimprc.levels_of_undo, 0.0, 255.0, 1.0, 5.0, 0.0, 1.0, 0.0); + spinbutton = gimp_spin_button_new (&adjustment, core_config->levels_of_undo, + 0.0, 255.0, 1.0, 5.0, 0.0, 1.0, 0.0); gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", GTK_SIGNAL_FUNC (gimp_int_adjustment_update), - &(gimprc.levels_of_undo)); + &core_config->levels_of_undo); gimp_table_attach_aligned (GTK_TABLE (table), 0, 0, _("Levels of Undo:"), 1.0, 0.5, spinbutton, 1, TRUE); @@ -2307,8 +2317,8 @@ preferences_dialog_create (void) optionmenu = gimp_option_menu_new2 (FALSE, prefs_toggle_callback, - &(gimprc.thumbnail_mode), (gpointer) - gimprc.thumbnail_mode, + &core_config->thumbnail_mode, + (gpointer) core_config->thumbnail_mode, _("Always"), (gpointer) 1, NULL, _("Never"), (gpointer) 0, NULL, @@ -2320,7 +2330,7 @@ preferences_dialog_create (void) optionmenu = gimp_option_menu_new2 (FALSE, prefs_toggle_callback, - &(gimprc.trust_dirty_flag), + &gimprc.trust_dirty_flag, (gpointer) gimprc.trust_dirty_flag, _("Only when Modified"), (gpointer) 1, NULL, @@ -2352,7 +2362,7 @@ preferences_dialog_create (void) gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC (prefs_toggle_callback), - &(gimprc.save_session_info)); + &gimprc.save_session_info); gtk_widget_show (button); hbox = gtk_hbox_new (FALSE, 2); @@ -2374,7 +2384,7 @@ preferences_dialog_create (void) gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC (prefs_toggle_callback), - &(gimprc.always_restore_session)); + &gimprc.always_restore_session); gtk_widget_show (button); vbox2 = prefs_frame_new (_("Devices"), GTK_BOX (vbox)); @@ -2385,7 +2395,7 @@ preferences_dialog_create (void) gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC (prefs_toggle_callback), - &(gimprc.save_device_status)); + &gimprc.save_device_status); gtk_widget_show (button); /* Monitor */ @@ -2459,7 +2469,7 @@ preferences_dialog_create (void) gtk_container_add (GTK_CONTAINER (abox), sizeentry); gtk_widget_show (sizeentry); - gtk_widget_set_sensitive (sizeentry, !gimprc.using_xserver_resolution); + gtk_widget_set_sensitive (sizeentry, ! gimprc.using_xserver_resolution); hbox = gtk_hbox_new (FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER (hbox), 4); @@ -2471,7 +2481,7 @@ preferences_dialog_create (void) sizeentry); gtk_box_pack_start (GTK_BOX (hbox), calibrate_button, FALSE, FALSE, 0); gtk_widget_show (calibrate_button); - gtk_widget_set_sensitive (calibrate_button, !gimprc.using_xserver_resolution); + gtk_widget_set_sensitive (calibrate_button, ! gimprc.using_xserver_resolution); group = NULL; button = gtk_radio_button_new_with_label (group, _("From windowing system")); @@ -2507,7 +2517,7 @@ preferences_dialog_create (void) gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); - if (!gimprc.using_xserver_resolution) + if (! gimprc.using_xserver_resolution) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); /* Directories */ diff --git a/app/dialogs/resize-dialog.c b/app/dialogs/resize-dialog.c index a36ed7b762..4feb074774 100644 --- a/app/dialogs/resize-dialog.c +++ b/app/dialogs/resize-dialog.c @@ -26,13 +26,12 @@ #include "core/core-types.h" +#include "core/gimpcoreconfig.h" #include "core/gimpimage.h" #include "core/gimplayer.h" #include "resize-dialog.h" -#include "gimprc.h" - #include "libgimp/gimpintl.h" @@ -593,7 +592,7 @@ resize_widget_new (ResizeType type, gtk_widget_set_usize (spinbutton, 75, 0); private->resolution_se = - gimp_size_entry_new (1, gimprc.default_resolution_units, + gimp_size_entry_new (1, core_config->default_resolution_units, _("pixels/%a"), FALSE, FALSE, FALSE, 75, GIMP_SIZE_ENTRY_UPDATE_RESOLUTION); diff --git a/app/disp_callbacks.c b/app/disp_callbacks.c index 29b9f627ea..a7e41f21fb 100644 --- a/app/disp_callbacks.c +++ b/app/disp_callbacks.c @@ -34,6 +34,7 @@ #include "paint-funcs/paint-funcs.h" +#include "core/gimp.h" #include "core/gimpbuffer.h" #include "core/gimpcontext.h" #include "core/gimpedit.h" @@ -159,7 +160,8 @@ gdisplay_shell_events (GtkWidget *widget, case GDK_KEY_PRESS: case GDK_BUTTON_PRESS: /* Setting the context's display automatically sets the image, too */ - gimp_context_set_display (gimp_context_get_user (), gdisp); + gimp_context_set_display (gimp_get_user_context (gdisp->gimage->gimp), + gdisp); break; default: @@ -318,7 +320,8 @@ gdisplay_canvas_events (GtkWidget *canvas, /* and doesn't want to be preserved across drawable changes */ ! active_tool->preserve) { - tool_manager_initialize_tool (active_tool, gdisp); + tool_manager_initialize_tool (gdisp->gimage->gimp, + active_tool, gdisp); } /* otherwise set it's drawable if it has none */ @@ -685,8 +688,9 @@ gdisplay_hruler_button_press (GtkWidget *widget, { gdisp = data; - gimp_context_set_tool (gimp_context_get_user (), - tool_manager_get_info_by_type (GIMP_TYPE_MOVE_TOOL)); + gimp_context_set_tool (gimp_get_user_context (gdisp->gimage->gimp), + tool_manager_get_info_by_type (gdisp->gimage->gimp, + GIMP_TYPE_MOVE_TOOL)); gimp_move_tool_start_hguide (active_tool, gdisp); gtk_grab_add (gdisp->canvas); @@ -709,8 +713,9 @@ gdisplay_vruler_button_press (GtkWidget *widget, { gdisp = data; - gimp_context_set_tool (gimp_context_get_user (), - tool_manager_get_info_by_type (GIMP_TYPE_MOVE_TOOL)); + gimp_context_set_tool (gimp_get_user_context (gdisp->gimage->gimp), + tool_manager_get_info_by_type (gdisp->gimage->gimp, + GIMP_TYPE_MOVE_TOOL)); gimp_move_tool_start_vguide (active_tool, gdisp); gtk_grab_add (gdisp->canvas); @@ -875,7 +880,8 @@ gdisplay_drop_drawable (GtkWidget *widget, gdisplays_flush (); - gimp_context_set_display (gimp_context_get_user (), gdisp); + gimp_context_set_display (gimp_get_user_context (gdisp->gimage->gimp), + gdisp); } } @@ -911,7 +917,8 @@ gdisplay_bucket_fill (GtkWidget *widget, gimp_set_busy (); /* Get the bucket fill context */ - tool_info = tool_manager_get_info_by_type (GIMP_TYPE_BUCKET_FILL_TOOL); + tool_info = tool_manager_get_info_by_type (gimage->gimp, + GIMP_TYPE_BUCKET_FILL_TOOL); if (tool_info && tool_info->context) { @@ -919,7 +926,7 @@ gdisplay_bucket_fill (GtkWidget *widget, } else { - context = gimp_context_get_user (); + context = gimp_get_user_context (gimage->gimp); } /* Transform the passed data for the dest image */ diff --git a/app/display/gimpdisplay-callbacks.c b/app/display/gimpdisplay-callbacks.c index 29b9f627ea..a7e41f21fb 100644 --- a/app/display/gimpdisplay-callbacks.c +++ b/app/display/gimpdisplay-callbacks.c @@ -34,6 +34,7 @@ #include "paint-funcs/paint-funcs.h" +#include "core/gimp.h" #include "core/gimpbuffer.h" #include "core/gimpcontext.h" #include "core/gimpedit.h" @@ -159,7 +160,8 @@ gdisplay_shell_events (GtkWidget *widget, case GDK_KEY_PRESS: case GDK_BUTTON_PRESS: /* Setting the context's display automatically sets the image, too */ - gimp_context_set_display (gimp_context_get_user (), gdisp); + gimp_context_set_display (gimp_get_user_context (gdisp->gimage->gimp), + gdisp); break; default: @@ -318,7 +320,8 @@ gdisplay_canvas_events (GtkWidget *canvas, /* and doesn't want to be preserved across drawable changes */ ! active_tool->preserve) { - tool_manager_initialize_tool (active_tool, gdisp); + tool_manager_initialize_tool (gdisp->gimage->gimp, + active_tool, gdisp); } /* otherwise set it's drawable if it has none */ @@ -685,8 +688,9 @@ gdisplay_hruler_button_press (GtkWidget *widget, { gdisp = data; - gimp_context_set_tool (gimp_context_get_user (), - tool_manager_get_info_by_type (GIMP_TYPE_MOVE_TOOL)); + gimp_context_set_tool (gimp_get_user_context (gdisp->gimage->gimp), + tool_manager_get_info_by_type (gdisp->gimage->gimp, + GIMP_TYPE_MOVE_TOOL)); gimp_move_tool_start_hguide (active_tool, gdisp); gtk_grab_add (gdisp->canvas); @@ -709,8 +713,9 @@ gdisplay_vruler_button_press (GtkWidget *widget, { gdisp = data; - gimp_context_set_tool (gimp_context_get_user (), - tool_manager_get_info_by_type (GIMP_TYPE_MOVE_TOOL)); + gimp_context_set_tool (gimp_get_user_context (gdisp->gimage->gimp), + tool_manager_get_info_by_type (gdisp->gimage->gimp, + GIMP_TYPE_MOVE_TOOL)); gimp_move_tool_start_vguide (active_tool, gdisp); gtk_grab_add (gdisp->canvas); @@ -875,7 +880,8 @@ gdisplay_drop_drawable (GtkWidget *widget, gdisplays_flush (); - gimp_context_set_display (gimp_context_get_user (), gdisp); + gimp_context_set_display (gimp_get_user_context (gdisp->gimage->gimp), + gdisp); } } @@ -911,7 +917,8 @@ gdisplay_bucket_fill (GtkWidget *widget, gimp_set_busy (); /* Get the bucket fill context */ - tool_info = tool_manager_get_info_by_type (GIMP_TYPE_BUCKET_FILL_TOOL); + tool_info = tool_manager_get_info_by_type (gimage->gimp, + GIMP_TYPE_BUCKET_FILL_TOOL); if (tool_info && tool_info->context) { @@ -919,7 +926,7 @@ gdisplay_bucket_fill (GtkWidget *widget, } else { - context = gimp_context_get_user (); + context = gimp_get_user_context (gimage->gimp); } /* Transform the passed data for the dest image */ diff --git a/app/display/gimpdisplay-selection.c b/app/display/gimpdisplay-selection.c index 8007cf1085..4e2a38a7f5 100644 --- a/app/display/gimpdisplay-selection.c +++ b/app/display/gimpdisplay-selection.c @@ -211,6 +211,8 @@ selection_pause (Selection *select) { g_source_remove (select->timeout_id); select->timeout_id = 0; + + select->state = INVISIBLE; } select->paused ++; diff --git a/app/display/gimpdisplay.c b/app/display/gimpdisplay.c index 2bb31c197b..768db9c7d9 100644 --- a/app/display/gimpdisplay.c +++ b/app/display/gimpdisplay.c @@ -31,6 +31,7 @@ #include "base/temp-buf.h" +#include "core/gimp.h" #include "core/gimpchannel.h" #include "core/gimpcontainer.h" #include "core/gimpcontext.h" @@ -51,6 +52,7 @@ #include "gui/menus.h" #include "nav_window.h" +#include "app_procs.h" #include "appenv.h" #include "colormaps.h" #include "gimprc.h" @@ -785,8 +787,12 @@ gdisplay_flush_whenever (GDisplay *gdisp, qmask_buttons_update (gdisp); /* ensure the consistency of the tear-off menus */ - if (!now && gimp_context_get_display (gimp_context_get_user ()) == gdisp) - gdisplay_set_menu_sensitivity (gdisp); + if (! now && + gimp_context_get_display (gimp_get_user_context + (gdisp->gimage->gimp)) == gdisp) + { + gdisplay_set_menu_sensitivity (gdisp); + } } void @@ -2229,7 +2235,7 @@ gdisplay_active (void) gdk_event_free (event); } - return gimp_context_get_display (gimp_context_get_user ()); + return gimp_context_get_display (gimp_get_user_context (the_gimp)); } GDisplay * diff --git a/app/display/gimpdisplayshell-callbacks.c b/app/display/gimpdisplayshell-callbacks.c index 29b9f627ea..a7e41f21fb 100644 --- a/app/display/gimpdisplayshell-callbacks.c +++ b/app/display/gimpdisplayshell-callbacks.c @@ -34,6 +34,7 @@ #include "paint-funcs/paint-funcs.h" +#include "core/gimp.h" #include "core/gimpbuffer.h" #include "core/gimpcontext.h" #include "core/gimpedit.h" @@ -159,7 +160,8 @@ gdisplay_shell_events (GtkWidget *widget, case GDK_KEY_PRESS: case GDK_BUTTON_PRESS: /* Setting the context's display automatically sets the image, too */ - gimp_context_set_display (gimp_context_get_user (), gdisp); + gimp_context_set_display (gimp_get_user_context (gdisp->gimage->gimp), + gdisp); break; default: @@ -318,7 +320,8 @@ gdisplay_canvas_events (GtkWidget *canvas, /* and doesn't want to be preserved across drawable changes */ ! active_tool->preserve) { - tool_manager_initialize_tool (active_tool, gdisp); + tool_manager_initialize_tool (gdisp->gimage->gimp, + active_tool, gdisp); } /* otherwise set it's drawable if it has none */ @@ -685,8 +688,9 @@ gdisplay_hruler_button_press (GtkWidget *widget, { gdisp = data; - gimp_context_set_tool (gimp_context_get_user (), - tool_manager_get_info_by_type (GIMP_TYPE_MOVE_TOOL)); + gimp_context_set_tool (gimp_get_user_context (gdisp->gimage->gimp), + tool_manager_get_info_by_type (gdisp->gimage->gimp, + GIMP_TYPE_MOVE_TOOL)); gimp_move_tool_start_hguide (active_tool, gdisp); gtk_grab_add (gdisp->canvas); @@ -709,8 +713,9 @@ gdisplay_vruler_button_press (GtkWidget *widget, { gdisp = data; - gimp_context_set_tool (gimp_context_get_user (), - tool_manager_get_info_by_type (GIMP_TYPE_MOVE_TOOL)); + gimp_context_set_tool (gimp_get_user_context (gdisp->gimage->gimp), + tool_manager_get_info_by_type (gdisp->gimage->gimp, + GIMP_TYPE_MOVE_TOOL)); gimp_move_tool_start_vguide (active_tool, gdisp); gtk_grab_add (gdisp->canvas); @@ -875,7 +880,8 @@ gdisplay_drop_drawable (GtkWidget *widget, gdisplays_flush (); - gimp_context_set_display (gimp_context_get_user (), gdisp); + gimp_context_set_display (gimp_get_user_context (gdisp->gimage->gimp), + gdisp); } } @@ -911,7 +917,8 @@ gdisplay_bucket_fill (GtkWidget *widget, gimp_set_busy (); /* Get the bucket fill context */ - tool_info = tool_manager_get_info_by_type (GIMP_TYPE_BUCKET_FILL_TOOL); + tool_info = tool_manager_get_info_by_type (gimage->gimp, + GIMP_TYPE_BUCKET_FILL_TOOL); if (tool_info && tool_info->context) { @@ -919,7 +926,7 @@ gdisplay_bucket_fill (GtkWidget *widget, } else { - context = gimp_context_get_user (); + context = gimp_get_user_context (gimage->gimp); } /* Transform the passed data for the dest image */ diff --git a/app/display/gimpdisplayshell-qmask.c b/app/display/gimpdisplayshell-qmask.c index 88179c8537..4161b32b02 100644 --- a/app/display/gimpdisplayshell-qmask.c +++ b/app/display/gimpdisplayshell-qmask.c @@ -29,6 +29,7 @@ #include "core/core-types.h" +#include "core/gimp.h" #include "core/gimpchannel.h" #include "core/gimpcontext.h" #include "core/gimpimage.h" @@ -36,6 +37,7 @@ #include "widgets/gimpcolorpanel.h" +#include "app_procs.h" #include "drawable.h" #include "floating_sel.h" #include "gdisplay.h" @@ -238,7 +240,10 @@ qmask_activate (GtkWidget *widget, "Qmask", &color); gimp_image_add_channel (gimg, gmask, 0); - drawable_fill (GIMP_DRAWABLE (gmask), TRANSPARENT_FILL); + + drawable_fill (GIMP_DRAWABLE (gmask), + gimp_get_user_context (gimg->gimp), + TRANSPARENT_FILL); } else { diff --git a/app/display/gimpdisplayshell-selection.c b/app/display/gimpdisplayshell-selection.c index 8007cf1085..4e2a38a7f5 100644 --- a/app/display/gimpdisplayshell-selection.c +++ b/app/display/gimpdisplayshell-selection.c @@ -211,6 +211,8 @@ selection_pause (Selection *select) { g_source_remove (select->timeout_id); select->timeout_id = 0; + + select->state = INVISIBLE; } select->paused ++; diff --git a/app/display/gimpnavigationeditor.c b/app/display/gimpnavigationeditor.c index 980ff89f86..ba16e77ddd 100644 --- a/app/display/gimpnavigationeditor.c +++ b/app/display/gimpnavigationeditor.c @@ -363,7 +363,7 @@ nav_dialog_follow_auto (void) GimpContext *context; GDisplay *gdisp; - context = gimp_context_get_user (); + context = gimp_get_user_context (the_gimp); gdisp = gimp_context_get_display (context); diff --git a/app/display/gimpnavigationview.c b/app/display/gimpnavigationview.c index 980ff89f86..ba16e77ddd 100644 --- a/app/display/gimpnavigationview.c +++ b/app/display/gimpnavigationview.c @@ -363,7 +363,7 @@ nav_dialog_follow_auto (void) GimpContext *context; GDisplay *gdisp; - context = gimp_context_get_user (); + context = gimp_get_user_context (the_gimp); gdisp = gimp_context_get_display (context); diff --git a/app/drawable.c b/app/drawable.c index 7e9108b306..4589b90c90 100644 --- a/app/drawable.c +++ b/app/drawable.c @@ -34,6 +34,7 @@ void drawable_fill (GimpDrawable *drawable, + GimpContext *context, GimpFillType fill_type) { GimpRGB color; @@ -46,11 +47,11 @@ drawable_fill (GimpDrawable *drawable, switch (fill_type) { case FOREGROUND_FILL: - gimp_context_get_foreground (NULL, &color); + gimp_context_get_foreground (context, &color); break; case BACKGROUND_FILL: - gimp_context_get_background (NULL, &color); + gimp_context_get_background (context, &color); break; case WHITE_FILL: diff --git a/app/drawable.h b/app/drawable.h index b31e6beaaa..604fb4cc9c 100644 --- a/app/drawable.h +++ b/app/drawable.h @@ -21,7 +21,9 @@ void drawable_fill (GimpDrawable *drawable, + GimpContext *context, GimpFillType fill_type); + void drawable_update (GimpDrawable *drawable, gint x, gint y, diff --git a/app/errors.c b/app/errors.c index 4ad38f0d1f..1fbb76ff30 100644 --- a/app/errors.c +++ b/app/errors.c @@ -145,11 +145,34 @@ gimp_terminate (gchar *fmt, ...) if (use_debug_handler) { - sigset_t sigset; + switch (stack_trace_mode) + { + case STACK_TRACE_NEVER: + break; + + case STACK_TRACE_QUERY: + { + sigset_t sigset; + + sigemptyset (&sigset); + sigprocmask (SIG_SETMASK, &sigset, NULL); + g_on_error_query (prog_name); + } + break; + + case STACK_TRACE_ALWAYS: + { + sigset_t sigset; - sigemptyset (&sigset); - sigprocmask (SIG_SETMASK, &sigset, NULL); - g_on_error_query (prog_name); + sigemptyset (&sigset); + sigprocmask (SIG_SETMASK, &sigset, NULL); + g_on_error_stack_trace (prog_name); + } + break; + + default: + break; + } } #else diff --git a/app/file-open.c b/app/file-open.c index baa5f7332a..acadcf8fde 100644 --- a/app/file-open.c +++ b/app/file-open.c @@ -61,8 +61,6 @@ #include "core/gimpimage.h" -#include "app_procs.h" -#include "gimprc.h" #include "file-open.h" #include "file-utils.h" #include "plug_in.h" @@ -77,7 +75,8 @@ GSList *load_procs = NULL; /* public functions */ GimpImage * -file_open_image (const gchar *filename, +file_open_image (Gimp *gimp, + const gchar *filename, const gchar *raw_filename, const gchar *open_mode, PlugInProcDef *file_proc, @@ -157,7 +156,7 @@ file_open_image (const gchar *filename, args[1].value.pdb_pointer = (gchar *) filename; args[2].value.pdb_pointer = (gchar *) raw_filename; - return_vals = procedural_db_execute (the_gimp, proc->name, args); + return_vals = procedural_db_execute (gimp, proc->name, args); *status = return_vals[0].value.pdb_int; gimage_id = return_vals[1].value.pdb_int; diff --git a/app/file-open.h b/app/file-open.h index 24b6596cb9..a6614a7e0f 100644 --- a/app/file-open.h +++ b/app/file-open.h @@ -23,7 +23,8 @@ extern GSList *load_procs; -GimpImage * file_open_image (const gchar *filename, +GimpImage * file_open_image (Gimp *gimp, + const gchar *filename, const gchar *raw_filename, const gchar *open_mode, PlugInProcDef *file_proc, diff --git a/app/file-save.c b/app/file-save.c index 44ae01e295..ab17a0642a 100644 --- a/app/file-save.c +++ b/app/file-save.c @@ -59,13 +59,13 @@ #include "core/core-types.h" +#include "core/gimpcoreconfig.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" #include "docindex.h" #include "gui/menus.h" -#include "gimprc.h" #include "file-save.h" #include "file-utils.h" #include "plug_in.h" @@ -181,7 +181,7 @@ file_save (GimpImage *gimage, /* gimage_set_save_proc(gimage, file_proc); */ /* Write a thumbnail for the saved image, where appropriate */ - switch (gimprc.thumbnail_mode) + switch (core_config->thumbnail_mode) { case 0: break; diff --git a/app/file/file-open.c b/app/file/file-open.c index baa5f7332a..acadcf8fde 100644 --- a/app/file/file-open.c +++ b/app/file/file-open.c @@ -61,8 +61,6 @@ #include "core/gimpimage.h" -#include "app_procs.h" -#include "gimprc.h" #include "file-open.h" #include "file-utils.h" #include "plug_in.h" @@ -77,7 +75,8 @@ GSList *load_procs = NULL; /* public functions */ GimpImage * -file_open_image (const gchar *filename, +file_open_image (Gimp *gimp, + const gchar *filename, const gchar *raw_filename, const gchar *open_mode, PlugInProcDef *file_proc, @@ -157,7 +156,7 @@ file_open_image (const gchar *filename, args[1].value.pdb_pointer = (gchar *) filename; args[2].value.pdb_pointer = (gchar *) raw_filename; - return_vals = procedural_db_execute (the_gimp, proc->name, args); + return_vals = procedural_db_execute (gimp, proc->name, args); *status = return_vals[0].value.pdb_int; gimage_id = return_vals[1].value.pdb_int; diff --git a/app/file/file-open.h b/app/file/file-open.h index 24b6596cb9..a6614a7e0f 100644 --- a/app/file/file-open.h +++ b/app/file/file-open.h @@ -23,7 +23,8 @@ extern GSList *load_procs; -GimpImage * file_open_image (const gchar *filename, +GimpImage * file_open_image (Gimp *gimp, + const gchar *filename, const gchar *raw_filename, const gchar *open_mode, PlugInProcDef *file_proc, diff --git a/app/file/file-save.c b/app/file/file-save.c index 44ae01e295..ab17a0642a 100644 --- a/app/file/file-save.c +++ b/app/file/file-save.c @@ -59,13 +59,13 @@ #include "core/core-types.h" +#include "core/gimpcoreconfig.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" #include "docindex.h" #include "gui/menus.h" -#include "gimprc.h" #include "file-save.h" #include "file-utils.h" #include "plug_in.h" @@ -181,7 +181,7 @@ file_save (GimpImage *gimage, /* gimage_set_save_proc(gimage, file_proc); */ /* Write a thumbnail for the saved image, where appropriate */ - switch (gimprc.thumbnail_mode) + switch (core_config->thumbnail_mode) { case 0: break; diff --git a/app/gdisplay.c b/app/gdisplay.c index 2bb31c197b..768db9c7d9 100644 --- a/app/gdisplay.c +++ b/app/gdisplay.c @@ -31,6 +31,7 @@ #include "base/temp-buf.h" +#include "core/gimp.h" #include "core/gimpchannel.h" #include "core/gimpcontainer.h" #include "core/gimpcontext.h" @@ -51,6 +52,7 @@ #include "gui/menus.h" #include "nav_window.h" +#include "app_procs.h" #include "appenv.h" #include "colormaps.h" #include "gimprc.h" @@ -785,8 +787,12 @@ gdisplay_flush_whenever (GDisplay *gdisp, qmask_buttons_update (gdisp); /* ensure the consistency of the tear-off menus */ - if (!now && gimp_context_get_display (gimp_context_get_user ()) == gdisp) - gdisplay_set_menu_sensitivity (gdisp); + if (! now && + gimp_context_get_display (gimp_get_user_context + (gdisp->gimage->gimp)) == gdisp) + { + gdisplay_set_menu_sensitivity (gdisp); + } } void @@ -2229,7 +2235,7 @@ gdisplay_active (void) gdk_event_free (event); } - return gimp_context_get_display (gimp_context_get_user ()); + return gimp_context_get_display (gimp_get_user_context (the_gimp)); } GDisplay * diff --git a/app/gimage.c b/app/gimage.c index f71c36a470..7381b4a97f 100644 --- a/app/gimage.c +++ b/app/gimage.c @@ -102,9 +102,9 @@ gimage_dirty_handler (GimpImage *gimage) if (gdisp) { if (gdisp->gimage == gimage) - tool_manager_initialize_tool (active_tool, gdisp); + tool_manager_initialize_tool (gimage->gimp, active_tool, gdisp); else - tool_manager_initialize_tool (active_tool, NULL); + tool_manager_initialize_tool (gimage->gimp, active_tool, NULL); } } } diff --git a/app/gimprc.c b/app/gimprc.c index 20287136cc..213f8fe3c6 100644 --- a/app/gimprc.c +++ b/app/gimprc.c @@ -43,6 +43,7 @@ #include "base/base-config.c" +#include "core/gimpcoreconfig.h" #include "core/gimptoolinfo.h" #include "tools/gimptool.h" @@ -197,24 +198,12 @@ static gchar * open_backup_file (gchar *filename, /* global gimprc variables */ GimpRc gimprc = { - /* plug_in_path */ NULL, - /* brush_path */ NULL, - /* default_brush */ NULL, - /* pattern_path */ NULL, - /* default_pattern */ NULL, - /* palette_path */ NULL, - /* default_palette */ NULL, - /* gradient_path */ NULL, - /* default_gradient */ NULL, - /* pluginrc_path */ NULL, - /* module_path */ NULL, /* marching_speed */ 300, /* 300 ms */ + /* last_opened_size */ 4, /* gamma_val */ 1.0, /* transparency_type */ 1, /* Mid-Tone Checks */ /* perfectmouse */ FALSE, /* off (fast and sloppy) */ /* transparency_size */ 1, /* Medium sized */ - /* levels_of_undo */ 5, - /* last_opened_size */ 4, /* min_colors */ 144, /* 6*6*4 */ /* install_cmap */ FALSE, /* cycled_marching_ants */ 0, @@ -225,20 +214,12 @@ GimpRc gimprc = /* nav_preview_size */ 112, /* show_rulers */ TRUE, /* show_statusbar */ TRUE, - /* default_units */ GIMP_UNIT_INCH, /* auto_save */ TRUE, /* confirm_on_close */ TRUE, + /* default_dot_for_dot */ TRUE, /* save_session_info */ TRUE, /* save_device_status */ FALSE, /* always_restore_session */ TRUE, - /* default_width */ 256, - /* default_height */ 256, - /* default_type */ RGB, - /* default_xresolution */ 72.0, - /* default_yresolution */ 72.0, - /* default_resolution_units */ GIMP_UNIT_INCH, - /* default_comment */ NULL, - /* default_dot_for_dot */ TRUE, /* show_tips */ TRUE, /* last_tip */ -1, /* show_tool_tips */ TRUE, @@ -247,10 +228,8 @@ GimpRc gimprc = /* using_xserver_resolution */ FALSE, /* image_title_format */ NULL, /* global_paint_options */ FALSE, - /* module_db_load_inhibit */ NULL, /* show_indicators */ TRUE, /* max_new_image_size */ 33554432, /* 32 MB */ - /* thumbnail_mode */ 1, /* trust_dirty_flag */ FALSE, /* use_help */ TRUE, /* nav_window_per_display */ FALSE, @@ -265,36 +244,12 @@ static GHashTable *parse_func_hash = NULL; static ParseFunc funcs[] = { - { "brush-path", TT_PATH, - &(gimprc.brush_path), NULL }, - { "pattern-path", TT_PATH, - &(gimprc.pattern_path), NULL }, - { "plug-in-path", TT_PATH, - &(gimprc.plug_in_path), NULL }, - { "palette-path", TT_PATH, - &(gimprc.palette_path), NULL }, - { "gradient-path", TT_PATH, - &(gimprc.gradient_path), NULL }, - { "pluginrc-path", TT_PATH, - &(gimprc.pluginrc_path), NULL }, - { "module-path", TT_PATH, - &(gimprc.module_path), NULL }, - { "default-brush", TT_STRING, - &(gimprc.default_brush), NULL }, - { "default-pattern", TT_STRING, - &(gimprc.default_pattern), NULL }, - { "default-palette", TT_STRING, - &(gimprc.default_palette), NULL }, - { "default-gradient", TT_STRING, - &(gimprc.default_gradient), NULL }, { "gamma-correction", TT_DOUBLE, &(gimprc.gamma_val), NULL }, { "marching-ants-speed", TT_INT, &(gimprc.marching_speed), NULL }, { "last-opened-size", TT_INT, &(gimprc.last_opened_size), NULL }, - { "undo-levels", TT_INT, - &(gimprc.levels_of_undo), NULL }, { "transparency-type", TT_INT, &(gimprc.transparency_type), NULL }, { "perfect-mouse", TT_BOOLEAN, @@ -327,8 +282,6 @@ static ParseFunc funcs[] = &(gimprc.show_statusbar), NULL }, { "dont-show-statusbar", TT_BOOLEAN, NULL, &(gimprc.show_statusbar) }, - { "default-units", TT_XUNIT, - &(gimprc.default_units), NULL }, { "auto-save", TT_BOOLEAN, &(gimprc.auto_save), NULL }, { "dont-auto-save", TT_BOOLEAN, NULL, @@ -357,18 +310,6 @@ static ParseFunc funcs[] = &(gimprc.show_tool_tips), NULL }, { "dont-show-tool-tips", TT_BOOLEAN, NULL, &(gimprc.show_tool_tips) }, - { "default-image-size", TT_POSITION, - &(gimprc.default_width), &(gimprc.default_height) }, - { "default-image-type", TT_IMAGETYPE, - &(gimprc.default_type), NULL }, - { "default-xresolution", TT_DOUBLE, - &(gimprc.default_xresolution), NULL }, - { "default-yresolution", TT_DOUBLE, - &(gimprc.default_yresolution), NULL }, - { "default-resolution-units", TT_XUNIT, - &(gimprc.default_resolution_units), NULL }, - { "default-comment", TT_XCOMMENT, - &(gimprc.default_comment), NULL }, { "default-dot-for-dot", TT_BOOLEAN, &(gimprc.default_dot_for_dot), NULL }, { "plug-in", TT_XPLUGIN, NULL, NULL }, @@ -393,12 +334,8 @@ static ParseFunc funcs[] = &(gimprc.show_indicators) }, { "no-global-paint-options", TT_BOOLEAN, NULL, &(gimprc.global_paint_options) }, - { "module-load-inhibit", TT_PATH, - &(gimprc.module_db_load_inhibit), NULL }, { "max-new-image-size", TT_MEMSIZE, &(gimprc.max_new_image_size), NULL }, - { "thumbnail-mode", TT_INT, - &(gimprc.thumbnail_mode), NULL }, { "trust-dirty-flag", TT_BOOLEAN, &(gimprc.trust_dirty_flag), NULL }, { "dont-trust-dirty-flag", TT_BOOLEAN, NULL, @@ -426,12 +363,12 @@ static gint n_funcs = (sizeof (funcs) / sizeof (funcs[0])); -static ParseInfo parse_info = { NULL }; +static ParseInfo parse_info = { NULL }; -static GList *unknown_tokens = NULL; +static GList *unknown_tokens = NULL; -static gint cur_token; -static gint next_token; +static gint cur_token; +static gint next_token; /* extern variables */ @@ -472,13 +409,63 @@ gimprc_init (void) static gint n_base_funcs = (sizeof (base_funcs) / sizeof (base_funcs[0])); + static ParseFunc core_funcs[] = + { + { "plug-in-path", TT_PATH, NULL, NULL }, + { "module-path", TT_PATH, NULL, NULL }, + { "brush-path", TT_PATH, NULL, NULL }, + { "pattern-path", TT_PATH, NULL, NULL }, + { "palette-path", TT_PATH, NULL, NULL }, + { "gradient-path", TT_PATH, NULL, NULL }, + { "default-brush", TT_STRING, NULL, NULL }, + { "default-pattern", TT_STRING, NULL, NULL }, + { "default-palette", TT_STRING, NULL, NULL }, + { "default-gradient", TT_STRING, NULL, NULL }, + { "default-comment", TT_STRING, NULL, NULL }, + { "default-image-type", TT_IMAGETYPE, NULL, NULL }, + { "default-image-size", TT_POSITION, NULL, NULL }, + { "default-units", TT_XUNIT, NULL, NULL }, + { "default-xresolution", TT_DOUBLE, NULL, NULL }, + { "default-yresolution", TT_DOUBLE, NULL, NULL }, + { "default-resolution-units", TT_XUNIT, NULL, NULL }, + { "undo-levels", TT_INT, NULL, NULL }, + { "pluginrc-path", TT_PATH, NULL, NULL }, + { "module-load-inhibit", TT_PATH, NULL, NULL }, + { "thumbnail-mode", TT_INT, NULL, NULL } + }; + static gint n_core_funcs = (sizeof (core_funcs) / + sizeof (core_funcs[0])); + /* this hurts badly */ - base_funcs[0].val1p = &base_config->temp_path; - base_funcs[1].val1p = &base_config->swap_path; - base_funcs[2].val1p = &base_config->tile_cache_size; - base_funcs[3].val1p = &base_config->stingy_memory_use; - base_funcs[4].val1p = &base_config->interpolation_type; - base_funcs[4].val1p = &base_config->num_processors; + base_funcs[0].val1p = &base_config->temp_path; + base_funcs[1].val1p = &base_config->swap_path; + base_funcs[2].val1p = &base_config->tile_cache_size; + base_funcs[3].val1p = &base_config->stingy_memory_use; + base_funcs[4].val1p = &base_config->interpolation_type; + base_funcs[4].val1p = &base_config->num_processors; + + core_funcs[0].val1p = &core_config->plug_in_path; + core_funcs[1].val1p = &core_config->module_path; + core_funcs[2].val1p = &core_config->brush_path; + core_funcs[3].val1p = &core_config->pattern_path; + core_funcs[4].val1p = &core_config->palette_path; + core_funcs[5].val1p = &core_config->gradient_path; + core_funcs[6].val1p = &core_config->default_brush; + core_funcs[7].val1p = &core_config->default_pattern; + core_funcs[8].val1p = &core_config->default_palette; + core_funcs[9].val1p = &core_config->default_gradient; + core_funcs[10].val1p = &core_config->default_comment; + core_funcs[11].val1p = &core_config->default_type; + core_funcs[12].val1p = &core_config->default_width; + core_funcs[12].val2p = &core_config->default_height; + core_funcs[13].val1p = &core_config->default_units; + core_funcs[14].val1p = &core_config->default_xresolution; + core_funcs[15].val1p = &core_config->default_xresolution; + core_funcs[16].val1p = &core_config->default_resolution_units; + core_funcs[17].val1p = &core_config->levels_of_undo; + core_funcs[18].val1p = &core_config->pluginrc_path; + core_funcs[19].val1p = &core_config->module_db_load_inhibit; + core_funcs[20].val1p = &core_config->thumbnail_mode; parse_func_hash = g_hash_table_new (g_str_hash, g_str_equal); @@ -487,6 +474,11 @@ gimprc_init (void) base_funcs[i].name, &base_funcs[i]); + for (i = 0; i < n_core_funcs; i++) + g_hash_table_insert (parse_func_hash, + core_funcs[i].name, + &core_funcs[i]); + for (i = 0; i < n_funcs; i++) g_hash_table_insert (parse_func_hash, funcs[i].name, @@ -527,7 +519,7 @@ parse_gimprc (void) parse_add_directory_tokens (); - if (alternate_system_gimprc != NULL) + if (alternate_system_gimprc) libfilename = g_strdup (alternate_system_gimprc); else libfilename = g_strdup (gimp_system_rc_file ()); @@ -546,10 +538,10 @@ parse_gimprc (void) g_free (filename); g_free (libfilename); - if (!gimprc.image_title_format) + if (! gimprc.image_title_format) gimprc.image_title_format = g_strdup (DEFAULT_IMAGE_TITLE_FORMAT); - if (!gimprc.default_comment) - gimprc.default_comment = g_strdup (DEFAULT_COMMENT); + if (! core_config->default_comment) + core_config->default_comment = g_strdup (DEFAULT_COMMENT); } gboolean @@ -558,7 +550,7 @@ parse_absolute_gimprc_file (char *filename) gint status; parse_info.fp = fopen (filename, "rt"); - if (!parse_info.fp) + if (! parse_info.fp) return FALSE; if (be_verbose) @@ -592,10 +584,10 @@ parse_absolute_gimprc_file (char *filename) gboolean parse_gimprc_file (gchar *filename) { - gchar *rfilename; - gboolean parsed; + gchar *rfilename; + gboolean parsed; - if (!g_path_is_absolute (filename)) + if (! g_path_is_absolute (filename)) { gchar *home_dir = g_get_home_dir (); gchar *home_dir_sep; @@ -646,16 +638,17 @@ save_gimprc_strings (gchar *token, gboolean found = FALSE; gchar *personal_gimprc; gchar *str; - + UnknownToken *ut; /* variables to modify unknown_tokens */ UnknownToken *tmp; GList *list; - + g_assert (token != NULL); g_assert (value != NULL); - + /* get the name of the backup file, and the file pointers. 'name' - is reused in another context later, disregard it here */ + * is reused in another context later, disregard it here + */ personal_gimprc = gimp_personal_rc_file ("gimprc"); error_msg = open_backup_file (personal_gimprc, gimp_system_rc_file (), @@ -674,10 +667,11 @@ save_gimprc_strings (gchar *token, /* copy the old .gimprc into the new one, modifying it as needed */ prev_line = NULL; - cur_line = g_new (char, 1024); - while (!feof (fp_old)) + cur_line = g_new (char, 1024); + + while (! feof (fp_old)) { - if (!fgets (cur_line, 1024, fp_old)) + if (! fgets (cur_line, 1024, fp_old)) continue; /* special case: save lines starting with '#-' (added by GIMP) */ @@ -693,11 +687,12 @@ save_gimprc_strings (gchar *token, } /* see if the line contains something that we can use - and place that into 'name' if its found */ + * and place that into 'name' if its found + */ if (find_token (cur_line, tokname, 50)) { /* check if that entry should be updated */ - if (!g_strcasecmp (token, tokname)) /* if they match */ + if (! g_strcasecmp (token, tokname)) /* if they match */ { if (prev_line == NULL) { @@ -724,8 +719,8 @@ save_gimprc_strings (gchar *token, g_free (str); found = TRUE; continue; - } /* end if token and name match */ - } /* end if token is found */ + } + } /* all lines that did not match the tests above are simply copied */ if (prev_line != NULL) @@ -738,12 +733,13 @@ save_gimprc_strings (gchar *token, } /* end of while(!feof) */ g_free (cur_line); - if (prev_line != NULL) + if (prev_line) g_free (prev_line); + fclose (fp_old); /* append the options that were not in the old .gimprc */ - if (!found) + if (! found) { fprintf (fp_new, "#- Next line added %s\n", timestamp); @@ -757,11 +753,9 @@ save_gimprc_strings (gchar *token, ut->token = g_strdup (token); ut->value = g_strdup (value); - list = unknown_tokens; - while (list) + for (list = unknown_tokens; list; list = g_list_next (list)) { tmp = (UnknownToken *) list->data; - list = list->next; if (strcmp (tmp->token, ut->token) == 0) { @@ -771,6 +765,7 @@ save_gimprc_strings (gchar *token, g_free (tmp); } } + unknown_tokens = g_list_append (unknown_tokens, ut); fclose (fp_new); diff --git a/app/gimprc.h b/app/gimprc.h index c0438bedba..8548e5ef27 100644 --- a/app/gimprc.h +++ b/app/gimprc.h @@ -24,24 +24,12 @@ typedef struct _GimpRc GimpRc; /* global gimprc variables - need some comments on this stuff */ struct _GimpRc { - gchar *plug_in_path; - gchar *brush_path; - gchar *default_brush; - gchar *pattern_path; - gchar *default_pattern; - gchar *palette_path; - gchar *default_palette; - gchar *gradient_path; - gchar *default_gradient; - gchar *pluginrc_path; - gchar *module_path; gint marching_speed; gint last_opened_size; gdouble gamma_val; gint transparency_type; gboolean perfectmouse; gint transparency_size; - gint levels_of_undo; gint min_colors; gboolean install_cmap; gboolean cycled_marching_ants; @@ -51,16 +39,9 @@ struct _GimpRc gint preview_size; gint nav_preview_size; gboolean show_rulers; - GimpUnit default_units; gboolean show_statusbar; gboolean auto_save; gboolean confirm_on_close; - gint default_width, default_height; - gint default_type; - GimpUnit default_resolution_units; - gdouble default_xresolution; - gdouble default_yresolution; - gchar *default_comment; gboolean default_dot_for_dot; gboolean save_session_info; gboolean save_device_status; @@ -73,10 +54,8 @@ struct _GimpRc gboolean using_xserver_resolution; gchar *image_title_format; gboolean global_paint_options; - gchar *module_db_load_inhibit; gboolean show_indicators; guint max_new_image_size; - gint thumbnail_mode; gboolean trust_dirty_flag; gboolean use_help; gboolean nav_window_per_display; diff --git a/app/gui/brush-select.c b/app/gui/brush-select.c index 88b2b99d25..f549015e36 100644 --- a/app/gui/brush-select.c +++ b/app/gui/brush-select.c @@ -153,11 +153,11 @@ brush_select_new (gchar *title, if (title) { - bsp->context = gimp_context_new (the_gimp, title, NULL); + bsp->context = gimp_create_context (the_gimp, title, NULL); } else { - bsp->context = gimp_context_get_user (); + bsp->context = gimp_get_user_context (the_gimp); dialog_register (bsp->shell); } @@ -175,11 +175,11 @@ brush_select_new (gchar *title, } else { - active = gimp_context_get_brush (gimp_context_get_user ()); + active = gimp_context_get_brush (gimp_get_user_context (the_gimp)); } if (!active) - active = gimp_context_get_brush (gimp_context_get_standard (the_gimp)); + active = gimp_context_get_brush (gimp_get_standard_context (the_gimp)); if (title) { diff --git a/app/gui/channels-commands.c b/app/gui/channels-commands.c index 4e62ba0dec..c0c396cdce 100644 --- a/app/gui/channels-commands.c +++ b/app/gui/channels-commands.c @@ -25,6 +25,7 @@ #include "core/core-types.h" +#include "core/gimp.h" #include "core/gimpchannel.h" #include "core/gimpimage.h" #include "core/gimpimage-mask.h" @@ -37,6 +38,7 @@ #include "gdisplay.h" #include "menus.h" +#include "app_procs.h" #include "drawable.h" #include "libgimp/gimpintl.h" @@ -314,7 +316,9 @@ new_channel_query_ok_callback (GtkWidget *widget, channel_name, &channel_color); - drawable_fill (GIMP_DRAWABLE (new_channel), TRANSPARENT_FILL); + drawable_fill (GIMP_DRAWABLE (new_channel), + gimp_get_user_context (the_gimp), + TRANSPARENT_FILL); gimp_image_add_channel (gimage, new_channel, -1); gdisplays_flush (); diff --git a/app/gui/color-area.c b/app/gui/color-area.c index 5d0455c641..d78f0889a6 100644 --- a/app/gui/color-area.c +++ b/app/gui/color-area.c @@ -30,12 +30,15 @@ #include "core/core-types.h" +#include "core/gimp.h" #include "core/gimpcontext.h" #include "widgets/gimpdnd.h" #include "color-area.h" #include "color-notebook.h" + +#include "app_procs.h" #include "gdisplay.h" #ifdef DISPLAY_FILTERS @@ -219,7 +222,7 @@ color_area_draw (void) gdk_gc_set_foreground (mask_gc, &mask_pattern); /* draw the background area */ - gimp_context_get_background (gimp_context_get_user (), &color); + gimp_context_get_background (gimp_get_user_context (the_gimp), &color); gimp_rgb_get_uchar (&color, &r, &g, &b); color_area_draw_rect (color_area_pixmap, color_area_gc, (width - rect_w), (height - rect_h), rect_w, rect_h, @@ -237,7 +240,7 @@ color_area_draw (void) (width - rect_w), (height - rect_h), rect_w, rect_h); /* draw the foreground area */ - gimp_context_get_foreground (gimp_context_get_user (), &color); + gimp_context_get_foreground (gimp_get_user_context (the_gimp), &color); gimp_rgb_get_uchar (&color, &r, &g, &b); color_area_draw_rect (color_area_pixmap, color_area_gc, 0, 0, rect_w, rect_h, @@ -294,15 +297,19 @@ color_area_select_callback (ColorNotebook *color_notebook, /* Fallthrough */ case COLOR_NOTEBOOK_UPDATE: if (edit_color == FOREGROUND) - gimp_context_set_foreground (gimp_context_get_user (), color); + gimp_context_set_foreground (gimp_get_user_context (the_gimp), + color); else - gimp_context_set_background (gimp_context_get_user (), color); + gimp_context_set_background (gimp_get_user_context (the_gimp), + color); break; case COLOR_NOTEBOOK_CANCEL: color_notebook_hide (color_notebook); color_notebook_active = FALSE; - gimp_context_set_foreground (gimp_context_get_user (), &revert_fg); - gimp_context_set_background (gimp_context_get_user (), &revert_bg); + gimp_context_set_foreground (gimp_get_user_context (the_gimp), + &revert_fg); + gimp_context_set_background (gimp_get_user_context (the_gimp), + &revert_bg); } } } @@ -313,7 +320,7 @@ color_area_edit (void) GimpContext *user_context; GimpRGB color; - user_context = gimp_context_get_user (); + user_context = gimp_get_user_context (the_gimp); if (! color_notebook_active) { @@ -414,10 +421,10 @@ color_area_events (GtkWidget *widget, } break; case SWAP_AREA: - gimp_context_swap_colors (gimp_context_get_user ()); + gimp_context_swap_colors (gimp_get_user_context (the_gimp)); break; case DEF_AREA: - gimp_context_set_default_colors (gimp_context_get_user ()); + gimp_context_set_default_colors (gimp_get_user_context (the_gimp)); break; default: break; @@ -512,11 +519,11 @@ color_area_create (gint width, GDK_ACTION_COPY); gimp_dnd_color_dest_set (color_area, color_area_drop_color, NULL); - gtk_signal_connect (GTK_OBJECT (gimp_context_get_user ()), + gtk_signal_connect (GTK_OBJECT (gimp_get_user_context (the_gimp)), "foreground_changed", GTK_SIGNAL_FUNC (color_area_color_changed), color_area); - gtk_signal_connect (GTK_OBJECT (gimp_context_get_user ()), + gtk_signal_connect (GTK_OBJECT (gimp_get_user_context (the_gimp)), "background_changed", GTK_SIGNAL_FUNC (color_area_color_changed), color_area); @@ -539,9 +546,9 @@ color_area_drag_color (GtkWidget *widget, gpointer data) { if (active_color == FOREGROUND) - gimp_context_get_foreground (gimp_context_get_user (), color); + gimp_context_get_foreground (gimp_get_user_context (the_gimp), color); else - gimp_context_get_background (gimp_context_get_user (), color); + gimp_context_get_background (gimp_get_user_context (the_gimp), color); } static void @@ -557,9 +564,9 @@ color_area_drop_color (GtkWidget *widget, else { if (active_color == FOREGROUND) - gimp_context_set_foreground (gimp_context_get_user (), color); + gimp_context_set_foreground (gimp_get_user_context (the_gimp), color); else - gimp_context_set_background (gimp_context_get_user (), color); + gimp_context_set_background (gimp_get_user_context (the_gimp), color); } } diff --git a/app/gui/device-status-dialog.c b/app/gui/device-status-dialog.c index fa9a9962c2..d305efc8b1 100644 --- a/app/gui/device-status-dialog.c +++ b/app/gui/device-status-dialog.c @@ -301,12 +301,13 @@ devices_init (void) device_info->num_axes = gdk_info->num_axes; device_info->axes = NULL; - device_info->context = gimp_context_new (the_gimp, - device_info->name, NULL); + device_info->context = gimp_create_context (the_gimp, + device_info->name, NULL); gimp_context_define_args (device_info->context, DEVICE_CONTEXT_MASK, FALSE); - gimp_context_copy_args (gimp_context_get_user (), device_info->context, + gimp_context_copy_args (gimp_get_user_context (the_gimp), + device_info->context, DEVICE_CONTEXT_MASK); device_status_context_connect (device_info->context, device_info->device); @@ -331,7 +332,7 @@ devices_restore (void) suppress_update = TRUE; - context = gimp_context_get_user (); + context = gimp_get_user_context (the_gimp); gimp_context_copy_args (device_info->context, context, DEVICE_CONTEXT_MASK); gimp_context_set_parent (device_info->context, context); @@ -389,12 +390,13 @@ devices_rc_update (gchar *name, else device_info->mode = GDK_MODE_DISABLED; - device_info->context = gimp_context_new (the_gimp, - device_info->name, NULL); + device_info->context = gimp_create_context (the_gimp, + device_info->name, NULL); gimp_context_define_args (device_info->context, DEVICE_CONTEXT_MASK, FALSE); - gimp_context_copy_args (gimp_context_get_user (), device_info->context, + gimp_context_copy_args (gimp_get_user_context (the_gimp), + device_info->context, DEVICE_CONTEXT_MASK); device_status_context_connect (device_info->context, device_info->device); @@ -534,7 +536,7 @@ select_device (guint32 new_device) current_device = new_device; - context = gimp_context_get_user (); + context = gimp_get_user_context (the_gimp); gimp_context_copy_args (device_info->context, context, DEVICE_CONTEXT_MASK); gimp_context_set_parent (device_info->context, context); diff --git a/app/gui/dialogs-constructors.c b/app/gui/dialogs-constructors.c index 376ab7172c..6cbc6a6451 100644 --- a/app/gui/dialogs-constructors.c +++ b/app/gui/dialogs-constructors.c @@ -567,7 +567,8 @@ dialogs_layer_list_view_new (GimpDialogFactory *factory, gimage = gimp_context_get_image (context); view = gimp_drawable_list_view_new - (gimage, + (gimprc.preview_size, + gimage, GIMP_TYPE_LAYER, "active_layer_changed", (GimpGetContainerFunc) gimp_image_get_layers, @@ -602,7 +603,8 @@ dialogs_channel_list_view_new (GimpDialogFactory *factory, gimage = gimp_context_get_image (context); view = gimp_drawable_list_view_new - (gimage, + (gimprc.preview_size, + gimage, GIMP_TYPE_CHANNEL, "active_channel_changed", (GimpGetContainerFunc) gimp_image_get_channels, diff --git a/app/gui/dialogs.c b/app/gui/dialogs.c index 48d73bc397..4814a89801 100644 --- a/app/gui/dialogs.c +++ b/app/gui/dialogs.c @@ -20,9 +20,9 @@ #include -#include "apptypes.h" #include "widgets/widgets-types.h" +#include "core/gimp.h" #include "core/gimpcontext.h" #include "widgets/gimpdialogfactory.h" @@ -88,25 +88,21 @@ static const gint n_dock_entries = (sizeof (dock_entries) / /* public functions */ void -dialogs_init (void) +dialogs_init (Gimp *gimp) { gint i; - global_dialog_factory = - gimp_dialog_factory_new ("toplevel", - gimp_context_get_user (), - NULL, - NULL); - + global_dialog_factory = gimp_dialog_factory_new ("toplevel", + gimp_get_user_context (gimp), + NULL, + NULL); gtk_object_ref (GTK_OBJECT (global_dialog_factory)); gtk_object_sink (GTK_OBJECT (global_dialog_factory)); - global_dock_factory = - gimp_dialog_factory_new ("dock", - gimp_context_get_user (), - menus_get_dialogs_factory (), - dialogs_dock_new); - + global_dock_factory = gimp_dialog_factory_new ("dock", + gimp_get_user_context (gimp), + menus_get_dialogs_factory (), + dialogs_dock_new); gtk_object_ref (GTK_OBJECT (global_dock_factory)); gtk_object_sink (GTK_OBJECT (global_dock_factory)); @@ -128,7 +124,7 @@ dialogs_init (void) } void -dialogs_exit (void) +dialogs_exit (Gimp *gimp) { gtk_object_unref (GTK_OBJECT (global_dialog_factory)); gtk_object_unref (GTK_OBJECT (global_dock_factory)); diff --git a/app/gui/dialogs.h b/app/gui/dialogs.h index 2d78189333..f76272b174 100644 --- a/app/gui/dialogs.h +++ b/app/gui/dialogs.h @@ -24,8 +24,8 @@ extern GimpDialogFactory *global_dialog_factory; extern GimpDialogFactory *global_dock_factory; -void dialogs_init (void); -void dialogs_exit (void); +void dialogs_init (Gimp *gimp); +void dialogs_exit (Gimp *gimp); #endif /* __DIALOGS_H__ */ diff --git a/app/gui/file-new-dialog.c b/app/gui/file-new-dialog.c index 592f8e2504..aa44e55bd6 100644 --- a/app/gui/file-new-dialog.c +++ b/app/gui/file-new-dialog.c @@ -26,6 +26,7 @@ #include "core/core-types.h" +#include "core/gimpcoreconfig.h" #include "core/gimpimage-new.h" #include "file-new-dialog.h" @@ -120,29 +121,30 @@ file_new_reset_callback (GtkWidget *widget, gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (info->couple_resolutions), - ABS (gimprc.default_xresolution - gimprc.default_yresolution) < GIMP_MIN_RESOLUTION); + ABS (core_config->default_xresolution - + core_config->default_yresolution) < GIMP_MIN_RESOLUTION); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (info->resolution_se), - 0, gimprc.default_xresolution); + 0, core_config->default_xresolution); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (info->resolution_se), - 1, gimprc.default_yresolution); + 1, core_config->default_yresolution); gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (info->resolution_se), - gimprc.default_resolution_units); + core_config->default_resolution_units); gtk_signal_handler_unblock_by_data (GTK_OBJECT (info->resolution_se), info); gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (info->size_se), - 0, gimprc.default_xresolution, TRUE); + 0, core_config->default_xresolution, TRUE); gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (info->size_se), - 1, gimprc.default_yresolution, TRUE); + 1, core_config->default_yresolution, TRUE); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (info->size_se), - 0, gimprc.default_width); + 0, core_config->default_width); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (info->size_se), - 1, gimprc.default_height); + 1, core_config->default_height); gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (info->size_se), - gimprc.default_units); + core_config->default_units); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (info->type_w[gimprc.default_type]), + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (info->type_w[core_config->default_type]), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (info->fill_type_w[BACKGROUND_FILL]), TRUE); @@ -534,7 +536,8 @@ file_new_dialog_create (GimpImage *gimage) gtk_widget_set_usize (spinbutton, 75, 0); info->resolution_se = - gimp_size_entry_new (1, gimprc.default_resolution_units, _("pixels/%a"), + gimp_size_entry_new (1, core_config->default_resolution_units, + _("pixels/%a"), FALSE, FALSE, FALSE, 75, GIMP_SIZE_ENTRY_UPDATE_RESOLUTION); gtk_table_set_col_spacing (GTK_TABLE (info->resolution_se), 1, 2); @@ -591,8 +594,10 @@ file_new_dialog_create (GimpImage *gimage) gtk_widget_show (radio_box); group = NULL; - list = g_list_first (gimp_image_new_get_base_type_names (the_gimp)); - while (list) + + for (list = gimp_image_new_get_base_type_names (the_gimp); + list; + list = g_list_next (list)) { GimpImageBaseTypeName *name_info; @@ -613,8 +618,6 @@ file_new_dialog_create (GimpImage *gimage) gtk_widget_show (button); info->type_w[name_info->type] = button; - - list = g_list_next (list); } /* frame for Fill Type */ @@ -628,8 +631,10 @@ file_new_dialog_create (GimpImage *gimage) gtk_widget_show (radio_box); group = NULL; - list = g_list_first (gimp_image_new_get_fill_type_names (the_gimp)); - while (list) + + for (list = gimp_image_new_get_fill_type_names (the_gimp); + list; + list = g_list_next (list)) { GimpFillTypeName *name_info; @@ -651,8 +656,6 @@ file_new_dialog_create (GimpImage *gimage) gtk_widget_show (button); info->fill_type_w[name_info->type] = button; - - list = g_list_next (list); } gimp_size_entry_grab_focus (GIMP_SIZE_ENTRY (info->size_se)); diff --git a/app/gui/file-open-dialog.c b/app/gui/file-open-dialog.c index c0f026284f..8c71cc8616 100644 --- a/app/gui/file-open-dialog.c +++ b/app/gui/file-open-dialog.c @@ -44,6 +44,7 @@ #include "core/gimp.h" #include "core/gimpcontext.h" +#include "core/gimpcoreconfig.h" #include "core/gimpimage.h" #include "file-dialog-utils.h" @@ -54,7 +55,6 @@ #include "dialog_handler.h" #include "docindex.h" #include "gdisplay.h" -#include "gimprc.h" #include "file-open.h" #include "file-utils.h" #include "plug_in.h" @@ -245,7 +245,8 @@ file_open_with_proc_and_display (gchar *filename, gchar *absolute; gint status; - if ((gimage = file_open_image (filename, + if ((gimage = file_open_image (the_gimp, + filename, raw_filename, _("Open"), file_proc, @@ -605,7 +606,7 @@ set_preview (const gchar *fullfname, } else { - switch (gimprc.thumbnail_mode) + switch (core_config->thumbnail_mode) { case 0: gtk_label_set_text (GTK_LABEL(open_options_label), @@ -717,7 +718,8 @@ file_open_genbutton_callback (GtkWidget *widget, { /* Is not directory. */ gint dummy; - gimage_to_be_thumbed = file_open_image (full_filename, + gimage_to_be_thumbed = file_open_image (the_gimp, + full_filename, list->data, NULL, NULL, @@ -730,7 +732,7 @@ file_open_genbutton_callback (GtkWidget *widget, RGBbuf = make_RGBbuf_from_tempbuf (tempbuf, &RGBbuf_w, &RGBbuf_h); - if (gimprc.thumbnail_mode) + if (core_config->thumbnail_mode) { file_save_thumbnail (gimage_to_be_thumbed, full_filename, tempbuf); @@ -934,7 +936,8 @@ file_revert_confirm_callback (GtkWidget *widget, filename = gimp_object_get_name (GIMP_OBJECT (old_gimage)); - new_gimage = file_open_image (filename, filename, + new_gimage = file_open_image (old_gimage->gimp, + filename, filename, _("Revert"), NULL, RUN_INTERACTIVE, diff --git a/app/gui/gradient-editor.c b/app/gui/gradient-editor.c index 0d3662b01d..5f5d701d95 100644 --- a/app/gui/gradient-editor.c +++ b/app/gui/gradient-editor.c @@ -540,7 +540,7 @@ gradient_editor_new (void) gradient_editor = g_new (GradientEditor, 1); - gradient_editor->context = gimp_context_new (the_gimp, NULL, NULL); + gradient_editor->context = gimp_create_context (the_gimp, NULL, NULL); gtk_signal_connect (GTK_OBJECT (gradient_editor->context), "gradient_changed", GTK_SIGNAL_FUNC (gradient_editor_gradient_changed), @@ -1409,7 +1409,7 @@ preview_set_foreground (GradientEditor *gradient_editor, (gimp_context_get_gradient (gradient_editor->context), xpos, &color); - gimp_context_set_foreground (gimp_context_get_user (), &color); + gimp_context_set_foreground (gimp_get_user_context (gradient_editor->context->gimp), &color); str = g_strdup_printf (_("Foreground color set to RGB (%d, %d, %d) <-> " "(%0.3f, %0.3f, %0.3f)"), @@ -1435,7 +1435,7 @@ preview_set_background (GradientEditor *gradient_editor, (gimp_context_get_gradient (gradient_editor->context), xpos, &color); - gimp_context_set_background (gimp_context_get_user (), &color); + gimp_context_set_background (gimp_get_user_context (gradient_editor->context->gimp), &color); str = g_strdup_printf (_("Background color to RGB (%d, %d, %d) <-> " "(%0.3f, %0.3f, %0.3f)"), @@ -2836,7 +2836,7 @@ cpopup_adjust_menus (GradientEditor *gradient_editor) /* Render Foreground color boxes */ - gimp_context_get_foreground (gimp_context_get_user (), &fg); + gimp_context_get_foreground (gimp_get_user_context (gradient_editor->context->gimp), &fg); cpopup_render_color_box (GTK_PREVIEW (gradient_editor->left_load_color_boxes[2]), &fg); @@ -3284,7 +3284,7 @@ cpopup_load_left_callback (GtkWidget *widget, break; case 2: /* Fetch from FG color */ - gimp_context_get_foreground (gimp_context_get_user (), &fg); + gimp_context_get_foreground (gimp_get_user_context (gradient_editor->context->gimp), &fg); cpopup_blend_endpoints (gradient_editor, &fg, &gradient_editor->control_sel_r->right_color, @@ -3350,7 +3350,7 @@ cpopup_load_right_callback (GtkWidget *widget, break; case 2: /* Fetch from FG color */ - gimp_context_get_foreground (gimp_context_get_user (), &fg); + gimp_context_get_foreground (gimp_get_user_context (gradient_editor->context->gimp), &fg); cpopup_blend_endpoints (gradient_editor, &gradient_editor->control_sel_l->left_color, &fg, diff --git a/app/gui/gradient-select.c b/app/gui/gradient-select.c index c9b19c3e36..6b70b2c741 100644 --- a/app/gui/gradient-select.c +++ b/app/gui/gradient-select.c @@ -120,11 +120,11 @@ gradient_select_new (gchar *title, if (title) { - gsp->context = gimp_context_new (the_gimp, title, NULL); + gsp->context = gimp_create_context (the_gimp, title, NULL); } else { - gsp->context = gimp_context_get_user (); + gsp->context = gimp_get_user_context (the_gimp); dialog_register (gsp->shell); } @@ -142,11 +142,11 @@ gradient_select_new (gchar *title, } else { - active = gimp_context_get_gradient (gimp_context_get_user ()); + active = gimp_context_get_gradient (gimp_get_user_context (the_gimp)); } if (!active) - active = gimp_context_get_gradient (gimp_context_get_standard (the_gimp)); + active = gimp_context_get_gradient (gimp_get_standard_context (the_gimp)); if (title) gimp_context_set_gradient (gsp->context, active); diff --git a/app/gui/gui.c b/app/gui/gui.c index 9c953cb252..83d0341d8c 100644 --- a/app/gui/gui.c +++ b/app/gui/gui.c @@ -30,6 +30,7 @@ #include "core/gimp.h" #include "core/gimpcontext.h" +#include "core/gimpimage.h" #include "widgets/gimpdialogfactory.h" @@ -66,13 +67,16 @@ /* local function prototypes */ -static void gui_display_new (GimpImage *gimage); -static gint gui_rotate_the_shield_harmonics (GtkWidget *widget, - GdkEvent *eevent, - gpointer data); -static void gui_really_quit_callback (GtkWidget *button, - gboolean quit, - gpointer data); +static void gui_display_new (GimpImage *gimage); +static gint gui_rotate_the_shield_harmonics (GtkWidget *widget, + GdkEvent *eevent, + gpointer data); +static void gui_really_quit_callback (GtkWidget *button, + gboolean quit, + gpointer data); +static void gui_display_changed (GimpContext *context, + GDisplay *display, + gpointer data); /* global variables */ @@ -85,6 +89,13 @@ extern GSList *display_list; /* from gdisplay.c */ void gui_init (Gimp *gimp) { + gimp->create_display_func = gui_display_new; + + gtk_signal_connect (GTK_OBJECT (gimp_get_user_context (gimp)), + "display_changed", + GTK_SIGNAL_FUNC (gui_display_changed), + NULL); + /* make sure the monitor resolution is valid */ if (gimprc.monitor_xres < GIMP_MIN_RESOLUTION || gimprc.monitor_yres < GIMP_MIN_RESOLUTION) @@ -101,7 +112,7 @@ gui_init (Gimp *gimp) gximage_init (); render_setup (gimprc.transparency_type, gimprc.transparency_size); - dialogs_init (); + dialogs_init (gimp); devices_init (); session_init (); @@ -141,12 +152,10 @@ gui_init (Gimp *gimp) g_free (filenames); } - - gimp->create_display_func = gui_display_new; } void -gui_restore (void) +gui_restore (Gimp *gimp) { color_select_init (); @@ -155,7 +164,7 @@ gui_restore (void) } void -gui_post_init (void) +gui_post_init (Gimp *gimp) { if (gimprc.show_tips) { @@ -164,7 +173,7 @@ gui_post_init (void) } void -gui_shutdown (void) +gui_shutdown (Gimp *gimp) { session_save (); device_status_free (); @@ -176,13 +185,13 @@ gui_shutdown (void) } void -gui_exit (void) +gui_exit (Gimp *gimp) { menus_quit (); gximage_free (); render_free (); - dialogs_exit (); + dialogs_exit (gimp); /* handle this in the dialog factory: */ document_index_free (); @@ -194,7 +203,7 @@ gui_exit (void) } void -gui_set_busy (void) +gui_set_busy (Gimp *gimp) { GDisplay *gdisp; GSList *list; @@ -213,7 +222,7 @@ gui_set_busy (void) } void -gui_unset_busy (void) +gui_unset_busy (Gimp *gimp) { GDisplay *gdisp; GSList *list; @@ -260,7 +269,7 @@ gui_display_new (GimpImage *gimage) gdisp = gdisplay_new (gimage, 0x0101); - gimp_context_set_display (gimp_context_get_user (), gdisp); + gimp_context_set_display (gimp_get_user_context (gimage->gimp), gdisp); if (double_speed) gtk_signal_connect_after (GTK_OBJECT (gdisp->canvas), "expose_event", @@ -331,3 +340,11 @@ gui_really_quit_callback (GtkWidget *button, menus_set_sensitive ("/File/Quit", TRUE); } } + +static void +gui_display_changed (GimpContext *context, + GDisplay *display, + gpointer data) +{ + gdisplay_set_menu_sensitivity (display); +} diff --git a/app/gui/gui.h b/app/gui/gui.h index defe447ec5..d90b0ea48a 100644 --- a/app/gui/gui.h +++ b/app/gui/gui.h @@ -21,14 +21,14 @@ void gui_init (Gimp *gimp); -void gui_restore (void); -void gui_post_init (void); +void gui_restore (Gimp *gimp); +void gui_post_init (Gimp *gimp); -void gui_shutdown (void); -void gui_exit (void); +void gui_shutdown (Gimp *gimp); +void gui_exit (Gimp *gimp); -void gui_set_busy (void); -void gui_unset_busy (void); +void gui_set_busy (Gimp *gimp); +void gui_unset_busy (Gimp *gimp); void gui_really_quit_dialog (void); diff --git a/app/gui/info-window.c b/app/gui/info-window.c index 5f4060d03a..c9240973b3 100644 --- a/app/gui/info-window.c +++ b/app/gui/info-window.c @@ -39,11 +39,12 @@ #include "tools/gimpcolorpickertool.h" /* need icon of color picker tool */ #include "tools/tool_manager.h" -#include "gdisplay.h" #include "info-dialog.h" #include "info-window.h" +#include "app_procs.h" #include "colormaps.h" +#include "gdisplay.h" #include "libgimp/gimpintl.h" @@ -182,7 +183,7 @@ info_window_create_extended (InfoDialog *info_win) gtk_container_add (GTK_CONTAINER (frame), table); gtk_widget_show (table); - preview = gimp_preview_new (GIMP_VIEWABLE (tool_manager_get_info_by_type (GIMP_TYPE_MOVE_TOOL)), 22, 0, FALSE); + preview = gimp_preview_new (GIMP_VIEWABLE (tool_manager_get_info_by_type (the_gimp, GIMP_TYPE_MOVE_TOOL)), 22, 0, FALSE); gtk_table_attach (GTK_TABLE (table), preview, 0, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 2, 2); gtk_widget_show (preview); @@ -242,7 +243,7 @@ info_window_create_extended (InfoDialog *info_win) gtk_container_add (GTK_CONTAINER (frame), table); gtk_widget_show (table); - preview = gimp_preview_new (GIMP_VIEWABLE (tool_manager_get_info_by_type (GIMP_TYPE_COLOR_PICKER_TOOL)), 22, 0, FALSE); + preview = gimp_preview_new (GIMP_VIEWABLE (tool_manager_get_info_by_type (the_gimp, GIMP_TYPE_COLOR_PICKER_TOOL)), 22, 0, FALSE); gtk_table_attach (GTK_TABLE (table), preview, 0, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 2, 2); gtk_widget_show (preview); @@ -420,7 +421,7 @@ info_window_follow_auto (void) GimpContext *context; GDisplay *gdisp; - context = gimp_context_get_user (); + context = gimp_get_user_context (the_gimp); gdisp = gimp_context_get_display (context); diff --git a/app/gui/input-dialog.c b/app/gui/input-dialog.c index fa9a9962c2..d305efc8b1 100644 --- a/app/gui/input-dialog.c +++ b/app/gui/input-dialog.c @@ -301,12 +301,13 @@ devices_init (void) device_info->num_axes = gdk_info->num_axes; device_info->axes = NULL; - device_info->context = gimp_context_new (the_gimp, - device_info->name, NULL); + device_info->context = gimp_create_context (the_gimp, + device_info->name, NULL); gimp_context_define_args (device_info->context, DEVICE_CONTEXT_MASK, FALSE); - gimp_context_copy_args (gimp_context_get_user (), device_info->context, + gimp_context_copy_args (gimp_get_user_context (the_gimp), + device_info->context, DEVICE_CONTEXT_MASK); device_status_context_connect (device_info->context, device_info->device); @@ -331,7 +332,7 @@ devices_restore (void) suppress_update = TRUE; - context = gimp_context_get_user (); + context = gimp_get_user_context (the_gimp); gimp_context_copy_args (device_info->context, context, DEVICE_CONTEXT_MASK); gimp_context_set_parent (device_info->context, context); @@ -389,12 +390,13 @@ devices_rc_update (gchar *name, else device_info->mode = GDK_MODE_DISABLED; - device_info->context = gimp_context_new (the_gimp, - device_info->name, NULL); + device_info->context = gimp_create_context (the_gimp, + device_info->name, NULL); gimp_context_define_args (device_info->context, DEVICE_CONTEXT_MASK, FALSE); - gimp_context_copy_args (gimp_context_get_user (), device_info->context, + gimp_context_copy_args (gimp_get_user_context (the_gimp), + device_info->context, DEVICE_CONTEXT_MASK); device_status_context_connect (device_info->context, device_info->device); @@ -534,7 +536,7 @@ select_device (guint32 new_device) current_device = new_device; - context = gimp_context_get_user (); + context = gimp_get_user_context (the_gimp); gimp_context_copy_args (device_info->context, context, DEVICE_CONTEXT_MASK); gimp_context_set_parent (device_info->context, context); diff --git a/app/gui/layers-commands.c b/app/gui/layers-commands.c index 7a8121e981..36b0d63324 100644 --- a/app/gui/layers-commands.c +++ b/app/gui/layers-commands.c @@ -30,6 +30,7 @@ #include "paint-funcs/paint-funcs.h" +#include "core/gimp.h" #include "core/gimpimage.h" #include "core/gimpimage-mask.h" #include "core/gimplayer.h" @@ -42,6 +43,7 @@ #include "menus.h" #include "resize-dialog.h" +#include "app_procs.h" #include "drawable.h" #include "gdisplay.h" #include "floating_sel.h" @@ -542,7 +544,9 @@ new_layer_query_ok_callback (GtkWidget *widget, layer_name, OPAQUE_OPACITY, NORMAL_MODE); if (layer) { - drawable_fill (GIMP_DRAWABLE (layer), fill_type); + drawable_fill (GIMP_DRAWABLE (layer), + gimp_get_user_context (the_gimp), + fill_type); gimp_image_add_layer (gimage, layer, -1); /* End the group undo */ diff --git a/app/gui/menus.c b/app/gui/menus.c index 2cee76b2cc..d4cf833cae 100644 --- a/app/gui/menus.c +++ b/app/gui/menus.c @@ -2252,7 +2252,7 @@ menus_init (void) } /* reorder /Image/Colors */ - tool_info = tool_manager_get_info_by_type (GIMP_TYPE_POSTERIZE_TOOL); + tool_info = tool_manager_get_info_by_type (the_gimp, GIMP_TYPE_POSTERIZE_TOOL); menu_item = gtk_item_factory_get_widget (image_factory, tool_info->menu_path); @@ -2275,7 +2275,7 @@ menus_init (void) for (i = 0; i < n_color_tools; i++) { - tool_info = tool_manager_get_info_by_type (color_tools[i]); + tool_info = tool_manager_get_info_by_type (the_gimp, color_tools[i]); menu_item = gtk_item_factory_get_widget (image_factory, tool_info->menu_path); diff --git a/app/gui/module-browser.c b/app/gui/module-browser.c index 7d707d1665..fc8ee3106f 100644 --- a/app/gui/module-browser.c +++ b/app/gui/module-browser.c @@ -38,12 +38,13 @@ #include "core/core-types.h" +#include "core/gimpcoreconfig.h" #include "core/gimplist.h" #include "appenv.h" #include "module_db.h" -#include "gimprc.h" #include "datafiles.h" +#include "gimprc.h" #include "libgimp/gimpmodule.h" @@ -217,7 +218,7 @@ module_db_init (void) modules = gimp_list_new (MODULE_INFO_TYPE, GIMP_CONTAINER_POLICY_WEAK); if (g_module_supported ()) - gimp_datafiles_read_directories (gimprc.module_path, 0 /* no flags */, + gimp_datafiles_read_directories (core_config->module_path, 0 /* no flags */, module_initialize, NULL); #ifdef DUMP_DB gimp_container_foreach (modules, print_module_info, NULL); @@ -615,7 +616,7 @@ module_initialize (const gchar *filename, mod->refs = 0; mod->load_inhibit = module_inhibited (mod->fullpath, - gimprc.module_db_load_inhibit); + core_config->module_db_load_inhibit); if (!mod->load_inhibit) { if (be_verbose) @@ -1137,7 +1138,7 @@ browser_refresh_callback (GtkWidget *widget, kill_list = NULL; /* walk filesystem and add new things we find */ - gimp_datafiles_read_directories (gimprc.module_path, 0 /* no flags */, + gimp_datafiles_read_directories (core_config->module_path, 0 /* no flags */, module_initialize, NULL); } diff --git a/app/gui/palette-editor.c b/app/gui/palette-editor.c index 362bf04bc1..33ce5d4ab1 100644 --- a/app/gui/palette-editor.c +++ b/app/gui/palette-editor.c @@ -271,9 +271,9 @@ palette_set_active_color (gint r, } if (active_color == FOREGROUND) - gimp_context_set_foreground (gimp_context_get_user (), &color); + gimp_context_set_foreground (gimp_get_user_context (the_gimp), &color); else if (active_color == BACKGROUND) - gimp_context_set_background (gimp_context_get_user (), &color); + gimp_context_set_background (gimp_get_user_context (the_gimp), &color); } /* called from palette_select.c ********************************************/ @@ -327,9 +327,9 @@ palette_dialog_new (gboolean editor) palette_dialog = g_new0 (PaletteDialog, 1); if (! editor) - palette_dialog->context = gimp_context_get_user (); + palette_dialog->context = gimp_get_user_context (the_gimp); else - palette_dialog->context = gimp_context_new (the_gimp, NULL, NULL); + palette_dialog->context = gimp_create_context (the_gimp, NULL, NULL); palette_dialog->zoom_factor = 1.0; palette_dialog->columns = COLUMNS; @@ -597,9 +597,9 @@ palette_dialog_new_entry_callback (GtkWidget *widget, return; if (active_color == FOREGROUND) - gimp_context_get_foreground (gimp_context_get_user (), &color); + gimp_context_get_foreground (gimp_get_user_context (the_gimp), &color); else if (active_color == BACKGROUND) - gimp_context_get_background (gimp_context_get_user (), &color); + gimp_context_get_background (gimp_get_user_context (the_gimp), &color); palette_dialog->color = gimp_palette_add_entry (gimp_context_get_palette (palette_dialog->context), @@ -684,9 +684,11 @@ palette_dialog_color_notebook_callback (ColorNotebook *color_notebook, /* Update either foreground or background colors */ if (active_color == FOREGROUND) - gimp_context_set_foreground (gimp_context_get_user (), color); + gimp_context_set_foreground (gimp_get_user_context (the_gimp), + color); else if (active_color == BACKGROUND) - gimp_context_set_background (gimp_context_get_user (), color); + gimp_context_set_background (gimp_get_user_context (the_gimp), + color); gimp_data_dirty (GIMP_DATA (palette)); } @@ -779,19 +781,19 @@ palette_dialog_color_area_events (GtkWidget *widget, if (active_color == FOREGROUND) { if (bevent->state & GDK_CONTROL_MASK) - gimp_context_set_background (gimp_context_get_user (), + gimp_context_set_background (gimp_get_user_context (the_gimp), &palette_dialog->color->color); else - gimp_context_set_foreground (gimp_context_get_user (), + gimp_context_set_foreground (gimp_get_user_context (the_gimp), &palette_dialog->color->color); } else if (active_color == BACKGROUND) { if (bevent->state & GDK_CONTROL_MASK) - gimp_context_set_foreground (gimp_context_get_user (), + gimp_context_set_foreground (gimp_get_user_context (the_gimp), &palette_dialog->color->color); else - gimp_context_set_background (gimp_context_get_user (), + gimp_context_set_background (gimp_get_user_context (the_gimp), &palette_dialog->color->color); } diff --git a/app/gui/palette-import-dialog.c b/app/gui/palette-import-dialog.c index de4e538acc..ff4643e29a 100644 --- a/app/gui/palette-import-dialog.c +++ b/app/gui/palette-import-dialog.c @@ -405,7 +405,7 @@ palette_import_grad_callback (GtkWidget *widget, { GimpGradient *gradient; - gradient = gimp_context_get_gradient (gimp_context_get_user ()); + gradient = gimp_context_get_gradient (gimp_get_user_context (the_gimp)); import_dialog->import_type = GRAD_IMPORT; if (import_dialog->image_list) @@ -571,7 +571,7 @@ palette_import_import_callback (GtkWidget *widget, else palette_name = g_strdup (palette_name); - gradient = gimp_context_get_gradient (gimp_context_get_user ()); + gradient = gimp_context_get_gradient (gimp_get_user_context (the_gimp)); n_colors = (gint) import_dialog->sample->value; threshold = (gint) import_dialog->threshold->value; @@ -677,7 +677,7 @@ palette_import_dialog_new (void) { GimpGradient* gradient; - gradient = gimp_context_get_gradient (gimp_context_get_current ()); + gradient = gimp_context_get_gradient (gimp_get_user_context (the_gimp)); gtk_entry_set_text (GTK_ENTRY (entry), gradient ? GIMP_OBJECT (gradient)->name : _("new_import")); } @@ -783,9 +783,10 @@ palette_import_dialog_new (void) /* Fill with the selected gradient */ palette_import_fill_grad_preview - (image, gimp_context_get_gradient (gimp_context_get_user ())); + (image, gimp_context_get_gradient (gimp_get_user_context (the_gimp))); import_dialog->import_type = GRAD_IMPORT; - gtk_signal_connect (GTK_OBJECT (gimp_context_get_user ()), "gradient_changed", + gtk_signal_connect (GTK_OBJECT (gimp_get_user_context (the_gimp)), + "gradient_changed", GTK_SIGNAL_FUNC (palette_import_gradient_update), NULL); diff --git a/app/gui/palette-select.c b/app/gui/palette-select.c index c595a1e952..e4bce2faad 100644 --- a/app/gui/palette-select.c +++ b/app/gui/palette-select.c @@ -100,11 +100,11 @@ palette_select_new (const gchar *title, if (title) { - psp->context = gimp_context_new (the_gimp, title, NULL); + psp->context = gimp_create_context (the_gimp, title, NULL); } else { - psp->context = gimp_context_get_user (); + psp->context = gimp_get_user_context (the_gimp); /* session_set_window_geometry (psp->shell, &palette_select_session_info, @@ -127,11 +127,11 @@ palette_select_new (const gchar *title, } else { - active = gimp_context_get_palette (gimp_context_get_user ()); + active = gimp_context_get_palette (gimp_get_user_context (the_gimp)); } if (!active) - active = gimp_context_get_palette (gimp_context_get_standard (the_gimp)); + active = gimp_context_get_palette (gimp_get_standard_context (the_gimp)); if (title) gimp_context_set_palette (psp->context, active); diff --git a/app/gui/paths-dialog.c b/app/gui/paths-dialog.c index 3589ecc213..e6ee2049b5 100644 --- a/app/gui/paths-dialog.c +++ b/app/gui/paths-dialog.c @@ -33,6 +33,7 @@ #include "core/core-types.h" #include "tools/tools-types.h" +#include "core/gimp.h" #include "core/gimpcontext.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" @@ -1347,7 +1348,7 @@ paths_dialog_sel_to_path_callback (GtkWidget *widget, args[2].value.pdb_int = (gint32) gimp_drawable_get_ID (gimp_image_active_drawable (gimage)); /* get the display by asking the current context */ - gdisp = gimp_context_get_display (gimp_context_get_user ()); + gdisp = gimp_context_get_display (gimp_get_user_context (gimage->gimp)); plug_in_run (proc_rec, args, 3, FALSE, TRUE, gdisp ? gdisp->ID : 0); diff --git a/app/gui/pattern-select.c b/app/gui/pattern-select.c index ea09afd338..ab7317c778 100644 --- a/app/gui/pattern-select.c +++ b/app/gui/pattern-select.c @@ -129,11 +129,11 @@ pattern_select_new (gchar *title, if (title) { - psp->context = gimp_context_new (the_gimp, title, NULL); + psp->context = gimp_create_context (the_gimp, title, NULL); } else { - psp->context = gimp_context_get_user (); + psp->context = gimp_get_user_context (the_gimp); dialog_register (psp->shell); } @@ -151,11 +151,11 @@ pattern_select_new (gchar *title, } else { - active = gimp_context_get_pattern (gimp_context_get_user ()); + active = gimp_context_get_pattern (gimp_get_user_context (the_gimp)); } if (!active) - active = gimp_context_get_pattern (gimp_context_get_standard (the_gimp)); + active = gimp_context_get_pattern (gimp_get_standard_context (the_gimp)); if (title) gimp_context_set_pattern (psp->context, active); diff --git a/app/gui/plug-in-commands.c b/app/gui/plug-in-commands.c index a9145841c2..94d5ee9622 100644 --- a/app/gui/plug-in-commands.c +++ b/app/gui/plug-in-commands.c @@ -89,6 +89,7 @@ #include "base/tile.h" #include "base/tile-manager.h" +#include "core/gimpcoreconfig.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" @@ -322,18 +323,19 @@ plug_in_init (void) plug_in_init_shm (); /* search for binaries in the plug-in directory path */ - gimp_datafiles_read_directories (gimprc.plug_in_path, MODE_EXECUTABLE, + gimp_datafiles_read_directories (core_config->plug_in_path, MODE_EXECUTABLE, plug_in_init_file, NULL); /* read the pluginrc file for cached data */ filename = NULL; - if (gimprc.pluginrc_path) + if (core_config->pluginrc_path) { - if (g_path_is_absolute (gimprc.pluginrc_path)) - filename = g_strdup (gimprc.pluginrc_path); + if (g_path_is_absolute (core_config->pluginrc_path)) + filename = g_strdup (core_config->pluginrc_path); else filename = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s", - gimp_directory (), gimprc.pluginrc_path); + gimp_directory (), + core_config->pluginrc_path); } else filename = gimp_personal_rc_file ("pluginrc"); @@ -853,7 +855,7 @@ plug_in_new (gchar *name) if (! g_path_is_absolute (name)) { - path = plug_in_search_in_path (gimprc.plug_in_path, name); + path = plug_in_search_in_path (core_config->plug_in_path, name); if (! path) { diff --git a/app/gui/plug-in-menus.c b/app/gui/plug-in-menus.c index a9145841c2..94d5ee9622 100644 --- a/app/gui/plug-in-menus.c +++ b/app/gui/plug-in-menus.c @@ -89,6 +89,7 @@ #include "base/tile.h" #include "base/tile-manager.h" +#include "core/gimpcoreconfig.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" @@ -322,18 +323,19 @@ plug_in_init (void) plug_in_init_shm (); /* search for binaries in the plug-in directory path */ - gimp_datafiles_read_directories (gimprc.plug_in_path, MODE_EXECUTABLE, + gimp_datafiles_read_directories (core_config->plug_in_path, MODE_EXECUTABLE, plug_in_init_file, NULL); /* read the pluginrc file for cached data */ filename = NULL; - if (gimprc.pluginrc_path) + if (core_config->pluginrc_path) { - if (g_path_is_absolute (gimprc.pluginrc_path)) - filename = g_strdup (gimprc.pluginrc_path); + if (g_path_is_absolute (core_config->pluginrc_path)) + filename = g_strdup (core_config->pluginrc_path); else filename = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s", - gimp_directory (), gimprc.pluginrc_path); + gimp_directory (), + core_config->pluginrc_path); } else filename = gimp_personal_rc_file ("pluginrc"); @@ -853,7 +855,7 @@ plug_in_new (gchar *name) if (! g_path_is_absolute (name)) { - path = plug_in_search_in_path (gimprc.plug_in_path, name); + path = plug_in_search_in_path (core_config->plug_in_path, name); if (! path) { diff --git a/app/gui/preferences-dialog.c b/app/gui/preferences-dialog.c index c4a64a4120..f00186fd7a 100644 --- a/app/gui/preferences-dialog.c +++ b/app/gui/preferences-dialog.c @@ -26,23 +26,25 @@ #include "libgimpbase/gimpbase.h" #include "libgimpwidgets/gimpwidgets.h" -#include "core/core-types.h" +#include "tools/tools-types.h" #include "base/base-config.h" #include "base/tile-cache.h" #include "core/gimp.h" #include "core/gimpcontainer.h" +#include "core/gimpcoreconfig.h" #include "core/gimpimage.h" -#include "gdisplay.h" +#include "tools/tool_manager.h" + #include "layer-select.h" #include "resolution-calibrate-dialog.h" #include "session.h" #include "app_procs.h" #include "colormaps.h" -#include "context_manager.h" +#include "gdisplay.h" #include "gdisplay_ops.h" #include "gimphelp.h" #include "gimprc.h" @@ -173,12 +175,12 @@ static gboolean edit_info_window_follows_mouse; static gboolean edit_disable_tearoff_menus; static gchar * edit_temp_path = NULL; static gchar * edit_swap_path = NULL; +static gchar * edit_plug_in_path = NULL; +static gchar * edit_module_path = NULL; static gchar * edit_brush_path = NULL; static gchar * edit_pattern_path = NULL; static gchar * edit_palette_path = NULL; static gchar * edit_gradient_path = NULL; -static gchar * edit_plug_in_path = NULL; -static gchar * edit_module_path = NULL; /* variables which will be changed _after_ closing the dialog */ static guint edit_tile_cache_size; @@ -269,10 +271,10 @@ static PrefsState prefs_check_settings (void) { /* First, check for invalid values... */ - if (gimprc.levels_of_undo < 0) + if (core_config->levels_of_undo < 0) { g_message (_("Error: Levels of undo must be zero or greater.")); - gimprc.levels_of_undo = old_levels_of_undo; + core_config->levels_of_undo = old_levels_of_undo; return PREFS_CORRUPT; } if (gimprc.marching_speed < 50) @@ -281,38 +283,38 @@ prefs_check_settings (void) gimprc.marching_speed = old_marching_speed; return PREFS_CORRUPT; } - if (gimprc.default_width < 1) + if (core_config->default_width < 1) { g_message (_("Error: Default width must be one or greater.")); - gimprc.default_width = old_default_width; + core_config->default_width = old_default_width; return PREFS_CORRUPT; } - if (gimprc.default_height < 1) + if (core_config->default_height < 1) { g_message (_("Error: Default height must be one or greater.")); - gimprc.default_height = old_default_height; + core_config->default_height = old_default_height; return PREFS_CORRUPT; } - if (gimprc.default_units < GIMP_UNIT_INCH || - gimprc.default_units >= gimp_unit_get_number_of_units ()) + if (core_config->default_units < GIMP_UNIT_INCH || + core_config->default_units >= gimp_unit_get_number_of_units ()) { g_message (_("Error: Default unit must be within unit range.")); - gimprc.default_units = old_default_units; + core_config->default_units = old_default_units; return PREFS_CORRUPT; } - if (gimprc.default_xresolution < GIMP_MIN_RESOLUTION || - gimprc.default_yresolution < GIMP_MIN_RESOLUTION) + if (core_config->default_xresolution < GIMP_MIN_RESOLUTION || + core_config->default_yresolution < GIMP_MIN_RESOLUTION) { g_message (_("Error: Default resolution must not be zero.")); - gimprc.default_xresolution = old_default_xresolution; - gimprc.default_yresolution = old_default_yresolution; + core_config->default_xresolution = old_default_xresolution; + core_config->default_yresolution = old_default_yresolution; return PREFS_CORRUPT; } - if (gimprc.default_resolution_units < GIMP_UNIT_INCH || - gimprc.default_resolution_units >= gimp_unit_get_number_of_units ()) + if (core_config->default_resolution_units < GIMP_UNIT_INCH || + core_config->default_resolution_units >= gimp_unit_get_number_of_units ()) { g_message (_("Error: Default resolution unit must be within unit range.")); - gimprc.default_resolution_units = old_default_resolution_units; + core_config->default_resolution_units = old_default_resolution_units; return PREFS_CORRUPT; } if (gimprc.monitor_xres < GIMP_MIN_RESOLUTION || @@ -350,12 +352,12 @@ prefs_check_settings (void) prefs_strcmp (old_temp_path, edit_temp_path) || prefs_strcmp (old_swap_path, edit_swap_path) || + prefs_strcmp (old_plug_in_path, edit_plug_in_path) || + prefs_strcmp (old_module_path, edit_module_path) || prefs_strcmp (old_brush_path, edit_brush_path) || prefs_strcmp (old_pattern_path, edit_pattern_path) || prefs_strcmp (old_palette_path, edit_palette_path) || - prefs_strcmp (old_gradient_path, edit_gradient_path) || - prefs_strcmp (old_plug_in_path, edit_plug_in_path) || - prefs_strcmp (old_module_path, edit_module_path)) + prefs_strcmp (old_gradient_path, edit_gradient_path)) { return PREFS_RESTART; } @@ -528,14 +530,15 @@ prefs_save_callback (GtkWidget *widget, save_temp_path = base_config->temp_path; save_swap_path = base_config->swap_path; - save_brush_path = gimprc.brush_path; - save_pattern_path = gimprc.pattern_path; - save_palette_path = gimprc.palette_path; - save_gradient_path = gimprc.gradient_path; - save_plug_in_path = gimprc.plug_in_path; - save_module_path = gimprc.module_path; - if (gimprc.levels_of_undo != old_levels_of_undo) + save_plug_in_path = core_config->plug_in_path; + save_module_path = core_config->module_path; + save_brush_path = core_config->brush_path; + save_pattern_path = core_config->pattern_path; + save_palette_path = core_config->palette_path; + save_gradient_path = core_config->gradient_path; + + if (core_config->levels_of_undo != old_levels_of_undo) { update = g_list_append (update, "undo-levels"); } @@ -596,32 +599,32 @@ prefs_save_callback (GtkWidget *widget, { update = g_list_append (update, "always-restore-session"); } - if (gimprc.default_width != old_default_width || - gimprc.default_height != old_default_height) + if (core_config->default_width != old_default_width || + core_config->default_height != old_default_height) { update = g_list_append (update, "default-image-size"); } - if (gimprc.default_units != old_default_units) + if (core_config->default_units != old_default_units) { update = g_list_append (update, "default-units"); } - if (ABS (gimprc.default_xresolution - old_default_xresolution) > GIMP_MIN_RESOLUTION) + if (ABS (core_config->default_xresolution - old_default_xresolution) > GIMP_MIN_RESOLUTION) { update = g_list_append (update, "default-xresolution"); } - if (ABS (gimprc.default_yresolution - old_default_yresolution) > GIMP_MIN_RESOLUTION) + if (ABS (core_config->default_yresolution - old_default_yresolution) > GIMP_MIN_RESOLUTION) { update = g_list_append (update, "default-yresolution"); } - if (gimprc.default_resolution_units != old_default_resolution_units) + if (core_config->default_resolution_units != old_default_resolution_units) { update = g_list_append (update, "default-resolution-units"); } - if (gimprc.default_type != old_default_type) + if (core_config->default_type != old_default_type) { update = g_list_append (update, "default-image-type"); } - if (prefs_strcmp (gimprc.default_comment, old_default_comment)) + if (prefs_strcmp (core_config->default_comment, old_default_comment)) { update = g_list_append (update, "default-comment"); } @@ -680,7 +683,7 @@ prefs_save_callback (GtkWidget *widget, { update = g_list_append (update, "max-new-image-size"); } - if (gimprc.thumbnail_mode != old_thumbnail_mode) + if (core_config->thumbnail_mode != old_thumbnail_mode) { update = g_list_append (update, "thumbnail-mode"); } @@ -771,36 +774,36 @@ prefs_save_callback (GtkWidget *widget, base_config->swap_path = edit_swap_path; update = g_list_append (update, "swap-path"); } + if (prefs_strcmp (old_plug_in_path, edit_plug_in_path)) + { + core_config->plug_in_path = edit_plug_in_path; + update = g_list_append (update, "plug-in-path"); + } + if (prefs_strcmp (old_module_path, edit_module_path)) + { + core_config->module_path = edit_module_path; + update = g_list_append (update, "module-path"); + } if (prefs_strcmp (old_brush_path, edit_brush_path)) { - gimprc.brush_path = edit_brush_path; + core_config->brush_path = edit_brush_path; update = g_list_append (update, "brush-path"); } if (prefs_strcmp (old_pattern_path, edit_pattern_path)) { - gimprc.pattern_path = edit_pattern_path; + core_config->pattern_path = edit_pattern_path; update = g_list_append (update, "pattern-path"); } if (prefs_strcmp (old_palette_path, edit_palette_path)) { - gimprc.palette_path = edit_palette_path; + core_config->palette_path = edit_palette_path; update = g_list_append (update, "palette-path"); } if (prefs_strcmp (old_gradient_path, edit_gradient_path)) { - gimprc.gradient_path = edit_gradient_path; + core_config->gradient_path = edit_gradient_path; update = g_list_append (update, "gradient-path"); } - if (prefs_strcmp (old_plug_in_path, edit_plug_in_path)) - { - gimprc.plug_in_path = edit_plug_in_path; - update = g_list_append (update, "plug-in-path"); - } - if (prefs_strcmp (old_module_path, edit_module_path)) - { - gimprc.module_path = edit_module_path; - update = g_list_append (update, "module-path"); - } /* values which are changed on "OK" or "Save" */ if (edit_tile_cache_size != old_tile_cache_size) @@ -814,8 +817,8 @@ prefs_save_callback (GtkWidget *widget, if (gimprc.using_xserver_resolution) - gdisplay_xserver_resolution (&(gimprc.monitor_xres), - &(gimprc.monitor_yres)); + gdisplay_xserver_resolution (&gimprc.monitor_xres, + &gimprc.monitor_yres); /* restore variables which must not change */ base_config->stingy_memory_use = save_stingy_memory_use; @@ -827,14 +830,15 @@ prefs_save_callback (GtkWidget *widget, gimprc.nav_window_per_display = save_nav_window_per_display; gimprc.info_window_follows_mouse = save_info_window_follows_mouse; - base_config->temp_path = save_temp_path; - base_config->swap_path = save_swap_path; - gimprc.brush_path = save_brush_path; - gimprc.pattern_path = save_pattern_path; - gimprc.palette_path = save_palette_path; - gimprc.gradient_path = save_gradient_path; - gimprc.plug_in_path = save_plug_in_path; - gimprc.module_path = save_module_path; + base_config->temp_path = save_temp_path; + base_config->swap_path = save_swap_path; + + core_config->plug_in_path = save_plug_in_path; + core_config->module_path = save_module_path; + core_config->brush_path = save_brush_path; + core_config->pattern_path = save_pattern_path; + core_config->palette_path = save_palette_path; + core_config->gradient_path = save_gradient_path; /* no need to restore values which are only changed on "OK" and "Save" */ @@ -850,39 +854,40 @@ prefs_cancel_callback (GtkWidget *widget, prefs_dlg = NULL; /* restore ordinary gimprc variables */ - base_config->interpolation_type = old_interpolation_type; - base_config->num_processors = old_num_processors; - - gimprc.levels_of_undo = old_levels_of_undo; - gimprc.marching_speed = old_marching_speed; - gimprc.allow_resize_windows = old_allow_resize_windows; - gimprc.auto_save = old_auto_save; - gimprc.no_cursor_updating = old_no_cursor_updating; - gimprc.perfectmouse = old_perfectmouse; - gimprc.show_tool_tips = old_show_tool_tips; - gimprc.show_rulers = old_show_rulers; - gimprc.show_statusbar = old_show_statusbar; - gimprc.confirm_on_close = old_confirm_on_close; - gimprc.save_session_info = old_save_session_info; - gimprc.save_device_status = old_save_device_status; - gimprc.default_width = old_default_width; - gimprc.default_height = old_default_height; - gimprc.default_units = old_default_units; - gimprc.default_xresolution = old_default_xresolution; - gimprc.default_yresolution = old_default_yresolution; - gimprc.default_resolution_units = old_default_resolution_units; - gimprc.default_type = old_default_type; - gimprc.default_dot_for_dot = old_default_dot_for_dot; - gimprc.monitor_xres = old_monitor_xres; - gimprc.monitor_yres = old_monitor_yres; - gimprc.using_xserver_resolution = old_using_xserver_resolution; - gimprc.max_new_image_size = old_max_new_image_size; - gimprc.thumbnail_mode = old_thumbnail_mode; - gimprc.trust_dirty_flag = old_trust_dirty_flag; - gimprc.use_help = old_use_help; - gimprc.help_browser = old_help_browser; - gimprc.cursor_mode = old_cursor_mode; - gimprc.default_threshold = old_default_threshold; + base_config->interpolation_type = old_interpolation_type; + base_config->num_processors = old_num_processors; + + core_config->default_type = old_default_type; + core_config->default_width = old_default_width; + core_config->default_height = old_default_height; + core_config->default_units = old_default_units; + core_config->default_xresolution = old_default_xresolution; + core_config->default_yresolution = old_default_yresolution; + core_config->default_resolution_units = old_default_resolution_units; + core_config->levels_of_undo = old_levels_of_undo; + core_config->thumbnail_mode = old_thumbnail_mode; + + gimprc.marching_speed = old_marching_speed; + gimprc.allow_resize_windows = old_allow_resize_windows; + gimprc.auto_save = old_auto_save; + gimprc.no_cursor_updating = old_no_cursor_updating; + gimprc.perfectmouse = old_perfectmouse; + gimprc.show_tool_tips = old_show_tool_tips; + gimprc.show_rulers = old_show_rulers; + gimprc.show_statusbar = old_show_statusbar; + gimprc.confirm_on_close = old_confirm_on_close; + gimprc.save_session_info = old_save_session_info; + gimprc.save_device_status = old_save_device_status; + gimprc.default_dot_for_dot = old_default_dot_for_dot; + gimprc.monitor_xres = old_monitor_xres; + gimprc.monitor_yres = old_monitor_yres; + gimprc.using_xserver_resolution = old_using_xserver_resolution; + gimprc.max_new_image_size = old_max_new_image_size; + gimprc.trust_dirty_flag = old_trust_dirty_flag; + gimprc.use_help = old_use_help; + gimprc.help_browser = old_help_browser; + gimprc.cursor_mode = old_cursor_mode; + gimprc.default_threshold = old_default_threshold; /* restore variables which need some magic */ if (gimprc.preview_size != old_preview_size) @@ -911,10 +916,10 @@ prefs_cancel_callback (GtkWidget *widget, gdisplays_flush (); } - prefs_strset (&(gimprc.image_title_format), old_image_title_format); - prefs_strset (&(gimprc.default_comment), old_default_comment); + prefs_strset (&gimprc.image_title_format, old_image_title_format); + prefs_strset (&core_config->default_comment, old_default_comment); - context_manager_set_global_paint_options (old_global_paint_options); + tool_manager_set_global_paint_options (the_gimp, old_global_paint_options); /* restore values which need a restart */ edit_stingy_memory_use = old_stingy_memory_use; @@ -929,12 +934,13 @@ prefs_cancel_callback (GtkWidget *widget, prefs_strset (&edit_temp_path, old_temp_path); prefs_strset (&edit_swap_path, old_swap_path); + + prefs_strset (&edit_plug_in_path, old_plug_in_path); + prefs_strset (&edit_module_path, old_module_path); prefs_strset (&edit_brush_path, old_brush_path); prefs_strset (&edit_pattern_path, old_pattern_path); prefs_strset (&edit_palette_path, old_palette_path); prefs_strset (&edit_gradient_path, old_gradient_path); - prefs_strset (&edit_plug_in_path, old_plug_in_path); - prefs_strset (&edit_module_path, old_module_path); /* no need to restore values which are only changed on "OK" and "Save" */ } @@ -948,19 +954,19 @@ prefs_toggle_callback (GtkWidget *widget, val = (gint *) data; /* toggle buttos */ - if (data == &(gimprc.allow_resize_windows) || - data == &(gimprc.auto_save) || - data == &(gimprc.no_cursor_updating) || - data == &(gimprc.perfectmouse) || - data == &(gimprc.show_tool_tips) || - data == &(gimprc.show_rulers) || - data == &(gimprc.show_statusbar) || - data == &(gimprc.confirm_on_close) || - data == &(gimprc.save_session_info) || - data == &(gimprc.save_device_status) || - data == &(gimprc.always_restore_session) || - data == &(gimprc.default_dot_for_dot) || - data == &(gimprc.use_help) || + if (data == &gimprc.allow_resize_windows || + data == &gimprc.auto_save || + data == &gimprc.no_cursor_updating || + data == &gimprc.perfectmouse || + data == &gimprc.show_tool_tips || + data == &gimprc.show_rulers || + data == &gimprc.show_statusbar || + data == &gimprc.confirm_on_close || + data == &gimprc.save_session_info || + data == &gimprc.save_device_status || + data == &gimprc.always_restore_session || + data == &gimprc.default_dot_for_dot || + data == &gimprc.use_help || data == &edit_stingy_memory_use || data == &edit_install_cmap || @@ -974,19 +980,19 @@ prefs_toggle_callback (GtkWidget *widget, } /* radio buttons */ - else if (data == &(gimprc.thumbnail_mode) || - data == &base_config->interpolation_type || - data == &(gimprc.trust_dirty_flag) || - data == &(gimprc.help_browser) || - data == &(gimprc.cursor_mode) || - data == &(gimprc.default_type)) + else if (data == &base_config->interpolation_type || + data == &core_config->default_type || + data == &core_config->thumbnail_mode || + data == &gimprc.trust_dirty_flag || + data == &gimprc.help_browser || + data == &gimprc.cursor_mode) { *val = (gint) gtk_object_get_user_data (GTK_OBJECT (widget)); } /* values which need some magic */ - else if ((data == &(gimprc.transparency_type)) || - (data == &(gimprc.transparency_size))) + else if ((data == &gimprc.transparency_type) || + (data == &gimprc.transparency_size)) { *val = (gint) gtk_object_get_user_data (GTK_OBJECT (widget)); @@ -997,10 +1003,10 @@ prefs_toggle_callback (GtkWidget *widget, gdisplays_expose_full (); gdisplays_flush (); } - else if (data == &(gimprc.global_paint_options)) + else if (data == &gimprc.global_paint_options) { - context_manager_set_global_paint_options - (GTK_TOGGLE_BUTTON (widget)->active); + tool_manager_set_global_paint_options (the_gimp, + GTK_TOGGLE_BUTTON (widget)->active); } /* no matching varible found */ @@ -1104,11 +1110,11 @@ static void prefs_default_size_callback (GtkWidget *widget, gpointer data) { - gimprc.default_width = + core_config->default_width = RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0)); - gimprc.default_height = + core_config->default_height = RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1)); - gimprc.default_units = gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (widget)); + core_config->default_units = gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (widget)); } static void @@ -1153,15 +1159,15 @@ prefs_default_resolution_callback (GtkWidget *widget, gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size_sizeentry), 1, yres, FALSE); - gimprc.default_width = + core_config->default_width = RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (size_sizeentry), 0)); - gimprc.default_height = + core_config->default_height = RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (size_sizeentry), 1)); - gimprc.default_xresolution = xres; - gimprc.default_yresolution = yres; + core_config->default_xresolution = xres; + core_config->default_yresolution = yres; - gimprc.default_resolution_units = + core_config->default_resolution_units = gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (widget)); } @@ -1175,8 +1181,8 @@ prefs_res_source_callback (GtkWidget *widget, if (GTK_TOGGLE_BUTTON (widget)->active) { - gdisplay_xserver_resolution (&(gimprc.monitor_xres), - &(gimprc.monitor_yres)); + gdisplay_xserver_resolution (&gimprc.monitor_xres, + &gimprc.monitor_yres); gimprc.using_xserver_resolution = TRUE; } else @@ -1404,12 +1410,13 @@ preferences_dialog_create (void) edit_temp_path = prefs_strdup (base_config->temp_path); edit_swap_path = prefs_strdup (base_config->swap_path); - edit_plug_in_path = prefs_strdup (gimprc.plug_in_path); - edit_module_path = prefs_strdup (gimprc.module_path); - edit_brush_path = prefs_strdup (gimprc.brush_path); - edit_pattern_path = prefs_strdup (gimprc.pattern_path); - edit_palette_path = prefs_strdup (gimprc.palette_path); - edit_gradient_path = prefs_strdup (gimprc.gradient_path); + + edit_plug_in_path = prefs_strdup (core_config->plug_in_path); + edit_module_path = prefs_strdup (core_config->module_path); + edit_brush_path = prefs_strdup (core_config->brush_path); + edit_pattern_path = prefs_strdup (core_config->pattern_path); + edit_palette_path = prefs_strdup (core_config->palette_path); + edit_gradient_path = prefs_strdup (core_config->gradient_path); } /* assign edit variables for values which get changed on "OK" and "Save" @@ -1421,10 +1428,19 @@ preferences_dialog_create (void) old_interpolation_type = base_config->interpolation_type; old_num_processors = base_config->num_processors; + old_default_type = core_config->default_type; + old_default_width = core_config->default_width; + old_default_height = core_config->default_height; + old_default_units = core_config->default_units; + old_default_xresolution = core_config->default_xresolution; + old_default_yresolution = core_config->default_yresolution; + old_default_resolution_units = core_config->default_resolution_units; + old_levels_of_undo = core_config->levels_of_undo; + old_thumbnail_mode = core_config->thumbnail_mode; + old_perfectmouse = gimprc.perfectmouse; old_transparency_type = gimprc.transparency_type; old_transparency_size = gimprc.transparency_size; - old_levels_of_undo = gimprc.levels_of_undo; old_marching_speed = gimprc.marching_speed; old_allow_resize_windows = gimprc.allow_resize_windows; old_auto_save = gimprc.auto_save; @@ -1438,20 +1454,12 @@ preferences_dialog_create (void) old_save_session_info = gimprc.save_session_info; old_save_device_status = gimprc.save_device_status; old_always_restore_session = gimprc.always_restore_session; - old_default_width = gimprc.default_width; - old_default_height = gimprc.default_height; - old_default_units = gimprc.default_units; - old_default_xresolution = gimprc.default_xresolution; - old_default_yresolution = gimprc.default_yresolution; - old_default_resolution_units = gimprc.default_resolution_units; - old_default_type = gimprc.default_type; old_default_dot_for_dot = gimprc.default_dot_for_dot; old_monitor_xres = gimprc.monitor_xres; old_monitor_yres = gimprc.monitor_yres; old_using_xserver_resolution = gimprc.using_xserver_resolution; old_global_paint_options = gimprc.global_paint_options; old_max_new_image_size = gimprc.max_new_image_size; - old_thumbnail_mode = gimprc.thumbnail_mode; old_trust_dirty_flag = gimprc.trust_dirty_flag; old_use_help = gimprc.use_help; old_help_browser = gimprc.help_browser; @@ -1459,7 +1467,7 @@ preferences_dialog_create (void) old_default_threshold = gimprc.default_threshold; prefs_strset (&old_image_title_format, gimprc.image_title_format); - prefs_strset (&old_default_comment, gimprc.default_comment); + prefs_strset (&old_default_comment, core_config->default_comment); /* values which will need a restart */ old_stingy_memory_use = edit_stingy_memory_use; @@ -1559,7 +1567,8 @@ preferences_dialog_create (void) gtk_widget_show (hbox); sizeentry = - gimp_size_entry_new (2, gimprc.default_units, "%p", FALSE, FALSE, TRUE, 75, + gimp_size_entry_new (2, core_config->default_units, "%p", + FALSE, FALSE, TRUE, 75, GIMP_SIZE_ENTRY_UPDATE_SIZE); gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry), @@ -1569,10 +1578,10 @@ preferences_dialog_create (void) gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry), _("Pixels"), 1, 4, 0.0); - gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), - 0, gimprc.default_xresolution, FALSE); - gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), - 1, gimprc.default_yresolution, FALSE); + gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0, + core_config->default_xresolution, FALSE); + gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 1, + core_config->default_yresolution, FALSE); gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0, GIMP_MIN_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE); @@ -1580,9 +1589,9 @@ preferences_dialog_create (void) (GIMP_SIZE_ENTRY (sizeentry), 1, GIMP_MIN_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0, - gimprc.default_width); + core_config->default_width); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1, - gimprc.default_height); + core_config->default_height); gtk_signal_connect (GTK_OBJECT (sizeentry), "unit_changed", GTK_SIGNAL_FUNC (prefs_default_size_callback), @@ -1608,13 +1617,14 @@ preferences_dialog_create (void) pixels_per_unit = g_strconcat (_("Pixels"), "/%s", NULL); - sizeentry2 = - gimp_size_entry_new (2, gimprc.default_resolution_units, pixels_per_unit, - FALSE, FALSE, TRUE, 75, - GIMP_SIZE_ENTRY_UPDATE_RESOLUTION); + sizeentry2 = gimp_size_entry_new (2, core_config->default_resolution_units, + pixels_per_unit, + FALSE, FALSE, TRUE, 75, + GIMP_SIZE_ENTRY_UPDATE_RESOLUTION); button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM); - if (ABS (gimprc.default_xresolution - gimprc.default_yresolution) < GIMP_MIN_RESOLUTION) + if (ABS (core_config->default_xresolution - + core_config->default_yresolution) < GIMP_MIN_RESOLUTION) gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (button), TRUE); gtk_table_attach_defaults (GTK_TABLE (sizeentry2), button, 1, 3, 3, 4); gtk_widget_show (button); @@ -1633,10 +1643,10 @@ preferences_dialog_create (void) gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry2), 1, GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION); - gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry2), - 0, gimprc.default_xresolution); - gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry2), - 1, gimprc.default_yresolution); + gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry2), 0, + core_config->default_xresolution); + gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry2), 1, + core_config->default_yresolution); gtk_signal_connect (GTK_OBJECT (sizeentry2), "unit_changed", (GtkSignalFunc) prefs_default_resolution_callback, @@ -1664,8 +1674,8 @@ preferences_dialog_create (void) optionmenu = gimp_option_menu_new2 (FALSE, prefs_toggle_callback, - &(gimprc.default_type), (gpointer) - gimprc.default_type, + &core_config->default_type, + (gpointer) core_config->default_type, _("RGB"), (gpointer) RGB, NULL, _("Grayscale"), (gpointer) GRAY, NULL, @@ -1682,7 +1692,7 @@ preferences_dialog_create (void) hbox = gimp_mem_size_entry_new (GTK_ADJUSTMENT (adjustment)); gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", GTK_SIGNAL_FUNC (gimp_uint_adjustment_update), - &(gimprc.max_new_image_size)); + &gimprc.max_new_image_size); gimp_table_attach_aligned (GTK_TABLE (table), 0, 1, _("Maximum Image Size:"), 1.0, 0.5, hbox, 1, TRUE); @@ -1710,10 +1720,11 @@ preferences_dialog_create (void) text = gtk_text_new (NULL, NULL); gtk_text_set_editable (GTK_TEXT (text), TRUE); - gtk_text_insert (GTK_TEXT (text), NULL, NULL, NULL, gimprc.default_comment, -1); + gtk_text_insert (GTK_TEXT (text), NULL, NULL, NULL, + core_config->default_comment, -1); gtk_signal_connect (GTK_OBJECT (text), "changed", GTK_SIGNAL_FUNC (prefs_text_callback), - &(gimprc.default_comment)); + &core_config->default_comment); gtk_container_add (GTK_CONTAINER (hbox), text); gtk_widget_show (text); @@ -1746,7 +1757,8 @@ preferences_dialog_create (void) optionmenu = gimp_option_menu_new2 (FALSE, prefs_toggle_callback, - &(gimprc.transparency_type), (gpointer) gimprc.transparency_type, + &gimprc.transparency_type, + (gpointer) gimprc.transparency_type, _("Light Checks"), (gpointer) LIGHT_CHECKS, NULL, _("Mid-Tone Checks"), (gpointer) GRAY_CHECKS, NULL, @@ -1762,8 +1774,8 @@ preferences_dialog_create (void) optionmenu = gimp_option_menu_new2 (FALSE, prefs_toggle_callback, - &(gimprc.transparency_size), (gpointer) - gimprc.transparency_size, + &gimprc.transparency_size, + (gpointer) gimprc.transparency_size, _("Small"), (gpointer) SMALL_CHECKS, NULL, _("Medium"), (gpointer) MEDIUM_CHECKS, NULL, @@ -1853,8 +1865,8 @@ preferences_dialog_create (void) optionmenu = gimp_option_menu_new2 (FALSE, prefs_preview_size_callback, - &(gimprc.preview_size), (gpointer) - gimprc.preview_size, + &gimprc.preview_size, + (gpointer) gimprc.preview_size, _("None"), (gpointer) 0, NULL, _("Tiny"), (gpointer) 24, NULL, @@ -1870,8 +1882,8 @@ preferences_dialog_create (void) optionmenu = gimp_option_menu_new2 (FALSE, prefs_nav_preview_size_callback, - &(gimprc.nav_preview_size), (gpointer) - gimprc.nav_preview_size, + &gimprc.nav_preview_size, + (gpointer) gimprc.nav_preview_size, _("Small"), (gpointer) 48, NULL, _("Medium"), (gpointer) 80, NULL, @@ -1956,7 +1968,7 @@ preferences_dialog_create (void) gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC (prefs_toggle_callback), - &(gimprc.show_tool_tips)); + &gimprc.show_tool_tips); gtk_widget_show (button); button = @@ -1966,7 +1978,7 @@ preferences_dialog_create (void) gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC (prefs_toggle_callback), - &(gimprc.use_help)); + &gimprc.use_help); gtk_widget_show (button); vbox2 = prefs_frame_new (_("Help Browser"), GTK_BOX (vbox)); @@ -1979,7 +1991,8 @@ preferences_dialog_create (void) optionmenu = gimp_option_menu_new2 (FALSE, prefs_toggle_callback, - &(gimprc.help_browser), (gpointer) gimprc.help_browser, + &gimprc.help_browser, + (gpointer) gimprc.help_browser, _("Internal"), (gpointer) HELP_BROWSER_GIMP, NULL, _("Netscape"), (gpointer) HELP_BROWSER_NETSCAPE, NULL, @@ -2009,7 +2022,7 @@ preferences_dialog_create (void) gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC (prefs_toggle_callback), - &(gimprc.default_dot_for_dot)); + &gimprc.default_dot_for_dot); gtk_widget_show (button); button = gtk_check_button_new_with_label(_("Resize Window on Zoom")); @@ -2018,7 +2031,7 @@ preferences_dialog_create (void) gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC (prefs_toggle_callback), - &(gimprc.allow_resize_windows)); + &gimprc.allow_resize_windows); gtk_widget_show (button); button = gtk_check_button_new_with_label(_("Show Rulers")); @@ -2027,7 +2040,7 @@ preferences_dialog_create (void) gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC (prefs_toggle_callback), - &(gimprc.show_rulers)); + &gimprc.show_rulers); gtk_widget_show (button); button = gtk_check_button_new_with_label(_("Show Statusbar")); @@ -2036,7 +2049,7 @@ preferences_dialog_create (void) gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC (prefs_toggle_callback), - &(gimprc.show_statusbar)); + &gimprc.show_statusbar); gtk_widget_show (button); table = gtk_table_new (2, 2, FALSE); @@ -2047,12 +2060,11 @@ preferences_dialog_create (void) gtk_widget_show (table); spinbutton = - gimp_spin_button_new (&adjustment, - gimprc.marching_speed, 50.0, 32000.0, 10.0, 100.0, 1.0, - 1.0, 0.0); + gimp_spin_button_new (&adjustment, gimprc.marching_speed, + 50.0, 32000.0, 10.0, 100.0, 1.0, 1.0, 0.0); gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", GTK_SIGNAL_FUNC (gimp_int_adjustment_update), - &(gimprc.marching_speed)); + &gimprc.marching_speed); gimp_table_attach_aligned (GTK_TABLE (table), 0, 0, _("Marching Ants Speed:"), 1.0, 0.5, spinbutton, 1, TRUE); @@ -2091,7 +2103,7 @@ preferences_dialog_create (void) gtk_signal_connect (GTK_OBJECT (GTK_COMBO (combo)->entry), "changed", GTK_SIGNAL_FUNC (prefs_string_callback), - &(gimprc.image_title_format)); + &gimprc.image_title_format); gimp_table_attach_aligned (GTK_TABLE (table), 0, 1, _("Image Title Format:"), 1.0, 0.5, @@ -2107,7 +2119,7 @@ preferences_dialog_create (void) gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC (prefs_toggle_callback), - &(gimprc.perfectmouse)); + &gimprc.perfectmouse); gtk_widget_show (button); button = gtk_check_button_new_with_label (_("Disable Cursor Updating")); @@ -2116,7 +2128,7 @@ preferences_dialog_create (void) gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC (prefs_toggle_callback), - &(gimprc.no_cursor_updating)); + &gimprc.no_cursor_updating); gtk_widget_show (button); table = gtk_table_new (1, 2, FALSE); @@ -2127,7 +2139,7 @@ preferences_dialog_create (void) optionmenu = gimp_option_menu_new2 (FALSE, prefs_toggle_callback, - &(gimprc.cursor_mode), + &gimprc.cursor_mode, (gpointer) gimprc.cursor_mode, _("Tool Icon"), @@ -2164,7 +2176,7 @@ preferences_dialog_create (void) gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC (prefs_toggle_callback), - &(gimprc.global_paint_options)); + &gimprc.global_paint_options); gtk_widget_show (button); vbox2 = prefs_frame_new (_("Finding Contiguous Regions"), GTK_BOX (vbox)); @@ -2178,12 +2190,11 @@ preferences_dialog_create (void) /* Default threshold */ spinbutton = - gimp_spin_button_new (&adjustment, - gimprc.default_threshold, 0.0, 255.0, - 1.0, 5.0, 0.0, 1.0, 0.0); + gimp_spin_button_new (&adjustment, gimprc.default_threshold, + 0.0, 255.0, 1.0, 5.0, 0.0, 1.0, 0.0); gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", GTK_SIGNAL_FUNC (gimp_int_adjustment_update), - &(gimprc.default_threshold)); + &gimprc.default_threshold); gimp_table_attach_aligned (GTK_TABLE (table), 0, 0, _("Default Threshold:"), 1.0, 0.5, spinbutton, 1, TRUE); @@ -2227,12 +2238,11 @@ preferences_dialog_create (void) gtk_widget_show (table); /* Levels of Undo */ - spinbutton = - gimp_spin_button_new (&adjustment, - gimprc.levels_of_undo, 0.0, 255.0, 1.0, 5.0, 0.0, 1.0, 0.0); + spinbutton = gimp_spin_button_new (&adjustment, core_config->levels_of_undo, + 0.0, 255.0, 1.0, 5.0, 0.0, 1.0, 0.0); gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", GTK_SIGNAL_FUNC (gimp_int_adjustment_update), - &(gimprc.levels_of_undo)); + &core_config->levels_of_undo); gimp_table_attach_aligned (GTK_TABLE (table), 0, 0, _("Levels of Undo:"), 1.0, 0.5, spinbutton, 1, TRUE); @@ -2307,8 +2317,8 @@ preferences_dialog_create (void) optionmenu = gimp_option_menu_new2 (FALSE, prefs_toggle_callback, - &(gimprc.thumbnail_mode), (gpointer) - gimprc.thumbnail_mode, + &core_config->thumbnail_mode, + (gpointer) core_config->thumbnail_mode, _("Always"), (gpointer) 1, NULL, _("Never"), (gpointer) 0, NULL, @@ -2320,7 +2330,7 @@ preferences_dialog_create (void) optionmenu = gimp_option_menu_new2 (FALSE, prefs_toggle_callback, - &(gimprc.trust_dirty_flag), + &gimprc.trust_dirty_flag, (gpointer) gimprc.trust_dirty_flag, _("Only when Modified"), (gpointer) 1, NULL, @@ -2352,7 +2362,7 @@ preferences_dialog_create (void) gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC (prefs_toggle_callback), - &(gimprc.save_session_info)); + &gimprc.save_session_info); gtk_widget_show (button); hbox = gtk_hbox_new (FALSE, 2); @@ -2374,7 +2384,7 @@ preferences_dialog_create (void) gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC (prefs_toggle_callback), - &(gimprc.always_restore_session)); + &gimprc.always_restore_session); gtk_widget_show (button); vbox2 = prefs_frame_new (_("Devices"), GTK_BOX (vbox)); @@ -2385,7 +2395,7 @@ preferences_dialog_create (void) gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC (prefs_toggle_callback), - &(gimprc.save_device_status)); + &gimprc.save_device_status); gtk_widget_show (button); /* Monitor */ @@ -2459,7 +2469,7 @@ preferences_dialog_create (void) gtk_container_add (GTK_CONTAINER (abox), sizeentry); gtk_widget_show (sizeentry); - gtk_widget_set_sensitive (sizeentry, !gimprc.using_xserver_resolution); + gtk_widget_set_sensitive (sizeentry, ! gimprc.using_xserver_resolution); hbox = gtk_hbox_new (FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER (hbox), 4); @@ -2471,7 +2481,7 @@ preferences_dialog_create (void) sizeentry); gtk_box_pack_start (GTK_BOX (hbox), calibrate_button, FALSE, FALSE, 0); gtk_widget_show (calibrate_button); - gtk_widget_set_sensitive (calibrate_button, !gimprc.using_xserver_resolution); + gtk_widget_set_sensitive (calibrate_button, ! gimprc.using_xserver_resolution); group = NULL; button = gtk_radio_button_new_with_label (group, _("From windowing system")); @@ -2507,7 +2517,7 @@ preferences_dialog_create (void) gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); - if (!gimprc.using_xserver_resolution) + if (! gimprc.using_xserver_resolution) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); /* Directories */ diff --git a/app/gui/qmask-commands.c b/app/gui/qmask-commands.c index 88179c8537..4161b32b02 100644 --- a/app/gui/qmask-commands.c +++ b/app/gui/qmask-commands.c @@ -29,6 +29,7 @@ #include "core/core-types.h" +#include "core/gimp.h" #include "core/gimpchannel.h" #include "core/gimpcontext.h" #include "core/gimpimage.h" @@ -36,6 +37,7 @@ #include "widgets/gimpcolorpanel.h" +#include "app_procs.h" #include "drawable.h" #include "floating_sel.h" #include "gdisplay.h" @@ -238,7 +240,10 @@ qmask_activate (GtkWidget *widget, "Qmask", &color); gimp_image_add_channel (gimg, gmask, 0); - drawable_fill (GIMP_DRAWABLE (gmask), TRANSPARENT_FILL); + + drawable_fill (GIMP_DRAWABLE (gmask), + gimp_get_user_context (gimg->gimp), + TRANSPARENT_FILL); } else { diff --git a/app/gui/resize-dialog.c b/app/gui/resize-dialog.c index a36ed7b762..4feb074774 100644 --- a/app/gui/resize-dialog.c +++ b/app/gui/resize-dialog.c @@ -26,13 +26,12 @@ #include "core/core-types.h" +#include "core/gimpcoreconfig.h" #include "core/gimpimage.h" #include "core/gimplayer.h" #include "resize-dialog.h" -#include "gimprc.h" - #include "libgimp/gimpintl.h" @@ -593,7 +592,7 @@ resize_widget_new (ResizeType type, gtk_widget_set_usize (spinbutton, 75, 0); private->resolution_se = - gimp_size_entry_new (1, gimprc.default_resolution_units, + gimp_size_entry_new (1, core_config->default_resolution_units, _("pixels/%a"), FALSE, FALSE, FALSE, 75, GIMP_SIZE_ENTRY_UPDATE_RESOLUTION); diff --git a/app/gui/test-commands.c b/app/gui/test-commands.c index c25121ec53..4f74182ac4 100644 --- a/app/gui/test-commands.c +++ b/app/gui/test-commands.c @@ -384,7 +384,7 @@ test_image_container_list_view_cmd_callback (GtkWidget *widget, { container_view_new (TRUE, "Image List", the_gimp->images, - gimp_context_get_user (), + gimp_get_user_context (the_gimp), 64); } @@ -394,7 +394,7 @@ test_image_container_grid_view_cmd_callback (GtkWidget *widget, { container_view_new (FALSE, "Image Grid", the_gimp->images, - gimp_context_get_user (), + gimp_get_user_context (the_gimp), 64); } @@ -406,7 +406,7 @@ test_brush_container_list_view_cmd_callback (GtkWidget *widget, "Brush List", the_gimp->brush_factory, NULL, - gimp_context_get_user (), + gimp_get_user_context (the_gimp), 24); } @@ -418,7 +418,7 @@ test_pattern_container_list_view_cmd_callback (GtkWidget *widget, "Pattern List", the_gimp->pattern_factory, NULL, - gimp_context_get_user (), + gimp_get_user_context (the_gimp), 24); } @@ -430,7 +430,7 @@ test_gradient_container_list_view_cmd_callback (GtkWidget *widget, "Gradient List", the_gimp->gradient_factory, NULL, - gimp_context_get_user (), + gimp_get_user_context (the_gimp), 24); } @@ -442,7 +442,7 @@ test_palette_container_list_view_cmd_callback (GtkWidget *widget, "Palette List", the_gimp->palette_factory, NULL, - gimp_context_get_user (), + gimp_get_user_context (the_gimp), 24); } @@ -454,7 +454,7 @@ test_brush_container_grid_view_cmd_callback (GtkWidget *widget, "Brush Grid", the_gimp->brush_factory, NULL, - gimp_context_get_user (), + gimp_get_user_context (the_gimp), 32); } @@ -466,7 +466,7 @@ test_pattern_container_grid_view_cmd_callback (GtkWidget *widget, "Pattern Grid", the_gimp->pattern_factory, NULL, - gimp_context_get_user (), + gimp_get_user_context (the_gimp), 24); } @@ -478,7 +478,7 @@ test_gradient_container_grid_view_cmd_callback (GtkWidget *widget, "Gradient Grid", the_gimp->gradient_factory, NULL, - gimp_context_get_user (), + gimp_get_user_context (the_gimp), 24); } @@ -490,7 +490,7 @@ test_palette_container_grid_view_cmd_callback (GtkWidget *widget, "Palette Grid", the_gimp->palette_factory, NULL, - gimp_context_get_user (), + gimp_get_user_context (the_gimp), 24); } @@ -500,7 +500,7 @@ test_multi_container_list_view_cmd_callback (GtkWidget *widget, { container_multi_view_new (TRUE, "Multi List", the_gimp->brush_factory->container, - gimp_context_get_user (), + gimp_get_user_context (the_gimp), 24); } @@ -510,7 +510,7 @@ test_multi_container_grid_view_cmd_callback (GtkWidget *widget, { container_multi_view_new (FALSE, "Multi Grid", the_gimp->brush_factory->container, - gimp_context_get_user (), + gimp_get_user_context (the_gimp), 32); } diff --git a/app/gui/tool-options-dialog.c b/app/gui/tool-options-dialog.c index a2a4396001..e50ad44dd7 100644 --- a/app/gui/tool-options-dialog.c +++ b/app/gui/tool-options-dialog.c @@ -24,6 +24,7 @@ #include "tools/tools-types.h" +#include "core/gimp.h" #include "core/gimpcontext.h" #include "core/gimplist.h" #include "core/gimptoolinfo.h" @@ -38,6 +39,7 @@ #include "tool-options-dialog.h" +#include "app_procs.h" #include "dialog_handler.h" #include "libgimp/gimpintl.h" @@ -84,7 +86,7 @@ tool_options_dialog_create (void) if (options_shell) return options_shell; - tool_info = gimp_context_get_tool (gimp_context_get_user ()); + tool_info = gimp_context_get_tool (gimp_get_user_context (the_gimp)); if (! tool_info) { @@ -173,14 +175,14 @@ tool_options_dialog_create (void) tool_options_dialog_drag_tool, NULL); gtk_signal_connect_while_alive - (GTK_OBJECT (gimp_context_get_user ()), "tool_changed", + (GTK_OBJECT (gimp_get_user_context (the_gimp)), "tool_changed", GTK_SIGNAL_FUNC (tool_options_dialog_tool_changed), NULL, GTK_OBJECT (options_shell)); - tool_info = gimp_context_get_tool (gimp_context_get_user ()); + tool_info = gimp_context_get_tool (gimp_get_user_context (the_gimp)); - tool_options_dialog_tool_changed (gimp_context_get_user (), + tool_options_dialog_tool_changed (gimp_get_user_context (the_gimp), tool_info, NULL); @@ -254,14 +256,15 @@ tool_options_dialog_drop_tool (GtkWidget *widget, GimpViewable *viewable, gpointer data) { - gimp_context_set_tool (gimp_context_get_user (), GIMP_TOOL_INFO (viewable)); + gimp_context_set_tool (gimp_get_user_context (the_gimp), + GIMP_TOOL_INFO (viewable)); } GimpViewable * tool_options_dialog_drag_tool (GtkWidget *widget, gpointer data) { - return (GimpViewable *) gimp_context_get_tool (gimp_context_get_user ()); + return (GimpViewable *) gimp_context_get_tool (gimp_get_user_context (the_gimp)); } static void @@ -287,7 +290,7 @@ tool_options_dialog_reset_callback (GtkWidget *widget, if (! active_tool) return; - tool_info = tool_manager_get_info_by_tool (active_tool); + tool_info = tool_manager_get_info_by_tool (the_gimp, active_tool); if (! tool_info) { diff --git a/app/gui/toolbox.c b/app/gui/toolbox.c index 81d0ad4e17..b349d6bf84 100644 --- a/app/gui/toolbox.c +++ b/app/gui/toolbox.c @@ -128,7 +128,7 @@ toolbox_tool_button_toggled (GtkWidget *widget, tool_info = GIMP_TOOL_INFO (data); if ((tool_info) && GTK_TOGGLE_BUTTON (widget)->active) - gimp_context_set_tool (gimp_context_get_user (), tool_info); + gimp_context_set_tool (gimp_get_user_context (the_gimp), tool_info); } static gint @@ -410,9 +410,9 @@ toolbox_create (void) gtk_box_pack_start (GTK_BOX (main_vbox), wbox, TRUE, TRUE, 0); gtk_widget_show (wbox); - create_tools (wbox, gimp_context_get_user ()); + create_tools (wbox, gimp_get_user_context (the_gimp)); - gtk_signal_connect_while_alive (GTK_OBJECT (gimp_context_get_user ()), + gtk_signal_connect_while_alive (GTK_OBJECT (gimp_get_user_context (the_gimp)), "tool_changed", GTK_SIGNAL_FUNC (toolbox_tool_changed), NULL, @@ -421,7 +421,7 @@ toolbox_create (void) create_color_area (wbox); if (gimprc.show_indicators) - create_indicator_area (wbox, gimp_context_get_user ()); + create_indicator_area (wbox, gimp_get_user_context (the_gimp)); gtk_drag_dest_set (window, GTK_DEST_DEFAULT_ALL, @@ -578,7 +578,8 @@ toolbox_drop_tool (GtkWidget *widget, GimpViewable *viewable, gpointer data) { - gimp_context_set_tool (gimp_context_get_user (), GIMP_TOOL_INFO (viewable)); + gimp_context_set_tool (gimp_get_user_context (the_gimp), + GIMP_TOOL_INFO (viewable)); } static void diff --git a/app/gui/tools-commands.c b/app/gui/tools-commands.c index fb7129c070..e9c948febf 100644 --- a/app/gui/tools-commands.c +++ b/app/gui/tools-commands.c @@ -42,14 +42,14 @@ void tools_default_colors_cmd_callback (GtkWidget *widget, gpointer data) { - gimp_context_set_default_colors (gimp_context_get_user ()); + gimp_context_set_default_colors (gimp_get_user_context (the_gimp)); } void tools_swap_colors_cmd_callback (GtkWidget *widget, gpointer data) { - gimp_context_swap_colors (gimp_context_get_user ()); + gimp_context_swap_colors (gimp_get_user_context (the_gimp)); } void @@ -61,19 +61,19 @@ tools_swap_contexts_cmd_callback (GtkWidget *widget, if (! swap_context) { - swap_context = gimp_context_new (the_gimp, - "Swap Context", - gimp_context_get_user ()); - temp_context = gimp_context_new (the_gimp, - "Temp Context", - NULL); + swap_context = gimp_create_context (the_gimp, + "Swap Context", + gimp_get_user_context (the_gimp)); + temp_context = gimp_create_context (the_gimp, + "Temp Context", + NULL); } - gimp_context_copy_args (gimp_context_get_user (), + gimp_context_copy_args (gimp_get_user_context (the_gimp), temp_context, GIMP_CONTEXT_ALL_ARGS_MASK); gimp_context_copy_args (swap_context, - gimp_context_get_user (), + gimp_get_user_context (the_gimp), GIMP_CONTEXT_ALL_ARGS_MASK); gimp_context_copy_args (temp_context, swap_context, @@ -91,10 +91,10 @@ tools_select_cmd_callback (GtkWidget *widget, tool_type = (GtkType) action; - tool_info = tool_manager_get_info_by_type (tool_type); + tool_info = tool_manager_get_info_by_type (the_gimp, tool_type); gdisp = gdisplay_active (); - gimp_context_set_tool (gimp_context_get_user (), tool_info); + gimp_context_set_tool (gimp_get_user_context (the_gimp), tool_info); #ifdef __GNUC__ #warning FIXME (let the tool manager to this stuff) diff --git a/app/libgimp_glue.c b/app/libgimp_glue.c index 2f9896e15f..e3cca38a0c 100644 --- a/app/libgimp_glue.c +++ b/app/libgimp_glue.c @@ -24,8 +24,10 @@ #include "core/core-types.h" +#include "core/gimp.h" #include "core/gimpcontext.h" +#include "app_procs.h" #include "libgimp_glue.h" @@ -34,7 +36,7 @@ gimp_palette_set_foreground (const GimpRGB *color) { g_return_val_if_fail (color != NULL, FALSE); - gimp_context_set_foreground (NULL, color); + gimp_context_set_foreground (gimp_get_user_context (the_gimp), color); return TRUE; } @@ -44,7 +46,7 @@ gimp_palette_get_foreground (GimpRGB *color) { g_return_val_if_fail (color != NULL, FALSE); - gimp_context_get_foreground (NULL, color); + gimp_context_get_foreground (gimp_get_user_context (the_gimp), color); return TRUE; } @@ -54,7 +56,7 @@ gimp_palette_set_background (const GimpRGB *color) { g_return_val_if_fail (color != NULL, FALSE); - gimp_context_set_background (NULL, color); + gimp_context_set_background (gimp_get_user_context (the_gimp), color); return TRUE; } @@ -64,7 +66,7 @@ gimp_palette_get_background (GimpRGB *color) { g_return_val_if_fail (color != NULL, FALSE); - gimp_context_get_background (NULL, color); + gimp_context_get_background (gimp_get_user_context (the_gimp), color); return TRUE; } diff --git a/app/menus/menus.c b/app/menus/menus.c index 2cee76b2cc..d4cf833cae 100644 --- a/app/menus/menus.c +++ b/app/menus/menus.c @@ -2252,7 +2252,7 @@ menus_init (void) } /* reorder /Image/Colors */ - tool_info = tool_manager_get_info_by_type (GIMP_TYPE_POSTERIZE_TOOL); + tool_info = tool_manager_get_info_by_type (the_gimp, GIMP_TYPE_POSTERIZE_TOOL); menu_item = gtk_item_factory_get_widget (image_factory, tool_info->menu_path); @@ -2275,7 +2275,7 @@ menus_init (void) for (i = 0; i < n_color_tools; i++) { - tool_info = tool_manager_get_info_by_type (color_tools[i]); + tool_info = tool_manager_get_info_by_type (the_gimp, color_tools[i]); menu_item = gtk_item_factory_get_widget (image_factory, tool_info->menu_path); diff --git a/app/menus/plug-in-menus.c b/app/menus/plug-in-menus.c index a9145841c2..94d5ee9622 100644 --- a/app/menus/plug-in-menus.c +++ b/app/menus/plug-in-menus.c @@ -89,6 +89,7 @@ #include "base/tile.h" #include "base/tile-manager.h" +#include "core/gimpcoreconfig.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" @@ -322,18 +323,19 @@ plug_in_init (void) plug_in_init_shm (); /* search for binaries in the plug-in directory path */ - gimp_datafiles_read_directories (gimprc.plug_in_path, MODE_EXECUTABLE, + gimp_datafiles_read_directories (core_config->plug_in_path, MODE_EXECUTABLE, plug_in_init_file, NULL); /* read the pluginrc file for cached data */ filename = NULL; - if (gimprc.pluginrc_path) + if (core_config->pluginrc_path) { - if (g_path_is_absolute (gimprc.pluginrc_path)) - filename = g_strdup (gimprc.pluginrc_path); + if (g_path_is_absolute (core_config->pluginrc_path)) + filename = g_strdup (core_config->pluginrc_path); else filename = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s", - gimp_directory (), gimprc.pluginrc_path); + gimp_directory (), + core_config->pluginrc_path); } else filename = gimp_personal_rc_file ("pluginrc"); @@ -853,7 +855,7 @@ plug_in_new (gchar *name) if (! g_path_is_absolute (name)) { - path = plug_in_search_in_path (gimprc.plug_in_path, name); + path = plug_in_search_in_path (core_config->plug_in_path, name); if (! path) { diff --git a/app/module_db.c b/app/module_db.c index 7d707d1665..fc8ee3106f 100644 --- a/app/module_db.c +++ b/app/module_db.c @@ -38,12 +38,13 @@ #include "core/core-types.h" +#include "core/gimpcoreconfig.h" #include "core/gimplist.h" #include "appenv.h" #include "module_db.h" -#include "gimprc.h" #include "datafiles.h" +#include "gimprc.h" #include "libgimp/gimpmodule.h" @@ -217,7 +218,7 @@ module_db_init (void) modules = gimp_list_new (MODULE_INFO_TYPE, GIMP_CONTAINER_POLICY_WEAK); if (g_module_supported ()) - gimp_datafiles_read_directories (gimprc.module_path, 0 /* no flags */, + gimp_datafiles_read_directories (core_config->module_path, 0 /* no flags */, module_initialize, NULL); #ifdef DUMP_DB gimp_container_foreach (modules, print_module_info, NULL); @@ -615,7 +616,7 @@ module_initialize (const gchar *filename, mod->refs = 0; mod->load_inhibit = module_inhibited (mod->fullpath, - gimprc.module_db_load_inhibit); + core_config->module_db_load_inhibit); if (!mod->load_inhibit) { if (be_verbose) @@ -1137,7 +1138,7 @@ browser_refresh_callback (GtkWidget *widget, kill_list = NULL; /* walk filesystem and add new things we find */ - gimp_datafiles_read_directories (gimprc.module_path, 0 /* no flags */, + gimp_datafiles_read_directories (core_config->module_path, 0 /* no flags */, module_initialize, NULL); } diff --git a/app/nav_window.c b/app/nav_window.c index 980ff89f86..ba16e77ddd 100644 --- a/app/nav_window.c +++ b/app/nav_window.c @@ -363,7 +363,7 @@ nav_dialog_follow_auto (void) GimpContext *context; GDisplay *gdisp; - context = gimp_context_get_user (); + context = gimp_get_user_context (the_gimp); gdisp = gimp_context_get_display (context); diff --git a/app/paint/gimpairbrush.c b/app/paint/gimpairbrush.c index 930b6f2875..6e29aa82de 100644 --- a/app/paint/gimpairbrush.c +++ b/app/paint/gimpairbrush.c @@ -29,6 +29,7 @@ #include "paint-funcs/paint-funcs.h" +#include "core/gimp.h" #include "core/gimpbrush.h" #include "core/gimpcontext.h" #include "core/gimpdrawable.h" @@ -124,9 +125,10 @@ static GimpPaintToolClass *parent_class = NULL; /* functions */ void -gimp_airbrush_tool_register (void) +gimp_airbrush_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_AIRBRUSH_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_AIRBRUSH_TOOL, TRUE, "gimp:airbrush_tool", _("Airbrush"), @@ -242,7 +244,8 @@ gimp_airbrush_tool_paint (GimpPaintTool *paint_tool, incremental = non_gui_incremental; } - brush = gimp_context_get_brush (NULL); + brush = + gimp_context_get_brush (gimp_get_current_context (drawable->gimage->gimp)); switch (state) { @@ -352,6 +355,7 @@ gimp_airbrush_tool_motion (GimpPaintTool *paint_tool, gboolean incremental) { GimpImage *gimage; + GimpContext *context; TempBuf *area; guchar col[MAX_CHANNELS]; gdouble scale; @@ -363,6 +367,8 @@ gimp_airbrush_tool_motion (GimpPaintTool *paint_tool, if (! (gimage = gimp_drawable_gimage (drawable))) return; + context = gimp_get_current_context (gimage->gimp); + if (pressure_options->size) scale = paint_tool->curpressure; else @@ -374,9 +380,9 @@ gimp_airbrush_tool_motion (GimpPaintTool *paint_tool, /* color the pixels */ if (pressure_options->color) { - GimpRGB color; - - gimp_gradient_get_color_at (gimp_context_get_gradient (NULL), + GimpRGB color; + + gimp_gradient_get_color_at (gimp_context_get_gradient (context), paint_tool->curpressure, &color); gimp_rgba_get_uchar (&color, @@ -412,8 +418,8 @@ gimp_airbrush_tool_motion (GimpPaintTool *paint_tool, /* paste the newly painted area to the image */ gimp_paint_tool_paste_canvas (paint_tool, drawable, MIN (pressure, 255), - (gint) (gimp_context_get_opacity (NULL) * 255), - gimp_context_get_paint_mode (NULL), + (gint) (gimp_context_get_opacity (context) * 255), + gimp_context_get_paint_mode (gimp_get_current_context (gimage->gimp)), SOFT, scale, paint_appl_mode); } diff --git a/app/paint/gimpairbrush.h b/app/paint/gimpairbrush.h index 8f21bff8b4..81779fe145 100644 --- a/app/paint/gimpairbrush.h +++ b/app/paint/gimpairbrush.h @@ -44,10 +44,11 @@ struct _GimpAirbrushToolClass }; -void gimp_airbrush_tool_register (void); +void gimp_airbrush_tool_register (Gimp *gimp); GtkType gimp_airbrush_tool_get_type (void); + gboolean airbrush_non_gui (GimpDrawable *drawable, gdouble pressure, gint num_strokes, diff --git a/app/paint/gimpclone.c b/app/paint/gimpclone.c index f5c29f10aa..79ce88d7fe 100644 --- a/app/paint/gimpclone.c +++ b/app/paint/gimpclone.c @@ -32,6 +32,7 @@ #include "paint-funcs/paint-funcs.h" +#include "core/gimp.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" #include "core/gimpimage-mask.h" @@ -155,9 +156,10 @@ static CloneType non_gui_type; /* global functions */ void -gimp_clone_tool_register (void) +gimp_clone_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_CLONE_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_CLONE_TOOL, TRUE, "gimp:clone_tool", _("Clone"), @@ -265,18 +267,21 @@ clone_set_src_drawable (GimpDrawable *drawable) } static void -gimp_clone_tool_paint (GimpPaintTool *paint_tool, - GimpDrawable *drawable, - PaintState state) +gimp_clone_tool_paint (GimpPaintTool *paint_tool, + GimpDrawable *drawable, + PaintState state) { - GDisplay *gdisp; - GDisplay *src_gdisp; - gint x1, y1, x2, y2; - static gint orig_src_x, orig_src_y; + GDisplay *gdisp; + GDisplay *src_gdisp; + gint x1, y1, x2, y2; + static gint orig_src_x, orig_src_y; GimpDrawTool *draw_tool; + GimpContext *context; gdisp = (GDisplay *) active_tool->gdisp; - draw_tool = GIMP_DRAW_TOOL(paint_tool); + draw_tool = GIMP_DRAW_TOOL (paint_tool); + + context = gimp_get_current_context (gdisp->gimage->gimp); switch (state) { @@ -341,7 +346,7 @@ gimp_clone_tool_paint (GimpPaintTool *paint_tool, orig_src_y = src_y; } if (clone_options->type == PATTERN_CLONE) - if (! gimp_context_get_pattern (NULL)) + if (! gimp_context_get_pattern (context)) g_message (_("No patterns available for this operation.")); break; @@ -351,7 +356,7 @@ gimp_clone_tool_paint (GimpPaintTool *paint_tool, { src_x = orig_src_x; src_y = orig_src_y; - } + } return; break; @@ -453,6 +458,7 @@ gimp_clone_tool_motion (GimpPaintTool *paint_tool, { GimpImage *gimage; GimpImage *src_gimage = NULL; + GimpContext *context; guchar *s; guchar *d; TempBuf *orig; @@ -484,6 +490,8 @@ gimp_clone_tool_motion (GimpPaintTool *paint_tool, if (! (gimage = gimp_drawable_gimage (drawable))) return; + context = gimp_get_current_context (gimage->gimp); + if (pressure_options->size) scale = paint_tool->curpressure; else @@ -559,7 +567,7 @@ gimp_clone_tool_motion (GimpPaintTool *paint_tool, break; case PATTERN_CLONE: - pattern = gimp_context_get_pattern (NULL); + pattern = gimp_context_get_pattern (context); if (!pattern) return; @@ -601,15 +609,15 @@ gimp_clone_tool_motion (GimpPaintTool *paint_tool, } } - opacity = 255.0 * gimp_context_get_opacity (NULL); + opacity = 255.0 * gimp_context_get_opacity (context); if (pressure_options->opacity) opacity = opacity * 2.0 * paint_tool->curpressure; /* paste the newly painted canvas to the gimage which is being worked on */ gimp_paint_tool_paste_canvas (paint_tool, drawable, MIN (opacity, 255), - (gint) (gimp_context_get_opacity (NULL) * 255), - gimp_context_get_paint_mode (NULL), + (gint) (gimp_context_get_opacity (context) * 255), + gimp_context_get_paint_mode (context), pressure_options->pressure ? PRESSURE : SOFT, scale, CONSTANT); } diff --git a/app/paint/gimpclone.h b/app/paint/gimpclone.h index 7f10e324a6..15ce1359fd 100644 --- a/app/paint/gimpclone.h +++ b/app/paint/gimpclone.h @@ -51,7 +51,7 @@ struct _GimpCloneToolClass }; -void gimp_clone_tool_register (void); +void gimp_clone_tool_register (Gimp *gimp); GtkType gimp_clone_tool_get_type (void); diff --git a/app/paint/gimpconvolve.c b/app/paint/gimpconvolve.c index 6b632b6477..47aa155909 100644 --- a/app/paint/gimpconvolve.c +++ b/app/paint/gimpconvolve.c @@ -28,9 +28,11 @@ #include "base/pixel-region.h" #include "base/temp-buf.h" +#include "core/gimp.h" #include "core/gimpbrush.h" #include "core/gimpcontext.h" #include "core/gimpdrawable.h" +#include "core/gimpimage.h" #include "paint-funcs/paint-funcs.h" @@ -168,9 +170,10 @@ static gfloat sharpen_matrix [25] = /* global functions */ void -gimp_convolve_tool_register (void) +gimp_convolve_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_CONVOLVE_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_CONVOLVE_TOOL, TRUE, "gimp:convolve_tool", _("Convolve"), @@ -350,6 +353,7 @@ gimp_convolve_tool_motion (GimpPaintTool *paint_tool, ConvolveClipType area_vclip = CONVOLVE_NOT_CLIPPED; gint marginx = 0; gint marginy = 0; + GimpContext *context; if (! gimp_drawable_gimage (drawable)) return; @@ -545,9 +549,11 @@ gimp_convolve_tool_motion (GimpPaintTool *paint_tool, g_free(fillcolor); } + context = gimp_get_current_context (gimp_drawable_gimage (drawable)->gimp); + /* paste the newly painted canvas to the gimage which is being worked on */ gimp_paint_tool_replace_canvas (paint_tool, drawable, OPAQUE_OPACITY, - (gint) (gimp_context_get_opacity (NULL) * 255), + (gint) (gimp_context_get_opacity (context) * 255), pressure_options->pressure ? PRESSURE : SOFT, scale, INCREMENTAL); } diff --git a/app/paint/gimpconvolve.h b/app/paint/gimpconvolve.h index 77ff7495c3..1662b3e344 100644 --- a/app/paint/gimpconvolve.h +++ b/app/paint/gimpconvolve.h @@ -52,7 +52,7 @@ struct _GimpConvolveToolClass }; -void gimp_convolve_tool_register (void); +void gimp_convolve_tool_register (Gimp *gimp); GtkType gimp_convolve_tool_get_type (void); diff --git a/app/paint/gimpdodgeburn.c b/app/paint/gimpdodgeburn.c index 7d83502d9b..2898fd26a2 100644 --- a/app/paint/gimpdodgeburn.c +++ b/app/paint/gimpdodgeburn.c @@ -32,8 +32,10 @@ #include "paint-funcs/paint-funcs.h" +#include "core/gimp.h" #include "core/gimpdrawable.h" #include "core/gimpcontext.h" +#include "core/gimpimage.h" #include "gdisplay.h" @@ -134,9 +136,10 @@ static GimpPaintToolClass *parent_class = NULL; /* functions */ void -gimp_dodgeburn_tool_register (void) +gimp_dodgeburn_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_DODGEBURN_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_DODGEBURN_TOOL, TRUE, "gimp:dodgeburn_tool", _("Dodge/Burn"), @@ -461,7 +464,9 @@ gimp_dodgeburn_tool_motion (GimpPaintTool *paint_tool, else copy_region (&tempPR, &destPR); - opacity = 255 * gimp_context_get_opacity (NULL); + opacity = + 255 * gimp_context_get_opacity (gimp_get_current_context (gimage->gimp)); + if (pressure_options->opacity) opacity = opacity * 2.0 * paint_tool->curpressure; diff --git a/app/paint/gimpdodgeburn.h b/app/paint/gimpdodgeburn.h index e37b8f3791..f7234d93ba 100644 --- a/app/paint/gimpdodgeburn.h +++ b/app/paint/gimpdodgeburn.h @@ -58,7 +58,7 @@ struct _GimpDodgeBurnToolClass }; -void gimp_dodgeburn_tool_register (void); +void gimp_dodgeburn_tool_register (Gimp *gimp); GtkType gimp_dodgeburn_tool_get_type (void); diff --git a/app/paint/gimperaser.c b/app/paint/gimperaser.c index e860dad545..b1dc9a455d 100644 --- a/app/paint/gimperaser.c +++ b/app/paint/gimperaser.c @@ -29,6 +29,7 @@ #include "paint-funcs/paint-funcs.h" +#include "core/gimp.h" #include "core/gimpcontext.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" @@ -101,9 +102,10 @@ static GimpPaintToolClass *parent_class = NULL; /* functions */ void -gimp_eraser_tool_register (void) +gimp_eraser_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_ERASER_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_ERASER_TOOL, TRUE, "gimp:eraser_tool", _("Eraser"), @@ -260,17 +262,20 @@ gimp_eraser_tool_motion (GimpPaintTool *paint_tool, gboolean incremental, gboolean anti_erase) { - GimpImage *gimage; - gint opacity; - TempBuf *area; - guchar col[MAX_CHANNELS]; - gdouble scale; + GimpImage *gimage; + GimpContext *context; + gint opacity; + TempBuf *area; + guchar col[MAX_CHANNELS]; + gdouble scale; if (! (gimage = gimp_drawable_gimage (drawable))) return; gimp_image_get_background (gimage, drawable, col); + context = gimp_get_current_context (gimage->gimp); + if (pressure_options->size) scale = paint_tool->curpressure; else @@ -287,7 +292,7 @@ gimp_eraser_tool_motion (GimpPaintTool *paint_tool, color_pixels (temp_buf_data (area), col, area->width * area->height, area->bytes); - opacity = 255 * gimp_context_get_opacity (NULL); + opacity = 255 * gimp_context_get_opacity (context); if (pressure_options->opacity) opacity = opacity * 2.0 * paint_tool->curpressure; @@ -295,7 +300,7 @@ gimp_eraser_tool_motion (GimpPaintTool *paint_tool, /* paste the newly painted canvas to the gimage which is being worked on */ gimp_paint_tool_paste_canvas (paint_tool, drawable, MIN (opacity, 255), - gimp_context_get_opacity (NULL) * 255, + gimp_context_get_opacity (context) * 255, anti_erase ? ANTI_ERASE_MODE : ERASE_MODE, hard ? HARD : (pressure_options->pressure ? PRESSURE : SOFT), scale, diff --git a/app/paint/gimperaser.h b/app/paint/gimperaser.h index aeb5412217..b325bc9e96 100644 --- a/app/paint/gimperaser.h +++ b/app/paint/gimperaser.h @@ -44,7 +44,7 @@ struct _GimpEraserToolClass }; -void gimp_eraser_tool_register (void); +void gimp_eraser_tool_register (Gimp *gimp); GtkType gimp_eraser_tool_get_type (void); diff --git a/app/paint/gimpink.c b/app/paint/gimpink.c index 5524893b6b..001c5b0eff 100644 --- a/app/paint/gimpink.c +++ b/app/paint/gimpink.c @@ -35,6 +35,7 @@ #include "paint-funcs/paint-funcs.h" +#include "core/gimp.h" #include "core/gimpcontext.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" @@ -232,9 +233,10 @@ static GimpToolClass *parent_class = NULL; /* functions */ void -gimp_ink_tool_register (void) +gimp_ink_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_INK_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_INK_TOOL, TRUE, "gimp:ink_tool", _("Ink Tool"), @@ -1492,6 +1494,7 @@ ink_paste (GimpInkTool *ink_tool, Blob *blob) { GimpImage *gimage; + GimpContext *context; PixelRegion srcPR; gint offx, offy; gchar col[MAX_CHANNELS]; @@ -1499,6 +1502,8 @@ ink_paste (GimpInkTool *ink_tool, if (! (gimage = gimp_drawable_gimage (drawable))) return; + context = gimp_get_current_context (gimage->gimp); + /* Get the the buffer */ ink_set_paint_area (ink_tool, drawable, blob); @@ -1537,8 +1542,8 @@ ink_paste (GimpInkTool *ink_tool, /* apply the paint area to the gimage */ gimp_image_apply_image (gimage, drawable, &srcPR, FALSE, - (int) (gimp_context_get_opacity (NULL) * 255), - gimp_context_get_paint_mode (NULL), + (int) (gimp_context_get_opacity (context) * 255), + gimp_context_get_paint_mode (context), undo_tiles, /* specify an alternative src1 */ canvas_buf->x, canvas_buf->y); diff --git a/app/paint/gimpink.h b/app/paint/gimpink.h index 911c84c863..b884a01a43 100644 --- a/app/paint/gimpink.h +++ b/app/paint/gimpink.h @@ -67,7 +67,7 @@ struct _GimpInkToolClass }; -void gimp_ink_tool_register (void); +void gimp_ink_tool_register (Gimp *gimp); GtkType gimp_ink_tool_get_type (void); diff --git a/app/paint/gimppaintbrush.c b/app/paint/gimppaintbrush.c index 0e9f2fbbb1..7d8240a624 100644 --- a/app/paint/gimppaintbrush.c +++ b/app/paint/gimppaintbrush.c @@ -31,6 +31,7 @@ #include "paint-funcs/paint-funcs.h" +#include "core/gimp.h" #include "core/gimpbrush.h" #include "core/gimpcontext.h" #include "core/gimpdrawable.h" @@ -81,9 +82,10 @@ static GimpPaintToolClass *parent_class = NULL; /* functions */ void -gimp_paintbrush_tool_register (void) +gimp_paintbrush_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_PAINTBRUSH_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_PAINTBRUSH_TOOL, TRUE, "gimp:paintbrush_tool", _("Paintbrush"), @@ -255,6 +257,7 @@ gimp_paintbrush_tool_motion (GimpPaintTool *paint_tool, GradientPaintMode gradient_type) { GimpImage *gimage; + GimpContext *context; TempBuf *area; gdouble x, paint_left; guchar local_blend = OPAQUE_OPACITY; @@ -269,6 +272,8 @@ gimp_paintbrush_tool_motion (GimpPaintTool *paint_tool, if (! (gimage = gimp_drawable_gimage (drawable))) return; + context = gimp_get_current_context (gimage->gimp); + if (pressure_options->size) scale = paint_tool->curpressure; else @@ -299,7 +304,7 @@ gimp_paintbrush_tool_motion (GimpPaintTool *paint_tool, if (gradient_length) { if (pressure_options->color) - gimp_gradient_get_color_at (gimp_context_get_gradient (NULL), + gimp_gradient_get_color_at (gimp_context_get_gradient (context), paint_tool->curpressure, &color); else gimp_paint_tool_get_color_from_gradient (paint_tool, gradient_length, @@ -344,8 +349,8 @@ gimp_paintbrush_tool_motion (GimpPaintTool *paint_tool, gimp_paint_tool_paste_canvas (paint_tool, drawable, MIN (opacity, 255), - gimp_context_get_opacity (NULL) * 255, - gimp_context_get_paint_mode (NULL), + gimp_context_get_opacity (context) * 255, + gimp_context_get_paint_mode (context), pressure_options->pressure ? PRESSURE : SOFT, scale, paint_appl_mode); } diff --git a/app/paint/gimppaintbrush.h b/app/paint/gimppaintbrush.h index 63188dfc2d..a7daacf4fb 100644 --- a/app/paint/gimppaintbrush.h +++ b/app/paint/gimppaintbrush.h @@ -44,7 +44,7 @@ struct _GimpPaintbrushToolClass }; -void gimp_paintbrush_tool_register (void); +void gimp_paintbrush_tool_register (Gimp *gimp); GtkType gimp_paintbrush_tool_get_type (void); diff --git a/app/paint/gimppaintcore.c b/app/paint/gimppaintcore.c index 91a0f38625..528faa95f6 100644 --- a/app/paint/gimppaintcore.c +++ b/app/paint/gimppaintcore.c @@ -37,6 +37,7 @@ #include "paint-funcs/paint-funcs.h" +#include "core/gimp.h" #include "core/gimpbrushpipe.h" #include "core/gimpcontext.h" #include "core/gimpdrawable.h" @@ -44,18 +45,19 @@ #include "core/gimpimage.h" #include "core/gimpimage-mask.h" -#include "devices.h" -#include "drawable.h" -#include "gdisplay.h" -#include "gimprc.h" -#include "undo.h" - #include "gimpdrawtool.h" #include "gimpdodgeburntool.h" #include "gimperasertool.h" #include "gimpconvolvetool.h" #include "gimppainttool.h" +#include "app_procs.h" +#include "devices.h" +#include "drawable.h" +#include "gdisplay.h" +#include "gimprc.h" +#include "undo.h" + #include "libgimp/gimpintl.h" #include "gimppainttool_kernels.h" @@ -837,6 +839,10 @@ gimp_paint_tool_sample_color (GimpDrawable *drawable, { if ((col = gimp_drawable_get_color_at (drawable, x, y))) { + Gimp *gimp; + + gimp = gimp_drawable_gimage (drawable)->gimp; + gimp_rgba_set_uchar (&color, col[RED_PIX], col[GREEN_PIX], @@ -844,9 +850,9 @@ gimp_paint_tool_sample_color (GimpDrawable *drawable, 255); if ((state & GDK_CONTROL_MASK)) - gimp_context_set_foreground (gimp_context_get_user (), &color); + gimp_context_set_foreground (gimp_get_user_context (gimp), &color); else - gimp_context_set_background (gimp_context_get_user (), &color); + gimp_context_set_background (gimp_get_user_context (gimp), &color); g_free (col); } @@ -870,6 +876,10 @@ gimp_paint_tool_start (GimpPaintTool *paint_tool, { static GimpBrush *brush = NULL; + GimpContext *context; + + context = gimp_get_current_context (the_gimp); + paint_tool->curx = x; paint_tool->cury = y; @@ -887,14 +897,14 @@ gimp_paint_tool_start (GimpPaintTool *paint_tool, #endif /* Each buffer is the same size as the maximum bounds of the active brush... */ - if (brush && brush != gimp_context_get_brush (NULL)) + if (brush && brush != gimp_context_get_brush (context)) { gtk_signal_disconnect_by_func (GTK_OBJECT (brush), GTK_SIGNAL_FUNC (gimp_paint_tool_invalidate_cache), NULL); gtk_object_unref (GTK_OBJECT (brush)); } - if (!(brush = gimp_context_get_brush (NULL))) + if (!(brush = gimp_context_get_brush (context))) { g_message (_("No brushes available for use with this tool.")); return FALSE; @@ -1099,8 +1109,11 @@ gimp_paint_tool_get_color_from_gradient (GimpPaintTool *paint_tool, GimpRGB *color, GradientPaintMode mode) { - gdouble y; - gdouble distance; /* distance in current brush stroke */ + GimpContext *context; + gdouble y; + gdouble distance; /* distance in current brush stroke */ + + context = gimp_get_current_context (the_gimp); distance = paint_tool->pixel_dist; y = ((double) distance / gradient_length); @@ -1114,7 +1127,7 @@ gimp_paint_tool_get_color_from_gradient (GimpPaintTool *paint_tool, else y = y - (int)y; - gimp_gradient_get_color_at (gimp_context_get_gradient (NULL), y, color); + gimp_gradient_get_color_at (gimp_context_get_gradient (context), y, color); } diff --git a/app/paint/gimppencil.c b/app/paint/gimppencil.c index 3db9d9fc0e..d070c05431 100644 --- a/app/paint/gimppencil.c +++ b/app/paint/gimppencil.c @@ -28,6 +28,7 @@ #include "paint-funcs/paint-funcs.h" +#include "core/gimp.h" #include "core/gimpbrush.h" #include "core/gimpcontext.h" #include "core/gimpdrawable.h" @@ -74,9 +75,10 @@ static GimpPaintToolClass *parent_class = NULL; /* functions */ void -gimp_pencil_tool_register (void) +gimp_pencil_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_PENCIL_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_PENCIL_TOOL, TRUE, "gimp:pencil_tool", _("Pencil"), @@ -191,6 +193,7 @@ gimp_pencil_tool_motion (GimpPaintTool *paint_tool, gboolean incremental) { GimpImage *gimage; + GimpContext *context; TempBuf *area; guchar col[MAX_CHANNELS]; gint opacity; @@ -200,6 +203,8 @@ gimp_pencil_tool_motion (GimpPaintTool *paint_tool, if (! (gimage = gimp_drawable_gimage (drawable))) return; + context = gimp_get_current_context (gimage->gimp); + if (pressure_options->size) scale = paint_tool->curpressure; else @@ -214,7 +219,7 @@ gimp_pencil_tool_motion (GimpPaintTool *paint_tool, { GimpRGB color; - gimp_gradient_get_color_at (gimp_context_get_gradient (NULL), + gimp_gradient_get_color_at (gimp_context_get_gradient (context), paint_tool->curpressure, &color); gimp_rgba_get_uchar (&color, @@ -242,15 +247,15 @@ gimp_pencil_tool_motion (GimpPaintTool *paint_tool, area->width * area->height, area->bytes); } - opacity = 255 * gimp_context_get_opacity (NULL); + opacity = 255 * gimp_context_get_opacity (context); if (pressure_options->opacity) opacity = opacity * 2.0 * paint_tool->curpressure; /* paste the newly painted canvas to the gimage which is being worked on */ gimp_paint_tool_paste_canvas (paint_tool, drawable, MIN (opacity, 255), - gimp_context_get_opacity (NULL) * 255, - gimp_context_get_paint_mode (NULL), + gimp_context_get_opacity (context) * 255, + gimp_context_get_paint_mode (context), HARD, scale, paint_appl_mode); } diff --git a/app/paint/gimppencil.h b/app/paint/gimppencil.h index 57f213edaa..0b13f7aa39 100644 --- a/app/paint/gimppencil.h +++ b/app/paint/gimppencil.h @@ -47,7 +47,7 @@ struct _GimpPencilToolClass }; -void gimp_pencil_tool_register (void); +void gimp_pencil_tool_register (Gimp *gimp); GtkType gimp_pencil_tool_get_type (void); diff --git a/app/paint/gimpsmudge.c b/app/paint/gimpsmudge.c index 2fac059696..b650b1ebbf 100644 --- a/app/paint/gimpsmudge.c +++ b/app/paint/gimpsmudge.c @@ -31,9 +31,11 @@ #include "paint-funcs/paint-funcs.h" +#include "core/gimp.h" #include "core/gimpbrush.h" #include "core/gimpcontext.h" #include "core/gimpdrawable.h" +#include "core/gimpimage.h" #include "gimpsmudgetool.h" #include "paint_options.h" @@ -111,9 +113,10 @@ static gdouble non_gui_rate; /* global functions */ void -gimp_smudge_tool_register (void) +gimp_smudge_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_SMUDGE_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_SMUDGE_TOOL, TRUE, "gimp:smudge_tool", _("Smudge"), @@ -348,6 +351,7 @@ gimp_smudge_tool_motion (GimpPaintTool *paint_tool, GimpDrawable *drawable) { GimpImage *gimage; + GimpContext *context; TempBuf *area; PixelRegion srcPR, destPR, tempPR; gdouble rate; @@ -357,6 +361,8 @@ gimp_smudge_tool_motion (GimpPaintTool *paint_tool, if (! (gimage = gimp_drawable_gimage (drawable))) return; + context = gimp_get_current_context (gimage->gimp); + /* If the image type is indexed, don't smudge */ if (gimp_drawable_is_indexed (drawable)) return; @@ -427,7 +433,7 @@ gimp_smudge_tool_motion (GimpPaintTool *paint_tool, else copy_region (&tempPR, &destPR); - opacity = 255 * gimp_context_get_opacity (NULL); + opacity = 255 * gimp_context_get_opacity (context); if (pressure_options->opacity) opacity = opacity * 2.0 * paint_tool->curpressure; diff --git a/app/paint/gimpsmudge.h b/app/paint/gimpsmudge.h index cd550bb65d..1584535691 100644 --- a/app/paint/gimpsmudge.h +++ b/app/paint/gimpsmudge.h @@ -58,12 +58,11 @@ struct _GimpSmudgeToolClass }; -void gimp_smudge_tool_register (void); +void gimp_smudge_tool_register (Gimp *gimp); GtkType gimp_smudge_tool_get_type (void); - /* FIXME: this antique code doesn't follow the coding style */ gboolean gimp_smudge_tool_non_gui (GimpDrawable *drawable, gdouble rate, diff --git a/app/paint/gimpsourcecore.c b/app/paint/gimpsourcecore.c index f5c29f10aa..79ce88d7fe 100644 --- a/app/paint/gimpsourcecore.c +++ b/app/paint/gimpsourcecore.c @@ -32,6 +32,7 @@ #include "paint-funcs/paint-funcs.h" +#include "core/gimp.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" #include "core/gimpimage-mask.h" @@ -155,9 +156,10 @@ static CloneType non_gui_type; /* global functions */ void -gimp_clone_tool_register (void) +gimp_clone_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_CLONE_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_CLONE_TOOL, TRUE, "gimp:clone_tool", _("Clone"), @@ -265,18 +267,21 @@ clone_set_src_drawable (GimpDrawable *drawable) } static void -gimp_clone_tool_paint (GimpPaintTool *paint_tool, - GimpDrawable *drawable, - PaintState state) +gimp_clone_tool_paint (GimpPaintTool *paint_tool, + GimpDrawable *drawable, + PaintState state) { - GDisplay *gdisp; - GDisplay *src_gdisp; - gint x1, y1, x2, y2; - static gint orig_src_x, orig_src_y; + GDisplay *gdisp; + GDisplay *src_gdisp; + gint x1, y1, x2, y2; + static gint orig_src_x, orig_src_y; GimpDrawTool *draw_tool; + GimpContext *context; gdisp = (GDisplay *) active_tool->gdisp; - draw_tool = GIMP_DRAW_TOOL(paint_tool); + draw_tool = GIMP_DRAW_TOOL (paint_tool); + + context = gimp_get_current_context (gdisp->gimage->gimp); switch (state) { @@ -341,7 +346,7 @@ gimp_clone_tool_paint (GimpPaintTool *paint_tool, orig_src_y = src_y; } if (clone_options->type == PATTERN_CLONE) - if (! gimp_context_get_pattern (NULL)) + if (! gimp_context_get_pattern (context)) g_message (_("No patterns available for this operation.")); break; @@ -351,7 +356,7 @@ gimp_clone_tool_paint (GimpPaintTool *paint_tool, { src_x = orig_src_x; src_y = orig_src_y; - } + } return; break; @@ -453,6 +458,7 @@ gimp_clone_tool_motion (GimpPaintTool *paint_tool, { GimpImage *gimage; GimpImage *src_gimage = NULL; + GimpContext *context; guchar *s; guchar *d; TempBuf *orig; @@ -484,6 +490,8 @@ gimp_clone_tool_motion (GimpPaintTool *paint_tool, if (! (gimage = gimp_drawable_gimage (drawable))) return; + context = gimp_get_current_context (gimage->gimp); + if (pressure_options->size) scale = paint_tool->curpressure; else @@ -559,7 +567,7 @@ gimp_clone_tool_motion (GimpPaintTool *paint_tool, break; case PATTERN_CLONE: - pattern = gimp_context_get_pattern (NULL); + pattern = gimp_context_get_pattern (context); if (!pattern) return; @@ -601,15 +609,15 @@ gimp_clone_tool_motion (GimpPaintTool *paint_tool, } } - opacity = 255.0 * gimp_context_get_opacity (NULL); + opacity = 255.0 * gimp_context_get_opacity (context); if (pressure_options->opacity) opacity = opacity * 2.0 * paint_tool->curpressure; /* paste the newly painted canvas to the gimage which is being worked on */ gimp_paint_tool_paste_canvas (paint_tool, drawable, MIN (opacity, 255), - (gint) (gimp_context_get_opacity (NULL) * 255), - gimp_context_get_paint_mode (NULL), + (gint) (gimp_context_get_opacity (context) * 255), + gimp_context_get_paint_mode (context), pressure_options->pressure ? PRESSURE : SOFT, scale, CONSTANT); } diff --git a/app/paint/gimpsourcecore.h b/app/paint/gimpsourcecore.h index 7f10e324a6..15ce1359fd 100644 --- a/app/paint/gimpsourcecore.h +++ b/app/paint/gimpsourcecore.h @@ -51,7 +51,7 @@ struct _GimpCloneToolClass }; -void gimp_clone_tool_register (void); +void gimp_clone_tool_register (Gimp *gimp); GtkType gimp_clone_tool_get_type (void); diff --git a/app/pdb/brushes_cmds.c b/app/pdb/brushes_cmds.c index 40b75da9d4..1f08e7b124 100644 --- a/app/pdb/brushes_cmds.c +++ b/app/pdb/brushes_cmds.c @@ -107,7 +107,7 @@ brushes_get_brush_invoker (Gimp *gimp, Argument *return_args; GimpBrush *brush; - success = (brush = gimp_context_get_brush (NULL)) != NULL; + success = (brush = gimp_context_get_brush (gimp_get_current_context (gimp))) != NULL; return_args = procedural_db_return_args (&brushes_get_brush_proc, success); @@ -180,7 +180,8 @@ brushes_set_brush_invoker (Gimp *gimp, name); if (object) - gimp_context_set_brush (NULL, GIMP_BRUSH (object)); + gimp_context_set_brush (gimp_get_current_context (gimp), + GIMP_BRUSH (object)); else success = FALSE; } @@ -220,7 +221,7 @@ brushes_get_opacity_invoker (Gimp *gimp, Argument *return_args; return_args = procedural_db_return_args (&brushes_get_opacity_proc, TRUE); - return_args[1].value.pdb_float = gimp_context_get_opacity (NULL) * 100.0; + return_args[1].value.pdb_float = gimp_context_get_opacity (gimp_get_current_context (gimp)) * 100.0; return return_args; } @@ -262,7 +263,7 @@ brushes_set_opacity_invoker (Gimp *gimp, success = FALSE; if (success) - gimp_context_set_opacity (NULL, opacity / 100.0); + gimp_context_set_opacity (gimp_get_current_context (gimp), opacity / 100.0); return procedural_db_return_args (&brushes_set_opacity_proc, success); } @@ -299,7 +300,7 @@ brushes_get_spacing_invoker (Gimp *gimp, Argument *return_args; return_args = procedural_db_return_args (&brushes_get_spacing_proc, TRUE); - return_args[1].value.pdb_int = gimp_brush_get_spacing (gimp_context_get_brush (NULL)); + return_args[1].value.pdb_int = gimp_brush_get_spacing (gimp_context_get_brush (gimp_get_current_context (gimp))); return return_args; } @@ -341,7 +342,7 @@ brushes_set_spacing_invoker (Gimp *gimp, success = FALSE; if (success) - gimp_brush_set_spacing (gimp_context_get_brush (NULL), spacing); + gimp_brush_set_spacing (gimp_context_get_brush (gimp_get_current_context (gimp)), spacing); return procedural_db_return_args (&brushes_set_spacing_proc, success); } @@ -378,7 +379,7 @@ brushes_get_paint_mode_invoker (Gimp *gimp, Argument *return_args; return_args = procedural_db_return_args (&brushes_get_paint_mode_proc, TRUE); - return_args[1].value.pdb_int = gimp_context_get_paint_mode (NULL); + return_args[1].value.pdb_int = gimp_context_get_paint_mode (gimp_get_current_context (gimp)); return return_args; } @@ -420,7 +421,7 @@ brushes_set_paint_mode_invoker (Gimp *gimp, success = FALSE; if (success) - gimp_context_set_paint_mode (NULL, paint_mode); + gimp_context_set_paint_mode (gimp_get_current_context (gimp), paint_mode); return procedural_db_return_args (&brushes_set_paint_mode_proc, success); } @@ -548,7 +549,7 @@ brushes_get_brush_data_invoker (Gimp *gimp, } } else - success = (brush = gimp_context_get_brush (NULL)) != NULL; + success = (brush = gimp_context_get_brush (gimp_get_current_context (gimp))) != NULL; if (success) { diff --git a/app/pdb/drawable_cmds.c b/app/pdb/drawable_cmds.c index 58f009740d..2c65f0abd6 100644 --- a/app/pdb/drawable_cmds.c +++ b/app/pdb/drawable_cmds.c @@ -33,6 +33,7 @@ #include "base/tile-manager.h" #include "base/tile.h" #include "core/core-types.h" +#include "core/gimp.h" #include "core/gimpchannel.h" #include "core/gimpdrawable-offset.h" #include "core/gimpdrawable.h" @@ -161,7 +162,7 @@ drawable_fill_invoker (Gimp *gimp, success = FALSE; if (success) - drawable_fill (drawable, (GimpFillType) fill_type); + drawable_fill (drawable, gimp_get_current_context (gimp), (GimpFillType) fill_type); return procedural_db_return_args (&drawable_fill_proc, success); } diff --git a/app/pdb/gimp-pdb.c b/app/pdb/gimp-pdb.c index 5c12d2e013..daa6fbdc5c 100644 --- a/app/pdb/gimp-pdb.c +++ b/app/pdb/gimp-pdb.c @@ -29,7 +29,6 @@ #include "core/gimp.h" #include "app_procs.h" -#include "context_manager.h" #include "plug_in.h" #include "procedural_db.h" diff --git a/app/pdb/gimppdb.c b/app/pdb/gimppdb.c index 5c12d2e013..daa6fbdc5c 100644 --- a/app/pdb/gimppdb.c +++ b/app/pdb/gimppdb.c @@ -29,7 +29,6 @@ #include "core/gimp.h" #include "app_procs.h" -#include "context_manager.h" #include "plug_in.h" #include "procedural_db.h" diff --git a/app/pdb/gimpprocedure.c b/app/pdb/gimpprocedure.c index 5c12d2e013..daa6fbdc5c 100644 --- a/app/pdb/gimpprocedure.c +++ b/app/pdb/gimpprocedure.c @@ -29,7 +29,6 @@ #include "core/gimp.h" #include "app_procs.h" -#include "context_manager.h" #include "plug_in.h" #include "procedural_db.h" diff --git a/app/pdb/gradient_select_cmds.c b/app/pdb/gradient_select_cmds.c index c448fd4838..95796f9338 100644 --- a/app/pdb/gradient_select_cmds.c +++ b/app/pdb/gradient_select_cmds.c @@ -320,7 +320,7 @@ gradients_get_gradient_data_invoker (Gimp *gimp, success = TRUE; } else - success = (gradient = gimp_context_get_gradient (NULL)) != NULL; + success = (gradient = gimp_context_get_gradient (gimp_get_current_context (gimp))) != NULL; if (success) { diff --git a/app/pdb/gradients_cmds.c b/app/pdb/gradients_cmds.c index 589782b0a0..2fc6fba6bb 100644 --- a/app/pdb/gradients_cmds.c +++ b/app/pdb/gradients_cmds.c @@ -130,12 +130,12 @@ gradients_get_active_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; - success = gimp_context_get_gradient (NULL) != NULL; + success = gimp_context_get_gradient (gimp_get_current_context (gimp)) != NULL; return_args = procedural_db_return_args (&gradients_get_active_proc, success); if (success) - return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (gimp_context_get_gradient (NULL))->name); + return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (gimp_context_get_gradient (gimp_get_current_context (gimp)))->name); return return_args; } @@ -187,7 +187,7 @@ gradients_set_active_invoker (Gimp *gimp, if (gradient) { - gimp_context_set_gradient (NULL, gradient); + gimp_context_set_gradient (gimp_get_current_context (gimp), gradient); success = TRUE; } } @@ -247,7 +247,7 @@ gradients_sample_uniform_invoker (Gimp *gimp, pv = color_samples = g_new (gdouble, array_length); - gradient = gimp_context_get_gradient (NULL); + gradient = gimp_context_get_gradient (gimp_get_current_context (gimp)); while (i--) { @@ -338,7 +338,7 @@ gradients_sample_custom_invoker (Gimp *gimp, pv = color_samples = g_new (gdouble, array_length); - gradient = gimp_context_get_gradient (NULL); + gradient = gimp_context_get_gradient (gimp_get_current_context (gimp)); while (i--) { diff --git a/app/pdb/palette_cmds.c b/app/pdb/palette_cmds.c index 6d37fea898..9e528ab1c7 100644 --- a/app/pdb/palette_cmds.c +++ b/app/pdb/palette_cmds.c @@ -61,7 +61,7 @@ palette_get_foreground_invoker (Gimp *gimp, Argument *return_args; GimpRGB color; - gimp_context_get_foreground (NULL, &color); + gimp_context_get_foreground (gimp_get_current_context (gimp), &color); return_args = procedural_db_return_args (&palette_get_foreground_proc, TRUE); return_args[1].value.pdb_color = color; @@ -101,7 +101,7 @@ palette_get_background_invoker (Gimp *gimp, Argument *return_args; GimpRGB color; - gimp_context_get_background (NULL, &color); + gimp_context_get_background (gimp_get_current_context (gimp), &color); return_args = procedural_db_return_args (&palette_get_background_proc, TRUE); return_args[1].value.pdb_color = color; @@ -143,7 +143,7 @@ palette_set_foreground_invoker (Gimp *gimp, color = args[0].value.pdb_color; gimp_rgb_set_alpha (&color, 1.0); - gimp_context_set_foreground (NULL, &color); + gimp_context_set_foreground (gimp_get_current_context (gimp), &color); return procedural_db_return_args (&palette_set_foreground_proc, TRUE); } @@ -182,7 +182,7 @@ palette_set_background_invoker (Gimp *gimp, color = args[0].value.pdb_color; gimp_rgb_set_alpha (&color, 1.0); - gimp_context_set_background (NULL, &color); + gimp_context_set_background (gimp_get_current_context (gimp), &color); return procedural_db_return_args (&palette_set_background_proc, TRUE); } @@ -216,7 +216,7 @@ static Argument * palette_set_default_colors_invoker (Gimp *gimp, Argument *args) { - gimp_context_set_default_colors (NULL); + gimp_context_set_default_colors (gimp_get_current_context (gimp)); return procedural_db_return_args (&palette_set_default_colors_proc, TRUE); } @@ -240,7 +240,7 @@ static Argument * palette_swap_colors_invoker (Gimp *gimp, Argument *args) { - gimp_context_swap_colors (NULL); + gimp_context_swap_colors (gimp_get_current_context (gimp)); return procedural_db_return_args (&palette_swap_colors_proc, TRUE); } diff --git a/app/pdb/patterns_cmds.c b/app/pdb/patterns_cmds.c index 6e79d83cfa..ad2484913c 100644 --- a/app/pdb/patterns_cmds.c +++ b/app/pdb/patterns_cmds.c @@ -58,7 +58,7 @@ patterns_get_pattern_invoker (Gimp *gimp, Argument *return_args; GimpPattern *pattern; - success = (pattern = gimp_context_get_pattern (NULL)) != NULL; + success = (pattern = gimp_context_get_pattern (gimp_get_current_context (gimp))) != NULL; return_args = procedural_db_return_args (&patterns_get_pattern_proc, success); @@ -132,7 +132,7 @@ patterns_set_pattern_invoker (Gimp *gimp, if (! strcmp (GIMP_OBJECT (pattern)->name, name)) { - gimp_context_set_pattern (NULL, pattern); + gimp_context_set_pattern (gimp_get_current_context (gimp), pattern); success = TRUE; break; } @@ -265,7 +265,7 @@ patterns_get_pattern_data_invoker (Gimp *gimp, } } else - success = (pattern = gimp_context_get_pattern (NULL)) != NULL; + success = (pattern = gimp_context_get_pattern (gimp_get_current_context (gimp))) != NULL; if (success) { diff --git a/app/pdb/procedural_db.c b/app/pdb/procedural_db.c index 5c12d2e013..daa6fbdc5c 100644 --- a/app/pdb/procedural_db.c +++ b/app/pdb/procedural_db.c @@ -29,7 +29,6 @@ #include "core/gimp.h" #include "app_procs.h" -#include "context_manager.h" #include "plug_in.h" #include "procedural_db.h" diff --git a/app/plug-in/gimpplugin-message.c b/app/plug-in/gimpplugin-message.c index a9145841c2..94d5ee9622 100644 --- a/app/plug-in/gimpplugin-message.c +++ b/app/plug-in/gimpplugin-message.c @@ -89,6 +89,7 @@ #include "base/tile.h" #include "base/tile-manager.h" +#include "core/gimpcoreconfig.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" @@ -322,18 +323,19 @@ plug_in_init (void) plug_in_init_shm (); /* search for binaries in the plug-in directory path */ - gimp_datafiles_read_directories (gimprc.plug_in_path, MODE_EXECUTABLE, + gimp_datafiles_read_directories (core_config->plug_in_path, MODE_EXECUTABLE, plug_in_init_file, NULL); /* read the pluginrc file for cached data */ filename = NULL; - if (gimprc.pluginrc_path) + if (core_config->pluginrc_path) { - if (g_path_is_absolute (gimprc.pluginrc_path)) - filename = g_strdup (gimprc.pluginrc_path); + if (g_path_is_absolute (core_config->pluginrc_path)) + filename = g_strdup (core_config->pluginrc_path); else filename = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s", - gimp_directory (), gimprc.pluginrc_path); + gimp_directory (), + core_config->pluginrc_path); } else filename = gimp_personal_rc_file ("pluginrc"); @@ -853,7 +855,7 @@ plug_in_new (gchar *name) if (! g_path_is_absolute (name)) { - path = plug_in_search_in_path (gimprc.plug_in_path, name); + path = plug_in_search_in_path (core_config->plug_in_path, name); if (! path) { diff --git a/app/plug-in/gimpplugin-progress.c b/app/plug-in/gimpplugin-progress.c index a9145841c2..94d5ee9622 100644 --- a/app/plug-in/gimpplugin-progress.c +++ b/app/plug-in/gimpplugin-progress.c @@ -89,6 +89,7 @@ #include "base/tile.h" #include "base/tile-manager.h" +#include "core/gimpcoreconfig.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" @@ -322,18 +323,19 @@ plug_in_init (void) plug_in_init_shm (); /* search for binaries in the plug-in directory path */ - gimp_datafiles_read_directories (gimprc.plug_in_path, MODE_EXECUTABLE, + gimp_datafiles_read_directories (core_config->plug_in_path, MODE_EXECUTABLE, plug_in_init_file, NULL); /* read the pluginrc file for cached data */ filename = NULL; - if (gimprc.pluginrc_path) + if (core_config->pluginrc_path) { - if (g_path_is_absolute (gimprc.pluginrc_path)) - filename = g_strdup (gimprc.pluginrc_path); + if (g_path_is_absolute (core_config->pluginrc_path)) + filename = g_strdup (core_config->pluginrc_path); else filename = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s", - gimp_directory (), gimprc.pluginrc_path); + gimp_directory (), + core_config->pluginrc_path); } else filename = gimp_personal_rc_file ("pluginrc"); @@ -853,7 +855,7 @@ plug_in_new (gchar *name) if (! g_path_is_absolute (name)) { - path = plug_in_search_in_path (gimprc.plug_in_path, name); + path = plug_in_search_in_path (core_config->plug_in_path, name); if (! path) { diff --git a/app/plug-in/gimpplugin.c b/app/plug-in/gimpplugin.c index a9145841c2..94d5ee9622 100644 --- a/app/plug-in/gimpplugin.c +++ b/app/plug-in/gimpplugin.c @@ -89,6 +89,7 @@ #include "base/tile.h" #include "base/tile-manager.h" +#include "core/gimpcoreconfig.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" @@ -322,18 +323,19 @@ plug_in_init (void) plug_in_init_shm (); /* search for binaries in the plug-in directory path */ - gimp_datafiles_read_directories (gimprc.plug_in_path, MODE_EXECUTABLE, + gimp_datafiles_read_directories (core_config->plug_in_path, MODE_EXECUTABLE, plug_in_init_file, NULL); /* read the pluginrc file for cached data */ filename = NULL; - if (gimprc.pluginrc_path) + if (core_config->pluginrc_path) { - if (g_path_is_absolute (gimprc.pluginrc_path)) - filename = g_strdup (gimprc.pluginrc_path); + if (g_path_is_absolute (core_config->pluginrc_path)) + filename = g_strdup (core_config->pluginrc_path); else filename = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s", - gimp_directory (), gimprc.pluginrc_path); + gimp_directory (), + core_config->pluginrc_path); } else filename = gimp_personal_rc_file ("pluginrc"); @@ -853,7 +855,7 @@ plug_in_new (gchar *name) if (! g_path_is_absolute (name)) { - path = plug_in_search_in_path (gimprc.plug_in_path, name); + path = plug_in_search_in_path (core_config->plug_in_path, name); if (! path) { diff --git a/app/plug-in/gimppluginmanager-call.c b/app/plug-in/gimppluginmanager-call.c index a9145841c2..94d5ee9622 100644 --- a/app/plug-in/gimppluginmanager-call.c +++ b/app/plug-in/gimppluginmanager-call.c @@ -89,6 +89,7 @@ #include "base/tile.h" #include "base/tile-manager.h" +#include "core/gimpcoreconfig.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" @@ -322,18 +323,19 @@ plug_in_init (void) plug_in_init_shm (); /* search for binaries in the plug-in directory path */ - gimp_datafiles_read_directories (gimprc.plug_in_path, MODE_EXECUTABLE, + gimp_datafiles_read_directories (core_config->plug_in_path, MODE_EXECUTABLE, plug_in_init_file, NULL); /* read the pluginrc file for cached data */ filename = NULL; - if (gimprc.pluginrc_path) + if (core_config->pluginrc_path) { - if (g_path_is_absolute (gimprc.pluginrc_path)) - filename = g_strdup (gimprc.pluginrc_path); + if (g_path_is_absolute (core_config->pluginrc_path)) + filename = g_strdup (core_config->pluginrc_path); else filename = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s", - gimp_directory (), gimprc.pluginrc_path); + gimp_directory (), + core_config->pluginrc_path); } else filename = gimp_personal_rc_file ("pluginrc"); @@ -853,7 +855,7 @@ plug_in_new (gchar *name) if (! g_path_is_absolute (name)) { - path = plug_in_search_in_path (gimprc.plug_in_path, name); + path = plug_in_search_in_path (core_config->plug_in_path, name); if (! path) { diff --git a/app/plug-in/gimppluginmanager-run.c b/app/plug-in/gimppluginmanager-run.c index a9145841c2..94d5ee9622 100644 --- a/app/plug-in/gimppluginmanager-run.c +++ b/app/plug-in/gimppluginmanager-run.c @@ -89,6 +89,7 @@ #include "base/tile.h" #include "base/tile-manager.h" +#include "core/gimpcoreconfig.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" @@ -322,18 +323,19 @@ plug_in_init (void) plug_in_init_shm (); /* search for binaries in the plug-in directory path */ - gimp_datafiles_read_directories (gimprc.plug_in_path, MODE_EXECUTABLE, + gimp_datafiles_read_directories (core_config->plug_in_path, MODE_EXECUTABLE, plug_in_init_file, NULL); /* read the pluginrc file for cached data */ filename = NULL; - if (gimprc.pluginrc_path) + if (core_config->pluginrc_path) { - if (g_path_is_absolute (gimprc.pluginrc_path)) - filename = g_strdup (gimprc.pluginrc_path); + if (g_path_is_absolute (core_config->pluginrc_path)) + filename = g_strdup (core_config->pluginrc_path); else filename = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s", - gimp_directory (), gimprc.pluginrc_path); + gimp_directory (), + core_config->pluginrc_path); } else filename = gimp_personal_rc_file ("pluginrc"); @@ -853,7 +855,7 @@ plug_in_new (gchar *name) if (! g_path_is_absolute (name)) { - path = plug_in_search_in_path (gimprc.plug_in_path, name); + path = plug_in_search_in_path (core_config->plug_in_path, name); if (! path) { diff --git a/app/plug-in/gimppluginmanager.c b/app/plug-in/gimppluginmanager.c index a9145841c2..94d5ee9622 100644 --- a/app/plug-in/gimppluginmanager.c +++ b/app/plug-in/gimppluginmanager.c @@ -89,6 +89,7 @@ #include "base/tile.h" #include "base/tile-manager.h" +#include "core/gimpcoreconfig.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" @@ -322,18 +323,19 @@ plug_in_init (void) plug_in_init_shm (); /* search for binaries in the plug-in directory path */ - gimp_datafiles_read_directories (gimprc.plug_in_path, MODE_EXECUTABLE, + gimp_datafiles_read_directories (core_config->plug_in_path, MODE_EXECUTABLE, plug_in_init_file, NULL); /* read the pluginrc file for cached data */ filename = NULL; - if (gimprc.pluginrc_path) + if (core_config->pluginrc_path) { - if (g_path_is_absolute (gimprc.pluginrc_path)) - filename = g_strdup (gimprc.pluginrc_path); + if (g_path_is_absolute (core_config->pluginrc_path)) + filename = g_strdup (core_config->pluginrc_path); else filename = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s", - gimp_directory (), gimprc.pluginrc_path); + gimp_directory (), + core_config->pluginrc_path); } else filename = gimp_personal_rc_file ("pluginrc"); @@ -853,7 +855,7 @@ plug_in_new (gchar *name) if (! g_path_is_absolute (name)) { - path = plug_in_search_in_path (gimprc.plug_in_path, name); + path = plug_in_search_in_path (core_config->plug_in_path, name); if (! path) { diff --git a/app/plug-in/gimppluginshm.c b/app/plug-in/gimppluginshm.c index a9145841c2..94d5ee9622 100644 --- a/app/plug-in/gimppluginshm.c +++ b/app/plug-in/gimppluginshm.c @@ -89,6 +89,7 @@ #include "base/tile.h" #include "base/tile-manager.h" +#include "core/gimpcoreconfig.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" @@ -322,18 +323,19 @@ plug_in_init (void) plug_in_init_shm (); /* search for binaries in the plug-in directory path */ - gimp_datafiles_read_directories (gimprc.plug_in_path, MODE_EXECUTABLE, + gimp_datafiles_read_directories (core_config->plug_in_path, MODE_EXECUTABLE, plug_in_init_file, NULL); /* read the pluginrc file for cached data */ filename = NULL; - if (gimprc.pluginrc_path) + if (core_config->pluginrc_path) { - if (g_path_is_absolute (gimprc.pluginrc_path)) - filename = g_strdup (gimprc.pluginrc_path); + if (g_path_is_absolute (core_config->pluginrc_path)) + filename = g_strdup (core_config->pluginrc_path); else filename = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s", - gimp_directory (), gimprc.pluginrc_path); + gimp_directory (), + core_config->pluginrc_path); } else filename = gimp_personal_rc_file ("pluginrc"); @@ -853,7 +855,7 @@ plug_in_new (gchar *name) if (! g_path_is_absolute (name)) { - path = plug_in_search_in_path (gimprc.plug_in_path, name); + path = plug_in_search_in_path (core_config->plug_in_path, name); if (! path) { diff --git a/app/plug-in/plug-in-def.c b/app/plug-in/plug-in-def.c index a9145841c2..94d5ee9622 100644 --- a/app/plug-in/plug-in-def.c +++ b/app/plug-in/plug-in-def.c @@ -89,6 +89,7 @@ #include "base/tile.h" #include "base/tile-manager.h" +#include "core/gimpcoreconfig.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" @@ -322,18 +323,19 @@ plug_in_init (void) plug_in_init_shm (); /* search for binaries in the plug-in directory path */ - gimp_datafiles_read_directories (gimprc.plug_in_path, MODE_EXECUTABLE, + gimp_datafiles_read_directories (core_config->plug_in_path, MODE_EXECUTABLE, plug_in_init_file, NULL); /* read the pluginrc file for cached data */ filename = NULL; - if (gimprc.pluginrc_path) + if (core_config->pluginrc_path) { - if (g_path_is_absolute (gimprc.pluginrc_path)) - filename = g_strdup (gimprc.pluginrc_path); + if (g_path_is_absolute (core_config->pluginrc_path)) + filename = g_strdup (core_config->pluginrc_path); else filename = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s", - gimp_directory (), gimprc.pluginrc_path); + gimp_directory (), + core_config->pluginrc_path); } else filename = gimp_personal_rc_file ("pluginrc"); @@ -853,7 +855,7 @@ plug_in_new (gchar *name) if (! g_path_is_absolute (name)) { - path = plug_in_search_in_path (gimprc.plug_in_path, name); + path = plug_in_search_in_path (core_config->plug_in_path, name); if (! path) { diff --git a/app/plug-in/plug-in-message.c b/app/plug-in/plug-in-message.c index a9145841c2..94d5ee9622 100644 --- a/app/plug-in/plug-in-message.c +++ b/app/plug-in/plug-in-message.c @@ -89,6 +89,7 @@ #include "base/tile.h" #include "base/tile-manager.h" +#include "core/gimpcoreconfig.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" @@ -322,18 +323,19 @@ plug_in_init (void) plug_in_init_shm (); /* search for binaries in the plug-in directory path */ - gimp_datafiles_read_directories (gimprc.plug_in_path, MODE_EXECUTABLE, + gimp_datafiles_read_directories (core_config->plug_in_path, MODE_EXECUTABLE, plug_in_init_file, NULL); /* read the pluginrc file for cached data */ filename = NULL; - if (gimprc.pluginrc_path) + if (core_config->pluginrc_path) { - if (g_path_is_absolute (gimprc.pluginrc_path)) - filename = g_strdup (gimprc.pluginrc_path); + if (g_path_is_absolute (core_config->pluginrc_path)) + filename = g_strdup (core_config->pluginrc_path); else filename = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s", - gimp_directory (), gimprc.pluginrc_path); + gimp_directory (), + core_config->pluginrc_path); } else filename = gimp_personal_rc_file ("pluginrc"); @@ -853,7 +855,7 @@ plug_in_new (gchar *name) if (! g_path_is_absolute (name)) { - path = plug_in_search_in_path (gimprc.plug_in_path, name); + path = plug_in_search_in_path (core_config->plug_in_path, name); if (! path) { diff --git a/app/plug-in/plug-in-params.c b/app/plug-in/plug-in-params.c index a9145841c2..94d5ee9622 100644 --- a/app/plug-in/plug-in-params.c +++ b/app/plug-in/plug-in-params.c @@ -89,6 +89,7 @@ #include "base/tile.h" #include "base/tile-manager.h" +#include "core/gimpcoreconfig.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" @@ -322,18 +323,19 @@ plug_in_init (void) plug_in_init_shm (); /* search for binaries in the plug-in directory path */ - gimp_datafiles_read_directories (gimprc.plug_in_path, MODE_EXECUTABLE, + gimp_datafiles_read_directories (core_config->plug_in_path, MODE_EXECUTABLE, plug_in_init_file, NULL); /* read the pluginrc file for cached data */ filename = NULL; - if (gimprc.pluginrc_path) + if (core_config->pluginrc_path) { - if (g_path_is_absolute (gimprc.pluginrc_path)) - filename = g_strdup (gimprc.pluginrc_path); + if (g_path_is_absolute (core_config->pluginrc_path)) + filename = g_strdup (core_config->pluginrc_path); else filename = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s", - gimp_directory (), gimprc.pluginrc_path); + gimp_directory (), + core_config->pluginrc_path); } else filename = gimp_personal_rc_file ("pluginrc"); @@ -853,7 +855,7 @@ plug_in_new (gchar *name) if (! g_path_is_absolute (name)) { - path = plug_in_search_in_path (gimprc.plug_in_path, name); + path = plug_in_search_in_path (core_config->plug_in_path, name); if (! path) { diff --git a/app/plug-in/plug-in-progress.c b/app/plug-in/plug-in-progress.c index a9145841c2..94d5ee9622 100644 --- a/app/plug-in/plug-in-progress.c +++ b/app/plug-in/plug-in-progress.c @@ -89,6 +89,7 @@ #include "base/tile.h" #include "base/tile-manager.h" +#include "core/gimpcoreconfig.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" @@ -322,18 +323,19 @@ plug_in_init (void) plug_in_init_shm (); /* search for binaries in the plug-in directory path */ - gimp_datafiles_read_directories (gimprc.plug_in_path, MODE_EXECUTABLE, + gimp_datafiles_read_directories (core_config->plug_in_path, MODE_EXECUTABLE, plug_in_init_file, NULL); /* read the pluginrc file for cached data */ filename = NULL; - if (gimprc.pluginrc_path) + if (core_config->pluginrc_path) { - if (g_path_is_absolute (gimprc.pluginrc_path)) - filename = g_strdup (gimprc.pluginrc_path); + if (g_path_is_absolute (core_config->pluginrc_path)) + filename = g_strdup (core_config->pluginrc_path); else filename = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s", - gimp_directory (), gimprc.pluginrc_path); + gimp_directory (), + core_config->pluginrc_path); } else filename = gimp_personal_rc_file ("pluginrc"); @@ -853,7 +855,7 @@ plug_in_new (gchar *name) if (! g_path_is_absolute (name)) { - path = plug_in_search_in_path (gimprc.plug_in_path, name); + path = plug_in_search_in_path (core_config->plug_in_path, name); if (! path) { diff --git a/app/plug-in/plug-in-run.c b/app/plug-in/plug-in-run.c index a9145841c2..94d5ee9622 100644 --- a/app/plug-in/plug-in-run.c +++ b/app/plug-in/plug-in-run.c @@ -89,6 +89,7 @@ #include "base/tile.h" #include "base/tile-manager.h" +#include "core/gimpcoreconfig.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" @@ -322,18 +323,19 @@ plug_in_init (void) plug_in_init_shm (); /* search for binaries in the plug-in directory path */ - gimp_datafiles_read_directories (gimprc.plug_in_path, MODE_EXECUTABLE, + gimp_datafiles_read_directories (core_config->plug_in_path, MODE_EXECUTABLE, plug_in_init_file, NULL); /* read the pluginrc file for cached data */ filename = NULL; - if (gimprc.pluginrc_path) + if (core_config->pluginrc_path) { - if (g_path_is_absolute (gimprc.pluginrc_path)) - filename = g_strdup (gimprc.pluginrc_path); + if (g_path_is_absolute (core_config->pluginrc_path)) + filename = g_strdup (core_config->pluginrc_path); else filename = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s", - gimp_directory (), gimprc.pluginrc_path); + gimp_directory (), + core_config->pluginrc_path); } else filename = gimp_personal_rc_file ("pluginrc"); @@ -853,7 +855,7 @@ plug_in_new (gchar *name) if (! g_path_is_absolute (name)) { - path = plug_in_search_in_path (gimprc.plug_in_path, name); + path = plug_in_search_in_path (core_config->plug_in_path, name); if (! path) { diff --git a/app/plug-in/plug-in-shm.c b/app/plug-in/plug-in-shm.c index a9145841c2..94d5ee9622 100644 --- a/app/plug-in/plug-in-shm.c +++ b/app/plug-in/plug-in-shm.c @@ -89,6 +89,7 @@ #include "base/tile.h" #include "base/tile-manager.h" +#include "core/gimpcoreconfig.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" @@ -322,18 +323,19 @@ plug_in_init (void) plug_in_init_shm (); /* search for binaries in the plug-in directory path */ - gimp_datafiles_read_directories (gimprc.plug_in_path, MODE_EXECUTABLE, + gimp_datafiles_read_directories (core_config->plug_in_path, MODE_EXECUTABLE, plug_in_init_file, NULL); /* read the pluginrc file for cached data */ filename = NULL; - if (gimprc.pluginrc_path) + if (core_config->pluginrc_path) { - if (g_path_is_absolute (gimprc.pluginrc_path)) - filename = g_strdup (gimprc.pluginrc_path); + if (g_path_is_absolute (core_config->pluginrc_path)) + filename = g_strdup (core_config->pluginrc_path); else filename = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s", - gimp_directory (), gimprc.pluginrc_path); + gimp_directory (), + core_config->pluginrc_path); } else filename = gimp_personal_rc_file ("pluginrc"); @@ -853,7 +855,7 @@ plug_in_new (gchar *name) if (! g_path_is_absolute (name)) { - path = plug_in_search_in_path (gimprc.plug_in_path, name); + path = plug_in_search_in_path (core_config->plug_in_path, name); if (! path) { diff --git a/app/plug-in/plug-in.c b/app/plug-in/plug-in.c index a9145841c2..94d5ee9622 100644 --- a/app/plug-in/plug-in.c +++ b/app/plug-in/plug-in.c @@ -89,6 +89,7 @@ #include "base/tile.h" #include "base/tile-manager.h" +#include "core/gimpcoreconfig.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" @@ -322,18 +323,19 @@ plug_in_init (void) plug_in_init_shm (); /* search for binaries in the plug-in directory path */ - gimp_datafiles_read_directories (gimprc.plug_in_path, MODE_EXECUTABLE, + gimp_datafiles_read_directories (core_config->plug_in_path, MODE_EXECUTABLE, plug_in_init_file, NULL); /* read the pluginrc file for cached data */ filename = NULL; - if (gimprc.pluginrc_path) + if (core_config->pluginrc_path) { - if (g_path_is_absolute (gimprc.pluginrc_path)) - filename = g_strdup (gimprc.pluginrc_path); + if (g_path_is_absolute (core_config->pluginrc_path)) + filename = g_strdup (core_config->pluginrc_path); else filename = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s", - gimp_directory (), gimprc.pluginrc_path); + gimp_directory (), + core_config->pluginrc_path); } else filename = gimp_personal_rc_file ("pluginrc"); @@ -853,7 +855,7 @@ plug_in_new (gchar *name) if (! g_path_is_absolute (name)) { - path = plug_in_search_in_path (gimprc.plug_in_path, name); + path = plug_in_search_in_path (core_config->plug_in_path, name); if (! path) { diff --git a/app/plug-in/plug-ins.c b/app/plug-in/plug-ins.c index a9145841c2..94d5ee9622 100644 --- a/app/plug-in/plug-ins.c +++ b/app/plug-in/plug-ins.c @@ -89,6 +89,7 @@ #include "base/tile.h" #include "base/tile-manager.h" +#include "core/gimpcoreconfig.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" @@ -322,18 +323,19 @@ plug_in_init (void) plug_in_init_shm (); /* search for binaries in the plug-in directory path */ - gimp_datafiles_read_directories (gimprc.plug_in_path, MODE_EXECUTABLE, + gimp_datafiles_read_directories (core_config->plug_in_path, MODE_EXECUTABLE, plug_in_init_file, NULL); /* read the pluginrc file for cached data */ filename = NULL; - if (gimprc.pluginrc_path) + if (core_config->pluginrc_path) { - if (g_path_is_absolute (gimprc.pluginrc_path)) - filename = g_strdup (gimprc.pluginrc_path); + if (g_path_is_absolute (core_config->pluginrc_path)) + filename = g_strdup (core_config->pluginrc_path); else filename = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s", - gimp_directory (), gimprc.pluginrc_path); + gimp_directory (), + core_config->pluginrc_path); } else filename = gimp_personal_rc_file ("pluginrc"); @@ -853,7 +855,7 @@ plug_in_new (gchar *name) if (! g_path_is_absolute (name)) { - path = plug_in_search_in_path (gimprc.plug_in_path, name); + path = plug_in_search_in_path (core_config->plug_in_path, name); if (! path) { diff --git a/app/plug_in.c b/app/plug_in.c index a9145841c2..94d5ee9622 100644 --- a/app/plug_in.c +++ b/app/plug_in.c @@ -89,6 +89,7 @@ #include "base/tile.h" #include "base/tile-manager.h" +#include "core/gimpcoreconfig.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" @@ -322,18 +323,19 @@ plug_in_init (void) plug_in_init_shm (); /* search for binaries in the plug-in directory path */ - gimp_datafiles_read_directories (gimprc.plug_in_path, MODE_EXECUTABLE, + gimp_datafiles_read_directories (core_config->plug_in_path, MODE_EXECUTABLE, plug_in_init_file, NULL); /* read the pluginrc file for cached data */ filename = NULL; - if (gimprc.pluginrc_path) + if (core_config->pluginrc_path) { - if (g_path_is_absolute (gimprc.pluginrc_path)) - filename = g_strdup (gimprc.pluginrc_path); + if (g_path_is_absolute (core_config->pluginrc_path)) + filename = g_strdup (core_config->pluginrc_path); else filename = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s", - gimp_directory (), gimprc.pluginrc_path); + gimp_directory (), + core_config->pluginrc_path); } else filename = gimp_personal_rc_file ("pluginrc"); @@ -853,7 +855,7 @@ plug_in_new (gchar *name) if (! g_path_is_absolute (name)) { - path = plug_in_search_in_path (gimprc.plug_in_path, name); + path = plug_in_search_in_path (core_config->plug_in_path, name); if (! path) { diff --git a/app/qmask.c b/app/qmask.c index 88179c8537..4161b32b02 100644 --- a/app/qmask.c +++ b/app/qmask.c @@ -29,6 +29,7 @@ #include "core/core-types.h" +#include "core/gimp.h" #include "core/gimpchannel.h" #include "core/gimpcontext.h" #include "core/gimpimage.h" @@ -36,6 +37,7 @@ #include "widgets/gimpcolorpanel.h" +#include "app_procs.h" #include "drawable.h" #include "floating_sel.h" #include "gdisplay.h" @@ -238,7 +240,10 @@ qmask_activate (GtkWidget *widget, "Qmask", &color); gimp_image_add_channel (gimg, gmask, 0); - drawable_fill (GIMP_DRAWABLE (gmask), TRANSPARENT_FILL); + + drawable_fill (GIMP_DRAWABLE (gmask), + gimp_get_user_context (gimg->gimp), + TRANSPARENT_FILL); } else { diff --git a/app/selection.c b/app/selection.c index 8007cf1085..4e2a38a7f5 100644 --- a/app/selection.c +++ b/app/selection.c @@ -211,6 +211,8 @@ selection_pause (Selection *select) { g_source_remove (select->timeout_id); select->timeout_id = 0; + + select->state = INVISIBLE; } select->paused ++; diff --git a/app/tools/gimpairbrushtool.c b/app/tools/gimpairbrushtool.c index 930b6f2875..6e29aa82de 100644 --- a/app/tools/gimpairbrushtool.c +++ b/app/tools/gimpairbrushtool.c @@ -29,6 +29,7 @@ #include "paint-funcs/paint-funcs.h" +#include "core/gimp.h" #include "core/gimpbrush.h" #include "core/gimpcontext.h" #include "core/gimpdrawable.h" @@ -124,9 +125,10 @@ static GimpPaintToolClass *parent_class = NULL; /* functions */ void -gimp_airbrush_tool_register (void) +gimp_airbrush_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_AIRBRUSH_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_AIRBRUSH_TOOL, TRUE, "gimp:airbrush_tool", _("Airbrush"), @@ -242,7 +244,8 @@ gimp_airbrush_tool_paint (GimpPaintTool *paint_tool, incremental = non_gui_incremental; } - brush = gimp_context_get_brush (NULL); + brush = + gimp_context_get_brush (gimp_get_current_context (drawable->gimage->gimp)); switch (state) { @@ -352,6 +355,7 @@ gimp_airbrush_tool_motion (GimpPaintTool *paint_tool, gboolean incremental) { GimpImage *gimage; + GimpContext *context; TempBuf *area; guchar col[MAX_CHANNELS]; gdouble scale; @@ -363,6 +367,8 @@ gimp_airbrush_tool_motion (GimpPaintTool *paint_tool, if (! (gimage = gimp_drawable_gimage (drawable))) return; + context = gimp_get_current_context (gimage->gimp); + if (pressure_options->size) scale = paint_tool->curpressure; else @@ -374,9 +380,9 @@ gimp_airbrush_tool_motion (GimpPaintTool *paint_tool, /* color the pixels */ if (pressure_options->color) { - GimpRGB color; - - gimp_gradient_get_color_at (gimp_context_get_gradient (NULL), + GimpRGB color; + + gimp_gradient_get_color_at (gimp_context_get_gradient (context), paint_tool->curpressure, &color); gimp_rgba_get_uchar (&color, @@ -412,8 +418,8 @@ gimp_airbrush_tool_motion (GimpPaintTool *paint_tool, /* paste the newly painted area to the image */ gimp_paint_tool_paste_canvas (paint_tool, drawable, MIN (pressure, 255), - (gint) (gimp_context_get_opacity (NULL) * 255), - gimp_context_get_paint_mode (NULL), + (gint) (gimp_context_get_opacity (context) * 255), + gimp_context_get_paint_mode (gimp_get_current_context (gimage->gimp)), SOFT, scale, paint_appl_mode); } diff --git a/app/tools/gimpairbrushtool.h b/app/tools/gimpairbrushtool.h index 8f21bff8b4..81779fe145 100644 --- a/app/tools/gimpairbrushtool.h +++ b/app/tools/gimpairbrushtool.h @@ -44,10 +44,11 @@ struct _GimpAirbrushToolClass }; -void gimp_airbrush_tool_register (void); +void gimp_airbrush_tool_register (Gimp *gimp); GtkType gimp_airbrush_tool_get_type (void); + gboolean airbrush_non_gui (GimpDrawable *drawable, gdouble pressure, gint num_strokes, diff --git a/app/tools/gimpbezierselecttool.c b/app/tools/gimpbezierselecttool.c index 0fd2cedfd3..aefefb033d 100644 --- a/app/tools/gimpbezierselecttool.c +++ b/app/tools/gimpbezierselecttool.c @@ -30,6 +30,7 @@ #include "base/pixel-region.h" +#include "core/gimp.h" #include "core/gimpchannel.h" #include "core/gimpmarshal.h" #include "core/gimpcontext.h" @@ -270,9 +271,10 @@ static void bezier_start_new_segment (GimpBezierSelectTool *bezier_sel, /* Public functions */ void -gimp_bezier_select_tool_register (void) +gimp_bezier_select_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_BEZIER_SELECT_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_BEZIER_SELECT_TOOL, FALSE, "gimp:bezier_select_tool", _("Bezier Select"), @@ -909,18 +911,18 @@ gimp_bezier_select_tool_motion (GimpTool *tool, gint -bezier_select_load (GDisplay *gdisp, +bezier_select_load (GDisplay *gdisp, GimpBezierSelectPoint *pts, - gint num_pts, - gint closed) + gint num_pts, + gint closed) { - GimpTool *tool; + GimpTool *tool; GimpBezierSelectTool *bezier_sel; /* select the bezier tool */ - gimp_context_set_tool (gimp_context_get_user (), - tool_manager_get_info_by_type - ( GIMP_TYPE_BEZIER_SELECT_TOOL)); + gimp_context_set_tool (gimp_get_user_context (gdisp->gimage->gimp), + tool_manager_get_info_by_type + (gdisp->gimage->gimp, GIMP_TYPE_BEZIER_SELECT_TOOL)); tool = active_tool; tool->state = ACTIVE; tool->gdisp = gdisp; @@ -3125,7 +3127,7 @@ bezier_tool_selected (void) } void -bezier_paste_bezierselect_to_current (GDisplay *gdisp, +bezier_paste_bezierselect_to_current (GDisplay *gdisp, GimpBezierSelectTool *bsel) { GimpBezierSelectPoint *pts; @@ -3150,9 +3152,9 @@ bezier_paste_bezierselect_to_current (GDisplay *gdisp, } } - gimp_context_set_tool (gimp_context_get_user (), - tool_manager_get_info_by_type - ( GIMP_TYPE_BEZIER_SELECT_TOOL)); + gimp_context_set_tool (gimp_get_user_context (gdisp->gimage->gimp), + tool_manager_get_info_by_type + (gdisp->gimage->gimp, GIMP_TYPE_BEZIER_SELECT_TOOL)); active_tool->paused_count = 0; active_tool->gdisp = gdisp; active_tool->drawable = gimp_image_active_drawable (gdisp->gimage); @@ -3786,7 +3788,7 @@ bezier_stroke (GimpBezierSelectTool *bezier_sel, /* Stroke with the correct tool */ return_vals = procedural_db_run_proc (gdisp->gimage->gimp, - tool_manager_active_get_PDB_string (), + tool_manager_active_get_PDB_string (gdisp->gimage->gimp), &nreturn_vals, GIMP_PDB_DRAWABLE, gimp_drawable_get_ID (drawable), GIMP_PDB_INT32, (gint32) rpnts->num_stroke_points * 2, diff --git a/app/tools/gimpbezierselecttool.h b/app/tools/gimpbezierselecttool.h index 2e33818cd8..f787d27d55 100644 --- a/app/tools/gimpbezierselecttool.h +++ b/app/tools/gimpbezierselecttool.h @@ -110,7 +110,8 @@ typedef struct /* Public functions */ -void gimp_bezier_select_tool_register (void); +void gimp_bezier_select_tool_register (Gimp *gimp); + GtkType gimp_bezier_select_tool_get_type (void); gboolean bezier_tool_selected (void); diff --git a/app/tools/gimpblendtool.c b/app/tools/gimpblendtool.c index f5e53cdfd3..ffc371d346 100644 --- a/app/tools/gimpblendtool.c +++ b/app/tools/gimpblendtool.c @@ -35,6 +35,7 @@ #include "paint-funcs/paint-funcs.h" +#include "core/gimp.h" #include "core/gimpcontext.h" #include "core/gimpdrawable.h" #include "core/gimpgradient.h" @@ -108,14 +109,15 @@ struct _BlendOptions typedef struct { - gdouble offset; - gdouble sx, sy; - BlendMode blend_mode; - GradientType gradient_type; - GimpRGB fg, bg; - gdouble dist; - gdouble vec[2]; - RepeatFunc repeat_func; + GimpGradient *gradient; + gdouble offset; + gdouble sx, sy; + BlendMode blend_mode; + GradientType gradient_type; + GimpRGB fg, bg; + gdouble dist; + gdouble vec[2]; + RepeatFunc repeat_func; } RenderBlendData; typedef struct @@ -272,9 +274,10 @@ static guint blend_n_targets = (sizeof (blend_target_table) / void -gimp_blend_tool_register (void) +gimp_blend_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_BLEND_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_BLEND_TOOL, TRUE, "gimp:blend_tool", _("Blend"), @@ -480,9 +483,9 @@ gimp_blend_tool_button_release (GimpTool *tool, blend (gimage, gimp_image_active_drawable (gimage), blend_options->blend_mode, - gimp_context_get_paint_mode (NULL), + gimp_context_get_paint_mode (gimp_get_current_context (gimage->gimp)), blend_options->gradient_type, - gimp_context_get_opacity (NULL) * 100, + gimp_context_get_opacity (gimp_get_current_context (gimage->gimp)) * 100, blend_options->offset, blend_options->repeat, blend_options->supersample, @@ -875,7 +878,8 @@ blend_options_drop_gradient (GtkWidget *widget, options = (BlendOptions *) data; - gimp_context_set_gradient (gimp_context_get_user (), GIMP_GRADIENT (viewable)); + gimp_context_set_gradient (gimp_get_user_context (the_gimp), + GIMP_GRADIENT (viewable)); gtk_option_menu_set_history (GTK_OPTION_MENU (options->blend_mode_w), CUSTOM_MODE); @@ -887,7 +891,8 @@ blend_options_drop_tool (GtkWidget *widget, GimpViewable *viewable, gpointer data) { - gimp_context_set_tool (gimp_context_get_user (), GIMP_TOOL_INFO (viewable)); + gimp_context_set_tool (gimp_get_user_context (the_gimp), + GIMP_TOOL_INFO (viewable)); } @@ -1474,8 +1479,7 @@ gradient_render_pixel (double x, if (rbd->blend_mode == CUSTOM_MODE) { - gimp_gradient_get_color_at (gimp_context_get_gradient (NULL), - factor, color); + gimp_gradient_get_color_at (rbd->gradient, factor, color); } else { @@ -1554,14 +1558,19 @@ gradient_fill_region (GimpImage *gimage, gpointer *pr; guchar *data; GimpRGB color; + GimpContext *context; + + context = gimp_get_current_context (gimage->gimp); + + rbd.gradient = gimp_context_get_gradient (context); /* Get foreground and background colors, normalized */ - gimp_context_get_foreground (NULL, &rbd.fg); + gimp_context_get_foreground (context, &rbd.fg); /* rbd.fg.a = 1.0; */ /* Foreground is always opaque */ - gimp_context_get_background (NULL, &rbd.bg); + gimp_context_get_background (context, &rbd.bg); /* rbd.bg.a = 1.0; */ /* opaque, for now */ diff --git a/app/tools/gimpblendtool.h b/app/tools/gimpblendtool.h index d412be5ece..e505baf95c 100644 --- a/app/tools/gimpblendtool.h +++ b/app/tools/gimpblendtool.h @@ -85,9 +85,9 @@ struct _GimpBlendToolClass }; -GtkType gimp_blend_tool_get_type (void); +void gimp_blend_tool_register (Gimp *gimp); -void gimp_blend_tool_register (void); +GtkType gimp_blend_tool_get_type (void); void blend (GimpImage *gimage, GimpDrawable *drawable, diff --git a/app/tools/gimpbrightnesscontrasttool.c b/app/tools/gimpbrightnesscontrasttool.c index 03b1044775..478319e82d 100644 --- a/app/tools/gimpbrightnesscontrasttool.c +++ b/app/tools/gimpbrightnesscontrasttool.c @@ -122,9 +122,10 @@ static GimpImageMapToolClass *parent_class = NULL; /* functions */ void -gimp_brightness_contrast_tool_register (void) +gimp_brightness_contrast_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_BRIGHTNESS_CONTRAST_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_BRIGHTNESS_CONTRAST_TOOL, FALSE, "gimp:brightness_contrast_tool", _("Brightness-Contrast"), diff --git a/app/tools/gimpbrightnesscontrasttool.h b/app/tools/gimpbrightnesscontrasttool.h index 94600d8a91..6fd179c0e8 100644 --- a/app/tools/gimpbrightnesscontrasttool.h +++ b/app/tools/gimpbrightnesscontrasttool.h @@ -44,7 +44,7 @@ struct _GimpBrightnessContrastToolClass }; -void gimp_brightness_contrast_tool_register (void); +void gimp_brightness_contrast_tool_register (Gimp *gimp); GtkType gimp_brightness_contrast_tool_get_type (void); diff --git a/app/tools/gimpbrushtool.c b/app/tools/gimpbrushtool.c index 91a0f38625..528faa95f6 100644 --- a/app/tools/gimpbrushtool.c +++ b/app/tools/gimpbrushtool.c @@ -37,6 +37,7 @@ #include "paint-funcs/paint-funcs.h" +#include "core/gimp.h" #include "core/gimpbrushpipe.h" #include "core/gimpcontext.h" #include "core/gimpdrawable.h" @@ -44,18 +45,19 @@ #include "core/gimpimage.h" #include "core/gimpimage-mask.h" -#include "devices.h" -#include "drawable.h" -#include "gdisplay.h" -#include "gimprc.h" -#include "undo.h" - #include "gimpdrawtool.h" #include "gimpdodgeburntool.h" #include "gimperasertool.h" #include "gimpconvolvetool.h" #include "gimppainttool.h" +#include "app_procs.h" +#include "devices.h" +#include "drawable.h" +#include "gdisplay.h" +#include "gimprc.h" +#include "undo.h" + #include "libgimp/gimpintl.h" #include "gimppainttool_kernels.h" @@ -837,6 +839,10 @@ gimp_paint_tool_sample_color (GimpDrawable *drawable, { if ((col = gimp_drawable_get_color_at (drawable, x, y))) { + Gimp *gimp; + + gimp = gimp_drawable_gimage (drawable)->gimp; + gimp_rgba_set_uchar (&color, col[RED_PIX], col[GREEN_PIX], @@ -844,9 +850,9 @@ gimp_paint_tool_sample_color (GimpDrawable *drawable, 255); if ((state & GDK_CONTROL_MASK)) - gimp_context_set_foreground (gimp_context_get_user (), &color); + gimp_context_set_foreground (gimp_get_user_context (gimp), &color); else - gimp_context_set_background (gimp_context_get_user (), &color); + gimp_context_set_background (gimp_get_user_context (gimp), &color); g_free (col); } @@ -870,6 +876,10 @@ gimp_paint_tool_start (GimpPaintTool *paint_tool, { static GimpBrush *brush = NULL; + GimpContext *context; + + context = gimp_get_current_context (the_gimp); + paint_tool->curx = x; paint_tool->cury = y; @@ -887,14 +897,14 @@ gimp_paint_tool_start (GimpPaintTool *paint_tool, #endif /* Each buffer is the same size as the maximum bounds of the active brush... */ - if (brush && brush != gimp_context_get_brush (NULL)) + if (brush && brush != gimp_context_get_brush (context)) { gtk_signal_disconnect_by_func (GTK_OBJECT (brush), GTK_SIGNAL_FUNC (gimp_paint_tool_invalidate_cache), NULL); gtk_object_unref (GTK_OBJECT (brush)); } - if (!(brush = gimp_context_get_brush (NULL))) + if (!(brush = gimp_context_get_brush (context))) { g_message (_("No brushes available for use with this tool.")); return FALSE; @@ -1099,8 +1109,11 @@ gimp_paint_tool_get_color_from_gradient (GimpPaintTool *paint_tool, GimpRGB *color, GradientPaintMode mode) { - gdouble y; - gdouble distance; /* distance in current brush stroke */ + GimpContext *context; + gdouble y; + gdouble distance; /* distance in current brush stroke */ + + context = gimp_get_current_context (the_gimp); distance = paint_tool->pixel_dist; y = ((double) distance / gradient_length); @@ -1114,7 +1127,7 @@ gimp_paint_tool_get_color_from_gradient (GimpPaintTool *paint_tool, else y = y - (int)y; - gimp_gradient_get_color_at (gimp_context_get_gradient (NULL), y, color); + gimp_gradient_get_color_at (gimp_context_get_gradient (context), y, color); } diff --git a/app/tools/gimpbucketfilltool.c b/app/tools/gimpbucketfilltool.c index 8452af193e..f8e2733a25 100644 --- a/app/tools/gimpbucketfilltool.c +++ b/app/tools/gimpbucketfilltool.c @@ -31,6 +31,7 @@ #include "paint-funcs/paint-funcs.h" +#include "core/gimp.h" #include "core/gimpchannel.h" #include "core/gimpcontext.h" #include "core/gimpdrawable.h" @@ -127,9 +128,10 @@ static void bucket_fill_line_pattern (guchar *, /* functions */ void -gimp_bucket_fill_tool_register (void) +gimp_bucket_fill_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_BUCKET_FILL_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_BUCKET_FILL_TOOL, TRUE, "gimp:bucket_fill_tool", _("Bucket Fill"), @@ -354,14 +356,18 @@ gimp_bucket_fill_tool_button_release (GimpTool *tool, /* if the 3rd button isn't pressed, fill the selected region */ if (! (bevent->state & GDK_BUTTON3_MASK)) { + GimpContext *context; + + context = gimp_get_current_context (gdisp->gimage->gimp); + return_vals = procedural_db_run_proc (gdisp->gimage->gimp, "gimp_bucket_fill", &nreturn_vals, GIMP_PDB_DRAWABLE, gimp_drawable_get_ID (gimp_image_active_drawable (gdisp->gimage)), GIMP_PDB_INT32, (gint32) bucket_options->fill_mode, - GIMP_PDB_INT32, (gint32) gimp_context_get_paint_mode (NULL), - GIMP_PDB_FLOAT, (gdouble) gimp_context_get_opacity (NULL) * 100, + GIMP_PDB_INT32, (gint32) gimp_context_get_paint_mode (context), + GIMP_PDB_FLOAT, (gdouble) gimp_context_get_opacity (context) * 100, GIMP_PDB_FLOAT, (gdouble) bucket_options->threshold, GIMP_PDB_INT32, (gint32) bucket_options->sample_merged, GIMP_PDB_FLOAT, (gdouble) bucket_tool->target_x, @@ -489,7 +495,7 @@ bucket_fill (GimpImage *gimage, gimp_image_get_background (gimage, drawable, col); else if (fill_mode == PATTERN_BUCKET_FILL) { - pattern = gimp_context_get_pattern (NULL); + pattern = gimp_context_get_pattern (gimp_get_current_context (gimage->gimp)); if (!pattern) { diff --git a/app/tools/gimpbucketfilltool.h b/app/tools/gimpbucketfilltool.h index 802a54b5d0..410712823f 100644 --- a/app/tools/gimpbucketfilltool.h +++ b/app/tools/gimpbucketfilltool.h @@ -55,7 +55,7 @@ struct _GimpBucketFillToolClass }; -void gimp_bucket_fill_tool_register (void); +void gimp_bucket_fill_tool_register (Gimp *gimp); GtkType gimp_bucket_fill_tool_get_type (void); diff --git a/app/tools/gimpbycolorselecttool.c b/app/tools/gimpbycolorselecttool.c index fddd5acd5b..a55a731a55 100644 --- a/app/tools/gimpbycolorselecttool.c +++ b/app/tools/gimpbycolorselecttool.c @@ -49,7 +49,6 @@ #include "tool_options.h" #include "tool_manager.h" -#include "context_manager.h" #include "gimprc.h" #include "gdisplay.h" @@ -174,9 +173,11 @@ static guint n_by_color_select_targets = (sizeof (by_color_select_targets) / /* public functions */ void -gimp_by_color_select_tool_register (void) +gimp_by_color_select_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_BY_COLOR_SELECT_TOOL, FALSE, + tool_manager_register_tool (gimp, + GIMP_TYPE_BY_COLOR_SELECT_TOOL, + FALSE, "gimp:by_color_select_tool", _("Select By Color"), _("Select regions by color"), diff --git a/app/tools/gimpbycolorselecttool.h b/app/tools/gimpbycolorselecttool.h index 7cee1f452a..001dc91277 100644 --- a/app/tools/gimpbycolorselecttool.h +++ b/app/tools/gimpbycolorselecttool.h @@ -51,7 +51,7 @@ struct _GimpByColorSelectToolClass -void gimp_by_color_select_tool_register (void); +void gimp_by_color_select_tool_register (Gimp *gimp); GtkType gimp_by_color_select_tool_get_type (void); diff --git a/app/tools/gimpclonetool.c b/app/tools/gimpclonetool.c index f5c29f10aa..79ce88d7fe 100644 --- a/app/tools/gimpclonetool.c +++ b/app/tools/gimpclonetool.c @@ -32,6 +32,7 @@ #include "paint-funcs/paint-funcs.h" +#include "core/gimp.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" #include "core/gimpimage-mask.h" @@ -155,9 +156,10 @@ static CloneType non_gui_type; /* global functions */ void -gimp_clone_tool_register (void) +gimp_clone_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_CLONE_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_CLONE_TOOL, TRUE, "gimp:clone_tool", _("Clone"), @@ -265,18 +267,21 @@ clone_set_src_drawable (GimpDrawable *drawable) } static void -gimp_clone_tool_paint (GimpPaintTool *paint_tool, - GimpDrawable *drawable, - PaintState state) +gimp_clone_tool_paint (GimpPaintTool *paint_tool, + GimpDrawable *drawable, + PaintState state) { - GDisplay *gdisp; - GDisplay *src_gdisp; - gint x1, y1, x2, y2; - static gint orig_src_x, orig_src_y; + GDisplay *gdisp; + GDisplay *src_gdisp; + gint x1, y1, x2, y2; + static gint orig_src_x, orig_src_y; GimpDrawTool *draw_tool; + GimpContext *context; gdisp = (GDisplay *) active_tool->gdisp; - draw_tool = GIMP_DRAW_TOOL(paint_tool); + draw_tool = GIMP_DRAW_TOOL (paint_tool); + + context = gimp_get_current_context (gdisp->gimage->gimp); switch (state) { @@ -341,7 +346,7 @@ gimp_clone_tool_paint (GimpPaintTool *paint_tool, orig_src_y = src_y; } if (clone_options->type == PATTERN_CLONE) - if (! gimp_context_get_pattern (NULL)) + if (! gimp_context_get_pattern (context)) g_message (_("No patterns available for this operation.")); break; @@ -351,7 +356,7 @@ gimp_clone_tool_paint (GimpPaintTool *paint_tool, { src_x = orig_src_x; src_y = orig_src_y; - } + } return; break; @@ -453,6 +458,7 @@ gimp_clone_tool_motion (GimpPaintTool *paint_tool, { GimpImage *gimage; GimpImage *src_gimage = NULL; + GimpContext *context; guchar *s; guchar *d; TempBuf *orig; @@ -484,6 +490,8 @@ gimp_clone_tool_motion (GimpPaintTool *paint_tool, if (! (gimage = gimp_drawable_gimage (drawable))) return; + context = gimp_get_current_context (gimage->gimp); + if (pressure_options->size) scale = paint_tool->curpressure; else @@ -559,7 +567,7 @@ gimp_clone_tool_motion (GimpPaintTool *paint_tool, break; case PATTERN_CLONE: - pattern = gimp_context_get_pattern (NULL); + pattern = gimp_context_get_pattern (context); if (!pattern) return; @@ -601,15 +609,15 @@ gimp_clone_tool_motion (GimpPaintTool *paint_tool, } } - opacity = 255.0 * gimp_context_get_opacity (NULL); + opacity = 255.0 * gimp_context_get_opacity (context); if (pressure_options->opacity) opacity = opacity * 2.0 * paint_tool->curpressure; /* paste the newly painted canvas to the gimage which is being worked on */ gimp_paint_tool_paste_canvas (paint_tool, drawable, MIN (opacity, 255), - (gint) (gimp_context_get_opacity (NULL) * 255), - gimp_context_get_paint_mode (NULL), + (gint) (gimp_context_get_opacity (context) * 255), + gimp_context_get_paint_mode (context), pressure_options->pressure ? PRESSURE : SOFT, scale, CONSTANT); } diff --git a/app/tools/gimpclonetool.h b/app/tools/gimpclonetool.h index 7f10e324a6..15ce1359fd 100644 --- a/app/tools/gimpclonetool.h +++ b/app/tools/gimpclonetool.h @@ -51,7 +51,7 @@ struct _GimpCloneToolClass }; -void gimp_clone_tool_register (void); +void gimp_clone_tool_register (Gimp *gimp); GtkType gimp_clone_tool_get_type (void); diff --git a/app/tools/gimpcolorbalancetool.c b/app/tools/gimpcolorbalancetool.c index dde2c36b7f..dc2da406f2 100644 --- a/app/tools/gimpcolorbalancetool.c +++ b/app/tools/gimpcolorbalancetool.c @@ -104,9 +104,10 @@ static GimpImageMapToolClass *parent_class = NULL; /* functions */ void -gimp_color_balance_tool_register (void) +gimp_color_balance_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_COLOR_BALANCE_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_COLOR_BALANCE_TOOL, FALSE, "gimp:color_balance_tool", _("Color Balance"), diff --git a/app/tools/gimpcolorbalancetool.h b/app/tools/gimpcolorbalancetool.h index c023214563..3a37ba396c 100644 --- a/app/tools/gimpcolorbalancetool.h +++ b/app/tools/gimpcolorbalancetool.h @@ -79,7 +79,7 @@ struct _ColorBalanceDialog }; -void gimp_color_balance_tool_register (void); +void gimp_color_balance_tool_register (Gimp *gimp); GtkType gimp_color_balance_tool_get_type (void); diff --git a/app/tools/gimpcolorpickertool.c b/app/tools/gimpcolorpickertool.c index 24d2a04558..954449c8ab 100644 --- a/app/tools/gimpcolorpickertool.c +++ b/app/tools/gimpcolorpickertool.c @@ -151,9 +151,10 @@ static GimpDrawToolClass *parent_class = NULL; void -gimp_color_picker_tool_register (void) +gimp_color_picker_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_COLOR_PICKER_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_COLOR_PICKER_TOOL, FALSE, "gimp:color_picker_tool", _("Color Picker"), diff --git a/app/tools/gimpcolorpickertool.h b/app/tools/gimpcolorpickertool.h index 3423571f0b..744a09186a 100644 --- a/app/tools/gimpcolorpickertool.h +++ b/app/tools/gimpcolorpickertool.h @@ -50,19 +50,18 @@ struct _GimpColorPickerToolClass /* FIXME: Whats this doing here? */ extern gint col_value[5]; +void gimp_color_picker_tool_register (Gimp *gimp); + GtkType gimp_color_picker_tool_get_type (void); -GimpTool * gimp_color_picker_tool_new (void); - -void gimp_color_picker_tool_register (void); - -gboolean pick_color (GimpImage *gimage, - GimpDrawable *drawable, - gint x, - gint y, - gboolean sample_merged, - gboolean sample_average, - double average_radius, - gint final); + +gboolean pick_color (GimpImage *gimage, + GimpDrawable *drawable, + gint x, + gint y, + gboolean sample_merged, + gboolean sample_average, + double average_radius, + gint final); #endif /* __GIMP_COLOR_PICKER_TOOL_H__ */ diff --git a/app/tools/gimpconvolvetool.c b/app/tools/gimpconvolvetool.c index 6b632b6477..47aa155909 100644 --- a/app/tools/gimpconvolvetool.c +++ b/app/tools/gimpconvolvetool.c @@ -28,9 +28,11 @@ #include "base/pixel-region.h" #include "base/temp-buf.h" +#include "core/gimp.h" #include "core/gimpbrush.h" #include "core/gimpcontext.h" #include "core/gimpdrawable.h" +#include "core/gimpimage.h" #include "paint-funcs/paint-funcs.h" @@ -168,9 +170,10 @@ static gfloat sharpen_matrix [25] = /* global functions */ void -gimp_convolve_tool_register (void) +gimp_convolve_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_CONVOLVE_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_CONVOLVE_TOOL, TRUE, "gimp:convolve_tool", _("Convolve"), @@ -350,6 +353,7 @@ gimp_convolve_tool_motion (GimpPaintTool *paint_tool, ConvolveClipType area_vclip = CONVOLVE_NOT_CLIPPED; gint marginx = 0; gint marginy = 0; + GimpContext *context; if (! gimp_drawable_gimage (drawable)) return; @@ -545,9 +549,11 @@ gimp_convolve_tool_motion (GimpPaintTool *paint_tool, g_free(fillcolor); } + context = gimp_get_current_context (gimp_drawable_gimage (drawable)->gimp); + /* paste the newly painted canvas to the gimage which is being worked on */ gimp_paint_tool_replace_canvas (paint_tool, drawable, OPAQUE_OPACITY, - (gint) (gimp_context_get_opacity (NULL) * 255), + (gint) (gimp_context_get_opacity (context) * 255), pressure_options->pressure ? PRESSURE : SOFT, scale, INCREMENTAL); } diff --git a/app/tools/gimpconvolvetool.h b/app/tools/gimpconvolvetool.h index 77ff7495c3..1662b3e344 100644 --- a/app/tools/gimpconvolvetool.h +++ b/app/tools/gimpconvolvetool.h @@ -52,7 +52,7 @@ struct _GimpConvolveToolClass }; -void gimp_convolve_tool_register (void); +void gimp_convolve_tool_register (Gimp *gimp); GtkType gimp_convolve_tool_get_type (void); diff --git a/app/tools/gimpcroptool.c b/app/tools/gimpcroptool.c index 20d84d6461..a242d94b8d 100644 --- a/app/tools/gimpcroptool.c +++ b/app/tools/gimpcroptool.c @@ -1675,9 +1675,10 @@ gimp_crop_tool_destroy (GtkObject *object) } void -gimp_crop_tool_register (void) +gimp_crop_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_CROP_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_CROP_TOOL, FALSE, "gimp:crop_tool", _("Crop Tool"), diff --git a/app/tools/gimpcroptool.h b/app/tools/gimpcroptool.h index 631a4f6e89..a2eac2fc1c 100644 --- a/app/tools/gimpcroptool.h +++ b/app/tools/gimpcroptool.h @@ -68,19 +68,19 @@ struct _GimpCropToolClass }; -void gimp_crop_tool_register (void); +void gimp_crop_tool_register (Gimp *gimp); GtkType gimp_crop_tool_get_type (void); /* Keep around for the PDB, temporarily */ -void crop_image (GimpImage *gimage, - gint x1, - gint y1, - gint x2, - gint y2, - gboolean layer_only, - gboolean crop_layers); +void crop_image (GimpImage *gimage, + gint x1, + gint y1, + gint x2, + gint y2, + gboolean layer_only, + gboolean crop_layers); #endif /* __GIMP_CROP_TOOL_H__ */ diff --git a/app/tools/gimpcurvestool.c b/app/tools/gimpcurvestool.c index 477cdc2d3f..a2fba29fe7 100644 --- a/app/tools/gimpcurvestool.c +++ b/app/tools/gimpcurvestool.c @@ -200,9 +200,10 @@ static CRMatrix CR_basis = /* functions */ void -gimp_curves_tool_register (void) +gimp_curves_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_CURVES_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_CURVES_TOOL, FALSE, "gimp:curves_tool", _("Curves"), diff --git a/app/tools/gimpcurvestool.h b/app/tools/gimpcurvestool.h index 335149b3df..e760141a27 100644 --- a/app/tools/gimpcurvestool.h +++ b/app/tools/gimpcurvestool.h @@ -85,7 +85,7 @@ struct _CurvesDialog }; -void gimp_curves_tool_register (void); +void gimp_curves_tool_register (Gimp *gimp); GtkType gimp_curves_tool_get_type (void); diff --git a/app/tools/gimpdodgeburntool.c b/app/tools/gimpdodgeburntool.c index 7d83502d9b..2898fd26a2 100644 --- a/app/tools/gimpdodgeburntool.c +++ b/app/tools/gimpdodgeburntool.c @@ -32,8 +32,10 @@ #include "paint-funcs/paint-funcs.h" +#include "core/gimp.h" #include "core/gimpdrawable.h" #include "core/gimpcontext.h" +#include "core/gimpimage.h" #include "gdisplay.h" @@ -134,9 +136,10 @@ static GimpPaintToolClass *parent_class = NULL; /* functions */ void -gimp_dodgeburn_tool_register (void) +gimp_dodgeburn_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_DODGEBURN_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_DODGEBURN_TOOL, TRUE, "gimp:dodgeburn_tool", _("Dodge/Burn"), @@ -461,7 +464,9 @@ gimp_dodgeburn_tool_motion (GimpPaintTool *paint_tool, else copy_region (&tempPR, &destPR); - opacity = 255 * gimp_context_get_opacity (NULL); + opacity = + 255 * gimp_context_get_opacity (gimp_get_current_context (gimage->gimp)); + if (pressure_options->opacity) opacity = opacity * 2.0 * paint_tool->curpressure; diff --git a/app/tools/gimpdodgeburntool.h b/app/tools/gimpdodgeburntool.h index e37b8f3791..f7234d93ba 100644 --- a/app/tools/gimpdodgeburntool.h +++ b/app/tools/gimpdodgeburntool.h @@ -58,7 +58,7 @@ struct _GimpDodgeBurnToolClass }; -void gimp_dodgeburn_tool_register (void); +void gimp_dodgeburn_tool_register (Gimp *gimp); GtkType gimp_dodgeburn_tool_get_type (void); diff --git a/app/tools/gimpellipseselecttool.c b/app/tools/gimpellipseselecttool.c index c0a48c0f6b..8b4ffe0648 100644 --- a/app/tools/gimpellipseselecttool.c +++ b/app/tools/gimpellipseselecttool.c @@ -29,13 +29,14 @@ #include "core/gimpimage-mask.h" #include "core/gimptoolinfo.h" -#include "gdisplay.h" - #include "gimpellipseselecttool.h" #include "selection_options.h" #include "tool_options.h" #include "tool_manager.h" +#include "app_procs.h" +#include "gdisplay.h" + #include "libgimp/gimpintl.h" #define WANT_ELLIPSE_SELECT_BITS @@ -63,9 +64,11 @@ static SelectionOptions *ellipse_options = NULL; /* public functions */ void -gimp_ellipse_select_tool_register (void) +gimp_ellipse_select_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_ELLIPSE_SELECT_TOOL, FALSE, + tool_manager_register_tool (gimp, + GIMP_TYPE_ELLIPSE_SELECT_TOOL, + FALSE, "gimp:ellipse_select_tool", _("Ellipse Select"), _("Select elliptical regions"), @@ -243,7 +246,7 @@ gimp_ellipse_select_tool_rect_select (GimpRectSelectTool *rect_tool, sel_tool = GIMP_SELECTION_TOOL (rect_tool); sel_options = (SelectionOptions *) - tool_manager_get_info_by_tool (tool)->tool_options; + tool_manager_get_info_by_tool (the_gimp, tool)->tool_options; ellipse_select (tool->gdisp->gimage, x, y, w, h, diff --git a/app/tools/gimpellipseselecttool.h b/app/tools/gimpellipseselecttool.h index 03d9c53427..782299eaa6 100644 --- a/app/tools/gimpellipseselecttool.h +++ b/app/tools/gimpellipseselecttool.h @@ -44,7 +44,7 @@ struct _GimpEllipseSelectToolClass }; -void gimp_ellipse_select_tool_register (void); +void gimp_ellipse_select_tool_register (Gimp *gimp); GtkType gimp_ellipse_select_tool_get_type (void); diff --git a/app/tools/gimperasertool.c b/app/tools/gimperasertool.c index e860dad545..b1dc9a455d 100644 --- a/app/tools/gimperasertool.c +++ b/app/tools/gimperasertool.c @@ -29,6 +29,7 @@ #include "paint-funcs/paint-funcs.h" +#include "core/gimp.h" #include "core/gimpcontext.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" @@ -101,9 +102,10 @@ static GimpPaintToolClass *parent_class = NULL; /* functions */ void -gimp_eraser_tool_register (void) +gimp_eraser_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_ERASER_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_ERASER_TOOL, TRUE, "gimp:eraser_tool", _("Eraser"), @@ -260,17 +262,20 @@ gimp_eraser_tool_motion (GimpPaintTool *paint_tool, gboolean incremental, gboolean anti_erase) { - GimpImage *gimage; - gint opacity; - TempBuf *area; - guchar col[MAX_CHANNELS]; - gdouble scale; + GimpImage *gimage; + GimpContext *context; + gint opacity; + TempBuf *area; + guchar col[MAX_CHANNELS]; + gdouble scale; if (! (gimage = gimp_drawable_gimage (drawable))) return; gimp_image_get_background (gimage, drawable, col); + context = gimp_get_current_context (gimage->gimp); + if (pressure_options->size) scale = paint_tool->curpressure; else @@ -287,7 +292,7 @@ gimp_eraser_tool_motion (GimpPaintTool *paint_tool, color_pixels (temp_buf_data (area), col, area->width * area->height, area->bytes); - opacity = 255 * gimp_context_get_opacity (NULL); + opacity = 255 * gimp_context_get_opacity (context); if (pressure_options->opacity) opacity = opacity * 2.0 * paint_tool->curpressure; @@ -295,7 +300,7 @@ gimp_eraser_tool_motion (GimpPaintTool *paint_tool, /* paste the newly painted canvas to the gimage which is being worked on */ gimp_paint_tool_paste_canvas (paint_tool, drawable, MIN (opacity, 255), - gimp_context_get_opacity (NULL) * 255, + gimp_context_get_opacity (context) * 255, anti_erase ? ANTI_ERASE_MODE : ERASE_MODE, hard ? HARD : (pressure_options->pressure ? PRESSURE : SOFT), scale, diff --git a/app/tools/gimperasertool.h b/app/tools/gimperasertool.h index aeb5412217..b325bc9e96 100644 --- a/app/tools/gimperasertool.h +++ b/app/tools/gimperasertool.h @@ -44,7 +44,7 @@ struct _GimpEraserToolClass }; -void gimp_eraser_tool_register (void); +void gimp_eraser_tool_register (Gimp *gimp); GtkType gimp_eraser_tool_get_type (void); diff --git a/app/tools/gimpfliptool.c b/app/tools/gimpfliptool.c index ef4fa8143a..4045327911 100644 --- a/app/tools/gimpfliptool.c +++ b/app/tools/gimpfliptool.c @@ -100,9 +100,10 @@ static GimpTransformToolClass *parent_class = NULL; /* public functions */ void -gimp_flip_tool_register (void) +gimp_flip_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_FLIP_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_FLIP_TOOL, FALSE, "gimp:flip_tool", _("Flip Tool"), diff --git a/app/tools/gimpfliptool.h b/app/tools/gimpfliptool.h index de1c7650cf..cde40d0e7e 100644 --- a/app/tools/gimpfliptool.h +++ b/app/tools/gimpfliptool.h @@ -44,10 +44,9 @@ struct _GimpFlipToolClass }; -GtkType gimp_flip_tool_get_type (void); - -void gimp_flip_tool_register (void); +void gimp_flip_tool_register (Gimp *gimp); +GtkType gimp_flip_tool_get_type (void); TileManager * flip_tool_flip (GimpImage *gimage, GimpDrawable *drawable, diff --git a/app/tools/gimpfreeselecttool.c b/app/tools/gimpfreeselecttool.c index 88b0917d83..e1204c4487 100644 --- a/app/tools/gimpfreeselecttool.c +++ b/app/tools/gimpfreeselecttool.c @@ -89,9 +89,11 @@ static SelectionOptions * free_options = NULL; /* public functions */ void -gimp_free_select_tool_register (void) +gimp_free_select_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_FREE_SELECT_TOOL, FALSE, + tool_manager_register_tool (gimp, + GIMP_TYPE_FREE_SELECT_TOOL, + FALSE, "gimp:free_select_tool", _("Free Select"), _("Select hand-drawn regions"), diff --git a/app/tools/gimpfreeselecttool.h b/app/tools/gimpfreeselecttool.h index f2eac09d2c..7923353577 100644 --- a/app/tools/gimpfreeselecttool.h +++ b/app/tools/gimpfreeselecttool.h @@ -48,7 +48,7 @@ struct _GimpFreeSelectToolClass }; -void gimp_free_select_tool_register (void); +void gimp_free_select_tool_register (Gimp *gimp); GtkType gimp_free_select_tool_get_type (void); diff --git a/app/tools/gimpfuzzyselecttool.c b/app/tools/gimpfuzzyselecttool.c index 7b4f96b9ee..7ccdfa1772 100644 --- a/app/tools/gimpfuzzyselecttool.c +++ b/app/tools/gimpfuzzyselecttool.c @@ -89,9 +89,11 @@ GimpChannel * fuzzy_mask = NULL; /* public functions */ void -gimp_fuzzy_select_tool_register (void) +gimp_fuzzy_select_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_FUZZY_SELECT_TOOL, FALSE, + tool_manager_register_tool (gimp, + GIMP_TYPE_FUZZY_SELECT_TOOL, + FALSE, "gimp:fuzzy_select_tool", _("Fuzzy Select"), _("Select contiguous regions"), diff --git a/app/tools/gimpfuzzyselecttool.h b/app/tools/gimpfuzzyselecttool.h index 2f6e1bd4b7..041821e797 100644 --- a/app/tools/gimpfuzzyselecttool.h +++ b/app/tools/gimpfuzzyselecttool.h @@ -49,7 +49,7 @@ struct _GimpFuzzySelectToolClass }; -void gimp_fuzzy_select_tool_register (void); +void gimp_fuzzy_select_tool_register (Gimp *gimp); GtkType gimp_fuzzy_select_tool_get_type (void); diff --git a/app/tools/gimphistogramtool.c b/app/tools/gimphistogramtool.c index 42fa37d8fe..b52f57ba7f 100644 --- a/app/tools/gimphistogramtool.c +++ b/app/tools/gimphistogramtool.c @@ -90,9 +90,10 @@ static GimpToolClass *parent_class = NULL; /* functions */ void -gimp_histogram_tool_register (void) +gimp_histogram_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_HISTOGRAM_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_HISTOGRAM_TOOL, FALSE, "gimp:histogram_tool", _("Histogram"), diff --git a/app/tools/gimphistogramtool.h b/app/tools/gimphistogramtool.h index 7c11709c52..4b47d8814a 100644 --- a/app/tools/gimphistogramtool.h +++ b/app/tools/gimphistogramtool.h @@ -78,7 +78,7 @@ struct _HistogramToolDialog }; -void gimp_histogram_tool_register (void); +void gimp_histogram_tool_register (Gimp *gimp); GtkType gimp_histogram_tool_get_type (void); diff --git a/app/tools/gimphuesaturationtool.c b/app/tools/gimphuesaturationtool.c index 324714a4e7..bcd8b6a48d 100644 --- a/app/tools/gimphuesaturationtool.c +++ b/app/tools/gimphuesaturationtool.c @@ -128,9 +128,10 @@ static gint default_colors[6][3] = /* functions */ void -gimp_hue_saturation_tool_register (void) +gimp_hue_saturation_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_HUE_SATURATION_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_HUE_SATURATION_TOOL, FALSE, "gimp:hue_saturation_tool", _("Hue-Saturation"), diff --git a/app/tools/gimphuesaturationtool.h b/app/tools/gimphuesaturationtool.h index f3c3b71b14..af8aeda2cb 100644 --- a/app/tools/gimphuesaturationtool.h +++ b/app/tools/gimphuesaturationtool.h @@ -80,7 +80,7 @@ struct _HueSaturationDialog }; -void gimp_hue_saturation_tool_register (void); +void gimp_hue_saturation_tool_register (Gimp *gimp); GtkType gimp_hue_saturation_tool_get_type (void); diff --git a/app/tools/gimpinktool.c b/app/tools/gimpinktool.c index 5524893b6b..001c5b0eff 100644 --- a/app/tools/gimpinktool.c +++ b/app/tools/gimpinktool.c @@ -35,6 +35,7 @@ #include "paint-funcs/paint-funcs.h" +#include "core/gimp.h" #include "core/gimpcontext.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" @@ -232,9 +233,10 @@ static GimpToolClass *parent_class = NULL; /* functions */ void -gimp_ink_tool_register (void) +gimp_ink_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_INK_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_INK_TOOL, TRUE, "gimp:ink_tool", _("Ink Tool"), @@ -1492,6 +1494,7 @@ ink_paste (GimpInkTool *ink_tool, Blob *blob) { GimpImage *gimage; + GimpContext *context; PixelRegion srcPR; gint offx, offy; gchar col[MAX_CHANNELS]; @@ -1499,6 +1502,8 @@ ink_paste (GimpInkTool *ink_tool, if (! (gimage = gimp_drawable_gimage (drawable))) return; + context = gimp_get_current_context (gimage->gimp); + /* Get the the buffer */ ink_set_paint_area (ink_tool, drawable, blob); @@ -1537,8 +1542,8 @@ ink_paste (GimpInkTool *ink_tool, /* apply the paint area to the gimage */ gimp_image_apply_image (gimage, drawable, &srcPR, FALSE, - (int) (gimp_context_get_opacity (NULL) * 255), - gimp_context_get_paint_mode (NULL), + (int) (gimp_context_get_opacity (context) * 255), + gimp_context_get_paint_mode (context), undo_tiles, /* specify an alternative src1 */ canvas_buf->x, canvas_buf->y); diff --git a/app/tools/gimpinktool.h b/app/tools/gimpinktool.h index 911c84c863..b884a01a43 100644 --- a/app/tools/gimpinktool.h +++ b/app/tools/gimpinktool.h @@ -67,7 +67,7 @@ struct _GimpInkToolClass }; -void gimp_ink_tool_register (void); +void gimp_ink_tool_register (Gimp *gimp); GtkType gimp_ink_tool_get_type (void); diff --git a/app/tools/gimpiscissorstool.c b/app/tools/gimpiscissorstool.c index b13cb6a89c..226a56b9e2 100644 --- a/app/tools/gimpiscissorstool.c +++ b/app/tools/gimpiscissorstool.c @@ -273,9 +273,10 @@ static GimpDrawTool *parent_class = NULL; void -gimp_iscissors_tool_register (void) +gimp_iscissors_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_ISCISSORS_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_ISCISSORS_TOOL, FALSE, "gimp:iscissors_tool", _("Intelligent Scissors"), diff --git a/app/tools/gimpiscissorstool.h b/app/tools/gimpiscissorstool.h index 3e4286edd7..0c118fc1cc 100644 --- a/app/tools/gimpiscissorstool.h +++ b/app/tools/gimpiscissorstool.h @@ -93,7 +93,7 @@ struct _GimpIscissorsToolClass }; -void gimp_iscissors_tool_register (void); +void gimp_iscissors_tool_register (Gimp *gimp); GtkType gimp_iscissors_tool_get_type (void); diff --git a/app/tools/gimplevelstool.c b/app/tools/gimplevelstool.c index 74fcb45274..7d4b372124 100644 --- a/app/tools/gimplevelstool.c +++ b/app/tools/gimplevelstool.c @@ -204,9 +204,10 @@ static GtkWidget *color_option_items[5]; /* functions */ void -gimp_levels_tool_register (void) +gimp_levels_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_LEVELS_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_LEVELS_TOOL, FALSE, "gimp:levels_tool", _("Levels"), diff --git a/app/tools/gimplevelstool.h b/app/tools/gimplevelstool.h index 4276d3b02b..13645e2807 100644 --- a/app/tools/gimplevelstool.h +++ b/app/tools/gimplevelstool.h @@ -44,7 +44,7 @@ struct _GimpLevelsToolClass }; -void gimp_levels_tool_register (void); +void gimp_levels_tool_register (Gimp *gimp); GtkType gimp_levels_tool_get_type (void); diff --git a/app/tools/gimpmagnifytool.c b/app/tools/gimpmagnifytool.c index 2917fe909d..2c2db4d3b5 100644 --- a/app/tools/gimpmagnifytool.c +++ b/app/tools/gimpmagnifytool.c @@ -101,9 +101,10 @@ static GimpDrawToolClass *parent_class = NULL; void -gimp_magnify_tool_register (void) +gimp_magnify_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_MAGNIFY_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_MAGNIFY_TOOL, FALSE, "gimp:magnify_tool", _("Magnify"), diff --git a/app/tools/gimpmagnifytool.h b/app/tools/gimpmagnifytool.h index e8dde91497..67131fa6b0 100644 --- a/app/tools/gimpmagnifytool.h +++ b/app/tools/gimpmagnifytool.h @@ -49,7 +49,7 @@ struct _GimpMagnifyToolClass }; -void gimp_magnify_tool_register (void); +void gimp_magnify_tool_register (Gimp *gimp); GtkType gimp_magnify_tool_get_type (void); diff --git a/app/tools/gimpmeasuretool.c b/app/tools/gimpmeasuretool.c index 4e85e2aa82..b5df90c1ad 100644 --- a/app/tools/gimpmeasuretool.c +++ b/app/tools/gimpmeasuretool.c @@ -119,9 +119,10 @@ static GimpDrawToolClass *parent_class = NULL; void -gimp_measure_tool_register (void) +gimp_measure_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_MEASURE_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_MEASURE_TOOL, FALSE, "gimp:measure_tool", _("Measure Tool"), diff --git a/app/tools/gimpmeasuretool.h b/app/tools/gimpmeasuretool.h index a5181cd45d..987c7187bd 100644 --- a/app/tools/gimpmeasuretool.h +++ b/app/tools/gimpmeasuretool.h @@ -67,7 +67,7 @@ struct _GimpMeasureToolClass }; -void gimp_measure_tool_register (void); +void gimp_measure_tool_register (Gimp *gimp); GtkType gimp_measure_tool_get_type (void); diff --git a/app/tools/gimpmovetool.c b/app/tools/gimpmovetool.c index c40f535b4d..4e7a3a8fee 100644 --- a/app/tools/gimpmovetool.c +++ b/app/tools/gimpmovetool.c @@ -78,9 +78,10 @@ static GimpToolClass *parent_class = NULL; void -gimp_move_tool_register (void) +gimp_move_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_MOVE_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_MOVE_TOOL, FALSE, "gimp:move_tool", _("Move Tool"), diff --git a/app/tools/gimpmovetool.h b/app/tools/gimpmovetool.h index c08f2b2ec4..945152bf8a 100644 --- a/app/tools/gimpmovetool.h +++ b/app/tools/gimpmovetool.h @@ -48,9 +48,9 @@ struct _GimpMoveToolClass }; -GtkType gimp_move_tool_get_type (void); +void gimp_move_tool_register (Gimp *gimp); -void gimp_move_tool_register (void); +GtkType gimp_move_tool_get_type (void); void gimp_move_tool_start_hguide (GimpTool *tool, GDisplay *gdisp); diff --git a/app/tools/gimppaintbrushtool.c b/app/tools/gimppaintbrushtool.c index 0e9f2fbbb1..7d8240a624 100644 --- a/app/tools/gimppaintbrushtool.c +++ b/app/tools/gimppaintbrushtool.c @@ -31,6 +31,7 @@ #include "paint-funcs/paint-funcs.h" +#include "core/gimp.h" #include "core/gimpbrush.h" #include "core/gimpcontext.h" #include "core/gimpdrawable.h" @@ -81,9 +82,10 @@ static GimpPaintToolClass *parent_class = NULL; /* functions */ void -gimp_paintbrush_tool_register (void) +gimp_paintbrush_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_PAINTBRUSH_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_PAINTBRUSH_TOOL, TRUE, "gimp:paintbrush_tool", _("Paintbrush"), @@ -255,6 +257,7 @@ gimp_paintbrush_tool_motion (GimpPaintTool *paint_tool, GradientPaintMode gradient_type) { GimpImage *gimage; + GimpContext *context; TempBuf *area; gdouble x, paint_left; guchar local_blend = OPAQUE_OPACITY; @@ -269,6 +272,8 @@ gimp_paintbrush_tool_motion (GimpPaintTool *paint_tool, if (! (gimage = gimp_drawable_gimage (drawable))) return; + context = gimp_get_current_context (gimage->gimp); + if (pressure_options->size) scale = paint_tool->curpressure; else @@ -299,7 +304,7 @@ gimp_paintbrush_tool_motion (GimpPaintTool *paint_tool, if (gradient_length) { if (pressure_options->color) - gimp_gradient_get_color_at (gimp_context_get_gradient (NULL), + gimp_gradient_get_color_at (gimp_context_get_gradient (context), paint_tool->curpressure, &color); else gimp_paint_tool_get_color_from_gradient (paint_tool, gradient_length, @@ -344,8 +349,8 @@ gimp_paintbrush_tool_motion (GimpPaintTool *paint_tool, gimp_paint_tool_paste_canvas (paint_tool, drawable, MIN (opacity, 255), - gimp_context_get_opacity (NULL) * 255, - gimp_context_get_paint_mode (NULL), + gimp_context_get_opacity (context) * 255, + gimp_context_get_paint_mode (context), pressure_options->pressure ? PRESSURE : SOFT, scale, paint_appl_mode); } diff --git a/app/tools/gimppaintbrushtool.h b/app/tools/gimppaintbrushtool.h index 63188dfc2d..a7daacf4fb 100644 --- a/app/tools/gimppaintbrushtool.h +++ b/app/tools/gimppaintbrushtool.h @@ -44,7 +44,7 @@ struct _GimpPaintbrushToolClass }; -void gimp_paintbrush_tool_register (void); +void gimp_paintbrush_tool_register (Gimp *gimp); GtkType gimp_paintbrush_tool_get_type (void); diff --git a/app/tools/gimppaintoptions-gui.c b/app/tools/gimppaintoptions-gui.c index adca1e7767..4ab7a55f14 100644 --- a/app/tools/gimppaintoptions-gui.c +++ b/app/tools/gimppaintoptions-gui.c @@ -25,14 +25,13 @@ #include "tools-types.h" +#include "core/gimp.h" #include "core/gimpcontext.h" #include "core/gimptoolinfo.h" #include "widgets/gimpwidgets-constructors.h" #include "widgets/gtkhwrapbox.h" -#include "gimprc.h" - #include "gimptool.h" #include "paint_options.h" #include "tool_manager.h" @@ -50,6 +49,9 @@ #include "gimpclonetool.h" #include "gimpconvolvetool.h" +#include "app_procs.h" +#include "gimprc.h" + #include "libgimp/gimpintl.h" @@ -126,7 +128,7 @@ paint_options_init (PaintOptions *options, GtkWidget *scale; GtkWidget *separator; - tool_info = tool_manager_get_info_by_type (tool_type); + tool_info = tool_manager_get_info_by_type (the_gimp, tool_type); if (! tool_info) { @@ -280,7 +282,7 @@ paint_options_reset (ToolOptions *tool_options) options = (PaintOptions *) tool_options; - default_context = gimp_context_get_default (); + default_context = gimp_get_default_context (the_gimp); if (options->opacity_w) { diff --git a/app/tools/gimppainttool.c b/app/tools/gimppainttool.c index 91a0f38625..528faa95f6 100644 --- a/app/tools/gimppainttool.c +++ b/app/tools/gimppainttool.c @@ -37,6 +37,7 @@ #include "paint-funcs/paint-funcs.h" +#include "core/gimp.h" #include "core/gimpbrushpipe.h" #include "core/gimpcontext.h" #include "core/gimpdrawable.h" @@ -44,18 +45,19 @@ #include "core/gimpimage.h" #include "core/gimpimage-mask.h" -#include "devices.h" -#include "drawable.h" -#include "gdisplay.h" -#include "gimprc.h" -#include "undo.h" - #include "gimpdrawtool.h" #include "gimpdodgeburntool.h" #include "gimperasertool.h" #include "gimpconvolvetool.h" #include "gimppainttool.h" +#include "app_procs.h" +#include "devices.h" +#include "drawable.h" +#include "gdisplay.h" +#include "gimprc.h" +#include "undo.h" + #include "libgimp/gimpintl.h" #include "gimppainttool_kernels.h" @@ -837,6 +839,10 @@ gimp_paint_tool_sample_color (GimpDrawable *drawable, { if ((col = gimp_drawable_get_color_at (drawable, x, y))) { + Gimp *gimp; + + gimp = gimp_drawable_gimage (drawable)->gimp; + gimp_rgba_set_uchar (&color, col[RED_PIX], col[GREEN_PIX], @@ -844,9 +850,9 @@ gimp_paint_tool_sample_color (GimpDrawable *drawable, 255); if ((state & GDK_CONTROL_MASK)) - gimp_context_set_foreground (gimp_context_get_user (), &color); + gimp_context_set_foreground (gimp_get_user_context (gimp), &color); else - gimp_context_set_background (gimp_context_get_user (), &color); + gimp_context_set_background (gimp_get_user_context (gimp), &color); g_free (col); } @@ -870,6 +876,10 @@ gimp_paint_tool_start (GimpPaintTool *paint_tool, { static GimpBrush *brush = NULL; + GimpContext *context; + + context = gimp_get_current_context (the_gimp); + paint_tool->curx = x; paint_tool->cury = y; @@ -887,14 +897,14 @@ gimp_paint_tool_start (GimpPaintTool *paint_tool, #endif /* Each buffer is the same size as the maximum bounds of the active brush... */ - if (brush && brush != gimp_context_get_brush (NULL)) + if (brush && brush != gimp_context_get_brush (context)) { gtk_signal_disconnect_by_func (GTK_OBJECT (brush), GTK_SIGNAL_FUNC (gimp_paint_tool_invalidate_cache), NULL); gtk_object_unref (GTK_OBJECT (brush)); } - if (!(brush = gimp_context_get_brush (NULL))) + if (!(brush = gimp_context_get_brush (context))) { g_message (_("No brushes available for use with this tool.")); return FALSE; @@ -1099,8 +1109,11 @@ gimp_paint_tool_get_color_from_gradient (GimpPaintTool *paint_tool, GimpRGB *color, GradientPaintMode mode) { - gdouble y; - gdouble distance; /* distance in current brush stroke */ + GimpContext *context; + gdouble y; + gdouble distance; /* distance in current brush stroke */ + + context = gimp_get_current_context (the_gimp); distance = paint_tool->pixel_dist; y = ((double) distance / gradient_length); @@ -1114,7 +1127,7 @@ gimp_paint_tool_get_color_from_gradient (GimpPaintTool *paint_tool, else y = y - (int)y; - gimp_gradient_get_color_at (gimp_context_get_gradient (NULL), y, color); + gimp_gradient_get_color_at (gimp_context_get_gradient (context), y, color); } diff --git a/app/tools/gimppathtool.c b/app/tools/gimppathtool.c index ab80b12492..fab8dbbcb8 100644 --- a/app/tools/gimppathtool.c +++ b/app/tools/gimppathtool.c @@ -104,9 +104,10 @@ static ToolOptions *path_options = NULL; void -gimp_path_tool_register (void) +gimp_path_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_PATH_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_PATH_TOOL, FALSE, "gimp:path_tool", _("Path Tool"), diff --git a/app/tools/gimppathtool.h b/app/tools/gimppathtool.h index 4f9dadd4d3..97a35cc427 100644 --- a/app/tools/gimppathtool.h +++ b/app/tools/gimppathtool.h @@ -68,7 +68,7 @@ struct _GimpPathToolClass }; -void gimp_path_tool_register (void); +void gimp_path_tool_register (Gimp *gimp); GtkType gimp_path_tool_get_type (void); diff --git a/app/tools/gimppenciltool.c b/app/tools/gimppenciltool.c index 3db9d9fc0e..d070c05431 100644 --- a/app/tools/gimppenciltool.c +++ b/app/tools/gimppenciltool.c @@ -28,6 +28,7 @@ #include "paint-funcs/paint-funcs.h" +#include "core/gimp.h" #include "core/gimpbrush.h" #include "core/gimpcontext.h" #include "core/gimpdrawable.h" @@ -74,9 +75,10 @@ static GimpPaintToolClass *parent_class = NULL; /* functions */ void -gimp_pencil_tool_register (void) +gimp_pencil_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_PENCIL_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_PENCIL_TOOL, TRUE, "gimp:pencil_tool", _("Pencil"), @@ -191,6 +193,7 @@ gimp_pencil_tool_motion (GimpPaintTool *paint_tool, gboolean incremental) { GimpImage *gimage; + GimpContext *context; TempBuf *area; guchar col[MAX_CHANNELS]; gint opacity; @@ -200,6 +203,8 @@ gimp_pencil_tool_motion (GimpPaintTool *paint_tool, if (! (gimage = gimp_drawable_gimage (drawable))) return; + context = gimp_get_current_context (gimage->gimp); + if (pressure_options->size) scale = paint_tool->curpressure; else @@ -214,7 +219,7 @@ gimp_pencil_tool_motion (GimpPaintTool *paint_tool, { GimpRGB color; - gimp_gradient_get_color_at (gimp_context_get_gradient (NULL), + gimp_gradient_get_color_at (gimp_context_get_gradient (context), paint_tool->curpressure, &color); gimp_rgba_get_uchar (&color, @@ -242,15 +247,15 @@ gimp_pencil_tool_motion (GimpPaintTool *paint_tool, area->width * area->height, area->bytes); } - opacity = 255 * gimp_context_get_opacity (NULL); + opacity = 255 * gimp_context_get_opacity (context); if (pressure_options->opacity) opacity = opacity * 2.0 * paint_tool->curpressure; /* paste the newly painted canvas to the gimage which is being worked on */ gimp_paint_tool_paste_canvas (paint_tool, drawable, MIN (opacity, 255), - gimp_context_get_opacity (NULL) * 255, - gimp_context_get_paint_mode (NULL), + gimp_context_get_opacity (context) * 255, + gimp_context_get_paint_mode (context), HARD, scale, paint_appl_mode); } diff --git a/app/tools/gimppenciltool.h b/app/tools/gimppenciltool.h index 57f213edaa..0b13f7aa39 100644 --- a/app/tools/gimppenciltool.h +++ b/app/tools/gimppenciltool.h @@ -47,7 +47,7 @@ struct _GimpPencilToolClass }; -void gimp_pencil_tool_register (void); +void gimp_pencil_tool_register (Gimp *gimp); GtkType gimp_pencil_tool_get_type (void); diff --git a/app/tools/gimpperspectivetool.c b/app/tools/gimpperspectivetool.c index efdb0648ca..ac9bd5fce8 100644 --- a/app/tools/gimpperspectivetool.c +++ b/app/tools/gimpperspectivetool.c @@ -66,12 +66,14 @@ static GimpTransformToolClass *parent_class = NULL; static TransformOptions *perspective_options = NULL; + /* public functions */ void -gimp_perspective_tool_register (void) +gimp_perspective_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_PERSPECTIVE_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_PERSPECTIVE_TOOL, FALSE, "gimp:perspective_tool", _("Perspective Tool"), diff --git a/app/tools/gimpperspectivetool.h b/app/tools/gimpperspectivetool.h index 2c52ce0d9c..e9ab33a15c 100644 --- a/app/tools/gimpperspectivetool.h +++ b/app/tools/gimpperspectivetool.h @@ -44,18 +44,19 @@ struct _GimpPerspectiveToolClass }; -GtkType gimp_perspective_tool_get_type (void); +void gimp_perspective_tool_register (Gimp *gimp); -void gimp_perspective_tool_register (void); +GtkType gimp_perspective_tool_get_type (void); -TileManager * gimp_perspective_tool_perspective (GimpImage *gimage, - GimpDrawable *drawable, - GDisplay *gdisp, - TileManager *float_tiles, - gboolean interpolation, - GimpMatrix3 matrix); -void gimp_perspective_tool_find_transform (gdouble *coords, - GimpMatrix3 matrix); +TileManager * gimp_perspective_tool_perspective (GimpImage *gimage, + GimpDrawable *drawable, + GDisplay *gdisp, + TileManager *float_tiles, + gboolean interpolation, + GimpMatrix3 matrix); +void gimp_perspective_tool_find_transform (gdouble *coords, + GimpMatrix3 matrix); + #endif /* __GIMP_PERSPECTIVE_TOOL_H__ */ diff --git a/app/tools/gimpposterizetool.c b/app/tools/gimpposterizetool.c index ff6171b780..09e00d54ab 100644 --- a/app/tools/gimpposterizetool.c +++ b/app/tools/gimpposterizetool.c @@ -105,9 +105,10 @@ static GimpImageMapToolClass *parent_class = NULL; /* functions */ void -gimp_posterize_tool_register (void) +gimp_posterize_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_POSTERIZE_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_POSTERIZE_TOOL, FALSE, "gimp:posterize_tool", _("Posterize"), diff --git a/app/tools/gimpposterizetool.h b/app/tools/gimpposterizetool.h index 0ca634389a..97b66c8da8 100644 --- a/app/tools/gimpposterizetool.h +++ b/app/tools/gimpposterizetool.h @@ -44,7 +44,7 @@ struct _GimpPosterizeToolClass }; -void gimp_posterize_tool_register (void); +void gimp_posterize_tool_register (Gimp *gimp); GtkType gimp_posterize_tool_get_type (void); diff --git a/app/tools/gimprectselecttool.c b/app/tools/gimprectselecttool.c index b0bd77806a..76dbc94a46 100644 --- a/app/tools/gimprectselecttool.c +++ b/app/tools/gimprectselecttool.c @@ -34,15 +34,16 @@ #include "core/gimpmarshal.h" #include "core/gimptoolinfo.h" -#include "gdisplay.h" -#include "floating_sel.h" - #include "gimpeditselectiontool.h" #include "gimprectselecttool.h" #include "selection_options.h" #include "tool_options.h" #include "tool_manager.h" +#include "app_procs.h" +#include "gdisplay.h" +#include "floating_sel.h" + #include "libgimp/gimpintl.h" #define WANT_RECT_SELECT_BITS @@ -92,9 +93,11 @@ static SelectionOptions *rect_options = NULL; /* public functions */ void -gimp_rect_select_tool_register (void) +gimp_rect_select_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_RECT_SELECT_TOOL, FALSE, + tool_manager_register_tool (gimp, + GIMP_TYPE_RECT_SELECT_TOOL, + FALSE, "gimp:rect_select_tool", _("Rect Select"), _("Select rectangular regions"), @@ -264,7 +267,7 @@ gimp_rect_select_tool_button_press (GimpTool *tool, sel_tool = GIMP_SELECTION_TOOL (tool); sel_options = (SelectionOptions *) - tool_manager_get_info_by_tool (tool)->tool_options; + tool_manager_get_info_by_tool (gdisp->gimage->gimp, tool)->tool_options; gdisplay_untransform_coords (gdisp, bevent->x, bevent->y, &x, &y, TRUE, 0); @@ -623,7 +626,7 @@ gimp_rect_select_tool_real_rect_select (GimpRectSelectTool *rect_tool, sel_tool = GIMP_SELECTION_TOOL (rect_tool); sel_options = (SelectionOptions *) - tool_manager_get_info_by_tool (tool)->tool_options; + tool_manager_get_info_by_tool (the_gimp, tool)->tool_options; rect_select (tool->gdisp->gimage, x, y, w, h, diff --git a/app/tools/gimprectselecttool.h b/app/tools/gimprectselecttool.h index 05a60d8c16..64e0bba2b5 100644 --- a/app/tools/gimprectselecttool.h +++ b/app/tools/gimprectselecttool.h @@ -61,7 +61,7 @@ struct _GimpRectSelectToolClass }; -void gimp_rect_select_tool_register (void); +void gimp_rect_select_tool_register (Gimp *gimp); GtkType gimp_rect_select_tool_get_type (void); diff --git a/app/tools/gimpregionselecttool.c b/app/tools/gimpregionselecttool.c index 7b4f96b9ee..7ccdfa1772 100644 --- a/app/tools/gimpregionselecttool.c +++ b/app/tools/gimpregionselecttool.c @@ -89,9 +89,11 @@ GimpChannel * fuzzy_mask = NULL; /* public functions */ void -gimp_fuzzy_select_tool_register (void) +gimp_fuzzy_select_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_FUZZY_SELECT_TOOL, FALSE, + tool_manager_register_tool (gimp, + GIMP_TYPE_FUZZY_SELECT_TOOL, + FALSE, "gimp:fuzzy_select_tool", _("Fuzzy Select"), _("Select contiguous regions"), diff --git a/app/tools/gimpregionselecttool.h b/app/tools/gimpregionselecttool.h index 2f6e1bd4b7..041821e797 100644 --- a/app/tools/gimpregionselecttool.h +++ b/app/tools/gimpregionselecttool.h @@ -49,7 +49,7 @@ struct _GimpFuzzySelectToolClass }; -void gimp_fuzzy_select_tool_register (void); +void gimp_fuzzy_select_tool_register (Gimp *gimp); GtkType gimp_fuzzy_select_tool_get_type (void); diff --git a/app/tools/gimprotatetool.c b/app/tools/gimprotatetool.c index 45e6ce9d3e..f0e4bfdff4 100644 --- a/app/tools/gimprotatetool.c +++ b/app/tools/gimprotatetool.c @@ -91,12 +91,14 @@ static GimpTransformToolClass *parent_class = NULL; static TransformOptions *rotate_options = NULL; + /* public functions */ void -gimp_rotate_tool_register (void) +gimp_rotate_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_ROTATE_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_ROTATE_TOOL, FALSE, "gimp:rotate_tool", _("Rotate Tool"), diff --git a/app/tools/gimprotatetool.h b/app/tools/gimprotatetool.h index 08005e47d3..83862a055d 100644 --- a/app/tools/gimprotatetool.h +++ b/app/tools/gimprotatetool.h @@ -44,9 +44,9 @@ struct _GimpRotateToolClass }; -GtkType gimp_rotate_tool_get_type (void); +void gimp_rotate_tool_register (Gimp *gimp); -void gimp_rotate_tool_register (void); +GtkType gimp_rotate_tool_get_type (void); TileManager * gimp_rotate_tool_rotate (GimpImage *gimage, diff --git a/app/tools/gimpscaletool.c b/app/tools/gimpscaletool.c index bdb10e84b5..7b171fa4e3 100644 --- a/app/tools/gimpscaletool.c +++ b/app/tools/gimpscaletool.c @@ -74,15 +74,17 @@ static gchar y_ratio_buf[MAX_INFO_BUF]; /* needed for original size unit update */ static GtkWidget *sizeentry = NULL; + static GimpTransformToolClass *parent_class = NULL; static TransformOptions *scale_options = NULL; void -gimp_scale_tool_register (void) +gimp_scale_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_SCALE_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_SCALE_TOOL, FALSE, "gimp:scale_tool", _("Scale Tool"), diff --git a/app/tools/gimpscaletool.h b/app/tools/gimpscaletool.h index 20da06c124..0fc528199d 100644 --- a/app/tools/gimpscaletool.h +++ b/app/tools/gimpscaletool.h @@ -43,7 +43,8 @@ struct _GimpScaleToolClass }; -void gimp_scale_tool_register (void); +void gimp_scale_tool_register (Gimp *gimp); + GtkType gimp_scale_tool_get_type (void); TileManager * gimp_scale_tool_scale (GimpImage *gimage, diff --git a/app/tools/gimpsheartool.c b/app/tools/gimpsheartool.c index 94b8a50889..4a6a29caf0 100644 --- a/app/tools/gimpsheartool.c +++ b/app/tools/gimpsheartool.c @@ -92,9 +92,10 @@ static TransformOptions *shear_options = NULL; /* Public functions */ void -gimp_shear_tool_register (void) +gimp_shear_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_SHEAR_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_SHEAR_TOOL, FALSE, "gimp:shear_tool", _("Shear Tool"), diff --git a/app/tools/gimpsheartool.h b/app/tools/gimpsheartool.h index 2c2dcdb148..7cf3349504 100644 --- a/app/tools/gimpsheartool.h +++ b/app/tools/gimpsheartool.h @@ -44,17 +44,17 @@ struct _GimpShearToolClass }; -GtkType gimp_shear_tool_get_type (void); +void gimp_shear_tool_register (Gimp *gimp); -void gimp_shear_tool_register (void); +GtkType gimp_shear_tool_get_type (void); -TileManager * gimp_shear_tool_shear (GimpImage *gimage, - GimpDrawable *drawable, - GDisplay *gdisp, - TileManager *float_tiles, - gboolean interpolation, - GimpMatrix3 matrix); +TileManager * gimp_shear_tool_shear (GimpImage *gimage, + GimpDrawable *drawable, + GDisplay *gdisp, + TileManager *float_tiles, + gboolean interpolation, + GimpMatrix3 matrix); #endif /* __GIMP_SHEAR_TOOL_H__ */ diff --git a/app/tools/gimpsmudgetool.c b/app/tools/gimpsmudgetool.c index 2fac059696..b650b1ebbf 100644 --- a/app/tools/gimpsmudgetool.c +++ b/app/tools/gimpsmudgetool.c @@ -31,9 +31,11 @@ #include "paint-funcs/paint-funcs.h" +#include "core/gimp.h" #include "core/gimpbrush.h" #include "core/gimpcontext.h" #include "core/gimpdrawable.h" +#include "core/gimpimage.h" #include "gimpsmudgetool.h" #include "paint_options.h" @@ -111,9 +113,10 @@ static gdouble non_gui_rate; /* global functions */ void -gimp_smudge_tool_register (void) +gimp_smudge_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_SMUDGE_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_SMUDGE_TOOL, TRUE, "gimp:smudge_tool", _("Smudge"), @@ -348,6 +351,7 @@ gimp_smudge_tool_motion (GimpPaintTool *paint_tool, GimpDrawable *drawable) { GimpImage *gimage; + GimpContext *context; TempBuf *area; PixelRegion srcPR, destPR, tempPR; gdouble rate; @@ -357,6 +361,8 @@ gimp_smudge_tool_motion (GimpPaintTool *paint_tool, if (! (gimage = gimp_drawable_gimage (drawable))) return; + context = gimp_get_current_context (gimage->gimp); + /* If the image type is indexed, don't smudge */ if (gimp_drawable_is_indexed (drawable)) return; @@ -427,7 +433,7 @@ gimp_smudge_tool_motion (GimpPaintTool *paint_tool, else copy_region (&tempPR, &destPR); - opacity = 255 * gimp_context_get_opacity (NULL); + opacity = 255 * gimp_context_get_opacity (context); if (pressure_options->opacity) opacity = opacity * 2.0 * paint_tool->curpressure; diff --git a/app/tools/gimpsmudgetool.h b/app/tools/gimpsmudgetool.h index cd550bb65d..1584535691 100644 --- a/app/tools/gimpsmudgetool.h +++ b/app/tools/gimpsmudgetool.h @@ -58,12 +58,11 @@ struct _GimpSmudgeToolClass }; -void gimp_smudge_tool_register (void); +void gimp_smudge_tool_register (Gimp *gimp); GtkType gimp_smudge_tool_get_type (void); - /* FIXME: this antique code doesn't follow the coding style */ gboolean gimp_smudge_tool_non_gui (GimpDrawable *drawable, gdouble rate, diff --git a/app/tools/gimpsourcetool.c b/app/tools/gimpsourcetool.c index f5c29f10aa..79ce88d7fe 100644 --- a/app/tools/gimpsourcetool.c +++ b/app/tools/gimpsourcetool.c @@ -32,6 +32,7 @@ #include "paint-funcs/paint-funcs.h" +#include "core/gimp.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" #include "core/gimpimage-mask.h" @@ -155,9 +156,10 @@ static CloneType non_gui_type; /* global functions */ void -gimp_clone_tool_register (void) +gimp_clone_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_CLONE_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_CLONE_TOOL, TRUE, "gimp:clone_tool", _("Clone"), @@ -265,18 +267,21 @@ clone_set_src_drawable (GimpDrawable *drawable) } static void -gimp_clone_tool_paint (GimpPaintTool *paint_tool, - GimpDrawable *drawable, - PaintState state) +gimp_clone_tool_paint (GimpPaintTool *paint_tool, + GimpDrawable *drawable, + PaintState state) { - GDisplay *gdisp; - GDisplay *src_gdisp; - gint x1, y1, x2, y2; - static gint orig_src_x, orig_src_y; + GDisplay *gdisp; + GDisplay *src_gdisp; + gint x1, y1, x2, y2; + static gint orig_src_x, orig_src_y; GimpDrawTool *draw_tool; + GimpContext *context; gdisp = (GDisplay *) active_tool->gdisp; - draw_tool = GIMP_DRAW_TOOL(paint_tool); + draw_tool = GIMP_DRAW_TOOL (paint_tool); + + context = gimp_get_current_context (gdisp->gimage->gimp); switch (state) { @@ -341,7 +346,7 @@ gimp_clone_tool_paint (GimpPaintTool *paint_tool, orig_src_y = src_y; } if (clone_options->type == PATTERN_CLONE) - if (! gimp_context_get_pattern (NULL)) + if (! gimp_context_get_pattern (context)) g_message (_("No patterns available for this operation.")); break; @@ -351,7 +356,7 @@ gimp_clone_tool_paint (GimpPaintTool *paint_tool, { src_x = orig_src_x; src_y = orig_src_y; - } + } return; break; @@ -453,6 +458,7 @@ gimp_clone_tool_motion (GimpPaintTool *paint_tool, { GimpImage *gimage; GimpImage *src_gimage = NULL; + GimpContext *context; guchar *s; guchar *d; TempBuf *orig; @@ -484,6 +490,8 @@ gimp_clone_tool_motion (GimpPaintTool *paint_tool, if (! (gimage = gimp_drawable_gimage (drawable))) return; + context = gimp_get_current_context (gimage->gimp); + if (pressure_options->size) scale = paint_tool->curpressure; else @@ -559,7 +567,7 @@ gimp_clone_tool_motion (GimpPaintTool *paint_tool, break; case PATTERN_CLONE: - pattern = gimp_context_get_pattern (NULL); + pattern = gimp_context_get_pattern (context); if (!pattern) return; @@ -601,15 +609,15 @@ gimp_clone_tool_motion (GimpPaintTool *paint_tool, } } - opacity = 255.0 * gimp_context_get_opacity (NULL); + opacity = 255.0 * gimp_context_get_opacity (context); if (pressure_options->opacity) opacity = opacity * 2.0 * paint_tool->curpressure; /* paste the newly painted canvas to the gimage which is being worked on */ gimp_paint_tool_paste_canvas (paint_tool, drawable, MIN (opacity, 255), - (gint) (gimp_context_get_opacity (NULL) * 255), - gimp_context_get_paint_mode (NULL), + (gint) (gimp_context_get_opacity (context) * 255), + gimp_context_get_paint_mode (context), pressure_options->pressure ? PRESSURE : SOFT, scale, CONSTANT); } diff --git a/app/tools/gimpsourcetool.h b/app/tools/gimpsourcetool.h index 7f10e324a6..15ce1359fd 100644 --- a/app/tools/gimpsourcetool.h +++ b/app/tools/gimpsourcetool.h @@ -51,7 +51,7 @@ struct _GimpCloneToolClass }; -void gimp_clone_tool_register (void); +void gimp_clone_tool_register (Gimp *gimp); GtkType gimp_clone_tool_get_type (void); diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c index 89039a0059..bc8a078fb2 100644 --- a/app/tools/gimptexttool.c +++ b/app/tools/gimptexttool.c @@ -156,9 +156,10 @@ static GimpToolClass *parent_class = NULL; /* functions */ void -gimp_text_tool_register (void) +gimp_text_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_TEXT_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_TEXT_TOOL, FALSE, "gimp:text_tool", _("Text Tool"), diff --git a/app/tools/gimptexttool.h b/app/tools/gimptexttool.h index 90fc8e6abc..525d42b554 100644 --- a/app/tools/gimptexttool.h +++ b/app/tools/gimptexttool.h @@ -57,9 +57,9 @@ struct _GimpTextToolClass }; -GtkType gimp_text_tool_get_type (void); +void gimp_text_tool_register (Gimp *gimp); -void gimp_text_tool_register (void); +GtkType gimp_text_tool_get_type (void); gboolean text_get_extents (gchar *fontname, diff --git a/app/tools/gimpthresholdtool.c b/app/tools/gimpthresholdtool.c index 49755da096..725c8b33af 100644 --- a/app/tools/gimpthresholdtool.c +++ b/app/tools/gimpthresholdtool.c @@ -111,9 +111,10 @@ static GimpImageMapToolClass *parent_class = NULL; /* functions */ void -gimp_threshold_tool_register (void) +gimp_threshold_tool_register (Gimp *gimp) { - tool_manager_register_tool (GIMP_TYPE_THRESHOLD_TOOL, + tool_manager_register_tool (gimp, + GIMP_TYPE_THRESHOLD_TOOL, FALSE, "gimp:threshold_tool", _("Threshold"), diff --git a/app/tools/gimpthresholdtool.h b/app/tools/gimpthresholdtool.h index ace2d979b5..39219ef1ba 100644 --- a/app/tools/gimpthresholdtool.h +++ b/app/tools/gimpthresholdtool.h @@ -67,7 +67,7 @@ struct _ThresholdDialog }; -void gimp_threshold_tool_register (void); +void gimp_threshold_tool_register (Gimp *gimp); GtkType gimp_threshold_tool_get_type (void); diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c index 7c11e684da..a673dbcffe 100644 --- a/app/tools/gimptransformtool.c +++ b/app/tools/gimptransformtool.c @@ -35,6 +35,7 @@ #include "paint-funcs/paint-funcs.h" +#include "core/gimp.h" #include "core/gimpchannel.h" #include "core/gimpcontext.h" #include "core/gimpdrawable.h" @@ -455,7 +456,7 @@ gimp_transform_tool_button_press (GimpTool *tool, GtkType tool_type; tool_type = - gimp_context_get_tool (gimp_context_get_user ())->tool_type; + gimp_context_get_tool (gimp_get_user_context (gdisp->gimage->gimp))->tool_type; gimp_dialog_create_action_area (GTK_DIALOG (transform_info->shell), diff --git a/app/tools/paint_options.c b/app/tools/paint_options.c index adca1e7767..4ab7a55f14 100644 --- a/app/tools/paint_options.c +++ b/app/tools/paint_options.c @@ -25,14 +25,13 @@ #include "tools-types.h" +#include "core/gimp.h" #include "core/gimpcontext.h" #include "core/gimptoolinfo.h" #include "widgets/gimpwidgets-constructors.h" #include "widgets/gtkhwrapbox.h" -#include "gimprc.h" - #include "gimptool.h" #include "paint_options.h" #include "tool_manager.h" @@ -50,6 +49,9 @@ #include "gimpclonetool.h" #include "gimpconvolvetool.h" +#include "app_procs.h" +#include "gimprc.h" + #include "libgimp/gimpintl.h" @@ -126,7 +128,7 @@ paint_options_init (PaintOptions *options, GtkWidget *scale; GtkWidget *separator; - tool_info = tool_manager_get_info_by_type (tool_type); + tool_info = tool_manager_get_info_by_type (the_gimp, tool_type); if (! tool_info) { @@ -280,7 +282,7 @@ paint_options_reset (ToolOptions *tool_options) options = (PaintOptions *) tool_options; - default_context = gimp_context_get_default (); + default_context = gimp_get_default_context (the_gimp); if (options->opacity_w) { diff --git a/app/tools/tool_manager.c b/app/tools/tool_manager.c index 13315ed736..7a68da73f6 100644 --- a/app/tools/tool_manager.c +++ b/app/tools/tool_manager.c @@ -31,9 +31,13 @@ #include "core/gimplist.h" #include "core/gimptoolinfo.h" +#include "gui/brush-select.h" + #include "gimptool.h" +#include "paint_options.h" #include "tool_manager.h" #include "tool_options.h" +#include "tools.h" #include "gimpairbrushtool.h" #include "gimppaintbrushtool.h" @@ -47,28 +51,121 @@ #include "appenv.h" #include "app_procs.h" #include "gdisplay.h" +#include "gimprc.h" #include "libgimp/gimpintl.h" +#define PAINT_OPTIONS_MASK GIMP_CONTEXT_OPACITY_MASK | \ + GIMP_CONTEXT_PAINT_MODE_MASK + + /* Global Data */ + GimpTool *active_tool = NULL; -static GSList *tool_stack = NULL; +static GSList *tool_stack = NULL; +static GimpContext *global_tool_context = NULL; -/* Function definitions */ +/* local function prototypes */ -static void -active_tool_unref (void) +static void active_tool_unref (void); +static void tool_manager_tool_changed (GimpContext *user_context, + GimpToolInfo *tool_info, + gpointer data); + + +/* public functions */ + +void +tool_manager_init (Gimp *gimp) { - if (! active_tool) + GimpContext *user_context; + GimpContext *tool_context; + + user_context = gimp_get_user_context (gimp); + + gtk_signal_connect (GTK_OBJECT (user_context), "tool_changed", + GTK_SIGNAL_FUNC (tool_manager_tool_changed), + NULL); + + /* Create a context to store the paint options of the + * global paint options mode + */ + global_tool_context = gimp_create_context (gimp, + "Global Tool Context", + user_context); + + /* TODO: add foreground, background, brush, pattern, gradient */ + gimp_context_define_args (global_tool_context, PAINT_OPTIONS_MASK, FALSE); + + /* register internal tools */ + tools_init (gimp); + + if (! gimprc.global_paint_options && active_tool && + (tool_context = tool_manager_get_info_by_tool (gimp, + active_tool)->context)) + { + gimp_context_set_parent (tool_context, user_context); + } + else if (gimprc.global_paint_options) + { + gimp_context_set_parent (global_tool_context, user_context); + } + + gimp_container_thaw (gimp->tool_info_list); +} + +void +tool_manager_exit (Gimp *gimp) +{ + gtk_object_unref (GTK_OBJECT (global_tool_context)); + global_tool_context = NULL; +} + +void +tool_manager_set_global_paint_options (Gimp *gimp, + gboolean global) +{ + GimpToolInfo *tool_info; + GimpContext *context; + + if (global == gimprc.global_paint_options) return; - gtk_object_unref (GTK_OBJECT (active_tool)); + paint_options_set_global (global); - active_tool = NULL; + /* NULL is the main brush selection */ + brush_select_show_paint_options (NULL, global); + + tool_info = gimp_context_get_tool (gimp_get_user_context (gimp)); + + if (global) + { + if (tool_info && (context = tool_info->context)) + { + gimp_context_unset_parent (context); + } + + gimp_context_copy_args (global_tool_context, + gimp_get_user_context (gimp), + PAINT_OPTIONS_MASK); + gimp_context_set_parent (global_tool_context, + gimp_get_user_context (gimp)); + } + else + { + gimp_context_unset_parent (global_tool_context); + + if (tool_info && (context = tool_info->context)) + { + gimp_context_copy_args (context, gimp_get_user_context (gimp), + GIMP_CONTEXT_PAINT_ARGS_MASK); + gimp_context_set_parent (context, gimp_get_user_context (gimp)); + } + } } void @@ -112,7 +209,8 @@ tool_manager_pop_tool (void) void -tool_manager_initialize_tool (GimpTool *tool, /* FIXME: remove tool param */ +tool_manager_initialize_tool (Gimp *gimp, + GimpTool *tool, /* FIXME: remove tool param */ GDisplay *gdisp) { GimpToolInfo *tool_info; @@ -129,17 +227,17 @@ tool_manager_initialize_tool (GimpTool *tool, /* FIXME: remove tool param */ /* Force the emission of the "tool_changed" signal */ - tool_info = gimp_context_get_tool (gimp_context_get_user ()); + tool_info = gimp_context_get_tool (gimp_get_user_context (gimp)); if (GTK_OBJECT (tool)->klass->type == tool_info->tool_type) { - gimp_context_tool_changed (gimp_context_get_user ()); + gimp_context_tool_changed (gimp_get_user_context (gimp)); } else { GList *list; - for (list = GIMP_LIST (the_gimp->tool_info_list)->list; + for (list = GIMP_LIST (gimp->tool_info_list)->list; list; list = g_list_next (list)) { @@ -147,7 +245,8 @@ tool_manager_initialize_tool (GimpTool *tool, /* FIXME: remove tool param */ if (tool_info->tool_type == GTK_OBJECT (tool)->klass->type) { - gimp_context_set_tool (gimp_context_get_user (), tool_info); + gimp_context_set_tool (gimp_get_user_context (gimp), + tool_info); break; } @@ -223,45 +322,9 @@ tool_manager_control_active (ToolAction action, } } - -#ifdef __GNUC__ -#warning bogosity alert -#endif -#if 0 -void -tools_register (ToolType tool_type, - ToolOptions *tool_options) -{ - g_return_if_fail (tool_options != NULL); - - tool_info [(gint) tool_type].tool_options = tool_options; - - /* need to check whether the widget is visible...this can happen - * because some tools share options such as the transformation tools - */ - if (! GTK_WIDGET_VISIBLE (tool_options->main_vbox)) - { - gtk_box_pack_start (GTK_BOX (options_vbox), tool_options->main_vbox, - TRUE, TRUE, 0); - gtk_widget_show (tool_options->main_vbox); - } - - gtk_label_set_text (GTK_LABEL (options_label), tool_options->title); - - gtk_pixmap_set (GTK_PIXMAP (options_pixmap), - tool_get_pixmap (tool_type), tool_get_mask (tool_type)); - - gtk_widget_queue_draw (options_pixmap); - - gimp_help_set_help_data (options_eventbox, - gettext (tool_info[(gint) tool_type].tool_desc), - tool_info[(gint) tool_type].private_tip); -} -#endif - - void -tool_manager_register_tool (GtkType tool_type, +tool_manager_register_tool (Gimp *gimp, + GtkType tool_type, gboolean tool_context, const gchar *identifier, const gchar *blurb, @@ -274,7 +337,8 @@ tool_manager_register_tool (GtkType tool_type, { GimpToolInfo *tool_info; - tool_info = gimp_tool_info_new (tool_type, + tool_info = gimp_tool_info_new (global_tool_context, + tool_type, tool_context, identifier, blurb, @@ -285,7 +349,7 @@ tool_manager_register_tool (GtkType tool_type, help_data, icon_data); - gimp_container_add (the_gimp->tool_info_list, GIMP_OBJECT (tool_info)); + gimp_container_add (gimp->tool_info_list, GIMP_OBJECT (tool_info)); } void @@ -294,7 +358,7 @@ tool_manager_register_tool_options (GtkType tool_type, { GimpToolInfo *tool_info; - tool_info = tool_manager_get_info_by_type (tool_type); + tool_info = tool_manager_get_info_by_type (the_gimp, tool_type); if (! tool_info) { @@ -307,12 +371,13 @@ tool_manager_register_tool_options (GtkType tool_type, } GimpToolInfo * -tool_manager_get_info_by_type (GtkType tool_type) +tool_manager_get_info_by_type (Gimp *gimp, + GtkType tool_type) { GimpToolInfo *tool_info; GList *list; - for (list = GIMP_LIST (the_gimp->tool_info_list)->list; + for (list = GIMP_LIST (gimp->tool_info_list)->list; list; list = g_list_next (list)) { @@ -326,16 +391,17 @@ tool_manager_get_info_by_type (GtkType tool_type) } GimpToolInfo * -tool_manager_get_info_by_tool (GimpTool *tool) +tool_manager_get_info_by_tool (Gimp *gimp, + GimpTool *tool) { g_return_val_if_fail (tool != NULL, NULL); g_return_val_if_fail (GIMP_IS_TOOL (tool), NULL); - return tool_manager_get_info_by_type (GTK_OBJECT (tool)->klass->type); + return tool_manager_get_info_by_type (gimp, GTK_OBJECT (tool)->klass->type); } const gchar * -tool_manager_active_get_PDB_string (void) +tool_manager_active_get_PDB_string (Gimp *gimp) { GimpToolInfo *tool_info; const gchar *tool_str = "gimp_paintbrush_default"; @@ -347,7 +413,7 @@ tool_manager_active_get_PDB_string (void) if (! active_tool) return tool_str; - tool_info = gimp_context_get_tool (gimp_context_get_user ()); + tool_info = gimp_context_get_tool (gimp_get_user_context (gimp)); if (tool_info->tool_type == GIMP_TYPE_PENCIL_TOOL) { @@ -390,7 +456,7 @@ tool_manager_active_get_help_data (void) { g_return_val_if_fail (active_tool != NULL, NULL); - return tool_manager_get_info_by_tool (active_tool)->help_data; + return tool_manager_get_info_by_tool (the_gimp, active_tool)->help_data; } void @@ -398,3 +464,86 @@ tool_manager_help_func (const gchar *help_data) { gimp_standard_help_func (tool_manager_active_get_help_data ()); } + + +/* private functions */ + +static void +active_tool_unref (void) +{ + if (! active_tool) + return; + + gtk_object_unref (GTK_OBJECT (active_tool)); + + active_tool = NULL; +} + +static void +tool_manager_tool_changed (GimpContext *user_context, + GimpToolInfo *tool_info, + gpointer data) +{ + GimpTool *new_tool = NULL; + GimpContext *tool_context = NULL; + + if (! tool_info) + return; + + /* FIXME: gimp_busy HACK */ + if (gimp_busy) + { + /* there may be contexts waiting for the user_context's "tool_changed" + * signal, so stop emitting it. + */ + gtk_signal_emit_stop_by_name (GTK_OBJECT (user_context), "tool_changed"); + + if (GTK_OBJECT (active_tool)->klass->type != tool_info->tool_type) + { + gtk_signal_handler_block_by_func (GTK_OBJECT (user_context), + tool_manager_tool_changed, + NULL); + + /* explicitly set the current tool */ + gimp_context_set_tool (user_context, + tool_manager_get_info_by_tool (user_context->gimp, + active_tool)); + + gtk_signal_handler_unblock_by_func (GTK_OBJECT (user_context), + tool_manager_tool_changed, + NULL); + } + + return; + } + + if (tool_info->tool_type != GTK_TYPE_NONE) + { + new_tool = gtk_type_new (tool_info->tool_type); + } + else + { + g_warning ("%s(): tool_info contains no valid GtkType", + G_GNUC_FUNCTION); + return; + } + + if (! gimprc.global_paint_options) + { + if (active_tool && + (tool_context = tool_manager_get_info_by_tool (user_context->gimp, + active_tool)->context)) + { + gimp_context_unset_parent (tool_context); + } + + if ((tool_context = tool_info->context)) + { + gimp_context_copy_args (tool_context, user_context, + PAINT_OPTIONS_MASK); + gimp_context_set_parent (tool_context, user_context); + } + } + + tool_manager_select_tool (new_tool); +} diff --git a/app/tools/tool_manager.h b/app/tools/tool_manager.h index 1e914d436c..bee74cb5bb 100644 --- a/app/tools/tool_manager.h +++ b/app/tools/tool_manager.h @@ -24,23 +24,31 @@ extern GimpTool *active_tool; +void tool_manager_init (Gimp *gimp); +void tool_manager_exit (Gimp *gimp); + +void tool_manager_set_global_paint_options (Gimp *gimp, + gboolean global); + void tool_manager_select_tool (GimpTool *tool); void tool_manager_push_tool (GimpTool *tool); void tool_manager_pop_tool (void); -void tool_manager_initialize_tool (GimpTool *tool, +void tool_manager_initialize_tool (Gimp *gimp, + GimpTool *tool, GDisplay *gdisp); void tool_manager_control_active (ToolAction action, GDisplay *gdisp); -const gchar * tool_manager_active_get_PDB_string (void); +const gchar * tool_manager_active_get_PDB_string (Gimp *gimp); const gchar * tool_manager_active_get_help_data (void); -void tool_manager_register_tool (GtkType tool_type, +void tool_manager_register_tool (Gimp *gimp, + GtkType tool_type, gboolean tool_context, const gchar *identifier, const gchar *blurb, @@ -54,8 +62,10 @@ void tool_manager_register_tool (GtkType tool_type, void tool_manager_register_tool_options (GtkType tool_type, ToolOptions *tool_options); -GimpToolInfo * tool_manager_get_info_by_type (GtkType tool_type); -GimpToolInfo * tool_manager_get_info_by_tool (GimpTool *tool); +GimpToolInfo * tool_manager_get_info_by_type (Gimp *gimp, + GtkType tool_type); +GimpToolInfo * tool_manager_get_info_by_tool (Gimp *gimp, + GimpTool *tool); diff --git a/app/tools/tools.c b/app/tools/tools.c index 642995c0cc..820cd78dde 100644 --- a/app/tools/tools.c +++ b/app/tools/tools.c @@ -66,66 +66,66 @@ void -tools_init (void) +tools_init (Gimp *gimp) { /* register tools in reverse order */ /* color tools */ - gimp_posterize_tool_register (); - gimp_curves_tool_register (); - gimp_levels_tool_register (); - gimp_threshold_tool_register (); - gimp_brightness_contrast_tool_register (); - gimp_hue_saturation_tool_register (); - gimp_color_balance_tool_register (); + gimp_posterize_tool_register (gimp); + gimp_curves_tool_register (gimp); + gimp_levels_tool_register (gimp); + gimp_threshold_tool_register (gimp); + gimp_brightness_contrast_tool_register (gimp); + gimp_hue_saturation_tool_register (gimp); + gimp_color_balance_tool_register (gimp); /* paint tools */ - gimp_smudge_tool_register (); - gimp_dodgeburn_tool_register (); - gimp_convolve_tool_register (); - gimp_clone_tool_register (); - gimp_ink_tool_register (); - gimp_airbrush_tool_register (); - gimp_eraser_tool_register (); - gimp_paintbrush_tool_register (); - gimp_pencil_tool_register (); - gimp_blend_tool_register (); - gimp_bucket_fill_tool_register (); - gimp_text_tool_register (); + gimp_smudge_tool_register (gimp); + gimp_dodgeburn_tool_register (gimp); + gimp_convolve_tool_register (gimp); + gimp_clone_tool_register (gimp); + gimp_ink_tool_register (gimp); + gimp_airbrush_tool_register (gimp); + gimp_eraser_tool_register (gimp); + gimp_paintbrush_tool_register (gimp); + gimp_pencil_tool_register (gimp); + gimp_blend_tool_register (gimp); + gimp_bucket_fill_tool_register (gimp); + gimp_text_tool_register (gimp); /* transform tools */ - gimp_flip_tool_register (); - gimp_perspective_tool_register (); - gimp_shear_tool_register (); - gimp_scale_tool_register (); - gimp_rotate_tool_register (); - gimp_crop_tool_register (); - gimp_move_tool_register (); + gimp_flip_tool_register (gimp); + gimp_perspective_tool_register (gimp); + gimp_shear_tool_register (gimp); + gimp_scale_tool_register (gimp); + gimp_rotate_tool_register (gimp); + gimp_crop_tool_register (gimp); + gimp_move_tool_register (gimp); /* non-modifying tools */ - gimp_path_tool_register (); - gimp_measure_tool_register (); - gimp_magnify_tool_register (); - gimp_histogram_tool_register (); - gimp_color_picker_tool_register (); + gimp_path_tool_register (gimp); + gimp_measure_tool_register (gimp); + gimp_magnify_tool_register (gimp); + gimp_histogram_tool_register (gimp); + gimp_color_picker_tool_register (gimp); /* selection tools */ - gimp_bezier_select_tool_register (); - gimp_iscissors_tool_register (); - gimp_by_color_select_tool_register (); - gimp_fuzzy_select_tool_register (); - gimp_free_select_tool_register (); - gimp_ellipse_select_tool_register (); - gimp_rect_select_tool_register (); + gimp_bezier_select_tool_register (gimp); + gimp_iscissors_tool_register (gimp); + gimp_by_color_select_tool_register (gimp); + gimp_fuzzy_select_tool_register (gimp); + gimp_free_select_tool_register (gimp); + gimp_ellipse_select_tool_register (gimp); + gimp_rect_select_tool_register (gimp); } void -tools_exit (void) +tools_exit (Gimp *gimp) { hue_saturation_free (); curves_free (); diff --git a/app/tools/tools.h b/app/tools/tools.h index 946d98e3d4..69bfd1fa47 100644 --- a/app/tools/tools.h +++ b/app/tools/tools.h @@ -20,8 +20,8 @@ #define __TOOLS_H__ -void tools_init (void); -void tools_exit (void); +void tools_init (Gimp *gimp); +void tools_exit (Gimp *gimp); #endif /* __TOOLS_H__ */ diff --git a/app/undo.c b/app/undo.c index 59d69e8107..d474762af2 100644 --- a/app/undo.c +++ b/app/undo.c @@ -36,6 +36,7 @@ #include "core/gimpchannel.h" #include "core/gimpcontainer.h" +#include "core/gimpcoreconfig.h" #include "core/gimpimage.h" #include "core/gimpimage-mask.h" #include "core/gimplayer.h" @@ -54,7 +55,6 @@ #include "gdisplay.h" #include "gdisplay_ops.h" #include "gimpparasite.h" -#include "gimprc.h" #include "parasitelist.h" #include "path_transform.h" #include "undo.h" @@ -314,13 +314,13 @@ static gboolean undo_free_up_space (GimpImage *gimage) { /* If there are 0 levels of undo return FALSE. */ - if (gimprc.levels_of_undo == 0) + if (core_config->levels_of_undo == 0) return FALSE; /* Delete the item on the bottom of the stack if we have the maximum * levels of undo already */ - while (gimage->undo_levels >= gimprc.levels_of_undo) + while (gimage->undo_levels >= core_config->levels_of_undo) gimage->undo_stack = remove_stack_bottom (gimage); return TRUE; diff --git a/app/widgets/gimpdeviceinfo.c b/app/widgets/gimpdeviceinfo.c index fa9a9962c2..d305efc8b1 100644 --- a/app/widgets/gimpdeviceinfo.c +++ b/app/widgets/gimpdeviceinfo.c @@ -301,12 +301,13 @@ devices_init (void) device_info->num_axes = gdk_info->num_axes; device_info->axes = NULL; - device_info->context = gimp_context_new (the_gimp, - device_info->name, NULL); + device_info->context = gimp_create_context (the_gimp, + device_info->name, NULL); gimp_context_define_args (device_info->context, DEVICE_CONTEXT_MASK, FALSE); - gimp_context_copy_args (gimp_context_get_user (), device_info->context, + gimp_context_copy_args (gimp_get_user_context (the_gimp), + device_info->context, DEVICE_CONTEXT_MASK); device_status_context_connect (device_info->context, device_info->device); @@ -331,7 +332,7 @@ devices_restore (void) suppress_update = TRUE; - context = gimp_context_get_user (); + context = gimp_get_user_context (the_gimp); gimp_context_copy_args (device_info->context, context, DEVICE_CONTEXT_MASK); gimp_context_set_parent (device_info->context, context); @@ -389,12 +390,13 @@ devices_rc_update (gchar *name, else device_info->mode = GDK_MODE_DISABLED; - device_info->context = gimp_context_new (the_gimp, - device_info->name, NULL); + device_info->context = gimp_create_context (the_gimp, + device_info->name, NULL); gimp_context_define_args (device_info->context, DEVICE_CONTEXT_MASK, FALSE); - gimp_context_copy_args (gimp_context_get_user (), device_info->context, + gimp_context_copy_args (gimp_get_user_context (the_gimp), + device_info->context, DEVICE_CONTEXT_MASK); device_status_context_connect (device_info->context, device_info->device); @@ -534,7 +536,7 @@ select_device (guint32 new_device) current_device = new_device; - context = gimp_context_get_user (); + context = gimp_get_user_context (the_gimp); gimp_context_copy_args (device_info->context, context, DEVICE_CONTEXT_MASK); gimp_context_set_parent (device_info->context, context); diff --git a/app/widgets/gimpdevices.c b/app/widgets/gimpdevices.c index fa9a9962c2..d305efc8b1 100644 --- a/app/widgets/gimpdevices.c +++ b/app/widgets/gimpdevices.c @@ -301,12 +301,13 @@ devices_init (void) device_info->num_axes = gdk_info->num_axes; device_info->axes = NULL; - device_info->context = gimp_context_new (the_gimp, - device_info->name, NULL); + device_info->context = gimp_create_context (the_gimp, + device_info->name, NULL); gimp_context_define_args (device_info->context, DEVICE_CONTEXT_MASK, FALSE); - gimp_context_copy_args (gimp_context_get_user (), device_info->context, + gimp_context_copy_args (gimp_get_user_context (the_gimp), + device_info->context, DEVICE_CONTEXT_MASK); device_status_context_connect (device_info->context, device_info->device); @@ -331,7 +332,7 @@ devices_restore (void) suppress_update = TRUE; - context = gimp_context_get_user (); + context = gimp_get_user_context (the_gimp); gimp_context_copy_args (device_info->context, context, DEVICE_CONTEXT_MASK); gimp_context_set_parent (device_info->context, context); @@ -389,12 +390,13 @@ devices_rc_update (gchar *name, else device_info->mode = GDK_MODE_DISABLED; - device_info->context = gimp_context_new (the_gimp, - device_info->name, NULL); + device_info->context = gimp_create_context (the_gimp, + device_info->name, NULL); gimp_context_define_args (device_info->context, DEVICE_CONTEXT_MASK, FALSE); - gimp_context_copy_args (gimp_context_get_user (), device_info->context, + gimp_context_copy_args (gimp_get_user_context (the_gimp), + device_info->context, DEVICE_CONTEXT_MASK); device_status_context_connect (device_info->context, device_info->device); @@ -534,7 +536,7 @@ select_device (guint32 new_device) current_device = new_device; - context = gimp_context_get_user (); + context = gimp_get_user_context (the_gimp); gimp_context_copy_args (device_info->context, context, DEVICE_CONTEXT_MASK); gimp_context_set_parent (device_info->context, context); diff --git a/app/widgets/gimpgradienteditor.c b/app/widgets/gimpgradienteditor.c index 0d3662b01d..5f5d701d95 100644 --- a/app/widgets/gimpgradienteditor.c +++ b/app/widgets/gimpgradienteditor.c @@ -540,7 +540,7 @@ gradient_editor_new (void) gradient_editor = g_new (GradientEditor, 1); - gradient_editor->context = gimp_context_new (the_gimp, NULL, NULL); + gradient_editor->context = gimp_create_context (the_gimp, NULL, NULL); gtk_signal_connect (GTK_OBJECT (gradient_editor->context), "gradient_changed", GTK_SIGNAL_FUNC (gradient_editor_gradient_changed), @@ -1409,7 +1409,7 @@ preview_set_foreground (GradientEditor *gradient_editor, (gimp_context_get_gradient (gradient_editor->context), xpos, &color); - gimp_context_set_foreground (gimp_context_get_user (), &color); + gimp_context_set_foreground (gimp_get_user_context (gradient_editor->context->gimp), &color); str = g_strdup_printf (_("Foreground color set to RGB (%d, %d, %d) <-> " "(%0.3f, %0.3f, %0.3f)"), @@ -1435,7 +1435,7 @@ preview_set_background (GradientEditor *gradient_editor, (gimp_context_get_gradient (gradient_editor->context), xpos, &color); - gimp_context_set_background (gimp_context_get_user (), &color); + gimp_context_set_background (gimp_get_user_context (gradient_editor->context->gimp), &color); str = g_strdup_printf (_("Background color to RGB (%d, %d, %d) <-> " "(%0.3f, %0.3f, %0.3f)"), @@ -2836,7 +2836,7 @@ cpopup_adjust_menus (GradientEditor *gradient_editor) /* Render Foreground color boxes */ - gimp_context_get_foreground (gimp_context_get_user (), &fg); + gimp_context_get_foreground (gimp_get_user_context (gradient_editor->context->gimp), &fg); cpopup_render_color_box (GTK_PREVIEW (gradient_editor->left_load_color_boxes[2]), &fg); @@ -3284,7 +3284,7 @@ cpopup_load_left_callback (GtkWidget *widget, break; case 2: /* Fetch from FG color */ - gimp_context_get_foreground (gimp_context_get_user (), &fg); + gimp_context_get_foreground (gimp_get_user_context (gradient_editor->context->gimp), &fg); cpopup_blend_endpoints (gradient_editor, &fg, &gradient_editor->control_sel_r->right_color, @@ -3350,7 +3350,7 @@ cpopup_load_right_callback (GtkWidget *widget, break; case 2: /* Fetch from FG color */ - gimp_context_get_foreground (gimp_context_get_user (), &fg); + gimp_context_get_foreground (gimp_get_user_context (gradient_editor->context->gimp), &fg); cpopup_blend_endpoints (gradient_editor, &gradient_editor->control_sel_l->left_color, &fg, diff --git a/app/widgets/gimpitemfactory.c b/app/widgets/gimpitemfactory.c index 2cee76b2cc..d4cf833cae 100644 --- a/app/widgets/gimpitemfactory.c +++ b/app/widgets/gimpitemfactory.c @@ -2252,7 +2252,7 @@ menus_init (void) } /* reorder /Image/Colors */ - tool_info = tool_manager_get_info_by_type (GIMP_TYPE_POSTERIZE_TOOL); + tool_info = tool_manager_get_info_by_type (the_gimp, GIMP_TYPE_POSTERIZE_TOOL); menu_item = gtk_item_factory_get_widget (image_factory, tool_info->menu_path); @@ -2275,7 +2275,7 @@ menus_init (void) for (i = 0; i < n_color_tools; i++) { - tool_info = tool_manager_get_info_by_type (color_tools[i]); + tool_info = tool_manager_get_info_by_type (the_gimp, color_tools[i]); menu_item = gtk_item_factory_get_widget (image_factory, tool_info->menu_path); diff --git a/app/widgets/gimppaletteeditor.c b/app/widgets/gimppaletteeditor.c index 362bf04bc1..33ce5d4ab1 100644 --- a/app/widgets/gimppaletteeditor.c +++ b/app/widgets/gimppaletteeditor.c @@ -271,9 +271,9 @@ palette_set_active_color (gint r, } if (active_color == FOREGROUND) - gimp_context_set_foreground (gimp_context_get_user (), &color); + gimp_context_set_foreground (gimp_get_user_context (the_gimp), &color); else if (active_color == BACKGROUND) - gimp_context_set_background (gimp_context_get_user (), &color); + gimp_context_set_background (gimp_get_user_context (the_gimp), &color); } /* called from palette_select.c ********************************************/ @@ -327,9 +327,9 @@ palette_dialog_new (gboolean editor) palette_dialog = g_new0 (PaletteDialog, 1); if (! editor) - palette_dialog->context = gimp_context_get_user (); + palette_dialog->context = gimp_get_user_context (the_gimp); else - palette_dialog->context = gimp_context_new (the_gimp, NULL, NULL); + palette_dialog->context = gimp_create_context (the_gimp, NULL, NULL); palette_dialog->zoom_factor = 1.0; palette_dialog->columns = COLUMNS; @@ -597,9 +597,9 @@ palette_dialog_new_entry_callback (GtkWidget *widget, return; if (active_color == FOREGROUND) - gimp_context_get_foreground (gimp_context_get_user (), &color); + gimp_context_get_foreground (gimp_get_user_context (the_gimp), &color); else if (active_color == BACKGROUND) - gimp_context_get_background (gimp_context_get_user (), &color); + gimp_context_get_background (gimp_get_user_context (the_gimp), &color); palette_dialog->color = gimp_palette_add_entry (gimp_context_get_palette (palette_dialog->context), @@ -684,9 +684,11 @@ palette_dialog_color_notebook_callback (ColorNotebook *color_notebook, /* Update either foreground or background colors */ if (active_color == FOREGROUND) - gimp_context_set_foreground (gimp_context_get_user (), color); + gimp_context_set_foreground (gimp_get_user_context (the_gimp), + color); else if (active_color == BACKGROUND) - gimp_context_set_background (gimp_context_get_user (), color); + gimp_context_set_background (gimp_get_user_context (the_gimp), + color); gimp_data_dirty (GIMP_DATA (palette)); } @@ -779,19 +781,19 @@ palette_dialog_color_area_events (GtkWidget *widget, if (active_color == FOREGROUND) { if (bevent->state & GDK_CONTROL_MASK) - gimp_context_set_background (gimp_context_get_user (), + gimp_context_set_background (gimp_get_user_context (the_gimp), &palette_dialog->color->color); else - gimp_context_set_foreground (gimp_context_get_user (), + gimp_context_set_foreground (gimp_get_user_context (the_gimp), &palette_dialog->color->color); } else if (active_color == BACKGROUND) { if (bevent->state & GDK_CONTROL_MASK) - gimp_context_set_foreground (gimp_context_get_user (), + gimp_context_set_foreground (gimp_get_user_context (the_gimp), &palette_dialog->color->color); else - gimp_context_set_background (gimp_context_get_user (), + gimp_context_set_background (gimp_get_user_context (the_gimp), &palette_dialog->color->color); } diff --git a/app/widgets/gimptoolbox-color-area.c b/app/widgets/gimptoolbox-color-area.c index 5d0455c641..d78f0889a6 100644 --- a/app/widgets/gimptoolbox-color-area.c +++ b/app/widgets/gimptoolbox-color-area.c @@ -30,12 +30,15 @@ #include "core/core-types.h" +#include "core/gimp.h" #include "core/gimpcontext.h" #include "widgets/gimpdnd.h" #include "color-area.h" #include "color-notebook.h" + +#include "app_procs.h" #include "gdisplay.h" #ifdef DISPLAY_FILTERS @@ -219,7 +222,7 @@ color_area_draw (void) gdk_gc_set_foreground (mask_gc, &mask_pattern); /* draw the background area */ - gimp_context_get_background (gimp_context_get_user (), &color); + gimp_context_get_background (gimp_get_user_context (the_gimp), &color); gimp_rgb_get_uchar (&color, &r, &g, &b); color_area_draw_rect (color_area_pixmap, color_area_gc, (width - rect_w), (height - rect_h), rect_w, rect_h, @@ -237,7 +240,7 @@ color_area_draw (void) (width - rect_w), (height - rect_h), rect_w, rect_h); /* draw the foreground area */ - gimp_context_get_foreground (gimp_context_get_user (), &color); + gimp_context_get_foreground (gimp_get_user_context (the_gimp), &color); gimp_rgb_get_uchar (&color, &r, &g, &b); color_area_draw_rect (color_area_pixmap, color_area_gc, 0, 0, rect_w, rect_h, @@ -294,15 +297,19 @@ color_area_select_callback (ColorNotebook *color_notebook, /* Fallthrough */ case COLOR_NOTEBOOK_UPDATE: if (edit_color == FOREGROUND) - gimp_context_set_foreground (gimp_context_get_user (), color); + gimp_context_set_foreground (gimp_get_user_context (the_gimp), + color); else - gimp_context_set_background (gimp_context_get_user (), color); + gimp_context_set_background (gimp_get_user_context (the_gimp), + color); break; case COLOR_NOTEBOOK_CANCEL: color_notebook_hide (color_notebook); color_notebook_active = FALSE; - gimp_context_set_foreground (gimp_context_get_user (), &revert_fg); - gimp_context_set_background (gimp_context_get_user (), &revert_bg); + gimp_context_set_foreground (gimp_get_user_context (the_gimp), + &revert_fg); + gimp_context_set_background (gimp_get_user_context (the_gimp), + &revert_bg); } } } @@ -313,7 +320,7 @@ color_area_edit (void) GimpContext *user_context; GimpRGB color; - user_context = gimp_context_get_user (); + user_context = gimp_get_user_context (the_gimp); if (! color_notebook_active) { @@ -414,10 +421,10 @@ color_area_events (GtkWidget *widget, } break; case SWAP_AREA: - gimp_context_swap_colors (gimp_context_get_user ()); + gimp_context_swap_colors (gimp_get_user_context (the_gimp)); break; case DEF_AREA: - gimp_context_set_default_colors (gimp_context_get_user ()); + gimp_context_set_default_colors (gimp_get_user_context (the_gimp)); break; default: break; @@ -512,11 +519,11 @@ color_area_create (gint width, GDK_ACTION_COPY); gimp_dnd_color_dest_set (color_area, color_area_drop_color, NULL); - gtk_signal_connect (GTK_OBJECT (gimp_context_get_user ()), + gtk_signal_connect (GTK_OBJECT (gimp_get_user_context (the_gimp)), "foreground_changed", GTK_SIGNAL_FUNC (color_area_color_changed), color_area); - gtk_signal_connect (GTK_OBJECT (gimp_context_get_user ()), + gtk_signal_connect (GTK_OBJECT (gimp_get_user_context (the_gimp)), "background_changed", GTK_SIGNAL_FUNC (color_area_color_changed), color_area); @@ -539,9 +546,9 @@ color_area_drag_color (GtkWidget *widget, gpointer data) { if (active_color == FOREGROUND) - gimp_context_get_foreground (gimp_context_get_user (), color); + gimp_context_get_foreground (gimp_get_user_context (the_gimp), color); else - gimp_context_get_background (gimp_context_get_user (), color); + gimp_context_get_background (gimp_get_user_context (the_gimp), color); } static void @@ -557,9 +564,9 @@ color_area_drop_color (GtkWidget *widget, else { if (active_color == FOREGROUND) - gimp_context_set_foreground (gimp_context_get_user (), color); + gimp_context_set_foreground (gimp_get_user_context (the_gimp), color); else - gimp_context_set_background (gimp_context_get_user (), color); + gimp_context_set_background (gimp_get_user_context (the_gimp), color); } } diff --git a/app/widgets/gimptoolbox.c b/app/widgets/gimptoolbox.c index 81d0ad4e17..b349d6bf84 100644 --- a/app/widgets/gimptoolbox.c +++ b/app/widgets/gimptoolbox.c @@ -128,7 +128,7 @@ toolbox_tool_button_toggled (GtkWidget *widget, tool_info = GIMP_TOOL_INFO (data); if ((tool_info) && GTK_TOGGLE_BUTTON (widget)->active) - gimp_context_set_tool (gimp_context_get_user (), tool_info); + gimp_context_set_tool (gimp_get_user_context (the_gimp), tool_info); } static gint @@ -410,9 +410,9 @@ toolbox_create (void) gtk_box_pack_start (GTK_BOX (main_vbox), wbox, TRUE, TRUE, 0); gtk_widget_show (wbox); - create_tools (wbox, gimp_context_get_user ()); + create_tools (wbox, gimp_get_user_context (the_gimp)); - gtk_signal_connect_while_alive (GTK_OBJECT (gimp_context_get_user ()), + gtk_signal_connect_while_alive (GTK_OBJECT (gimp_get_user_context (the_gimp)), "tool_changed", GTK_SIGNAL_FUNC (toolbox_tool_changed), NULL, @@ -421,7 +421,7 @@ toolbox_create (void) create_color_area (wbox); if (gimprc.show_indicators) - create_indicator_area (wbox, gimp_context_get_user ()); + create_indicator_area (wbox, gimp_get_user_context (the_gimp)); gtk_drag_dest_set (window, GTK_DEST_DEFAULT_ALL, @@ -578,7 +578,8 @@ toolbox_drop_tool (GtkWidget *widget, GimpViewable *viewable, gpointer data) { - gimp_context_set_tool (gimp_context_get_user (), GIMP_TOOL_INFO (viewable)); + gimp_context_set_tool (gimp_get_user_context (the_gimp), + GIMP_TOOL_INFO (viewable)); } static void diff --git a/app/widgets/gimptooloptionseditor.c b/app/widgets/gimptooloptionseditor.c index a2a4396001..e50ad44dd7 100644 --- a/app/widgets/gimptooloptionseditor.c +++ b/app/widgets/gimptooloptionseditor.c @@ -24,6 +24,7 @@ #include "tools/tools-types.h" +#include "core/gimp.h" #include "core/gimpcontext.h" #include "core/gimplist.h" #include "core/gimptoolinfo.h" @@ -38,6 +39,7 @@ #include "tool-options-dialog.h" +#include "app_procs.h" #include "dialog_handler.h" #include "libgimp/gimpintl.h" @@ -84,7 +86,7 @@ tool_options_dialog_create (void) if (options_shell) return options_shell; - tool_info = gimp_context_get_tool (gimp_context_get_user ()); + tool_info = gimp_context_get_tool (gimp_get_user_context (the_gimp)); if (! tool_info) { @@ -173,14 +175,14 @@ tool_options_dialog_create (void) tool_options_dialog_drag_tool, NULL); gtk_signal_connect_while_alive - (GTK_OBJECT (gimp_context_get_user ()), "tool_changed", + (GTK_OBJECT (gimp_get_user_context (the_gimp)), "tool_changed", GTK_SIGNAL_FUNC (tool_options_dialog_tool_changed), NULL, GTK_OBJECT (options_shell)); - tool_info = gimp_context_get_tool (gimp_context_get_user ()); + tool_info = gimp_context_get_tool (gimp_get_user_context (the_gimp)); - tool_options_dialog_tool_changed (gimp_context_get_user (), + tool_options_dialog_tool_changed (gimp_get_user_context (the_gimp), tool_info, NULL); @@ -254,14 +256,15 @@ tool_options_dialog_drop_tool (GtkWidget *widget, GimpViewable *viewable, gpointer data) { - gimp_context_set_tool (gimp_context_get_user (), GIMP_TOOL_INFO (viewable)); + gimp_context_set_tool (gimp_get_user_context (the_gimp), + GIMP_TOOL_INFO (viewable)); } GimpViewable * tool_options_dialog_drag_tool (GtkWidget *widget, gpointer data) { - return (GimpViewable *) gimp_context_get_tool (gimp_context_get_user ()); + return (GimpViewable *) gimp_context_get_tool (gimp_get_user_context (the_gimp)); } static void @@ -287,7 +290,7 @@ tool_options_dialog_reset_callback (GtkWidget *widget, if (! active_tool) return; - tool_info = tool_manager_get_info_by_tool (active_tool); + tool_info = tool_manager_get_info_by_tool (the_gimp, active_tool); if (! tool_info) { -- GitLab