gimp r26408 - in branches/soc-2008-text: . app app/actions app/base app/composite app/core app/dialogs app/display app/gui app/menus app/paint app/paint-funcs app/pdb app/plug-in app/text app/tools app/vectors app/widgets app/xcf data/images data/tips devel-docs devel-docs/libgimp devel-docs/libgimp/tmpl devel-docs/libgimpbase/tmpl devel-docs/tools docs etc libgimp libgimpbase libgimpwidgets menus plug-ins/common plug-ins/help plug-ins/help-browser plug-ins/psd plug-ins/pygimp plug-ins/script-fu plug-ins/selection-to-path plug-ins/uri po po-libgimp po-plug-ins po-python po-script-fu po-tips themes/Default/images tools/pdbgen tools/pdbgen/pdb



Author: danedde
Date: Wed Aug  6 20:36:18 2008
New Revision: 26408
URL: http://svn.gnome.org/viewvc/gimp?rev=26408&view=rev

Log:
2008-08-06  Daniel Eddeland <danedde svn gnome org>

	Merged 26051:26401 from trunk



Added:
   branches/soc-2008-text/app/display/gimpdisplayshell-private.h
      - copied unchanged from r26401, /trunk/app/display/gimpdisplayshell-private.h
   branches/soc-2008-text/app/gui/dbus-service.xml
      - copied unchanged from r26401, /trunk/app/gui/dbus-service.xml
   branches/soc-2008-text/app/gui/gimpdbusservice.c
      - copied unchanged from r26401, /trunk/app/gui/gimpdbusservice.c
   branches/soc-2008-text/app/gui/gimpdbusservice.h
      - copied unchanged from r26401, /trunk/app/gui/gimpdbusservice.h
   branches/soc-2008-text/app/gui/gui-unique.c
      - copied unchanged from r26401, /trunk/app/gui/gui-unique.c
   branches/soc-2008-text/app/gui/gui-unique.h
      - copied unchanged from r26401, /trunk/app/gui/gui-unique.h
   branches/soc-2008-text/app/unique.c
      - copied unchanged from r26401, /trunk/app/unique.c
   branches/soc-2008-text/app/unique.h
      - copied unchanged from r26401, /trunk/app/unique.h
   branches/soc-2008-text/plug-ins/psd/psd-save.c
      - copied unchanged from r26401, /trunk/plug-ins/psd/psd-save.c
   branches/soc-2008-text/plug-ins/pygimp/ChangeLog.old
      - copied unchanged from r26401, /trunk/plug-ins/pygimp/ChangeLog.old
   branches/soc-2008-text/po-plug-ins/be.po
      - copied unchanged from r26401, /trunk/po-plug-ins/be.po
   branches/soc-2008-text/po-python/be.po
      - copied unchanged from r26401, /trunk/po-python/be.po
   branches/soc-2008-text/po-script-fu/be.po
      - copied unchanged from r26401, /trunk/po-script-fu/be.po
   branches/soc-2008-text/po-tips/be.po
      - copied unchanged from r26401, /trunk/po-tips/be.po
Removed:
   branches/soc-2008-text/app/widgets/dbus-service.xml
   branches/soc-2008-text/app/widgets/gimpdbusservice.c
   branches/soc-2008-text/app/widgets/gimpdbusservice.h
   branches/soc-2008-text/plug-ins/common/psd-save.c
   branches/soc-2008-text/plug-ins/pygimp/ChangeLog
Modified:
   branches/soc-2008-text/   (props changed)
   branches/soc-2008-text/ChangeLog
   branches/soc-2008-text/INSTALL
   branches/soc-2008-text/NEWS
   branches/soc-2008-text/app/Makefile.am
   branches/soc-2008-text/app/actions/file-commands.c
   branches/soc-2008-text/app/actions/windows-actions.c
   branches/soc-2008-text/app/app.c
   branches/soc-2008-text/app/base/color-balance.c
   branches/soc-2008-text/app/base/gimphistogram.c
   branches/soc-2008-text/app/base/gimphistogram.h
   branches/soc-2008-text/app/base/tile-manager.h
   branches/soc-2008-text/app/base/tile-pyramid.h
   branches/soc-2008-text/app/composite/gimp-composite-3dnow-test.c
   branches/soc-2008-text/app/composite/gimp-composite-altivec-test.c
   branches/soc-2008-text/app/composite/gimp-composite-mmx-test.c
   branches/soc-2008-text/app/composite/gimp-composite-sse-test.c
   branches/soc-2008-text/app/composite/gimp-composite-sse2-test.c
   branches/soc-2008-text/app/composite/gimp-composite-test.c
   branches/soc-2008-text/app/composite/gimp-composite-vis-test.c
   branches/soc-2008-text/app/core/core-types.h
   branches/soc-2008-text/app/core/gimp-user-install.c
   branches/soc-2008-text/app/core/gimpchannel.c
   branches/soc-2008-text/app/core/gimpcoords.c
   branches/soc-2008-text/app/core/gimpdata.c
   branches/soc-2008-text/app/core/gimpdata.h
   branches/soc-2008-text/app/core/gimpdatafactory.c
   branches/soc-2008-text/app/core/gimpdatafactory.h
   branches/soc-2008-text/app/core/gimpgrid.c
   branches/soc-2008-text/app/core/gimpguideundo.c
   branches/soc-2008-text/app/core/gimpimage-crop.c
   branches/soc-2008-text/app/core/gimpimage-resize.c
   branches/soc-2008-text/app/core/gimpimage-rotate.c
   branches/soc-2008-text/app/core/gimpimage-scale.c
   branches/soc-2008-text/app/core/gimpimage-undo-push.c
   branches/soc-2008-text/app/core/gimpimage-undo-push.h
   branches/soc-2008-text/app/core/gimpimage-undo.c
   branches/soc-2008-text/app/core/gimpimage.c
   branches/soc-2008-text/app/core/gimpimage.h
   branches/soc-2008-text/app/core/gimpimagemapconfig.c
   branches/soc-2008-text/app/core/gimpimageundo.c
   branches/soc-2008-text/app/core/gimpimageundo.h
   branches/soc-2008-text/app/core/gimpitemundo.c
   branches/soc-2008-text/app/core/gimplayermaskundo.c
   branches/soc-2008-text/app/core/gimpmarshal.list
   branches/soc-2008-text/app/core/gimpparamspecs.c
   branches/soc-2008-text/app/core/gimpparamspecs.h
   branches/soc-2008-text/app/core/gimppdbprogress.c
   branches/soc-2008-text/app/core/gimpscanconvert.c
   branches/soc-2008-text/app/core/gimpstrokedesc.c
   branches/soc-2008-text/app/core/gimpstrokedesc.h
   branches/soc-2008-text/app/core/gimptooloptions.c
   branches/soc-2008-text/app/core/gimptoolpresets.c
   branches/soc-2008-text/app/core/gimpundo.h
   branches/soc-2008-text/app/dialogs/file-open-dialog.c
   branches/soc-2008-text/app/dialogs/preferences-dialog.c
   branches/soc-2008-text/app/dialogs/stroke-dialog.c
   branches/soc-2008-text/app/dialogs/tips-dialog.c
   branches/soc-2008-text/app/dialogs/tips-parser.c
   branches/soc-2008-text/app/dialogs/tips-parser.h
   branches/soc-2008-text/app/display/Makefile.am
   branches/soc-2008-text/app/display/gimpdisplayshell-autoscroll.c
   branches/soc-2008-text/app/display/gimpdisplayshell-callbacks.c
   branches/soc-2008-text/app/display/gimpdisplayshell-close.c
   branches/soc-2008-text/app/display/gimpdisplayshell-coords.c
   branches/soc-2008-text/app/display/gimpdisplayshell-draw.c
   branches/soc-2008-text/app/display/gimpdisplayshell-handlers.c
   branches/soc-2008-text/app/display/gimpdisplayshell-progress.c
   branches/soc-2008-text/app/display/gimpdisplayshell-render.c
   branches/soc-2008-text/app/display/gimpdisplayshell-scale.c
   branches/soc-2008-text/app/display/gimpdisplayshell-scale.h
   branches/soc-2008-text/app/display/gimpdisplayshell-scroll.c
   branches/soc-2008-text/app/display/gimpdisplayshell-scroll.h
   branches/soc-2008-text/app/display/gimpdisplayshell-transform.c
   branches/soc-2008-text/app/display/gimpdisplayshell.c
   branches/soc-2008-text/app/display/gimpdisplayshell.h
   branches/soc-2008-text/app/display/gimpnavigationeditor.c
   branches/soc-2008-text/app/display/gimpstatusbar.c
   branches/soc-2008-text/app/gui/   (props changed)
   branches/soc-2008-text/app/gui/Makefile.am
   branches/soc-2008-text/app/gui/gui.c
   branches/soc-2008-text/app/gui/session.c
   branches/soc-2008-text/app/gui/splash.c
   branches/soc-2008-text/app/main.c
   branches/soc-2008-text/app/menus/file-menu.c
   branches/soc-2008-text/app/paint-funcs/scale-region.c
   branches/soc-2008-text/app/paint/gimpairbrush.c
   branches/soc-2008-text/app/paint/gimpbrushcore.c
   branches/soc-2008-text/app/paint/gimpclone.c
   branches/soc-2008-text/app/paint/gimpconvolve.c
   branches/soc-2008-text/app/paint/gimpdodgeburn.c
   branches/soc-2008-text/app/paint/gimperaser.c
   branches/soc-2008-text/app/paint/gimpheal.c
   branches/soc-2008-text/app/paint/gimppaintbrush.c
   branches/soc-2008-text/app/paint/gimppaintcore-stroke.c
   branches/soc-2008-text/app/paint/gimppaintcore-stroke.h
   branches/soc-2008-text/app/paint/gimppaintcore.c
   branches/soc-2008-text/app/paint/gimppaintcore.h
   branches/soc-2008-text/app/paint/gimppaintoptions.c
   branches/soc-2008-text/app/paint/gimppaintoptions.h
   branches/soc-2008-text/app/paint/gimpsmudge.c
   branches/soc-2008-text/app/pdb/edit-cmds.c
   branches/soc-2008-text/app/pdb/gimp-pdb-compat.c
   branches/soc-2008-text/app/pdb/internal-procs.c
   branches/soc-2008-text/app/pdb/palette-cmds.c
   branches/soc-2008-text/app/pdb/vectors-cmds.c
   branches/soc-2008-text/app/plug-in/gimpplugin-message.c
   branches/soc-2008-text/app/plug-in/plug-in-params.c
   branches/soc-2008-text/app/text/gimpfont.c
   branches/soc-2008-text/app/text/gimptext-compat.c
   branches/soc-2008-text/app/text/gimptextlayout-render.c
   branches/soc-2008-text/app/tools/gimpcolorizetool.c
   branches/soc-2008-text/app/tools/gimpcolortool.c
   branches/soc-2008-text/app/tools/gimpdrawtool.c
   branches/soc-2008-text/app/tools/gimpdrawtool.h
   branches/soc-2008-text/app/tools/gimpeditselectiontool.c
   branches/soc-2008-text/app/tools/gimpeditselectiontool.h
   branches/soc-2008-text/app/tools/gimpmovetool.c
   branches/soc-2008-text/app/tools/gimppaintoptions-gui.c
   branches/soc-2008-text/app/tools/gimppainttool.c
   branches/soc-2008-text/app/tools/gimprectangletool.c
   branches/soc-2008-text/app/tools/gimprotatetool.c
   branches/soc-2008-text/app/tools/gimptexttool.c
   branches/soc-2008-text/app/tools/gimptool.c
   branches/soc-2008-text/app/tools/gimpvectortool.c
   branches/soc-2008-text/app/vectors/gimpbezierstroke.c
   branches/soc-2008-text/app/vectors/gimpvectors.c
   branches/soc-2008-text/app/widgets/   (props changed)
   branches/soc-2008-text/app/widgets/Makefile.am
   branches/soc-2008-text/app/widgets/gimpaction.c
   branches/soc-2008-text/app/widgets/gimpcellrendererviewable.c
   branches/soc-2008-text/app/widgets/gimpcontrollereditor.c
   branches/soc-2008-text/app/widgets/gimpcontrollerinfo.c
   branches/soc-2008-text/app/widgets/gimpcontrollerkeyboard.c
   branches/soc-2008-text/app/widgets/gimpcontrollerlist.c
   branches/soc-2008-text/app/widgets/gimpdasheditor.c
   branches/soc-2008-text/app/widgets/gimpdock.c
   branches/soc-2008-text/app/widgets/gimpeditor.c
   branches/soc-2008-text/app/widgets/gimpgrideditor.c
   branches/soc-2008-text/app/widgets/gimphelp.c
   branches/soc-2008-text/app/widgets/gimphelp.h
   branches/soc-2008-text/app/widgets/gimphistogrameditor.c
   branches/soc-2008-text/app/widgets/gimphistogramview.c
   branches/soc-2008-text/app/widgets/gimpnavigationview.c
   branches/soc-2008-text/app/widgets/gimpnavigationview.h
   branches/soc-2008-text/app/widgets/gimppdbdialog.c
   branches/soc-2008-text/app/widgets/gimppluginaction.c
   branches/soc-2008-text/app/widgets/gimpsessioninfo-aux.c
   branches/soc-2008-text/app/widgets/gimpsessioninfo.c
   branches/soc-2008-text/app/widgets/gimpstrokeeditor.c
   branches/soc-2008-text/app/widgets/gimptemplateeditor.c
   branches/soc-2008-text/app/widgets/gimpviewrendererimagefile.c
   branches/soc-2008-text/app/widgets/gtkscalebutton.c
   branches/soc-2008-text/app/xcf/xcf-load.c
   branches/soc-2008-text/configure.in
   branches/soc-2008-text/data/images/gimp-splash.png
   branches/soc-2008-text/data/tips/gimp-tips.dtd
   branches/soc-2008-text/data/tips/gimp-tips.xml.in
   branches/soc-2008-text/devel-docs/ChangeLog
   branches/soc-2008-text/devel-docs/libgimp/libgimp-sections.txt
   branches/soc-2008-text/devel-docs/libgimp/tmpl/gimppalette.sgml
   branches/soc-2008-text/devel-docs/libgimp/tmpl/gimpvectors.sgml
   branches/soc-2008-text/devel-docs/libgimpbase/tmpl/gimpbaseenums.sgml
   branches/soc-2008-text/devel-docs/tools/widgets.c
   branches/soc-2008-text/docs/Makefile.am
   branches/soc-2008-text/docs/gimp.1.in
   branches/soc-2008-text/docs/gimprc.5.in
   branches/soc-2008-text/etc/controllerrc
   branches/soc-2008-text/etc/gimprc
   branches/soc-2008-text/libgimp/gimp.c
   branches/soc-2008-text/libgimp/gimp.def
   branches/soc-2008-text/libgimp/gimp.h
   branches/soc-2008-text/libgimp/gimpedit_pdb.c
   branches/soc-2008-text/libgimp/gimppalette_pdb.c
   branches/soc-2008-text/libgimp/gimppalette_pdb.h
   branches/soc-2008-text/libgimp/gimpui.c
   branches/soc-2008-text/libgimp/gimpvectors_pdb.c
   branches/soc-2008-text/libgimp/gimpvectors_pdb.h
   branches/soc-2008-text/libgimpbase/gimpbaseenums.c
   branches/soc-2008-text/libgimpbase/gimpbaseenums.h
   branches/soc-2008-text/libgimpbase/gimpprotocol.c
   branches/soc-2008-text/libgimpbase/gimpprotocol.h
   branches/soc-2008-text/libgimpwidgets/gimpcolorprofilecombobox.c
   branches/soc-2008-text/menus/image-menu.xml.in
   branches/soc-2008-text/plug-ins/common/   (props changed)
   branches/soc-2008-text/plug-ins/common/Makefile.am
   branches/soc-2008-text/plug-ins/common/alien-map.c
   branches/soc-2008-text/plug-ins/common/blinds.c
   branches/soc-2008-text/plug-ins/common/blur-motion.c
   branches/soc-2008-text/plug-ins/common/channel-mixer.c
   branches/soc-2008-text/plug-ins/common/color-exchange.c
   branches/soc-2008-text/plug-ins/common/color-to-alpha.c
   branches/soc-2008-text/plug-ins/common/contrast-retinex.c
   branches/soc-2008-text/plug-ins/common/convolution-matrix.c
   branches/soc-2008-text/plug-ins/common/cubism.c
   branches/soc-2008-text/plug-ins/common/deinterlace.c
   branches/soc-2008-text/plug-ins/common/destripe.c
   branches/soc-2008-text/plug-ins/common/edge-dog.c
   branches/soc-2008-text/plug-ins/common/edge.c
   branches/soc-2008-text/plug-ins/common/emboss.c
   branches/soc-2008-text/plug-ins/common/engrave.c
   branches/soc-2008-text/plug-ins/common/filter-pack.c
   branches/soc-2008-text/plug-ins/common/gif-save.c
   branches/soc-2008-text/plug-ins/common/illusion.c
   branches/soc-2008-text/plug-ins/common/jigsaw.c
   branches/soc-2008-text/plug-ins/common/lens-apply.c
   branches/soc-2008-text/plug-ins/common/lens-distortion.c
   branches/soc-2008-text/plug-ins/common/max-rgb.c
   branches/soc-2008-text/plug-ins/common/newsprint.c
   branches/soc-2008-text/plug-ins/common/nl-filter.c
   branches/soc-2008-text/plug-ins/common/noise-hsv.c
   branches/soc-2008-text/plug-ins/common/noise-solid.c
   branches/soc-2008-text/plug-ins/common/pixelize.c
   branches/soc-2008-text/plug-ins/common/plasma.c
   branches/soc-2008-text/plug-ins/common/plugin-defs.pl
   branches/soc-2008-text/plug-ins/common/polar-coords.c
   branches/soc-2008-text/plug-ins/common/ripple.c
   branches/soc-2008-text/plug-ins/common/shift.c
   branches/soc-2008-text/plug-ins/common/sparkle.c
   branches/soc-2008-text/plug-ins/common/tiff-load.c
   branches/soc-2008-text/plug-ins/common/tile-glass.c
   branches/soc-2008-text/plug-ins/common/value-propagate.c
   branches/soc-2008-text/plug-ins/common/waves.c
   branches/soc-2008-text/plug-ins/common/whirl-pinch.c
   branches/soc-2008-text/plug-ins/common/wind.c
   branches/soc-2008-text/plug-ins/help-browser/dialog.c
   branches/soc-2008-text/plug-ins/help/gimphelpdomain.c
   branches/soc-2008-text/plug-ins/help/gimphelpitem.h
   branches/soc-2008-text/plug-ins/help/gimphelplocale.c
   branches/soc-2008-text/plug-ins/psd/   (props changed)
   branches/soc-2008-text/plug-ins/psd/Makefile.am
   branches/soc-2008-text/plug-ins/pygimp/gimpmodule.c
   branches/soc-2008-text/plug-ins/pygimp/pygimp-pdb.c
   branches/soc-2008-text/plug-ins/script-fu/scheme-wrapper.c
   branches/soc-2008-text/plug-ins/selection-to-path/pxl-outline.c
   branches/soc-2008-text/plug-ins/uri/Makefile.am
   branches/soc-2008-text/plug-ins/uri/uri-backend-gvfs.c
   branches/soc-2008-text/plug-ins/uri/uri-backend-libcurl.c
   branches/soc-2008-text/po-libgimp/ChangeLog
   branches/soc-2008-text/po-libgimp/POTFILES.in
   branches/soc-2008-text/po-libgimp/ar.po
   branches/soc-2008-text/po-libgimp/be.po
   branches/soc-2008-text/po-libgimp/ca.po
   branches/soc-2008-text/po-libgimp/de.po
   branches/soc-2008-text/po-libgimp/es.po
   branches/soc-2008-text/po-libgimp/gl.po
   branches/soc-2008-text/po-libgimp/it.po
   branches/soc-2008-text/po-libgimp/lt.po
   branches/soc-2008-text/po-libgimp/sv.po
   branches/soc-2008-text/po-plug-ins/ChangeLog
   branches/soc-2008-text/po-plug-ins/POTFILES.in
   branches/soc-2008-text/po-plug-ins/ar.po
   branches/soc-2008-text/po-plug-ins/ca.po
   branches/soc-2008-text/po-plug-ins/de.po
   branches/soc-2008-text/po-plug-ins/es.po
   branches/soc-2008-text/po-plug-ins/gl.po
   branches/soc-2008-text/po-plug-ins/it.po
   branches/soc-2008-text/po-plug-ins/lt.po
   branches/soc-2008-text/po-plug-ins/sv.po
   branches/soc-2008-text/po-python/ChangeLog
   branches/soc-2008-text/po-python/de.po
   branches/soc-2008-text/po-python/es.po
   branches/soc-2008-text/po-python/gl.po
   branches/soc-2008-text/po-python/it.po
   branches/soc-2008-text/po-python/lt.po
   branches/soc-2008-text/po-python/nn.po
   branches/soc-2008-text/po-script-fu/ChangeLog
   branches/soc-2008-text/po-script-fu/ar.po
   branches/soc-2008-text/po-script-fu/de.po
   branches/soc-2008-text/po-script-fu/es.po
   branches/soc-2008-text/po-script-fu/gl.po
   branches/soc-2008-text/po-script-fu/lt.po
   branches/soc-2008-text/po-script-fu/sv.po
   branches/soc-2008-text/po-tips/ChangeLog
   branches/soc-2008-text/po-tips/ar.po
   branches/soc-2008-text/po-tips/gl.po
   branches/soc-2008-text/po-tips/nn.po
   branches/soc-2008-text/po/ChangeLog
   branches/soc-2008-text/po/ar.po
   branches/soc-2008-text/po/be.po
   branches/soc-2008-text/po/ca.po
   branches/soc-2008-text/po/de.po
   branches/soc-2008-text/po/es.po
   branches/soc-2008-text/po/gl.po
   branches/soc-2008-text/po/it.po
   branches/soc-2008-text/po/lt.po
   branches/soc-2008-text/po/sv.po
   branches/soc-2008-text/themes/Default/images/stock-user-manual-64.png
   branches/soc-2008-text/tools/pdbgen/app.pl
   branches/soc-2008-text/tools/pdbgen/enums.pl
   branches/soc-2008-text/tools/pdbgen/pdb.pl
   branches/soc-2008-text/tools/pdbgen/pdb/edit.pdb
   branches/soc-2008-text/tools/pdbgen/pdb/palette.pdb
   branches/soc-2008-text/tools/pdbgen/pdb/vectors.pdb

Modified: branches/soc-2008-text/INSTALL
==============================================================================
--- branches/soc-2008-text/INSTALL	(original)
+++ branches/soc-2008-text/INSTALL	Wed Aug  6 20:36:18 2008
@@ -230,6 +230,10 @@
      gimp-console binary to be built in addition to the standard binary.
      gimp-console is useful for command-line batch mode or as a server.
 
+  --enable-gimp-remote.  Use this option if you want the gimp-remote
+     binary to be built. This only works with X11 and it is obsolete if#
+     your platform has DBus support.
+
   --disable-python.  If for some reason you don't want to build the
      Python based pygimp plug-in, you can use --disable-python.
 

Modified: branches/soc-2008-text/NEWS
==============================================================================
--- branches/soc-2008-text/NEWS	(original)
+++ branches/soc-2008-text/NEWS	Wed Aug  6 20:36:18 2008
@@ -7,6 +7,32 @@
 towards the next stable release, which will be GIMP 2.6.
 
 
+Changes in GIMP 2.5.2
+=====================
+
+ - final touches on the combined Freehand/Polygon Select tool
+ - added a dockable dialog for managing Color tool settings
+ - prepared the code for changes in the upcoming GTK+ release
+ - improved popup scale button
+ - mark the center of rectangles/bounding rectangles during moves
+ - added dialog to query for using the online user manual
+ - allow to map dynamics to hardness for the Eraser tool
+ - provide gimp-remote functionality on Windows
+ - disable the build and install of the gimp-remote tool by default
+ - allow to scroll beyond the image borders
+ - added new PDB data type for transferring color arrays
+ - added new PDB function gimp-palette-get-colors
+ - added text search to the Help Browser plug-in
+ - bug fixes and code cleanup
+
+
+Contributors:
+
+  Sven Neumann, Michael Natterer, Martin Nordholts, Manish Singh,
+  Lars-Peter Clausen, Alexia Death, Tor Lillqvist, RÃman Joost,
+  Jakub Steiner
+
+
 Changes in GIMP 2.5.1
 =====================
 

Modified: branches/soc-2008-text/app/Makefile.am
==============================================================================
--- branches/soc-2008-text/app/Makefile.am	(original)
+++ branches/soc-2008-text/app/Makefile.am	Wed Aug  6 20:36:18 2008
@@ -49,6 +49,8 @@
 	main.c		\
 	sanity.c	\
 	sanity.h	\
+	unique.c	\
+	unique.h	\
 	units.c		\
 	units.h		\
 	version.c	\
@@ -67,7 +69,7 @@
 	wilber.ico
 
 if OS_WIN32
-mwindows = -mwindows
+win32_ldflags = -mwindows -Wl,--large-address-aware
 endif
 
 if USE_BINRELOC
@@ -101,7 +103,7 @@
 	-u $(SYMPREFIX)gimp_image_map_config_get_type	\
 	-u $(SYMPREFIX)gimp_plug_in_manager_restore
 
-gimp_2_5_LDFLAGS = $(AM_LDFLAGS) $(mwindows) 
+gimp_2_5_LDFLAGS = $(AM_LDFLAGS) $(win32_ldflags) 
 
 gimp_2_5_LDADD = \
 	gui/libappgui.a			\

Modified: branches/soc-2008-text/app/actions/file-commands.c
==============================================================================
--- branches/soc-2008-text/app/actions/file-commands.c	(original)
+++ branches/soc-2008-text/app/actions/file-commands.c	Wed Aug  6 20:36:18 2008
@@ -65,6 +65,7 @@
 /*  local function prototypes  */
 
 static void   file_open_dialog_show        (GtkWidget   *parent,
+                                            Gimp        *gimp,
                                             GimpImage   *image,
                                             const gchar *uri,
                                             gboolean     open_as_layers);
@@ -90,9 +91,11 @@
 file_open_cmd_callback (GtkAction *action,
                         gpointer   data)
 {
+  Gimp        *gimp;
   GimpImage   *image;
   GtkWidget   *widget;
   const gchar *uri = NULL;
+  return_if_no_gimp (gimp, data);
   return_if_no_widget (widget, data);
 
   image = action_data_get_image (data);
@@ -100,24 +103,26 @@
   if (image)
     uri = gimp_object_get_name (GIMP_OBJECT (image));
 
-  file_open_dialog_show (widget, NULL, uri, FALSE);
+  file_open_dialog_show (widget, gimp, NULL, uri, FALSE);
 }
 
 void
 file_open_as_layers_cmd_callback (GtkAction *action,
                                   gpointer   data)
 {
+  Gimp        *gimp;
   GimpDisplay *display;
   GtkWidget   *widget;
   GimpImage   *image;
   const gchar *uri;
+  return_if_no_gimp (gimp, data);
   return_if_no_display (display, data);
   return_if_no_widget (widget, data);
 
   image = display->image;
   uri = gimp_object_get_name (GIMP_OBJECT (image));
 
-  file_open_dialog_show (widget, image, uri, TRUE);
+  file_open_dialog_show (widget, gimp, image, uri, TRUE);
 }
 
 void
@@ -436,7 +441,7 @@
                        const gchar *uri,
                        GtkWidget   *parent)
 {
-  file_open_dialog_show (parent, NULL, uri, FALSE);
+  file_open_dialog_show (parent, gimp, NULL, uri, FALSE);
 }
 
 
@@ -444,6 +449,7 @@
 
 static void
 file_open_dialog_show (GtkWidget   *parent,
+                       Gimp        *gimp,
                        GimpImage   *image,
                        const gchar *uri,
                        gboolean     open_as_layers)
@@ -456,6 +462,9 @@
 
   if (dialog)
     {
+      if (! uri)
+        uri = g_object_get_data (G_OBJECT (gimp), "gimp-file-open-last-uri");
+
       if (uri)
         gtk_file_chooser_set_uri (GTK_FILE_CHOOSER (dialog), uri);
 

Modified: branches/soc-2008-text/app/actions/windows-actions.c
==============================================================================
--- branches/soc-2008-text/app/actions/windows-actions.c	(original)
+++ branches/soc-2008-text/app/actions/windows-actions.c	Wed Aug  6 20:36:18 2008
@@ -321,9 +321,11 @@
                              GimpActionGroup  *group)
 {
   GtkAction *action;
-  gchar     *action_name = g_strdup_printf ("windows-dock-%04d", dock->ID);
+  gchar     *action_name;
 
+  action_name = g_strdup_printf ("windows-dock-%04d", dock->ID);
   action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), action_name);
+  g_free (action_name);
 
   if (action)
     g_object_set (action,

Modified: branches/soc-2008-text/app/app.c
==============================================================================
--- branches/soc-2008-text/app/app.c	(original)
+++ branches/soc-2008-text/app/app.c	Wed Aug  6 20:36:18 2008
@@ -32,8 +32,6 @@
 
 #include <gegl.h>
 
-#include <gegl.h>
-
 #include "libgimpbase/gimpbase.h"
 #include "libgimpconfig/gimpconfig.h"
 
@@ -64,6 +62,7 @@
 
 #include "gimp-intl.h"
 
+
 /*  local prototypes  */
 
 static void       app_init_update_none    (const gchar *text1,

Modified: branches/soc-2008-text/app/base/color-balance.c
==============================================================================
--- branches/soc-2008-text/app/base/color-balance.c	(original)
+++ branches/soc-2008-text/app/base/color-balance.c	Wed Aug  6 20:36:18 2008
@@ -85,53 +85,78 @@
       transfer_initialized = TRUE;
     }
 
-  /*  Set the transfer arrays  (for speed)  */
+  /*  Prepare the transfer arrays  (for speed)  */
+
   cyan_red_transfer[GIMP_SHADOWS] =
     (cb->cyan_red[GIMP_SHADOWS] > 0) ? shadows_add : shadows_sub;
+
   cyan_red_transfer[GIMP_MIDTONES] =
     (cb->cyan_red[GIMP_MIDTONES] > 0) ? midtones_add : midtones_sub;
+
   cyan_red_transfer[GIMP_HIGHLIGHTS] =
     (cb->cyan_red[GIMP_HIGHLIGHTS] > 0) ? highlights_add : highlights_sub;
 
+
   magenta_green_transfer[GIMP_SHADOWS] =
     (cb->magenta_green[GIMP_SHADOWS] > 0) ? shadows_add : shadows_sub;
+
   magenta_green_transfer[GIMP_MIDTONES] =
     (cb->magenta_green[GIMP_MIDTONES] > 0) ? midtones_add : midtones_sub;
+
   magenta_green_transfer[GIMP_HIGHLIGHTS] =
     (cb->magenta_green[GIMP_HIGHLIGHTS] > 0) ? highlights_add : highlights_sub;
 
+
   yellow_blue_transfer[GIMP_SHADOWS] =
     (cb->yellow_blue[GIMP_SHADOWS] > 0) ? shadows_add : shadows_sub;
+
   yellow_blue_transfer[GIMP_MIDTONES] =
     (cb->yellow_blue[GIMP_MIDTONES] > 0) ? midtones_add : midtones_sub;
+
   yellow_blue_transfer[GIMP_HIGHLIGHTS] =
     (cb->yellow_blue[GIMP_HIGHLIGHTS] > 0) ? highlights_add : highlights_sub;
 
+
   for (i = 0; i < 256; i++)
     {
       r_n = i;
       g_n = i;
       b_n = i;
 
-      r_n += cb->cyan_red[GIMP_SHADOWS] * cyan_red_transfer[GIMP_SHADOWS][r_n];
+      r_n += (cb->cyan_red[GIMP_SHADOWS] *
+              cyan_red_transfer[GIMP_SHADOWS][r_n]);
       r_n = CLAMP0255 (r_n);
-      r_n += cb->cyan_red[GIMP_MIDTONES] * cyan_red_transfer[GIMP_MIDTONES][r_n];
+
+      r_n += (cb->cyan_red[GIMP_MIDTONES] *
+              cyan_red_transfer[GIMP_MIDTONES][r_n]);
       r_n = CLAMP0255 (r_n);
-      r_n += cb->cyan_red[GIMP_HIGHLIGHTS] * cyan_red_transfer[GIMP_HIGHLIGHTS][r_n];
+
+      r_n += (cb->cyan_red[GIMP_HIGHLIGHTS] *
+              cyan_red_transfer[GIMP_HIGHLIGHTS][r_n]);
       r_n = CLAMP0255 (r_n);
 
-      g_n += cb->magenta_green[GIMP_SHADOWS] * magenta_green_transfer[GIMP_SHADOWS][g_n];
+      g_n += (cb->magenta_green[GIMP_SHADOWS] *
+              magenta_green_transfer[GIMP_SHADOWS][g_n]);
       g_n = CLAMP0255 (g_n);
-      g_n += cb->magenta_green[GIMP_MIDTONES] * magenta_green_transfer[GIMP_MIDTONES][g_n];
+
+      g_n += (cb->magenta_green[GIMP_MIDTONES] *
+              magenta_green_transfer[GIMP_MIDTONES][g_n]);
       g_n = CLAMP0255 (g_n);
-      g_n += cb->magenta_green[GIMP_HIGHLIGHTS] * magenta_green_transfer[GIMP_HIGHLIGHTS][g_n];
+
+      g_n += (cb->magenta_green[GIMP_HIGHLIGHTS] *
+              magenta_green_transfer[GIMP_HIGHLIGHTS][g_n]);
       g_n = CLAMP0255 (g_n);
 
-      b_n += cb->yellow_blue[GIMP_SHADOWS] * yellow_blue_transfer[GIMP_SHADOWS][b_n];
+      b_n += (cb->yellow_blue[GIMP_SHADOWS] *
+              yellow_blue_transfer[GIMP_SHADOWS][b_n]);
       b_n = CLAMP0255 (b_n);
-      b_n += cb->yellow_blue[GIMP_MIDTONES] * yellow_blue_transfer[GIMP_MIDTONES][b_n];
+
+      b_n += (cb->yellow_blue[GIMP_MIDTONES] *
+              yellow_blue_transfer[GIMP_MIDTONES][b_n]);
       b_n = CLAMP0255 (b_n);
-      b_n += cb->yellow_blue[GIMP_HIGHLIGHTS] * yellow_blue_transfer[GIMP_HIGHLIGHTS][b_n];
+
+      b_n += (cb->yellow_blue[GIMP_HIGHLIGHTS] *
+              yellow_blue_transfer[GIMP_HIGHLIGHTS][b_n]);
       b_n = CLAMP0255 (b_n);
 
       cb->r_lookup[i] = r_n;

Modified: branches/soc-2008-text/app/base/gimphistogram.c
==============================================================================
--- branches/soc-2008-text/app/base/gimphistogram.c	(original)
+++ branches/soc-2008-text/app/base/gimphistogram.c	Wed Aug  6 20:36:18 2008
@@ -102,6 +102,39 @@
     }
 }
 
+/**
+ * gimp_histogram_duplicate:
+ * @histogram: a %GimpHistogram
+ *
+ * Creates a duplicate of @histogram. The duplicate has a reference
+ * count of 1 and contains the values from @histogram.
+ *
+ * Return value: a newly allocated %GimpHistogram
+ **/
+GimpHistogram *
+gimp_histogram_duplicate (GimpHistogram *histogram)
+{
+  GimpHistogram *dup;
+
+  g_return_val_if_fail (histogram != NULL, NULL);
+
+  dup = gimp_histogram_new ();
+
+#ifdef ENABLE_MP
+  g_static_mutex_lock (&histogram->mutex);
+#endif
+
+  dup->n_channels = histogram->n_channels;
+  dup->values[0]  = g_memdup (histogram->values[0],
+                              sizeof (gdouble) * dup->n_channels * 256);
+
+#ifdef ENABLE_MP
+  g_static_mutex_unlock (&histogram->mutex);
+#endif
+
+  return dup;
+}
+
 void
 gimp_histogram_calculate (GimpHistogram *histogram,
                           PixelRegion   *region,

Modified: branches/soc-2008-text/app/base/gimphistogram.h
==============================================================================
--- branches/soc-2008-text/app/base/gimphistogram.h	(original)
+++ branches/soc-2008-text/app/base/gimphistogram.h	Wed Aug  6 20:36:18 2008
@@ -23,9 +23,12 @@
 
 
 GimpHistogram * gimp_histogram_new           (void);
+
 GimpHistogram * gimp_histogram_ref           (GimpHistogram        *histogram);
 void            gimp_histogram_unref         (GimpHistogram        *histogram);
 
+GimpHistogram * gimp_histogram_duplicate     (GimpHistogram        *histogram);
+
 void            gimp_histogram_calculate     (GimpHistogram        *histogram,
                                               PixelRegion          *region,
                                               PixelRegion          *mask);

Modified: branches/soc-2008-text/app/base/tile-manager.h
==============================================================================
--- branches/soc-2008-text/app/base/tile-manager.h	(original)
+++ branches/soc-2008-text/app/base/tile-manager.h	Wed Aug  6 20:36:18 2008
@@ -26,15 +26,7 @@
 GType         gimp_tile_manager_get_type     (void) G_GNUC_CONST;
 
 
-/* Creates a new tile manager with the specified width for the
- *  toplevel. The toplevel size is used to compute the number of
- *  levels and their size. Each level is 1/2 the width and height of
- *  the level above it.
- *
- * The toplevel is level 0. The smallest level in the hierarchy
- *  is "nlevels - 1". That level will be smaller than TILE_WIDTH x
- *  TILE_HEIGHT
- */
+/* Creates a new tile manager with the specified size */
 TileManager * tile_manager_new               (gint width,
                                               gint height,
                                               gint bpp);

Modified: branches/soc-2008-text/app/base/tile-pyramid.h
==============================================================================
--- branches/soc-2008-text/app/base/tile-pyramid.h	(original)
+++ branches/soc-2008-text/app/base/tile-pyramid.h	Wed Aug  6 20:36:18 2008
@@ -20,6 +20,15 @@
 #define __TILE_PYRAMID_H__
 
 
+/* Creates a new tile pyramid with the specified size for the
+ *  toplevel. The toplevel size is used to compute the number of
+ *  levels and their size. Each level is 1/2 the width and height of
+ *  the level above it.
+ *
+ * The toplevel is level 0. The smallest level in the hierarchy
+ *  is "nlevels - 1". That level will be smaller than TILE_WIDTH x
+ *  TILE_HEIGHT
+ */
 TilePyramid * tile_pyramid_new               (GimpImageType      type,
                                               gint               width,
                                               gint               height);

Modified: branches/soc-2008-text/app/composite/gimp-composite-3dnow-test.c
==============================================================================
--- branches/soc-2008-text/app/composite/gimp-composite-3dnow-test.c	(original)
+++ branches/soc-2008-text/app/composite/gimp-composite-3dnow-test.c	Wed Aug  6 20:36:18 2008
@@ -13,7 +13,7 @@
 #include "gimp-composite-generic.h"
 #include "gimp-composite-3dnow.h"
 
-int
+static int
 gimp_composite_3dnow_test (int iterations, int n_pixels)
 {
 #if defined(COMPILE_3DNOW_IS_OKAY)

Modified: branches/soc-2008-text/app/composite/gimp-composite-altivec-test.c
==============================================================================
--- branches/soc-2008-text/app/composite/gimp-composite-altivec-test.c	(original)
+++ branches/soc-2008-text/app/composite/gimp-composite-altivec-test.c	Wed Aug  6 20:36:18 2008
@@ -13,7 +13,7 @@
 #include "gimp-composite-generic.h"
 #include "gimp-composite-altivec.h"
 
-int
+static int
 gimp_composite_altivec_test (int iterations, int n_pixels)
 {
 #if defined(COMPILE_ALTIVEC_IS_OKAY)

Modified: branches/soc-2008-text/app/composite/gimp-composite-mmx-test.c
==============================================================================
--- branches/soc-2008-text/app/composite/gimp-composite-mmx-test.c	(original)
+++ branches/soc-2008-text/app/composite/gimp-composite-mmx-test.c	Wed Aug  6 20:36:18 2008
@@ -13,7 +13,7 @@
 #include "gimp-composite-generic.h"
 #include "gimp-composite-mmx.h"
 
-int
+static int
 gimp_composite_mmx_test (int iterations, int n_pixels)
 {
 #if defined(COMPILE_MMX_IS_OKAY)

Modified: branches/soc-2008-text/app/composite/gimp-composite-sse-test.c
==============================================================================
--- branches/soc-2008-text/app/composite/gimp-composite-sse-test.c	(original)
+++ branches/soc-2008-text/app/composite/gimp-composite-sse-test.c	Wed Aug  6 20:36:18 2008
@@ -13,7 +13,7 @@
 #include "gimp-composite-generic.h"
 #include "gimp-composite-sse.h"
 
-int
+static int
 gimp_composite_sse_test (int iterations, int n_pixels)
 {
 #if defined(COMPILE_SSE_IS_OKAY)

Modified: branches/soc-2008-text/app/composite/gimp-composite-sse2-test.c
==============================================================================
--- branches/soc-2008-text/app/composite/gimp-composite-sse2-test.c	(original)
+++ branches/soc-2008-text/app/composite/gimp-composite-sse2-test.c	Wed Aug  6 20:36:18 2008
@@ -13,7 +13,7 @@
 #include "gimp-composite-generic.h"
 #include "gimp-composite-sse2.h"
 
-int
+static int
 gimp_composite_sse2_test (int iterations, int n_pixels)
 {
 #if defined(COMPILE_SSE2_IS_OKAY)

Modified: branches/soc-2008-text/app/composite/gimp-composite-test.c
==============================================================================
--- branches/soc-2008-text/app/composite/gimp-composite-test.c	(original)
+++ branches/soc-2008-text/app/composite/gimp-composite-test.c	Wed Aug  6 20:36:18 2008
@@ -12,7 +12,7 @@
 #include "gimp-composite-util.h"
 #include "gimp-composite-generic.h"
 
-int
+static int
 gimp_composite_regression(int iterations, int n_pixels)
 {
   GimpCompositeContext generic_ctx;

Modified: branches/soc-2008-text/app/composite/gimp-composite-vis-test.c
==============================================================================
--- branches/soc-2008-text/app/composite/gimp-composite-vis-test.c	(original)
+++ branches/soc-2008-text/app/composite/gimp-composite-vis-test.c	Wed Aug  6 20:36:18 2008
@@ -13,7 +13,7 @@
 #include "gimp-composite-generic.h"
 #include "gimp-composite-vis.h"
 
-int
+static int
 gimp_composite_vis_test (int iterations, int n_pixels)
 {
 #if defined(COMPILE_VIS_IS_OKAY)

Modified: branches/soc-2008-text/app/core/core-types.h
==============================================================================
--- branches/soc-2008-text/app/core/core-types.h	(original)
+++ branches/soc-2008-text/app/core/core-types.h	Wed Aug  6 20:36:18 2008
@@ -45,11 +45,14 @@
 #define GIMP_COORDS_MAX_WHEEL         1.0
 #define GIMP_COORDS_DEFAULT_WHEEL     0.5
 
-#define GIMP_COORDS_DEFAULT_VALUES  { 0.0, 0.0, \
-                                      GIMP_COORDS_DEFAULT_PRESSURE, \
-                                      GIMP_COORDS_DEFAULT_TILT,     \
-                                      GIMP_COORDS_DEFAULT_TILT,     \
-                                      GIMP_COORDS_DEFAULT_WHEEL }
+#define GIMP_COORDS_DEFAULT_VELOCITY  0.0
+
+#define GIMP_COORDS_DEFAULT_VALUES    { 0.0, 0.0, \
+                                        GIMP_COORDS_DEFAULT_PRESSURE, \
+                                        GIMP_COORDS_DEFAULT_TILT,     \
+                                        GIMP_COORDS_DEFAULT_TILT,     \
+                                        GIMP_COORDS_DEFAULT_WHEEL,    \
+                                        GIMP_COORDS_DEFAULT_VELOCITY }
 
 
 /*  base classes  */
@@ -199,12 +202,7 @@
   gdouble xtilt;
   gdouble ytilt;
   gdouble wheel;
-  gdouble delta_time;
-  gdouble delta_x;
-  gdouble delta_y;
-  gdouble distance;
   gdouble velocity;
-  gdouble random;
 };
 
 

Modified: branches/soc-2008-text/app/core/gimp-user-install.c
==============================================================================
--- branches/soc-2008-text/app/core/gimp-user-install.c	(original)
+++ branches/soc-2008-text/app/core/gimp-user-install.c	Wed Aug  6 20:36:18 2008
@@ -219,11 +219,11 @@
 
           migrate = g_file_test (dir, G_FILE_TEST_IS_DIR);
 
-#ifdef GIMP_UNSTABLE
-          g_printerr ("gimp-user-install: migrating from %s\n", dir);
-#endif
           if (migrate)
             {
+#ifdef GIMP_UNSTABLE
+	      g_printerr ("gimp-user-install: migrating from %s\n", dir);
+#endif
               install->old_major = 2;
               install->old_minor = i;
 

Modified: branches/soc-2008-text/app/core/gimpchannel.c
==============================================================================
--- branches/soc-2008-text/app/core/gimpchannel.c	(original)
+++ branches/soc-2008-text/app/core/gimpchannel.c	Wed Aug  6 20:36:18 2008
@@ -589,15 +589,35 @@
                     GimpInterpolationType  interpolation_type,
                     GimpProgress          *progress)
 {
+  GimpChannel *channel = GIMP_CHANNEL (item);
+
   if (G_TYPE_FROM_INSTANCE (item) == GIMP_TYPE_CHANNEL)
     {
       new_offset_x = 0;
       new_offset_y = 0;
     }
 
-  GIMP_ITEM_CLASS (parent_class)->scale (item, new_width, new_height,
-                                         new_offset_x, new_offset_y,
-                                         interpolation_type, progress);
+  /*  don't waste CPU cycles scaling an empty channel  */
+  if (channel->bounds_known && channel->empty)
+    {
+      GimpDrawable *drawable  = GIMP_DRAWABLE (item);
+      TileManager  *new_tiles = tile_manager_new (new_width, new_height,
+                                                  drawable->bytes);
+
+      gimp_drawable_set_tiles_full (drawable,
+                                    gimp_item_is_attached (item), NULL,
+                                    new_tiles, gimp_drawable_type (drawable),
+                                    new_offset_x, new_offset_y);
+      tile_manager_unref (new_tiles);
+
+      gimp_channel_clear (GIMP_CHANNEL (item), NULL, FALSE);
+    }
+  else
+    {
+      GIMP_ITEM_CLASS (parent_class)->scale (item, new_width, new_height,
+                                             new_offset_x, new_offset_y,
+                                             interpolation_type, progress);
+    }
 }
 
 static void
@@ -712,6 +732,7 @@
 
         retval = gimp_paint_core_stroke_boundary (core, drawable,
                                                   stroke_desc->paint_options,
+                                                  stroke_desc->emulate_dynamics,
                                                   segs_in, n_segs_in,
                                                   offset_x, offset_y,
                                                   error);
@@ -1188,7 +1209,7 @@
       gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (channel));
     }
 
-  if (channel->bounds_known && !channel->empty)
+  if (channel->bounds_known && ! channel->empty)
     {
       pixel_region_init (&maskPR,
                          gimp_drawable_get_tiles (GIMP_DRAWABLE (channel)),

Modified: branches/soc-2008-text/app/core/gimpcoords.c
==============================================================================
--- branches/soc-2008-text/app/core/gimpcoords.c	(original)
+++ branches/soc-2008-text/app/core/gimpcoords.c	Wed Aug  6 20:36:18 2008
@@ -44,12 +44,13 @@
 {
   if (b)
     {
-      ret_val->x        = amul * a->x        + bmul * b->x ;
-      ret_val->y        = amul * a->y        + bmul * b->y ;
-      ret_val->pressure = amul * a->pressure + bmul * b->pressure ;
-      ret_val->xtilt    = amul * a->xtilt    + bmul * b->xtilt ;
-      ret_val->ytilt    = amul * a->ytilt    + bmul * b->ytilt ;
-      ret_val->wheel    = amul * a->wheel    + bmul * b->wheel ;
+      ret_val->x        = amul * a->x        + bmul * b->x;
+      ret_val->y        = amul * a->y        + bmul * b->y;
+      ret_val->pressure = amul * a->pressure + bmul * b->pressure;
+      ret_val->xtilt    = amul * a->xtilt    + bmul * b->xtilt;
+      ret_val->ytilt    = amul * a->ytilt    + bmul * b->ytilt;
+      ret_val->wheel    = amul * a->wheel    + bmul * b->wheel;
+      ret_val->velocity = amul * a->velocity + bmul * b->velocity;
     }
   else
     {
@@ -59,6 +60,7 @@
       ret_val->xtilt    = amul * a->xtilt;
       ret_val->ytilt    = amul * a->ytilt;
       ret_val->wheel    = amul * a->wheel;
+      ret_val->velocity = amul * a->velocity;
     }
 }
 
@@ -118,7 +120,8 @@
           a->pressure * b->pressure +
           a->xtilt    * b->xtilt    +
           a->ytilt    * b->ytilt    +
-          a->wheel    * b->wheel   );
+          a->wheel    * b->wheel    +
+          a->velocity * a->velocity);
 }
 
 
@@ -139,6 +142,7 @@
   upscaled_a.xtilt    = a->xtilt    * INPUT_RESOLUTION;
   upscaled_a.ytilt    = a->ytilt    * INPUT_RESOLUTION;
   upscaled_a.wheel    = a->wheel    * INPUT_RESOLUTION;
+  upscaled_a.velocity = a->velocity * INPUT_RESOLUTION;
 
   return gimp_coords_scalarprod (&upscaled_a, &upscaled_a);
 }
@@ -165,6 +169,7 @@
   dist += ABS (a->xtilt - b->xtilt);
   dist += ABS (a->ytilt - b->ytilt);
   dist += ABS (a->wheel - b->wheel);
+  dist += ABS (a->velocity - b->velocity);
 
   dist *= INPUT_RESOLUTION;
 
@@ -183,5 +188,6 @@
           a->pressure == b->pressure &&
              a->xtilt == b->xtilt    &&
              a->ytilt == b->ytilt    &&
-             a->wheel == b->wheel);
+             a->wheel == b->wheel    &&
+          a->velocity == b->velocity);
 }

Modified: branches/soc-2008-text/app/core/gimpdata.c
==============================================================================
--- branches/soc-2008-text/app/core/gimpdata.c	(original)
+++ branches/soc-2008-text/app/core/gimpdata.c	Wed Aug  6 20:36:18 2008
@@ -728,26 +728,31 @@
 }
 
 /**
- * gimp_data_name_compare:
+ * gimp_data_compare:
  * @data1: a #GimpData object.
  * @data2: another #GimpData object.
  *
- * Compares the names of the two objects for use in sorting; see
- * gimp_object_name_collate() for the method.  Objects marked as
- * "internal" are considered to come before any objects that are not.
+ * Compares two data objects for use in sorting. Objects marked as
+ * "internal" come first, then user-writable objects, then system data
+ * files. In these three groups, the objects are sorted alphabetically
+ * by name, using gimp_object_name_collate().
  *
  * Return value: -1 if @data1 compares before @data2,
  *                0 if they compare equal,
  *                1 if @data1 compares after @data2.
  **/
 gint
-gimp_data_name_compare (GimpData *data1,
-                        GimpData *data2)
+gimp_data_compare (GimpData *data1,
+		   GimpData *data2)
 {
   /*  move the internal objects (like the FG -> BG) gradient) to the top  */
   if (data1->internal != data2->internal)
     return data1->internal ? -1 : 1;
 
+  /*  keep user-writable objects about system resource files  */
+  if (data1->writable != data2->writable)
+    return data1->writable ? -1 : 1;
+
   return gimp_object_name_collate ((GimpObject *) data1,
                                    (GimpObject *) data2);
 }

Modified: branches/soc-2008-text/app/core/gimpdata.h
==============================================================================
--- branches/soc-2008-text/app/core/gimpdata.h	(original)
+++ branches/soc-2008-text/app/core/gimpdata.h	Wed Aug  6 20:36:18 2008
@@ -104,6 +104,8 @@
 
 void          gimp_data_make_internal    (GimpData     *data);
 
+gint          gimp_data_compare          (GimpData     *data1,
+                                          GimpData     *data2);
 gint          gimp_data_name_compare     (GimpData     *data1,
                                           GimpData     *data2);
 

Modified: branches/soc-2008-text/app/core/gimpdatafactory.c
==============================================================================
--- branches/soc-2008-text/app/core/gimpdatafactory.c	(original)
+++ branches/soc-2008-text/app/core/gimpdatafactory.c	Wed Aug  6 20:36:18 2008
@@ -137,7 +137,7 @@
                        const GimpDataFactoryLoaderEntry *loader_entries,
                        gint                              n_loader_entries,
                        GimpDataNewFunc                   new_func,
-                       GimpDataGetStandardFunc           standard_func)
+                       GimpDataGetStandardFunc           get_standard_func)
 {
   GimpDataFactory *factory;
 
@@ -153,7 +153,7 @@
   factory->gimp                   = gimp;
   factory->container              = gimp_list_new (data_type, TRUE);
   gimp_list_set_sort_func (GIMP_LIST (factory->container),
-                           (GCompareFunc) gimp_data_name_compare);
+			   (GCompareFunc) gimp_data_compare);
 
   factory->path_property_name     = g_strdup (path_property_name);
   factory->writable_property_name = g_strdup (writable_property_name);
@@ -162,7 +162,7 @@
   factory->n_loader_entries       = n_loader_entries;
 
   factory->data_new_func          = new_func;
-  factory->data_get_standard_func = standard_func;
+  factory->data_get_standard_func = get_standard_func;
 
   return factory;
 }

Modified: branches/soc-2008-text/app/core/gimpdatafactory.h
==============================================================================
--- branches/soc-2008-text/app/core/gimpdatafactory.h	(original)
+++ branches/soc-2008-text/app/core/gimpdatafactory.h	Wed Aug  6 20:36:18 2008
@@ -84,7 +84,7 @@
                                               const GimpDataFactoryLoaderEntry *loader_entries,
                                               gint                              n_loader_entries,
                                               GimpDataNewFunc                   new_func,
-                                              GimpDataGetStandardFunc           standard_func);
+                                              GimpDataGetStandardFunc           get_standard_func);
 
 void       gimp_data_factory_data_init         (GimpDataFactory  *factory,
                                                 gboolean          no_data);

Modified: branches/soc-2008-text/app/core/gimpgrid.c
==============================================================================
--- branches/soc-2008-text/app/core/gimpgrid.c	(original)
+++ branches/soc-2008-text/app/core/gimpgrid.c	Wed Aug  6 20:36:18 2008
@@ -83,7 +83,7 @@
                                  "style",
                                  N_("Line style used for the grid."),
                                  GIMP_TYPE_GRID_STYLE,
-                                 GIMP_GRID_INTERSECTIONS,
+                                 GIMP_GRID_SOLID,
                                  GIMP_PARAM_STATIC_STRINGS);
   GIMP_CONFIG_INSTALL_PROP_RGB (object_class, PROP_FGCOLOR,
                                 "fgcolor",
@@ -99,12 +99,12 @@
   GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_XSPACING,
                                    "xspacing",
                                    N_("Horizontal spacing of grid lines."),
-                                   1.0, GIMP_MAX_IMAGE_SIZE, 32.0,
+                                   1.0, GIMP_MAX_IMAGE_SIZE, 10.0,
                                    GIMP_PARAM_STATIC_STRINGS);
   GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_YSPACING,
                                    "yspacing",
                                    N_("Vertical spacing of grid lines."),
-                                   1.0, GIMP_MAX_IMAGE_SIZE, 32.0,
+                                   1.0, GIMP_MAX_IMAGE_SIZE, 10.0,
                                    GIMP_PARAM_STATIC_STRINGS);
   GIMP_CONFIG_INSTALL_PROP_UNIT (object_class, PROP_SPACING_UNIT,
                                  "spacing-unit", NULL,

Modified: branches/soc-2008-text/app/core/gimpguideundo.c
==============================================================================
--- branches/soc-2008-text/app/core/gimpguideundo.c	(original)
+++ branches/soc-2008-text/app/core/gimpguideundo.c	Wed Aug  6 20:36:18 2008
@@ -115,7 +115,7 @@
   switch (property_id)
     {
     case PROP_GUIDE:
-      guide_undo->guide = (GimpGuide *) g_value_dup_object (value);
+      guide_undo->guide = g_value_dup_object (value);
       break;
 
     default:

Modified: branches/soc-2008-text/app/core/gimpimage-crop.c
==============================================================================
--- branches/soc-2008-text/app/core/gimpimage-crop.c	(original)
+++ branches/soc-2008-text/app/core/gimpimage-crop.c	Wed Aug  6 20:36:18 2008
@@ -129,7 +129,7 @@
                                      _("Resize Image"));
 
       /*  Push the image size to the stack  */
-      gimp_image_undo_push_image_size (image, NULL);
+      gimp_image_undo_push_image_size (image, NULL, x1, y1);
 
       /*  Set the new width and height  */
       g_object_set (image,
@@ -267,7 +267,8 @@
                          gimp_image_get_width  (image),
                          gimp_image_get_height (image));
 
-      gimp_viewable_size_changed (GIMP_VIEWABLE (image));
+      gimp_image_size_changed_detailed (image, -x1, -y1);
+
       g_object_thaw_notify (G_OBJECT (image));
     }
 

Modified: branches/soc-2008-text/app/core/gimpimage-resize.c
==============================================================================
--- branches/soc-2008-text/app/core/gimpimage-resize.c	(original)
+++ branches/soc-2008-text/app/core/gimpimage-resize.c	Wed Aug  6 20:36:18 2008
@@ -97,7 +97,7 @@
   old_height = gimp_image_get_height (image);
 
   /*  Push the image size to the stack  */
-  gimp_image_undo_push_image_size (image, NULL);
+  gimp_image_undo_push_image_size (image, NULL, -offset_x, -offset_y);
 
   /*  Set the new width and height  */
   g_object_set (image,
@@ -220,7 +220,8 @@
 
   gimp_image_undo_group_end (image);
 
-  gimp_viewable_size_changed (GIMP_VIEWABLE (image));
+  gimp_image_size_changed_detailed (image, offset_x, offset_y);
+
   g_object_thaw_notify (G_OBJECT (image));
 
   gimp_unset_busy (image->gimp);

Modified: branches/soc-2008-text/app/core/gimpimage-rotate.c
==============================================================================
--- branches/soc-2008-text/app/core/gimpimage-rotate.c	(original)
+++ branches/soc-2008-text/app/core/gimpimage-rotate.c	Wed Aug  6 20:36:18 2008
@@ -61,6 +61,8 @@
   gdouble   progress_current = 1.0;
   gint      new_image_width;
   gint      new_image_height;
+  gint      offset_x;
+  gint      offset_y;
   gboolean  size_changed;
 
   g_return_if_fail (GIMP_IS_IMAGE (image));
@@ -89,13 +91,17 @@
       new_image_width  = gimp_image_get_height (image);
       new_image_height = gimp_image_get_width  (image);
       size_changed     = TRUE;
+      offset_x         = (gimp_image_get_width  (image) - new_image_width)  / 2;
+      offset_y         = (gimp_image_get_height (image) - new_image_height) / 2;
       break;
 
     case GIMP_ROTATE_180:
       new_image_width  = gimp_image_get_width  (image);
       new_image_height = gimp_image_get_height (image);
       size_changed     = FALSE;
-     break;
+      offset_x         = 0;
+      offset_y         = 0;
+      break;
 
     default:
       g_assert_not_reached ();
@@ -186,7 +192,7 @@
       gdouble xres;
       gdouble yres;
 
-      gimp_image_undo_push_image_size (image, NULL);
+      gimp_image_undo_push_image_size (image, NULL, offset_x, offset_y);
 
       g_object_set (image,
                     "width",  new_image_width,
@@ -202,7 +208,7 @@
   gimp_image_undo_group_end (image);
 
   if (size_changed)
-    gimp_viewable_size_changed (GIMP_VIEWABLE (image));
+    gimp_image_size_changed_detailed (image, -offset_x, -offset_y);
 
   g_object_thaw_notify (G_OBJECT (image));
 

Modified: branches/soc-2008-text/app/core/gimpimage-scale.c
==============================================================================
--- branches/soc-2008-text/app/core/gimpimage-scale.c	(original)
+++ branches/soc-2008-text/app/core/gimpimage-scale.c	Wed Aug  6 20:36:18 2008
@@ -56,6 +56,8 @@
   GList        *remove           = NULL;
   gint          old_width;
   gint          old_height;
+  gint          offset_x;
+  gint          offset_y;
   gdouble       img_scale_w      = 1.0;
   gdouble       img_scale_h      = 1.0;
   gint          progress_steps;
@@ -79,14 +81,17 @@
   gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_IMAGE_SCALE,
                                _("Scale Image"));
 
-  /*  Push the image size to the stack  */
-  gimp_image_undo_push_image_size (image, NULL);
-
   old_width   = gimp_image_get_width  (image);
   old_height  = gimp_image_get_height (image);
   img_scale_w = (gdouble) new_width  / (gdouble) old_width;
   img_scale_h = (gdouble) new_height / (gdouble) old_height;
 
+  offset_x = (old_width  - new_width)  / 2;
+  offset_y = (old_height - new_height) / 2;
+
+  /*  Push the image size to the stack  */
+  gimp_image_undo_push_image_size (image, NULL, offset_x, offset_y);
+
   /*  Set the new width and height  */
   g_object_set (image,
                 "width",  new_width,
@@ -192,7 +197,9 @@
     }
 
   /*  Scale all sample points  */
-  for (list = gimp_image_get_sample_points (image); list; list = g_list_next (list))
+  for (list = gimp_image_get_sample_points (image);
+       list;
+       list = g_list_next (list))
     {
       GimpSamplePoint *sample_point = list->data;
 
@@ -205,7 +212,8 @@
 
   g_object_unref (sub_progress);
 
-  gimp_viewable_size_changed (GIMP_VIEWABLE (image));
+  gimp_image_size_changed_detailed (image, -offset_x, -offset_y);
+
   g_object_thaw_notify (G_OBJECT (image));
 
   gimp_unset_busy (image->gimp);

Modified: branches/soc-2008-text/app/core/gimpimage-undo-push.c
==============================================================================
--- branches/soc-2008-text/app/core/gimpimage-undo-push.c	(original)
+++ branches/soc-2008-text/app/core/gimpimage-undo-push.c	Wed Aug  6 20:36:18 2008
@@ -80,13 +80,17 @@
 
 GimpUndo *
 gimp_image_undo_push_image_size (GimpImage   *image,
-                                 const gchar *undo_desc)
+                                 const gchar *undo_desc,
+                                 gint         previous_origin_x,
+                                 gint         previous_origin_y)
 {
   g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
 
   return gimp_image_undo_push (image, GIMP_TYPE_IMAGE_UNDO,
                                GIMP_UNDO_IMAGE_SIZE, undo_desc,
                                GIMP_DIRTY_IMAGE | GIMP_DIRTY_IMAGE_SIZE,
+                               "previous-origin-x", previous_origin_x,
+                               "previous-origin-y", previous_origin_y,
                                NULL);
 }
 

Modified: branches/soc-2008-text/app/core/gimpimage-undo-push.h
==============================================================================
--- branches/soc-2008-text/app/core/gimpimage-undo-push.h	(original)
+++ branches/soc-2008-text/app/core/gimpimage-undo-push.h	Wed Aug  6 20:36:18 2008
@@ -25,7 +25,9 @@
 GimpUndo * gimp_image_undo_push_image_type          (GimpImage     *image,
                                                      const gchar   *undo_desc);
 GimpUndo * gimp_image_undo_push_image_size          (GimpImage     *image,
-                                                     const gchar   *undo_desc);
+                                                     const gchar   *undo_desc,
+                                                     gint           previous_origin_x,
+                                                     gint           previous_origin_y);
 GimpUndo * gimp_image_undo_push_image_resolution    (GimpImage     *image,
                                                      const gchar   *undo_desc);
 GimpUndo * gimp_image_undo_push_image_grid          (GimpImage     *image,

Modified: branches/soc-2008-text/app/core/gimpimage-undo.c
==============================================================================
--- branches/soc-2008-text/app/core/gimpimage-undo.c	(original)
+++ branches/soc-2008-text/app/core/gimpimage-undo.c	Wed Aug  6 20:36:18 2008
@@ -381,7 +381,9 @@
         gimp_image_mode_changed (image);
 
       if (accum.size_changed)
-        gimp_viewable_size_changed (GIMP_VIEWABLE (image));
+        gimp_image_size_changed_detailed (image,
+                                          accum.previous_origin_x,
+                                          accum.previous_origin_y);
 
       if (accum.resolution_changed)
         gimp_image_resolution_changed (image);

Modified: branches/soc-2008-text/app/core/gimpimage.c
==============================================================================
--- branches/soc-2008-text/app/core/gimpimage.c	(original)
+++ branches/soc-2008-text/app/core/gimpimage.c	Wed Aug  6 20:36:18 2008
@@ -88,6 +88,7 @@
   COMPONENT_ACTIVE_CHANGED,
   MASK_CHANGED,
   RESOLUTION_CHANGED,
+  SIZE_CHANGED_DETAILED,
   UNIT_CHANGED,
   QUICK_MASK_CHANGED,
   SELECTION_CONTROL,
@@ -147,6 +148,10 @@
 static void     gimp_image_size_changed          (GimpViewable   *viewable);
 static gchar  * gimp_image_get_description       (GimpViewable   *viewable,
                                                   gchar         **tooltip);
+static void     gimp_image_real_size_changed_detailed
+                                                 (GimpImage      *image,
+                                                  gint            previous_origin_x,
+                                                  gint            previous_origin_y);
 static void     gimp_image_real_colormap_changed (GimpImage      *image,
                                                   gint            color_index);
 static void     gimp_image_real_flush            (GimpImage      *image,
@@ -314,6 +319,17 @@
                   gimp_marshal_VOID__VOID,
                   G_TYPE_NONE, 0);
 
+  gimp_image_signals[SIZE_CHANGED_DETAILED] =
+    g_signal_new ("size-changed-detailed",
+                  G_TYPE_FROM_CLASS (klass),
+                  G_SIGNAL_RUN_FIRST,
+                  G_STRUCT_OFFSET (GimpImageClass, size_changed_detailed),
+                  NULL, NULL,
+                  gimp_marshal_VOID__INT_INT,
+                  G_TYPE_NONE, 2,
+                  G_TYPE_INT,
+                  G_TYPE_INT);
+
   gimp_image_signals[UNIT_CHANGED] =
     g_signal_new ("unit-changed",
                   G_TYPE_FROM_CLASS (klass),
@@ -504,6 +520,11 @@
   klass->component_visibility_changed = NULL;
   klass->component_active_changed     = NULL;
   klass->mask_changed                 = NULL;
+  klass->resolution_changed           = NULL;
+  klass->size_changed_detailed        = gimp_image_real_size_changed_detailed;
+  klass->unit_changed                 = NULL;
+  klass->quick_mask_changed           = NULL;
+  klass->selection_control            = NULL;
 
   klass->clean                        = NULL;
   klass->dirty                        = NULL;
@@ -1099,6 +1120,18 @@
 }
 
 static void
+gimp_image_real_size_changed_detailed (GimpImage *image,
+                                       gint       previous_origin_x,
+                                       gint       previous_origin_y)
+{
+  /* Whenever GimpImage::size-changed-detailed is emitted, so is
+   * GimpViewable::size-changed. Clients choose what signal to listen
+   * to depending on how much info they need.
+   */
+  gimp_viewable_size_changed (GIMP_VIEWABLE (image));
+}
+
+static void
 gimp_image_real_colormap_changed (GimpImage *image,
                                   gint       color_index)
 {
@@ -1470,7 +1503,7 @@
       image->yresolution = yresolution;
 
       gimp_image_resolution_changed (image);
-      gimp_viewable_size_changed (GIMP_VIEWABLE (image));
+      gimp_image_size_changed_detailed (image, 0, 0);
     }
 }
 
@@ -1793,6 +1826,30 @@
                  sample_point);
 }
 
+/**
+ * gimp_image_size_changed_detailed:
+ * @image:
+ * @previous_origin_x:
+ * @previous_origin_y:
+ *
+ * Emits the size-changed-detailed signal that is typically used to adjust the
+ * position of the image in the display shell on various operations,
+ * e.g. crop.
+ *
+ * This function makes sure that GimpViewable::size-changed is also emitted.
+ **/
+void
+gimp_image_size_changed_detailed (GimpImage *image,
+                                  gint       previous_origin_x,
+                                  gint       previous_origin_y)
+{
+  g_return_if_fail (GIMP_IS_IMAGE (image));
+
+  g_signal_emit (image, gimp_image_signals[SIZE_CHANGED_DETAILED], 0,
+                 previous_origin_x,
+                 previous_origin_y);
+}
+
 void
 gimp_image_colormap_changed (GimpImage *image,
                              gint       color_index)

Modified: branches/soc-2008-text/app/core/gimpimage.h
==============================================================================
--- branches/soc-2008-text/app/core/gimpimage.h	(original)
+++ branches/soc-2008-text/app/core/gimpimage.h	Wed Aug  6 20:36:18 2008
@@ -191,6 +191,9 @@
                                          GimpChannelType       channel);
   void (* mask_changed)                 (GimpImage            *image);
   void (* resolution_changed)           (GimpImage            *image);
+  void (* size_changed_detailed)        (GimpImage            *image,
+                                         gint                  previous_origin_x,
+                                         gint                  previous_origin_y);
   void (* unit_changed)                 (GimpImage            *image);
   void (* quick_mask_changed)           (GimpImage            *image);
   void (* selection_control)            (GimpImage            *image,
@@ -324,6 +327,9 @@
 void            gimp_image_selection_control     (GimpImage          *image,
                                                   GimpSelectionControl  control);
 void            gimp_image_quick_mask_changed    (GimpImage          *image);
+void            gimp_image_size_changed_detailed (GimpImage          *image,
+                                                  gint                previous_origin_x,
+                                                  gint                previous_origin_y);
 
 
 /*  undo  */

Modified: branches/soc-2008-text/app/core/gimpimagemapconfig.c
==============================================================================
--- branches/soc-2008-text/app/core/gimpimagemapconfig.c	(original)
+++ branches/soc-2008-text/app/core/gimpimagemapconfig.c	Wed Aug  6 20:36:18 2008
@@ -148,7 +148,7 @@
     {
       return -1;
     }
-  else if (b->time)
+  else if (b->time > 0)
     {
       return 1;
     }

Modified: branches/soc-2008-text/app/core/gimpimageundo.c
==============================================================================
--- branches/soc-2008-text/app/core/gimpimageundo.c	(original)
+++ branches/soc-2008-text/app/core/gimpimageundo.c	Wed Aug  6 20:36:18 2008
@@ -41,6 +41,8 @@
 enum
 {
   PROP_0,
+  PROP_PREVIOUS_ORIGIN_X,
+  PROP_PREVIOUS_ORIGIN_Y,
   PROP_GRID,
   PROP_PARASITE_NAME
 };
@@ -89,6 +91,22 @@
   undo_class->pop                = gimp_image_undo_pop;
   undo_class->free               = gimp_image_undo_free;
 
+  g_object_class_install_property (object_class, PROP_PREVIOUS_ORIGIN_X,
+                                   g_param_spec_int ("previous-origin-x",
+                                                     NULL, NULL,
+                                                     -GIMP_MAX_IMAGE_SIZE,
+                                                     GIMP_MAX_IMAGE_SIZE,
+                                                     0,
+                                                     GIMP_PARAM_READWRITE));
+
+  g_object_class_install_property (object_class, PROP_PREVIOUS_ORIGIN_Y,
+                                   g_param_spec_int ("previous-origin-y",
+                                                     NULL, NULL,
+                                                     -GIMP_MAX_IMAGE_SIZE,
+                                                     GIMP_MAX_IMAGE_SIZE,
+                                                     0,
+                                                     GIMP_PARAM_READWRITE));
+
   g_object_class_install_property (object_class, PROP_GRID,
                                    g_param_spec_object ("grid", NULL, NULL,
                                                         GIMP_TYPE_GRID,
@@ -176,6 +194,12 @@
 
   switch (property_id)
     {
+    case PROP_PREVIOUS_ORIGIN_X:
+      image_undo->previous_origin_x = g_value_get_int (value);
+      break;
+    case PROP_PREVIOUS_ORIGIN_Y:
+      image_undo->previous_origin_y = g_value_get_int (value);
+      break;
     case PROP_GRID:
       {
         GimpGrid *grid = g_value_get_object (value);
@@ -204,6 +228,12 @@
 
   switch (property_id)
     {
+    case PROP_PREVIOUS_ORIGIN_X:
+      g_value_set_int (value, image_undo->previous_origin_x);
+      break;
+    case PROP_PREVIOUS_ORIGIN_Y:
+      g_value_set_int (value, image_undo->previous_origin_y);
+      break;
     case PROP_GRID:
       g_value_set_object (value, image_undo->grid);
        break;
@@ -267,12 +297,19 @@
       {
         gint width;
         gint height;
+        gint previous_origin_x;
+        gint previous_origin_y;
 
-        width  = image_undo->width;
-        height = image_undo->height;
-
-        image_undo->width  = gimp_image_get_width  (image);
-        image_undo->height = gimp_image_get_height (image);
+        width             = image_undo->width;
+        height            = image_undo->height;
+        previous_origin_x = image_undo->previous_origin_x;
+        previous_origin_y = image_undo->previous_origin_y;
+
+        /* Transform to a redo */
+        image_undo->width             = gimp_image_get_width  (image);
+        image_undo->height            = gimp_image_get_height (image);
+        image_undo->previous_origin_x = -previous_origin_x;
+        image_undo->previous_origin_y = -previous_origin_y;
 
         g_object_set (image,
                       "width",  width,
@@ -284,7 +321,11 @@
 
         if (gimp_image_get_width  (image) != image_undo->width ||
             gimp_image_get_height (image) != image_undo->height)
-          accum->size_changed = TRUE;
+          {
+            accum->size_changed      = TRUE;
+            accum->previous_origin_x = previous_origin_x;
+            accum->previous_origin_y = previous_origin_y;
+          }
       }
       break;
 

Modified: branches/soc-2008-text/app/core/gimpimageundo.h
==============================================================================
--- branches/soc-2008-text/app/core/gimpimageundo.h	(original)
+++ branches/soc-2008-text/app/core/gimpimageundo.h	Wed Aug  6 20:36:18 2008
@@ -40,6 +40,8 @@
   GimpImageBaseType  base_type;
   gint               width;
   gint               height;
+  gint               previous_origin_x;
+  gint               previous_origin_y;
   gdouble            xresolution;
   gdouble            yresolution;
   GimpUnit           resolution_unit;

Modified: branches/soc-2008-text/app/core/gimpitemundo.c
==============================================================================
--- branches/soc-2008-text/app/core/gimpitemundo.c	(original)
+++ branches/soc-2008-text/app/core/gimpitemundo.c	Wed Aug  6 20:36:18 2008
@@ -107,8 +107,9 @@
   switch (property_id)
     {
     case PROP_ITEM:
-      item_undo->item = (GimpItem *) g_value_dup_object (value);
+      item_undo->item = g_value_dup_object (value);
       break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;
@@ -128,6 +129,7 @@
     case PROP_ITEM:
       g_value_set_object (value, item_undo->item);
       break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;

Modified: branches/soc-2008-text/app/core/gimplayermaskundo.c
==============================================================================
--- branches/soc-2008-text/app/core/gimplayermaskundo.c	(original)
+++ branches/soc-2008-text/app/core/gimplayermaskundo.c	Wed Aug  6 20:36:18 2008
@@ -119,7 +119,7 @@
   switch (property_id)
     {
     case PROP_LAYER_MASK:
-      layer_mask_undo->layer_mask = (GimpLayerMask *) g_value_dup_object (value);
+      layer_mask_undo->layer_mask = g_value_dup_object (value);
       break;
 
     default:

Modified: branches/soc-2008-text/app/core/gimpmarshal.list
==============================================================================
--- branches/soc-2008-text/app/core/gimpmarshal.list	(original)
+++ branches/soc-2008-text/app/core/gimpmarshal.list	Wed Aug  6 20:36:18 2008
@@ -34,6 +34,7 @@
 VOID: BOXED, ENUM
 VOID: DOUBLE
 VOID: DOUBLE, DOUBLE
+VOID: DOUBLE, DOUBLE, DOUBLE, DOUBLE
 VOID: ENUM
 VOID: ENUM, ENUM, BOXED, INT
 VOID: ENUM, OBJECT

Modified: branches/soc-2008-text/app/core/gimpparamspecs.c
==============================================================================
--- branches/soc-2008-text/app/core/gimpparamspecs.c	(original)
+++ branches/soc-2008-text/app/core/gimpparamspecs.c	Wed Aug  6 20:36:18 2008
@@ -2805,3 +2805,128 @@
 
   g_value_take_boxed (value, array);
 }
+
+
+/*
+ * GIMP_TYPE_COLOR_ARRAY
+ */
+
+GType
+gimp_color_array_get_type (void)
+{
+  static GType type = 0;
+
+  if (! type)
+    type = g_boxed_type_register_static ("GimpColorArray",
+                                         (GBoxedCopyFunc) gimp_array_copy,
+                                         (GBoxedFreeFunc) gimp_array_free);
+
+  return type;
+}
+
+
+/*
+ * GIMP_TYPE_PARAM_COLOR_ARRAY
+ */
+
+static void  gimp_param_color_array_class_init (GParamSpecClass *klass);
+static void  gimp_param_color_array_init       (GParamSpec      *pspec);
+
+GType
+gimp_param_color_array_get_type (void)
+{
+  static GType type = 0;
+
+  if (! type)
+    {
+      const GTypeInfo info =
+      {
+        sizeof (GParamSpecClass),
+        NULL, NULL,
+        (GClassInitFunc) gimp_param_color_array_class_init,
+        NULL, NULL,
+        sizeof (GimpParamSpecArray),
+        0,
+        (GInstanceInitFunc) gimp_param_color_array_init
+      };
+
+      type = g_type_register_static (G_TYPE_PARAM_BOXED,
+                                     "GimpParamColorArray", &info, 0);
+    }
+
+  return type;
+}
+
+static void
+gimp_param_color_array_class_init (GParamSpecClass *klass)
+{
+  klass->value_type = GIMP_TYPE_COLOR_ARRAY;
+}
+
+static void
+gimp_param_color_array_init (GParamSpec *pspec)
+{
+}
+
+GParamSpec *
+gimp_param_spec_color_array (const gchar *name,
+                             const gchar *nick,
+                             const gchar *blurb,
+                             GParamFlags  flags)
+{
+  GimpParamSpecColorArray *array_spec;
+
+  array_spec = g_param_spec_internal (GIMP_TYPE_PARAM_COLOR_ARRAY,
+                                      name, nick, blurb, flags);
+
+  return G_PARAM_SPEC (array_spec);
+}
+
+const GimpRGB *
+gimp_value_get_colorarray (const GValue *value)
+{
+  g_return_val_if_fail (GIMP_VALUE_HOLDS_COLOR_ARRAY (value), NULL);
+
+  return (const GimpRGB *) gimp_value_get_array (value);
+}
+
+GimpRGB *
+gimp_value_dup_colorarray (const GValue *value)
+{
+  g_return_val_if_fail (GIMP_VALUE_HOLDS_COLOR_ARRAY (value), NULL);
+
+  return (GimpRGB *) gimp_value_dup_array (value);
+}
+
+void
+gimp_value_set_colorarray (GValue        *value,
+                           const GimpRGB *data,
+                           gsize         length)
+{
+  g_return_if_fail (GIMP_VALUE_HOLDS_COLOR_ARRAY (value));
+
+  gimp_value_set_array (value, (const guint8 *) data,
+                        length * sizeof (GimpRGB));
+}
+
+void
+gimp_value_set_static_colorarray (GValue        *value,
+                                  const GimpRGB *data,
+                                  gsize          length)
+{
+  g_return_if_fail (GIMP_VALUE_HOLDS_COLOR_ARRAY (value));
+
+  gimp_value_set_static_array (value, (const guint8 *) data,
+                               length * sizeof (GimpRGB));
+}
+
+void
+gimp_value_take_colorarray (GValue  *value,
+                            GimpRGB *data,
+                            gsize    length)
+{
+  g_return_if_fail (GIMP_VALUE_HOLDS_COLOR_ARRAY (value));
+
+  gimp_value_take_array (value, (guint8 *) data,
+                         length * sizeof (GimpRGB));
+}

Modified: branches/soc-2008-text/app/core/gimpparamspecs.h
==============================================================================
--- branches/soc-2008-text/app/core/gimpparamspecs.h	(original)
+++ branches/soc-2008-text/app/core/gimpparamspecs.h	Wed Aug  6 20:36:18 2008
@@ -859,4 +859,49 @@
                                                   gsize         length);
 
 
+/*
+ * GIMP_TYPE_COLOR_ARRAY
+ */
+
+#define GIMP_TYPE_COLOR_ARRAY               (gimp_color_array_get_type ())
+#define GIMP_VALUE_HOLDS_COLOR_ARRAY(value) (G_TYPE_CHECK_VALUE_TYPE ((value), GIMP_TYPE_COLOR_ARRAY))
+
+GType   gimp_color_array_get_type           (void) G_GNUC_CONST;
+
+
+/*
+ * GIMP_TYPE_PARAM_COLOR_ARRAY
+ */
+
+#define GIMP_TYPE_PARAM_COLOR_ARRAY           (gimp_param_color_array_get_type ())
+#define GIMP_PARAM_SPEC_COLOR_ARRAY(pspec)    (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GIMP_TYPE_PARAM_COLOR_ARRAY, GimpParamSpecColorArray))
+#define GIMP_IS_PARAM_SPEC_COLOR_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_COLOR_ARRAY))
+
+typedef struct _GimpParamSpecColorArray GimpParamSpecColorArray;
+
+struct _GimpParamSpecColorArray
+{
+  GParamSpecBoxed parent_instance;
+};
+
+GType           gimp_param_color_array_get_type  (void) G_GNUC_CONST;
+
+GParamSpec    * gimp_param_spec_color_array      (const gchar   *name,
+                                                  const gchar   *nick,
+                                                  const gchar   *blurb,
+                                                  GParamFlags    flags);
+
+const GimpRGB * gimp_value_get_colorarray        (const GValue  *value);
+GimpRGB       * gimp_value_dup_colorarray        (const GValue  *value);
+void            gimp_value_set_colorarray        (GValue        *value,
+                                                  const GimpRGB *array,
+                                                  gsize          length);
+void            gimp_value_set_static_colorarray (GValue        *value,
+                                                  const GimpRGB *array,
+                                                  gsize          length);
+void            gimp_value_take_colorarray       (GValue        *value,
+                                                  GimpRGB       *array,
+                                                  gsize          length);
+
+
 #endif  /*  __GIMP_PARAM_SPECS_H__  */

Modified: branches/soc-2008-text/app/core/gimppdbprogress.c
==============================================================================
--- branches/soc-2008-text/app/core/gimppdbprogress.c	(original)
+++ branches/soc-2008-text/app/core/gimppdbprogress.c	Wed Aug  6 20:36:18 2008
@@ -237,13 +237,13 @@
     case PROP_PDB:
       if (progress->pdb)
         g_object_unref (progress->pdb);
-      progress->pdb = GIMP_PDB (g_value_dup_object (value));
+      progress->pdb = g_value_dup_object (value);
       break;
 
     case PROP_CONTEXT:
       if (progress->context)
         g_object_unref (progress->context);
-      progress->context = GIMP_CONTEXT (g_value_dup_object (value));
+      progress->context = g_value_dup_object (value);
       break;
 
     case PROP_CALLBACK_NAME:

Modified: branches/soc-2008-text/app/core/gimpscanconvert.c
==============================================================================
--- branches/soc-2008-text/app/core/gimpscanconvert.c	(original)
+++ branches/soc-2008-text/app/core/gimpscanconvert.c	Wed Aug  6 20:36:18 2008
@@ -22,7 +22,7 @@
 
 #include <glib-object.h>
 
-#include <cairo/cairo.h>
+#include <cairo.h>
 
 #include "libgimpbase/gimpbase.h"
 #include "libgimpmath/gimpmath.h"

Modified: branches/soc-2008-text/app/core/gimpstrokedesc.c
==============================================================================
--- branches/soc-2008-text/app/core/gimpstrokedesc.c	(original)
+++ branches/soc-2008-text/app/core/gimpstrokedesc.c	Wed Aug  6 20:36:18 2008
@@ -47,6 +47,7 @@
   PROP_METHOD,
   PROP_STROKE_OPTIONS,
   PROP_PAINT_INFO,
+  PROP_EMULATE_DYNAMICS,
   PROP_PAINT_OPTIONS
 };
 
@@ -109,6 +110,10 @@
                                    "paint-info", NULL,
                                    GIMP_TYPE_PAINT_INFO,
                                    GIMP_PARAM_STATIC_STRINGS);
+  GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_EMULATE_DYNAMICS,
+                                    "emulate-brush-dynamics", NULL,
+                                    FALSE,
+                                    GIMP_PARAM_STATIC_STRINGS);
   GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_PAINT_OPTIONS,
                                    "paint-options", NULL,
                                    GIMP_TYPE_PAINT_OPTIONS,
@@ -189,23 +194,31 @@
     case PROP_GIMP:
       desc->gimp = g_value_get_object (value);
       break;
+
     case PROP_METHOD:
       desc->method = g_value_get_enum (value);
       break;
+
     case PROP_STROKE_OPTIONS:
       if (g_value_get_object (value))
         gimp_config_sync (g_value_get_object (value),
                           G_OBJECT (desc->stroke_options), 0);
       break;
+
     case PROP_PAINT_INFO:
       if (desc->paint_info)
         g_object_unref (desc->paint_info);
-      desc->paint_info = (GimpPaintInfo *) g_value_dup_object (value);
+      desc->paint_info = g_value_dup_object (value);
       break;
+
+    case PROP_EMULATE_DYNAMICS:
+      desc->emulate_dynamics = g_value_get_boolean (value);
+      break;
+
     case PROP_PAINT_OPTIONS:
       if (desc->paint_options)
         g_object_unref (desc->paint_options);
-      desc->paint_options = (GimpPaintOptions *) g_value_dup_object (value);
+      desc->paint_options = g_value_dup_object (value);
       break;
 
     default:
@@ -227,15 +240,23 @@
     case PROP_GIMP:
       g_value_set_object (value, desc->gimp);
       break;
+
     case PROP_METHOD:
       g_value_set_enum (value, desc->method);
       break;
+
     case PROP_STROKE_OPTIONS:
       g_value_set_object (value, desc->stroke_options);
       break;
+
     case PROP_PAINT_INFO:
       g_value_set_object (value, desc->paint_info);
       break;
+
+    case PROP_EMULATE_DYNAMICS:
+      g_value_set_boolean (value, desc->emulate_dynamics);
+      break;
+
     case PROP_PAINT_OPTIONS:
       g_value_set_object (value, desc->paint_options);
       break;

Modified: branches/soc-2008-text/app/core/gimpstrokedesc.h
==============================================================================
--- branches/soc-2008-text/app/core/gimpstrokedesc.h	(original)
+++ branches/soc-2008-text/app/core/gimpstrokedesc.h	Wed Aug  6 20:36:18 2008
@@ -46,13 +46,14 @@
 
   GimpStrokeOptions *stroke_options;
   GimpPaintInfo     *paint_info;
+  gboolean           emulate_dynamics;
 
   GimpPaintOptions  *paint_options;
 };
 
 struct _GimpStrokeDescClass
 {
-  GimpObjectClass parent_class;
+  GimpObjectClass    parent_class;
 };
 
 

Modified: branches/soc-2008-text/app/core/gimptooloptions.c
==============================================================================
--- branches/soc-2008-text/app/core/gimptooloptions.c	(original)
+++ branches/soc-2008-text/app/core/gimptooloptions.c	Wed Aug  6 20:36:18 2008
@@ -106,7 +106,7 @@
                           options->tool_info == tool_info);
 
         if (! options->tool_info)
-          options->tool_info = GIMP_TOOL_INFO (g_value_dup_object (value));
+          options->tool_info = g_value_dup_object (value);
       }
       break;
 

Modified: branches/soc-2008-text/app/core/gimptoolpresets.c
==============================================================================
--- branches/soc-2008-text/app/core/gimptoolpresets.c	(original)
+++ branches/soc-2008-text/app/core/gimptoolpresets.c	Wed Aug  6 20:36:18 2008
@@ -139,7 +139,7 @@
   switch (property_id)
     {
     case PROP_TOOL_INFO:
-      presets->tool_info = GIMP_TOOL_INFO (g_value_dup_object (value));
+      presets->tool_info = g_value_dup_object (value);
       break;
 
     default:

Modified: branches/soc-2008-text/app/core/gimpundo.h
==============================================================================
--- branches/soc-2008-text/app/core/gimpundo.h	(original)
+++ branches/soc-2008-text/app/core/gimpundo.h	Wed Aug  6 20:36:18 2008
@@ -27,6 +27,8 @@
 {
   gboolean mode_changed;
   gboolean size_changed;
+  gdouble  previous_origin_x;
+  gdouble  previous_origin_y;
   gboolean resolution_changed;
   gboolean unit_changed;
   gboolean quick_mask_changed;

Modified: branches/soc-2008-text/app/dialogs/file-open-dialog.c
==============================================================================
--- branches/soc-2008-text/app/dialogs/file-open-dialog.c	(original)
+++ branches/soc-2008-text/app/dialogs/file-open-dialog.c	Wed Aug  6 20:36:18 2008
@@ -118,6 +118,10 @@
 
   uris = gtk_file_chooser_get_uris (GTK_FILE_CHOOSER (open_dialog));
 
+  if (uris)
+    g_object_set_data_full (G_OBJECT (gimp), "gimp-file-open-last-uri",
+                            g_strdup (uris->data), (GDestroyNotify) g_free);
+
   gimp_file_dialog_set_sensitive (dialog, FALSE);
 
   for (list = uris; list; list = g_slist_next (list))

Modified: branches/soc-2008-text/app/dialogs/preferences-dialog.c
==============================================================================
--- branches/soc-2008-text/app/dialogs/preferences-dialog.c	(original)
+++ branches/soc-2008-text/app/dialogs/preferences-dialog.c	Wed Aug  6 20:36:18 2008
@@ -43,6 +43,7 @@
 #include "widgets/gimpdevices.h"
 #include "widgets/gimpdialogfactory.h"
 #include "widgets/gimpgrideditor.h"
+#include "widgets/gimphelp.h"
 #include "widgets/gimphelp-ids.h"
 #include "widgets/gimpmessagebox.h"
 #include "widgets/gimpmessagedialog.h"
@@ -1798,15 +1799,49 @@
                           GTK_BOX (vbox2));
 
   {
-    GtkWidget *combo;
+    GtkWidget   *combo;
+    GtkWidget   *hbox;
+    GtkWidget   *image;
+    GtkWidget   *label;
+    const gchar *icon;
+    const gchar *text;
 
-    table = prefs_table_new (1, GTK_CONTAINER (vbox2));
+    table = prefs_table_new (2, GTK_CONTAINER (vbox2));
     combo = prefs_boolean_combo_box_add (object, "user-manual-online",
                                          _("Use the online version"),
                                          _("Use a locally installed copy"),
                                          _("User manual:"),
                                          GTK_TABLE (table), 0, size_group);
     gimp_help_set_help_data (combo, NULL, NULL);
+
+    if (gimp_help_user_manual_is_installed (gimp))
+      {
+        icon = GIMP_STOCK_INFO;
+        text = _("There's a local installation of the user manual.");
+      }
+    else
+      {
+        icon = GIMP_STOCK_WARNING;
+        text = _("The user manual is not installed locally.");
+      }
+
+    hbox = gtk_hbox_new (FALSE, 6);
+    gtk_table_attach_defaults (GTK_TABLE (table), hbox, 1, 2, 1, 2);
+    gtk_widget_show (hbox);
+
+    image = gtk_image_new_from_stock (icon, GTK_ICON_SIZE_BUTTON);
+    gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
+    gtk_widget_show (image);
+
+    label = gtk_label_new (text);
+    gimp_label_set_attributes (GTK_LABEL (label),
+                               PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
+                               -1);
+    gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+    gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+
+    gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
+    gtk_widget_show (label);
   }
 
   /*  Help Browser  */

Modified: branches/soc-2008-text/app/dialogs/stroke-dialog.c
==============================================================================
--- branches/soc-2008-text/app/dialogs/stroke-dialog.c	(original)
+++ branches/soc-2008-text/app/dialogs/stroke-dialog.c	Wed Aug  6 20:36:18 2008
@@ -204,17 +204,23 @@
                     NULL);
 
   {
+    GtkWidget *vbox;
     GtkWidget *hbox;
     GtkWidget *label;
     GtkWidget *combo;
+    GtkWidget *button;
 
-    hbox = gtk_hbox_new (FALSE, 6);
-    gtk_container_add (GTK_CONTAINER (frame), hbox);
-    gtk_widget_show (hbox);
+    vbox = gtk_vbox_new (FALSE, 6);
+    gtk_container_add (GTK_CONTAINER (frame), vbox);
+    gtk_widget_show (vbox);
 
-    gtk_widget_set_sensitive (hbox,
+    gtk_widget_set_sensitive (vbox,
                               desc->method == GIMP_STROKE_METHOD_PAINT_CORE);
-    g_object_set_data (G_OBJECT (paint_radio), "set_sensitive", hbox);
+    g_object_set_data (G_OBJECT (paint_radio), "set_sensitive", vbox);
+
+    hbox = gtk_hbox_new (FALSE, 6);
+    gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
+    gtk_widget_show (hbox);
 
     label = gtk_label_new (_("Paint tool:"));
     gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
@@ -234,6 +240,12 @@
 
 
     g_object_set_data (G_OBJECT (dialog), "gimp-tool-menu", combo);
+
+    button = gimp_prop_check_button_new (G_OBJECT (desc),
+                                         "emulate-brush-dynamics",
+                                         _("_Emulate brush dynamics"));
+    gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
+    gtk_widget_show (button);
   }
 
   return dialog;

Modified: branches/soc-2008-text/app/dialogs/tips-dialog.c
==============================================================================
--- branches/soc-2008-text/app/dialogs/tips-dialog.c	(original)
+++ branches/soc-2008-text/app/dialogs/tips-dialog.c	Wed Aug  6 20:36:18 2008
@@ -36,24 +36,26 @@
 
 #include "gimp-intl.h"
 
-
 enum
 {
   RESPONSE_PREVIOUS = 1,
   RESPONSE_NEXT     = 2
 };
 
-static void  tips_dialog_set_tip  (GimpTip   *tip);
-static void  tips_dialog_response (GtkWidget *dialog,
-                                   gint       response);
-static void  tips_dialog_destroy  (GtkWidget *widget,
-                                   gpointer   data);
+static void  tips_dialog_set_tip  (GimpTip       *tip);
+static void  tips_dialog_response (GtkWidget     *dialog,
+                                   gint           response);
+static void  tips_dialog_destroy  (GtkWidget     *widget,
+                                   GimpGuiConfig *config);
+static void  more_button_clicked  (GtkWidget     *button,
+                                   Gimp          *gimp);
 
 
-static GtkWidget *tips_dialog   = NULL;
-static GtkWidget *thetip_label  = NULL;
-static GList     *tips          = NULL;
-static GList     *current_tip   = NULL;
+static GtkWidget *tips_dialog = NULL;
+static GtkWidget *tip_label   = NULL;
+static GtkWidget *more_button = NULL;
+static GList     *tips        = NULL;
+static GList     *current_tip = NULL;
 
 
 GtkWidget *
@@ -164,32 +166,48 @@
   gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
   gtk_widget_show (hbox);
 
-  thetip_label = gtk_label_new (NULL);
-  gtk_label_set_selectable (GTK_LABEL (thetip_label), TRUE);
-  gtk_label_set_justify (GTK_LABEL (thetip_label), GTK_JUSTIFY_LEFT);
-  gtk_label_set_line_wrap (GTK_LABEL (thetip_label), TRUE);
-  gtk_misc_set_alignment (GTK_MISC (thetip_label), 0.5, 0.5);
-  gtk_box_pack_start (GTK_BOX (hbox), thetip_label, TRUE, TRUE, 0);
-  gtk_widget_show (thetip_label);
+  vbox = gtk_vbox_new (FALSE, 6);
+  gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
+  gtk_widget_show (vbox);
 
   image = gtk_image_new_from_stock (GIMP_STOCK_INFO, GTK_ICON_SIZE_DIALOG);
-  gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.5);
+  gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
   gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
   gtk_widget_show (image);
 
   gtk_container_set_focus_chain (GTK_CONTAINER (hbox), NULL);
 
+  tip_label = gtk_label_new (NULL);
+  gtk_label_set_selectable (GTK_LABEL (tip_label), TRUE);
+  gtk_label_set_justify (GTK_LABEL (tip_label), GTK_JUSTIFY_LEFT);
+  gtk_label_set_line_wrap (GTK_LABEL (tip_label), TRUE);
+  gtk_misc_set_alignment (GTK_MISC (tip_label), 0.5, 0.0);
+  gtk_box_pack_start (GTK_BOX (vbox), tip_label, TRUE, TRUE, 0);
+  gtk_widget_show (tip_label);
+
+  hbox = gtk_hbox_new (FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
+  gtk_widget_show (hbox);
+  
+  more_button = gtk_link_button_new_with_label ("http://docs.gimp.org/";,
+  /*  a link to the related section in the user manual  */
+                                                _("Learn more"));
+  gtk_widget_show (more_button);
+  gtk_box_pack_start (GTK_BOX (hbox), more_button, FALSE, FALSE, 0);
+
+  g_signal_connect (more_button, "clicked",
+                    G_CALLBACK (more_button_clicked),
+                    gimp);
+
   tips_dialog_set_tip (current_tip->data);
 
   return tips_dialog;
 }
 
 static void
-tips_dialog_destroy (GtkWidget *widget,
-                     gpointer   data)
+tips_dialog_destroy (GtkWidget     *widget,
+                     GimpGuiConfig *config)
 {
-  GimpGuiConfig *config = GIMP_GUI_CONFIG (data);
-
   /* the last-shown-tip is saved in sessionrc */
   config->last_tip = g_list_position (tips, current_tip);
 
@@ -227,5 +245,21 @@
 {
   g_return_if_fail (tip != NULL);
 
-  gtk_label_set_markup (GTK_LABEL (thetip_label), tip->thetip);
+  gtk_label_set_markup (GTK_LABEL (tip_label), tip->text);
+
+  /*  set the URI to unset the "visited" state  */
+  gtk_link_button_set_uri (GTK_LINK_BUTTON (more_button),
+                           "http://docs.gimp.org/";);
+
+  gtk_widget_set_sensitive (more_button, tip->help_id != NULL);
+}
+
+static void
+more_button_clicked (GtkWidget *button,
+                     Gimp      *gimp)
+{
+  GimpTip *tip = current_tip->data;
+
+  if (tip->help_id)
+    gimp_help (gimp, NULL, NULL, tip->help_id);
 }

Modified: branches/soc-2008-text/app/dialogs/tips-parser.c
==============================================================================
--- branches/soc-2008-text/app/dialogs/tips-parser.c	(original)
+++ branches/soc-2008-text/app/dialogs/tips-parser.c	Wed Aug  6 20:36:18 2008
@@ -54,6 +54,7 @@
   TipsParserState        state;
   TipsParserState        last_known_state;
   const gchar           *locale;
+  const gchar           *help_id;
   TipsParserLocaleState  locale_state;
   gint                   markup_depth;
   gint                   unknown_depth;
@@ -63,33 +64,38 @@
 } TipsParser;
 
 
-static void  tips_parser_start_element (GMarkupParseContext  *context,
-                                        const gchar          *element_name,
-                                        const gchar         **attribute_names,
-                                        const gchar         **attribute_values,
-                                        gpointer              user_data,
-                                        GError              **error);
-static void  tips_parser_end_element   (GMarkupParseContext  *context,
-                                        const gchar          *element_name,
-                                        gpointer              user_data,
-                                        GError              **error);
-static void  tips_parser_characters    (GMarkupParseContext  *context,
-                                        const gchar          *text,
-                                        gsize                 text_len,
-                                        gpointer              user_data,
-                                        GError              **error);
-
-static void tips_parser_start_markup   (TipsParser   *parser,
-                                        const gchar  *markup_name);
-static void tips_parser_end_markup     (TipsParser   *parser,
-                                        const gchar  *markup_name);
-static void tips_parser_start_unknown  (TipsParser   *parser);
-static void tips_parser_end_unknown    (TipsParser   *parser);
-static void tips_parser_parse_locale   (TipsParser   *parser,
-                                        const gchar **names,
-                                        const gchar **values);
-static void  tips_parser_set_by_locale (TipsParser   *parser,
-                                        gchar       **dest);
+static void    tips_parser_start_element (GMarkupParseContext  *context,
+                                          const gchar          *element_name,
+                                          const gchar         **attribute_names,
+                                          const gchar         **attribute_values,
+                                          gpointer              user_data,
+                                          GError              **error);
+static void    tips_parser_end_element   (GMarkupParseContext  *context,
+                                          const gchar          *element_name,
+                                          gpointer              user_data,
+                                          GError              **error);
+static void    tips_parser_characters    (GMarkupParseContext  *context,
+                                          const gchar          *text,
+                                          gsize                 text_len,
+                                          gpointer              user_data,
+                                          GError              **error);
+
+static void    tips_parser_start_markup   (TipsParser   *parser,
+                                           const gchar  *markup_name);
+static void    tips_parser_end_markup     (TipsParser   *parser,
+                                           const gchar  *markup_name);
+static void    tips_parser_start_unknown  (TipsParser   *parser);
+static void    tips_parser_end_unknown    (TipsParser   *parser);
+
+static gchar * tips_parser_parse_help_id  (TipsParser   *parser,
+                                           const gchar **names,
+                                           const gchar **values);
+
+static void    tips_parser_parse_locale   (TipsParser   *parser,
+                                           const gchar **names,
+                                           const gchar **values);
+static void    tips_parser_set_by_locale  (TipsParser   *parser,
+                                           gchar       **dest);
 
 
 static const GMarkupParser markup_parser =
@@ -129,7 +135,7 @@
       va_end (args);
     }
 
-  tip->thetip = g_string_free (str, FALSE);
+  tip->text = g_string_free (str, FALSE);
 
   return tip;
 }
@@ -140,7 +146,9 @@
   if (! tip)
     return;
 
-  g_free (tip->thetip);
+  g_free (tip->text);
+  g_free (tip->help_id);
+
   g_slice_free (GimpTip, tip);
 }
 
@@ -230,9 +238,13 @@
     {
     case TIPS_START:
       if (strcmp (element_name, "gimp-tips") == 0)
-        parser->state = TIPS_IN_TIPS;
+        {
+          parser->state = TIPS_IN_TIPS;
+        }
       else
-        tips_parser_start_unknown (parser);
+        {
+          tips_parser_start_unknown (parser);
+        }
       break;
 
     case TIPS_IN_TIPS:
@@ -240,9 +252,14 @@
         {
           parser->state = TIPS_IN_TIP;
           parser->current_tip = g_slice_new0 (GimpTip);
+          parser->current_tip->help_id = tips_parser_parse_help_id (parser,
+                                                                    attribute_names,
+                                                                    attribute_values);
         }
       else
-        tips_parser_start_unknown (parser);
+        {
+          tips_parser_start_unknown (parser);
+        }
       break;
 
     case TIPS_IN_TIP:
@@ -252,16 +269,22 @@
           tips_parser_parse_locale (parser, attribute_names, attribute_values);
         }
       else
-        tips_parser_start_unknown (parser);
+        {
+          tips_parser_start_unknown (parser);
+        }
       break;
 
     case TIPS_IN_THETIP:
       if (strcmp (element_name, "b"  ) == 0 ||
           strcmp (element_name, "big") == 0 ||
           strcmp (element_name, "tt" ) == 0)
-        tips_parser_start_markup (parser, element_name);
+        {
+          tips_parser_start_markup (parser, element_name);
+        }
       else
-        tips_parser_start_unknown (parser);
+        {
+          tips_parser_start_unknown (parser);
+        }
       break;
 
     case TIPS_IN_UNKNOWN:
@@ -297,7 +320,7 @@
     case TIPS_IN_THETIP:
       if (parser->markup_depth == 0)
         {
-          tips_parser_set_by_locale (parser, &parser->current_tip->thetip);
+          tips_parser_set_by_locale (parser, &parser->current_tip->text);
           g_string_truncate (parser->value, 0);
           parser->state = TIPS_IN_TIP;
         }
@@ -387,6 +410,23 @@
     parser->state = parser->last_known_state;
 }
 
+static gchar *
+tips_parser_parse_help_id (TipsParser   *parser,
+                           const gchar **names,
+                           const gchar **values)
+{
+  while (*names && *values)
+    {
+      if (strcmp (*names, "help") == 0 && **values)
+        return g_strdup (*values);
+
+      names++;
+      values++;
+    }
+
+  return NULL;
+}
+
 static void
 tips_parser_parse_locale (TipsParser   *parser,
                           const gchar **names,
@@ -435,3 +475,4 @@
       break;
     }
 }
+

Modified: branches/soc-2008-text/app/dialogs/tips-parser.h
==============================================================================
--- branches/soc-2008-text/app/dialogs/tips-parser.h	(original)
+++ branches/soc-2008-text/app/dialogs/tips-parser.h	Wed Aug  6 20:36:18 2008
@@ -27,7 +27,8 @@
 
 struct _GimpTip
 {
-  gchar *thetip;
+  gchar *text;
+  gchar *help_id;
 };
 
 

Modified: branches/soc-2008-text/app/display/Makefile.am
==============================================================================
--- branches/soc-2008-text/app/display/Makefile.am	(original)
+++ branches/soc-2008-text/app/display/Makefile.am	Wed Aug  6 20:36:18 2008
@@ -45,6 +45,7 @@
 	gimpdisplayshell-icon.h			\
 	gimpdisplayshell-preview.c		\
 	gimpdisplayshell-preview.h		\
+	gimpdisplayshell-private.h		\
 	gimpdisplayshell-progress.c		\
 	gimpdisplayshell-progress.h		\
 	gimpdisplayshell-render.c		\

Modified: branches/soc-2008-text/app/display/gimpdisplayshell-autoscroll.c
==============================================================================
--- branches/soc-2008-text/app/display/gimpdisplayshell-autoscroll.c	(original)
+++ branches/soc-2008-text/app/display/gimpdisplayshell-autoscroll.c	Wed Aug  6 20:36:18 2008
@@ -26,6 +26,7 @@
 #include "gimpdisplayshell.h"
 #include "gimpdisplayshell-autoscroll.h"
 #include "gimpdisplayshell-coords.h"
+#include "gimpdisplayshell-private.h"
 #include "gimpdisplayshell-scroll.h"
 #include "gimpdisplayshell-transform.h"
 
@@ -135,9 +136,9 @@
 
       info->time += AUTOSCROLL_DT;
 
-      gimp_display_shell_scroll (shell,
-                                 AUTOSCROLL_DX * (gdouble) dx,
-                                 AUTOSCROLL_DX * (gdouble) dy);
+      gimp_display_shell_scroll_private (shell,
+                                         AUTOSCROLL_DX * (gdouble) dx,
+                                         AUTOSCROLL_DX * (gdouble) dy);
 
       gimp_display_shell_untransform_coordinate (shell,
                                                  &device_coords,

Modified: branches/soc-2008-text/app/display/gimpdisplayshell-callbacks.c
==============================================================================
--- branches/soc-2008-text/app/display/gimpdisplayshell-callbacks.c	(original)
+++ branches/soc-2008-text/app/display/gimpdisplayshell-callbacks.c	Wed Aug  6 20:36:18 2008
@@ -67,6 +67,7 @@
 #include "gimpdisplayshell-draw.h"
 #include "gimpdisplayshell-layer-select.h"
 #include "gimpdisplayshell-preview.h"
+#include "gimpdisplayshell-private.h"
 #include "gimpdisplayshell-scale.h"
 #include "gimpdisplayshell-scroll.h"
 #include "gimpdisplayshell-selection.h"
@@ -84,7 +85,15 @@
                                                               GimpDisplayShell *shell);
 static void       gimp_display_shell_hscrollbar_update       (GtkAdjustment    *adjustment,
                                                               GimpDisplayShell *shell);
+static gboolean   gimp_display_shell_vscrollbar_update_range (GtkRange         *range,
+                                                              GtkScrollType     scroll,
+                                                              gdouble           value,
+                                                              GimpDisplayShell *shell);
 
+static gboolean   gimp_display_shell_hscrollbar_update_range (GtkRange         *range,
+                                                              GtkScrollType     scroll,
+                                                              gdouble           value,
+                                                              GimpDisplayShell *shell);
 static GdkModifierType
                   gimp_display_shell_key_to_state            (gint              key);
 
@@ -238,6 +247,14 @@
                     G_CALLBACK (gimp_display_shell_vscrollbar_update),
                     shell);
 
+  g_signal_connect (shell->hsb, "change-value",
+                    G_CALLBACK (gimp_display_shell_hscrollbar_update_range),
+                    shell);
+
+  g_signal_connect (shell->vsb, "change-value",
+                    G_CALLBACK (gimp_display_shell_vscrollbar_update_range),
+                    shell);
+
   /*  allow shrinking  */
   gtk_widget_set_size_request (GTK_WIDGET (shell), 0, 0);
 
@@ -1100,11 +1117,11 @@
 
         if (shell->scrolling)
           {
-            gimp_display_shell_scroll (shell,
-                                       (shell->scroll_start_x - mevent->x -
-                                        shell->offset_x),
-                                       (shell->scroll_start_y - mevent->y -
-                                        shell->offset_y));
+            gimp_display_shell_scroll_private (shell,
+                                               (shell->scroll_start_x - mevent->x -
+                                                shell->offset_x),
+                                               (shell->scroll_start_y - mevent->y -
+                                                shell->offset_y));
           }
         else if (state & GDK_BUTTON1_MASK)
           {
@@ -1661,20 +1678,62 @@
 gimp_display_shell_vscrollbar_update (GtkAdjustment    *adjustment,
                                       GimpDisplayShell *shell)
 {
-  gimp_display_shell_scroll (shell,
-                             0,
-                             gtk_adjustment_get_value (adjustment) -
-                             shell->offset_y);
+  gimp_display_shell_scroll_private (shell,
+                                     0,
+                                     gtk_adjustment_get_value (adjustment) -
+                                     shell->offset_y);
 }
 
 static void
 gimp_display_shell_hscrollbar_update (GtkAdjustment    *adjustment,
                                       GimpDisplayShell *shell)
 {
-  gimp_display_shell_scroll (shell,
-                             gtk_adjustment_get_value (adjustment) -
-                             shell->offset_x,
-                             0);
+  gimp_display_shell_scroll_private (shell,
+                                     gtk_adjustment_get_value (adjustment) -
+                                     shell->offset_x,
+                                     0);
+}
+
+static gboolean
+gimp_display_shell_hscrollbar_update_range (GtkRange         *range,
+                                            GtkScrollType     scroll,
+                                            gdouble           value,
+                                            GimpDisplayShell *shell)
+{
+  if (! shell->display)
+    return TRUE;
+
+  if ((scroll == GTK_SCROLL_JUMP)          ||
+      (scroll == GTK_SCROLL_PAGE_BACKWARD) ||
+      (scroll == GTK_SCROLL_PAGE_FORWARD))
+    return FALSE;
+
+  gimp_display_shell_setup_hscrollbar_with_value (shell, value);
+
+  gtk_adjustment_changed (shell->hsbdata);
+
+  return FALSE;
+}
+
+static gboolean
+gimp_display_shell_vscrollbar_update_range (GtkRange         *range,
+                                            GtkScrollType     scroll,
+                                            gdouble           value,
+                                            GimpDisplayShell *shell)
+{
+  if (! shell->display)
+    return TRUE;
+
+  if ((scroll == GTK_SCROLL_JUMP)          ||
+      (scroll == GTK_SCROLL_PAGE_BACKWARD) ||
+      (scroll == GTK_SCROLL_PAGE_FORWARD))
+    return FALSE;
+
+  gimp_display_shell_setup_vscrollbar_with_value (shell, value);
+
+  gtk_adjustment_changed (shell->vsbdata);
+
+  return FALSE;
 }
 
 static GdkModifierType

Modified: branches/soc-2008-text/app/display/gimpdisplayshell-close.c
==============================================================================
--- branches/soc-2008-text/app/display/gimpdisplayshell-close.c	(original)
+++ branches/soc-2008-text/app/display/gimpdisplayshell-close.c	Wed Aug  6 20:36:18 2008
@@ -90,7 +90,19 @@
       image->dirty           &&
       shell->display->config->confirm_on_close)
     {
-      gimp_display_shell_close_dialog (shell, image);
+      /*  If there's a save dialog active for this image, then raise it.
+       *  (see bug #511965)
+       */
+      GtkWidget *dialog = g_object_get_data (G_OBJECT (image),
+                                             "gimp-file-save-dialog");
+      if (dialog)
+        {
+          gtk_window_present (GTK_WINDOW (dialog));
+        }
+      else
+        {
+          gimp_display_shell_close_dialog (shell, image);
+        }
     }
   else if (image)
     {

Modified: branches/soc-2008-text/app/display/gimpdisplayshell-coords.c
==============================================================================
--- branches/soc-2008-text/app/display/gimpdisplayshell-coords.c	(original)
+++ branches/soc-2008-text/app/display/gimpdisplayshell-coords.c	Wed Aug  6 20:36:18 2008
@@ -213,6 +213,11 @@
 			       gdouble           inertia_factor,
 			       guint32           time)
 {
+  gdouble delta_time = 0.001;
+  gdouble delta_x    = 0.0;
+  gdouble delta_y    = 0.0;
+  gdouble distance   = 1.0;
+
   /* Smoothing causes problems with cursor tracking
    * when zoomed above screen resolution so we need to supress it.
    */
@@ -221,22 +226,21 @@
       inertia_factor = 0.0;
     }
 
-  if (shell->last_disp_motion_time == 0)
+  if (shell->last_motion_time == 0)
     {
       /* First pair is invalid to do any velocity calculation,
-       * so we apply constant values.
+       * so we apply a constant value.
        */
-      coords->velocity   = 1.0;
-      coords->delta_time = 0.001;
-      coords->distance   = 1;
+      coords->velocity = 1.0;
     }
   else
     {
-      gdouble dx = coords->delta_x = shell->last_coords.x - coords->x;
-      gdouble dy = coords->delta_y = shell->last_coords.y - coords->y;
       gdouble filter;
       gdouble dist;
 
+      delta_x = shell->last_coords.x - coords->x;
+      delta_y = shell->last_coords.y - coords->y;
+
 #define SMOOTH_FACTOR 0.3
 
       /* Events with distances less than the screen resolution are not
@@ -244,20 +248,18 @@
        */
       filter = MIN (1 / shell->scale_x, 1 / shell->scale_y) / 2.0;
 
-      if (fabs (dx) < filter && fabs (dy) < filter)
+      if (fabs (delta_x) < filter && fabs (delta_y) < filter)
         return FALSE;
 
-      coords->delta_time = time - shell->last_disp_motion_time;
-      coords->delta_time = (shell->last_coords.delta_time * (1 - SMOOTH_FACTOR)
-                            + coords->delta_time * SMOOTH_FACTOR);
-      coords->distance = dist = sqrt (SQR (dx) + SQR (dy));
+      delta_time = (shell->last_motion_delta_time * (1 - SMOOTH_FACTOR)
+                    +  (time - shell->last_motion_time) * SMOOTH_FACTOR);
 
-      coords->random = g_random_double_range (0.0, 1.0);
+      distance = dist = sqrt (SQR (delta_x) + SQR (delta_y));
 
       /* If even smoothed time resolution does not allow to guess for speed,
        * use last velocity.
        */
-      if ((coords->delta_time == 0))
+      if (delta_time == 0)
         {
           coords->velocity = shell->last_coords.velocity;
         }
@@ -266,14 +268,13 @@
           /* We need to calculate the velocity in screen coordinates
            * for human interaction
            */
-          gdouble screen_distance = (coords->distance *
+          gdouble screen_distance = (distance *
                                      MIN (shell->scale_x, shell->scale_y));
 
           /* Calculate raw valocity */
-          coords->velocity = ((screen_distance / (gdouble) coords->delta_time) /
-                              VELOCITY_UNIT);
+          coords->velocity = ((screen_distance / delta_time) / VELOCITY_UNIT);
 
-          /* Adding velocity dependent smooth, feels better in tools this way. */
+          /* Adding velocity dependent smoothing, feels better in tools. */
           coords->velocity = (shell->last_coords.velocity *
                               (1 - MIN (SMOOTH_FACTOR, coords->velocity)) +
                               coords->velocity *
@@ -282,10 +283,11 @@
           /* Speed needs upper limit */
           coords->velocity = MIN (coords->velocity, 1.0);
         }
+
       /* High speed -> less smooth*/
       inertia_factor *= (1 - coords->velocity);
 
-      if (inertia_factor > 0 && coords->distance > 0)
+      if (inertia_factor > 0 && distance > 0)
         {
           /* Apply smoothing to X and Y. */
 
@@ -301,23 +303,21 @@
           gdouble new_x;
           gdouble new_y;
 
-          sin_new = coords->delta_x / coords->distance;
-          sin_old = shell->last_coords.delta_x / shell->last_coords.distance;
+          sin_new = delta_x / distance;
+          sin_old = shell->last_motion_delta_x / shell->last_motion_distance;
           sin_avg = sin (asin (sin_old) * inertia_factor +
                          asin (sin_new) * (1 - inertia_factor));
 
-          cos_new = coords->delta_y / coords->distance;
-          cos_old = shell->last_coords.delta_y / shell->last_coords.distance;
+          cos_new = delta_y / distance;
+          cos_old = shell->last_motion_delta_y / shell->last_motion_distance;
           cos_avg = cos (acos (cos_old) * inertia_factor +
                          acos (cos_new) * (1 - inertia_factor));
 
-          coords->delta_x = sin_avg * coords->distance;
-          coords->delta_y = cos_avg * coords->distance;
+          delta_x = sin_avg * distance;
+          delta_y = cos_avg * distance;
 
-          new_x =
-            (shell->last_coords.x - coords->delta_x) * 0.5 + coords->x * 0.5;
-          new_y =
-            (shell->last_coords.y - coords->delta_y) * 0.5 + coords->y * 0.5;
+          new_x = (shell->last_coords.x - delta_x) * 0.5 + coords->x * 0.5;
+          new_y = (shell->last_coords.y - delta_y) * 0.5 + coords->y * 0.5;
 
           cur_deviation = SQR (coords->x - new_x) + SQR (coords->y - new_y);
 
@@ -333,18 +333,17 @@
           coords->x = new_x;
           coords->y = new_y;
 
-          coords->delta_x = shell->last_coords.x - coords->x;
-          coords->delta_y = shell->last_coords.y - coords->y;
+          delta_x = shell->last_coords.x - coords->x;
+          delta_y = shell->last_coords.y - coords->y;
 
           /* Recalculate distance */
-          coords->distance = sqrt (SQR (coords->delta_x) +
-                                   SQR (coords->delta_y));
+          distance = sqrt (SQR (delta_x) + SQR (delta_y));
         }
 
 #ifdef VERBOSE
       g_printerr ("DIST: %f, DT:%f, Vel:%f, Press:%f,smooth_dd:%f, sf %f\n",
-                  coords->distance,
-                  coords->delta_time,
+                  distance,
+                  delta_time,
                   shell->last_coords.velocity,
                   coords->pressure,
                   coords->distance - dist,
@@ -352,8 +351,13 @@
 #endif
     }
 
-  shell->last_coords           = *coords;
-  shell->last_disp_motion_time = time;
+  shell->last_coords            = *coords;
+
+  shell->last_motion_time       = time;
+  shell->last_motion_delta_time = delta_time;
+  shell->last_motion_delta_x    = delta_x;
+  shell->last_motion_delta_y    = delta_y;
+  shell->last_motion_distance   = distance;
 
   return TRUE;
 }

Modified: branches/soc-2008-text/app/display/gimpdisplayshell-draw.c
==============================================================================
--- branches/soc-2008-text/app/display/gimpdisplayshell-draw.c	(original)
+++ branches/soc-2008-text/app/display/gimpdisplayshell-draw.c	Wed Aug  6 20:36:18 2008
@@ -48,6 +48,7 @@
 #include "gimpdisplayshell-appearance.h"
 #include "gimpdisplayshell-draw.h"
 #include "gimpdisplayshell-render.h"
+#include "gimpdisplayshell-scroll.h"
 #include "gimpdisplayshell-transform.h"
 
 
@@ -68,8 +69,8 @@
                                gboolean          active)
 {
   gint  position;
-  gint  x1, x2, y1, y2;
-  gint  x, y, w, h;
+  gint  x1, y1, x2, y2;
+  gint  x, y;
 
   g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
   g_return_if_fail (GIMP_IS_GUIDE (guide));
@@ -79,18 +80,10 @@
   if (position < 0)
     return;
 
-  gimp_display_shell_transform_xy (shell, 0, 0, &x1, &y1, FALSE);
-  gimp_display_shell_transform_xy (shell,
-                                   gimp_image_get_width  (shell->display->image),
-                                   gimp_image_get_height (shell->display->image),
-                                   &x2, &y2, FALSE);
+  x1 = 0;
+  y1 = 0;
 
-  gdk_drawable_get_size (shell->canvas->window, &w, &h);
-
-  x1 = MAX (x1, 0);
-  y1 = MAX (y1, 0);
-  x2 = MIN (x2, w);
-  y2 = MIN (y2, h);
+  gdk_drawable_get_size (shell->canvas->window, &x2, &y2);
 
   switch (gimp_guide_get_orientation (guide))
     {
@@ -128,9 +121,7 @@
            list;
            list = g_list_next (list))
         {
-          gimp_display_shell_draw_guide (shell,
-                                         (GimpGuide *) list->data,
-                                         FALSE);
+          gimp_display_shell_draw_guide (shell, list->data, FALSE);
         }
     }
 }
@@ -511,35 +502,16 @@
                               gint              w,
                               gint              h)
 {
-  GimpProjection *proj;
-  TileManager    *tiles;
-  gint            level;
-  gint            level_width;
-  gint            level_height;
-  gint            sx, sy;
-  gint            sw, sh;
+  gint sx, sy;
+  gint sw, sh;
 
   g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
 
   if (! shell->display->image)
     return;
 
-  proj = shell->display->image->projection;
-
-  level = gimp_projection_get_level (proj, shell->scale_x, shell->scale_y);
-
-  tiles = gimp_projection_get_tiles_at_level (proj, level, NULL);
-
-  level_width  = tile_manager_width (tiles);
-  level_height = tile_manager_height (tiles);
-
-  /*  the image's size in display coordinates  */
-  sx = shell->disp_xoffset - shell->offset_x;
-  sy = shell->disp_yoffset - shell->offset_y;
-
-  /* SCALE[XY] with pyramid level taken into account. */
-  sw = PROJ_ROUND (level_width  * (shell->scale_x * (1 << level)));
-  sh = PROJ_ROUND (level_height * (shell->scale_y * (1 << level)));
+  gimp_display_shell_get_scaled_viewport_offset (shell, &sx, &sy);
+  gimp_display_shell_get_scaled_image_size (shell, &sw, &sh);
 
   /*  check if the passed in area intersects with
    *  both the display and the image
@@ -574,14 +546,19 @@
         {
           for (j = x; j < x2; j += GIMP_DISPLAY_RENDER_BUF_WIDTH)
             {
+              gint disp_xoffset, disp_yoffset;
               gint dx, dy;
 
               dx = MIN (x2 - j, GIMP_DISPLAY_RENDER_BUF_WIDTH);
               dy = MIN (y2 - i, GIMP_DISPLAY_RENDER_BUF_HEIGHT);
 
+              gimp_display_shell_get_disp_offset (shell,
+                                                  &disp_xoffset,
+                                                  &disp_yoffset);
+
               gimp_display_shell_render (shell,
-                                         j - shell->disp_xoffset,
-                                         i - shell->disp_yoffset,
+                                         j - disp_xoffset,
+                                         i - disp_yoffset,
                                          dx, dy,
                                          shell->highlight ? &rect : NULL);
             }

Modified: branches/soc-2008-text/app/display/gimpdisplayshell-handlers.c
==============================================================================
--- branches/soc-2008-text/app/display/gimpdisplayshell-handlers.c	(original)
+++ branches/soc-2008-text/app/display/gimpdisplayshell-handlers.c	Wed Aug  6 20:36:18 2008
@@ -21,6 +21,7 @@
 #include <gtk/gtk.h>
 
 #include "libgimpcolor/gimpcolor.h"
+#include "libgimpmath/gimpmath.h"
 #include "libgimpwidgets/gimpwidgets.h"
 
 #include "display-types.h"
@@ -43,6 +44,7 @@
 #include "gimpdisplayshell-handlers.h"
 #include "gimpdisplayshell-icon.h"
 #include "gimpdisplayshell-scale.h"
+#include "gimpdisplayshell-scroll.h"
 #include "gimpdisplayshell-selection.h"
 #include "gimpdisplayshell-title.h"
 
@@ -64,7 +66,10 @@
 static void   gimp_display_shell_selection_control_handler  (GimpImage        *image,
                                                              GimpSelectionControl control,
                                                              GimpDisplayShell *shell);
-static void   gimp_display_shell_size_changed_handler       (GimpImage        *image,
+static void   gimp_display_shell_size_changed_detailed_handler
+                                                            (GimpImage        *image,
+                                                             gint              previous_origin_x,
+                                                             gint              previous_origin_y,
                                                              GimpDisplayShell *shell);
 static void   gimp_display_shell_resolution_changed_handler (GimpImage        *image,
                                                              GimpDisplayShell *shell);
@@ -148,8 +153,8 @@
   g_signal_connect (image, "selection-control",
                     G_CALLBACK (gimp_display_shell_selection_control_handler),
                     shell);
-  g_signal_connect (image, "size-changed",
-                    G_CALLBACK (gimp_display_shell_size_changed_handler),
+  g_signal_connect (image, "size-changed-detailed",
+                    G_CALLBACK (gimp_display_shell_size_changed_detailed_handler),
                     shell);
   g_signal_connect (image, "resolution-changed",
                     G_CALLBACK (gimp_display_shell_resolution_changed_handler),
@@ -338,7 +343,7 @@
                                         gimp_display_shell_resolution_changed_handler,
                                         shell);
   g_signal_handlers_disconnect_by_func (image,
-                                        gimp_display_shell_size_changed_handler,
+                                        gimp_display_shell_size_changed_detailed_handler,
                                         shell);
   g_signal_handlers_disconnect_by_func (image,
                                         gimp_display_shell_selection_control_handler,
@@ -410,15 +415,6 @@
 }
 
 static void
-gimp_display_shell_size_changed_handler (GimpImage        *image,
-                                         GimpDisplayShell *shell)
-{
-  gimp_display_shell_scale_resize (shell,
-                                   shell->display->config->resize_windows_on_resize,
-                                   FALSE);
-}
-
-static void
 gimp_display_shell_resolution_changed_handler (GimpImage        *image,
                                                GimpDisplayShell *shell)
 {
@@ -431,7 +427,13 @@
     }
   else
     {
-      gimp_display_shell_size_changed_handler (image, shell);
+      /* A resolution change has the same effect as a size change from
+       * a display shell point of view. Force a redraw of the display
+       * so that we don't get any display garbage.
+       */
+      gimp_display_shell_scale_resize (shell,
+                                       shell->display->config->resize_windows_on_resize,
+                                       FALSE);
     }
 }
 
@@ -479,6 +481,36 @@
 }
 
 static void
+gimp_display_shell_size_changed_detailed_handler (GimpImage        *image,
+                                                  gint              previous_origin_x,
+                                                  gint              previous_origin_y,
+                                                  GimpDisplayShell *shell)
+{
+  if (shell->display->config->resize_windows_on_resize)
+    {
+      /* If the window is resized just center the image in it when it
+       * has change size
+       */
+      gimp_display_shell_shrink_wrap (shell, FALSE);
+      gimp_display_shell_center_image_on_next_size_allocate (shell);
+    }
+  else
+    {
+      gint scaled_previous_origin_x = SCALEX (shell, previous_origin_x);
+      gint scaled_previous_origin_y = SCALEY (shell, previous_origin_y);
+
+      /* Note that we can't use gimp_display_shell_scroll_private() here
+       * because that would expose the image twice, causing unwanted
+       * flicker.
+       */
+      gimp_display_shell_scale_by_values (shell, gimp_zoom_model_get_factor (shell->zoom),
+                                          shell->offset_x + scaled_previous_origin_x,
+                                          shell->offset_y + scaled_previous_origin_y,
+                                          FALSE);
+    }
+}
+
+static void
 gimp_display_shell_invalidate_preview_handler (GimpImage        *image,
                                                GimpDisplayShell *shell)
 {

Modified: branches/soc-2008-text/app/display/gimpdisplayshell-progress.c
==============================================================================
--- branches/soc-2008-text/app/display/gimpdisplayshell-progress.c	(original)
+++ branches/soc-2008-text/app/display/gimpdisplayshell-progress.c	Wed Aug  6 20:36:18 2008
@@ -144,12 +144,17 @@
       /* warning messages go to the statusbar, if it's visible */
       if (! gimp_statusbar_get_visible (GIMP_STATUSBAR (shell->statusbar)))
         break;
-      /* else fallthrough */
+      else
+	return gimp_progress_message (GIMP_PROGRESS (shell->statusbar), gimp,
+				      severity, domain, message);
 
     case GIMP_MESSAGE_INFO:
-      /* info messages go to the statusbar, no matter if it's visible or not */
-      return gimp_progress_message (GIMP_PROGRESS (shell->statusbar), gimp,
-                                    severity, domain, message);
+      /* info messages go to the statusbar;
+       * if they are not handled there, they are swallowed
+       */
+      gimp_progress_message (GIMP_PROGRESS (shell->statusbar), gimp,
+			     severity, domain, message);
+      return TRUE;
     }
 
   return FALSE;

Modified: branches/soc-2008-text/app/display/gimpdisplayshell-render.c
==============================================================================
--- branches/soc-2008-text/app/display/gimpdisplayshell-render.c	(original)
+++ branches/soc-2008-text/app/display/gimpdisplayshell-render.c	Wed Aug  6 20:36:18 2008
@@ -44,6 +44,7 @@
 #include "gimpdisplayshell.h"
 #include "gimpdisplayshell-filter.h"
 #include "gimpdisplayshell-render.h"
+#include "gimpdisplayshell-scroll.h"
 
 #define GIMP_DISPLAY_ZOOM_FAST     (1 << 0) /* use the fastest possible code
                                                path trading quality for speed
@@ -223,6 +224,8 @@
   GimpImage      *image;
   RenderInfo      info;
   GimpImageType   type;
+  gint            offset_x;
+  gint            offset_y;
 
   g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
   g_return_if_fail (w > 0 && h > 0);
@@ -230,13 +233,15 @@
   image = shell->display->image;
   projection = image->projection;
 
+  gimp_display_shell_get_render_start_offset (shell, &offset_x, &offset_y);
+
   /* Initialize RenderInfo with values that don't change during the
    * call of this function.
    */
   info.shell      = shell;
 
-  info.x          = x + shell->offset_x;
-  info.y          = y + shell->offset_y;
+  info.x          = x + offset_x;
+  info.y          = y + offset_y;
   info.w          = w;
   info.h          = h;
 
@@ -310,12 +315,20 @@
     }
 
   /*  put it to the screen  */
-  gimp_canvas_draw_rgb (GIMP_CANVAS (shell->canvas), GIMP_CANVAS_STYLE_RENDER,
-                        x + shell->disp_xoffset, y + shell->disp_yoffset,
+  {
+    gint disp_xoffset, disp_yoffset;
+    gint offset_x, offset_y;
+
+    gimp_display_shell_get_disp_offset (shell, &disp_xoffset, &disp_yoffset);
+    gimp_display_shell_get_render_start_offset (shell, &offset_x, &offset_y);
+
+    gimp_canvas_draw_rgb (GIMP_CANVAS (shell->canvas), GIMP_CANVAS_STYLE_RENDER,
+                        x + disp_xoffset, y + disp_yoffset,
                         w, h,
                         shell->render_buf,
                         3 * GIMP_DISPLAY_RENDER_BUF_WIDTH,
-                        shell->offset_x, shell->offset_y);
+                        offset_x, offset_y);
+  }
 }
 
 
@@ -338,16 +351,20 @@
 {
   guchar       *buf  = shell->render_buf;
   GdkRectangle  rect;
+  gint          offset_x;
+  gint          offset_y;
+
+  gimp_display_shell_get_render_start_offset (shell, &offset_x, &offset_y);
 
-  rect.x      = shell->offset_x + x;
-  rect.y      = shell->offset_y + y;
+  rect.x      = x + offset_x;
+  rect.y      = y + offset_y;
   rect.width  = w;
   rect.height = h;
 
   if (gdk_rectangle_intersect (highlight, &rect, &rect))
     {
-      rect.x -= shell->offset_x + x;
-      rect.y -= shell->offset_y + y;
+      rect.x -= x + offset_x;
+      rect.y -= y + offset_y;
 
       for (y = 0; y < rect.y; y++)
         {

Modified: branches/soc-2008-text/app/display/gimpdisplayshell-scale.c
==============================================================================
--- branches/soc-2008-text/app/display/gimpdisplayshell-scale.c	(original)
+++ branches/soc-2008-text/app/display/gimpdisplayshell-scale.c	Wed Aug  6 20:36:18 2008
@@ -38,6 +38,7 @@
 
 #include "gimpdisplay.h"
 #include "gimpdisplayshell.h"
+#include "gimpdisplayshell-private.h"
 #include "gimpdisplayshell-scale.h"
 #include "gimpdisplayshell-scroll.h"
 #include "gimpdisplayshell-title.h"
@@ -89,10 +90,7 @@
 gimp_display_shell_scale_setup (GimpDisplayShell *shell)
 {
   GimpImage *image;
-  gdouble    lower;
-  gdouble    upper;
-  gdouble    max_size;
-  gfloat     sx, sy;
+  gfloat     sw, sh;
   gint       image_width;
   gint       image_height;
 
@@ -108,126 +106,119 @@
       image_width  = gimp_image_get_width  (image);
       image_height = gimp_image_get_height (image);
 
-      sx = SCALEX (shell, image_width);
-      sy = SCALEY (shell, image_height);
+      sw = SCALEX (shell, image_width);
+      sh = SCALEY (shell, image_height);
     }
   else
     {
       image_width  = shell->disp_width;
       image_height = shell->disp_height;
 
-      sx = image_width;
-      sy = image_height;
+      sw = image_width;
+      sh = image_height;
     }
 
+
+  /* Horizontal scrollbar */
+
   shell->hsbdata->value          = shell->offset_x;
-  shell->hsbdata->upper          = sx;
-  shell->hsbdata->page_size      = MIN (sx, shell->disp_width);
+  shell->hsbdata->page_size      = shell->disp_width;
   shell->hsbdata->page_increment = shell->disp_width / 2;
-  shell->hsbdata->step_increment = shell->scale_x;
 
-  shell->vsbdata->value          = shell->offset_y;
-  shell->vsbdata->upper          = sy;
-  shell->vsbdata->page_size      = MIN (sy, shell->disp_height);
-  shell->vsbdata->page_increment = shell->disp_height / 2;
-  shell->vsbdata->step_increment = shell->scale_y;
+  gimp_display_shell_setup_hscrollbar_with_value (shell, shell->offset_x);
 
   gtk_adjustment_changed (shell->hsbdata);
-  gtk_adjustment_changed (shell->vsbdata);
-
-  /* horizontal ruler */
-
-  lower = 0;
-
-  if (image)
-    {
-      upper    = img2real (shell, TRUE, FUNSCALEX (shell, shell->disp_width));
-      max_size = img2real (shell, TRUE, MAX (image_width, image_height));
-    }
-  else
-    {
-      upper    = image_width;
-      max_size = MAX (image_width, image_height);
-    }
-
-  if (image && sx < shell->disp_width)
-    {
-      shell->disp_xoffset = (shell->disp_width - sx) / 2;
-
-      lower -= img2real (shell, TRUE,
-                         FUNSCALEX (shell, (gdouble) shell->disp_xoffset));
-      upper -= img2real (shell, TRUE,
-                         FUNSCALEX (shell, (gdouble) shell->disp_xoffset));
-    }
-  else if (image)
-    {
-      shell->disp_xoffset = 0;
-
-      lower += img2real (shell, TRUE,
-                         FUNSCALEX (shell, (gdouble) shell->offset_x));
-      upper += img2real (shell, TRUE,
-                         FUNSCALEX (shell, (gdouble) shell->offset_x));
-    }
-  else
-    {
-      shell->disp_xoffset = 0;
-    }
-
-  gimp_ruler_set_range (GIMP_RULER (shell->hrule), lower, upper, max_size);
-  gimp_ruler_set_unit (GIMP_RULER (shell->hrule), shell->unit);
 
-  /* vertical ruler */
 
-  lower = 0;
+  /* Vertcal scrollbar */
 
-  if (image)
-    {
-      upper    = img2real (shell, FALSE, FUNSCALEY (shell, shell->disp_height));
-      max_size = img2real (shell, FALSE, MAX (image_width, image_height));
-    }
-  else
-    {
-      upper    = image_height;
-      max_size = MAX (image_width, image_height);
-    }
+  shell->vsbdata->value          = shell->offset_y;
+  shell->vsbdata->page_size      = shell->disp_height;
+  shell->vsbdata->page_increment = shell->disp_height / 2;
 
-  if (image && sy < shell->disp_height)
-    {
-      shell->disp_yoffset = (shell->disp_height - sy) / 2;
+  gimp_display_shell_setup_vscrollbar_with_value (shell, shell->offset_y);
 
-      lower -= img2real (shell, FALSE,
-                         FUNSCALEY (shell, (gdouble) shell->disp_yoffset));
-      upper -= img2real (shell, FALSE,
-                         FUNSCALEY (shell, (gdouble) shell->disp_yoffset));
-    }
-  else if (image)
-    {
-      shell->disp_yoffset = 0;
-
-      lower += img2real (shell, FALSE,
-                         FUNSCALEY (shell, (gdouble) shell->offset_y));
-      upper += img2real (shell, FALSE,
-                         FUNSCALEY (shell, (gdouble) shell->offset_y));
-    }
-  else
-    {
-      shell->disp_yoffset = 0;
-    }
+  gtk_adjustment_changed (shell->vsbdata);
 
-  gimp_ruler_set_range (GIMP_RULER (shell->vrule), lower, upper, max_size);
-  gimp_ruler_set_unit (GIMP_RULER (shell->vrule), shell->unit);
 
-#if 0
-  g_printerr ("offset_x:     %d\n"
-              "offset_y:     %d\n"
-              "disp_width:   %d\n"
-              "disp_height:  %d\n"
-              "disp_xoffset: %d\n"
-              "disp_yoffset: %d\n\n",
-              shell->offset_x, shell->offset_y,
-              shell->disp_width, shell->disp_height,
-              shell->disp_xoffset, shell->disp_yoffset);
-#endif
+  /* Setup rulers */
+  {
+    gdouble horizontal_lower;
+    gdouble horizontal_upper;
+    gdouble horizontal_max_size;
+    gdouble vertical_lower;
+    gdouble vertical_upper;
+    gdouble vertical_max_size;
+    gint    scaled_viewport_offset_x;
+    gint    scaled_viewport_offset_y;
+
+
+    /* Initialize values */
+
+    horizontal_lower = 0;
+    vertical_lower   = 0;
+
+    if (image)
+      {
+        horizontal_upper    = img2real (shell, TRUE,
+					FUNSCALEX (shell, shell->disp_width));
+        horizontal_max_size = img2real (shell, TRUE,
+					MAX (image_width, image_height));
+
+        vertical_upper      = img2real (shell, FALSE,
+					FUNSCALEY (shell, shell->disp_height));
+        vertical_max_size   = img2real (shell, FALSE,
+					MAX (image_width, image_height));
+      }
+    else
+      {
+        horizontal_upper    = image_width;
+        horizontal_max_size = MAX (image_width, image_height);
+
+        vertical_upper      = image_height;
+        vertical_max_size   = MAX (image_width, image_height);
+      }
+
+
+    /* Adjust due to scrolling */
+
+    gimp_display_shell_get_scaled_viewport_offset (shell,
+                                                   &scaled_viewport_offset_x,
+                                                   &scaled_viewport_offset_y);
+
+    horizontal_lower -= img2real (shell, TRUE,
+                                  FUNSCALEX (shell,
+					     (gdouble) scaled_viewport_offset_x));
+    horizontal_upper -= img2real (shell, TRUE,
+                                  FUNSCALEX (shell,
+					     (gdouble) scaled_viewport_offset_x));
+
+    vertical_lower   -= img2real (shell, FALSE,
+                                  FUNSCALEY (shell,
+					     (gdouble) scaled_viewport_offset_y));
+    vertical_upper   -= img2real (shell, FALSE,
+                                  FUNSCALEY (shell,
+					     (gdouble) scaled_viewport_offset_y));
+
+
+    /* Finally setup the actual rulers */
+
+    gimp_ruler_set_range (GIMP_RULER (shell->hrule),
+                          horizontal_lower,
+                          horizontal_upper,
+                          horizontal_max_size);
+
+    gimp_ruler_set_unit  (GIMP_RULER (shell->hrule),
+                          shell->unit);
+
+    gimp_ruler_set_range (GIMP_RULER (shell->vrule),
+                          vertical_lower,
+                          vertical_upper,
+                          vertical_max_size);
+
+    gimp_ruler_set_unit  (GIMP_RULER (shell->vrule),
+                          shell->unit);
+  }
 }
 
 /**
@@ -334,8 +325,9 @@
   x = shell->disp_width  / 2;
   y = shell->disp_height / 2;
 
-  /*  Center on the mouse position instead of the display center,
-   *  if one of the following conditions is fulfilled:
+  /*  Center on the mouse position instead of the display center if
+   *  one of the following conditions are fulfilled and pointer is
+   *  within the canvas:
    *
    *   (1) there's no current event (the action was triggered by an
    *       input controller)
@@ -352,7 +344,21 @@
       gtk_get_event_widget (event) == shell->canvas ||
       gtk_get_event_widget (event) == GTK_WIDGET (shell))
     {
-      gtk_widget_get_pointer (shell->canvas, &x, &y);
+      gint canvas_pointer_x;
+      gint canvas_pointer_y;
+
+      gtk_widget_get_pointer (shell->canvas,
+                              &canvas_pointer_x,
+                              &canvas_pointer_y);
+
+      if (canvas_pointer_x >= 0 &&
+          canvas_pointer_y >= 0 &&
+          canvas_pointer_x < shell->disp_width &&
+          canvas_pointer_y < shell->disp_height)
+        {
+          x = canvas_pointer_x;
+          y = canvas_pointer_y;
+        }
     }
 
   gimp_display_shell_scale_to (shell, zoom_type, new_scale, x, y);
@@ -446,6 +452,7 @@
                      (gdouble) shell->disp_height / (gdouble) image_height);
 
   gimp_display_shell_scale (shell, GIMP_ZOOM_TO, zoom_factor);
+  gimp_display_shell_center_image (shell, TRUE, TRUE);
 }
 
 /**
@@ -484,6 +491,97 @@
                      (gdouble) shell->disp_height / (gdouble) image_height);
 
   gimp_display_shell_scale (shell, GIMP_ZOOM_TO, zoom_factor);
+  gimp_display_shell_center_image (shell, TRUE, TRUE);
+}
+
+/**
+ * gimp_display_shell_center_image:
+ * @shell:
+ * @horizontally:
+ * @vertically:
+ *
+ * Centers the image in the display shell on the desired axes.
+ *
+ **/
+void
+gimp_display_shell_center_image (GimpDisplayShell *shell,
+                                 gboolean          horizontally,
+                                 gboolean          vertically)
+{
+  gint sw, sh;
+  gint target_offset_x, target_offset_y;
+
+  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
+
+  if (! shell->display)
+    return;
+
+  target_offset_x = shell->offset_x;
+  target_offset_y = shell->offset_y;
+
+  gimp_display_shell_get_scaled_image_size (shell, &sw, &sh);
+
+  if (horizontally)
+    {
+      if (sw < shell->disp_width)
+        {
+          target_offset_x = -(shell->disp_width - sw) / 2;
+        }
+      else
+        {
+          target_offset_x = (sw - shell->disp_width) / 2;
+        }
+    }
+
+  if (vertically)
+    {
+      if (sh < shell->disp_height)
+        {
+          target_offset_y = -(shell->disp_height - sh) / 2;
+        }
+      else
+        {
+          target_offset_y = (sh - shell->disp_height) / 2;
+        }
+    }
+
+  /* Note that we can't use gimp_display_shell_scroll_private() here
+   * because that would expose the image twice, causing unwanted
+   * flicker.
+   */
+  gimp_display_shell_scale_by_values (shell, gimp_zoom_model_get_factor (shell->zoom),
+                                      target_offset_x, target_offset_y,
+                                      shell->display->config->resize_windows_on_zoom);
+}
+
+static void
+gimp_display_shell_size_allocate_center_image_callback (GimpDisplayShell *shell,
+                                                        GtkAllocation    *allocation,
+                                                        GtkWidget        *canvas)
+{
+  gimp_display_shell_center_image (shell, TRUE, TRUE);
+
+  g_signal_handlers_disconnect_by_func (canvas,
+                                        gimp_display_shell_size_allocate_center_image_callback,
+                                        shell);
+}
+
+/**
+ * gimp_display_shell_center_image_on_next_size_allocate:
+ * @shell:
+ *
+ * Centers the image in the display as soon as the canvas has got its
+ * new size
+ *
+ **/
+void
+gimp_display_shell_center_image_on_next_size_allocate (GimpDisplayShell *shell)
+{
+  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
+
+  g_signal_connect_swapped (shell->canvas, "size-allocate",
+                            G_CALLBACK (gimp_display_shell_size_allocate_center_image_callback),
+                            shell);
 }
 
 /**

Modified: branches/soc-2008-text/app/display/gimpdisplayshell-scale.h
==============================================================================
--- branches/soc-2008-text/app/display/gimpdisplayshell-scale.h	(original)
+++ branches/soc-2008-text/app/display/gimpdisplayshell-scale.h	Wed Aug  6 20:36:18 2008
@@ -38,6 +38,11 @@
                                                  gdouble           y);
 void   gimp_display_shell_scale_fit_in          (GimpDisplayShell *shell);
 void   gimp_display_shell_scale_fill            (GimpDisplayShell *shell);
+void   gimp_display_shell_center_image          (GimpDisplayShell *shell,
+                                                 gboolean          horizontally,
+                                                 gboolean          vertically);
+void   gimp_display_shell_center_image_on_next_size_allocate
+                                                (GimpDisplayShell *shell);
 void   gimp_display_shell_scale_by_values       (GimpDisplayShell *shell,
                                                  gdouble           scale,
                                                  gint              offset_x,

Modified: branches/soc-2008-text/app/display/gimpdisplayshell-scroll.c
==============================================================================
--- branches/soc-2008-text/app/display/gimpdisplayshell-scroll.c	(original)
+++ branches/soc-2008-text/app/display/gimpdisplayshell-scroll.c	Wed Aug  6 20:36:18 2008
@@ -26,24 +26,63 @@
 
 #include "display-types.h"
 
+#include "config/gimpdisplayconfig.h"
+
+#include "base/tile-manager.h"
+
 #include "core/gimpimage.h"
+#include "core/gimpprojection.h"
 
 #include "gimpdisplay.h"
 #include "gimpdisplay-foreach.h"
 #include "gimpdisplayshell.h"
+#include "gimpdisplayshell-private.h"
 #include "gimpdisplayshell-scale.h"
 #include "gimpdisplayshell-scroll.h"
 
 
-gboolean
-gimp_display_shell_scroll (GimpDisplayShell *shell,
-                           gint              x_offset,
-                           gint              y_offset)
+#define OVERPAN_FACTOR 0.5
+
+
+/**
+ * gimp_display_shell_center_around_image_coordinate:
+ * @shell:
+ * @image_x:
+ * @image_y:
+ *
+ * Center the viewport around the passed image coordinate
+ *
+ **/
+void
+gimp_display_shell_center_around_image_coordinate (GimpDisplayShell       *shell,
+                                                   gdouble                 image_x,
+                                                   gdouble                 image_y)
+{
+  gint scaled_image_x;
+  gint scaled_image_y;
+  gint offset_to_apply_x;
+  gint offset_to_apply_y;
+
+  scaled_image_x = RINT (image_x * shell->scale_x);
+  scaled_image_y = RINT (image_y * shell->scale_y);
+
+  offset_to_apply_x = scaled_image_x - shell->disp_width  / 2 - shell->offset_x;
+  offset_to_apply_y = scaled_image_y - shell->disp_height / 2 - shell->offset_y;
+
+  gimp_display_shell_scroll_private (shell,
+                                     offset_to_apply_x,
+                                     offset_to_apply_y);
+}
+
+void
+gimp_display_shell_scroll_private (GimpDisplayShell *shell,
+                                   gint              x_offset,
+                                   gint              y_offset)
 {
   gint old_x;
   gint old_y;
 
-  g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
+  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
 
   old_x = shell->offset_x;
   old_y = shell->offset_y;
@@ -80,11 +119,7 @@
       gimp_display_shell_resume (shell);
 
       gimp_display_shell_scrolled (shell);
-
-      return TRUE;
     }
-
-  return FALSE;
 }
 
 void
@@ -94,16 +129,73 @@
 
   if (shell->display->image)
     {
-      gint sx, sy;
+      gint sw, sh;
+      gint min_offset_x;
+      gint max_offset_x;
+      gint min_offset_y;
+      gint max_offset_y;
+
+      sw = SCALEX (shell, gimp_image_get_width  (shell->display->image));
+      sh = SCALEY (shell, gimp_image_get_height (shell->display->image));
+
+      if (shell->disp_width < sw)
+        {
+          min_offset_x = 0  - shell->disp_width * OVERPAN_FACTOR;
+          max_offset_x = sw - shell->disp_width * (1.0 - OVERPAN_FACTOR);
+        }
+      else
+        {
+          gint overpan_amount;
+
+          overpan_amount = shell->disp_width - sw * (1.0 - OVERPAN_FACTOR);
+
+          min_offset_x = 0  - overpan_amount;
+          max_offset_x = sw + overpan_amount - shell->disp_width;
+        }
+
+      if (shell->disp_height < sh)
+        {
+          min_offset_y = 0  - shell->disp_height * OVERPAN_FACTOR;
+          max_offset_y = sh - shell->disp_height * (1.0 - OVERPAN_FACTOR);
+        }
+      else
+        {
+          gint overpan_amount;
+
+          overpan_amount = shell->disp_height - sh * (1.0 - OVERPAN_FACTOR);
+
+          min_offset_y = 0  - overpan_amount;
+          max_offset_y = sh + overpan_amount - shell->disp_height;
+        }
+
+
+      /* Handle scrollbar stepper sensitiity */
+
+      gtk_range_set_lower_stepper_sensitivity (GTK_RANGE (shell->hsb),
+                                               min_offset_x < shell->offset_x ?
+                                               GTK_SENSITIVITY_ON :
+                                               GTK_SENSITIVITY_OFF);
+
+      gtk_range_set_upper_stepper_sensitivity (GTK_RANGE (shell->hsb),
+                                               max_offset_x > shell->offset_x ?
+                                               GTK_SENSITIVITY_ON :
+                                               GTK_SENSITIVITY_OFF);
+
+      gtk_range_set_lower_stepper_sensitivity (GTK_RANGE (shell->vsb),
+                                               min_offset_y < shell->offset_y ?
+                                               GTK_SENSITIVITY_ON :
+                                               GTK_SENSITIVITY_OFF);
+
+      gtk_range_set_upper_stepper_sensitivity (GTK_RANGE (shell->vsb),
+                                               max_offset_y > shell->offset_y ?
+                                               GTK_SENSITIVITY_ON :
+                                               GTK_SENSITIVITY_OFF);
 
-      sx = SCALEX (shell, gimp_image_get_width  (shell->display->image));
-      sy = SCALEY (shell, gimp_image_get_height (shell->display->image));
 
-      shell->offset_x = CLAMP (shell->offset_x, 0,
-                               MAX (sx - shell->disp_width, 0));
+      /* Clamp */
 
-      shell->offset_y = CLAMP (shell->offset_y, 0,
-                               MAX (sy - shell->disp_height, 0));
+      shell->offset_x = CLAMP (shell->offset_x, min_offset_x, max_offset_x);
+      shell->offset_y = CLAMP (shell->offset_y, min_offset_y, max_offset_y);
     }
   else
     {
@@ -111,3 +203,265 @@
       shell->offset_y = 0;
     }
 }
+
+/**
+ * gimp_display_shell_get_scaled_viewport:
+ * @shell:
+ * @x:
+ * @y:
+ * @w:
+ * @h:
+ *
+ * Gets the viewport in screen coordinates, with origin at (0, 0) in
+ * the image
+ *
+ **/
+void
+gimp_display_shell_get_scaled_viewport (const GimpDisplayShell *shell,
+                                        gint                   *x,
+                                        gint                   *y,
+                                        gint                   *w,
+                                        gint                   *h)
+{
+  gint scaled_viewport_offset_x;
+  gint scaled_viewport_offset_y;
+
+  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
+
+  gimp_display_shell_get_scaled_viewport_offset (shell,
+                                                 &scaled_viewport_offset_x,
+                                                 &scaled_viewport_offset_y);
+  if (x) *x = -scaled_viewport_offset_x;
+  if (y) *y = -scaled_viewport_offset_y;
+  if (w) *w =  shell->disp_width;
+  if (h) *h =  shell->disp_height;
+}
+
+/**
+ * gimp_display_shell_get_viewport:
+ * @shell:
+ * @x:
+ * @y:
+ * @w:
+ * @h:
+ *
+ * Gets the viewport in image coordinates
+ *
+ **/
+void
+gimp_display_shell_get_viewport (const GimpDisplayShell *shell,
+                                 gdouble                *x,
+                                 gdouble                *y,
+                                 gdouble                *w,
+                                 gdouble                *h)
+{
+  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
+
+  if (x) *x = shell->offset_x    / shell->scale_x;
+  if (y) *y = shell->offset_y    / shell->scale_y;
+  if (w) *w = shell->disp_width  / shell->scale_x;
+  if (h) *h = shell->disp_height / shell->scale_y;
+}
+
+/**
+ * gimp_display_shell_get_scaled_viewport_offset:
+ * @shell:
+ * @x:
+ * @y:
+ *
+ * Gets the scaled image offset in viewport coordinates
+ *
+ **/
+void
+gimp_display_shell_get_scaled_viewport_offset (const GimpDisplayShell *shell,
+                                               gint                   *x,
+                                               gint                   *y)
+{
+  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
+
+  if (x) *x = -shell->offset_x;
+  if (y) *y = -shell->offset_y;
+}
+
+/**
+ * gimp_display_shell_get_scaled_image_size:
+ * @shell:
+ * @w:
+ * @h:
+ *
+ * Gets the size of the rendered image after it has been scaled.
+ *
+ **/
+void
+gimp_display_shell_get_scaled_image_size (const GimpDisplayShell *shell,
+                                          gint                   *w,
+                                          gint                   *h)
+{
+  GimpProjection *proj;
+  TileManager    *tiles;
+  gint            level;
+  gint            level_width;
+  gint            level_height;
+
+  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
+  g_return_if_fail (GIMP_IS_IMAGE (shell->display->image));
+
+  proj = shell->display->image->projection;
+
+  level = gimp_projection_get_level (proj, shell->scale_x, shell->scale_y);
+
+  tiles = gimp_projection_get_tiles_at_level (proj, level, NULL);
+
+  level_width  = tile_manager_width (tiles);
+  level_height = tile_manager_height (tiles);
+
+  if (w) *w = PROJ_ROUND (level_width  * (shell->scale_x * (1 << level)));
+  if (h) *h = PROJ_ROUND (level_height * (shell->scale_y * (1 << level)));
+}
+
+/**
+ * gimp_display_shell_get_disp_offset:
+ * @shell:
+ * @disp_xoffset:
+ * @disp_yoffset:
+ *
+ * In viewport coordinates, get the offset of where to start rendering
+ * the scaled image.
+ *
+ **/
+void
+gimp_display_shell_get_disp_offset (const GimpDisplayShell *shell,
+                                    gint                   *disp_xoffset,
+                                    gint                   *disp_yoffset)
+{
+  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
+
+  if (disp_xoffset)
+    {
+      if (shell->offset_x < 0)
+        {
+          *disp_xoffset = -shell->offset_x;
+        }
+      else
+        {
+          *disp_xoffset = 0;
+        }
+    }
+
+  if (disp_yoffset)
+    {
+      if (shell->offset_y < 0)
+        {
+          *disp_yoffset = -shell->offset_y;
+        }
+      else
+        {
+          *disp_yoffset = 0;
+        }
+    }
+}
+
+/**
+ * gimp_display_shell_get_render_start_offset:
+ * @shell:
+ * @offset_x:
+ * @offset_y:
+ *
+ * Get the offset into the scaled image that we should start render
+ * from
+ *
+ **/
+void
+gimp_display_shell_get_render_start_offset (const GimpDisplayShell *shell,
+                                            gint                   *offset_x,
+                                            gint                   *offset_y)
+{
+  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
+
+  if (offset_x) *offset_x = MAX (0, shell->offset_x);
+  if (offset_y) *offset_y = MAX (0, shell->offset_y);
+}
+
+/**
+ * gimp_display_shell_setup_hscrollbar_with_value:
+ * @shell:
+ * @value:
+ *
+ * Setup the limits of the horizontal scrollbar
+ *
+ **/
+void
+gimp_display_shell_setup_hscrollbar_with_value (GimpDisplayShell *shell,
+                                                gdouble           value)
+{
+  gint sw;
+
+  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
+
+  if (! shell->display ||
+      ! shell->display->image)
+    return;
+
+  gimp_display_shell_get_scaled_image_size (shell, &sw, NULL);
+
+  if (shell->disp_width < sw)
+    {
+      shell->hsbdata->lower = MIN (value,
+                                   0);
+
+      shell->hsbdata->upper = MAX (value + shell->disp_width,
+                                   sw);
+    }
+  else
+    {
+      shell->hsbdata->lower = MIN (value,
+                                   -(shell->disp_width - sw) / 2);
+
+      shell->hsbdata->upper = MAX (value + shell->disp_width,
+                                   sw + (shell->disp_width - sw) / 2);
+    }
+
+  shell->hsbdata->step_increment = MAX (shell->scale_x, 1.0);
+}
+
+/**
+ * gimp_display_shell_setup_vscrollbar_with_value:
+ * @shell:
+ * @value:
+ *
+ * Setup the limits of the vertical scrollbar
+ *
+ **/
+void
+gimp_display_shell_setup_vscrollbar_with_value (GimpDisplayShell *shell,
+                                                gdouble           value)
+{
+  gint sh;
+
+  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
+
+  if (! shell->display ||
+      ! shell->display->image)
+    return;
+
+  gimp_display_shell_get_scaled_image_size (shell, NULL, &sh);
+
+  if (shell->disp_height < sh)
+    {
+      shell->vsbdata->lower = MIN (value,
+                                   0);
+
+      shell->vsbdata->upper = MAX (value + shell->disp_height,
+                                   sh);
+    }
+  else
+    {
+      shell->vsbdata->lower = MIN (value,
+                                   -(shell->disp_height - sh) / 2);
+
+      shell->vsbdata->upper = MAX (value + shell->disp_height,
+                                   sh + (shell->disp_height - sh) / 2);
+    }
+
+  shell->vsbdata->step_increment = MAX (shell->scale_y, 1.0);
+}

Modified: branches/soc-2008-text/app/display/gimpdisplayshell-scroll.h
==============================================================================
--- branches/soc-2008-text/app/display/gimpdisplayshell-scroll.h	(original)
+++ branches/soc-2008-text/app/display/gimpdisplayshell-scroll.h	Wed Aug  6 20:36:18 2008
@@ -20,11 +20,44 @@
 #define __GIMP_DISPLAY_SHELL_SCROLL_H__
 
 
-gboolean   gimp_display_shell_scroll               (GimpDisplayShell *shell,
-                                                    gint              x_offset,
-                                                    gint              y_offset);
+void   gimp_display_shell_center_around_image_coordinate (GimpDisplayShell       *shell,
+                                                          gdouble                 image_x,
+                                                          gdouble                 image_y);
 
-void       gimp_display_shell_scroll_clamp_offsets (GimpDisplayShell *shell);
+void   gimp_display_shell_scroll_clamp_offsets           (GimpDisplayShell       *shell);
+
+void   gimp_display_shell_get_scaled_viewport            (const GimpDisplayShell *shell,
+                                                          gint                   *x,
+                                                          gint                   *y,
+                                                          gint                   *w,
+                                                          gint                   *h);
+
+void   gimp_display_shell_get_viewport                   (const GimpDisplayShell *shell,
+                                                          gdouble                *x,
+                                                          gdouble                *y,
+                                                          gdouble                *w,
+                                                          gdouble                *h);
+
+void   gimp_display_shell_get_scaled_viewport_offset     (const GimpDisplayShell *shell,
+                                                          gint                   *x,
+                                                          gint                   *y);
+
+void   gimp_display_shell_get_scaled_image_size          (const GimpDisplayShell *shell,
+                                                          gint                   *w,
+                                                          gint                   *h);
+
+void   gimp_display_shell_get_disp_offset                (const GimpDisplayShell *shell,
+                                                          gint                   *disp_xoffset,
+                                                          gint                   *disp_yoffset);
+
+void   gimp_display_shell_get_render_start_offset        (const GimpDisplayShell *shell,
+                                                          gint                   *offset_x,
+                                                          gint                   *offset_y);
+
+void   gimp_display_shell_setup_hscrollbar_with_value    (GimpDisplayShell       *shell,
+                                                          gdouble                 value);
+void   gimp_display_shell_setup_vscrollbar_with_value    (GimpDisplayShell       *shell,
+                                                          gdouble                 value);
 
 
 #endif  /*  __GIMP_DISPLAY_SHELL_SCROLL_H__  */

Modified: branches/soc-2008-text/app/display/gimpdisplayshell-transform.c
==============================================================================
--- branches/soc-2008-text/app/display/gimpdisplayshell-transform.c	(original)
+++ branches/soc-2008-text/app/display/gimpdisplayshell-transform.c	Wed Aug  6 20:36:18 2008
@@ -31,6 +31,7 @@
 
 #include "gimpdisplay.h"
 #include "gimpdisplayshell.h"
+#include "gimpdisplayshell-scroll.h"
 #include "gimpdisplayshell-transform.h"
 
 
@@ -48,6 +49,9 @@
                                          GimpCoords       *image_coords,
                                          GimpCoords       *display_coords)
 {
+  gint scaled_viewport_offset_x;
+  gint scaled_viewport_offset_y;
+
   g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
   g_return_if_fail (image_coords != NULL);
   g_return_if_fail (display_coords != NULL);
@@ -57,8 +61,12 @@
   display_coords->x = SCALEX (shell, image_coords->x);
   display_coords->y = SCALEY (shell, image_coords->y);
 
-  display_coords->x += - shell->offset_x + shell->disp_xoffset;
-  display_coords->y += - shell->offset_y + shell->disp_yoffset;
+  gimp_display_shell_get_scaled_viewport_offset (shell,
+                                                 &scaled_viewport_offset_x,
+                                                 &scaled_viewport_offset_y);
+
+  display_coords->x += scaled_viewport_offset_x;
+  display_coords->y += scaled_viewport_offset_y;
 }
 
 /**
@@ -75,14 +83,21 @@
                                            GimpCoords       *display_coords,
                                            GimpCoords       *image_coords)
 {
+  gint scaled_viewport_offset_x;
+  gint scaled_viewport_offset_y;
+
   g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
   g_return_if_fail (display_coords != NULL);
   g_return_if_fail (image_coords != NULL);
 
   *image_coords = *display_coords;
 
-  image_coords->x = display_coords->x - shell->disp_xoffset + shell->offset_x;
-  image_coords->y = display_coords->y - shell->disp_yoffset + shell->offset_y;
+  gimp_display_shell_get_scaled_viewport_offset (shell,
+                                                 &scaled_viewport_offset_x,
+                                                 &scaled_viewport_offset_y);
+
+  image_coords->x = display_coords->x - scaled_viewport_offset_x;
+  image_coords->y = display_coords->y - scaled_viewport_offset_y;
 
   image_coords->x /= shell->scale_x;
   image_coords->y /= shell->scale_y;
@@ -96,6 +111,8 @@
                                  gint             *ny,
                                  gboolean          use_offsets)
 {
+  gint   scaled_viewport_offset_x;
+  gint   scaled_viewport_offset_y;
   gint   offset_x = 0;
   gint   offset_y = 0;
   gint64 tx;
@@ -119,8 +136,11 @@
   tx = ((gint64) x * shell->x_src_dec) / shell->x_dest_inc;
   ty = ((gint64) y * shell->y_src_dec) / shell->y_dest_inc;
 
-  tx += shell->disp_xoffset - shell->offset_x;
-  ty += shell->disp_yoffset - shell->offset_y;
+  gimp_display_shell_get_scaled_viewport_offset (shell,
+                                                 &scaled_viewport_offset_x,
+                                                 &scaled_viewport_offset_y);
+  tx += scaled_viewport_offset_x;
+  ty += scaled_viewport_offset_y;
 
   /* The projected coordinates might overflow a gint in the case of big
      images at high zoom levels, so we clamp them here to avoid problems.  */
@@ -153,6 +173,8 @@
                                    gboolean          round,
                                    gboolean          use_offsets)
 {
+  gint   scaled_viewport_offset_x;
+  gint   scaled_viewport_offset_y;
   gint   offset_x = 0;
   gint   offset_y = 0;
   gint64 tx;
@@ -170,8 +192,11 @@
       gimp_item_offsets (item, &offset_x, &offset_y);
     }
 
-  tx = (gint64) x + shell->offset_x - shell->disp_xoffset;
-  ty = (gint64) y + shell->offset_y - shell->disp_yoffset;
+  gimp_display_shell_get_scaled_viewport_offset (shell,
+                                                 &scaled_viewport_offset_x,
+                                                 &scaled_viewport_offset_y);
+  tx = (gint64) x - scaled_viewport_offset_x;
+  ty = (gint64) y - scaled_viewport_offset_y;
 
   tx *= shell->x_dest_inc;
   ty *= shell->y_dest_inc;
@@ -207,6 +232,8 @@
                                     gdouble          *ny,
                                     gboolean          use_offsets)
 {
+  gint scaled_viewport_offset_x;
+  gint scaled_viewport_offset_y;
   gint offset_x = 0;
   gint offset_y = 0;
 
@@ -222,11 +249,12 @@
       gimp_item_offsets (item, &offset_x, &offset_y);
     }
 
-  *nx = SCALEX (shell, x + offset_x) - shell->offset_x;
-  *ny = SCALEY (shell, y + offset_y) - shell->offset_y;
+  gimp_display_shell_get_scaled_viewport_offset (shell,
+                                                 &scaled_viewport_offset_x,
+                                                 &scaled_viewport_offset_y);
 
-  *nx += shell->disp_xoffset;
-  *ny += shell->disp_yoffset;
+  *nx = SCALEX (shell, x + offset_x) + scaled_viewport_offset_x;
+  *ny = SCALEY (shell, y + offset_y) + scaled_viewport_offset_y;
 }
 
 /**
@@ -251,6 +279,8 @@
                                      gdouble          *ny,
                                      gboolean          use_offsets)
 {
+  gint scaled_viewport_offset_x;
+  gint scaled_viewport_offset_y;
   gint offset_x = 0;
   gint offset_y = 0;
 
@@ -258,9 +288,6 @@
   g_return_if_fail (nx != NULL);
   g_return_if_fail (ny != NULL);
 
-  x -= shell->disp_xoffset;
-  y -= shell->disp_yoffset;
-
   if (use_offsets)
     {
       GimpItem *item;
@@ -269,8 +296,12 @@
       gimp_item_offsets (item, &offset_x, &offset_y);
     }
 
-  *nx = (x + shell->offset_x) / shell->scale_x - offset_x;
-  *ny = (y + shell->offset_y) / shell->scale_y - offset_y;
+  gimp_display_shell_get_scaled_viewport_offset (shell,
+                                                 &scaled_viewport_offset_x,
+                                                 &scaled_viewport_offset_y);
+
+  *nx = (x - scaled_viewport_offset_x) / shell->scale_x - offset_x;
+  *ny = (y - scaled_viewport_offset_y) / shell->scale_y - offset_y;
 }
 
 /**
@@ -308,17 +339,21 @@
 
   for (i = 0; i < n_points ; i++)
     {
+      gint    scaled_viewport_offset_x;
+      gint    scaled_viewport_offset_y;
       gdouble x = points[i].x + offset_x;
       gdouble y = points[i].y + offset_y;
 
       x = x * shell->x_src_dec / shell->x_dest_inc;
       y = y * shell->y_src_dec / shell->y_dest_inc;
 
-      coords[i].x = CLAMP (PROJ_ROUND64 (x) +
-                           shell->disp_xoffset - shell->offset_x,
+      gimp_display_shell_get_scaled_viewport_offset (shell,
+                                                     &scaled_viewport_offset_x,
+                                                     &scaled_viewport_offset_y);
+
+      coords[i].x = CLAMP (PROJ_ROUND64 (x) + scaled_viewport_offset_x,
                            G_MININT, G_MAXINT);
-      coords[i].y = CLAMP (PROJ_ROUND64 (y) +
-                           shell->disp_yoffset - shell->offset_y,
+      coords[i].y = CLAMP (PROJ_ROUND64 (y) + scaled_viewport_offset_y,
                            G_MININT, G_MAXINT);
     }
 }
@@ -358,17 +393,21 @@
 
   for (i = 0; i < n_coords ; i++)
     {
+      gint    scaled_viewport_offset_x;
+      gint    scaled_viewport_offset_y;
       gdouble x = image_coords[i].x + offset_x;
       gdouble y = image_coords[i].y + offset_y;
 
       x = x * shell->x_src_dec / shell->x_dest_inc;
       y = y * shell->y_src_dec / shell->y_dest_inc;
 
-      disp_coords[i].x = CLAMP (PROJ_ROUND64 (x) +
-                                shell->disp_xoffset - shell->offset_x,
+      gimp_display_shell_get_scaled_viewport_offset (shell,
+                                                     &scaled_viewport_offset_x,
+                                                     &scaled_viewport_offset_y);
+
+      disp_coords[i].x = CLAMP (PROJ_ROUND64 (x) + scaled_viewport_offset_x,
                                 G_MININT, G_MAXINT);
-      disp_coords[i].y = CLAMP (PROJ_ROUND64 (y) +
-                                shell->disp_yoffset - shell->offset_y,
+      disp_coords[i].y = CLAMP (PROJ_ROUND64 (y) + scaled_viewport_offset_y,
                                 G_MININT, G_MAXINT);
     }
 }
@@ -408,6 +447,8 @@
 
   for (i = 0; i < n_segs ; i++)
     {
+      gint   scaled_viewport_offset_x;
+      gint   scaled_viewport_offset_y;
       gint64 x1, x2;
       gint64 y1, y2;
 
@@ -421,13 +462,17 @@
       y1 = (y1 * shell->y_src_dec) / shell->y_dest_inc;
       y2 = (y2 * shell->y_src_dec) / shell->y_dest_inc;
 
-      dest_segs[i].x1 = CLAMP (x1 + shell->disp_xoffset - shell->offset_x,
+      gimp_display_shell_get_scaled_viewport_offset (shell,
+                                                     &scaled_viewport_offset_x,
+                                                     &scaled_viewport_offset_y);
+
+      dest_segs[i].x1 = CLAMP (x1 + scaled_viewport_offset_x,
                                G_MININT, G_MAXINT);
-      dest_segs[i].x2 = CLAMP (x2 + shell->disp_xoffset - shell->offset_x,
+      dest_segs[i].x2 = CLAMP (x2 + scaled_viewport_offset_x,
                                G_MININT, G_MAXINT);
-      dest_segs[i].y1 = CLAMP (y1 + shell->disp_yoffset - shell->offset_y,
+      dest_segs[i].y1 = CLAMP (y1 + scaled_viewport_offset_y,
                                G_MININT, G_MAXINT);
-      dest_segs[i].y2 = CLAMP (y2 + shell->disp_yoffset - shell->offset_y,
+      dest_segs[i].y2 = CLAMP (y2 + scaled_viewport_offset_y,
                                G_MININT, G_MAXINT);
     }
 }

Modified: branches/soc-2008-text/app/display/gimpdisplayshell.c
==============================================================================
--- branches/soc-2008-text/app/display/gimpdisplayshell.c	(original)
+++ branches/soc-2008-text/app/display/gimpdisplayshell.c	Wed Aug  6 20:36:18 2008
@@ -257,8 +257,6 @@
 
   shell->disp_width             = 0;
   shell->disp_height            = 0;
-  shell->disp_xoffset           = 0;
-  shell->disp_yoffset           = 0;
 
   shell->proximity              = FALSE;
   shell->snap_to_guides         = TRUE;
@@ -339,10 +337,16 @@
   shell->scroll_start_x         = 0;
   shell->scroll_start_y         = 0;
   shell->button_press_before_focus = FALSE;
-
+  
   shell->highlight              = NULL;
   shell->mask                   = NULL;
 
+  shell->last_motion_time       = 0;
+  shell->last_motion_delta_x    = 0.0;
+  shell->last_motion_delta_y    = 0.0;
+  shell->last_motion_distance   = 0.0;
+  shell->last_motion_delta_time = 0.0;
+
   gtk_window_set_role (GTK_WINDOW (shell), "gimp-image-window");
   gtk_window_set_resizable (GTK_WINDOW (shell), TRUE);
 
@@ -937,12 +941,14 @@
   shell->hsbdata = GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, image_width,
                                                        1, 1, image_width));
   shell->hsb = gtk_hscrollbar_new (shell->hsbdata);
+
   GTK_WIDGET_UNSET_FLAGS (shell->hsb, GTK_CAN_FOCUS);
 
   /*  the vertical scrollbar  */
   shell->vsbdata = GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, image_height,
                                                        1, 1, image_height));
   shell->vsb = gtk_vscrollbar_new (shell->vsbdata);
+
   GTK_WIDGET_UNSET_FLAGS (shell->vsb, GTK_CAN_FOCUS);
 
   /*  create the contents of the inner_table  ********************************/
@@ -1198,6 +1204,9 @@
   if (display->image)
     {
       gimp_display_shell_connect (shell);
+
+      /* after connecting to the image we want to center it */
+      gimp_display_shell_center_image_on_next_size_allocate (shell);
     }
   else
     {
@@ -1316,6 +1325,35 @@
     gimp_ui_manager_update (shell->popup_manager, shell->display);
 }
 
+static void
+gimp_display_shell_center_image_callback (GimpDisplayShell *shell,
+                                          GtkAllocation    *allocation,
+                                          GtkWidget        *canvas)
+{
+  gint     sw, sh;
+  gboolean center_horizontally;
+  gboolean center_vertically;
+
+  gimp_display_shell_get_scaled_image_size (shell, &sw, &sh);
+
+  /* We only want to center on the axes on which the image is smaller
+   * than the display canvas. If it is larger, it will be centered on
+   * that axis later, and if we center on all axis unconditionally, we
+   * end up with the wrong centering if the image is larger than the
+   * display canvas.
+   */
+  center_horizontally = sw < shell->disp_width;
+  center_vertically   = sh < shell->disp_height;
+
+  gimp_display_shell_center_image (shell,
+                                   center_horizontally,
+                                   center_vertically);
+
+  g_signal_handlers_disconnect_by_func (canvas,
+                                        gimp_display_shell_center_image_callback,
+                                        shell);
+}
+
 static gboolean
 gimp_display_shell_fill_idle (GimpDisplayShell *shell)
 {
@@ -1334,9 +1372,6 @@
                          GimpUnit          unit,
                          gdouble           scale)
 {
-  gint display_width;
-  gint display_height;
-
   g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
   g_return_if_fail (GIMP_IS_DISPLAY (shell->display));
   g_return_if_fail (GIMP_IS_IMAGE (image));
@@ -1345,8 +1380,7 @@
                                      GTK_WIDGET (shell));
 
   gimp_display_shell_set_unit (shell, unit);
-  gimp_display_shell_set_initial_scale (shell, scale,
-                                        &display_width, &display_height);
+  gimp_display_shell_set_initial_scale (shell, scale, NULL, NULL);
   gimp_display_shell_scale_changed (shell);
 
   gimp_statusbar_fill (GIMP_STATUSBAR (shell->statusbar));
@@ -1355,6 +1389,15 @@
 
   gimp_help_set_help_data (shell->canvas, NULL, NULL);
 
+  /* Not pretty, but we need to center the image as soon as the canvas
+   * has got its new size allocated. The centering will be wrong if we
+   * do it too early, and if we do it too late flickering will occur
+   * due to the image being rendered twice.
+   */
+  g_signal_connect_swapped (shell->canvas, "size-allocate",
+                            G_CALLBACK (gimp_display_shell_center_image_callback),
+                            shell);
+
   shell->fill_idle_id = g_idle_add_full (G_PRIORITY_LOW,
                                          (GSourceFunc) gimp_display_shell_fill_idle,
                                          shell, NULL);

Modified: branches/soc-2008-text/app/display/gimpdisplayshell.h
==============================================================================
--- branches/soc-2008-text/app/display/gimpdisplayshell.h	(original)
+++ branches/soc-2008-text/app/display/gimpdisplayshell.h	Wed Aug  6 20:36:18 2008
@@ -99,8 +99,6 @@
 
   gint               disp_width;       /*  width of drawing area              */
   gint               disp_height;      /*  height of drawing area             */
-  gint               disp_xoffset;
-  gint               disp_yoffset;
 
   gboolean           proximity;        /*  is a device in proximity           */
   gboolean           snap_to_guides;   /*  should the guides be snapped to?   */
@@ -182,8 +180,6 @@
   gint               scroll_start_x;
   gint               scroll_start_y;
   gboolean           button_press_before_focus;
-  guint32            last_disp_motion_time; /*  previous time of a forwarded motion event  */
-  guint32            last_read_motion_time;
 
   GdkRectangle      *highlight;        /* in image coordinates, can be NULL   */
   GimpDrawable      *mask;
@@ -192,6 +188,14 @@
   gpointer           scroll_info;
 
   GimpCoords         last_coords;      /* last motion event                   */
+
+  guint32            last_motion_time; /*  previous time of a forwarded motion event  */
+  guint32            last_read_motion_time;
+  gdouble            last_motion_delta_time;
+  gdouble            last_motion_delta_x;
+  gdouble            last_motion_delta_y;
+  gdouble            last_motion_distance;
+
 };
 
 struct _GimpDisplayShellClass

Modified: branches/soc-2008-text/app/display/gimpnavigationeditor.c
==============================================================================
--- branches/soc-2008-text/app/display/gimpnavigationeditor.c	(original)
+++ branches/soc-2008-text/app/display/gimpnavigationeditor.c	Wed Aug  6 20:36:18 2008
@@ -53,6 +53,9 @@
 #include "gimp-intl.h"
 
 
+#define BORDER_PEN_WIDTH  3
+
+
 static void   gimp_navigation_editor_docked_iface_init (GimpDockedInterface  *iface);
 
 static void   gimp_navigation_editor_destroy           (GtkObject            *object);
@@ -71,6 +74,8 @@
 static void   gimp_navigation_editor_marker_changed    (GimpNavigationView   *view,
                                                         gdouble               x,
                                                         gdouble               y,
+                                                        gdouble               width,
+                                                        gdouble               height,
                                                         GimpNavigationEditor *editor);
 static void   gimp_navigation_editor_zoom              (GimpNavigationView   *view,
                                                         GimpZoomType          direction,
@@ -226,6 +231,10 @@
   GdkScreen            *screen;
   gint                  x, y;
   gint                  x_org, y_org;
+  gint                  view_marker_x;
+  gint                  view_marker_y;
+  gint                  view_marker_width;
+  gint                  view_marker_height;
 
   g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
   g_return_if_fail (GTK_IS_WIDGET (widget));
@@ -267,16 +276,20 @@
   /* decide where to put the popup */
   gdk_window_get_origin (widget->window, &x_org, &y_org);
 
-#define BORDER_PEN_WIDTH  3
+  gimp_navigation_view_get_local_marker (view,
+                                         &view_marker_x,
+                                         &view_marker_y,
+                                         &view_marker_width,
+                                         &view_marker_height);
 
   x = (x_org + click_x -
-       view->p_x -
-       0.5 * (view->p_width  - BORDER_PEN_WIDTH) -
+       view_marker_x -
+       0.5 * (view_marker_width  - BORDER_PEN_WIDTH) -
        2   * style->xthickness);
 
   y = (y_org + click_y -
-       view->p_y -
-       0.5 * (view->p_height - BORDER_PEN_WIDTH) -
+       view_marker_y -
+       0.5 * (view_marker_height - BORDER_PEN_WIDTH) -
        2   * style->ythickness);
 
   /* If the popup doesn't fit into the screen, we have a problem.
@@ -302,11 +315,9 @@
   gdk_flush ();
 
   /* fill in then grab pointer */
-  view->motion_offset_x = 0.5 * (view->p_width  - BORDER_PEN_WIDTH);
-  view->motion_offset_y = 0.5 * (view->p_height - BORDER_PEN_WIDTH);
-
-#undef BORDER_PEN_WIDTH
-
+  gimp_navigation_view_set_motion_offset (view,
+                                          0.5 * (view_marker_width  - BORDER_PEN_WIDTH),
+                                          0.5 * (view_marker_height - BORDER_PEN_WIDTH));
   gimp_navigation_view_grab_pointer (view);
 }
 
@@ -491,15 +502,17 @@
 gimp_navigation_editor_marker_changed (GimpNavigationView   *view,
                                        gdouble               x,
                                        gdouble               y,
+                                       gdouble               width,
+                                       gdouble               height,
                                        GimpNavigationEditor *editor)
 {
   if (editor->shell)
     {
       GimpDisplayShell *shell = editor->shell;
 
-      gimp_display_shell_scroll (shell,
-                                 RINT (x * shell->scale_x - shell->offset_x),
-                                 RINT (y * shell->scale_y - shell->offset_y));
+      gimp_display_shell_center_around_image_coordinate (shell,
+                                                         x + width / 2,
+                                                         y + height / 2);
     }
 }
 
@@ -642,9 +655,13 @@
     gimp_view_renderer_set_dot_for_dot (renderer, shell->dot_for_dot);
 
   if (renderer->viewable)
-    gimp_navigation_view_set_marker (GIMP_NAVIGATION_VIEW (editor->view),
-                                     shell->offset_x    / shell->scale_x,
-                                     shell->offset_y    / shell->scale_y,
-                                     shell->disp_width  / shell->scale_x,
-                                     shell->disp_height / shell->scale_y);
+    {
+      GimpNavigationView *view = GIMP_NAVIGATION_VIEW (editor->view);
+      gdouble             x, y;
+      gdouble             w, h;
+
+      gimp_display_shell_get_viewport (shell, &x, &y, &w, &h);
+
+      gimp_navigation_view_set_marker (view, x, y, w, h);
+    }
 }

Modified: branches/soc-2008-text/app/display/gimpstatusbar.c
==============================================================================
--- branches/soc-2008-text/app/display/gimpstatusbar.c	(original)
+++ branches/soc-2008-text/app/display/gimpstatusbar.c	Wed Aug  6 20:36:18 2008
@@ -493,13 +493,18 @@
   GimpStatusbar *statusbar  = GIMP_STATUSBAR (progress);
   GtkWidget     *label      = GTK_STATUSBAR (statusbar)->label;
   PangoLayout   *layout;
-  const gchar   *stock_id   = gimp_get_message_stock_id (severity);
+  const gchar   *stock_id;
   gboolean       handle_msg = FALSE;
 
-  /*  we can only handle short one-liners  */
+  /*  don't accept a message if we are already displaying one  */
+  if (statusbar->temp_timeout_id)
+    return FALSE;
 
+  /*  we can only handle short one-liners  */
   layout = gtk_widget_create_pango_layout (label, message);
 
+  stock_id = gimp_get_message_stock_id (severity);
+
   if (pango_layout_get_line_count (layout) == 1)
     {
       gint width;

Modified: branches/soc-2008-text/app/gui/Makefile.am
==============================================================================
--- branches/soc-2008-text/app/gui/Makefile.am	(original)
+++ branches/soc-2008-text/app/gui/Makefile.am	Wed Aug  6 20:36:18 2008
@@ -15,13 +15,17 @@
 
 noinst_LIBRARIES = libappgui.a
 
-libappgui_a_SOURCES = \
+libappgui_a_sources = \
 	color-history.c		\
 	color-history.h		\
+	gimpdbusservice.c	\
+	gimpdbusservice.h	\
 	gui.c			\
 	gui.h			\
 	gui-message.c		\
 	gui-message.h		\
+	gui-unique.c		\
+	gui-unique.h		\
 	gui-vtable.c		\
 	gui-vtable.h		\
 	gui-types.h		\
@@ -34,4 +38,23 @@
 	ige-mac-menu.c		\
 	ige-mac-menu.h
 
-EXTRA_DIST = makefile.msc
+libappgui_a_built_sources = gimpdbusservice-glue.h 
+
+libappgui_a_SOURCES = $(libappgui_a_built_sources) $(libappgui_a_sources)
+
+EXTRA_DIST = \
+	dbus-service.xml	\
+	makefile.msc
+
+
+#
+# rules to generate built sources
+#
+# setup autogeneration dependencies
+gen_sources = gimpdbusservice-glue.h
+CLEANFILES = $(gen_sources)
+
+$(srcdir)/gimpdbusservice.c: gimpdbusservice-glue.h
+
+gimpdbusservice-glue.h: $(srcdir)/dbus-service.xml
+	$(DBUS_BINDING_TOOL) --mode=glib-server --prefix=gimp $< > $(@F)

Modified: branches/soc-2008-text/app/gui/gui.c
==============================================================================
--- branches/soc-2008-text/app/gui/gui.c	(original)
+++ branches/soc-2008-text/app/gui/gui.c	Wed Aug  6 20:36:18 2008
@@ -22,12 +22,6 @@
 
 #include <gtk/gtk.h>
 
-#if HAVE_DBUS_GLIB
-#define DBUS_API_SUBJECT_TO_CHANGE
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-lowlevel.h>
-#endif
-
 #include "libgimpbase/gimpbase.h"
 #include "libgimpwidgets/gimpwidgets.h"
 #include "libgimpwidgets/gimpwidgets-private.h"
@@ -57,7 +51,6 @@
 #include "widgets/gimpclipboard.h"
 #include "widgets/gimpcolorselectorpalette.h"
 #include "widgets/gimpcontrollers.h"
-#include "widgets/gimpdbusservice.h"
 #include "widgets/gimpdevices.h"
 #include "widgets/gimpdevicestatus.h"
 #include "widgets/gimpdialogfactory.h"
@@ -80,6 +73,7 @@
 
 #include "color-history.h"
 #include "gui.h"
+#include "gui-unique.h"
 #include "gui-vtable.h"
 #include "session.h"
 #include "splash.h"
@@ -136,18 +130,11 @@
                                                  Gimp               *gimp);
 static void       gui_display_remove            (GimpContainer      *displays);
 
-static void       gui_dbus_service_init         (Gimp               *gimp);
-static void       gui_dbus_service_exit         (void);
-
 
 /*  private variables  */
 
-static Gimp            *the_gui_gimp     = NULL;
-static GimpUIManager   *image_ui_manager = NULL;
-
-#if HAVE_DBUS_GLIB
-static DBusGConnection *dbus_connection  = NULL;
-#endif
+static Gimp          *the_gui_gimp     = NULL;
+static GimpUIManager *image_ui_manager = NULL;
 
 
 /*  public functions  */
@@ -525,7 +512,7 @@
   display = GIMP_DISPLAY (gimp_create_display (gimp,
                                                NULL, GIMP_UNIT_PIXEL, 1.0));
 
-  gui_dbus_service_init (gimp);
+  gui_unique_init (gimp);
 
   if (gui_config->restore_session)
     session_restore (gimp);
@@ -559,9 +546,7 @@
 
   gimp->message_handler = GIMP_CONSOLE;
 
-#if HAVE_DBUS_GLIB
-  gui_dbus_service_exit ();
-#endif
+  gui_unique_exit ();
 
   if (gui_config->save_session_info)
     session_save (gimp, FALSE);
@@ -761,43 +746,3 @@
   if (gimp_container_is_empty (displays))
     windows_show_toolbox ();
 }
-
-static void
-gui_dbus_service_init (Gimp *gimp)
-{
-#if HAVE_DBUS_GLIB
-  GError  *error = NULL;
-
-  g_return_if_fail (dbus_connection == NULL);
-
-  dbus_connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
-
-  if (dbus_connection)
-    {
-      GObject *service = gimp_dbus_service_new (gimp);
-
-      dbus_bus_request_name (dbus_g_connection_get_connection (dbus_connection),
-                             GIMP_DBUS_SERVICE_NAME, 0, NULL);
-
-      dbus_g_connection_register_g_object (dbus_connection,
-                                           GIMP_DBUS_SERVICE_PATH, service);
-    }
-  else
-    {
-      g_printerr ("%s\n", error->message);
-      g_error_free (error);
-    }
-#endif
-}
-
-static void
-gui_dbus_service_exit (void)
-{
-#if HAVE_DBUS_GLIB
-  if (dbus_connection)
-    {
-      dbus_g_connection_unref (dbus_connection);
-      dbus_connection = NULL;
-    }
-#endif
-}

Modified: branches/soc-2008-text/app/gui/session.c
==============================================================================
--- branches/soc-2008-text/app/gui/session.c	(original)
+++ branches/soc-2008-text/app/gui/session.c	Wed Aug  6 20:36:18 2008
@@ -155,6 +155,8 @@
                   skip = (info->toplevel_entry == NULL);
                 }
 
+              g_free (entry_name);
+
               if (GIMP_CONFIG_GET_INTERFACE (info)->deserialize (GIMP_CONFIG (info),
                                                                  scanner,
                                                                  1,

Modified: branches/soc-2008-text/app/gui/splash.c
==============================================================================
--- branches/soc-2008-text/app/gui/splash.c	(original)
+++ branches/soc-2008-text/app/gui/splash.c	Wed Aug  6 20:36:18 2008
@@ -151,7 +151,7 @@
       splash->area = gtk_image_new_from_animation (pixbuf);
     }
 
-  gtk_box_pack_start_defaults (GTK_BOX (vbox), splash->area);
+  gtk_box_pack_start (GTK_BOX (vbox), splash->area, TRUE, TRUE, 0);
   gtk_widget_show (splash->area);
 
   gtk_widget_set_size_request (splash->area, splash->width, splash->height);

Modified: branches/soc-2008-text/app/main.c
==============================================================================
--- branches/soc-2008-text/app/main.c	(original)
+++ branches/soc-2008-text/app/main.c	Wed Aug  6 20:36:18 2008
@@ -41,10 +41,6 @@
 #include <io.h> /* get_osfhandle */
 #endif
 
-#if HAVE_DBUS_GLIB
-#include <dbus/dbus-glib.h>
-#endif
-
 #ifndef GIMP_CONSOLE_COMPILATION
 #include <gdk/gdk.h>
 #endif
@@ -59,14 +55,11 @@
 
 #include "core/gimp.h"
 
-#include "file/file-utils.h"
-
-#include "widgets/gimpdbusservice.h"
-
 #include "about.h"
 #include "app.h"
 #include "errors.h"
 #include "sanity.h"
+#include "unique.h"
 #include "units.h"
 #include "version.h"
 
@@ -113,11 +106,6 @@
 #define gimp_open_console_window() /* as nothing */
 #endif
 
-static gboolean  gimp_dbus_open               (const gchar **filenames,
-                                               gboolean      as_new,
-                                               gboolean      be_verbose);
-
-
 static const gchar        *system_gimprc     = NULL;
 static const gchar        *user_gimprc       = NULL;
 static const gchar        *session_name      = NULL;
@@ -386,11 +374,18 @@
   if (no_interface)
     new_instance = TRUE;
 
-  if (! new_instance)
+#ifndef GIMP_CONSOLE_COMPILATION
+  if (! new_instance && gimp_unique_open (filenames, as_new))
     {
-      if (gimp_dbus_open (filenames, as_new, be_verbose))
-        return EXIT_SUCCESS;
+      if (be_verbose)
+	g_print ("%s\n",
+		 _("Another GIMP instance is already running."));
+
+      gdk_notify_startup_complete ();
+
+      return EXIT_SUCCESS;
     }
+#endif
 
   abort_message = sanity_check ();
   if (abort_message)
@@ -607,9 +602,6 @@
    *
    * An alternative to tuning this parameter would be to use
    * malloc_trim(), for example after releasing a large tile-manager.
-   *
-   * Another possibility is to switch to using GSlice as soon as this
-   * API is available in a stable GLib release.
    */
   mallopt (M_MMAP_THRESHOLD, TILE_WIDTH * TILE_HEIGHT);
 #endif
@@ -698,113 +690,3 @@
 }
 
 #endif /* ! G_OS_WIN32 */
-
-
-static gboolean
-gimp_dbus_open (const gchar **filenames,
-                gboolean      as_new,
-                gboolean      be_verbose)
-{
-#ifndef GIMP_CONSOLE_COMPILATION
-#if HAVE_DBUS_GLIB
-  DBusGConnection *connection = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
-
-  if (connection)
-    {
-      DBusGProxy *proxy;
-      gboolean    success;
-      GError     *error = NULL;
-
-      proxy = dbus_g_proxy_new_for_name (connection,
-                                         GIMP_DBUS_SERVICE_NAME,
-                                         GIMP_DBUS_SERVICE_PATH,
-                                         GIMP_DBUS_SERVICE_INTERFACE);
-
-      if (filenames)
-        {
-          const gchar *method = as_new ? "OpenAsNew" : "Open";
-          gchar       *cwd    = NULL;
-          gint         i;
-
-          for (i = 0, success = TRUE; filenames[i] && success; i++)
-            {
-              const gchar *filename = filenames[i];
-              gchar       *uri      = NULL;
-
-              if (file_utils_filename_is_uri (filename, &error))
-                {
-                  uri = g_strdup (filename);
-                }
-              else if (! error)
-                {
-                  if (! g_path_is_absolute (filename))
-                    {
-                      gchar *absolute;
-
-                      if (! cwd)
-                        cwd = g_get_current_dir ();
-
-                      absolute = g_build_filename (cwd, filename, NULL);
-
-                      uri = g_filename_to_uri (absolute, NULL, &error);
-
-                      g_free (absolute);
-                    }
-                  else
-                    {
-                      uri = g_filename_to_uri (filename, NULL, &error);
-                    }
-                }
-
-              if (uri)
-                {
-                  gboolean retval; /* ignored */
-
-                  success = dbus_g_proxy_call (proxy, method, &error,
-                                               G_TYPE_STRING, uri,
-                                               G_TYPE_INVALID,
-                                               G_TYPE_BOOLEAN, &retval,
-                                               G_TYPE_INVALID);
-                  g_free (uri);
-                }
-              else
-                {
-                  g_printerr ("conversion to uri failed: %s\n", error->message);
-                  g_clear_error (&error);
-                }
-            }
-
-          g_free (cwd);
-        }
-      else
-        {
-          success = dbus_g_proxy_call (proxy, "Activate", &error,
-                                       G_TYPE_INVALID, G_TYPE_INVALID);
-        }
-
-      g_object_unref (proxy);
-      dbus_g_connection_unref (connection);
-
-      if (success)
-        {
-          if (be_verbose)
-            g_print ("%s\n",
-                     _("Another GIMP instance is already running."));
-
-          gdk_notify_startup_complete ();
-
-          return TRUE;
-        }
-      else if (! (error->domain == DBUS_GERROR &&
-                  error->code == DBUS_GERROR_SERVICE_UNKNOWN))
-        {
-          g_print ("%s\n", error->message);
-        }
-
-      g_clear_error (&error);
-    }
-#endif
-#endif
-
-  return FALSE;
-}

Modified: branches/soc-2008-text/app/menus/file-menu.c
==============================================================================
--- branches/soc-2008-text/app/menus/file-menu.c	(original)
+++ branches/soc-2008-text/app/menus/file-menu.c	Wed Aug  6 20:36:18 2008
@@ -105,7 +105,12 @@
                                      GtkTooltip *tooltip,
                                      GimpAction *action)
 {
-  gtk_tooltip_set_text (tooltip, gtk_widget_get_tooltip_text (widget));
+  gchar *text;
+
+  text = gtk_widget_get_tooltip_text (widget);
+  gtk_tooltip_set_text (tooltip, text);
+  g_free (text);
+
   gtk_tooltip_set_icon (tooltip,
                         gimp_viewable_get_pixbuf (action->viewable,
                                                   action->context,

Modified: branches/soc-2008-text/app/paint-funcs/scale-region.c
==============================================================================
--- branches/soc-2008-text/app/paint-funcs/scale-region.c	(original)
+++ branches/soc-2008-text/app/paint-funcs/scale-region.c	Wed Aug  6 20:36:18 2008
@@ -26,656 +26,1104 @@
 
 #include "paint-funcs-types.h"
 
+#include "base/tile.h"
+#include "base/tile-manager.h"
 #include "base/pixel-region.h"
 
+#include "paint-funcs.h"
 #include "scale-region.h"
 
 
-#define EPSILON          (0.0001)  /* arbitary small number for avoiding zero */
+static void           scale_region_buffer     (PixelRegion           *srcPR,
+                                               PixelRegion           *dstPR,
+                                               GimpInterpolationType  interpolation,
+                                               GimpProgressFunc       progress_callback,
+                                               gpointer               progress_data);
+static void           scale_region_tile       (PixelRegion           *srcPR,
+                                               PixelRegion           *dstPR,
+                                               GimpInterpolationType  interpolation,
+                                               GimpProgressFunc       progress_callback,
+                                               gpointer               progress_data);
+static void           scale                   (TileManager           *srcTM,
+                                               TileManager           *dstTM,
+                                               GimpInterpolationType  interpolation,
+                                               GimpProgressFunc       progress_callback,
+                                               gpointer               progress_data,
+                                               gint                  *progress,
+                                               gint                   max_progress);
+static void           scale_pr                (PixelRegion           *srcPR,
+                                               PixelRegion           *dstPR,
+                                               GimpInterpolationType  interpolation);
+static void           interpolate_bilinear    (TileManager           *srcTM,
+                                               gint                   x0,
+                                               gint                   y0,
+                                               gint                   x1,
+                                               gint                   y1,
+                                               gdouble                xfrac,
+                                               gdouble                yfrac,
+                                               guchar                *pixel,
+                                               gfloat                *kernel_lookup);
+static void           interpolate_nearest     (TileManager           *srcTM,
+                                               gint                   x0,
+                                               gint                   y0,
+                                               gint                   x1,
+                                               gint                   y1,
+                                               gdouble                xfrac,
+                                               gdouble                yfrac,
+                                               guchar                *pixel,
+                                               gfloat                *kernel_lookup);
+static void           interpolate_cubic       (TileManager           *srcTM,
+                                               gint                   x0,
+                                               gint                   y0,
+                                               gint                   x1,
+                                               gint                   y1,
+                                               gdouble                xfrac,
+                                               gdouble                yfrac,
+                                               guchar                *pixel,
+                                               gfloat                *kernel_lookup);
+static void           decimate_gauss          (TileManager           *srcTM,
+                                               gint                   x0,
+                                               gint                   y0,
+                                               gint                   x1,
+                                               gint                   y1,
+                                               gdouble                xfrac,
+                                               gdouble                yfrac,
+                                               guchar                *pixel,
+                                               gfloat                *kernel_lookup);
+static void           decimate_average        (TileManager           *srcTM,
+                                               gint                   x0,
+                                               gint                   y0,
+                                               gint                   x1,
+                                               gint                   y1,
+                                               gdouble                xfrac,
+                                               gdouble                yfrac,
+                                               guchar                *pixel,
+                                               gfloat                *kernel_lookup);
+static gfloat *       create_lanczos3_lookup  (void);
+static void           interpolate_lanczos3    (TileManager           *srcTM,
+                                               gint                   x1,
+                                               gint                   y1,
+                                               gint                   x2,
+                                               gint                   y2,
+                                               gdouble                xfrac,
+                                               gdouble                yfrac,
+                                               guchar                *pixel,
+                                               gfloat                *kernel_lookup);
+static void           decimate_average_pr     (PixelRegion           *srcPR,
+                                               gint                   x0,
+                                               gint                   y0,
+                                               gint                   x1,
+                                               gint                   y1,
+                                               guchar                *pixel);
+static void           interpolate_bilinear_pr (PixelRegion           *srcPR,
+                                               gint                   x0,
+                                               gint                   y0,
+                                               gint                   x1,
+                                               gint                   y1,
+                                               gdouble                xfrac,
+                                               gdouble                yfrac,
+                                               guchar                *p);
+static void           determine_scale         (PixelRegion           *srcPR,
+                                               PixelRegion           *dstPR,
+                                               gint                  *levelx,
+                                               gint                  *levely,
+                                               gint                  *max_progress);
+static inline void    gaussan_lanczos2        (guchar                *pixels,
+                                               gint                   bytes,
+                                               guchar                *pixel);
+static inline void    decimate_lanczos2       (TileManager           *srcTM,
+                                               gint                   x0,
+                                               gint                   y0,
+                                               gint                   x1,
+                                               gint                   y1,
+                                               gdouble                xfrac,
+                                               gdouble                yfrac,
+                                               guchar                *pixel,
+                                               gfloat                *kernel_lookup);
+static inline void    pixel_average           (guchar                *p1,
+                                               guchar                *p2,
+                                               guchar                *p3,
+                                               guchar                *p4,
+                                               guchar                *p,
+                                               gint                   bytes);
+static inline void    gaussan_decimate        (guchar                *pixels,
+                                               gint                   bytes,
+                                               guchar                *pixel);
+static inline gdouble cubic_spline_fit        (gdouble                dx,
+                                               gint                   pt0,
+                                               gint                   pt1,
+                                               gint                   pt2,
+                                               gint                   pt3);
+static inline gdouble weighted_sum            (gdouble                dx,
+                                               gdouble                dy,
+                                               gint                   s00,
+                                               gint                   s10,
+                                               gint                   s01,
+                                               gint                   s11);
+static inline gdouble sinc                    (gdouble                x);
+static inline gdouble lanczos3_mul_alpha       (guchar                *pixels,
+                                               gdouble               *x_kernel,
+                                               gdouble               *y_kernel,
+                                               gint                   bytes,
+                                               gint                   byte);
+static inline gdouble lanczos3_mul            (guchar                *pixels,
+                                               gdouble               *x_kernel,
+                                               gdouble               *y_kernel,
+                                               gint                   bytes,
+                                               gint                   byte);
 
-static void  scale_region_no_resample (PixelRegion           *srcPR,
-                                       PixelRegion           *destPR);
-static void  scale_region_lanczos     (PixelRegion           *srcPR,
-                                       PixelRegion           *dstPR,
-                                       GimpProgressFunc       progress_callback,
-                                       gpointer               progress_data);
-
-static void  expand_line              (gdouble               *dest,
-                                       const gdouble         *src,
-                                       gint                   bytes,
-                                       gint                   old_width,
-                                       gint                   width,
-                                       GimpInterpolationType  interp);
-static void  shrink_line              (gdouble               *dest,
-                                       const gdouble         *src,
-                                       gint                   bytes,
-                                       gint                   old_width,
-                                       gint                   width,
-                                       GimpInterpolationType  interp);
 
+static void
+determine_scale (PixelRegion *srcPR,
+                 PixelRegion *dstPR,
+                 gint        *levelx,
+                 gint        *levely,
+                 gint        *max_progress)
+{
+  gdouble scalex = (gdouble) dstPR->w / (gdouble) srcPR->w;
+  gdouble scaley = (gdouble) dstPR->h / (gdouble) srcPR->h;
+  gint    width  = srcPR->w;
+  gint    height = srcPR->h;
 
-/* Catmull-Rom spline - not bad
-  * basic intro http://www.mvps.org/directx/articles/catmull/
-  * This formula will calculate an interpolated point between pt1 and pt2
-  * dx=0 returns pt1; dx=1 returns pt2
-  */
+  *max_progress = ((height % TILE_HEIGHT) + 1) * ((width % TILE_WIDTH) + 1);
 
-static inline gdouble
-cubic_spline_fit (gdouble dx,
-                  gint    pt0,
-                  gint    pt1,
-                  gint    pt2,
-                  gint    pt3)
-{
+  /* determine scaling levels */
+  while (scalex >= 2)
+    {
+      scalex  /= 2;
+      width   *=2;
+      *levelx -= 1;
+      *max_progress += (((height % TILE_HEIGHT) + 1) *
+                        ((width % TILE_WIDTH) + 1));
+    }
 
-  return (gdouble) ((( ( - pt0 + 3 * pt1 - 3 * pt2 + pt3 ) * dx +
-      ( 2 * pt0 - 5 * pt1 + 4 * pt2 - pt3 ) ) * dx +
-      ( - pt0 + pt2 ) ) * dx + (pt1 + pt1) ) / 2.0;
-}
+  while (scaley >= 2)
+    {
+      scaley  /= 2;
+      height  *= 2;
+      *levely -= 1;
+      *max_progress += (((height % TILE_HEIGHT) + 1) *
+                        ((width % TILE_WIDTH) + 1));
+    }
 
+  while (scalex <= 0.5)
+    {
+      scalex  *= 2;
+      width   /= 2;
+      *levelx += 1;
+      *max_progress += (((height % TILE_HEIGHT) + 1) *
+                        ((width % TILE_WIDTH) + 1));
+    }
 
+  while (scaley <= 0.5)
+    {
+      scaley  *= 2;
+      height  *= 2;
+      *levely += 1;
+      *max_progress += (((height % TILE_HEIGHT) + 1) *
+                        ((width % TILE_WIDTH) + 1));
+    }
+}
 
-/*
- * non-interpolating scale_region.  [adam]
- */
 static void
-scale_region_no_resample (PixelRegion *srcPR,
-                          PixelRegion *destPR)
+scale_region_buffer (PixelRegion           *srcPR,
+                     PixelRegion           *dstPR,
+                     GimpInterpolationType  interpolation,
+                     GimpProgressFunc       progress_callback,
+                     gpointer               progress_data)
 {
-  const gint  width       = destPR->w;
-  const gint  height      = destPR->h;
-  const gint  orig_width  = srcPR->w;
-  const gint  orig_height = srcPR->h;
-  const gint  bytes       = srcPR->bytes;
-  gint       *x_src_offsets;
-  gint       *y_src_offsets;
-  gint       *offset;
-  guchar     *src;
-  guchar     *dest;
-  gint        last_src_y;
-  gint        row_bytes;
-  gint        x, y;
-  gint        b;
+  PixelRegion  tmpPR0;
+  PixelRegion  tmpPR1;
+  gint         width        = srcPR->w;
+  gint         height       = srcPR->h;
+  gint         bytes        = srcPR->bytes;
+  gint         max_progress = 0;
+  gint         levelx       = 0;
+  gint         levely       = 0;
+
+  /* determine scaling levels */
+  determine_scale (srcPR, dstPR, &levelx, &levely, &max_progress);
+
+  pixel_region_init_data (&tmpPR0,
+                          g_memdup (srcPR->data, width * height * bytes),
+                          bytes, width * bytes, 0, 0, width, height);
+
+  while (levelx < 0 && levely < 0)
+    {
+      width  <<= 1;
+      height <<= 1;
 
-  /*  the data pointers...  */
-  x_src_offsets = g_new (gint, width * bytes);
-  y_src_offsets = g_new (gint, height);
+      pixel_region_init_data (&tmpPR1,
+                              g_new (guchar, width * height * bytes),
+                              bytes, width * bytes, 0, 0, width, height);
+
+      scale_pr (&tmpPR0, &tmpPR1, interpolation);
+
+      g_free (tmpPR0.data);
+      pixel_region_init_data (&tmpPR0,
+                              tmpPR1.data,
+                              bytes, width * bytes, 0, 0, width, height);
 
-  src  = g_new (guchar, orig_width * bytes);
-  dest = g_new (guchar, width * bytes);
+      levelx++;
+      levely++;
+    }
 
-  /*  pre-calc the scale tables  */
-  offset = x_src_offsets;
-  for (x = 0; x < width; x++)
+  while (levelx < 0)
     {
-      /*  need to use 64 bit integers here to avoid an overflow  */
-      gint o = ((gint64) x *
-                (gint64) orig_width + orig_width / 2) / (gint64) width;
+      width <<= 1;
+
+      pixel_region_init_data (&tmpPR1,
+                              g_new (guchar, width * height * bytes),
+                              bytes, width * bytes, 0, 0, width, height);
+
+      scale_pr (&tmpPR0, &tmpPR1, interpolation);
 
-      for (b = 0; b < bytes; b++)
-        *offset++ = o * bytes + b;
+      g_free (tmpPR0.data);
+      pixel_region_init_data (&tmpPR0,
+                              tmpPR1.data,
+                              bytes, width * bytes, 0, 0, width, height);
+
+      levelx++;
     }
 
-  offset = y_src_offsets;
-  for (y = 0; y < height; y++)
+  while (levely < 0)
     {
-      /*  need to use 64 bit integers here to avoid an overflow  */
-      *offset++ = (((gint64) y * (gint64) orig_height + orig_height / 2) /
-                   (gint64) height);
-    }
+      height <<= 1;
 
-  /*  do the scaling  */
-  row_bytes = width * bytes;
-  last_src_y = -1;
+      pixel_region_init_data (&tmpPR1,
+                              g_new (guchar, width * height * bytes),
+                              bytes, width * bytes, 0, 0, width, height);
+
+      scale_pr (&tmpPR0, &tmpPR1, interpolation);
+
+      g_free (tmpPR0.data);
+      pixel_region_init_data (&tmpPR0,
+                              tmpPR1.data,
+                              bytes, width * bytes, 0, 0, width, height);
+      levely++;
+    }
 
-  for (y = 0; y < height; y++)
+  while (levelx > 0 && levely > 0)
     {
-      /* if the source of this line was the same as the source
-       *  of the last line, there's no point in re-rescaling.
-       */
-      if (y_src_offsets[y] != last_src_y)
-        {
-          pixel_region_get_row (srcPR, 0, y_src_offsets[y], orig_width, src, 1);
-
-          for (x = 0; x < row_bytes ; x++)
-            dest[x] = src[x_src_offsets[x]];
+      width  >>= 1;
+      height >>= 1;
 
-          last_src_y = y_src_offsets[y];
-        }
+      pixel_region_init_data (&tmpPR1,
+                              g_new (guchar, width * height * bytes),
+                              bytes, width * bytes, 0, 0, width, height);
+
+      scale_pr (&tmpPR0, &tmpPR1, interpolation);
+
+      g_free (tmpPR0.data);
+      pixel_region_init_data (&tmpPR0,
+                              tmpPR1.data,
+                              bytes, width * bytes, 0, 0, width, height);
 
-      pixel_region_set_row (destPR, 0, y, width, dest);
+      levelx--;
+      levely--;
     }
 
-  g_free (x_src_offsets);
-  g_free (y_src_offsets);
-  g_free (src);
-  g_free (dest);
-}
+  while (levelx > 0)
+    {
+      width <<= 1;
 
+      pixel_region_init_data (&tmpPR1,
+                              g_new (guchar, width * height * bytes),
+                              bytes, width * bytes, 0, 0, width, height);
 
-static void
-get_premultiplied_double_row (PixelRegion *srcPR,
-                              gint         x,
-                              gint         y,
-                              gint         w,
-                              gdouble     *row,
-                              guchar      *tmp_src,
-                              gint         n)
-{
-  const gint bytes = srcPR->bytes;
-  gint       b;
+      scale_pr (&tmpPR0, &tmpPR1, interpolation);
 
-  pixel_region_get_row (srcPR, x, y, w, tmp_src, n);
+      g_free (tmpPR0.data);
+      pixel_region_init_data (&tmpPR0,
+                              tmpPR1.data,
+                              bytes, width * bytes, 0, 0, width, height);
 
-  if (pixel_region_has_alpha (srcPR))
+      levelx--;
+    }
+
+  while (levely > 0)
     {
-      /* premultiply the alpha into the double array */
-      const gint  alpha = bytes - 1;
-      gdouble    *irow  = row;
+      height <<= 1;
 
-      for (x = 0; x < w; x++)
-        {
-          gdouble  mod_alpha = tmp_src[alpha] / 255.0;
+      pixel_region_init_data (&tmpPR1,
+                              g_new (guchar, width * height * bytes),
+                              bytes, width * bytes, 0, 0, width, height);
 
-          for (b = 0; b < alpha; b++)
-            irow[b] = mod_alpha * tmp_src[b];
+      scale_pr (&tmpPR0, &tmpPR1, interpolation);
 
-          irow[b] = tmp_src[alpha];
-          irow += bytes;
-          tmp_src += bytes;
-        }
-    }
-  else /* no alpha */
-    {
-      for (x = 0; x < w * bytes; x++)
-        row[x] = tmp_src[x];
+      g_free (tmpPR0.data);
+      pixel_region_init_data (&tmpPR0,
+                              tmpPR1.data,
+                              bytes, width * bytes, 0, 0, width, height);
+
+      levely--;
     }
 
-  /* set the off edge pixels to their nearest neighbor */
-  for (b = 0; b < 2 * bytes; b++)
-    row[b - 2 * bytes] = row[b % bytes];
+  scale_pr (&tmpPR0, dstPR, interpolation);
 
-  for (b = 0; b < 2 * bytes; b++)
-    row[b + w * bytes] = row[(w - 1) * bytes + b % bytes];
-}
+  g_free (tmpPR0.data);
 
+  return;
+}
 
 static void
-expand_line (gdouble               *dest,
-             const gdouble         *src,
-             gint                   bpp,
-             gint                   old_width,
-             gint                   width,
-             GimpInterpolationType  interp)
+scale_region_tile (PixelRegion           *srcPR,
+                   PixelRegion           *dstPR,
+                   GimpInterpolationType  interpolation,
+                   GimpProgressFunc       progress_callback,
+                   gpointer               progress_data)
 {
-  const gdouble *s;
-  /* reverse scaling_factor */
-  const gdouble  ratio = (gdouble) old_width / (gdouble) width;
-  gint           x, b;
-  gint           src_col;
-  gdouble        frac;
+  TileManager *tmpTM        = NULL;
+  TileManager *srcTM        = srcPR->tiles;
+  TileManager *dstTM        = dstPR->tiles;
+  gint         width        = srcPR->w;
+  gint         height       = srcPR->h;
+  gint         bytes        = srcPR->bytes;
+  gint         max_progress = (((height % TILE_HEIGHT) + 1) *
+                               ((width % TILE_WIDTH) + 1));
+  gint         progress     = 0;
+  gint         levelx       = 0;
+  gint         levely       = 0;
 
-  /* we can overflow src's boundaries, so we expect our caller to have
-   * allocated extra space for us to do so safely (see scale_region ())
-   */
+  /* determine scaling levels */
+  determine_scale (srcPR, dstPR, &levelx, &levely, &max_progress);
 
-  switch (interp)
+  if (levelx == 0 && levely == 0)
     {
-      /* -0.5 is because cubic() interpolates a position between 2nd and 3rd
-       * data points we are assigning to 2nd in dest, hence mean shift of +0.5
-       * +1, -1 ensures we dont (int) a negative; first src col only.
-       */
-    case GIMP_INTERPOLATION_CUBIC:
-      for (x = 0; x < width; x++)
-        {
-          gdouble xr = x * ratio - 0.5;
-
-          if (xr < 0)
-            src_col = (gint) (xr + 1) - 1;
-          else
-            src_col = (gint) xr;
+       scale (srcTM, dstTM, interpolation,
+              progress_callback,
+              progress_data, &progress, max_progress);
+    }
 
-          frac = xr - src_col;
-          s = &src[src_col * bpp];
+  while (levelx < 0 && levely < 0)
+    {
+      width  <<= 1;
+      height <<= 1;
 
-          for (b = 0; b < bpp; b++)
-            dest[b] = cubic_spline_fit (frac, s[b - bpp], s[b], s[b + bpp],
-                                        s[b + bpp * 2]);
+      tmpTM = tile_manager_new (width, height, bytes);
+      scale (srcTM, tmpTM, interpolation,
+             progress_callback, progress_data, &progress, max_progress);
+
+      if (srcTM != srcPR->tiles)
+        tile_manager_unref (srcTM);
+
+      srcTM = tmpTM;
+      levelx++;
+      levely++;
+    }
 
-          dest += bpp;
-        }
+  while (levelx < 0)
+    {
+      width <<= 1;
 
-      break;
+      tmpTM = tile_manager_new (width, height, bytes);
+      scale (srcTM, tmpTM, interpolation,
+             progress_callback, progress_data, &progress, max_progress);
 
-      /* -0.5 corrects the drift from averaging between adjacent points and
-       * assigning to dest[b]
-       * +1, -1 ensures we dont (int) a negative; first src col only.
-       */
-    case GIMP_INTERPOLATION_LINEAR:
-      for (x = 0; x < width; x++)
-        {
-          gdouble xr = (x * ratio + 1 - 0.5) - 1;
+      if (srcTM != srcPR->tiles)
+        tile_manager_unref (srcTM);
 
-          src_col = (gint) xr;
-          frac = xr - src_col;
-          s = &src[src_col * bpp];
+      srcTM = tmpTM;
+      levelx++;
+    }
 
-          for (b = 0; b < bpp; b++)
-            dest[b] = ((s[b + bpp] - s[b]) * frac + s[b]);
+  while (levely < 0)
+    {
+      height <<= 1;
 
-          dest += bpp;
-        }
-      break;
+      tmpTM = tile_manager_new (width, height, bytes);
+      scale (srcTM, tmpTM, interpolation,
+             progress_callback, progress_data, &progress, max_progress);
 
-    case GIMP_INTERPOLATION_NONE:
-    case GIMP_INTERPOLATION_LANCZOS:
-      g_assert_not_reached ();
-      break;
+      if (srcTM != srcPR->tiles)
+        tile_manager_unref (srcTM);
 
-    default:
-      break;
+      srcTM = tmpTM;
+      levely++;
     }
-}
 
+  while ( levelx > 0 && levely > 0 )
+    {
+      width  >>= 1;
+      height >>= 1;
 
+      tmpTM = tile_manager_new (width, height, bytes);
+      scale (srcTM, tmpTM, interpolation,
+             progress_callback, progress_data, &progress, max_progress);
+
+      if (srcTM != srcPR->tiles)
+        tile_manager_unref (srcTM);
+
+      srcTM = tmpTM;
+      levelx--;
+      levely--;
+    }
 
-static void
-shrink_line (gdouble               *dest,
-             const gdouble         *src,
-             gint                   bytes,
-             gint                   old_width,
-             gint                   width,
-             GimpInterpolationType  interp)
-{
-  const gdouble *srcp;
-  gdouble       *destp;
-  gdouble        accum[4];
-  gdouble        slice;
-  const gdouble  avg_ratio = (gdouble) width / old_width;
-  const gdouble  inv_width = 1.0 / width;
-  gint           slicepos;      /* slice position relative to width */
-  gint           x;
-  gint           b;
+  while ( levelx > 0 )
+    {
+      width <<= 1;
 
-#if 0
-  g_printerr ("shrink_line bytes=%d old_width=%d width=%d interp=%d "
-              "avg_ratio=%f\n",
-              bytes, old_width, width, interp, avg_ratio);
-#endif
+      tmpTM = tile_manager_new (width, height, bytes);
+      scale (srcTM, tmpTM, interpolation,
+             progress_callback, progress_data, &progress, max_progress);
 
-  g_return_if_fail (bytes <= 4);
+      if (srcTM != srcPR->tiles)
+        tile_manager_unref (srcTM);
 
-  /* This algorithm calculates the weighted average of pixel data that
-     each output pixel must receive, taking into account that it always
-     scales down, i.e. there's always more than one input pixel per each
-     output pixel.  */
+      srcTM = tmpTM;
+      levelx--;
+    }
 
-  srcp = src;
-  destp = dest;
+  while ( levely > 0 )
+    {
+      height <<= 1;
 
-  slicepos = 0;
+      tmpTM = tile_manager_new (width, height, bytes);
+      scale (srcTM, tmpTM, interpolation,
+             progress_callback, progress_data, &progress, max_progress);
 
-  /* Initialize accum to the first pixel slice.  As there is no partial
-     pixel at start, that value is 0.  The source data is interleaved, so
-     we maintain BYTES accumulators at the same time to deal with that
-     many channels simultaneously.  */
-  for (b = 0; b < bytes; b++)
-    accum[b] = 0.0;
+      if (srcTM != srcPR->tiles)
+        tile_manager_unref (srcTM);
 
-  for (x = 0; x < width; x++)
+      srcTM = tmpTM;
+      levely--;
+    }
+
+  if (tmpTM != NULL)
     {
-      /* Accumulate whole pixels.  */
-      do
-        {
-          for (b = 0; b < bytes; b++)
-            accum[b] += *srcp++;
+      scale (tmpTM, dstTM, interpolation,
+             progress_callback,
+             progress_data, &progress, max_progress);
+      tile_manager_unref (tmpTM);
+    }
 
-          slicepos += width;
-        }
-      while (slicepos < old_width);
-      slicepos -= old_width;
+  if (progress_callback)
+    progress_callback (0, max_progress, max_progress, progress_data);
+
+  return;
+}
 
-      if (! (slicepos < width))
-        g_warning ("Assertion (slicepos < width) failed. Please report.");
+static void
+scale (TileManager           *srcTM,
+       TileManager           *dstTM,
+       GimpInterpolationType  interpolation,
+       GimpProgressFunc       progress_callback,
+       gpointer               progress_data,
+       gint                  *progress,
+       gint                   max_progress)
+{
+  guint              src_width      = tile_manager_width  (srcTM);
+  guint              src_height     = tile_manager_height (srcTM);
+  Tile              *dst_tile;
+  guchar            *dst_data;
+  guint              dst_width      = tile_manager_width  (dstTM);
+  guint              dst_height     = tile_manager_height (dstTM);
+  guint              dst_bpp        = tile_manager_bpp (dstTM);
+  guint              dst_tilerows   = tile_manager_tiles_per_row(dstTM);    /*  the number of tiles in each row      */
+  guint              dst_tilecols   = tile_manager_tiles_per_col(dstTM);    /*  the number of tiles in each columns  */
+  guint              dst_ewidth;
+  guint              dst_eheight;
+  guint              dst_stride;
+  gdouble            scalex         = (gdouble) dst_width  / (gdouble) src_width;
+  gdouble            scaley         = (gdouble) dst_height / (gdouble) src_height;
+  gdouble            xfrac;
+  gdouble            yfrac;
+  gint               x, y, x0, y0, x1, y1;
+  gint               sx0, sy0, sx1, sy1;
+  gint               col, row;
+  guchar             pixel[dst_bpp];
+  gfloat            *kernel_lookup = NULL;
 
-      if (slicepos == 0)
+  /* fall back if not enough pixels available */
+  if (interpolation != GIMP_INTERPOLATION_NONE )
+    {
+      if ( src_width < 2 || src_height < 2 ||
+           dst_width < 2 || dst_height < 2)
         {
-          /* Simplest case: we have reached a whole pixel boundary.  Store
-             the average value per channel and reset the accumulators for
-             the next round.
+          interpolation = GIMP_INTERPOLATION_NONE;
+        }
+      else if ( src_width < 3 || src_height < 3 ||
+                dst_width < 3 || dst_height < 3)
+        {
+          interpolation = GIMP_INTERPOLATION_LINEAR;
+        }
+    }
 
-             The main reason to treat this case separately is to avoid an
-             access to out-of-bounds memory for the first pixel.  */
-          for (b = 0; b < bytes; b++)
+  /* if scale is 2^n */
+  if (src_width == dst_width && src_height == dst_height)
+    {
+      for (row = 0; row < dst_tilerows; row++)
+        {
+          for (col = 0; col < dst_tilecols; col++)
             {
-              *destp++ = accum[b] * avg_ratio;
-              accum[b] = 0.0;
+              dst_tile    = tile_manager_get_at (dstTM, col, row, TRUE, TRUE);
+              dst_data    = tile_data_pointer (dst_tile, 0, 0);
+              dst_bpp     = tile_bpp (dst_tile);
+              dst_ewidth  = tile_ewidth (dst_tile);
+              dst_eheight = tile_eheight (dst_tile);
+              dst_stride  = dst_ewidth * dst_bpp;
+              x0          = col * TILE_WIDTH;
+              y0          = row * TILE_HEIGHT;
+              x1          = x0 + dst_ewidth - 1;
+              y1          = y0 + dst_eheight - 1;
+
+              read_pixel_data (srcTM, x0, y0, x1, y1, dst_data, dst_stride);
+
+              tile_release (dst_tile, TRUE);
+
+              if (progress_callback)
+                progress_callback (0, max_progress, ((*progress)++),
+                                   progress_data);
             }
         }
-      else
+      return;
+    }
+
+  if (interpolation == GIMP_INTERPOLATION_LANCZOS )
+    kernel_lookup = create_lanczos3_lookup();
+
+  for (row = 0; row < dst_tilerows; row++)
+    {
+      for (col = 0; col < dst_tilecols; col++)
         {
-          for (b = 0; b < bytes; b++)
+          dst_tile    = tile_manager_get_at (dstTM, col, row, FALSE, FALSE);
+          dst_data    = tile_data_pointer (dst_tile, 0, 0);
+          dst_bpp     = tile_bpp (dst_tile);
+          dst_ewidth  = tile_ewidth (dst_tile);
+          dst_eheight = tile_eheight (dst_tile);
+          dst_stride  = dst_ewidth * dst_bpp;
+
+          x0          = col * TILE_WIDTH;
+          y0          = row * TILE_HEIGHT;
+          x1          = x0 + dst_ewidth - 1;
+          y1          = y0 + dst_eheight - 1;
+
+          for (y = y0; y <= y1; y++)
             {
-              /* We have accumulated a whole pixel per channel where just a
-                 slice of it was needed.  Subtract now the previous pixel's
-                 extra slice.  */
-              slice = srcp[- bytes + b] * slicepos * inv_width;
-              *destp++ = (accum[b] - slice) * avg_ratio;
+              yfrac = ( y / scaley );
+              sy0   = (gint) yfrac;
+              sy1   = sy0 + 1;
+              sy1   = ( sy1 >= src_height) ? src_height - 1 : sy1;
+              yfrac =  yfrac - sy0;
+
+              for (x = x0; x <= x1; x++)
+                {
+                  xfrac = (x / scalex);
+                  sx0   = (gint) xfrac;
+                  sx1   = sx0 + 1;
+                  sx1   = ( sx1 >= src_width) ? src_width - 1 : sx1;
+                  xfrac =  xfrac - sx0;
 
-              /* That slice is the initial value for the next round.  */
-              accum[b] = slice;
+                  switch (interpolation)
+                    {
+                    case GIMP_INTERPOLATION_NONE:
+                      interpolate_nearest (srcTM, sx0, sy0,
+                                           sx1, sy1,
+                                           xfrac, yfrac,
+                                           pixel,
+                                           kernel_lookup);
+                      break;
+
+                    case GIMP_INTERPOLATION_LINEAR:
+                      if (scalex == 0.5 || scaley == 0.5)
+                        decimate_average (srcTM, sx0, sy0,
+                                          sx1, sy1,
+                                          xfrac, yfrac,
+                                          pixel,
+                                          kernel_lookup);
+                      else
+                        interpolate_bilinear (srcTM, sx0, sy0,
+                                              sx1, sy1,
+                                              xfrac, yfrac,
+                                              pixel,
+                                              kernel_lookup);
+                      break;
+
+                    case GIMP_INTERPOLATION_CUBIC:
+                      if (scalex == 0.5 || scaley == 0.5)
+                        decimate_gauss (srcTM, sx0, sy0,
+                                        sx1, sy1,
+                                        xfrac, yfrac,
+                                        pixel,
+                                        kernel_lookup);
+                      else
+                        interpolate_cubic (srcTM, sx0, sy0,
+                                           sx1, sy1,
+                                           xfrac, yfrac,
+                                           pixel,
+                                           kernel_lookup);
+                      break;
+
+                    case GIMP_INTERPOLATION_LANCZOS:
+                      if (scalex == 0.5 || scaley == 0.5)
+                        decimate_lanczos2 (srcTM, sx0, sy0,
+                                           sx1, sy1,
+                                           xfrac, yfrac,
+                                           pixel,
+                                           kernel_lookup);
+                      else
+                        interpolate_lanczos3 (srcTM, sx0, sy0,
+                                              sx1, sy1,
+                                              xfrac, yfrac,
+                                              pixel,
+                                              kernel_lookup);
+                      break;
+                    }
+                  write_pixel_data_1 (dstTM, x, y, pixel);
+                }
             }
+
+          if (progress_callback)
+            progress_callback (0, max_progress, ((*progress)++), progress_data);
         }
     }
 
-  /* Sanity check: srcp should point to the next-to-last position, and
-     slicepos should be zero.  */
-  if (! (srcp - src == old_width * bytes && slicepos == 0))
-    g_warning ("Assertion (srcp - src == old_width * bytes && slicepos == 0)"
-               " failed. Please report.");
+  if (interpolation == GIMP_INTERPOLATION_LANCZOS)
+    g_free (kernel_lookup);
 }
 
-static inline void
-rotate_pointers (guchar  **p,
-                 guint32   n)
+static void inline
+pixel_average (guchar *p1,
+               guchar *p2,
+               guchar *p3,
+               guchar *p4,
+               guchar *p,
+               gint    bytes)
 {
-  guchar  *tmp = p[0];
-  guint32  i;
+  gdouble sum, alphasum;
+  gdouble alpha;
+  gint    b;
 
-  for (i = 0; i < n-1; i++)
-    p[i] = p[i+1];
+  for (b = 0; b < bytes; b++)
+    p[b]=0;
 
-  p[i] = tmp;
-}
+  switch (bytes)
+    {
+    case 1:
+      sum = ((p1[0] + p2[0] + p3[0] + p4[0]) / 4);
 
-static void
-get_scaled_row (gdouble              **src,
-                gint                   y,
-                gint                   new_width,
-                PixelRegion           *srcPR,
-                gdouble               *row,
-                guchar                *src_tmp,
-                GimpInterpolationType  interpolation_type)
-{
-  /* get the necesary lines from the source image, scale them,
-     and put them into src[] */
+      p[0] = (guchar) CLAMP (sum, 0, 255);
+      break;
 
-  rotate_pointers ((gpointer) src, 4);
+    case 2:
+      alphasum = p1[1] +  p2[1] +  p3[1] +  p4[1];
 
-  if (y < 0)
-    y = 0;
+      if (alphasum > 0)
+        {
+          sum = p1[0] * p1[1] + p2[0] * p2[1] + p3[0] * p3[1] + p4[0] * p4[1];
+          sum /= alphasum;
 
-  if (y < srcPR->h)
-    {
-      get_premultiplied_double_row (srcPR, 0, y, srcPR->w, row, src_tmp, 1);
+          alpha = alphasum / 4;
 
-      if (new_width > srcPR->w)
-        expand_line (src[3], row, srcPR->bytes,
-                     srcPR->w, new_width, interpolation_type);
-      else if (srcPR->w > new_width)
-        shrink_line (src[3], row, srcPR->bytes,
-                     srcPR->w, new_width, interpolation_type);
-      else /* no scailing needed */
-        memcpy (src[3], row, sizeof (gdouble) * new_width * srcPR->bytes);
-    }
-  else
-    {
-      memcpy (src[3], src[2], sizeof (gdouble) * new_width * srcPR->bytes);
+          p[0] = (guchar) CLAMP (sum, 0, 255);
+          p[1] = (guchar) CLAMP (alpha, 0, 255);
+        }
+      break;
+
+    case 3:
+      for (b = 0; b<3; b++)
+        {
+          sum = ((p1[b] + p2[b] + p3[b] + p4[b]) / 4);
+          p[b] = (guchar) CLAMP (sum, 0, 255);
+        }
+      break;
+
+    case 4:
+      alphasum = p1[3] +  p2[3] +  p3[3] +  p4[3];
+
+      if (alphasum > 0)
+        {
+          for (b = 0; b<3; b++)
+            {
+              sum = p1[b] * p1[3] + p2[b] * p2[3] + p3[b] * p3[3] + p4[b] * p4[3];
+              sum /= alphasum;
+
+              p[b] = (guchar) CLAMP (sum, 0, 255);
+            }
+
+          alpha = alphasum / 4;
+
+          p[3] = (guchar) CLAMP (alpha, 0, 255);
+        }
+      break;
     }
 }
 
 void
 scale_region (PixelRegion           *srcPR,
-              PixelRegion           *destPR,
+              PixelRegion           *dstPR,
               GimpInterpolationType  interpolation,
               GimpProgressFunc       progress_callback,
               gpointer               progress_data)
 {
-  gdouble *src[4];
-  guchar  *src_tmp;
-  guchar  *dest;
-  gdouble *row;
-  gdouble *accum;
-  gint     bytes, b;
-  gint     width, height;
-  gint     orig_width, orig_height;
-  gdouble  y_ratio;
-  gint     i;
-  gint     old_y = -4;
-  gint     x, y;
 
-  switch (interpolation)
+  /* Copy and return if scale = 1.0 */
+  if (srcPR->h == dstPR->h && srcPR->w == dstPR->w)
     {
-    case GIMP_INTERPOLATION_NONE:
-      scale_region_no_resample (srcPR, destPR);
+      copy_region (srcPR, dstPR);
       return;
+    }
 
-    case GIMP_INTERPOLATION_LINEAR:
-    case GIMP_INTERPOLATION_CUBIC:
-      break;
-
-    case GIMP_INTERPOLATION_LANCZOS:
-      scale_region_lanczos (srcPR, destPR, progress_callback, progress_data);
+  if (srcPR->tiles == NULL && srcPR->data != NULL)
+    {
+      scale_region_buffer (srcPR, dstPR, interpolation,
+                           progress_callback, progress_data);
       return;
     }
 
-  /* the following code is only run for linear and cubic interpolation */
+  if (srcPR->tiles != NULL && srcPR->data == NULL)
+    {
+      scale_region_tile (srcPR, dstPR, interpolation,
+                         progress_callback, progress_data);
+      return;
+    }
 
-  orig_width  = srcPR->w;
-  orig_height = srcPR->h;
+  g_assert_not_reached ();
+}
 
-  width  = destPR->w;
-  height = destPR->h;
+static void
+decimate_gauss (TileManager *srcTM,
+                gint         x0,
+                gint         y0,
+                gint         x1,
+                gint         y1,
+                gdouble      xfrac,
+                gdouble      yfrac,
+                guchar      *pixel,
+                gfloat      *kernel_lookup)
+{
+  gint    src_bpp    = tile_manager_bpp  (srcTM);
+  guint   src_width  = tile_manager_width  (srcTM);
+  guint   src_height = tile_manager_height (srcTM);
+  guchar  pixel1[src_bpp];
+  guchar  pixel2[src_bpp];
+  guchar  pixel3[src_bpp];
+  guchar  pixel4[src_bpp];
+  guchar  pixels[16 * src_bpp];
+  gint    x, y, i;
+  guchar *p;
 
-#if 0
-  g_printerr ("scale_region: (%d x %d) -> (%d x %d)\n",
-              orig_width, orig_height, width, height);
-#endif
+  for (y = y0 - 1, i = 0; y <= y0 + 2; y++)
+    {
+      for (x = x0 - 1; x <= x0 + 2; x++, i++)
+        {
+          x1 = ABS(x);
+          y1 = ABS(y);
+          x1 = (x1 < src_width)  ? x1 : 2 * src_width - x1 - 1;
+          y1 = (y1 < src_height) ? y1 : 2 * src_height - y1 - 1;
+          read_pixel_data_1 (srcTM, x1, y1, pixels + (i * src_bpp));
+        }
+    }
 
-  /*  find the ratios of old y to new y  */
-  y_ratio = (gdouble) orig_height / (gdouble) height;
+  p = pixels + (0 * src_bpp);
+  gaussan_decimate (p, src_bpp, pixel1);
+  p = pixels + (1 * src_bpp);
+  gaussan_decimate (p, src_bpp, pixel2);
+  p = pixels + (4 * src_bpp);
+  gaussan_decimate (p, src_bpp, pixel3);
+  p = pixels + (5 * src_bpp);
+  gaussan_decimate (p, src_bpp, pixel4);
 
-  bytes = destPR->bytes;
+  pixel_average (pixel1, pixel2, pixel3, pixel4, pixel, src_bpp);
 
-  /*  the data pointers...  */
-  for (i = 0; i < 4; i++)
-    src[i] = g_new (gdouble, width * bytes);
+}
 
-  dest = g_new (guchar, width * bytes);
+static inline void
+gaussan_decimate (guchar *pixels,
+                  gint    bytes,
+                  guchar *pixel)
+{
+  guchar *p;
+  gdouble sum;
+  gdouble alphasum;
+  gdouble alpha;
+  gint    b;
 
-  src_tmp = g_new (guchar, orig_width * bytes);
+  for (b = 0; b < bytes; b++)
+    pixel[b] = 0;
 
-  /* offset the row pointer by 2*bytes so the range of the array
-     is [-2*bytes] to [(orig_width + 2)*bytes] */
-  row = g_new (gdouble, (orig_width + 2 * 2) * bytes);
-  row += bytes * 2;
+  p = pixels;
 
-  accum = g_new (gdouble, width * bytes);
+  switch (bytes)
+    {
+    case 1:
+      sum  = p[0]     + p[1] * 2 + p[2];
+      sum += p[4] * 2 + p[5] * 4 + p[6] * 2;
+      sum += p[8]     + p[9] * 2 + p[10];
+      sum /= 16;
 
-  /*  Scale the selected region  */
+      pixel[0] = (guchar) CLAMP (sum, 0, 255);
+      break;
 
-  for (y = 0; y < height; y++)
-    {
-      if (progress_callback && (y % 64 == 0))
-        progress_callback (0, height, y, progress_data);
+    case 2:
+      alphasum  = p[1]     + p[3]  * 2 + p[5];
+      alphasum += p[9] * 2 + p[11] * 4 + p[13] * 2;
+      alphasum += p[17]    + p[19] * 2 + p[21];
 
-      if (height < orig_height)
+      if (alphasum > 0)
         {
-          const gdouble inv_ratio = 1.0 / y_ratio;
-          gint          new_y;
-          gint          max;
-          gdouble       frac;
-
-          if (y == 0) /* load the first row if this is the first time through */
-            get_scaled_row (&src[0], 0, width, srcPR, row,
-                            src_tmp,
-                            interpolation);
+          sum  = p[0]  * p[1]     + p[2]  * p[3]  * 2 + p[4]  * p[5];
+          sum += p[8]  * p[9] * 2 + p[10] * p[11] * 4 + p[12] * p[13] * 2;
+          sum += p[16] * p[17]    + p[18] * p[19] * 2 + p[20] * p[21];
+          sum /= alphasum;
 
-          new_y = (gint) (y * y_ratio);
-          frac = 1.0 - (y * y_ratio - new_y);
+          alpha = alphasum / 16;
 
-          for (x = 0; x < width * bytes; x++)
-            accum[x] = src[3][x] * frac;
+          pixel[0] = (guchar) CLAMP (sum,   0, 255);
+          pixel[1] = (guchar) CLAMP (alpha, 0, 255);
+        }
+      break;
 
-          max = (gint) ((y + 1) * y_ratio) - new_y - 1;
+    case 3:
+      for (b = 0; b < 3; b++ )
+        {
+          sum  = p[b   ]     + p[3 + b] * 2 + p[6 + b];
+          sum += p[12 + b] * 2 + p[15 + b] * 4 + p[18 + b] * 2;
+          sum += p[24 + b]     + p[27 + b] * 2 + p[30 + b];
+          sum /= 16;
 
-          get_scaled_row (&src[0], ++new_y, width, srcPR, row,
-                          src_tmp,
-                          interpolation);
+          pixel[b] = (guchar) CLAMP (sum, 0, 255);
+        }
+      break;
 
-          while (max > 0)
+    case 4:
+      alphasum  = p[3]      + p[7]  * 2  + p[11];
+      alphasum += p[19] * 2 + p[23] * 4  + p[27] * 2;
+      alphasum += p[35]     + p[39] * 2  + p[43];
+      if (alphasum > 0)
+        {
+          for (b = 0; b < 3; b++)
             {
-              for (x = 0; x < width * bytes; x++)
-                accum[x] += src[3][x];
+              sum = p[   b] * p[3]      + p[4 + b] * p[7]  * 2 + p[8 + b] * p[11];
+              sum += p[16 + b] * p[19] * 2 + p[20 + b] * p[23] * 4 + p[24 + b] * p[27] * 2;
+              sum += p[32 + b] * p[35]     + p[36 + b] * p[39] * 2 + p[40 + b] * p[43];
+              sum /= alphasum;
 
-              get_scaled_row (&src[0], ++new_y, width, srcPR, row,
-                              src_tmp,
-                              interpolation);
-              max--;
+              pixel[b] = (guchar) CLAMP (sum, 0, 255);
             }
 
-          frac = (y + 1) * y_ratio - ((int) ((y + 1) * y_ratio));
+          alpha = alphasum / 16;
 
-          for (x = 0; x < width * bytes; x++)
-            {
-              accum[x] += frac * src[3][x];
-              accum[x] *= inv_ratio;
-            }
+          pixel[3] = (guchar) CLAMP (alpha, 0, 255);
         }
-      else if (height > orig_height)
-        {
-          gint new_y = floor (y * y_ratio - 0.5);
+      break;
+    }
+}
 
-          while (old_y <= new_y)
-            {
-              /* get the necesary lines from the source image, scale them,
-                 and put them into src[] */
-              get_scaled_row (&src[0], old_y + 2, width, srcPR, row,
-                              src_tmp,
-                              interpolation);
-              old_y++;
-            }
+static inline void
+decimate_lanczos2 (TileManager *srcTM,
+                   gint         x0,
+                   gint         y0,
+                   gint         x1,
+                   gint         y1,
+                   gdouble      xfrac,
+                   gdouble      yfrac,
+                   guchar      *pixel,
+                   gfloat      *kernel_lookup)
+{
+  gint    src_bpp    = tile_manager_bpp  (srcTM);
+  guint   src_width  = tile_manager_width  (srcTM);
+  guint   src_height = tile_manager_height (srcTM);
+  guchar  pixel1[src_bpp];
+  guchar  pixel2[src_bpp];
+  guchar  pixel3[src_bpp];
+  guchar  pixel4[src_bpp];
+  guchar  pixels[36 * src_bpp];
+  gint    x, y, i;
+  guchar *p;
 
-          switch (interpolation)
-            {
-            case GIMP_INTERPOLATION_CUBIC:
-              {
-                gdouble p0, p1, p2, p3;
-                gdouble dy = (y * y_ratio - 0.5) - new_y;
-
-                p0 = cubic_spline_fit (dy, 1, 0, 0, 0);
-                p1 = cubic_spline_fit (dy, 0, 1, 0, 0);
-                p2 = cubic_spline_fit (dy, 0, 0, 1, 0);
-                p3 = cubic_spline_fit (dy, 0, 0, 0, 1);
-
-                for (x = 0; x < width * bytes; x++)
-                  accum[x] = (p0 * src[0][x] + p1 * src[1][x] +
-                              p2 * src[2][x] + p3 * src[3][x]);
-              }
+  for (y = y0 - 2, i = 0; y <= y0 + 3; y++)
+    {
+      for (x = x0 - 2; x <= x0 + 3; x++, i++)
+        {
+          x1 = ABS(x);
+          y1 = ABS(y);
+          x1 = (x1 < src_width)  ? x1 : 2 * src_width - x1 - 1;
+          y1 = (y1 < src_height) ? y1 : 2 * src_height - y1 - 1;
+          read_pixel_data_1 (srcTM, x1, y1, pixels + (i * src_bpp));
+        }
+    }
 
-              break;
+  p = pixels + (0 * src_bpp);
+  gaussan_lanczos2 (p, src_bpp, pixel1);
+  p = pixels + (1 * src_bpp);
+  gaussan_lanczos2 (p, src_bpp, pixel2);
+  p = pixels + (6 * src_bpp);
+  gaussan_lanczos2 (p, src_bpp, pixel3);
+  p = pixels + (7 * src_bpp);
+  gaussan_lanczos2 (p, src_bpp, pixel4);
 
-            case GIMP_INTERPOLATION_LINEAR:
-              {
-                gdouble idy = (y * y_ratio - 0.5) - new_y;
-                gdouble dy  = 1.0 - idy;
-
-                for (x = 0; x < width * bytes; x++)
-                  accum[x] = dy * src[1][x] + idy * src[2][x];
-              }
+  pixel_average (pixel1, pixel2, pixel3, pixel4, pixel, src_bpp);
 
-              break;
+}
 
-            case GIMP_INTERPOLATION_NONE:
-            case GIMP_INTERPOLATION_LANCZOS:
-              g_assert_not_reached ();
-              break;
-            }
-        }
-      else /* height == orig_height */
-        {
-          get_scaled_row (&src[0], y, width, srcPR, row,
-                          src_tmp,
-                          interpolation);
-          memcpy (accum, src[3], sizeof (gdouble) * width * bytes);
-        }
+static inline void
+gaussan_lanczos2 (guchar *pixels,
+                  gint    bytes,
+                  guchar *pixel)
+{
+  /*
+   *   Filter source taken from document:
+   *   www.worldserver.com/turk/computergraphics/ResamplingFilters.pdf
+   *
+   *   Filters for Common Resampling Tasks
+   *
+   *   Ken Turkowski, Apple computer
+   *
+   */
+  guchar  *p;
+  gdouble  sum;
+  gdouble  alphasum;
+  gdouble  alpha;
+  gint     b;
 
-      if (pixel_region_has_alpha (srcPR))
-        {
-          /* unmultiply the alpha */
-          gdouble  inv_alpha;
-          gdouble *p     = accum;
-          gint     alpha = bytes - 1;
-          gint     result;
-          guchar  *d     = dest;
+  for (b = 0; b < bytes; b++)
+    pixel[b] = 0;
 
-          for (x = 0; x < width; x++)
-            {
-              if (p[alpha] > 0.001)
-                {
-                  inv_alpha = 255.0 / p[alpha];
+  p = pixels;
 
-                  for (b = 0; b < alpha; b++)
-                    {
-                      result = RINT (inv_alpha * p[b]);
+  switch (bytes)
+    {
+    case 1:
+      sum  = p[0] + p[1] * -9 + p[2] * -16 + p[3] * -9 + p[4];
+      sum += p[6] * -9 + p[7] * 81 + p[8] * 144 + p[9] * 81 + p[10] * -9;
+      sum += p[12] * -16 +
+             p[13] * 144 + p[14] * 256 + p[15] * 144 + p[16] * -16;
+      sum += p[18] * -9 + p[19] * 81 + p[20] * 144 + p[21] * 81 + p[22] * -9;
+      sum += p[24] + p[25] * -9 + p[26] * -16 + p[27] * -9 + p[28];
+      sum /= 1024;
 
-                      if (result < 0)
-                        d[b] = 0;
-                      else if (result > 255)
-                        d[b] = 255;
-                      else
-                        d[b] = result;
-                    }
+      pixel[0] = (guchar) CLAMP (sum, 0, 255);
+      break;
 
-                  result = RINT (p[alpha]);
+    case 2:
+      alphasum =  p[1] + p[3] * -9 + p[5] * -16 + p[7] * -9 + p[9];
+      alphasum += p[13] * -9 +
+                  p[15] * 81 + p[17] * 144 + p[19] * 81 + p[21] * -9;
+      alphasum += p[25] * -16 +
+                  p[27] * 144 + p[29] * 256 + p[31] * 144 + p[33] * -16;
+      alphasum += p[37] * -9 +
+                  p[39] * 81 + p[41] * 144 + p[43] * 81 + p[45] * -9;
+      alphasum += p[49] + p[51] * -9 + p[53] * -16 + p[55] * -9 + p[57];
 
-                  if (result > 255)
-                    d[alpha] = 255;
-                  else
-                    d[alpha] = result;
-                }
-              else /* alpha <= 0 */
-                {
-                  for (b = 0; b <= alpha; b++)
-                    d[b] = 0;
-                }
+      if (alphasum > 0)
+        {
+          sum =  p[0] * p[1] +
+                 p[2] * p[3] * -9 +
+                 p[4] * p[5] * -16 + p[6] * p[7] * -9 + p[8] * p[9];
+          sum += p[12] * p[13] * -9 +
+                 p[14] * p[15] * 81 +
+                 p[16] * p[17] * 144 + p[18] * p[19] * 81 + p[20] * p[21] * -9;
+          sum += p[24] * p[25] * -16 +
+                 p[26] * p[27] * 144 +
+                 p[28] * p[29] * 256 + p[30] * p[31] * 144 + p[32] * p[33] * -16;
+          sum += p[36] * p[37] * -9 +
+                 p[38] * p[39] * 81 +
+                 p[40] * p[41] * 144 + p[42] * p[43] * 81 + p[44] * p[45] * -9;
+          sum += p[48] * p[49] +
+                 p[50] * p[51] * -9 +
+                 p[52] * p[53] * -16 + p[54] * p[55] * -9 + p[56] * p[57];
+          sum /= alphasum;
 
-              d += bytes;
-              p += bytes;
-            }
+          alpha = alphasum / 1024;
+
+          pixel[0] = (guchar) CLAMP (sum, 0, 255);
+          pixel[1] = (guchar) CLAMP (alpha, 0, 255);
         }
-      else
+      break;
+
+    case 3:
+      for (b = 0; b < 3; b++)
         {
-          gint w = width * bytes;
+          sum =  p[b] +
+                 p[3 + b] * -9 + p[6 + b] * -16 + p[9 + b] * -9 + p[12 + b];
+          sum += p[18 + b] * -9 +
+                 p[21 + b] * 81 +
+                 p[24 + b] * 144 + p[27 + b] * 81 + p[30 + b] * -9;
+          sum += p[36 + b] * -16 +
+                 p[39 + b] * 144 +
+                 p[42 + b] * 256 + p[45 + b] * 144 + p[48 + b] * -16;
+          sum += p[54 + b] * -9 +
+                 p[57 + b] * 81 +
+                 p[60 + b] * 144 + p[63 + b] * 81 + p[66 + b] * -9;
+          sum += p[72 + b] +
+                 p[75 + b] * -9 + p[78 + b] * -16 + p[81 + b] * -9 + p[84 + b];
+          sum /= 1024;
 
-          for (x = 0; x < w; x++)
-            {
-              if (accum[x] < 0.0)
-                dest[x] = 0;
-              else if (accum[x] > 255.0)
-                dest[x] = 255;
-              else
-                dest[x] = RINT (accum[x]);
-            }
+          pixel[b] = (guchar) CLAMP (sum, 0, 255);
         }
+      break;
 
-      pixel_region_set_row (destPR, 0, y, width, dest);
-    }
+    case 4:
+      alphasum =  p[3] + p[7] * -9 + p[11] * -16 + p[15] * -9 + p[19];
+      alphasum += p[27] * -9 +
+                  p[31] * 81 + p[35] * 144 + p[39] * 81 + p[43] * -9;
+      alphasum += p[51] * -16 +
+                  p[55] * 144 + p[59] * 256 + p[63] * 144 + p[67] * -16;
+      alphasum += p[75] * -9 +
+                  p[79] * 81 + p[83] * 144 + p[87] * 81 + p[91] * -9;
+      alphasum += p[99] + p[103] * -9 + p[107] * -16 + p[111] * -9 + p[115];
 
-  /*  free up temporary arrays  */
-  g_free (accum);
+      if (alphasum > 0)
+        {
+          for (b = 0; b < 3; b++)
+            {
+              sum =  p[0 + b] * p[3] +
+                     p[4 + b] * p[7] * -9 +
+                     p[8 + b] * p[11] * -16 +
+                     p[12 + b] * p[15] * -9 + p[16 + b] * p[19];
+              sum += p[24 + b] * p[27] * -9 +
+                     p[28 + b] * p[31] * 81 +
+                     p[32 + b] * p[35] * 144 +
+                     p[36 + b] * p[39] * 81 + p[40 + b] * p[43] * -9;
+              sum += p[48 + b] * p[51] * -16 +
+                     p[52 + b] * p[55] * 144 +
+                     p[56 + b] * p[59] * 256 +
+                     p[60 + b] * p[63] * 144 + p[64 + b] * p[67] * -16;
+              sum += p[72 + b] * p[75] * -9 +
+                     p[76 + b] * p[79] * 81 +
+                     p[80 + b] * p[83] * 144 +
+                     p[84 + b] * p[87] * 81 + p[88 + b] * p[91] * -9;
+              sum += p[96 + b] * p[99] +
+                     p[100 + b] * p[103] * -9 +
+                    p[104 + b] * p[107] * -16 +
+                    p[108 + b] * p[111] * -9 + p[112 + b] * p[115];
+              sum /= alphasum;
+              pixel[b] = (guchar) CLAMP (sum, 0, 255);
+            }
 
-  for (i = 0; i < 4; i++)
-    g_free (src[i]);
+          alpha = (gint) alphasum / 1024;
+          pixel[3] = (guchar) CLAMP (alpha, 0, 255);
+        }
+      break;
+    }
+}
 
-  g_free (src_tmp);
-  g_free (dest);
+static void
+decimate_average (TileManager *srcTM,
+                  gint         x0,
+                  gint         y0,
+                  gint         x1,
+                  gint         y1,
+                  gdouble      xfrac,
+                  gdouble      yfrac,
+                  guchar      *pixel,
+                  gfloat      *kernel_lookup)
+{
+  gint   src_bpp    = tile_manager_bpp  (srcTM);
+  guchar pixel1[src_bpp];
+  guchar pixel2[src_bpp];
+  guchar pixel3[src_bpp];
+  guchar pixel4[src_bpp];
+
+  read_pixel_data_1 (srcTM, x0, y0, pixel1);
+  read_pixel_data_1 (srcTM, x1, y0, pixel2);
+  read_pixel_data_1 (srcTM, x0, y1, pixel3);
+  read_pixel_data_1 (srcTM, x1, y1, pixel4);
 
-  row -= 2 * bytes;
-  g_free (row);
+  pixel_average (pixel1, pixel2, pixel3, pixel4, pixel, src_bpp);
 }
 
-/* Lanczos */
 static inline gdouble
 sinc (gdouble x)
 {
@@ -687,60 +1135,6 @@
   return sin (y) / y;
 }
 
-static inline gdouble
-lanczos_sum (guchar         *ptr,
-             const gdouble  *kernel,  /* 1-D kernel of transform coeffs */
-             gint            u,
-             gint            bytes,
-             gint            byte)
-{
-  gdouble sum = 0;
-  gint    i;
-
-  for (i = 0; i < LANCZOS_WIDTH2 ; i++)
-    sum += kernel[i] * ptr[ (u + i - LANCZOS_WIDTH) * bytes + byte ];
-
-  return sum;
-}
-
-static inline gdouble
-lanczos_sum_mul (guchar         *ptr,
-                 const gdouble  *kernel,    /* 1-D kernel of transform coeffs */
-                 gint            u,
-                 gint            bytes,
-                 gint            byte,
-                 gint            alpha)
-{
-  gdouble sum = 0;
-  gint    i;
-
-  for (i = 0; i < LANCZOS_WIDTH2 ; i++ )
-    sum += kernel[i] * ptr[ (u + i - LANCZOS_WIDTH) * bytes + byte ]
-                 * ptr[ (u + i - LANCZOS_WIDTH) * bytes + alpha];
-
-  return sum;
-}
-
-static gboolean
-inv_lin_trans (const gdouble *t,
-               gdouble       *it)
-{
-  gdouble d = (t[0] * t[4]) - (t[1] * t[3]);  /* determinant */
-
-  if (fabs(d) < EPSILON )
-    return FALSE;
-
-  it[0] =    t[4] / d;
-  it[1] =   -t[1] / d;
-  it[2] = (( t[1] * t[5]) - (t[2] * t[4])) / d;
-  it[3] =   -t[3] / d;
-  it[4] =    t[0] / d;
-  it[5] = (( t[2] * t[3]) - (t[0] * t[5])) / d;
-
-  return TRUE;
-}
-
-
 /*
  * allocate and fill lookup table of Lanczos windowed sinc function
  * use gfloat since errors due to granularity of array far exceed data precision
@@ -764,248 +1158,566 @@
   return lookup;
 }
 
+static gfloat *
+create_lanczos3_lookup (void)
+{
+  const gdouble dx = 3.0 / (gdouble) (LANCZOS_SAMPLES - 1);
+
+  gfloat  *lookup = g_new (gfloat, LANCZOS_SAMPLES);
+  gdouble  x      = 0.0;
+  gint     i;
+
+  for (i = 0; i < LANCZOS_SAMPLES; i++)
+    {
+      lookup[i] = ((ABS (x) < 3.0) ?
+                   (sinc (x) * sinc (x / 3.0)) : 0.0);
+      x += dx;
+    }
+
+  return lookup;
+}
+
 static void
-scale_region_lanczos (PixelRegion      *srcPR,
-                      PixelRegion      *dstPR,
-                      GimpProgressFunc  progress_callback,
-                      gpointer          progress_data)
+interpolate_nearest (TileManager *srcTM,
+                     gint         x0,
+                     gint         y0,
+                     gint         x1,
+                     gint         y1,
+                     gdouble      xfrac,
+                     gdouble      yfrac,
+                     guchar      *pixel,
+                     gfloat      *kernel_lookup)
+{
+  gint x = (xfrac <= 0.5) ? x0 : x1;
+  gint y = (yfrac <= 0.5) ? y0 : y1;
 
+  read_pixel_data_1 (srcTM, x, y, pixel);
+}
+
+static inline gdouble
+weighted_sum (gdouble dx,
+              gdouble dy,
+              gint    s00,
+              gint    s10,
+              gint    s01,
+              gint    s11)
 {
-  gfloat        *kernel_lookup  = NULL;             /* Lanczos lookup table                */
-  gdouble        x_kernel[LANCZOS_WIDTH2],    /* 1-D kernels of Lanczos window coeffs */
-                 y_kernel[LANCZOS_WIDTH2];
+  return ((1 - dy) *
+          ((1 - dx) * s00 + dx * s10) + dy * ((1 - dx) * s01 + dx * s11));
+}
 
-  gdouble        newval;                      /* new interpolated RGB value          */
+static void
+interpolate_bilinear (TileManager *srcTM,
+                      gint         x0,
+                      gint         y0,
+                      gint         x1,
+                      gint         y1,
+                      gdouble      xfrac,
+                      gdouble      yfrac,
+                      guchar      *p,
+                      gfloat      *kernel_lookup)
+{
+  gint   src_bpp         = tile_manager_bpp  (srcTM);
+  guchar p1[src_bpp];
+  guchar p2[src_bpp];
+  guchar p3[src_bpp];
+  guchar p4[src_bpp];
+
+  gint   b;
+  gdouble sum, alphasum;
+
+  for (b=0; b < src_bpp; b++)
+    p[b]=0;
+
+  read_pixel_data_1 (srcTM, x0, y0, p1);
+  read_pixel_data_1 (srcTM, x1, y0, p2);
+  read_pixel_data_1 (srcTM, x0, y1, p3);
+  read_pixel_data_1 (srcTM, x1, y1, p4);
 
-  guchar        *win_buf = NULL;              /* Sliding window buffer               */
-  guchar        *win_ptr[LANCZOS_WIDTH2];     /* Ponters to sliding window rows      */
+  switch (src_bpp)
+    {
+    case 1:
+      sum = weighted_sum (xfrac, yfrac, p1[0], p2[0], p3[0], p4[0]);
+      p[0] = (guchar) CLAMP (sum, 0, 255);
+      break;
 
-  guchar        *dst_buf = NULL;              /* Pointer to destination image data   */
+    case 2:
+      alphasum = weighted_sum (xfrac, yfrac, p1[1], p2[1], p3[1], p4[1]);
+      if (alphasum > 0)
+        {
+          sum = weighted_sum (xfrac, yfrac, p1[0] * p1[1], p2[0] * p2[1],
+                              p3[0] * p3[1], p4[0] * p4[1]);
+          sum /= alphasum;
+
+          p[0] = (guchar) CLAMP (sum, 0, 255);
+          p[1] = (guchar) CLAMP (alphasum, 0, 255);
+        }
+      break;
 
-  gint           x, y;                        /* Position in destination image       */
-  gint           i, byte;                     /* loop vars  */
-  gint           row;
+    case 3:
+      for (b = 0; b < 3; b++)
+        {
+          sum = weighted_sum (xfrac, yfrac, p1[b], p2[b], p3[b], p4[b]);
+          p[b] = (guchar) CLAMP (sum, 0, 255);
+        }
+      break;
 
-  gdouble        trans[6], itrans[6];         /* Scale transformations               */
+    case 4:
+      alphasum = weighted_sum (xfrac, yfrac, p1[3], p2[3], p3[3], p4[3]);
+      if (alphasum > 0)
+        {
+          for (b = 0; b<3; b++)
+            {
+              sum = weighted_sum (xfrac, yfrac, p1[b] * p1[3], p2[b] * p2[3],
+                                  p3[b] * p3[3], p4[b] * p4[3]);
+              sum /= alphasum;
+              p[b] = (guchar) CLAMP (sum, 0, 255);
+            }
 
-  const gint     dst_width     = dstPR->w;
-  const gint     dst_height    = dstPR->h;
-  const gint     bytes         = dstPR->bytes;
-  const gint     src_width     = srcPR->w;
-  const gint     src_height    = srcPR->h;
+          p[3] = (guchar) CLAMP (alphasum, 0, 255);
+        }
+      break;
+    }
+}
 
-  const gint     src_row_span  = src_width * bytes;
-  const gint     dst_row_span  = dst_width * bytes;
-  const gint     win_row_span  = (src_width + LANCZOS_WIDTH2) * bytes;
+/* Catmull-Rom spline - not bad
+  * basic intro http://www.mvps.org/directx/articles/catmull/
+  * This formula will calculate an interpolated point between pt1 and pt2
+  * dx=0 returns pt1; dx=1 returns pt2
+  */
 
-  const gdouble  scale_x       = dst_width / (gdouble) src_width;
-  const gdouble  scale_y       = dst_height / (gdouble) src_height;
+static inline gdouble
+cubic_spline_fit (gdouble dx,
+                  gint    pt0,
+                  gint    pt1,
+                  gint    pt2,
+                  gint    pt3)
+{
 
-  for (i = 0; i < 6; i++)
-    trans[i] = 0.0;
+  return (gdouble) ((( ( -pt0 + 3 * pt1 - 3 * pt2 + pt3 ) *   dx +
+                       ( 2 * pt0 - 5 * pt1 + 4 * pt2 - pt3 ) ) * dx +
+                     ( -pt0 + pt2 ) ) * dx + (pt1 + pt1) ) / 2.0;
+}
 
-  trans[0] = scale_x;
-  trans[4] = scale_y;
+static void
+interpolate_cubic (TileManager *srcTM,
+                   gint         x1,
+                   gint         y1,
+                   gint         x2,
+                   gint         y2,
+                   gdouble      xfrac,
+                   gdouble      yfrac,
+                   guchar      *p,
+                   gfloat      *kernel_lookup)
+{
+  gint    src_bpp    = tile_manager_bpp  (srcTM);
+  guint   src_width  = tile_manager_width  (srcTM);
+  guint   src_height = tile_manager_height (srcTM);
+  gint    b, i;
+  gint    x, y;
+  gint    x0;
+  gint    y0;
+
+  guchar  ps[16 * src_bpp];
+  gdouble p0, p1, p2, p3;
+
+  gdouble sum, alphasum;
+
+  for (b = 0; b < src_bpp; b++)
+    p[b] = 0;
+
+  for (y = y1 - 1, i = 0; y <= y1 + 2; y++)
+    for (x = x1 - 1; x <= x1 + 2; x++, i++)
+      {
+        x0 = (x < src_width)  ? ABS(x) : 2 * src_width  - x - 1;
+        y0 = (y < src_height) ? ABS(y) : 2 * src_height - y - 1;
+        read_pixel_data_1 (srcTM, x0, y0, ps + (i * src_bpp));
+      }
 
-  if (! inv_lin_trans (trans, itrans))
+  switch (src_bpp)
     {
-      g_warning ("transformation matrix is not invertible");
-      return;
-    }
+    case 1:
+      p0 = cubic_spline_fit (xfrac, ps[0 ], ps[1 ], ps[2 ], ps[3 ]);
+      p1 = cubic_spline_fit (xfrac, ps[4 ], ps[5 ], ps[6 ], ps[7 ]);
+      p2 = cubic_spline_fit (xfrac, ps[8 ], ps[9 ], ps[10], ps[11]);
+      p3 = cubic_spline_fit (xfrac, ps[12], ps[13], ps[14], ps[15]);
 
-  /* allocate buffer for destination row */
-  dst_buf = g_new0 (guchar, dst_row_span);
+      sum = cubic_spline_fit (yfrac, p0, p1, p2, p3);
 
-  /* if no scaling needed copy data */
-  if (dst_width == src_width && dst_height == src_height)
-    {
-       for (i = 0 ; i < src_height ; i++)
-         {
-           pixel_region_get_row (srcPR, 0, i, src_width, dst_buf, 1);
-           pixel_region_set_row (dstPR, 0, i, dst_width, dst_buf);
-         }
-       g_free(dst_buf);
-       return;
-    }
-
-  /* allocate and fill kernel_lookup lookup table */
-  kernel_lookup = create_lanczos_lookup ();
-
-  /* allocate buffer for source rows */
-  win_buf = g_new0 (guchar, win_row_span * LANCZOS_WIDTH2);
-
-  /* Set the window pointers */
-  for ( i = 0 ; i < LANCZOS_WIDTH2 ; i++ )
-    win_ptr[i] = win_buf + (win_row_span * i) + LANCZOS_WIDTH * bytes;
-
-  /* fill the data for the first loop */
-  for ( i = 0 ; i <= LANCZOS_WIDTH && i < src_height ; i++)
-    pixel_region_get_row (srcPR, 0, i, src_width, win_ptr[i + LANCZOS_WIDTH], 1);
-
-  for (row = y = 0; y < dst_height; y++)
-    {
-      if (progress_callback && (y % 64 == 0))
-        progress_callback (0, dst_height, y, progress_data);
-
-      pixel_region_get_row (dstPR, 0, y, dst_width, dst_buf, 1);
-      for  (x = 0; x < dst_width; x++)
-        {
-          gdouble  dsrc_x ,dsrc_y;        /* corresponding scaled position in source image */
-          gint     int_src_x, int_src_y;  /* integer part of coordinates in source image   */
-          gint     x_shift, y_shift;      /* index into Lanczos lookup                     */
-          gdouble  kx_sum, ky_sum;        /* sums of Lanczos kernel coeffs                 */
-
-          /* -0.5 corrects image drift.due to average offset used in lookup */
-          dsrc_x = x / scale_x - 0.5;
-          dsrc_y = y / scale_y - 0.5;
-
-          /* avoid (int) on negative*/
-          if (dsrc_x > 0)
-            int_src_x = (gint) (dsrc_x);
-          else
-            int_src_x = (gint) (dsrc_x + 1) - 1;
-
-          if (dsrc_y > 0)
-            int_src_y = (gint) (dsrc_y);
-          else
-            int_src_y = (gint) (dsrc_y + 1) - 1;
-
-          /* calc lookup offsets for non-interger remainders */
-          x_shift = (gint) ((dsrc_x - int_src_x) * LANCZOS_SPP + 0.5);
-          y_shift = (gint) ((dsrc_y - int_src_y) * LANCZOS_SPP + 0.5);
-
-          /*  Fill x_kernel[] and y_kernel[] with lanczos coeffs
-           *
-           *  kernel_lookup = Is a lookup table that contains half of the symetrical windowed-sinc func.
-           *
-           *  x_shift, y_shift = shift from kernel center due to fractional part
-           *           of interpollation
-           *
-           *  The for-loop creates two 1-D kernels for convolution.
-           *    - If the center position +/- LANCZOS_WIDTH is out of
-           *      the source image coordinates set the value to 0.0
-           *      FIXME => partial kernel. Define a more rigourous border mode.
-           *    - If the kernel index is out of range set value to 0.0
-           *      ( caused by offset coeff. obselete??)
-           */
-          kx_sum = ky_sum = 0.0;
+      p[0]= (guchar) CLAMP (sum, 0, 255);
+      break;
 
-          for (i = LANCZOS_WIDTH; i >= -LANCZOS_WIDTH; i--)
+    case 2:
+      p0 = cubic_spline_fit (xfrac, ps[1 ], ps[3 ], ps[5 ], ps[7 ]);
+      p1 = cubic_spline_fit (xfrac, ps[9 ], ps[11], ps[13], ps[15]);
+      p2 = cubic_spline_fit (xfrac, ps[17], ps[19], ps[21], ps[23]);
+      p3 = cubic_spline_fit (xfrac, ps[25], ps[27], ps[29], ps[31]);
+
+      alphasum = cubic_spline_fit (yfrac, p0, p1, p2, p3);
+
+      if (alphasum > 0)
+        {
+          p0 = cubic_spline_fit (xfrac, ps[0 ] * ps[1 ], ps[2 ] * ps[3 ],
+                                 ps[4 ] * ps[5 ], ps[6 ] * ps[7 ]);
+          p1 = cubic_spline_fit (xfrac, ps[8 ] * ps[9 ], ps[10] * ps[11],
+                                 ps[12] * ps[13], ps[14] * ps[15]);
+          p2 = cubic_spline_fit (xfrac, ps[16] * ps[17], ps[18] * ps[19],
+                                 ps[20] * ps[21], ps[22] * ps[23]);
+          p3 = cubic_spline_fit (xfrac, ps[24] * ps[25], ps[26] * ps[27],
+                                 ps[28] * ps[29], ps[30] * ps[31]);
+
+          sum  = cubic_spline_fit (yfrac, p0, p1, p2, p3);
+          sum /= alphasum;
+
+          p[0] = (guchar) CLAMP (sum, 0, 255);
+          p[1] = (guchar) CLAMP (alphasum, 0, 255);
+        }
+      break;
+    case 3:
+      for (b = 0; b < 3; b++)
+        {
+          p0 = cubic_spline_fit (xfrac, ps[   b], ps[3 + b], ps[6 + b], ps[9 + b]);
+          p1 = cubic_spline_fit (xfrac, ps[12 + b], ps[15 + b], ps[18 + b], ps[21 + b]);
+          p2 = cubic_spline_fit (xfrac, ps[24 + b], ps[27 + b], ps[30 + b], ps[33 + b]);
+          p3 = cubic_spline_fit (xfrac, ps[36 + b], ps[39 + b], ps[42 + b], ps[45 + b]);
+
+          sum = cubic_spline_fit (yfrac, p0, p1, p2, p3);
+
+          p[b] = (guchar) CLAMP (sum, 0, 255);
+        }
+      break;
+
+    case 4:
+      p0 = cubic_spline_fit (xfrac, ps[3],  ps[7],  ps[11], ps[15]);
+      p1 = cubic_spline_fit (xfrac, ps[19], ps[23], ps[27], ps[31]);
+      p2 = cubic_spline_fit (xfrac, ps[35], ps[39], ps[43], ps[47]);
+      p3 = cubic_spline_fit (xfrac, ps[51], ps[55], ps[59], ps[63]);
+
+      alphasum = cubic_spline_fit (yfrac, p0, p1, p2, p3);
+
+      if (alphasum > 0)
+        {
+          for (b = 0; b < 3; b++)
             {
-              gint pos = i * LANCZOS_SPP;
+              p0 = cubic_spline_fit (xfrac, ps[0 + b] * ps[3],  ps[4 + b] * ps[7],
+                                     ps[8 + b] * ps[11], ps[12 + b] * ps[15]);
+              p1 = cubic_spline_fit (xfrac, ps[16 + b] * ps[19], ps[20 + b] * ps[23],
+                                     ps[24 + b] * ps[27], ps[28 + b] * ps[31]);
+              p2 = cubic_spline_fit (xfrac, ps[32 + b] * ps[35], ps[36 + b] * ps[39],
+                                     ps[40 + b] * ps[43], ps[44 + b] * ps[47]);
+              p3 = cubic_spline_fit (xfrac, ps[48 + b] * ps[51], ps[52 + b] * ps[55],
+                                     ps[56 + b] * ps[59], ps[60 + b] * ps[63]);
 
-              if ( int_src_x + i >= 0 && int_src_x + i < src_width)
-                kx_sum += x_kernel[LANCZOS_WIDTH + i] = kernel_lookup[ABS (x_shift - pos)];
-              else
-                x_kernel[LANCZOS_WIDTH + i] = 0.0;
+              sum  = cubic_spline_fit (yfrac, p0, p1, p2, p3);
+              sum /= alphasum;
 
-              if ( int_src_y + i >= 0 && int_src_y + i < src_height)
-                ky_sum += y_kernel[LANCZOS_WIDTH + i] = kernel_lookup[ABS (y_shift - pos)];
-              else
-                y_kernel[LANCZOS_WIDTH + i] = 0.0;
+              p[b] = (guchar) CLAMP (sum, 0, 255);
             }
 
-          /* normalise the kernel arrays */
-          for (i = -LANCZOS_WIDTH; i <= LANCZOS_WIDTH; i++)
-          {
-             x_kernel[LANCZOS_WIDTH + i] /= kx_sum;
-             y_kernel[LANCZOS_WIDTH + i] /= ky_sum;
-          }
-
-          /*
-            Scaling up
-            New determined source row is > than last read row
-            rotate the pointers and get next source row from region.
-            If no more source rows are available fill buffer with 0
-            ( Probably not necessary because multipliers should be 0).
-          */
-          for ( ; row < int_src_y ; )
+          p[3] = (guchar) CLAMP (alphasum, 0, 255);
+        }
+      break;
+    }
+}
+
+static gdouble inline
+lanczos3_mul_alpha (guchar  * pixels,
+                    gdouble * x_kernel,
+                    gdouble * y_kernel,
+                    gint bytes,
+                    gint byte)
+{
+  gdouble sum   = 0.0;
+  guchar *p     = pixels;
+  guchar  alpha = bytes - 1;
+  gint    x, y;
+
+  for (y = 0; y < 6; y++)
+    {
+      gdouble tmpsum = 0.0;
+
+      for (x = 0; x < 6; x++, p += bytes)
+        {
+          tmpsum += x_kernel[x] * p[byte] * p[alpha];
+        }
+
+      tmpsum *= y_kernel[y];
+      sum    += tmpsum;
+    }
+
+  return sum;
+}
+
+static gdouble inline
+lanczos3_mul (guchar  *pixels,
+              gdouble *x_kernel,
+              gdouble *y_kernel,
+              gint     bytes,
+              gint     byte)
+{
+  gdouble sum  = 0.0;
+  guchar *p    = pixels;
+  gint    x, y;
+
+  for (y = 0; y < 6; y++)
+    {
+      gdouble tmpsum = 0.0;
+
+      for (x = 0; x < 6; x++, p += bytes)
+        {
+          tmpsum += x_kernel[x] * p[byte];
+        }
+
+      tmpsum *= y_kernel[y];
+      sum    += tmpsum;
+    }
+
+  return sum;
+}
+
+static void
+interpolate_lanczos3 (TileManager *srcTM,
+                      gint         x1,
+                      gint         y1,
+                      gint         x2,
+                      gint         y2,
+                      gdouble      xfrac,
+                      gdouble      yfrac,
+                      guchar      *pixel,
+                      gfloat      *kernel_lookup)
+{
+  gint    src_bpp    = tile_manager_bpp  (srcTM);
+  guint   src_width  = tile_manager_width  (srcTM);
+  guint   src_height = tile_manager_height (srcTM);
+  gint    b, i;
+  gint    x, y;
+  gint    x0;
+  gint    y0;
+  gint    x_shift, y_shift;
+  gdouble kx_sum, ky_sum;
+  gdouble x_kernel[6], y_kernel[6];
+  guchar  pixels[36 * src_bpp];
+  gdouble sum, alphasum;
+
+  for (b = 0; b < src_bpp; b++)
+    pixel[b] = 0;
+
+  for (y = y1 - 2, i = 0; y <= y1 + 3; y++)
+    {
+      for (x = x1 - 2; x <= x1 + 3; x++, i++)
+        {
+          x0 = (x < src_width)  ? ABS(x) : 2 * src_width  - x - 1;
+          y0 = (y < src_height) ? ABS(y) : 2 * src_height - y - 1;
+          read_pixel_data_1 (srcTM, x0, y0, pixels + (i * src_bpp));
+        }
+    }
+
+  x_shift = (gint) (xfrac * LANCZOS_SPP + 0.5);
+  y_shift = (gint) (yfrac * LANCZOS_SPP + 0.5);
+  kx_sum  = ky_sum = 0.0;
+
+  for (i = 3; i >= -2; i--)
+    {
+      gint pos = i * LANCZOS_SPP;
+
+      kx_sum += x_kernel[2 + i] = kernel_lookup[ABS (x_shift - pos)];
+      ky_sum += y_kernel[2 + i] = kernel_lookup[ABS (y_shift - pos)];
+    }
+
+  /* normalise the kernel arrays */
+  for (i = -2; i <= 3; i++)
+    {
+      x_kernel[2 + i] /= kx_sum;
+      y_kernel[2 + i] /= ky_sum;
+    }
+
+  switch (src_bpp)
+    {
+    case 1:
+      sum      = lanczos3_mul (pixels, x_kernel, y_kernel, 1, 0);
+      pixel[0] = (guchar) CLAMP ((gint) sum, 0, 255);
+      break;
+
+    case 2:
+      alphasum  = lanczos3_mul (pixels, x_kernel, y_kernel, 2, 1);
+      if (alphasum > 0)
+        {
+          sum       = lanczos3_mul_alpha (pixels, x_kernel, y_kernel, 2, 0);
+          sum      /= alphasum;
+          pixel[0]  = (guchar) CLAMP (sum, 0, 255);
+          pixel[1]  = (guchar) CLAMP (alphasum, 0, 255);
+        }
+      break;
+
+    case 3:
+      for (b = 0; b < 3; b++)
+        {
+          sum      = lanczos3_mul (pixels, x_kernel, y_kernel, 3, b);
+          pixel[b] = (guchar) CLAMP (sum, 0, 255);
+        }
+      break;
+
+    case 4:
+      alphasum = lanczos3_mul (pixels, x_kernel, y_kernel, 4, 3);
+      if (alphasum > 0)
+        {
+          for (b = 0; b < 3; b++)
             {
-              row++;
-              rotate_pointers (win_ptr, LANCZOS_WIDTH2);
-              if ( row + LANCZOS_WIDTH < src_height)
-                pixel_region_get_row (srcPR, 0,
-                                      row + LANCZOS_WIDTH, src_width,
-                                      win_ptr[LANCZOS_WIDTH2 - 1], 1);
-              else
-                memset (win_ptr[LANCZOS_WIDTH2 - 1], 0,
-                        sizeof (guchar) * src_row_span);
+              sum      = lanczos3_mul_alpha (pixels, x_kernel, y_kernel, 4, b);
+              sum     /= alphasum;
+              pixel[b] = (guchar) CLAMP (sum, 0, 255);
             }
-           /*
-              Scaling down
-            */
-            for ( ; row > int_src_y ; )
+
+          pixel[3] = (guchar) CLAMP (alphasum, 0, 255);
+        }
+      break;
+    }
+}
+
+static void
+scale_pr (PixelRegion           *srcPR,
+          PixelRegion           *dstPR,
+          GimpInterpolationType  interpolation)
+{
+  gdouble scalex     = (gdouble) dstPR->w / (gdouble) srcPR->w;
+  gdouble scaley     = (gdouble) dstPR->h / (gdouble) srcPR->h;
+  gint    src_width  = srcPR->w;
+  gint    src_height = srcPR->h;
+  gint    bytes      = srcPR->bytes;
+  guchar *dstPtr     = dstPR->data;
+  gdouble xfrac, yfrac;
+  gint    b, x, sx0, sx1, y, sy0, sy1;
+  guchar  pixel[bytes];
+
+  for (y = 0; y < dstPR->h; y++)
+    {
+      yfrac = (y / scaley);
+      sy0   = (gint) yfrac;
+      sy1   = sy0 + 1;
+      sy1   = (sy1 < src_height) ? ABS(sy1) : 2 * src_height - sy1 - 1;
+
+      yfrac =  yfrac - sy0;
+
+      for (x = 0; x < dstPR->w; x++)
+        {
+          xfrac = (x / scalex);
+          sx0   = (gint) xfrac;
+          sx1   = sx0 + 1;
+          sx1   = (sx1 < src_width) ? ABS(sx1) : 2 * src_width - sx1 - 1;
+          xfrac =  xfrac - sx0;
+
+          switch (interpolation)
             {
-              row--;
-              for ( i = 0 ; i < LANCZOS_WIDTH2 - 1 ; i++ )
-                 rotate_pointers (win_ptr, LANCZOS_WIDTH2);
-              if ( row >=  0)
-                pixel_region_get_row (srcPR, 0,
-                                      row, src_width,
-                                      win_ptr[0], 1);
+            case GIMP_INTERPOLATION_NONE:
+            case GIMP_INTERPOLATION_LINEAR:
+            case GIMP_INTERPOLATION_CUBIC:
+            case GIMP_INTERPOLATION_LANCZOS:
+              if (scalex == 0.5 || scaley == 0.5)
+                {
+                  decimate_average_pr (srcPR,
+                                       sx0, sy0,
+                                       sx1, sy1,
+                                       pixel);
+                }
               else
-                memset (win_ptr[0], 0,
-                        sizeof (guchar) * src_row_span);
-
+                {
+                  interpolate_bilinear_pr (srcPR,
+                                           sx0, sy0,
+                                           sx1, sy1,
+                                           xfrac, yfrac,
+                                           pixel);
+                }
+              break;
             }
 
+          for (b = 0; b < bytes; b++, dstPtr++)
+            *dstPtr = pixel[b];
+        }
+    }
+}
+
+static void
+decimate_average_pr (PixelRegion *srcPR,
+                     gint         x0,
+                     gint         y0,
+                     gint         x1,
+                     gint         y1,
+                     guchar      *p)
+{
+  gint    bytes = srcPR->bytes;
+  gint    width = srcPR->w;
+  guchar *p1    = srcPR->data + (y0 * width + x0) * bytes;
+  guchar *p2    = srcPR->data + (y0 * width + x1) * bytes;
+  guchar *p3    = srcPR->data + (y1 * width + x0) * bytes;
+  guchar *p4    = srcPR->data + (y1 * width + x1) * bytes;
 
-           if (pixel_region_has_alpha (srcPR))
-             {
-               const gint alpha = bytes - 1;
-               gint       byte;
-               gdouble    arecip;
-               gdouble    aval;
-
-               aval = 0.0;
-               for (i = 0; i < LANCZOS_WIDTH2 ; i++ )
-                 aval += y_kernel[i] * lanczos_sum (win_ptr[i], x_kernel,
-                         int_src_x, bytes, alpha);
-
-               if (aval <= 0.0)
-                 {
-                   arecip = 0.0;
-                   dst_buf[x * bytes + alpha] = 0;
-                 }
-               else if (aval > 255.0)
-                 {
-                   arecip = 1.0 / aval;
-                   dst_buf[x * bytes + alpha] = 255;
-                 }
-               else
-                 {
-                   arecip = 1.0 / aval;
-                   dst_buf[x * bytes + alpha] = RINT (aval);
-                 }
-
-               for (byte = 0; byte < alpha; byte++)
-                 {
-                   newval = 0.0;
-                   for (i = 0; i < LANCZOS_WIDTH2; i++ )
-                     newval += y_kernel[i] * lanczos_sum_mul (win_ptr[i], x_kernel,
-                               int_src_x, bytes, byte, alpha);
-                   newval *= arecip;
-                   dst_buf[x * bytes + byte] = CLAMP (newval, 0, 255);
-                 }
-             }
-           else
-             {
-               for (byte = 0; byte < bytes; byte++)
-                 {
-                   /* Calculate new value */
-                   newval = 0.0;
-                   for (i = 0; i < LANCZOS_WIDTH2; i++ )
-                     newval += y_kernel[i] * lanczos_sum (win_ptr[i], x_kernel,
-                               int_src_x, bytes, byte);
-                   dst_buf[x * bytes + byte] = CLAMP ((gint) newval, 0, 255);
-                 }
-             }
-        }
-
-      pixel_region_set_row (dstPR, 0, y , dst_width, dst_buf);
-    }
-
-  g_free (dst_buf);
-  g_free (win_buf);
-  g_free (kernel_lookup);
+  pixel_average (p1, p2, p3, p4, p, bytes);
+}
+
+static void
+interpolate_bilinear_pr (PixelRegion *srcPR,
+                         gint         x0,
+                         gint         y0,
+                         gint         x1,
+                         gint         y1,
+                         gdouble      xfrac,
+                         gdouble      yfrac,
+                         guchar      *p)
+{
+  gint    bytes = srcPR->bytes;
+  gint    width = srcPR->w;
+  guchar *p1    = srcPR->data + (y0 * width + x0) * bytes;
+  guchar *p2    = srcPR->data + (y0 * width + x1) * bytes;
+  guchar *p3    = srcPR->data + (y1 * width + x0) * bytes;
+  guchar *p4    = srcPR->data + (y1 * width + x1) * bytes;
+
+  gint    b;
+  gdouble sum, alphasum;
+
+  for (b = 0; b < bytes; b++)
+    p[b] = 0;
+
+  switch (bytes)
+    {
+    case 1:
+      sum      = weighted_sum (xfrac, yfrac, p1[0], p2[0], p3[0], p4[0]);
+      p[0]     = (guchar) CLAMP (sum, 0, 255);
+      break;
+
+    case 2:
+      alphasum = weighted_sum (xfrac, yfrac, p1[1], p2[1], p3[1], p4[1]);
+      if (alphasum > 0)
+        {
+          sum  = weighted_sum (xfrac, yfrac, p1[0] * p1[1], p2[0] * p2[1],
+                               p3[0] * p3[1], p4[0] * p4[1]);
+          sum /= alphasum;
+          p[0] = (guchar) CLAMP (sum, 0, 255);
+          p[1] = (guchar) CLAMP (alphasum, 0, 255);
+        }
+      break;
+
+    case 3:
+      for (b = 0; b < 3; b++)
+        {
+          sum  = weighted_sum (xfrac, yfrac, p1[b], p2[b], p3[b], p4[b]);
+          p[b] = (guchar) CLAMP (sum, 0, 255);
+        }
+      break;
+
+    case 4:
+      alphasum = weighted_sum (xfrac, yfrac, p1[3], p2[3], p3[3], p4[3]);
+      if (alphasum > 0)
+        {
+          for (b = 0; b < 3; b++)
+            {
+              sum  = weighted_sum (xfrac, yfrac, p1[b] * p1[3], p2[b] * p2[3],
+                                   p3[b] * p3[3], p4[b] * p4[3]);
+              sum /= alphasum;
+              p[b] = (guchar) CLAMP (sum, 0, 255);
+            }
+
+          p[3] = (guchar) CLAMP (alphasum, 0, 255);
+        }
+      break;
+    }
 }

Modified: branches/soc-2008-text/app/paint/gimpairbrush.c
==============================================================================
--- branches/soc-2008-text/app/paint/gimpairbrush.c	(original)
+++ branches/soc-2008-text/app/paint/gimpairbrush.c	Wed Aug  6 20:36:18 2008
@@ -143,8 +143,7 @@
           airbrush->paint_options = paint_options;
 
           dynamic_rate = gimp_paint_options_get_dynamic_rate (paint_options,
-                                                              &paint_core->cur_coords,
-                                                              paint_core->use_pressure);
+                                                              &paint_core->cur_coords);
 
           timeout = 10000 / (options->rate * dynamic_rate);
 

Modified: branches/soc-2008-text/app/paint/gimpbrushcore.c
==============================================================================
--- branches/soc-2008-text/app/paint/gimpbrushcore.c	(original)
+++ branches/soc-2008-text/app/paint/gimpbrushcore.c	Wed Aug  6 20:36:18 2008
@@ -355,7 +355,6 @@
 
   core->scale = gimp_paint_options_get_dynamic_size (paint_options,
                                                      coords,
-                                                     paint_core->use_pressure,
                                                      GIMP_BRUSH_CORE_GET_CLASS (core)->handles_scaling_brush);
 
   core->spacing = (gdouble) gimp_brush_get_spacing (core->main_brush) / 100.0;
@@ -636,7 +635,6 @@
                                          p * delta_wheel);
       paint_core->cur_coords.velocity = (paint_core->last_coords.velocity +
                                          p * delta_velocity);
-      paint_core->cur_coords.random   = g_random_double_range (0.0, 1.0);
 
       if (core->jitter > 0.0)
         {
@@ -689,12 +687,10 @@
   gint           brush_width, brush_height;
 
   if (GIMP_BRUSH_CORE_GET_CLASS (core)->handles_scaling_brush)
-    {
-      core->scale = gimp_paint_options_get_dynamic_size (paint_options,
-                                                         &paint_core->cur_coords,
-                                                         paint_core->use_pressure,
-                                                         TRUE);
-    }
+    core->scale = gimp_paint_options_get_dynamic_size (paint_options,
+                                                       &paint_core->cur_coords,
+                                                       TRUE);
+
   /* else use scale from start(), we don't support on-the-fly scaling */
 
   gimp_brush_scale_size (core->brush, core->scale,

Modified: branches/soc-2008-text/app/paint/gimpclone.c
==============================================================================
--- branches/soc-2008-text/app/paint/gimpclone.c	(original)
+++ branches/soc-2008-text/app/paint/gimpclone.c	Wed Aug  6 20:36:18 2008
@@ -237,12 +237,10 @@
     }
 
   opacity *= gimp_paint_options_get_dynamic_opacity (paint_options,
-                                                     &paint_core->cur_coords,
-                                                     paint_core->use_pressure);
+                                                     &paint_core->cur_coords);
 
   hardness = gimp_paint_options_get_dynamic_hardness (paint_options,
-                                                      &paint_core->cur_coords,
-                                                      paint_core->use_pressure);
+                                                      &paint_core->cur_coords);
 
   gimp_brush_core_paste_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
                                 MIN (opacity, GIMP_OPACITY_OPAQUE),

Modified: branches/soc-2008-text/app/paint/gimpconvolve.c
==============================================================================
--- branches/soc-2008-text/app/paint/gimpconvolve.c	(original)
+++ branches/soc-2008-text/app/paint/gimpconvolve.c	Wed Aug  6 20:36:18 2008
@@ -151,8 +151,7 @@
   rate = options->rate;
 
   rate *= gimp_paint_options_get_dynamic_rate (paint_options,
-                                               &paint_core->cur_coords,
-                                               paint_core->use_pressure);
+                                               &paint_core->cur_coords);
 
   gimp_convolve_calculate_matrix (convolve, options->type,
                                   brush_core->brush->mask->width / 2,

Modified: branches/soc-2008-text/app/paint/gimpdodgeburn.c
==============================================================================
--- branches/soc-2008-text/app/paint/gimpdodgeburn.c	(original)
+++ branches/soc-2008-text/app/paint/gimpdodgeburn.c	Wed Aug  6 20:36:18 2008
@@ -237,12 +237,10 @@
   g_free (temp_data);
 
   opacity *= gimp_paint_options_get_dynamic_opacity (paint_options,
-                                                     &paint_core->cur_coords,
-                                                     paint_core->use_pressure);
+                                                     &paint_core->cur_coords);
 
   hardness = gimp_paint_options_get_dynamic_hardness (paint_options,
-                                                      &paint_core->cur_coords,
-                                                      paint_core->use_pressure);
+                                                      &paint_core->cur_coords);
 
   /* Replace the newly dodgedburned area (canvas_buf) to the image */
   gimp_brush_core_replace_canvas (GIMP_BRUSH_CORE (paint_core), drawable,

Modified: branches/soc-2008-text/app/paint/gimperaser.c
==============================================================================
--- branches/soc-2008-text/app/paint/gimperaser.c	(original)
+++ branches/soc-2008-text/app/paint/gimperaser.c	Wed Aug  6 20:36:18 2008
@@ -132,12 +132,10 @@
                 area->width * area->height, area->bytes);
 
   opacity *= gimp_paint_options_get_dynamic_opacity (paint_options,
-                                                     &paint_core->cur_coords,
-                                                     paint_core->use_pressure);
+                                                     &paint_core->cur_coords);
 
   hardness = gimp_paint_options_get_dynamic_hardness (paint_options,
-                                                      &paint_core->cur_coords,
-                                                      paint_core->use_pressure);
+                                                      &paint_core->cur_coords);
 
   gimp_brush_core_paste_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
                                 MIN (opacity, GIMP_OPACITY_OPAQUE),

Modified: branches/soc-2008-text/app/paint/gimpheal.c
==============================================================================
--- branches/soc-2008-text/app/paint/gimpheal.c	(original)
+++ branches/soc-2008-text/app/paint/gimpheal.c	Wed Aug  6 20:36:18 2008
@@ -438,8 +438,7 @@
   gdouble        hardness;
 
   hardness = gimp_paint_options_get_dynamic_hardness (paint_options,
-                                                      &paint_core->cur_coords,
-                                                      paint_core->use_pressure);
+                                                      &paint_core->cur_coords);
 
   mask_buf = gimp_brush_core_get_brush_mask (GIMP_BRUSH_CORE (source_core),
                                              GIMP_BRUSH_HARD,
@@ -547,8 +546,7 @@
   temp_buf_free (temp);
 
   opacity *= gimp_paint_options_get_dynamic_opacity (paint_options,
-                                                     &paint_core->cur_coords,
-                                                     paint_core->use_pressure);
+                                                     &paint_core->cur_coords);
 
   /* replace the canvas with our healed data */
   gimp_brush_core_replace_canvas (GIMP_BRUSH_CORE (paint_core),

Modified: branches/soc-2008-text/app/paint/gimppaintbrush.c
==============================================================================
--- branches/soc-2008-text/app/paint/gimppaintbrush.c	(original)
+++ branches/soc-2008-text/app/paint/gimppaintbrush.c	Wed Aug  6 20:36:18 2008
@@ -129,8 +129,7 @@
   paint_appl_mode = paint_options->application_mode;
 
   grad_point = gimp_paint_options_get_dynamic_color (paint_options,
-                                                     &paint_core->cur_coords,
-                                                     paint_core->use_pressure);
+                                                     &paint_core->cur_coords);
 
   /* optionally take the color from the current gradient */
   if (gimp_paint_options_get_gradient_color (paint_options, image,
@@ -175,12 +174,10 @@
     }
 
   opacity *= gimp_paint_options_get_dynamic_opacity (paint_options,
-                                                     &paint_core->cur_coords,
-                                                     paint_core->use_pressure);
+                                                     &paint_core->cur_coords);
 
   hardness = gimp_paint_options_get_dynamic_hardness (paint_options,
-                                                      &paint_core->cur_coords,
-                                                      paint_core->use_pressure);
+                                                      &paint_core->cur_coords);
 
   /* finally, let the brush core paste the colored area on the canvas */
   gimp_brush_core_paste_canvas (brush_core, drawable,

Modified: branches/soc-2008-text/app/paint/gimppaintcore-stroke.c
==============================================================================
--- branches/soc-2008-text/app/paint/gimppaintcore-stroke.c	(original)
+++ branches/soc-2008-text/app/paint/gimppaintcore-stroke.c	Wed Aug  6 20:36:18 2008
@@ -34,6 +34,9 @@
 #include "gimppaintoptions.h"
 
 
+static void gimp_paint_core_stroke_emulate_dynamics (GimpCoords *coords,
+                                                     gint        length);
+
 static const GimpCoords default_coords = GIMP_COORDS_DEFAULT_VALUES;
 
 
@@ -91,6 +94,7 @@
 gimp_paint_core_stroke_boundary (GimpPaintCore     *core,
                                  GimpDrawable      *drawable,
                                  GimpPaintOptions  *paint_options,
+                                 gboolean           emulate_dynamics,
                                  const BoundSeg    *bound_segs,
                                  gint               n_bound_segs,
                                  gint               offset_x,
@@ -160,6 +164,9 @@
 
       n_coords++;
 
+      if (emulate_dynamics)
+        gimp_paint_core_stroke_emulate_dynamics (coords, n_coords);
+
       if (initialized ||
           gimp_paint_core_start (core, drawable, paint_options, &coords[0],
                                  error))
@@ -219,15 +226,14 @@
 gimp_paint_core_stroke_vectors (GimpPaintCore     *core,
                                 GimpDrawable      *drawable,
                                 GimpPaintOptions  *paint_options,
+                                gboolean           emulate_dynamics,
                                 GimpVectors       *vectors,
                                 GError           **error)
 {
-  GList      *stroke;
-  GArray     *coords      = NULL;
-  gboolean    initialized = FALSE;
-  gboolean    closed;
-  gint        off_x, off_y;
-  gint        vectors_off_x, vectors_off_y;
+  GList    *stroke;
+  gboolean  initialized = FALSE;
+  gint      off_x, off_y;
+  gint      vectors_off_x, vectors_off_y;
 
   g_return_val_if_fail (GIMP_IS_PAINT_CORE (core), FALSE);
   g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
@@ -244,6 +250,9 @@
 
   for (stroke = vectors->strokes; stroke; stroke = stroke->next)
     {
+      GArray   *coords;
+      gboolean  closed;
+
       coords = gimp_stroke_interpolate (GIMP_STROKE (stroke->data),
                                         1.0, &closed);
 
@@ -257,6 +266,10 @@
               g_array_index (coords, GimpCoords, i).y -= off_y;
             }
 
+          if (emulate_dynamics)
+            gimp_paint_core_stroke_emulate_dynamics ((GimpCoords *) coords->data,
+                                                     coords->len);
+
           if (initialized ||
               gimp_paint_core_start (core, drawable, paint_options,
                                      &g_array_index (coords, GimpCoords, 0),
@@ -305,3 +318,42 @@
 
   return initialized;
 }
+
+static void
+gimp_paint_core_stroke_emulate_dynamics (GimpCoords *coords,
+                                         gint        length)
+{
+  const gint ramp_length = length / 3;
+
+  /* Calculate and create pressure ramp parameters */
+  if (ramp_length > 0)
+    {
+      gdouble slope = 1.0 / (gdouble) (ramp_length);
+      gint    i;
+
+      /* Calculate pressure start ramp */
+      for (i = 0; i < ramp_length; i++)
+        {
+          coords[i].pressure =  i * slope;
+        }
+                
+      /* Calculate pressure end ramp */
+      for (i = length - ramp_length; i < length; i++)
+        {
+          coords[i].pressure = 1.0 - (i - (length - ramp_length)) * slope;
+        }
+    }
+
+  /* Calculate and create velocity ramp parameters */
+  if (length > 0)
+    {
+      gdouble slope = 1.0 / length;
+      gint    i;
+
+      /* Calculate velocity end ramp */
+      for (i = 0; i < length; i++)
+        {
+          coords[i].velocity = i * slope;
+        }
+    }
+}

Modified: branches/soc-2008-text/app/paint/gimppaintcore-stroke.h
==============================================================================
--- branches/soc-2008-text/app/paint/gimppaintcore-stroke.h	(original)
+++ branches/soc-2008-text/app/paint/gimppaintcore-stroke.h	Wed Aug  6 20:36:18 2008
@@ -29,6 +29,7 @@
 gboolean   gimp_paint_core_stroke_boundary (GimpPaintCore     *core,
                                             GimpDrawable      *drawable,
                                             GimpPaintOptions  *paint_options,
+                                            gboolean           emulate_dynamics,
                                             const BoundSeg    *bound_segs,
                                             gint               n_bound_segs,
                                             gint               offset_x,
@@ -37,6 +38,7 @@
 gboolean   gimp_paint_core_stroke_vectors  (GimpPaintCore     *core,
                                             GimpDrawable      *drawable,
                                             GimpPaintOptions  *paint_options,
+                                            gboolean           emulate_dynamics,
                                             GimpVectors       *vectors,
                                             GError           **error);
 

Modified: branches/soc-2008-text/app/paint/gimppaintcore.c
==============================================================================
--- branches/soc-2008-text/app/paint/gimppaintcore.c	(original)
+++ branches/soc-2008-text/app/paint/gimppaintcore.c	Wed Aug  6 20:36:18 2008
@@ -150,7 +150,6 @@
   core->x2               = 0;
   core->y2               = 0;
 
-  core->use_pressure     = FALSE;
   core->use_saved_proj   = FALSE;
 
   core->undo_tiles       = NULL;

Modified: branches/soc-2008-text/app/paint/gimppaintcore.h
==============================================================================
--- branches/soc-2008-text/app/paint/gimppaintcore.h	(original)
+++ branches/soc-2008-text/app/paint/gimppaintcore.h	Wed Aug  6 20:36:18 2008
@@ -55,7 +55,6 @@
   gint         x1, y1;           /*  undo extents in image coords        */
   gint         x2, y2;           /*  undo extents in image coords        */
 
-  gboolean     use_pressure;     /*  look at coords->pressure            */
   gboolean     use_saved_proj;   /*  keep the unmodified proj around     */
 
   TileManager *undo_tiles;       /*  tiles which have been modified      */

Modified: branches/soc-2008-text/app/paint/gimppaintoptions.c
==============================================================================
--- branches/soc-2008-text/app/paint/gimppaintoptions.c	(original)
+++ branches/soc-2008-text/app/paint/gimppaintoptions.c	Wed Aug  6 20:36:18 2008
@@ -412,15 +412,17 @@
   switch (property_id)
     {
     case PROP_PAINT_INFO:
-      options->paint_info = (GimpPaintInfo *) g_value_dup_object (value);
+      options->paint_info = g_value_dup_object (value);
       break;
 
     case PROP_BRUSH_SCALE:
       options->brush_scale = g_value_get_double (value);
       break;
+
     case PROP_APPLICATION_MODE:
       options->application_mode = g_value_get_enum (value);
       break;
+
     case PROP_HARD:
       options->hard = g_value_get_boolean (value);
       break;
@@ -432,21 +434,27 @@
     case PROP_PRESSURE_OPACITY:
       pressure_options->opacity = g_value_get_boolean (value);
       break;
+
     case PROP_PRESSURE_HARDNESS:
       pressure_options->hardness = g_value_get_boolean (value);
       break;
+
     case PROP_PRESSURE_RATE:
       pressure_options->rate = g_value_get_boolean (value);
       break;
+
     case PROP_PRESSURE_SIZE:
       pressure_options->size = g_value_get_boolean (value);
       break;
+
     case PROP_PRESSURE_INVERSE_SIZE:
       pressure_options->inverse_size = g_value_get_boolean (value);
       break;
+
     case PROP_PRESSURE_COLOR:
       pressure_options->color = g_value_get_boolean (value);
       break;
+
     case PROP_PRESSURE_PRESCALE:
       pressure_options->prescale = g_value_get_double (value);
       break;
@@ -454,21 +462,27 @@
     case PROP_VELOCITY_OPACITY:
       velocity_options->opacity = g_value_get_boolean (value);
       break;
+
     case PROP_VELOCITY_HARDNESS:
       velocity_options->hardness = g_value_get_boolean (value);
       break;
+
     case PROP_VELOCITY_RATE:
       velocity_options->rate = g_value_get_boolean (value);
       break;
+
     case PROP_VELOCITY_SIZE:
       velocity_options->size = g_value_get_boolean (value);
       break;
+
     case PROP_VELOCITY_INVERSE_SIZE:
       velocity_options->inverse_size = g_value_get_boolean (value);
       break;
+
     case PROP_VELOCITY_COLOR:
       velocity_options->color = g_value_get_boolean (value);
       break;
+
     case PROP_VELOCITY_PRESCALE:
       velocity_options->prescale = g_value_get_double (value);
       break;
@@ -476,21 +490,27 @@
     case PROP_RANDOM_OPACITY:
       random_options->opacity = g_value_get_boolean (value);
       break;
+
     case PROP_RANDOM_HARDNESS:
       random_options->hardness = g_value_get_boolean (value);
       break;
+
     case PROP_RANDOM_RATE:
       random_options->rate = g_value_get_boolean (value);
       break;
+
     case PROP_RANDOM_SIZE:
       random_options->size = g_value_get_boolean (value);
       break;
+
     case PROP_RANDOM_INVERSE_SIZE:
       random_options->inverse_size = g_value_get_boolean (value);
       break;
+
     case PROP_RANDOM_COLOR:
       random_options->color = g_value_get_boolean (value);
       break;
+
     case PROP_RANDOM_PRESCALE:
       random_options->prescale = g_value_get_double (value);
       break;
@@ -498,9 +518,11 @@
     case PROP_USE_FADE:
       fade_options->use_fade = g_value_get_boolean (value);
       break;
+
     case PROP_FADE_LENGTH:
       fade_options->fade_length = g_value_get_double (value);
       break;
+
     case PROP_FADE_UNIT:
       fade_options->fade_unit = g_value_get_int (value);
       break;
@@ -508,6 +530,7 @@
     case PROP_USE_JITTER:
       jitter_options->use_jitter = g_value_get_boolean (value);
       break;
+
     case PROP_JITTER_AMOUNT:
       jitter_options->jitter_amount = g_value_get_double (value);
       break;
@@ -515,15 +538,19 @@
     case PROP_USE_GRADIENT:
       gradient_options->use_gradient = g_value_get_boolean (value);
       break;
+
     case PROP_GRADIENT_REVERSE:
       gradient_options->gradient_reverse = g_value_get_boolean (value);
       break;
+
     case PROP_GRADIENT_REPEAT:
       gradient_options->gradient_repeat = g_value_get_enum (value);
       break;
+
     case PROP_GRADIENT_LENGTH:
       gradient_options->gradient_length = g_value_get_double (value);
       break;
+
     case PROP_GRADIENT_UNIT:
       gradient_options->gradient_unit = g_value_get_int (value);
       break;
@@ -531,6 +558,7 @@
     case PROP_BRUSH_VIEW_TYPE:
       options->brush_view_type = g_value_get_enum (value);
       break;
+
     case PROP_BRUSH_VIEW_SIZE:
       options->brush_view_size = g_value_get_int (value);
       break;
@@ -538,6 +566,7 @@
     case PROP_PATTERN_VIEW_TYPE:
       options->pattern_view_type = g_value_get_enum (value);
       break;
+
     case PROP_PATTERN_VIEW_SIZE:
       options->pattern_view_size = g_value_get_int (value);
       break;
@@ -545,6 +574,7 @@
     case PROP_GRADIENT_VIEW_TYPE:
       options->gradient_view_type = g_value_get_enum (value);
       break;
+
     case PROP_GRADIENT_VIEW_SIZE:
       options->gradient_view_size = g_value_get_int (value);
       break;
@@ -578,9 +608,11 @@
     case PROP_BRUSH_SCALE:
       g_value_set_double (value, options->brush_scale);
       break;
+
     case PROP_APPLICATION_MODE:
       g_value_set_enum (value, options->application_mode);
       break;
+
     case PROP_HARD:
       g_value_set_boolean (value, options->hard);
       break;
@@ -592,21 +624,27 @@
     case PROP_PRESSURE_OPACITY:
       g_value_set_boolean (value, pressure_options->opacity);
       break;
+
     case PROP_PRESSURE_HARDNESS:
       g_value_set_boolean (value, pressure_options->hardness);
       break;
+
     case PROP_PRESSURE_RATE:
       g_value_set_boolean (value, pressure_options->rate);
       break;
+
     case PROP_PRESSURE_SIZE:
       g_value_set_boolean (value, pressure_options->size);
       break;
+
     case PROP_PRESSURE_INVERSE_SIZE:
       g_value_set_boolean (value, pressure_options->inverse_size);
       break;
+
     case PROP_PRESSURE_COLOR:
       g_value_set_boolean (value, pressure_options->color);
       break;
+
     case PROP_PRESSURE_PRESCALE:
       g_value_set_double (value, pressure_options->prescale);
       break;
@@ -614,21 +652,27 @@
     case PROP_VELOCITY_OPACITY:
       g_value_set_boolean (value, velocity_options->opacity);
       break;
+
     case PROP_VELOCITY_HARDNESS:
       g_value_set_boolean (value, velocity_options->hardness);
       break;
+
     case PROP_VELOCITY_RATE:
       g_value_set_boolean (value, velocity_options->rate);
       break;
+
     case PROP_VELOCITY_SIZE:
       g_value_set_boolean (value, velocity_options->size);
       break;
+
     case PROP_VELOCITY_INVERSE_SIZE:
       g_value_set_boolean (value, velocity_options->inverse_size);
       break;
+
     case PROP_VELOCITY_COLOR:
       g_value_set_boolean (value, velocity_options->color);
       break;
+
     case PROP_VELOCITY_PRESCALE:
       g_value_set_double (value, velocity_options->prescale);
       break;
@@ -636,21 +680,27 @@
     case PROP_RANDOM_OPACITY:
       g_value_set_boolean (value, random_options->opacity);
       break;
+
     case PROP_RANDOM_HARDNESS:
       g_value_set_boolean (value, random_options->hardness);
       break;
+
     case PROP_RANDOM_RATE:
       g_value_set_boolean (value, random_options->rate);
       break;
+
     case PROP_RANDOM_SIZE:
       g_value_set_boolean (value, random_options->size);
       break;
+
     case PROP_RANDOM_INVERSE_SIZE:
       g_value_set_boolean (value, random_options->inverse_size);
       break;
+
     case PROP_RANDOM_COLOR:
       g_value_set_boolean (value, random_options->color);
       break;
+
     case PROP_RANDOM_PRESCALE:
       g_value_set_double (value, random_options->prescale);
       break;
@@ -658,9 +708,11 @@
     case PROP_USE_FADE:
       g_value_set_boolean (value, fade_options->use_fade);
       break;
+
     case PROP_FADE_LENGTH:
       g_value_set_double (value, fade_options->fade_length);
       break;
+
     case PROP_FADE_UNIT:
       g_value_set_int (value, fade_options->fade_unit);
       break;
@@ -668,6 +720,7 @@
     case PROP_USE_JITTER:
       g_value_set_boolean (value, jitter_options->use_jitter);
       break;
+
     case PROP_JITTER_AMOUNT:
       g_value_set_double (value, jitter_options->jitter_amount);
       break;
@@ -675,15 +728,19 @@
     case PROP_USE_GRADIENT:
       g_value_set_boolean (value, gradient_options->use_gradient);
       break;
+
     case PROP_GRADIENT_REVERSE:
       g_value_set_boolean (value, gradient_options->gradient_reverse);
       break;
+
     case PROP_GRADIENT_REPEAT:
       g_value_set_enum (value, gradient_options->gradient_repeat);
       break;
+
     case PROP_GRADIENT_LENGTH:
       g_value_set_double (value, gradient_options->gradient_length);
       break;
+
     case PROP_GRADIENT_UNIT:
       g_value_set_int (value, gradient_options->gradient_unit);
       break;
@@ -691,6 +748,7 @@
     case PROP_BRUSH_VIEW_TYPE:
       g_value_set_enum (value, options->brush_view_type);
       break;
+
     case PROP_BRUSH_VIEW_SIZE:
       g_value_set_int (value, options->brush_view_size);
       break;
@@ -698,6 +756,7 @@
     case PROP_PATTERN_VIEW_TYPE:
       g_value_set_enum (value, options->pattern_view_type);
       break;
+
     case PROP_PATTERN_VIEW_SIZE:
       g_value_set_int (value, options->pattern_view_size);
       break;
@@ -705,6 +764,7 @@
     case PROP_GRADIENT_VIEW_TYPE:
       g_value_set_enum (value, options->gradient_view_type);
       break;
+
     case PROP_GRADIENT_VIEW_SIZE:
       g_value_set_int (value, options->gradient_view_size);
       break;
@@ -980,8 +1040,7 @@
 
 gdouble
 gimp_paint_options_get_dynamic_opacity (GimpPaintOptions *paint_options,
-                                        const GimpCoords *coords,
-                                        gboolean          use_pressure)
+                                        const GimpCoords *coords)
 {
   gdouble opacity = 1.0;
 
@@ -996,14 +1055,14 @@
       gdouble velocity = -1.0;
       gdouble random   = -1.0;
 
-      if (paint_options->pressure_options->opacity && use_pressure)
+      if (paint_options->pressure_options->opacity)
         pressure = GIMP_PAINT_PRESSURE_SCALE * coords->pressure;
 
       if (paint_options->velocity_options->opacity)
         velocity = GIMP_PAINT_VELOCITY_SCALE * (1 - coords->velocity);
 
       if (paint_options->random_options->opacity)
-        random = coords->random;
+        random = g_random_double_range (0.0, 1.0);
 
       opacity = gimp_paint_options_get_dynamics_mix (pressure,
                                                      paint_options->pressure_options->prescale,
@@ -1019,7 +1078,6 @@
 gdouble
 gimp_paint_options_get_dynamic_size (GimpPaintOptions *paint_options,
                                      const GimpCoords *coords,
-                                     gboolean          use_pressure,
                                      gboolean          use_dynamics)
 {
   gdouble scale = 1.0;
@@ -1030,11 +1088,11 @@
       gdouble velocity = -1.0;
       gdouble random   = -1.0;
 
-      if (paint_options->pressure_options->size && use_pressure)
+      if (paint_options->pressure_options->size)
         {
           pressure = coords->pressure;
         }
-      else if (paint_options->pressure_options->inverse_size && use_pressure)
+      else if (paint_options->pressure_options->inverse_size)
         {
           pressure = 1.0 - 0.9 * coords->pressure;
         }
@@ -1050,11 +1108,11 @@
 
       if (paint_options->random_options->size)
         {
-          random = 1.0 - coords->random;
+          random = 1.0 - g_random_double_range (0.0, 1.0);
         }
       else if (paint_options->random_options->inverse_size)
         {
-          random = coords->random;
+          random = g_random_double_range (0.0, 1.0);
         }
 
       scale = gimp_paint_options_get_dynamics_mix (pressure,
@@ -1078,8 +1136,7 @@
 
 gdouble
 gimp_paint_options_get_dynamic_rate (GimpPaintOptions *paint_options,
-                                     const GimpCoords *coords,
-                                     gboolean          use_pressure)
+                                     const GimpCoords *coords)
 {
   gdouble rate = 1.0;
 
@@ -1094,14 +1151,14 @@
       gdouble velocity = -1.0;
       gdouble random   = -1.0;
 
-      if (paint_options->pressure_options->rate && use_pressure)
+      if (paint_options->pressure_options->rate)
         pressure = GIMP_PAINT_PRESSURE_SCALE * coords->pressure;
 
       if (paint_options->velocity_options->rate)
         velocity = GIMP_PAINT_VELOCITY_SCALE * (1 - coords->velocity);
 
       if (paint_options->random_options->rate)
-        random = coords->random;
+        random = g_random_double_range (0.0, 1.0);
 
       rate = gimp_paint_options_get_dynamics_mix (pressure,
                                                   paint_options->pressure_options->prescale,
@@ -1117,8 +1174,7 @@
 
 gdouble
 gimp_paint_options_get_dynamic_color (GimpPaintOptions *paint_options,
-                                      const GimpCoords *coords,
-                                      gboolean          use_pressure)
+                                      const GimpCoords *coords)
 {
   gdouble color = 1.0;
 
@@ -1133,14 +1189,14 @@
       gdouble velocity = -1.0;
       gdouble random   = -1.0;
 
-      if (paint_options->pressure_options->color && use_pressure)
+      if (paint_options->pressure_options->color)
         pressure = GIMP_PAINT_PRESSURE_SCALE * coords->pressure;
 
       if (paint_options->velocity_options->color)
         velocity = GIMP_PAINT_VELOCITY_SCALE * coords->velocity;
 
       if (paint_options->random_options->color)
-        random = coords->random;
+        random = g_random_double_range (0.0, 1.0);
 
       color = gimp_paint_options_get_dynamics_mix (pressure,
                                                    paint_options->pressure_options->prescale,
@@ -1155,30 +1211,29 @@
 
 gdouble
 gimp_paint_options_get_dynamic_hardness (GimpPaintOptions *paint_options,
-                                         const GimpCoords *coords,
-                                         gboolean          use_pressure)
+                                         const GimpCoords *coords)
 {
   gdouble hardness = 1.0;
 
   g_return_val_if_fail (GIMP_IS_PAINT_OPTIONS (paint_options), 1.0);
   g_return_val_if_fail (coords != NULL, 1.0);
 
-  if (paint_options->pressure_options->rate ||
-      paint_options->velocity_options->rate ||
-      paint_options->random_options->rate)
+  if (paint_options->pressure_options->hardness ||
+      paint_options->velocity_options->hardness ||
+      paint_options->random_options->hardness)
     {
       gdouble pressure = -1.0;
       gdouble velocity = -1.0;
       gdouble random   = -1.0;
 
-      if (paint_options->pressure_options->hardness && use_pressure)
+      if (paint_options->pressure_options->hardness)
         pressure = GIMP_PAINT_PRESSURE_SCALE * coords->pressure;
 
       if (paint_options->velocity_options->hardness)
         velocity = GIMP_PAINT_VELOCITY_SCALE * (1 - coords->velocity);
 
       if (paint_options->random_options->hardness)
-        random = coords->random;
+        random = g_random_double_range (0.0, 1.0);
 
       hardness = gimp_paint_options_get_dynamics_mix (pressure,
                                                       paint_options->pressure_options->prescale,

Modified: branches/soc-2008-text/app/paint/gimppaintoptions.h
==============================================================================
--- branches/soc-2008-text/app/paint/gimppaintoptions.h	(original)
+++ branches/soc-2008-text/app/paint/gimppaintoptions.h	Wed Aug  6 20:36:18 2008
@@ -139,25 +139,20 @@
 
 
 gdouble gimp_paint_options_get_dynamic_opacity (GimpPaintOptions *paint_options,
-                                                const GimpCoords *coords,
-                                                gboolean          use_pressure);
+                                                const GimpCoords *coords);
 
 gdouble gimp_paint_options_get_dynamic_size    (GimpPaintOptions *paint_options,
                                                 const GimpCoords *coords,
-                                                gboolean          use_pressure,
                                                 gboolean          use_dynamics);
 
 gdouble gimp_paint_options_get_dynamic_rate    (GimpPaintOptions *paint_options,
-                                                const GimpCoords *coords,
-                                                gboolean          use_pressure);
+                                                const GimpCoords *coords);
 
 gdouble gimp_paint_options_get_dynamic_color   (GimpPaintOptions *paint_options,
-                                                const GimpCoords *coords,
-                                                gboolean          use_pressure);
+                                                const GimpCoords *coords);
 
 gdouble gimp_paint_options_get_dynamic_hardness(GimpPaintOptions *paint_options,
-                                                const GimpCoords *coords,
-                                                gboolean          use_pressure);
+                                                const GimpCoords *coords);
 
 
 #endif  /*  __GIMP_PAINT_OPTIONS_H__  */

Modified: branches/soc-2008-text/app/paint/gimpsmudge.c
==============================================================================
--- branches/soc-2008-text/app/paint/gimpsmudge.c	(original)
+++ branches/soc-2008-text/app/paint/gimpsmudge.c	Wed Aug  6 20:36:18 2008
@@ -264,8 +264,7 @@
 
   /* Enable dynamic rate */
   dynamic_rate = gimp_paint_options_get_dynamic_rate (paint_options,
-                                                      &paint_core->cur_coords,
-                                                      paint_core->use_pressure);
+                                                      &paint_core->cur_coords);
   rate = (options->rate / 100.0) * dynamic_rate;
 
   /* The tempPR will be the built up buffer (for smudge) */
@@ -306,12 +305,10 @@
     copy_region (&tempPR, &destPR);
 
   opacity *= gimp_paint_options_get_dynamic_opacity (paint_options,
-                                                     &paint_core->cur_coords,
-                                                     paint_core->use_pressure);
+                                                     &paint_core->cur_coords);
 
   hardness = gimp_paint_options_get_dynamic_hardness (paint_options,
-                                                      &paint_core->cur_coords,
-                                                      paint_core->use_pressure);
+                                                      &paint_core->cur_coords);
 
   gimp_brush_core_replace_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
                                   MIN (opacity, GIMP_OPACITY_OPAQUE),

Modified: branches/soc-2008-text/app/pdb/edit-cmds.c
==============================================================================
--- branches/soc-2008-text/app/pdb/edit-cmds.c	(original)
+++ branches/soc-2008-text/app/pdb/edit-cmds.c	Wed Aug  6 20:36:18 2008
@@ -766,7 +766,8 @@
 
   if (success)
     {
-      if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) &&
+          gimp_pdb_item_is_attached (GIMP_ITEM (vectors), error))
         {
           GimpStrokeDesc *desc  = gimp_stroke_desc_new (gimp, context);
 
@@ -799,7 +800,7 @@
   gimp_procedure_set_static_strings (procedure,
                                      "gimp-edit-cut",
                                      "Cut from the specified drawable.",
-                                     "If there is a selection in the image, then the area specified by the selection is cut from the specified drawable and placed in an internal GIMP edit buffer. It can subsequently be retrieved using the 'gimp-edit-paste' command. If there is no selection, then the specified drawable will be removed and its contents stored in the internal GIMP edit buffer.",
+                                     "If there is a selection in the image, then the area specified by the selection is cut from the specified drawable and placed in an internal GIMP edit buffer. It can subsequently be retrieved using the 'gimp-edit-paste' command. If there is no selection, then the specified drawable will be removed and its contents stored in the internal GIMP edit buffer. This procedure will fail if the selected area lies completely outside the bounds of the current drawable and there is nothing to copy from.",
                                      "Spencer Kimball & Peter Mattis",
                                      "Spencer Kimball & Peter Mattis",
                                      "1995-1996",
@@ -813,7 +814,7 @@
   gimp_procedure_add_return_value (procedure,
                                    g_param_spec_boolean ("non-empty",
                                                          "non empty",
-                                                         "TRUE if the cut was successful, FALSE if the selection contained only transparent pixels",
+                                                         "TRUE if the cut was successful, FALSE if there was nothing to copy from",
                                                          FALSE,
                                                          GIMP_PARAM_READWRITE));
   gimp_pdb_register_procedure (pdb, procedure);
@@ -828,7 +829,7 @@
   gimp_procedure_set_static_strings (procedure,
                                      "gimp-edit-copy",
                                      "Copy from the specified drawable.",
-                                     "If there is a selection in the image, then the area specified by the selection is copied from the specified drawable and placed in an internal GIMP edit buffer. It can subsequently be retrieved using the 'gimp-edit-paste' command. If there is no selection, then the specified drawable's contents will be stored in the internal GIMP edit buffer.",
+                                     "If there is a selection in the image, then the area specified by the selection is copied from the specified drawable and placed in an internal GIMP edit buffer. It can subsequently be retrieved using the 'gimp-edit-paste' command. If there is no selection, then the specified drawable's contents will be stored in the internal GIMP edit buffer. This procedure will fail if the selected area lies completely outside the bounds of the current drawable and there is nothing to copy from.",
                                      "Spencer Kimball & Peter Mattis",
                                      "Spencer Kimball & Peter Mattis",
                                      "1995-1996",
@@ -842,7 +843,7 @@
   gimp_procedure_add_return_value (procedure,
                                    g_param_spec_boolean ("non-empty",
                                                          "non empty",
-                                                         "TRUE if the copy was successful, FALSE if the selection contained only transparent pixels",
+                                                         "TRUE if the cut was successful, FALSE if there was nothing to copy from",
                                                          FALSE,
                                                          GIMP_PARAM_READWRITE));
   gimp_pdb_register_procedure (pdb, procedure);
@@ -871,7 +872,7 @@
   gimp_procedure_add_return_value (procedure,
                                    g_param_spec_boolean ("non-empty",
                                                          "non empty",
-                                                         "TRUE if the copy was successful, FALSE if the selection contained only transparent pixels",
+                                                         "TRUE if the copy was successful",
                                                          FALSE,
                                                          GIMP_PARAM_READWRITE));
   gimp_pdb_register_procedure (pdb, procedure);
@@ -965,7 +966,7 @@
   gimp_procedure_add_return_value (procedure,
                                    gimp_param_spec_string ("real-name",
                                                            "real name",
-                                                           "The real name given to the buffer, or NULL if the selection contained only transparent pixels",
+                                                           "The real name given to the buffer, or NULL if the cut failed",
                                                            FALSE, FALSE, FALSE,
                                                            NULL,
                                                            GIMP_PARAM_READWRITE));
@@ -1002,7 +1003,7 @@
   gimp_procedure_add_return_value (procedure,
                                    gimp_param_spec_string ("real-name",
                                                            "real name",
-                                                           "The real name given to the buffer, or NULL if the selection contained only transparent pixels",
+                                                           "The real name given to the buffer, or NULL if the copy failed",
                                                            FALSE, FALSE, FALSE,
                                                            NULL,
                                                            GIMP_PARAM_READWRITE));
@@ -1039,7 +1040,7 @@
   gimp_procedure_add_return_value (procedure,
                                    gimp_param_spec_string ("real-name",
                                                            "real name",
-                                                           "The real name given to the buffer, or NULL if the selection contained only transparent pixels",
+                                                           "The real name given to the buffer, or NULL if the copy failed",
                                                            FALSE, FALSE, FALSE,
                                                            NULL,
                                                            GIMP_PARAM_READWRITE));

Modified: branches/soc-2008-text/app/pdb/gimp-pdb-compat.c
==============================================================================
--- branches/soc-2008-text/app/pdb/gimp-pdb-compat.c	(original)
+++ branches/soc-2008-text/app/pdb/gimp-pdb-compat.c	Wed Aug  6 20:36:18 2008
@@ -148,7 +148,9 @@
                                             G_PARAM_READWRITE);
       break;
 
-    case GIMP_PDB_BOUNDARY:
+    case GIMP_PDB_COLORARRAY:
+      pspec = gimp_param_spec_color_array (name, name, desc,
+                                           G_PARAM_READWRITE);
       break;
 
     case GIMP_PDB_VECTORS:
@@ -220,7 +222,6 @@
       return GIMP_TYPE_RGB;
 
     case GIMP_PDB_REGION:
-    case GIMP_PDB_BOUNDARY:
       break;
 
     case GIMP_PDB_DISPLAY:
@@ -241,6 +242,9 @@
     case GIMP_PDB_SELECTION:
       return GIMP_TYPE_SELECTION_ID;
 
+    case GIMP_PDB_COLORARRAY:
+      return GIMP_TYPE_COLOR_ARRAY;
+
     case GIMP_PDB_VECTORS:
       return GIMP_TYPE_VECTORS_ID;
 
@@ -268,7 +272,7 @@
 
   if (! pdb_type_quark)
     {
-      struct
+      const struct
       {
         GType          g_type;
         GimpPDBArgType pdb_type;
@@ -287,13 +291,14 @@
 
         { G_TYPE_STRING,             GIMP_PDB_STRING      },
 
+        { GIMP_TYPE_RGB,             GIMP_PDB_COLOR       },
+
         { GIMP_TYPE_INT32_ARRAY,     GIMP_PDB_INT32ARRAY  },
         { GIMP_TYPE_INT16_ARRAY,     GIMP_PDB_INT16ARRAY  },
         { GIMP_TYPE_INT8_ARRAY,      GIMP_PDB_INT8ARRAY   },
         { GIMP_TYPE_FLOAT_ARRAY,     GIMP_PDB_FLOATARRAY  },
         { GIMP_TYPE_STRING_ARRAY,    GIMP_PDB_STRINGARRAY },
-
-        { GIMP_TYPE_RGB,             GIMP_PDB_COLOR       },
+        { GIMP_TYPE_COLOR_ARRAY,     GIMP_PDB_COLORARRAY  },
 
         { GIMP_TYPE_DISPLAY_ID,      GIMP_PDB_DISPLAY     },
         { GIMP_TYPE_IMAGE_ID,        GIMP_PDB_IMAGE       },

Modified: branches/soc-2008-text/app/pdb/internal-procs.c
==============================================================================
--- branches/soc-2008-text/app/pdb/internal-procs.c	(original)
+++ branches/soc-2008-text/app/pdb/internal-procs.c	Wed Aug  6 20:36:18 2008
@@ -29,7 +29,7 @@
 #include "internal-procs.h"
 
 
-/* 586 procedures registered total */
+/* 588 procedures registered total */
 
 void
 internal_procs_init (GimpPDB *pdb)

Modified: branches/soc-2008-text/app/pdb/palette-cmds.c
==============================================================================
--- branches/soc-2008-text/app/pdb/palette-cmds.c	(original)
+++ branches/soc-2008-text/app/pdb/palette-cmds.c	Wed Aug  6 20:36:18 2008
@@ -248,6 +248,54 @@
 }
 
 static GValueArray *
+palette_get_colors_invoker (GimpProcedure      *procedure,
+                            Gimp               *gimp,
+                            GimpContext        *context,
+                            GimpProgress       *progress,
+                            const GValueArray  *args,
+                            GError            **error)
+{
+  gboolean success = TRUE;
+  GValueArray *return_vals;
+  const gchar *name;
+  gint32 num_colors = 0;
+  GimpRGB *colors = NULL;
+
+  name = g_value_get_string (&args->values[0]);
+
+  if (success)
+    {
+      GimpPalette *palette = gimp_pdb_get_palette (gimp, name, FALSE, error);
+
+      if (palette)
+        {
+          GList *list = palette->colors;
+          gint   i;
+
+          num_colors = palette->n_colors;
+          colors     = g_new (GimpRGB, num_colors);
+
+          for (i = 0; i < num_colors; i++, list = g_list_next (list))
+            colors[i] = ((GimpPaletteEntry *)(list->data))->color;
+        }
+      else
+        {
+          success = FALSE;
+        }
+    }
+
+  return_vals = gimp_procedure_get_return_values (procedure, success);
+
+  if (success)
+    {
+      g_value_set_int (&return_vals->values[1], num_colors);
+      gimp_value_take_colorarray (&return_vals->values[2], colors, num_colors);
+    }
+
+  return return_vals;
+}
+
+static GValueArray *
 palette_get_columns_invoker (GimpProcedure      *procedure,
                              Gimp               *gimp,
                              GimpContext        *context,
@@ -748,6 +796,41 @@
   g_object_unref (procedure);
 
   /*
+   * gimp-palette-get-colors
+   */
+  procedure = gimp_procedure_new (palette_get_colors_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-palette-get-colors");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-palette-get-colors",
+                                     "Gets all colors from the specified palette.",
+                                     "This procedure retrieves all color entries of the specified palette.",
+                                     "Sven Neumann <sven gimp org>",
+                                     "Sven Neumann",
+                                     "2006",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_string ("name",
+                                                       "name",
+                                                       "The palette name",
+                                                       FALSE, FALSE, TRUE,
+                                                       NULL,
+                                                       GIMP_PARAM_READWRITE));
+  gimp_procedure_add_return_value (procedure,
+                                   gimp_param_spec_int32 ("num-colors",
+                                                          "num colors",
+                                                          "Length of the colors array",
+                                                          0, G_MAXINT32, 0,
+                                                          GIMP_PARAM_READWRITE));
+  gimp_procedure_add_return_value (procedure,
+                                   gimp_param_spec_color_array ("colors",
+                                                                "colors",
+                                                                "The colors in the palette",
+                                                                GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
    * gimp-palette-get-columns
    */
   procedure = gimp_procedure_new (palette_get_columns_invoker);

Modified: branches/soc-2008-text/app/pdb/vectors-cmds.c
==============================================================================
--- branches/soc-2008-text/app/pdb/vectors-cmds.c	(original)
+++ branches/soc-2008-text/app/pdb/vectors-cmds.c	Wed Aug  6 20:36:18 2008
@@ -145,6 +145,38 @@
 }
 
 static GValueArray *
+vectors_copy_invoker (GimpProcedure      *procedure,
+                      Gimp               *gimp,
+                      GimpContext        *context,
+                      GimpProgress       *progress,
+                      const GValueArray  *args,
+                      GError            **error)
+{
+  gboolean success = TRUE;
+  GValueArray *return_vals;
+  GimpVectors *vectors;
+  GimpVectors *vectors_copy = NULL;
+
+  vectors = gimp_value_get_vectors (&args->values[0], gimp);
+
+  if (success)
+    {
+      vectors_copy = GIMP_VECTORS (gimp_item_duplicate (GIMP_ITEM (vectors),
+                                   G_TYPE_FROM_INSTANCE (vectors)));
+
+      if (! vectors_copy)
+        success = FALSE;
+    }
+
+  return_vals = gimp_procedure_get_return_values (procedure, success);
+
+  if (success)
+    gimp_value_set_vectors (&return_vals->values[1], vectors_copy);
+
+  return return_vals;
+}
+
+static GValueArray *
 vectors_get_image_invoker (GimpProcedure      *procedure,
                            Gimp               *gimp,
                            GimpContext        *context,
@@ -1486,6 +1518,35 @@
   g_object_unref (procedure);
 
   /*
+   * gimp-vectors-copy
+   */
+  procedure = gimp_procedure_new (vectors_copy_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-vectors-copy");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-vectors-copy",
+                                     "Copy a vectors object.",
+                                     "This procedure copies the specified vectors object and returns the copy.",
+                                     "Barak Itkin <lightningismyname gmail com>",
+                                     "Barak Itkin",
+                                     "2008",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_vectors_id ("vectors",
+                                                           "vectors",
+                                                           "The vectors object to copy",
+                                                           pdb->gimp, FALSE,
+                                                           GIMP_PARAM_READWRITE));
+  gimp_procedure_add_return_value (procedure,
+                                   gimp_param_spec_vectors_id ("vectors-copy",
+                                                               "vectors copy",
+                                                               "The newly copied vectors object",
+                                                               pdb->gimp, FALSE,
+                                                               GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
    * gimp-vectors-get-image
    */
   procedure = gimp_procedure_new (vectors_get_image_invoker);

Modified: branches/soc-2008-text/app/plug-in/gimpplugin-message.c
==============================================================================
--- branches/soc-2008-text/app/plug-in/gimpplugin-message.c	(original)
+++ branches/soc-2008-text/app/plug-in/gimpplugin-message.c	Wed Aug  6 20:36:18 2008
@@ -618,7 +618,8 @@
       if ((proc_install->params[i].type == GIMP_PDB_INT32ARRAY ||
            proc_install->params[i].type == GIMP_PDB_INT8ARRAY  ||
            proc_install->params[i].type == GIMP_PDB_FLOATARRAY ||
-           proc_install->params[i].type == GIMP_PDB_STRINGARRAY)
+           proc_install->params[i].type == GIMP_PDB_STRINGARRAY ||
+           proc_install->params[i].type == GIMP_PDB_COLORARRAY)
           &&
           proc_install->params[i - 1].type != GIMP_PDB_INT32)
         {

Modified: branches/soc-2008-text/app/plug-in/plug-in-params.c
==============================================================================
--- branches/soc-2008-text/app/plug-in/plug-in-params.c	(original)
+++ branches/soc-2008-text/app/plug-in/plug-in-params.c	Wed Aug  6 20:36:18 2008
@@ -221,8 +221,16 @@
           g_value_set_int (&value, params[i].data.d_selection);
           break;
 
-        case GIMP_PDB_BOUNDARY:
-          g_message ("the \"boundary\" arg type is not currently supported");
+        case GIMP_PDB_COLORARRAY:
+          count = g_value_get_int (&args->values[i - 1]);
+          if (full_copy)
+            gimp_value_set_colorarray (&value,
+                                      params[i].data.d_colorarray,
+                                      count);
+          else
+            gimp_value_set_static_colorarray (&value,
+                                             params[i].data.d_colorarray,
+                                             count);
           break;
 
         case GIMP_PDB_VECTORS:
@@ -374,8 +382,11 @@
           params[i].data.d_selection = g_value_get_int (value);
           break;
 
-        case GIMP_PDB_BOUNDARY:
-          g_message ("the \"boundary\" arg type is not currently supported");
+        case GIMP_PDB_COLORARRAY:
+          if (full_copy)
+            params[i].data.d_colorarray = gimp_value_dup_colorarray (value);
+          else
+            params[i].data.d_colorarray = (GimpRGB *) gimp_value_get_colorarray (value);
           break;
 
         case GIMP_PDB_VECTORS:

Modified: branches/soc-2008-text/app/text/gimpfont.c
==============================================================================
--- branches/soc-2008-text/app/text/gimpfont.c	(original)
+++ branches/soc-2008-text/app/text/gimpfont.c	Wed Aug  6 20:36:18 2008
@@ -165,7 +165,7 @@
     case PROP_PANGO_CONTEXT:
       if (font->pango_context)
         g_object_unref (font->pango_context);
-      font->pango_context = (PangoContext *) g_value_dup_object (value);
+      font->pango_context = g_value_dup_object (value);
       break;
 
     default:

Modified: branches/soc-2008-text/app/text/gimptext-compat.c
==============================================================================
--- branches/soc-2008-text/app/text/gimptext-compat.c	(original)
+++ branches/soc-2008-text/app/text/gimptext-compat.c	Wed Aug  6 20:36:18 2008
@@ -154,6 +154,17 @@
   context = pango_ft2_font_map_create_context (PANGO_FT2_FONT_MAP (fontmap));
   g_object_unref (fontmap);
 
+  /*  Workaround for bug #143542 (PangoFT2Fontmap leak),
+   *  see also bug #148997 (Text layer rendering leaks font file descriptor):
+   *
+   *  Calling pango_ft2_font_map_substitute_changed() causes the
+   *  font_map cache to be flushed, thereby removing the circular
+   *  reference that causes the leak.
+   */
+  g_object_weak_ref (G_OBJECT (context),
+                     (GWeakNotify) pango_ft2_font_map_substitute_changed,
+                     fontmap);
+
   layout = pango_layout_new (context);
   g_object_unref (context);
 
@@ -176,7 +187,7 @@
       PangoLayoutLine *line;
 
       iter = pango_layout_get_iter (layout);
-      line = pango_layout_iter_get_line (iter);
+      line = pango_layout_iter_get_line_readonly (iter);
       pango_layout_iter_free (iter);
 
       pango_layout_line_get_pixel_extents (line, NULL, &rect);

Modified: branches/soc-2008-text/app/text/gimptextlayout-render.c
==============================================================================
--- branches/soc-2008-text/app/text/gimptextlayout-render.c	(original)
+++ branches/soc-2008-text/app/text/gimptextlayout-render.c	Wed Aug  6 20:36:18 2008
@@ -92,7 +92,7 @@
       PangoLayoutLine *line;
       gint             baseline;
 
-      line = pango_layout_iter_get_line (iter);
+      line = pango_layout_iter_get_line_readonly (iter);
 
       pango_layout_iter_get_line_extents (iter, NULL, &rect);
       baseline = pango_layout_iter_get_baseline (iter);

Modified: branches/soc-2008-text/app/tools/gimpcolorizetool.c
==============================================================================
--- branches/soc-2008-text/app/tools/gimpcolorizetool.c	(original)
+++ branches/soc-2008-text/app/tools/gimpcolorizetool.c	Wed Aug  6 20:36:18 2008
@@ -109,7 +109,7 @@
   im_tool_class->shell_desc          = _("Colorize the Image");
   im_tool_class->settings_name       = "colorize";
   im_tool_class->import_dialog_title = _("Import Colorize Settings");
-  im_tool_class->export_dialog_title = _("Export Colorsize Settings");
+  im_tool_class->export_dialog_title = _("Export Colorize Settings");
 
   im_tool_class->get_operation       = gimp_colorize_tool_get_operation;
   im_tool_class->map                 = gimp_colorize_tool_map;

Modified: branches/soc-2008-text/app/tools/gimpcolortool.c
==============================================================================
--- branches/soc-2008-text/app/tools/gimpcolortool.c	(original)
+++ branches/soc-2008-text/app/tools/gimpcolortool.c	Wed Aug  6 20:36:18 2008
@@ -247,6 +247,8 @@
       color_tool->sample_point_x      = color_tool->sample_point->x;
       color_tool->sample_point_y      = color_tool->sample_point->y;
 
+      gimp_tool_control_set_scroll_lock (tool->control, TRUE);
+
       gimp_display_shell_selection_control (shell, GIMP_SELECTION_PAUSE);
 
       gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), display);
@@ -299,6 +301,7 @@
 
       gimp_tool_pop_status (tool, display);
 
+      gimp_tool_control_set_scroll_lock (tool->control, FALSE);
       gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool));
 
       if (release_type == GIMP_BUTTON_RELEASE_CANCEL)
@@ -811,6 +814,7 @@
 
   tool->display = display;
   gimp_tool_control_activate (tool->control);
+  gimp_tool_control_set_scroll_lock (tool->control, TRUE);
 
   if (color_tool->sample_point)
     gimp_display_shell_draw_sample_point (GIMP_DISPLAY_SHELL (display->shell),

Modified: branches/soc-2008-text/app/tools/gimpdrawtool.c
==============================================================================
--- branches/soc-2008-text/app/tools/gimpdrawtool.c	(original)
+++ branches/soc-2008-text/app/tools/gimpdrawtool.c	Wed Aug  6 20:36:18 2008
@@ -28,6 +28,7 @@
 
 #include "base/boundary.h"
 
+#include "core/gimpguide.h"
 #include "core/gimpimage.h"
 #include "core/gimplist.h"
 
@@ -539,6 +540,52 @@
 }
 
 /**
+ * gimp_draw_tool_draw_guide:
+ * @draw_tool:   the #GimpDrawTool
+ * @orientation: the orientation of the guide line
+ * @position:    the position of the guide line in image coordinates
+ *
+ * This function draws a guide line across the canvas.
+ **/
+void
+gimp_draw_tool_draw_guide_line (GimpDrawTool        *draw_tool,
+                                GimpOrientationType  orientation,
+                                gint                 position)
+{
+  GimpDisplayShell *shell;
+  gint              x1, y1, x2, y2;
+  gint              x, y;
+
+  g_return_if_fail (GIMP_IS_DRAW_TOOL (draw_tool));
+
+  shell = GIMP_DISPLAY_SHELL (draw_tool->display->shell);
+
+  x1 = 0;
+  y1 = 0;
+
+  gdk_drawable_get_size (shell->canvas->window, &x2, &y2);
+
+  switch (orientation)
+    {
+    case GIMP_ORIENTATION_HORIZONTAL:
+      gimp_display_shell_transform_xy (shell, 0, position, &x, &y, FALSE);
+      y1 = y2 = y;
+      break;
+
+    case GIMP_ORIENTATION_VERTICAL:
+      gimp_display_shell_transform_xy (shell, position, 0, &x, &y, FALSE);
+      x1 = x2 = x;
+      break;
+
+    case GIMP_ORIENTATION_UNKNOWN:
+      return;
+    }
+
+  gimp_canvas_draw_line (GIMP_CANVAS (shell->canvas), GIMP_CANVAS_STYLE_XOR,
+                         x1, y1, x2, y2);
+}
+
+/**
  * gimp_draw_tool_draw_rectangle:
  * @draw_tool:   the #GimpDrawTool
  * @filled:      whether to fill the rectangle
@@ -1362,7 +1409,6 @@
   GimpStroke *pref_stroke  = NULL;
   GimpAnchor *anchor       = NULL;
   GimpAnchor *pref_anchor  = NULL;
-  GList      *list;
   gdouble     dx, dy;
   gdouble     pref_mindist = -1;
   gdouble     mindist      = -1;
@@ -1377,35 +1423,33 @@
 
   while ((stroke = gimp_vectors_stroke_get_next (vectors, stroke)))
     {
-      GList *anchor_list;
+      GList *anchor_list = gimp_stroke_get_draw_anchors (stroke);
+      GList *list;
 
-      anchor_list = gimp_stroke_get_draw_anchors (stroke);
+      anchor_list = g_list_concat (gimp_stroke_get_draw_anchors (stroke),
+                                   gimp_stroke_get_draw_controls (stroke));
 
-      list = gimp_stroke_get_draw_controls (stroke);
-      anchor_list = g_list_concat (anchor_list, list);
-
-      while (anchor_list)
+      for (list = anchor_list; list; list = g_list_next (list))
         {
-          dx = coord->x - GIMP_ANCHOR (anchor_list->data)->position.x;
-          dy = coord->y - GIMP_ANCHOR (anchor_list->data)->position.y;
+          dx = coord->x - GIMP_ANCHOR (list->data)->position.x;
+          dy = coord->y - GIMP_ANCHOR (list->data)->position.y;
 
           if (mindist < 0 || mindist > dx * dx + dy * dy)
             {
               mindist = dx * dx + dy * dy;
-              anchor = GIMP_ANCHOR (anchor_list->data);
+              anchor = GIMP_ANCHOR (list->data);
+
               if (ret_stroke)
                 *ret_stroke = stroke;
             }
 
           if ((pref_mindist < 0 || pref_mindist > dx * dx + dy * dy) &&
-              GIMP_ANCHOR (anchor_list->data)->type == preferred)
+              GIMP_ANCHOR (list->data)->type == preferred)
             {
               pref_mindist = dx * dx + dy * dy;
-              pref_anchor = GIMP_ANCHOR (anchor_list->data);
+              pref_anchor = GIMP_ANCHOR (list->data);
               pref_stroke = stroke;
             }
-
-          anchor_list = anchor_list->next;
         }
 
       g_list_free (anchor_list);

Modified: branches/soc-2008-text/app/tools/gimpdrawtool.h
==============================================================================
--- branches/soc-2008-text/app/tools/gimpdrawtool.h	(original)
+++ branches/soc-2008-text/app/tools/gimpdrawtool.h	Wed Aug  6 20:36:18 2008
@@ -118,6 +118,9 @@
                                                     gdouble           x2,
                                                     gdouble           y2,
                                                     gboolean          use_offsets);
+void       gimp_draw_tool_draw_guide_line          (GimpDrawTool     *draw_tool,
+                                                    GimpOrientationType  orientation,
+                                                    gint              position);
 void       gimp_draw_tool_draw_rectangle           (GimpDrawTool     *draw_tool,
                                                     gboolean          filled,
                                                     gdouble           x,

Modified: branches/soc-2008-text/app/tools/gimpeditselectiontool.c
==============================================================================
--- branches/soc-2008-text/app/tools/gimpeditselectiontool.c	(original)
+++ branches/soc-2008-text/app/tools/gimpeditselectiontool.c	Wed Aug  6 20:36:18 2008
@@ -62,6 +62,42 @@
 
 #define EDIT_SELECT_SCROLL_LOCK FALSE
 #define ARROW_VELOCITY          25
+#define CENTER_CROSS_SIZE       6
+
+
+typedef struct _GimpEditSelectionTool
+{
+  GimpDrawTool        parent_instance;
+
+  gint                origx, origy;    /*  Last x and y coords               */
+  gint                cumlx, cumly;    /*  Cumulative changes to x and yed   */
+  gint                x, y;            /*  Current x and y coords            */
+  gint                num_segs_in;     /*  Num seg in selection boundary     */
+  gint                num_segs_out;    /*  Num seg in selection boundary     */
+  BoundSeg           *segs_in;         /*  Pointer to the channel sel. segs  */
+  BoundSeg           *segs_out;        /*  Pointer to the channel sel. segs  */
+
+  gint                x1, y1;          /*  Bounding box of selection mask    */
+  gint                x2, y2;
+
+  gdouble             center_x;        /*  Where to draw the mark of center  */
+  gdouble             center_y;
+
+  GimpTranslateMode   edit_mode;       /*  Translate the mask or layer?      */
+
+  gboolean            first_move;      /*  Don't push undos after the first  */
+
+  gboolean            propagate_release;
+
+  gboolean            constrain;       /*  Constrain the movement            */
+  gdouble             start_x, start_y;/*  Coords when button was pressed    */
+  gdouble             last_x,  last_y; /*  Previous coords sent to _motion   */
+} GimpEditSelectionTool;
+
+typedef struct _GimpEditSelectionToolClass
+{
+  GimpDrawToolClass   parent_class;
+} GimpEditSelectionToolClass;
 
 
 static void       gimp_edit_selection_tool_button_release      (GimpTool                    *tool,
@@ -398,6 +434,10 @@
                                         y1 - coords->y,
                                         x2 - x1,
                                         y2 - y1);
+
+    /* Save where to draw the mark of the center */
+    edit_select->center_x = (x1 + x2) / 2.0;
+    edit_select->center_y = (y1 + y2) / 2.0;
   }
 
   gimp_tool_control_activate (GIMP_TOOL (edit_select)->control);
@@ -919,6 +959,15 @@
       break;
     }
 
+  /* Mark the center because we snap to it */
+  gimp_draw_tool_draw_cross_by_anchor (draw_tool,
+                                       edit_select->center_x + edit_select->cumlx,
+                                       edit_select->center_y + edit_select->cumly,
+                                       CENTER_CROSS_SIZE,
+                                       CENTER_CROSS_SIZE,
+                                       GTK_ANCHOR_CENTER,
+                                       FALSE);
+
   GIMP_DRAW_TOOL_CLASS (parent_class)->draw (draw_tool);
 }
 

Modified: branches/soc-2008-text/app/tools/gimpeditselectiontool.h
==============================================================================
--- branches/soc-2008-text/app/tools/gimpeditselectiontool.h	(original)
+++ branches/soc-2008-text/app/tools/gimpeditselectiontool.h	Wed Aug  6 20:36:18 2008
@@ -30,41 +30,6 @@
 #define GIMP_IS_EDIT_SELECTION_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_EDIT_SELECTION_TOOL))
 
 
-typedef struct _GimpEditSelectionTool      GimpEditSelectionTool;
-typedef struct _GimpEditSelectionToolClass GimpEditSelectionToolClass;
-
-struct _GimpEditSelectionTool
-{
-  GimpDrawTool        parent_instance;
-
-  gint                origx, origy;    /*  Last x and y coords               */
-  gint                cumlx, cumly;    /*  Cumulative changes to x and yed   */
-  gint                x, y;            /*  Current x and y coords            */
-  gint                num_segs_in;     /*  Num seg in selection boundary     */
-  gint                num_segs_out;    /*  Num seg in selection boundary     */
-  BoundSeg           *segs_in;         /*  Pointer to the channel sel. segs  */
-  BoundSeg           *segs_out;        /*  Pointer to the channel sel. segs  */
-
-  gint                x1, y1;          /*  Bounding box of selection mask    */
-  gint                x2, y2;
-
-  GimpTranslateMode   edit_mode;       /*  Translate the mask or layer?      */
-
-  gboolean            first_move;      /*  Don't push undos after the first  */
-
-  gboolean            propagate_release;
-
-  gboolean            constrain;       /*  Constrain the movement            */
-  gdouble             start_x, start_y;/*  Coords when button was pressed    */
-  gdouble             last_x,  last_y; /*  Previous coords sent to _motion   */
-};
-
-struct _GimpEditSelectionToolClass
-{
-  GimpDrawToolClass   parent_class;
-};
-
-
 GType      gimp_edit_selection_tool_get_type  (void) G_GNUC_CONST;
 
 void       gimp_edit_selection_tool_start     (GimpTool          *parent_tool,

Modified: branches/soc-2008-text/app/tools/gimpmovetool.c
==============================================================================
--- branches/soc-2008-text/app/tools/gimpmovetool.c	(original)
+++ branches/soc-2008-text/app/tools/gimpmovetool.c	Wed Aug  6 20:36:18 2008
@@ -764,29 +764,9 @@
 
   if (move->moving_guide && move->guide_position != -1)
     {
-      GimpImage *image = draw_tool->display->image;
-
-      switch (move->guide_orientation)
-        {
-        case GIMP_ORIENTATION_HORIZONTAL:
-          gimp_draw_tool_draw_line (draw_tool,
-                                    0, move->guide_position,
-                                    gimp_image_get_width (image),
-                                    move->guide_position,
-                                    FALSE);
-          break;
-
-        case GIMP_ORIENTATION_VERTICAL:
-          gimp_draw_tool_draw_line (draw_tool,
-                                    move->guide_position, 0,
-                                    move->guide_position,
-                                    gimp_image_get_height (image),
-                                    FALSE);
-          break;
-
-        default:
-          g_assert_not_reached ();
-        }
+      gimp_draw_tool_draw_guide_line (draw_tool,
+                                      move->guide_orientation,
+                                      move->guide_position);
     }
 }
 

Modified: branches/soc-2008-text/app/tools/gimppaintoptions-gui.c
==============================================================================
--- branches/soc-2008-text/app/tools/gimppaintoptions-gui.c	(original)
+++ branches/soc-2008-text/app/tools/gimppaintoptions-gui.c	Wed Aug  6 20:36:18 2008
@@ -183,7 +183,7 @@
       gboolean   rtl = gtk_widget_get_direction (vbox) == GTK_TEXT_DIR_RTL;
 
       frame = gimp_prop_expander_new (config, "dynamics-expanded",
-                                      _("Dynamics sensitivity"));
+                                      _("Brush Dynamics"));
       gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
       gtk_widget_show (frame);
 
@@ -299,10 +299,10 @@
 tool_has_opacity_dynamics (GType tool_type)
 {
   return (g_type_is_a (tool_type, GIMP_TYPE_PAINTBRUSH_TOOL) ||
-          tool_type == GIMP_TYPE_CLONE_TOOL                  ||
-          tool_type == GIMP_TYPE_HEAL_TOOL                   ||
-          tool_type == GIMP_TYPE_PERSPECTIVE_CLONE_TOOL      ||
-          tool_type == GIMP_TYPE_DODGE_BURN_TOOL             ||
+          tool_type == GIMP_TYPE_CLONE_TOOL             ||
+          tool_type == GIMP_TYPE_HEAL_TOOL              ||
+          tool_type == GIMP_TYPE_PERSPECTIVE_CLONE_TOOL ||
+          tool_type == GIMP_TYPE_DODGE_BURN_TOOL        ||
           tool_type == GIMP_TYPE_ERASER_TOOL);
 }
 
@@ -314,6 +314,7 @@
           tool_type == GIMP_TYPE_HEAL_TOOL              ||
           tool_type == GIMP_TYPE_PERSPECTIVE_CLONE_TOOL ||
           tool_type == GIMP_TYPE_CONVOLVE_TOOL          ||
+          tool_type == GIMP_TYPE_ERASER_TOOL            ||
           tool_type == GIMP_TYPE_DODGE_BURN_TOOL        ||
           tool_type == GIMP_TYPE_PAINTBRUSH_TOOL        ||
           tool_type == GIMP_TYPE_SMUDGE_TOOL);
@@ -322,23 +323,21 @@
 static gboolean
 tool_has_rate_dynamics (GType tool_type)
 {
-  return (tool_type == GIMP_TYPE_AIRBRUSH_TOOL ||
-          tool_type == GIMP_TYPE_CONVOLVE_TOOL ||
+  return (tool_type == GIMP_TYPE_AIRBRUSH_TOOL          ||
+          tool_type == GIMP_TYPE_CONVOLVE_TOOL          ||
           tool_type == GIMP_TYPE_SMUDGE_TOOL);
 }
 
 static gboolean
 tool_has_size_dynamics (GType tool_type)
 {
-  return (tool_type == GIMP_TYPE_CLONE_TOOL             ||
+  return (g_type_is_a (tool_type, GIMP_TYPE_PAINTBRUSH_TOOL) ||
+          tool_type == GIMP_TYPE_CLONE_TOOL             ||
           tool_type == GIMP_TYPE_HEAL_TOOL              ||
           tool_type == GIMP_TYPE_PERSPECTIVE_CLONE_TOOL ||
           tool_type == GIMP_TYPE_CONVOLVE_TOOL          ||
           tool_type == GIMP_TYPE_DODGE_BURN_TOOL        ||
-          tool_type == GIMP_TYPE_ERASER_TOOL            ||
-          tool_type == GIMP_TYPE_PAINTBRUSH_TOOL        ||
-          tool_type == GIMP_TYPE_AIRBRUSH_TOOL          ||
-          tool_type == GIMP_TYPE_PENCIL_TOOL);
+          tool_type == GIMP_TYPE_ERASER_TOOL);
 }
 
 static gboolean

Modified: branches/soc-2008-text/app/tools/gimppainttool.c
==============================================================================
--- branches/soc-2008-text/app/tools/gimppainttool.c	(original)
+++ branches/soc-2008-text/app/tools/gimppainttool.c	Wed Aug  6 20:36:18 2008
@@ -274,7 +274,6 @@
   GimpPaintOptions *paint_options = GIMP_PAINT_TOOL_GET_OPTIONS (tool);
   GimpPaintCore    *core          = paint_tool->core;
   GimpDrawable     *drawable;
-  GdkDisplay       *gdk_display;
   GimpCoords        curr_coords;
   gint              off_x, off_y;
   GError           *error = NULL;
@@ -311,11 +310,6 @@
       tool->display = display;
     }
 
-  gdk_display = gtk_widget_get_display (display->shell);
-
-  core->use_pressure = (gimp_devices_get_current (display->image->gimp) !=
-                        gdk_display_get_core_pointer (gdk_display));
-
   if (! gimp_paint_core_start (core, drawable, paint_options, &curr_coords,
                                &error))
     {
@@ -345,7 +339,6 @@
               GIMP_BRUSH_HARD);
 
       core->start_coords = core->last_coords;
-      core->use_pressure = FALSE;
 
       gimp_paint_tool_round_line (core, hard, state);
     }
@@ -453,8 +446,11 @@
   core->cur_coords.x -= off_x;
   core->cur_coords.y -= off_y;
 
-  GIMP_TOOL_CLASS (parent_class)->motion (tool, coords, time, state,
-                                          display);
+  GIMP_TOOL_CLASS (parent_class)->motion (tool, coords, time, state, display);
+
+  /*  don't paint while the Shift key is pressed for line drawing  */
+  if (paint_tool->draw_line)
+    return;
 
   gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
 
@@ -550,7 +546,7 @@
 
   gimp_tool_pop_status (tool, display);
 
-  if (tool->display          &&
+  if (tool->display            &&
       tool->display != display &&
       tool->display->image == display->image)
     {

Modified: branches/soc-2008-text/app/tools/gimprectangletool.c
==============================================================================
--- branches/soc-2008-text/app/tools/gimprectangletool.c	(original)
+++ branches/soc-2008-text/app/tools/gimprectangletool.c	Wed Aug  6 20:36:18 2008
@@ -41,6 +41,7 @@
 
 #include "display/gimpdisplay.h"
 #include "display/gimpdisplayshell.h"
+#include "display/gimpdisplayshell-scroll.h"
 #include "display/gimpdisplayshell-transform.h"
 
 #include "gimpdrawtool.h"
@@ -64,6 +65,7 @@
 #define MIN_HANDLE_SIZE         15
 #define NARROW_MODE_HANDLE_SIZE 15
 #define NARROW_MODE_THRESHOLD   45
+#define CENTER_CROSS_SIZE       6
 
 
 #define SQRT5   2.236067977
@@ -1680,9 +1682,23 @@
   switch (private->function)
     {
     case GIMP_RECTANGLE_TOOL_MOVING:
+
       if (gimp_tool_control_is_active (tool->control))
-        break;
-      /* else fallthrough */
+        {
+          /* Mark the center because we snap to it */
+          gimp_draw_tool_draw_cross_by_anchor (draw_tool,
+                                               (pub_x1 + pub_x2) / 2.0,
+                                               (pub_y1 + pub_y2) / 2.0,
+                                               CENTER_CROSS_SIZE,
+                                               CENTER_CROSS_SIZE,
+                                               GTK_ANCHOR_CENTER,
+                                               FALSE);
+          break;
+        }
+      else
+        {
+          /* Fallthrough */
+        }
 
     case GIMP_RECTANGLE_TOOL_DEAD:
     case GIMP_RECTANGLE_TOOL_CREATING:
@@ -1846,15 +1862,14 @@
     /* Calculate rectangles of the selection rectangle and the display shell,
      * with origin at (0, 0) of image, and in screen coordinate scale.
      */
-    gint    x1 =  pub_x1 * shell->scale_x;
-    gint    y1 =  pub_y1 * shell->scale_y;
-    gint    w1 = (pub_x2 - pub_x1) * shell->scale_x;
-    gint    h1 = (pub_y2 - pub_y1) * shell->scale_y;
-
-    gint    x2 = -shell->disp_xoffset + shell->offset_x;
-    gint    y2 = -shell->disp_yoffset + shell->offset_y;
-    gint    w2 =  shell->disp_width;
-    gint    h2 =  shell->disp_height;
+    gint x1 =  pub_x1 * shell->scale_x;
+    gint y1 =  pub_y1 * shell->scale_y;
+    gint w1 = (pub_x2 - pub_x1) * shell->scale_x;
+    gint h1 = (pub_y2 - pub_y1) * shell->scale_y;
+
+    gint x2, y2, w2, h2;
+
+    gimp_display_shell_get_scaled_viewport (shell, &x2, &y2, &w2, &h2);
 
     rectangle_width  = w1;
     rectangle_height = h1;
@@ -1946,8 +1961,9 @@
 
   shell = GIMP_DISPLAY_SHELL (tool->display->shell);
 
-  return shell->scale_x != private->scale_x_used_for_handle_size_calculations ||
-         shell->scale_y != private->scale_y_used_for_handle_size_calculations;
+  return (shell->scale_x != private->scale_x_used_for_handle_size_calculations
+          ||
+          shell->scale_y != private->scale_y_used_for_handle_size_calculations);
 }
 
 static void
@@ -2181,25 +2197,33 @@
                                        gdouble            new_x,
                                        gdouble            new_y)
 {
+  GimpTool                 *tool;
+  GimpDrawTool             *draw_tool;
   GimpRectangleToolPrivate *private;
   GimpRectangleFunction     old_function;
 
+  tool      = GIMP_TOOL (rect_tool);
+  draw_tool = GIMP_DRAW_TOOL (rect_tool);
+  private   = GIMP_RECTANGLE_TOOL_GET_PRIVATE (rect_tool);
+
   /* We don't want to synthesize motions if the tool control is active
    * since that means the mouse button is down and the rectangle will
    * get updated in _motion anyway. The reason we want to prevent this
-   * function from executing is that is emits the rectangle-changed
-   * signal which we don't want in the middle of a rectangle change.
+   * function from executing is that is emits the
+   * rectangle-changed-complete signal which we don't want in the
+   * middle of a rectangle change.
+   *
+   * In addition to that, we don't want to synthesize a motion if
+   * there is no pending rectangle because that doesn't make any
+   * sense.
    */
-  if (gimp_tool_control_is_active (GIMP_TOOL (rect_tool)->control))
-    {
-      return;
-    }
- 
-  private = GIMP_RECTANGLE_TOOL_GET_PRIVATE (rect_tool);
+  if (gimp_tool_control_is_active (tool->control) ||
+      ! tool->display)
+    return;
 
   old_function = private->function;
 
-  gimp_draw_tool_pause (GIMP_DRAW_TOOL (rect_tool));
+  gimp_draw_tool_pause (draw_tool);
 
   gimp_rectangle_tool_set_function (rect_tool, function);
 
@@ -2212,14 +2236,14 @@
   private->center_y_on_fixed_center = (private->y1 + private->y2) / 2;
 
   gimp_rectangle_tool_update_options (rect_tool,
-                                      GIMP_TOOL (rect_tool)->display);
+                                      tool->display);
 
   gimp_rectangle_tool_set_function (rect_tool, old_function);
 
   gimp_rectangle_tool_update_highlight (rect_tool);
   gimp_rectangle_tool_update_handle_sizes (rect_tool);
 
-  gimp_draw_tool_resume (GIMP_DRAW_TOOL (rect_tool));
+  gimp_draw_tool_resume (draw_tool);
 
   gimp_rectangle_tool_rectangle_change_complete (rect_tool);
 }
@@ -2542,10 +2566,10 @@
   y1_b = pub_y1 - (narrow_mode ? private->corner_handle_h / shell->scale_y : 0);
   y2_b = pub_y2 + (narrow_mode ? private->corner_handle_h / shell->scale_y : 0);
 
-  return coord->x < x1_b ||
-         coord->x > x2_b ||
-         coord->y < y1_b ||
-         coord->y > y2_b;
+  return (coord->x < x1_b ||
+          coord->x > x2_b ||
+          coord->y < y1_b ||
+          coord->y > y2_b);
 }
 
 /**

Modified: branches/soc-2008-text/app/tools/gimprotatetool.c
==============================================================================
--- branches/soc-2008-text/app/tools/gimprotatetool.c	(original)
+++ branches/soc-2008-text/app/tools/gimprotatetool.c	Wed Aug  6 20:36:18 2008
@@ -130,49 +130,37 @@
                             GdkEventKey *kevent,
                             GimpDisplay *display)
 {
-  GimpDrawTool   *draw_tool   = GIMP_DRAW_TOOL (tool);
-  GimpRotateTool *rotate      = GIMP_ROTATE_TOOL (tool);
-  gboolean        handled_key = FALSE;
-  GtkSpinButton  *angle_spin  = GTK_SPIN_BUTTON (rotate->angle_spin_button);
+  GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
 
   if (display == draw_tool->display)
     {
+      GimpRotateTool *rotate     = GIMP_ROTATE_TOOL (tool);
+      GtkSpinButton  *angle_spin = GTK_SPIN_BUTTON (rotate->angle_spin_button);
+
       switch (kevent->keyval)
         {
         case GDK_Up:
-          handled_key = TRUE;
           gtk_spin_button_spin (angle_spin, GTK_SPIN_STEP_FORWARD, 0.0);
-          break;
+          return TRUE;
 
         case GDK_Down:
-          handled_key = TRUE;
           gtk_spin_button_spin (angle_spin, GTK_SPIN_STEP_BACKWARD, 0.0);
-          break;
+          return TRUE;
 
         case GDK_Left:
-          handled_key = TRUE;
           gtk_spin_button_spin (angle_spin, GTK_SPIN_PAGE_FORWARD, 0.0);
-          break;
+          return TRUE;
 
         case GDK_Right:
-          handled_key = TRUE;
           gtk_spin_button_spin (angle_spin, GTK_SPIN_PAGE_BACKWARD, 0.0);
-          break;
+          return TRUE;
 
         default:
-          handled_key = FALSE;
           break;
         }
     }
 
-  if (! handled_key)
-    {
-      handled_key = GIMP_TOOL_CLASS (parent_class)->key_press (tool,
-                                                               kevent,
-                                                               display);
-    }
-
-  return handled_key;
+  return GIMP_TOOL_CLASS (parent_class)->key_press (tool, kevent, display);
 }
 
 static void

Modified: branches/soc-2008-text/app/tools/gimptexttool.c
==============================================================================
--- branches/soc-2008-text/app/tools/gimptexttool.c	(original)
+++ branches/soc-2008-text/app/tools/gimptexttool.c	Wed Aug  6 20:36:18 2008
@@ -1957,7 +1957,6 @@
                                    &cursor,
                                     gtk_text_buffer_get_insert (text_tool->text_buffer));
 
-
   if (gtk_text_buffer_get_has_selection (text_tool->text_buffer))
     gtk_text_buffer_delete_selection (text_tool->text_buffer, TRUE, TRUE);
   else
@@ -1970,11 +1969,7 @@
 gimp_text_tool_enter_text (GimpTextTool *text_tool,
                            const gchar *str)
 {
-  GtkTextIter start, end;
-
-  gtk_text_buffer_get_bounds (text_tool->text_buffer, &start, &end);
   gtk_text_buffer_insert_at_cursor (text_tool->text_buffer, str, -1);
-
   gimp_text_tool_update_proxy (text_tool);
 }
 

Modified: branches/soc-2008-text/app/tools/gimptool.c
==============================================================================
--- branches/soc-2008-text/app/tools/gimptool.c	(original)
+++ branches/soc-2008-text/app/tools/gimptool.c	Wed Aug  6 20:36:18 2008
@@ -198,7 +198,7 @@
   switch (property_id)
     {
     case PROP_TOOL_INFO:
-      tool->tool_info = GIMP_TOOL_INFO (g_value_dup_object (value));
+      tool->tool_info = g_value_dup_object (value);
       break;
 
     default:

Modified: branches/soc-2008-text/app/tools/gimpvectortool.c
==============================================================================
--- branches/soc-2008-text/app/tools/gimpvectortool.c	(original)
+++ branches/soc-2008-text/app/tools/gimpvectortool.c	Wed Aug  6 20:36:18 2008
@@ -286,6 +286,7 @@
           gimp_vector_tool_set_vectors (vector_tool, vectors);
           gimp_image_set_active_vectors (display->image, vectors);
         }
+
       vector_tool->function = VECTORS_FINISHED;
     }
 
@@ -306,7 +307,6 @@
       gimp_vector_tool_set_vectors (vector_tool, vectors);
 
       vector_tool->function = VECTORS_CREATE_STROKE;
-
     }
 
   gimp_vectors_freeze (vector_tool->vectors);
@@ -335,21 +335,28 @@
 
   if (vector_tool->function == VECTORS_ADD_ANCHOR)
     {
+      GimpCoords position = GIMP_COORDS_DEFAULT_VALUES;
+
+      position.x = coords->x;
+      position.y = coords->y;
+
       gimp_vector_tool_undo_push (vector_tool, _("Add Anchor"));
 
       vector_tool->undo_motion = TRUE;
 
       vector_tool->cur_anchor =
-                     gimp_bezier_stroke_extend (vector_tool->sel_stroke, coords,
+                     gimp_bezier_stroke_extend (vector_tool->sel_stroke,
+                                                &position,
                                                 vector_tool->sel_anchor,
                                                 EXTEND_EDITABLE);
 
       vector_tool->restriction = GIMP_ANCHOR_FEATURE_SYMMETRIC;
 
-      if (!options->polygonal)
+      if (! options->polygonal)
         vector_tool->function = VECTORS_MOVE_HANDLE;
       else
         vector_tool->function = VECTORS_MOVE_ANCHOR;
+
       vector_tool->cur_stroke = vector_tool->sel_stroke;
     }
 
@@ -374,6 +381,7 @@
                                           vector_tool->cur_anchor,
                                           GIMP_ANCHOR_FEATURE_EDGE);
             }
+
           vector_tool->function = VECTORS_MOVE_ANCHOR;
         }
       else
@@ -391,7 +399,7 @@
 
       if (vector_tool->cur_anchor->type == GIMP_ANCHOR_ANCHOR)
         {
-          if (!vector_tool->cur_anchor->selected)
+          if (! vector_tool->cur_anchor->selected)
             {
               gimp_vectors_anchor_select (vector_tool->vectors,
                                           vector_tool->cur_stroke,
@@ -406,7 +414,7 @@
                                             GIMP_ANCHOR_CONTROL, TRUE,
                                             &vector_tool->cur_anchor,
                                             &vector_tool->cur_stroke);
-          if (!vector_tool->cur_anchor)
+          if (! vector_tool->cur_anchor)
             vector_tool->function = VECTORS_FINISHED;
         }
     }
@@ -418,7 +426,7 @@
     {
       gimp_vector_tool_undo_push (vector_tool, _("Drag Anchor"));
 
-      if (!vector_tool->cur_anchor->selected)
+      if (! vector_tool->cur_anchor->selected)
         {
           gimp_vectors_anchor_select (vector_tool->vectors,
                                       vector_tool->cur_stroke,
@@ -442,7 +450,9 @@
                                       vector_tool->cur_anchor,
                                       !vector_tool->cur_anchor->selected,
                                       FALSE);
+
           vector_tool->undo_motion = TRUE;
+
           if (vector_tool->cur_anchor->selected == FALSE)
             vector_tool->function = VECTORS_FINISHED;
         }
@@ -495,6 +505,7 @@
           gimp_vectors_stroke_remove (vector_tool->vectors,
                                       vector_tool->cur_stroke);
         }
+
       vector_tool->sel_anchor = vector_tool->cur_anchor;
       vector_tool->cur_stroke = vector_tool->sel_stroke;
 
@@ -643,11 +654,15 @@
 {
   GimpVectorTool    *vector_tool = GIMP_VECTOR_TOOL (tool);
   GimpVectorOptions *options     = GIMP_VECTOR_TOOL_GET_OPTIONS (tool);
+  GimpCoords         position    = GIMP_COORDS_DEFAULT_VALUES;
   GimpAnchor        *anchor;
 
   if (vector_tool->function == VECTORS_FINISHED)
     return;
 
+  position.x = coords->x;
+  position.y = coords->y;
+
   gimp_vectors_freeze (vector_tool->vectors);
 
   if ((vector_tool->saved_state & TOGGLE_MASK) != (state & TOGGLE_MASK))
@@ -675,7 +690,8 @@
         {
           gimp_stroke_anchor_move_absolute (vector_tool->cur_stroke,
                                             vector_tool->cur_anchor,
-                                            coords, vector_tool->restriction);
+                                            &position,
+                                            vector_tool->restriction);
           vector_tool->undo_motion = TRUE;
         }
       break;
@@ -684,8 +700,8 @@
       if (options->polygonal)
         {
           gimp_vector_tool_move_selected_anchors (vector_tool,
-                                               coords->x - vector_tool->last_x,
-                                               coords->y - vector_tool->last_y);
+                                                  coords->x - vector_tool->last_x,
+                                                  coords->y - vector_tool->last_y);
           vector_tool->undo_motion = TRUE;
         }
       else
@@ -693,7 +709,8 @@
           gimp_stroke_point_move_absolute (vector_tool->cur_stroke,
                                            vector_tool->cur_anchor,
                                            vector_tool->cur_position,
-                                           coords, vector_tool->restriction);
+                                           &position,
+                                           vector_tool->restriction);
           vector_tool->undo_motion = TRUE;
         }
       break;
@@ -977,6 +994,7 @@
           else
             {
               vector_tool->function = VECTORS_MOVE_HANDLE;
+
               if (state & TOGGLE_MASK)
                 vector_tool->restriction = GIMP_ANCHOR_FEATURE_SYMMETRIC;
               else
@@ -988,6 +1006,7 @@
           if (gimp_stroke_point_is_movable (stroke, anchor, position))
             {
               vector_tool->function = VECTORS_MOVE_CURVE;
+
               if (state & TOGGLE_MASK)
                 vector_tool->restriction = GIMP_ANCHOR_FEATURE_SYMMETRIC;
               else
@@ -1688,9 +1707,9 @@
 {
   GimpAnchor *cur_anchor;
   GimpStroke *cur_stroke = NULL;
-  GList *anchors;
-  GList *list;
-  GimpCoords offset = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
+  GList      *anchors;
+  GList      *list;
+  GimpCoords  offset = { 0.0, };
 
   offset.x = x;
   offset.y = y;
@@ -1780,7 +1799,7 @@
   vector_tool->sel_anchor = NULL;
   vector_tool->sel_stroke = NULL;
 
-  if (!vector_tool->vectors)
+  if (! vector_tool->vectors)
     {
       vector_tool->cur_position = -1;
       vector_tool->cur_anchor   = NULL;
@@ -1832,10 +1851,10 @@
         }
     }
 
-  if (!cur_stroke_valid)
+  if (! cur_stroke_valid)
     vector_tool->cur_stroke = NULL;
 
-  if (!cur_anchor_valid)
+  if (! cur_anchor_valid)
     vector_tool->cur_anchor = NULL;
 
 }

Modified: branches/soc-2008-text/app/vectors/gimpbezierstroke.c
==============================================================================
--- branches/soc-2008-text/app/vectors/gimpbezierstroke.c	(original)
+++ branches/soc-2008-text/app/vectors/gimpbezierstroke.c	Wed Aug  6 20:36:18 2008
@@ -22,7 +22,7 @@
 #include "config.h"
 
 #include <glib-object.h>
-#include <cairo/cairo.h>
+#include <cairo.h>
 
 #include "libgimpmath/gimpmath.h"
 
@@ -245,11 +245,12 @@
 }
 
 static void
-gimp_bezier_stroke_anchor_delete (GimpStroke        *stroke,
-                                  GimpAnchor        *anchor)
+gimp_bezier_stroke_anchor_delete (GimpStroke *stroke,
+                                  GimpAnchor *anchor)
 {
-  GList *list, *list2;
-  gint i;
+  GList *list;
+  GList *list2;
+  gint   i;
 
   /* Anchors always are surrounded by two handles that have to
    * be deleted too */
@@ -271,7 +272,8 @@
 gimp_bezier_stroke_open (GimpStroke *stroke,
                          GimpAnchor *end_anchor)
 {
-  GList *list, *list2;
+  GList      *list;
+  GList      *list2;
   GimpStroke *new_stroke = NULL;
 
   list = g_list_find (stroke->anchors, end_anchor);
@@ -318,10 +320,12 @@
                                   GimpAnchor *predec,
                                   gdouble     position)
 {
-  GList *segment_start, *list, *list2;
-  GimpCoords subdivided[8];
-  GimpCoords beziercoords[4];
-  gint i;
+  GList      *segment_start;
+  GList      *list;
+  GList      *list2;
+  GimpCoords  subdivided[8];
+  GimpCoords  beziercoords[4];
+  gint        i;
 
   segment_start = g_list_find (stroke->anchors, predec);
 
@@ -424,10 +428,11 @@
                                         const GimpCoords      *deltacoord,
                                         GimpAnchorFeatureType  feature)
 {
-  GimpCoords offsetcoords[2];
-  GList      *segment_start, *list;
+  GimpCoords  offsetcoords[2];
+  GList      *segment_start;
+  GList      *list;
   gint        i;
-  gdouble feel_good;
+  gdouble     feel_good;
 
   segment_start = g_list_find (stroke->anchors, predec);
 
@@ -480,7 +485,8 @@
   GimpCoords  deltacoord;
   GimpCoords  tmp1, tmp2, abs_pos;
   GimpCoords  beziercoords[4];
-  GList      *segment_start, *list;
+  GList      *segment_start;
+  GList      *list;
   gint        i;
 
   segment_start = g_list_find (stroke->anchors, predec);
@@ -514,7 +520,8 @@
 static void
 gimp_bezier_stroke_close (GimpStroke *stroke)
 {
-  GList *start, *end;
+  GList      *start;
+  GList      *end;
   GimpAnchor *anchor;
 
   start = g_list_first (stroke->anchors);
@@ -569,7 +576,8 @@
   GimpCoords  point;
   GimpCoords  segmentcoords[4];
   GList      *anchorlist;
-  GimpAnchor *segment_start, *segment_end = NULL;
+  GimpAnchor *segment_start;
+  GimpAnchor *segment_end = NULL;
   GimpAnchor *anchor;
   gint        count;
 
@@ -603,6 +611,7 @@
           if (dist < min_dist || min_dist < 0)
             {
               min_dist = dist;
+
               if (ret_pos)
                 *ret_pos = pos;
               if (ret_point)
@@ -612,6 +621,7 @@
               if (ret_segment_end)
                 *ret_segment_end = segment_end;
             }
+
           segment_start = anchorlist->data;
           segmentcoords[0] = segmentcoords[3];
           count = 1;
@@ -627,7 +637,9 @@
           segmentcoords[count] = GIMP_ANCHOR (anchorlist->data)->position;
           count++;
         }
+
       anchorlist = g_list_next (anchorlist);
+
       if (anchorlist)
         {
           segment_end = GIMP_ANCHOR (anchorlist->data);
@@ -642,6 +654,7 @@
       if (dist < min_dist || min_dist < 0)
         {
           min_dist = dist;
+
           if (ret_pos)
             *ret_pos = pos;
           if (ret_point)
@@ -671,9 +684,9 @@
    */
 
   GimpCoords subdivided[8];
-  gdouble dist1, dist2;
+  gdouble    dist1, dist2;
   GimpCoords point1, point2;
-  gdouble pos1, pos2;
+  gdouble    pos1, pos2;
 
   gimp_coords_difference (&beziercoords[1], &beziercoords[0], &point1);
   gimp_coords_difference (&beziercoords[3], &beziercoords[2], &point2);
@@ -683,8 +696,8 @@
                  && gimp_coords_length_squared (&point2) < precision))
     {
       GimpCoords line, dcoord;
-      gdouble length2, scalar;
-      gint i;
+      gdouble    length2, scalar;
+      gint       i;
 
       gimp_coords_difference (&(beziercoords[3]),
                               &(beziercoords[0]),
@@ -708,7 +721,8 @@
       for (i = 0; i <= 15; i++)
         {
           pos2 *= 0.5;
-          if (3*pos1*pos1*(1-pos1) + pos1*pos1*pos1 < scalar)
+
+          if (3 * pos1 * pos1 * (1-pos1) + pos1 * pos1 * pos1 < scalar)
             pos1 += pos2;
           else
             pos1 -= pos2;
@@ -794,7 +808,8 @@
   GimpCoords  point;
   GimpCoords  segmentcoords[4];
   GList      *anchorlist;
-  GimpAnchor *segment_start, *segment_end = NULL;
+  GimpAnchor *segment_start;
+  GimpAnchor *segment_end = NULL;
   GimpAnchor *anchor;
   gint        count;
 
@@ -828,6 +843,7 @@
           if (dist >= 0 && (dist < min_dist || min_dist < 0))
             {
               min_dist = dist;
+
               if (ret_pos)
                 *ret_pos = pos;
               if (nearest)
@@ -837,6 +853,7 @@
               if (ret_segment_end)
                 *ret_segment_end = segment_end;
             }
+
           segment_start = anchorlist->data;
           segmentcoords[0] = segmentcoords[3];
           count = 1;
@@ -852,7 +869,9 @@
           segmentcoords[count] = GIMP_ANCHOR (anchorlist->data)->position;
           count++;
         }
+
       anchorlist = g_list_next (anchorlist);
+
       if (anchorlist)
         {
           segment_end = GIMP_ANCHOR (anchorlist->data);
@@ -867,6 +886,7 @@
       if (dist >= 0 && (dist < min_dist || min_dist < 0))
         {
           min_dist = dist;
+
           if (ret_pos)
             *ret_pos = pos;
           if (nearest)
@@ -889,10 +909,12 @@
                                                 GimpCoords       *ret_point,
                                                 gdouble          *ret_pos)
 {
-  GArray *ret_coords, *ret_params;
-  GimpCoords dir, line, dcoord, min_point;
-  gdouble min_dist = -1, dist, length2, scalar, ori, ori2;
-  gint i;
+  GArray     *ret_coords;
+  GArray     *ret_params;
+  GimpCoords  dir, line, dcoord, min_point;
+  gdouble     min_dist = -1;
+  gdouble     dist, length2, scalar, ori, ori2;
+  gint        i;
 
   gimp_coords_difference (coord2, coord1, &line);
 
@@ -1274,7 +1296,8 @@
                                    GimpStroke *extension,
                                    GimpAnchor *neighbor)
 {
-  GList *list1, *list2;
+  GList *list1;
+  GList *list2;
 
   list1 = g_list_find (stroke->anchors, anchor);
   list1 = gimp_bezier_stroke_get_anchor_listitem (list1);
@@ -1446,10 +1469,11 @@
 static GimpBezierDesc *
 gimp_bezier_stroke_make_bezier (const GimpStroke *stroke)
 {
-  GArray *points, *cmd_array;
-  GimpBezierDesc *bezdesc;
+  GArray            *points;
+  GArray            *cmd_array;
+  GimpBezierDesc    *bezdesc;
   cairo_path_data_t  pathdata;
-  gint num_cmds, i;
+  gint               num_cmds, i;
 
   points = gimp_stroke_control_points_get (stroke, NULL);
 
@@ -1523,6 +1547,7 @@
   bezdesc->status = CAIRO_STATUS_SUCCESS;
   bezdesc->data = (cairo_path_data_t *) cmd_array->data;
   bezdesc->num_data = cmd_array->len;
+
   g_array_free (points, TRUE);
   g_array_free (cmd_array, FALSE);
 
@@ -1701,7 +1726,8 @@
 }
 
 static gdouble
-arcto_circleparam (gdouble h, gdouble *y)
+arcto_circleparam (gdouble  h,
+                   gdouble *y)
 {
   gdouble t0 = 0.5;
   gdouble dt = 0.25;
@@ -1710,10 +1736,10 @@
 
   while (dt >= 0.00001)
     {
-      pt0 = (  y[0]*(1-t0)*(1-t0)*(1-t0) +
-             3*y[1]*(1-t0)*(1-t0)*t0 +
-             3*y[2]*(1-t0)*t0*t0 +
-               y[3]*t0*t0*t0 );
+      pt0 = (    y[0] * (1-t0) * (1-t0) * (1-t0) +
+             3 * y[1] * (1-t0) * (1-t0) * t0     +
+             3 * y[2] * (1-t0) * t0     * t0     +
+                 y[3] * t0     * t0     * t0 );
 
       if (pt0 > h)
         t0 = t0 - dt;
@@ -1737,7 +1763,9 @@
 }
 
 static void
-arcto_subdivide (gdouble t, gint part, GimpCoords *p)
+arcto_subdivide (gdouble     t,
+                 gint        part,
+                 GimpCoords *p)
 {
   GimpCoords p01, p12, p23, p012, p123, p0123;
 
@@ -1771,12 +1799,13 @@
                       gdouble     phi1,
                       GimpCoords *ellips)
 {
-  gdouble       phi_s, phi_e;
-  GimpCoords    template    = GIMP_COORDS_DEFAULT_VALUES;
-  const gdouble circlemagic = 4.0 * (G_SQRT2 - 1.0) / 3.0;
-  gdouble       y[4];
-  gdouble       h0, h1;
-  gdouble       t0, t1;
+  const GimpCoords  template    = GIMP_COORDS_DEFAULT_VALUES;
+  const gdouble     circlemagic = 4.0 * (G_SQRT2 - 1.0) / 3.0;
+
+  gdouble  phi_s, phi_e;
+  gdouble  y[4];
+  gdouble  h0, h1;
+  gdouble  t0, t1;
 
   g_return_if_fail (ellips != NULL);
 
@@ -1808,10 +1837,9 @@
 
   ellips[0].x = cos (phi_s); ellips[0].y = sin (phi_s);
   ellips[3].x = cos (phi_e); ellips[3].y = sin (phi_e);
-  gimp_coords_mix (1, &(ellips[0]), circlemagic, &(ellips[3]),
-                   &(ellips[1]));
-  gimp_coords_mix (circlemagic, &(ellips[0]), 1, &(ellips[3]),
-                   &(ellips[2]));
+
+  gimp_coords_mix (1, &(ellips[0]), circlemagic, &(ellips[3]), &(ellips[1]));
+  gimp_coords_mix (circlemagic, &(ellips[0]), 1, &(ellips[3]), &(ellips[2]));
 
   if (h0 > y[0])
     {
@@ -2145,7 +2173,7 @@
    */
 
   GimpCoords subdivided[8];
-  gdouble middle_t = (start_t + end_t) / 2;
+  gdouble    middle_t = (start_t + end_t) / 2;
 
   subdivided[0] = beziercoords[0];
   subdivided[6] = beziercoords[3];
@@ -2184,12 +2212,15 @@
                                                 precision)) /* 1st half */
     {
       *ret_coords = g_array_append_vals (*ret_coords, &(subdivided[0]), 3);
+
       if (ret_params)
         {
           gdouble params[3];
+
           params[0] = start_t;
           params[1] = (2 * start_t + middle_t) / 3;
           params[2] = (start_t + 2 * middle_t) / 3;
+
           *ret_params = g_array_append_vals (*ret_params, &(params[0]), 3);
         }
     }
@@ -2205,12 +2236,15 @@
                                                 precision)) /* 2nd half */
     {
       *ret_coords = g_array_append_vals (*ret_coords, &(subdivided[3]), 3);
+
       if (ret_params)
         {
           gdouble params[3];
+
           params[0] = middle_t;
           params[1] = (2 * middle_t + end_t) / 3;
           params[2] = (middle_t + 2 * end_t) / 3;
+
           *ret_params = g_array_append_vals (*ret_params, &(params[0]), 3);
         }
     }

Modified: branches/soc-2008-text/app/vectors/gimpvectors.c
==============================================================================
--- branches/soc-2008-text/app/vectors/gimpvectors.c	(original)
+++ branches/soc-2008-text/app/vectors/gimpvectors.c	Wed Aug  6 20:36:18 2008
@@ -22,7 +22,7 @@
 #include "config.h"
 
 #include <glib-object.h>
-#include <cairo/cairo.h>
+#include <cairo.h>
 
 #include "libgimpcolor/gimpcolor.h"
 #include "libgimpmath/gimpmath.h"
@@ -522,6 +522,7 @@
 
         retval = gimp_paint_core_stroke_vectors (core, drawable,
                                                  stroke_desc->paint_options,
+                                                 stroke_desc->emulate_dynamics,
                                                  vectors, error);
 
         g_object_unref (core);

Modified: branches/soc-2008-text/app/widgets/Makefile.am
==============================================================================
--- branches/soc-2008-text/app/widgets/Makefile.am	(original)
+++ branches/soc-2008-text/app/widgets/Makefile.am	Wed Aug  6 20:36:18 2008
@@ -11,8 +11,6 @@
 	-I$(top_builddir)/app	\
 	-I$(top_srcdir)/app	\
 	$(GTK_CFLAGS)		\
-	$(PANGOFT2_CFLAGS)	\
-	$(DBUS_GLIB_CFLAGS)	\
 	-I$(includedir)
 
 noinst_LIBRARIES = libappwidgets.a
@@ -110,8 +108,6 @@
 	gimpdataeditor.h		\
 	gimpdatafactoryview.c		\
 	gimpdatafactoryview.h		\
-	gimpdbusservice.c		\
-	gimpdbusservice.h		\
 	gimpdeviceinfo.c		\
 	gimpdeviceinfo.h		\
 	gimpdevices.c			\
@@ -350,30 +346,21 @@
 	gtkvwrapbox.c			\
 	gtkvwrapbox.h
 
-libappwidgets_a_built_sources = gimpdbusservice-glue.h widgets-enums.c
+libappwidgets_a_built_sources = widgets-enums.c
 
 libappwidgets_a_SOURCES = \
 	$(libappwidgets_a_built_sources) $(libappwidgets_a_sources)
 
-EXTRA_DIST = \
-	dbus-service.xml	\
-	makefile.msc
+EXTRA_DIST = makefile.msc
 
 
 #
 # rules to generate built sources
 #
 # setup autogeneration dependencies
-gen_sources = xgen-wec gimpdbusservice-glue.h
+gen_sources = xgen-wec
 CLEANFILES = $(gen_sources)
 
-
-$(srcdir)/gimpdbusservice.c: gimpdbusservice-glue.h
-
-gimpdbusservice-glue.h: $(srcdir)/dbus-service.xml
-	$(DBUS_BINDING_TOOL) --mode=glib-server --prefix=gimp $< > $(@F)
-
-
 widgets-enums.c: $(srcdir)/widgets-enums.h $(GIMP_MKENUMS)
 	$(GIMP_MKENUMS) \
 		--fhead "#include \"config.h\"\n#include <gtk/gtk.h>\n#include \"libgimpbase/gimpbase.h\"\n#include \"widgets-enums.h\"\n#include \"gimp-intl.h\"" \

Modified: branches/soc-2008-text/app/widgets/gimpaction.c
==============================================================================
--- branches/soc-2008-text/app/widgets/gimpaction.c	(original)
+++ branches/soc-2008-text/app/widgets/gimpaction.c	Wed Aug  6 20:36:18 2008
@@ -177,15 +177,19 @@
     case PROP_CONTEXT:
       g_value_set_object (value, action->context);
       break;
+
     case PROP_COLOR:
       g_value_set_boxed (value, action->color);
       break;
+
     case PROP_VIEWABLE:
       g_value_set_object (value, action->viewable);
       break;
+
     case PROP_ELLIPSIZE:
       g_value_set_enum (value, action->ellipsize);
       break;
+
     case PROP_MAX_WIDTH_CHARS:
       g_value_set_int (value, action->max_width_chars);
       break;
@@ -210,24 +214,28 @@
     case PROP_CONTEXT:
       if (action->context)
         g_object_unref  (action->context);
-      action->context = GIMP_CONTEXT (g_value_dup_object (value));
+      action->context = g_value_dup_object (value);
       break;
+
     case PROP_COLOR:
       if (action->color)
         g_free (action->color);
       action->color = g_value_dup_boxed (value);
       set_proxy = TRUE;
       break;
+
     case PROP_VIEWABLE:
       if (action->viewable)
         g_object_unref  (action->viewable);
-      action->viewable = GIMP_VIEWABLE (g_value_dup_object (value));
+      action->viewable = g_value_dup_object (value);
       set_proxy = TRUE;
       break;
+
     case PROP_ELLIPSIZE:
       action->ellipsize = g_value_get_enum (value);
       set_proxy = TRUE;
       break;
+
     case PROP_MAX_WIDTH_CHARS:
       action->max_width_chars = g_value_get_int (value);
       set_proxy = TRUE;

Modified: branches/soc-2008-text/app/widgets/gimpcellrendererviewable.c
==============================================================================
--- branches/soc-2008-text/app/widgets/gimpcellrendererviewable.c	(original)
+++ branches/soc-2008-text/app/widgets/gimpcellrendererviewable.c	Wed Aug  6 20:36:18 2008
@@ -174,11 +174,11 @@
     {
     case PROP_RENDERER:
       {
-        GimpViewRenderer *renderer;
+        GimpViewRenderer *renderer = g_value_dup_object (value);
 
-        renderer = (GimpViewRenderer *) g_value_dup_object (value);
         if (cell->renderer)
           g_object_unref (cell->renderer);
+
         cell->renderer = renderer;
       }
       break;

Modified: branches/soc-2008-text/app/widgets/gimpcontrollereditor.c
==============================================================================
--- branches/soc-2008-text/app/widgets/gimpcontrollereditor.c	(original)
+++ branches/soc-2008-text/app/widgets/gimpcontrollereditor.c	Wed Aug  6 20:36:18 2008
@@ -410,11 +410,11 @@
   switch (property_id)
     {
     case PROP_CONTROLLER_INFO:
-      editor->info = GIMP_CONTROLLER_INFO (g_value_dup_object (value));
+      editor->info = g_value_dup_object (value);
       break;
 
     case PROP_CONTEXT:
-      editor->context = GIMP_CONTEXT (g_value_dup_object (value));
+      editor->context = g_value_dup_object (value);
       break;
 
     default:

Modified: branches/soc-2008-text/app/widgets/gimpcontrollerinfo.c
==============================================================================
--- branches/soc-2008-text/app/widgets/gimpcontrollerinfo.c	(original)
+++ branches/soc-2008-text/app/widgets/gimpcontrollerinfo.c	Wed Aug  6 20:36:18 2008
@@ -199,17 +199,20 @@
           g_object_unref (info->controller);
         }
 
-      info->controller = GIMP_CONTROLLER (g_value_dup_object (value));
+      info->controller = g_value_dup_object (value);
 
       if (info->controller)
         {
+          GimpControllerClass *controller_class;
+
           g_signal_connect_object (info->controller, "event",
                                    G_CALLBACK (gimp_controller_info_event),
                                    G_OBJECT (info),
                                    0);
 
+          controller_class = GIMP_CONTROLLER_GET_CLASS (info->controller);
           gimp_viewable_set_stock_id (GIMP_VIEWABLE (info),
-                                      GIMP_CONTROLLER_GET_CLASS (info->controller)->stock_id);
+                                      controller_class->stock_id);
         }
       break;
     case PROP_MAPPING:

Modified: branches/soc-2008-text/app/widgets/gimpcontrollerkeyboard.c
==============================================================================
--- branches/soc-2008-text/app/widgets/gimpcontrollerkeyboard.c	(original)
+++ branches/soc-2008-text/app/widgets/gimpcontrollerkeyboard.c	Wed Aug  6 20:36:18 2008
@@ -66,103 +66,103 @@
 static KeyboardEvent keyboard_events[] =
 {
   { GDK_Up, GDK_MOD1_MASK | GDK_CONTROL_MASK | GDK_SHIFT_MASK,
-    "key-up-shift-control-alt",
+    "cursor-up-shift-control-alt",
     N_("Cursor Up") },
   { GDK_Up, GDK_MOD1_MASK | GDK_CONTROL_MASK,
-    "key-up-control-alt",
+    "cursor-up-control-alt",
     N_("Cursor Up") },
   { GDK_Up, GDK_MOD1_MASK | GDK_SHIFT_MASK,
-    "key-up-shift-alt",
+    "cursor-up-shift-alt",
     N_("Cursor Up") },
   { GDK_Up, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
-    "key-up-shift-control",
+    "cursor-up-shift-control",
     N_("Cursor Up") },
   { GDK_Up, GDK_MOD1_MASK,
-    "key-up-alt",
+    "cursor-up-alt",
     N_("Cursor Up") },
   { GDK_Up, GDK_CONTROL_MASK,
-    "key-up-control",
+    "cursor-up-control",
     N_("Cursor Up") },
   { GDK_Up, GDK_SHIFT_MASK,
-    "key-up-shift",
+    "cursor-up-shift",
     N_("Cursor Up") },
   { GDK_Up, 0,
-    "key-up",
+    "cursor-up",
     N_("Cursor Up") },
 
   { GDK_Down, GDK_MOD1_MASK | GDK_CONTROL_MASK | GDK_SHIFT_MASK,
-    "key-down-shift-control-alt",
+    "cursor-down-shift-control-alt",
     N_("Cursor Down") },
   { GDK_Down, GDK_MOD1_MASK | GDK_CONTROL_MASK,
-    "key-down-control-alt",
+    "cursor-down-control-alt",
     N_("Cursor Down") },
   { GDK_Down, GDK_MOD1_MASK | GDK_SHIFT_MASK,
-    "key-down-shift-alt",
+    "cursor-down-shift-alt",
     N_("Cursor Down") },
   { GDK_Down, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
-    "key-down-shift-control",
+    "cursor-down-shift-control",
     N_("Cursor Down") },
   { GDK_Down, GDK_MOD1_MASK,
-    "key-down-alt",
+    "cursor-down-alt",
     N_("Cursor Down") },
   { GDK_Down, GDK_CONTROL_MASK,
-    "key-down-control",
+    "cursor-down-control",
     N_("Cursor Down") },
   { GDK_Down, GDK_SHIFT_MASK,
-    "key-down-shift",
+    "cursor-down-shift",
     N_("Cursor Down") },
   { GDK_Down, 0,
-    "key-down",
+    "cursor-down",
     N_("Cursor Down") },
 
   { GDK_Left, GDK_MOD1_MASK | GDK_CONTROL_MASK | GDK_SHIFT_MASK,
-    "key-left-shift-control-alt",
+    "cursor-left-shift-control-alt",
     N_("Cursor Left") },
   { GDK_Left, GDK_MOD1_MASK | GDK_CONTROL_MASK,
-    "key-left-control-alt",
+    "cursor-left-control-alt",
     N_("Cursor Left") },
   { GDK_Left, GDK_MOD1_MASK | GDK_SHIFT_MASK,
-    "key-left-shift-alt",
+    "cursor-left-shift-alt",
     N_("Cursor Left") },
   { GDK_Left, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
-    "key-left-shift-control",
+    "cursor-left-shift-control",
     N_("Cursor Left") },
   { GDK_Left, GDK_MOD1_MASK,
-    "key-left-alt",
+    "cursor-left-alt",
     N_("Cursor Left") },
   { GDK_Left, GDK_CONTROL_MASK,
-    "key-left-control",
+    "cursor-left-control",
     N_("Cursor Left") },
   { GDK_Left, GDK_SHIFT_MASK,
-    "key-left-shift",
+    "cursor-left-shift",
     N_("Cursor Left") },
   { GDK_Left, 0,
-    "key-left",
+    "cursor-left",
     N_("Cursor Left") },
 
   { GDK_Right, GDK_MOD1_MASK | GDK_CONTROL_MASK | GDK_SHIFT_MASK,
-    "key-right-shift-control-alt",
+    "cursor-right-shift-control-alt",
     N_("Cursor Right") },
   { GDK_Right, GDK_MOD1_MASK | GDK_CONTROL_MASK,
-    "key-right-control-alt",
+    "cursor-right-control-alt",
     N_("Cursor Right") },
   { GDK_Right, GDK_MOD1_MASK | GDK_SHIFT_MASK,
-    "key-right-shift-alt",
+    "cursor-right-shift-alt",
     N_("Cursor Right") },
   { GDK_Right, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
-    "key-right-shift-control",
+    "cursor-right-shift-control",
     N_("Cursor Right") },
   { GDK_Right, GDK_MOD1_MASK,
-    "key-right-alt",
+    "cursor-right-alt",
     N_("Cursor Right") },
   { GDK_Right, GDK_CONTROL_MASK,
-    "key-right-control",
+    "cursor-right-control",
     N_("Cursor Right") },
   { GDK_Right, GDK_SHIFT_MASK,
-    "key-right-shift",
+    "cursor-right-shift",
     N_("Cursor Right") },
   { GDK_Right, 0,
-    "key-right",
+    "cursor-right",
     N_("Cursor Right") }
 };
 

Modified: branches/soc-2008-text/app/widgets/gimpcontrollerlist.c
==============================================================================
--- branches/soc-2008-text/app/widgets/gimpcontrollerlist.c	(original)
+++ branches/soc-2008-text/app/widgets/gimpcontrollerlist.c	Wed Aug  6 20:36:18 2008
@@ -348,8 +348,9 @@
   switch (property_id)
     {
     case PROP_GIMP:
-      list->gimp = GIMP (g_value_dup_object (value));
+      list->gimp = g_value_dup_object (value);
       break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;
@@ -369,6 +370,7 @@
     case PROP_GIMP:
       g_value_set_object (value, list->gimp);
       break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;

Modified: branches/soc-2008-text/app/widgets/gimpdasheditor.c
==============================================================================
--- branches/soc-2008-text/app/widgets/gimpdasheditor.c	(original)
+++ branches/soc-2008-text/app/widgets/gimpdasheditor.c	Wed Aug  6 20:36:18 2008
@@ -170,7 +170,7 @@
     case PROP_STROKE_OPTIONS:
       g_return_if_fail (editor->stroke_options == NULL);
 
-      editor->stroke_options = GIMP_STROKE_OPTIONS (g_value_dup_object (value));
+      editor->stroke_options = g_value_dup_object (value);
       g_signal_connect_object (editor->stroke_options, "notify::dash-info",
                                G_CALLBACK (update_segments_from_options),
                                editor, G_CONNECT_SWAPPED);

Modified: branches/soc-2008-text/app/widgets/gimpdock.c
==============================================================================
--- branches/soc-2008-text/app/widgets/gimpdock.c	(original)
+++ branches/soc-2008-text/app/widgets/gimpdock.c	Wed Aug  6 20:36:18 2008
@@ -225,11 +225,13 @@
   switch (property_id)
     {
     case PROP_CONTEXT:
-      dock->context = GIMP_CONTEXT (g_value_dup_object (value));
+      dock->context = g_value_dup_object (value);
       break;
+
     case PROP_DIALOG_FACTORY:
       dock->dialog_factory = g_value_get_object (value);
       break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;
@@ -249,9 +251,11 @@
     case PROP_CONTEXT:
       g_value_set_object (value, dock->context);
       break;
+
     case PROP_DIALOG_FACTORY:
       g_value_set_object (value, dock->dialog_factory);
       break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;

Modified: branches/soc-2008-text/app/widgets/gimpeditor.c
==============================================================================
--- branches/soc-2008-text/app/widgets/gimpeditor.c	(original)
+++ branches/soc-2008-text/app/widgets/gimpeditor.c	Wed Aug  6 20:36:18 2008
@@ -246,23 +246,29 @@
   switch (property_id)
     {
     case PROP_MENU_FACTORY:
-      editor->menu_factory = (GimpMenuFactory *) g_value_dup_object (value);
+      editor->menu_factory = g_value_dup_object (value);
       break;
+
     case PROP_MENU_IDENTIFIER:
       editor->menu_identifier = g_value_dup_string (value);
       break;
+
     case PROP_UI_PATH:
       editor->ui_path = g_value_dup_string (value);
       break;
+
     case PROP_POPUP_DATA:
       editor->popup_data = g_value_get_pointer (value);
       break;
+
     case PROP_SHOW_NAME:
       g_object_set_property (G_OBJECT (editor->name_label), "visible", value);
       break;
+
     case PROP_NAME:
       gimp_editor_set_name (editor, g_value_get_string (value));
       break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;
@@ -282,18 +288,23 @@
     case PROP_MENU_FACTORY:
       g_value_set_object (value, editor->menu_factory);
       break;
+
     case PROP_MENU_IDENTIFIER:
       g_value_set_string (value, editor->menu_identifier);
       break;
+
     case PROP_UI_PATH:
       g_value_set_string (value, editor->ui_path);
       break;
+
     case PROP_POPUP_DATA:
       g_value_set_pointer (value, editor->popup_data);
       break;
+
     case PROP_SHOW_NAME:
       g_object_get_property (G_OBJECT (editor->name_label), "visible", value);
       break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;

Modified: branches/soc-2008-text/app/widgets/gimpgrideditor.c
==============================================================================
--- branches/soc-2008-text/app/widgets/gimpgrideditor.c	(original)
+++ branches/soc-2008-text/app/widgets/gimpgrideditor.c	Wed Aug  6 20:36:18 2008
@@ -126,17 +126,21 @@
   switch (property_id)
     {
     case PROP_GRID:
-      editor->grid = GIMP_GRID (g_value_dup_object (value));
+      editor->grid = g_value_dup_object (value);
       break;
+
     case PROP_CONTEXT:
-      editor->context = GIMP_CONTEXT (g_value_dup_object (value));
+      editor->context = g_value_dup_object (value);
       break;
+
     case PROP_XRESOLUTION:
       editor->xresolution = g_value_get_double (value);
       break;
+
     case PROP_YRESOLUTION:
       editor->yresolution = g_value_get_double (value);
       break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;
@@ -156,15 +160,19 @@
     case PROP_GRID:
       g_value_set_object (value, editor->grid);
       break;
+
     case PROP_CONTEXT:
       g_value_set_object (value, editor->context);
       break;
+
     case PROP_XRESOLUTION:
       g_value_set_double (value, editor->xresolution);
       break;
+
     case PROP_YRESOLUTION:
       g_value_set_double (value, editor->yresolution);
       break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;

Modified: branches/soc-2008-text/app/widgets/gimphelp.c
==============================================================================
--- branches/soc-2008-text/app/widgets/gimphelp.c	(original)
+++ branches/soc-2008-text/app/widgets/gimphelp.c	Wed Aug  6 20:36:18 2008
@@ -47,6 +47,8 @@
 #include "gimphelp-ids.h"
 #include "gimpmessagebox.h"
 #include "gimpmessagedialog.h"
+#include "gimpmessagedialog.h"
+#include "gimpwidgets-utils.c"
 
 #include "gimp-log.h"
 #include "gimp-intl.h"
@@ -66,10 +68,13 @@
 
 /*  local function prototypes  */
 
-static gint       gimp_idle_help          (GimpIdleHelp  *idle_help);
+static gboolean   gimp_idle_help          (GimpIdleHelp  *idle_help);
+static void       gimp_idle_help_free     (GimpIdleHelp  *idle_help);
 
-static gboolean   gimp_help_browser       (Gimp          *gimp);
+static gboolean   gimp_help_browser       (Gimp          *gimp,
+					   GimpProgress  *progress);
 static void       gimp_help_browser_error (Gimp          *gimp,
+					   GimpProgress  *progress,
                                            const gchar   *title,
                                            const gchar   *primary,
                                            const gchar   *text);
@@ -81,11 +86,15 @@
                                            const gchar   *help_locales,
                                            const gchar   *help_id);
 
-static gint       gimp_help_get_help_domains       (Gimp    *gimp,
-                                                    gchar ***domain_names,
-                                                    gchar ***domain_uris);
-static gchar    * gimp_help_get_default_domain_uri (Gimp    *gimp);
-static gchar    * gimp_help_get_locales            (Gimp    *gimp);
+static gint       gimp_help_get_help_domains         (Gimp    *gimp,
+                                                      gchar ***domain_names,
+                                                      gchar ***domain_uris);
+static gchar    * gimp_help_get_default_domain_uri   (Gimp    *gimp);
+static gchar    * gimp_help_get_locales              (Gimp    *gimp);
+
+static gchar    * gimp_help_get_user_manual_basedir  (void);
+
+static void       gimp_help_query_user_manual_online (GimpIdleHelp *idle_help);
 
 
 /*  public functions  */
@@ -118,13 +127,55 @@
       if (help_id && strlen (help_id))
         idle_help->help_id = g_strdup (help_id);
 
+      GIMP_LOG (HELP, "request for help-id '%s' from help-domain '%s'",
+                help_id     ? help_id      : "(null)",
+                help_domain ? help_domain  : "(null)");
+
       g_idle_add ((GSourceFunc) gimp_idle_help, idle_help);
+    }
+}
+
+gboolean
+gimp_help_user_manual_is_installed (Gimp *gimp)
+{
+  gchar    *basedir;
+  gboolean  found = FALSE;
+
+  g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
+
+  /*  if GIMP2_HELP_URI is set, assume that the manual can be found there  */
+  if (g_getenv ("GIMP2_HELP_URI"))
+    return TRUE;
+
+  basedir = gimp_help_get_user_manual_basedir ();
+
+  if (g_file_test (basedir, G_FILE_TEST_IS_DIR))
+    {
+      gchar       *locales = gimp_help_get_locales (gimp);
+      const gchar *s       = locales;
+      const gchar *p;
+
+      for (p = strchr (s, ':'); p && !found; p = strchr (s, ':'))
+        {
+          gchar *locale = g_strndup (s, p - s);
+          gchar *path;
+
+          path = g_build_filename (basedir, locale, "gimp-help.xml", NULL);
+
+          found = g_file_test (path, G_FILE_TEST_IS_REGULAR);
 
-      if (gimp->be_verbose)
-        g_print ("HELP: request for help-id '%s' from help-domain '%s'\n",
-                 help_id     ? help_id      : "(null)",
-                 help_domain ? help_domain  : "(null)");
+          g_free (path);
+          g_free (locale);
+
+          s = p + 1;
+        }
+
+      g_free (locales);
     }
+
+  g_free (basedir);
+
+  return found;
 }
 
 
@@ -136,13 +187,21 @@
   GimpGuiConfig *config         = GIMP_GUI_CONFIG (idle_help->gimp->config);
   const gchar   *procedure_name = NULL;
 
-  GIMP_LOG (HELP, "Domain = '%s', ID = '%s'",
-            idle_help->help_domain ? idle_help->help_domain : "NULL",
-            idle_help->help_id     ? idle_help->help_id     : "NULL");
+  if (! idle_help->help_domain       &&
+      ! config->user_manual_online   &&
+      ! gimp_help_user_manual_is_installed (idle_help->gimp))
+    {
+      /*  The user manual is not installed locally, ask the user
+       *  if the online version should be used instead.
+       */
+      gimp_help_query_user_manual_online (idle_help);
+
+      return FALSE;
+    }
 
   if (config->help_browser == GIMP_HELP_BROWSER_GIMP)
     {
-      if (gimp_help_browser (idle_help->gimp))
+      if (gimp_help_browser (idle_help->gimp, idle_help->progress))
         procedure_name = "extension-gimp-help-browser-temp";
     }
 
@@ -160,17 +219,24 @@
                     idle_help->help_locales,
                     idle_help->help_id);
 
+  gimp_idle_help_free (idle_help);
+
+  return FALSE;
+}
+
+static void
+gimp_idle_help_free (GimpIdleHelp *idle_help)
+{
   g_free (idle_help->help_domain);
   g_free (idle_help->help_locales);
   g_free (idle_help->help_id);
 
   g_slice_free (GimpIdleHelp, idle_help);
-
-  return FALSE;
 }
 
 static gboolean
-gimp_help_browser (Gimp *gimp)
+gimp_help_browser (Gimp         *gimp,
+		   GimpProgress *progress)
 {
   static gboolean  busy = FALSE;
   GimpProcedure   *procedure;
@@ -197,11 +263,13 @@
 
       if (! procedure)
         {
-          gimp_help_browser_error (gimp,
-                                   _("Help browser not found"),
-                                   _("Could not find GIMP help browser."),
+          gimp_help_browser_error (gimp, progress,
+                                   _("Help browser is missing"),
+                                   _("The GIMP help browser is not available."),
                                    _("The GIMP help browser plug-in appears "
-                                     "to be missing from your installation."));
+                                     "to be missing from your installation. "
+				     "You may instead use the web browser "
+				     "for reading the help pages."));
           busy = FALSE;
 
           return FALSE;
@@ -226,7 +294,7 @@
 
       if (error)
         {
-          gimp_message (gimp, NULL, GIMP_MESSAGE_ERROR,
+          gimp_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR,
                         "%s", error->message);
           g_error_free (error);
         }
@@ -238,9 +306,10 @@
 
   if (! procedure)
     {
-      gimp_help_browser_error (gimp,
+      gimp_help_browser_error (gimp, progress,
                                _("Help browser doesn't start"),
-                               _("Could not start the GIMP help browser plug-in."),
+                               _("Could not start the GIMP help browser "
+                                 "plug-in."),
                                NULL);
       busy = FALSE;
 
@@ -253,28 +322,36 @@
 }
 
 static void
-gimp_help_browser_error (Gimp        *gimp,
-                         const gchar *title,
-                         const gchar *primary,
-                         const gchar *text)
+gimp_help_browser_error (Gimp         *gimp,
+			 GimpProgress *progress,
+                         const gchar  *title,
+                         const gchar  *primary,
+                         const gchar  *text)
 {
   GtkWidget *dialog;
 
-  dialog =
-    gimp_message_dialog_new (title, GIMP_STOCK_WARNING,
-                             NULL, 0,
-                             NULL, NULL,
+  dialog = gimp_message_dialog_new (title, GIMP_STOCK_USER_MANUAL,
+				    NULL, 0,
+				    NULL, NULL,
 
-                             GTK_STOCK_CANCEL,              GTK_RESPONSE_CANCEL,
-                             _("Use _web browser instead"), GTK_RESPONSE_OK,
+				    GTK_STOCK_CANCEL,      GTK_RESPONSE_CANCEL,
+				    _("Use _Web Browser"), GTK_RESPONSE_OK,
 
-                             NULL);
+				    NULL);
 
   gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
                                            GTK_RESPONSE_OK,
                                            GTK_RESPONSE_CANCEL,
                                            -1);
 
+  if (progress)
+    {
+      guint32 window = gimp_progress_get_window (progress);
+
+      if (window)
+        gimp_window_set_transient_for (GTK_WINDOW (dialog), window);
+    }
+
   gimp_message_box_set_primary_text (GIMP_MESSAGE_DIALOG (dialog)->box,
                                      primary);
   gimp_message_box_set_text (GIMP_MESSAGE_DIALOG (dialog)->box, text);
@@ -454,7 +531,7 @@
   if (config->user_manual_online)
     return g_strdup (config->user_manual_online_uri);
 
-  dir = g_build_filename (gimp_data_directory (), "help", NULL);
+  dir = gimp_help_get_user_manual_basedir ();
   uri = g_filename_to_uri (dir, NULL, NULL);
   g_free (dir);
 
@@ -471,3 +548,79 @@
 
   return g_strjoinv (":", (gchar **) g_get_language_names ());
 }
+
+static gchar *
+gimp_help_get_user_manual_basedir (void)
+{
+  return g_build_filename (gimp_data_directory (), "help", NULL);
+}
+
+
+static void
+gimp_help_query_online_response (GtkWidget    *dialog,
+                                 gint          response,
+                                 GimpIdleHelp *idle_help)
+{
+  gtk_widget_destroy (dialog);
+
+  if (response == GTK_RESPONSE_ACCEPT)
+    {
+      g_object_set (idle_help->gimp->config,
+                    "user-manual-online", TRUE,
+                    NULL);
+
+      gimp_help_show (idle_help->gimp,
+                      idle_help->progress,
+                      idle_help->help_domain,
+                      idle_help->help_id);
+    }
+
+  gimp_idle_help_free (idle_help);
+}
+
+static void
+gimp_help_query_user_manual_online (GimpIdleHelp *idle_help)
+{
+  GtkWidget *dialog;
+  GtkWidget *button;
+
+  dialog = gimp_message_dialog_new (_("GIMP user manual is missing"),
+                                    GIMP_STOCK_USER_MANUAL,
+                                    NULL, 0, NULL, NULL,
+                                    GTK_STOCK_CANCEL,  GTK_RESPONSE_CANCEL,
+                                    NULL);
+
+  button = gtk_dialog_add_button (GTK_DIALOG (dialog),
+                                  _("_Read Online"), GTK_RESPONSE_ACCEPT);
+  gtk_button_set_image (GTK_BUTTON (button),
+                        gtk_image_new_from_stock (GIMP_STOCK_WEB,
+                                                  GTK_ICON_SIZE_BUTTON));
+
+  gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
+                                           GTK_RESPONSE_ACCEPT,
+                                           GTK_RESPONSE_CANCEL,
+                                           -1);
+  gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
+
+  if (idle_help->progress)
+    {
+      guint32 window = gimp_progress_get_window (idle_help->progress);
+
+      if (window)
+        gimp_window_set_transient_for (GTK_WINDOW (dialog), window);
+    }
+
+  g_signal_connect (dialog, "response",
+                    G_CALLBACK (gimp_help_query_online_response),
+                    idle_help);
+
+  gimp_message_box_set_primary_text (GIMP_MESSAGE_DIALOG (dialog)->box,
+                                     _("The GIMP user manual is not installed "
+                                       "on your computer."));
+  gimp_message_box_set_text (GIMP_MESSAGE_DIALOG (dialog)->box,
+                             _("You may either install the additional help "
+                               "package or change your preferences to use "
+                               "the online version."));
+
+  gtk_widget_show (dialog);
+}

Modified: branches/soc-2008-text/app/widgets/gimphelp.h
==============================================================================
--- branches/soc-2008-text/app/widgets/gimphelp.h	(original)
+++ branches/soc-2008-text/app/widgets/gimphelp.h	Wed Aug  6 20:36:18 2008
@@ -27,10 +27,15 @@
  *
  *  there should be no need to use it directly
  */
-void   gimp_help_show (Gimp         *gimp,
-                       GimpProgress *progress,
-                       const gchar  *help_domain,
-                       const gchar  *help_id);
+void       gimp_help_show (Gimp         *gimp,
+                           GimpProgress *progress,
+                           const gchar  *help_domain,
+                           const gchar  *help_id);
+
+
+/*  checks if the user manual is installed locally
+ */
+gboolean   gimp_help_user_manual_is_installed (Gimp *gimp);
 
 
 #endif /* __GIMP_HELP_H__ */

Modified: branches/soc-2008-text/app/widgets/gimphistogrameditor.c
==============================================================================
--- branches/soc-2008-text/app/widgets/gimphistogrameditor.c	(original)
+++ branches/soc-2008-text/app/widgets/gimphistogrameditor.c	Wed Aug  6 20:36:18 2008
@@ -77,7 +77,7 @@
 
 
 static void
-gimp_histogram_editor_class_init (GimpHistogramEditorClass* klass)
+gimp_histogram_editor_class_init (GimpHistogramEditorClass *klass)
 {
   GimpImageEditorClass *image_editor_class = GIMP_IMAGE_EDITOR_CLASS (klass);
 
@@ -365,6 +365,24 @@
   gimp_histogram_editor_name_update (editor);
 }
 
+static gboolean
+gimp_histogram_editor_validate (GimpHistogramEditor *editor)
+{
+  if (! editor->valid && editor->histogram)
+    {
+      if (editor->drawable)
+        gimp_drawable_calculate_histogram (editor->drawable, editor->histogram);
+      else
+        gimp_histogram_calculate (editor->histogram, NULL, NULL);
+
+      gimp_histogram_editor_info_update (editor);
+
+      editor->valid = TRUE;
+    }
+
+  return editor->valid;
+}
+
 static void
 gimp_histogram_editor_frozen_update (GimpHistogramEditor *editor,
                                      const GParamSpec    *pspec)
@@ -375,10 +393,8 @@
     {
       if (! editor->bg_histogram)
         {
-          editor->bg_histogram = gimp_histogram_new ();
-
-          gimp_drawable_calculate_histogram (editor->drawable,
-                                             editor->bg_histogram);
+          if (gimp_histogram_editor_validate (editor))
+            editor->bg_histogram = gimp_histogram_duplicate (editor->histogram);
 
           gimp_histogram_view_set_background (view, editor->bg_histogram);
         }
@@ -538,17 +554,7 @@
 static gboolean
 gimp_histogram_view_expose (GimpHistogramEditor *editor)
 {
-  if (! editor->valid && editor->histogram)
-    {
-      if (editor->drawable)
-        gimp_drawable_calculate_histogram (editor->drawable, editor->histogram);
-      else
-        gimp_histogram_calculate (editor->histogram, NULL, NULL);
-
-      editor->valid = TRUE;
-
-      gimp_histogram_editor_info_update (editor);
-    }
+  gimp_histogram_editor_validate (editor);
 
   return FALSE;
 }

Modified: branches/soc-2008-text/app/widgets/gimphistogramview.c
==============================================================================
--- branches/soc-2008-text/app/widgets/gimphistogramview.c	(original)
+++ branches/soc-2008-text/app/widgets/gimphistogramview.c	Wed Aug  6 20:36:18 2008
@@ -632,7 +632,7 @@
   if (view->bg_histogram != histogram)
     {
       if (view->bg_histogram)
-        gimp_histogram_ref (view->bg_histogram);
+        gimp_histogram_unref (view->bg_histogram);
 
       view->bg_histogram = histogram;
 

Modified: branches/soc-2008-text/app/widgets/gimpnavigationview.c
==============================================================================
--- branches/soc-2008-text/app/widgets/gimpnavigationview.c	(original)
+++ branches/soc-2008-text/app/widgets/gimpnavigationview.c	Wed Aug  6 20:36:18 2008
@@ -50,6 +50,30 @@
 };
 
 
+struct _GimpNavigationView
+{
+  GimpView     parent_instance;
+
+  /*  values in image coordinates  */
+  gdouble      x;
+  gdouble      y;
+  gdouble      width;
+  gdouble      height;
+
+  /*  values in view coordinates  */
+  gint         p_x;
+  gint         p_y;
+  gint         p_width;
+  gint         p_height;
+
+  gint         motion_offset_x;
+  gint         motion_offset_y;
+  gboolean     has_grab;
+
+  GdkGC       *gc;
+};
+
+
 static void     gimp_navigation_view_realize        (GtkWidget      *widget);
 static void     gimp_navigation_view_unrealize      (GtkWidget      *widget);
 static void     gimp_navigation_view_size_allocate  (GtkWidget      *widget,
@@ -90,8 +114,10 @@
                   G_SIGNAL_RUN_FIRST,
                   G_STRUCT_OFFSET (GimpNavigationViewClass, marker_changed),
                   NULL, NULL,
-                  gimp_marshal_VOID__DOUBLE_DOUBLE,
-                  G_TYPE_NONE, 2,
+                  gimp_marshal_VOID__DOUBLE_DOUBLE_DOUBLE_DOUBLE,
+                  G_TYPE_NONE, 4,
+                  G_TYPE_DOUBLE,
+                  G_TYPE_DOUBLE,
                   G_TYPE_DOUBLE,
                   G_TYPE_DOUBLE);
 
@@ -133,7 +159,6 @@
 
   gtk_widget_add_events (GTK_WIDGET (view), (GDK_POINTER_MOTION_MASK |
                                              GDK_KEY_PRESS_MASK));
-
   view->x               = 0.0;
   view->y               = 0.0;
   view->width           = 0.0;
@@ -239,7 +264,8 @@
   x = tx * ratiox;
   y = ty * ratioy;
 
-  g_signal_emit (view, view_signals[MARKER_CHANGED], 0, x, y);
+  g_signal_emit (view, view_signals[MARKER_CHANGED], 0,
+                 x, y, nav_view->width, nav_view->height);
 }
 
 void
@@ -572,3 +598,29 @@
   if (GTK_WIDGET_DRAWABLE (view))
     gimp_navigation_view_draw_marker (nav_view, NULL);
 }
+
+void
+gimp_navigation_view_set_motion_offset (GimpNavigationView *view,
+                                        gint                motion_offset_x,
+                                        gint                motion_offset_y)
+{
+  g_return_if_fail (GIMP_IS_NAVIGATION_VIEW (view));
+
+  view->motion_offset_x = motion_offset_x;
+  view->motion_offset_y = motion_offset_y;
+}
+
+void
+gimp_navigation_view_get_local_marker (GimpNavigationView *view,
+                                       gint               *x,
+                                       gint               *y,
+                                       gint               *width,
+                                       gint               *height)
+{
+  g_return_if_fail (GIMP_IS_NAVIGATION_VIEW (view));
+
+  if (x)      *x      = view->p_x;
+  if (y)      *y      = view->p_y;
+  if (width)  *width  = view->p_width;
+  if (height) *height = view->p_height;
+}

Modified: branches/soc-2008-text/app/widgets/gimpnavigationview.h
==============================================================================
--- branches/soc-2008-text/app/widgets/gimpnavigationview.h	(original)
+++ branches/soc-2008-text/app/widgets/gimpnavigationview.h	Wed Aug  6 20:36:18 2008
@@ -38,29 +38,6 @@
 
 typedef struct _GimpNavigationViewClass  GimpNavigationViewClass;
 
-struct _GimpNavigationView
-{
-  GimpView     parent_instance;
-
-  /*  values in image coordinates  */
-  gdouble      x;
-  gdouble      y;
-  gdouble      width;
-  gdouble      height;
-
-  /*  values in view coordinates  */
-  gint         p_x;
-  gint         p_y;
-  gint         p_width;
-  gint         p_height;
-
-  gint         motion_offset_x;
-  gint         motion_offset_y;
-  gboolean     has_grab;
-
-  GdkGC       *gc;
-};
-
 struct _GimpNavigationViewClass
 {
   GimpViewClass  parent_class;
@@ -82,6 +59,16 @@
                                            gdouble             y,
                                            gdouble             width,
                                            gdouble             height);
+void    gimp_navigation_view_set_motion_offset
+                                          (GimpNavigationView *view,
+                                           gint                motion_offset_x,
+                                           gint                motion_offset_y);
+void    gimp_navigation_view_get_local_marker
+                                          (GimpNavigationView *view,
+                                           gint               *x,
+                                           gint               *y,
+                                           gint               *width,
+                                           gint               *height);
 void    gimp_navigation_view_grab_pointer (GimpNavigationView *view);
 
 

Modified: branches/soc-2008-text/app/widgets/gimppdbdialog.c
==============================================================================
--- branches/soc-2008-text/app/widgets/gimppdbdialog.c	(original)
+++ branches/soc-2008-text/app/widgets/gimppdbdialog.c	Wed Aug  6 20:36:18 2008
@@ -242,11 +242,11 @@
   switch (property_id)
     {
     case PROP_PDB:
-      dialog->pdb = GIMP_PDB (g_value_dup_object (value));
+      dialog->pdb = g_value_dup_object (value);
       break;
 
     case PROP_CONTEXT:
-      dialog->caller_context = GIMP_CONTEXT (g_value_dup_object (value));
+      dialog->caller_context = g_value_dup_object (value);
       break;
 
     case PROP_SELECT_TYPE:
@@ -265,7 +265,7 @@
       break;
 
     case PROP_MENU_FACTORY:
-      dialog->menu_factory = (GimpMenuFactory *) g_value_dup_object (value);
+      dialog->menu_factory = g_value_dup_object (value);
       break;
 
     default:

Modified: branches/soc-2008-text/app/widgets/gimppluginaction.c
==============================================================================
--- branches/soc-2008-text/app/widgets/gimppluginaction.c	(original)
+++ branches/soc-2008-text/app/widgets/gimppluginaction.c	Wed Aug  6 20:36:18 2008
@@ -150,7 +150,7 @@
     case PROP_PROCEDURE:
       if (action->procedure)
         g_object_unref (action->procedure);
-      action->procedure = GIMP_PLUG_IN_PROCEDURE (g_value_dup_object (value));
+      action->procedure = g_value_dup_object (value);
       break;
 
     default:

Modified: branches/soc-2008-text/app/widgets/gimpsessioninfo-aux.c
==============================================================================
--- branches/soc-2008-text/app/widgets/gimpsessioninfo-aux.c	(original)
+++ branches/soc-2008-text/app/widgets/gimpsessioninfo-aux.c	Wed Aug  6 20:36:18 2008
@@ -100,6 +100,7 @@
             }
 
           g_value_unset (&value);
+          g_string_free (str, TRUE);
         }
       else
         {

Modified: branches/soc-2008-text/app/widgets/gimpsessioninfo.c
==============================================================================
--- branches/soc-2008-text/app/widgets/gimpsessioninfo.c	(original)
+++ branches/soc-2008-text/app/widgets/gimpsessioninfo.c	Wed Aug  6 20:36:18 2008
@@ -477,13 +477,21 @@
 
   if (info->widget->window)
     {
-      gdk_window_get_root_origin (info->widget->window, &info->x, &info->y);
+      gint x, y;
+
+      gdk_window_get_root_origin (info->widget->window, &x, &y);
+
+      /* Don't write negative values to the sessionrc, they are
+       * interpreted as relative to the right, respective bottom edge
+       * of the screen.
+       */
+      info->x = MAX (0, x);
+      info->y = MAX (0, y);
 
       if (! info->toplevel_entry || info->toplevel_entry->remember_size)
         {
           gdk_drawable_get_size (GDK_DRAWABLE (info->widget->window),
-                                 &info->width,
-                                 &info->height);
+                                 &info->width, &info->height);
         }
       else
         {

Modified: branches/soc-2008-text/app/widgets/gimpstrokeeditor.c
==============================================================================
--- branches/soc-2008-text/app/widgets/gimpstrokeeditor.c	(original)
+++ branches/soc-2008-text/app/widgets/gimpstrokeeditor.c	Wed Aug  6 20:36:18 2008
@@ -113,7 +113,7 @@
     case PROP_OPTIONS:
       if (editor->options)
         g_object_unref (editor->options);
-      editor->options = GIMP_STROKE_OPTIONS (g_value_dup_object (value));
+      editor->options = g_value_dup_object (value);
       break;
 
     case PROP_RESOLUTION:

Modified: branches/soc-2008-text/app/widgets/gimptemplateeditor.c
==============================================================================
--- branches/soc-2008-text/app/widgets/gimptemplateeditor.c	(original)
+++ branches/soc-2008-text/app/widgets/gimptemplateeditor.c	Wed Aug  6 20:36:18 2008
@@ -437,8 +437,9 @@
   switch (property_id)
     {
     case PROP_TEMPLATE:
-      editor->template = GIMP_TEMPLATE (g_value_dup_object (value));
+      editor->template = g_value_dup_object (value);
       break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;
@@ -458,6 +459,7 @@
     case PROP_TEMPLATE:
       g_value_set_object (value, editor->template);
       break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;

Modified: branches/soc-2008-text/app/widgets/gimpviewrendererimagefile.c
==============================================================================
--- branches/soc-2008-text/app/widgets/gimpviewrendererimagefile.c	(original)
+++ branches/soc-2008-text/app/widgets/gimpviewrendererimagefile.c	Wed Aug  6 20:36:18 2008
@@ -169,18 +169,24 @@
     {
       GFile       *file;
       GFileInfo   *file_info;
-      GIcon       *icon;
       GtkIconInfo *info;
 
       file = g_file_new_for_uri (gimp_object_get_name (GIMP_OBJECT (imagefile)));
       file_info = g_file_query_info (file, "standard::icon", 0, NULL, NULL);
-      icon = g_file_info_get_icon (file_info);
 
-      info = gtk_icon_theme_lookup_by_gicon (icon_theme, icon, size, 0);
-      pixbuf = gtk_icon_info_load_icon (info, NULL);
+      if (file_info)
+        {
+          GIcon *icon;
+
+          icon = g_file_info_get_icon (file_info);
+
+          info = gtk_icon_theme_lookup_by_gicon (icon_theme, icon, size, 0);
+          pixbuf = gtk_icon_info_load_icon (info, NULL);
+
+          g_object_unref (file_info);
+        }
 
       g_object_unref (file);
-      g_object_unref (file_info);
     }
 #endif
 

Modified: branches/soc-2008-text/app/widgets/gtkscalebutton.c
==============================================================================
--- branches/soc-2008-text/app/widgets/gtkscalebutton.c	(original)
+++ branches/soc-2008-text/app/widgets/gtkscalebutton.c	Wed Aug  6 20:36:18 2008
@@ -1294,6 +1294,10 @@
  * Scale stuff.
  */
 
+static GType gtk_scale_button_hscale_get_type (void) G_GNUC_CONST;
+static GType gtk_scale_button_vscale_get_type (void) G_GNUC_CONST;
+
+
 #define GTK_TYPE_SCALE_BUTTON_VSCALE    (gtk_scale_button_vscale_get_type ())
 #define GTK_SCALE_BUTTON_VSCALE(obj)    (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SCALE_BUTTON_VSCALE, GtkScaleButtonVScale))
 #define GTK_IS_SCALE_BUTTON_VSCALE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SCALE_BUTTON_VSCALE))

Modified: branches/soc-2008-text/app/xcf/xcf-load.c
==============================================================================
--- branches/soc-2008-text/app/xcf/xcf-load.c	(original)
+++ branches/soc-2008-text/app/xcf/xcf-load.c	Wed Aug  6 20:36:18 2008
@@ -1735,7 +1735,7 @@
       guint32      num_axes;
       guint32      num_control_points;
       guint32      type;
-      gfloat       coords[6] = GIMP_COORDS_DEFAULT_VALUES;
+      gfloat       coords[7] = GIMP_COORDS_DEFAULT_VALUES;
       GimpStroke  *stroke;
       gint         j;
 

Modified: branches/soc-2008-text/configure.in
==============================================================================
--- branches/soc-2008-text/configure.in	(original)
+++ branches/soc-2008-text/configure.in	Wed Aug  6 20:36:18 2008
@@ -8,7 +8,7 @@
 
 m4_define([gimp_major_version], [2])
 m4_define([gimp_minor_version], [5])
-m4_define([gimp_micro_version], [2])
+m4_define([gimp_micro_version], [3])
 m4_define([gimp_real_version],
           [gimp_major_version.gimp_minor_version.gimp_micro_version])
 m4_define([gimp_version], [gimp_real_version])
@@ -402,10 +402,10 @@
 # Internationalisation
 ######################
 
-# Note to translators: you MUST have .po files in all 5 directories: po,
-# po-libgimp, po-plug-ins, po-python and po-script-fu before adding your
-# language code to ALL_LINGUAS.
-ALL_LINGUAS="ar bg ca ca valencia cs da de dz el en_CA en_GB eo es et eu fa fi fr ga gl gu he hu hr id is it ja km ko lt mk ms nb ne nl nn oc pa pl pt pt_BR ro ru rw sk sl sr sr Latn sv tr tt uk vi xh yi zh_CN zh_TW"
+# Note to translators: you MUST have .po files in all 6 directories:
+# po, po-libgimp, po-plug-ins, po-python, po-script-fu and po-tips
+# before adding your language code to ALL_LINGUAS.
+ALL_LINGUAS="ar be bg ca ca valencia cs da de dz el en_CA en_GB eo es et eu fa fi fr ga gl gu he hu hr id is it ja km ko lt mk ms nb ne nl nn oc pa pl pt pt_BR ro ru rw sk sl sr sr Latn sv tr tt uk vi xh yi zh_CN zh_TW"
 
 IT_PROG_INTLTOOL(0.35.5)
 AM_GLIB_GNU_GETTEXT
@@ -432,7 +432,7 @@
 
 
 PKG_CHECK_MODULES(BABL, babl >= babl_required_version, :,
-  AC_MSG_ERROR([Test for BABL failed. Please get it from http://gegl.org/]))
+  AC_MSG_ERROR([Test for babl failed. Please get it from http://gegl.org/]))
 
 
 PKG_CHECK_MODULES(GEGL, gegl >= gegl_required_version, :,
@@ -898,16 +898,25 @@
 	    [Define to 1 to enable support for multiple processors.])
 fi
 
+###################################################
+# gimp-remote is obsolete, but can still be enabled
+###################################################
+
+AC_ARG_ENABLE(gimp-remote,
+	      [  --enable-gimp-remote    build gimp-remote utility (default=no)],
+	      enable_gimp_remote=yes,
+	      enable_gimp_remote="no (not enabled)")
+
 
 ################################
 # Some plug-ins are X11 specific
 ################################
 
-GIMP_COMMAND='gimp-gimp_app_version'
-
 # Check if building for GTK+-X11
 gdk_target=`$PKG_CONFIG --variable=target gtk+-2.0`
 
+have_libxmu="no (building for $gdk_target)"
+
 if test "$gdk_target" = x11; then
 
    # doc-shooter is X11 specific
@@ -922,16 +931,13 @@
    LDFLAGS="$LDFLAGS $X_LIBS"
 
    # Test for Xmu
-   enable_gimp_remote=yes
    if test -z "$LIBXMU"; then
       AC_CHECK_LIB(Xmu, XmuClientWindow,
         [AC_CHECK_HEADERS(X11/Xmu/WinUtil.h,
-          GIMP_REMOTE='gimp-remote-gimp_app_version$(EXEEXT)';
-	  GIMP_COMMAND='gimp-remote-gimp_app_version'
 	  have_libxmu=yes
           LIBXMU="$X_LIBS $X_PRE_LIBS -lX11 -lXmu -lXt",
-	  [enable_gimp_remote="no (XMU header file not found)"],[#include <gdk/gdkx.h>])],
-	[enable_gimp_remote="no (XMU library not found)"], -lXt -lX11)
+	  [have_libxmu="no (XMU header file not found)"],[#include <gdk/gdkx.h>])],
+	[have_libxmu="no (XMU library not found)"], -lXt -lX11)
       LIBSCREENSHOT="$LIBXMU"
    fi
 
@@ -950,9 +956,6 @@
                 [Define to 1 to if the XFIXES X extension is available])
       LIBSCREENSHOT="$LIBSCREENSHOT $XFIXES_LIBS",
       true)
-
-else
-   enable_gimp_remote="no (building for $gdk_target)"
 fi
 
 AC_SUBST(LIBXMU)
@@ -960,7 +963,21 @@
 
 AC_SUBST(DOC_SHOOTER)
 
+
+if test x"$enable_gimp_remote" = xyes; then
+  enable_gimp_remote="$have_libxmu"
+fi
+
+if test x"$enable_gimp_remote" = xyes; then
+  GIMP_REMOTE='gimp-remote-gimp_app_version$(EXEEXT)'
+  GIMP_REMOTE_MANPAGE='gimp-remote-gimp_app_version.1'
+  GIMP_COMMAND='gimp-remote-gimp_app_version'
+else
+  GIMP_COMMAND='gimp-gimp_app_version'
+fi
+
 AC_SUBST(GIMP_REMOTE)
+AC_SUBST(GIMP_REMOTE_MANPAGE)
 AC_SUBST(GIMP_COMMAND)
 
 
@@ -1312,8 +1329,6 @@
 AM_CONDITIONAL(HAVE_GVFS, test "x$with_gvfs" != xno)
 
 
-gnome_vfs_modules="gnome-vfs-2.0 >= gnome_vfs_required_version"
-
 AC_ARG_WITH(gnomevfs, [  --without-gnomevfs      build without gnomevfs support])
 
 have_gnomeui="no (disabled)"
@@ -1322,6 +1337,8 @@
 
 if test "x$with_gnomevfs" != xno; then
 
+gnome_vfs_modules="gnome-vfs-2.0 >= gnome_vfs_required_version"
+
 if $PKG_CONFIG --atleast-version=gnomeui_required_version libgnomeui-2.0; then
   have_gnomeui=yes
   gnome_vfs_modules="$gnome_vfs_modules libgnomeui-2.0"
@@ -1336,7 +1353,7 @@
   have_gnome_keyring="no (gnome-keyring-1 not found)"
 fi
 
-PKG_CHECK_MODULES(URI_GNOME_VFS, $gnome_vfs_modules,
+PKG_CHECK_MODULES(GNOME_VFS, $gnome_vfs_modules,
   have_gnomevfs=yes,
   have_gnomevfs="no (gnome-vfs-2.0 not found)")
 
@@ -1345,15 +1362,13 @@
 AM_CONDITIONAL(HAVE_GNOMEVFS, test "x$have_gnomevfs" = xyes)
 
 
-libcurl_modules="libcurl >= libcurl_required_version"
-
 AC_ARG_WITH(libcurl,  [  --without-libcurl       build without curl support])
 
 have_libcurl="no (disabled)"
 
 if test "x$with_libcurl" != xno; then
 
-PKG_CHECK_MODULES(URI_LIBCURL, $libcurl_modules,
+PKG_CHECK_MODULES(CURL, libcurl >= libcurl_required_version,
   have_libcurl=yes,
   have_libcurl="no (libcurl not found)")
 

Modified: branches/soc-2008-text/data/images/gimp-splash.png
==============================================================================
Binary files. No diff available.

Modified: branches/soc-2008-text/data/tips/gimp-tips.dtd
==============================================================================
--- branches/soc-2008-text/data/tips/gimp-tips.dtd	(original)
+++ branches/soc-2008-text/data/tips/gimp-tips.dtd	Wed Aug  6 20:36:18 2008
@@ -4,6 +4,7 @@
 
 <!ELEMENT tip (thetip+)>
 <!ATTLIST tip level (start|beginner|intermediate|advanced) #REQUIRED>
+<!ATTLIST tip help CDATA #IMPLIED>
 
 <!ENTITY % markup "(#PCDATA|b|big|tt)*">
 

Modified: branches/soc-2008-text/data/tips/gimp-tips.xml.in
==============================================================================
--- branches/soc-2008-text/data/tips/gimp-tips.xml.in	(original)
+++ branches/soc-2008-text/data/tips/gimp-tips.xml.in	Wed Aug  6 20:36:18 2008
@@ -20,20 +20,20 @@
       pressing the F1 key at any time.  This also works inside the menus.
     </_thetip>
   </tip>
-  <tip level="beginner">
+  <tip level="beginner" help="gimp-layer-dialog">
     <_thetip>
       GIMP uses layers to let you organize your image.  Think of them
       as a stack of slides or filters, such that looking through them you
       see a composite of their contents.
     </_thetip>
   </tip>
-  <tip level="beginner">
+  <tip level="beginner" help="gimp-layer-menu">
     <_thetip>
       You can perform many layer operations by right-clicking on the text
       label of a layer in the Layers dialog.
     </_thetip>
   </tip>
-  <tip level="beginner">
+  <tip level="beginner" help="gimp-file-save">
     <_thetip>
       When you save an image to work on it again later, try using XCF,
       GIMP's native file format (use the file extension <tt>.xcf</tt>).
@@ -41,14 +41,14 @@
       Once a project is completed, you can save it as JPEG, PNG, GIF, ...
     </_thetip>
   </tip>
-  <tip level="beginner">
+  <tip level="beginner" help="gimp-image-flatten">
     <_thetip>
       Most plug-ins work on the current layer of the current image.  In
       some cases, you will have to merge all layers (ImageâFlatten Image)
       if you want the plug-in to work on the whole image.
     </_thetip>
   </tip>
-  <tip level="beginner">
+  <tip level="beginner" help="gimp-layer-alpha-add">
     <_thetip>
       If a layer's name in the Layers dialog is displayed in <b>bold</b>,
       this layer doesn't have an alpha-channel. You can add an alpha-channel
@@ -91,14 +91,14 @@
       (or optionally hold <tt>Spacebar</tt> while you move the mouse).
     </_thetip>
   </tip>
-  <tip level="intermediate">
+  <tip level="intermediate" help="gimp-concepts-image-grid">
     <_thetip>
       Click and drag on a ruler to place a guide on an image.  All
       dragged selections will snap to the guides.  You can remove
       guides by dragging them off the image with the Move tool.
     </_thetip>
   </tip>
-  <tip level="intermediate">
+  <tip level="intermediate" help="gimp-file-new">
     <_thetip>
       You can drag a layer from the Layers dialog and drop it onto the
       toolbox.  This will create a new image containing only that layer.
@@ -128,28 +128,28 @@
       current one.
     </_thetip>
   </tip>
-  <tip level="intermediate">
+  <tip level="intermediate" help="gimp-selection-stroke">
     <_thetip>
       You can draw simple squares or circles using EditâStroke Selection.
       It strokes the edge of your current selection. More complex shapes
       can be drawn using the Path tool or with FiltersâRenderâGfig.
     </_thetip>
   </tip>
-  <tip level="intermediate">
+  <tip level="intermediate" help="gimp-path-stroke">
     <_thetip>
       If you stroke a path (EditâStroke Path), the paint tools can
       be used with their current settings.  You can use the Paintbrush in
       gradient mode or even the Eraser or the Smudge tool.
     </_thetip>
   </tip>
-  <tip level="intermediate">
+  <tip level="intermediate" help="gimp-using-paths">
     <_thetip>
       You can create and edit complex selections using the Path tool.
       The Paths dialog allows you to work on multiple paths and to convert
       them to selections.
     </_thetip>
   </tip>
-  <tip level="intermediate">
+  <tip level="intermediate" help="gimp-using-quickmask">
     <_thetip>
       You can use the paint tools to change the selection.  Click on the
       &quot;Quick Mask&quot; button at the bottom left of an image window.
@@ -157,7 +157,7 @@
       again to convert it back to a normal selection.
     </_thetip>
   </tip>
-  <tip level="intermediate">
+  <tip level="intermediate" help="gimp-channel-dialog">
     <_thetip>
       You can save a selection to a channel (SelectâSave to Channel) and
       then modify this channel with any paint tools.  Using the buttons in
@@ -208,7 +208,7 @@
       an image (if your window manager doesn't trap those keys...).
     </_thetip>
   </tip>
-  <tip level="advanced">
+  <tip level="advanced" help="gimp-tool-bucket-fill">
     <_thetip>
       <tt>Ctrl</tt>-click with the Bucket Fill tool to have it use
       the background color instead of the foreground color.
@@ -216,7 +216,7 @@
       sets the background color instead of the foreground color.
     </_thetip>
   </tip>
-  <tip level="advanced">
+  <tip level="advanced" help="gimp-tools-transform">
     <_thetip>
       <tt>Ctrl</tt>-drag with the Rotate tool will constrain the
       rotation to 15 degree angles.
@@ -224,15 +224,6 @@
   </tip>
   <tip level="advanced">
     <_thetip>
-      To create a circle-shaped selection, hold <tt>Shift</tt> while
-      doing an ellipse select. To place a circle precisely, drag
-      horizontal and vertical guides tangent to the circle you want to
-      select, place your cursor at the intersection of the guides, and
-      the resulting selection will just touch the guides.
-    </_thetip>
-  </tip>
-  <tip level="advanced">
-    <_thetip>
       If some of your scanned photos do not look colorful enough, you
       can easily improve their tonal range with the &quot;Auto&quot;
       button in the Levels tool (ColorsâLevels).  If there are any

Modified: branches/soc-2008-text/devel-docs/libgimp/libgimp-sections.txt
==============================================================================
--- branches/soc-2008-text/devel-docs/libgimp/libgimp-sections.txt	(original)
+++ branches/soc-2008-text/devel-docs/libgimp/libgimp-sections.txt	Wed Aug  6 20:36:18 2008
@@ -636,6 +636,7 @@
 gimp_palette_rename
 gimp_palette_delete
 gimp_palette_get_info
+gimp_palette_get_colors
 gimp_palette_get_columns
 gimp_palette_set_columns
 gimp_palette_add_entry
@@ -930,6 +931,7 @@
 <FILE>gimpvectors</FILE>
 gimp_vectors_new
 gimp_vectors_new_from_text_layer
+gimp_vectors_copy
 gimp_vectors_is_valid
 gimp_vectors_get_strokes
 gimp_vectors_get_image

Modified: branches/soc-2008-text/devel-docs/libgimp/tmpl/gimppalette.sgml
==============================================================================
--- branches/soc-2008-text/devel-docs/libgimp/tmpl/gimppalette.sgml	(original)
+++ branches/soc-2008-text/devel-docs/libgimp/tmpl/gimppalette.sgml	Wed Aug  6 20:36:18 2008
@@ -64,6 +64,16 @@
 @Returns: 
 
 
+<!-- ##### FUNCTION gimp_palette_get_colors ##### -->
+<para>
+
+</para>
+
+ name: 
+ num_colors: 
+ Returns: 
+
+
 <!-- ##### FUNCTION gimp_palette_get_columns ##### -->
 <para>
 

Modified: branches/soc-2008-text/devel-docs/libgimp/tmpl/gimpvectors.sgml
==============================================================================
--- branches/soc-2008-text/devel-docs/libgimp/tmpl/gimpvectors.sgml	(original)
+++ branches/soc-2008-text/devel-docs/libgimp/tmpl/gimpvectors.sgml	Wed Aug  6 20:36:18 2008
@@ -37,6 +37,15 @@
 @Returns: 
 
 
+<!-- ##### FUNCTION gimp_vectors_copy ##### -->
+<para>
+
+</para>
+
+ vectors_ID: 
+ Returns: 
+
+
 <!-- ##### FUNCTION gimp_vectors_is_valid ##### -->
 <para>
 

Modified: branches/soc-2008-text/devel-docs/libgimpbase/tmpl/gimpbaseenums.sgml
==============================================================================
--- branches/soc-2008-text/devel-docs/libgimpbase/tmpl/gimpbaseenums.sgml	(original)
+++ branches/soc-2008-text/devel-docs/libgimpbase/tmpl/gimpbaseenums.sgml	Wed Aug  6 20:36:18 2008
@@ -232,12 +232,13 @@
 @GIMP_PDB_CHANNEL: 
 @GIMP_PDB_DRAWABLE: 
 @GIMP_PDB_SELECTION: 
- GIMP_PDB_BOUNDARY: 
+ GIMP_PDB_COLORARRAY: 
 @GIMP_PDB_VECTORS: 
 @GIMP_PDB_PARASITE: 
 @GIMP_PDB_STATUS: 
 @GIMP_PDB_END: 
 @GIMP_PDB_PATH: 
+ GIMP_PDB_BOUNDARY: 
 
 <!-- ##### ENUM GimpPDBProcType ##### -->
 <para>

Modified: branches/soc-2008-text/devel-docs/tools/widgets.c
==============================================================================
--- branches/soc-2008-text/devel-docs/tools/widgets.c	(original)
+++ branches/soc-2008-text/devel-docs/tools/widgets.c	Wed Aug  6 20:36:18 2008
@@ -168,7 +168,7 @@
   gtk_box_pack_start (GTK_BOX (GIMP_BROWSER (browser)->left_vbox),
                       gtk_label_new ("TreeView goes here"), TRUE, TRUE, 0);
   gtk_container_add (GTK_CONTAINER (align), browser);
-  gtk_box_pack_start_defaults (GTK_BOX (vbox), align);
+  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Browser"), FALSE, FALSE, 0);
 
@@ -202,7 +202,7 @@
 
   vbox = gtk_vbox_new (FALSE, 6);
   align = gtk_alignment_new (0.5, 0.5, 0.0, 0.8);
-  gtk_box_pack_start_defaults (GTK_BOX (vbox), align);
+  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
   table = gtk_table_new (2, 5, FALSE);
   gtk_table_set_row_spacings (GTK_TABLE (table), 6);
   gtk_table_set_col_spacings (GTK_TABLE (table), 6);
@@ -231,7 +231,8 @@
   gtk_table_attach (GTK_TABLE (table), chain, 4,5, 0,2,
                     GTK_SHRINK | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
 
-  gtk_box_pack_end_defaults (GTK_BOX (vbox), gtk_label_new ("Chain Button"));
+  gtk_box_pack_end (GTK_BOX (vbox), gtk_label_new ("Chain Button"),
+                    TRUE, TRUE, 0);
 
   return new_widget_info ("gimp-chain-button", vbox, MEDIUM);
 }
@@ -252,7 +253,7 @@
   gimp_color_area_set_draw_border (GIMP_COLOR_AREA (area), TRUE);
   gtk_widget_set_size_request (area, -1, 25);
   gtk_container_add (GTK_CONTAINER (align), area);
-  gtk_box_pack_start_defaults (GTK_BOX (vbox), align);
+  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Color Area"), FALSE, FALSE, 0);
 
@@ -275,7 +276,7 @@
                                    80, 20, &color,
                                    GIMP_COLOR_AREA_SMALL_CHECKS);
   gtk_container_add (GTK_CONTAINER (align), button);
-  gtk_box_pack_start_defaults (GTK_BOX (vbox), align);
+  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Color Button"), FALSE, FALSE, 0);
 
@@ -297,7 +298,7 @@
   entry = gimp_color_hex_entry_new ();
   gimp_color_hex_entry_set_color (GIMP_COLOR_HEX_ENTRY (entry), &color);
   gtk_container_add (GTK_CONTAINER (align), entry);
-  gtk_box_pack_start_defaults (GTK_BOX (vbox), align);
+  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Color Hex Entry"), FALSE, FALSE, 0);
 
@@ -318,7 +319,7 @@
                                     NULL, "sRGB");
   gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
   gtk_container_add (GTK_CONTAINER (align), combo);
-  gtk_box_pack_start_defaults (GTK_BOX (vbox), align);
+  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Color Profile Combo Box"),
                       FALSE, FALSE, 0);
@@ -345,7 +346,7 @@
   gimp_color_scale_set_color (GIMP_COLOR_SCALE (scale), &rgb, &hsv);
   gtk_range_set_value (GTK_RANGE (scale), 40);
   gtk_container_add (GTK_CONTAINER (align), scale);
-  gtk_box_pack_start_defaults (GTK_BOX (vbox), align);
+  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Color Scale"), FALSE, FALSE, 0);
 
@@ -369,7 +370,7 @@
   gimp_color_selection_set_color  (GIMP_COLOR_SELECTION (selection), &color);
   gtk_widget_set_size_request (selection, 400, -1);
   gtk_container_add (GTK_CONTAINER (align), selection);
-  gtk_box_pack_start_defaults (GTK_BOX (vbox), align);
+  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Color Selection"), FALSE, FALSE, 0);
 
@@ -412,7 +413,7 @@
   combo = gimp_enum_combo_box_new (GIMP_TYPE_CHANNEL_TYPE);
   gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo), GIMP_BLUE_CHANNEL);
   gtk_container_add (GTK_CONTAINER (align), combo);
-  gtk_box_pack_start_defaults (GTK_BOX (vbox), align);
+  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Enum Combo Box"), FALSE, FALSE, 0);
 
@@ -430,7 +431,7 @@
   align = gtk_alignment_new (0.5, 0.5, 0.5, 0.0);
   label = gimp_enum_label_new (GIMP_TYPE_IMAGE_BASE_TYPE, GIMP_RGB);
   gtk_container_add (GTK_CONTAINER (align), label);
-  gtk_box_pack_start_defaults (GTK_BOX (vbox), align);
+  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Enum Label"), FALSE, FALSE, 0);
 
@@ -450,7 +451,7 @@
                                "wilber.png",
                                FALSE, TRUE);
   gtk_container_add (GTK_CONTAINER (align), entry);
-  gtk_box_pack_start_defaults (GTK_BOX (vbox), align);
+  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("File Entry"), FALSE, FALSE, 0);
 
@@ -491,7 +492,7 @@
   entry =  gimp_number_pair_entry_new (":/", TRUE, 0.001, GIMP_MAX_IMAGE_SIZE);
   gimp_number_pair_entry_set_values (GIMP_NUMBER_PAIR_ENTRY (entry), 4, 3);
   gtk_container_add (GTK_CONTAINER (align), entry);
-  gtk_box_pack_start_defaults (GTK_BOX (vbox), align);
+  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Number Pair Entry"), FALSE, FALSE, 0);
 
@@ -517,7 +518,7 @@
   gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo), 1);
 
   gtk_container_add (GTK_CONTAINER (align), combo);
-  gtk_box_pack_start_defaults (GTK_BOX (vbox), align);
+  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Int Combo Box"), FALSE, FALSE, 0);
 
@@ -536,7 +537,7 @@
   entry = gimp_memsize_entry_new ((3 * 1024 + 512) * 1024,
                                   0, 1024 * 1024 * 1024);
   gtk_container_add (GTK_CONTAINER (align), entry);
-  gtk_box_pack_start_defaults (GTK_BOX (vbox), align);
+  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Memsize Entry"), FALSE, FALSE, 0);
 
@@ -560,7 +561,7 @@
   gimp_offset_area_set_size (GIMP_OFFSET_AREA (area), 180, 160);
   gimp_offset_area_set_offsets (GIMP_OFFSET_AREA (area), 30, 30);
   gtk_container_add (GTK_CONTAINER (frame), area);
-  gtk_box_pack_start_defaults (GTK_BOX (vbox), align);
+  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Offset Area"), FALSE, FALSE, 0);
 
@@ -579,7 +580,7 @@
   gimp_page_selector_set_n_pages (GIMP_PAGE_SELECTOR (selector), 16);
   gimp_page_selector_select_range (GIMP_PAGE_SELECTOR (selector),
                                    "1,3,7-9,12-15");
-  gtk_box_pack_start_defaults (GTK_BOX (vbox), selector);
+  gtk_box_pack_start (GTK_BOX (vbox), selector, TRUE, TRUE, 0);
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Page Selector"), FALSE, FALSE, 0);
 
@@ -600,7 +601,7 @@
   editor = gimp_path_editor_new ("Path Editor", path);
   gtk_widget_set_size_request (editor, -1, 240);
   gtk_container_add (GTK_CONTAINER (align), editor);
-  gtk_box_pack_start_defaults (GTK_BOX (vbox), align);
+  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Path Editor"), FALSE, FALSE, 0);
 
@@ -621,7 +622,7 @@
   align = gtk_alignment_new (0.5, 0.5, 0.5, 1.0);
   button =  gimp_pick_button_new ();
   gtk_container_add (GTK_CONTAINER (align), button);
-  gtk_box_pack_start_defaults (GTK_BOX (vbox), align);
+  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Pick Button"), FALSE, FALSE, 0);
 
@@ -664,7 +665,7 @@
                                gdk_pixbuf_get_width (pixbuf),
                                gdk_pixbuf_get_height (pixbuf));
   g_object_unref (pixbuf);
-  gtk_box_pack_start_defaults (GTK_BOX (vbox), align);
+  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Preview Area"), FALSE, FALSE, 0);
 
@@ -689,7 +690,7 @@
   gimp_string_combo_box_set_active (GIMP_STRING_COMBO_BOX (combo), "Foo");
 
   gtk_container_add (GTK_CONTAINER (align), combo);
-  gtk_box_pack_start_defaults (GTK_BOX (vbox), align);
+  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("String Combo Box"), FALSE, FALSE, 0);
 
@@ -707,7 +708,7 @@
   align = gtk_alignment_new (0.5, 0.5, 0.5, 0.0);
   menu =  gimp_unit_menu_new ("%p", GIMP_UNIT_MM, TRUE, FALSE, FALSE);
   gtk_container_add (GTK_CONTAINER (align), menu);
-  gtk_box_pack_start_defaults (GTK_BOX (vbox), align);
+  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Unit Menu"), FALSE, FALSE, 0);
 

Modified: branches/soc-2008-text/docs/Makefile.am
==============================================================================
--- branches/soc-2008-text/docs/Makefile.am	(original)
+++ branches/soc-2008-text/docs/Makefile.am	Wed Aug  6 20:36:18 2008
@@ -1,6 +1,7 @@
 ## Process this file with automake to produce Makefile.in
 
 EXTRA_DIST = \
+	gimp-remote.1.in		\
 	Wilber.xcf.gz			\
 	Wilber.xcf.gz.README		\
 	Wilber_Construction_Kit.xcf.gz
@@ -8,7 +9,7 @@
 mans = \
 	gimp-$(GIMP_APP_VERSION).1	\
 	gimprc-$(GIMP_APP_VERSION).5	\
-	gimp-remote-$(GIMP_APP_VERSION).1
+	$(GIMP_REMOTE_MANPAGE)
 
 man_MANS = \
 	$(mans)				\

Modified: branches/soc-2008-text/docs/gimp.1.in
==============================================================================
--- branches/soc-2008-text/docs/gimp.1.in	(original)
+++ branches/soc-2008-text/docs/gimp.1.in	Wed Aug  6 20:36:18 2008
@@ -60,6 +60,9 @@
 .B  \-\-help-gtk
 Show GTK+ command\-line options.
 .TP 8
+.B  \-\-help-gegl
+Show GEGL command\-line options.
+.TP 8
 .B \-v, \-\-version
 Output version information and exit. When combined with the \-\-verbose
 option, version information about libraries used by GIMP is shown as well.
@@ -193,7 +196,7 @@
 together with the tool, colors, brush, pattern and gradient
 associated to that device.
 
-\fB$HOME\fP/@gimpdir@/gtkrc - users set of GIMP-specific GTK config
+\fB$HOME\fP/@gimpdir@/gtkrc - users set of GIMP-specific GTK+ config
 settings. Options such as widget color and fonts sizes can be set
 here.
 
@@ -316,7 +319,7 @@
 bugs, please check to see if the bug has already been reported.
 
 When reporting GIMP bugs, it is important to include a reliable way to
-reproduce the bug, version number of GIMP (and probably GTK), OS name
+reproduce the bug, version number of GIMP (and probably GTK+), OS name
 and version, and any relevant hardware specs. If a bug is causing a
 crash, it is very useful if a stack trace can be provided. And of
 course, patches to rectify the bug are even better.
@@ -345,4 +348,3 @@
 .SH "SEE ALSO"
 .BR gimprc (5),
 .BR gimptool (1),
-.BR gimp\-remote (1)

Modified: branches/soc-2008-text/docs/gimprc.5.in
==============================================================================
--- branches/soc-2008-text/docs/gimprc.5.in	(original)
+++ branches/soc-2008-text/docs/gimprc.5.in	Wed Aug  6 20:36:18 2008
@@ -222,11 +222,11 @@
 
 .TP
 (default-grid
-    (style intersections)
+    (style solid)
     (fgcolor (color-rgba 0.000000 0.000000 0.000000 1.000000))
     (bgcolor (color-rgba 1.000000 1.000000 1.000000 1.000000))
-    (xspacing 32.000000)
-    (yspacing 32.000000)
+    (xspacing 10.000000)
+    (yspacing 10.000000)
     (spacing-unit inches)
     (xoffset 0.000000)
     (yoffset 0.000000)

Modified: branches/soc-2008-text/etc/controllerrc
==============================================================================
--- branches/soc-2008-text/etc/controllerrc	(original)
+++ branches/soc-2008-text/etc/controllerrc	Wed Aug  6 20:36:18 2008
@@ -21,22 +21,18 @@
     (debug-events no)
     (controller "GimpControllerKeyboard")
     (mapping
-        (map "key-up"            "view-scroll-up")
-        (map "key-down"          "view-scroll-down")
-        (map "key-left"          "view-scroll-left")
-        (map "key-right"         "view-scroll-right")
-        (map "key-up-shift"      "view-scroll-page-up")
-        (map "key-down-shift"    "view-scroll-page-down")
-        (map "key-left-shift"    "view-scroll-page-left")
-        (map "key-right-shift"   "view-scroll-page-right")
-        (map "key-up-control"    "view-scroll-top-border")
-        (map "key-down-control"  "view-scroll-bottom-border")
-        (map "key-left-control"  "view-scroll-left-border")
-        (map "key-right-control" "view-scroll-right-border")
-        (map "key-up-alt"        "tools-value-1-increase-skip")
-        (map "key-down-alt"      "tools-value-1-decrease-skip")
-        (map "key-left-alt"      "tools-value-1-decrease")
-        (map "key-right-alt"     "tools-value-1-increase")))
+        (map "cursor-up-shift"      "view-scroll-page-up")
+        (map "cursor-down-shift"    "view-scroll-page-down")
+        (map "cursor-left-shift"    "view-scroll-page-left")
+        (map "cursor-right-shift"   "view-scroll-page-right")
+        (map "cursor-up-control"    "view-scroll-top-border")
+        (map "cursor-down-control"  "view-scroll-bottom-border")
+        (map "cursor-left-control"  "view-scroll-left-border")
+        (map "cursor-right-control" "view-scroll-right-border")
+        (map "cursor-up-alt"        "tools-value-1-increase-skip")
+        (map "cursor-down-alt"      "tools-value-1-decrease-skip")
+        (map "cursor-left-alt"      "tools-value-1-decrease")
+        (map "cursor-right-alt"     "tools-value-1-increase")))
 
 # (GimpControllerInfo "Linux Input Example"
 #    (enabled yes)

Modified: branches/soc-2008-text/etc/gimprc
==============================================================================
--- branches/soc-2008-text/etc/gimprc	(original)
+++ branches/soc-2008-text/etc/gimprc	Wed Aug  6 20:36:18 2008
@@ -172,11 +172,11 @@
 # Specify a default image grid.  This is a parameter list.
 # 
 # (default-grid
-#     (style intersections)
+#     (style solid)
 #     (fgcolor (color-rgba 0.000000 0.000000 0.000000 1.000000))
 #     (bgcolor (color-rgba 1.000000 1.000000 1.000000 1.000000))
-#     (xspacing 32.000000)
-#     (yspacing 32.000000)
+#     (xspacing 10.000000)
+#     (yspacing 10.000000)
 #     (spacing-unit inches)
 #     (xoffset 0.000000)
 #     (yoffset 0.000000)

Modified: branches/soc-2008-text/libgimp/gimp.c
==============================================================================
--- branches/soc-2008-text/libgimp/gimp.c	(original)
+++ branches/soc-2008-text/libgimp/gimp.c	Wed Aug  6 20:36:18 2008
@@ -736,7 +736,6 @@
         case GIMP_PDB_CHANNEL:
         case GIMP_PDB_DRAWABLE:
         case GIMP_PDB_SELECTION:
-        case GIMP_PDB_BOUNDARY:
         case GIMP_PDB_VECTORS:
         case GIMP_PDB_STATUS:
           (void) va_arg (args, gint);
@@ -769,6 +768,7 @@
           (void) va_arg (args, gchar **);
           break;
         case GIMP_PDB_COLOR:
+	case GIMP_PDB_COLORARRAY:
           (void) va_arg (args, GimpRGB *);
           break;
         case GIMP_PDB_PARASITE:
@@ -850,8 +850,8 @@
         case GIMP_PDB_SELECTION:
           params[i].data.d_selection = va_arg (args, gint32);
           break;
-        case GIMP_PDB_BOUNDARY:
-          params[i].data.d_boundary = va_arg (args, gint32);
+        case GIMP_PDB_COLORARRAY:
+          params[i].data.d_colorarray = va_arg (args, GimpRGB *);
           break;
         case GIMP_PDB_VECTORS:
           params[i].data.d_vectors = va_arg (args, gint32);

Modified: branches/soc-2008-text/libgimp/gimp.def
==============================================================================
--- branches/soc-2008-text/libgimp/gimp.def	(original)
+++ branches/soc-2008-text/libgimp/gimp.def	Wed Aug  6 20:36:18 2008
@@ -460,6 +460,7 @@
 	gimp_palette_entry_set_color
 	gimp_palette_entry_set_name
 	gimp_palette_get_background
+	gimp_palette_get_colors
 	gimp_palette_get_columns
 	gimp_palette_get_foreground
 	gimp_palette_get_info
@@ -656,6 +657,7 @@
 	gimp_vectors_bezier_stroke_lineto
 	gimp_vectors_bezier_stroke_new_ellipse
 	gimp_vectors_bezier_stroke_new_moveto
+        gimp_vectors_copy
 	gimp_vectors_export_to_file
 	gimp_vectors_export_to_string
 	gimp_vectors_get_image

Modified: branches/soc-2008-text/libgimp/gimp.h
==============================================================================
--- branches/soc-2008-text/libgimp/gimp.h	(original)
+++ branches/soc-2008-text/libgimp/gimp.h	Wed Aug  6 20:36:18 2008
@@ -128,6 +128,7 @@
   guint8           *d_int8array;
   gdouble          *d_floatarray;
   gchar           **d_stringarray;
+  GimpRGB          *d_colorarray;
   GimpRGB           d_color;
   GimpParamRegion   d_region;
   gint32            d_display;

Modified: branches/soc-2008-text/libgimp/gimpedit_pdb.c
==============================================================================
--- branches/soc-2008-text/libgimp/gimpedit_pdb.c	(original)
+++ branches/soc-2008-text/libgimp/gimpedit_pdb.c	Wed Aug  6 20:36:18 2008
@@ -36,9 +36,11 @@
  * internal GIMP edit buffer. It can subsequently be retrieved using
  * the gimp_edit_paste() command. If there is no selection, then the
  * specified drawable will be removed and its contents stored in the
- * internal GIMP edit buffer.
+ * internal GIMP edit buffer. This procedure will fail if the selected
+ * area lies completely outside the bounds of the current drawable and
+ * there is nothing to copy from.
  *
- * Returns: TRUE if the cut was successful, FALSE if the selection contained only transparent pixels.
+ * Returns: TRUE if the cut was successful, FALSE if there was nothing to copy from.
  */
 gboolean
 gimp_edit_cut (gint32 drawable_ID)
@@ -71,9 +73,11 @@
  * internal GIMP edit buffer. It can subsequently be retrieved using
  * the gimp_edit_paste() command. If there is no selection, then the
  * specified drawable's contents will be stored in the internal GIMP
- * edit buffer.
+ * edit buffer. This procedure will fail if the selected area lies
+ * completely outside the bounds of the current drawable and there is
+ * nothing to copy from.
  *
- * Returns: TRUE if the copy was successful, FALSE if the selection contained only transparent pixels.
+ * Returns: TRUE if the cut was successful, FALSE if there was nothing to copy from.
  */
 gboolean
 gimp_edit_copy (gint32 drawable_ID)
@@ -108,7 +112,7 @@
  * projection's contents will be stored in the internal GIMP edit
  * buffer.
  *
- * Returns: TRUE if the copy was successful, FALSE if the selection contained only transparent pixels.
+ * Returns: TRUE if the copy was successful.
  *
  * Since: GIMP 2.2
  */
@@ -224,7 +228,7 @@
  * later pasting, regardless of any intermediate copy or cut
  * operations.
  *
- * Returns: The real name given to the buffer, or NULL if the selection contained only transparent pixels.
+ * Returns: The real name given to the buffer, or NULL if the cut failed.
  *
  * Since: GIMP 2.4
  */
@@ -262,7 +266,7 @@
  * later pasting, regardless of any intermediate copy or cut
  * operations.
  *
- * Returns: The real name given to the buffer, or NULL if the selection contained only transparent pixels.
+ * Returns: The real name given to the buffer, or NULL if the copy failed.
  *
  * Since: GIMP 2.4
  */
@@ -300,7 +304,7 @@
  * available for later pasting, regardless of any intermediate copy or
  * cut operations.
  *
- * Returns: The real name given to the buffer, or NULL if the selection contained only transparent pixels.
+ * Returns: The real name given to the buffer, or NULL if the copy failed.
  *
  * Since: GIMP 2.4
  */

Modified: branches/soc-2008-text/libgimp/gimppalette_pdb.c
==============================================================================
--- branches/soc-2008-text/libgimp/gimppalette_pdb.c	(original)
+++ branches/soc-2008-text/libgimp/gimppalette_pdb.c	Wed Aug  6 20:36:18 2008
@@ -23,6 +23,8 @@
 
 #include "config.h"
 
+#include <string.h>
+
 #include "gimp.h"
 
 /**
@@ -227,6 +229,48 @@
 }
 
 /**
+ * gimp_palette_get_colors:
+ * @name: The palette name.
+ * @num_colors: Length of the colors array.
+ *
+ * Gets all colors from the specified palette.
+ *
+ * This procedure retrieves all color entries of the specified palette.
+ *
+ * Returns: The colors in the palette.
+ *
+ * Since: GIMP 2.6
+ */
+GimpRGB *
+gimp_palette_get_colors (const gchar *name,
+                         gint        *num_colors)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  GimpRGB *colors = NULL;
+
+  return_vals = gimp_run_procedure ("gimp-palette-get-colors",
+                                    &nreturn_vals,
+                                    GIMP_PDB_STRING, name,
+                                    GIMP_PDB_END);
+
+  *num_colors = 0;
+
+  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+    {
+      *num_colors = return_vals[1].data.d_int32;
+      colors = g_new (GimpRGB, *num_colors);
+      memcpy (colors,
+              return_vals[2].data.d_colorarray,
+              *num_colors * sizeof (GimpRGB));
+    }
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return colors;
+}
+
+/**
  * gimp_palette_get_columns:
  * @name: The palette name.
  *

Modified: branches/soc-2008-text/libgimp/gimppalette_pdb.h
==============================================================================
--- branches/soc-2008-text/libgimp/gimppalette_pdb.h	(original)
+++ branches/soc-2008-text/libgimp/gimppalette_pdb.h	Wed Aug  6 20:36:18 2008
@@ -37,6 +37,8 @@
 gboolean gimp_palette_is_editable     (const gchar    *name);
 gboolean gimp_palette_get_info        (const gchar    *name,
                                        gint           *num_colors);
+GimpRGB* gimp_palette_get_colors      (const gchar    *name,
+                                       gint           *num_colors);
 gint     gimp_palette_get_columns     (const gchar    *name);
 gboolean gimp_palette_set_columns     (const gchar    *name,
                                        gint            columns);

Modified: branches/soc-2008-text/libgimp/gimpui.c
==============================================================================
--- branches/soc-2008-text/libgimp/gimpui.c	(original)
+++ branches/soc-2008-text/libgimp/gimpui.c	Wed Aug  6 20:36:18 2008
@@ -50,7 +50,7 @@
  * gimp_ui_init:
  * @prog_name: The name of the plug-in which will be passed as argv[0] to
  *             gtk_init(). It's a convention to use the name of the
- *             executable and _not_ the PDB procedure name or something.
+ *             executable and _not_ the PDB procedure name.
  * @preview:   This parameter is unused and exists for historical
  *             reasons only.
  *
@@ -58,8 +58,11 @@
  * image rendering subsystem (GdkRGB) to follow the GIMP main program's
  * colormap allocation/installation policy.
  *
- * GIMP's colormap policy can be determinded by the user with the
- * gimprc variables @min_colors and @install_cmap.
+ * It also sets up various other things so that the plug-in user looks
+ * and behaves like the GIMP core. This includes selecting the GTK+
+ * theme and setting up the help system as chosen in the GIMP
+ * preferences. Any plug-in that provides a user interface should call
+ * this function.
  **/
 void
 gimp_ui_init (const gchar *prog_name,

Modified: branches/soc-2008-text/libgimp/gimpvectors_pdb.c
==============================================================================
--- branches/soc-2008-text/libgimp/gimpvectors_pdb.c	(original)
+++ branches/soc-2008-text/libgimp/gimpvectors_pdb.c	Wed Aug  6 20:36:18 2008
@@ -133,6 +133,39 @@
 }
 
 /**
+ * gimp_vectors_copy:
+ * @vectors_ID: The vectors object to copy.
+ *
+ * Copy a vectors object.
+ *
+ * This procedure copies the specified vectors object and returns the
+ * copy.
+ *
+ * Returns: The newly copied vectors object.
+ *
+ * Since: GIMP 2.6
+ */
+gint32
+gimp_vectors_copy (gint32 vectors_ID)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gint32 vectors_copy_ID = -1;
+
+  return_vals = gimp_run_procedure ("gimp-vectors-copy",
+                                    &nreturn_vals,
+                                    GIMP_PDB_VECTORS, vectors_ID,
+                                    GIMP_PDB_END);
+
+  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+    vectors_copy_ID = return_vals[1].data.d_vectors;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return vectors_copy_ID;
+}
+
+/**
  * gimp_vectors_get_image:
  * @vectors_ID: The vectors object.
  *

Modified: branches/soc-2008-text/libgimp/gimpvectors_pdb.h
==============================================================================
--- branches/soc-2008-text/libgimp/gimpvectors_pdb.h	(original)
+++ branches/soc-2008-text/libgimp/gimpvectors_pdb.h	Wed Aug  6 20:36:18 2008
@@ -34,6 +34,7 @@
                                                               const gchar            *name);
 gint32                gimp_vectors_new_from_text_layer       (gint32                  image_ID,
                                                               gint32                  layer_ID);
+gint32                gimp_vectors_copy                      (gint32                  vectors_ID);
 gint32                gimp_vectors_get_image                 (gint32                  vectors_ID);
 gchar*                gimp_vectors_get_name                  (gint32                  vectors_ID);
 gboolean              gimp_vectors_set_name                  (gint32                  vectors_ID,

Modified: branches/soc-2008-text/libgimpbase/gimpbaseenums.c
==============================================================================
--- branches/soc-2008-text/libgimpbase/gimpbaseenums.c	(original)
+++ branches/soc-2008-text/libgimpbase/gimpbaseenums.c	Wed Aug  6 20:36:18 2008
@@ -815,12 +815,11 @@
     { GIMP_PDB_CHANNEL, "GIMP_PDB_CHANNEL", "channel" },
     { GIMP_PDB_DRAWABLE, "GIMP_PDB_DRAWABLE", "drawable" },
     { GIMP_PDB_SELECTION, "GIMP_PDB_SELECTION", "selection" },
-    { GIMP_PDB_BOUNDARY, "GIMP_PDB_BOUNDARY", "boundary" },
+    { GIMP_PDB_COLORARRAY, "GIMP_PDB_COLORARRAY", "colorarray" },
     { GIMP_PDB_VECTORS, "GIMP_PDB_VECTORS", "vectors" },
     { GIMP_PDB_PARASITE, "GIMP_PDB_PARASITE", "parasite" },
     { GIMP_PDB_STATUS, "GIMP_PDB_STATUS", "status" },
     { GIMP_PDB_END, "GIMP_PDB_END", "end" },
-    { GIMP_PDB_PATH, "GIMP_PDB_PATH", "path" },
     { 0, NULL, NULL }
   };
 
@@ -844,12 +843,11 @@
     { GIMP_PDB_CHANNEL, "GIMP_PDB_CHANNEL", NULL },
     { GIMP_PDB_DRAWABLE, "GIMP_PDB_DRAWABLE", NULL },
     { GIMP_PDB_SELECTION, "GIMP_PDB_SELECTION", NULL },
-    { GIMP_PDB_BOUNDARY, "GIMP_PDB_BOUNDARY", NULL },
+    { GIMP_PDB_COLORARRAY, "GIMP_PDB_COLORARRAY", NULL },
     { GIMP_PDB_VECTORS, "GIMP_PDB_VECTORS", NULL },
     { GIMP_PDB_PARASITE, "GIMP_PDB_PARASITE", NULL },
     { GIMP_PDB_STATUS, "GIMP_PDB_STATUS", NULL },
     { GIMP_PDB_END, "GIMP_PDB_END", NULL },
-    { GIMP_PDB_PATH, "GIMP_PDB_PATH", NULL },
     { 0, NULL, NULL }
   };
 

Modified: branches/soc-2008-text/libgimpbase/gimpbaseenums.h
==============================================================================
--- branches/soc-2008-text/libgimpbase/gimpbaseenums.h	(original)
+++ branches/soc-2008-text/libgimpbase/gimpbaseenums.h	Wed Aug  6 20:36:18 2008
@@ -373,13 +373,15 @@
   GIMP_PDB_CHANNEL,
   GIMP_PDB_DRAWABLE,
   GIMP_PDB_SELECTION,
-  GIMP_PDB_BOUNDARY,
+  GIMP_PDB_COLORARRAY,
   GIMP_PDB_VECTORS,
   GIMP_PDB_PARASITE,
   GIMP_PDB_STATUS,
   GIMP_PDB_END,
 
-  GIMP_PDB_PATH = GIMP_PDB_VECTORS /* deprecated */
+  /*  the following aliases are deprecated  */
+  GIMP_PDB_PATH     = GIMP_PDB_VECTORS,     /*< skip >*/
+  GIMP_PDB_BOUNDARY = GIMP_PDB_COLORARRAY   /*< skip >*/
 } GimpPDBArgType;
 
 

Modified: branches/soc-2008-text/libgimpbase/gimpprotocol.c
==============================================================================
--- branches/soc-2008-text/libgimpbase/gimpprotocol.c	(original)
+++ branches/soc-2008-text/libgimpbase/gimpprotocol.c	Wed Aug  6 20:36:18 2008
@@ -1481,11 +1481,17 @@
             goto cleanup;
           break;
 
-        case GIMP_PDB_BOUNDARY:
-          if (! _gimp_wire_read_int32 (channel,
-                                       (guint32 *) &(*params)[i].data.d_boundary, 1,
-                                       user_data))
-            goto cleanup;
+	case GIMP_PDB_COLORARRAY:
+	  (*params)[i].data.d_colorarray = g_new (GimpRGB,
+                                                  (*params)[i-1].data.d_int32);
+	  if (! _gimp_wire_read_color (channel,
+                                        (*params)[i].data.d_colorarray,
+                                        (*params)[i-1].data.d_int32,
+                                        user_data))
+	    {
+	      g_free ((*params)[i].data.d_colorarray);
+	      goto cleanup;
+	    }
           break;
 
         case GIMP_PDB_VECTORS:
@@ -1698,9 +1704,10 @@
             return;
           break;
 
-        case GIMP_PDB_BOUNDARY:
-          if (! _gimp_wire_write_int32 (channel,
-                                        (const guint32 *) &params[i].data.d_boundary, 1,
+        case GIMP_PDB_COLORARRAY:
+          if (! _gimp_wire_write_color (channel,
+                                        params[i].data.d_colorarray,
+                                        params[i-1].data.d_int32,
                                         user_data))
             return;
           break;
@@ -1773,7 +1780,6 @@
         case GIMP_PDB_CHANNEL:
         case GIMP_PDB_DRAWABLE:
         case GIMP_PDB_SELECTION:
-        case GIMP_PDB_BOUNDARY:
         case GIMP_PDB_VECTORS:
         case GIMP_PDB_STATUS:
           break;
@@ -1811,6 +1817,10 @@
             }
           break;
 
+        case GIMP_PDB_COLORARRAY:
+          g_free (params[i].data.d_colorarray);
+          break;
+
         case GIMP_PDB_PARASITE:
           if (params[i].data.d_parasite.name)
             g_free (params[i].data.d_parasite.name);

Modified: branches/soc-2008-text/libgimpbase/gimpprotocol.h
==============================================================================
--- branches/soc-2008-text/libgimpbase/gimpprotocol.h	(original)
+++ branches/soc-2008-text/libgimpbase/gimpprotocol.h	Wed Aug  6 20:36:18 2008
@@ -27,7 +27,7 @@
 
 /* Increment every time the protocol changes
  */
-#define GIMP_PROTOCOL_VERSION  0x0012
+#define GIMP_PROTOCOL_VERSION  0x0013
 
 
 enum
@@ -120,6 +120,7 @@
     guint8       *d_int8array;
     gdouble      *d_floatarray;
     gchar       **d_stringarray;
+    GimpRGB      *d_colorarray;
     GimpRGB       d_color;
     struct
     {

Modified: branches/soc-2008-text/libgimpwidgets/gimpcolorprofilecombobox.c
==============================================================================
--- branches/soc-2008-text/libgimpwidgets/gimpcolorprofilecombobox.c	(original)
+++ branches/soc-2008-text/libgimpwidgets/gimpcolorprofilecombobox.c	Wed Aug  6 20:36:18 2008
@@ -169,7 +169,7 @@
     {
     case PROP_DIALOG:
       g_return_if_fail (combo_box->dialog == NULL);
-      combo_box->dialog = (GtkWidget *) g_value_dup_object (value);
+      combo_box->dialog = g_value_dup_object (value);
       break;
 
     case PROP_MODEL:

Modified: branches/soc-2008-text/menus/image-menu.xml.in
==============================================================================
--- branches/soc-2008-text/menus/image-menu.xml.in	(original)
+++ branches/soc-2008-text/menus/image-menu.xml.in	Wed Aug  6 20:36:18 2008
@@ -558,19 +558,6 @@
       <menuitem action="context-colors-swap" />
     </menu>
 
-    <menu action="windows-menu" name="Windows">
-      <menu action="windows-docks-menu" name="Recently Closed Docks" />
-      <menu action="windows-dialogs-menu" name="Dockable Dialogs">
-	<xi:include href="dialogs-menuitems.xml" />
-      </menu>
-      <separator />
-      <placeholder name="Images" />
-      <separator />
-      <placeholder name="Docks">
-	<menuitem action="windows-show-toolbox" />
-      </placeholder>
-    </menu>
-
     <menu action="plug-in-menu" name="Filters">
       <menuitem action="plug-in-repeat" />
       <menuitem action="plug-in-reshow" />
@@ -617,6 +604,19 @@
 
     <placeholder name="Menus" />
 
+    <menu action="windows-menu" name="Windows">
+      <menu action="windows-docks-menu" name="Recently Closed Docks" />
+      <menu action="windows-dialogs-menu" name="Dockable Dialogs">
+	<xi:include href="dialogs-menuitems.xml" />
+      </menu>
+      <separator />
+      <placeholder name="Images" />
+      <separator />
+      <placeholder name="Docks">
+	<menuitem action="windows-show-toolbox" />
+      </placeholder>
+    </menu>
+
     <menu action="help-menu" name="Help">
       <menuitem action="help-help" />
       <menuitem action="help-context-help" />

Modified: branches/soc-2008-text/plug-ins/common/Makefile.am
==============================================================================
--- branches/soc-2008-text/plug-ins/common/Makefile.am	(original)
+++ branches/soc-2008-text/plug-ins/common/Makefile.am	Wed Aug  6 20:36:18 2008
@@ -138,7 +138,6 @@
 	$(POPPLER) \
 	postscript \
 	procedure-browser \
-	psd-save \
 	$(PSP) \
 	qbist \
 	raw \
@@ -1808,22 +1807,6 @@
 	$(RT_LIBS)		\
 	$(INTLLIBS)
 
-psd_save_SOURCES = \
-	psd-save.c
-
-psd_save_LDADD = \
-	$(libgimpui)		\
-	$(libgimpwidgets)	\
-	$(libgimpmodule)	\
-	$(libgimp)		\
-	$(libgimpmath)		\
-	$(libgimpconfig)	\
-	$(libgimpcolor)		\
-	$(libgimpbase)		\
-	$(GTK_LIBS)		\
-	$(RT_LIBS)		\
-	$(INTLLIBS)
-
 psp_SOURCES = \
 	psp.c
 

Modified: branches/soc-2008-text/plug-ins/common/alien-map.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/alien-map.c	(original)
+++ branches/soc-2008-text/plug-ins/common/alien-map.c	Wed Aug  6 20:36:18 2008
@@ -412,8 +412,9 @@
   gtk_widget_show (main_vbox);
 
   preview = gimp_zoom_preview_new (drawable);
-  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview);
+  gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
   gtk_widget_show (preview);
+
   g_signal_connect_swapped (preview, "invalidated",
                             G_CALLBACK (dialog_update_preview),
                             drawable);

Modified: branches/soc-2008-text/plug-ins/common/blinds.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/blinds.c	(original)
+++ branches/soc-2008-text/plug-ins/common/blinds.c	Wed Aug  6 20:36:18 2008
@@ -245,8 +245,9 @@
   gtk_widget_show (main_vbox);
 
   preview = gimp_aspect_preview_new (drawable, NULL);
-  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview);
+  gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
   gtk_widget_show (preview);
+
   g_signal_connect_swapped (preview, "invalidated",
                             G_CALLBACK (dialog_update_preview),
                             drawable);

Modified: branches/soc-2008-text/plug-ins/common/blur-motion.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/blur-motion.c	(original)
+++ branches/soc-2008-text/plug-ins/common/blur-motion.c	Wed Aug  6 20:36:18 2008
@@ -1046,9 +1046,9 @@
                                     G_CALLBACK (mblur_radio_button_update),
                                     &mbvals.mblur_type, mbvals.mblur_type,
 
-                                    _("_Linear"), MBLUR_LINEAR, NULL,
-                                    _("_Radial"), MBLUR_RADIAL, NULL,
-                                    _("_Zoom"),   MBLUR_ZOOM,   NULL,
+                                    C_("blur-type", "_Linear"),  MBLUR_LINEAR, NULL,
+                                    C_("blur-type", "_Radial"),  MBLUR_RADIAL, NULL,
+                                    C_("blur-type", "_Zoom"),    MBLUR_ZOOM,   NULL,
 
                                     NULL);
 

Modified: branches/soc-2008-text/plug-ins/common/channel-mixer.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/channel-mixer.c	(original)
+++ branches/soc-2008-text/plug-ins/common/channel-mixer.c	Wed Aug  6 20:36:18 2008
@@ -511,8 +511,9 @@
   gtk_widget_show (main_vbox);
 
   preview = gimp_zoom_preview_new (drawable);
-  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview);
+  gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
   gtk_widget_show (preview);
+
   g_signal_connect_swapped (preview, "invalidated",
                             G_CALLBACK (cm_preview),
                             mix);

Modified: branches/soc-2008-text/plug-ins/common/color-exchange.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/color-exchange.c	(original)
+++ branches/soc-2008-text/plug-ins/common/color-exchange.c	Wed Aug  6 20:36:18 2008
@@ -307,7 +307,7 @@
   gtk_widget_show (main_vbox);
 
   frame = gimp_frame_new (_("Middle-Click Inside Preview to Pick \"From Color\""));
-  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), frame);
+  gtk_box_pack_start (GTK_BOX (main_vbox), frame, TRUE, TRUE, 0);
   gtk_widget_show (frame);
 
   preview = gimp_drawable_preview_new (drawable, NULL);

Modified: branches/soc-2008-text/plug-ins/common/color-to-alpha.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/color-to-alpha.c	(original)
+++ branches/soc-2008-text/plug-ins/common/color-to-alpha.c	Wed Aug  6 20:36:18 2008
@@ -396,8 +396,9 @@
   gtk_widget_show (main_vbox);
 
   preview = gimp_drawable_preview_new (drawable, NULL);
-  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview);
+  gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
   gtk_widget_show (preview);
+
   g_signal_connect (preview, "invalidated",
                     G_CALLBACK (color_to_alpha_preview),
                     drawable);

Modified: branches/soc-2008-text/plug-ins/common/contrast-retinex.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/contrast-retinex.c	(original)
+++ branches/soc-2008-text/plug-ins/common/contrast-retinex.c	Wed Aug  6 20:36:18 2008
@@ -305,7 +305,7 @@
   gtk_widget_show (main_vbox);
 
   preview = gimp_zoom_preview_new (drawable);
-  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview);
+  gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
   gtk_widget_show (preview);
 
   g_signal_connect_swapped (preview, "invalidated",

Modified: branches/soc-2008-text/plug-ins/common/convolution-matrix.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/convolution-matrix.c	(original)
+++ branches/soc-2008-text/plug-ins/common/convolution-matrix.c	Wed Aug  6 20:36:18 2008
@@ -927,8 +927,9 @@
   gtk_widget_show (main_vbox);
 
   preview = gimp_drawable_preview_new (drawable, NULL);
-  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview);
+  gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
   gtk_widget_show (preview);
+
   g_signal_connect_swapped (preview, "invalidated",
                             G_CALLBACK (convolve_image),
                             drawable);

Modified: branches/soc-2008-text/plug-ins/common/cubism.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/cubism.c	(original)
+++ branches/soc-2008-text/plug-ins/common/cubism.c	Wed Aug  6 20:36:18 2008
@@ -287,8 +287,9 @@
   gtk_widget_show (main_vbox);
 
   preview = gimp_drawable_preview_new (drawable, &cvals.preview);
-  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview);
+  gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
   gtk_widget_show (preview);
+
   g_signal_connect_swapped (preview, "invalidated",
                             G_CALLBACK (cubism),
                             drawable);

Modified: branches/soc-2008-text/plug-ins/common/deinterlace.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/deinterlace.c	(original)
+++ branches/soc-2008-text/plug-ins/common/deinterlace.c	Wed Aug  6 20:36:18 2008
@@ -344,7 +344,7 @@
   gtk_widget_show (main_vbox);
 
   preview = gimp_drawable_preview_new (drawable, NULL);
-  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview);
+  gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
   gtk_widget_show (preview);
   g_signal_connect_swapped (preview, "invalidated",
                             G_CALLBACK (deinterlace),

Modified: branches/soc-2008-text/plug-ins/common/destripe.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/destripe.c	(original)
+++ branches/soc-2008-text/plug-ins/common/destripe.c	Wed Aug  6 20:36:18 2008
@@ -457,8 +457,9 @@
   gtk_widget_show (main_vbox);
 
   preview = gimp_drawable_preview_new (drawable, NULL);
-  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview);
+  gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
   gtk_widget_show (preview);
+
   g_signal_connect_swapped (preview, "invalidated",
                             G_CALLBACK (destripe),
                             drawable);

Modified: branches/soc-2008-text/plug-ins/common/edge-dog.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/edge-dog.c	(original)
+++ branches/soc-2008-text/plug-ins/common/edge-dog.c	Wed Aug  6 20:36:18 2008
@@ -297,8 +297,9 @@
   gtk_widget_show (main_vbox);
 
   preview = gimp_drawable_preview_new (drawable, NULL);
-  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview);
+  gtk_box_pack_start (GTK_BOX (main_vbox), preview, FALSE, FALSE, 0);
   gtk_widget_show (preview);
+
   g_signal_connect (preview, "invalidated",
                     G_CALLBACK (preview_update_preview),
                     drawable);

Modified: branches/soc-2008-text/plug-ins/common/edge.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/edge.c	(original)
+++ branches/soc-2008-text/plug-ins/common/edge.c	Wed Aug  6 20:36:18 2008
@@ -652,8 +652,9 @@
   gtk_widget_show (main_vbox);
 
   preview = gimp_drawable_preview_new (drawable, NULL);
-  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview);
+  gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
   gtk_widget_show (preview);
+
   g_signal_connect (preview, "invalidated",
                     G_CALLBACK (edge_preview_update),
                     NULL);

Modified: branches/soc-2008-text/plug-ins/common/emboss.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/emboss.c	(original)
+++ branches/soc-2008-text/plug-ins/common/emboss.c	Wed Aug  6 20:36:18 2008
@@ -465,7 +465,7 @@
   gtk_widget_show (main_vbox);
 
   preview = gimp_drawable_preview_new (drawable, NULL);
-  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview);
+  gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
   gtk_widget_show (preview);
   g_signal_connect_swapped (preview, "invalidated",
                             G_CALLBACK (emboss),

Modified: branches/soc-2008-text/plug-ins/common/engrave.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/engrave.c	(original)
+++ branches/soc-2008-text/plug-ins/common/engrave.c	Wed Aug  6 20:36:18 2008
@@ -228,8 +228,9 @@
   gtk_widget_show (main_vbox);
 
   preview = gimp_drawable_preview_new (drawable, NULL);
-  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview);
+  gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
   gtk_widget_show (preview);
+
   g_signal_connect_swapped (preview, "invalidated",
                             G_CALLBACK (engrave),
                             drawable);

Modified: branches/soc-2008-text/plug-ins/common/filter-pack.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/filter-pack.c	(original)
+++ branches/soc-2008-text/plug-ins/common/filter-pack.c	Wed Aug  6 20:36:18 2008
@@ -1333,7 +1333,7 @@
   gtk_widget_show (inner_vbox);
 
   alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
-  gtk_box_pack_start_defaults (GTK_BOX (inner_vbox), alignment);
+  gtk_box_pack_start (GTK_BOX (inner_vbox), alignment, TRUE, TRUE, 0);
   gtk_widget_show (alignment);
 
   innermost_vbox = gtk_vbox_new (FALSE, 0);

Modified: branches/soc-2008-text/plug-ins/common/gif-save.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/gif-save.c	(original)
+++ branches/soc-2008-text/plug-ins/common/gif-save.c	Wed Aug  6 20:36:18 2008
@@ -1051,7 +1051,7 @@
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
                                   GTK_POLICY_AUTOMATIC,
                                   GTK_POLICY_AUTOMATIC);
-  gtk_box_pack_start_defaults (GTK_BOX (hbox), scrolled_window);
+  gtk_box_pack_start (GTK_BOX (hbox), scrolled_window, TRUE, TRUE, 0);
   gtk_widget_show (scrolled_window);
 
   text_buffer = gtk_text_buffer_new (NULL);

Modified: branches/soc-2008-text/plug-ins/common/illusion.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/illusion.c	(original)
+++ branches/soc-2008-text/plug-ins/common/illusion.c	Wed Aug  6 20:36:18 2008
@@ -369,7 +369,7 @@
   gtk_widget_show (main_vbox);
 
   preview = gimp_zoom_preview_new (drawable);
-  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview);
+  gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
   gtk_widget_show (preview);
 
   g_signal_connect (preview, "invalidated",

Modified: branches/soc-2008-text/plug-ins/common/jigsaw.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/jigsaw.c	(original)
+++ branches/soc-2008-text/plug-ins/common/jigsaw.c	Wed Aug  6 20:36:18 2008
@@ -2435,8 +2435,9 @@
   gtk_widget_show (main_vbox);
 
   preview = gimp_aspect_preview_new (drawable, NULL);
-  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview);
+  gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
   gtk_widget_show (preview);
+
   g_signal_connect_swapped (preview, "invalidated",
                             G_CALLBACK (jigsaw),
                             drawable);

Modified: branches/soc-2008-text/plug-ins/common/lens-apply.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/lens-apply.c	(original)
+++ branches/soc-2008-text/plug-ins/common/lens-apply.c	Wed Aug  6 20:36:18 2008
@@ -412,8 +412,9 @@
   gtk_widget_show (main_vbox);
 
   preview = gimp_aspect_preview_new (drawable, NULL);
-  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview);
+  gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
   gtk_widget_show (preview);
+
   g_signal_connect_swapped (preview, "invalidated",
                             G_CALLBACK (drawlens),
                             drawable);

Modified: branches/soc-2008-text/plug-ins/common/lens-distortion.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/lens-distortion.c	(original)
+++ branches/soc-2008-text/plug-ins/common/lens-distortion.c	Wed Aug  6 20:36:18 2008
@@ -504,8 +504,9 @@
   gtk_widget_show (main_vbox);
 
   preview = gimp_zoom_preview_new (drawable);
-  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview);
+  gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
   gtk_widget_show (preview);
+
   g_signal_connect_swapped (preview, "invalidated",
                             G_CALLBACK (lens_distort_preview),
                             drawable);

Modified: branches/soc-2008-text/plug-ins/common/max-rgb.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/max-rgb.c	(original)
+++ branches/soc-2008-text/plug-ins/common/max-rgb.c	Wed Aug  6 20:36:18 2008
@@ -278,8 +278,9 @@
   gtk_widget_show (main_vbox);
 
   preview = gimp_zoom_preview_new (drawable);
-  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview);
+  gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
   gtk_widget_show (preview);
+
   g_signal_connect_swapped (preview, "invalidated",
                             G_CALLBACK (main_function),
                             drawable);

Modified: branches/soc-2008-text/plug-ins/common/newsprint.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/newsprint.c	(original)
+++ branches/soc-2008-text/plug-ins/common/newsprint.c	Wed Aug  6 20:36:18 2008
@@ -1216,8 +1216,9 @@
   gtk_widget_show (vbox);
 
   preview = gimp_drawable_preview_new (drawable, NULL);
-  gtk_box_pack_start_defaults (GTK_BOX (hbox), preview);
+  gtk_box_pack_start (GTK_BOX (hbox), preview, TRUE, TRUE, 0);
   gtk_widget_show (preview);
+
   g_signal_connect_swapped (preview, "invalidated",
                             G_CALLBACK (newsprint),
                             drawable);

Modified: branches/soc-2008-text/plug-ins/common/nl-filter.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/nl-filter.c	(original)
+++ branches/soc-2008-text/plug-ins/common/nl-filter.c	Wed Aug  6 20:36:18 2008
@@ -1034,8 +1034,9 @@
   gtk_widget_show (main_vbox);
 
   preview = gimp_drawable_preview_new (drawable, NULL);
-  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview);
+  gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
   gtk_widget_show (preview);
+
   g_signal_connect_swapped (preview, "invalidated",
                             G_CALLBACK (nlfilter),
                             drawable);

Modified: branches/soc-2008-text/plug-ins/common/noise-hsv.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/noise-hsv.c	(original)
+++ branches/soc-2008-text/plug-ins/common/noise-hsv.c	Wed Aug  6 20:36:18 2008
@@ -380,7 +380,7 @@
   gtk_widget_show (main_vbox);
 
   preview = gimp_drawable_preview_new (drawable, NULL);
-  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview);
+  gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
   gtk_widget_show (preview);
 
   g_signal_connect (preview, "invalidated",

Modified: branches/soc-2008-text/plug-ins/common/noise-solid.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/noise-solid.c	(original)
+++ branches/soc-2008-text/plug-ins/common/noise-solid.c	Wed Aug  6 20:36:18 2008
@@ -582,8 +582,9 @@
   gtk_widget_show (main_vbox);
 
   preview = gimp_aspect_preview_new (drawable, NULL);
-  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview);
+  gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
   gtk_widget_show (preview);
+
   g_signal_connect_swapped (preview, "invalidated",
                             G_CALLBACK (solid_noise),
                             drawable);

Modified: branches/soc-2008-text/plug-ins/common/pixelize.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/pixelize.c	(original)
+++ branches/soc-2008-text/plug-ins/common/pixelize.c	Wed Aug  6 20:36:18 2008
@@ -333,7 +333,7 @@
   gtk_widget_show (main_vbox);
 
   preview = gimp_drawable_preview_new (drawable, NULL);
-  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview);
+  gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
   gtk_widget_show (preview);
   g_signal_connect_swapped (preview, "invalidated",
                             G_CALLBACK (pixelize),

Modified: branches/soc-2008-text/plug-ins/common/plasma.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/plasma.c	(original)
+++ branches/soc-2008-text/plug-ins/common/plasma.c	Wed Aug  6 20:36:18 2008
@@ -319,8 +319,9 @@
   gtk_widget_show (main_vbox);
 
   preview = gimp_aspect_preview_new (drawable, NULL);
-  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview);
+  gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
   gtk_widget_show (preview);
+
   g_signal_connect_swapped (preview, "invalidated",
                             G_CALLBACK (plasma_seed_changed_callback),
                             drawable);

Modified: branches/soc-2008-text/plug-ins/common/plugin-defs.pl
==============================================================================
--- branches/soc-2008-text/plug-ins/common/plugin-defs.pl	(original)
+++ branches/soc-2008-text/plug-ins/common/plugin-defs.pl	Wed Aug  6 20:36:18 2008
@@ -101,7 +101,6 @@
     'poppler' => { ui => 1, optional => 1, cflags => 1 },
     'postscript' => { ui => 1 },
     'procedure-browser' => { ui => 1 },
-    'psd-save' => { ui => 1 },
     'psp' => { ui => 1, optional => 1, libopt => 'z' },
     'qbist' => { ui => 1 },
     'raw' => { ui => 1 },

Modified: branches/soc-2008-text/plug-ins/common/polar-coords.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/polar-coords.c	(original)
+++ branches/soc-2008-text/plug-ins/common/polar-coords.c	Wed Aug  6 20:36:18 2008
@@ -612,8 +612,9 @@
 
   /* Preview */
   preview = gimp_zoom_preview_new (drawable);
-  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview);
+  gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
   gtk_widget_show (preview);
+
   g_signal_connect_swapped (preview, "invalidated",
                             G_CALLBACK (dialog_update_preview),
                             drawable);

Modified: branches/soc-2008-text/plug-ins/common/ripple.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/ripple.c	(original)
+++ branches/soc-2008-text/plug-ins/common/ripple.c	Wed Aug  6 20:36:18 2008
@@ -488,8 +488,9 @@
   gtk_widget_show (main_vbox);
 
   preview = gimp_drawable_preview_new (drawable, NULL);
-  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview);
+  gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
   gtk_widget_show (preview);
+
   g_signal_connect_swapped (preview, "invalidated",
                             G_CALLBACK (ripple),
                             drawable);

Modified: branches/soc-2008-text/plug-ins/common/shift.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/shift.c	(original)
+++ branches/soc-2008-text/plug-ins/common/shift.c	Wed Aug  6 20:36:18 2008
@@ -374,10 +374,12 @@
   gtk_widget_show (main_vbox);
 
   preview = gimp_drawable_preview_new (drawable, NULL);
-  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview);
+  gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
   gtk_widget_show (preview);
+
   g_signal_connect_swapped (preview, "invalidated",
-                            G_CALLBACK (shift), drawable);
+                            G_CALLBACK (shift),
+                            drawable);
 
   frame = gimp_int_radio_group_new (FALSE, NULL,
                                     G_CALLBACK (gimp_radio_button_update),

Modified: branches/soc-2008-text/plug-ins/common/sparkle.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/sparkle.c	(original)
+++ branches/soc-2008-text/plug-ins/common/sparkle.c	Wed Aug  6 20:36:18 2008
@@ -356,7 +356,7 @@
   gtk_widget_show (main_vbox);
 
   preview = gimp_drawable_preview_new (drawable, NULL);
-  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview);
+  gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
   gtk_widget_show (preview);
   g_signal_connect_swapped (preview, "invalidated",
                             G_CALLBACK (sparkle),

Modified: branches/soc-2008-text/plug-ins/common/tiff-load.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/tiff-load.c	(original)
+++ branches/soc-2008-text/plug-ins/common/tiff-load.c	Wed Aug  6 20:36:18 2008
@@ -380,23 +380,42 @@
               const gchar *fmt,
               va_list      ap)
 {
-  va_list ap_test;
+  int tag = 0;
 
-  /* Workaround for: http://bugzilla.gnome.org/show_bug.cgi?id=131975 */
-  /* Ignore the warnings about unregistered private tags (>= 32768) */
   if (! strcmp (fmt, "%s: unknown field with tag %d (0x%x) encountered"))
     {
+      const char *name;
+      va_list     ap_test;
+
       G_VA_COPY (ap_test, ap);
-      if (va_arg (ap_test, char *));  /* ignore first argument */
-      if (va_arg (ap_test, int) >= 32768)
-        return;
+
+      name = va_arg (ap_test, const char *);
+      tag  = va_arg (ap_test, int);
     }
   /* for older versions of libtiff? */
   else if (! strcmp (fmt, "unknown field with tag %d (0x%x) ignored"))
     {
+      va_list ap_test;
+
       G_VA_COPY (ap_test, ap);
-      if (va_arg (ap_test, int) >= 32768)
-        return;
+
+      tag = va_arg (ap_test, int);
+    }
+
+  /* Workaround for: http://bugzilla.gnome.org/show_bug.cgi?id=131975 */
+  /* Ignore the warnings about unregistered private tags (>= 32768).  */
+  if (tag >= 32768)
+    return;
+
+  /* Other unknown fields are only reported to stderr. */
+  if (tag > 0)
+    {
+      gchar *msg = g_strdup_vprintf (fmt, ap);
+
+      g_printerr ("%s\n", msg);
+      g_free (msg);
+
+      return;
     }
 
   g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, fmt, ap);

Modified: branches/soc-2008-text/plug-ins/common/tile-glass.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/tile-glass.c	(original)
+++ branches/soc-2008-text/plug-ins/common/tile-glass.c	Wed Aug  6 20:36:18 2008
@@ -269,8 +269,9 @@
   gtk_widget_show (main_vbox);
 
   preview = gimp_drawable_preview_new (drawable, NULL);
-  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview);
+  gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
   gtk_widget_show (preview);
+
   g_signal_connect_swapped (preview, "invalidated",
                             G_CALLBACK (glasstile),
                             drawable);

Modified: branches/soc-2008-text/plug-ins/common/value-propagate.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/value-propagate.c	(original)
+++ branches/soc-2008-text/plug-ins/common/value-propagate.c	Wed Aug  6 20:36:18 2008
@@ -518,7 +518,7 @@
       nr = swap;
 
 
-      if (((y % 5) == 0) && !preview)
+      if (((y % 16) == 0) && !preview)
         gimp_progress_update ((gdouble) y / (gdouble) (endy - begy));
     }
 
@@ -530,7 +530,7 @@
   else
     {
       /*  update the region  */
-      gimp_progress_update(1.0);
+      gimp_progress_update (1.0);
       gimp_drawable_flush (drawable);
       gimp_drawable_merge_shadow (drawable->drawable_id, TRUE);
       gimp_drawable_update (drawable->drawable_id, begx, begy, endx-begx, endy-begy);
@@ -610,7 +610,7 @@
     }
 }
 
-static int
+static inline int
 value_difference_check (guchar *pos1,
                         guchar *pos2,
                         gint   ch)
@@ -636,11 +636,23 @@
                   guchar             *here,
                   void              **tmp)
 {
-  if (*tmp == NULL)
-    *tmp = (void *) g_new (gfloat, 1);
-  *(float *)*tmp = sqrt (channel_mask[0] * here[0] * here[0]
-                         + channel_mask[1] * here[1] * here[1]
-                         + channel_mask[2] * here[2] * here[2]);
+
+  switch (dtype)
+    {
+    case GIMP_RGB_IMAGE:
+    case GIMP_RGBA_IMAGE:
+      if (*tmp == NULL)
+	*tmp = (void *) g_new (gfloat, 1);
+      **(float **)tmp = channel_mask[0] * here[0] * here[0]
+                     + channel_mask[1] * here[1] * here[1]
+                     + channel_mask[2] * here[2] * here[2];
+      break;
+    case GIMP_GRAYA_IMAGE:
+    case GIMP_GRAY_IMAGE:
+      break;
+    default:
+      break;
+    }
 }
 
 static void
@@ -657,9 +669,9 @@
     {
     case GIMP_RGB_IMAGE:
     case GIMP_RGBA_IMAGE:
-      v_here = sqrt (channel_mask[0] * here[0] * here[0]
+      v_here = channel_mask[0] * here[0] * here[0]
                      + channel_mask[1] * here[1] * here[1]
-                     + channel_mask[2] * here[2] * here[2]);
+                     + channel_mask[2] * here[2] * here[2];
      if (*(float *)tmp < v_here && value_difference_check(orig, here, 3))
         {
           *(float *)tmp = v_here;
@@ -683,11 +695,22 @@
                   guchar             *here,
                   void              **tmp)
 {
-  if (*tmp == NULL)
-    *tmp = (void *) g_new (gfloat, 1);
-  *(float *)*tmp = sqrt (channel_mask[0] * here[0] * here[0]
-                         + channel_mask[1] * here[1] * here[1]
-                         + channel_mask[2] * here[2] * here[2]);
+  switch (dtype)
+    {
+    case GIMP_RGB_IMAGE:
+    case GIMP_RGBA_IMAGE:
+      if (*tmp == NULL)
+	*tmp = (void *) g_new (gfloat, 1);
+      **(float **)tmp = (channel_mask[0] * here[0] * here[0]
+                     + channel_mask[1] * here[1] * here[1]
+                     + channel_mask[2] * here[2] * here[2]);
+      break;
+    case GIMP_GRAYA_IMAGE:
+    case GIMP_GRAY_IMAGE:
+      break;
+    default:
+      break;
+    }
 }
 
 static void
@@ -704,7 +727,7 @@
     {
     case GIMP_RGB_IMAGE:
     case GIMP_RGBA_IMAGE:
-      v_here = sqrt (channel_mask[0] * here[0] * here[0]
+      v_here = (channel_mask[0] * here[0] * here[0]
                      + channel_mask[1] * here[1] * here[1]
                      + channel_mask[2] * here[2] * here[2]);
       if (v_here < *(float *)tmp && value_difference_check(orig, here, 3))
@@ -753,7 +776,7 @@
     {
     case GIMP_RGB_IMAGE:
     case GIMP_RGBA_IMAGE:
-      data->original_value = sqrt (channel_mask[0] * here[0] * here[0]
+      data->original_value = (channel_mask[0] * here[0] * here[0]
                                    + channel_mask[1] * here[1] * here[1]
                                    + channel_mask[2] * here[2] * here[2]);
       break;
@@ -785,7 +808,7 @@
     {
     case GIMP_RGB_IMAGE:
     case GIMP_RGBA_IMAGE:
-      v_here = sqrt (channel_mask[0] * here[0] * here[0]
+      v_here = (channel_mask[0] * here[0] * here[0]
                      + channel_mask[1] * here[1] * here[1]
                      + channel_mask[2] * here[2] * here[2]);
       if ((v_here <= data->minv) && value_difference_check(orig, here, 3))
@@ -1082,8 +1105,9 @@
   gtk_widget_show (main_vbox);
 
   preview = gimp_drawable_preview_new (drawable, NULL);
-  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview);
+  gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
   gtk_widget_show (preview);
+
   g_signal_connect_swapped (preview, "invalidated",
                             G_CALLBACK (value_propagate_body),
                             drawable);

Modified: branches/soc-2008-text/plug-ins/common/waves.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/waves.c	(original)
+++ branches/soc-2008-text/plug-ins/common/waves.c	Wed Aug  6 20:36:18 2008
@@ -267,8 +267,9 @@
   gtk_widget_show (main_vbox);
 
   preview = gimp_zoom_preview_new (drawable);
-  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview);
+  gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
   gtk_widget_show (preview);
+
   g_signal_connect_swapped (preview, "invalidated",
                             G_CALLBACK (waves_preview),
                             drawable);

Modified: branches/soc-2008-text/plug-ins/common/whirl-pinch.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/whirl-pinch.c	(original)
+++ branches/soc-2008-text/plug-ins/common/whirl-pinch.c	Wed Aug  6 20:36:18 2008
@@ -547,8 +547,9 @@
   gtk_widget_show (main_vbox);
 
   preview = gimp_zoom_preview_new (drawable);
-  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview);
+  gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
   gtk_widget_show (preview);
+
   g_signal_connect_swapped (preview, "invalidated",
                             G_CALLBACK (dialog_update_preview),
                             drawable);

Modified: branches/soc-2008-text/plug-ins/common/wind.c
==============================================================================
--- branches/soc-2008-text/plug-ins/common/wind.c	(original)
+++ branches/soc-2008-text/plug-ins/common/wind.c	Wed Aug  6 20:36:18 2008
@@ -898,10 +898,12 @@
   gtk_widget_show (main_vbox);
 
   preview = gimp_drawable_preview_new (drawable, NULL);
-  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview);
+  gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
   gtk_widget_show (preview);
+
   g_signal_connect_swapped (preview, "invalidated",
-                            G_CALLBACK (render_effect), drawable);
+                            G_CALLBACK (render_effect),
+                            drawable);
 
   /*****************************************************
     outer frame and table

Modified: branches/soc-2008-text/plug-ins/help-browser/dialog.c
==============================================================================
--- branches/soc-2008-text/plug-ins/help-browser/dialog.c	(original)
+++ branches/soc-2008-text/plug-ins/help-browser/dialog.c	Wed Aug  6 20:36:18 2008
@@ -4,6 +4,7 @@
  * GIMP Help Browser
  * Copyright (C) 1999-2008 Sven Neumann <sven gimp org>
  *                         Michael Natterer <mitch gimp org>
+ *                         RÃman Joost <romanofski gimp org>
  *
  * dialog.c
  *
@@ -26,16 +27,11 @@
 
 #include <stdlib.h>
 #include <string.h>
-#include <errno.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#include <glib/gstdio.h>
 
 #include <gtk/gtk.h>
 
+#include <gdk/gdkkeysyms.h>
+
 #include <webkit/webkit.h>
 
 #include "libgimpwidgets/gimpwidgets.h"
@@ -43,10 +39,6 @@
 #include "libgimp/gimp.h"
 #include "libgimp/gimpui.h"
 
-#ifdef G_OS_WIN32
-#include "libgimpbase/gimpwin32-io.h"
-#endif
-
 #include "plug-ins/help/gimphelp.h"
 
 #include "gimpthrobber.h"
@@ -57,12 +49,11 @@
 
 #include "libgimp/stdplugins-intl.h"
 
-#ifndef _O_BINARY
-#define _O_BINARY 0
-#endif
 
+#define GIMP_HELP_BROWSER_DIALOG_DATA      "gimp-help-browser-dialog"
+
+#define GIMP_HELP_BROWSER_INDEX_MAX_DEPTH  4
 
-#define GIMP_HELP_BROWSER_DIALOG_DATA  "gimp-help-browser-dialog"
 
 typedef struct
 {
@@ -81,59 +72,77 @@
 
 /*  local function prototypes  */
 
-static GtkUIManager * ui_manager_new     (GtkWidget         *window);
-
-static void       back_callback          (GtkAction         *action,
-                                          gpointer           data);
-static void       forward_callback       (GtkAction         *action,
-                                          gpointer           data);
-static void       reload_callback        (GtkAction         *action,
-                                          gpointer           data);
-static void       stop_callback          (GtkAction         *action,
-                                          gpointer           data);
-static void       home_callback          (GtkAction         *action,
-                                          gpointer           data);
-static void       copy_location_callback (GtkAction         *action,
-                                          gpointer           data);
-static void       show_index_callback    (GtkAction         *action,
-                                          gpointer           data);
-static void       zoom_in_callback       (GtkAction         *action,
-                                          gpointer           data);
-static void       zoom_out_callback      (GtkAction         *action,
-                                          gpointer           data);
-static void       close_callback         (GtkAction         *action,
-                                          gpointer           data);
-static void       website_callback       (GtkAction         *action,
-                                          gpointer           data);
-
-static void       update_actions         (void);
-
-static void       window_set_icons       (GtkWidget         *window);
-
-static void       row_activated          (GtkTreeView       *tree_view,
-                                          GtkTreePath       *path,
-                                          GtkTreeViewColumn *column);
-static void       dialog_unmap           (GtkWidget         *window,
-                                          GtkWidget         *paned);
-
-static void       view_realize           (GtkWidget         *widget);
-static void       view_unrealize         (GtkWidget         *widget);
-static gboolean   view_popup_menu        (GtkWidget         *widget,
-                                          GdkEventButton    *event);
-static gboolean   view_button_press      (GtkWidget         *widget,
-                                          GdkEventButton    *event);
-
-static void       title_changed          (GtkWidget         *view,
-                                          WebKitWebFrame    *frame,
-                                          const gchar       *title,
-                                          GtkWidget         *window);
-static void       load_started           (GtkWidget         *view,
-                                          WebKitWebFrame    *frame);
-static void       load_finished          (GtkWidget         *view,
-                                          WebKitWebFrame    *frame);
+static GtkUIManager * ui_manager_new      (GtkWidget         *window);
 
-static void       select_index           (const gchar       *uri);
+static GtkWidget * build_searchbar        (void);
 
+static void       back_callback           (GtkAction         *action,
+                                           gpointer           data);
+static void       forward_callback        (GtkAction         *action,
+                                           gpointer           data);
+static void       reload_callback         (GtkAction         *action,
+                                           gpointer           data);
+static void       stop_callback           (GtkAction         *action,
+                                           gpointer           data);
+static void       home_callback           (GtkAction         *action,
+                                           gpointer           data);
+static void       find_callback           (GtkAction         *action,
+                                           gpointer           data);
+static void       find_again_callback     (GtkAction         *action,
+                                           gpointer           data);
+static void       copy_location_callback  (GtkAction         *action,
+                                           gpointer           data);
+static void       show_index_callback     (GtkAction         *action,
+                                           gpointer           data);
+static void       zoom_in_callback        (GtkAction         *action,
+                                           gpointer           data);
+static void       zoom_out_callback       (GtkAction         *action,
+                                           gpointer           data);
+static void       close_callback          (GtkAction         *action,
+                                           gpointer           data);
+static void       website_callback        (GtkAction         *action,
+                                           gpointer           data);
+
+static void       update_actions          (void);
+
+static void       window_set_icons        (GtkWidget         *window);
+
+static void       row_activated           (GtkTreeView       *tree_view,
+                                           GtkTreePath       *path,
+                                           GtkTreeViewColumn *column);
+static void       dialog_unmap            (GtkWidget         *window,
+                                           GtkWidget         *paned);
+
+static void       view_realize            (GtkWidget         *widget);
+static void       view_unrealize          (GtkWidget         *widget);
+static gboolean   view_popup_menu         (GtkWidget         *widget,
+                                           GdkEventButton    *event);
+static gboolean   view_button_press       (GtkWidget         *widget,
+                                           GdkEventButton    *event);
+static gboolean   view_key_press          (GtkWidget         *widget,
+                                           GdkEventKey       *event);
+
+static void       title_changed           (GtkWidget         *view,
+                                           WebKitWebFrame    *frame,
+                                           const gchar       *title,
+                                           GtkWidget         *window);
+static void       load_started            (GtkWidget         *view,
+                                           WebKitWebFrame    *frame);
+static void       load_finished           (GtkWidget         *view,
+                                           WebKitWebFrame    *frame);
+
+static void       select_index            (const gchar       *uri);
+
+static void       search_entry_changed    (GtkWidget         *entry);
+static gboolean   search_entry_key_press  (GtkWidget         *entry,
+                                           GdkEventKey       *event);
+static void       search_prev_clicked     (GtkWidget         *button,
+                                           GtkWidget         *entry);
+static void       search_next_clicked     (GtkWidget         *button,
+                                           GtkWidget         *entry);
+static void       search_close_clicked    (GtkWidget         *button);
+static void       search                  (const gchar       *text,
+                                           gboolean           forward);
 
 
 /*  private variables  */
@@ -142,6 +151,7 @@
 
 static GtkWidget    *view           = NULL;
 static GtkWidget    *sidebar        = NULL;
+static GtkWidget    *searchbar      = NULL;
 static GtkWidget    *tree_view      = NULL;
 static GtkUIManager *ui_manager     = NULL;
 static GtkWidget    *button_prev    = NULL;
@@ -155,6 +165,7 @@
 browser_dialog_open (void)
 {
   GtkWidget   *window;
+  GtkWidget   *main_vbox;
   GtkWidget   *vbox;
   GtkWidget   *toolbar;
   GtkWidget   *paned;
@@ -253,12 +264,16 @@
                     NULL);
 
   /*  HTML view  */
+  main_vbox = gtk_vbox_new (FALSE, 0);
+  gtk_widget_show (main_vbox);
+  gtk_paned_pack2 (GTK_PANED (paned), main_vbox, TRUE, TRUE);
+
   scrolled = gtk_scrolled_window_new (NULL, NULL);
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
                                   GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
 
   gtk_widget_set_size_request (scrolled, 300, 200);
-  gtk_paned_add2 (GTK_PANED (paned), scrolled);
+  gtk_box_pack_start (GTK_BOX (main_vbox), scrolled, TRUE, TRUE, 0);
   gtk_widget_show (scrolled);
 
   view = webkit_web_view_new ();
@@ -280,6 +295,9 @@
   g_signal_connect (view, "button-press-event",
                     G_CALLBACK (view_button_press),
                     NULL);
+  g_signal_connect (view, "key-press-event",
+                    G_CALLBACK (view_key_press),
+                    NULL);
 
 #if HAVE_WEBKIT_ZOOM_API
   webkit_web_view_set_zoom_level (WEBKIT_WEB_VIEW (view), data.zoom);
@@ -303,6 +321,10 @@
                     paned);
 
   update_actions ();
+
+  /* Searchbar */
+  searchbar = build_searchbar ();
+  gtk_box_pack_start (GTK_BOX (main_vbox), searchbar, FALSE, FALSE, 0);
 }
 
 void
@@ -343,7 +365,6 @@
                                    GimpHelpItem   *item,
                                    GimpHelpLocale *locale)
 {
-
 #if 0
   g_printerr ("%s: processing %s (parent %s)\n",
               G_STRFUNC,
@@ -358,10 +379,21 @@
 
       for (i = 0; i < 5; i++)
         {
+          gunichar c;
+
           if (! indices[i])
             break;
 
-          item->index += atoi (indices[i]) << (8 * (5 - i));
+          c = g_utf8_get_char (indices[i]);
+
+          if (g_unichar_isdigit (c))
+            {
+              item->index += atoi (indices[i]) << (8 * (5 - i));
+            }
+          else if (g_utf8_strlen (indices[i], -1) == 1)
+            {
+              item->index += (c & 0xFF) << (8 * (5 - i));
+            }
         }
 
       g_strfreev (indices);
@@ -374,7 +406,9 @@
       parent = g_hash_table_lookup (locale->help_id_mapping, item->parent);
 
       if (parent)
-        parent->children = g_list_prepend (parent->children, item);
+        {
+          parent->children = g_list_prepend (parent->children, item);
+        }
     }
   else
     {
@@ -386,8 +420,8 @@
 help_item_compare (gconstpointer a,
                    gconstpointer b)
 {
-  GimpHelpItem *item_a = (GimpHelpItem *) a;
-  GimpHelpItem *item_b = (GimpHelpItem *) b;
+  const GimpHelpItem *item_a = a;
+  const GimpHelpItem *item_b = b;
 
   if (item_a->index > item_b->index)
     return 1;
@@ -402,7 +436,8 @@
            GimpHelpDomain *domain,
            GimpHelpLocale *locale,
            GtkTreeIter    *parent,
-           GimpHelpItem   *item)
+           GimpHelpItem   *item,
+           gint            depth)
 {
   GtkTreeIter  iter;
   GList       *list;
@@ -424,13 +459,16 @@
                        uri,
                        gtk_tree_iter_copy (&iter));
 
+  if (depth + 1 == GIMP_HELP_BROWSER_INDEX_MAX_DEPTH)
+    return;
+
   item->children = g_list_sort (item->children, help_item_compare);
 
   for (list = item->children; list; list = g_list_next (list))
     {
       GimpHelpItem *item = list->data;
 
-      add_child (store, domain, locale, &iter, item);
+      add_child (store, domain, locale, &iter, item, depth + 1);
     }
 }
 
@@ -470,7 +508,7 @@
     {
       GimpHelpItem *item = list->data;
 
-      add_child (store, domain, locale, NULL, item);
+      add_child (store, domain, locale, NULL, item, 0);
     }
 
   gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view), GTK_TREE_MODEL (store));
@@ -481,11 +519,12 @@
 select_index (const gchar *uri)
 {
   GtkTreeSelection *selection;
-  GtkTreeIter      *iter;
+  GtkTreeIter      *iter = NULL;
 
   selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
 
-  iter = g_hash_table_lookup (uri_hash_table, uri);
+  if (uri)
+    iter = g_hash_table_lookup (uri_hash_table, uri);
 
   if (iter)
     {
@@ -562,6 +601,16 @@
       G_CALLBACK (zoom_out_callback)
     },
     {
+      "find", GTK_STOCK_FIND,
+      NULL, "<control>F", N_("Find text in current page"),
+      G_CALLBACK (find_callback)
+    },
+    {
+      "find-again", NULL,
+      N_("Find _Again"), "<control>G", NULL,
+      G_CALLBACK (find_again_callback)
+    },
+    {
       "close", GTK_STOCK_CLOSE,
       NULL, "<control>W", NULL,
       G_CALLBACK (close_callback)
@@ -646,6 +695,9 @@
                                      "    <menuitem action=\"home\" />"
                                      "    <menuitem action=\"copy-location\" />"
                                      "    <menuitem action=\"show-index\" />"
+                                     "    <separator />"
+                                     "    <menuitem action=\"find\" />"
+                                     "    <menuitem action=\"find-again\" />"
 #ifdef HAVE_WEBKIT_ZOOM_API
                                      "    <separator />"
                                      "    <menuitem action=\"zoom-in\" />"
@@ -715,6 +767,28 @@
 }
 
 static void
+find_callback (GtkAction *action,
+               gpointer   data)
+{
+  GtkWidget *entry = g_object_get_data (G_OBJECT (searchbar), "entry");
+
+  gtk_widget_show (searchbar);
+  gtk_widget_grab_focus (entry);
+}
+
+static void
+find_again_callback (GtkAction *action,
+                     gpointer   data)
+{
+  GtkWidget *entry = g_object_get_data (G_OBJECT (searchbar), "entry");
+
+  gtk_widget_show (searchbar);
+  gtk_widget_grab_focus (entry);
+
+  search (gtk_entry_get_text (GTK_ENTRY (entry)), TRUE);
+}
+
+static void
 copy_location_callback (GtkAction *action,
                         gpointer   data)
 {
@@ -789,34 +863,39 @@
 
 /*  this function unrefs the items and frees the list  */
 static GtkWidget *
-build_menu (GList *list)
+build_menu (GList *items)
 {
   GtkWidget *menu;
+  GList     *list;
 
-  if (! list)
+  if (! items)
     return NULL;
 
   menu = gtk_menu_new ();
 
-  do
+  for (list = items; list; list = g_list_next (list))
     {
       WebKitWebHistoryItem *item = list->data;
-      GtkWidget            *menu_item;
+      const gchar          *title;
 
-      menu_item = gtk_menu_item_new_with_label (webkit_web_history_item_get_title (item));
+      title = webkit_web_history_item_get_title (item);
 
-      gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
-      gtk_widget_show (menu_item);
+      if (title)
+        {
+          GtkWidget *menu_item = gtk_menu_item_new_with_label (title);
+
+          gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
+          gtk_widget_show (menu_item);
 
-      g_signal_connect_object (menu_item, "activate",
-                               G_CALLBACK (menu_callback),
-                               item, 0);
+          g_signal_connect_object (menu_item, "activate",
+                                   G_CALLBACK (menu_callback),
+                                   item, 0);
 
-      g_object_unref (item);
+          g_object_unref (item);
+        }
     }
-  while ((list = g_list_next (list)));
 
-  g_list_free (list);
+  g_list_free (items);
 
   return menu;
 }
@@ -986,6 +1065,24 @@
   return FALSE;
 }
 
+static gboolean
+view_key_press (GtkWidget   *widget,
+                GdkEventKey *event)
+{
+  if (event->keyval == GDK_slash)
+    {
+      GtkAction *action;
+
+      action = gtk_ui_manager_get_action (ui_manager,
+                                          "/ui/help-browser-popup/find");
+      gtk_action_activate (action);
+
+      return TRUE;
+    }
+
+  return FALSE;
+}
+
 static void
 title_changed (GtkWidget      *view,
                WebKitWebFrame *frame,
@@ -1022,4 +1119,126 @@
   gtk_action_set_sensitive (action, FALSE);
 
   update_actions ();
+
+  select_index (webkit_web_frame_get_uri (frame));
+}
+
+static GtkWidget *
+build_searchbar (void)
+{
+  GtkWidget *button;
+  GtkWidget *image;
+  GtkWidget *entry;
+  GtkWidget *hbox;
+  GtkWidget *label;
+
+  hbox = gtk_hbox_new (FALSE, 6);
+
+  label = gtk_label_new (_("Find:"));
+  gtk_widget_show (label);
+  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+
+  entry = gtk_entry_new ();
+  gtk_widget_show (entry);
+  gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
+  g_object_set_data (G_OBJECT (hbox), "entry", entry);
+
+  g_signal_connect (entry, "changed",
+                    G_CALLBACK (search_entry_changed),
+                    NULL);
+
+  g_signal_connect (entry, "key-press-event",
+                    G_CALLBACK (search_entry_key_press),
+                    NULL);
+
+  button = gtk_button_new_with_mnemonic (C_("search", "_Previous"));
+  gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
+  gtk_button_set_image (GTK_BUTTON (button),
+                        gtk_image_new_from_stock (GTK_STOCK_GO_BACK,
+                                                  GTK_ICON_SIZE_BUTTON));
+  gtk_widget_show (button);
+  gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
+
+  g_signal_connect (button, "clicked",
+                    G_CALLBACK (search_prev_clicked),
+                    entry);
+
+  button = gtk_button_new_with_mnemonic (C_("search", "_Next"));
+  gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
+  gtk_button_set_image (GTK_BUTTON (button),
+                        gtk_image_new_from_stock (GTK_STOCK_GO_FORWARD,
+                                                  GTK_ICON_SIZE_BUTTON));
+  gtk_widget_show (button);
+  gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
+
+  g_signal_connect (button, "clicked",
+                    G_CALLBACK (search_next_clicked),
+                    entry);
+
+  button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
+  gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
+
+  g_object_get (button, "image", &image, NULL);
+  g_object_set (image, "icon-size", GTK_ICON_SIZE_MENU, NULL);
+  g_object_unref (image);
+
+  gtk_widget_show (button);
+  gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
+
+  g_signal_connect (button, "clicked",
+                    G_CALLBACK (search_close_clicked),
+                    NULL);
+
+  return hbox;
+}
+
+static void
+search_entry_changed (GtkWidget *entry)
+{
+  search (gtk_entry_get_text (GTK_ENTRY (entry)), TRUE);
+}
+
+static gboolean
+search_entry_key_press (GtkWidget   *entry,
+                        GdkEventKey *event)
+{
+  if (event->keyval == GDK_Escape)
+    {
+      gtk_widget_hide (searchbar);
+      webkit_web_view_unmark_text_matches (WEBKIT_WEB_VIEW (view));
+
+      return TRUE;
+    }
+
+  return FALSE;
+}
+
+static void
+search_prev_clicked (GtkWidget *button,
+                     GtkWidget *entry)
+{
+  search (gtk_entry_get_text (GTK_ENTRY (entry)), FALSE);
+}
+
+static void
+search_next_clicked (GtkWidget *button,
+                     GtkWidget *entry)
+{
+  search (gtk_entry_get_text (GTK_ENTRY (entry)), TRUE);
+}
+
+static void
+search (const gchar *text,
+        gboolean     forward)
+{
+  if (text)
+    webkit_web_view_search_text (WEBKIT_WEB_VIEW (view),
+                                 text, FALSE, forward, TRUE);
+}
+
+static void
+search_close_clicked (GtkWidget *button)
+{
+  gtk_widget_hide (searchbar);
+  webkit_web_view_unmark_text_matches (WEBKIT_WEB_VIEW (view));
 }

Modified: branches/soc-2008-text/plug-ins/help/gimphelpdomain.c
==============================================================================
--- branches/soc-2008-text/plug-ins/help/gimphelpdomain.c	(original)
+++ branches/soc-2008-text/plug-ins/help/gimphelpdomain.c	Wed Aug  6 20:36:18 2008
@@ -176,20 +176,33 @@
           switch (error->code)
             {
             case G_IO_ERROR_NOT_FOUND:
+              if (domain->help_domain)
+                {
+                  g_message (_("The help pages for '%s' are not available."),
+                             domain->help_domain);
+                }
+              else
+                {
+                  g_message ("%s\n\n%s",
+                             _("The GIMP user manual is not available."),
+                             _("Please install the additional help package "
+                               "or use the online user manual at "
+                               "http://docs.gimp.org/.";));
+                }
+              break;
+
+            case G_IO_ERROR_NOT_SUPPORTED:
               g_message ("%s\n\n%s",
-                         _("The GIMP user manual is not available."),
-                         _("Please install the additional help package or use "
-                           "the online user manual at http://docs.gimp.org/.";));
+                         error->message,
+                         _("Perhaps you are missing GIO backends and need "
+                           "to install GVFS?"));
               break;
 
             case G_IO_ERROR_CANCELLED:
               break;
 
             default:
-              g_message ("%s\n\n%s\n\n%s",
-                         _("There is a problem with the GIMP user manual."),
-                         error->message,
-                         _("Please check your installation."));
+              g_message (error->message);
               break;
             }
 

Modified: branches/soc-2008-text/plug-ins/help/gimphelpitem.h
==============================================================================
--- branches/soc-2008-text/plug-ins/help/gimphelpitem.h	(original)
+++ branches/soc-2008-text/plug-ins/help/gimphelpitem.h	Wed Aug  6 20:36:18 2008
@@ -31,7 +31,7 @@
   gchar *title;
   gchar *parent;
 
-  /* eek */
+  /*  extra fields used by the help-browser  */
   GList *children;
   gint   index;
 };

Modified: branches/soc-2008-text/plug-ins/help/gimphelplocale.c
==============================================================================
--- branches/soc-2008-text/plug-ins/help/gimphelplocale.c	(original)
+++ branches/soc-2008-text/plug-ins/help/gimphelplocale.c	Wed Aug  6 20:36:18 2008
@@ -194,7 +194,7 @@
     }
 
 #ifdef GIMP_HELP_DEBUG
-  g_printerr ("help (%s): parsing '%s' for locale \"%s\"\n",
+  g_printerr ("help (%s): parsing '%s' for \"%s\"\n",
               locale->locale_id, uri, help_domain);
 #endif
 
@@ -219,8 +219,8 @@
                                            cancellable, error);
       if (! info)
         {
-          locale_set_error (error, _("Could not open '%s' for reading: %s"),
-                            file);
+          locale_set_error (error,
+                            _("Could not open '%s' for reading: %s"), file);
           g_object_unref (file);
 
           return FALSE;
@@ -235,7 +235,8 @@
 
   if (! stream)
     {
-      locale_set_error (error, _("Could not open '%s' for reading: %s"), file);
+      locale_set_error (error, 
+                        _("Could not open '%s' for reading: %s"), file);
       g_object_unref (file);
 
       return FALSE;

Modified: branches/soc-2008-text/plug-ins/psd/Makefile.am
==============================================================================
--- branches/soc-2008-text/plug-ins/psd/Makefile.am	(original)
+++ branches/soc-2008-text/plug-ins/psd/Makefile.am	Wed Aug  6 20:36:18 2008
@@ -16,9 +16,11 @@
 
 libexecdir = $(gimpplugindir)/plug-ins
 
-libexec_PROGRAMS = psd
+libexec_PROGRAMS = \
+	psd-load	\
+	psd-save
 
-psd_SOURCES = \
+psd_load_SOURCES = \
 	psd.c			\
 	psd.h			\
 	psd-util.c		\
@@ -32,6 +34,9 @@
 	psd-layer-res-load.c	\
 	psd-layer-res-load.h		
 
+psd_save_SOURCES = \
+	psd-save.c
+
 EXTRA_DIST = \
 	TODO.txt		\
 	new-resource-ids.txt

Modified: branches/soc-2008-text/plug-ins/pygimp/gimpmodule.c
==============================================================================
--- branches/soc-2008-text/plug-ins/pygimp/gimpmodule.c	(original)
+++ branches/soc-2008-text/plug-ins/pygimp/gimpmodule.c	Wed Aug  6 20:36:18 2008
@@ -1710,7 +1710,6 @@
     {"personal_rc_file",        (PyCFunction)pygimp_personal_rc_file, METH_VARARGS | METH_KEYWORDS},
     {"context_push", (PyCFunction)pygimp_context_push, METH_NOARGS},
     {"context_pop", (PyCFunction)pygimp_context_pop, METH_NOARGS},
-    {"get_foreground",  (PyCFunction)pygimp_get_foreground,     METH_NOARGS},
     {"get_background",  (PyCFunction)pygimp_get_background,     METH_NOARGS},
     {"get_foreground",  (PyCFunction)pygimp_get_foreground,     METH_NOARGS},
     {"set_background",  (PyCFunction)pygimp_set_background,     METH_VARARGS},

Modified: branches/soc-2008-text/plug-ins/pygimp/pygimp-pdb.c
==============================================================================
--- branches/soc-2008-text/plug-ins/pygimp/pygimp-pdb.c	(original)
+++ branches/soc-2008-text/plug-ins/pygimp/pygimp-pdb.c	Wed Aug  6 20:36:18 2008
@@ -287,8 +287,26 @@
 	case GIMP_PDB_SELECTION:
 	    value = pygimp_layer_new(params[i].data.d_selection);
 	    break;
-	case GIMP_PDB_BOUNDARY:
-	    value = PyInt_FromLong(params[i].data.d_boundary);
+	case GIMP_PDB_COLORARRAY:
+	    if (params[i].data.d_colorarray == NULL) {
+		value = PyTuple_New(0);
+		break;
+	    }
+	    if ((tmp=PyTuple_GetItem(args, i-1)) == NULL) {
+		Py_DECREF(args);
+		return NULL;
+	    }
+	    if (!PyInt_Check(tmp)) {
+		PyErr_SetString(PyExc_TypeError,
+				"count type must be integer");
+		Py_DECREF(args);
+		return NULL;
+	    }
+	    n = PyInt_AsLong(tmp);
+	    value = PyTuple_New(n);
+	    for (j = 0; j < n; j++)
+		PyTuple_SetItem(value, j,
+                                pygimp_rgb_new(&params[i].data.d_colorarray[j]));
 	    break;
 	case GIMP_PDB_VECTORS:
 	    value = pygimp_vectors_new(params[i].data.d_vectors);
@@ -481,6 +499,10 @@
 	    ret[i].data.d_region.height = PyInt_AsLong(h);
 	    break;
 	case GIMP_PDB_DISPLAY:
+            if (item == Py_None) {
+                ret[i].data.d_display = -1;
+                break;
+            }
 	    check(!pygimp_display_check(item));
 	    ret[i].data.d_display = ((PyGimpDisplay *)item)->ID;
 	    break;
@@ -520,9 +542,23 @@
 	    check(!pygimp_layer_check(item));
 	    ret[i].data.d_selection = ((PyGimpLayer *)item)->ID;
 	    break;
-	case GIMP_PDB_BOUNDARY:
-	    check(!PyInt_Check(item));
-	    ret[i].data.d_boundary = PyInt_AsLong(item);
+	case GIMP_PDB_COLORARRAY:
+	    {
+                GimpRGB *rgb;
+
+		check(!PySequence_Check(item));
+		len = PySequence_Length(item);
+		rgb = g_new(GimpRGB, len);
+		for (j = 0; j < len; j++) {
+		    if (!pygimp_rgb_from_pyobject(item, &rgb[j])) {
+			Py_DECREF(tuple);
+			g_free(rgb);
+			gimp_destroy_params(ret, nparams);
+			return NULL;
+		    }
+		}
+                ret[i].data.d_colorarray = rgb;
+	    }
 	    break;
 	case GIMP_PDB_VECTORS:
 	    check(!pygimp_vectors_check(item));

Modified: branches/soc-2008-text/plug-ins/script-fu/scheme-wrapper.c
==============================================================================
--- branches/soc-2008-text/plug-ins/script-fu/scheme-wrapper.c	(original)
+++ branches/soc-2008-text/plug-ins/script-fu/scheme-wrapper.c	Wed Aug  6 20:36:18 2008
@@ -615,18 +615,18 @@
 #define typeflag(p) ((p)->_flag)
 #define type(p)     (typeflag(p)&T_MASKTYPE)
 
-char *ret_types[] = {
+static const char *ret_types[] = {
   "GIMP_PDB_INT32",       "GIMP_PDB_INT16",     "GIMP_PDB_INT8",
   "GIMP_PDB_FLOAT",       "GIMP_PDB_STRING",    "GIMP_PDB_INT32ARRAY",
   "GIMP_PDB_INT16ARRAY",  "GIMP_PDB_INT8ARRAY", "GIMP_PDB_FLOATARRAY",
   "GIMP_PDB_STRINGARRAY", "GIMP_PDB_COLOR",     "GIMP_PDB_REGION",
   "GIMP_PDB_DISPLAY",     "GIMP_PDB_IMAGE",     "GIMP_PDB_LAYER",
   "GIMP_PDB_CHANNEL",     "GIMP_PDB_DRAWABLE",  "GIMP_PDB_SELECTION",
-  "GIMP_PDB_BOUNDARY",    "GIMP_PDB_VECTORS",   "GIMP_PDB_PARASITE",
+  "GIMP_PDB_COLORARRY",   "GIMP_PDB_VECTORS",   "GIMP_PDB_PARASITE",
   "GIMP_PDB_STATUS",      "GIMP_PDB_END"
 };
 
-char *ts_types[] = {
+static const char *ts_types[] = {
   "T_NONE",
   "T_STRING",    "T_NUMBER",     "T_SYMBOL",       "T_PROC",
   "T_PAIR",      "T_CLOSURE",    "T_CONTINUATION", "T_FOREIGN",
@@ -634,7 +634,7 @@
   "T_PROMISE",   "T_ENVIRONMENT","T_ARRAY"
 };
 
-char *status_types[] = {
+static const char *status_types[] = {
   "GIMP_PDB_EXECUTION_ERROR", "GIMP_PDB_CALLING_ERROR",
   "GIMP_PDB_PASS_THROUGH",    "GIMP_PDB_SUCCESS",
   "GIMP_PDB_CANCEL"
@@ -739,7 +739,6 @@
         case GIMP_PDB_CHANNEL:
         case GIMP_PDB_DRAWABLE:
         case GIMP_PDB_SELECTION:
-        case GIMP_PDB_BOUNDARY:
         case GIMP_PDB_VECTORS:
           if (!sc->vptr->is_number (sc->vptr->pair_car (a)))
             success = FALSE;
@@ -846,7 +845,7 @@
     g_printerr ("     ");
     for (j = 0; j < count; ++j)
       g_printerr (" %ld",
-               sc->vptr->ivalue ( sc->vptr->vector_elem (vector, j) ));
+                  sc->vptr->ivalue ( sc->vptr->vector_elem (vector, j) ));
     g_printerr ("\n");
   }
 }
@@ -897,7 +896,7 @@
     g_printerr ("     ");
     for (j = 0; j < count; ++j)
       g_printerr (" %ld",
-               sc->vptr->ivalue ( sc->vptr->vector_elem (vector, j) ));
+                  sc->vptr->ivalue ( sc->vptr->vector_elem (vector, j) ));
     g_printerr ("\n");
   }
 }
@@ -950,7 +949,7 @@
     g_printerr ("     ");
     for (j = 0; j < count; ++j)
       g_printerr (" %ld",
-               sc->vptr->ivalue ( sc->vptr->vector_elem (vector, j) ));
+                  sc->vptr->ivalue ( sc->vptr->vector_elem (vector, j) ));
     g_printerr ("\n");
   }
 }
@@ -1003,7 +1002,7 @@
     g_printerr ("     ");
     for (j = 0; j < count; ++j)
       g_printerr (" %f",
-               sc->vptr->rvalue ( sc->vptr->vector_elem (vector, j) ));
+                  sc->vptr->rvalue ( sc->vptr->vector_elem (vector, j) ));
     g_printerr ("\n");
   }
 }
@@ -1104,6 +1103,66 @@
             }
           break;
 
+        case GIMP_PDB_COLORARRAY:
+          vector = sc->vptr->pair_car (a);
+          if (!sc->vptr->is_vector (vector))
+            success = FALSE;
+          if (success)
+            {
+              n_elements = args[i-1].data.d_int32;
+              if (n_elements < 0 ||
+                  n_elements > sc->vptr->vector_length (vector))
+                {
+                  g_snprintf (error_str, sizeof (error_str),
+                              "COLOR vector (argument %d) for function %s has "
+                              "size of %ld but expected size of %d",
+                              i+1, proc_name,
+                              sc->vptr->vector_length (vector), n_elements);
+                  return foreign_error (sc, error_str, 0);
+                }
+
+              args[i].data.d_colorarray = g_new (GimpRGB, n_elements);
+
+              for (j = 0; j < n_elements; j++)
+                {
+                  pointer v_element = sc->vptr->vector_elem (vector, j);
+                  pointer color_list;
+                  guchar  r, g, b;
+
+                  if (! (sc->vptr->is_list (sc,
+                                            sc->vptr->pair_car (v_element)) &&
+                         sc->vptr->list_length (sc,
+                                                sc->vptr->pair_car (v_element)) == 3))
+                    {
+                      g_snprintf (error_str, sizeof (error_str),
+                                  "Item %d in vector is not a color "
+                                  "(argument %d for function %s)",
+                                  j+1, i+1, proc_name);
+                      return foreign_error (sc, error_str, vector);
+                    }
+
+                  color_list = sc->vptr->pair_car (v_element);
+                  r = CLAMP (sc->vptr->ivalue (sc->vptr->pair_car (color_list)),
+                             0, 255);
+                  color_list = sc->vptr->pair_cdr (color_list);
+                  g = CLAMP (sc->vptr->ivalue (sc->vptr->pair_car (color_list)),
+                             0, 255);
+                  color_list = sc->vptr->pair_cdr (color_list);
+                  b = CLAMP (sc->vptr->ivalue (sc->vptr->pair_car (color_list)),
+                             0, 255);
+
+                  gimp_rgba_set_uchar (&args[i].data.d_colorarray[j],
+                                       r, g, b, 255);
+                }
+#if DEBUG_MARSHALL
+{
+glong count = sc->vptr->vector_length (vector);
+g_printerr ("      color vector has %ld elements\n", count);
+}
+#endif
+            }
+          break;
+
         case GIMP_PDB_REGION:
           if (! (sc->vptr->is_list (sc, sc->vptr->pair_car (a)) &&
             sc->vptr->list_length (sc, sc->vptr->pair_car (a)) == 4))
@@ -1282,7 +1341,6 @@
             case GIMP_PDB_CHANNEL:
             case GIMP_PDB_DRAWABLE:
             case GIMP_PDB_SELECTION:
-            case GIMP_PDB_BOUNDARY:
             case GIMP_PDB_VECTORS:
               return_val = sc->vptr->cons (sc,
                              sc->vptr->mk_integer (sc,
@@ -1457,6 +1515,38 @@
                 break;
               }
 
+            case GIMP_PDB_COLORARRAY:
+              /*  color arrays are always implemented such that the previous
+               *  return value contains the number of strings in the array
+               */
+              {
+                gint32   num_colors = values[i].data.d_int32;
+                GimpRGB *array  = (GimpRGB *) values[i + 1].data.d_colorarray;
+                pointer  vector = sc->vptr->mk_vector (sc, num_colors);
+
+                return_val = sc->vptr->cons (sc, vector, return_val);
+                set_safe_foreign (sc, return_val);
+
+                for (j = 0; j < num_colors; j++)
+                  {
+                    guchar r, g, b;
+
+                    gimp_rgb_get_uchar (&array[j], &r, &g, &b);
+
+                    intermediate_val = sc->vptr->cons (sc,
+                        sc->vptr->mk_integer (sc, r),
+                        sc->vptr->cons (sc,
+                            sc->vptr->mk_integer (sc, g),
+                            sc->vptr->cons (sc,
+                                sc->vptr->mk_integer (sc, b),
+                                sc->NIL)));
+                    return_val = sc->vptr->cons (sc,
+                                                 intermediate_val,
+                                                 return_val);
+                    set_safe_foreign (sc, return_val);
+                  }
+              }
+              break;
             case GIMP_PDB_REGION:
               {
                 gint32 x, y, w, h;
@@ -1612,6 +1702,10 @@
           g_free (params[i].data.d_stringarray);
           break;
 
+        case GIMP_PDB_COLORARRAY:
+          g_free (params[i].data.d_colorarray);
+          break;
+
         case GIMP_PDB_COLOR:
         case GIMP_PDB_REGION:
         case GIMP_PDB_DISPLAY:
@@ -1620,7 +1714,6 @@
         case GIMP_PDB_CHANNEL:
         case GIMP_PDB_DRAWABLE:
         case GIMP_PDB_SELECTION:
-        case GIMP_PDB_BOUNDARY:
         case GIMP_PDB_VECTORS:
         case GIMP_PDB_PARASITE:
         case GIMP_PDB_STATUS:

Modified: branches/soc-2008-text/plug-ins/selection-to-path/pxl-outline.c
==============================================================================
--- branches/soc-2008-text/plug-ins/selection-to-path/pxl-outline.c	(original)
+++ branches/soc-2008-text/plug-ins/selection-to-path/pxl-outline.c	Wed Aug  6 20:36:18 2008
@@ -21,8 +21,6 @@
 
 #include "config.h"
 
-#include <stdlib.h>
-
 #include "global.h"
 #include "selection-to-path.h"
 #include "bitmap.h"
@@ -253,7 +251,7 @@
       break;
 
     default:
-      printf ("append_coordinate: Bad edge (%d)", edge);
+      g_printerr ("append_coordinate: Bad edge (%d)", edge);
     }
 
   append_outline_pixel (o, c);

Modified: branches/soc-2008-text/plug-ins/uri/Makefile.am
==============================================================================
--- branches/soc-2008-text/plug-ins/uri/Makefile.am	(original)
+++ branches/soc-2008-text/plug-ins/uri/Makefile.am	Wed Aug  6 20:36:18 2008
@@ -25,13 +25,13 @@
 else
 if HAVE_GNOMEVFS
 backend_sources = uri-backend-gnomevfs.c
-backend_cflags = $(URI_GNOME_VFS_CFLAGS)
-backend_libs = $(URI_GNOME_VFS_LIBS)
+backend_cflags = $(GNOME_VFS_CFLAGS)
+backend_libs = $(GNOME_VFS_LIBS)
 else
 if HAVE_LIBCURL
 backend_sources = uri-backend-libcurl.c
-backend_cflags = $(URI_LIBCURL_CFLAGS)
-backend_libs = $(URI_LIBCURL_LIBS)
+backend_cflags = $(CURL_CFLAGS)
+backend_libs = $(CURL_LIBS)
 else
 backend_sources = uri-backend-wget.c
 backend_cflags = 

Modified: branches/soc-2008-text/plug-ins/uri/uri-backend-gvfs.c
==============================================================================
--- branches/soc-2008-text/plug-ins/uri/uri-backend-gvfs.c	(original)
+++ branches/soc-2008-text/plug-ins/uri/uri-backend-gvfs.c	Wed Aug  6 20:36:18 2008
@@ -199,9 +199,11 @@
         case DOWNLOAD:
           format = _("Downloading image (%s of %s)");
           break;
+
         case UPLOAD:
           format = _("Uploading image (%s of %s)");
           break;
+
         default:
           g_assert_not_reached ();
         }
@@ -223,9 +225,11 @@
         case DOWNLOAD:
           format = _("Downloaded %s of image data");
           break;
+
         case UPLOAD:
           format = _("Uploaded %s of image data");
           break;
+
         default:
           g_assert_not_reached ();
         }

Modified: branches/soc-2008-text/plug-ins/uri/uri-backend-libcurl.c
==============================================================================
--- branches/soc-2008-text/plug-ins/uri/uri-backend-libcurl.c	(original)
+++ branches/soc-2008-text/plug-ins/uri/uri-backend-libcurl.c	Wed Aug  6 20:36:18 2008
@@ -21,12 +21,12 @@
 
 #include "config.h"
 
-#include <stdio.h>
-
 #include <curl/curl.h>
 #include <curl/types.h>
 #include <curl/easy.h>
 
+#include <glib/gstdio.h>
+
 #include <libgimp/gimp.h>
 #include <libgimp/gimpui.h>
 
@@ -154,7 +154,7 @@
 
   gimp_progress_init (_("Connecting to server"));
 
-  if ((out_file = fopen(tmpname, "wb")) == NULL)
+  if ((out_file = g_fopen (tmpname, "wb")) == NULL)
     {
       g_set_error (error, 0, 0,
                    _("Could not open output file for writing"));

Modified: branches/soc-2008-text/po-libgimp/POTFILES.in
==============================================================================
--- branches/soc-2008-text/po-libgimp/POTFILES.in	(original)
+++ branches/soc-2008-text/po-libgimp/POTFILES.in	Wed Aug  6 20:36:18 2008
@@ -19,6 +19,7 @@
 libgimp/gimpunitcache.c
 
 libgimpbase/gimpbaseenums.c
+libgimpbase/gimpcpuaccel.c
 libgimpbase/gimpmemsize.c
 libgimpbase/gimputils.c
 

Modified: branches/soc-2008-text/po-plug-ins/POTFILES.in
==============================================================================
--- branches/soc-2008-text/po-plug-ins/POTFILES.in	(original)
+++ branches/soc-2008-text/po-plug-ins/POTFILES.in	Wed Aug  6 20:36:18 2008
@@ -111,7 +111,6 @@
 plug-ins/common/poppler.c
 plug-ins/common/postscript.c
 plug-ins/common/procedure-browser.c
-plug-ins/common/psd-save.c
 plug-ins/common/psp.c
 plug-ins/common/qbist.c
 plug-ins/common/raw.c
@@ -263,6 +262,7 @@
 plug-ins/print/print.c
 plug-ins/psd/psd-image-res-load.c
 plug-ins/psd/psd-load.c
+plug-ins/psd/psd-save.c
 plug-ins/psd/psd-thumb-load.c
 plug-ins/psd/psd-util.c
 plug-ins/psd/psd.c

Modified: branches/soc-2008-text/themes/Default/images/stock-user-manual-64.png
==============================================================================
Binary files. No diff available.

Modified: branches/soc-2008-text/tools/pdbgen/app.pl
==============================================================================
--- branches/soc-2008-text/tools/pdbgen/app.pl	(original)
+++ branches/soc-2008-text/tools/pdbgen/app.pl	Wed Aug  6 20:36:18 2008
@@ -487,6 +487,14 @@
                               $flags)
 CODE
     }
+    elsif ($pdbtype eq 'colorarray') {
+	$pspec = <<CODE;
+gimp_param_spec_color_array ("$name",
+                             "$nick",
+                             "$blurb",
+                             $flags)
+CODE
+    }
     else {
 	warn "Unsupported PDB type: $arg->{name} ($arg->{type})";
 	exit -1;

Modified: branches/soc-2008-text/tools/pdbgen/enums.pl
==============================================================================
--- branches/soc-2008-text/tools/pdbgen/enums.pl	(original)
+++ branches/soc-2008-text/tools/pdbgen/enums.pl	Wed Aug  6 20:36:18 2008
@@ -265,9 +265,9 @@
 			  GIMP_PDB_COLOR GIMP_PDB_REGION GIMP_PDB_DISPLAY
 			  GIMP_PDB_IMAGE GIMP_PDB_LAYER GIMP_PDB_CHANNEL
 			  GIMP_PDB_DRAWABLE GIMP_PDB_SELECTION
-			  GIMP_PDB_BOUNDARY GIMP_PDB_VECTORS
+			  GIMP_PDB_COLORARRAY GIMP_PDB_VECTORS
 			  GIMP_PDB_PARASITE GIMP_PDB_STATUS GIMP_PDB_END
-			  GIMP_PDB_PATH) ],
+			  GIMP_PDB_PATH GIMP_PDB_BOUNDARY) ],
 	  mapping => { GIMP_PDB_INT32 => '0',
 		       GIMP_PDB_INT16 => '1',
 		       GIMP_PDB_INT8 => '2',
@@ -286,12 +286,13 @@
 		       GIMP_PDB_CHANNEL => '15',
 		       GIMP_PDB_DRAWABLE => '16',
 		       GIMP_PDB_SELECTION => '17',
-		       GIMP_PDB_BOUNDARY => '18',
+		       GIMP_PDB_COLORARRAY => '18',
 		       GIMP_PDB_VECTORS => '19',
 		       GIMP_PDB_PARASITE => '20',
 		       GIMP_PDB_STATUS => '21',
 		       GIMP_PDB_END => '22',
-		       GIMP_PDB_PATH => 'GIMP_PDB_VECTORS' }
+		       GIMP_PDB_PATH => 'GIMP_PDB_VECTORS',
+		       GIMP_PDB_BOUNDARY => 'GIMP_PDB_COLORARRAY' }
 	},
     GimpPDBProcType =>
 	{ contig => 1,

Modified: branches/soc-2008-text/tools/pdbgen/pdb.pl
==============================================================================
--- branches/soc-2008-text/tools/pdbgen/pdb.pl	(original)
+++ branches/soc-2008-text/tools/pdbgen/pdb.pl	Wed Aug  6 20:36:18 2008
@@ -85,6 +85,13 @@
 		     init_value     => 'NULL',
 		     get_value_func => '$var = gimp_value_get_stringarray ($value)',
 		     set_value_func => 'gimp_value_take_stringarray ($value, $var, $var_len)' },
+    colorarray  => { name           => 'COLORARRAY',
+		     type           => 'GimpRGB *',
+		     const_type     => 'const GimpRGB *',
+		     array          => 1,
+		     init_value     => 'NULL',
+		     get_value_func => '$var = gimp_value_get_colorarray ($value)',
+		     set_value_func => 'gimp_value_take_colorarray ($value, $var, $var_len)' },
 
     color => { name           => 'COLOR' , 
 	       type           => 'GimpRGB ',

Modified: branches/soc-2008-text/tools/pdbgen/pdb/edit.pdb
==============================================================================
--- branches/soc-2008-text/tools/pdbgen/pdb/edit.pdb	(original)
+++ branches/soc-2008-text/tools/pdbgen/pdb/edit.pdb	Wed Aug  6 20:36:18 2008
@@ -23,10 +23,12 @@
     $help = <<'HELP';
 If there is a selection in the image, then the area specified by the
 selection is cut from the specified drawable and placed in an internal
-GIMP edit buffer.  It can subsequently be retrieved using the
+GIMP edit buffer. It can subsequently be retrieved using the
 gimp_edit_paste() command. If there is no selection, then the
 specified drawable will be removed and its contents stored in the
-internal GIMP edit buffer.
+internal GIMP edit buffer. This procedure will fail if the selected area
+lies completely outside the bounds of the current drawable and there is
+nothing to copy from.
 HELP
 
     &std_pdb_misc;
@@ -38,8 +40,8 @@
 
     @outargs = (
 	{ name => 'non_empty', type => 'boolean',
-	  desc => 'TRUE if the cut was successful, FALSE if the
-                   selection contained only transparent pixels' }
+	  desc => 'TRUE if the cut was successful,
+                   FALSE if there was nothing to copy from' }
     );
 
     %invoke = (
@@ -75,7 +77,9 @@
 internal GIMP edit buffer. It can subsequently be retrieved using the
 gimp_edit_paste() command.  If there is no selection, then the
 specified drawable's contents will be stored in the internal GIMP edit
-buffer.
+buffer. This procedure will fail if the selected area lies completely
+outside the bounds of the current drawable and there is nothing to
+copy from.
 HELP
 
     &std_pdb_misc;
@@ -87,8 +91,8 @@
 
     @outargs = (
 	{ name => 'non_empty', type => 'boolean',
-	  desc => 'TRUE if the copy was successful, FALSE if the
-                   selection contained only transparent pixels' }
+	  desc => 'TRUE if the cut was successful,
+                   FALSE if there was nothing to copy from' }
     );
 
     %invoke = (
@@ -135,8 +139,7 @@
 
     @outargs = (
 	{ name => 'non_empty', type => 'boolean',
-	  desc => 'TRUE if the copy was successful, FALSE if the
-                   selection contained only transparent pixels' }
+	  desc => 'TRUE if the copy was successful' }
     );
 
     %invoke = (
@@ -266,7 +269,7 @@
     @outargs = (
 	{ name => 'real_name', type => 'string',
 	  desc => 'The real name given to the buffer, or NULL if the
-                   selection contained only transparent pixels' }
+                   cut failed' }
     );
 
     %invoke = (
@@ -318,7 +321,7 @@
     @outargs = (
 	{ name => 'real_name', type => 'string',
 	  desc => 'The real name given to the buffer, or NULL if the
-                   selection contained only transparent pixels' }
+                   copy failed' }
     );
 
     %invoke = (
@@ -372,7 +375,7 @@
     @outargs = (
 	{ name => 'real_name', type => 'string',
 	  desc => 'The real name given to the buffer, or NULL if the
-                   selection contained only transparent pixels' }
+                   copy failed' }
     );
 
     %invoke = (
@@ -868,7 +871,8 @@
 	headers => [ qw("core/gimpstrokedesc.h") ],
 	code => <<'CODE'
 {
-  if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) &&
+      gimp_pdb_item_is_attached (GIMP_ITEM (vectors), error))
     {
       GimpStrokeDesc *desc  = gimp_stroke_desc_new (gimp, context);
 

Modified: branches/soc-2008-text/tools/pdbgen/pdb/palette.pdb
==============================================================================
--- branches/soc-2008-text/tools/pdbgen/pdb/palette.pdb	(original)
+++ branches/soc-2008-text/tools/pdbgen/pdb/palette.pdb	Wed Aug  6 20:36:18 2008
@@ -212,6 +212,53 @@
     );
 }
 
+sub palette_get_colors {
+    $blurb = 'Gets all colors from the specified palette.';
+
+    $help = <<'HELP';
+This procedure retrieves all color entries of the specified palette. 
+HELP
+
+    &neo_pdb_misc('2006', '2.6');
+
+    @inargs = (
+	{ name => 'name', type => 'string', non_empty => 1,
+	  desc => 'The palette name' }
+    );
+
+    @outargs = (
+    	{ name => 'colors', type => 'colorarray',
+	  desc => 'The colors in the palette',
+	  array => { name => 'num_colors',
+                     desc => 'Length of the colors array' } }
+    );
+
+    %invoke = (
+	vars => [ 'GimpPalette *palette = NULL' ],
+	code => <<'CODE'
+{
+  GimpPalette *palette = gimp_pdb_get_palette (gimp, name, FALSE, error);
+
+  if (palette)
+    {
+      GList *list = palette->colors;
+      gint   i;
+
+      num_colors = palette->n_colors;
+      colors     = g_new (GimpRGB, num_colors);
+
+      for (i = 0; i < num_colors; i++, list = g_list_next (list))
+	colors[i] = ((GimpPaletteEntry *)(list->data))->color;
+    }
+  else
+    {
+      success = FALSE;
+    }
+}
+CODE
+    );
+}
+
 sub palette_get_columns {
     $blurb = "Retrieves the number of columns to use to display this palette";
     $help = <<'HELP';
@@ -551,7 +598,7 @@
             palette_rename
             palette_delete
             palette_is_editable
-            palette_get_info
+            palette_get_info palette_get_colors
             palette_get_columns palette_set_columns
             palette_add_entry palette_delete_entry
             palette_entry_get_color palette_entry_set_color

Modified: branches/soc-2008-text/tools/pdbgen/pdb/vectors.pdb
==============================================================================
--- branches/soc-2008-text/tools/pdbgen/pdb/vectors.pdb	(original)
+++ branches/soc-2008-text/tools/pdbgen/pdb/vectors.pdb	Wed Aug  6 20:36:18 2008
@@ -122,6 +122,41 @@
     );
 }
 
+sub vectors_copy {
+    $blurb = 'Copy a vectors object.';
+
+    $help = <<'HELP';
+This procedure copies the specified vectors object and returns the copy.
+HELP
+
+    $author = 'Barak Itkin <lightningismyname gmail com>';
+    $copyright = 'Barak Itkin';
+    $date = '2008';
+    $since = '2.6';
+
+    @inargs = (
+	{ name => 'vectors', type => 'vectors',
+	  desc => 'The vectors object to copy' }
+    );
+
+    @outargs = (
+	{ name => 'vectors_copy', type => 'vectors',
+	  desc => 'The newly copied vectors object' }
+    );
+
+    %invoke = (
+	code => <<'CODE'
+{
+  vectors_copy = GIMP_VECTORS (gimp_item_duplicate (GIMP_ITEM (vectors),
+                               G_TYPE_FROM_INSTANCE (vectors)));
+
+  if (! vectors_copy)
+    success = FALSE;
+}
+CODE
+    );
+}
+
 sub vectors_get_image {
     $blurb = 'Returns the vectors objects image.';
     $help  = 'Returns the vectors objects image.';
@@ -1404,6 +1439,7 @@
 @procs = qw(vectors_is_valid
             vectors_new
 	    vectors_new_from_text_layer
+            vectors_copy
             vectors_get_image
             vectors_get_name vectors_set_name
             vectors_get_visible vectors_set_visible



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]