From f235eabbf185e76d7cd58f7403f8aad310d813c5 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Tue, 25 Sep 2001 23:23:09 +0000 Subject: [PATCH] app/Makefile.am app/disp_callbacks.[ch] app/gdisplay.[ch] 2001-09-26 Michael Natterer * app/Makefile.am * app/disp_callbacks.[ch] * app/gdisplay.[ch] * app/gdisplay_ops.[ch] * app/gximage.[ch] * app/image_render.[ch] * app/interface.[ch] * app/marching_ants.h * app/scale.[ch] * app/scroll.[ch] * app/selection.[ch]: removed. * app/display/Makefile.am * app/display/display-types.h * app/display/gimpdisplay-callbacks.[ch] * app/display/gimpdisplay-marching-ants.h * app/display/gimpdisplay-ops.[ch] * app/display/gimpdisplay-render.[ch] * app/display/gimpdisplay-scale.[ch] * app/display/gimpdisplay-scroll.[ch] * app/display/gimpdisplay-selection.[ch] * app/display/gimpdisplay.[ch] * app/display/gimpdisplayshell.[ch] * app/display/gximage.[ch]: added here. * app/[many files] * app/gui/[many files] * app/tools/* * app/widgets/[many files]: changed accordingly. Still very incomplete separation of the display stuff but it at least compiles. * tools/pdbgen/pdb.pl: * tools/pdbgen/pdb/display.pdb: s/GDisplay/GimpDisplay/, s/"gdisplay.h"/"display/gimpdisplay.h"/. * app/pdb/display_cmds.c: regenerated. --- ChangeLog | 41 +- app/Makefile.am | 22 - app/actions/channels-commands.c | 3 +- app/actions/edit-commands.c | 4 +- app/actions/file-commands.c | 7 +- app/actions/image-commands.c | 3 +- app/actions/layers-commands.c | 5 +- app/actions/plug-in-commands.c | 5 +- app/actions/qmask-commands.c | 3 +- app/actions/quick-mask-commands.c | 3 +- app/actions/select-commands.c | 4 +- app/actions/tools-commands.c | 5 +- app/actions/view-commands.c | 9 +- app/app_procs.c | 3 +- app/base/color-balance.c | 3 +- app/base/curves.c | 3 +- app/base/hue-saturation.c | 3 +- app/base/threshold.c | 3 +- app/core/gimp-transform-region.c | 4 +- app/core/gimpdrawable-blend.c | 3 +- app/core/gimpdrawable-transform.c | 4 +- app/core/gimpimage-pick-color.c | 4 +- app/core/gimpimage-qmask.c | 3 +- app/core/gimpimage-quick-mask.c | 3 +- app/core/gimpimage-undo-push.c | 6 +- app/core/gimpimagemap.c | 3 +- app/core/gimpprojection.c | 23 +- app/core/gimpprojection.h | 5 +- app/dialogs/convert-dialog.c | 3 +- app/dialogs/file-dialog-utils.c | 3 +- app/dialogs/image-new-dialog.c | 3 +- app/dialogs/info-window.c | 4 +- app/dialogs/offset-dialog.c | 4 +- app/dialogs/preferences-dialog.c | 9 +- app/dialogs/user-install-dialog.c | 5 +- app/disp_callbacks.c | 1076 ------- app/disp_callbacks.h | 67 - app/display/Makefile.am | 44 +- app/display/display-types.h | 2 +- app/display/gimpdisplay-callbacks.c | 15 +- app/display/gimpdisplay-ops.c | 6 +- app/display/gimpdisplay-ops.h | 9 +- app/display/gimpdisplay-render.c | 11 +- app/display/gimpdisplay-scale.c | 10 +- app/display/gimpdisplay-scroll.c | 9 +- app/display/gimpdisplay-selection.c | 11 +- app/display/gimpdisplay.c | 23 +- app/display/gimpdisplay.h | 5 +- app/display/gimpdisplayshell-callbacks.c | 15 +- app/display/gimpdisplayshell-draw.c | 12 +- app/display/gimpdisplayshell-layer-select.c | 6 +- app/display/gimpdisplayshell-qmask.c | 3 +- app/display/gimpdisplayshell-render.c | 11 +- app/display/gimpdisplayshell-scale.c | 10 +- app/display/gimpdisplayshell-scroll.c | 9 +- app/display/gimpdisplayshell-selection.c | 11 +- app/display/gimpdisplayshell.c | 12 +- app/display/gimpnavigationeditor.c | 7 +- app/display/gimpnavigationview.c | 7 +- app/display/gimpprogress.c | 3 +- app/docindex.c | 3 +- app/gdisplay.c | 2851 ------------------- app/gdisplay.h | 339 --- app/gdisplay_ops.c | 321 --- app/gdisplay_ops.h | 40 - app/gimpprogress.c | 3 +- app/gimprc.c | 4 +- app/gui/channels-commands.c | 3 +- app/gui/color-area.c | 1 - app/gui/colormap-dialog.c | 3 +- app/gui/convert-dialog.c | 3 +- app/gui/edit-commands.c | 4 +- app/gui/file-commands.c | 7 +- app/gui/file-dialog-utils.c | 3 +- app/gui/file-new-dialog.c | 3 +- app/gui/gui.c | 9 +- app/gui/image-commands.c | 3 +- app/gui/info-window.c | 4 +- app/gui/layer-select.c | 6 +- app/gui/layers-commands.c | 5 +- app/gui/menus.c | 5 +- app/gui/offset-dialog.c | 4 +- app/gui/paths-dialog.c | 7 +- app/gui/plug-in-commands.c | 5 +- app/gui/plug-in-menus.c | 5 +- app/gui/preferences-dialog.c | 9 +- app/gui/qmask-commands.c | 3 +- app/gui/select-commands.c | 4 +- app/gui/toolbox.c | 3 +- app/gui/tools-commands.c | 5 +- app/gui/user-install-dialog.c | 5 +- app/gui/view-commands.c | 9 +- app/gximage.c | 136 - app/gximage.h | 34 - app/image_map.c | 3 +- app/image_render.c | 890 ------ app/image_render.h | 43 - app/interface.c | 578 ---- app/interface.h | 30 - app/marching_ants.h | 90 - app/menus/menus.c | 5 +- app/menus/plug-in-menus.c | 5 +- app/nav_window.c | 7 +- app/paint/gimpairbrush.c | 4 +- app/paint/gimpclone.c | 4 +- app/paint/gimpconvolve.c | 2 - app/paint/gimpdodgeburn.c | 2 - app/paint/gimperaser.c | 2 - app/paint/gimpink.c | 3 +- app/paint/gimppaintbrush.c | 2 - app/paint/gimppaintcore.c | 3 +- app/paint/gimppencil.c | 2 - app/paint/gimpsmudge.c | 2 - app/paint/gimpsourcecore.c | 4 +- app/path.c | 6 +- app/pdb/display_cmds.c | 6 +- app/pdb/internal_procs.c | 2 +- app/plug-in/gimpplugin-message.c | 5 +- app/plug-in/gimpplugin-progress.c | 5 +- app/plug-in/gimpplugin.c | 5 +- app/plug-in/gimppluginmanager-call.c | 5 +- app/plug-in/gimppluginmanager-run.c | 5 +- app/plug-in/gimppluginmanager.c | 5 +- app/plug-in/gimppluginshm.c | 5 +- app/plug-in/plug-in-def.c | 5 +- app/plug-in/plug-in-message.c | 5 +- app/plug-in/plug-in-params.c | 5 +- app/plug-in/plug-in-progress.c | 5 +- app/plug-in/plug-in-run.c | 5 +- app/plug-in/plug-in-shm.c | 5 +- app/plug-in/plug-in.c | 5 +- app/plug-in/plug-ins.c | 5 +- app/plug_in.c | 5 +- app/qmask.c | 3 +- app/scale.c | 284 -- app/scale.h | 33 - app/scroll.c | 227 -- app/scroll.h | 39 - app/selection.c | 784 ----- app/selection.h | 78 - app/tools/gimpairbrushtool.c | 4 +- app/tools/gimpbezierselecttool.c | 3 +- app/tools/gimpblendtool.c | 3 +- app/tools/gimpbrightnesscontrasttool.c | 3 +- app/tools/gimpbrushtool.c | 3 +- app/tools/gimpbucketfilltool.c | 3 +- app/tools/gimpbycolorselecttool.c | 3 +- app/tools/gimpclonetool.c | 4 +- app/tools/gimpcolorbalancetool.c | 3 +- app/tools/gimpcolorpickertool.c | 4 +- app/tools/gimpconvolvetool.c | 2 - app/tools/gimpcroptool.c | 4 +- app/tools/gimpcurvestool.c | 3 +- app/tools/gimpdodgeburntool.c | 2 - app/tools/gimpdrawtool.c | 4 +- app/tools/gimpeditselectiontool.c | 5 +- app/tools/gimpellipseselecttool.c | 3 +- app/tools/gimperasertool.c | 2 - app/tools/gimpfliptool.c | 5 +- app/tools/gimpfreeselecttool.c | 3 +- app/tools/gimpfuzzyselecttool.c | 3 +- app/tools/gimphistogramtool.c | 3 +- app/tools/gimphuesaturationtool.c | 3 +- app/tools/gimpinktool.c | 3 +- app/tools/gimpiscissorstool.c | 4 +- app/tools/gimplevelstool.c | 3 +- app/tools/gimpmagnifytool.c | 5 +- app/tools/gimpmeasuretool.c | 4 +- app/tools/gimpmovetool.c | 5 +- app/tools/gimppaintbrushtool.c | 2 - app/tools/gimppainttool.c | 3 +- app/tools/gimppathtool.c | 7 +- app/tools/gimppenciltool.c | 2 - app/tools/gimpperspectivetool.c | 9 +- app/tools/gimpposterizetool.c | 3 +- app/tools/gimprectselecttool.c | 3 +- app/tools/gimpregionselecttool.c | 3 +- app/tools/gimprotatetool.c | 11 +- app/tools/gimpscaletool.c | 4 +- app/tools/gimpselectiontool.c | 4 +- app/tools/gimpsheartool.c | 11 +- app/tools/gimpsmudgetool.c | 2 - app/tools/gimpsourcetool.c | 4 +- app/tools/gimptexttool.c | 6 +- app/tools/gimpthresholdtool.c | 3 +- app/tools/gimptool.c | 3 +- app/tools/gimptransformtool.c | 4 +- app/tools/gimptransformtool.h | 4 + app/tools/tool_manager.c | 3 +- app/undo.c | 6 +- app/user_install.c | 5 +- app/widgets/gimpbufferview.c | 4 +- app/widgets/gimpchannellistitem.c | 6 +- app/widgets/gimpchannellistitem.h | 3 +- app/widgets/gimpchannellistview.c | 4 +- app/widgets/gimpchanneltreeview.c | 4 +- app/widgets/gimpcolormapeditor.c | 3 +- app/widgets/gimpcomponentlistitem.c | 4 +- app/widgets/gimpdrawablelistitem.c | 4 +- app/widgets/gimpdrawablelistview.c | 4 +- app/widgets/gimpdrawabletreeview.c | 4 +- app/widgets/gimpitemfactory.c | 5 +- app/widgets/gimpitemlistview.c | 4 +- app/widgets/gimpitemtreeview.c | 4 +- app/widgets/gimplayerlistitem.c | 4 +- app/widgets/gimplayerlistview.c | 4 +- app/widgets/gimplayertreeview.c | 4 +- app/widgets/gimppreview.c | 5 +- app/widgets/gimppreviewrenderer.c | 5 +- app/widgets/gimptoolbox-color-area.c | 1 - app/widgets/gimptoolbox.c | 3 +- app/widgets/gimpview.c | 5 +- app/widgets/gimpviewrenderer.c | 5 +- app/widgets/widgets-types.h | 2 +- tools/pdbgen/pdb.pl | 4 +- tools/pdbgen/pdb/display.pdb | 4 +- 216 files changed, 574 insertions(+), 8410 deletions(-) delete mode 100644 app/disp_callbacks.c delete mode 100644 app/disp_callbacks.h delete mode 100644 app/gdisplay.c delete mode 100644 app/gdisplay.h delete mode 100644 app/gdisplay_ops.c delete mode 100644 app/gdisplay_ops.h delete mode 100644 app/gximage.c delete mode 100644 app/gximage.h delete mode 100644 app/image_render.c delete mode 100644 app/image_render.h delete mode 100644 app/interface.c delete mode 100644 app/interface.h delete mode 100644 app/marching_ants.h delete mode 100644 app/scale.c delete mode 100644 app/scale.h delete mode 100644 app/scroll.c delete mode 100644 app/scroll.h delete mode 100644 app/selection.c delete mode 100644 app/selection.h diff --git a/ChangeLog b/ChangeLog index 6919ac1621..9fd425b18c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,43 @@ +2001-09-26 Michael Natterer + + * app/Makefile.am + * app/disp_callbacks.[ch] + * app/gdisplay.[ch] + * app/gdisplay_ops.[ch] + * app/gximage.[ch] + * app/image_render.[ch] + * app/interface.[ch] + * app/marching_ants.h + * app/scale.[ch] + * app/scroll.[ch] + * app/selection.[ch]: removed. + + * app/display/Makefile.am + * app/display/display-types.h + * app/display/gimpdisplay-callbacks.[ch] + * app/display/gimpdisplay-marching-ants.h + * app/display/gimpdisplay-ops.[ch] + * app/display/gimpdisplay-render.[ch] + * app/display/gimpdisplay-scale.[ch] + * app/display/gimpdisplay-scroll.[ch] + * app/display/gimpdisplay-selection.[ch] + * app/display/gimpdisplay.[ch] + * app/display/gimpdisplayshell.[ch] + * app/display/gximage.[ch]: added here. + + * app/[many files] + * app/gui/[many files] + * app/tools/* + * app/widgets/[many files]: changed accordingly. Still very + incomplete separation of the display stuff but it at least + compiles. + + * tools/pdbgen/pdb.pl: + * tools/pdbgen/pdb/display.pdb: s/GDisplay/GimpDisplay/, + s/"gdisplay.h"/"display/gimpdisplay.h"/. + + * app/pdb/display_cmds.c: regenerated. + 2001-09-25 Michael Natterer * app/gdisplay.[ch]: renamed it to GimpDisplay and made it a @@ -46,7 +86,6 @@ caused segfaults on images with a width of exactly 64. Bug is present in 1.2.2; fix should be committed to stable after it is tested. - 2001-09-23 Sven Neumann * plug-ins/Makefile.am: reenabled build of ifscompose. We should port diff --git a/app/Makefile.am b/app/Makefile.am index 6e6ab49743..995fe96287 100644 --- a/app/Makefile.am +++ b/app/Makefile.am @@ -27,28 +27,6 @@ gimp_SOURCES = @STRIP_BEGIN@ \ undo_history.c \ undo_history.h \ ## -## display stuff -## - disp_callbacks.c \ - disp_callbacks.h \ - gdisplay.c \ - gdisplay.h \ - gdisplay_ops.c \ - gdisplay_ops.h \ - gximage.c \ - gximage.h \ - image_render.c \ - image_render.h \ - interface.c \ - interface.h \ - scale.c \ - scale.h \ - scroll.c \ - scroll.h \ - selection.c \ - selection.h \ - marching_ants.h \ -## ## stuff that needs to be split up in core / ui files ## image_map.c \ diff --git a/app/actions/channels-commands.c b/app/actions/channels-commands.c index 56635242b4..0d5ea7bd29 100644 --- a/app/actions/channels-commands.c +++ b/app/actions/channels-commands.c @@ -31,11 +31,12 @@ #include "core/gimpimage-mask.h" #include "core/gimplist.h" +#include "display/gimpdisplay.h" + #include "widgets/gimpcolorpanel.h" #include "widgets/gimpwidgets-utils.h" #include "channels-commands.h" -#include "gdisplay.h" #include "menus.h" #include "app_procs.h" diff --git a/app/actions/edit-commands.c b/app/actions/edit-commands.c index 9bf3bbdda3..12b03ff35d 100644 --- a/app/actions/edit-commands.c +++ b/app/actions/edit-commands.c @@ -22,7 +22,6 @@ #include "libgimpwidgets/gimpwidgets.h" -#include "core/core-types.h" #include "tools/tools-types.h" #include "core/gimp.h" @@ -34,6 +33,8 @@ #include "core/gimpimage.h" #include "core/gimpimage-mask.h" +#include "display/gimpdisplay.h" + #include "tools/tool_manager.h" #include "widgets/gimpdialogfactory.h" @@ -41,7 +42,6 @@ #include "dialogs.h" #include "edit-commands.h" -#include "gdisplay.h" #include "undo.h" #include "libgimp/gimpintl.h" diff --git a/app/actions/file-commands.c b/app/actions/file-commands.c index 363c31936a..2ff96b6ecb 100644 --- a/app/actions/file-commands.c +++ b/app/actions/file-commands.c @@ -22,11 +22,14 @@ #include "libgimpwidgets/gimpwidgets.h" -#include "core/core-types.h" +#include "display/display-types.h" #include "core/gimpimage.h" #include "core/gimpobject.h" +#include "display/gimpdisplay.h" +#include "display/gimpdisplay-ops.h" + #include "file-commands.h" #include "file-new-dialog.h" #include "file-open-dialog.h" @@ -36,8 +39,6 @@ #include "app_procs.h" #include "file-open.h" #include "file-save.h" -#include "gdisplay.h" -#include "gdisplay_ops.h" #include "gimprc.h" #include "undo.h" diff --git a/app/actions/image-commands.c b/app/actions/image-commands.c index 5026c2f111..4ff53b98f3 100644 --- a/app/actions/image-commands.c +++ b/app/actions/image-commands.c @@ -33,11 +33,12 @@ #include "pdb/procedural_db.h" +#include "display/gimpdisplay.h" + #include "convert-dialog.h" #include "offset-dialog.h" #include "resize-dialog.h" -#include "gdisplay.h" #include "undo.h" #include "libgimp/gimpintl.h" diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c index d1ea904922..1e422c3d1f 100644 --- a/app/actions/layers-commands.c +++ b/app/actions/layers-commands.c @@ -26,7 +26,7 @@ #include "libgimpbase/gimpbase.h" #include "libgimpwidgets/gimpwidgets.h" -#include "core/core-types.h" +#include "gui-types.h" #include "paint-funcs/paint-funcs.h" @@ -37,6 +37,8 @@ #include "core/gimplayermask.h" #include "core/gimplist.h" +#include "display/gimpdisplay.h" + #include "widgets/gimpwidgets-utils.h" #include "layers-commands.h" @@ -44,7 +46,6 @@ #include "resize-dialog.h" #include "app_procs.h" -#include "gdisplay.h" #include "floating_sel.h" #include "undo.h" diff --git a/app/actions/plug-in-commands.c b/app/actions/plug-in-commands.c index 8cfc5af24f..12b9886464 100644 --- a/app/actions/plug-in-commands.c +++ b/app/actions/plug-in-commands.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "core/core-types.h" +#include "display/display-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -95,11 +95,12 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "display/gimpdisplay.h" + #include "gui/brush-select.h" #include "gui/gradient-select.h" #include "gui/menus.h" #include "gui/pattern-select.h" -#include "gdisplay.h" #include "app_procs.h" #include "appenv.h" diff --git a/app/actions/qmask-commands.c b/app/actions/qmask-commands.c index baf09dd1a5..07da95f3d0 100644 --- a/app/actions/qmask-commands.c +++ b/app/actions/qmask-commands.c @@ -35,11 +35,12 @@ #include "core/gimpimage.h" #include "core/gimpimage-mask.h" +#include "display/gimpdisplay.h" + #include "widgets/gimpcolorpanel.h" #include "app_procs.h" #include "floating_sel.h" -#include "gdisplay.h" #include "qmask.h" #include "undo.h" diff --git a/app/actions/quick-mask-commands.c b/app/actions/quick-mask-commands.c index baf09dd1a5..07da95f3d0 100644 --- a/app/actions/quick-mask-commands.c +++ b/app/actions/quick-mask-commands.c @@ -35,11 +35,12 @@ #include "core/gimpimage.h" #include "core/gimpimage-mask.h" +#include "display/gimpdisplay.h" + #include "widgets/gimpcolorpanel.h" #include "app_procs.h" #include "floating_sel.h" -#include "gdisplay.h" #include "qmask.h" #include "undo.h" diff --git a/app/actions/select-commands.c b/app/actions/select-commands.c index 8c3eaf6413..d1903ba479 100644 --- a/app/actions/select-commands.c +++ b/app/actions/select-commands.c @@ -23,12 +23,12 @@ #include "libgimpmath/gimpmath.h" #include "libgimpwidgets/gimpwidgets.h" -#include "core/core-types.h" +#include "gui-types.h" #include "core/gimpimage.h" #include "core/gimpimage-mask.h" -#include "gdisplay.h" +#include "display/gimpdisplay.h" #include "libgimp/gimpintl.h" diff --git a/app/actions/tools-commands.c b/app/actions/tools-commands.c index 1bd591d9e8..d7dcc9a5d3 100644 --- a/app/actions/tools-commands.c +++ b/app/actions/tools-commands.c @@ -20,17 +20,18 @@ #include -#include "tools/tools-types.h" +#include "gui-types.h" #include "core/gimp.h" #include "core/gimpcontext.h" #include "core/gimpimage.h" +#include "display/gimpdisplay.h" + #include "tools/gimptool.h" #include "tools/tool_manager.h" #include "app_procs.h" -#include "gdisplay.h" #define return_if_no_display(gdisp) \ diff --git a/app/actions/view-commands.c b/app/actions/view-commands.c index be51306a33..edd33cb09d 100644 --- a/app/actions/view-commands.c +++ b/app/actions/view-commands.c @@ -26,16 +26,17 @@ #include "core/gimpimage.h" +#include "display/gimpdisplay.h" +#include "display/gimpdisplay-ops.h" +#include "display/gimpdisplay-scale.h" +#include "display/gimpdisplay-selection.h" + #include "info-dialog.h" #include "info-window.h" #include "view-commands.h" -#include "gdisplay.h" -#include "gdisplay_ops.h" #include "gimprc.h" #include "nav_window.h" -#include "scale.h" -#include "selection.h" #define return_if_no_display(gdisp) \ diff --git a/app/app_procs.c b/app/app_procs.c index c76edeb7d1..7248b282b2 100644 --- a/app/app_procs.c +++ b/app/app_procs.c @@ -46,6 +46,8 @@ #include "xcf/xcf.h" +#include "display/gimpdisplay.h" + #include "tools/tool_manager.h" #include "gui/file-open-dialog.h" @@ -58,7 +60,6 @@ #include "colormaps.h" #include "docindex.h" #include "errors.h" -#include "gdisplay.h" #include "gimprc.h" #include "module_db.h" #include "plug_in.h" diff --git a/app/base/color-balance.c b/app/base/color-balance.c index 38c27516c1..11ca9412af 100644 --- a/app/base/color-balance.c +++ b/app/base/color-balance.c @@ -33,13 +33,14 @@ #include "widgets/gimpwidgets-utils.h" +#include "display/gimpdisplay.h" + #include "gimpcolorbalancetool.h" #include "gimpcolorbalancetool-transfer.h" #include "tool_manager.h" #include "tool_options.h" #include "app_procs.h" -#include "gdisplay.h" #include "image_map.h" #include "libgimp/gimpintl.h" diff --git a/app/base/curves.c b/app/base/curves.c index 7f786f64b8..cdd5860846 100644 --- a/app/base/curves.c +++ b/app/base/curves.c @@ -39,12 +39,13 @@ #include "widgets/gimpcursor.h" #include "widgets/gimpwidgets-utils.h" +#include "display/gimpdisplay.h" + #include "gimpcurvestool.h" #include "tool_manager.h" #include "tool_options.h" #include "app_procs.h" -#include "gdisplay.h" #include "image_map.h" #include "libgimp/gimpintl.h" diff --git a/app/base/hue-saturation.c b/app/base/hue-saturation.c index 43d6970e52..4ff531e97f 100644 --- a/app/base/hue-saturation.c +++ b/app/base/hue-saturation.c @@ -34,12 +34,13 @@ #include "widgets/gimpwidgets-utils.h" +#include "display/gimpdisplay.h" + #include "gimphuesaturationtool.h" #include "tool_manager.h" #include "tool_options.h" #include "app_procs.h" -#include "gdisplay.h" #include "image_map.h" #include "libgimp/gimpintl.h" diff --git a/app/base/threshold.c b/app/base/threshold.c index 3d80250be2..650ff71e11 100644 --- a/app/base/threshold.c +++ b/app/base/threshold.c @@ -36,12 +36,13 @@ #include "widgets/gimphistogramview.h" #include "widgets/gimpwidgets-utils.h" +#include "display/gimpdisplay.h" + #include "gimpthresholdtool.h" #include "tool_manager.h" #include "tool_options.h" #include "app_procs.h" -#include "gdisplay.h" #include "image_map.h" #include "libgimp/gimpintl.h" diff --git a/app/core/gimp-transform-region.c b/app/core/gimp-transform-region.c index 077d315a18..48e10170a4 100644 --- a/app/core/gimp-transform-region.c +++ b/app/core/gimp-transform-region.c @@ -26,6 +26,7 @@ #include "libgimpwidgets/gimpwidgets.h" #include "tools-types.h" +#include "gui/gui-types.h" #include "base/base-config.h" #include "base/pixel-region.h" @@ -46,7 +47,8 @@ #include "core/gimptoolinfo.h" #include "gui/info-dialog.h" -#include "gdisplay.h" + +#include "display/gimpdisplay.h" #include "tool_manager.h" #include "tool_options.h" diff --git a/app/core/gimpdrawable-blend.c b/app/core/gimpdrawable-blend.c index 313ec71a69..9a5b79cf73 100644 --- a/app/core/gimpdrawable-blend.c +++ b/app/core/gimpdrawable-blend.c @@ -45,9 +45,10 @@ #include "widgets/gimpdnd.h" +#include "display/gimpdisplay.h" + #include "app_procs.h" #include "errors.h" -#include "gdisplay.h" #include "gimpprogress.h" #include "undo.h" diff --git a/app/core/gimpdrawable-transform.c b/app/core/gimpdrawable-transform.c index 077d315a18..48e10170a4 100644 --- a/app/core/gimpdrawable-transform.c +++ b/app/core/gimpdrawable-transform.c @@ -26,6 +26,7 @@ #include "libgimpwidgets/gimpwidgets.h" #include "tools-types.h" +#include "gui/gui-types.h" #include "base/base-config.h" #include "base/pixel-region.h" @@ -46,7 +47,8 @@ #include "core/gimptoolinfo.h" #include "gui/info-dialog.h" -#include "gdisplay.h" + +#include "display/gimpdisplay.h" #include "tool_manager.h" #include "tool_options.h" diff --git a/app/core/gimpimage-pick-color.c b/app/core/gimpimage-pick-color.c index 79fe157dce..d48efd37f1 100644 --- a/app/core/gimpimage-pick-color.c +++ b/app/core/gimpimage-pick-color.c @@ -24,6 +24,7 @@ #include "libgimpwidgets/gimpwidgets.h" #include "tools-types.h" +#include "gui/gui-types.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" @@ -31,12 +32,13 @@ #include "gui/info-dialog.h" #include "gui/palette-editor.h" +#include "display/gimpdisplay.h" + #include "gimpdrawtool.h" #include "gimpcolorpickertool.h" #include "tool_manager.h" #include "tool_options.h" -#include "gdisplay.h" #include "gimprc.h" #include "libgimp/gimpintl.h" diff --git a/app/core/gimpimage-qmask.c b/app/core/gimpimage-qmask.c index baf09dd1a5..07da95f3d0 100644 --- a/app/core/gimpimage-qmask.c +++ b/app/core/gimpimage-qmask.c @@ -35,11 +35,12 @@ #include "core/gimpimage.h" #include "core/gimpimage-mask.h" +#include "display/gimpdisplay.h" + #include "widgets/gimpcolorpanel.h" #include "app_procs.h" #include "floating_sel.h" -#include "gdisplay.h" #include "qmask.h" #include "undo.h" diff --git a/app/core/gimpimage-quick-mask.c b/app/core/gimpimage-quick-mask.c index baf09dd1a5..07da95f3d0 100644 --- a/app/core/gimpimage-quick-mask.c +++ b/app/core/gimpimage-quick-mask.c @@ -35,11 +35,12 @@ #include "core/gimpimage.h" #include "core/gimpimage-mask.h" +#include "display/gimpdisplay.h" + #include "widgets/gimpcolorpanel.h" #include "app_procs.h" #include "floating_sel.h" -#include "gdisplay.h" #include "qmask.h" #include "undo.h" diff --git a/app/core/gimpimage-undo-push.c b/app/core/gimpimage-undo-push.c index c412101fa9..60451c438d 100644 --- a/app/core/gimpimage-undo-push.c +++ b/app/core/gimpimage-undo-push.c @@ -25,7 +25,6 @@ #include "libgimpbase/gimpbase.h" -#include "core/core-types.h" #include "tools/tools-types.h" #include "base/pixel-region.h" @@ -45,6 +44,8 @@ #include "core/gimpparasite.h" #include "core/gimpparasitelist.h" +#include "display/gimpdisplay.h" + #include "tools/gimpbycolorselecttool.h" #include "tools/gimptool.h" #include "tools/gimpdrawtool.h" @@ -54,15 +55,12 @@ #include "app_procs.h" #include "floating_sel.h" -#include "gdisplay.h" -#include "gdisplay_ops.h" #include "path_transform.h" #include "undo.h" #include "libgimp/gimpintl.h" - /*#define DEBUG*/ #ifdef DEBUG diff --git a/app/core/gimpimagemap.c b/app/core/gimpimagemap.c index 56d8d05e7b..194660bfa8 100644 --- a/app/core/gimpimagemap.c +++ b/app/core/gimpimagemap.c @@ -31,7 +31,8 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" -#include "gdisplay.h" +#include "display/gimpdisplay.h" + #include "image_map.h" diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c index eb1827dac2..1b0d32e648 100644 --- a/app/core/gimpprojection.c +++ b/app/core/gimpprojection.c @@ -26,8 +26,8 @@ #include "libgimpmath/gimpmath.h" #include "libgimpbase/gimpbase.h" -#include "core/core-types.h" -#include "tools/tools-types.h" +#include "display-types.h" +#include "gui/gui-types.h" /* FIXME */ #include "base/temp-buf.h" @@ -44,24 +44,25 @@ #include "tools/gimptool.h" #include "tools/tool_manager.h" -#include "disp_callbacks.h" -#include "gdisplay.h" -#include "gdisplay_ops.h" #include "gui/info-window.h" -#include "interface.h" #include "gui/menus.h" -#include "nav_window.h" + +#include "gimpdisplay.h" +#include "gimpdisplay-callbacks.h" +#include "gimpdisplay-ops.h" +#include "gimpdisplay-render.h" +#include "gimpdisplay-scale.h" +#include "gimpdisplay-selection.h" +#include "gimpdisplayshell.h" +#include "gximage.h" #include "app_procs.h" #include "appenv.h" #include "colormaps.h" #include "gimprc.h" -#include "gximage.h" -#include "image_render.h" +#include "nav_window.h" #include "plug_in.h" #include "qmask.h" -#include "scale.h" -#include "selection.h" #include "undo.h" #ifdef DISPLAY_FILTERS diff --git a/app/core/gimpprojection.h b/app/core/gimpprojection.h index 0342947e2e..c457cb9449 100644 --- a/app/core/gimpprojection.h +++ b/app/core/gimpprojection.h @@ -23,9 +23,8 @@ #include "core/gimpobject.h" -/* FIXME: move the display stuff to display/ */ - -#include "display/display-types.h" +/* FIXME move all GTK stuff to gimpdisplayshell */ +#include "gui/gui-types.h" /* some useful macros */ diff --git a/app/dialogs/convert-dialog.c b/app/dialogs/convert-dialog.c index 5e6f913de9..fa63ceebe5 100644 --- a/app/dialogs/convert-dialog.c +++ b/app/dialogs/convert-dialog.c @@ -32,11 +32,12 @@ #include "core/gimplist.h" #include "core/gimppalette.h" +#include "display/gimpdisplay.h" + #include "tools/gimptool.h" #include "tools/tool_manager.h" #include "app_procs.h" -#include "gdisplay.h" #include "palette-select.h" #include "libgimp/gimpintl.h" diff --git a/app/dialogs/file-dialog-utils.c b/app/dialogs/file-dialog-utils.c index fec75c8450..a1fe2f3d75 100644 --- a/app/dialogs/file-dialog-utils.c +++ b/app/dialogs/file-dialog-utils.c @@ -25,11 +25,12 @@ #include "core/core-types.h" +#include "display/gimpdisplay.h" + #include "widgets/gimpwidgets-utils.h" #include "menus.h" -#include "gdisplay.h" #include "plug_in.h" diff --git a/app/dialogs/image-new-dialog.c b/app/dialogs/image-new-dialog.c index 48610f990b..caa84b3786 100644 --- a/app/dialogs/image-new-dialog.c +++ b/app/dialogs/image-new-dialog.c @@ -24,14 +24,13 @@ #include "libgimpbase/gimpbase.h" #include "libgimpwidgets/gimpwidgets.h" -#include "core/core-types.h" +#include "gui-types.h" #include "core/gimp.h" #include "core/gimpcoreconfig.h" #include "core/gimpimage-new.h" #include "file-new-dialog.h" -#include "gdisplay.h" #include "app_procs.h" #include "gimprc.h" diff --git a/app/dialogs/info-window.c b/app/dialogs/info-window.c index 284147f08c..4478d8af15 100644 --- a/app/dialogs/info-window.c +++ b/app/dialogs/info-window.c @@ -23,7 +23,6 @@ #include "libgimpbase/gimpbase.h" #include "libgimpwidgets/gimpwidgets.h" -#include "core/core-types.h" #include "tools/tools-types.h" #include "widgets/widgets-types.h" @@ -33,6 +32,8 @@ #include "core/gimpimage.h" #include "core/gimpunit.h" +#include "display/gimpdisplay.h" + #include "widgets/gimppreview.h" #include "tools/gimptool.h" @@ -45,7 +46,6 @@ #include "app_procs.h" #include "colormaps.h" -#include "gdisplay.h" #include "libgimp/gimpintl.h" diff --git a/app/dialogs/offset-dialog.c b/app/dialogs/offset-dialog.c index beeaf6b16e..3ae0b0e43a 100644 --- a/app/dialogs/offset-dialog.c +++ b/app/dialogs/offset-dialog.c @@ -23,13 +23,13 @@ #include "libgimpmath/gimpmath.h" #include "libgimpwidgets/gimpwidgets.h" -#include "core/core-types.h" +#include "gui-types.h" #include "core/gimpdrawable.h" #include "core/gimpdrawable-offset.h" #include "core/gimpimage.h" -#include "gdisplay.h" +#include "display/gimpdisplay.h" #include "libgimp/gimpintl.h" diff --git a/app/dialogs/preferences-dialog.c b/app/dialogs/preferences-dialog.c index a38a31cb14..10d7391ba9 100644 --- a/app/dialogs/preferences-dialog.c +++ b/app/dialogs/preferences-dialog.c @@ -26,7 +26,7 @@ #include "libgimpbase/gimpbase.h" #include "libgimpwidgets/gimpwidgets.h" -#include "tools/tools-types.h" +#include "gui-types.h" #include "base/base-config.h" #include "base/tile-cache.h" @@ -36,6 +36,10 @@ #include "core/gimpcoreconfig.h" #include "core/gimpimage.h" +#include "display/gimpdisplay.h" +#include "display/gimpdisplay-ops.h" +#include "display/gimpdisplay-render.h" + #include "tools/tool_manager.h" #include "layer-select.h" @@ -44,11 +48,8 @@ #include "app_procs.h" #include "colormaps.h" -#include "gdisplay.h" -#include "gdisplay_ops.h" #include "gimphelp.h" #include "gimprc.h" -#include "image_render.h" #include "libgimp/gimpintl.h" diff --git a/app/dialogs/user-install-dialog.c b/app/dialogs/user-install-dialog.c index 09be3e8979..d9e1034f9e 100644 --- a/app/dialogs/user-install-dialog.c +++ b/app/dialogs/user-install-dialog.c @@ -34,16 +34,17 @@ #include "libgimpbase/gimpbase.h" #include "libgimpwidgets/gimpwidgets.h" -#include "core/core-types.h" +#include "display/display-types.h" #include "base/base-config.h" #include "core/gimpunit.h" +#include "display/gimpdisplay-ops.h" + #include "gui/resolution-calibrate-dialog.h" #include "appenv.h" -#include "gdisplay_ops.h" #include "gimprc.h" #include "user_install.h" diff --git a/app/disp_callbacks.c b/app/disp_callbacks.c deleted file mode 100644 index fb5a341893..0000000000 --- a/app/disp_callbacks.c +++ /dev/null @@ -1,1076 +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 -#include - -#include "libgimpcolor/gimpcolor.h" - -#include "core/core-types.h" -#include "tools/tools-types.h" - -#include "base/pixel-region.h" -#include "base/temp-buf.h" -#include "base/tile-manager.h" - -#include "paint-funcs/paint-funcs.h" - -#include "core/gimp.h" -#include "core/gimpbuffer.h" -#include "core/gimpcontext.h" -#include "core/gimpedit.h" -#include "core/gimpimage.h" -#include "core/gimplayer.h" -#include "core/gimppattern.h" -#include "core/gimptoolinfo.h" - -#include "tools/gimpbucketfilltool.h" -#include "tools/gimpfuzzyselecttool.h" -#include "tools/gimpmovetool.h" -#include "tools/tool_manager.h" - -#include "widgets/gimpdialogfactory.h" -#include "widgets/gimpwidgets-utils.h" - -#include "gui/dialogs.h" -#include "gui/info-window.h" -#include "gui/layer-select.h" - -#include "devices.h" -#include "disp_callbacks.h" -#include "gdisplay.h" -#include "gimprc.h" -#include "scale.h" -#include "scroll.h" -#include "selection.h" -#include "undo.h" - -#include "libgimp/gimpintl.h" - - -static void -gdisplay_redraw (GimpDisplay *gdisp, - gint x, - gint y, - gint w, - gint h) -{ - glong x1, y1, x2, y2; /* coordinate of rectangle corners */ - - x1 = x; - y1 = y; - x2 = (x + w); - y2 = (y + h); - - x1 = CLAMP (x1, 0, gdisp->disp_width); - y1 = CLAMP (y1, 0, gdisp->disp_height); - x2 = CLAMP (x2, 0, gdisp->disp_width); - y2 = CLAMP (y2, 0, gdisp->disp_height); - - if ((x2 - x1) && (y2 - y1)) - { - gdisplay_expose_area (gdisp, - x1, y1, - (x2 - x1), (y2 - y1)); - gdisplay_flush_displays_only (gdisp); - } -} - -static void -gdisplay_check_device_cursor (GimpDisplay *gdisp) -{ - GList *list; - - /* gdk_input_list_devices returns an internal list, so we shouldn't - * free it afterwards - */ - for (list = gdk_devices_list (); list; list = g_list_next (list)) - { - GdkDevice *device = (GdkDevice *) list->data; - - if (device == current_device) - { - gdisp->draw_cursor = ! device->has_cursor; - break; - } - } -} - -static int -key_to_state (gint key) -{ - switch (key) - { - case GDK_Alt_L: - case GDK_Alt_R: - return GDK_MOD1_MASK; - case GDK_Shift_L: - case GDK_Shift_R: - return GDK_SHIFT_MASK; - case GDK_Control_L: - case GDK_Control_R: - return GDK_CONTROL_MASK; - default: - return 0; - } -} - -static void -gdisplay_vscrollbar_update (GtkAdjustment *adjustment, - GimpDisplay *gdisp) -{ - scroll_display (gdisp, 0, (adjustment->value - gdisp->offset_y)); -} - -static void -gdisplay_hscrollbar_update (GtkAdjustment *adjustment, - GimpDisplay *gdisp) -{ - scroll_display (gdisp, (adjustment->value - gdisp->offset_x), 0); -} - -gboolean -gdisplay_shell_events (GtkWidget *widget, - GdkEvent *event, - GimpDisplay *gdisp) -{ - switch (event->type) - { - case GDK_KEY_PRESS: - case GDK_BUTTON_PRESS: - /* Setting the context's display automatically sets the image, too */ - gimp_context_set_display (gimp_get_user_context (gdisp->gimage->gimp), - gdisp); - - break; - default: - break; - } - - return FALSE; -} - -gboolean -gdisplay_canvas_events (GtkWidget *canvas, - GdkEvent *event, - GimpDisplay *gdisp) -{ - GimpTool *active_tool; - GdkEventExpose *eevent; - GdkEventMotion *mevent; - GdkEventButton *bevent; - GdkEventScroll *sevent; - GdkEventKey *kevent; - gdouble tx = 0; - gdouble ty = 0; - guint state = 0; - gint return_val = FALSE; - static gboolean scrolled = FALSE; - static guint key_signal_id = 0; - gboolean update_cursor = FALSE; - - if (! canvas->window) - return FALSE; - - active_tool = tool_manager_get_active (gdisp->gimage->gimp); - - /* If this is the first event... */ - if (!gdisp->select) - { - /* create the selection object */ - gdisp->select = selection_create (gdisp->canvas->window, gdisp, - gdisp->gimage->height, - gdisp->gimage->width, - gimprc.marching_speed); - - gdisp->disp_width = gdisp->canvas->allocation.width; - gdisp->disp_height = gdisp->canvas->allocation.height; - - /* create GC for scrolling */ - gdisp->scroll_gc = gdk_gc_new (gdisp->canvas->window); - gdk_gc_set_exposures (gdisp->scroll_gc, TRUE); - - /* set up the scrollbar observers */ - g_signal_connect (G_OBJECT (gdisp->hsbdata), "value_changed", - G_CALLBACK (gdisplay_hscrollbar_update), - gdisp); - g_signal_connect (G_OBJECT (gdisp->vsbdata), "value_changed", - G_CALLBACK (gdisplay_vscrollbar_update), - gdisp); - - /* setup scale properly */ - setup_scale (gdisp); - } - - /* Find out what device the event occurred upon */ - if (! gdisp->gimage->gimp->busy && devices_check_change (event)) - gdisplay_check_device_cursor (gdisp); - - switch (event->type) - { - case GDK_EXPOSE: - eevent = (GdkEventExpose *) event; - - gdisplay_redraw (gdisp, - eevent->area.x, eevent->area.y, - eevent->area.width, eevent->area.height); - break; - - case GDK_CONFIGURE: - if ((gdisp->disp_width != gdisp->canvas->allocation.width) || - (gdisp->disp_height != gdisp->canvas->allocation.height)) - { - gdisp->disp_width = gdisp->canvas->allocation.width; - gdisp->disp_height = gdisp->canvas->allocation.height; - - resize_display (gdisp, FALSE, FALSE); - } - break; - - case GDK_LEAVE_NOTIFY: - if (((GdkEventCrossing *) event)->mode != GDK_CROSSING_NORMAL) - return TRUE; - gdisplay_update_cursor (gdisp, 0, 0); - gtk_label_set_text (GTK_LABEL (gdisp->cursor_label), ""); - info_window_update_extended (gdisp, -1, -1); - - case GDK_PROXIMITY_OUT: - gdisp->proximity = FALSE; - break; - - case GDK_ENTER_NOTIFY: - if (((GdkEventCrossing *) event)->mode != GDK_CROSSING_NORMAL) - return TRUE; - /* Actually, should figure out tx,ty here */ - break; - - case GDK_BUTTON_PRESS: - bevent = (GdkEventButton *) event; - state = bevent->state; - - /* ignore new mouse events */ - if (gdisp->gimage->gimp->busy) - return TRUE; - - switch (bevent->button) - { - case 1: - state |= GDK_BUTTON1_MASK; - gtk_grab_add (canvas); - - /* This is a hack to prevent other stuff being run in the middle of - * a tool operation (like changing image types.... brrrr). We just - * block all the keypress event. A better solution is to implement - * some sort of locking for images. - * Note that this is dependent on specific GTK behavior, and isn't - * guaranteed to work in future versions of GTK. - * -Yosh - */ - if (key_signal_id == 0) - key_signal_id = g_signal_connect (G_OBJECT (canvas), - "key_press_event", - G_CALLBACK (gtk_true), - NULL); - - /* FIXME!!! This code is ugly */ - - if (active_tool && (GIMP_IS_MOVE_TOOL (active_tool) || - ! gimp_image_is_empty (gdisp->gimage))) - { - if (active_tool->auto_snap_to) - { - gdisplay_snap_point (gdisp, bevent->x, bevent->y, &tx, &ty); - bevent->x = tx; - bevent->y = ty; - update_cursor = TRUE; - } - - /* reset the current tool if ... */ - if ((/* it has no drawable */ - ! active_tool->drawable || - - /* or a drawable different from the current one */ - (gimp_image_active_drawable (gdisp->gimage) != - active_tool->drawable)) && - - /* and doesn't want to be preserved across drawable changes */ - ! active_tool->preserve) - { - tool_manager_initialize_tool (gdisp->gimage->gimp, - active_tool, gdisp); - - active_tool = tool_manager_get_active (gdisp->gimage->gimp); - } - - /* otherwise set it's drawable if it has none */ - else if (! active_tool->drawable) - { - active_tool->drawable = - gimp_image_active_drawable (gdisp->gimage); - } - - gimp_tool_button_press (active_tool, bevent, gdisp); - } - break; - - case 2: - state |= GDK_BUTTON2_MASK; - scrolled = TRUE; - gtk_grab_add (canvas); - start_grab_and_scroll (gdisp, bevent); - break; - - case 3: - state |= GDK_BUTTON3_MASK; - gimp_item_factory_popup_with_data (gdisp->ifactory, gdisp->gimage); - return_val = TRUE; - break; - - default: - break; - } - break; - - case GDK_BUTTON_RELEASE: - bevent = (GdkEventButton *) event; - state = bevent->state; - - /* ugly side condition: all operations which set busy cursors are - * invoked on BUTTON_RELEASE, thus no new BUTTON_PRESS events are - * accepted while Gimp is busy, thus it should be safe to block - * BUTTON_RELEASE. --Mitch - * - * ugly: fuzzy_select sets busy cursors while ACTIVE. - */ - if (gdisp->gimage->gimp->busy && - ! (GIMP_IS_FUZZY_SELECT_TOOL (active_tool) && - active_tool->state == ACTIVE)) - return TRUE; - - switch (bevent->button) - { - case 1: - state &= ~GDK_BUTTON1_MASK; - - /* Lame hack. See above */ - if (key_signal_id) - { - g_signal_handler_disconnect (G_OBJECT (canvas), key_signal_id); - key_signal_id = 0; - } - - gtk_grab_remove (canvas); - - if (active_tool && (GIMP_IS_MOVE_TOOL (active_tool) || - ! gimp_image_is_empty (gdisp->gimage))) - { - if (active_tool->state == ACTIVE) - { - if (active_tool->auto_snap_to) - { - gdisplay_snap_point (gdisp, bevent->x, bevent->y, &tx, &ty); - bevent->x = tx; - bevent->y = ty; - update_cursor = TRUE; - } - - gimp_tool_button_release (active_tool, bevent, gdisp); - } - } - break; - - case 2: - state &= ~GDK_BUTTON2_MASK; - scrolled = FALSE; - gtk_grab_remove (canvas); - end_grab_and_scroll (gdisp, bevent); - break; - - case 3: - state &= ~GDK_BUTTON3_MASK; - break; - - default: - break; - } - break; - - case GDK_SCROLL: - sevent = (GdkEventScroll *) event; - state = sevent->state; - - if (state & GDK_SHIFT_MASK) - { - if (sevent->direction == GDK_SCROLL_UP) - change_scale (gdisp, GIMP_ZOOM_IN); - else - change_scale (gdisp, GIMP_ZOOM_OUT); - } - else - { - GtkAdjustment *adj; - gdouble value; - - if (state & GDK_CONTROL_MASK) - adj = gdisp->hsbdata; - else - adj = gdisp->vsbdata; - - value = adj->value + ((sevent->direction == GDK_SCROLL_UP) ? - -adj->page_increment / 2 : - adj->page_increment / 2); - value = CLAMP (value, adj->lower, adj->upper - adj->page_size); - - gtk_adjustment_set_value (adj, value); - } - - return_val = TRUE; - break; - - case GDK_MOTION_NOTIFY: - mevent = (GdkEventMotion *) event; - state = mevent->state; - - /* for the same reason we block BUTTON_RELEASE, - * we block MOTION_NOTIFY. --Mitch - * - * ugly: fuzzy_select sets busy cursors while ACTIVE. - */ - if (gdisp->gimage->gimp->busy && - ! (GIMP_IS_FUZZY_SELECT_TOOL (active_tool) && - active_tool->state == ACTIVE)) - return TRUE; - - /* Ask for the pointer position, but ignore it except for cursor - * handling, so motion events sync with the button press/release events - */ - if (mevent->is_hint) - { -#ifdef __GNUC__ -#warning FIXME: replace gdk_input_window_get_pointer() -#endif -#if 0 - gdk_input_window_get_pointer (canvas->window, current_device, &tx, &ty, - NULL, NULL, NULL, NULL); -#endif - } - else - { - tx = mevent->x; - ty = mevent->y; - } - update_cursor = TRUE; - - if (!gdisp->proximity) - { - gdisp->proximity = TRUE; - gdisplay_check_device_cursor (gdisp); - } - - if (active_tool && (GIMP_IS_MOVE_TOOL(active_tool) || - ! gimp_image_is_empty (gdisp->gimage)) && - (mevent->state & GDK_BUTTON1_MASK)) - { - if (active_tool->state == ACTIVE) - { - /* if the first mouse button is down, check for automatic - * scrolling... - */ - if ((mevent->state & GDK_BUTTON1_MASK) && - !active_tool->scroll_lock) - { - if (mevent->x < 0 || mevent->y < 0 || - mevent->x > gdisp->disp_width || - mevent->y > gdisp->disp_height) - scroll_to_pointer_position (gdisp, mevent); - } - - if (active_tool->auto_snap_to) - { - gdisplay_snap_point (gdisp, mevent->x, mevent->y, &tx, &ty); - mevent->x = tx; - mevent->y = ty; - update_cursor = TRUE; - } - - gimp_tool_motion (active_tool, mevent, gdisp); - } - } - else if ((mevent->state & GDK_BUTTON2_MASK) && scrolled) - { - grab_and_scroll (gdisp, mevent); - } - - if (/* Should we have a tool... */ - active_tool && - /* and this event is NOT driving - * button press handlers ... - */ - !(state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK))) - { - /* ...then preconditions to modify a tool - * operator state have been met. - */ - gimp_tool_oper_update (active_tool, mevent, gdisp); - } - - break; - - case GDK_KEY_PRESS: - kevent = (GdkEventKey *) event; - state = kevent->state; - - /* ignore any key presses */ - if (gdisp->gimage->gimp->busy) - return TRUE; - - switch (kevent->keyval) - { - case GDK_Left: case GDK_Right: - case GDK_Up: case GDK_Down: - if (active_tool && ! gimp_image_is_empty (gdisp->gimage)) - gimp_tool_arrow_key (active_tool, kevent, gdisp); - - return_val = TRUE; - break; - - case GDK_Tab: - if (kevent->state & GDK_MOD1_MASK && - !gimp_image_is_empty (gdisp->gimage)) - layer_select_init (gdisp->gimage, 1, kevent->time); - - if (kevent->state & GDK_CONTROL_MASK && - !gimp_image_is_empty (gdisp->gimage)) - layer_select_init (gdisp->gimage, -1, kevent->time); - - /* Hide or show all dialogs */ - if (! kevent->state) - gimp_dialog_factories_toggle (global_dialog_factory, - "gimp:toolbox"); - - return_val = TRUE; - break; - - /* Update the state based on modifiers being pressed */ - case GDK_Alt_L: case GDK_Alt_R: - case GDK_Shift_L: case GDK_Shift_R: - case GDK_Control_L: case GDK_Control_R: - state |= key_to_state (kevent->keyval); - /* For all modifier keys: call the tools modifier_key_func */ - if (active_tool && !gimp_image_is_empty (gdisp->gimage)) - { -#if 0 - gdk_input_window_get_pointer (canvas->window, current_device, - &tx, &ty, NULL, NULL, NULL, NULL); -#endif - gimp_tool_modifier_key (active_tool, kevent, gdisp); - return_val = TRUE; - } - break; - } - break; - - case GDK_KEY_RELEASE: - kevent = (GdkEventKey *) event; - state = kevent->state; - - /* ignore any key releases */ - if (gdisp->gimage->gimp->busy) - return TRUE; - - switch (kevent->keyval) - { - case GDK_Alt_L: case GDK_Alt_R: - case GDK_Shift_L: case GDK_Shift_R: - case GDK_Control_L: case GDK_Control_R: - state &= ~key_to_state (kevent->keyval); - /* For all modifier keys: call the tools modifier_key_func */ - if (active_tool && !gimp_image_is_empty (gdisp->gimage)) - { -#if 0 - gdk_input_window_get_pointer (canvas->window, current_device, - &tx, &ty, NULL, NULL, NULL, NULL); - gimp_tool_modifier_key (active_tool, kevent, gdisp); -#endif - return_val = TRUE; - } - break; - } - - return_val = TRUE; - break; - - default: - break; - } - - /* if we reached this point in gimp_busy mode, return now */ - if (gdisp->gimage->gimp->busy) - return TRUE; - - /* Cursor update support - * no_cursor_updating is TRUE (=1) when - * /File/Preferences.../Interface/... - * Image Windows/Disable Cursor Updating is TOGGLED ON - */ - if (! gimprc.no_cursor_updating) - { - active_tool = tool_manager_get_active (gdisp->gimage->gimp); - - if (active_tool && !gimp_image_is_empty (gdisp->gimage) && - !(state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK))) - { - GdkEventMotion me; - me.x = tx; me.y = ty; - me.state = state; - gimp_tool_cursor_update (active_tool, &me, gdisp); - } - else if (gimp_image_is_empty (gdisp->gimage)) - { - gdisplay_install_tool_cursor (gdisp, - GIMP_BAD_CURSOR, - GIMP_TOOL_CURSOR_NONE, - GIMP_CURSOR_MODIFIER_NONE); - } - } - - if (update_cursor) - gdisplay_update_cursor (gdisp, tx, ty); - - return return_val; -} - -gboolean -gdisplay_hruler_button_press (GtkWidget *widget, - GdkEventButton *event, - gpointer data) -{ - GimpDisplay *gdisp; - - gdisp = (GimpDisplay *) data; - - if (gdisp->gimage->gimp->busy) - return TRUE; - - if (event->button == 1) - { - GimpToolInfo *tool_info; - GimpTool *active_tool; - - tool_info = tool_manager_get_info_by_type (gdisp->gimage->gimp, - GIMP_TYPE_MOVE_TOOL); - - if (tool_info) - { - gimp_context_set_tool (gimp_get_user_context (gdisp->gimage->gimp), - tool_info); - - active_tool = tool_manager_get_active (gdisp->gimage->gimp); - - if (active_tool) - { - gimp_move_tool_start_hguide (active_tool, gdisp); - gtk_grab_add (gdisp->canvas); - } - } - } - - return FALSE; -} - -gboolean -gdisplay_vruler_button_press (GtkWidget *widget, - GdkEventButton *event, - gpointer data) -{ - GimpDisplay *gdisp; - - gdisp = (GimpDisplay *) data; - - if (gdisp->gimage->gimp->busy) - return TRUE; - - if (event->button == 1) - { - GimpToolInfo *tool_info; - GimpTool *active_tool; - - tool_info = tool_manager_get_info_by_type (gdisp->gimage->gimp, - GIMP_TYPE_MOVE_TOOL); - - if (tool_info) - { - gimp_context_set_tool (gimp_get_user_context (gdisp->gimage->gimp), - tool_info); - - active_tool = tool_manager_get_active (gdisp->gimage->gimp); - - if (active_tool) - { - gimp_move_tool_start_vguide (active_tool, gdisp); - gtk_grab_add (gdisp->canvas); - } - } - } - - return FALSE; -} - -static void -gdisplay_origin_menu_position (GtkMenu *menu, - gint *x, - gint *y, - gpointer data) -{ - GtkWidget *origin; - gint origin_x; - gint origin_y; - - origin = (GtkWidget *) data; - - gdk_window_get_origin (origin->window, &origin_x, &origin_y); - - *x = origin_x + origin->allocation.x + origin->allocation.width - 1; - *y = origin_y + origin->allocation.y + (origin->allocation.height - 1) / 2; - - if (*x + GTK_WIDGET (menu)->allocation.width > gdk_screen_width ()) - *x -= (GTK_WIDGET (menu)->allocation.width + origin->allocation.width); - - if (*y + GTK_WIDGET (menu)->allocation.height > gdk_screen_height ()) - *y -= (GTK_WIDGET (menu)->allocation.height); -} - -gboolean -gdisplay_origin_button_press (GtkWidget *widget, - GdkEventButton *event, - gpointer data) -{ - GimpDisplay *gdisp; - - gdisp = (GimpDisplay *) data; - - if (! gdisp->gimage->gimp->busy && event->button == 1) - { - gint x, y; - - gdisplay_origin_menu_position (GTK_MENU (gdisp->ifactory->widget), - &x, &y, widget); - - gtk_item_factory_popup_with_data (gdisp->ifactory, - gdisp->gimage, NULL, - x, y, - 1, event->time); - } - - /* Return TRUE to stop signal emission so the button doesn't grab the - * pointer away from us. - */ - return TRUE; -} - -void -gdisplay_drop_drawable (GtkWidget *widget, - GimpViewable *viewable, - gpointer data) -{ - GimpDrawable *drawable; - GimpDisplay *gdisp; - GimpImage *src_gimage; - GimpLayer *new_layer; - GimpImage *dest_gimage; - gint src_width, src_height; - gint dest_width, dest_height; - gint off_x, off_y; - TileManager *tiles; - PixelRegion srcPR, destPR; - guchar bg[MAX_CHANNELS]; - gint bytes; - GimpImageBaseType type; - - gdisp = (GimpDisplay *) data; - - if (gdisp->gimage->gimp->busy) - return; - - drawable = GIMP_DRAWABLE (viewable); - - src_gimage = gimp_drawable_gimage (drawable); - src_width = gimp_drawable_width (drawable); - src_height = gimp_drawable_height (drawable); - - switch (gimp_drawable_type (drawable)) - { - case RGB_GIMAGE: case RGBA_GIMAGE: - bytes = 4; type = RGB; - break; - case GRAY_GIMAGE: case GRAYA_GIMAGE: - bytes = 2; type = GRAY; - break; - case INDEXED_GIMAGE: case INDEXEDA_GIMAGE: - bytes = 4; type = INDEXED; - break; - default: - bytes = 3; type = RGB; - break; - } - - gimp_image_get_background (src_gimage, drawable, bg); - - tiles = tile_manager_new (src_width, src_height, bytes); - - pixel_region_init (&srcPR, gimp_drawable_data (drawable), - 0, 0, src_width, src_height, FALSE); - pixel_region_init (&destPR, tiles, - 0, 0, src_width, src_height, TRUE); - - if (type == INDEXED) - { - /* If the layer is indexed...we need to extract pixels */ - extract_from_region (&srcPR, &destPR, NULL, - gimp_drawable_cmap (drawable), bg, type, - gimp_drawable_has_alpha (drawable), FALSE); - } - else if (bytes > srcPR.bytes) - { - /* If the layer doesn't have an alpha channel, add one */ - add_alpha_region (&srcPR, &destPR); - } - else - { - /* Otherwise, do a straight copy */ - copy_region (&srcPR, &destPR); - } - - dest_gimage = gdisp->gimage; - dest_width = dest_gimage->width; - dest_height = dest_gimage->height; - - undo_push_group_start (dest_gimage, EDIT_PASTE_UNDO); - - new_layer = - gimp_layer_new_from_tiles (dest_gimage, - gimp_image_base_type_with_alpha (dest_gimage), - tiles, - _("Pasted Layer"), - OPAQUE_OPACITY, NORMAL_MODE); - - tile_manager_destroy (tiles); - - if (new_layer) - { - gimp_drawable_set_gimage (GIMP_DRAWABLE (new_layer), dest_gimage); - - off_x = (dest_gimage->width - src_width) / 2; - off_y = (dest_gimage->height - src_height) / 2; - - gimp_layer_translate (new_layer, off_x, off_y); - - gimp_image_add_layer (dest_gimage, new_layer, -1); - - undo_push_group_end (dest_gimage); - - gdisplays_flush (); - - gimp_context_set_display (gimp_get_user_context (gdisp->gimage->gimp), - gdisp); - } -} - -static void -gdisplay_bucket_fill (GimpDisplay *gdisp, - BucketFillMode fill_mode, - guchar orig_color[], - TempBuf *orig_pat_buf) -{ - GimpImage *gimage; - GimpDrawable *drawable; - TileManager *buf_tiles; - PixelRegion bufPR; - GimpToolInfo *tool_info; - GimpContext *context; - gint x1, x2, y1, y2; - gint bytes; - gboolean has_alpha; - - guchar color[3]; - TempBuf *pat_buf = NULL; - gboolean new_buf = FALSE; - - gimage = gdisp->gimage; - - if (gimage->gimp->busy) - return; - - drawable = gimp_image_active_drawable (gimage); - - if (! drawable) - return; - - gimp_set_busy (gimage->gimp); - - /* Get the bucket fill context */ - tool_info = tool_manager_get_info_by_type (gimage->gimp, - GIMP_TYPE_BUCKET_FILL_TOOL); - - if (tool_info && tool_info->context) - { - context = tool_info->context; - } - else - { - context = gimp_get_user_context (gimage->gimp); - } - - /* Transform the passed data for the dest image */ - if (fill_mode == FG_BUCKET_FILL) - { - gimp_image_transform_color (gimage, drawable, orig_color, color, RGB); - } - else - { - if (((orig_pat_buf->bytes == 3) && ! gimp_drawable_is_rgb (drawable)) || - ((orig_pat_buf->bytes == 1) && ! gimp_drawable_is_gray (drawable))) - { - guchar *d1, *d2; - gint size; - - if ((orig_pat_buf->bytes == 1) && gimp_drawable_is_rgb (drawable)) - pat_buf = temp_buf_new (orig_pat_buf->width, orig_pat_buf->height, - 3, 0, 0, NULL); - else - pat_buf = temp_buf_new (orig_pat_buf->width, orig_pat_buf->height, - 1, 0, 0, NULL); - - d1 = temp_buf_data (orig_pat_buf); - d2 = temp_buf_data (pat_buf); - - size = orig_pat_buf->width * orig_pat_buf->height; - while (size--) - { - gimp_image_transform_color (gimage, drawable, d1, d2, - (orig_pat_buf->bytes == 3) ? RGB : GRAY); - d1 += orig_pat_buf->bytes; - d2 += pat_buf->bytes; - } - - new_buf = TRUE; - } - else - { - pat_buf = orig_pat_buf; - } - } - - gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2); - bytes = gimp_drawable_bytes (drawable); - has_alpha = gimp_drawable_has_alpha (drawable); - - /* Fill the region */ - buf_tiles = tile_manager_new ((x2 - x1), (y2 - y1), bytes); - pixel_region_init (&bufPR, buf_tiles, 0, 0, (x2 - x1), (y2 - y1), TRUE); - bucket_fill_region (fill_mode, &bufPR, NULL, - color, pat_buf, x1, y1, has_alpha); - - /* Apply it to the image */ - pixel_region_init (&bufPR, buf_tiles, 0, 0, (x2 - x1), (y2 - y1), FALSE); - gimp_image_apply_image (gimage, drawable, &bufPR, TRUE, - gimp_context_get_opacity (context) * 255, - gimp_context_get_paint_mode (context), - NULL, x1, y1); - tile_manager_destroy (buf_tiles); - - /* Update the displays */ - gimp_drawable_update (drawable, - x1, y1, - (x2 - x1), (y2 - y1)); - gdisplays_flush (); - - if (new_buf) - temp_buf_free (pat_buf); - - gimp_unset_busy (gimage->gimp); -} - -void -gdisplay_drop_pattern (GtkWidget *widget, - GimpViewable *viewable, - gpointer data) -{ - GimpDisplay *gdisp; - - gdisp = (GimpDisplay *) data; - - if (GIMP_IS_PATTERN (viewable)) - { - gdisplay_bucket_fill (gdisp, - PATTERN_BUCKET_FILL, - NULL, - GIMP_PATTERN (viewable)->mask); - } -} - -void -gdisplay_drop_color (GtkWidget *widget, - const GimpRGB *drop_color, - gpointer data) -{ - GimpDisplay *gdisp; - guchar color[4]; - - gdisp = (GimpDisplay *) data; - - gimp_rgba_get_uchar (drop_color, - &color[0], - &color[1], - &color[2], - &color[3]); - - gdisplay_bucket_fill (gdisp, - FG_BUCKET_FILL, - color, - NULL); -} - -void -gdisplay_drop_buffer (GtkWidget *widget, - GimpViewable *viewable, - gpointer data) -{ - GimpBuffer *buffer; - GimpDisplay *gdisp; - - gdisp = (GimpDisplay *) data; - - if (gdisp->gimage->gimp->busy) - return; - - buffer = GIMP_BUFFER (viewable); - - /* FIXME: popup a menu for selecting "Paste Into" */ - - gimp_edit_paste (gdisp->gimage, - gimp_image_active_drawable (gdisp->gimage), - buffer->tiles, - FALSE); - - gdisplays_flush (); -} diff --git a/app/disp_callbacks.h b/app/disp_callbacks.h deleted file mode 100644 index 72922230c5..0000000000 --- a/app/disp_callbacks.h +++ /dev/null @@ -1,67 +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 __DISP_CALLBACKS_H__ -#define __DISP_CALLBACKS_H__ - - -#define CANVAS_EVENT_MASK (GDK_EXPOSURE_MASK | \ - GDK_POINTER_MOTION_MASK | \ - GDK_POINTER_MOTION_HINT_MASK | \ - GDK_BUTTON_PRESS_MASK | \ - GDK_BUTTON_RELEASE_MASK | \ - GDK_STRUCTURE_MASK | \ - GDK_ENTER_NOTIFY_MASK | \ - GDK_LEAVE_NOTIFY_MASK | \ - GDK_KEY_PRESS_MASK | \ - GDK_KEY_RELEASE_MASK | \ - GDK_PROXIMITY_OUT_MASK) - - -gboolean gdisplay_shell_events (GtkWidget *widget, - GdkEvent *event, - GimpDisplay *gdisp); -gboolean gdisplay_canvas_events (GtkWidget *widget, - GdkEvent *event, - GimpDisplay *gdisp); - -gboolean gdisplay_hruler_button_press (GtkWidget *widget, - GdkEventButton *bevent, - gpointer data); -gboolean gdisplay_vruler_button_press (GtkWidget *widget, - GdkEventButton *bevent, - gpointer data); -gboolean gdisplay_origin_button_press (GtkWidget *widget, - GdkEventButton *bevent, - gpointer data); - -void gdisplay_drop_drawable (GtkWidget *widget, - GimpViewable *viewable, - gpointer data); -void gdisplay_drop_pattern (GtkWidget *widget, - GimpViewable *viewable, - gpointer data); -void gdisplay_drop_color (GtkWidget *widget, - const GimpRGB *color, - gpointer data); -void gdisplay_drop_buffer (GtkWidget *widget, - GimpViewable *viewable, - gpointer data); - - -#endif /* __DISP_CALLBACKS_H__ */ diff --git a/app/display/Makefile.am b/app/display/Makefile.am index c0fe41fc15..667cfa81ae 100644 --- a/app/display/Makefile.am +++ b/app/display/Makefile.am @@ -3,29 +3,27 @@ noinst_LIBRARIES = libappdisplay.a libappdisplay_a_SOURCES = @STRIP_BEGIN@ \ - display-types.h \ -## display.c \ -## display.h \ -## gimpdisplay.c \ -## gimpdisplay.h \ -## gimpdisplay-callbacks.c \ -## gimpdisplay-callbacks.h \ -## gimpdisplay-ops.c \ -## gimpdisplay-ops.h \ -## gimpdisplay-render.c \ -## gimpdisplay-render.h \ -## gimpdisplay-scale.c \ -## gimpdisplay-scale.h \ -## gimpdisplay-scroll.c \ -## gimpdisplay-scroll.h \ -## gimpdisplay-selection.c \ -## gimpdisplay-selection.h \ -## gimpdisplay-shell.c \ -## gimpdisplay-shell.h \ -## \ -## gximage.c \ -## gximage.h \ -## marching_ants.h \ + display-types.h \ + gimpdisplay.c \ + gimpdisplay.h \ + gimpdisplay-callbacks.c \ + gimpdisplay-callbacks.h \ + gimpdisplay-marching-ants.h \ + gimpdisplay-ops.c \ + gimpdisplay-ops.h \ + gimpdisplay-render.c \ + gimpdisplay-render.h \ + gimpdisplay-scale.c \ + gimpdisplay-scale.h \ + gimpdisplay-scroll.c \ + gimpdisplay-scroll.h \ + gimpdisplay-selection.c \ + gimpdisplay-selection.h \ + gimpdisplayshell.c \ + gimpdisplayshell.h \ + \ + gximage.c \ + gximage.h \ @STRIP_END@ AM_CPPFLAGS = @STRIP_BEGIN@ \ diff --git a/app/display/display-types.h b/app/display/display-types.h index 4be1125483..0156f5b792 100644 --- a/app/display/display-types.h +++ b/app/display/display-types.h @@ -20,7 +20,7 @@ #define __DISPLAY_TYPES_H__ -#include "gui/gui-types.h" +#include "tools/tools-types.h" typedef enum /*< skip >*/ diff --git a/app/display/gimpdisplay-callbacks.c b/app/display/gimpdisplay-callbacks.c index fb5a341893..cb991dfe6e 100644 --- a/app/display/gimpdisplay-callbacks.c +++ b/app/display/gimpdisplay-callbacks.c @@ -25,8 +25,8 @@ #include "libgimpcolor/gimpcolor.h" -#include "core/core-types.h" -#include "tools/tools-types.h" +#include "display-types.h" +#include "gui/gui-types.h" #include "base/pixel-region.h" #include "base/temp-buf.h" @@ -55,13 +55,14 @@ #include "gui/info-window.h" #include "gui/layer-select.h" +#include "gimpdisplay.h" +#include "gimpdisplay-callbacks.h" +#include "gimpdisplay-selection.h" +#include "gimpdisplay-scale.h" +#include "gimpdisplay-scroll.h" + #include "devices.h" -#include "disp_callbacks.h" -#include "gdisplay.h" #include "gimprc.h" -#include "scale.h" -#include "scroll.h" -#include "selection.h" #include "undo.h" #include "libgimp/gimpintl.h" diff --git a/app/display/gimpdisplay-ops.c b/app/display/gimpdisplay-ops.c index b75f7724e8..f4c96d0cfe 100644 --- a/app/display/gimpdisplay-ops.c +++ b/app/display/gimpdisplay-ops.c @@ -22,13 +22,15 @@ #include "libgimpwidgets/gimpwidgets.h" -#include "core/core-types.h" +#include "display-types.h" #include "core/gimp.h" #include "core/gimpimage.h" +#include "gimpdisplay.h" +#include "gimpdisplay-ops.h" + #include "colormaps.h" -#include "gdisplay_ops.h" #include "gimprc.h" #include "libgimp/gimpintl.h" diff --git a/app/display/gimpdisplay-ops.h b/app/display/gimpdisplay-ops.h index 8b1cf03ad2..c3d2d75e6e 100644 --- a/app/display/gimpdisplay-ops.h +++ b/app/display/gimpdisplay-ops.h @@ -16,11 +16,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __GDISPLAY_OPS_H__ -#define __GDISPLAY_OPS_H__ - - -#include "gdisplay.h" +#ifndef __GIMPDISPLAY_OPS_H__ +#define __GIMPDISPLAY_OPS_H__ gulong gdisplay_black_pixel (GimpDisplay *gdisp); @@ -37,4 +34,4 @@ void gdisplay_close_window (GimpDisplay *gdisp, void gdisplay_shrink_wrap (GimpDisplay *gdisp); -#endif /* __GDISPLAY_OPS_H__ */ +#endif /* __GIMPDISPLAY_OPS_H__ */ diff --git a/app/display/gimpdisplay-render.c b/app/display/gimpdisplay-render.c index 3a9fd5645f..61eeb00d87 100644 --- a/app/display/gimpdisplay-render.c +++ b/app/display/gimpdisplay-render.c @@ -23,18 +23,19 @@ #include -#include "core/core-types.h" +#include "display-types.h" #include "base/tile-manager.h" #include "base/tile.h" #include "core/gimpimage.h" -#include "appenv.h" -#include "gdisplay.h" -#include "gimprc.h" +#include "gimpdisplay.h" +#include "gimpdisplay-render.h" #include "gximage.h" -#include "image_render.h" + +#include "appenv.h" +#include "gimprc.h" #define MAX_PREVIEW_SIZE 256 /* EEK */ diff --git a/app/display/gimpdisplay-scale.c b/app/display/gimpdisplay-scale.c index 9cc1d311c6..265b3d56a8 100644 --- a/app/display/gimpdisplay-scale.c +++ b/app/display/gimpdisplay-scale.c @@ -24,19 +24,19 @@ #include "libgimpbase/gimpbase.h" -#include "core/core-types.h" -#include "tools/tools-types.h" +#include "display-types.h" #include "core/gimpimage.h" #include "tools/gimptool.h" #include "tools/tool_manager.h" -#include "gdisplay.h" -#include "gdisplay_ops.h" +#include "gimpdisplay.h" +#include "gimpdisplay-ops.h" +#include "gimpdisplay-scale.h" + #include "gimprc.h" #include "nav_window.h" -#include "scale.h" void diff --git a/app/display/gimpdisplay-scroll.c b/app/display/gimpdisplay-scroll.c index 6e53f465ee..8d0222a4cf 100644 --- a/app/display/gimpdisplay-scroll.c +++ b/app/display/gimpdisplay-scroll.c @@ -22,7 +22,7 @@ #include -#include "tools/tools-types.h" +#include "display-types.h" #include "core/gimpimage.h" @@ -31,9 +31,10 @@ #include "tools/gimptool.h" #include "tools/tool_manager.h" -#include "gdisplay.h" -#include "scale.h" -#include "scroll.h" +#include "gimpdisplay.h" +#include "gimpdisplay-scale.h" +#include "gimpdisplay-scroll.h" + #include "nav_window.h" diff --git a/app/display/gimpdisplay-selection.c b/app/display/gimpdisplay-selection.c index 7835fd63b4..c7e5919d10 100644 --- a/app/display/gimpdisplay-selection.c +++ b/app/display/gimpdisplay-selection.c @@ -20,19 +20,20 @@ #include -#include "core/core-types.h" +#include "display-types.h" #include "base/boundary.h" #include "core/gimpimage.h" #include "core/gimpimage-mask.h" +#include "gimpdisplay.h" +#include "gimpdisplay-marching-ants.h" +#include "gimpdisplay-ops.h" +#include "gimpdisplay-selection.h" + #include "colormaps.h" -#include "gdisplay.h" -#include "gdisplay_ops.h" #include "gimprc.h" -#include "selection.h" -#include "marching_ants.h" #define USE_XDRAWPOINTS diff --git a/app/display/gimpdisplay.c b/app/display/gimpdisplay.c index eb1827dac2..1b0d32e648 100644 --- a/app/display/gimpdisplay.c +++ b/app/display/gimpdisplay.c @@ -26,8 +26,8 @@ #include "libgimpmath/gimpmath.h" #include "libgimpbase/gimpbase.h" -#include "core/core-types.h" -#include "tools/tools-types.h" +#include "display-types.h" +#include "gui/gui-types.h" /* FIXME */ #include "base/temp-buf.h" @@ -44,24 +44,25 @@ #include "tools/gimptool.h" #include "tools/tool_manager.h" -#include "disp_callbacks.h" -#include "gdisplay.h" -#include "gdisplay_ops.h" #include "gui/info-window.h" -#include "interface.h" #include "gui/menus.h" -#include "nav_window.h" + +#include "gimpdisplay.h" +#include "gimpdisplay-callbacks.h" +#include "gimpdisplay-ops.h" +#include "gimpdisplay-render.h" +#include "gimpdisplay-scale.h" +#include "gimpdisplay-selection.h" +#include "gimpdisplayshell.h" +#include "gximage.h" #include "app_procs.h" #include "appenv.h" #include "colormaps.h" #include "gimprc.h" -#include "gximage.h" -#include "image_render.h" +#include "nav_window.h" #include "plug_in.h" #include "qmask.h" -#include "scale.h" -#include "selection.h" #include "undo.h" #ifdef DISPLAY_FILTERS diff --git a/app/display/gimpdisplay.h b/app/display/gimpdisplay.h index 0342947e2e..c457cb9449 100644 --- a/app/display/gimpdisplay.h +++ b/app/display/gimpdisplay.h @@ -23,9 +23,8 @@ #include "core/gimpobject.h" -/* FIXME: move the display stuff to display/ */ - -#include "display/display-types.h" +/* FIXME move all GTK stuff to gimpdisplayshell */ +#include "gui/gui-types.h" /* some useful macros */ diff --git a/app/display/gimpdisplayshell-callbacks.c b/app/display/gimpdisplayshell-callbacks.c index fb5a341893..cb991dfe6e 100644 --- a/app/display/gimpdisplayshell-callbacks.c +++ b/app/display/gimpdisplayshell-callbacks.c @@ -25,8 +25,8 @@ #include "libgimpcolor/gimpcolor.h" -#include "core/core-types.h" -#include "tools/tools-types.h" +#include "display-types.h" +#include "gui/gui-types.h" #include "base/pixel-region.h" #include "base/temp-buf.h" @@ -55,13 +55,14 @@ #include "gui/info-window.h" #include "gui/layer-select.h" +#include "gimpdisplay.h" +#include "gimpdisplay-callbacks.h" +#include "gimpdisplay-selection.h" +#include "gimpdisplay-scale.h" +#include "gimpdisplay-scroll.h" + #include "devices.h" -#include "disp_callbacks.h" -#include "gdisplay.h" #include "gimprc.h" -#include "scale.h" -#include "scroll.h" -#include "selection.h" #include "undo.h" #include "libgimp/gimpintl.h" diff --git a/app/display/gimpdisplayshell-draw.c b/app/display/gimpdisplayshell-draw.c index 2d71f99dd2..1a7f2b40bd 100644 --- a/app/display/gimpdisplayshell-draw.c +++ b/app/display/gimpdisplayshell-draw.c @@ -22,7 +22,7 @@ #include "libgimpwidgets/gimpwidgets.h" -#include "display/display-types.h" +#include "display-types.h" #include "core/gimpbuffer.h" #include "core/gimpimage.h" @@ -33,13 +33,15 @@ #include "widgets/gimpdnd.h" #include "widgets/gimpwidgets-utils.h" -#include "disp_callbacks.h" -#include "gdisplay_ops.h" -#include "interface.h" #include "gui/menus.h" -#include "nav_window.h" + +#include "gimpdisplay.h" +#include "gimpdisplay-callbacks.h" +#include "gimpdisplay-ops.h" +#include "gimpdisplayshell.h" #include "gimprc.h" +#include "nav_window.h" #include "qmask.h" #include "pixmaps/qmasksel.xpm" diff --git a/app/display/gimpdisplayshell-layer-select.c b/app/display/gimpdisplayshell-layer-select.c index 1765755c51..755078a7b7 100644 --- a/app/display/gimpdisplayshell-layer-select.c +++ b/app/display/gimpdisplayshell-layer-select.c @@ -21,16 +21,16 @@ #include #include -#include "core/core-types.h" -#include "widgets/widgets-types.h" +#include "gui-types.h" #include "core/gimpimage.h" #include "core/gimplayer.h" +#include "display/gimpdisplay.h" + #include "widgets/gimppreview.h" #include "layer-select.h" -#include "gdisplay.h" #include "gimprc.h" diff --git a/app/display/gimpdisplayshell-qmask.c b/app/display/gimpdisplayshell-qmask.c index baf09dd1a5..07da95f3d0 100644 --- a/app/display/gimpdisplayshell-qmask.c +++ b/app/display/gimpdisplayshell-qmask.c @@ -35,11 +35,12 @@ #include "core/gimpimage.h" #include "core/gimpimage-mask.h" +#include "display/gimpdisplay.h" + #include "widgets/gimpcolorpanel.h" #include "app_procs.h" #include "floating_sel.h" -#include "gdisplay.h" #include "qmask.h" #include "undo.h" diff --git a/app/display/gimpdisplayshell-render.c b/app/display/gimpdisplayshell-render.c index 3a9fd5645f..61eeb00d87 100644 --- a/app/display/gimpdisplayshell-render.c +++ b/app/display/gimpdisplayshell-render.c @@ -23,18 +23,19 @@ #include -#include "core/core-types.h" +#include "display-types.h" #include "base/tile-manager.h" #include "base/tile.h" #include "core/gimpimage.h" -#include "appenv.h" -#include "gdisplay.h" -#include "gimprc.h" +#include "gimpdisplay.h" +#include "gimpdisplay-render.h" #include "gximage.h" -#include "image_render.h" + +#include "appenv.h" +#include "gimprc.h" #define MAX_PREVIEW_SIZE 256 /* EEK */ diff --git a/app/display/gimpdisplayshell-scale.c b/app/display/gimpdisplayshell-scale.c index 9cc1d311c6..265b3d56a8 100644 --- a/app/display/gimpdisplayshell-scale.c +++ b/app/display/gimpdisplayshell-scale.c @@ -24,19 +24,19 @@ #include "libgimpbase/gimpbase.h" -#include "core/core-types.h" -#include "tools/tools-types.h" +#include "display-types.h" #include "core/gimpimage.h" #include "tools/gimptool.h" #include "tools/tool_manager.h" -#include "gdisplay.h" -#include "gdisplay_ops.h" +#include "gimpdisplay.h" +#include "gimpdisplay-ops.h" +#include "gimpdisplay-scale.h" + #include "gimprc.h" #include "nav_window.h" -#include "scale.h" void diff --git a/app/display/gimpdisplayshell-scroll.c b/app/display/gimpdisplayshell-scroll.c index 6e53f465ee..8d0222a4cf 100644 --- a/app/display/gimpdisplayshell-scroll.c +++ b/app/display/gimpdisplayshell-scroll.c @@ -22,7 +22,7 @@ #include -#include "tools/tools-types.h" +#include "display-types.h" #include "core/gimpimage.h" @@ -31,9 +31,10 @@ #include "tools/gimptool.h" #include "tools/tool_manager.h" -#include "gdisplay.h" -#include "scale.h" -#include "scroll.h" +#include "gimpdisplay.h" +#include "gimpdisplay-scale.h" +#include "gimpdisplay-scroll.h" + #include "nav_window.h" diff --git a/app/display/gimpdisplayshell-selection.c b/app/display/gimpdisplayshell-selection.c index 7835fd63b4..c7e5919d10 100644 --- a/app/display/gimpdisplayshell-selection.c +++ b/app/display/gimpdisplayshell-selection.c @@ -20,19 +20,20 @@ #include -#include "core/core-types.h" +#include "display-types.h" #include "base/boundary.h" #include "core/gimpimage.h" #include "core/gimpimage-mask.h" +#include "gimpdisplay.h" +#include "gimpdisplay-marching-ants.h" +#include "gimpdisplay-ops.h" +#include "gimpdisplay-selection.h" + #include "colormaps.h" -#include "gdisplay.h" -#include "gdisplay_ops.h" #include "gimprc.h" -#include "selection.h" -#include "marching_ants.h" #define USE_XDRAWPOINTS diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c index 2d71f99dd2..1a7f2b40bd 100644 --- a/app/display/gimpdisplayshell.c +++ b/app/display/gimpdisplayshell.c @@ -22,7 +22,7 @@ #include "libgimpwidgets/gimpwidgets.h" -#include "display/display-types.h" +#include "display-types.h" #include "core/gimpbuffer.h" #include "core/gimpimage.h" @@ -33,13 +33,15 @@ #include "widgets/gimpdnd.h" #include "widgets/gimpwidgets-utils.h" -#include "disp_callbacks.h" -#include "gdisplay_ops.h" -#include "interface.h" #include "gui/menus.h" -#include "nav_window.h" + +#include "gimpdisplay.h" +#include "gimpdisplay-callbacks.h" +#include "gimpdisplay-ops.h" +#include "gimpdisplayshell.h" #include "gimprc.h" +#include "nav_window.h" #include "qmask.h" #include "pixmaps/qmasksel.xpm" diff --git a/app/display/gimpnavigationeditor.c b/app/display/gimpnavigationeditor.c index 8c8fe28e29..b0dba382e9 100644 --- a/app/display/gimpnavigationeditor.c +++ b/app/display/gimpnavigationeditor.c @@ -36,16 +36,17 @@ #include "core/gimpimage.h" #include "core/gimplist.h" +#include "display/gimpdisplay.h" +#include "display/gimpdisplay-scroll.h" +#include "display/gimpdisplay-scale.h" + #include "widgets/gimpnavigationpreview.h" #include "app_procs.h" -#include "gdisplay.h" #include "nav_window.h" #include "app_procs.h" #include "gimprc.h" -#include "scroll.h" -#include "scale.h" #include "libgimp/gimpintl.h" diff --git a/app/display/gimpnavigationview.c b/app/display/gimpnavigationview.c index 8c8fe28e29..b0dba382e9 100644 --- a/app/display/gimpnavigationview.c +++ b/app/display/gimpnavigationview.c @@ -36,16 +36,17 @@ #include "core/gimpimage.h" #include "core/gimplist.h" +#include "display/gimpdisplay.h" +#include "display/gimpdisplay-scroll.h" +#include "display/gimpdisplay-scale.h" + #include "widgets/gimpnavigationpreview.h" #include "app_procs.h" -#include "gdisplay.h" #include "nav_window.h" #include "app_procs.h" #include "gimprc.h" -#include "scroll.h" -#include "scale.h" #include "libgimp/gimpintl.h" diff --git a/app/display/gimpprogress.c b/app/display/gimpprogress.c index 1b50cedeca..c3d289f82a 100644 --- a/app/display/gimpprogress.c +++ b/app/display/gimpprogress.c @@ -24,7 +24,8 @@ #include "core/core-types.h" -#include "gdisplay.h" +#include "display/gimpdisplay.h" + #include "gimpprogress.h" #include "libgimp/gimpintl.h" diff --git a/app/docindex.c b/app/docindex.c index 01c4100e0a..7c6776d951 100644 --- a/app/docindex.c +++ b/app/docindex.c @@ -29,13 +29,14 @@ #include "core/gimpobject.h" +#include "display/gimpdisplay.h" + #include "widgets/gimpdnd.h" #include "gui/file-commands.h" #include "gui/file-open-dialog.h" #include "docindex.h" -#include "gdisplay.h" #include "ops_buttons.h" #include "libgimp/gimpintl.h" diff --git a/app/gdisplay.c b/app/gdisplay.c deleted file mode 100644 index eb1827dac2..0000000000 --- a/app/gdisplay.c +++ /dev/null @@ -1,2851 +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 -#include - -#include - -#include "libgimpmath/gimpmath.h" -#include "libgimpbase/gimpbase.h" - -#include "core/core-types.h" -#include "tools/tools-types.h" - -#include "base/temp-buf.h" - -#include "core/gimp.h" -#include "core/gimpchannel.h" -#include "core/gimpcontainer.h" -#include "core/gimpcontext.h" -#include "core/gimpimage.h" -#include "core/gimpimage-mask.h" -#include "core/gimplayer.h" - -#include "widgets/gimpcursor.h" - -#include "tools/gimptool.h" -#include "tools/tool_manager.h" - -#include "disp_callbacks.h" -#include "gdisplay.h" -#include "gdisplay_ops.h" -#include "gui/info-window.h" -#include "interface.h" -#include "gui/menus.h" -#include "nav_window.h" - -#include "app_procs.h" -#include "appenv.h" -#include "colormaps.h" -#include "gimprc.h" -#include "gximage.h" -#include "image_render.h" -#include "plug_in.h" -#include "qmask.h" -#include "scale.h" -#include "selection.h" -#include "undo.h" - -#ifdef DISPLAY_FILTERS -#include "gdisplay_color.h" -#endif /* DISPLAY_FILTERS */ - -#include "libgimp/gimpintl.h" - -#include "pixmaps/wilber.xpm" - - -/* EEEK, we shouldn't use this, but it will go away when - GDisplay is made a proper GObject */ - -#define g_signal_handlers_disconnect_by_data(instance,data) \ - g_signal_handlers_disconnect_matched (instance,\ - G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, data) - - -#define OVERHEAD 25 /* in units of pixel area */ -#define EPSILON 5 - -#define MAX_TITLE_BUF 256 - - -typedef struct _GimpArea GimpArea; - -struct _GimpArea -{ - gint x1, y1, x2, y2; /* area bounds */ -}; - - -/* Local functions */ -static void gimp_display_class_init (GimpDisplayClass *klass); -static void gimp_display_init (GimpDisplay *gdisp); - -static void gimp_display_finalize (GObject *object); - -static void gdisplay_format_title (GimpDisplay *gdisp, - gchar *title, - gint title_len); -static void gdisplay_delete (GimpDisplay *gdisp); -static GSList * gdisplay_free_area_list (GSList *list); -static GSList * gdisplay_process_area_list (GSList *list, - GimpArea *ga1); -static void gdisplay_add_update_area (GimpDisplay *gdisp, - gint x, - gint y, - gint w, - gint h); -static void gdisplay_add_display_area (GimpDisplay *gdisp, - gint x, - gint y, - gint w, - gint h); -static void gdisplay_paint_area (GimpDisplay *gdisp, - gint x, - gint y, - gint w, - gint h); -static void gdisplay_draw_cursor (GimpDisplay *gdisp); -static void gdisplay_display_area (GimpDisplay *gdisp, - gint x, - gint y, - gint w, - gint h); -static guint gdisplay_hash (GimpDisplay *gdisp); -static void gdisplay_cleandirty_handler (GimpImage *gdisp, - gpointer data); - - -static GimpObjectClass *parent_class = NULL; - -GSList *display_list = NULL; -static gint display_num = 1; -static GdkCursorType default_gdisplay_cursor = GDK_TOP_LEFT_ARROW; -static GHashTable *display_ht = NULL; - - -GType -gimp_display_get_type (void) -{ - static GType display_type = 0; - - if (! display_type) - { - static const GTypeInfo display_info = - { - sizeof (GimpDisplayClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gimp_display_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GimpDisplay), - 0, /* n_preallocs */ - (GInstanceInitFunc) gimp_display_init, - }; - - display_type = g_type_register_static (GIMP_TYPE_OBJECT, - "GimpDisplay", - &display_info, 0); - } - - return display_type; -} - -static void -gimp_display_class_init (GimpDisplayClass *klass) -{ - GObjectClass *object_class; - - object_class = G_OBJECT_CLASS (klass); - - parent_class = g_type_class_peek_parent (klass); - - object_class->finalize = gimp_display_finalize; -} - -static void -gimp_display_init (GimpDisplay *gdisp) -{ - gdisp->ID = display_num++; - - gdisp->ifactory = NULL; - - gdisp->shell = NULL; - gdisp->canvas = NULL; - gdisp->hsb = NULL; - gdisp->vsb = NULL; - gdisp->qmaskoff = NULL; - gdisp->qmaskon = NULL; - gdisp->hrule = NULL; - gdisp->vrule = NULL; - gdisp->origin = NULL; - gdisp->statusarea = NULL; - gdisp->progressbar = NULL; - gdisp->cursor_label = NULL; - gdisp->cursor_format_str[0] = '\0'; - gdisp->cancelbutton = NULL; - gdisp->progressid = FALSE; - - gdisp->window_info_dialog = NULL; - gdisp->window_nav_dialog = NULL; - gdisp->nav_popup = NULL; - gdisp->warning_dialog = NULL; - - gdisp->hsbdata = NULL; - gdisp->vsbdata = NULL; - - gdisp->icon = NULL; - gdisp->iconmask = NULL; - gdisp->iconsize = 0; - gdisp->icon_needs_update = FALSE; - gdisp->icon_timeout_id = 0; - gdisp->icon_idle_id = 0; - - gdisp->gimage = NULL; - gdisp->instance = 0; - - gdisp->disp_width = 0; - gdisp->disp_height = 0; - gdisp->disp_xoffset = 0; - gdisp->disp_yoffset = 0; - - gdisp->offset_x = 0; - gdisp->offset_y = 0; - gdisp->scale = 0; - gdisp->dot_for_dot = gimprc.default_dot_for_dot; - gdisp->draw_guides = TRUE; - gdisp->snap_to_guides = TRUE; - - gdisp->select = NULL; - - gdisp->scroll_gc = NULL; - - gdisp->update_areas = NULL; - gdisp->display_areas = NULL; - - gdisp->current_cursor = (GdkCursorType) -1; - gdisp->tool_cursor = GIMP_TOOL_CURSOR_NONE; - gdisp->cursor_modifier = GIMP_CURSOR_MODIFIER_NONE; - - gdisp->override_cursor = (GdkCursorType) -1; - gdisp->using_override_cursor = FALSE; - - gdisp->draw_cursor = FALSE; - gdisp->cursor_x = 0; - gdisp->cursor_y = 0; - gdisp->proximity = FALSE; - gdisp->have_cursor = FALSE; - - gdisp->idle_render.idleid = -1; - gdisp->idle_render.update_areas = NULL; - gdisp->idle_render.active = FALSE; - -#ifdef DISPLAY_FILTERS - gdisp->cd_list = NULL; - gdisp->cd_ui = NULL; -#endif /* DISPLAY_FILTERS */ -} - -static void -gimp_display_finalize (GObject *object) -{ - GimpDisplay *gdisp; - - g_return_if_fail (GIMP_IS_DISPLAY (object)); - - gdisp = GIMP_DISPLAY (object); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -GimpDisplay * -gdisplay_new (GimpImage *gimage, - guint scale) -{ - GimpDisplay *gdisp; - gchar title [MAX_TITLE_BUF]; - - /* If there isn't an interface, never create a gdisplay */ - if (no_interface) - return NULL; - - /* - * Set all GimpDisplay parameters... - */ - gdisp = g_object_new (GIMP_TYPE_DISPLAY, NULL); - - gdisp->gimage = gimage; - gdisp->instance = gimage->instance_count; - gdisp->scale = scale; - - gimage->instance_count++; /* this is obsolete */ - gimage->disp_count++; - - g_object_ref (G_OBJECT (gimage)); - - /* We're interested in clean and dirty signals so we can update the - * title if need be. - */ - g_signal_connect (G_OBJECT (gimage), "dirty", - G_CALLBACK (gdisplay_cleandirty_handler), gdisp); - g_signal_connect (G_OBJECT (gimage), "clean", - G_CALLBACK (gdisplay_cleandirty_handler), gdisp); - - /* format the title */ - gdisplay_format_title (gdisp, title, MAX_TITLE_BUF); - - /* add the new display to the list so that it isn't lost */ - display_list = g_slist_append (display_list, gdisp); - - /* create the shell for the image */ - create_display_shell (gdisp, gimage->width, gimage->height, - title, gimp_image_base_type (gimage)); - - /* update the title to correct the initially displayed scale */ - gdisplay_update_title (gdisp); - - /* set the qmask buttons */ - qmask_buttons_update (gdisp); - - /* set the user data */ - if (!display_ht) - display_ht = g_hash_table_new ((GHashFunc) gdisplay_hash, NULL); - - g_hash_table_insert (display_ht, gdisp->shell, gdisp); - g_hash_table_insert (display_ht, gdisp->canvas, gdisp); - - /* set the current tool cursor */ - gdisplay_install_tool_cursor (gdisp, - default_gdisplay_cursor, - GIMP_TOOL_CURSOR_NONE, - GIMP_CURSOR_MODIFIER_NONE); - - return gdisp; -} - -static int print (char *, int, int, const char *, ...) G_GNUC_PRINTF (4, 5); - -static int -print (char *buf, int len, int start, const char *fmt, ...) -{ - va_list args; - int printed; - - va_start (args, fmt); - - printed = g_vsnprintf (buf + start, len - start, fmt, args); - if (printed < 0) - printed = len - start; - - va_end (args); - - return printed; -} - -static void -gdisplay_format_title (GimpDisplay *gdisp, - gchar *title, - gint title_len) -{ - GimpImage *gimage; - gchar *image_type_str; - gint empty; - gint i; - gchar *format; - - g_return_if_fail (GIMP_IS_DISPLAY (gdisp)); - - gimage = gdisp->gimage; - - empty = gimp_image_is_empty (gimage); - - switch (gimp_image_base_type (gimage)) - { - case RGB: - image_type_str = (empty) ? _("RGB-empty") : _("RGB"); - break; - case GRAY: - image_type_str = (empty) ? _("grayscale-empty") : _("grayscale"); - break; - case INDEXED: - image_type_str = (empty) ? _("indexed-empty") : _("indexed"); - break; - default: - image_type_str = NULL; - } - - i = 0; - format = gimprc.image_title_format; - - while (i < title_len && *format) - { - switch (*format) - { - case '%': - format++; - switch (*format) - { - case 0: - g_warning ("image-title-format string ended within %%-sequence"); - break; - - case '%': - title[i++] = '%'; - break; - - case 'f': /* pruned filename */ - { - gchar *basename; - - basename = g_path_get_basename (gimp_image_filename (gimage)); - - i += print (title, title_len, i, "%s", basename); - - g_free (basename); - } - break; - - case 'F': /* full filename */ - i += print (title, title_len, i, "%s", gimp_image_filename (gimage)); - break; - - case 'p': /* PDB id */ - i += print (title, title_len, i, "%d", gimp_image_get_ID (gimage)); - break; - - case 'i': /* instance */ - i += print (title, title_len, i, "%d", gdisp->instance); - break; - - case 't': /* type */ - i += print (title, title_len, i, "%s", image_type_str); - break; - - case 's': /* user source zoom factor */ - i += print (title, title_len, i, "%d", SCALESRC (gdisp)); - break; - - case 'd': /* user destination zoom factor */ - i += print (title, title_len, i, "%d", SCALEDEST (gdisp)); - break; - - case 'z': /* user zoom factor (percentage) */ - i += print (title, title_len, i, - "%d", 100 * SCALEDEST (gdisp) / SCALESRC (gdisp)); - break; - - case 'D': /* dirty flag */ - if (format[1] == 0) - { - g_warning("image-title-format string ended within %%D-sequence"); - break; - } - if (gimage->dirty) - title[i++] = format[1]; - format++; - break; - - /* Other cool things to be added: - * %m = memory used by picture - * some kind of resolution / image size thing - * people seem to want to know the active layer name - */ - - default: - g_warning ("image-title-format contains unknown format sequence '%%%c'", *format); - break; - } - break; - - default: - title[i++] = *format; - break; - } - - format++; - } - - title[MIN(i, title_len-1)] = 0; -} - -static void -gdisplay_delete (GimpDisplay *gdisp) -{ - GimpTool *active_tool; - - g_return_if_fail (GIMP_IS_DISPLAY (gdisp)); - - g_hash_table_remove (display_ht, gdisp->shell); - g_hash_table_remove (display_ht, gdisp->canvas); - - /* stop any active tool */ - tool_manager_control_active (gdisp->gimage->gimp, HALT, gdisp); - - active_tool = tool_manager_get_active (gdisp->gimage->gimp); - - /* clear out the pointer to this gdisp from the active tool */ - if (active_tool && active_tool->gdisp == gdisp) - { - active_tool->drawable = NULL; - active_tool->gdisp = NULL; - } - - if (gdisp->select) - { - selection_free (gdisp->select); - gdisp->select = NULL; - } - - /* If this gdisplay was idlerendering at the time when it was deleted, - deactivate the idlerendering thread before deletion! */ - if (gdisp->idle_render.active) - { - g_source_remove (gdisp->idle_render.idleid); - gdisp->idle_render.active = FALSE; - } - -#ifdef DISPLAY_FILTERS - /* detach any color displays */ - gdisplay_color_detach_all (gdisp); -#endif /* DISPLAY_FILTERS */ - - /* get rid of signals handled by this display */ - g_signal_handlers_disconnect_by_data (G_OBJECT (gdisp->gimage), gdisp); - - if (gdisp->scroll_gc) - { - gdk_gc_unref (gdisp->scroll_gc); - gdisp->scroll_gc = NULL; - } - - /* free the area lists */ - gdisplay_free_area_list (gdisp->update_areas); - gdisplay_free_area_list (gdisp->display_areas); - - gdisplay_free_area_list (gdisp->idle_render.update_areas); - - /* remove dialogs before removing the image because they may want to - * disconnect from image signals - */ - if (gdisp->window_info_dialog) - { - info_window_free (gdisp->window_info_dialog); - gdisp->window_info_dialog = NULL; - } - - if (gdisp->window_nav_dialog) - { - nav_dialog_free (gdisp, gdisp->window_nav_dialog); - gdisp->window_nav_dialog = NULL; - } - - /* free the gimage */ - gdisp->gimage->disp_count--; - g_object_unref (G_OBJECT (gdisp->gimage)); - - if (gdisp->nav_popup) - { - nav_dialog_free (gdisp, gdisp->nav_popup); - gdisp->nav_popup = NULL; - } - - if (gdisp->icon_timeout_id) - { - g_source_remove (gdisp->icon_timeout_id); - gdisp->icon_timeout_id = 0; - } - - if (gdisp->icon_idle_id) - { - g_source_remove (gdisp->icon_idle_id); - gdisp->icon_idle_id = 0; - } - - if (gdisp->icon) - { - gdk_drawable_unref (gdisp->icon); - gdisp->icon = NULL; - } - if (gdisp->iconmask) - { - gdk_drawable_unref (gdisp->iconmask); - gdisp->iconmask = NULL; - } - - if (gdisp->shell) - { - gtk_widget_destroy (gdisp->shell); - gdisp->shell = NULL; - } - - g_object_unref (G_OBJECT (gdisp)); -} - -static GSList * -gdisplay_free_area_list (GSList *list) -{ - if (list) - { - g_slist_foreach (list, (GFunc) g_free, NULL); - g_slist_free (list); - } - - return NULL; -} - -/* - * As far as I can tell, this function takes a GimpArea and unifies it with - * an existing list of GimpAreas, trying to avoid overdraw. [adam] - */ -static GSList * -gdisplay_process_area_list (GSList *list, - GimpArea *ga1) -{ - GSList *new_list; - GSList *l; - gint area1, area2, area3; - GimpArea *ga2; - - /* start new list off */ - new_list = g_slist_prepend (NULL, ga1); - - for (l = list; l; l = g_slist_next (l)) - { - ga2 = (GimpArea *) l->data; - - area1 = (ga1->x2 - ga1->x1) * (ga1->y2 - ga1->y1) + OVERHEAD; - area2 = (ga2->x2 - ga2->x1) * (ga2->y2 - ga2->y1) + OVERHEAD; - area3 = (MAX (ga2->x2, ga1->x2) - MIN (ga2->x1, ga1->x1)) * - (MAX (ga2->y2, ga1->y2) - MIN (ga2->y1, ga1->y1)) + OVERHEAD; - - if ((area1 + area2) < area3) - { - new_list = g_slist_prepend (new_list, ga2); - } - else - { - ga1->x1 = MIN (ga1->x1, ga2->x1); - ga1->y1 = MIN (ga1->y1, ga2->y1); - ga1->x2 = MAX (ga1->x2, ga2->x2); - ga1->y2 = MAX (ga1->y2, ga2->y2); - - g_free (ga2); - } - } - - if (list) - g_slist_free (list); - - return new_list; -} - - -static gint -idle_render_next_area (GimpDisplay *gdisp) -{ - GimpArea *ga; - GSList *list; - - list = gdisp->idle_render.update_areas; - - if (list == NULL) - { - return -1; - } - - ga = (GimpArea *) list->data; - - gdisp->idle_render.update_areas = - g_slist_remove (gdisp->idle_render.update_areas, ga); - - gdisp->idle_render.x = gdisp->idle_render.basex = ga->x1; - gdisp->idle_render.y = gdisp->idle_render.basey = ga->y1; - gdisp->idle_render.width = ga->x2 - ga->x1; - gdisp->idle_render.height = ga->y2 - ga->y1; - - g_free (ga); - - return 0; -} - - -/* Unless specified otherwise, display re-rendering is organised by - * IdleRender, which amalgamates areas to be re-rendered and breaks - * them into bite-sized chunks which are chewed on in a low- priority - * idle thread. This greatly improves responsiveness for many GIMP - * operations. -- Adam - */ -static gint -idlerender_callback (gpointer data) -{ - const gint CHUNK_WIDTH = 256; - const gint CHUNK_HEIGHT = 128; - gint workx, worky, workw, workh; - GimpDisplay *gdisp = data; - - workw = CHUNK_WIDTH; - workh = CHUNK_HEIGHT; - workx = gdisp->idle_render.x; - worky = gdisp->idle_render.y; - - if (workx + workw > gdisp->idle_render.basex + gdisp->idle_render.width) - { - workw = gdisp->idle_render.basex + gdisp->idle_render.width - workx; - } - - if (worky+workh > gdisp->idle_render.basey+gdisp->idle_render.height) - { - workh = gdisp->idle_render.basey + gdisp->idle_render.height - worky; - } - - gdisplay_paint_area (gdisp, workx, worky, workw, workh); - gdisplay_flush_displays_only (gdisp); - - gdisp->idle_render.x += CHUNK_WIDTH; - if (gdisp->idle_render.x >= - gdisp->idle_render.basex + gdisp->idle_render.width) - { - gdisp->idle_render.x = gdisp->idle_render.basex; - gdisp->idle_render.y += CHUNK_HEIGHT; - if (gdisp->idle_render.y >= - gdisp->idle_render.basey + gdisp->idle_render.height) - { - if (idle_render_next_area(gdisp) != 0) - { - /* FINISHED */ - gdisp->idle_render.active = FALSE; - - return 0; - } - } - } - - /* Still work to do. */ - return 1; -} - - -static void -gdisplay_idlerender_init (GimpDisplay *gdisp) -{ - GSList *list; - GimpArea *ga, *new_ga; - -/* gdisplay_install_override_cursor(gdisp, GDK_CIRCLE); */ - - /* We need to merge the IdleRender's and the GimpDisplay's update_areas list - to keep track of which of the updates have been flushed and hence need - to be drawn. */ - list = gdisp->update_areas; - while (list) - { - ga = (GimpArea *) list->data; - new_ga = g_malloc (sizeof(GimpArea)); - memcpy (new_ga, ga, sizeof(GimpArea)); - - gdisp->idle_render.update_areas = - gdisplay_process_area_list (gdisp->idle_render.update_areas, new_ga); - - list = g_slist_next (list); - } - - /* If an idlerender was already running, merge the remainder of its - unrendered area with the update_areas list, and make it start work - on the next unrendered area in the list. */ - if (gdisp->idle_render.active) - { - new_ga = g_malloc (sizeof(GimpArea)); - new_ga->x1 = gdisp->idle_render.basex; - new_ga->y1 = gdisp->idle_render.y; - new_ga->x2 = gdisp->idle_render.basex + gdisp->idle_render.width; - new_ga->y2 = gdisp->idle_render.y + - (gdisp->idle_render.height - - (gdisp->idle_render.y - gdisp->idle_render.basey) - ); - - gdisp->idle_render.update_areas = - gdisplay_process_area_list (gdisp->idle_render.update_areas, new_ga); - - idle_render_next_area(gdisp); - } - else - { - if (gdisp->idle_render.update_areas == NULL) - { - g_warning ("Wanted to start idlerender thread with no update_areas. (+memleak)"); - return; - } - - idle_render_next_area(gdisp); - - gdisp->idle_render.active = TRUE; - - gdisp->idle_render.idleid = - gtk_idle_add_priority (GTK_PRIORITY_LOW, - idlerender_callback, gdisp); - } - - /* Caller frees gdisp->update_areas */ -} - - -void -gdisplay_flush_displays_only (GimpDisplay *gdisp) -{ - GSList *list; - GimpArea *ga; - - g_return_if_fail (GIMP_IS_DISPLAY (gdisp)); - - list = gdisp->display_areas; - - if (list) - { - /* stop the currently active tool */ - tool_manager_control_active (gdisp->gimage->gimp, PAUSE, gdisp); - - while (list) - { - /* Paint the area specified by the GimpArea */ - ga = (GimpArea *) list->data; - gdisplay_display_area (gdisp, ga->x1, ga->y1, - (ga->x2 - ga->x1), (ga->y2 - ga->y1)); - - list = g_slist_next (list); - } - /* Free the update lists */ - gdisp->display_areas = gdisplay_free_area_list (gdisp->display_areas); - - /* draw the guides */ - gdisplay_draw_guides (gdisp); - - /* and the cursor (if we have a software cursor */ - if (gdisp->have_cursor) - gdisplay_draw_cursor (gdisp); - - /* restart (and recalculate) the selection boundaries */ - selection_start (gdisp->select, TRUE); - - /* start the currently active tool */ - tool_manager_control_active (gdisp->gimage->gimp, RESUME, gdisp); - } -} - - -static void -gdisplay_flush_whenever (GimpDisplay *gdisp, - gboolean now) -{ - GSList *list; - GimpArea *ga; - - /* Flush the items in the displays and updates lists - - * but only if gdisplay has been mapped and exposed - */ - if (!gdisp->select) - return; - - /* First the updates... */ - if (now) - { /* Synchronous */ - list = gdisp->update_areas; - while (list) - { - /* Paint the area specified by the GimpArea */ - ga = (GimpArea *) list->data; - - if ((ga->x1 != ga->x2) && (ga->y1 != ga->y2)) - { - gdisplay_paint_area (gdisp, ga->x1, ga->y1, - (ga->x2 - ga->x1), (ga->y2 - ga->y1)); - } - - list = g_slist_next (list); - } - } - else - { /* Asynchronous */ - if (gdisp->update_areas) - gdisplay_idlerender_init (gdisp); - } - /* Free the update lists */ - gdisp->update_areas = gdisplay_free_area_list (gdisp->update_areas); - - /* Next the displays... */ - gdisplay_flush_displays_only (gdisp); - - /* update the gdisplay's info dialog */ - info_window_update (gdisp); - - /* update the gdisplay's qmask buttons */ - qmask_buttons_update (gdisp); - - /* ensure the consistency of the tear-off menus */ - if (! now && - gimp_context_get_display (gimp_get_user_context - (gdisp->gimage->gimp)) == gdisp) - { - gdisplay_set_menu_sensitivity (gdisp); - } -} - -void -gdisplay_flush (GimpDisplay *gdisp) -{ - g_return_if_fail (GIMP_IS_DISPLAY (gdisp)); - - /* Redraw on idle time */ - gdisplay_flush_whenever (gdisp, FALSE); -} - -void -gdisplay_flush_now (GimpDisplay *gdisp) -{ - g_return_if_fail (GIMP_IS_DISPLAY (gdisp)); - - /* Redraw NOW */ - gdisplay_flush_whenever (gdisp, TRUE); -} - -/* Force all gdisplays to finish their idlerender projection */ -void -gdisplays_finish_draw (void) -{ - GSList *list = display_list; - GimpDisplay *gdisp; - - while (list) - { - gdisp = (GimpDisplay *) list->data; - - if (gdisp->idle_render.active) - { - gtk_idle_remove (gdisp->idle_render.idleid); - while (idlerender_callback(gdisp)); - } - list = g_slist_next (list); - } -} - -void -gdisplay_update_icon (GimpDisplay *gdisp) -{ - - /* Warning: Lots of obscure Gdk-Stuff ahead. */ - - static GdkPixmap *wilber_pixmap = NULL; - static GdkBitmap *wilber_mask = NULL; - GtkStyle *style; - GdkGC *icongc, *iconmaskgc; - GdkColormap *colormap; - GdkColor black, white; - gboolean success; - - TempBuf *icondata; - guchar *data; - gint width, height; - gdouble factor; - - g_return_if_fail (GIMP_IS_DISPLAY (gdisp)); - - if (!gdisp->icon) - { - gdisp->icon = gdk_pixmap_new (gdisp->shell->window, - gdisp->iconsize, - gdisp->iconsize, - -1); - gdisp->iconmask = gdk_pixmap_new (NULL, - gdisp->iconsize, - gdisp->iconsize, - 1); - } - - icongc = gdk_gc_new (gdisp->icon); - iconmaskgc = gdk_gc_new (gdisp->iconmask); - colormap = gdk_colormap_get_system (); /* or gdk_rgb_get_colormap () */ - - white.red = 255; - white.green = 255; - white.blue = 255; - gdk_colormap_alloc_colors (colormap, &white, 1, FALSE, TRUE, &success); - - black.red = 0; - black.green = 0; - black.blue = 0; - gdk_colormap_alloc_colors (colormap, &black, 1, FALSE, TRUE, &success); - - if (! gdisp->icon_needs_update) - return; - - style = gtk_widget_get_style (gdisp->shell); - if (wilber_pixmap == NULL) - wilber_pixmap = - gdk_pixmap_create_from_xpm_d (gdisp->shell->window, - &wilber_mask, - &style->bg[GTK_STATE_NORMAL], - wilber_xpm); - - factor = ((gfloat) gimp_image_get_height (gdisp->gimage)) / - gimp_image_get_width (gdisp->gimage); - - if (factor >= 1) - { - height = MAX (gdisp->iconsize, 1); - width = MAX (((gfloat) gdisp->iconsize) / factor, 1); - } - else - { - height = MAX (((gfloat) gdisp->iconsize) * factor, 1); - width = MAX (gdisp->iconsize, 1); - } - - icondata = gimp_viewable_get_new_preview (GIMP_VIEWABLE (gdisp->gimage), - width, height); - data = temp_buf_data (icondata); - - /* Set up an icon mask */ - gdk_gc_set_foreground (iconmaskgc, &black); - gdk_draw_rectangle (gdisp->iconmask, iconmaskgc, TRUE, 0, 0, - gdisp->iconsize, gdisp->iconsize); - - gdk_gc_set_foreground (iconmaskgc, &white); - gdk_draw_rectangle (gdisp->iconmask, iconmaskgc, TRUE, - (gdisp->iconsize - icondata->width) / 2, - (gdisp->iconsize - icondata->height) / 2, - icondata->width, icondata->height); - - /* This is an ugly bad hack. There should be a clean way to get - * a preview in a specified depth with a nicely rendered - * checkerboard if no alpha channel is requested. - * We ignore the alpha channel for now. Also the aspect ratio is - * incorrect. - * - * Currently the icons are updated when you press the "menu" button in - * the top left corner of the window. Of course this should go in an - * idle routine. - */ - if (icondata->bytes == 1) - { - gdk_draw_gray_image (gdisp->icon, - icongc, - (gdisp->iconsize - icondata->width) / 2, - (gdisp->iconsize - icondata->height) / 2, - icondata->width, - icondata->height, - GDK_RGB_DITHER_MAX, - data, - icondata->width * icondata->bytes); - gdk_window_set_icon (gdisp->shell->window, - NULL, gdisp->icon, gdisp->iconmask); - } - else if (icondata->bytes == 3) - { - gdk_draw_rgb_image (gdisp->icon, - icongc, - (gdisp->iconsize - icondata->width) / 2, - (gdisp->iconsize - icondata->height) / 2, - icondata->width, - icondata->height, - GDK_RGB_DITHER_MAX, - data, - icondata->width * icondata->bytes); - gdk_window_set_icon (gdisp->shell->window, - NULL, gdisp->icon, gdisp->iconmask); - } - else if (icondata->bytes == 4) - { - gdk_draw_rgb_32_image (gdisp->icon, - icongc, - (gdisp->iconsize - icondata->width) / 2, - (gdisp->iconsize - icondata->height) / 2, - icondata->width, - icondata->height, - GDK_RGB_DITHER_MAX, - data, - icondata->width * icondata->bytes); - gdk_window_set_icon (gdisp->shell->window, - NULL, gdisp->icon, gdisp->iconmask); - } - else - { - g_printerr ("gdisplay_update_icon: falling back to default\n"); - gdk_window_set_icon (gdisp->shell->window, - NULL, wilber_pixmap, wilber_mask); - } - - gdisp->icon_needs_update = 0; - - gdk_gc_unref (icongc); - gdk_gc_unref (iconmaskgc); - - temp_buf_free (icondata); -} - -/* This function marks the icon as invalid and sets up the infrastructure - * to check every 8 seconds if an update is necessary. - */ - -void -gdisplay_update_icon_scheduler (GimpImage *gimage, - gpointer data) -{ - GimpDisplay *gdisp; - - gdisp = (GimpDisplay *) data; - - if (gdisp == gdisplays_check_valid (gdisp, gimage)) - { - gdisp->icon_needs_update = 1; - if (!gdisp->icon_timeout_id) - { - gdisp->icon_timeout_id = g_timeout_add (7500, - gdisplay_update_icon_timer, - gdisp); - if (!gdisp->icon_idle_id) - gdisp->icon_idle_id = g_idle_add (gdisplay_update_icon_invoker, - gdisp); - } - } - else - { - g_printerr ("gdisplay_update_icon_scheduler called for invalid gdisplay\n"); - } -} - -/* this timer is necessary to check if the icon is invalid and if yes - * adds the update function to the idle loop - */ -gboolean -gdisplay_update_icon_timer (gpointer data) -{ - GimpDisplay *gdisp; - - /* we should check this for validity... */ - gdisp = (GimpDisplay *) data; - - if (gdisp->icon_needs_update == 1 && !gdisp->icon_idle_id) - gdisp->icon_idle_id = g_idle_add (gdisplay_update_icon_invoker, gdisp); - - return TRUE; -} - -/* Just a dumb invoker for gdisplay_update_icon () */ -gboolean -gdisplay_update_icon_invoker (gpointer data) -{ - GimpDisplay *gdisp; - - /* we should check this for validity... */ - gdisp = (GimpDisplay *) data; - - gdisplay_update_icon (gdisp); - - gdisp->icon_idle_id = 0; - return FALSE; -} - - -void -gdisplay_draw_guides (GimpDisplay *gdisp) -{ - GList *list; - GimpGuide *guide; - - g_return_if_fail (GIMP_IS_DISPLAY (gdisp)); - - if (gdisp->draw_guides) - { - for (list = gdisp->gimage->guides; list; list = g_list_next (list)) - { - guide = (GimpGuide *) list->data; - - gdisplay_draw_guide (gdisp, guide, FALSE); - } - } -} - -void -gdisplay_draw_guide (GimpDisplay *gdisp, - GimpGuide *guide, - gboolean active) -{ - static GdkGC *normal_hgc = NULL; - static GdkGC *active_hgc = NULL; - static GdkGC *normal_vgc = NULL; - static GdkGC *active_vgc = NULL; - static gboolean initialize = TRUE; - gint x1, x2; - gint y1, y2; - gint w, h; - gint x, y; - - g_return_if_fail (GIMP_IS_DISPLAY (gdisp)); - - if (guide->position < 0) - return; - - if (initialize) - { - GdkGCValues values; - const char stipple[] = - { - 0xF0, /* ####---- */ - 0xE1, /* ###----# */ - 0xC3, /* ##----## */ - 0x87, /* #----### */ - 0x0F, /* ----#### */ - 0x1E, /* ---####- */ - 0x3C, /* --####-- */ - 0x78, /* -####--- */ - }; - - initialize = FALSE; - - values.foreground.pixel = gdisplay_black_pixel (gdisp); - values.background.pixel = g_normal_guide_pixel; - values.fill = GDK_OPAQUE_STIPPLED; - values.stipple = gdk_bitmap_create_from_data (gdisp->canvas->window, - (char*) stipple, 8, 1); - normal_hgc = gdk_gc_new_with_values (gdisp->canvas->window, &values, - GDK_GC_FOREGROUND | - GDK_GC_BACKGROUND | - GDK_GC_FILL | - GDK_GC_STIPPLE); - - values.background.pixel = g_active_guide_pixel; - active_hgc = gdk_gc_new_with_values (gdisp->canvas->window, &values, - GDK_GC_FOREGROUND | - GDK_GC_BACKGROUND | - GDK_GC_FILL | - GDK_GC_STIPPLE); - - values.foreground.pixel = gdisplay_black_pixel (gdisp); - values.background.pixel = g_normal_guide_pixel; - values.fill = GDK_OPAQUE_STIPPLED; - values.stipple = gdk_bitmap_create_from_data (gdisp->canvas->window, - (char*) stipple, 1, 8); - normal_vgc = gdk_gc_new_with_values (gdisp->canvas->window, &values, - GDK_GC_FOREGROUND | - GDK_GC_BACKGROUND | - GDK_GC_FILL | - GDK_GC_STIPPLE); - - values.background.pixel = g_active_guide_pixel; - active_vgc = gdk_gc_new_with_values (gdisp->canvas->window, &values, - GDK_GC_FOREGROUND | - GDK_GC_BACKGROUND | - GDK_GC_FILL | - GDK_GC_STIPPLE); - } - - gdisplay_transform_coords (gdisp, 0, 0, &x1, &y1, FALSE); - gdisplay_transform_coords (gdisp, - gdisp->gimage->width, gdisp->gimage->height, - &x2, &y2, FALSE); - gdk_drawable_get_size (gdisp->canvas->window, &w, &h); - - if (x1 < 0) x1 = 0; - if (y1 < 0) y1 = 0; - if (x2 > w) x2 = w; - if (y2 > h) y2 = h; - - if (guide->orientation == ORIENTATION_HORIZONTAL) - { - gdisplay_transform_coords (gdisp, 0, guide->position, &x, &y, FALSE); - - if (active) - gdk_draw_line (gdisp->canvas->window, active_hgc, x1, y, x2, y); - else - gdk_draw_line (gdisp->canvas->window, normal_hgc, x1, y, x2, y); - } - else if (guide->orientation == ORIENTATION_VERTICAL) - { - gdisplay_transform_coords (gdisp, guide->position, 0, &x, &y, FALSE); - - if (active) - gdk_draw_line (gdisp->canvas->window, active_vgc, x, y1, x, y2); - else - gdk_draw_line (gdisp->canvas->window, normal_vgc, x, y1, x, y2); - } -} - -GimpGuide * -gdisplay_find_guide (GimpDisplay *gdisp, - gdouble x, - gdouble y) -{ - GList *list; - GimpGuide *guide; - gint offset_x, offset_y; - gdouble scalex, scaley; - gdouble pos; - - g_return_val_if_fail (GIMP_IS_DISPLAY (gdisp), NULL); - - if (gdisp->draw_guides) - { - offset_x = gdisp->offset_x - gdisp->disp_xoffset; - offset_y = gdisp->offset_y - gdisp->disp_yoffset; - scalex = SCALEFACTOR_X (gdisp); - scaley = SCALEFACTOR_Y (gdisp); - - for (list = gdisp->gimage->guides; list; list = g_list_next (list)) - { - guide = (GimpGuide *) list->data; - - switch (guide->orientation) - { - case ORIENTATION_HORIZONTAL: - pos = scaley * guide->position - offset_y; - if ((guide->position != -1) && - (pos > (y - EPSILON)) && - (pos < (y + EPSILON))) - return guide; - break; - - case ORIENTATION_VERTICAL: - pos = scalex * guide->position - offset_x; - if ((guide->position != -1) && - (pos > (x - EPSILON)) && - (pos < (x + EPSILON))) - return guide; - break; - - default: - break; - } - } - } - - return NULL; -} - -gboolean -gdisplay_snap_point (GimpDisplay *gdisp, - gdouble x, - gdouble y, - gdouble *tx, - gdouble *ty) -{ - GList *list; - GimpGuide *guide; - gdouble scalex, scaley; - gdouble pos; - gint offset_x, offset_y; - gint minhdist, minvdist; - gint dist; - gboolean snapped = FALSE; - - g_return_val_if_fail (GIMP_IS_DISPLAY (gdisp), FALSE); - - *tx = x; - *ty = y; - - if (gdisp->draw_guides && - gdisp->snap_to_guides && - gdisp->gimage->guides) - { - offset_x = gdisp->offset_x - gdisp->disp_xoffset; - offset_y = gdisp->offset_y - gdisp->disp_yoffset; - scalex = SCALEFACTOR_X (gdisp); - scaley = SCALEFACTOR_Y (gdisp); - - minhdist = G_MAXINT; - minvdist = G_MAXINT; - - for (list = gdisp->gimage->guides; list; list = g_list_next (list)) - { - guide = (GimpGuide *) list->data; - - switch (guide->orientation) - { - case ORIENTATION_HORIZONTAL: - pos = scaley * guide->position - offset_y; - - if ((pos > (y - EPSILON)) && - (pos < (y + EPSILON))) - { - dist = (int) pos - y; - dist = ABS (dist); - - if (dist < minhdist) - { - minhdist = dist; - *ty = pos; - snapped = TRUE; - } - } - break; - - case ORIENTATION_VERTICAL: - pos = scalex * guide->position - offset_x; - - if ((pos > (x - EPSILON)) && - (pos < (x + EPSILON))) - { - dist = (int) pos - x; - dist = ABS (dist); - - if (dist < minvdist) - { - minvdist = dist; - *tx = pos; - snapped = TRUE; - } - } - break; - - default: - break; - } - } - } - return snapped; -} - -void -gdisplay_snap_rectangle (GimpDisplay *gdisp, - gdouble x1, - gdouble y1, - gdouble x2, - gdouble y2, - gdouble *tx1, - gdouble *ty1) -{ - gdouble nx1, ny1; - gdouble nx2, ny2; - gboolean snap1, snap2; - - g_return_if_fail (GIMP_IS_DISPLAY (gdisp)); - - *tx1 = x1; - *ty1 = y1; - - snap1 = gdisplay_snap_point (gdisp, x1, y1, &nx1, &ny1); - snap2 = gdisplay_snap_point (gdisp, x2, y2, &nx2, &ny2); - - if (snap1 || snap2) - { - if (x1 != nx1) - *tx1 = nx1; - else if (x2 != nx2) - *tx1 = x1 + (nx2 - x2); - - if (y1 != ny1) - *ty1 = ny1; - else if (y2 != ny2) - *ty1 = y1 + (ny2 - y2); - } -} - -void -gdisplay_draw_cursor (GimpDisplay *gdisp) -{ - gint x = gdisp->cursor_x; - gint y = gdisp->cursor_y; - - g_return_if_fail (GIMP_IS_DISPLAY (gdisp)); - - gdk_draw_line (gdisp->canvas->window, - gdisp->canvas->style->white_gc, - x - 7, y-1, x + 7, y-1); - gdk_draw_line (gdisp->canvas->window, - gdisp->canvas->style->black_gc, - x - 7, y, x + 7, y); - gdk_draw_line (gdisp->canvas->window, - gdisp->canvas->style->white_gc, - x - 7, y+1, x + 7, y+1); - gdk_draw_line (gdisp->canvas->window, - gdisp->canvas->style->white_gc, - x-1, y - 7, x-1, y + 7); - gdk_draw_line (gdisp->canvas->window, - gdisp->canvas->style->black_gc, - x, y - 7, x, y + 7); - gdk_draw_line (gdisp->canvas->window, - gdisp->canvas->style->white_gc, - x+1, y - 7, x+1, y + 7); -} - -void -gdisplay_update_cursor (GimpDisplay *gdisp, - gint x, - gint y) -{ - gint new_cursor; - gchar buffer[CURSOR_STR_LENGTH]; - gint t_x; - gint t_y; - - g_return_if_fail (GIMP_IS_DISPLAY (gdisp)); - - new_cursor = gdisp->draw_cursor && gdisp->proximity; - - /* Erase old cursor, if necessary */ - - if (gdisp->have_cursor && (!new_cursor || x != gdisp->cursor_x || - y != gdisp->cursor_y)) - { - gdisplay_expose_area (gdisp, gdisp->cursor_x - 7, - gdisp->cursor_y - 7, - 15, 15); - if (!new_cursor) - { - gdisp->have_cursor = FALSE; - gdisplay_flush (gdisp); - } - } - - gdisplay_untransform_coords (gdisp, x, y, &t_x, &t_y, FALSE, FALSE); - - if (t_x < 0 || - t_y < 0 || - t_x >= gdisp->gimage->width || - t_y >= gdisp->gimage->height) - { - gtk_label_set_text (GTK_LABEL (gdisp->cursor_label), ""); - info_window_update_extended (gdisp, -1, -1); - } - else - { - if (gdisp->dot_for_dot) - { - g_snprintf (buffer, CURSOR_STR_LENGTH, - gdisp->cursor_format_str, "", t_x, ", ", t_y); - } - else /* show real world units */ - { - gdouble unit_factor = gimp_unit_get_factor (gdisp->gimage->unit); - - g_snprintf - (buffer, CURSOR_STR_LENGTH, gdisp->cursor_format_str, - "", - (gdouble) t_x * unit_factor / gdisp->gimage->xresolution, - ", ", - (gdouble) t_y * unit_factor / gdisp->gimage->yresolution); - } - gtk_label_set_text (GTK_LABEL (gdisp->cursor_label), buffer); - info_window_update_extended (gdisp, t_x, t_y); - } - - gdisp->have_cursor = new_cursor; - gdisp->cursor_x = x; - gdisp->cursor_y = y; - - if (new_cursor) - gdisplay_flush (gdisp); -} - - -void -gdisplay_set_dot_for_dot (GimpDisplay *gdisp, - gboolean dot_for_dot) -{ - g_return_if_fail (GIMP_IS_DISPLAY (gdisp)); - - if (dot_for_dot != gdisp->dot_for_dot) - { - gdisp->dot_for_dot = dot_for_dot; - - gdisplay_resize_cursor_label (gdisp); - resize_display (gdisp, gimprc.allow_resize_windows, TRUE); - } -} - - -/* Set a proper size for the coordinates display in the statusbar. */ -void -gdisplay_resize_cursor_label (GimpDisplay *gdisp) -{ - static PangoLayout *layout = NULL; - gchar buffer[CURSOR_STR_LENGTH]; - gint cursor_label_width; - gint label_frame_size_difference; - - g_return_if_fail (GIMP_IS_DISPLAY (gdisp)); - - if (gdisp->dot_for_dot) - { - g_snprintf (gdisp->cursor_format_str, sizeof (gdisp->cursor_format_str), - "%%s%%d%%s%%d"); - g_snprintf (buffer, sizeof (buffer), gdisp->cursor_format_str, - "", gdisp->gimage->width, ", ", gdisp->gimage->height); - } - else /* show real world units */ - { - gdouble unit_factor = gimp_unit_get_factor (gdisp->gimage->unit); - - g_snprintf (gdisp->cursor_format_str, sizeof (gdisp->cursor_format_str), - "%%s%%.%df%%s%%.%df %s", - gimp_unit_get_digits (gdisp->gimage->unit), - gimp_unit_get_digits (gdisp->gimage->unit), - gimp_unit_get_symbol (gdisp->gimage->unit)); - - g_snprintf (buffer, sizeof (buffer), gdisp->cursor_format_str, - "", - (gdouble) gdisp->gimage->width * unit_factor / - gdisp->gimage->xresolution, - ", ", - (gdouble) gdisp->gimage->height * unit_factor / - gdisp->gimage->yresolution); - } - - /* one static layout for all displays should be fine */ - if (!layout) - layout = gtk_widget_create_pango_layout (gdisp->cursor_label, buffer); - else - pango_layout_set_text (layout, buffer, -1); - - pango_layout_get_pixel_size (layout, &cursor_label_width, NULL); - - /* find out how many pixels the label's parent frame is bigger than - * the label itself - */ - label_frame_size_difference = - gdisp->cursor_label->parent->allocation.width - - gdisp->cursor_label->allocation.width; - - gtk_widget_set_usize (gdisp->cursor_label, cursor_label_width, -1); - - /* don't resize if this is a new display */ - if (label_frame_size_difference) - gtk_widget_set_usize (gdisp->cursor_label->parent, - cursor_label_width + label_frame_size_difference, -1); - - gdisplay_update_cursor (gdisp, gdisp->cursor_x, gdisp->cursor_y); -} - -void -gdisplay_remove_and_delete (GimpDisplay *gdisp) -{ - g_return_if_fail (GIMP_IS_DISPLAY (gdisp)); - - /* remove the display from the list */ - display_list = g_slist_remove (display_list, (void *) gdisp); - gdisplay_delete (gdisp); -} - - -static void -gdisplay_add_update_area (GimpDisplay *gdisp, - gint x, - gint y, - gint w, - gint h) -{ - GimpArea * ga; - - g_return_if_fail (GIMP_IS_DISPLAY (gdisp)); - - ga = g_new (GimpArea, 1); - - ga->x1 = CLAMP (x, 0, gdisp->gimage->width); - ga->y1 = CLAMP (y, 0, gdisp->gimage->height); - ga->x2 = CLAMP (x + w, 0, gdisp->gimage->width); - ga->y2 = CLAMP (y + h, 0, gdisp->gimage->height); - - gdisp->update_areas = gdisplay_process_area_list (gdisp->update_areas, ga); -} - - -static void -gdisplay_add_display_area (GimpDisplay *gdisp, - gint x, - gint y, - gint w, - gint h) -{ - GimpArea * ga; - - g_return_if_fail (GIMP_IS_DISPLAY (gdisp)); - - ga = g_new (GimpArea, 1); - - ga->x1 = CLAMP (x, 0, gdisp->disp_width); - ga->y1 = CLAMP (y, 0, gdisp->disp_height); - ga->x2 = CLAMP (x + w, 0, gdisp->disp_width); - ga->y2 = CLAMP (y + h, 0, gdisp->disp_height); - - gdisp->display_areas = gdisplay_process_area_list (gdisp->display_areas, ga); -} - - -static void -gdisplay_paint_area (GimpDisplay *gdisp, - gint x, - gint y, - gint w, - gint h) -{ - gint x1, y1, x2, y2; - - /* Bounds check */ - x1 = CLAMP (x, 0, gdisp->gimage->width); - y1 = CLAMP (y, 0, gdisp->gimage->height); - x2 = CLAMP (x + w, 0, gdisp->gimage->width); - y2 = CLAMP (y + h, 0, gdisp->gimage->height); - x = x1; - y = y1; - w = (x2 - x1); - h = (y2 - y1); - - /* calculate the extents of the update as limited by what's visible */ - gdisplay_untransform_coords (gdisp, 0, 0, &x1, &y1, FALSE, FALSE); - gdisplay_untransform_coords (gdisp, gdisp->disp_width, gdisp->disp_height, - &x2, &y2, FALSE, FALSE); - - gimp_image_invalidate (gdisp->gimage, x, y, w, h, x1, y1, x2, y2); - - /* display the area */ - gdisplay_transform_coords (gdisp, x, y, &x1, &y1, FALSE); - gdisplay_transform_coords (gdisp, x + w, y + h, &x2, &y2, FALSE); - - gdisplay_expose_area (gdisp, x1, y1, (x2 - x1), (y2 - y1)); -} - - -static void -gdisplay_display_area (GimpDisplay *gdisp, - gint x, - gint y, - gint w, - gint h) -{ - gint sx, sy; - gint x1, y1; - gint x2, y2; - gint dx, dy; - gint i, j; - guchar *buf; - gint bpp, bpl; -#ifdef DISPLAY_FILTERS - GList *list; -#endif /* DISPLAY_FILTERS */ - - buf = gximage_get_data (); - bpp = gximage_get_bpp (); - bpl = gximage_get_bpl (); - - sx = SCALEX (gdisp, gdisp->gimage->width); - sy = SCALEY (gdisp, gdisp->gimage->height); - - /* Bounds check */ - x1 = CLAMP (x, 0, gdisp->disp_width); - y1 = CLAMP (y, 0, gdisp->disp_height); - x2 = CLAMP (x + w, 0, gdisp->disp_width); - y2 = CLAMP (y + h, 0, gdisp->disp_height); - - if (y1 < gdisp->disp_yoffset) - { - gdk_draw_rectangle (gdisp->canvas->window, - gdisp->canvas->style->bg_gc[GTK_STATE_NORMAL], 1, - x, y, w, gdisp->disp_yoffset - y); - /* X X X - . # . - . . . */ - - y1 = gdisp->disp_yoffset; - } - - if (x1 < gdisp->disp_xoffset) - { - gdk_draw_rectangle (gdisp->canvas->window, - gdisp->canvas->style->bg_gc[GTK_STATE_NORMAL], 1, - x, y1, gdisp->disp_xoffset - x, h); - /* . . . - X # . - X . . */ - - x1 = gdisp->disp_xoffset; - } - - if (x2 > (gdisp->disp_xoffset + sx)) - { - gdk_draw_rectangle (gdisp->canvas->window, - gdisp->canvas->style->bg_gc[GTK_STATE_NORMAL], 1, - gdisp->disp_xoffset + sx, y1, - x2 - (gdisp->disp_xoffset + sx), h - (y1-y)); - /* . . . - . # X - . . X */ - - x2 = gdisp->disp_xoffset + sx; - } - - if (y2 > (gdisp->disp_yoffset + sy)) - { - gdk_draw_rectangle (gdisp->canvas->window, - gdisp->canvas->style->bg_gc[GTK_STATE_NORMAL], 1, - x1, gdisp->disp_yoffset + sy, - x2-x1, - y2 - (gdisp->disp_yoffset + sy)); - /* . . . - . # . - . X . */ - - y2 = gdisp->disp_yoffset + sy; - } - - /* display the image in GXIMAGE_WIDTH x GXIMAGE_HEIGHT sized chunks */ - for (i = y1; i < y2; i += GXIMAGE_HEIGHT) - for (j = x1; j < x2; j += GXIMAGE_WIDTH) - { - dx = MIN (x2 - j, GXIMAGE_WIDTH); - dy = MIN (y2 - i, GXIMAGE_HEIGHT); - render_image (gdisp, j - gdisp->disp_xoffset, i - gdisp->disp_yoffset, - dx, dy); -#if 0 - /* Invalidate the projection just after we render it! */ - gimp_image_invalidate_without_render (gdisp->gimage, - j - gdisp->disp_xoffset, - i - gdisp->disp_yoffset, - dx, dy, - 0, 0, 0, 0); -#endif - -#ifdef DISPLAY_FILTERS - list = gdisp->cd_list; - while (list) - { - ColorDisplayNode *node = (ColorDisplayNode *) list->data; - node->cd_convert (node->cd_ID, buf, dx, dy, bpp, bpl); - list = list->next; - } -#endif /* DISPLAY_FILTERS */ - - gximage_put (gdisp->canvas->window, - j, i, dx, dy, - gdisp->offset_x, - gdisp->offset_y); - } -} - -gint -gdisplay_mask_value (GimpDisplay *gdisp, - gint x, - gint y) -{ - g_return_val_if_fail (GIMP_IS_DISPLAY (gdisp), 0); - - /* move the coordinates from screen space to image space */ - gdisplay_untransform_coords (gdisp, x, y, &x, &y, FALSE, 0); - - return gimage_mask_value (gdisp->gimage, x, y); -} - -gboolean -gdisplay_mask_bounds (GimpDisplay *gdisp, - gint *x1, - gint *y1, - gint *x2, - gint *y2) -{ - GimpLayer *layer; - gint off_x; - gint off_y; - - g_return_val_if_fail (GIMP_IS_DISPLAY (gdisp), FALSE); - - /* If there is a floating selection, handle things differently */ - if ((layer = gimp_image_floating_sel (gdisp->gimage))) - { - gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y); - - if (! gimp_channel_bounds (gimp_image_get_mask (gdisp->gimage), - x1, y1, x2, y2)) - { - *x1 = off_x; - *y1 = off_y; - *x2 = off_x + gimp_drawable_width (GIMP_DRAWABLE (layer)); - *y2 = off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)); - } - else - { - *x1 = MIN (off_x, *x1); - *y1 = MIN (off_y, *y1); - *x2 = MAX (off_x + gimp_drawable_width (GIMP_DRAWABLE (layer)), *x2); - *y2 = MAX (off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)), *y2); - } - } - else if (! gimp_channel_bounds (gimp_image_get_mask (gdisp->gimage), - x1, y1, x2, y2)) - return FALSE; - - gdisplay_transform_coords (gdisp, *x1, *y1, x1, y1, 0); - gdisplay_transform_coords (gdisp, *x2, *y2, x2, y2, 0); - - /* Make sure the extents are within bounds */ - *x1 = CLAMP (*x1, 0, gdisp->disp_width); - *y1 = CLAMP (*y1, 0, gdisp->disp_height); - *x2 = CLAMP (*x2, 0, gdisp->disp_width); - *y2 = CLAMP (*y2, 0, gdisp->disp_height); - - return TRUE; -} - -void -gdisplay_transform_coords (GimpDisplay *gdisp, - gint x, - gint y, - gint *nx, - gint *ny, - gboolean use_offsets) -{ - gdouble scalex; - gdouble scaley; - gint offset_x; - gint offset_y; - - g_return_if_fail (GIMP_IS_DISPLAY (gdisp)); - - /* transform from image coordinates to screen coordinates */ - scalex = SCALEFACTOR_X (gdisp); - scaley = SCALEFACTOR_Y (gdisp); - - if (use_offsets) - gimp_drawable_offsets (gimp_image_active_drawable (gdisp->gimage), - &offset_x, &offset_y); - else - { - offset_x = offset_y = 0; - } - - *nx = (int) (scalex * (x + offset_x) - gdisp->offset_x); - *ny = (int) (scaley * (y + offset_y) - gdisp->offset_y); - - *nx += gdisp->disp_xoffset; - *ny += gdisp->disp_yoffset; -} - -void -gdisplay_untransform_coords (GimpDisplay *gdisp, - gint x, - gint y, - gint *nx, - gint *ny, - gboolean round, - gboolean use_offsets) -{ - gdouble scalex; - gdouble scaley; - gint offset_x; - gint offset_y; - - g_return_if_fail (GIMP_IS_DISPLAY (gdisp)); - - x -= gdisp->disp_xoffset; - y -= gdisp->disp_yoffset; - - /* transform from screen coordinates to image coordinates */ - scalex = SCALEFACTOR_X (gdisp); - scaley = SCALEFACTOR_Y (gdisp); - - if (use_offsets) - gimp_drawable_offsets (gimp_image_active_drawable (gdisp->gimage), - &offset_x, &offset_y); - else - { - offset_x = offset_y = 0; - } - - if (round) - { - *nx = ROUND ((x + gdisp->offset_x) / scalex - offset_x); - *ny = ROUND ((y + gdisp->offset_y) / scaley - offset_y); - } - else - { - *nx = (int) ((x + gdisp->offset_x) / scalex - offset_x); - *ny = (int) ((y + gdisp->offset_y) / scaley - offset_y); - } -} - -void -gdisplay_transform_coords_f (GimpDisplay *gdisp, - gdouble x, - gdouble y, - gdouble *nx, - gdouble *ny, - gboolean use_offsets) -{ - gdouble scalex; - gdouble scaley; - gint offset_x; - gint offset_y; - - g_return_if_fail (GIMP_IS_DISPLAY (gdisp)); - - /* transform from gimp coordinates to screen coordinates */ - scalex = SCALEFACTOR_X (gdisp); - scaley = SCALEFACTOR_Y (gdisp); - - if (use_offsets) - gimp_drawable_offsets (gimp_image_active_drawable (gdisp->gimage), - &offset_x, &offset_y); - else - { - offset_x = offset_y = 0; - } - - *nx = scalex * (x + offset_x) - gdisp->offset_x; - *ny = scaley * (y + offset_y) - gdisp->offset_y; - - *nx += gdisp->disp_xoffset; - *ny += gdisp->disp_yoffset; -} - -void -gdisplay_untransform_coords_f (GimpDisplay *gdisp, - gdouble x, - gdouble y, - gdouble *nx, - gdouble *ny, - gboolean use_offsets) -{ - gdouble scalex; - gdouble scaley; - gint offset_x; - gint offset_y; - - g_return_if_fail (GIMP_IS_DISPLAY (gdisp)); - - x -= gdisp->disp_xoffset; - y -= gdisp->disp_yoffset; - - /* transform from screen coordinates to gimp coordinates */ - scalex = SCALEFACTOR_X (gdisp); - scaley = SCALEFACTOR_Y (gdisp); - - if (use_offsets) - gimp_drawable_offsets (gimp_image_active_drawable (gdisp->gimage), - &offset_x, &offset_y); - else - { - offset_x = offset_y = 0; - } - - *nx = (x + gdisp->offset_x) / scalex - offset_x; - *ny = (y + gdisp->offset_y) / scaley - offset_y; -} - -/* install and remove tool cursor from gdisplay... */ -void -gdisplay_real_install_tool_cursor (GimpDisplay *gdisp, - GdkCursorType cursor_type, - GimpToolCursorType tool_cursor, - GimpCursorModifier modifier, - gboolean always_install) -{ - g_return_if_fail (GIMP_IS_DISPLAY (gdisp)); - - if (cursor_type != GIMP_BAD_CURSOR) - { - switch (gimprc.cursor_mode) - { - case CURSOR_MODE_TOOL_ICON: - break; - - case CURSOR_MODE_TOOL_CROSSHAIR: - cursor_type = GIMP_CROSSHAIR_SMALL_CURSOR; - break; - - case CURSOR_MODE_CROSSHAIR: - cursor_type = GIMP_CROSSHAIR_CURSOR; - tool_cursor = GIMP_TOOL_CURSOR_NONE; - modifier = GIMP_CURSOR_MODIFIER_NONE; - break; - } - } - - if (gdisp->current_cursor != cursor_type || - gdisp->tool_cursor != tool_cursor || - gdisp->cursor_modifier != modifier || - always_install) - { - GdkCursor *cursor; - - gdisp->current_cursor = cursor_type; - gdisp->tool_cursor = tool_cursor; - gdisp->cursor_modifier = modifier; - - cursor = gimp_cursor_new (cursor_type, - tool_cursor, - modifier); - gdk_window_set_cursor (gdisp->canvas->window, cursor); - gdk_cursor_unref (cursor); - } -} - -void -gdisplay_install_tool_cursor (GimpDisplay *gdisp, - GdkCursorType cursor_type, - GimpToolCursorType tool_cursor, - GimpCursorModifier modifier) -{ - g_return_if_fail (GIMP_IS_DISPLAY (gdisp)); - - if (!gdisp->using_override_cursor) - gdisplay_real_install_tool_cursor (gdisp, - cursor_type, - tool_cursor, - modifier, - FALSE); -} - -void -gdisplay_install_override_cursor (GimpDisplay *gdisp, - GdkCursorType cursor_type) -{ - g_return_if_fail (GIMP_IS_DISPLAY (gdisp)); - - if (!gdisp->using_override_cursor || - (gdisp->using_override_cursor && - (gdisp->override_cursor != cursor_type))) - { - GdkCursor *cursor; - - gdisp->override_cursor = cursor_type; - gdisp->using_override_cursor = TRUE; - - cursor = gimp_cursor_new (cursor_type, - GIMP_TOOL_CURSOR_NONE, - GIMP_CURSOR_MODIFIER_NONE); - gdk_window_set_cursor (gdisp->canvas->window, cursor); - gdk_cursor_unref(cursor); - } -} - -void -gdisplay_remove_override_cursor (GimpDisplay *gdisp) -{ - g_return_if_fail (GIMP_IS_DISPLAY (gdisp)); - - if (gdisp->using_override_cursor) - { - gdisp->using_override_cursor = FALSE; - gdisplay_real_install_tool_cursor (gdisp, - gdisp->current_cursor, - gdisp->tool_cursor, - gdisp->cursor_modifier, - TRUE); - } -} - -void -gdisplay_remove_tool_cursor (GimpDisplay *gdisp) -{ - g_return_if_fail (GIMP_IS_DISPLAY (gdisp)); - - gdk_window_set_cursor (gdisp->canvas->window, NULL); -} - -void -gdisplay_set_menu_sensitivity (GimpDisplay *gdisp) -{ - GimpImageBaseType base_type = 0; - GimpImageType type = -1; - GimpDrawable *drawable = NULL; - GimpLayer *layer = NULL; - gboolean fs = FALSE; - gboolean aux = FALSE; - gboolean lm = FALSE; - gboolean lp = FALSE; - gboolean alpha = FALSE; - gint lind = -1; - gint lnum = -1; - - g_return_if_fail (! gdisp || GIMP_IS_DISPLAY (gdisp)); - - if (gdisp) - { - base_type = gimp_image_base_type (gdisp->gimage); - - fs = (gimp_image_floating_sel (gdisp->gimage) != NULL); - aux = (gimp_image_get_active_channel (gdisp->gimage) != NULL); - lp = ! gimp_image_is_empty (gdisp->gimage); - - drawable = gimp_image_active_drawable (gdisp->gimage); - if (drawable) - type = gimp_drawable_type (drawable); - - if (lp) - { - layer = gimp_image_get_active_layer (gdisp->gimage); - - if (layer) - { - lm = gimp_layer_get_mask (layer) ? TRUE : FALSE; - alpha = gimp_layer_has_alpha (layer); - lind = gimp_image_get_layer_index (gdisp->gimage, layer); - } - - lnum = gimp_container_num_children (gdisp->gimage->layers); - } - } - -#define SET_SENSITIVE(menu,condition) \ - menus_set_sensitive ("/" menu, (condition) != 0) -#define SET_STATE(menu,condition) \ - menus_set_state ("/" menu, (condition) != 0) - - SET_SENSITIVE ("File/Save", gdisp && drawable); - SET_SENSITIVE ("File/Save as...", gdisp && drawable); - SET_SENSITIVE ("File/Save a Copy as...", gdisp && drawable); - SET_SENSITIVE ("File/Revert...", gdisp && GIMP_OBJECT (gdisp->gimage)->name); - SET_SENSITIVE ("File/Close", gdisp); - - SET_SENSITIVE ("Edit", gdisp); - SET_SENSITIVE ("Edit/Buffer", gdisp); - if (gdisp) - { - /* Interactive tools such as CURVES, COLOR_BALANCE, LEVELS disable */ - /* undo to fake some kind of atomic behaviour. G. R. Osgood #14072 */ - - if (gimp_image_undo_is_enabled (gdisp->gimage)) - { - /* If undo/redo stacks are empty, disable respective menu */ - - SET_SENSITIVE ("Edit/Undo", undo_get_undo_name (gdisp->gimage)); - SET_SENSITIVE ("Edit/Redo", undo_get_redo_name (gdisp->gimage)); - } - else - { - SET_SENSITIVE ("Edit/Undo", FALSE); - SET_SENSITIVE ("Edit/Redo", FALSE); - } - SET_SENSITIVE ("Edit/Cut", lp); - SET_SENSITIVE ("Edit/Copy", lp); - SET_SENSITIVE ("Edit/Buffer/Cut Named...", lp); - SET_SENSITIVE ("Edit/Buffer/Copy Named...", lp); - SET_SENSITIVE ("Edit/Clear", lp); - SET_SENSITIVE ("Edit/Fill with FG Color", lp); - SET_SENSITIVE ("Edit/Fill with BG Color", lp); - SET_SENSITIVE ("Edit/Stroke", lp); - } - - SET_SENSITIVE ("Select", gdisp && lp); - SET_SENSITIVE ("Select/Save to Channel", !fs); - - SET_SENSITIVE ("View", gdisp); - SET_SENSITIVE ("View/Zoom", gdisp); - if (gdisp) - { - SET_STATE ("View/Toggle Selection", !gdisp->select->hidden); - SET_STATE ("View/Toggle Rulers", - GTK_WIDGET_VISIBLE (gdisp->origin) ? 1 : 0); - SET_STATE ("View/Toggle Guides", gdisp->draw_guides); - SET_STATE ("View/Snap to Guides", gdisp->snap_to_guides); - SET_STATE ("View/Toggle Statusbar", - GTK_WIDGET_VISIBLE (gdisp->statusarea) ? 1 : 0); - SET_STATE ("View/Dot for Dot", gdisp->dot_for_dot); - } - - SET_SENSITIVE ("Image", gdisp); - SET_SENSITIVE ("Image/Mode", gdisp); - SET_SENSITIVE ("Image/Colors", gdisp); - SET_SENSITIVE ("Image/Colors/Auto", gdisp); - SET_SENSITIVE ("Image/Alpha", gdisp); - SET_SENSITIVE ("Image/Transforms", gdisp); - SET_SENSITIVE ("Image/Transforms/Rotate", gdisp); - if (gdisp) - { - SET_SENSITIVE ("Image/Mode/RGB", (base_type != RGB)); - SET_SENSITIVE ("Image/Mode/Grayscale", (base_type != GRAY)); - SET_SENSITIVE ("Image/Mode/Indexed...", (base_type != INDEXED)); - - SET_SENSITIVE ("Image/Histogram...", lp); - - SET_SENSITIVE ("Image/Colors", lp); - SET_SENSITIVE ("Image/Colors/Color Balance...", (base_type == RGB)); - SET_SENSITIVE ("Image/Colors/Hue-Saturation...", (base_type == RGB)); - SET_SENSITIVE ("Image/Colors/Brightness-Contrast...", (base_type != INDEXED)); - SET_SENSITIVE ("Image/Colors/Threshold...", (base_type != INDEXED)); - SET_SENSITIVE ("Image/Colors/Levels...", (base_type != INDEXED)); - SET_SENSITIVE ("Image/Colors/Curves...", (base_type != INDEXED)); - SET_SENSITIVE ("Image/Colors/Desaturate", (base_type == RGB)); - SET_SENSITIVE ("Image/Colors/Posterize...", (base_type != INDEXED)); - SET_SENSITIVE ("Image/Colors/Invert", (base_type != INDEXED)); - SET_SENSITIVE ("Image/Colors/Auto/Equalize", (base_type != INDEXED)); - - SET_SENSITIVE ("Image/Alpha/Add Alpha Channel", - !fs && !aux && lp && !lm && !alpha); - - SET_SENSITIVE ("Image/Transforms/Offset...", lp); - } - - SET_SENSITIVE ("Layers/Stack", gdisp); - if (gdisp) - { - SET_SENSITIVE ("Layers/Stack/Previous Layer", - !fs && !aux && lp && lind > 0); - SET_SENSITIVE ("Layers/Stack/Next Layer", - !fs && !aux && lp && lind < (lnum - 1)); - SET_SENSITIVE ("Layers/Stack/Raise Layer", - !fs && !aux && lp && alpha && lind > 0); - SET_SENSITIVE ("Layers/Stack/Lower Layer", - !fs && !aux && lp && alpha && lind < (lnum - 1)); - SET_SENSITIVE ("Layers/Stack/Layer to Top", - !fs && !aux && lp && alpha && lind > 0); - SET_SENSITIVE ("Layers/Stack/Layer to Bottom", - !fs && !aux && lp && alpha && lind < (lnum - 1)); - } - SET_SENSITIVE ("Layers/Rotate", gdisp && !aux && !lm & lp); - SET_SENSITIVE ("Layers/Layer to Imagesize", gdisp && !aux && lp); - - SET_SENSITIVE ("Layers/Anchor Layer", gdisp && fs && !aux && lp); - SET_SENSITIVE ("Layers/Merge Visible Layers...", gdisp && !fs && !aux && lp); - SET_SENSITIVE ("Layers/Flatten Image", gdisp && !fs && !aux && lp); - SET_SENSITIVE ("Layers/Alpha to Selection", gdisp && !aux && lp && alpha); - SET_SENSITIVE ("Layers/Mask to Selection", gdisp && !aux && lm && lp); - SET_SENSITIVE ("Layers/Add Alpha Channel", - gdisp && !fs && !aux && lp && !lm && !alpha); - - SET_SENSITIVE ("Filters", gdisp && lp); - - SET_SENSITIVE ("Script-Fu", gdisp && lp); - -#undef SET_STATE -#undef SET_SENSITIVE - - plug_in_set_menu_sensitivity (type); -} - -void -gdisplay_expose_area (GimpDisplay *gdisp, - gint x, - gint y, - gint w, - gint h) -{ - g_return_if_fail (GIMP_IS_DISPLAY (gdisp)); - - gdisplay_add_display_area (gdisp, x, y, w, h); -} - -void -gdisplay_expose_guide (GimpDisplay *gdisp, - GimpGuide *guide) -{ - gint x; - gint y; - - g_return_if_fail (GIMP_IS_DISPLAY (gdisp)); - - if (guide->position < 0) - return; - - gdisplay_transform_coords (gdisp, guide->position, - guide->position, &x, &y, FALSE); - - switch (guide->orientation) - { - case ORIENTATION_HORIZONTAL: - gdisplay_expose_area (gdisp, 0, y, gdisp->disp_width, 1); - break; - - case ORIENTATION_VERTICAL: - gdisplay_expose_area (gdisp, x, 0, 1, gdisp->disp_height); - break; - - default: - break; - } -} - -void -gdisplay_expose_full (GimpDisplay *gdisp) -{ - g_return_if_fail (GIMP_IS_DISPLAY (gdisp)); - - gdisplay_add_display_area (gdisp, 0, 0, - gdisp->disp_width, - gdisp->disp_height); -} - -void -gdisplay_selection_visibility (GimpDisplay *gdisp, - GimpSelectionControl control) -{ - g_return_if_fail (GIMP_IS_DISPLAY (gdisp)); - - if (gdisp->select) - { - switch (control) - { - case GIMP_SELECTION_OFF: - selection_invis (gdisp->select); - break; - case GIMP_SELECTION_LAYER_OFF: - selection_layer_invis (gdisp->select); - break; - case GIMP_SELECTION_ON: - selection_start (gdisp->select, TRUE); - break; - case GIMP_SELECTION_PAUSE: - selection_pause (gdisp->select); - break; - case GIMP_SELECTION_RESUME: - selection_resume (gdisp->select); - break; - } - } -} - -/**************************************************/ -/* Functions independent of a specific gdisplay */ -/**************************************************/ - -GimpDisplay * -gdisplay_active (void) -{ - GdkEvent *event; - - /* Whoever finds out why we do this (see below) gets a free beer. - * Report back the reason to Sven and Mitch ... - */ - event = gtk_get_current_event (); - if (event != NULL) - { - gdk_event_free (event); - } - - return gimp_context_get_display (gimp_get_user_context (the_gimp)); -} - -GimpDisplay * -gdisplay_get_by_ID (Gimp *gimp, - gint ID) -{ - GimpDisplay *gdisp; - GSList *list; - - /* Traverse the list of displays, returning the one that matches the ID - * If no display in the list is a match, return NULL. - */ - for (list = display_list; list; list = g_slist_next (list)) - { - gdisp = (GimpDisplay *) list->data; - - if (gdisp->ID == ID) - return gdisp; - } - - return NULL; -} - -void -gdisplay_update_title (GimpDisplay *gdisp) -{ - gchar title [MAX_TITLE_BUF]; - guint context_id; - - g_return_if_fail (GIMP_IS_DISPLAY (gdisp)); - - /* format the title */ - gdisplay_format_title (gdisp, title, MAX_TITLE_BUF); - gdk_window_set_title (gdisp->shell->window, title); - - /* update the statusbar */ - context_id = - gtk_statusbar_get_context_id (GTK_STATUSBAR (gdisp->statusbar), "title"); - gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), context_id); - gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), context_id, title); -} - -void -gdisplays_update_title (GimpImage *gimage) -{ - GimpDisplay *gdisp; - GSList *list; - - /* traverse the linked list of displays, handling each one */ - for (list = display_list; list; list = g_slist_next (list)) - { - gdisp = (GimpDisplay *) list->data; - - if (gdisp->gimage == gimage) - gdisplay_update_title (gdisp); - } -} - -void -gdisplays_resize_cursor_label (GimpImage *gimage) -{ - GimpDisplay *gdisp; - GSList *list; - - /* traverse the linked list of displays, handling each one */ - for (list = display_list; list; list = g_slist_next (list)) - { - gdisp = (GimpDisplay *) list->data; - - if (gdisp->gimage == gimage) - gdisplay_resize_cursor_label (gdisp); - } -} - -void -gdisplays_setup_scale (GimpImage *gimage) -{ - GimpDisplay *gdisp; - GSList *list; - - /* traverse the linked list of displays, handling each one */ - for (list = display_list; list; list = g_slist_next (list)) - { - gdisp = (GimpDisplay *) list->data; - - if (gdisp->gimage == gimage) - setup_scale (gdisp); - } -} - -void -gdisplays_update_area (GimpImage *gimage, - gint x, - gint y, - gint w, - gint h) -{ - GimpDisplay *gdisp; - GSList *list; - - /* traverse the linked list of displays */ - for (list = display_list; list; list = g_slist_next (list)) - { - gdisp = (GimpDisplay *) list->data; - - if (gdisp->gimage == gimage) - gdisplay_add_update_area (gdisp, x, y, w, h); - } -} - -void -gdisplays_expose_guides (GimpImage *gimage) -{ - GimpDisplay *gdisp; - GSList *list; - GList *guide_list; - - /* traverse the linked list of displays, handling each one */ - for (list = display_list; list; list = g_slist_next (list)) - { - gdisp = (GimpDisplay *) list->data; - - if (gdisp->gimage == gimage) - { - for (guide_list = gdisp->gimage->guides; - guide_list; - guide_list = g_list_next (guide_list)) - { - gdisplay_expose_guide (gdisp, guide_list->data); - } - } - } -} - -void -gdisplays_expose_guide (GimpImage *gimage, - GimpGuide *guide) -{ - GimpDisplay *gdisp; - GSList *list; - - /* traverse the linked list of displays, handling each one */ - for (list = display_list; list; list = g_slist_next (list)) - { - gdisp = (GimpDisplay *) list->data; - - if (gdisp->gimage == gimage) - gdisplay_expose_guide (gdisp, guide); - } -} - -void -gdisplays_update_full (GimpImage *gimage) -{ - GimpDisplay *gdisp; - GSList *list; - - /* traverse the linked list of displays, handling each one */ - for (list = display_list; list; list = g_slist_next (list)) - { - gdisp = (GimpDisplay *) list->data; - - if (gdisp->gimage == gimage) - gdisplay_add_update_area (gdisp, 0, 0, - gdisp->gimage->width, - gdisp->gimage->height); - } -} - -void -gdisplays_shrink_wrap (GimpImage *gimage) -{ - GimpDisplay *gdisp; - GSList *list; - - /* traverse the linked list of displays, handling each one */ - for (list = display_list; list; list = g_slist_next (list)) - { - gdisp = (GimpDisplay *) list->data; - - if (gdisp->gimage == gimage) - shrink_wrap_display (gdisp); - } -} - -void -gdisplays_expose_full (void) -{ - GimpDisplay *gdisp; - GSList *list; - - /* traverse the linked list of displays, handling each one */ - for (list = display_list; list; list = g_slist_next (list)) - { - gdisp = (GimpDisplay *) list->data; - - gdisplay_expose_full (gdisp); - } -} - -void -gdisplays_nav_preview_resized (void) -{ - GimpDisplay *gdisp; - GSList *list; - - /* traverse the linked list of displays, handling each one */ - for (list = display_list; list; list = g_slist_next (list)) - { - gdisp = (GimpDisplay *) list->data; - - if (gdisp->window_nav_dialog) - nav_dialog_preview_resized (gdisp->window_nav_dialog); - - if (gdisp->nav_popup) - { - nav_dialog_free (NULL, gdisp->nav_popup); - gdisp->nav_popup = NULL; - } - } -} - -void -gdisplays_selection_visibility (GimpImage *gimage, - GimpSelectionControl control) -{ - GimpDisplay *gdisp; - GSList *list; - - /* traverse the linked list of displays, handling each one */ - for (list = display_list; list; list = g_slist_next (list)) - { - gdisp = (GimpDisplay *) list->data; - - if (gdisp->gimage == gimage) - gdisplay_selection_visibility (gdisp, control); - } -} - -gboolean -gdisplays_dirty (void) -{ - gboolean dirty = FALSE; - GSList *list; - - /* traverse the linked list of displays */ - for (list = display_list; list; list = g_slist_next (list)) - { - if (((GimpDisplay *) list->data)->gimage->dirty != 0) - dirty = TRUE; - } - - return dirty; -} - -void -gdisplays_delete (void) -{ - GimpDisplay *gdisp; - - /* destroying the shell removes the GimpDisplay from the list, so - * do a while loop "around" the first element to get them all - */ - while (display_list) - { - gdisp = (GimpDisplay *) display_list->data; - - gtk_widget_destroy (gdisp->shell); - } -} - -GimpDisplay * -gdisplays_check_valid (GimpDisplay *gtest, - GimpImage *gimage) -{ - /* Give a gdisp check that it is still valid and points to the required - * GimpImage. If not return the first gDisplay that does point to the - * gimage. If none found return NULL; - */ - - GimpDisplay *gdisp; - GimpDisplay *gdisp_found = NULL; - GSList *list; - - /* traverse the linked list of displays */ - for (list = display_list; list; list = g_slist_next (list)) - { - gdisp = (GimpDisplay *) list->data; - - if (gdisp == gtest) - return gtest; - - if (!gdisp_found && gdisp->gimage == gimage) - gdisp_found = gdisp; - } - - return gdisp_found; -} - -static void -gdisplays_flush_whenever (gboolean now) -{ - static gboolean flushing = FALSE; - - GSList *list; - - /* no flushing necessary without an interface */ - if (no_interface) - return; - - /* this prevents multiple recursive calls to this procedure */ - if (flushing == TRUE) - { - g_warning ("gdisplays_flush() called recursively."); - return; - } - - flushing = TRUE; - - /* traverse the linked list of displays */ - for (list = display_list; list; list = g_slist_next (list)) - { - gdisplay_flush_whenever ((GimpDisplay *) list->data, now); - } - - flushing = FALSE; -} - -void -gdisplays_flush (void) -{ - gdisplays_flush_whenever (FALSE); -} - -void -gdisplays_flush_now (void) -{ - gdisplays_flush_whenever (TRUE); -} - -static guint -gdisplay_hash (GimpDisplay *display) -{ - return (gulong) display; -} - -void -gdisplay_reconnect (GimpDisplay *gdisp, - GimpImage *gimage) -{ - gint instance; - - g_return_if_fail (GIMP_IS_DISPLAY (gdisp)); - g_return_if_fail (GIMP_IS_IMAGE (gimage)); - - if (gdisp->idle_render.active) - { - gtk_idle_remove (gdisp->idle_render.idleid); - gdisp->idle_render.active = FALSE; - } - - g_signal_handlers_disconnect_by_data (G_OBJECT (gdisp->gimage), gdisp); - gdisp->gimage->disp_count--; - g_object_unref (G_OBJECT (gdisp->gimage)); - - instance = gimage->instance_count; - gimage->instance_count++; - gimage->disp_count++; - - gdisp->gimage = gimage; - gdisp->instance = instance; - g_object_ref (G_OBJECT (gimage)); - - /* reconnect our clean / dirty signal_handlers */ - g_signal_connect (G_OBJECT (gimage), "dirty", - G_CALLBACK (gdisplay_cleandirty_handler), - gdisp); - g_signal_connect (G_OBJECT (gimage), "clean", - G_CALLBACK (gdisplay_cleandirty_handler), - gdisp); - - gdisplays_update_title (gimage); - - gdisplay_expose_full (gdisp); - gdisplay_flush (gdisp); -} - -void -gdisplays_reconnect (GimpImage *old, - GimpImage *new) -{ - GSList *list; - GimpDisplay *gdisp; - - g_return_if_fail (old != NULL && new != NULL); - - for (list = display_list; list; list = g_slist_next (list)) - { - gdisp = list->data; - - if (gdisp->gimage == old) - gdisplay_reconnect (gdisp, new); - } -} - -/* Called whenever the underlying gimage is dirtied or cleaned */ -static void -gdisplay_cleandirty_handler (GimpImage *gimage, - void *data) -{ - GimpDisplay *gdisp = data; - - gdisplay_update_title (gdisp); -} - -void -gdisplays_foreach (GFunc func, - gpointer user_data) -{ - g_slist_foreach (display_list, func, user_data); -} diff --git a/app/gdisplay.h b/app/gdisplay.h deleted file mode 100644 index 0342947e2e..0000000000 --- a/app/gdisplay.h +++ /dev/null @@ -1,339 +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 __GDISPLAY_H__ -#define __GDISPLAY_H__ - - -#include "core/gimpobject.h" - - -/* FIXME: move the display stuff to display/ */ - -#include "display/display-types.h" - - -/* some useful macros */ - -/* unpacking the user scale level (char) */ -#define SCALESRC(g) (g->scale & 0x00ff) -#define SCALEDEST(g) (g->scale >> 8) - -/* finding the effective screen resolution (double) */ -#define SCREEN_XRES(g) (g->dot_for_dot? g->gimage->xresolution : gimprc.monitor_xres) -#define SCREEN_YRES(g) (g->dot_for_dot? g->gimage->yresolution : gimprc.monitor_yres) - -/* calculate scale factors (double) */ -#define SCALEFACTOR_X(g) ((SCALEDEST(g) * SCREEN_XRES(g)) / \ - (SCALESRC(g) * g->gimage->xresolution)) -#define SCALEFACTOR_Y(g) ((SCALEDEST(g) * SCREEN_YRES(g)) / \ - (SCALESRC(g) * g->gimage->yresolution)) - -/* scale values */ -#define SCALEX(g,x) ((int)(x * SCALEFACTOR_X(g))) -#define SCALEY(g,y) ((int)(y * SCALEFACTOR_Y(g))) - -/* unscale values */ -#define UNSCALEX(g,x) ((int)(x / SCALEFACTOR_X(g))) -#define UNSCALEY(g,y) ((int)(y / SCALEFACTOR_Y(g))) -/* (and float-returning versions) */ -#define FUNSCALEX(g,x) ((x / SCALEFACTOR_X(g))) -#define FUNSCALEY(g,y) ((y / SCALEFACTOR_Y(g))) - - - - -#define LOWPASS(x) ((x>0) ? x : 0) -/* #define HIGHPASS(x,y) ((x>y) ? y : x) */ /* unused - == MIN */ - - -/* maximal width of the string holding the cursor-coordinates for - the status line */ -#define CURSOR_STR_LENGTH 256 - -/* maximal length of the format string for the cursor-coordinates */ -#define CURSOR_FORMAT_LENGTH 32 - - -typedef struct _IdleRenderStruct IdleRenderStruct; - -struct _IdleRenderStruct -{ - gint width; - gint height; - gint x; - gint y; - gint basex; - gint basey; - guint idleid; - gboolean active; - GSList *update_areas; /* flushed update areas */ -}; - - -#define GIMP_TYPE_DISPLAY (gimp_display_get_type ()) -#define GIMP_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DISPLAY, GimpDisplay)) -#define GIMP_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DISPLAY, GimpDisplayClass)) -#define GIMP_IS_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_DISPLAY)) -#define GIMP_IS_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DISPLAY)) -#define GIMP_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_DISPLAY, GimpDisplayClass)) - - -typedef struct _GimpDisplayClass GimpDisplayClass; - -struct _GimpDisplay -{ - GimpObject parent_instance; - - GtkWidget *shell; /* shell widget for this gdisplay */ - GimpImage *gimage; /* pointer to the associated gimage struct */ - /* - * these need to be first in the sturuct - * because of an ugly hack in - * core/gimpcontext.c - */ - - gint ID; /* unique identifier for this gdisplay */ - - GtkItemFactory *ifactory; /* factory for popup menu */ - - GtkWidget *canvas; /* canvas widget for this gdisplay */ - GtkWidget *hsb; /* widgets for scroll bars */ - GtkWidget *vsb; - GtkWidget *qmaskoff; /* widgets for qmask buttons */ - GtkWidget *qmaskon; - GtkWidget *hrule; /* widgets for rulers */ - GtkWidget *vrule; - GtkWidget *origin; /* widgets for rulers */ - GtkWidget *statusarea; /* hbox holding the statusbar and stuff */ - GtkWidget *statusbar; /* widget for statusbar */ - GtkWidget *progressbar; /* widget for progressbar */ - GtkWidget *cursor_label; /* widget for cursor position */ - gchar cursor_format_str[CURSOR_FORMAT_LENGTH]; - /* we need a variable format string because - * different units have different number - * of decimals - */ - GtkWidget *cancelbutton; /* widget for cancel button */ - guint progressid; /* id of statusbar message for progress */ - - InfoDialog *window_info_dialog; /* dialog box for image information */ - NavigationDialog *window_nav_dialog; /* dialog box for image navigation */ - NavigationDialog *nav_popup; /* the popup navigation window */ - GtkWidget *warning_dialog; /* "Changes were made to %s. Close anyway?" */ - - GtkAdjustment *hsbdata; /* horizontal data information */ - GtkAdjustment *vsbdata; /* vertical data information */ - - GdkPixmap *icon; /* Pixmap for the icon */ - GdkBitmap *iconmask; /* Bitmap for the icon mask */ - guint iconsize; /* The size of the icon pixmap */ - gboolean icon_needs_update; /* Do we need to render a new icon? */ - guint icon_timeout_id; /* The ID of the timeout-function */ - guint icon_idle_id; /* The ID of the idle-function */ - - gint instance; /* the instance # of this gdisplay as */ - /* taken from the gimage at creation */ - - gint disp_width; /* width of drawing area in the window */ - gint disp_height; /* height of drawing area in the window */ - gint disp_xoffset; - gint disp_yoffset; - - gint offset_x; /* offset of display image into raw image */ - gint offset_y; - gint scale; /* scale factor from original raw image */ - gboolean dot_for_dot; /* is monitor resolution being ignored? */ - gboolean draw_guides; /* should the guides be drawn? */ - gboolean snap_to_guides; /* should the guides be snapped to? */ - - Selection *select; /* Selection object */ - - GdkGC *scroll_gc; /* GC for scrolling */ - - GSList *update_areas; /* Update areas list */ - GSList *display_areas; /* Display areas list */ - - GdkCursorType current_cursor; /* Currently installed main cursor */ - GimpToolCursorType tool_cursor; /* Current Tool cursor */ - GimpCursorModifier cursor_modifier; /* Cursor modifier (plus, minus, ...) */ - - GdkCursorType override_cursor; /* Overriding cursor (ie. hourglass) */ - gboolean using_override_cursor; /* is the cursor overridden? (ie. hourglass)*/ - - gboolean draw_cursor; /* should we draw software cursor ? */ - gint cursor_x; /* software cursor X value */ - gint cursor_y; /* software cursor Y value */ - gboolean proximity; /* is a device in proximity of gdisplay ? */ - gboolean have_cursor; /* is cursor currently drawn ? */ - - IdleRenderStruct idle_render; /* state of this gdisplay's render thread */ - -#ifdef DISPLAY_FILTERS - GList *cd_list; /* color display conversion stuff */ - GtkWidget *cd_ui; /* color display filter dialog */ -#endif /* DISPLAY_FILTERS */ -}; - -struct _GimpDisplayClass -{ - GimpObjectClass parent_class; -}; - - -/* member function declarations */ - -GType gimp_display_get_type (void); - -GimpDisplay * gdisplay_new (GimpImage *gimage, - guint scale); -void gdisplay_reconnect (GimpDisplay *gdisp, - GimpImage *gimage); -void gdisplay_remove_and_delete (GimpDisplay *gdisp); -gint gdisplay_mask_value (GimpDisplay *gdisp, - gint x, - gint y); -gint gdisplay_mask_bounds (GimpDisplay *gdisp, - gint *x1, - gint *y1, - gint *x2, - gint *y2); -void gdisplay_transform_coords (GimpDisplay *gdisp, - gint x, - gint y, - gint *nx, - gint *ny, - gboolean use_offsets); -void gdisplay_untransform_coords (GimpDisplay *gdisp, - gint x, - gint y, - gint *nx, - gint *ny, - gboolean round, - gboolean use_offsets); -void gdisplay_transform_coords_f (GimpDisplay *gdisp, - gdouble x, - gdouble y, - gdouble *nx, - gdouble *ny, - gboolean use_offsets); -void gdisplay_untransform_coords_f (GimpDisplay *gdisp, - gdouble x, - gdouble y, - gdouble *nx, - gdouble *ny, - gboolean use_offsets); - -void gdisplay_real_install_tool_cursor (GimpDisplay *gdisp, - GdkCursorType cursor_type, - GimpToolCursorType tool_cursor, - GimpCursorModifier modifier, - gboolean always_install); -void gdisplay_install_tool_cursor (GimpDisplay *gdisp, - GdkCursorType cursor_type, - GimpToolCursorType tool_cursor, - GimpCursorModifier modifier); -void gdisplay_remove_tool_cursor (GimpDisplay *gdisp); -void gdisplay_install_override_cursor (GimpDisplay *gdisp, - GdkCursorType cursor_type); -void gdisplay_remove_override_cursor (GimpDisplay *gdisp); - -void gdisplay_set_menu_sensitivity (GimpDisplay *gdisp); -void gdisplay_expose_area (GimpDisplay *gdisp, - gint x, - gint y, - gint w, - gint h); -void gdisplay_expose_guide (GimpDisplay *gdisp, - GimpGuide *guide); -void gdisplay_expose_full (GimpDisplay *gdisp); -void gdisplay_selection_visibility (GimpDisplay *gdisp, - GimpSelectionControl control); -void gdisplay_flush (GimpDisplay *gdisp); -void gdisplay_flush_now (GimpDisplay *gdisp); -void gdisplay_update_icon (GimpDisplay *gdisp); -gboolean gdisplay_update_icon_timer (gpointer data); -gboolean gdisplay_update_icon_invoker (gpointer data); -void gdisplay_update_icon_scheduler (GimpImage *gimage, - gpointer data); -void gdisplay_draw_guides (GimpDisplay *gdisp); -void gdisplay_draw_guide (GimpDisplay *gdisp, - GimpGuide *guide, - gboolean active); -GimpGuide * gdisplay_find_guide (GimpDisplay *gdisp, - gdouble x, - double y); -gboolean gdisplay_snap_point (GimpDisplay *gdisp, - gdouble x, - gdouble y, - gdouble *tx, - gdouble *ty); -void gdisplay_snap_rectangle (GimpDisplay *gdisp, - gdouble x1, - gdouble y1, - gdouble x2, - gdouble y2, - gdouble *tx1, - gdouble *ty1); -void gdisplay_update_cursor (GimpDisplay *gdisp, - gint x, - gint y); -void gdisplay_set_dot_for_dot (GimpDisplay *gdisp, - gboolean dot_for_dot); -void gdisplay_resize_cursor_label (GimpDisplay *gdisp); -void gdisplay_update_title (GimpDisplay *gdisp); -void gdisplay_flush_displays_only (GimpDisplay *gdisp); /* no rerender! */ - -GimpDisplay * gdisplay_active (void); -GimpDisplay * gdisplay_get_by_ID (Gimp *gimp, - gint ID); - - -/* function declarations */ - -GimpDisplay * gdisplays_check_valid (GimpDisplay *gdisp, - GimpImage *gimage); -void gdisplays_reconnect (GimpImage *old, - GimpImage *new); -void gdisplays_update_title (GimpImage *gimage); -void gdisplays_resize_cursor_label (GimpImage *gimage); -void gdisplays_setup_scale (GimpImage *gimage); -void gdisplays_update_area (GimpImage *gimage, - gint x, - gint y, - gint w, - gint h); -void gdisplays_expose_guides (GimpImage *gimage); -void gdisplays_expose_guide (GimpImage *gimage, - GimpGuide *guide); -void gdisplays_update_full (GimpImage *gimage); -void gdisplays_shrink_wrap (GimpImage *gimage); -void gdisplays_expose_full (void); -void gdisplays_selection_visibility (GimpImage *gimage, - GimpSelectionControl control); -gboolean gdisplays_dirty (void); -void gdisplays_delete (void); -void gdisplays_flush (void); -void gdisplays_flush_now (void); -void gdisplays_finish_draw (void); -void gdisplays_nav_preview_resized (void); -void gdisplays_foreach (GFunc func, - gpointer user_data); - - -#endif /* __GDISPLAY_H__ */ diff --git a/app/gdisplay_ops.c b/app/gdisplay_ops.c deleted file mode 100644 index b75f7724e8..0000000000 --- a/app/gdisplay_ops.c +++ /dev/null @@ -1,321 +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 "libgimpwidgets/gimpwidgets.h" - -#include "core/core-types.h" - -#include "core/gimp.h" -#include "core/gimpimage.h" - -#include "colormaps.h" -#include "gdisplay_ops.h" -#include "gimprc.h" - -#include "libgimp/gimpintl.h" - - -static void gdisplay_close_warning_callback (GtkWidget *widget, - gboolean close, - gpointer data); -static void gdisplay_close_warning_dialog (const gchar *image_name, - GimpDisplay *gdisp); - -/* - * This file is for operations on the gdisplay object - */ - -gulong -gdisplay_white_pixel (GimpDisplay *gdisp) -{ - return g_white_pixel; -} - -gulong -gdisplay_gray_pixel (GimpDisplay *gdisp) -{ - return g_gray_pixel; -} - -gulong -gdisplay_black_pixel (GimpDisplay *gdisp) -{ - return g_black_pixel; -} - -gulong -gdisplay_color_pixel (GimpDisplay *gdisp) -{ - return g_color_pixel; -} - - -void -gdisplay_xserver_resolution (gdouble *xres, - gdouble *yres) -{ - gint width, height; - gint widthMM, heightMM; - - width = gdk_screen_width (); - height = gdk_screen_height (); - - widthMM = gdk_screen_width_mm (); - heightMM = gdk_screen_height_mm (); - - /* - * From xdpyinfo.c: - * - * there are 2.54 centimeters to an inch; so there are 25.4 millimeters. - * - * dpi = N pixels / (M millimeters / (25.4 millimeters / 1 inch)) - * = N pixels / (M inch / 25.4) - * = N * 25.4 pixels / M inch - */ - - *xres = (width * 25.4) / ((gdouble) widthMM); - *yres = (height * 25.4) / ((gdouble) heightMM); -} - - -void -gdisplay_new_view (GimpDisplay *gdisp) -{ - GimpDisplay *new_gdisp; - - /* make sure the image has been fully loaded... */ - if (gdisp->gimage) - { - new_gdisp = gdisplay_new (gdisp->gimage, gdisp->scale); - } -} - - -void -gdisplay_close_window (GimpDisplay *gdisp, - gboolean kill_it) -{ - /* FIXME: gimp_busy HACK not really appropriate here because we only - * want to prevent the busy image and display to be closed. --Mitch - */ - if (gdisp->gimage->gimp->busy) - return; - - /* If the image has been modified, give the user a chance to save - * it before nuking it--this only applies if its the last view - * to an image canvas. (a gimage with disp_count = 1) - */ - if (! kill_it && - (gdisp->gimage->disp_count == 1) && - gdisp->gimage->dirty && - gimprc.confirm_on_close) - { - gchar *basename; - - basename = g_path_get_basename (gimp_image_filename (gdisp->gimage)); - - gdisplay_close_warning_dialog (basename, gdisp); - - g_free (basename); - } - else - { - gtk_widget_destroy (gdisp->shell); - } -} - - -void -gdisplay_shrink_wrap (GimpDisplay *gdisp) -{ - /* - * I'm pretty sure this assumes that the current size is < display size - * Is this a valid assumption? - */ - GtkAllocation allocation; - gint disp_width, disp_height; - gint width, height; - gint shell_x, shell_y; - gint shell_width, shell_height; - gint max_auto_width, max_auto_height; - gint border_x, border_y; - gint s_width, s_height; - - gboolean resize = FALSE; - - s_width = gdk_screen_width (); - s_height = gdk_screen_height (); - - width = SCALEX (gdisp, gdisp->gimage->width); - height = SCALEY (gdisp, gdisp->gimage->height); - - disp_width = gdisp->disp_width; - disp_height = gdisp->disp_height; - - shell_width = gdisp->shell->allocation.width; - shell_height = gdisp->shell->allocation.height; - - border_x = shell_width - disp_width; - border_y = shell_height - disp_height; - - max_auto_width = (s_width - border_x) * 0.75; - max_auto_height = (s_height - border_y) * 0.75; - - allocation.x = 0; - allocation.y = 0; - - /* If one of the display dimensions has changed and one of the - * dimensions fits inside the screen - */ - if (((width + border_x) < s_width || (height + border_y) < s_height) && - (width != disp_width || height != disp_height)) - { - width = ((width + border_x) < s_width) ? width : max_auto_width; - height = ((height + border_y) < s_height) ? height : max_auto_height; - - resize = TRUE; - } - /* If the projected dimension is greater than current, but less than - * 3/4 of the screen size, expand automagically - */ - else if ((width > disp_width || height > disp_height) && - (disp_width < max_auto_width || disp_height < max_auto_height)) - { - width = MIN (max_auto_width, width); - height = MIN (max_auto_height, height); - - resize = TRUE; - } - - if (resize) - { - if (width < gdisp->statusarea->requisition.width) - { - width = gdisp->statusarea->requisition.width; - } - -#undef RESIZE_DEBUG -#ifdef RESIZE_DEBUG - g_print ("1w:%d/%d d:%d/%d s:%d/%d b:%d/%d\n", - width, height, - disp_width, disp_height, - shell_width, shell_height, - border_x, border_y); -#endif /* RESIZE_DEBUG */ - - gdisp->disp_width = width; - gdisp->disp_height = height; - - allocation.width = width + border_x; - allocation.height = height + border_y; - - /* don't call gdisplay_canvas_events() on any of the following - * changes because our caller has to do a full display update anyway - */ - gtk_signal_handler_block_by_data (GTK_OBJECT (gdisp->canvas), gdisp); - - gtk_widget_size_allocate (gdisp->shell, &allocation); - - gdk_window_resize (gdisp->shell->window, - allocation.width, - allocation.height); - - /* let Gtk/X/WM position the window */ - while (gtk_events_pending ()) - gtk_main_iteration (); - - gdk_window_get_origin (gdisp->shell->window, &shell_x, &shell_y); - - /* if the window is offscreen, center it... */ - if (shell_x > s_width || shell_y > s_height || - (shell_x + width + border_x) < 0 || (shell_y + height + border_y) < 0) - { - shell_x = (s_width - width - border_x) >> 1; - shell_y = (s_height - height - border_y) >> 1; - - gdk_window_move (gdisp->shell->window, shell_x, shell_y); - } - - gtk_signal_handler_unblock_by_data (GTK_OBJECT (gdisp->canvas), gdisp); - } - - /* If the width or height of the display has changed, recalculate - * the display offsets... - */ - if (disp_width != gdisp->disp_width || - disp_height != gdisp->disp_height) - { - gdisp->offset_x += (disp_width - gdisp->disp_width) / 2; - gdisp->offset_y += (disp_height - gdisp->disp_height) / 2; - } -} - -/******************************************************** - * Routines to query before closing a dirty image * - ********************************************************/ - -static void -gdisplay_close_warning_callback (GtkWidget *widget, - gboolean close, - gpointer data) -{ - GimpDisplay *gdisp; - - gdisp = (GimpDisplay *) data; - - gdisp->warning_dialog = NULL; - - if (close) - gtk_widget_destroy (gdisp->shell); -} - -static void -gdisplay_close_warning_dialog (const gchar *image_name, - GimpDisplay *gdisp) -{ - GtkWidget *mbox; - gchar *warning_buf; - - if (gdisp->warning_dialog != NULL) - { - gdk_window_raise (gdisp->warning_dialog->window); - return; - } - - warning_buf = - g_strdup_printf (_("Changes were made to %s.\nClose anyway?"), image_name); - - gdisp->warning_dialog = mbox = - gimp_query_boolean_box (image_name, - gimp_standard_help_func, - "dialogs/really_close.html", - FALSE, - warning_buf, - GTK_STOCK_CLOSE, GTK_STOCK_CANCEL, - NULL, NULL, - gdisplay_close_warning_callback, - gdisp); - - g_free (warning_buf); - - gtk_widget_show (mbox); -} diff --git a/app/gdisplay_ops.h b/app/gdisplay_ops.h deleted file mode 100644 index 8b1cf03ad2..0000000000 --- a/app/gdisplay_ops.h +++ /dev/null @@ -1,40 +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 __GDISPLAY_OPS_H__ -#define __GDISPLAY_OPS_H__ - - -#include "gdisplay.h" - - -gulong gdisplay_black_pixel (GimpDisplay *gdisp); -gulong gdisplay_gray_pixel (GimpDisplay *gdisp); -gulong gdisplay_white_pixel (GimpDisplay *gdisp); -gulong gdisplay_color_pixel (GimpDisplay *gdisp); - -void gdisplay_xserver_resolution (gdouble *xres, - gdouble *yres); - -void gdisplay_new_view (GimpDisplay *gdisp); -void gdisplay_close_window (GimpDisplay *gdisp, - gboolean kill_it); -void gdisplay_shrink_wrap (GimpDisplay *gdisp); - - -#endif /* __GDISPLAY_OPS_H__ */ diff --git a/app/gimpprogress.c b/app/gimpprogress.c index 1b50cedeca..c3d289f82a 100644 --- a/app/gimpprogress.c +++ b/app/gimpprogress.c @@ -24,7 +24,8 @@ #include "core/core-types.h" -#include "gdisplay.h" +#include "display/gimpdisplay.h" + #include "gimpprogress.h" #include "libgimp/gimpintl.h" diff --git a/app/gimprc.c b/app/gimprc.c index 5ccba0ca29..27e674cb4f 100644 --- a/app/gimprc.c +++ b/app/gimprc.c @@ -37,9 +37,7 @@ #include "libgimpbase/gimputils.h" #include "libgimpcolor/gimpcolor.h" -#include "core/core-types.h" -#include "tools/tools-types.h" -#include "widgets/widgets-types.h" +#include "gui/gui-types.h" #include "base/base-config.c" diff --git a/app/gui/channels-commands.c b/app/gui/channels-commands.c index 56635242b4..0d5ea7bd29 100644 --- a/app/gui/channels-commands.c +++ b/app/gui/channels-commands.c @@ -31,11 +31,12 @@ #include "core/gimpimage-mask.h" #include "core/gimplist.h" +#include "display/gimpdisplay.h" + #include "widgets/gimpcolorpanel.h" #include "widgets/gimpwidgets-utils.h" #include "channels-commands.h" -#include "gdisplay.h" #include "menus.h" #include "app_procs.h" diff --git a/app/gui/color-area.c b/app/gui/color-area.c index 1fdf730738..0aa3fa2d51 100644 --- a/app/gui/color-area.c +++ b/app/gui/color-area.c @@ -40,7 +40,6 @@ #include "color-notebook.h" #include "app_procs.h" -#include "gdisplay.h" #ifdef DISPLAY_FILTERS #include "gdisplay_color.h" diff --git a/app/gui/colormap-dialog.c b/app/gui/colormap-dialog.c index ca6bc67238..db6e684d9d 100644 --- a/app/gui/colormap-dialog.c +++ b/app/gui/colormap-dialog.c @@ -34,6 +34,8 @@ #include "core/gimpcontainer.h" #include "core/gimpimage.h" +#include "display/gimpdisplay-render.h" + #include "widgets/gimpdnd.h" #include "color-notebook.h" @@ -41,7 +43,6 @@ #include "color-area.h" #include "colormaps.h" -#include "image_render.h" #include "libgimp/gimpintl.h" diff --git a/app/gui/convert-dialog.c b/app/gui/convert-dialog.c index 5e6f913de9..fa63ceebe5 100644 --- a/app/gui/convert-dialog.c +++ b/app/gui/convert-dialog.c @@ -32,11 +32,12 @@ #include "core/gimplist.h" #include "core/gimppalette.h" +#include "display/gimpdisplay.h" + #include "tools/gimptool.h" #include "tools/tool_manager.h" #include "app_procs.h" -#include "gdisplay.h" #include "palette-select.h" #include "libgimp/gimpintl.h" diff --git a/app/gui/edit-commands.c b/app/gui/edit-commands.c index 9bf3bbdda3..12b03ff35d 100644 --- a/app/gui/edit-commands.c +++ b/app/gui/edit-commands.c @@ -22,7 +22,6 @@ #include "libgimpwidgets/gimpwidgets.h" -#include "core/core-types.h" #include "tools/tools-types.h" #include "core/gimp.h" @@ -34,6 +33,8 @@ #include "core/gimpimage.h" #include "core/gimpimage-mask.h" +#include "display/gimpdisplay.h" + #include "tools/tool_manager.h" #include "widgets/gimpdialogfactory.h" @@ -41,7 +42,6 @@ #include "dialogs.h" #include "edit-commands.h" -#include "gdisplay.h" #include "undo.h" #include "libgimp/gimpintl.h" diff --git a/app/gui/file-commands.c b/app/gui/file-commands.c index 363c31936a..2ff96b6ecb 100644 --- a/app/gui/file-commands.c +++ b/app/gui/file-commands.c @@ -22,11 +22,14 @@ #include "libgimpwidgets/gimpwidgets.h" -#include "core/core-types.h" +#include "display/display-types.h" #include "core/gimpimage.h" #include "core/gimpobject.h" +#include "display/gimpdisplay.h" +#include "display/gimpdisplay-ops.h" + #include "file-commands.h" #include "file-new-dialog.h" #include "file-open-dialog.h" @@ -36,8 +39,6 @@ #include "app_procs.h" #include "file-open.h" #include "file-save.h" -#include "gdisplay.h" -#include "gdisplay_ops.h" #include "gimprc.h" #include "undo.h" diff --git a/app/gui/file-dialog-utils.c b/app/gui/file-dialog-utils.c index fec75c8450..a1fe2f3d75 100644 --- a/app/gui/file-dialog-utils.c +++ b/app/gui/file-dialog-utils.c @@ -25,11 +25,12 @@ #include "core/core-types.h" +#include "display/gimpdisplay.h" + #include "widgets/gimpwidgets-utils.h" #include "menus.h" -#include "gdisplay.h" #include "plug_in.h" diff --git a/app/gui/file-new-dialog.c b/app/gui/file-new-dialog.c index 48610f990b..caa84b3786 100644 --- a/app/gui/file-new-dialog.c +++ b/app/gui/file-new-dialog.c @@ -24,14 +24,13 @@ #include "libgimpbase/gimpbase.h" #include "libgimpwidgets/gimpwidgets.h" -#include "core/core-types.h" +#include "gui-types.h" #include "core/gimp.h" #include "core/gimpcoreconfig.h" #include "core/gimpimage-new.h" #include "file-new-dialog.h" -#include "gdisplay.h" #include "app_procs.h" #include "gimprc.h" diff --git a/app/gui/gui.c b/app/gui/gui.c index d5ef88b75c..7722c57e4b 100644 --- a/app/gui/gui.c +++ b/app/gui/gui.c @@ -34,6 +34,11 @@ #include "core/gimpdatafiles.h" #include "core/gimpimage.h" +#include "display/gimpdisplay.h" +#include "display/gimpdisplay-ops.h" +#include "display/gimpdisplay-render.h" +#include "display/gximage.h" + #include "widgets/gimpdialogfactory.h" #include "brush-select.h" @@ -45,8 +50,6 @@ #include "file-save-dialog.h" #include "gradient-select.h" #include "gui.h" -#include "gximage.h" -#include "image_render.h" #include "menus.h" #include "palette-select.h" #include "palette-import-dialog.h" @@ -57,8 +60,6 @@ #include "appenv.h" #include "app_procs.h" -#include "gdisplay.h" /* for gdisplay_*_override_cursor() */ -#include "gdisplay_ops.h" /* for gdisplay_xserver_resolution() */ #include "gimprc.h" #include "libgimp/gimpintl.h" diff --git a/app/gui/image-commands.c b/app/gui/image-commands.c index 5026c2f111..4ff53b98f3 100644 --- a/app/gui/image-commands.c +++ b/app/gui/image-commands.c @@ -33,11 +33,12 @@ #include "pdb/procedural_db.h" +#include "display/gimpdisplay.h" + #include "convert-dialog.h" #include "offset-dialog.h" #include "resize-dialog.h" -#include "gdisplay.h" #include "undo.h" #include "libgimp/gimpintl.h" diff --git a/app/gui/info-window.c b/app/gui/info-window.c index 284147f08c..4478d8af15 100644 --- a/app/gui/info-window.c +++ b/app/gui/info-window.c @@ -23,7 +23,6 @@ #include "libgimpbase/gimpbase.h" #include "libgimpwidgets/gimpwidgets.h" -#include "core/core-types.h" #include "tools/tools-types.h" #include "widgets/widgets-types.h" @@ -33,6 +32,8 @@ #include "core/gimpimage.h" #include "core/gimpunit.h" +#include "display/gimpdisplay.h" + #include "widgets/gimppreview.h" #include "tools/gimptool.h" @@ -45,7 +46,6 @@ #include "app_procs.h" #include "colormaps.h" -#include "gdisplay.h" #include "libgimp/gimpintl.h" diff --git a/app/gui/layer-select.c b/app/gui/layer-select.c index 1765755c51..755078a7b7 100644 --- a/app/gui/layer-select.c +++ b/app/gui/layer-select.c @@ -21,16 +21,16 @@ #include #include -#include "core/core-types.h" -#include "widgets/widgets-types.h" +#include "gui-types.h" #include "core/gimpimage.h" #include "core/gimplayer.h" +#include "display/gimpdisplay.h" + #include "widgets/gimppreview.h" #include "layer-select.h" -#include "gdisplay.h" #include "gimprc.h" diff --git a/app/gui/layers-commands.c b/app/gui/layers-commands.c index d1ea904922..1e422c3d1f 100644 --- a/app/gui/layers-commands.c +++ b/app/gui/layers-commands.c @@ -26,7 +26,7 @@ #include "libgimpbase/gimpbase.h" #include "libgimpwidgets/gimpwidgets.h" -#include "core/core-types.h" +#include "gui-types.h" #include "paint-funcs/paint-funcs.h" @@ -37,6 +37,8 @@ #include "core/gimplayermask.h" #include "core/gimplist.h" +#include "display/gimpdisplay.h" + #include "widgets/gimpwidgets-utils.h" #include "layers-commands.h" @@ -44,7 +46,6 @@ #include "resize-dialog.h" #include "app_procs.h" -#include "gdisplay.h" #include "floating_sel.h" #include "undo.h" diff --git a/app/gui/menus.c b/app/gui/menus.c index 60e3a33c0b..b0a15936a8 100644 --- a/app/gui/menus.c +++ b/app/gui/menus.c @@ -28,12 +28,14 @@ #include "libgimpbase/gimpbase.h" #include "libgimpwidgets/gimpwidgets.h" -#include "tools/tools-types.h" +#include "gui-types.h" #include "core/gimp.h" #include "core/gimplist.h" #include "core/gimptoolinfo.h" +#include "display/gimpdisplay.h" + #include "tools/gimpbrightnesscontrasttool.h" #include "tools/gimpcolorbalancetool.h" #include "tools/gimpcurvestool.h" @@ -61,7 +63,6 @@ #include "view-commands.h" #include "app_procs.h" -#include "gdisplay.h" #include "gimphelp.h" #include "gimprc.h" diff --git a/app/gui/offset-dialog.c b/app/gui/offset-dialog.c index beeaf6b16e..3ae0b0e43a 100644 --- a/app/gui/offset-dialog.c +++ b/app/gui/offset-dialog.c @@ -23,13 +23,13 @@ #include "libgimpmath/gimpmath.h" #include "libgimpwidgets/gimpwidgets.h" -#include "core/core-types.h" +#include "gui-types.h" #include "core/gimpdrawable.h" #include "core/gimpdrawable-offset.h" #include "core/gimpimage.h" -#include "gdisplay.h" +#include "display/gimpdisplay.h" #include "libgimp/gimpintl.h" diff --git a/app/gui/paths-dialog.c b/app/gui/paths-dialog.c index 7f6e708291..3daa4ceb77 100644 --- a/app/gui/paths-dialog.c +++ b/app/gui/paths-dialog.c @@ -30,23 +30,22 @@ #include "libgimpmath/gimpmath.h" #include "libgimpwidgets/gimpwidgets.h" -#include "core/core-types.h" -#include "tools/tools-types.h" +#include "gui-types.h" #include "core/gimp.h" #include "core/gimpcontext.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "display/gimpdisplay.h" + #include "tools/gimpbezierselecttool.h" -#include "gdisplay.h" #include "menus.h" #include "ops_buttons.h" #include "paths-dialog.h" #include "gimprc.h" -#include "image_render.h" #include "path.h" #include "pathP.h" #include "path_transform.h" diff --git a/app/gui/plug-in-commands.c b/app/gui/plug-in-commands.c index 8cfc5af24f..12b9886464 100644 --- a/app/gui/plug-in-commands.c +++ b/app/gui/plug-in-commands.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "core/core-types.h" +#include "display/display-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -95,11 +95,12 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "display/gimpdisplay.h" + #include "gui/brush-select.h" #include "gui/gradient-select.h" #include "gui/menus.h" #include "gui/pattern-select.h" -#include "gdisplay.h" #include "app_procs.h" #include "appenv.h" diff --git a/app/gui/plug-in-menus.c b/app/gui/plug-in-menus.c index 8cfc5af24f..12b9886464 100644 --- a/app/gui/plug-in-menus.c +++ b/app/gui/plug-in-menus.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "core/core-types.h" +#include "display/display-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -95,11 +95,12 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "display/gimpdisplay.h" + #include "gui/brush-select.h" #include "gui/gradient-select.h" #include "gui/menus.h" #include "gui/pattern-select.h" -#include "gdisplay.h" #include "app_procs.h" #include "appenv.h" diff --git a/app/gui/preferences-dialog.c b/app/gui/preferences-dialog.c index a38a31cb14..10d7391ba9 100644 --- a/app/gui/preferences-dialog.c +++ b/app/gui/preferences-dialog.c @@ -26,7 +26,7 @@ #include "libgimpbase/gimpbase.h" #include "libgimpwidgets/gimpwidgets.h" -#include "tools/tools-types.h" +#include "gui-types.h" #include "base/base-config.h" #include "base/tile-cache.h" @@ -36,6 +36,10 @@ #include "core/gimpcoreconfig.h" #include "core/gimpimage.h" +#include "display/gimpdisplay.h" +#include "display/gimpdisplay-ops.h" +#include "display/gimpdisplay-render.h" + #include "tools/tool_manager.h" #include "layer-select.h" @@ -44,11 +48,8 @@ #include "app_procs.h" #include "colormaps.h" -#include "gdisplay.h" -#include "gdisplay_ops.h" #include "gimphelp.h" #include "gimprc.h" -#include "image_render.h" #include "libgimp/gimpintl.h" diff --git a/app/gui/qmask-commands.c b/app/gui/qmask-commands.c index baf09dd1a5..07da95f3d0 100644 --- a/app/gui/qmask-commands.c +++ b/app/gui/qmask-commands.c @@ -35,11 +35,12 @@ #include "core/gimpimage.h" #include "core/gimpimage-mask.h" +#include "display/gimpdisplay.h" + #include "widgets/gimpcolorpanel.h" #include "app_procs.h" #include "floating_sel.h" -#include "gdisplay.h" #include "qmask.h" #include "undo.h" diff --git a/app/gui/select-commands.c b/app/gui/select-commands.c index 8c3eaf6413..d1903ba479 100644 --- a/app/gui/select-commands.c +++ b/app/gui/select-commands.c @@ -23,12 +23,12 @@ #include "libgimpmath/gimpmath.h" #include "libgimpwidgets/gimpwidgets.h" -#include "core/core-types.h" +#include "gui-types.h" #include "core/gimpimage.h" #include "core/gimpimage-mask.h" -#include "gdisplay.h" +#include "display/gimpdisplay.h" #include "libgimp/gimpintl.h" diff --git a/app/gui/toolbox.c b/app/gui/toolbox.c index 09177a76ba..18f60c8e60 100644 --- a/app/gui/toolbox.c +++ b/app/gui/toolbox.c @@ -24,7 +24,7 @@ #include "libgimpwidgets/gimpwidgets.h" -#include "widgets/widgets-types.h" +#include "gui-types.h" #include "base/pixel-region.h" #include "base/tile-manager.h" @@ -50,7 +50,6 @@ #include "devices.h" #include "dialogs.h" #include "dialogs-commands.h" -#include "gdisplay.h" #include "indicator-area.h" #include "menus.h" diff --git a/app/gui/tools-commands.c b/app/gui/tools-commands.c index 1bd591d9e8..d7dcc9a5d3 100644 --- a/app/gui/tools-commands.c +++ b/app/gui/tools-commands.c @@ -20,17 +20,18 @@ #include -#include "tools/tools-types.h" +#include "gui-types.h" #include "core/gimp.h" #include "core/gimpcontext.h" #include "core/gimpimage.h" +#include "display/gimpdisplay.h" + #include "tools/gimptool.h" #include "tools/tool_manager.h" #include "app_procs.h" -#include "gdisplay.h" #define return_if_no_display(gdisp) \ diff --git a/app/gui/user-install-dialog.c b/app/gui/user-install-dialog.c index 09be3e8979..d9e1034f9e 100644 --- a/app/gui/user-install-dialog.c +++ b/app/gui/user-install-dialog.c @@ -34,16 +34,17 @@ #include "libgimpbase/gimpbase.h" #include "libgimpwidgets/gimpwidgets.h" -#include "core/core-types.h" +#include "display/display-types.h" #include "base/base-config.h" #include "core/gimpunit.h" +#include "display/gimpdisplay-ops.h" + #include "gui/resolution-calibrate-dialog.h" #include "appenv.h" -#include "gdisplay_ops.h" #include "gimprc.h" #include "user_install.h" diff --git a/app/gui/view-commands.c b/app/gui/view-commands.c index be51306a33..edd33cb09d 100644 --- a/app/gui/view-commands.c +++ b/app/gui/view-commands.c @@ -26,16 +26,17 @@ #include "core/gimpimage.h" +#include "display/gimpdisplay.h" +#include "display/gimpdisplay-ops.h" +#include "display/gimpdisplay-scale.h" +#include "display/gimpdisplay-selection.h" + #include "info-dialog.h" #include "info-window.h" #include "view-commands.h" -#include "gdisplay.h" -#include "gdisplay_ops.h" #include "gimprc.h" #include "nav_window.h" -#include "scale.h" -#include "selection.h" #define return_if_no_display(gdisp) \ diff --git a/app/gximage.c b/app/gximage.c deleted file mode 100644 index 0bdd47b565..0000000000 --- a/app/gximage.c +++ /dev/null @@ -1,136 +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 "appenv.h" -#include "colormaps.h" -#include "gximage.h" - - -typedef struct _GXImage GXImage; - -struct _GXImage -{ - long width, height; /* width and height of ximage structure */ - - GdkVisual *visual; /* visual appropriate to our depth */ - GdkGC *gc; /* graphics context */ - - guchar *data; -}; - - -/* The static gximages for drawing to windows */ -static GXImage *gximage = NULL; - -#define QUANTUM 32 - -/* STATIC functions */ - -static GXImage * -create_gximage (GdkVisual *visual, int width, int height) -{ - GXImage * gximage; - - gximage = g_new (GXImage, 1); - - gximage->visual = visual; - gximage->gc = NULL; - - gximage->data = g_malloc (width * height * 3); - - return gximage; -} - -static void -delete_gximage (GXImage *gximage) -{ - g_free (gximage->data); - if (gximage->gc) - gdk_gc_unref (gximage->gc); - g_free (gximage); -} - -/****************************************************************/ - - -/* Function definitions */ - -void -gximage_init (void) -{ - gximage = create_gximage (g_visual, GXIMAGE_WIDTH, GXIMAGE_HEIGHT); -} - -void -gximage_free (void) -{ - delete_gximage (gximage); -} - -guchar* -gximage_get_data (void) -{ - return gximage->data; -} - -int -gximage_get_bpp (void) -{ - return 3; -} - -int -gximage_get_bpl (void) -{ - return 3 * GXIMAGE_WIDTH; -} - -int -gximage_get_byte_order (void) -{ - return GDK_MSB_FIRST; -} - -void -gximage_put (GdkWindow *win, int x, int y, int w, int h, int xdith, int ydith) -{ - /* create the GC if it doesn't yet exist */ - if (!gximage->gc) - { - gximage->gc = gdk_gc_new (win); - gdk_gc_set_exposures (gximage->gc, TRUE); - } - - gdk_draw_rgb_image_dithalign (win, - gximage->gc, - x, - y, - w, - h, - /* todo: make configurable */ - GDK_RGB_DITHER_MAX, - gximage->data, - GXIMAGE_WIDTH * 3, - xdith, ydith); -} diff --git a/app/gximage.h b/app/gximage.h deleted file mode 100644 index 5f9fb1c39d..0000000000 --- a/app/gximage.h +++ /dev/null @@ -1,34 +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 __GXIMAGE_H__ -#define __GXIMAGE_H__ - -#define GXIMAGE_WIDTH 256 -#define GXIMAGE_HEIGHT 256 - -void gximage_init (void); -void gximage_free (void); - -void -gximage_put (GdkWindow *win, int x, int y, int w, int h, int xdith, int ydith); -guchar* gximage_get_data (void); -int gximage_get_bpp (void); -int gximage_get_bpl (void); -int gximage_get_byte_order (void); - -#endif /* __GXIMAGE_H__ */ diff --git a/app/image_map.c b/app/image_map.c index 56d8d05e7b..194660bfa8 100644 --- a/app/image_map.c +++ b/app/image_map.c @@ -31,7 +31,8 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" -#include "gdisplay.h" +#include "display/gimpdisplay.h" + #include "image_map.h" diff --git a/app/image_render.c b/app/image_render.c deleted file mode 100644 index 3a9fd5645f..0000000000 --- a/app/image_render.c +++ /dev/null @@ -1,890 +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 - -#include - -#include "core/core-types.h" - -#include "base/tile-manager.h" -#include "base/tile.h" - -#include "core/gimpimage.h" - -#include "appenv.h" -#include "gdisplay.h" -#include "gimprc.h" -#include "gximage.h" -#include "image_render.h" - - -#define MAX_PREVIEW_SIZE 256 /* EEK */ - - -typedef struct _RenderInfo RenderInfo; - -typedef void (* RenderFunc) (RenderInfo *info); - -struct _RenderInfo -{ - GDisplay *gdisp; - TileManager *src_tiles; - guint *alpha; - guchar *scale; - guchar *src; - guchar *dest; - gint x, y; - gint w, h; - gfloat scalex; - gfloat scaley; - gint src_x, src_y; - gint src_bpp; - gint dest_bpp; - gint dest_bpl; - gint dest_width; - gint byte_order; -}; - - -/* accelerate transparency of image scaling */ -guchar *render_check_buf = NULL; -guchar *render_empty_buf = NULL; -guchar *render_temp_buf = NULL; -guchar *render_blend_dark_check = NULL; -guchar *render_blend_light_check = NULL; - - -static guchar *tile_buf = NULL; -static guint check_mod = 0; -static guint check_shift = 0; -static guint tile_shift = 0; -static guchar check_combos[6][2] = -{ - { 204, 255 }, - { 102, 153 }, - { 0, 51 }, - { 255, 255 }, - { 127, 127 }, - { 0, 0 } -}; - - -void -render_setup (GimpCheckType check_type, - GimpCheckSize check_size) -{ - gint i, j; - - if (check_type < LIGHT_CHECKS || check_type > BLACK_ONLY) - g_error ("invalid check_type argument to render_setup: %d", check_type); - if (check_size < SMALL_CHECKS || check_size > LARGE_CHECKS) - g_error ("invalid check_size argument to render_setup: %d", check_size); - - /* based on the tile size, determine the tile shift amount - * (assume here that tile_height and tile_width are equal) - */ - tile_shift = 0; - while ((1 << tile_shift) < TILE_WIDTH) - tile_shift++; - - /* allocate a buffer for arranging information from a row of tiles */ - if (! tile_buf) - tile_buf = g_new (guchar, GXIMAGE_WIDTH * MAX_CHANNELS); - - if (! render_blend_dark_check) - render_blend_dark_check = g_new (guchar, 65536); - if (! render_blend_light_check) - render_blend_light_check = g_new (guchar, 65536); - - for (i = 0; i < 256; i++) - for (j = 0; j < 256; j++) - { - render_blend_dark_check [(i << 8) + j] = (guchar) - ((j * i + check_combos[check_type][0] * (255 - i)) / 255); - render_blend_light_check [(i << 8) + j] = (guchar) - ((j * i + check_combos[check_type][1] * (255 - i)) / 255); - } - - switch (check_size) - { - case SMALL_CHECKS: - check_mod = 0x3; - check_shift = 2; - break; - case MEDIUM_CHECKS: - check_mod = 0x7; - check_shift = 3; - break; - case LARGE_CHECKS: - check_mod = 0xf; - check_shift = 4; - break; - } - - g_free (render_check_buf); - g_free (render_empty_buf); - g_free (render_temp_buf); - - /* calculate check buffer for previews */ - if (TRUE /* preview_size */) - { - render_check_buf = g_new (guchar, (MAX_PREVIEW_SIZE + 4) * 3); - - for (i = 0; i < (MAX_PREVIEW_SIZE + 4); i++) - { - if (i & 0x4) - { - render_check_buf[i * 3 + 0] = render_blend_dark_check[0]; - render_check_buf[i * 3 + 1] = render_blend_dark_check[0]; - render_check_buf[i * 3 + 2] = render_blend_dark_check[0]; - } - else - { - render_check_buf[i * 3 + 0] = render_blend_light_check[0]; - render_check_buf[i * 3 + 1] = render_blend_light_check[0]; - render_check_buf[i * 3 + 2] = render_blend_light_check[0]; - } - } - - render_empty_buf = g_new0 (guchar, (MAX_PREVIEW_SIZE + 4) * 3); - render_temp_buf = g_new (guchar, (MAX_PREVIEW_SIZE + 4) * 3); - } - else - { - render_check_buf = NULL; - render_empty_buf = NULL; - render_temp_buf = NULL; - } -} - -void -render_free (void) -{ - g_free (tile_buf); - g_free (render_check_buf); -} - - -/* Render Image functions */ - -static void render_image_rgb (RenderInfo *info); -static void render_image_rgb_a (RenderInfo *info); -static void render_image_gray (RenderInfo *info); -static void render_image_gray_a (RenderInfo *info); -static void render_image_indexed (RenderInfo *info); -static void render_image_indexed_a (RenderInfo *info); - -static void render_image_init_info (RenderInfo *info, - GDisplay *gdisp, - gint x, - gint y, - gint w, - gint h); -static guint * render_image_init_alpha (gint mult); -static guchar * render_image_accelerate_scaling (gint width, - gint start, - gfloat scalex); -static guchar * render_image_tile_fault (RenderInfo *info); - - -static RenderFunc render_funcs[6] = -{ - render_image_rgb, - render_image_rgb_a, - render_image_gray, - render_image_gray_a, - render_image_indexed, - render_image_indexed_a, -}; - - -/*****************************************************************/ -/* This function is the core of the display--it offsets and */ -/* scales the image according to the current parameters in the */ -/* gdisp object. It handles color, grayscale, 8, 15, 16, 24, */ -/* & 32 bit output depths. */ -/*****************************************************************/ - -void -render_image (GDisplay *gdisp, - gint x, - gint y, - gint w, - gint h) -{ - RenderInfo info; - gint image_type; - - render_image_init_info (&info, gdisp, x, y, w, h); - - image_type = gimp_image_projection_type (gdisp->gimage); - - if ((image_type < 0) || (image_type > 5)) - { - g_message ("unknown gimage projection type: %d", - gimp_image_projection_type (gdisp->gimage)); - return; - } - - if ((info.dest_bpp < 1) || (info.dest_bpp > 4)) - { - g_message ("unsupported destination bytes per pixel: %d", info.dest_bpp); - return; - } - - /* Currently, only RGBA and GRAYA projection types are used - the rest - * are in case of future need. -- austin, 28th Nov 1998. - */ - if (image_type != RGBA_GIMAGE && image_type != GRAYA_GIMAGE) - g_warning ("using untested projection type %d", image_type); - - (* render_funcs[image_type]) (&info); -} - - -/*************************/ -/* 8 Bit functions */ -/*************************/ - -static void -render_image_indexed (RenderInfo *info) -{ - guchar *src; - guchar *dest; - guchar *cmap; - gulong val; - gint byte_order; - gint y, ye; - gint x, xe; - gint initial; - gfloat error; - gfloat step; - - cmap = gimp_image_cmap (info->gdisp->gimage); - - y = info->y; - ye = info->y + info->h; - xe = info->x + info->w; - - step = 1.0 / info->scaley; - - error = y * step; - error -= ((gint) error) - step; - - initial = TRUE; - byte_order = info->byte_order; - info->src = render_image_tile_fault (info); - - for (; y < ye; y++) - { - if (!initial && (error < 1.0)) - { - memcpy (info->dest, info->dest - info->dest_bpl, info->dest_width); - } - else - { - src = info->src; - dest = info->dest; - - g_return_if_fail (src != NULL); - - for (x = info->x; x < xe; x++) - { - val = src[INDEXED_PIX] * 3; - src += 1; - - dest[0] = cmap[val+0]; - dest[1] = cmap[val+1]; - dest[2] = cmap[val+2]; - dest += 3; - } - } - - info->dest += info->dest_bpl; - - initial = FALSE; - - if (error >= 1.0) - { - info->src_y += (int)error; - error -= (int)error; - info->src = render_image_tile_fault (info); - initial = TRUE; - } - - error += step; - } -} - -static void -render_image_indexed_a (RenderInfo *info) -{ - guchar *src; - guchar *dest; - guint *alpha; - guchar *cmap; - gulong r, g, b; - gulong val; - guint a; - gint dark_light; - gint byte_order; - gint y, ye; - gint x, xe; - gint initial; - gfloat error; - gfloat step; - - cmap = gimp_image_cmap (info->gdisp->gimage); - alpha = info->alpha; - - y = info->y; - ye = info->y + info->h; - xe = info->x + info->w; - - step = 1.0 / info->scaley; - - error = y * step; - error -= ((gint) error) - step; - - initial = TRUE; - byte_order = info->byte_order; - info->src = render_image_tile_fault (info); - - for (; y < ye; y++) - { - if (!initial && (error < 1.0) && (y & check_mod)) - { - memcpy (info->dest, info->dest - info->dest_bpl, info->dest_width); - } - else - { - src = info->src; - dest = info->dest; - - dark_light = (y >> check_shift) + (info->x >> check_shift); - - g_return_if_fail (src != NULL); - - for (x = info->x; x < xe; x++) - { - a = alpha[src[ALPHA_I_PIX]]; - val = src[INDEXED_PIX] * 3; - src += 2; - - if (dark_light & 0x1) - { - r = render_blend_dark_check[(a | cmap[val + 0])]; - g = render_blend_dark_check[(a | cmap[val + 1])]; - b = render_blend_dark_check[(a | cmap[val + 2])]; - } - else - { - r = render_blend_light_check[(a | cmap[val + 0])]; - g = render_blend_light_check[(a | cmap[val + 1])]; - b = render_blend_light_check[(a | cmap[val + 2])]; - } - - dest[0] = r; - dest[1] = g; - dest[2] = b; - dest += 3; - - if (((x + 1) & check_mod) == 0) - dark_light += 1; - } - } - - info->dest += info->dest_bpl; - - initial = FALSE; - - if (error >= 1.0) - { - info->src_y += (int)error; - error -= (int)error; - info->src = render_image_tile_fault (info); - initial = TRUE; - } - - error += step; - } -} - -static void -render_image_gray (RenderInfo *info) -{ - guchar *src; - guchar *dest; - gulong val; - gint byte_order; - gint y, ye; - gint x, xe; - gint initial; - gfloat error; - gfloat step; - - y = info->y; - ye = info->y + info->h; - xe = info->x + info->w; - - step = 1.0 / info->scaley; - - error = y * step; - error -= ((gint) error) - step; - - initial = TRUE; - byte_order = info->byte_order; - info->src = render_image_tile_fault (info); - - for (; y < ye; y++) - { - if (!initial && (error < 1.0)) - { - memcpy (info->dest, info->dest - info->dest_bpl, info->dest_width); - } - else - { - src = info->src; - dest = info->dest; - - g_return_if_fail (src != NULL); - - for (x = info->x; x < xe; x++) - { - val = src[GRAY_PIX]; - src += 1; - - dest[0] = val; - dest[1] = val; - dest[2] = val; - dest += 3; - } - } - - info->dest += info->dest_bpl; - - initial = FALSE; - - if (error >= 1.0) - { - info->src_y += (int)error; - error -= (int)error; - info->src = render_image_tile_fault (info); - initial = TRUE; - } - - error += step; - } -} - -static void -render_image_gray_a (RenderInfo *info) -{ - guchar *src; - guchar *dest; - guint *alpha; - gulong val; - guint a; - gint dark_light; - gint byte_order; - gint y, ye; - gint x, xe; - gint initial; - gfloat error; - gfloat step; - - alpha = info->alpha; - - y = info->y; - ye = info->y + info->h; - xe = info->x + info->w; - - step = 1.0 / info->scaley; - - error = y * step; - error -= ((gint) error) - step; - - initial = TRUE; - byte_order = info->byte_order; - info->src = render_image_tile_fault (info); - - for (; y < ye; y++) - { - if (!initial && (error < 1.0) && (y & check_mod)) - { - memcpy (info->dest, info->dest - info->dest_bpl, info->dest_width); - } - else - { - src = info->src; - dest = info->dest; - - dark_light = (y >> check_shift) + (info->x >> check_shift); - - g_return_if_fail (src != NULL); - - for (x = info->x; x < xe; x++) - { - a = alpha[src[ALPHA_G_PIX]]; - if (dark_light & 0x1) - val = render_blend_dark_check[(a | src[GRAY_PIX])]; - else - val = render_blend_light_check[(a | src[GRAY_PIX])]; - src += 2; - - dest[0] = val; - dest[1] = val; - dest[2] = val; - dest += 3; - - if (((x + 1) & check_mod) == 0) - dark_light += 1; - } - } - - info->dest += info->dest_bpl; - - initial = FALSE; - - if (error >= 1.0) - { - info->src_y += (int)error; - error -= (int)error; - info->src = render_image_tile_fault (info); - initial = TRUE; - } - - error += step; - } -} - -static void -render_image_rgb (RenderInfo *info) -{ - guchar *src; - guchar *dest; - gint byte_order; - gint y, ye; - gint x, xe; - gint initial; - gfloat error; - gfloat step; - - y = info->y; - ye = info->y + info->h; - xe = info->x + info->w; - - step = 1.0 / info->scaley; - - error = y * step; - error -= (gint) error - step; - - initial = TRUE; - byte_order = info->byte_order; - info->src = render_image_tile_fault (info); - - for (; y < ye; y++) - { - if (!initial && (error < 1.0)) - { - memcpy (info->dest, info->dest - info->dest_bpl, info->dest_width); - } - else - { - src = info->src; - dest = info->dest; - - g_return_if_fail (src != NULL); - - /* replace this with memcpy, or better yet, avoid it altogether? */ - for (x = info->x; x < xe; x++) - { - dest[0] = src[0]; - dest[1] = src[1]; - dest[2] = src[2]; - - src += 3; - dest += 3; - } - } - - info->dest += info->dest_bpl; - - initial = FALSE; - - if (error >= 1.0) - { - info->src_y += (int)error; - error -= (int)error; - info->src = render_image_tile_fault (info); - initial = TRUE; - } - - error += step; - } -} - -static void -render_image_rgb_a (RenderInfo *info) -{ - guchar *src; - guchar *dest; - guint *alpha; - gulong r, g, b; - guint a; - gint dark_light; - gint byte_order; - gint y, ye; - gint x, xe; - gint initial; - gfloat error; - gfloat step; - - alpha = info->alpha; - - y = info->y; - ye = info->y + info->h; - xe = info->x + info->w; - - step = 1.0 / info->scaley; - - error = y * step; - error -= ((gint) error) - step; - - initial = TRUE; - byte_order = info->byte_order; - info->src = render_image_tile_fault (info); - - for (; y < ye; y++) - { - if (!initial && (error < 1.0) && (y & check_mod)) - { - memcpy (info->dest, info->dest - info->dest_bpl, info->dest_width); - } - else - { - src = info->src; - dest = info->dest; - - dark_light = (y >> check_shift) + (info->x >> check_shift); - - g_return_if_fail (src != NULL); - - for (x = info->x; x < xe; x++) - { - a = alpha[src[ALPHA_PIX]]; - if (dark_light & 0x1) - { - r = render_blend_dark_check[(a | src[RED_PIX])]; - g = render_blend_dark_check[(a | src[GREEN_PIX])]; - b = render_blend_dark_check[(a | src[BLUE_PIX])]; - } - else - { - r = render_blend_light_check[(a | src[RED_PIX])]; - g = render_blend_light_check[(a | src[GREEN_PIX])]; - b = render_blend_light_check[(a | src[BLUE_PIX])]; - } - - src += 4; - - dest[0] = r; - dest[1] = g; - dest[2] = b; - dest += 3; - - if (((x + 1) & check_mod) == 0) - dark_light += 1; - } - } - - info->dest += info->dest_bpl; - - initial = FALSE; - - if (error >= 1.0) - { - info->src_y += (int)error; - error -= (int)error; - info->src = render_image_tile_fault (info); - initial = TRUE; - } - - error += step; - } -} - -static void -render_image_init_info (RenderInfo *info, - GDisplay *gdisp, - gint x, - gint y, - gint w, - gint h) -{ - info->gdisp = gdisp; - info->src_tiles = gimp_image_projection (gdisp->gimage); - info->x = x + gdisp->offset_x; - info->y = y + gdisp->offset_y; - info->w = w; - info->h = h; - info->scalex = SCALEFACTOR_X (gdisp); - info->scaley = SCALEFACTOR_Y (gdisp); - info->src_x = UNSCALEX (gdisp, info->x); - info->src_y = UNSCALEY (gdisp, info->y); - info->src_bpp = gimp_image_projection_bytes (gdisp->gimage); - info->dest = gximage_get_data (); - info->dest_bpp = gximage_get_bpp (); - info->dest_bpl = gximage_get_bpl (); - info->dest_width = info->w * info->dest_bpp; - info->byte_order = gximage_get_byte_order (); - info->scale = render_image_accelerate_scaling (w, info->x, info->scalex); - info->alpha = NULL; - - switch (gimp_image_projection_type (gdisp->gimage)) - { - case RGBA_GIMAGE: - case GRAYA_GIMAGE: - case INDEXEDA_GIMAGE: - info->alpha = - render_image_init_alpha (gimp_image_projection_opacity (gdisp->gimage)); - break; - default: - /* nothing special needs doing */ - break; - } -} - -static guint* -render_image_init_alpha (gint mult) -{ - static guint *alpha_mult = NULL; - static gint alpha_val = -1; - - gint i; - - if (alpha_val != mult) - { - if (!alpha_mult) - alpha_mult = g_new (guint, 256); - - alpha_val = mult; - for (i = 0; i < 256; i++) - alpha_mult[i] = ((mult * i) / 255) << 8; - } - - return alpha_mult; -} - -static guchar* -render_image_accelerate_scaling (gint width, - gint start, - gfloat scalex) -{ - static guchar *scale = NULL; - - gfloat error; - gfloat step; - gint i; - - if (!scale) - scale = g_new (guchar, GXIMAGE_WIDTH + 1); - - step = 1.0 / scalex; - - error = start * step; - error -= ((int)error) - step; - - for (i = 0; i <= width; i++) - { - scale[i] = ((int)error); - error += step - (int)error; - } - - return scale; -} - -static guchar * -render_image_tile_fault (RenderInfo *info) -{ - Tile *tile; - guchar *data; - guchar *dest; - guchar *scale; - gint width; - gint tilex; - gint tiley; - gint srctilex, srctiley; - gint step; - gint bpp = info->src_bpp; - gint x, b; - - tilex = info->src_x / TILE_WIDTH; - tiley = info->src_y / TILE_HEIGHT; - - tile = tile_manager_get_tile (info->src_tiles, - srctilex=info->src_x, srctiley=info->src_y, - TRUE, FALSE); - if (!tile) - return NULL; - - data = tile_data_pointer (tile, - info->src_x % TILE_WIDTH, - info->src_y % TILE_HEIGHT); - scale = info->scale; - dest = tile_buf; - - x = info->src_x; - width = info->w; - - while (width--) - { - for (b = 0; b < bpp; b++) - *dest++ = data[b]; - - step = *scale++; - if (step != 0) - { - x += step; - data += step * bpp; - - if ((x >> tile_shift) != tilex) - { - tile_release (tile, FALSE); - tilex += 1; - - tile = tile_manager_get_tile (info->src_tiles, srctilex=x, - srctiley=info->src_y, TRUE, FALSE); - if (!tile) - return tile_buf; - - data = tile_data_pointer (tile, - x % TILE_WIDTH, - info->src_y % TILE_HEIGHT); - } - } - } - - tile_release (tile, FALSE); - - return tile_buf; -} diff --git a/app/image_render.h b/app/image_render.h deleted file mode 100644 index 7d8db7d629..0000000000 --- a/app/image_render.h +++ /dev/null @@ -1,43 +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 __IMAGE_RENDER_H__ -#define __IMAGE_RENDER_H__ - - -/* Functions */ -void render_setup (GimpCheckType check_type, - GimpCheckSize check_size); -void render_free (void); -void render_image (GDisplay *gdisp, - gint x, - gint y, - gint w, - gint h); - -/* - * Extern variables - */ -extern guchar *render_check_buf; -extern guchar *render_empty_buf; -extern guchar *render_temp_buf; -extern guchar *render_blend_dark_check; -extern guchar *render_blend_light_check; - - -#endif /* __IMAGE_RENDER_H__ */ diff --git a/app/interface.c b/app/interface.c deleted file mode 100644 index 2d71f99dd2..0000000000 --- a/app/interface.c +++ /dev/null @@ -1,578 +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 "libgimpwidgets/gimpwidgets.h" - -#include "display/display-types.h" - -#include "core/gimpbuffer.h" -#include "core/gimpimage.h" -#include "core/gimplayer.h" -#include "core/gimplayermask.h" -#include "core/gimppattern.h" - -#include "widgets/gimpdnd.h" -#include "widgets/gimpwidgets-utils.h" - -#include "disp_callbacks.h" -#include "gdisplay_ops.h" -#include "interface.h" -#include "gui/menus.h" -#include "nav_window.h" - -#include "gimprc.h" -#include "qmask.h" - -#include "pixmaps/qmasksel.xpm" -#include "pixmaps/qmasknosel.xpm" -#include "pixmaps/navbutton.xpm" - -#include "libgimp/gimpintl.h" - - -/* local functions */ -static void gdisplay_destroy (GtkWidget *widget, - GDisplay *display); -static gboolean gdisplay_delete (GtkWidget *widget, - GdkEvent *event, - GDisplay *display); - - -static GtkTargetEntry display_target_table[] = -{ - GIMP_TARGET_LAYER, - GIMP_TARGET_CHANNEL, - GIMP_TARGET_LAYER_MASK, - GIMP_TARGET_COLOR, - GIMP_TARGET_PATTERN, - GIMP_TARGET_BUFFER -}; - - -static void -gdisplay_destroy (GtkWidget *widget, - GDisplay *gdisp) -{ - gdisplay_remove_and_delete (gdisp); -} - -static gboolean -gdisplay_delete (GtkWidget *widget, - GdkEvent *event, - GDisplay *gdisp) -{ - gdisplay_close_window (gdisp, FALSE); - - return TRUE; -} - -static gpointer -gdisplay_get_accel_context (gpointer data) -{ - GDisplay *gdisp; - - gdisp = (GDisplay *) data; - - if (gdisp) - return gdisp->gimage; - - return NULL; -} - -void -create_display_shell (GDisplay *gdisp, - gint width, - gint height, - gchar *title, - gint type) -{ - static GdkPixmap *qmasksel_pixmap = NULL; - static GdkBitmap *qmasksel_mask = NULL; - static GdkPixmap *qmasknosel_pixmap = NULL; - static GdkBitmap *qmasknosel_mask = NULL; - static GdkPixmap *navbutton_pixmap = NULL; - static GdkBitmap *navbutton_mask = NULL; - - GtkWidget *main_vbox; - GtkWidget *disp_vbox; - GtkWidget *upper_hbox; - GtkWidget *lower_hbox; - GtkWidget *inner_table; - GtkWidget *status_hbox; - GtkWidget *arrow; - GtkWidget *pixmap; - GtkWidget *label_frame; - GtkWidget *nav_ebox; - - GSList *group = NULL; - - gint n_width, n_height; - gint s_width, s_height; - gint scalesrc, scaledest; - gint contextid; - - /* adjust the initial scale -- so that window fits on screen - * the 75% value is the same as in gdisplay_shrink_wrap. It - * probably should be a user-configurable option. - */ - s_width = gdk_screen_width () * 0.75; - s_height = gdk_screen_height () * 0.75; - - scalesrc = SCALESRC (gdisp); - scaledest = SCALEDEST (gdisp); - - n_width = SCALEX (gdisp, width); - n_height = SCALEX (gdisp, height); - - /* Limit to the size of the screen... */ - while (n_width > s_width || n_height > s_height) - { - if (scaledest > 1) - scaledest--; - else - if (scalesrc < 0xff) - scalesrc++; - - n_width = width * - (scaledest * SCREEN_XRES (gdisp)) / (scalesrc * gdisp->gimage->xresolution); - n_height = height * - (scaledest * SCREEN_XRES (gdisp)) / (scalesrc * gdisp->gimage->xresolution); - } - - gdisp->scale = (scaledest << 8) + scalesrc; - - /* the toplevel shell */ - gdisp->shell = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_widget_ref (gdisp->shell); - gtk_window_set_title (GTK_WINDOW (gdisp->shell), title); - gtk_window_set_wmclass (GTK_WINDOW (gdisp->shell), "image_window", "Gimp"); - gtk_window_set_policy (GTK_WINDOW (gdisp->shell), TRUE, TRUE, TRUE); - gtk_widget_set_events (gdisp->shell, (GDK_POINTER_MOTION_MASK | - GDK_POINTER_MOTION_HINT_MASK | - GDK_BUTTON_PRESS_MASK | - GDK_KEY_PRESS_MASK | - GDK_KEY_RELEASE_MASK)); - - g_signal_connect (G_OBJECT (gdisp->shell), "delete_event", - G_CALLBACK (gdisplay_delete), - gdisp); - g_signal_connect (G_OBJECT (gdisp->shell), "destroy", - G_CALLBACK (gdisplay_destroy), - gdisp); - - /* active display callback */ - g_signal_connect (G_OBJECT (gdisp->shell), "button_press_event", - G_CALLBACK (gdisplay_shell_events), - gdisp); - g_signal_connect (G_OBJECT (gdisp->shell), "key_press_event", - G_CALLBACK (gdisplay_shell_events), - gdisp); - - /* dnd stuff */ - gtk_drag_dest_set (gdisp->shell, - GTK_DEST_DEFAULT_ALL, - display_target_table, G_N_ELEMENTS (display_target_table), - GDK_ACTION_COPY); - - gimp_dnd_viewable_dest_set (gdisp->shell, GIMP_TYPE_LAYER, - gdisplay_drop_drawable, gdisp); - gimp_dnd_viewable_dest_set (gdisp->shell, GIMP_TYPE_LAYER_MASK, - gdisplay_drop_drawable, gdisp); - gimp_dnd_viewable_dest_set (gdisp->shell, GIMP_TYPE_CHANNEL, - gdisplay_drop_drawable, gdisp); - gimp_dnd_viewable_dest_set (gdisp->shell, GIMP_TYPE_PATTERN, - gdisplay_drop_pattern, gdisp); - gimp_dnd_viewable_dest_set (gdisp->shell, GIMP_TYPE_BUFFER, - gdisplay_drop_buffer, gdisp); - gimp_dnd_color_dest_set (gdisp->shell, - gdisplay_drop_color, gdisp); - - /* the popup menu */ - gdisp->ifactory = menus_get_image_factory (); - - /* The accelerator table for images */ - gimp_window_add_accel_group (GTK_WINDOW (gdisp->shell), - gdisp->ifactory, - gdisplay_get_accel_context, - gdisp); - - /* connect the "F1" help key */ - gimp_help_connect (gdisp->shell, - gimp_standard_help_func, - "image/image_window.html"); - - /* GtkTable widgets are not able to shrink a row/column correctly if - * widgets are attached with GTK_EXPAND even if those widgets have - * other rows/columns in their rowspan/colspan where they could - * nicely expand without disturbing the row/column which is supposed - * to shrink. --Mitch - * - * Changed the packing to use hboxes and vboxes which behave nicer: - * - * main_vbox - * | - * +-- disp_vbox - * | | - * | +-- upper_hbox - * | | | - * | | +-- inner_table - * | | | | - * | | | +-- origin - * | | | +-- hruler - * | | | +-- vruler - * | | | +-- canvas - * | | | - * | | +-- vscrollbar - * | | - * | +-- lower_hbox - * | | - * | +-- qmaskoff - * | +-- qmaskon - * | +-- hscrollbar - * | +-- navbutton - * | - * +-- statusarea - * | - * +-- cursorlabel - * +-- statusbar - * +-- progressbar - * +-- cancelbutton - */ - - /* first, set up the container hierarchy *********************************/ - - /* the vbox containing all widgets */ - main_vbox = gtk_vbox_new (FALSE, 2); - gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 2); - gtk_container_add (GTK_CONTAINER (gdisp->shell), main_vbox); - - /* another vbox for everything except the statusbar */ - disp_vbox = gtk_vbox_new (FALSE, 1); - gtk_box_pack_start (GTK_BOX (main_vbox), disp_vbox, TRUE, TRUE, 0); - gtk_widget_show (disp_vbox); - - /* a hbox for the inner_table and the vertical scrollbar */ - upper_hbox = gtk_hbox_new (FALSE, 1); - gtk_box_pack_start (GTK_BOX (disp_vbox), upper_hbox, TRUE, TRUE, 0); - gtk_widget_show (upper_hbox); - - /* the table containing origin, rulers and the canvas */ - inner_table = gtk_table_new (2, 2, FALSE); - gtk_table_set_col_spacing (GTK_TABLE (inner_table), 0, 1); - gtk_table_set_row_spacing (GTK_TABLE (inner_table), 0, 1); - gtk_box_pack_start (GTK_BOX (upper_hbox), inner_table, TRUE, TRUE, 0); - gtk_widget_show (inner_table); - - /* the hbox containing qmask buttons, vertical scrollbar and nav button */ - lower_hbox = gtk_hbox_new (FALSE, 1); - gtk_box_pack_start (GTK_BOX (disp_vbox), lower_hbox, FALSE, FALSE, 0); - gtk_widget_show (lower_hbox); - - /* eventbox and hbox for status area */ - gdisp->statusarea = gtk_event_box_new (); - gtk_box_pack_start (GTK_BOX (main_vbox), gdisp->statusarea, FALSE, FALSE, 0); - - gimp_help_set_help_data (gdisp->statusarea, NULL, "#status_area"); - - status_hbox = gtk_hbox_new (FALSE, 2); - gtk_container_add (GTK_CONTAINER (gdisp->statusarea), status_hbox); - gtk_widget_show (status_hbox); - - gtk_container_set_resize_mode (GTK_CONTAINER (status_hbox), - GTK_RESIZE_QUEUE); - - /* create the scrollbars *************************************************/ - - /* the horizontal scrollbar */ - gdisp->hsbdata = - GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, width, 1, 1, width)); - gdisp->hsb = gtk_hscrollbar_new (gdisp->hsbdata); - GTK_WIDGET_UNSET_FLAGS (gdisp->hsb, GTK_CAN_FOCUS); - - /* the vertical scrollbar */ - gdisp->vsbdata = - GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, height, 1, 1, height)); - gdisp->vsb = gtk_vscrollbar_new (gdisp->vsbdata); - GTK_WIDGET_UNSET_FLAGS (gdisp->vsb, GTK_CAN_FOCUS); - - /* create the contents of the inner_table ********************************/ - - /* the menu popup button */ - gdisp->origin = gtk_button_new (); - GTK_WIDGET_UNSET_FLAGS (gdisp->origin, GTK_CAN_FOCUS); - gtk_widget_set_events (GTK_WIDGET (gdisp->origin), - GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK); - - g_signal_connect (G_OBJECT (gdisp->origin), "button_press_event", - G_CALLBACK (gdisplay_origin_button_press), - gdisp); - - gimp_help_set_help_data (gdisp->origin, NULL, "#origin_button"); - - arrow = gtk_arrow_new (GTK_ARROW_RIGHT, GTK_SHADOW_OUT); - gtk_container_set_border_width (GTK_CONTAINER (gdisp->origin), 0); - gtk_container_add (GTK_CONTAINER (gdisp->origin), arrow); - gtk_widget_show (arrow); - - /* the horizontal ruler */ - gdisp->hrule = gtk_hruler_new (); - gtk_widget_set_events (GTK_WIDGET (gdisp->hrule), - GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK); - - g_signal_connect_swapped (G_OBJECT (gdisp->shell), "motion_notify_event", - G_CALLBACK (GTK_WIDGET_GET_CLASS (gdisp->hrule)->motion_notify_event), - gdisp->hrule); - g_signal_connect (G_OBJECT (gdisp->hrule), "button_press_event", - G_CALLBACK (gdisplay_hruler_button_press), - gdisp); - - gimp_help_set_help_data (gdisp->hrule, NULL, "#ruler"); - - /* the vertical ruler */ - gdisp->vrule = gtk_vruler_new (); - gtk_widget_set_events (GTK_WIDGET (gdisp->vrule), - GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK); - - g_signal_connect_swapped (G_OBJECT (gdisp->shell), "motion_notify_event", - G_CALLBACK (GTK_WIDGET_GET_CLASS (gdisp->vrule)->motion_notify_event), - gdisp->vrule); - g_signal_connect (G_OBJECT (gdisp->vrule), "button_press_event", - G_CALLBACK (gdisplay_vruler_button_press), - gdisp); - - gimp_help_set_help_data (gdisp->vrule, NULL, "#ruler"); - - /* the canvas */ - gdisp->canvas = gtk_drawing_area_new (); - gtk_widget_set_name (gdisp->canvas, "gimp-canvas"); - gtk_drawing_area_size (GTK_DRAWING_AREA (gdisp->canvas), n_width, n_height); - gtk_widget_set_events (gdisp->canvas, CANVAS_EVENT_MASK); - gtk_widget_set_extension_events (gdisp->canvas, GDK_EXTENSION_EVENTS_ALL); - GTK_WIDGET_SET_FLAGS (gdisp->canvas, GTK_CAN_FOCUS); - - /* set the active display before doing any other canvas event processing */ - g_signal_connect (G_OBJECT (gdisp->canvas), "event", - G_CALLBACK (gdisplay_shell_events), - gdisp); - g_signal_connect (G_OBJECT (gdisp->canvas), "event", - G_CALLBACK (gdisplay_canvas_events), - gdisp); - - /* create the contents of the lower_hbox *********************************/ - - /* the qmask buttons */ - gdisp->qmaskoff = gtk_radio_button_new (group); - group = gtk_radio_button_group (GTK_RADIO_BUTTON (gdisp->qmaskoff)); - gtk_widget_set_usize (GTK_WIDGET (gdisp->qmaskoff), 15, 15); - gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (gdisp->qmaskoff), FALSE); - GTK_WIDGET_UNSET_FLAGS (gdisp->qmaskoff, GTK_CAN_FOCUS); - - g_signal_connect (G_OBJECT (gdisp->qmaskoff), "toggled", - G_CALLBACK (qmask_deactivate_callback), - gdisp); - g_signal_connect (G_OBJECT (gdisp->qmaskoff), "button_press_event", - G_CALLBACK (qmask_button_press_callback), - gdisp); - - gimp_help_set_help_data (gdisp->qmaskoff, NULL, "#qmask_off_button"); - - gdisp->qmaskon = gtk_radio_button_new (group); - group = gtk_radio_button_group (GTK_RADIO_BUTTON (gdisp->qmaskon)); - gtk_widget_set_usize (GTK_WIDGET (gdisp->qmaskon), 15, 15); - gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (gdisp->qmaskon), FALSE); - GTK_WIDGET_UNSET_FLAGS (gdisp->qmaskon, GTK_CAN_FOCUS); - - g_signal_connect (G_OBJECT (gdisp->qmaskon), "toggled", - G_CALLBACK (qmask_activate_callback), - gdisp); - g_signal_connect (G_OBJECT (gdisp->qmaskon), "button_press_event", - G_CALLBACK (qmask_button_press_callback), - gdisp); - - gimp_help_set_help_data (gdisp->qmaskon, NULL, "#qmask_on_button"); - - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gdisp->qmaskoff), TRUE); - - /* the navigation window button */ - nav_ebox = gtk_event_box_new (); - - g_signal_connect (G_OBJECT (nav_ebox), "button_press_event", - G_CALLBACK (nav_popup_click_handler), - gdisp); - - gimp_help_set_help_data (nav_ebox, NULL, "#nav_window_button"); - - /* We need to realize the shell so that we have a GdkWindow for - * the pixmap creation. - */ - gtk_widget_realize (gdisp->shell); - - /* create the pixmaps ****************************************************/ - if (!qmasksel_pixmap) - { - GtkStyle *style; - - style = gtk_widget_get_style (gdisp->shell); - - qmasksel_pixmap = - gdk_pixmap_create_from_xpm_d (gdisp->shell->window, - &qmasksel_mask, - &style->bg[GTK_STATE_NORMAL], - qmasksel_xpm); - qmasknosel_pixmap = - gdk_pixmap_create_from_xpm_d (gdisp->shell->window, - &qmasknosel_mask, - &style->bg[GTK_STATE_NORMAL], - qmasknosel_xpm); - navbutton_pixmap = - gdk_pixmap_create_from_xpm_d (gdisp->shell->window, - &navbutton_mask, - &style->bg[GTK_STATE_NORMAL], - navbutton_xpm); - } - - /* Icon stuff */ - gdisp->iconsize = 32; - gdisp->icon = NULL; - gdisp->iconmask = NULL; - gdisp->icon_needs_update = 0; - gdisp->icon_timeout_id = 0; - gdisp->icon_idle_id = 0; - - g_signal_connect (G_OBJECT (gdisp->gimage), "invalidate_preview", - G_CALLBACK (gdisplay_update_icon_scheduler), - gdisp); - - gdisplay_update_icon_scheduler (gdisp->gimage, gdisp); - - - /* create the GtkPixmaps */ - pixmap = gtk_pixmap_new (qmasksel_pixmap, qmasksel_mask); - gtk_container_add (GTK_CONTAINER (gdisp->qmaskon), pixmap); - gtk_widget_show (pixmap); - - pixmap = gtk_pixmap_new (qmasknosel_pixmap, qmasknosel_mask); - gtk_container_add (GTK_CONTAINER (gdisp->qmaskoff), pixmap); - gtk_widget_show (pixmap); - - pixmap = gtk_pixmap_new (navbutton_pixmap, navbutton_mask); - gtk_container_add (GTK_CONTAINER (nav_ebox), pixmap); - gtk_widget_show (pixmap); - - /* create the contents of the status area *********************************/ - - /* the cursor label */ - label_frame = gtk_frame_new (NULL); - gtk_frame_set_shadow_type (GTK_FRAME (label_frame), GTK_SHADOW_IN); - - gdisp->cursor_label = gtk_label_new (" "); - gtk_container_add (GTK_CONTAINER (label_frame), gdisp->cursor_label); - gtk_widget_show (gdisp->cursor_label); - - /* the statusbar */ - gdisp->statusbar = gtk_statusbar_new (); - gtk_widget_set_usize (gdisp->statusbar, 1, -1); - gtk_container_set_resize_mode (GTK_CONTAINER (gdisp->statusbar), - GTK_RESIZE_QUEUE); - contextid = gtk_statusbar_get_context_id (GTK_STATUSBAR (gdisp->statusbar), - "title"); - gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), - contextid, - title); - - /* the progress bar */ - gdisp->progressbar = gtk_progress_bar_new (); - gtk_widget_set_usize (gdisp->progressbar, 80, -1); - - /* the cancel button */ - gdisp->cancelbutton = gtk_button_new_with_label (_("Cancel")); - gtk_widget_set_sensitive (gdisp->cancelbutton, FALSE); - - /* pack all the widgets **************************************************/ - - /* fill the upper_hbox */ - gtk_box_pack_start (GTK_BOX (upper_hbox), gdisp->vsb, FALSE, FALSE, 0); - - /* fill the inner_table */ - gtk_table_attach (GTK_TABLE (inner_table), gdisp->origin, 0, 1, 0, 1, - GTK_FILL, GTK_FILL, 0, 0); - gtk_table_attach (GTK_TABLE (inner_table), gdisp->hrule, 1, 2, 0, 1, - GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0); - gtk_table_attach (GTK_TABLE (inner_table), gdisp->vrule, 0, 1, 1, 2, - GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); - gtk_table_attach (GTK_TABLE (inner_table), gdisp->canvas, 1, 2, 1, 2, - GTK_EXPAND | GTK_SHRINK | GTK_FILL, - GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); - - /* fill the lower_hbox */ - gtk_box_pack_start (GTK_BOX (lower_hbox), gdisp->qmaskoff, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (lower_hbox), gdisp->qmaskon, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (lower_hbox), gdisp->hsb, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (lower_hbox), nav_ebox, FALSE, FALSE, 0); - - /* fill the status area */ - gtk_box_pack_start (GTK_BOX (status_hbox), label_frame, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (status_hbox), gdisp->statusbar, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (status_hbox), gdisp->progressbar, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (status_hbox), gdisp->cancelbutton, FALSE, FALSE, 0); - - /* show everything *******************************************************/ - - if (gimprc.show_rulers) - { - gtk_widget_show (gdisp->origin); - gtk_widget_show (gdisp->hrule); - gtk_widget_show (gdisp->vrule); - } - gtk_widget_show (gdisp->canvas); - - gtk_widget_show (gdisp->vsb); - gtk_widget_show (gdisp->hsb); - - gtk_widget_show (gdisp->qmaskoff); - gtk_widget_show (gdisp->qmaskon); - gtk_widget_show (nav_ebox); - - gtk_widget_show (label_frame); - gtk_widget_show (gdisp->statusbar); - gtk_widget_show (gdisp->progressbar); - gtk_widget_show (gdisp->cancelbutton); - if (gimprc.show_statusbar) - { - gtk_widget_show (gdisp->statusarea); - } - - gtk_widget_realize (gdisp->canvas); - gdk_window_set_back_pixmap (gdisp->canvas->window, NULL, FALSE); - - /* we need to realize the cursor_label widget here, so the size gets - * computed correctly - */ - gtk_widget_realize (gdisp->cursor_label); - gdisplay_resize_cursor_label (gdisp); - - gtk_widget_show (main_vbox); - gtk_widget_show (gdisp->shell); - - /* set the focus to the canvas area */ - gtk_widget_grab_focus (gdisp->canvas); -} diff --git a/app/interface.h b/app/interface.h deleted file mode 100644 index f745e13ce6..0000000000 --- a/app/interface.h +++ /dev/null @@ -1,30 +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 __INTERFACE_H__ -#define __INTERFACE_H__ - - -void create_display_shell (GDisplay *gdisp, - gint width, - gint height, - gchar *title, - gint type); - - -#endif /* __INTERFACE_H__ */ diff --git a/app/marching_ants.h b/app/marching_ants.h deleted file mode 100644 index c6047fcb71..0000000000 --- a/app/marching_ants.h +++ /dev/null @@ -1,90 +0,0 @@ -#ifndef __MARCHING_ANTS_H__ -#define __MARCHING_ANTS_H__ - -/* static variable definitions */ -static unsigned char ant_data[8][8] = -{ - { - 0xF0, /* ####---- */ - 0xE1, /* ###----# */ - 0xC3, /* ##----## */ - 0x87, /* #----### */ - 0x0F, /* ----#### */ - 0x1E, /* ---####- */ - 0x3C, /* --####-- */ - 0x78, /* -####--- */ - }, - { - 0xE1, /* ###----# */ - 0xC3, /* ##----## */ - 0x87, /* #----### */ - 0x0F, /* ----#### */ - 0x1E, /* ---####- */ - 0x3C, /* --####-- */ - 0x78, /* -####--- */ - 0xF0, /* ####---- */ - }, - { - 0xC3, /* ##----## */ - 0x87, /* #----### */ - 0x0F, /* ----#### */ - 0x1E, /* ---####- */ - 0x3C, /* --####-- */ - 0x78, /* -####--- */ - 0xF0, /* ####---- */ - 0xE1, /* ###----# */ - }, - { - 0x87, /* #----### */ - 0x0F, /* ----#### */ - 0x1E, /* ---####- */ - 0x3C, /* --####-- */ - 0x78, /* -####--- */ - 0xF0, /* ####---- */ - 0xE1, /* ###----# */ - 0xC3, /* ##----## */ - }, - { - 0x0F, /* ----#### */ - 0x1E, /* ---####- */ - 0x3C, /* --####-- */ - 0x78, /* -####--- */ - 0xF0, /* ####---- */ - 0xE1, /* ###----# */ - 0xC3, /* ##----## */ - 0x87, /* #----### */ - }, - { - 0x1E, /* ---####- */ - 0x3C, /* --####-- */ - 0x78, /* -####--- */ - 0xF0, /* ####---- */ - 0xE1, /* ###----# */ - 0xC3, /* ##----## */ - 0x87, /* #----### */ - 0x0F, /* ----#### */ - }, - { - 0x3C, /* --####-- */ - 0x78, /* -####--- */ - 0xF0, /* ####---- */ - 0xE1, /* ###----# */ - 0xC3, /* ##----## */ - 0x87, /* #----### */ - 0x0F, /* ----#### */ - 0x1E, /* ---####- */ - }, - { - 0x78, /* -####--- */ - 0xF0, /* ####---- */ - 0xE1, /* ###----# */ - 0xC3, /* ##----## */ - 0x87, /* #----### */ - 0x0F, /* ----#### */ - 0x1E, /* ---####- */ - 0x3C, /* --####-- */ - }, -}; - - -#endif /* __MARCHING_ANTS_H__ */ diff --git a/app/menus/menus.c b/app/menus/menus.c index 60e3a33c0b..b0a15936a8 100644 --- a/app/menus/menus.c +++ b/app/menus/menus.c @@ -28,12 +28,14 @@ #include "libgimpbase/gimpbase.h" #include "libgimpwidgets/gimpwidgets.h" -#include "tools/tools-types.h" +#include "gui-types.h" #include "core/gimp.h" #include "core/gimplist.h" #include "core/gimptoolinfo.h" +#include "display/gimpdisplay.h" + #include "tools/gimpbrightnesscontrasttool.h" #include "tools/gimpcolorbalancetool.h" #include "tools/gimpcurvestool.h" @@ -61,7 +63,6 @@ #include "view-commands.h" #include "app_procs.h" -#include "gdisplay.h" #include "gimphelp.h" #include "gimprc.h" diff --git a/app/menus/plug-in-menus.c b/app/menus/plug-in-menus.c index 8cfc5af24f..12b9886464 100644 --- a/app/menus/plug-in-menus.c +++ b/app/menus/plug-in-menus.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "core/core-types.h" +#include "display/display-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -95,11 +95,12 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "display/gimpdisplay.h" + #include "gui/brush-select.h" #include "gui/gradient-select.h" #include "gui/menus.h" #include "gui/pattern-select.h" -#include "gdisplay.h" #include "app_procs.h" #include "appenv.h" diff --git a/app/nav_window.c b/app/nav_window.c index 8c8fe28e29..b0dba382e9 100644 --- a/app/nav_window.c +++ b/app/nav_window.c @@ -36,16 +36,17 @@ #include "core/gimpimage.h" #include "core/gimplist.h" +#include "display/gimpdisplay.h" +#include "display/gimpdisplay-scroll.h" +#include "display/gimpdisplay-scale.h" + #include "widgets/gimpnavigationpreview.h" #include "app_procs.h" -#include "gdisplay.h" #include "nav_window.h" #include "app_procs.h" #include "gimprc.h" -#include "scroll.h" -#include "scale.h" #include "libgimp/gimpintl.h" diff --git a/app/paint/gimpairbrush.c b/app/paint/gimpairbrush.c index f0ff990d94..deaed8fb92 100644 --- a/app/paint/gimpairbrush.c +++ b/app/paint/gimpairbrush.c @@ -36,13 +36,13 @@ #include "core/gimpgradient.h" #include "core/gimpimage.h" +#include "display/gimpdisplay.h" + #include "gimpairbrushtool.h" #include "paint_options.h" #include "gimptool.h" #include "tool_manager.h" -#include "gdisplay.h" - #include "libgimp/gimpintl.h" diff --git a/app/paint/gimpclone.c b/app/paint/gimpclone.c index f4f473f3ef..ebf78b817b 100644 --- a/app/paint/gimpclone.c +++ b/app/paint/gimpclone.c @@ -40,13 +40,13 @@ #include "core/gimpcontext.h" #include "core/gimpbrush.h" +#include "display/gimpdisplay.h" + #include "gimpclonetool.h" #include "paint_options.h" #include "tool_manager.h" #include "tool_options.h" -#include "gdisplay.h" - #include "libgimp/gimpintl.h" diff --git a/app/paint/gimpconvolve.c b/app/paint/gimpconvolve.c index ca6b32e8ed..207e6921fb 100644 --- a/app/paint/gimpconvolve.c +++ b/app/paint/gimpconvolve.c @@ -41,8 +41,6 @@ #include "tool_manager.h" #include "tool_options.h" -#include "gdisplay.h" - #include "libgimp/gimpintl.h" diff --git a/app/paint/gimpdodgeburn.c b/app/paint/gimpdodgeburn.c index 34d5db3203..af43bdd52f 100644 --- a/app/paint/gimpdodgeburn.c +++ b/app/paint/gimpdodgeburn.c @@ -37,8 +37,6 @@ #include "core/gimpcontext.h" #include "core/gimpimage.h" -#include "gdisplay.h" - #include "gimpdodgeburntool.h" #include "gimppainttool.h" #include "paint_options.h" diff --git a/app/paint/gimperaser.c b/app/paint/gimperaser.c index 4a68a12e13..b73d3dba6a 100644 --- a/app/paint/gimperaser.c +++ b/app/paint/gimperaser.c @@ -34,8 +34,6 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" -#include "gdisplay.h" - #include "gimperasertool.h" #include "paint_options.h" #include "tool_manager.h" diff --git a/app/paint/gimpink.c b/app/paint/gimpink.c index b93d9f53ea..e637eca91b 100644 --- a/app/paint/gimpink.c +++ b/app/paint/gimpink.c @@ -41,6 +41,8 @@ #include "core/gimpimage.h" #include "core/gimpimage-mask.h" +#include "display/gimpdisplay.h" + #include "gimpinktool.h" #include "gimpinktool-blob.h" #include "gimptool.h" @@ -49,7 +51,6 @@ #include "gimprc.h" #include "undo.h" -#include "gdisplay.h" #include "libgimp/gimpintl.h" diff --git a/app/paint/gimppaintbrush.c b/app/paint/gimppaintbrush.c index 9baa63c7fc..10f4b29ced 100644 --- a/app/paint/gimppaintbrush.c +++ b/app/paint/gimppaintbrush.c @@ -38,8 +38,6 @@ #include "core/gimpgradient.h" #include "core/gimpimage.h" -#include "gdisplay.h" - #include "gimppaintbrushtool.h" #include "paint_options.h" #include "tool_manager.h" diff --git a/app/paint/gimppaintcore.c b/app/paint/gimppaintcore.c index 3316eecfba..4f862d037c 100644 --- a/app/paint/gimppaintcore.c +++ b/app/paint/gimppaintcore.c @@ -46,6 +46,8 @@ #include "core/gimpimage-mask.h" #include "core/gimpmarshal.h" +#include "display/gimpdisplay.h" + #include "gimpdrawtool.h" #include "gimpdodgeburntool.h" #include "gimperasertool.h" @@ -54,7 +56,6 @@ #include "app_procs.h" #include "devices.h" -#include "gdisplay.h" #include "gimprc.h" #include "undo.h" diff --git a/app/paint/gimppencil.c b/app/paint/gimppencil.c index 9d9c69c20c..f96a9897dd 100644 --- a/app/paint/gimppencil.c +++ b/app/paint/gimppencil.c @@ -36,8 +36,6 @@ #include "core/gimpgradient.h" #include "core/gimpimage.h" -#include "gdisplay.h" - #include "gimppenciltool.h" #include "gimppainttool.h" #include "paint_options.h" diff --git a/app/paint/gimpsmudge.c b/app/paint/gimpsmudge.c index e48d031c72..7f485feb44 100644 --- a/app/paint/gimpsmudge.c +++ b/app/paint/gimpsmudge.c @@ -42,8 +42,6 @@ #include "tool_manager.h" #include "tool_options.h" -#include "gdisplay.h" - #include "libgimp/gimpintl.h" diff --git a/app/paint/gimpsourcecore.c b/app/paint/gimpsourcecore.c index f4f473f3ef..ebf78b817b 100644 --- a/app/paint/gimpsourcecore.c +++ b/app/paint/gimpsourcecore.c @@ -40,13 +40,13 @@ #include "core/gimpcontext.h" #include "core/gimpbrush.h" +#include "display/gimpdisplay.h" + #include "gimpclonetool.h" #include "paint_options.h" #include "tool_manager.h" #include "tool_options.h" -#include "gdisplay.h" - #include "libgimp/gimpintl.h" diff --git a/app/path.c b/app/path.c index 5c8e403895..1d4f03f2ce 100644 --- a/app/path.c +++ b/app/path.c @@ -26,14 +26,14 @@ #include "libgimpmath/gimpmath.h" -#include "core/core-types.h" -#include "tools/tools-types.h" +#include "display/display-types.h" #include "core/gimpimage.h" +#include "display/gimpdisplay.h" + #include "tools/gimpbezierselecttool.h" -#include "gdisplay.h" #include "gui/paths-dialog.h" #include "path.h" diff --git a/app/pdb/display_cmds.c b/app/pdb/display_cmds.c index de9c1674bb..c5237f6c60 100644 --- a/app/pdb/display_cmds.c +++ b/app/pdb/display_cmds.c @@ -30,7 +30,7 @@ #include "procedural_db.h" #include "core/gimpimage.h" -#include "gdisplay.h" +#include "display/gimpdisplay.h" static ProcRecord display_new_proc; static ProcRecord display_delete_proc; @@ -51,7 +51,7 @@ display_new_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; GimpImage *gimage; - GDisplay *gdisp = NULL; + GimpDisplay *gdisp = NULL; guint scale = 0x101; gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int); @@ -110,7 +110,7 @@ display_delete_invoker (Gimp *gimp, Argument *args) { gboolean success = TRUE; - GDisplay *gdisp; + GimpDisplay *gdisp; gdisp = gdisplay_get_by_ID (gimp, args[0].value.pdb_int); if (gdisp == NULL) diff --git a/app/pdb/internal_procs.c b/app/pdb/internal_procs.c index a95b922597..deb0eb1012 100644 --- a/app/pdb/internal_procs.c +++ b/app/pdb/internal_procs.c @@ -82,7 +82,7 @@ internal_procs_init (Gimp *gimp) app_init_update_status (NULL, _("Convert"), 0.129); register_convert_procs (gimp); - app_init_update_status (NULL, _("GDisplay procedures"), 0.138); + app_init_update_status (NULL, _("GimpDisplay procedures"), 0.138); register_display_procs (gimp); app_init_update_status (NULL, _("Drawable procedures"), 0.147); diff --git a/app/plug-in/gimpplugin-message.c b/app/plug-in/gimpplugin-message.c index 8cfc5af24f..12b9886464 100644 --- a/app/plug-in/gimpplugin-message.c +++ b/app/plug-in/gimpplugin-message.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "core/core-types.h" +#include "display/display-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -95,11 +95,12 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "display/gimpdisplay.h" + #include "gui/brush-select.h" #include "gui/gradient-select.h" #include "gui/menus.h" #include "gui/pattern-select.h" -#include "gdisplay.h" #include "app_procs.h" #include "appenv.h" diff --git a/app/plug-in/gimpplugin-progress.c b/app/plug-in/gimpplugin-progress.c index 8cfc5af24f..12b9886464 100644 --- a/app/plug-in/gimpplugin-progress.c +++ b/app/plug-in/gimpplugin-progress.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "core/core-types.h" +#include "display/display-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -95,11 +95,12 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "display/gimpdisplay.h" + #include "gui/brush-select.h" #include "gui/gradient-select.h" #include "gui/menus.h" #include "gui/pattern-select.h" -#include "gdisplay.h" #include "app_procs.h" #include "appenv.h" diff --git a/app/plug-in/gimpplugin.c b/app/plug-in/gimpplugin.c index 8cfc5af24f..12b9886464 100644 --- a/app/plug-in/gimpplugin.c +++ b/app/plug-in/gimpplugin.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "core/core-types.h" +#include "display/display-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -95,11 +95,12 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "display/gimpdisplay.h" + #include "gui/brush-select.h" #include "gui/gradient-select.h" #include "gui/menus.h" #include "gui/pattern-select.h" -#include "gdisplay.h" #include "app_procs.h" #include "appenv.h" diff --git a/app/plug-in/gimppluginmanager-call.c b/app/plug-in/gimppluginmanager-call.c index 8cfc5af24f..12b9886464 100644 --- a/app/plug-in/gimppluginmanager-call.c +++ b/app/plug-in/gimppluginmanager-call.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "core/core-types.h" +#include "display/display-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -95,11 +95,12 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "display/gimpdisplay.h" + #include "gui/brush-select.h" #include "gui/gradient-select.h" #include "gui/menus.h" #include "gui/pattern-select.h" -#include "gdisplay.h" #include "app_procs.h" #include "appenv.h" diff --git a/app/plug-in/gimppluginmanager-run.c b/app/plug-in/gimppluginmanager-run.c index 8cfc5af24f..12b9886464 100644 --- a/app/plug-in/gimppluginmanager-run.c +++ b/app/plug-in/gimppluginmanager-run.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "core/core-types.h" +#include "display/display-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -95,11 +95,12 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "display/gimpdisplay.h" + #include "gui/brush-select.h" #include "gui/gradient-select.h" #include "gui/menus.h" #include "gui/pattern-select.h" -#include "gdisplay.h" #include "app_procs.h" #include "appenv.h" diff --git a/app/plug-in/gimppluginmanager.c b/app/plug-in/gimppluginmanager.c index 8cfc5af24f..12b9886464 100644 --- a/app/plug-in/gimppluginmanager.c +++ b/app/plug-in/gimppluginmanager.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "core/core-types.h" +#include "display/display-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -95,11 +95,12 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "display/gimpdisplay.h" + #include "gui/brush-select.h" #include "gui/gradient-select.h" #include "gui/menus.h" #include "gui/pattern-select.h" -#include "gdisplay.h" #include "app_procs.h" #include "appenv.h" diff --git a/app/plug-in/gimppluginshm.c b/app/plug-in/gimppluginshm.c index 8cfc5af24f..12b9886464 100644 --- a/app/plug-in/gimppluginshm.c +++ b/app/plug-in/gimppluginshm.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "core/core-types.h" +#include "display/display-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -95,11 +95,12 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "display/gimpdisplay.h" + #include "gui/brush-select.h" #include "gui/gradient-select.h" #include "gui/menus.h" #include "gui/pattern-select.h" -#include "gdisplay.h" #include "app_procs.h" #include "appenv.h" diff --git a/app/plug-in/plug-in-def.c b/app/plug-in/plug-in-def.c index 8cfc5af24f..12b9886464 100644 --- a/app/plug-in/plug-in-def.c +++ b/app/plug-in/plug-in-def.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "core/core-types.h" +#include "display/display-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -95,11 +95,12 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "display/gimpdisplay.h" + #include "gui/brush-select.h" #include "gui/gradient-select.h" #include "gui/menus.h" #include "gui/pattern-select.h" -#include "gdisplay.h" #include "app_procs.h" #include "appenv.h" diff --git a/app/plug-in/plug-in-message.c b/app/plug-in/plug-in-message.c index 8cfc5af24f..12b9886464 100644 --- a/app/plug-in/plug-in-message.c +++ b/app/plug-in/plug-in-message.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "core/core-types.h" +#include "display/display-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -95,11 +95,12 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "display/gimpdisplay.h" + #include "gui/brush-select.h" #include "gui/gradient-select.h" #include "gui/menus.h" #include "gui/pattern-select.h" -#include "gdisplay.h" #include "app_procs.h" #include "appenv.h" diff --git a/app/plug-in/plug-in-params.c b/app/plug-in/plug-in-params.c index 8cfc5af24f..12b9886464 100644 --- a/app/plug-in/plug-in-params.c +++ b/app/plug-in/plug-in-params.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "core/core-types.h" +#include "display/display-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -95,11 +95,12 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "display/gimpdisplay.h" + #include "gui/brush-select.h" #include "gui/gradient-select.h" #include "gui/menus.h" #include "gui/pattern-select.h" -#include "gdisplay.h" #include "app_procs.h" #include "appenv.h" diff --git a/app/plug-in/plug-in-progress.c b/app/plug-in/plug-in-progress.c index 8cfc5af24f..12b9886464 100644 --- a/app/plug-in/plug-in-progress.c +++ b/app/plug-in/plug-in-progress.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "core/core-types.h" +#include "display/display-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -95,11 +95,12 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "display/gimpdisplay.h" + #include "gui/brush-select.h" #include "gui/gradient-select.h" #include "gui/menus.h" #include "gui/pattern-select.h" -#include "gdisplay.h" #include "app_procs.h" #include "appenv.h" diff --git a/app/plug-in/plug-in-run.c b/app/plug-in/plug-in-run.c index 8cfc5af24f..12b9886464 100644 --- a/app/plug-in/plug-in-run.c +++ b/app/plug-in/plug-in-run.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "core/core-types.h" +#include "display/display-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -95,11 +95,12 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "display/gimpdisplay.h" + #include "gui/brush-select.h" #include "gui/gradient-select.h" #include "gui/menus.h" #include "gui/pattern-select.h" -#include "gdisplay.h" #include "app_procs.h" #include "appenv.h" diff --git a/app/plug-in/plug-in-shm.c b/app/plug-in/plug-in-shm.c index 8cfc5af24f..12b9886464 100644 --- a/app/plug-in/plug-in-shm.c +++ b/app/plug-in/plug-in-shm.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "core/core-types.h" +#include "display/display-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -95,11 +95,12 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "display/gimpdisplay.h" + #include "gui/brush-select.h" #include "gui/gradient-select.h" #include "gui/menus.h" #include "gui/pattern-select.h" -#include "gdisplay.h" #include "app_procs.h" #include "appenv.h" diff --git a/app/plug-in/plug-in.c b/app/plug-in/plug-in.c index 8cfc5af24f..12b9886464 100644 --- a/app/plug-in/plug-in.c +++ b/app/plug-in/plug-in.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "core/core-types.h" +#include "display/display-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -95,11 +95,12 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "display/gimpdisplay.h" + #include "gui/brush-select.h" #include "gui/gradient-select.h" #include "gui/menus.h" #include "gui/pattern-select.h" -#include "gdisplay.h" #include "app_procs.h" #include "appenv.h" diff --git a/app/plug-in/plug-ins.c b/app/plug-in/plug-ins.c index 8cfc5af24f..12b9886464 100644 --- a/app/plug-in/plug-ins.c +++ b/app/plug-in/plug-ins.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "core/core-types.h" +#include "display/display-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -95,11 +95,12 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "display/gimpdisplay.h" + #include "gui/brush-select.h" #include "gui/gradient-select.h" #include "gui/menus.h" #include "gui/pattern-select.h" -#include "gdisplay.h" #include "app_procs.h" #include "appenv.h" diff --git a/app/plug_in.c b/app/plug_in.c index 8cfc5af24f..12b9886464 100644 --- a/app/plug_in.c +++ b/app/plug_in.c @@ -84,7 +84,7 @@ #include "libgimpbase/gimpprotocol.h" #include "libgimpbase/gimpwire.h" -#include "core/core-types.h" +#include "display/display-types.h" #include "base/tile.h" #include "base/tile-manager.h" @@ -95,11 +95,12 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" +#include "display/gimpdisplay.h" + #include "gui/brush-select.h" #include "gui/gradient-select.h" #include "gui/menus.h" #include "gui/pattern-select.h" -#include "gdisplay.h" #include "app_procs.h" #include "appenv.h" diff --git a/app/qmask.c b/app/qmask.c index baf09dd1a5..07da95f3d0 100644 --- a/app/qmask.c +++ b/app/qmask.c @@ -35,11 +35,12 @@ #include "core/gimpimage.h" #include "core/gimpimage-mask.h" +#include "display/gimpdisplay.h" + #include "widgets/gimpcolorpanel.h" #include "app_procs.h" #include "floating_sel.h" -#include "gdisplay.h" #include "qmask.h" #include "undo.h" diff --git a/app/scale.c b/app/scale.c deleted file mode 100644 index 9cc1d311c6..0000000000 --- a/app/scale.c +++ /dev/null @@ -1,284 +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 - -#include "libgimpbase/gimpbase.h" - -#include "core/core-types.h" -#include "tools/tools-types.h" - -#include "core/gimpimage.h" - -#include "tools/gimptool.h" -#include "tools/tool_manager.h" - -#include "gdisplay.h" -#include "gdisplay_ops.h" -#include "gimprc.h" -#include "nav_window.h" -#include "scale.h" - - -void -bounds_checking (GimpDisplay *gdisp) -{ - gint sx, sy; - - sx = SCALEX (gdisp, gdisp->gimage->width); - sy = SCALEY (gdisp, gdisp->gimage->height); - - gdisp->offset_x = CLAMP (gdisp->offset_x, 0, - LOWPASS (sx - gdisp->disp_width)); - - gdisp->offset_y = CLAMP (gdisp->offset_y, 0, - LOWPASS (sy - gdisp->disp_height)); -} - - -void -resize_display (GimpDisplay *gdisp, - gboolean resize_window, - gboolean redisplay) -{ - /* freeze the active tool */ - tool_manager_control_active (gdisp->gimage->gimp, PAUSE, gdisp); - - if (resize_window) - gdisplay_shrink_wrap (gdisp); - - bounds_checking (gdisp); - setup_scale (gdisp); - - if (resize_window || redisplay) - { - gdisplay_expose_full (gdisp); - gdisplays_flush (); - /* title may have changed if it includes the zoom ratio */ - gdisplay_update_title (gdisp); - } - - /* re-enable the active tool */ - tool_manager_control_active (gdisp->gimage->gimp, RESUME, gdisp); -} - - -void -shrink_wrap_display (GimpDisplay *gdisp) -{ - /* freeze the active tool */ - tool_manager_control_active (gdisp->gimage->gimp, PAUSE, gdisp); - - gdisplay_shrink_wrap (gdisp); - - bounds_checking (gdisp); - setup_scale (gdisp); - - gdisplay_expose_full (gdisp); - gdisplays_flush (); - - /* re-enable the active tool */ - tool_manager_control_active (gdisp->gimage->gimp, RESUME, gdisp); -} - - -void -change_scale (GimpDisplay *gdisp, - GimpZoomType zoom_type) -{ - guchar scalesrc, scaledest; - gdouble offset_x, offset_y; - glong sx, sy; - - /* user zoom control, so resolution versions not needed -- austin */ - scalesrc = SCALESRC (gdisp); - scaledest = SCALEDEST (gdisp); - - offset_x = gdisp->offset_x + (gdisp->disp_width / 2.0); - offset_y = gdisp->offset_y + (gdisp->disp_height / 2.0); - - offset_x *= ((double) scalesrc / (double) scaledest); - offset_y *= ((double) scalesrc / (double) scaledest); - - switch (zoom_type) - { - case GIMP_ZOOM_IN: - if (scalesrc > 1) - scalesrc--; - else - if (scaledest < 0x10) - scaledest++; - else - return; - break; - - case GIMP_ZOOM_OUT: - if (scaledest > 1) - scaledest--; - else - if (scalesrc < 0x10) - scalesrc++; - else - return; - break; - - default: - scalesrc = zoom_type % 100; - if (scalesrc < 1) - scalesrc = 1; - else if (scalesrc > 0x10) - scalesrc = 0x10; - scaledest = zoom_type / 100; - if (scaledest < 1) - scaledest = 1; - else if (scaledest > 0x10) - scaledest = 0x10; - break; - } - - sx = (gdisp->gimage->width * scaledest) / scalesrc; - sy = (gdisp->gimage->height * scaledest) / scalesrc; - - /* The slider value is a short, so make sure we are within its - range. If we are trying to scale past it, then stop the scale */ - if (sx < 0xffff && sy < 0xffff) - { - gdisp->scale = (scaledest << 8) + scalesrc; - - /* set the offsets */ - offset_x *= ((double) scaledest / (double) scalesrc); - offset_y *= ((double) scaledest / (double) scalesrc); - - gdisp->offset_x = (int) (offset_x - (gdisp->disp_width / 2)); - gdisp->offset_y = (int) (offset_y - (gdisp->disp_height / 2)); - - /* resize the image */ - resize_display (gdisp, gimprc.allow_resize_windows, TRUE); - } -} - - -/* scale image coord to realworld units (cm, inches, pixels) */ -/* 27/Feb/1999 I tried inlining this, but the result was slightly - * slower (poorer cache locality, probably) -- austin */ -static gdouble -img2real (GimpDisplay *gdisp, - gboolean xdir, - gdouble a) -{ - gdouble res; - - if (gdisp->dot_for_dot) - return a; - - if (xdir) - res = gdisp->gimage->xresolution; - else - res = gdisp->gimage->yresolution; - - return a * gimp_unit_get_factor (gdisp->gimage->unit) / res; -} - - -void -setup_scale (GimpDisplay *gdisp) -{ - GtkRuler *hruler; - GtkRuler *vruler; - gfloat sx, sy; - gfloat stepx, stepy; - - sx = SCALEX (gdisp, gdisp->gimage->width); - sy = SCALEY (gdisp, gdisp->gimage->height); - stepx = SCALEFACTOR_X (gdisp); - stepy = SCALEFACTOR_Y (gdisp); - - gdisp->hsbdata->value = gdisp->offset_x; - gdisp->hsbdata->upper = sx; - gdisp->hsbdata->page_size = MIN (sx, gdisp->disp_width); - gdisp->hsbdata->page_increment = (gdisp->disp_width / 2); - gdisp->hsbdata->step_increment = stepx; - - gdisp->vsbdata->value = gdisp->offset_y; - gdisp->vsbdata->upper = sy; - gdisp->vsbdata->page_size = MIN (sy, gdisp->disp_height); - gdisp->vsbdata->page_increment = (gdisp->disp_height / 2); - gdisp->vsbdata->step_increment = stepy; - - gtk_adjustment_changed (gdisp->hsbdata); - gtk_adjustment_changed (gdisp->vsbdata); - - hruler = GTK_RULER (gdisp->hrule); - vruler = GTK_RULER (gdisp->vrule); - - hruler->lower = 0; - hruler->upper = img2real (gdisp, TRUE, FUNSCALEX (gdisp, gdisp->disp_width)); - hruler->max_size = img2real (gdisp, TRUE, MAX (gdisp->gimage->width, - gdisp->gimage->height)); - - vruler->lower = 0; - vruler->upper = img2real(gdisp, FALSE, FUNSCALEY(gdisp, gdisp->disp_height)); - vruler->max_size = img2real (gdisp, FALSE, MAX (gdisp->gimage->width, - gdisp->gimage->height)); - - if (sx < gdisp->disp_width) - { - gdisp->disp_xoffset = (gdisp->disp_width - sx) / 2; - hruler->lower -= img2real(gdisp, TRUE, - FUNSCALEX (gdisp, (double) gdisp->disp_xoffset)); - hruler->upper -= img2real(gdisp, TRUE, - FUNSCALEX (gdisp, (double) gdisp->disp_xoffset)); - } - else - { - gdisp->disp_xoffset = 0; - hruler->lower += img2real (gdisp, TRUE, - FUNSCALEX (gdisp, (double) gdisp->offset_x)); - hruler->upper += img2real (gdisp, TRUE, - FUNSCALEX (gdisp, (double) gdisp->offset_x)); - } - - if (sy < gdisp->disp_height) - { - gdisp->disp_yoffset = (gdisp->disp_height - sy) / 2; - vruler->lower -= img2real(gdisp, FALSE, - FUNSCALEY (gdisp, (double) gdisp->disp_yoffset)); - vruler->upper -= img2real(gdisp, FALSE, - FUNSCALEY (gdisp, (double) gdisp->disp_yoffset)); - } - else - { - gdisp->disp_yoffset = 0; - vruler->lower += img2real (gdisp, FALSE, - FUNSCALEY (gdisp, (double) gdisp->offset_y)); - vruler->upper += img2real (gdisp, FALSE, - FUNSCALEY (gdisp, (double) gdisp->offset_y)); - } - - gtk_widget_queue_draw (GTK_WIDGET (hruler)); - gtk_widget_queue_draw (GTK_WIDGET (vruler)); - - nav_dialog_update_window_marker (gdisp->window_nav_dialog); - - if (gdisp->nav_popup) - nav_dialog_update_window_marker (gdisp->nav_popup); -} diff --git a/app/scale.h b/app/scale.h deleted file mode 100644 index 814a3cfa05..0000000000 --- a/app/scale.h +++ /dev/null @@ -1,33 +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 __SCALE_H__ -#define __SCALE_H__ - - -void change_scale (GimpDisplay *gdisp, - GimpZoomType zoom_type); -void resize_display (GimpDisplay *gdisp, - gboolean resize_window, - gboolean redisplay); -void shrink_wrap_display (GimpDisplay *gdisp); -void setup_scale (GimpDisplay *gdisp); -void bounds_checking (GimpDisplay *gdisp); - - -#endif /* __SCALE_H__ */ diff --git a/app/scroll.c b/app/scroll.c deleted file mode 100644 index 6e53f465ee..0000000000 --- a/app/scroll.c +++ /dev/null @@ -1,227 +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 - -#include "tools/tools-types.h" - -#include "core/gimpimage.h" - -#include "widgets/gimpcursor.h" - -#include "tools/gimptool.h" -#include "tools/tool_manager.h" - -#include "gdisplay.h" -#include "scale.h" -#include "scroll.h" -#include "nav_window.h" - - -/* This is the delay before dithering begins - * for example, after an operation such as scrolling - */ -#define DITHER_DELAY 250 /* milliseconds */ - -/* STATIC variables */ -/* These are the values of the initial pointer grab */ -static gint startx, starty; - -void -start_grab_and_scroll (GimpDisplay *gdisp, - GdkEventButton *bevent) -{ - GdkCursor *cursor; - - startx = bevent->x + gdisp->offset_x; - starty = bevent->y + gdisp->offset_y; - - cursor = gimp_cursor_new (GDK_FLEUR, - GIMP_TOOL_CURSOR_NONE, - GIMP_CURSOR_MODIFIER_NONE); - gdk_window_set_cursor (gdisp->canvas->window, cursor); - gdk_cursor_unref (cursor); -} - - -void -end_grab_and_scroll (GimpDisplay *gdisp, - GdkEventButton *bevent) -{ - gdisplay_real_install_tool_cursor (gdisp, - gdisp->current_cursor, - gdisp->tool_cursor, - GIMP_CURSOR_MODIFIER_NONE, - TRUE); -} - - -void -grab_and_scroll (GimpDisplay *gdisp, - GdkEventMotion *mevent) -{ - if (mevent && mevent->window != gdisp->canvas->window) - return; - - scroll_display (gdisp, - startx - mevent->x - gdisp->offset_x, - starty - mevent->y - gdisp->offset_y); -} - - -void -scroll_to_pointer_position (GimpDisplay *gdisp, - GdkEventMotion *mevent) -{ - gdouble child_x, child_y; - gint off_x, off_y; - - off_x = off_y = 0; - - /* The cases for scrolling */ - if (mevent->x < 0) - off_x = mevent->x; - else if (mevent->x > gdisp->disp_width) - off_x = mevent->x - gdisp->disp_width; - - if (mevent->y < 0) - off_y = mevent->y; - else if (mevent->y > gdisp->disp_height) - off_y = mevent->y - gdisp->disp_height; - - if (scroll_display (gdisp, off_x, off_y)) - { -#ifdef __GNUC__ -#warning FIXME: replace gdk_input_window_get_pointer() -#endif -#if 0 - gdk_input_window_get_pointer (gdisp->canvas->window, mevent->deviceid, - &child_x, &child_y, - NULL, NULL, NULL, NULL); - - if (child_x == mevent->x && child_y == mevent->y) - /* Put this event back on the queue -- so it keeps scrolling */ - gdk_event_put ((GdkEvent *) mevent); -#endif - } -} - -gboolean -scroll_display (GimpDisplay *gdisp, - gint x_offset, - gint y_offset) -{ - gint old_x, old_y; - gint src_x, src_y; - gint dest_x, dest_y; - GdkEvent *event; - - old_x = gdisp->offset_x; - old_y = gdisp->offset_y; - - gdisp->offset_x += x_offset; - gdisp->offset_y += y_offset; - - bounds_checking (gdisp); - - /* the actual changes in offset */ - x_offset = (gdisp->offset_x - old_x); - y_offset = (gdisp->offset_y - old_y); - - if (x_offset || y_offset) - { - setup_scale (gdisp); - - src_x = (x_offset < 0) ? 0 : x_offset; - src_y = (y_offset < 0) ? 0 : y_offset; - dest_x = (x_offset < 0) ? -x_offset : 0; - dest_y = (y_offset < 0) ? -y_offset : 0; - - /* reset the old values so that the tool can accurately redraw */ - gdisp->offset_x = old_x; - gdisp->offset_y = old_y; - - /* freeze the active tool */ - tool_manager_control_active (gdisp->gimage->gimp, PAUSE, gdisp); - - /* set the offsets back to the new values */ - gdisp->offset_x += x_offset; - gdisp->offset_y += y_offset; - - gdk_draw_drawable (gdisp->canvas->window, - gdisp->scroll_gc, - gdisp->canvas->window, - src_x, src_y, - dest_x, dest_y, - (gdisp->disp_width - abs (x_offset)), - (gdisp->disp_height - abs (y_offset))); - - /* re-enable the active tool */ - tool_manager_control_active (gdisp->gimage->gimp, RESUME, gdisp); - - /* scale the image into the exposed regions */ - if (x_offset) - { - src_x = (x_offset < 0) ? 0 : gdisp->disp_width - x_offset; - src_y = 0; - gdisplay_expose_area (gdisp, - src_x, src_y, - abs (x_offset), gdisp->disp_height); - } - if (y_offset) - { - src_x = 0; - src_y = (y_offset < 0) ? 0 : gdisp->disp_height - y_offset; - gdisplay_expose_area (gdisp, - src_x, src_y, - gdisp->disp_width, abs (y_offset)); - } - - if (x_offset || y_offset) - gdisplays_flush (); - - nav_dialog_update_window_marker (gdisp->window_nav_dialog); - - if (gdisp->nav_popup) - nav_dialog_update_window_marker (gdisp->nav_popup); - - /* Make sure graphics expose events are processed before scrolling - * again - */ - while ((event = gdk_event_get_graphics_expose (gdisp->canvas->window))) - { - gtk_widget_event (gdisp->canvas, event); - - if (event->expose.count == 0) - { - gdk_event_free (event); - break; - } - - gdk_event_free (event); - } - - return TRUE; - } - - return FALSE; -} diff --git a/app/scroll.h b/app/scroll.h deleted file mode 100644 index 2b52965a7d..0000000000 --- a/app/scroll.h +++ /dev/null @@ -1,39 +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 __SCROLL_H__ -#define __SCROLL_H__ - - -/* routines for grabbing the image and scrolling via the pointer */ -void start_grab_and_scroll (GimpDisplay *gdisp, - GdkEventButton *bevent); -void end_grab_and_scroll (GimpDisplay *gdisp, - GdkEventButton *bevent); -void grab_and_scroll (GimpDisplay *gdisp, - GdkEventMotion *mevent); -void scroll_to_pointer_position (GimpDisplay *gdisp, - GdkEventMotion *mevent); - -/* generic scroll-by-offset function */ -gboolean scroll_display (GimpDisplay *gdisp, - gint x_offset, - gint y_offset); - - -#endif /* __SCROLL_H__ */ diff --git a/app/selection.c b/app/selection.c deleted file mode 100644 index 7835fd63b4..0000000000 --- a/app/selection.c +++ /dev/null @@ -1,784 +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 "base/boundary.h" - -#include "core/gimpimage.h" -#include "core/gimpimage-mask.h" - -#include "colormaps.h" -#include "gdisplay.h" -#include "gdisplay_ops.h" -#include "gimprc.h" -#include "selection.h" -#include "marching_ants.h" - - -#define USE_XDRAWPOINTS -#undef VERBOSE - -/* The possible internal drawing states... */ -#define INVISIBLE 0 -#define INTRO 1 -#define MARCHING 2 - -#define INITIAL_DELAY 15 /* in milleseconds */ - - -/* local function prototypes */ - -static GdkPixmap * create_cycled_ants_pixmap (GdkWindow *window, - gint depth); -static void cycle_ant_colors (Selection *select); -static void selection_add_point (GdkPoint *points[8], - gint max_npoints[8], - gint npoints[8], - gint x, - gint y); -static void selection_render_points (Selection *select); -static void selection_draw (Selection *select); -static void selection_transform_segs (Selection *select, - BoundSeg *src_segs, - GdkSegment *dest_segs, - gint num_segs); -static void selection_generate_segs (Selection *select); -static void selection_free_segs (Selection *select); -static gboolean selection_start_marching (gpointer data); -static gboolean selection_march_ants (gpointer data); - - -GdkPixmap * marching_ants[9] = { NULL }; -GdkPixmap * cycled_ants_pixmap = NULL; - - -/* public functions */ - -Selection * -selection_create (GdkWindow *win, - GDisplay *gdisp, - gint size, - gint width, - gint speed) -{ - GdkColor fg, bg; - Selection *new; - gint base_type; - gint i; - - new = g_new (Selection, 1); - base_type = gimp_image_base_type (gdisp->gimage); - - if (gimprc.cycled_marching_ants) - { - new->cycle = TRUE; - if (!cycled_ants_pixmap) - cycled_ants_pixmap = create_cycled_ants_pixmap (win, g_visual->depth); - - new->cycle_pix = cycled_ants_pixmap; - } - else - { - new->cycle = FALSE; - if (!marching_ants[0]) - for (i = 0; i < 8; i++) - marching_ants[i] = gdk_bitmap_create_from_data (win, (char*) ant_data[i], 8, 8); - } - - new->win = win; - new->gdisp = gdisp; - new->segs_in = NULL; - new->segs_out = NULL; - new->segs_layer = NULL; - new->num_segs_in = 0; - new->num_segs_out = 0; - new->num_segs_layer = 0; - new->index_in = 0; - new->index_out = 0; - new->index_layer = 0; - new->state = INVISIBLE; - new->paused = 0; - new->recalc = TRUE; - new->speed = speed; - new->hidden = FALSE; - - for (i = 0; i < 8; i++) - new->points_in[i] = NULL; - - /* create a new graphics context */ - new->gc_in = gdk_gc_new (new->win); - - if (new->cycle) - { - gdk_gc_set_fill (new->gc_in, GDK_TILED); - gdk_gc_set_tile (new->gc_in, new->cycle_pix); - gdk_gc_set_line_attributes (new->gc_in, 1, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER); - } - else - { - /* get black and white pixels for this gdisplay */ - fg.pixel = gdisplay_black_pixel (gdisp); - bg.pixel = gdisplay_white_pixel (gdisp); - - gdk_gc_set_foreground (new->gc_in, &fg); - gdk_gc_set_background (new->gc_in, &bg); - gdk_gc_set_fill (new->gc_in, GDK_OPAQUE_STIPPLED); - gdk_gc_set_line_attributes (new->gc_in, 1, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER); - } - -#ifdef USE_XDRAWPOINTS - new->gc_white = gdk_gc_new (new->win); - gdk_gc_set_foreground (new->gc_white, &bg); - - new->gc_black = gdk_gc_new (new->win); - gdk_gc_set_foreground (new->gc_black, &fg); -#endif - - /* Setup 2nd & 3rd GCs */ - fg.pixel = gdisplay_white_pixel (gdisp); - bg.pixel = gdisplay_gray_pixel (gdisp); - - /* create a new graphics context */ - new->gc_out = gdk_gc_new (new->win); - gdk_gc_set_foreground (new->gc_out, &fg); - gdk_gc_set_background (new->gc_out, &bg); - gdk_gc_set_fill (new->gc_out, GDK_OPAQUE_STIPPLED); - gdk_gc_set_line_attributes (new->gc_out, 1, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER); - - /* get black and color pixels for this gdisplay */ - fg.pixel = gdisplay_black_pixel (gdisp); - bg.pixel = gdisplay_color_pixel (gdisp); - - /* create a new graphics context */ - new->gc_layer = gdk_gc_new (new->win); - gdk_gc_set_foreground (new->gc_layer, &fg); - gdk_gc_set_background (new->gc_layer, &bg); - gdk_gc_set_fill (new->gc_layer, GDK_OPAQUE_STIPPLED); - gdk_gc_set_line_attributes (new->gc_layer, 1, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER); - - return new; -} - - -void -selection_free (Selection *select) -{ - if (select->state != INVISIBLE) - g_source_remove (select->timeout_id); - - if (select->gc_in) - gdk_gc_unref (select->gc_in); - if (select->gc_out) - gdk_gc_unref (select->gc_out); - if (select->gc_layer) - gdk_gc_unref (select->gc_layer); -#ifdef USE_XDRAWPOINTS - if (select->gc_white) - gdk_gc_unref (select->gc_white); - if (select->gc_black) - gdk_gc_unref (select->gc_black); -#endif - selection_free_segs (select); - - g_free (select); -} - - -void -selection_pause (Selection *select) -{ - if (select->state != INVISIBLE) - { - g_source_remove (select->timeout_id); - select->timeout_id = 0; - - select->state = INVISIBLE; - } - - select->paused ++; -} - - -void -selection_resume (Selection *select) -{ - if (select->paused == 1) - { - select->state = INTRO; - select->timeout_id = g_timeout_add (INITIAL_DELAY, - selection_start_marching, - select); - } - - select->paused--; -} - - -void -selection_start (Selection *select, - gboolean recalc) -{ - /* A call to selection_start with recalc == TRUE means that - * we want to recalculate the selection boundary--usually - * after scaling or panning the display, or modifying the - * selection in some way. If recalc == FALSE, the already - * calculated boundary is simply redrawn. - */ - if (recalc) - select->recalc = TRUE; - - /* If this selection is paused, do not start it */ - if (select->paused > 0) - return; - - if (select->state != INVISIBLE) - g_source_remove (select->timeout_id); - - select->state = INTRO; /* The state before the first draw */ - select->timeout_id = g_timeout_add (INITIAL_DELAY, - selection_start_marching, - select); -} - - -void -selection_invis (Selection *select) -{ - GDisplay * gdisp; - int x1, y1, x2, y2; - - if (select->state != INVISIBLE) - { - g_source_remove (select->timeout_id); - select->timeout_id = 0; - - select->state = INVISIBLE; - } - - gdisp = (GDisplay *) select->gdisp; - - /* Find the bounds of the selection */ - if (gdisplay_mask_bounds (gdisp, &x1, &y1, &x2, &y2)) - { - gdisplay_expose_area (gdisp, x1, y1, (x2 - x1), (y2 - y1)); - } - else - { - selection_start (select, TRUE); - } -} - - -void -selection_layer_invis (Selection *select) -{ - gint x1, y1; - gint x2, y2; - gint x3, y3; - gint x4, y4; - - if (select->state != INVISIBLE) - { - g_source_remove (select->timeout_id); - select->timeout_id = 0; - - select->state = INVISIBLE; - } - - if (select->segs_layer != NULL && select->num_segs_layer == 4) - { - GDisplay *gdisp; - - gdisp = select->gdisp; - - x1 = select->segs_layer[0].x1 - 1; - y1 = select->segs_layer[0].y1 - 1; - x2 = select->segs_layer[3].x2 + 1; - y2 = select->segs_layer[3].y2 + 1; - - x3 = select->segs_layer[0].x1 + 1; - y3 = select->segs_layer[0].y1 + 1; - x4 = select->segs_layer[3].x2 - 1; - y4 = select->segs_layer[3].y2 - 1; - - /* expose the region */ - gdisplay_expose_area (gdisp, x1, y1, (x2 - x1) + 1, (y3 - y1) + 1); - gdisplay_expose_area (gdisp, x1, y3, (x3 - x1) + 1, (y4 - y3) + 1); - gdisplay_expose_area (gdisp, x1, y4, (x2 - x1) + 1, (y2 - y4) + 1); - gdisplay_expose_area (gdisp, x4, y3, (x2 - x4) + 1, (y4 - y3) + 1); - } -} - - -void -selection_toggle (Selection *select) -{ - selection_invis (select); - selection_layer_invis (select); - - /* toggle the visibility */ - select->hidden = select->hidden ? FALSE : TRUE; - - selection_start (select, TRUE); -} - - -/* private functions */ - -static GdkPixmap * -create_cycled_ants_pixmap (GdkWindow *window, - gint depth) -{ - GdkPixmap *pixmap; - GdkGC *gc; - GdkColor col; - gint i, j; - - pixmap = gdk_pixmap_new (window, 8, 8, depth); - gc = gdk_gc_new (window); - - for (i = 0; i < 8; i++) - for (j = 0; j < 8; j++) - { - col.pixel = marching_ants_pixels[((i + j) % 8)]; - gdk_gc_set_foreground (gc, &col); - gdk_draw_line (pixmap, gc, i, j, i, j); - } - - gdk_gc_unref (gc); - - return pixmap; -} - - -static void -cycle_ant_colors (Selection *select) -{ - gint i; - gint index; - - for (i = 0; i < 8; i++) - { - index = (i + (8 - select->index_in)) % 8; - if (index < 4) - marching_ants_pixels[i] = get_color (0, 0, 0); - else - marching_ants_pixels[i] = get_color (255, 255, 255); - } -} - - -#define MAX_POINTS_INC 2048 - -static void -selection_add_point (GdkPoint *points[8], - gint max_npoints[8], - gint npoints[8], - gint x, - gint y) -{ - gint i, j; - - j = (x - y) & 7; - - i = npoints[j]++; - if (i == max_npoints[j]) - { - max_npoints[j] += 2048; - points[j] = g_realloc (points[j], sizeof (GdkPoint) * max_npoints[j]); - } - points[j][i].x = x; - points[j][i].y = y; -} - - -/* Render the segs_in array into points_in */ -static void -selection_render_points (Selection *select) -{ - gint i, j; - gint max_npoints[8]; - gint x, y; - gint dx, dy; - gint dxa, dya; - gint r; - - if (select->segs_in == NULL) - return; - - for (j = 0; j < 8; j++) - { - max_npoints[j] = MAX_POINTS_INC; - select->points_in[j] = g_new (GdkPoint, max_npoints[j]); - select->num_points_in[j] = 0; - } - - for (i = 0; i < select->num_segs_in; i++) - { -#ifdef VERBOSE - g_print ("%2d: (%d, %d) - (%d, %d)\n", i, - select->segs_in[i].x1, - select->segs_in[i].y1, - select->segs_in[i].x2, - select->segs_in[i].y2); -#endif - x = select->segs_in[i].x1; - dxa = select->segs_in[i].x2 - x; - if (dxa > 0) - { - dx = 1; - } - else - { - dxa = -dxa; - dx = -1; - } - y = select->segs_in[i].y1; - dya = select->segs_in[i].y2 - y; - if (dya > 0) - { - dy = 1; - } - else - { - dya = -dya; - dy = -1; - } - if (dxa > dya) - { - r = dya; - do { - selection_add_point (select->points_in, - max_npoints, - select->num_points_in, - x, y); - x += dx; - r += dya; - if (r >= (dxa << 1)) { - y += dy; - r -= (dxa << 1); - } - } while (x != select->segs_in[i].x2); - } - else if (dxa < dya) - { - r = dxa; - do { - selection_add_point (select->points_in, - max_npoints, - select->num_points_in, - x, y); - y += dy; - r += dxa; - if (r >= (dya << 1)) { - x += dx; - r -= (dya << 1); - } - } while (y != select->segs_in[i].y2); - } - else - selection_add_point (select->points_in, - max_npoints, - select->num_points_in, - x, y); - } -} - - -static void -selection_draw (Selection *select) -{ - if (select->hidden) - return; - - if (select->segs_layer && select->index_layer == 0) - gdk_draw_segments (select->win, select->gc_layer, - select->segs_layer, select->num_segs_layer); -#ifdef USE_XDRAWPOINTS -#ifdef VERBOSE - { - gint j, sum; - sum = 0; - for (j = 0; j < 8; j++) - sum += select->num_points_in[j]; - - g_print ("%d segments, %d points\n", select->num_segs_in, sum); - } -#endif - if (select->segs_in) - { - gint i; - - if (select->index_in == 0) - { - for (i = 0; i < 4; i++) - if (select->num_points_in[i]) - gdk_draw_points (select->win, select->gc_white, - select->points_in[i], select->num_points_in[i]); - for (i = 4; i < 8; i++) - if (select->num_points_in[i]) - gdk_draw_points (select->win, select->gc_black, - select->points_in[i], select->num_points_in[i]); - } - else - { - i = ((select->index_in + 3) & 7); - if (select->num_points_in[i]) - gdk_draw_points (select->win, select->gc_white, - select->points_in[i], select->num_points_in[i]); - i = ((select->index_in + 7) & 7); - if (select->num_points_in[i]) - gdk_draw_points (select->win, select->gc_black, - select->points_in[i], select->num_points_in[i]); - } - } -#else - if (select->segs_in) - gdk_draw_segments (select->win, select->gc_in, - select->segs_in, select->num_segs_in); -#endif - if (select->segs_out && select->index_out == 0) - gdk_draw_segments (select->win, select->gc_out, - select->segs_out, select->num_segs_out); -} - - -static void -selection_transform_segs (Selection *select, - BoundSeg *src_segs, - GdkSegment *dest_segs, - gint num_segs) -{ - GDisplay *gdisp; - gint x, y; - gint i; - - gdisp = (GDisplay *) select->gdisp; - - for (i = 0; i < num_segs; i++) - { - gdisplay_transform_coords (gdisp, src_segs[i].x1, src_segs[i].y1, - &x, &y, 0); - - dest_segs[i].x1 = x; - dest_segs[i].y1 = y; - - gdisplay_transform_coords (gdisp, src_segs[i].x2, src_segs[i].y2, - &x, &y, 0); - - dest_segs[i].x2 = x; - dest_segs[i].y2 = y; - - /* If this segment is a closing segment && the segments lie inside - * the region, OR if this is an opening segment and the segments - * lie outside the region... - * we need to transform it by one display pixel - */ - if (!src_segs[i].open) - { - /* If it is vertical */ - if (dest_segs[i].x1 == dest_segs[i].x2) - { - dest_segs[i].x1 -= 1; - dest_segs[i].x2 -= 1; - } - else - { - dest_segs[i].y1 -= 1; - dest_segs[i].y2 -= 1; - } - } - } -} - - -static void -selection_generate_segs (Selection *select) -{ - GDisplay *gdisp; - BoundSeg *segs_in; - BoundSeg *segs_out; - BoundSeg *segs_layer; - - gdisp = (GDisplay *) select->gdisp; - - /* Ask the gimage for the boundary of its selected region... - * Then transform that information into a new buffer of XSegments - */ - gimage_mask_boundary (gdisp->gimage, &segs_in, &segs_out, - &select->num_segs_in, &select->num_segs_out); - if (select->num_segs_in) - { - select->segs_in = g_new (GdkSegment, select->num_segs_in); - selection_transform_segs (select, segs_in, select->segs_in, - select->num_segs_in); -#ifdef USE_XDRAWPOINTS - selection_render_points (select); -#endif - } - else - { - select->segs_in = NULL; - } - - /* Possible secondary boundary representation */ - if (select->num_segs_out) - { - select->segs_out = g_new (GdkSegment, select->num_segs_out); - selection_transform_segs (select, segs_out, select->segs_out, - select->num_segs_out); - } - else - { - select->segs_out = NULL; - } - - /* The active layer's boundary */ - gimp_image_layer_boundary (gdisp->gimage, &segs_layer, - &select->num_segs_layer); - - if (select->num_segs_layer) - { - select->segs_layer = g_new (GdkSegment, select->num_segs_layer); - selection_transform_segs (select, segs_layer, select->segs_layer, - select->num_segs_layer); - } - else - { - select->segs_layer = NULL; - } - - g_free (segs_layer); -} - - -static void -selection_free_segs (Selection *select) -{ - gint j; - - if (select->segs_in) - g_free (select->segs_in); - if (select->segs_out) - g_free (select->segs_out); - if (select->segs_layer) - g_free (select->segs_layer); - - for (j = 0; j < 8; j++) - { - if (select->points_in[j]) - g_free (select->points_in[j]); - - select->points_in[j] = NULL; - select->num_points_in[j] = 0; - } - - select->segs_in = NULL; - select->num_segs_in = 0; - select->segs_out = NULL; - select->num_segs_out = 0; - select->segs_layer = NULL; - select->num_segs_layer = 0; -} - - -static gboolean -selection_start_marching (gpointer data) -{ - Selection *select; - - select = (Selection *) data; - - /* if the RECALC bit is set, reprocess the boundaries */ - if (select->recalc) - { - selection_free_segs (select); - selection_generate_segs (select); - - /* Toggle the RECALC flag */ - select->recalc = FALSE; - } - - select->index_in = 0; - select->index_out = 0; - select->index_layer = 0; - - /* Make sure the state is set to marching */ - select->state = MARCHING; - - /* Draw the ants */ - if (select->cycle) - cycle_ant_colors (select); - else - { - gdk_gc_set_stipple (select->gc_in, marching_ants[select->index_in]); - gdk_gc_set_stipple (select->gc_out, marching_ants[select->index_out]); - gdk_gc_set_stipple (select->gc_layer, marching_ants[select->index_layer]); - } - - selection_draw (select); - - /* Reset the timer */ - select->timeout_id = g_timeout_add (select->speed, - selection_march_ants, - select); - - return FALSE; -} - - -static gboolean -selection_march_ants (gpointer data) -{ - Selection *select; - - select = (Selection *) data; - - /* increment stipple index */ - select->index_in++; - -#ifndef USE_XDRAWPOINTS - if (select->index_in > 7) - select->index_in = 0; -#endif - - /* outside segments do not march, so index does not cycle */ - select->index_out++; - - /* layer doesn't march */ - select->index_layer++; - - /* Draw the ants */ - if (select->cycle) - cycle_ant_colors (select); - else - { -#ifndef USE_XDRAWPOINTS - gdk_gc_set_stipple (select->gc_in, marching_ants[select->index_in]); -#endif - - selection_draw (select); - } - - return TRUE; -} diff --git a/app/selection.h b/app/selection.h deleted file mode 100644 index f4b7dca554..0000000000 --- a/app/selection.h +++ /dev/null @@ -1,78 +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 __SELECTION_H__ -#define __SELECTION_H__ - - -struct _Selection -{ - /* This information is for maintaining the selection's appearance */ - GdkWindow *win; /* Window to draw to */ - GDisplay *gdisp; /* GDisplay that owns the selection */ - GdkGC *gc_in; /* GC for drawing selection outline */ - GdkGC *gc_out; /* GC for selected regions outside - * current layer */ - GdkGC *gc_layer; /* GC for current layer outline */ - - /* This information is for drawing the marching ants around the border */ - GdkSegment *segs_in; /* gdk segments of area boundary */ - GdkSegment *segs_out; /* gdk segments of area boundary */ - GdkSegment *segs_layer; /* gdk segments of area boundary */ - gint num_segs_in; /* number of segments in segs1 */ - gint num_segs_out; /* number of segments in segs2 */ - gint num_segs_layer; /* number of segments in segs3 */ - gint index_in; /* index of current stipple pattern */ - gint index_out; /* index of current stipple pattern */ - gint index_layer; /* index of current stipple pattern */ - gint state; /* internal drawing state */ - gint paused; /* count of pause requests */ - gboolean recalc; /* flag to recalculate the selection */ - gint speed; /* speed of marching ants */ - gboolean hidden; /* is the selection hidden? */ - guint timeout_id; /* timer for successive draws */ - gint cycle; /* color cycling turned on */ - GdkPixmap *cycle_pix; /* cycling pixmap */ - - /* These are used only if USE_XDRAWPOINTS is defined. */ - GdkPoint *points_in[8]; /* points of segs_in for fast ants */ - gint num_points_in[8]; /* number of points in points_in */ - GdkGC *gc_white; /* gc for drawing white points */ - GdkGC *gc_black; /* gc for drawing black points */ -}; - - -Selection * selection_create (GdkWindow *window, - GDisplay *gdisp, - gint size, - gint width, - gint speed); -void selection_free (Selection *select); - -void selection_pause (Selection *select); -void selection_resume (Selection *select); - -void selection_start (Selection *select, - gboolean recalc); -void selection_invis (Selection *select); -void selection_layer_invis (Selection *select); - -void selection_toggle (Selection *select); - - -#endif /* __SELECTION_H__ */ diff --git a/app/tools/gimpairbrushtool.c b/app/tools/gimpairbrushtool.c index f0ff990d94..deaed8fb92 100644 --- a/app/tools/gimpairbrushtool.c +++ b/app/tools/gimpairbrushtool.c @@ -36,13 +36,13 @@ #include "core/gimpgradient.h" #include "core/gimpimage.h" +#include "display/gimpdisplay.h" + #include "gimpairbrushtool.h" #include "paint_options.h" #include "gimptool.h" #include "tool_manager.h" -#include "gdisplay.h" - #include "libgimp/gimpintl.h" diff --git a/app/tools/gimpbezierselecttool.c b/app/tools/gimpbezierselecttool.c index a8db094313..ababda5031 100644 --- a/app/tools/gimpbezierselecttool.c +++ b/app/tools/gimpbezierselecttool.c @@ -40,6 +40,8 @@ #include "pdb/procedural_db.h" +#include "display/gimpdisplay.h" + #include "gui/paths-dialog.h" #include "gimpeditselectiontool.h" @@ -50,7 +52,6 @@ #include "app_procs.h" #include "errors.h" -#include "gdisplay.h" #include "path.h" #include "pathP.h" #include "undo.h" diff --git a/app/tools/gimpblendtool.c b/app/tools/gimpblendtool.c index 313ec71a69..9a5b79cf73 100644 --- a/app/tools/gimpblendtool.c +++ b/app/tools/gimpblendtool.c @@ -45,9 +45,10 @@ #include "widgets/gimpdnd.h" +#include "display/gimpdisplay.h" + #include "app_procs.h" #include "errors.h" -#include "gdisplay.h" #include "gimpprogress.h" #include "undo.h" diff --git a/app/tools/gimpbrightnesscontrasttool.c b/app/tools/gimpbrightnesscontrasttool.c index 0ea42197e0..8b69fe21d6 100644 --- a/app/tools/gimpbrightnesscontrasttool.c +++ b/app/tools/gimpbrightnesscontrasttool.c @@ -33,12 +33,13 @@ #include "widgets/gimpwidgets-utils.h" +#include "display/gimpdisplay.h" + #include "gimpbrightnesscontrasttool.h" #include "tool_manager.h" #include "tool_options.h" #include "app_procs.h" -#include "gdisplay.h" #include "image_map.h" #include "libgimp/gimpintl.h" diff --git a/app/tools/gimpbrushtool.c b/app/tools/gimpbrushtool.c index 3316eecfba..4f862d037c 100644 --- a/app/tools/gimpbrushtool.c +++ b/app/tools/gimpbrushtool.c @@ -46,6 +46,8 @@ #include "core/gimpimage-mask.h" #include "core/gimpmarshal.h" +#include "display/gimpdisplay.h" + #include "gimpdrawtool.h" #include "gimpdodgeburntool.h" #include "gimperasertool.h" @@ -54,7 +56,6 @@ #include "app_procs.h" #include "devices.h" -#include "gdisplay.h" #include "gimprc.h" #include "undo.h" diff --git a/app/tools/gimpbucketfilltool.c b/app/tools/gimpbucketfilltool.c index 6ab6852c08..9aa3fdcb69 100644 --- a/app/tools/gimpbucketfilltool.c +++ b/app/tools/gimpbucketfilltool.c @@ -41,13 +41,14 @@ #include "pdb/procedural_db.h" +#include "display/gimpdisplay.h" + #include "gimpbucketfilltool.h" #include "gimpfuzzyselecttool.h" #include "gimptool.h" #include "paint_options.h" #include "tool_manager.h" -#include "gdisplay.h" #include "gimprc.h" #include "undo.h" diff --git a/app/tools/gimpbycolorselecttool.c b/app/tools/gimpbycolorselecttool.c index 753cba3467..6179a6d2b1 100644 --- a/app/tools/gimpbycolorselecttool.c +++ b/app/tools/gimpbycolorselecttool.c @@ -44,13 +44,14 @@ #include "widgets/gimpdnd.h" #include "widgets/gimpwidgets-utils.h" +#include "display/gimpdisplay.h" + #include "gimpbycolorselecttool.h" #include "selection_options.h" #include "tool_options.h" #include "tool_manager.h" #include "gimprc.h" -#include "gdisplay.h" #include "libgimp/gimpintl.h" diff --git a/app/tools/gimpclonetool.c b/app/tools/gimpclonetool.c index f4f473f3ef..ebf78b817b 100644 --- a/app/tools/gimpclonetool.c +++ b/app/tools/gimpclonetool.c @@ -40,13 +40,13 @@ #include "core/gimpcontext.h" #include "core/gimpbrush.h" +#include "display/gimpdisplay.h" + #include "gimpclonetool.h" #include "paint_options.h" #include "tool_manager.h" #include "tool_options.h" -#include "gdisplay.h" - #include "libgimp/gimpintl.h" diff --git a/app/tools/gimpcolorbalancetool.c b/app/tools/gimpcolorbalancetool.c index 38c27516c1..11ca9412af 100644 --- a/app/tools/gimpcolorbalancetool.c +++ b/app/tools/gimpcolorbalancetool.c @@ -33,13 +33,14 @@ #include "widgets/gimpwidgets-utils.h" +#include "display/gimpdisplay.h" + #include "gimpcolorbalancetool.h" #include "gimpcolorbalancetool-transfer.h" #include "tool_manager.h" #include "tool_options.h" #include "app_procs.h" -#include "gdisplay.h" #include "image_map.h" #include "libgimp/gimpintl.h" diff --git a/app/tools/gimpcolorpickertool.c b/app/tools/gimpcolorpickertool.c index 79fe157dce..d48efd37f1 100644 --- a/app/tools/gimpcolorpickertool.c +++ b/app/tools/gimpcolorpickertool.c @@ -24,6 +24,7 @@ #include "libgimpwidgets/gimpwidgets.h" #include "tools-types.h" +#include "gui/gui-types.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" @@ -31,12 +32,13 @@ #include "gui/info-dialog.h" #include "gui/palette-editor.h" +#include "display/gimpdisplay.h" + #include "gimpdrawtool.h" #include "gimpcolorpickertool.h" #include "tool_manager.h" #include "tool_options.h" -#include "gdisplay.h" #include "gimprc.h" #include "libgimp/gimpintl.h" diff --git a/app/tools/gimpconvolvetool.c b/app/tools/gimpconvolvetool.c index ca6b32e8ed..207e6921fb 100644 --- a/app/tools/gimpconvolvetool.c +++ b/app/tools/gimpconvolvetool.c @@ -41,8 +41,6 @@ #include "tool_manager.h" #include "tool_options.h" -#include "gdisplay.h" - #include "libgimp/gimpintl.h" diff --git a/app/tools/gimpcroptool.c b/app/tools/gimpcroptool.c index 0d2b76c611..ae39164040 100644 --- a/app/tools/gimpcroptool.c +++ b/app/tools/gimpcroptool.c @@ -26,6 +26,7 @@ #include "libgimpwidgets/gimpwidgets.h" #include "tools-types.h" +#include "gui/gui-types.h" #include "core/gimpdrawable.h" #include "core/gimpimage.h" @@ -34,6 +35,8 @@ #include "gui/info-dialog.h" +#include "display/gimpdisplay.h" + #include "gimpcroptool.h" #include "gimpdrawtool.h" #include "gimptool.h" @@ -41,7 +44,6 @@ #include "tool_manager.h" #include "app_procs.h" -#include "gdisplay.h" #include "libgimp/gimpintl.h" diff --git a/app/tools/gimpcurvestool.c b/app/tools/gimpcurvestool.c index 7f786f64b8..cdd5860846 100644 --- a/app/tools/gimpcurvestool.c +++ b/app/tools/gimpcurvestool.c @@ -39,12 +39,13 @@ #include "widgets/gimpcursor.h" #include "widgets/gimpwidgets-utils.h" +#include "display/gimpdisplay.h" + #include "gimpcurvestool.h" #include "tool_manager.h" #include "tool_options.h" #include "app_procs.h" -#include "gdisplay.h" #include "image_map.h" #include "libgimp/gimpintl.h" diff --git a/app/tools/gimpdodgeburntool.c b/app/tools/gimpdodgeburntool.c index 34d5db3203..af43bdd52f 100644 --- a/app/tools/gimpdodgeburntool.c +++ b/app/tools/gimpdodgeburntool.c @@ -37,8 +37,6 @@ #include "core/gimpcontext.h" #include "core/gimpimage.h" -#include "gdisplay.h" - #include "gimpdodgeburntool.h" #include "gimppainttool.h" #include "paint_options.h" diff --git a/app/tools/gimpdrawtool.c b/app/tools/gimpdrawtool.c index 4d59c149b7..c7d37176e1 100644 --- a/app/tools/gimpdrawtool.c +++ b/app/tools/gimpdrawtool.c @@ -24,9 +24,9 @@ #include "tools-types.h" -#include "gimpdrawtool.h" +#include "display/gimpdisplay.h" -#include "gdisplay.h" +#include "gimpdrawtool.h" enum diff --git a/app/tools/gimpeditselectiontool.c b/app/tools/gimpeditselectiontool.c index a361dccdf7..57d77bb3cb 100644 --- a/app/tools/gimpeditselectiontool.c +++ b/app/tools/gimpeditselectiontool.c @@ -37,11 +37,12 @@ #include "core/gimplayer.h" #include "core/gimplist.h" +#include "display/gimpdisplay.h" +#include "display/gimpdisplay-selection.h" + #include "floating_sel.h" -#include "gdisplay.h" #include "gimprc.h" #include "path_transform.h" -#include "selection.h" #include "undo.h" #include "gimpeditselectiontool.h" diff --git a/app/tools/gimpellipseselecttool.c b/app/tools/gimpellipseselecttool.c index c1bc0f72b3..0d56da9062 100644 --- a/app/tools/gimpellipseselecttool.c +++ b/app/tools/gimpellipseselecttool.c @@ -31,13 +31,14 @@ #include "core/gimpimage-mask.h" #include "core/gimptoolinfo.h" +#include "display/gimpdisplay.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" diff --git a/app/tools/gimperasertool.c b/app/tools/gimperasertool.c index 4a68a12e13..b73d3dba6a 100644 --- a/app/tools/gimperasertool.c +++ b/app/tools/gimperasertool.c @@ -34,8 +34,6 @@ #include "core/gimpdrawable.h" #include "core/gimpimage.h" -#include "gdisplay.h" - #include "gimperasertool.h" #include "paint_options.h" #include "tool_manager.h" diff --git a/app/tools/gimpfliptool.c b/app/tools/gimpfliptool.c index 37dc7cf15c..9ce15ba841 100644 --- a/app/tools/gimpfliptool.c +++ b/app/tools/gimpfliptool.c @@ -37,8 +37,9 @@ #include "core/gimpimage-mask.h" #include "core/gimplayer.h" -#include "gdisplay.h" -#include "gdisplay_ops.h" +#include "display/gimpdisplay.h" +#include "display/gimpdisplay-ops.h" + #include "undo.h" #include "path_transform.h" diff --git a/app/tools/gimpfreeselecttool.c b/app/tools/gimpfreeselecttool.c index f00039b701..3d44b0402f 100644 --- a/app/tools/gimpfreeselecttool.c +++ b/app/tools/gimpfreeselecttool.c @@ -34,6 +34,8 @@ #include "core/gimpimage-mask.h" #include "core/gimpscanconvert.h" +#include "display/gimpdisplay.h" + #include "gimpeditselectiontool.h" #include "gimpfreeselecttool.h" #include "selection_options.h" @@ -42,7 +44,6 @@ #include "errors.h" #include "floating_sel.h" -#include "gdisplay.h" #include "libgimp/gimpintl.h" diff --git a/app/tools/gimpfuzzyselecttool.c b/app/tools/gimpfuzzyselecttool.c index 249b9b7418..21473e4709 100644 --- a/app/tools/gimpfuzzyselecttool.c +++ b/app/tools/gimpfuzzyselecttool.c @@ -39,6 +39,8 @@ #include "core/gimpimage.h" #include "core/gimpimage-mask.h" +#include "display/gimpdisplay.h" + #include "gimpeditselectiontool.h" #include "gimpfuzzyselecttool.h" #include "gimptool.h" @@ -46,7 +48,6 @@ #include "tool_options.h" #include "tool_manager.h" -#include "gdisplay.h" #include "gimprc.h" #include "libgimp/gimpintl.h" diff --git a/app/tools/gimphistogramtool.c b/app/tools/gimphistogramtool.c index 1195269d00..f4a6f523b4 100644 --- a/app/tools/gimphistogramtool.c +++ b/app/tools/gimphistogramtool.c @@ -34,12 +34,13 @@ #include "widgets/gimphistogramview.h" #include "widgets/gimpwidgets-utils.h" +#include "display/gimpdisplay.h" + #include "gimphistogramtool.h" #include "tool_manager.h" #include "tool_options.h" #include "app_procs.h" -#include "gdisplay.h" #include "libgimp/gimpintl.h" diff --git a/app/tools/gimphuesaturationtool.c b/app/tools/gimphuesaturationtool.c index 43d6970e52..4ff531e97f 100644 --- a/app/tools/gimphuesaturationtool.c +++ b/app/tools/gimphuesaturationtool.c @@ -34,12 +34,13 @@ #include "widgets/gimpwidgets-utils.h" +#include "display/gimpdisplay.h" + #include "gimphuesaturationtool.h" #include "tool_manager.h" #include "tool_options.h" #include "app_procs.h" -#include "gdisplay.h" #include "image_map.h" #include "libgimp/gimpintl.h" diff --git a/app/tools/gimpinktool.c b/app/tools/gimpinktool.c index b93d9f53ea..e637eca91b 100644 --- a/app/tools/gimpinktool.c +++ b/app/tools/gimpinktool.c @@ -41,6 +41,8 @@ #include "core/gimpimage.h" #include "core/gimpimage-mask.h" +#include "display/gimpdisplay.h" + #include "gimpinktool.h" #include "gimpinktool-blob.h" #include "gimptool.h" @@ -49,7 +51,6 @@ #include "gimprc.h" #include "undo.h" -#include "gdisplay.h" #include "libgimp/gimpintl.h" diff --git a/app/tools/gimpiscissorstool.c b/app/tools/gimpiscissorstool.c index ec8bda4f04..6949c20846 100644 --- a/app/tools/gimpiscissorstool.c +++ b/app/tools/gimpiscissorstool.c @@ -58,14 +58,14 @@ #include "core/gimpimage-mask.h" #include "core/gimpscanconvert.h" +#include "display/gimpdisplay.h" + #include "gimpbezierselecttool.h" #include "gimpiscissorstool.h" #include "gimpeditselectiontool.h" #include "selection_options.h" #include "tool_manager.h" -#include "gdisplay.h" - #include "libgimp/gimpintl.h" diff --git a/app/tools/gimplevelstool.c b/app/tools/gimplevelstool.c index 7f937f44f8..cfbe968b76 100644 --- a/app/tools/gimplevelstool.c +++ b/app/tools/gimplevelstool.c @@ -42,12 +42,13 @@ #include "widgets/gimphistogramview.h" #include "widgets/gimpwidgets-utils.h" +#include "display/gimpdisplay.h" + #include "gimplevelstool.h" #include "tool_manager.h" #include "tool_options.h" #include "app_procs.h" -#include "gdisplay.h" #include "image_map.h" #include "libgimp/gimpintl.h" diff --git a/app/tools/gimpmagnifytool.c b/app/tools/gimpmagnifytool.c index 103c404c8d..a16660dfa4 100644 --- a/app/tools/gimpmagnifytool.c +++ b/app/tools/gimpmagnifytool.c @@ -27,15 +27,14 @@ #include "tools-types.h" -#include "gui/info-window.h" -#include "gdisplay.h" +#include "display/gimpdisplay.h" +#include "display/gimpdisplay-scale.h" #include "gimpmagnifytool.h" #include "tool_options.h" #include "tool_manager.h" #include "gimprc.h" -#include "scale.h" #include "libgimp/gimpintl.h" diff --git a/app/tools/gimpmeasuretool.c b/app/tools/gimpmeasuretool.c index 8d7c306d43..6884b121a2 100644 --- a/app/tools/gimpmeasuretool.c +++ b/app/tools/gimpmeasuretool.c @@ -30,11 +30,13 @@ #include "libgimpwidgets/gimpwidgets.h" #include "tools-types.h" +#include "gui/gui-types.h" #include "core/gimpimage.h" #include "gui/info-dialog.h" -#include "gdisplay.h" + +#include "display/gimpdisplay.h" #include "gimpdrawtool.h" #include "gimpmeasuretool.h" diff --git a/app/tools/gimpmovetool.c b/app/tools/gimpmovetool.c index 96824af8a7..44ff3996d0 100644 --- a/app/tools/gimpmovetool.c +++ b/app/tools/gimpmovetool.c @@ -30,9 +30,10 @@ #include "core/gimpimage-mask.h" #include "core/gimplayer.h" +#include "display/gimpdisplay.h" +#include "display/gimpdisplay-ops.h" + #include "floating_sel.h" -#include "gdisplay.h" -#include "gdisplay_ops.h" #include "undo.h" #include "gimpeditselectiontool.h" diff --git a/app/tools/gimppaintbrushtool.c b/app/tools/gimppaintbrushtool.c index 9baa63c7fc..10f4b29ced 100644 --- a/app/tools/gimppaintbrushtool.c +++ b/app/tools/gimppaintbrushtool.c @@ -38,8 +38,6 @@ #include "core/gimpgradient.h" #include "core/gimpimage.h" -#include "gdisplay.h" - #include "gimppaintbrushtool.h" #include "paint_options.h" #include "tool_manager.h" diff --git a/app/tools/gimppainttool.c b/app/tools/gimppainttool.c index 3316eecfba..4f862d037c 100644 --- a/app/tools/gimppainttool.c +++ b/app/tools/gimppainttool.c @@ -46,6 +46,8 @@ #include "core/gimpimage-mask.h" #include "core/gimpmarshal.h" +#include "display/gimpdisplay.h" + #include "gimpdrawtool.h" #include "gimpdodgeburntool.h" #include "gimperasertool.h" @@ -54,7 +56,6 @@ #include "app_procs.h" #include "devices.h" -#include "gdisplay.h" #include "gimprc.h" #include "undo.h" diff --git a/app/tools/gimppathtool.c b/app/tools/gimppathtool.c index 8b43e2aae7..7a6327308e 100644 --- a/app/tools/gimppathtool.c +++ b/app/tools/gimppathtool.c @@ -28,16 +28,17 @@ #include "tools-types.h" -#include "gdisplay.h" -#include "path_curves.h" +#include "display/gimpdisplay.h" + #include "gimpdrawtool.h" #include "gimppathtool.h" #include "tool_manager.h" #include "tool_options.h" +#include "path_tool.h" #include "libgimp/gimpintl.h" -#include "path_tool.h" +#include "path_curves.h" /* local function prototypes */ diff --git a/app/tools/gimppenciltool.c b/app/tools/gimppenciltool.c index 9d9c69c20c..f96a9897dd 100644 --- a/app/tools/gimppenciltool.c +++ b/app/tools/gimppenciltool.c @@ -36,8 +36,6 @@ #include "core/gimpgradient.h" #include "core/gimpimage.h" -#include "gdisplay.h" - #include "gimppenciltool.h" #include "gimppainttool.h" #include "paint_options.h" diff --git a/app/tools/gimpperspectivetool.c b/app/tools/gimpperspectivetool.c index 3ca4086de3..99ae88a48a 100644 --- a/app/tools/gimpperspectivetool.c +++ b/app/tools/gimpperspectivetool.c @@ -24,19 +24,22 @@ #include "libgimpwidgets/gimpwidgets.h" #include "tools-types.h" +#include "gui/gui-types.h" #include "core/gimpimage.h" -#include "gdisplay.h" -#include "gimpprogress.h" #include "gui/info-dialog.h" -#include "undo.h" + +#include "display/gimpdisplay.h" #include "gimpperspectivetool.h" #include "tool_manager.h" #include "tool_options.h" #include "transform_options.h" +#include "gimpprogress.h" +#include "undo.h" + #include "libgimp/gimpintl.h" diff --git a/app/tools/gimpposterizetool.c b/app/tools/gimpposterizetool.c index 8585d30c5a..1680dcf271 100644 --- a/app/tools/gimpposterizetool.c +++ b/app/tools/gimpposterizetool.c @@ -32,12 +32,13 @@ #include "widgets/gimpwidgets-utils.h" +#include "display/gimpdisplay.h" + #include "gimpposterizetool.h" #include "tool_manager.h" #include "tool_options.h" #include "app_procs.h" -#include "gdisplay.h" #include "image_map.h" #include "libgimp/gimpintl.h" diff --git a/app/tools/gimprectselecttool.c b/app/tools/gimprectselecttool.c index f87a0b9759..09f98a6203 100644 --- a/app/tools/gimprectselecttool.c +++ b/app/tools/gimprectselecttool.c @@ -34,6 +34,8 @@ #include "core/gimpmarshal.h" #include "core/gimptoolinfo.h" +#include "display/gimpdisplay.h" + #include "gimpeditselectiontool.h" #include "gimprectselecttool.h" #include "selection_options.h" @@ -41,7 +43,6 @@ #include "tool_manager.h" #include "app_procs.h" -#include "gdisplay.h" #include "floating_sel.h" #include "libgimp/gimpintl.h" diff --git a/app/tools/gimpregionselecttool.c b/app/tools/gimpregionselecttool.c index 249b9b7418..21473e4709 100644 --- a/app/tools/gimpregionselecttool.c +++ b/app/tools/gimpregionselecttool.c @@ -39,6 +39,8 @@ #include "core/gimpimage.h" #include "core/gimpimage-mask.h" +#include "display/gimpdisplay.h" + #include "gimpeditselectiontool.h" #include "gimpfuzzyselecttool.h" #include "gimptool.h" @@ -46,7 +48,6 @@ #include "tool_options.h" #include "tool_manager.h" -#include "gdisplay.h" #include "gimprc.h" #include "libgimp/gimpintl.h" diff --git a/app/tools/gimprotatetool.c b/app/tools/gimprotatetool.c index 46f9fd167d..26a3015ced 100644 --- a/app/tools/gimprotatetool.c +++ b/app/tools/gimprotatetool.c @@ -24,6 +24,7 @@ #include "libgimpwidgets/gimpwidgets.h" #include "tools-types.h" +#include "gui/gui-types.h" #include "paint-funcs/paint-funcs.h" @@ -31,17 +32,17 @@ #include "gui/info-dialog.h" -#include "gdisplay.h" -#include "gdisplay_ops.h" -#include "gimpprogress.h" -#include "undo.h" -#include "path_transform.h" +#include "display/gimpdisplay.h" #include "gimprotatetool.h" #include "tool_manager.h" #include "tool_options.h" #include "transform_options.h" +#include "gimpprogress.h" +#include "undo.h" +#include "path_transform.h" + #include "libgimp/gimpintl.h" diff --git a/app/tools/gimpscaletool.c b/app/tools/gimpscaletool.c index 29a64d54f3..90a8c6365c 100644 --- a/app/tools/gimpscaletool.c +++ b/app/tools/gimpscaletool.c @@ -25,17 +25,19 @@ #include "libgimpwidgets/gimpwidgets.h" #include "tools-types.h" +#include "gui/gui-types.h" #include "core/gimpimage.h" #include "gui/info-dialog.h" +#include "display/gimpdisplay.h" + #include "gimpscaletool.h" #include "tool_manager.h" #include "tool_options.h" #include "transform_options.h" -#include "gdisplay.h" #include "gimpprogress.h" #include "undo.h" diff --git a/app/tools/gimpselectiontool.c b/app/tools/gimpselectiontool.c index 13f5deb6d9..80fe485954 100644 --- a/app/tools/gimpselectiontool.c +++ b/app/tools/gimpselectiontool.c @@ -26,11 +26,11 @@ #include "core/gimpimage.h" #include "core/gimpimage-mask.h" +#include "display/gimpdisplay.h" + #include "gimpdrawtool.h" #include "gimpselectiontool.h" -#include "gdisplay.h" - static void gimp_selection_tool_class_init (GimpSelectionToolClass *klass); static void gimp_selection_tool_init (GimpSelectionTool *selection_tool); diff --git a/app/tools/gimpsheartool.c b/app/tools/gimpsheartool.c index bd5e0d2a50..cfa4a28abd 100644 --- a/app/tools/gimpsheartool.c +++ b/app/tools/gimpsheartool.c @@ -26,22 +26,23 @@ #include "libgimpwidgets/gimpwidgets.h" #include "tools-types.h" +#include "gui/gui-types.h" #include "core/gimpimage.h" #include "gui/info-dialog.h" -#include "floating_sel.h" -#include "gdisplay.h" -#include "gdisplay_ops.h" -#include "gimpprogress.h" -#include "undo.h" +#include "display/gimpdisplay.h" #include "gimpsheartool.h" #include "tool_manager.h" #include "tool_options.h" #include "transform_options.h" +#include "floating_sel.h" +#include "gimpprogress.h" +#include "undo.h" + #include "libgimp/gimpintl.h" diff --git a/app/tools/gimpsmudgetool.c b/app/tools/gimpsmudgetool.c index e48d031c72..7f485feb44 100644 --- a/app/tools/gimpsmudgetool.c +++ b/app/tools/gimpsmudgetool.c @@ -42,8 +42,6 @@ #include "tool_manager.h" #include "tool_options.h" -#include "gdisplay.h" - #include "libgimp/gimpintl.h" diff --git a/app/tools/gimpsourcetool.c b/app/tools/gimpsourcetool.c index f4f473f3ef..ebf78b817b 100644 --- a/app/tools/gimpsourcetool.c +++ b/app/tools/gimpsourcetool.c @@ -40,13 +40,13 @@ #include "core/gimpcontext.h" #include "core/gimpbrush.h" +#include "display/gimpdisplay.h" + #include "gimpclonetool.h" #include "paint_options.h" #include "tool_manager.h" #include "tool_options.h" -#include "gdisplay.h" - #include "libgimp/gimpintl.h" diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c index 263bdc6af7..d755bddf07 100644 --- a/app/tools/gimptexttool.c +++ b/app/tools/gimptexttool.c @@ -41,20 +41,20 @@ #include "widgets/gimpfontselection.h" +#include "display/gimpdisplay.h" + +#include "gimpeditselectiontool.h" #include "gimptexttool.h" #include "gimptool.h" #include "tool_manager.h" #include "tool_options.h" #include "app_procs.h" -#include "gdisplay.h" #include "libgimp_glue.h" #include "floating_sel.h" #include "undo_types.h" #include "undo.h" -#include "gimpeditselectiontool.h" - #include "libgimp/gimpintl.h" diff --git a/app/tools/gimpthresholdtool.c b/app/tools/gimpthresholdtool.c index 3d80250be2..650ff71e11 100644 --- a/app/tools/gimpthresholdtool.c +++ b/app/tools/gimpthresholdtool.c @@ -36,12 +36,13 @@ #include "widgets/gimphistogramview.h" #include "widgets/gimpwidgets-utils.h" +#include "display/gimpdisplay.h" + #include "gimpthresholdtool.h" #include "tool_manager.h" #include "tool_options.h" #include "app_procs.h" -#include "gdisplay.h" #include "image_map.h" #include "libgimp/gimpintl.h" diff --git a/app/tools/gimptool.c b/app/tools/gimptool.c index ec221f4a85..a6cba15e6b 100644 --- a/app/tools/gimptool.c +++ b/app/tools/gimptool.c @@ -27,11 +27,12 @@ #include "core/gimpimage.h" #include "core/gimpmarshal.h" +#include "display/gimpdisplay.h" + #include "gimptool.h" #include "tool_manager.h" #include "app_procs.h" -#include "gdisplay.h" #include "libgimp/gimpintl.h" diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c index 077d315a18..48e10170a4 100644 --- a/app/tools/gimptransformtool.c +++ b/app/tools/gimptransformtool.c @@ -26,6 +26,7 @@ #include "libgimpwidgets/gimpwidgets.h" #include "tools-types.h" +#include "gui/gui-types.h" #include "base/base-config.h" #include "base/pixel-region.h" @@ -46,7 +47,8 @@ #include "core/gimptoolinfo.h" #include "gui/info-dialog.h" -#include "gdisplay.h" + +#include "display/gimpdisplay.h" #include "tool_manager.h" #include "tool_options.h" diff --git a/app/tools/gimptransformtool.h b/app/tools/gimptransformtool.h index c138f83ad1..0d22f2c730 100644 --- a/app/tools/gimptransformtool.h +++ b/app/tools/gimptransformtool.h @@ -23,6 +23,10 @@ #include "gimpdrawtool.h" +/* FIXME */ +#include "gui/gui-types.h" + + /* buffer sizes for scaling information strings (for the info dialog) */ #define MAX_INFO_BUF 40 #define TRAN_INFO_SIZE 8 diff --git a/app/tools/tool_manager.c b/app/tools/tool_manager.c index 235e168e19..91553661a8 100644 --- a/app/tools/tool_manager.c +++ b/app/tools/tool_manager.c @@ -33,6 +33,8 @@ #include "gui/brush-select.h" +#include "display/gimpdisplay.h" + #include "gimptool.h" #include "gimprectselecttool.h" #include "paint_options.h" @@ -50,7 +52,6 @@ #include "gimpsmudgetool.h" #include "app_procs.h" -#include "gdisplay.h" #include "gimprc.h" #include "libgimp/gimpintl.h" diff --git a/app/undo.c b/app/undo.c index c412101fa9..60451c438d 100644 --- a/app/undo.c +++ b/app/undo.c @@ -25,7 +25,6 @@ #include "libgimpbase/gimpbase.h" -#include "core/core-types.h" #include "tools/tools-types.h" #include "base/pixel-region.h" @@ -45,6 +44,8 @@ #include "core/gimpparasite.h" #include "core/gimpparasitelist.h" +#include "display/gimpdisplay.h" + #include "tools/gimpbycolorselecttool.h" #include "tools/gimptool.h" #include "tools/gimpdrawtool.h" @@ -54,15 +55,12 @@ #include "app_procs.h" #include "floating_sel.h" -#include "gdisplay.h" -#include "gdisplay_ops.h" #include "path_transform.h" #include "undo.h" #include "libgimp/gimpintl.h" - /*#define DEBUG*/ #ifdef DEBUG diff --git a/app/user_install.c b/app/user_install.c index 09be3e8979..d9e1034f9e 100644 --- a/app/user_install.c +++ b/app/user_install.c @@ -34,16 +34,17 @@ #include "libgimpbase/gimpbase.h" #include "libgimpwidgets/gimpwidgets.h" -#include "core/core-types.h" +#include "display/display-types.h" #include "base/base-config.h" #include "core/gimpunit.h" +#include "display/gimpdisplay-ops.h" + #include "gui/resolution-calibrate-dialog.h" #include "appenv.h" -#include "gdisplay_ops.h" #include "gimprc.h" #include "user_install.h" diff --git a/app/widgets/gimpbufferview.c b/app/widgets/gimpbufferview.c index 0ab8f65f48..f167b4b409 100644 --- a/app/widgets/gimpbufferview.c +++ b/app/widgets/gimpbufferview.c @@ -33,12 +33,12 @@ #include "core/gimpedit.h" #include "core/gimpimage.h" +#include "display/gimpdisplay.h" + #include "gimpcontainerview.h" #include "gimpbufferview.h" #include "gimpdnd.h" -#include "gdisplay.h" - #include "libgimp/gimpintl.h" diff --git a/app/widgets/gimpchannellistitem.c b/app/widgets/gimpchannellistitem.c index 7a927d0274..ca5051910f 100644 --- a/app/widgets/gimpchannellistitem.c +++ b/app/widgets/gimpchannellistitem.c @@ -33,8 +33,6 @@ #include "gimpchannellistitem.h" #include "gimppreview.h" -#include "gdisplay.h" - static void gimp_channel_list_item_class_init (GimpChannelListItemClass *klass); static void gimp_channel_list_item_init (GimpChannelListItem *list_item); @@ -46,10 +44,10 @@ static void gimp_channel_list_item_drop_color (GtkWidget *widget, */ -GtkType +GType gimp_channel_list_item_get_type (void) { - static GtkType list_item_type = 0; + static GType list_item_type = 0; if (! list_item_type) { diff --git a/app/widgets/gimpchannellistitem.h b/app/widgets/gimpchannellistitem.h index b833a8184f..4c2b7f4261 100644 --- a/app/widgets/gimpchannellistitem.h +++ b/app/widgets/gimpchannellistitem.h @@ -36,6 +36,7 @@ extern "C" { #define GIMP_CHANNEL_LIST_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_CHANNEL_LIST_ITEM, GimpChannelListItemClass)) #define GIMP_IS_CHANNEL_LIST_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_CHANNEL_LIST_ITEM)) #define GIMP_IS_CHANNEL_LIST_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CHANNEL_LIST_ITEM)) +#define GIMP_CHANNEL_LIST_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_CHANNEL_LIST_ITEM, GimpChannelListItemClass)) typedef struct _GimpChannelListItemClass GimpChannelListItemClass; @@ -51,7 +52,7 @@ struct _GimpChannelListItemClass }; -GtkType gimp_channel_list_item_get_type (void); +GType gimp_channel_list_item_get_type (void); #ifdef __cplusplus diff --git a/app/widgets/gimpchannellistview.c b/app/widgets/gimpchannellistview.c index cbc8c6a24a..449705755a 100644 --- a/app/widgets/gimpchannellistview.c +++ b/app/widgets/gimpchannellistview.c @@ -34,14 +34,14 @@ #include "core/gimpimage-mask.h" #include "core/gimpmarshal.h" +#include "display/gimpdisplay.h" + #include "gimpchannellistview.h" #include "gimpcomponentlistitem.h" #include "gimpdnd.h" #include "gimpimagepreview.h" #include "gimplistitem.h" -#include "gdisplay.h" - #include "libgimp/gimpintl.h" diff --git a/app/widgets/gimpchanneltreeview.c b/app/widgets/gimpchanneltreeview.c index cbc8c6a24a..449705755a 100644 --- a/app/widgets/gimpchanneltreeview.c +++ b/app/widgets/gimpchanneltreeview.c @@ -34,14 +34,14 @@ #include "core/gimpimage-mask.h" #include "core/gimpmarshal.h" +#include "display/gimpdisplay.h" + #include "gimpchannellistview.h" #include "gimpcomponentlistitem.h" #include "gimpdnd.h" #include "gimpimagepreview.h" #include "gimplistitem.h" -#include "gdisplay.h" - #include "libgimp/gimpintl.h" diff --git a/app/widgets/gimpcolormapeditor.c b/app/widgets/gimpcolormapeditor.c index ca6bc67238..db6e684d9d 100644 --- a/app/widgets/gimpcolormapeditor.c +++ b/app/widgets/gimpcolormapeditor.c @@ -34,6 +34,8 @@ #include "core/gimpcontainer.h" #include "core/gimpimage.h" +#include "display/gimpdisplay-render.h" + #include "widgets/gimpdnd.h" #include "color-notebook.h" @@ -41,7 +43,6 @@ #include "color-area.h" #include "colormaps.h" -#include "image_render.h" #include "libgimp/gimpintl.h" diff --git a/app/widgets/gimpcomponentlistitem.c b/app/widgets/gimpcomponentlistitem.c index 5033a82219..a1cafc7d3d 100644 --- a/app/widgets/gimpcomponentlistitem.c +++ b/app/widgets/gimpcomponentlistitem.c @@ -30,13 +30,13 @@ #include "core/gimpimage.h" #include "core/gimpviewable.h" +#include "display/gimpdisplay.h" + #include "gimpcomponentlistitem.h" #include "gimpdnd.h" #include "gimpimagepreview.h" #include "gimppreview.h" -#include "gdisplay.h" - #include "libgimp/gimpintl.h" diff --git a/app/widgets/gimpdrawablelistitem.c b/app/widgets/gimpdrawablelistitem.c index b5e8bd11db..173982f850 100644 --- a/app/widgets/gimpdrawablelistitem.c +++ b/app/widgets/gimpdrawablelistitem.c @@ -29,13 +29,13 @@ #include "core/gimpdrawable.h" +#include "display/gimpdisplay.h" + #include "gimpdnd.h" #include "gimpdrawablelistitem.h" #include "gimpdrawablelistview.h" #include "gimppreview.h" -#include "gdisplay.h" - static void gimp_drawable_list_item_class_init (GimpDrawableListItemClass *klass); static void gimp_drawable_list_item_init (GimpDrawableListItem *list_item); diff --git a/app/widgets/gimpdrawablelistview.c b/app/widgets/gimpdrawablelistview.c index 31a1dd9d24..8bc2aef27d 100644 --- a/app/widgets/gimpdrawablelistview.c +++ b/app/widgets/gimpdrawablelistview.c @@ -35,6 +35,8 @@ #include "core/gimplayer.h" #include "core/gimpmarshal.h" +#include "display/gimpdisplay.h" + #include "gimpchannellistview.h" #include "gimpdnd.h" #include "gimpdrawablelistview.h" @@ -42,8 +44,6 @@ #include "gimplistitem.h" #include "gimppreview.h" -#include "gdisplay.h" - #include "libgimp/gimpintl.h" diff --git a/app/widgets/gimpdrawabletreeview.c b/app/widgets/gimpdrawabletreeview.c index 31a1dd9d24..8bc2aef27d 100644 --- a/app/widgets/gimpdrawabletreeview.c +++ b/app/widgets/gimpdrawabletreeview.c @@ -35,6 +35,8 @@ #include "core/gimplayer.h" #include "core/gimpmarshal.h" +#include "display/gimpdisplay.h" + #include "gimpchannellistview.h" #include "gimpdnd.h" #include "gimpdrawablelistview.h" @@ -42,8 +44,6 @@ #include "gimplistitem.h" #include "gimppreview.h" -#include "gdisplay.h" - #include "libgimp/gimpintl.h" diff --git a/app/widgets/gimpitemfactory.c b/app/widgets/gimpitemfactory.c index 60e3a33c0b..b0a15936a8 100644 --- a/app/widgets/gimpitemfactory.c +++ b/app/widgets/gimpitemfactory.c @@ -28,12 +28,14 @@ #include "libgimpbase/gimpbase.h" #include "libgimpwidgets/gimpwidgets.h" -#include "tools/tools-types.h" +#include "gui-types.h" #include "core/gimp.h" #include "core/gimplist.h" #include "core/gimptoolinfo.h" +#include "display/gimpdisplay.h" + #include "tools/gimpbrightnesscontrasttool.h" #include "tools/gimpcolorbalancetool.h" #include "tools/gimpcurvestool.h" @@ -61,7 +63,6 @@ #include "view-commands.h" #include "app_procs.h" -#include "gdisplay.h" #include "gimphelp.h" #include "gimprc.h" diff --git a/app/widgets/gimpitemlistview.c b/app/widgets/gimpitemlistview.c index 31a1dd9d24..8bc2aef27d 100644 --- a/app/widgets/gimpitemlistview.c +++ b/app/widgets/gimpitemlistview.c @@ -35,6 +35,8 @@ #include "core/gimplayer.h" #include "core/gimpmarshal.h" +#include "display/gimpdisplay.h" + #include "gimpchannellistview.h" #include "gimpdnd.h" #include "gimpdrawablelistview.h" @@ -42,8 +44,6 @@ #include "gimplistitem.h" #include "gimppreview.h" -#include "gdisplay.h" - #include "libgimp/gimpintl.h" diff --git a/app/widgets/gimpitemtreeview.c b/app/widgets/gimpitemtreeview.c index 31a1dd9d24..8bc2aef27d 100644 --- a/app/widgets/gimpitemtreeview.c +++ b/app/widgets/gimpitemtreeview.c @@ -35,6 +35,8 @@ #include "core/gimplayer.h" #include "core/gimpmarshal.h" +#include "display/gimpdisplay.h" + #include "gimpchannellistview.h" #include "gimpdnd.h" #include "gimpdrawablelistview.h" @@ -42,8 +44,6 @@ #include "gimplistitem.h" #include "gimppreview.h" -#include "gdisplay.h" - #include "libgimp/gimpintl.h" diff --git a/app/widgets/gimplayerlistitem.c b/app/widgets/gimplayerlistitem.c index 962629b24e..3668638f06 100644 --- a/app/widgets/gimplayerlistitem.c +++ b/app/widgets/gimplayerlistitem.c @@ -33,12 +33,12 @@ #include "core/gimplayer.h" #include "core/gimplayermask.h" +#include "display/gimpdisplay.h" + #include "gimpdnd.h" #include "gimplayerlistitem.h" #include "gimppreview.h" -#include "gdisplay.h" - static void gimp_layer_list_item_class_init (GimpLayerListItemClass *klass); static void gimp_layer_list_item_init (GimpLayerListItem *list_item); diff --git a/app/widgets/gimplayerlistview.c b/app/widgets/gimplayerlistview.c index 10b496c075..b791369f30 100644 --- a/app/widgets/gimplayerlistview.c +++ b/app/widgets/gimplayerlistview.c @@ -33,13 +33,13 @@ #include "core/gimplayer.h" #include "core/gimpmarshal.h" +#include "display/gimpdisplay.h" + #include "gimpdnd.h" #include "gimplayerlistview.h" #include "gimplistitem.h" #include "gimpwidgets-constructors.h" -#include "gdisplay.h" - #include "libgimp/gimpintl.h" diff --git a/app/widgets/gimplayertreeview.c b/app/widgets/gimplayertreeview.c index 10b496c075..b791369f30 100644 --- a/app/widgets/gimplayertreeview.c +++ b/app/widgets/gimplayertreeview.c @@ -33,13 +33,13 @@ #include "core/gimplayer.h" #include "core/gimpmarshal.h" +#include "display/gimpdisplay.h" + #include "gimpdnd.h" #include "gimplayerlistview.h" #include "gimplistitem.h" #include "gimpwidgets-constructors.h" -#include "gdisplay.h" - #include "libgimp/gimpintl.h" diff --git a/app/widgets/gimppreview.c b/app/widgets/gimppreview.c index a1a0b8cdda..c6de796501 100644 --- a/app/widgets/gimppreview.c +++ b/app/widgets/gimppreview.c @@ -44,6 +44,8 @@ #include "core/gimppattern.h" #include "core/gimptoolinfo.h" +#include "display/gimpdisplay-render.h" + #include "gimpbrushpreview.h" #include "gimpbufferpreview.h" #include "gimpdnd.h" @@ -55,9 +57,6 @@ #include "gimppreview.h" #include "gimptoolinfopreview.h" -#include "display/display-types.h" -#include "image_render.h" - #define PREVIEW_POPUP_DELAY 150 diff --git a/app/widgets/gimppreviewrenderer.c b/app/widgets/gimppreviewrenderer.c index a1a0b8cdda..c6de796501 100644 --- a/app/widgets/gimppreviewrenderer.c +++ b/app/widgets/gimppreviewrenderer.c @@ -44,6 +44,8 @@ #include "core/gimppattern.h" #include "core/gimptoolinfo.h" +#include "display/gimpdisplay-render.h" + #include "gimpbrushpreview.h" #include "gimpbufferpreview.h" #include "gimpdnd.h" @@ -55,9 +57,6 @@ #include "gimppreview.h" #include "gimptoolinfopreview.h" -#include "display/display-types.h" -#include "image_render.h" - #define PREVIEW_POPUP_DELAY 150 diff --git a/app/widgets/gimptoolbox-color-area.c b/app/widgets/gimptoolbox-color-area.c index 1fdf730738..0aa3fa2d51 100644 --- a/app/widgets/gimptoolbox-color-area.c +++ b/app/widgets/gimptoolbox-color-area.c @@ -40,7 +40,6 @@ #include "color-notebook.h" #include "app_procs.h" -#include "gdisplay.h" #ifdef DISPLAY_FILTERS #include "gdisplay_color.h" diff --git a/app/widgets/gimptoolbox.c b/app/widgets/gimptoolbox.c index 09177a76ba..18f60c8e60 100644 --- a/app/widgets/gimptoolbox.c +++ b/app/widgets/gimptoolbox.c @@ -24,7 +24,7 @@ #include "libgimpwidgets/gimpwidgets.h" -#include "widgets/widgets-types.h" +#include "gui-types.h" #include "base/pixel-region.h" #include "base/tile-manager.h" @@ -50,7 +50,6 @@ #include "devices.h" #include "dialogs.h" #include "dialogs-commands.h" -#include "gdisplay.h" #include "indicator-area.h" #include "menus.h" diff --git a/app/widgets/gimpview.c b/app/widgets/gimpview.c index a1a0b8cdda..c6de796501 100644 --- a/app/widgets/gimpview.c +++ b/app/widgets/gimpview.c @@ -44,6 +44,8 @@ #include "core/gimppattern.h" #include "core/gimptoolinfo.h" +#include "display/gimpdisplay-render.h" + #include "gimpbrushpreview.h" #include "gimpbufferpreview.h" #include "gimpdnd.h" @@ -55,9 +57,6 @@ #include "gimppreview.h" #include "gimptoolinfopreview.h" -#include "display/display-types.h" -#include "image_render.h" - #define PREVIEW_POPUP_DELAY 150 diff --git a/app/widgets/gimpviewrenderer.c b/app/widgets/gimpviewrenderer.c index a1a0b8cdda..c6de796501 100644 --- a/app/widgets/gimpviewrenderer.c +++ b/app/widgets/gimpviewrenderer.c @@ -44,6 +44,8 @@ #include "core/gimppattern.h" #include "core/gimptoolinfo.h" +#include "display/gimpdisplay-render.h" + #include "gimpbrushpreview.h" #include "gimpbufferpreview.h" #include "gimpdnd.h" @@ -55,9 +57,6 @@ #include "gimppreview.h" #include "gimptoolinfopreview.h" -#include "display/display-types.h" -#include "image_render.h" - #define PREVIEW_POPUP_DELAY 150 diff --git a/app/widgets/widgets-types.h b/app/widgets/widgets-types.h index 13cf04ac9d..05786cf38e 100644 --- a/app/widgets/widgets-types.h +++ b/app/widgets/widgets-types.h @@ -22,7 +22,7 @@ #include "libgimpwidgets/gimpwidgetstypes.h" -#include "core/core-types.h" +#include "display/display-types.h" /* enums */ diff --git a/tools/pdbgen/pdb.pl b/tools/pdbgen/pdb.pl index 498512e91d..63f3782b70 100644 --- a/tools/pdbgen/pdb.pl +++ b/tools/pdbgen/pdb.pl @@ -36,8 +36,8 @@ package Gimp::CodeGen::pdb; headers => [ qw("libgimpcolor/gimpcolor.h") ], struct => 1 }, display => { name => 'DISPLAY', - type => 'GDisplay *', - headers => [ qw("gdisplay.h") ], + type => 'GimpDisplay *', + headers => [ qw("display/gimpdisplay.h") ], id_func => 'gdisplay_get_by_ID', id_ret_func => '$var->ID' }, image => { name => 'IMAGE', diff --git a/tools/pdbgen/pdb/display.pdb b/tools/pdbgen/pdb/display.pdb index e8c41bca44..cbdb8229b7 100644 --- a/tools/pdbgen/pdb/display.pdb +++ b/tools/pdbgen/pdb/display.pdb @@ -81,11 +81,11 @@ HELP %invoke = ( code => 'gdisplays_flush ();' ); } -@headers = qw("display/display-types.h" "gdisplay.h"); +@headers = qw("display/display-types.h" "display/gimpdisplay.h"); @procs = qw(display_new display_delete displays_flush); %exports = (app => [@procs], lib => [@procs]); -$desc = 'GDisplay procedures'; +$desc = 'GimpDisplay procedures'; 1;