gimp r24822 - in branches/weskaggs: . app app/base app/core app/dialogs app/display app/gegl app/paint app/pdb app/tools app/widgets libgimpconfig libgimpwidgets menus plug-ins/common plug-ins/print plug-ins/script-fu po themes/Default/images themes/Default/images/tools tools/pdbgen/pdb



Author: weskaggs
Date: Wed Feb  6 17:19:00 2008
New Revision: 24822
URL: http://svn.gnome.org/viewvc/gimp?rev=24822&view=rev

Log:
Bill Skaggs  <weskaggs primate ucdavis edu>
	
	Merged 24759:24821 from trunk.


Added:
   branches/weskaggs/app/core/gimpdrawable-brightness-contrast.c
      - copied unchanged from r24821, /trunk/app/core/gimpdrawable-brightness-contrast.c
   branches/weskaggs/app/core/gimpdrawable-brightness-contrast.h
      - copied unchanged from r24821, /trunk/app/core/gimpdrawable-brightness-contrast.h
   branches/weskaggs/app/core/gimpdrawable-color-balance.c
      - copied unchanged from r24821, /trunk/app/core/gimpdrawable-color-balance.c
   branches/weskaggs/app/core/gimpdrawable-color-balance.h
      - copied unchanged from r24821, /trunk/app/core/gimpdrawable-color-balance.h
   branches/weskaggs/app/core/gimpdrawable-colorize.c
      - copied unchanged from r24821, /trunk/app/core/gimpdrawable-colorize.c
   branches/weskaggs/app/core/gimpdrawable-colorize.h
      - copied unchanged from r24821, /trunk/app/core/gimpdrawable-colorize.h
   branches/weskaggs/app/core/gimpdrawable-curves.c
      - copied unchanged from r24821, /trunk/app/core/gimpdrawable-curves.c
   branches/weskaggs/app/core/gimpdrawable-curves.h
      - copied unchanged from r24821, /trunk/app/core/gimpdrawable-curves.h
   branches/weskaggs/app/core/gimpdrawable-hue-saturation.c
      - copied unchanged from r24821, /trunk/app/core/gimpdrawable-hue-saturation.c
   branches/weskaggs/app/core/gimpdrawable-hue-saturation.h
      - copied unchanged from r24821, /trunk/app/core/gimpdrawable-hue-saturation.h
   branches/weskaggs/app/core/gimpdrawable-posterize.c
      - copied unchanged from r24821, /trunk/app/core/gimpdrawable-posterize.c
   branches/weskaggs/app/core/gimpdrawable-posterize.h
      - copied unchanged from r24821, /trunk/app/core/gimpdrawable-posterize.h
   branches/weskaggs/app/core/gimpdrawable-threshold.c
      - copied unchanged from r24821, /trunk/app/core/gimpdrawable-threshold.c
   branches/weskaggs/app/core/gimpdrawable-threshold.h
      - copied unchanged from r24821, /trunk/app/core/gimpdrawable-threshold.h
   branches/weskaggs/app/tools/gimpgegltool.c
      - copied unchanged from r24821, /trunk/app/tools/gimpgegltool.c
   branches/weskaggs/app/tools/gimpgegltool.h
      - copied unchanged from r24821, /trunk/app/tools/gimpgegltool.h
   branches/weskaggs/plug-ins/print/print-page-setup.c
      - copied unchanged from r24821, /trunk/plug-ins/print/print-page-setup.c
   branches/weskaggs/plug-ins/print/print-page-setup.h
      - copied unchanged from r24821, /trunk/plug-ins/print/print-page-setup.h
   branches/weskaggs/themes/Default/images/stock-gegl-16.png
      - copied unchanged from r24821, /trunk/themes/Default/images/stock-gegl-16.png
   branches/weskaggs/themes/Default/images/stock-gegl-24.png
      - copied unchanged from r24821, /trunk/themes/Default/images/stock-gegl-24.png
Modified:
   branches/weskaggs/ChangeLog
   branches/weskaggs/INSTALL
   branches/weskaggs/app/app.c
   branches/weskaggs/app/base/gimphistogram.c
   branches/weskaggs/app/base/gimphistogram.h
   branches/weskaggs/app/core/Makefile.am
   branches/weskaggs/app/core/core-types.h
   branches/weskaggs/app/core/gimpdatafactory.c
   branches/weskaggs/app/core/gimpdrawable-equalize.c
   branches/weskaggs/app/core/gimpdrawable-levels.c
   branches/weskaggs/app/core/gimpimagemap.c
   branches/weskaggs/app/dialogs/dialogs.c
   branches/weskaggs/app/dialogs/image-new-dialog.c
   branches/weskaggs/app/display/gimpdisplayshell-preview.c
   branches/weskaggs/app/display/gimpdisplayshell-transform.c
   branches/weskaggs/app/gegl/gegl-types.h
   branches/weskaggs/app/gegl/gimp-gegl.c
   branches/weskaggs/app/gegl/gimpbrightnesscontrastconfig.c
   branches/weskaggs/app/gegl/gimpbrightnesscontrastconfig.h
   branches/weskaggs/app/gegl/gimpcolorbalanceconfig.c
   branches/weskaggs/app/gegl/gimpcolorbalanceconfig.h
   branches/weskaggs/app/gegl/gimpcolorizeconfig.c
   branches/weskaggs/app/gegl/gimpcolorizeconfig.h
   branches/weskaggs/app/gegl/gimpcurvesconfig.c
   branches/weskaggs/app/gegl/gimpcurvesconfig.h
   branches/weskaggs/app/gegl/gimphuesaturationconfig.c
   branches/weskaggs/app/gegl/gimphuesaturationconfig.h
   branches/weskaggs/app/gegl/gimplevelsconfig.c
   branches/weskaggs/app/gegl/gimplevelsconfig.h
   branches/weskaggs/app/gegl/gimpoperationcurves.c
   branches/weskaggs/app/gegl/gimpoperationhuesaturation.c
   branches/weskaggs/app/gegl/gimpoperationposterize.c
   branches/weskaggs/app/gegl/gimpposterizeconfig.c
   branches/weskaggs/app/gegl/gimpposterizeconfig.h
   branches/weskaggs/app/gegl/gimpthresholdconfig.c
   branches/weskaggs/app/gegl/gimpthresholdconfig.h
   branches/weskaggs/app/paint/gimpbrushcore.c
   branches/weskaggs/app/pdb/color_cmds.c
   branches/weskaggs/app/pdb/drawable_cmds.c
   branches/weskaggs/app/pdb/drawable_transform_cmds.c
   branches/weskaggs/app/pdb/edit_cmds.c
   branches/weskaggs/app/pdb/floating_sel_cmds.c
   branches/weskaggs/app/pdb/gimppdb-utils.c
   branches/weskaggs/app/pdb/gimppdb-utils.h
   branches/weskaggs/app/pdb/layer_cmds.c
   branches/weskaggs/app/pdb/paint_tools_cmds.c
   branches/weskaggs/app/pdb/selection_cmds.c
   branches/weskaggs/app/pdb/text_tool_cmds.c
   branches/weskaggs/app/pdb/transform_tools_cmds.c
   branches/weskaggs/app/tools/Makefile.am
   branches/weskaggs/app/tools/gimp-tools.c
   branches/weskaggs/app/tools/gimpcurvestool.c
   branches/weskaggs/app/tools/gimpcurvestool.h
   branches/weskaggs/app/tools/gimpimagemaptool.c
   branches/weskaggs/app/tools/gimpimagemaptool.h
   branches/weskaggs/app/tools/gimplevelstool.c
   branches/weskaggs/app/tools/gimplevelstool.h
   branches/weskaggs/app/tools/gimppolygonselecttool.c
   branches/weskaggs/app/tools/gimppolygonselecttool.h
   branches/weskaggs/app/tools/gimpthresholdtool.c
   branches/weskaggs/app/tools/gimpthresholdtool.h
   branches/weskaggs/app/widgets/gimpcontainerview.c
   branches/weskaggs/app/widgets/gimphistogrameditor.c
   branches/weskaggs/app/widgets/gimphistogramview.c
   branches/weskaggs/app/widgets/gimppropwidgets.c
   branches/weskaggs/app/widgets/gimppropwidgets.h
   branches/weskaggs/libgimpconfig/gimpconfig-iface.c
   branches/weskaggs/libgimpconfig/gimpconfig-iface.h
   branches/weskaggs/libgimpconfig/gimpconfig-utils.c
   branches/weskaggs/libgimpwidgets/gimpstock.c
   branches/weskaggs/libgimpwidgets/gimpstock.h
   branches/weskaggs/menus/image-menu.xml.in
   branches/weskaggs/plug-ins/common/iwarp.c
   branches/weskaggs/plug-ins/common/psd-save.c
   branches/weskaggs/plug-ins/print/Makefile.am
   branches/weskaggs/plug-ins/print/print-draw-page.c
   branches/weskaggs/plug-ins/print/print-page-layout.c
   branches/weskaggs/plug-ins/print/print-settings.c
   branches/weskaggs/plug-ins/print/print.c
   branches/weskaggs/plug-ins/print/print.h
   branches/weskaggs/plug-ins/script-fu/script-fu.c
   branches/weskaggs/po/ChangeLog
   branches/weskaggs/po/POTFILES.in
   branches/weskaggs/po/fr.po
   branches/weskaggs/themes/Default/images/Makefile.am
   branches/weskaggs/themes/Default/images/tools/stock-tool-polygon-select-22.png
   branches/weskaggs/tools/pdbgen/pdb/color.pdb
   branches/weskaggs/tools/pdbgen/pdb/drawable.pdb
   branches/weskaggs/tools/pdbgen/pdb/drawable_transform.pdb
   branches/weskaggs/tools/pdbgen/pdb/edit.pdb
   branches/weskaggs/tools/pdbgen/pdb/floating_sel.pdb
   branches/weskaggs/tools/pdbgen/pdb/layer.pdb
   branches/weskaggs/tools/pdbgen/pdb/paint_tools.pdb
   branches/weskaggs/tools/pdbgen/pdb/selection.pdb
   branches/weskaggs/tools/pdbgen/pdb/text_tool.pdb
   branches/weskaggs/tools/pdbgen/pdb/transform_tools.pdb

Modified: branches/weskaggs/INSTALL
==============================================================================
--- branches/weskaggs/INSTALL	(original)
+++ branches/weskaggs/INSTALL	Wed Feb  6 17:19:00 2008
@@ -28,8 +28,8 @@
   1. You need to have installed a recent version of pkg-config available
      from http://www.freedesktop.org/software/pkgconfig/.  
 
-  2. You need to have installed GEGL version 0.0.14 or newer.
-     The GEGL sources can be grabbed from ftp://ftp.gimp.org/pub/gegl/.
+  2. You need to have installed GEGL trunk. To check out GEGL trunk:
+     svn co http://svn.gnome.org/svn/gegl/trunk gegl-trunk
 
   3. You need to have installed GTK+ version 2.12.1 or newer.  GIMP
      also need a recent versions of GLib (>= 2.14.1) and Pango (>= 1.12.2).

Modified: branches/weskaggs/app/app.c
==============================================================================
--- branches/weskaggs/app/app.c	(original)
+++ branches/weskaggs/app/app.c	Wed Feb  6 17:19:00 2008
@@ -32,8 +32,6 @@
 
 #include <glib-object.h>
 
-#include <gegl.h>
-
 #include "libgimpbase/gimpbase.h"
 #include "libgimpconfig/gimpconfig.h"
 
@@ -82,8 +80,6 @@
 {
   g_type_init ();
 
-  g_option_context_add_group (context, gegl_get_option_group ());
-
 #ifndef GIMP_CONSOLE_COMPILATION
   if (! no_interface)
     {

Modified: branches/weskaggs/app/base/gimphistogram.c
==============================================================================
--- branches/weskaggs/app/base/gimphistogram.c	(original)
+++ branches/weskaggs/app/base/gimphistogram.c	Wed Feb  6 17:19:00 2008
@@ -42,6 +42,7 @@
 
 struct _GimpHistogram
 {
+  gint           ref_count;
   gint           n_channels;
 #ifdef ENABLE_MP
   GStaticMutex   mutex;
@@ -68,6 +69,8 @@
 {
   GimpHistogram *histogram = g_slice_new0 (GimpHistogram);
 
+  histogram->ref_count = 1;
+
 #ifdef ENABLE_MP
   g_static_mutex_init (&histogram->mutex);
 #endif
@@ -75,13 +78,28 @@
   return histogram;
 }
 
+GimpHistogram *
+gimp_histogram_ref (GimpHistogram *histogram)
+{
+  g_return_val_if_fail (histogram != NULL, NULL);
+
+  histogram->ref_count++;
+
+  return histogram;
+}
+
 void
-gimp_histogram_free (GimpHistogram *histogram)
+gimp_histogram_unref (GimpHistogram *histogram)
 {
   g_return_if_fail (histogram != NULL);
 
-  gimp_histogram_free_values (histogram);
-  g_slice_free (GimpHistogram, histogram);
+  histogram->ref_count--;
+
+  if (histogram->ref_count == 0)
+    {
+      gimp_histogram_free_values (histogram);
+      g_slice_free (GimpHistogram, histogram);
+    }
 }
 
 void

Modified: branches/weskaggs/app/base/gimphistogram.h
==============================================================================
--- branches/weskaggs/app/base/gimphistogram.h	(original)
+++ branches/weskaggs/app/base/gimphistogram.h	Wed Feb  6 17:19:00 2008
@@ -23,7 +23,8 @@
 
 
 GimpHistogram * gimp_histogram_new           (void);
-void            gimp_histogram_free          (GimpHistogram        *histogram);
+GimpHistogram * gimp_histogram_ref           (GimpHistogram        *histogram);
+void            gimp_histogram_unref         (GimpHistogram        *histogram);
 
 void            gimp_histogram_calculate     (GimpHistogram        *histogram,
                                               PixelRegion          *region,

Modified: branches/weskaggs/app/core/Makefile.am
==============================================================================
--- branches/weskaggs/app/core/Makefile.am	(original)
+++ branches/weskaggs/app/core/Makefile.am	Wed Feb  6 17:19:00 2008
@@ -18,295 +18,309 @@
 noinst_LIBRARIES = libappcore.a
 
 libappcore_a_sources = \
-	core-enums.h			\
-	core-types.h			\
-	gimp.c				\
-	gimp.h				\
-	gimp-contexts.c			\
-	gimp-contexts.h			\
-	gimp-documents.c		\
-	gimp-documents.h		\
-	gimp-edit.c			\
-	gimp-edit.h			\
-	gimp-gradients.c		\
-	gimp-gradients.h		\
-	gimp-gui.c			\
-	gimp-gui.h			\
-	gimp-modules.c			\
-	gimp-modules.h			\
-	gimp-parasites.c		\
-	gimp-parasites.h		\
-	gimp-templates.c		\
-	gimp-templates.h		\
-	gimp-transform-region.c		\
-	gimp-transform-region.h		\
-	gimp-transform-resize.c		\
-	gimp-transform-resize.h		\
-	gimp-transform-utils.c		\
-	gimp-transform-utils.h		\
-	gimp-units.c			\
-	gimp-units.h			\
-	gimp-user-install.c		\
-	gimp-user-install.h		\
-	gimp-utils.c			\
-	gimp-utils.h			\
-	gimparea.c			\
-	gimparea.h			\
-	gimpbrush.c			\
-	gimpbrush.h			\
-	gimpbrush-header.h		\
-	gimpbrush-load.c		\
-	gimpbrush-load.h		\
-	gimpbrush-scale.c		\
-	gimpbrush-scale.h		\
-	gimpbrushclipboard.c		\
-	gimpbrushclipboard.h		\
-	gimpbrushgenerated.c		\
-	gimpbrushgenerated.h		\
-	gimpbrushgenerated-load.c	\
-	gimpbrushgenerated-load.h	\
-	gimpbrushgenerated-save.c	\
-	gimpbrushgenerated-save.h	\
-	gimpbrushpipe.c			\
-	gimpbrushpipe.h			\
-	gimpbrushpipe-load.c		\
-	gimpbrushpipe-load.h		\
-	gimpbuffer.c			\
-	gimpbuffer.h			\
-	gimpchannel.c			\
-	gimpchannel.h			\
-	gimpchannel-combine.c		\
-	gimpchannel-combine.h		\
-	gimpchannel-select.c		\
-	gimpchannel-select.h		\
-	gimpchannelpropundo.c		\
-	gimpchannelpropundo.h		\
-	gimpchannelundo.c		\
-	gimpchannelundo.h		\
-	gimpcontainer.c			\
-	gimpcontainer.h			\
-	gimpcontainer-filter.c		\
-	gimpcontainer-filter.h		\
-	gimpcontext.c			\
-	gimpcontext.h			\
-	gimpcoords.c			\
-	gimpcoords.h			\
-	gimpcurve.c			\
-	gimpcurve.h			\
-	gimpcurve-load.c		\
-	gimpcurve-load.h		\
-	gimpcurve-save.c		\
-	gimpcurve-save.h		\
-	gimpdashpattern.c		\
-	gimpdashpattern.h		\
-	gimpdata.c			\
-	gimpdata.h			\
-	gimpdatafactory.c		\
-	gimpdatafactory.h		\
-	gimpdocumentlist.c		\
-	gimpdocumentlist.h		\
-	gimpdrawable.c			\
-	gimpdrawable.h			\
-	gimpdrawable-blend.c		\
-	gimpdrawable-blend.h		\
-	gimpdrawable-bucket-fill.c	\
-	gimpdrawable-bucket-fill.h	\
-	gimpdrawable-combine.c		\
-	gimpdrawable-combine.h		\
-	gimpdrawable-convert.c		\
-	gimpdrawable-convert.h		\
-	gimpdrawable-desaturate.c	\
-	gimpdrawable-desaturate.h	\
-	gimpdrawable-equalize.c		\
-	gimpdrawable-equalize.h		\
-	gimpdrawable-foreground-extract.c\
-	gimpdrawable-foreground-extract.h\
-	gimpdrawable-histogram.c	\
-	gimpdrawable-histogram.h	\
-	gimpdrawable-invert.c		\
-	gimpdrawable-invert.h		\
-	gimpdrawable-levels.c		\
-	gimpdrawable-levels.h		\
-	gimpdrawable-offset.c		\
-	gimpdrawable-offset.h		\
-	gimpdrawable-operation.c	\
-	gimpdrawable-operation.h	\
-	gimpdrawable-preview.c		\
-	gimpdrawable-preview.h		\
-	gimpdrawable-stroke.c		\
-	gimpdrawable-stroke.h		\
-	gimpdrawable-transform.c	\
-	gimpdrawable-transform.h	\
-	gimpdrawablemodundo.c		\
-	gimpdrawablemodundo.h		\
-	gimpdrawableundo.c		\
-	gimpdrawableundo.h		\
-	gimpfloatingselundo.c		\
-	gimpfloatingselundo.h		\
-	gimpgradient.c			\
-	gimpgradient.h			\
-	gimpgradient-load.c		\
-	gimpgradient-load.h		\
-	gimpgradient-save.c		\
-	gimpgradient-save.h		\
-	gimpgrid.c			\
-	gimpgrid.h			\
-	gimpguide.c			\
-	gimpguide.h			\
-	gimpguideundo.c			\
-	gimpguideundo.h			\
-	gimpimage.c			\
-	gimpimage.h			\
-	gimpimage-arrange.c		\
-	gimpimage-arrange.h		\
-	gimpimage-colorhash.c		\
-	gimpimage-colorhash.h		\
-	gimpimage-colormap.c		\
-	gimpimage-colormap.h		\
-	gimpimage-contiguous-region.c	\
-	gimpimage-contiguous-region.h	\
-	gimpimage-convert.c		\
-	gimpimage-convert.h		\
-	gimpimage-convert-fsdither.h	\
-	gimpimage-convert-data.h	\
-	gimpimage-crop.c		\
-	gimpimage-crop.h		\
-	gimpimage-duplicate.c		\
-	gimpimage-duplicate.h		\
-	gimpimage-flip.c		\
-	gimpimage-flip.h		\
-	gimpimage-grid.h                \
-	gimpimage-grid.c                \
-	gimpimage-guides.c		\
-	gimpimage-guides.h		\
-	gimpimage-item-list.c		\
-	gimpimage-item-list.h		\
-	gimpimage-merge.c		\
-	gimpimage-merge.h		\
-	gimpimage-new.c			\
-	gimpimage-new.h			\
-	gimpimage-pick-color.c		\
-	gimpimage-pick-color.h		\
-	gimpimage-preview.c		\
-	gimpimage-preview.h		\
-	gimpimage-quick-mask.c		\
-	gimpimage-quick-mask.h		\
-	gimpimage-resize.c		\
-	gimpimage-resize.h		\
-	gimpimage-rotate.c		\
-	gimpimage-rotate.h		\
-	gimpimage-sample-points.c	\
-	gimpimage-sample-points.h	\
-	gimpimage-scale.c		\
-	gimpimage-scale.h		\
-	gimpimage-snap.c		\
-	gimpimage-snap.h		\
-	gimpimage-undo.c		\
-	gimpimage-undo.h		\
-	gimpimage-undo-push.c		\
-	gimpimage-undo-push.h		\
-	gimpimageundo.c			\
-	gimpimageundo.h			\
-	gimpimagefile.c			\
-	gimpimagefile.h			\
-	gimpimagemap.c			\
-	gimpimagemap.h			\
-	gimpitem.c			\
-	gimpitem.h			\
-	gimpitem-linked.c		\
-	gimpitem-linked.h		\
-	gimpitem-preview.c		\
-	gimpitem-preview.h		\
-	gimpitempropundo.c		\
-	gimpitempropundo.h		\
-	gimpitemundo.c			\
-	gimpitemundo.h			\
-	gimplayer.c			\
-	gimplayer.h			\
-	gimplayer-floating-sel.c	\
-	gimplayer-floating-sel.h	\
-	gimplayermask.c			\
-	gimplayermask.h			\
-	gimplayermaskpropundo.c		\
-	gimplayermaskpropundo.h		\
-	gimplayermaskundo.c		\
-	gimplayermaskundo.h		\
-	gimplayerpropundo.c		\
-	gimplayerpropundo.h		\
-	gimplayerundo.c			\
-	gimplayerundo.h			\
-	gimplist.c			\
-	gimplist.h			\
-	gimpmaskundo.c			\
-	gimpmaskundo.h			\
-	gimpobject.c			\
-	gimpobject.h			\
-	gimppaintinfo.c			\
-	gimppaintinfo.h			\
-	gimppattern.c			\
-	gimppattern.h			\
-	gimppattern-header.h		\
-	gimppattern-load.c		\
-	gimppattern-load.h		\
-	gimppatternclipboard.c		\
-	gimppatternclipboard.h		\
-	gimppalette.c			\
-	gimppalette.h			\
-	gimppalette-import.c		\
-	gimppalette-import.h		\
-	gimppalette-load.c		\
-	gimppalette-load.h		\
-	gimppalette-save.c		\
-	gimppalette-save.h		\
-	gimpparamspecs.c		\
-	gimpparamspecs.h		\
-	gimpparamspecs-desc.c		\
-	gimpparamspecs-desc.h		\
-	gimpparasitelist.c		\
-	gimpparasitelist.h		\
-	gimppdbprogress.c		\
-	gimppdbprogress.h		\
-	gimppickable.c			\
-	gimppickable.h			\
-	gimppreviewcache.c		\
-	gimppreviewcache.h		\
-	gimpprogress.c			\
-	gimpprogress.h			\
-	gimpprojection.c		\
-	gimpprojection.h		\
-	gimpprojection-construct.c	\
-	gimpprojection-construct.h	\
-	gimpsamplepoint.c		\
-	gimpsamplepoint.h		\
-	gimpsamplepointundo.c		\
-	gimpsamplepointundo.h		\
-	gimpscanconvert.c		\
-	gimpscanconvert.h		\
-	gimpselection.c			\
-	gimpselection.h			\
-	gimpstrokedesc.c		\
-	gimpstrokedesc.h		\
-	gimpstrokeoptions.c		\
-	gimpstrokeoptions.h		\
-	gimpsubprogress.c		\
-	gimpsubprogress.h		\
-	gimptagged.c			\
-	gimptagged.h			\
-	gimptemplate.c			\
-	gimptemplate.h			\
-	gimptoolinfo.c			\
-	gimptoolinfo.h			\
-	gimptooloptions.c		\
-	gimptooloptions.h		\
-	gimptoolpresets.c		\
-	gimptoolpresets.h		\
-	gimpunit.c			\
-	gimpunit.h			\
-	gimpundo.c			\
-	gimpundo.h			\
-	gimpundostack.c			\
-	gimpundostack.h			\
-	gimpviewable.c			\
+	core-enums.h				\
+	core-types.h				\
+	gimp.c					\
+	gimp.h					\
+	gimp-contexts.c				\
+	gimp-contexts.h				\
+	gimp-documents.c			\
+	gimp-documents.h			\
+	gimp-edit.c				\
+	gimp-edit.h				\
+	gimp-gradients.c			\
+	gimp-gradients.h			\
+	gimp-gui.c				\
+	gimp-gui.h				\
+	gimp-modules.c				\
+	gimp-modules.h				\
+	gimp-parasites.c			\
+	gimp-parasites.h			\
+	gimp-templates.c			\
+	gimp-templates.h			\
+	gimp-transform-region.c			\
+	gimp-transform-region.h			\
+	gimp-transform-resize.c			\
+	gimp-transform-resize.h			\
+	gimp-transform-utils.c			\
+	gimp-transform-utils.h			\
+	gimp-units.c				\
+	gimp-units.h				\
+	gimp-user-install.c			\
+	gimp-user-install.h			\
+	gimp-utils.c				\
+	gimp-utils.h				\
+	gimparea.c				\
+	gimparea.h				\
+	gimpbrush.c				\
+	gimpbrush.h				\
+	gimpbrush-header.h			\
+	gimpbrush-load.c			\
+	gimpbrush-load.h			\
+	gimpbrush-scale.c			\
+	gimpbrush-scale.h			\
+	gimpbrushclipboard.c			\
+	gimpbrushclipboard.h			\
+	gimpbrushgenerated.c			\
+	gimpbrushgenerated.h			\
+	gimpbrushgenerated-load.c		\
+	gimpbrushgenerated-load.h		\
+	gimpbrushgenerated-save.c		\
+	gimpbrushgenerated-save.h		\
+	gimpbrushpipe.c				\
+	gimpbrushpipe.h				\
+	gimpbrushpipe-load.c			\
+	gimpbrushpipe-load.h			\
+	gimpbuffer.c				\
+	gimpbuffer.h				\
+	gimpchannel.c				\
+	gimpchannel.h				\
+	gimpchannel-combine.c			\
+	gimpchannel-combine.h			\
+	gimpchannel-select.c			\
+	gimpchannel-select.h			\
+	gimpchannelpropundo.c			\
+	gimpchannelpropundo.h			\
+	gimpchannelundo.c			\
+	gimpchannelundo.h			\
+	gimpcontainer.c				\
+	gimpcontainer.h				\
+	gimpcontainer-filter.c			\
+	gimpcontainer-filter.h			\
+	gimpcontext.c				\
+	gimpcontext.h				\
+	gimpcoords.c				\
+	gimpcoords.h				\
+	gimpcurve.c				\
+	gimpcurve.h				\
+	gimpcurve-load.c			\
+	gimpcurve-load.h			\
+	gimpcurve-save.c			\
+	gimpcurve-save.h			\
+	gimpdashpattern.c			\
+	gimpdashpattern.h			\
+	gimpdata.c				\
+	gimpdata.h				\
+	gimpdatafactory.c			\
+	gimpdatafactory.h			\
+	gimpdocumentlist.c			\
+	gimpdocumentlist.h			\
+	gimpdrawable.c				\
+	gimpdrawable.h				\
+	gimpdrawable-blend.c			\
+	gimpdrawable-blend.h			\
+	gimpdrawable-brightness-contrast.c	\
+	gimpdrawable-brightness-contrast.h	\
+	gimpdrawable-bucket-fill.c		\
+	gimpdrawable-bucket-fill.h		\
+	gimpdrawable-color-balance.c		\
+	gimpdrawable-color-balance.h		\
+	gimpdrawable-colorize.c			\
+	gimpdrawable-colorize.h			\
+	gimpdrawable-combine.c			\
+	gimpdrawable-combine.h			\
+	gimpdrawable-convert.c			\
+	gimpdrawable-convert.h			\
+	gimpdrawable-curves.c			\
+	gimpdrawable-curves.h			\
+	gimpdrawable-desaturate.c		\
+	gimpdrawable-desaturate.h		\
+	gimpdrawable-equalize.c			\
+	gimpdrawable-equalize.h			\
+	gimpdrawable-foreground-extract.c	\
+	gimpdrawable-foreground-extract.h	\
+	gimpdrawable-histogram.c		\
+	gimpdrawable-histogram.h		\
+	gimpdrawable-hue-saturation.c		\
+	gimpdrawable-hue-saturation.h		\
+	gimpdrawable-invert.c			\
+	gimpdrawable-invert.h			\
+	gimpdrawable-levels.c			\
+	gimpdrawable-levels.h			\
+	gimpdrawable-offset.c			\
+	gimpdrawable-offset.h			\
+	gimpdrawable-operation.c		\
+	gimpdrawable-operation.h		\
+	gimpdrawable-posterize.c		\
+	gimpdrawable-posterize.h		\
+	gimpdrawable-preview.c			\
+	gimpdrawable-preview.h			\
+	gimpdrawable-stroke.c			\
+	gimpdrawable-stroke.h			\
+	gimpdrawable-threshold.c		\
+	gimpdrawable-threshold.h		\
+	gimpdrawable-transform.c		\
+	gimpdrawable-transform.h		\
+	gimpdrawablemodundo.c			\
+	gimpdrawablemodundo.h			\
+	gimpdrawableundo.c			\
+	gimpdrawableundo.h			\
+	gimpfloatingselundo.c			\
+	gimpfloatingselundo.h			\
+	gimpgradient.c				\
+	gimpgradient.h				\
+	gimpgradient-load.c			\
+	gimpgradient-load.h			\
+	gimpgradient-save.c			\
+	gimpgradient-save.h			\
+	gimpgrid.c				\
+	gimpgrid.h				\
+	gimpguide.c				\
+	gimpguide.h				\
+	gimpguideundo.c				\
+	gimpguideundo.h				\
+	gimpimage.c				\
+	gimpimage.h				\
+	gimpimage-arrange.c			\
+	gimpimage-arrange.h			\
+	gimpimage-colorhash.c			\
+	gimpimage-colorhash.h			\
+	gimpimage-colormap.c			\
+	gimpimage-colormap.h			\
+	gimpimage-contiguous-region.c		\
+	gimpimage-contiguous-region.h		\
+	gimpimage-convert.c			\
+	gimpimage-convert.h			\
+	gimpimage-convert-fsdither.h		\
+	gimpimage-convert-data.h		\
+	gimpimage-crop.c			\
+	gimpimage-crop.h			\
+	gimpimage-duplicate.c			\
+	gimpimage-duplicate.h			\
+	gimpimage-flip.c			\
+	gimpimage-flip.h			\
+	gimpimage-grid.h                	\
+	gimpimage-grid.c                	\
+	gimpimage-guides.c			\
+	gimpimage-guides.h			\
+	gimpimage-item-list.c			\
+	gimpimage-item-list.h			\
+	gimpimage-merge.c			\
+	gimpimage-merge.h			\
+	gimpimage-new.c				\
+	gimpimage-new.h				\
+	gimpimage-pick-color.c			\
+	gimpimage-pick-color.h			\
+	gimpimage-preview.c			\
+	gimpimage-preview.h			\
+	gimpimage-quick-mask.c			\
+	gimpimage-quick-mask.h			\
+	gimpimage-resize.c			\
+	gimpimage-resize.h			\
+	gimpimage-rotate.c			\
+	gimpimage-rotate.h			\
+	gimpimage-sample-points.c		\
+	gimpimage-sample-points.h		\
+	gimpimage-scale.c			\
+	gimpimage-scale.h			\
+	gimpimage-snap.c			\
+	gimpimage-snap.h			\
+	gimpimage-undo.c			\
+	gimpimage-undo.h			\
+	gimpimage-undo-push.c			\
+	gimpimage-undo-push.h			\
+	gimpimageundo.c				\
+	gimpimageundo.h				\
+	gimpimagefile.c				\
+	gimpimagefile.h				\
+	gimpimagemap.c				\
+	gimpimagemap.h				\
+	gimpitem.c				\
+	gimpitem.h				\
+	gimpitem-linked.c			\
+	gimpitem-linked.h			\
+	gimpitem-preview.c			\
+	gimpitem-preview.h			\
+	gimpitempropundo.c			\
+	gimpitempropundo.h			\
+	gimpitemundo.c				\
+	gimpitemundo.h				\
+	gimplayer.c				\
+	gimplayer.h				\
+	gimplayer-floating-sel.c		\
+	gimplayer-floating-sel.h		\
+	gimplayermask.c				\
+	gimplayermask.h				\
+	gimplayermaskpropundo.c			\
+	gimplayermaskpropundo.h			\
+	gimplayermaskundo.c			\
+	gimplayermaskundo.h			\
+	gimplayerpropundo.c			\
+	gimplayerpropundo.h			\
+	gimplayerundo.c				\
+	gimplayerundo.h				\
+	gimplist.c				\
+	gimplist.h				\
+	gimpmaskundo.c				\
+	gimpmaskundo.h				\
+	gimpobject.c				\
+	gimpobject.h				\
+	gimppaintinfo.c				\
+	gimppaintinfo.h				\
+	gimppattern.c				\
+	gimppattern.h				\
+	gimppattern-header.h			\
+	gimppattern-load.c			\
+	gimppattern-load.h			\
+	gimppatternclipboard.c			\
+	gimppatternclipboard.h			\
+	gimppalette.c				\
+	gimppalette.h				\
+	gimppalette-import.c			\
+	gimppalette-import.h			\
+	gimppalette-load.c			\
+	gimppalette-load.h			\
+	gimppalette-save.c			\
+	gimppalette-save.h			\
+	gimpparamspecs.c			\
+	gimpparamspecs.h			\
+	gimpparamspecs-desc.c			\
+	gimpparamspecs-desc.h			\
+	gimpparasitelist.c			\
+	gimpparasitelist.h			\
+	gimppdbprogress.c			\
+	gimppdbprogress.h			\
+	gimppickable.c				\
+	gimppickable.h				\
+	gimppreviewcache.c			\
+	gimppreviewcache.h			\
+	gimpprogress.c				\
+	gimpprogress.h				\
+	gimpprojection.c			\
+	gimpprojection.h			\
+	gimpprojection-construct.c		\
+	gimpprojection-construct.h		\
+	gimpsamplepoint.c			\
+	gimpsamplepoint.h			\
+	gimpsamplepointundo.c			\
+	gimpsamplepointundo.h			\
+	gimpscanconvert.c			\
+	gimpscanconvert.h			\
+	gimpselection.c				\
+	gimpselection.h				\
+	gimpstrokedesc.c			\
+	gimpstrokedesc.h			\
+	gimpstrokeoptions.c			\
+	gimpstrokeoptions.h			\
+	gimpsubprogress.c			\
+	gimpsubprogress.h			\
+	gimptagged.c				\
+	gimptagged.h				\
+	gimptemplate.c				\
+	gimptemplate.h				\
+	gimptoolinfo.c				\
+	gimptoolinfo.h				\
+	gimptooloptions.c			\
+	gimptooloptions.h			\
+	gimptoolpresets.c			\
+	gimptoolpresets.h			\
+	gimpunit.c				\
+	gimpunit.h				\
+	gimpundo.c				\
+	gimpundo.h				\
+	gimpundostack.c				\
+	gimpundostack.h				\
+	gimpviewable.c				\
 	gimpviewable.h
 
 libappcore_a_built_sources = \

Modified: branches/weskaggs/app/core/core-types.h
==============================================================================
--- branches/weskaggs/app/core/core-types.h	(original)
+++ branches/weskaggs/app/core/core-types.h	Wed Feb  6 17:19:00 2008
@@ -23,7 +23,7 @@
 #include "libgimpmodule/gimpmoduletypes.h"
 #include "libgimpthumb/gimpthumb-types.h"
 
-#include "gegl/gegl-types.h"
+#include "base/base-types.h"
 
 #include "core/core-enums.h"
 
@@ -206,6 +206,7 @@
 };
 
 
+#include "gegl/gegl-types.h"
 #include "paint/paint-types.h"
 #include "text/text-types.h"
 #include "vectors/vectors-types.h"

Modified: branches/weskaggs/app/core/gimpdatafactory.c
==============================================================================
--- branches/weskaggs/app/core/gimpdatafactory.c	(original)
+++ branches/weskaggs/app/core/gimpdatafactory.c	Wed Feb  6 17:19:00 2008
@@ -54,6 +54,8 @@
 
 static gchar * gimp_data_factory_get_save_dir (GimpDataFactory      *factory);
 
+static void    gimp_data_factory_load_data_recursive (const GimpDatafileData *file_data,
+                                                      gpointer                data);
 
 G_DEFINE_TYPE (GimpDataFactory, gimp_data_factory, GIMP_TYPE_OBJECT)
 
@@ -302,6 +304,10 @@
       gimp_datafiles_read_directories (writable_path, G_FILE_TEST_EXISTS,
                                        gimp_data_factory_load_data, &context);
 
+      gimp_datafiles_read_directories (path, G_FILE_TEST_IS_DIR,
+                                       gimp_data_factory_load_data_recursive,
+                                       &context);
+
       if (writable_path)
         {
           gimp_path_free (writable_list);
@@ -659,6 +665,20 @@
 }
 
 void
+gimp_data_factory_load_data_recursive (const GimpDatafileData *file_data,
+                                       gpointer                data)
+{
+  GimpDataLoadContext *context = data;
+
+  gimp_datafiles_read_directories (file_data->filename, G_FILE_TEST_EXISTS,
+                                   gimp_data_factory_load_data, context);
+
+  gimp_datafiles_read_directories (file_data->filename, G_FILE_TEST_IS_DIR,
+                                   gimp_data_factory_load_data_recursive,
+                                   context);
+}
+
+void
 gimp_data_factory_load_data (const GimpDatafileData *file_data,
                              gpointer                user_data)
 {

Modified: branches/weskaggs/app/core/gimpdrawable-equalize.c
==============================================================================
--- branches/weskaggs/app/core/gimpdrawable-equalize.c	(original)
+++ branches/weskaggs/app/core/gimpdrawable-equalize.c	Wed Feb  6 17:19:00 2008
@@ -72,7 +72,7 @@
                                   lut, 2, &srcPR, &destPR);
 
   gimp_lut_free (lut);
-  gimp_histogram_free (hist);
+  gimp_histogram_unref (hist);
 
   gimp_drawable_merge_shadow (drawable, TRUE, _("Equalize"));
 

Modified: branches/weskaggs/app/core/gimpdrawable-levels.c
==============================================================================
--- branches/weskaggs/app/core/gimpdrawable-levels.c	(original)
+++ branches/weskaggs/app/core/gimpdrawable-levels.c	Wed Feb  6 17:19:00 2008
@@ -166,7 +166,7 @@
   gimp_levels_config_stretch (config, histogram,
                               gimp_drawable_is_rgb (drawable));
 
-  gimp_histogram_free (histogram);
+  gimp_histogram_unref (histogram);
 
   if (gimp_use_gegl (GIMP_ITEM (drawable)->image->gimp))
     {

Modified: branches/weskaggs/app/core/gimpimagemap.c
==============================================================================
--- branches/weskaggs/app/core/gimpimagemap.c	(original)
+++ branches/weskaggs/app/core/gimpimagemap.c	Wed Feb  6 17:19:00 2008
@@ -41,6 +41,11 @@
 #endif
 GeglNode * gegl_node_add_child (GeglNode *self,
                                 GeglNode *child);
+#ifdef __GNUC__
+#warning FIXME: gegl_node_get_pad() or something similar needs to be public
+#endif
+gpointer   gegl_node_get_pad (GeglNode    *self,
+                              const gchar *pad_name);
 
 enum
 {
@@ -460,11 +465,29 @@
             g_object_unref (sink_operation);
           }
 
-          gegl_node_link_many (image_map->input,
-                               image_map->shift,
-                               image_map->operation,
-                               image_map->output,
-                               NULL);
+          if (gegl_node_get_pad (image_map->operation, "input"))
+            {
+              gegl_node_link_many (image_map->input,
+                                   image_map->shift,
+                                   image_map->operation,
+                                   image_map->output,
+                                   NULL);
+            }
+          else
+            {
+              GeglNode *over = gegl_node_new_child (image_map->gegl,
+                                                    "operation", "over",
+                                                    NULL);
+
+              gegl_node_link_many (image_map->input,
+                                   image_map->shift,
+                                   over,
+                                   image_map->output,
+                                   NULL);
+
+              gegl_node_connect_to (image_map->operation, "output",
+                                    over, "aux");
+            }
         }
 
       gegl_node_set (image_map->input,

Modified: branches/weskaggs/app/dialogs/dialogs.c
==============================================================================
--- branches/weskaggs/app/dialogs/dialogs.c	(original)
+++ branches/weskaggs/app/dialogs/dialogs.c	Wed Feb  6 17:19:00 2008
@@ -60,6 +60,7 @@
   FOREIGN ("gimp-crop-tool-dialog",                TRUE,  FALSE),
   FOREIGN ("gimp-curves-tool-dialog",              TRUE,  TRUE),
   FOREIGN ("gimp-color-balance-tool-dialog",       TRUE,  FALSE),
+  FOREIGN ("gimp-gegl-tool-dialog",                TRUE,  FALSE),
   FOREIGN ("gimp-hue-saturation-tool-dialog",      TRUE,  FALSE),
   FOREIGN ("gimp-levels-tool-dialog",              TRUE,  TRUE),
   FOREIGN ("gimp-measure-tool-dialog",             TRUE,  FALSE),

Modified: branches/weskaggs/app/dialogs/image-new-dialog.c
==============================================================================
--- branches/weskaggs/app/dialogs/image-new-dialog.c	(original)
+++ branches/weskaggs/app/dialogs/image-new-dialog.c	Wed Feb  6 17:19:00 2008
@@ -333,14 +333,12 @@
 image_new_create_image (ImageNewDialog *dialog)
 {
   GimpTemplate *template = g_object_ref (dialog->template);
-  GimpContext  *context  = g_object_ref (dialog->context);
   Gimp         *gimp     = dialog->context->gimp;
 
   gtk_widget_destroy (dialog->dialog);
 
-  gimp_template_create_image (gimp, template, context);
+  gimp_template_create_image (gimp, template, gimp_get_user_context (gimp));
   gimp_image_new_set_last_template (gimp, template);
 
   g_object_unref (template);
-  g_object_unref (context);
 }

Modified: branches/weskaggs/app/display/gimpdisplayshell-preview.c
==============================================================================
--- branches/weskaggs/app/display/gimpdisplayshell-preview.c	(original)
+++ branches/weskaggs/app/display/gimpdisplayshell-preview.c	Wed Feb  6 17:19:00 2008
@@ -828,7 +828,7 @@
 {
   const gint  dy = y2 - y1;
   gint        dx;
-  gchar       xdir;
+  gint        xdir;
   gint        errorterm;
   gint        b;
   gint       *dptr;

Modified: branches/weskaggs/app/display/gimpdisplayshell-transform.c
==============================================================================
--- branches/weskaggs/app/display/gimpdisplayshell-transform.c	(original)
+++ branches/weskaggs/app/display/gimpdisplayshell-transform.c	Wed Feb  6 17:19:00 2008
@@ -96,9 +96,10 @@
                                  gint             *ny,
                                  gboolean          use_offsets)
 {
-  gint offset_x = 0;
-  gint offset_y = 0;
-  gint64 tx, ty;
+  gint   offset_x = 0;
+  gint   offset_y = 0;
+  gint64 tx;
+  gint64 ty;
 
   g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
   g_return_if_fail (nx != NULL);
@@ -115,8 +116,8 @@
       y += offset_y;
     }
 
-  tx = PROJ_ROUND64 (x * shell->x_src_dec) / shell->x_dest_inc;
-  ty = PROJ_ROUND64 (y * shell->y_src_dec) / shell->y_dest_inc;
+  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;
@@ -152,9 +153,10 @@
                                    gboolean          round,
                                    gboolean          use_offsets)
 {
-  gint offset_x = 0;
-  gint offset_y = 0;
-  gint64 tx, ty;
+  gint   offset_x = 0;
+  gint   offset_y = 0;
+  gint64 tx;
+  gint64 ty;
 
   g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
   g_return_if_fail (nx != NULL);
@@ -168,8 +170,8 @@
       gimp_item_offsets (item, &offset_x, &offset_y);
     }
 
-  tx = x + shell->offset_x - shell->disp_xoffset;
-  ty = y + shell->offset_y - shell->disp_yoffset;
+  tx = (gint64) x + shell->offset_x - shell->disp_xoffset;
+  ty = (gint64) y + shell->offset_y - shell->disp_yoffset;
 
   tx *= shell->x_dest_inc;
   ty *= shell->y_dest_inc;
@@ -306,17 +308,17 @@
 
   for (i = 0; i < n_points ; i++)
     {
-      gdouble x, y;
-
-      x = points[i*2]   + offset_x;
-      y = points[i*2+1] + offset_y;
+      gdouble x = points[i*2]   + offset_x;
+      gdouble y = points[i*2+1] + offset_y;
 
-      x *= shell->x_src_dec / shell->x_dest_inc;
-      y *= shell->y_src_dec / shell->y_dest_inc;
+      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),
+      coords[i].x = CLAMP (PROJ_ROUND64 (x) +
+                           shell->disp_xoffset - shell->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) +
+                           shell->disp_yoffset - shell->offset_y,
                            G_MININT, G_MAXINT);
     }
 }
@@ -356,17 +358,17 @@
 
   for (i = 0; i < n_coords ; i++)
     {
-      gdouble x, y;
-
-      x = image_coords[i].x + offset_x;
-      y = image_coords[i].y + offset_y;
+      gdouble x = image_coords[i].x + offset_x;
+      gdouble y = image_coords[i].y + offset_y;
 
-      x *= shell->x_src_dec / shell->x_dest_inc;
-      y *= shell->y_src_dec / shell->y_dest_inc;
+      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),
+      disp_coords[i].x = CLAMP (PROJ_ROUND64 (x) +
+                                shell->disp_xoffset - shell->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) +
+                                shell->disp_yoffset - shell->offset_y,
                                 G_MININT, G_MAXINT);
     }
 }
@@ -414,10 +416,10 @@
       y1 = src_segs[i].y1 + offset_y;
       y2 = src_segs[i].y2 + offset_y;
 
-      x1 = PROJ_ROUND64 (x1 * shell->x_src_dec) / shell->x_dest_inc;
-      x2 = PROJ_ROUND64 (x2 * shell->x_src_dec) / shell->x_dest_inc;
-      y1 = PROJ_ROUND64 (y1 * shell->y_src_dec) / shell->y_dest_inc;
-      y2 = PROJ_ROUND64 (y2 * shell->y_src_dec) / shell->y_dest_inc;
+      x1 = (x1 * shell->x_src_dec) / shell->x_dest_inc;
+      x2 = (x2 * shell->x_src_dec) / shell->x_dest_inc;
+      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,
                                G_MININT, G_MAXINT);

Modified: branches/weskaggs/app/gegl/gegl-types.h
==============================================================================
--- branches/weskaggs/app/gegl/gegl-types.h	(original)
+++ branches/weskaggs/app/gegl/gegl-types.h	Wed Feb  6 17:19:00 2008
@@ -22,7 +22,7 @@
 #define __GEGL_TYPES_H__
 
 
-#include "base/base-types.h"
+#include "core/core-types.h"
 #include "gegl/gegl-types.h"
 
 

Modified: branches/weskaggs/app/gegl/gimp-gegl.c
==============================================================================
--- branches/weskaggs/app/gegl/gimp-gegl.c	(original)
+++ branches/weskaggs/app/gegl/gimp-gegl.c	Wed Feb  6 17:19:00 2008
@@ -41,6 +41,8 @@
 void
 gimp_gegl_init (void)
 {
+  gegl_init (NULL, NULL);
+
   g_type_class_ref (GIMP_TYPE_OPERATION_COLOR_BALANCE);
   g_type_class_ref (GIMP_TYPE_OPERATION_COLORIZE);
   g_type_class_ref (GIMP_TYPE_OPERATION_CURVES);

Modified: branches/weskaggs/app/gegl/gimpbrightnesscontrastconfig.c
==============================================================================
--- branches/weskaggs/app/gegl/gimpbrightnesscontrastconfig.c	(original)
+++ branches/weskaggs/app/gegl/gimpbrightnesscontrastconfig.c	Wed Feb  6 17:19:00 2008
@@ -50,7 +50,7 @@
 
 G_DEFINE_TYPE_WITH_CODE (GimpBrightnessContrastConfig,
                          gimp_brightness_contrast_config,
-                         G_TYPE_OBJECT,
+                         GIMP_TYPE_VIEWABLE,
                          G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG, NULL))
 
 #define parent_class gimp_brightness_contrast_config_parent_class
@@ -59,26 +59,23 @@
 static void
 gimp_brightness_contrast_config_class_init (GimpBrightnessContrastConfigClass *klass)
 {
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GObjectClass      *object_class   = G_OBJECT_CLASS (klass);
+  GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
 
-  object_class->set_property = gimp_brightness_contrast_config_set_property;
-  object_class->get_property = gimp_brightness_contrast_config_get_property;
+  object_class->set_property       = gimp_brightness_contrast_config_set_property;
+  object_class->get_property       = gimp_brightness_contrast_config_get_property;
 
-  g_object_class_install_property (object_class, PROP_BRIGHTNESS,
-                                   g_param_spec_double ("brightness",
-                                                        "Brightness",
-                                                        "Brightness",
-                                                        -1.0, 1.0, 0.0,
-                                                        G_PARAM_READWRITE |
-                                                        G_PARAM_CONSTRUCT));
-
-  g_object_class_install_property (object_class, PROP_CONTRAST,
-                                   g_param_spec_double ("contrast",
-                                                        "Contrast",
-                                                        "Contrast",
-                                                        -1.0, 1.0, 0.0,
-                                                        G_PARAM_READWRITE |
-                                                        G_PARAM_CONSTRUCT));
+  viewable_class->default_stock_id = "gimp-tool-brightness-constrast";
+
+  GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_BRIGHTNESS,
+                                   "brightness",
+                                   "Brightness",
+                                   -1.0, 1.0, 0.0, 0);
+
+  GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CONTRAST,
+                                   "contrast",
+                                   "Contrast",
+                                   -1.0, 1.0, 0.0, 0);
 }
 
 static void

Modified: branches/weskaggs/app/gegl/gimpbrightnesscontrastconfig.h
==============================================================================
--- branches/weskaggs/app/gegl/gimpbrightnesscontrastconfig.h	(original)
+++ branches/weskaggs/app/gegl/gimpbrightnesscontrastconfig.h	Wed Feb  6 17:19:00 2008
@@ -23,6 +23,9 @@
 #define __GIMP_BRIGHTNESS_CONTRAST_CONFIG_H__
 
 
+#include "core/gimpviewable.h"
+
+
 #define GIMP_TYPE_BRIGHTNESS_CONTRAST_CONFIG            (gimp_brightness_contrast_config_get_type ())
 #define GIMP_BRIGHTNESS_CONTRAST_CONFIG(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_BRIGHTNESS_CONTRAST_CONFIG, GimpBrightnessContrastConfig))
 #define GIMP_BRIGHTNESS_CONTRAST_CONFIG_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  GIMP_TYPE_BRIGHTNESS_CONTRAST_CONFIG, GimpBrightnessContrastConfigClass))
@@ -35,15 +38,15 @@
 
 struct _GimpBrightnessContrastConfig
 {
-  GObject  parent_instance;
+  GimpViewable  parent_instance;
 
-  gdouble  brightness;
-  gdouble  contrast;
+  gdouble       brightness;
+  gdouble       contrast;
 };
 
 struct _GimpBrightnessContrastConfigClass
 {
-  GObjectClass  parent_class;
+  GimpViewableClass  parent_class;
 };
 
 

Modified: branches/weskaggs/app/gegl/gimpcolorbalanceconfig.c
==============================================================================
--- branches/weskaggs/app/gegl/gimpcolorbalanceconfig.c	(original)
+++ branches/weskaggs/app/gegl/gimpcolorbalanceconfig.c	Wed Feb  6 17:19:00 2008
@@ -46,22 +46,27 @@
 };
 
 
-static void   gimp_color_balance_config_iface_init   (GimpConfigInterface *iface);
+static void     gimp_color_balance_config_iface_init   (GimpConfigInterface *iface);
 
-static void   gimp_color_balance_config_get_property (GObject      *object,
-                                                      guint         property_id,
-                                                      GValue       *value,
-                                                      GParamSpec   *pspec);
-static void   gimp_color_balance_config_set_property (GObject      *object,
-                                                      guint         property_id,
-                                                      const GValue *value,
-                                                      GParamSpec   *pspec);
-
-static void   gimp_color_balance_config_reset        (GimpConfig   *config);
+static void     gimp_color_balance_config_get_property (GObject      *object,
+                                                        guint         property_id,
+                                                        GValue       *value,
+                                                        GParamSpec   *pspec);
+static void     gimp_color_balance_config_set_property (GObject      *object,
+                                                        guint         property_id,
+                                                        const GValue *value,
+                                                        GParamSpec   *pspec);
+
+static gboolean gimp_color_balance_config_equal        (GimpConfig   *a,
+                                                        GimpConfig   *b);
+static void     gimp_color_balance_config_reset        (GimpConfig   *config);
+static gboolean gimp_color_balance_config_copy         (GimpConfig   *src,
+                                                        GimpConfig   *dest,
+                                                        GParamFlags   flags);
 
 
 G_DEFINE_TYPE_WITH_CODE (GimpColorBalanceConfig, gimp_color_balance_config,
-                         G_TYPE_OBJECT,
+                         GIMP_TYPE_VIEWABLE,
                          G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
                                                 gimp_color_balance_config_iface_init))
 
@@ -71,57 +76,47 @@
 static void
 gimp_color_balance_config_class_init (GimpColorBalanceConfigClass *klass)
 {
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GObjectClass      *object_class   = G_OBJECT_CLASS (klass);
+  GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
+
+  object_class->set_property       = gimp_color_balance_config_set_property;
+  object_class->get_property       = gimp_color_balance_config_get_property;
 
-  object_class->set_property = gimp_color_balance_config_set_property;
-  object_class->get_property = gimp_color_balance_config_get_property;
+  viewable_class->default_stock_id = "gimp-tool-color-balance";
 
-  g_object_class_install_property (object_class, PROP_RANGE,
-                                   g_param_spec_enum ("range",
-                                                      "range",
-                                                      "The affected range",
-                                                      GIMP_TYPE_TRANSFER_MODE,
-                                                      GIMP_MIDTONES,
-                                                      G_PARAM_READWRITE |
-                                                      G_PARAM_CONSTRUCT));
-
-  g_object_class_install_property (object_class, PROP_CYAN_RED,
-                                   g_param_spec_double ("cyan-red",
-                                                        "Cyan-Red",
-                                                        "Cyan-Red",
-                                                        -1.0, 1.0, 0.0,
-                                                        G_PARAM_READWRITE |
-                                                        G_PARAM_CONSTRUCT));
-
-  g_object_class_install_property (object_class, PROP_MAGENTA_GREEN,
-                                   g_param_spec_double ("magenta-green",
-                                                        "Magenta-Green",
-                                                        "Magenta-Green",
-                                                        -1.0, 1.0, 0.0,
-                                                        G_PARAM_READWRITE |
-                                                        G_PARAM_CONSTRUCT));
-
-  g_object_class_install_property (object_class, PROP_YELLOW_BLUE,
-                                   g_param_spec_double ("yellow-blue",
-                                                        "Yellow-Blue",
-                                                        "Yellow-Blue",
-                                                        -1.0, 1.0, 0.0,
-                                                        G_PARAM_READWRITE |
-                                                        G_PARAM_CONSTRUCT));
-
-  g_object_class_install_property (object_class, PROP_PRESERVE_LUMINOSITY,
-                                   g_param_spec_boolean ("preserve-luminosity",
-                                                         "Preserve Luminosity",
-                                                         "Preserve Luminosity",
-                                                         TRUE,
-                                                         G_PARAM_READWRITE |
-                                                         G_PARAM_CONSTRUCT));
+  GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_RANGE,
+                                 "range",
+                                 "The affected range",
+                                 GIMP_TYPE_TRANSFER_MODE,
+                                 GIMP_MIDTONES, 0);
+
+  GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_CYAN_RED,
+                                   "cyan-red",
+                                   "Cyan-Red",
+                                   -1.0, 1.0, 0.0, 0);
+
+  GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MAGENTA_GREEN,
+                                   "magenta-green",
+                                   "Magenta-Green",
+                                   -1.0, 1.0, 0.0, 0);
+
+  GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_YELLOW_BLUE,
+                                   "yellow-blue",
+                                   "Yellow-Blue",
+                                   -1.0, 1.0, 0.0, 0);
+
+  GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_PRESERVE_LUMINOSITY,
+                                    "preserve-luminosity",
+                                    "Preserve Luminosity",
+                                    TRUE, 0);
 }
 
 static void
 gimp_color_balance_config_iface_init (GimpConfigInterface *iface)
 {
+  iface->equal = gimp_color_balance_config_equal;
   iface->reset = gimp_color_balance_config_reset;
+  iface->copy  = gimp_color_balance_config_copy;
 }
 
 static void
@@ -205,14 +200,36 @@
     }
 }
 
+static gboolean
+gimp_color_balance_config_equal (GimpConfig *a,
+                                 GimpConfig *b)
+{
+  GimpColorBalanceConfig *a_config = GIMP_COLOR_BALANCE_CONFIG (a);
+  GimpColorBalanceConfig *b_config = GIMP_COLOR_BALANCE_CONFIG (b);
+  GimpTransferMode        range;
+
+  for (range = GIMP_SHADOWS; range <= GIMP_HIGHLIGHTS; range++)
+    {
+      if (a_config->cyan_red[range]      != b_config->cyan_red[range]      ||
+          a_config->magenta_green[range] != b_config->magenta_green[range] ||
+          a_config->yellow_blue[range]   != b_config->yellow_blue[range])
+        return FALSE;
+    }
+
+  /* don't compare "range" */
+
+  if (a_config->preserve_luminosity != b_config->preserve_luminosity)
+    return FALSE;
+
+  return TRUE;
+}
+
 static void
 gimp_color_balance_config_reset (GimpConfig *config)
 {
   GimpColorBalanceConfig *cb_config = GIMP_COLOR_BALANCE_CONFIG (config);
   GimpTransferMode        range;
 
-  g_object_freeze_notify (G_OBJECT (config));
-
   for (range = GIMP_SHADOWS; range <= GIMP_HIGHLIGHTS; range++)
     {
       cb_config->range = range;
@@ -221,8 +238,35 @@
 
   gimp_config_reset_property (G_OBJECT (config), "range");
   gimp_config_reset_property (G_OBJECT (config), "preserve-luminosity");
+}
 
-  g_object_thaw_notify (G_OBJECT (config));
+static gboolean
+gimp_color_balance_config_copy (GimpConfig  *src,
+                                GimpConfig  *dest,
+                                GParamFlags  flags)
+{
+  GimpColorBalanceConfig *src_config  = GIMP_COLOR_BALANCE_CONFIG (src);
+  GimpColorBalanceConfig *dest_config = GIMP_COLOR_BALANCE_CONFIG (dest);
+  GimpTransferMode        range;
+
+  for (range = GIMP_SHADOWS; range <= GIMP_HIGHLIGHTS; range++)
+    {
+      dest_config->cyan_red[range]      = src_config->cyan_red[range];
+      dest_config->magenta_green[range] = src_config->magenta_green[range];
+      dest_config->yellow_blue[range]   = src_config->yellow_blue[range];
+    }
+
+  g_object_notify (G_OBJECT (dest), "cyan-red");
+  g_object_notify (G_OBJECT (dest), "magenta-green");
+  g_object_notify (G_OBJECT (dest), "yellow-blue");
+
+  dest_config->range               = src_config->range;
+  dest_config->preserve_luminosity = src_config->preserve_luminosity;
+
+  g_object_notify (G_OBJECT (dest), "range");
+  g_object_notify (G_OBJECT (dest), "preserve-luminosity");
+
+  return TRUE;
 }
 
 

Modified: branches/weskaggs/app/gegl/gimpcolorbalanceconfig.h
==============================================================================
--- branches/weskaggs/app/gegl/gimpcolorbalanceconfig.h	(original)
+++ branches/weskaggs/app/gegl/gimpcolorbalanceconfig.h	Wed Feb  6 17:19:00 2008
@@ -23,6 +23,9 @@
 #define __GIMP_COLOR_BALANCE_CONFIG_H__
 
 
+#include "core/gimpviewable.h"
+
+
 #define GIMP_TYPE_COLOR_BALANCE_CONFIG            (gimp_color_balance_config_get_type ())
 #define GIMP_COLOR_BALANCE_CONFIG(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_COLOR_BALANCE_CONFIG, GimpColorBalanceConfig))
 #define GIMP_COLOR_BALANCE_CONFIG_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  GIMP_TYPE_COLOR_BALANCE_CONFIG, GimpColorBalanceConfigClass))
@@ -35,7 +38,7 @@
 
 struct _GimpColorBalanceConfig
 {
-  GObject           parent_instance;
+  GimpViewable      parent_instance;
 
   GimpTransferMode  range;
 
@@ -48,7 +51,7 @@
 
 struct _GimpColorBalanceConfigClass
 {
-  GObjectClass  parent_class;
+  GimpViewableClass  parent_class;
 };
 
 

Modified: branches/weskaggs/app/gegl/gimpcolorizeconfig.c
==============================================================================
--- branches/weskaggs/app/gegl/gimpcolorizeconfig.c	(original)
+++ branches/weskaggs/app/gegl/gimpcolorizeconfig.c	Wed Feb  6 17:19:00 2008
@@ -53,7 +53,7 @@
 
 
 G_DEFINE_TYPE_WITH_CODE (GimpColorizeConfig, gimp_colorize_config,
-                         G_TYPE_OBJECT,
+                         GIMP_TYPE_VIEWABLE,
                          G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG, NULL))
 
 #define parent_class gimp_colorize_config_parent_class
@@ -62,34 +62,28 @@
 static void
 gimp_colorize_config_class_init (GimpColorizeConfigClass *klass)
 {
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GObjectClass      *object_class   = G_OBJECT_CLASS (klass);
+  GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
 
-  object_class->set_property = gimp_colorize_config_set_property;
-  object_class->get_property = gimp_colorize_config_get_property;
+  object_class->set_property       = gimp_colorize_config_set_property;
+  object_class->get_property       = gimp_colorize_config_get_property;
 
-  g_object_class_install_property (object_class, PROP_HUE,
-                                   g_param_spec_double ("hue",
-                                                        "Hue",
-                                                        "Hue",
-                                                        0.0, 1.0, 0.5,
-                                                        G_PARAM_READWRITE |
-                                                        G_PARAM_CONSTRUCT));
-
-  g_object_class_install_property (object_class, PROP_SATURATION,
-                                   g_param_spec_double ("saturation",
-                                                        "Saturation",
-                                                        "Saturation",
-                                                        0.0, 1.0, 0.5,
-                                                        G_PARAM_READWRITE |
-                                                        G_PARAM_CONSTRUCT));
-
-  g_object_class_install_property (object_class, PROP_LIGHTNESS,
-                                   g_param_spec_double ("lightness",
-                                                        "Lightness",
-                                                        "Lightness",
-                                                        -1.0, 1.0, 0.0,
-                                                        G_PARAM_READWRITE |
-                                                        G_PARAM_CONSTRUCT));
+  viewable_class->default_stock_id = "gimp-tool-colorize";
+
+  GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_HUE,
+                                   "hue",
+                                   "Hue",
+                                   0.0, 1.0, 0.5, 0);
+
+  GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_SATURATION,
+                                   "saturation",
+                                   "Saturation",
+                                   0.0, 1.0, 0.5, 0);
+
+  GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_LIGHTNESS,
+                                   "lightness",
+                                   "Lightness",
+                                   -1.0, 1.0, 0.0, 0);
 }
 
 static void

Modified: branches/weskaggs/app/gegl/gimpcolorizeconfig.h
==============================================================================
--- branches/weskaggs/app/gegl/gimpcolorizeconfig.h	(original)
+++ branches/weskaggs/app/gegl/gimpcolorizeconfig.h	Wed Feb  6 17:19:00 2008
@@ -23,6 +23,9 @@
 #define __GIMP_COLORIZE_CONFIG_H__
 
 
+#include "core/gimpviewable.h"
+
+
 #define GIMP_TYPE_COLORIZE_CONFIG            (gimp_colorize_config_get_type ())
 #define GIMP_COLORIZE_CONFIG(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_COLORIZE_CONFIG, GimpColorizeConfig))
 #define GIMP_COLORIZE_CONFIG_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  GIMP_TYPE_COLORIZE_CONFIG, GimpColorizeConfigClass))
@@ -35,16 +38,16 @@
 
 struct _GimpColorizeConfig
 {
-  GObject  parent_instance;
+  GimpViewable  parent_instance;
 
-  gdouble  hue;
-  gdouble  saturation;
-  gdouble  lightness;
+  gdouble       hue;
+  gdouble       saturation;
+  gdouble       lightness;
 };
 
 struct _GimpColorizeConfigClass
 {
-  GObjectClass  parent_class;
+  GimpViewableClass  parent_class;
 };
 
 

Modified: branches/weskaggs/app/gegl/gimpcurvesconfig.c
==============================================================================
--- branches/weskaggs/app/gegl/gimpcurvesconfig.c	(original)
+++ branches/weskaggs/app/gegl/gimpcurvesconfig.c	Wed Feb  6 17:19:00 2008
@@ -37,6 +37,8 @@
 /*  temp cruft  */
 #include "base/curves.h"
 
+#include "core/gimpcurve.h"
+
 #include "gimpcurvesconfig.h"
 
 #include "gimp-intl.h"
@@ -50,26 +52,31 @@
 };
 
 
-static void   gimp_curves_config_iface_init   (GimpConfigInterface *iface);
-
-static void   gimp_curves_config_finalize     (GObject          *object);
-static void   gimp_curves_config_get_property (GObject          *object,
-                                               guint             property_id,
-                                               GValue           *value,
-                                               GParamSpec       *pspec);
-static void   gimp_curves_config_set_property (GObject          *object,
-                                               guint             property_id,
-                                               const GValue     *value,
-                                               GParamSpec       *pspec);
+static void     gimp_curves_config_iface_init   (GimpConfigInterface *iface);
 
-static void   gimp_curves_config_reset        (GimpConfig       *config);
+static void     gimp_curves_config_finalize     (GObject          *object);
+static void     gimp_curves_config_get_property (GObject          *object,
+                                                 guint             property_id,
+                                                 GValue           *value,
+                                                 GParamSpec       *pspec);
+static void     gimp_curves_config_set_property (GObject          *object,
+                                                 guint             property_id,
+                                                 const GValue     *value,
+                                                 GParamSpec       *pspec);
+
+static gboolean gimp_curves_config_equal        (GimpConfig       *a,
+                                                 GimpConfig       *b);
+static void     gimp_curves_config_reset        (GimpConfig       *config);
+static gboolean gimp_curves_config_copy         (GimpConfig       *src,
+                                                 GimpConfig       *dest,
+                                                 GParamFlags       flags);
 
-static void   gimp_curves_config_curve_dirty  (GimpCurve        *curve,
-                                               GimpCurvesConfig *config);
+static void     gimp_curves_config_curve_dirty  (GimpCurve        *curve,
+                                                 GimpCurvesConfig *config);
 
 
 G_DEFINE_TYPE_WITH_CODE (GimpCurvesConfig, gimp_curves_config,
-                         G_TYPE_OBJECT,
+                         GIMP_TYPE_VIEWABLE,
                          G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
                                                 gimp_curves_config_iface_init))
 
@@ -79,33 +86,34 @@
 static void
 gimp_curves_config_class_init (GimpCurvesConfigClass *klass)
 {
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GObjectClass      *object_class   = G_OBJECT_CLASS (klass);
+  GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
 
-  object_class->finalize     = gimp_curves_config_finalize;
-  object_class->set_property = gimp_curves_config_set_property;
-  object_class->get_property = gimp_curves_config_get_property;
-
-  g_object_class_install_property (object_class, PROP_CHANNEL,
-                                   g_param_spec_enum ("channel",
-                                                      "Channel",
-                                                      "The affected channel",
-                                                      GIMP_TYPE_HISTOGRAM_CHANNEL,
-                                                      GIMP_HISTOGRAM_VALUE,
-                                                      G_PARAM_READWRITE |
-                                                      G_PARAM_CONSTRUCT));
-
-  g_object_class_install_property (object_class, PROP_CURVE,
-                                   g_param_spec_object ("curve",
-                                                        "Curve",
-                                                        "Curve",
-                                                        GIMP_TYPE_CURVE,
-                                                        G_PARAM_READWRITE));
+  object_class->finalize           = gimp_curves_config_finalize;
+  object_class->set_property       = gimp_curves_config_set_property;
+  object_class->get_property       = gimp_curves_config_get_property;
+
+  viewable_class->default_stock_id = "gimp-tool-curves";
+
+  GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_CHANNEL,
+                                 "channel",
+                                 "The affected channel",
+                                 GIMP_TYPE_HISTOGRAM_CHANNEL,
+                                 GIMP_HISTOGRAM_VALUE, 0);
+
+  GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_CURVE,
+                                   "curve",
+                                   "Curve",
+                                   GIMP_TYPE_CURVE,
+                                   GIMP_CONFIG_PARAM_AGGREGATE);
 }
 
 static void
 gimp_curves_config_iface_init (GimpConfigInterface *iface)
 {
+  iface->equal = gimp_curves_config_equal;
   iface->reset = gimp_curves_config_reset;
+  iface->copy  = gimp_curves_config_copy;
 }
 
 static void
@@ -137,11 +145,8 @@
        channel <= GIMP_HISTOGRAM_ALPHA;
        channel++)
     {
-      if (self->curve[channel])
-        {
-          g_object_unref (self->curve[channel]);
-          self->curve[channel] = NULL;
-        }
+      g_object_unref (self->curve[channel]);
+      self->curve[channel] = NULL;
     }
 
   G_OBJECT_CLASS (parent_class)->finalize (object);
@@ -187,9 +192,20 @@
       break;
 
     case PROP_CURVE:
-      if (self->curve[self->channel])
-        g_object_unref (self->curve[self->channel]);
-      self->curve[self->channel] = g_value_dup_object (value);
+      {
+        GimpCurve *src_curve  = g_value_get_object (value);
+        GimpCurve *dest_curve = self->curve[self->channel];
+
+        if (src_curve && dest_curve)
+          {
+            gimp_config_sync (G_OBJECT (src_curve), G_OBJECT (dest_curve), 0);
+
+            memcpy (dest_curve->points, src_curve->points,
+                    sizeof (src_curve->points));
+            memcpy (dest_curve->curve, src_curve->curve,
+                    sizeof (src_curve->curve));
+          }
+      }
       break;
 
    default:
@@ -198,14 +214,49 @@
     }
 }
 
+static gboolean
+gimp_curves_config_equal (GimpConfig *a,
+                          GimpConfig *b)
+{
+  GimpCurvesConfig     *a_config = GIMP_CURVES_CONFIG (a);
+  GimpCurvesConfig     *b_config = GIMP_CURVES_CONFIG (b);
+  GimpHistogramChannel  channel;
+
+  for (channel = GIMP_HISTOGRAM_VALUE;
+       channel <= GIMP_HISTOGRAM_ALPHA;
+       channel++)
+    {
+      GimpCurve *a_curve = a_config->curve[channel];
+      GimpCurve *b_curve = b_config->curve[channel];
+
+      if (a_curve && b_curve)
+        {
+          if (a_curve->curve_type != b_curve->curve_type)
+            return FALSE;
+
+          if (memcmp (a_curve->points, b_curve->points,
+                      sizeof (b_curve->points)) ||
+              memcmp (a_curve->curve, b_curve->curve,
+                      sizeof (b_curve->curve)))
+            return FALSE;
+        }
+      else if (a_curve || b_curve)
+        {
+          return FALSE;
+        }
+    }
+
+  /* don't compare "channel" */
+
+  return TRUE;
+}
+
 static void
 gimp_curves_config_reset (GimpConfig *config)
 {
   GimpCurvesConfig     *c_config = GIMP_CURVES_CONFIG (config);
   GimpHistogramChannel  channel;
 
-  g_object_freeze_notify (G_OBJECT (config));
-
   for (channel = GIMP_HISTOGRAM_VALUE;
        channel <= GIMP_HISTOGRAM_ALPHA;
        channel++)
@@ -215,8 +266,42 @@
     }
 
   gimp_config_reset_property (G_OBJECT (config), "channel");
+}
 
-  g_object_thaw_notify (G_OBJECT (config));
+static gboolean
+gimp_curves_config_copy (GimpConfig  *src,
+                         GimpConfig  *dest,
+                         GParamFlags  flags)
+{
+  GimpCurvesConfig     *src_config  = GIMP_CURVES_CONFIG (src);
+  GimpCurvesConfig     *dest_config = GIMP_CURVES_CONFIG (dest);
+  GimpHistogramChannel  channel;
+
+  for (channel = GIMP_HISTOGRAM_VALUE;
+       channel <= GIMP_HISTOGRAM_ALPHA;
+       channel++)
+    {
+      GimpCurve *src_curve  = src_config->curve[channel];
+      GimpCurve *dest_curve = dest_config->curve[channel];
+
+      if (src_curve && dest_curve)
+        {
+          gimp_config_sync (G_OBJECT (src_curve), G_OBJECT (dest_curve), 0);
+
+          memcpy (dest_curve->points,
+                  src_curve->points, sizeof (src_curve->points));
+          memcpy (dest_curve->curve,
+                  src_curve->curve, sizeof (src_curve->curve));
+        }
+    }
+
+  g_object_notify (G_OBJECT (dest), "curve");
+
+  dest_config->channel = src_config->channel;
+
+  g_object_notify (G_OBJECT (dest), "channel");
+
+  return TRUE;
 }
 
 static void

Modified: branches/weskaggs/app/gegl/gimpcurvesconfig.h
==============================================================================
--- branches/weskaggs/app/gegl/gimpcurvesconfig.h	(original)
+++ branches/weskaggs/app/gegl/gimpcurvesconfig.h	Wed Feb  6 17:19:00 2008
@@ -23,9 +23,7 @@
 #define __GIMP_CURVES_CONFIG_H__
 
 
-#include <gdk-pixbuf/gdk-pixbuf.h> /* eek */
-#include "core/core-types.h" /* eek */
-#include "core/gimpcurve.h" /* eek */
+#include "core/gimpviewable.h"
 
 
 #define GIMP_TYPE_CURVES_CONFIG            (gimp_curves_config_get_type ())
@@ -40,7 +38,7 @@
 
 struct _GimpCurvesConfig
 {
-  GObject               parent_instance;
+  GimpViewable          parent_instance;
 
   GimpHistogramChannel  channel;
 
@@ -49,7 +47,7 @@
 
 struct _GimpCurvesConfigClass
 {
-  GObjectClass  parent_class;
+  GimpViewableClass  parent_class;
 };
 
 

Modified: branches/weskaggs/app/gegl/gimphuesaturationconfig.c
==============================================================================
--- branches/weskaggs/app/gegl/gimphuesaturationconfig.c	(original)
+++ branches/weskaggs/app/gegl/gimphuesaturationconfig.c	Wed Feb  6 17:19:00 2008
@@ -44,22 +44,27 @@
 };
 
 
-static void   gimp_hue_saturation_config_iface_init   (GimpConfigInterface *iface);
+static void     gimp_hue_saturation_config_iface_init   (GimpConfigInterface *iface);
 
-static void   gimp_hue_saturation_config_get_property (GObject      *object,
-                                                       guint         property_id,
-                                                       GValue       *value,
-                                                       GParamSpec   *pspec);
-static void   gimp_hue_saturation_config_set_property (GObject      *object,
-                                                       guint         property_id,
-                                                       const GValue *value,
-                                                       GParamSpec   *pspec);
-
-static void   gimp_hue_saturation_config_reset        (GimpConfig   *config);
+static void     gimp_hue_saturation_config_get_property (GObject      *object,
+                                                         guint         property_id,
+                                                         GValue       *value,
+                                                         GParamSpec   *pspec);
+static void     gimp_hue_saturation_config_set_property (GObject      *object,
+                                                         guint         property_id,
+                                                         const GValue *value,
+                                                         GParamSpec   *pspec);
+
+static gboolean gimp_hue_saturation_config_equal        (GimpConfig   *a,
+                                                         GimpConfig   *b);
+static void     gimp_hue_saturation_config_reset        (GimpConfig   *config);
+static gboolean gimp_hue_saturation_config_copy         (GimpConfig   *src,
+                                                         GimpConfig   *dest,
+                                                         GParamFlags   flags);
 
 
 G_DEFINE_TYPE_WITH_CODE (GimpHueSaturationConfig, gimp_hue_saturation_config,
-                         G_TYPE_OBJECT,
+                         GIMP_TYPE_VIEWABLE,
                          G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
                                                 gimp_hue_saturation_config_iface_init))
 
@@ -69,57 +74,47 @@
 static void
 gimp_hue_saturation_config_class_init (GimpHueSaturationConfigClass *klass)
 {
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GObjectClass      *object_class   = G_OBJECT_CLASS (klass);
+  GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
+
+  object_class->set_property       = gimp_hue_saturation_config_set_property;
+  object_class->get_property       = gimp_hue_saturation_config_get_property;
 
-  object_class->set_property = gimp_hue_saturation_config_set_property;
-  object_class->get_property = gimp_hue_saturation_config_get_property;
+  viewable_class->default_stock_id = "gimp-tool-hue-saturation";
 
-  g_object_class_install_property (object_class, PROP_RANGE,
-                                   g_param_spec_enum ("range",
-                                                      "range",
-                                                      "The affected range",
-                                                      GIMP_TYPE_HUE_RANGE,
-                                                      GIMP_ALL_HUES,
-                                                      G_PARAM_READWRITE |
-                                                      G_PARAM_CONSTRUCT));
-
-  g_object_class_install_property (object_class, PROP_HUE,
-                                   g_param_spec_double ("hue",
-                                                        "Hue",
-                                                        "Hue",
-                                                        -1.0, 1.0, 0.0,
-                                                        G_PARAM_READWRITE |
-                                                        G_PARAM_CONSTRUCT));
-
-  g_object_class_install_property (object_class, PROP_SATURATION,
-                                   g_param_spec_double ("saturation",
-                                                        "Saturation",
-                                                        "Saturation",
-                                                        -1.0, 1.0, 0.0,
-                                                        G_PARAM_READWRITE |
-                                                        G_PARAM_CONSTRUCT));
-
-  g_object_class_install_property (object_class, PROP_LIGHTNESS,
-                                   g_param_spec_double ("lightness",
-                                                        "Lightness",
-                                                        "Lightness",
-                                                        -1.0, 1.0, 0.0,
-                                                        G_PARAM_READWRITE |
-                                                        G_PARAM_CONSTRUCT));
-
-  g_object_class_install_property (object_class, PROP_OVERLAP,
-                                   g_param_spec_double ("overlap",
-                                                        "Overlap",
-                                                        "Overlap",
-                                                        0.0, 1.0, 0.0,
-                                                        G_PARAM_READWRITE |
-                                                        G_PARAM_CONSTRUCT));
+  GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_RANGE,
+                                 "range",
+                                 "The affected range",
+                                 GIMP_TYPE_HUE_RANGE,
+                                 GIMP_ALL_HUES, 0);
+
+  GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_HUE,
+                                   "hue",
+                                   "Hue",
+                                   -1.0, 1.0, 0.0, 0);
+
+  GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_SATURATION,
+                                   "saturation",
+                                   "Saturation",
+                                   -1.0, 1.0, 0.0, 0);
+
+  GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_LIGHTNESS,
+                                   "lightness",
+                                   "Lightness",
+                                   -1.0, 1.0, 0.0, 0);
+
+  GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_OVERLAP,
+                                   "overlap",
+                                   "Overlap",
+                                   0.0, 1.0, 0.0, 0);
 }
 
 static void
 gimp_hue_saturation_config_iface_init (GimpConfigInterface *iface)
 {
+  iface->equal = gimp_hue_saturation_config_equal;
   iface->reset = gimp_hue_saturation_config_reset;
+  iface->copy  = gimp_hue_saturation_config_copy;
 }
 
 static void
@@ -203,14 +198,36 @@
     }
 }
 
+static gboolean
+gimp_hue_saturation_config_equal (GimpConfig *a,
+                                  GimpConfig *b)
+{
+  GimpHueSaturationConfig *a_config = GIMP_HUE_SATURATION_CONFIG (a);
+  GimpHueSaturationConfig *b_config = GIMP_HUE_SATURATION_CONFIG (b);
+  GimpHueRange             range;
+
+  for (range = GIMP_ALL_HUES; range <= GIMP_MAGENTA_HUES; range++)
+    {
+      if (a_config->hue[range]        != b_config->hue[range]        ||
+          a_config->saturation[range] != b_config->saturation[range] ||
+          a_config->lightness[range]  != b_config->lightness[range])
+        return FALSE;
+    }
+
+  /* don't compare "range" */
+
+  if (a_config->overlap != b_config->overlap)
+    return FALSE;
+
+  return TRUE;
+}
+
 static void
 gimp_hue_saturation_config_reset (GimpConfig *config)
 {
   GimpHueSaturationConfig *hs_config = GIMP_HUE_SATURATION_CONFIG (config);
   GimpHueRange             range;
 
-  g_object_freeze_notify (G_OBJECT (config));
-
   for (range = GIMP_ALL_HUES; range <= GIMP_MAGENTA_HUES; range++)
     {
       hs_config->range = range;
@@ -219,8 +236,35 @@
 
   gimp_config_reset_property (G_OBJECT (config), "range");
   gimp_config_reset_property (G_OBJECT (config), "overlap");
+}
 
-  g_object_thaw_notify (G_OBJECT (config));
+static gboolean
+gimp_hue_saturation_config_copy (GimpConfig   *src,
+                                 GimpConfig   *dest,
+                                 GParamFlags   flags)
+{
+  GimpHueSaturationConfig *src_config  = GIMP_HUE_SATURATION_CONFIG (src);
+  GimpHueSaturationConfig *dest_config = GIMP_HUE_SATURATION_CONFIG (dest);
+  GimpHueRange             range;
+
+  for (range = GIMP_ALL_HUES; range <= GIMP_MAGENTA_HUES; range++)
+    {
+      dest_config->hue[range]        = src_config->hue[range];
+      dest_config->saturation[range] = src_config->saturation[range];
+      dest_config->lightness[range]  = src_config->lightness[range];
+    }
+
+  g_object_notify (G_OBJECT (dest), "hue");
+  g_object_notify (G_OBJECT (dest), "saturation");
+  g_object_notify (G_OBJECT (dest), "lightness");
+
+  dest_config->range   = src_config->range;
+  dest_config->overlap = src_config->overlap;
+
+  g_object_notify (G_OBJECT (dest), "range");
+  g_object_notify (G_OBJECT (dest), "overlap");
+
+  return TRUE;
 }
 
 

Modified: branches/weskaggs/app/gegl/gimphuesaturationconfig.h
==============================================================================
--- branches/weskaggs/app/gegl/gimphuesaturationconfig.h	(original)
+++ branches/weskaggs/app/gegl/gimphuesaturationconfig.h	Wed Feb  6 17:19:00 2008
@@ -23,6 +23,9 @@
 #define __GIMP_HUE_SATURATION_CONFIG_H__
 
 
+#include "core/gimpviewable.h"
+
+
 #define GIMP_TYPE_HUE_SATURATION_CONFIG            (gimp_hue_saturation_config_get_type ())
 #define GIMP_HUE_SATURATION_CONFIG(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_HUE_SATURATION_CONFIG, GimpHueSaturationConfig))
 #define GIMP_HUE_SATURATION_CONFIG_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  GIMP_TYPE_HUE_SATURATION_CONFIG, GimpHueSaturationConfigClass))
@@ -35,7 +38,7 @@
 
 struct _GimpHueSaturationConfig
 {
-  GObject       parent_instance;
+  GimpViewable  parent_instance;
 
   GimpHueRange  range;
 
@@ -48,7 +51,7 @@
 
 struct _GimpHueSaturationConfigClass
 {
-  GObjectClass  parent_class;
+  GimpViewableClass  parent_class;
 };
 
 

Modified: branches/weskaggs/app/gegl/gimplevelsconfig.c
==============================================================================
--- branches/weskaggs/app/gegl/gimplevelsconfig.c	(original)
+++ branches/weskaggs/app/gegl/gimplevelsconfig.c	Wed Feb  6 17:19:00 2008
@@ -55,22 +55,27 @@
 };
 
 
-static void   gimp_levels_config_iface_init   (GimpConfigInterface *iface);
+static void     gimp_levels_config_iface_init   (GimpConfigInterface *iface);
 
-static void   gimp_levels_config_get_property (GObject       *object,
-                                               guint          property_id,
-                                               GValue        *value,
-                                               GParamSpec    *pspec);
-static void   gimp_levels_config_set_property (GObject       *object,
-                                               guint          property_id,
-                                               const GValue  *value,
-                                               GParamSpec    *pspec);
-
-static void   gimp_levels_config_reset        (GimpConfig    *config);
+static void     gimp_levels_config_get_property (GObject       *object,
+                                                 guint          property_id,
+                                                 GValue        *value,
+                                                 GParamSpec    *pspec);
+static void     gimp_levels_config_set_property (GObject       *object,
+                                                 guint          property_id,
+                                                 const GValue  *value,
+                                                 GParamSpec    *pspec);
+
+static gboolean gimp_levels_config_equal        (GimpConfig    *a,
+                                                 GimpConfig    *b);
+static void     gimp_levels_config_reset        (GimpConfig    *config);
+static gboolean gimp_levels_config_copy         (GimpConfig    *src,
+                                                 GimpConfig    *dest,
+                                                 GParamFlags    flags);
 
 
 G_DEFINE_TYPE_WITH_CODE (GimpLevelsConfig, gimp_levels_config,
-                         G_TYPE_OBJECT,
+                         GIMP_TYPE_VIEWABLE,
                          G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
                                                 gimp_levels_config_iface_init))
 
@@ -80,65 +85,52 @@
 static void
 gimp_levels_config_class_init (GimpLevelsConfigClass *klass)
 {
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GObjectClass      *object_class   = G_OBJECT_CLASS (klass);
+  GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
+
+  object_class->set_property       = gimp_levels_config_set_property;
+  object_class->get_property       = gimp_levels_config_get_property;
 
-  object_class->set_property = gimp_levels_config_set_property;
-  object_class->get_property = gimp_levels_config_get_property;
+  viewable_class->default_stock_id = "gimp-tool-levels";
 
-  g_object_class_install_property (object_class, PROP_CHANNEL,
-                                   g_param_spec_enum ("channel",
-                                                      "Channel",
-                                                      "The affected channel",
-                                                      GIMP_TYPE_HISTOGRAM_CHANNEL,
-                                                      GIMP_HISTOGRAM_VALUE,
-                                                      G_PARAM_READWRITE |
-                                                      G_PARAM_CONSTRUCT));
-
-  g_object_class_install_property (object_class, PROP_GAMMA,
-                                   g_param_spec_double ("gamma",
-                                                        "Gamma",
-                                                        "Gamma",
-                                                        0.1, 10.0, 1.0,
-                                                        G_PARAM_READWRITE |
-                                                        G_PARAM_CONSTRUCT));
-
-  g_object_class_install_property (object_class, PROP_LOW_INPUT,
-                                   g_param_spec_double ("low-input",
-                                                        "Low Input",
-                                                        "Low Input",
-                                                        0.0, 1.0, 0.0,
-                                                        G_PARAM_READWRITE |
-                                                        G_PARAM_CONSTRUCT));
-
-  g_object_class_install_property (object_class, PROP_HIGH_INPUT,
-                                   g_param_spec_double ("high-input",
-                                                        "High Input",
-                                                        "High Input",
-                                                        0.0, 1.0, 1.0,
-                                                        G_PARAM_READWRITE |
-                                                        G_PARAM_CONSTRUCT));
-
-  g_object_class_install_property (object_class, PROP_LOW_OUTPUT,
-                                   g_param_spec_double ("low-output",
-                                                        "Low Output",
-                                                        "Low Output",
-                                                        0.0, 1.0, 0.0,
-                                                        G_PARAM_READWRITE |
-                                                        G_PARAM_CONSTRUCT));
-
-  g_object_class_install_property (object_class, PROP_HIGH_OUTPUT,
-                                   g_param_spec_double ("high-output",
-                                                        "High Output",
-                                                        "High Output",
-                                                        0.0, 1.0, 1.0,
-                                                        G_PARAM_READWRITE |
-                                                        G_PARAM_CONSTRUCT));
+  GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_CHANNEL,
+                                 "channel",
+                                 "The affected channel",
+                                 GIMP_TYPE_HISTOGRAM_CHANNEL,
+                                 GIMP_HISTOGRAM_VALUE, 0);
+
+  GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_GAMMA,
+                                   "gamma",
+                                   "Gamma",
+                                   0.1, 10.0, 1.0, 0);
+
+  GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_LOW_INPUT,
+                                   "low-input",
+                                   "Low Input",
+                                   0.0, 1.0, 0.0, 0);
+
+  GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_HIGH_INPUT,
+                                   "high-input",
+                                   "High Input",
+                                   0.0, 1.0, 1.0, 0);
+
+  GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_LOW_OUTPUT,
+                                   "low-output",
+                                   "Low Output",
+                                   0.0, 1.0, 0.0, 0);
+
+  GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_HIGH_OUTPUT,
+                                   "high-output",
+                                   "High Output",
+                                   0.0, 1.0, 1.0, 0);
 }
 
 static void
 gimp_levels_config_iface_init (GimpConfigInterface *iface)
 {
+  iface->equal = gimp_levels_config_equal;
   iface->reset = gimp_levels_config_reset;
+  iface->copy  = gimp_levels_config_copy;
 }
 
 static void
@@ -232,14 +224,37 @@
     }
 }
 
+static gboolean
+gimp_levels_config_equal (GimpConfig *a,
+                          GimpConfig *b)
+{
+  GimpLevelsConfig     *a_config = GIMP_LEVELS_CONFIG (a);
+  GimpLevelsConfig     *b_config = GIMP_LEVELS_CONFIG (b);
+  GimpHistogramChannel  channel;
+
+  for (channel = GIMP_HISTOGRAM_VALUE;
+       channel <= GIMP_HISTOGRAM_ALPHA;
+       channel++)
+    {
+      if (a_config->gamma[channel]       != b_config->gamma[channel]      ||
+          a_config->low_input[channel]   != b_config->low_input[channel]  ||
+          a_config->high_input[channel]  != b_config->high_input[channel] ||
+          a_config->low_output[channel]  != b_config->low_output[channel] ||
+          a_config->high_output[channel] != b_config->high_output[channel])
+        return FALSE;
+    }
+
+  /* don't compare "channel" */
+
+  return TRUE;
+}
+
 static void
 gimp_levels_config_reset (GimpConfig *config)
 {
   GimpLevelsConfig     *l_config = GIMP_LEVELS_CONFIG (config);
   GimpHistogramChannel  channel;
 
-  g_object_freeze_notify (G_OBJECT (config));
-
   for (channel = GIMP_HISTOGRAM_VALUE;
        channel <= GIMP_HISTOGRAM_ALPHA;
        channel++)
@@ -249,8 +264,39 @@
     }
 
   gimp_config_reset_property (G_OBJECT (config), "channel");
+}
 
-  g_object_thaw_notify (G_OBJECT (config));
+static gboolean
+gimp_levels_config_copy (GimpConfig  *src,
+                         GimpConfig  *dest,
+                         GParamFlags  flags)
+{
+  GimpLevelsConfig     *src_config  = GIMP_LEVELS_CONFIG (src);
+  GimpLevelsConfig     *dest_config = GIMP_LEVELS_CONFIG (dest);
+  GimpHistogramChannel  channel;
+
+  for (channel = GIMP_HISTOGRAM_VALUE;
+       channel <= GIMP_HISTOGRAM_ALPHA;
+       channel++)
+    {
+      dest_config->gamma[channel]       = src_config->gamma[channel];
+      dest_config->low_input[channel]   = src_config->low_input[channel];
+      dest_config->high_input[channel]  = src_config->high_input[channel];
+      dest_config->low_output[channel]  = src_config->low_output[channel];
+      dest_config->high_output[channel] = src_config->high_output[channel];
+    }
+
+  g_object_notify (G_OBJECT (dest), "gamma");
+  g_object_notify (G_OBJECT (dest), "low-input");
+  g_object_notify (G_OBJECT (dest), "high-input");
+  g_object_notify (G_OBJECT (dest), "low-output");
+  g_object_notify (G_OBJECT (dest), "high-output");
+
+  dest_config->channel = src_config->channel;
+
+  g_object_notify (G_OBJECT (dest), "channel");
+
+  return TRUE;
 }
 
 

Modified: branches/weskaggs/app/gegl/gimplevelsconfig.h
==============================================================================
--- branches/weskaggs/app/gegl/gimplevelsconfig.h	(original)
+++ branches/weskaggs/app/gegl/gimplevelsconfig.h	Wed Feb  6 17:19:00 2008
@@ -23,6 +23,9 @@
 #define __GIMP_LEVELS_CONFIG_H__
 
 
+#include "core/gimpviewable.h"
+
+
 #define GIMP_TYPE_LEVELS_CONFIG            (gimp_levels_config_get_type ())
 #define GIMP_LEVELS_CONFIG(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_LEVELS_CONFIG, GimpLevelsConfig))
 #define GIMP_LEVELS_CONFIG_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  GIMP_TYPE_LEVELS_CONFIG, GimpLevelsConfigClass))
@@ -35,7 +38,7 @@
 
 struct _GimpLevelsConfig
 {
-  GObject               parent_instance;
+  GimpViewable          parent_instance;
 
   GimpHistogramChannel  channel;
 
@@ -50,7 +53,7 @@
 
 struct _GimpLevelsConfigClass
 {
-  GObjectClass  parent_class;
+  GimpViewableClass  parent_class;
 };
 
 

Modified: branches/weskaggs/app/gegl/gimpoperationcurves.c
==============================================================================
--- branches/weskaggs/app/gegl/gimpoperationcurves.c	(original)
+++ branches/weskaggs/app/gegl/gimpoperationcurves.c	Wed Feb  6 17:19:00 2008
@@ -28,6 +28,8 @@
 
 #include "gegl-types.h"
 
+#include "core/gimpcurve.h"
+
 #include "gimpcurvesconfig.h"
 #include "gimpoperationcurves.h"
 

Modified: branches/weskaggs/app/gegl/gimpoperationhuesaturation.c
==============================================================================
--- branches/weskaggs/app/gegl/gimpoperationhuesaturation.c	(original)
+++ branches/weskaggs/app/gegl/gimpoperationhuesaturation.c	Wed Feb  6 17:19:00 2008
@@ -127,15 +127,17 @@
                                        void          *out_buf,
                                        glong          samples)
 {
-  GimpOperationPointFilter *point   = GIMP_OPERATION_POINT_FILTER (operation);
-  GimpHueSaturationConfig  *config  = GIMP_HUE_SATURATION_CONFIG (point->config);
-  gfloat                   *src     = in_buf;
-  gfloat                   *dest    = out_buf;
-  gfloat                    overlap = config->overlap / 2.0;
+  GimpOperationPointFilter *point  = GIMP_OPERATION_POINT_FILTER (operation);
+  GimpHueSaturationConfig  *config = GIMP_HUE_SATURATION_CONFIG (point->config);
+  gfloat                   *src    = in_buf;
+  gfloat                   *dest   = out_buf;
+  gfloat                    overlap;
 
   if (! config)
     return FALSE;
 
+  overlap = config->overlap / 2.0;
+
   while (samples--)
     {
       GimpRGB  rgb;

Modified: branches/weskaggs/app/gegl/gimpoperationposterize.c
==============================================================================
--- branches/weskaggs/app/gegl/gimpoperationposterize.c	(original)
+++ branches/weskaggs/app/gegl/gimpoperationposterize.c	Wed Feb  6 17:19:00 2008
@@ -83,11 +83,13 @@
   GimpPosterizeConfig      *config = GIMP_POSTERIZE_CONFIG (point->config);
   gfloat                   *src    = in_buf;
   gfloat                   *dest   = out_buf;
-  gfloat                    levels = config->levels - 1.0;
+  gfloat                    levels;
 
   if (! config)
     return FALSE;
 
+  levels = config->levels - 1.0;
+
   while (samples--)
     {
       dest[RED_PIX]   = RINT (src[RED_PIX]   * levels) / levels;

Modified: branches/weskaggs/app/gegl/gimpposterizeconfig.c
==============================================================================
--- branches/weskaggs/app/gegl/gimpposterizeconfig.c	(original)
+++ branches/weskaggs/app/gegl/gimpposterizeconfig.c	Wed Feb  6 17:19:00 2008
@@ -48,7 +48,7 @@
 
 
 G_DEFINE_TYPE_WITH_CODE (GimpPosterizeConfig, gimp_posterize_config,
-                         G_TYPE_OBJECT,
+                         GIMP_TYPE_VIEWABLE,
                          G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG, NULL))
 
 #define parent_class gimp_posterize_config_parent_class
@@ -57,18 +57,18 @@
 static void
 gimp_posterize_config_class_init (GimpPosterizeConfigClass *klass)
 {
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GObjectClass      *object_class   = G_OBJECT_CLASS (klass);
+  GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
 
-  object_class->set_property = gimp_posterize_config_set_property;
-  object_class->get_property = gimp_posterize_config_get_property;
+  object_class->set_property       = gimp_posterize_config_set_property;
+  object_class->get_property       = gimp_posterize_config_get_property;
 
-  g_object_class_install_property (object_class, PROP_LEVELS,
-                                   g_param_spec_int ("levels",
-                                                     "Levels",
-                                                     "Posterize levels",
-                                                     2, 256, 3,
-                                                     G_PARAM_READWRITE |
-                                                     G_PARAM_CONSTRUCT));
+  viewable_class->default_stock_id = "gimp-tool-posterize";
+
+  GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_LEVELS,
+                                "levels",
+                                "Posterize levels",
+                                2, 256, 3, 0);
 }
 
 static void

Modified: branches/weskaggs/app/gegl/gimpposterizeconfig.h
==============================================================================
--- branches/weskaggs/app/gegl/gimpposterizeconfig.h	(original)
+++ branches/weskaggs/app/gegl/gimpposterizeconfig.h	Wed Feb  6 17:19:00 2008
@@ -23,6 +23,9 @@
 #define __GIMP_POSTERIZE_CONFIG_H__
 
 
+#include "core/gimpviewable.h"
+
+
 #define GIMP_TYPE_POSTERIZE_CONFIG            (gimp_posterize_config_get_type ())
 #define GIMP_POSTERIZE_CONFIG(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_POSTERIZE_CONFIG, GimpPosterizeConfig))
 #define GIMP_POSTERIZE_CONFIG_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  GIMP_TYPE_POSTERIZE_CONFIG, GimpPosterizeConfigClass))
@@ -35,14 +38,14 @@
 
 struct _GimpPosterizeConfig
 {
-  GObject  parent_instance;
+  GimpViewable  parent_instance;
 
-  gint     levels;
+  gint          levels;
 };
 
 struct _GimpPosterizeConfigClass
 {
-  GObjectClass  parent_class;
+  GimpViewableClass  parent_class;
 };
 
 

Modified: branches/weskaggs/app/gegl/gimpthresholdconfig.c
==============================================================================
--- branches/weskaggs/app/gegl/gimpthresholdconfig.c	(original)
+++ branches/weskaggs/app/gegl/gimpthresholdconfig.c	Wed Feb  6 17:19:00 2008
@@ -52,7 +52,7 @@
 
 
 G_DEFINE_TYPE_WITH_CODE (GimpThresholdConfig, gimp_threshold_config,
-                         G_TYPE_OBJECT,
+                         GIMP_TYPE_VIEWABLE,
                          G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG, NULL))
 
 #define parent_class gimp_threshold_config_parent_class
@@ -61,26 +61,23 @@
 static void
 gimp_threshold_config_class_init (GimpThresholdConfigClass *klass)
 {
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GObjectClass      *object_class   = G_OBJECT_CLASS (klass);
+  GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
 
-  object_class->set_property = gimp_threshold_config_set_property;
-  object_class->get_property = gimp_threshold_config_get_property;
+  object_class->set_property       = gimp_threshold_config_set_property;
+  object_class->get_property       = gimp_threshold_config_get_property;
 
-  g_object_class_install_property (object_class, PROP_LOW,
-                                   g_param_spec_double ("low",
-                                                        "Low",
-                                                        "Low threshold",
-                                                        0.0, 1.0, 0.5,
-                                                        G_PARAM_READWRITE |
-                                                        G_PARAM_CONSTRUCT));
-
-  g_object_class_install_property (object_class, PROP_HIGH,
-                                   g_param_spec_double ("high",
-                                                        "High",
-                                                        "High threshold",
-                                                        0.0, 1.0, 1.0,
-                                                        G_PARAM_READWRITE |
-                                                        G_PARAM_CONSTRUCT));
+  viewable_class->default_stock_id = "gimp-tool-threshold";
+
+  GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_LOW,
+                                   "low",
+                                   "Low threshold",
+                                   0.0, 1.0, 0.5, 0);
+
+  GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_HIGH,
+                                   "high",
+                                   "High threshold",
+                                   0.0, 1.0, 1.0, 0);
 }
 
 static void
@@ -141,11 +138,13 @@
 
 void
 gimp_threshold_config_to_cruft (GimpThresholdConfig *config,
-                                Threshold           *cruft)
+                                Threshold           *cruft,
+                                gboolean             color)
 {
   g_return_if_fail (GIMP_IS_THRESHOLD_CONFIG (config));
   g_return_if_fail (cruft != NULL);
 
   cruft->low_threshold  = config->low  * 255.999;
   cruft->high_threshold = config->high * 255.999;
+  cruft->color          = color;
 }

Modified: branches/weskaggs/app/gegl/gimpthresholdconfig.h
==============================================================================
--- branches/weskaggs/app/gegl/gimpthresholdconfig.h	(original)
+++ branches/weskaggs/app/gegl/gimpthresholdconfig.h	Wed Feb  6 17:19:00 2008
@@ -23,6 +23,9 @@
 #define __GIMP_THRESHOLD_CONFIG_H__
 
 
+#include "core/gimpviewable.h"
+
+
 #define GIMP_TYPE_THRESHOLD_CONFIG            (gimp_threshold_config_get_type ())
 #define GIMP_THRESHOLD_CONFIG(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_THRESHOLD_CONFIG, GimpThresholdConfig))
 #define GIMP_THRESHOLD_CONFIG_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  GIMP_TYPE_THRESHOLD_CONFIG, GimpThresholdConfigClass))
@@ -35,15 +38,15 @@
 
 struct _GimpThresholdConfig
 {
-  GObject  parent_instance;
+  GimpViewable  parent_instance;
 
-  gdouble  low;
-  gdouble  high;
+  gdouble       low;
+  gdouble       high;
 };
 
 struct _GimpThresholdConfigClass
 {
-  GObjectClass  parent_class;
+  GimpViewableClass  parent_class;
 };
 
 
@@ -51,7 +54,8 @@
 
 /*  temp cruft  */
 void    gimp_threshold_config_to_cruft (GimpThresholdConfig *config,
-                                        Threshold           *cruft);
+                                        Threshold           *cruft,
+                                        gboolean             color);
 
 
 #endif /* __GIMP_THRESHOLD_CONFIG_H__ */

Modified: branches/weskaggs/app/paint/gimpbrushcore.c
==============================================================================
--- branches/weskaggs/app/paint/gimpbrushcore.c	(original)
+++ branches/weskaggs/app/paint/gimpbrushcore.c	Wed Feb  6 17:19:00 2008
@@ -786,8 +786,12 @@
       pixel_region_init_temp_buf (&PR, mask,
                                   0, 0, mask->width, mask->height);
 
-      /*  smooth the mask in order to obtain a simpler boundary  */
-      smooth_region (&PR);
+      /* Large, complex brush outlines are a performance problem.
+       * Smooth the mask in order to obtain a simpler boundary.
+       */
+      if (mask->width > 32 && mask->height > 32)
+        smooth_region (&PR);
+
 
       boundary = boundary_find (&PR, BOUNDARY_WITHIN_BOUNDS,
                                 0, 0, PR.w, PR.h,

Modified: branches/weskaggs/app/pdb/color_cmds.c
==============================================================================
--- branches/weskaggs/app/pdb/color_cmds.c	(original)
+++ branches/weskaggs/app/pdb/color_cmds.c	Wed Feb  6 17:19:00 2008
@@ -29,27 +29,22 @@
 #include "gimpprocedure.h"
 #include "core/gimpparamspecs.h"
 
-#include "base/color-balance.h"
-#include "base/colorize.h"
-#include "base/curves.h"
 #include "base/gimphistogram.h"
-#include "base/gimplut.h"
-#include "base/hue-saturation.h"
-#include "base/lut-funcs.h"
-#include "base/pixel-processor.h"
-#include "base/pixel-region.h"
-#include "base/threshold.h"
-#include "core/gimp.h"
-#include "core/gimpcurve.h"
+#include "core/gimpdrawable-brightness-contrast.h"
+#include "core/gimpdrawable-color-balance.h"
+#include "core/gimpdrawable-colorize.h"
+#include "core/gimpdrawable-curves.h"
 #include "core/gimpdrawable-desaturate.h"
 #include "core/gimpdrawable-equalize.h"
 #include "core/gimpdrawable-histogram.h"
+#include "core/gimpdrawable-hue-saturation.h"
 #include "core/gimpdrawable-invert.h"
 #include "core/gimpdrawable-levels.h"
-#include "core/gimpdrawable-operation.h"
+#include "core/gimpdrawable-posterize.h"
+#include "core/gimpdrawable-threshold.h"
 #include "core/gimpdrawable.h"
-#include "core/gimpimage.h"
 #include "gimp-intl.h"
+#include "gimppdb-utils.h"
 
 #include "internal_procs.h"
 
@@ -73,60 +68,13 @@
 
   if (success)
     {
-      if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
+      if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) ||
           gimp_drawable_is_indexed (drawable))
         success = FALSE;
 
       if (success)
-        {
-      if (gimp_use_gegl (gimp))
-        {
-          GeglNode *node = g_object_new (GEGL_TYPE_NODE,
-                                         "operation",  "brightness-contrast",
-                                         NULL);
-
-          gegl_node_set (node,
-                         "brightness", brightness / 127.0,
-                         "contrast",   (contrast < 0 ?
-                                        (contrast + 127.0) / 127.0 :
-                                        contrast * 4.0 / 127.0 + 1),
-                         NULL);
-
-          gimp_drawable_apply_operation (drawable, node, TRUE,
-                                         progress, _("Brightness-Contrast"));
-
-          g_object_unref (node);
-        }
-      else
-        {
-          gint x, y, width, height;
-
-          /* The application should occur only within selection bounds */
-          if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
-            {
-              GimpLut     *lut;
-              PixelRegion  srcPR, destPR;
-
-              lut = brightness_contrast_lut_new (brightness / 255.0,
-                                                 contrast / 127.0,
-                                                 gimp_drawable_bytes (drawable));
-
-              pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
-                                 x, y, width, height, FALSE);
-              pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
-                                 x, y, width, height, TRUE);
-
-              pixel_regions_process_parallel ((PixelProcessorFunc)
-                                              gimp_lut_process,
-                                              lut, 2, &srcPR, &destPR);
-
-              gimp_lut_free (lut);
-
-              gimp_drawable_merge_shadow (drawable, TRUE, _("Brightness-Contrast"));
-              gimp_drawable_update (drawable, x, y, width, height);
-            }
-        }
-        }
+        gimp_drawable_brightness_contrast (drawable, progress,
+                                           brightness, contrast);
     }
 
   return gimp_procedure_get_return_values (procedure, success);
@@ -159,7 +107,7 @@
 
   if (success)
     {
-      if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
+      if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) ||
           gimp_drawable_is_indexed (drawable) ||
           (! gimp_drawable_has_alpha (drawable) &&
            channel == GIMP_HISTOGRAM_ALPHA) ||
@@ -193,7 +141,7 @@
 
   if (success)
     {
-      if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
+      if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) ||
           gimp_drawable_is_indexed (drawable))
         success = FALSE;
 
@@ -219,7 +167,7 @@
 
   if (success)
     {
-      if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
+      if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) ||
           gimp_drawable_is_indexed (drawable))
         success = FALSE;
 
@@ -247,55 +195,12 @@
 
   if (success)
     {
-      if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
+      if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) ||
           gimp_drawable_is_indexed (drawable))
         success = FALSE;
 
       if (success)
-        {
-      if (gimp_use_gegl (gimp))
-        {
-          GeglNode *node = g_object_new (GEGL_TYPE_NODE,
-                                         "operation", "gimp-posterize",
-                                         NULL);
-
-          gegl_node_set (node,
-                         "levels", levels,
-                         NULL);
-
-          gimp_drawable_apply_operation (drawable, node, TRUE,
-                                         progress, _("Levels"));
-
-          g_object_unref (node);
-        }
-      else
-        {
-          gint x, y, width, height;
-
-          /* The application should occur only within selection bounds */
-          if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
-            {
-              GimpLut     *lut;
-              PixelRegion  srcPR, destPR;
-
-              lut = posterize_lut_new (levels, gimp_drawable_bytes (drawable));
-
-              pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
-                                 x, y, width, height, FALSE);
-              pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
-                                 x, y, width, height, TRUE);
-
-              pixel_regions_process_parallel ((PixelProcessorFunc)
-                                              gimp_lut_process,
-                                              lut, 2, &srcPR, &destPR);
-
-              gimp_lut_free (lut);
-
-              gimp_drawable_merge_shadow (drawable, TRUE, _("Posterize"));
-              gimp_drawable_update (drawable, x, y, width, height);
-            }
-        }
-        }
+        gimp_drawable_posterize (drawable, progress, levels);
     }
 
   return gimp_procedure_get_return_values (procedure, success);
@@ -316,7 +221,7 @@
 
   if (success)
     {
-      if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
+      if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) ||
           ! gimp_drawable_is_rgb (drawable))
         success = FALSE;
 
@@ -344,7 +249,7 @@
 
   if (success)
     {
-      if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
+      if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) ||
           ! gimp_drawable_is_rgb (drawable))
         success = FALSE;
 
@@ -372,7 +277,7 @@
 
   if (success)
     {
-      if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
+      if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) ||
           gimp_drawable_is_indexed (drawable))
         success = FALSE;
 
@@ -398,7 +303,7 @@
 
   if (success)
     {
-      if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
+      if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) ||
           gimp_drawable_is_indexed (drawable))
         success = FALSE;
 
@@ -430,7 +335,7 @@
 
   if (success)
     {
-      if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
+      if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) ||
           gimp_drawable_is_indexed (drawable) || (num_points & 1) ||
           (! gimp_drawable_has_alpha (drawable) &&
            channel == GIMP_HISTOGRAM_ALPHA) ||
@@ -439,65 +344,8 @@
         success = FALSE;
 
       if (success)
-        {
-          gint x, y, width, height;
-
-          /* The application should occur only within selection bounds */
-          if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
-            {
-              GimpCurve   *curve;
-              Curves       c;
-              gint         j;
-              PixelRegion  srcPR, destPR;
-              GimpLut     *lut;
-
-              /* FIXME: hack */
-              if (gimp_drawable_is_gray (drawable) &&
-                  channel == GIMP_HISTOGRAM_ALPHA)
-                channel = 1;
-
-              lut = gimp_lut_new ();
-
-              curves_init (&c);
-
-              curve = GIMP_CURVE (gimp_curve_new ("curves_spline"));
-
-              gimp_data_freeze (GIMP_DATA (curve));
-
-              /*  unset the last point  */
-              gimp_curve_set_point (curve, GIMP_CURVE_NUM_POINTS - 1, -1, -1);
-
-              for (j = 0; j < num_points / 2; j++)
-                gimp_curve_set_point (curve, j,
-                                      control_pts[j * 2],
-                                      control_pts[j * 2 + 1]);
-
-              gimp_data_thaw (GIMP_DATA (curve));
-
-              gimp_curve_get_uchar (curve, c.curve[channel]);
-
-              g_object_unref (curve);
-
-              gimp_lut_setup (lut,
-                              (GimpLutFunc) curves_lut_func,
-                              &c,
-                              gimp_drawable_bytes (drawable));
-
-              pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
-                                 x, y, width, height, FALSE);
-              pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
-                                 x, y, width, height, TRUE);
-
-              pixel_regions_process_parallel ((PixelProcessorFunc)
-                                              gimp_lut_process,
-                                              lut, 2, &srcPR, &destPR);
-
-              gimp_lut_free (lut);
-
-              gimp_drawable_merge_shadow (drawable, TRUE, _("Curves"));
-              gimp_drawable_update (drawable, x, y, width, height);
-            }
-        }
+        gimp_drawable_curves_spline (drawable, progress,
+                                     channel, control_pts, num_points);
     }
 
   return gimp_procedure_get_return_values (procedure, success);
@@ -524,7 +372,7 @@
 
   if (success)
     {
-      if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
+      if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) ||
           gimp_drawable_is_indexed (drawable) || (num_bytes != 256) ||
           (! gimp_drawable_has_alpha (drawable) &&
            channel == GIMP_HISTOGRAM_ALPHA) ||
@@ -533,49 +381,8 @@
         success = FALSE;
 
       if (success)
-        {
-          gint x, y, width, height;
-
-          /* The application should occur only within selection bounds */
-          if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
-            {
-              Curves       c;
-              gint         j;
-              PixelRegion  srcPR, destPR;
-              GimpLut     *lut;
-
-              /* FIXME: hack */
-              if (gimp_drawable_is_gray (drawable) &&
-                  channel == GIMP_HISTOGRAM_ALPHA)
-                channel = 1;
-
-              lut = gimp_lut_new ();
-
-              curves_init (&c);
-
-              for (j = 0; j < 256; j++)
-                c.curve[channel][j] = curve[j];
-
-              gimp_lut_setup (lut,
-                              (GimpLutFunc) curves_lut_func,
-                              &c,
-                              gimp_drawable_bytes (drawable));
-
-              pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
-                                 x, y, width, height, FALSE);
-              pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
-                                 x, y, width, height, TRUE);
-
-              pixel_regions_process_parallel ((PixelProcessorFunc)
-                                              gimp_lut_process,
-                                              lut, 2, &srcPR, &destPR);
-
-              gimp_lut_free (lut);
-
-              gimp_drawable_merge_shadow (drawable, TRUE, _("Curves"));
-              gimp_drawable_update (drawable, x, y, width, height);
-            }
-        }
+        gimp_drawable_curves_explicit (drawable, progress,
+                                       channel, curve, num_bytes);
     }
 
   return gimp_procedure_get_return_values (procedure, success);
@@ -606,42 +413,15 @@
 
   if (success)
     {
-      if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
+      if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) ||
           gimp_drawable_is_indexed (drawable))
         success = FALSE;
 
       if (success)
-        {
-          gint x, y, width, height;
-
-          /* The application should occur only within selection bounds */
-          if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
-            {
-              ColorBalance  cb;
-              PixelRegion   srcPR, destPR;
-
-              color_balance_init (&cb);
-
-              cb.preserve_luminosity = preserve_lum;
-
-              cb.cyan_red[transfer_mode]      = cyan_red;
-              cb.magenta_green[transfer_mode] = magenta_green;
-              cb.yellow_blue[transfer_mode]   = yellow_blue;
-
-              color_balance_create_lookup_tables (&cb);
-
-              pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
-                                 x, y, width, height, FALSE);
-              pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
-                                 x, y, width, height, TRUE);
-
-              pixel_regions_process_parallel ((PixelProcessorFunc) color_balance,
-                                              &cb, 2, &srcPR, &destPR);
-
-              gimp_drawable_merge_shadow (drawable, TRUE, _("Color Balance"));
-              gimp_drawable_update (drawable, x, y, width, height);
-            }
-        }
+        gimp_drawable_color_balance (drawable, progress,
+                                     transfer_mode,
+                                     cyan_red, magenta_green, yellow_blue,
+                                     preserve_lum);
     }
 
   return gimp_procedure_get_return_values (procedure, success);
@@ -668,60 +448,13 @@
 
   if (success)
     {
-      if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
+      if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) ||
           ! gimp_drawable_is_rgb (drawable))
         success = FALSE;
 
       if (success)
-        {
-      if (gimp_use_gegl (gimp))
-        {
-          GeglNode *node = g_object_new (GEGL_TYPE_NODE,
-                                         "operation", "gimp-colorize",
-                                         NULL);
-
-          gegl_node_set (node,
-                         "hue",        hue,
-                         "saturation", saturation,
-                         "lightness",  lightness,
-                         NULL);
-
-          gimp_drawable_apply_operation (drawable, node, TRUE,
-                                         progress, _("Colorize"));
-
-          g_object_unref (node);
-        }
-      else
-        {
-          gint x, y, width, height;
-
-          /* The application should occur only within selection bounds */
-          if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
-            {
-              Colorize     colors;
-              PixelRegion  srcPR, destPR;
-
-              colorize_init (&colors);
-
-              colors.hue        = hue;
-              colors.saturation = saturation;
-              colors.lightness  = lightness;
-
-              colorize_calculate (&colors);
-
-              pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
-                                 x, y, width, height, FALSE);
-              pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
-                                 x, y, width, height, TRUE);
-
-              pixel_regions_process_parallel ((PixelProcessorFunc) colorize,
-                                              &colors, 2, &srcPR, &destPR);
-
-              gimp_drawable_merge_shadow (drawable, TRUE, _("Colorize"));
-              gimp_drawable_update (drawable, x, y, width, height);
-            }
-        }
-        }
+        gimp_drawable_colorize (drawable, progress,
+                                hue, saturation, lightness);
     }
 
   return gimp_procedure_get_return_values (procedure, success);
@@ -755,7 +488,7 @@
 
   if (success)
     {
-      if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
+      if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) ||
           gimp_drawable_is_indexed (drawable) ||
           (! gimp_drawable_has_alpha (drawable) &&
            channel == GIMP_HISTOGRAM_ALPHA) ||
@@ -780,7 +513,7 @@
                                                  start_range, end_range);
           percentile = count / pixels;
 
-          gimp_histogram_free (histogram);
+          gimp_histogram_unref (histogram);
         }
     }
 
@@ -822,41 +555,13 @@
 
   if (success)
     {
-      if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
+      if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) ||
           gimp_drawable_is_indexed (drawable))
         success = FALSE;
 
       if (success)
-        {
-          gint x, y, width, height;
-
-          /* The application should occur only within selection bounds */
-          if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
-            {
-              HueSaturation  hs;
-              PixelRegion    srcPR, destPR;
-
-              hue_saturation_init (&hs);
-
-              hs.hue[hue_range]        = hue_offset;
-              hs.lightness[hue_range]  = lightness;
-              hs.saturation[hue_range] = saturation;
-
-              /* Calculate the transfer arrays */
-              hue_saturation_calculate_transfers (&hs);
-
-              pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
-                                 x, y, width, height, FALSE);
-              pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
-                                 x, y, width, height, TRUE);
-
-              pixel_regions_process_parallel ((PixelProcessorFunc) hue_saturation,
-                                              &hs, 2, &srcPR, &destPR);
-
-              gimp_drawable_merge_shadow (drawable, TRUE, _("Hue-Saturation"));
-              gimp_drawable_update (drawable, x, y, width, height);
-            }
-        }
+        gimp_drawable_hue_saturation (drawable, progress,
+                                      hue_range, hue_offset, saturation, lightness);
     }
 
   return gimp_procedure_get_return_values (procedure, success);
@@ -881,56 +586,14 @@
 
   if (success)
     {
-      if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
+      if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) ||
           gimp_drawable_is_indexed (drawable) ||
           (low_threshold > high_threshold))
         success = FALSE;
 
       if (success)
-        {
-      if (gimp_use_gegl (gimp))
-        {
-          GeglNode *node = g_object_new (GEGL_TYPE_NODE,
-                                         "operation", "gimp-threshold",
-                                         NULL);
-
-          gegl_node_set (node,
-                         "low",  low_threshold  / 255.0,
-                         "high", high_threshold / 255.0,
-                         NULL);
-
-          gimp_drawable_apply_operation (drawable, node, TRUE,
-                                         progress, _("Threshold"));
-
-          g_object_unref (node);
-        }
-      else
-        {
-          gint x, y, width, height;
-
-          /* The application should occur only within selection bounds */
-          if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
-            {
-              Threshold   tr;
-              PixelRegion srcPR, destPR;
-
-              tr.color          = gimp_drawable_is_rgb (drawable);
-              tr.low_threshold  = low_threshold;
-              tr.high_threshold = high_threshold;
-
-              pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
-                                 x, y, width, height, FALSE);
-              pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
-                                 x, y, width, height, TRUE);
-
-              pixel_regions_process_parallel ((PixelProcessorFunc) threshold,
-                                              &tr, 2, &srcPR, &destPR);
-
-              gimp_drawable_merge_shadow (drawable, TRUE, _("Threshold"));
-              gimp_drawable_update (drawable, x, y, width, height);
-            }
-        }
-        }
+        gimp_drawable_threshold (drawable, progress,
+                                 low_threshold, high_threshold);
     }
 
   return gimp_procedure_get_return_values (procedure, success);

Modified: branches/weskaggs/app/pdb/drawable_cmds.c
==============================================================================
--- branches/weskaggs/app/pdb/drawable_cmds.c	(original)
+++ branches/weskaggs/app/pdb/drawable_cmds.c	Wed Feb  6 17:19:00 2008
@@ -41,6 +41,7 @@
 #include "core/gimplayer.h"
 #include "core/gimplayermask.h"
 #include "gimp-intl.h"
+#include "gimppdb-utils.h"
 #include "plug-in/gimpplugin.h"
 #include "plug-in/gimppluginmanager.h"
 
@@ -814,7 +815,7 @@
 
   if (success)
     {
-      if (gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         {
           const gchar *undo_desc = _("Plug-In");
 
@@ -1016,7 +1017,7 @@
 
   if (success)
     {
-      if (gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         gimp_drawable_offset (drawable, context, wrap_around, fill_type,
                               offset_x, offset_y);
       else
@@ -1205,7 +1206,7 @@
 
   if (success)
     {
-      if (gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         gimp_drawable_foreground_extract (drawable, mode, mask, progress);
       else
         success = FALSE;

Modified: branches/weskaggs/app/pdb/drawable_transform_cmds.c
==============================================================================
--- branches/weskaggs/app/pdb/drawable_transform_cmds.c	(original)
+++ branches/weskaggs/app/pdb/drawable_transform_cmds.c	Wed Feb  6 17:19:00 2008
@@ -38,6 +38,7 @@
 #include "core/gimpimage.h"
 #include "core/gimpprogress.h"
 #include "gimp-intl.h"
+#include "gimppdb-utils.h"
 
 #include "internal_procs.h"
 
@@ -68,7 +69,7 @@
     {
       gint x, y, width, height;
 
-      success = gimp_item_is_attached (GIMP_ITEM (drawable));
+      success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error);
 
       if (success &&
           gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@@ -124,7 +125,7 @@
     {
       gint x, y, width, height;
 
-      success = gimp_item_is_attached (GIMP_ITEM (drawable));
+      success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error);
 
       if (success &&
           gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@@ -194,7 +195,7 @@
     {
       gint x, y, width, height;
 
-      success = gimp_item_is_attached (GIMP_ITEM (drawable));
+      success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error);
 
       if (success &&
           gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@@ -282,7 +283,7 @@
     {
       gint x, y, width, height;
 
-      success = gimp_item_is_attached (GIMP_ITEM (drawable));
+      success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error);
 
       if (success &&
           gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@@ -362,7 +363,7 @@
     {
       gint x, y, width, height;
 
-      success = gimp_item_is_attached (GIMP_ITEM (drawable));
+      success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error);
 
       if (success &&
           gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@@ -436,7 +437,7 @@
     {
       gint x, y, width, height;
 
-      success = gimp_item_is_attached (GIMP_ITEM (drawable));
+      success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error);
 
       if (success &&
           gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@@ -492,7 +493,7 @@
     {
       gint x, y, width, height;
 
-      success = gimp_item_is_attached (GIMP_ITEM (drawable));
+      success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error);
 
       if (success &&
           gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@@ -566,7 +567,7 @@
     {
       gint x, y, width, height;
 
-      success = gimp_item_is_attached (GIMP_ITEM (drawable));
+      success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error);
 
       if (success &&
           gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@@ -650,7 +651,7 @@
     {
       gint x, y, width, height;
 
-      success = (gimp_item_is_attached (GIMP_ITEM (drawable)) && x0 < x1 && y0 < y1);
+      success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) && x0 < x1 && y0 < y1);
 
       if (success &&
           gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@@ -721,7 +722,7 @@
     {
       gint x, y, width, height;
 
-      success = (gimp_item_is_attached (GIMP_ITEM (drawable)) && x0 < x1 && y0 < y1);
+      success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) && x0 < x1 && y0 < y1);
 
       if (success &&
           gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@@ -798,7 +799,7 @@
     {
       gint x, y, width, height;
 
-      success = gimp_item_is_attached (GIMP_ITEM (drawable));
+      success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error);
 
       if (success &&
           gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@@ -865,7 +866,7 @@
     {
       gint x, y, width, height;
 
-      success = gimp_item_is_attached (GIMP_ITEM (drawable));
+      success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error);
 
       if (success &&
           gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@@ -952,7 +953,7 @@
     {
       gint x, y, width, height;
 
-      success = gimp_item_is_attached (GIMP_ITEM (drawable));
+      success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error);
 
       if (success &&
           gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@@ -1030,7 +1031,7 @@
     {
       gint x, y, width, height;
 
-      success = gimp_item_is_attached (GIMP_ITEM (drawable));
+      success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error);
 
       if (success &&
           gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@@ -1122,7 +1123,7 @@
     {
       gint x, y, width, height;
 
-      success = gimp_item_is_attached (GIMP_ITEM (drawable));
+      success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error);
 
       if (success &&
           gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@@ -1208,7 +1209,7 @@
     {
       gint x, y, width, height;
 
-      success = gimp_item_is_attached (GIMP_ITEM (drawable));
+      success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error);
 
       if (success &&
           gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))

Modified: branches/weskaggs/app/pdb/edit_cmds.c
==============================================================================
--- branches/weskaggs/app/pdb/edit_cmds.c	(original)
+++ branches/weskaggs/app/pdb/edit_cmds.c	Wed Feb  6 17:19:00 2008
@@ -63,7 +63,7 @@
 
   if (success)
     {
-      if (gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         {
           GimpImage *image    = gimp_item_get_image (GIMP_ITEM (drawable));
           GError    *my_error = NULL;
@@ -106,7 +106,7 @@
 
   if (success)
     {
-      if (gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         {
           GimpImage *image    = gimp_item_get_image (GIMP_ITEM (drawable));
           GError    *my_error = NULL;
@@ -188,7 +188,8 @@
 
   if (success)
     {
-      if (gimp->global_buffer && gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (gimp->global_buffer &&
+          gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         {
           floating_sel = gimp_edit_paste (gimp_item_get_image (GIMP_ITEM (drawable)),
                                           drawable, gimp->global_buffer,
@@ -260,7 +261,7 @@
 
   if (success)
     {
-      if (gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         {
           GimpImage *image    = gimp_item_get_image (GIMP_ITEM (drawable));
           GError    *my_error = NULL;
@@ -310,7 +311,7 @@
 
   if (success)
     {
-      if (gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         {
           GimpImage *image    = gimp_item_get_image (GIMP_ITEM (drawable));
           GError    *my_error = NULL;
@@ -408,7 +409,7 @@
     {
       GimpBuffer *buffer = gimp_pdb_get_buffer (gimp, buffer_name, error);
 
-      if (buffer && gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (buffer && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         {
           floating_sel = gimp_edit_paste (gimp_item_get_image (GIMP_ITEM (drawable)),
                                           drawable, buffer,
@@ -481,7 +482,7 @@
 
   if (success)
     {
-      if (gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         {
           GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
 
@@ -511,7 +512,7 @@
 
   if (success)
     {
-      if (gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         {
           GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
 
@@ -554,7 +555,7 @@
 
   if (success)
     {
-      if (gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         {
           GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
           gboolean   do_seed_fill;
@@ -609,7 +610,7 @@
 
   if (success)
     {
-      if (gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         {
           GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
           gboolean   do_seed_fill;
@@ -676,7 +677,7 @@
 
   if (success)
     {
-      success = gimp_item_is_attached (GIMP_ITEM (drawable));
+      success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error);
 
       if (success && supersample)
         {
@@ -727,7 +728,7 @@
 
   if (success)
     {
-      if (gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         {
           GimpImage      *image = gimp_item_get_image (GIMP_ITEM (drawable));
           GimpStrokeDesc *desc  = gimp_stroke_desc_new (gimp, context);
@@ -764,7 +765,7 @@
 
   if (success)
     {
-      if (gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         {
           GimpStrokeDesc *desc  = gimp_stroke_desc_new (gimp, context);
 

Modified: branches/weskaggs/app/pdb/floating_sel_cmds.c
==============================================================================
--- branches/weskaggs/app/pdb/floating_sel_cmds.c	(original)
+++ branches/weskaggs/app/pdb/floating_sel_cmds.c	Wed Feb  6 17:19:00 2008
@@ -32,6 +32,7 @@
 #include "core/gimplayer-floating-sel.h"
 #include "core/gimplayer.h"
 #include "gimp-intl.h"
+#include "gimppdb-utils.h"
 #include "gimppdberror.h"
 
 #include "internal_procs.h"
@@ -147,7 +148,7 @@
 
   if (success)
     {
-      if (gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         floating_sel_attach (layer, drawable);
       else
         success = FALSE;

Modified: branches/weskaggs/app/pdb/gimppdb-utils.c
==============================================================================
--- branches/weskaggs/app/pdb/gimppdb-utils.c	(original)
+++ branches/weskaggs/app/pdb/gimppdb-utils.c	Wed Feb  6 17:19:00 2008
@@ -28,6 +28,7 @@
 #include "core/gimpbrushgenerated.h"
 #include "core/gimpcontainer.h"
 #include "core/gimpdatafactory.h"
+#include "core/gimpitem.h"
 
 #include "gimppdb-utils.h"
 #include "gimppdberror.h"
@@ -284,3 +285,24 @@
 
   return paint_info;
 }
+
+gboolean
+gimp_pdb_item_is_attached (GimpItem  *item,
+                           GError   **error)
+{
+  g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
+  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+  if (! gimp_item_is_attached (item))
+    {
+      g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_CALLING_ERROR,
+                   _("Item '%s' (%d) cannot be used because it has not "
+                     "been added to an image"),
+                   gimp_object_get_name (GIMP_OBJECT (item)),
+                   gimp_item_get_ID (item));
+
+      return FALSE;
+    }
+
+  return TRUE;
+}

Modified: branches/weskaggs/app/pdb/gimppdb-utils.h
==============================================================================
--- branches/weskaggs/app/pdb/gimppdb-utils.h	(original)
+++ branches/weskaggs/app/pdb/gimppdb-utils.h	Wed Feb  6 17:19:00 2008
@@ -49,5 +49,8 @@
                                               const gchar  *name,
                                               GError      **error);
 
+gboolean        gimp_pdb_item_is_attached    (GimpItem     *item,
+                                              GError      **error);
+
 
 #endif /* __GIMP_PDB_UTILS_H__ */

Modified: branches/weskaggs/app/pdb/layer_cmds.c
==============================================================================
--- branches/weskaggs/app/pdb/layer_cmds.c	(original)
+++ branches/weskaggs/app/pdb/layer_cmds.c	Wed Feb  6 17:19:00 2008
@@ -39,6 +39,7 @@
 #include "core/gimplayer.h"
 #include "core/gimplayermask.h"
 #include "gimp-intl.h"
+#include "gimppdb-utils.h"
 
 #include "internal_procs.h"
 
@@ -236,7 +237,7 @@
 
   if (success)
     {
-      if (gimp_item_is_attached (GIMP_ITEM (layer)))
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), error))
         gimp_item_scale_by_origin (GIMP_ITEM (layer), new_width, new_height,
                                    gimp->config->interpolation_type, NULL,
                                    local_origin);
@@ -270,7 +271,7 @@
 
   if (success)
     {
-      if (gimp_item_is_attached (GIMP_ITEM (layer)))
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), error))
         gimp_item_resize (GIMP_ITEM (layer), context,
                           new_width, new_height, offx, offy);
       else
@@ -295,7 +296,7 @@
 
   if (success)
     {
-      if (gimp_item_is_attached (GIMP_ITEM (layer)))
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), error))
         gimp_layer_resize_to_image (layer, context);
       else
         success = FALSE;
@@ -496,7 +497,7 @@
 
   if (success)
     {
-      if (gimp_item_is_attached (GIMP_ITEM (layer)))
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), error))
         gimp_layer_add_mask (layer, mask, TRUE);
       else
         success = FALSE;
@@ -522,7 +523,7 @@
 
   if (success)
     {
-      if (gimp_item_is_attached (GIMP_ITEM (layer)))
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), error))
         gimp_layer_apply_mask (layer, mode, TRUE);
       else
         success = FALSE;

Modified: branches/weskaggs/app/pdb/paint_tools_cmds.c
==============================================================================
--- branches/weskaggs/app/pdb/paint_tools_cmds.c	(original)
+++ branches/weskaggs/app/pdb/paint_tools_cmds.c	Wed Feb  6 17:19:00 2008
@@ -119,7 +119,7 @@
     {
       GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-airbrush", error);
 
-      if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         {
           GimpPaintOptions *options = gimp_paint_options_new (info);
 
@@ -160,7 +160,7 @@
     {
       GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-airbrush", error);
 
-      if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         {
           GimpPaintOptions *options = gimp_paint_options_new (info);
 
@@ -205,7 +205,7 @@
     {
       GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-clone", error);
 
-      if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         {
           GimpPaintOptions *options = gimp_paint_options_new (info);
 
@@ -249,7 +249,7 @@
     {
       GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-clone", error);
 
-      if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         {
           GimpPaintOptions *options = gimp_paint_options_new (info);
 
@@ -290,7 +290,7 @@
     {
       GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-convolve", error);
 
-      if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         {
           GimpPaintOptions *options = gimp_paint_options_new (info);
 
@@ -332,7 +332,7 @@
     {
       GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-convolve", error);
 
-      if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         {
           GimpPaintOptions *options = gimp_paint_options_new (info);
 
@@ -375,7 +375,7 @@
     {
       GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-dodge-burn", error);
 
-      if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         {
           GimpPaintOptions *options = gimp_paint_options_new (info);
 
@@ -418,7 +418,7 @@
     {
       GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-dodge-burn", error);
 
-      if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         {
           GimpPaintOptions *options = gimp_paint_options_new (info);
 
@@ -459,7 +459,7 @@
     {
       GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-eraser", error);
 
-      if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         {
           GimpPaintOptions *options = gimp_paint_options_new (info);
 
@@ -501,7 +501,7 @@
     {
       GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-eraser", error);
 
-      if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         {
           GimpPaintOptions *options = gimp_paint_options_new (info);
 
@@ -544,7 +544,7 @@
     {
       GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-heal", error);
 
-      if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         {
           GimpPaintOptions *options = gimp_paint_options_new (info);
 
@@ -584,7 +584,7 @@
     {
       GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-heal", error);
 
-      if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         {
           GimpPaintOptions *options = gimp_paint_options_new (info);
 
@@ -627,7 +627,7 @@
     {
       GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-paintbrush", error);
 
-      if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         {
           GimpPaintOptions *options = gimp_paint_options_new (info);
 
@@ -672,7 +672,7 @@
     {
       GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-paintbrush", error);
 
-      if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         {
           GimpPaintOptions *options = gimp_paint_options_new (info);
 
@@ -709,7 +709,7 @@
     {
       GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-pencil", error);
 
-      if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         {
           GimpPaintOptions *options = gimp_paint_options_new (info);
 
@@ -748,7 +748,7 @@
     {
       GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-smudge", error);
 
-      if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         {
           GimpPaintOptions *options = gimp_paint_options_new (info);
 
@@ -789,7 +789,7 @@
     {
       GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-smudge", error);
 
-      if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         {
           GimpPaintOptions *options = gimp_paint_options_new (info);
 

Modified: branches/weskaggs/app/pdb/selection_cmds.c
==============================================================================
--- branches/weskaggs/app/pdb/selection_cmds.c	(original)
+++ branches/weskaggs/app/pdb/selection_cmds.c	Wed Feb  6 17:19:00 2008
@@ -36,6 +36,7 @@
 #include "core/gimppickable.h"
 #include "core/gimpselection.h"
 #include "gimp-intl.h"
+#include "gimppdb-utils.h"
 
 #include "internal_procs.h"
 
@@ -186,7 +187,7 @@
 
   if (success)
     {
-      if (gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         {
           GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
 

Modified: branches/weskaggs/app/pdb/text_tool_cmds.c
==============================================================================
--- branches/weskaggs/app/pdb/text_tool_cmds.c	(original)
+++ branches/weskaggs/app/pdb/text_tool_cmds.c	Wed Feb  6 17:19:00 2008
@@ -33,6 +33,7 @@
 #include "core/gimpdrawable.h"
 #include "core/gimpimage.h"
 #include "core/gimplayer.h"
+#include "gimppdb-utils.h"
 #include "text/gimptext-compat.h"
 
 #include "internal_procs.h"
@@ -73,7 +74,7 @@
 
   if (success)
     {
-      if (drawable && ! gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (drawable && ! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         success = FALSE;
 
       if (success)
@@ -193,7 +194,7 @@
 
   if (success)
     {
-      if (drawable && ! gimp_item_is_attached (GIMP_ITEM (drawable)))
+      if (drawable && ! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         success = FALSE;
 
       if (success)

Modified: branches/weskaggs/app/pdb/transform_tools_cmds.c
==============================================================================
--- branches/weskaggs/app/pdb/transform_tools_cmds.c	(original)
+++ branches/weskaggs/app/pdb/transform_tools_cmds.c	Wed Feb  6 17:19:00 2008
@@ -38,6 +38,7 @@
 #include "core/gimpimage.h"
 #include "core/gimpprogress.h"
 #include "gimp-intl.h"
+#include "gimppdb-utils.h"
 
 #include "internal_procs.h"
 
@@ -62,7 +63,7 @@
     {
       gint x, y, width, height;
 
-      success = gimp_item_is_attached (GIMP_ITEM (drawable));
+      success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error);
 
       if (success &&
           gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@@ -116,7 +117,7 @@
     {
       gint x, y, width, height;
 
-      success = gimp_item_is_attached (GIMP_ITEM (drawable));
+      success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error);
 
       if (success &&
           gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@@ -185,7 +186,7 @@
     {
       gint x, y, width, height;
 
-      success = gimp_item_is_attached (GIMP_ITEM (drawable));
+      success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error);
 
       if (success &&
           gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@@ -259,7 +260,7 @@
     {
       gint x, y, width, height;
 
-      success = (gimp_item_is_attached (GIMP_ITEM (drawable)) &&
+      success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) &&
                  x0 < x1 && y0 < y1);
 
       if (success &&
@@ -330,7 +331,7 @@
     {
       gint x, y, width, height;
 
-      success = gimp_item_is_attached (GIMP_ITEM (drawable));
+      success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error);
 
       if (success &&
           gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@@ -410,7 +411,7 @@
     {
       gint x, y, width, height;
 
-      success = gimp_item_is_attached (GIMP_ITEM (drawable));
+      success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error);
 
       if (success &&
           gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))

Modified: branches/weskaggs/app/tools/Makefile.am
==============================================================================
--- branches/weskaggs/app/tools/Makefile.am	(original)
+++ branches/weskaggs/app/tools/Makefile.am	Wed Feb  6 17:19:00 2008
@@ -74,6 +74,8 @@
 	gimpforegroundselecttoolundo.h	\
 	gimpfuzzyselecttool.c		\
 	gimpfuzzyselecttool.h		\
+	gimpgegltool.c			\
+	gimpgegltool.h			\
 	gimphealtool.c			\
 	gimphealtool.h			\
 	gimphistogramoptions.c		\

Modified: branches/weskaggs/app/tools/gimp-tools.c
==============================================================================
--- branches/weskaggs/app/tools/gimp-tools.c	(original)
+++ branches/weskaggs/app/tools/gimp-tools.c	Wed Feb  6 17:19:00 2008
@@ -56,6 +56,7 @@
 #include "gimpfreeselecttool.h"
 #include "gimpforegroundselecttool.h"
 #include "gimpfuzzyselecttool.h"
+#include "gimpgegltool.h"
 #include "gimphealtool.h"
 #include "gimphuesaturationtool.h"
 #include "gimpinktool.h"
@@ -115,6 +116,7 @@
     /*  register tools in reverse order  */
 
     /*  color tools  */
+    gimp_gegl_tool_register,
     gimp_posterize_tool_register,
     gimp_curves_tool_register,
     gimp_levels_tool_register,

Modified: branches/weskaggs/app/tools/gimpcurvestool.c
==============================================================================
--- branches/weskaggs/app/tools/gimpcurvestool.c	(original)
+++ branches/weskaggs/app/tools/gimpcurvestool.c	Wed Feb  6 17:19:00 2008
@@ -192,12 +192,6 @@
 
   gimp_lut_free (tool->lut);
 
-  if (tool->hist)
-    {
-      gimp_histogram_free (tool->hist);
-      tool->hist = NULL;
-    }
-
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
@@ -208,6 +202,7 @@
 {
   GimpCurvesTool *c_tool   = GIMP_CURVES_TOOL (tool);
   GimpDrawable   *drawable = gimp_image_get_active_drawable (display->image);
+  GimpHistogram  *histogram;
 
   if (! drawable)
     return FALSE;
@@ -221,12 +216,6 @@
 
   gimp_config_reset (GIMP_CONFIG (c_tool->config));
 
-  if (! c_tool->hist)
-    c_tool->hist = gimp_histogram_new ();
-
-  c_tool->color = gimp_drawable_is_rgb (drawable);
-  c_tool->alpha = gimp_drawable_has_alpha (drawable);
-
   GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error);
 
   /*  always pick colors  */
@@ -234,16 +223,13 @@
                           GIMP_COLOR_TOOL_GET_OPTIONS (tool));
 
   gimp_int_combo_box_set_sensitivity (GIMP_INT_COMBO_BOX (c_tool->channel_menu),
-                                      curves_menu_sensitivity, c_tool, NULL);
+                                      curves_menu_sensitivity, drawable, NULL);
 
-  gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (c_tool->channel_menu),
-                                 c_tool->config->channel);
-
-  gimp_drawable_calculate_histogram (drawable, c_tool->hist);
+  histogram = gimp_histogram_new ();
+  gimp_drawable_calculate_histogram (drawable, histogram);
   gimp_histogram_view_set_background (GIMP_HISTOGRAM_VIEW (c_tool->graph),
-                                      c_tool->hist);
-  gimp_curve_view_set_curve (GIMP_CURVE_VIEW (c_tool->graph),
-                             c_tool->config->curve[c_tool->config->channel]);
+                                      histogram);
+  gimp_histogram_unref (histogram);
 
   return TRUE;
 }
@@ -406,15 +392,17 @@
 static void
 gimp_curves_tool_map (GimpImageMapTool *image_map_tool)
 {
-  GimpCurvesTool *tool = GIMP_CURVES_TOOL (image_map_tool);
+  GimpCurvesTool *tool     = GIMP_CURVES_TOOL (image_map_tool);
+  GimpDrawable   *drawable = image_map_tool->drawable;
   Curves          curves;
 
-  gimp_curves_config_to_cruft (tool->config, &curves, tool->color);
+  gimp_curves_config_to_cruft (tool->config, &curves,
+                               gimp_drawable_is_rgb (drawable));
 
   gimp_lut_setup (tool->lut,
                   (GimpLutFunc) curves_lut_func,
                   &curves,
-                  gimp_drawable_bytes (image_map_tool->drawable));
+                  gimp_drawable_bytes (drawable));
 }
 
 
@@ -425,25 +413,25 @@
 static void
 gimp_curves_tool_dialog (GimpImageMapTool *image_map_tool)
 {
-  GimpCurvesTool  *tool         = GIMP_CURVES_TOOL (image_map_tool);
-  GimpToolOptions *tool_options = GIMP_TOOL_GET_OPTIONS (image_map_tool);
-  GtkListStore    *store;
-  GtkWidget       *vbox;
-  GtkWidget       *vbox2;
-  GtkWidget       *hbox;
-  GtkWidget       *hbox2;
-  GtkWidget       *label;
-  GtkWidget       *bbox;
-  GtkWidget       *frame;
-  GtkWidget       *menu;
-  GtkWidget       *table;
-  GtkWidget       *button;
-  GtkWidget       *bar;
-  gint             padding;
+  GimpCurvesTool   *tool         = GIMP_CURVES_TOOL (image_map_tool);
+  GimpToolOptions  *tool_options = GIMP_TOOL_GET_OPTIONS (image_map_tool);
+  GimpCurvesConfig *config       = tool->config;
+  GtkListStore     *store;
+  GtkWidget        *vbox;
+  GtkWidget        *vbox2;
+  GtkWidget        *hbox;
+  GtkWidget        *hbox2;
+  GtkWidget        *label;
+  GtkWidget        *bbox;
+  GtkWidget        *frame;
+  GtkWidget        *table;
+  GtkWidget        *button;
+  GtkWidget        *bar;
+  gint              padding;
 
   vbox = image_map_tool->main_vbox;
 
-  /*  The option menu for selecting channels  */
+  /*  The combo box for selecting channels  */
   hbox = gtk_hbox_new (FALSE, 6);
   gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
   gtk_widget_show (hbox);
@@ -455,20 +443,22 @@
   store = gimp_enum_store_new_with_range (GIMP_TYPE_HISTOGRAM_CHANNEL,
                                           GIMP_HISTOGRAM_VALUE,
                                           GIMP_HISTOGRAM_ALPHA);
-  menu = gimp_enum_combo_box_new_with_model (GIMP_ENUM_STORE (store));
+  tool->channel_menu =
+    gimp_enum_combo_box_new_with_model (GIMP_ENUM_STORE (store));
   g_object_unref (store);
 
-  g_signal_connect (menu, "changed",
-                    G_CALLBACK (curves_channel_callback),
-                    tool);
-  gimp_enum_combo_box_set_stock_prefix (GIMP_ENUM_COMBO_BOX (menu),
+  gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (tool->channel_menu),
+                                 config->channel);
+  gimp_enum_combo_box_set_stock_prefix (GIMP_ENUM_COMBO_BOX (tool->channel_menu),
                                         "gimp-channel");
-  gtk_box_pack_start (GTK_BOX (hbox), menu, FALSE, FALSE, 0);
-  gtk_widget_show (menu);
+  gtk_box_pack_start (GTK_BOX (hbox), tool->channel_menu, FALSE, FALSE, 0);
+  gtk_widget_show (tool->channel_menu);
 
-  tool->channel_menu = menu;
+  g_signal_connect (tool->channel_menu, "changed",
+                    G_CALLBACK (curves_channel_callback),
+                    tool);
 
-  gtk_label_set_mnemonic_widget (GTK_LABEL (label), menu);
+  gtk_label_set_mnemonic_widget (GTK_LABEL (label), tool->channel_menu);
 
   button = gtk_button_new_with_mnemonic (_("R_eset Channel"));
   gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
@@ -478,11 +468,12 @@
                     G_CALLBACK (curves_channel_reset_callback),
                     tool);
 
-  menu = gimp_prop_enum_stock_box_new (G_OBJECT (tool_options),
-                                       "histogram-scale", "gimp-histogram",
-                                       0, 0);
-  gtk_box_pack_end (GTK_BOX (hbox), menu, FALSE, FALSE, 0);
-  gtk_widget_show (menu);
+  /*  The histogram scale radio buttons  */
+  hbox2 = gimp_prop_enum_stock_box_new (G_OBJECT (tool_options),
+                                        "histogram-scale", "gimp-histogram",
+                                        0, 0);
+  gtk_box_pack_end (GTK_BOX (hbox), hbox2, FALSE, FALSE, 0);
+  gtk_widget_show (hbox2);
 
   /*  The table for the color bars and the graph  */
   table = gtk_table_new (2, 2, FALSE);
@@ -521,6 +512,8 @@
                 "border-width", RADIUS,
                 "subdivisions", 1,
                 NULL);
+  gimp_curve_view_set_curve (GIMP_CURVE_VIEW (tool->graph),
+                             config->curve[config->channel]);
   gtk_container_add (GTK_CONTAINER (frame), tool->graph);
   gtk_widget_show (tool->graph);
 
@@ -636,21 +629,25 @@
                                 GimpCurvesTool *tool)
 {
   GimpCurvesConfig *config = GIMP_CURVES_CONFIG (object);
+  GimpCurve        *curve  = config->curve[config->channel];
 
   if (! tool->xrange)
     return;
 
   if (! strcmp (pspec->name, "channel"))
     {
+      gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (tool->channel_menu),
+                                     config->channel);
+
       switch (config->channel)
         {
         case GIMP_HISTOGRAM_VALUE:
         case GIMP_HISTOGRAM_ALPHA:
         case GIMP_HISTOGRAM_RGB:
           gimp_color_bar_set_buffers (GIMP_COLOR_BAR (tool->xrange),
-                                      config->curve[config->channel]->curve,
-                                      config->curve[config->channel]->curve,
-                                      config->curve[config->channel]->curve);
+                                      curve->curve,
+                                      curve->curve,
+                                      curve->curve);
           break;
 
         case GIMP_HISTOGRAM_RED:
@@ -671,13 +668,15 @@
       gimp_color_bar_set_channel (GIMP_COLOR_BAR (tool->yrange),
                                   config->channel);
 
-      gimp_curve_view_set_curve (GIMP_CURVE_VIEW (tool->graph),
-                                 config->curve[config->channel]);
+      gimp_curve_view_set_curve (GIMP_CURVE_VIEW (tool->graph), curve);
+
+      gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (tool->curve_type),
+                                       curve->curve_type);
     }
   else if (! strcmp (pspec->name, "curve"))
     {
       gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (tool->curve_type),
-                                       config->curve[config->channel]->curve_type);
+                                       curve->curve_type);
     }
 
   gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (tool));
@@ -710,8 +709,8 @@
 curves_menu_sensitivity (gint      value,
                          gpointer  data)
 {
-  GimpCurvesTool       *tool    = GIMP_CURVES_TOOL (data);
-  GimpHistogramChannel  channel = value;
+  GimpDrawable         *drawable = GIMP_DRAWABLE (data);
+  GimpHistogramChannel  channel  = value;
 
   switch (channel)
     {
@@ -721,10 +720,10 @@
     case GIMP_HISTOGRAM_RED:
     case GIMP_HISTOGRAM_GREEN:
     case GIMP_HISTOGRAM_BLUE:
-      return tool->color;
+      return gimp_drawable_is_rgb (drawable);
 
     case GIMP_HISTOGRAM_ALPHA:
-      return tool->alpha;
+      return gimp_drawable_has_alpha (drawable);
 
     case GIMP_HISTOGRAM_RGB:
       return FALSE;
@@ -737,13 +736,16 @@
 curves_curve_type_callback (GtkWidget      *widget,
                             GimpCurvesTool *tool)
 {
-  GimpCurvesConfig *config = tool->config;
-  GimpCurveType     curve_type;
+  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
+    {
+      GimpCurvesConfig *config = tool->config;
+      GimpCurveType     curve_type;
 
-  gimp_radio_button_update (widget, &curve_type);
+      gimp_radio_button_update (widget, &curve_type);
 
-  if (config->curve[config->channel]->curve_type != curve_type)
-    {
-      gimp_curve_set_curve_type (config->curve[config->channel], curve_type);
+      if (config->curve[config->channel]->curve_type != curve_type)
+        {
+          gimp_curve_set_curve_type (config->curve[config->channel], curve_type);
+        }
     }
 }

Modified: branches/weskaggs/app/tools/gimpcurvestool.h
==============================================================================
--- branches/weskaggs/app/tools/gimpcurvestool.h	(original)
+++ branches/weskaggs/app/tools/gimpcurvestool.h	Wed Feb  6 17:19:00 2008
@@ -41,13 +41,8 @@
   GimpLut              *lut;
 
   /* dialog */
-  gboolean              color;
-  gboolean              alpha;
-
   gint                  col_value[5];
 
-  GimpHistogram        *hist;
-
   GtkWidget            *channel_menu;
   GtkWidget            *xrange;
   GtkWidget            *yrange;

Modified: branches/weskaggs/app/tools/gimpimagemaptool.c
==============================================================================
--- branches/weskaggs/app/tools/gimpimagemaptool.c	(original)
+++ branches/weskaggs/app/tools/gimpimagemaptool.c	Wed Feb  6 17:19:00 2008
@@ -36,10 +36,13 @@
 #include "core/gimpimage.h"
 #include "core/gimpimage-pick-color.h"
 #include "core/gimpimagemap.h"
+#include "core/gimplist.h"
 #include "core/gimppickable.h"
 #include "core/gimpprojection.h"
 #include "core/gimptoolinfo.h"
 
+#include "widgets/gimpcontainercombobox.h"
+#include "widgets/gimpcontainerview.h"
 #include "widgets/gimpdialogfactory.h"
 #include "widgets/gimptooldialog.h"
 #include "widgets/gimpwidgets-utils.h"
@@ -57,6 +60,11 @@
 
 /*  local function prototypes  */
 
+static void      gimp_image_map_tool_class_init  (GimpImageMapToolClass *klass);
+static void      gimp_image_map_tool_base_init   (GimpImageMapToolClass *klass);
+
+static void      gimp_image_map_tool_init        (GimpImageMapTool *im_tool);
+
 static GObject * gimp_image_map_tool_constructor (GType             type,
                                                   guint             n_params,
                                                   GObjectConstructParam *params);
@@ -82,8 +90,6 @@
 static void      gimp_image_map_tool_dialog      (GimpImageMapTool *im_tool);
 static void      gimp_image_map_tool_reset       (GimpImageMapTool *im_tool);
 
-static void      gimp_image_map_tool_create_map  (GimpImageMapTool *im_tool);
-
 static void      gimp_image_map_tool_flush       (GimpImageMap     *image_map,
                                                   GimpImageMapTool *im_tool);
 
@@ -91,31 +97,63 @@
                                                   gint              response_id,
                                                   GimpImageMapTool *im_tool);
 
-static void      gimp_image_map_tool_load_clicked     (GtkWidget        *widget,
-                                                       GimpImageMapTool *tool);
-static void      gimp_image_map_tool_load_ext_clicked (GtkWidget        *widget,
-                                                       GdkModifierType   state,
-                                                       GimpImageMapTool *tool);
-static void      gimp_image_map_tool_save_clicked     (GtkWidget        *widget,
-                                                       GimpImageMapTool *tool);
-static void      gimp_image_map_tool_save_ext_clicked (GtkWidget        *widget,
-                                                       GdkModifierType   state,
-                                                       GimpImageMapTool *tool);
-
-static void      gimp_image_map_tool_settings_dialog  (GimpImageMapTool *im_tool,
-                                                       const gchar      *title,
-                                                       gboolean          save);
-static void      gimp_image_map_tool_notify_preview   (GObject          *config,
-                                                       GParamSpec       *pspec,
-                                                       GimpImageMapTool *im_tool);
-static void      gimp_image_map_tool_gegl_notify      (GObject          *config,
-                                                       const GParamSpec *pspec,
-                                                       GimpImageMapTool *im_tool);
-
-
-G_DEFINE_TYPE (GimpImageMapTool, gimp_image_map_tool, GIMP_TYPE_COLOR_TOOL)
+static void      gimp_image_map_tool_recent_selected  (GimpContainerView *view,
+                                                       GimpViewable      *object,
+                                                       gpointer           insert_data,
+                                                       GimpImageMapTool  *tool);
+
+static void      gimp_image_map_tool_load_clicked     (GtkWidget         *widget,
+                                                       GimpImageMapTool  *tool);
+static void      gimp_image_map_tool_load_ext_clicked (GtkWidget         *widget,
+                                                       GdkModifierType    state,
+                                                       GimpImageMapTool  *tool);
+static void      gimp_image_map_tool_save_clicked     (GtkWidget         *widget,
+                                                       GimpImageMapTool  *tool);
+static void      gimp_image_map_tool_save_ext_clicked (GtkWidget         *widget,
+                                                       GdkModifierType    state,
+                                                       GimpImageMapTool  *tool);
+
+static void      gimp_image_map_tool_settings_dialog  (GimpImageMapTool  *im_tool,
+                                                       const gchar       *title,
+                                                       gboolean           save);
+static void      gimp_image_map_tool_notify_preview   (GObject           *config,
+                                                       GParamSpec        *pspec,
+                                                       GimpImageMapTool  *im_tool);
+static void      gimp_image_map_tool_gegl_notify      (GObject           *config,
+                                                       const GParamSpec  *pspec,
+                                                       GimpImageMapTool  *im_tool);
+
+
+static GimpColorToolClass *parent_class = NULL;
+
+
+GType
+gimp_image_map_tool_get_type (void)
+{
+  static GType type = 0;
+
+  if (! type)
+    {
+      const GTypeInfo info =
+      {
+        sizeof (GimpImageMapToolClass),
+        (GBaseInitFunc) gimp_image_map_tool_base_init,
+        (GBaseFinalizeFunc) NULL,
+        (GClassInitFunc) gimp_image_map_tool_class_init,
+        NULL,           /* class_finalize */
+        NULL,           /* class_data */
+        sizeof (GimpImageMapTool),
+        0,              /* n_preallocs */
+        (GInstanceInitFunc) gimp_image_map_tool_init,
+      };
+
+      type = g_type_register_static (GIMP_TYPE_COLOR_TOOL,
+                                     "GimpImageMapTool",
+                                     &info, 0);
+    }
 
-#define parent_class gimp_image_map_tool_parent_class
+  return type;
+}
 
 
 static void
@@ -125,6 +163,8 @@
   GimpToolClass      *tool_class       = GIMP_TOOL_CLASS (klass);
   GimpColorToolClass *color_tool_class = GIMP_COLOR_TOOL_CLASS (klass);
 
+  parent_class = g_type_class_peek_parent (klass);
+
   object_class->constructor = gimp_image_map_tool_constructor;
   object_class->finalize    = gimp_image_map_tool_finalize;
 
@@ -150,6 +190,12 @@
 }
 
 static void
+gimp_image_map_tool_base_init (GimpImageMapToolClass *klass)
+{
+  klass->recent_settings = gimp_list_new (GIMP_TYPE_VIEWABLE, FALSE);
+}
+
+static void
 gimp_image_map_tool_init (GimpImageMapTool *image_map_tool)
 {
   GimpTool *tool = GIMP_TOOL (image_map_tool);
@@ -243,6 +289,9 @@
       GimpImageMapToolClass *klass;
       GtkWidget             *shell;
       GtkWidget             *vbox;
+      GtkWidget             *hbox;
+      GtkWidget             *label;
+      GtkWidget             *combo;
       GtkWidget             *toggle;
       const gchar           *stock_id;
 
@@ -275,6 +324,27 @@
       gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
       gtk_container_add (GTK_CONTAINER (GTK_DIALOG (shell)->vbox), vbox);
 
+      hbox = gtk_hbox_new (FALSE, 4);
+      gtk_box_pack_start (GTK_BOX (image_map_tool->main_vbox), hbox,
+                          FALSE, FALSE, 0);
+      gtk_widget_show (hbox);
+
+      label = gtk_label_new (_("Recent Settings:"));
+      gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+      gtk_widget_show (label);
+
+      combo = gimp_container_combo_box_new (klass->recent_settings,
+                                            GIMP_CONTEXT (tool_info->tool_options),
+                                            16, 0);
+      gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 0);
+      gtk_widget_show (combo);
+
+      gimp_help_set_help_data (combo, _("Pick a setting from the list"), NULL);
+
+      g_signal_connect_after (combo, "select-item",
+                              G_CALLBACK (gimp_image_map_tool_recent_selected),
+                              image_map_tool);
+
       /*  The preview toggle  */
       toggle = gimp_prop_check_button_new (G_OBJECT (tool_info->tool_options),
                                            "preview",
@@ -499,12 +569,16 @@
     }
 }
 
-static void
+void
 gimp_image_map_tool_create_map (GimpImageMapTool *tool)
 {
-  Gimp     *gimp = GIMP_TOOL (tool)->tool_info->gimp;
+  Gimp     *gimp;
   gboolean  use_gegl;
 
+  g_return_if_fail (GIMP_IS_IMAGE_MAP_TOOL (tool));
+
+  gimp = GIMP_TOOL (tool)->tool_info->gimp;
+
   if (tool->image_map)
     {
       gimp_image_map_clear (tool->image_map);
@@ -566,6 +640,49 @@
 }
 
 static void
+gimp_image_map_tool_add_recent (GimpImageMapTool *image_map_tool)
+{
+  GimpContainer *recent;
+  GimpConfig    *current;
+  GimpConfig    *config = NULL;
+  GList         *list;
+  time_t         now;
+  struct tm      tm;
+  gchar          buf[64];
+  gchar         *name;
+
+  recent  = GIMP_IMAGE_MAP_TOOL_GET_CLASS (image_map_tool)->recent_settings;
+  current = GIMP_CONFIG (image_map_tool->config);
+
+  for (list = GIMP_LIST (recent)->list; list; list = g_list_next (list))
+    {
+      config = list->data;
+
+      if (gimp_config_is_equal_to (config, current))
+        {
+          gimp_container_reorder (recent, GIMP_OBJECT (config), 0);
+          break;
+        }
+
+      config = NULL;
+    }
+
+  if (! config)
+    {
+      config = gimp_config_duplicate (current);
+      gimp_container_insert (recent, GIMP_OBJECT (config), 0);
+    }
+
+  now = time (NULL);
+  tm = *localtime (&now);
+  strftime (buf, sizeof (buf), "%Y-%m-%d %T", &tm);
+
+  name = g_locale_to_utf8 (buf, -1, NULL, NULL, NULL);
+  gimp_object_set_name (GIMP_OBJECT (config), name);
+  g_free (name);
+}
+
+static void
 gimp_image_map_tool_response (GtkWidget        *widget,
                               gint              response_id,
                               GimpImageMapTool *image_map_tool)
@@ -598,6 +715,9 @@
           gimp_tool_control_set_preserve (tool->control, FALSE);
 
           gimp_image_flush (tool->display->image);
+
+          if (image_map_tool->config)
+            gimp_image_map_tool_add_recent (image_map_tool);
         }
 
       tool->display  = NULL;
@@ -627,6 +747,21 @@
 }
 
 static void
+gimp_image_map_tool_recent_selected (GimpContainerView *view,
+                                     GimpViewable      *object,
+                                     gpointer           insert_data,
+                                     GimpImageMapTool  *tool)
+{
+  if (object)
+    {
+      gimp_config_copy (GIMP_CONFIG (object),
+                        GIMP_CONFIG (tool->config), 0);
+
+      gimp_container_view_select_item (view, NULL);
+    }
+}
+
+static void
 gimp_image_map_tool_notify_preview (GObject          *config,
                                     GParamSpec       *pspec,
                                     GimpImageMapTool *image_map_tool)

Modified: branches/weskaggs/app/tools/gimpimagemaptool.h
==============================================================================
--- branches/weskaggs/app/tools/gimpimagemaptool.h	(original)
+++ branches/weskaggs/app/tools/gimpimagemaptool.h	Wed Feb  6 17:19:00 2008
@@ -69,6 +69,8 @@
   const gchar        *save_button_tip;
   const gchar        *save_dialog_title;
 
+  GimpContainer      *recent_settings;
+
   /* virtual functions */
   GeglNode * (* get_operation) (GimpImageMapTool  *image_map_tool,
                                 GObject          **config);
@@ -84,9 +86,13 @@
 };
 
 
-GType   gimp_image_map_tool_get_type (void) G_GNUC_CONST;
+GType   gimp_image_map_tool_get_type   (void) G_GNUC_CONST;
+
+void    gimp_image_map_tool_preview    (GimpImageMapTool *image_map_tool);
+
+/* temp hack for the gegl tool */
+void    gimp_image_map_tool_create_map (GimpImageMapTool *image_map_tool);
 
-void    gimp_image_map_tool_preview  (GimpImageMapTool *image_map_tool);
 
 
 #endif  /*  __GIMP_IMAGE_MAP_TOOL_H__  */

Modified: branches/weskaggs/app/tools/gimplevelstool.c
==============================================================================
--- branches/weskaggs/app/tools/gimplevelstool.c	(original)
+++ branches/weskaggs/app/tools/gimplevelstool.c	Wed Feb  6 17:19:00 2008
@@ -177,7 +177,7 @@
   GimpImageMapTool *im_tool = GIMP_IMAGE_MAP_TOOL (tool);
 
   tool->lut           = gimp_lut_new ();
-  tool->hist          = NULL;
+  tool->histogram     = gimp_histogram_new ();
   tool->active_picker = NULL;
 
   im_tool->apply_func = (GimpImageMapApplyFunc) gimp_lut_process;
@@ -191,10 +191,10 @@
 
   gimp_lut_free (tool->lut);
 
-  if (tool->hist)
+  if (tool->histogram)
     {
-      gimp_histogram_free (tool->hist);
-      tool->hist = NULL;
+      gimp_histogram_unref (tool->histogram);
+      tool->histogram = NULL;
     }
 
   G_OBJECT_CLASS (parent_class)->finalize (object);
@@ -220,12 +220,6 @@
 
   gimp_config_reset (GIMP_CONFIG (l_tool->config));
 
-  if (! l_tool->hist)
-    l_tool->hist = gimp_histogram_new ();
-
-  l_tool->color = gimp_drawable_is_rgb (drawable);
-  l_tool->alpha = gimp_drawable_has_alpha (drawable);
-
   if (l_tool->active_picker)
     gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (l_tool->active_picker),
                                   FALSE);
@@ -233,11 +227,11 @@
   GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error);
 
   gimp_int_combo_box_set_sensitivity (GIMP_INT_COMBO_BOX (l_tool->channel_menu),
-                                      levels_menu_sensitivity, l_tool, NULL);
+                                      levels_menu_sensitivity, drawable, NULL);
 
-  gimp_drawable_calculate_histogram (drawable, l_tool->hist);
-  gimp_histogram_view_set_histogram (GIMP_HISTOGRAM_VIEW (l_tool->hist_view),
-                                     l_tool->hist);
+  gimp_drawable_calculate_histogram (drawable, l_tool->histogram);
+  gimp_histogram_view_set_histogram (GIMP_HISTOGRAM_VIEW (l_tool->histogram_view),
+                                     l_tool->histogram);
 
   return TRUE;
 }
@@ -271,15 +265,17 @@
 static void
 gimp_levels_tool_map (GimpImageMapTool *image_map_tool)
 {
-  GimpLevelsTool *tool = GIMP_LEVELS_TOOL (image_map_tool);
+  GimpLevelsTool *tool     = GIMP_LEVELS_TOOL (image_map_tool);
+  GimpDrawable   *drawable = image_map_tool->drawable;
   Levels          levels;
 
-  gimp_levels_config_to_cruft (tool->config, &levels, tool->color);
+  gimp_levels_config_to_cruft (tool->config, &levels,
+                               gimp_drawable_is_rgb (drawable));
 
   gimp_lut_setup (tool->lut,
                   (GimpLutFunc) levels_lut_func,
                   &levels,
-                  gimp_drawable_bytes (image_map_tool->drawable));
+                  gimp_drawable_bytes (drawable));
 }
 
 
@@ -417,14 +413,14 @@
   gtk_container_add (GTK_CONTAINER (frame), vbox2);
   gtk_widget_show (vbox2);
 
-  tool->hist_view = gimp_histogram_view_new (FALSE);
-  gtk_box_pack_start (GTK_BOX (vbox2), tool->hist_view, TRUE, TRUE, 0);
-  gtk_widget_show (GTK_WIDGET (tool->hist_view));
+  tool->histogram_view = gimp_histogram_view_new (FALSE);
+  gtk_box_pack_start (GTK_BOX (vbox2), tool->histogram_view, TRUE, TRUE, 0);
+  gtk_widget_show (GTK_WIDGET (tool->histogram_view));
 
   gimp_histogram_options_connect_view (GIMP_HISTOGRAM_OPTIONS (tool_options),
-                                       GIMP_HISTOGRAM_VIEW (tool->hist_view));
+                                       GIMP_HISTOGRAM_VIEW (tool->histogram_view));
 
-  g_object_get (tool->hist_view, "border-width", &border, NULL);
+  g_object_get (tool->histogram_view, "border-width", &border, NULL);
 
   vbox3 = gtk_vbox_new (FALSE, 0);
   gtk_container_set_border_width (GTK_CONTAINER (vbox3), border);
@@ -737,7 +733,7 @@
 
   if (! strcmp (pspec->name, "channel"))
     {
-      gimp_histogram_view_set_channel (GIMP_HISTOGRAM_VIEW (tool->hist_view),
+      gimp_histogram_view_set_channel (GIMP_HISTOGRAM_VIEW (tool->histogram_view),
                                        config->channel);
       gimp_color_bar_set_channel (GIMP_COLOR_BAR (tool->output_bar),
                                   config->channel);
@@ -865,8 +861,8 @@
 levels_menu_sensitivity (gint      value,
                          gpointer  data)
 {
-  GimpLevelsTool       *tool    = GIMP_LEVELS_TOOL (data);
-  GimpHistogramChannel  channel = value;
+  GimpDrawable         *drawable = GIMP_DRAWABLE (data);
+  GimpHistogramChannel  channel  = value;
 
   switch (channel)
     {
@@ -876,10 +872,10 @@
     case GIMP_HISTOGRAM_RED:
     case GIMP_HISTOGRAM_GREEN:
     case GIMP_HISTOGRAM_BLUE:
-      return tool->color;
+      return gimp_drawable_is_rgb (drawable);
 
     case GIMP_HISTOGRAM_ALPHA:
-      return tool->alpha;
+      return gimp_drawable_has_alpha (drawable);
 
     case GIMP_HISTOGRAM_RGB:
       return FALSE;
@@ -892,7 +888,10 @@
 levels_stretch_callback (GtkWidget      *widget,
                          GimpLevelsTool *tool)
 {
-  gimp_levels_config_stretch (tool->config, tool->hist, tool->color);
+  GimpDrawable *drawable = GIMP_IMAGE_MAP_TOOL (tool)->drawable;
+
+  gimp_levels_config_stretch (tool->config, tool->histogram,
+                              gimp_drawable_is_rgb (drawable));
 }
 
 static void

Modified: branches/weskaggs/app/tools/gimplevelstool.h
==============================================================================
--- branches/weskaggs/app/tools/gimplevelstool.h	(original)
+++ branches/weskaggs/app/tools/gimplevelstool.h	Wed Feb  6 17:19:00 2008
@@ -42,14 +42,11 @@
   GimpLut              *lut;
 
   /* dialog */
-  gboolean              color;
-  gboolean              alpha;
-
-  GimpHistogram        *hist;
+  GimpHistogram        *histogram;
 
   GtkWidget            *channel_menu;
 
-  GtkWidget            *hist_view;
+  GtkWidget            *histogram_view;
 
   GtkWidget            *input_bar;
   GtkWidget            *input_sliders;

Modified: branches/weskaggs/app/tools/gimppolygonselecttool.c
==============================================================================
--- branches/weskaggs/app/tools/gimppolygonselecttool.c	(original)
+++ branches/weskaggs/app/tools/gimppolygonselecttool.c	Wed Feb  6 17:19:00 2008
@@ -236,13 +236,20 @@
 
   if (tool->display == display)
     {
+      gboolean hovering_first_point;
+
       gimp_polygon_select_tool_select_closet_point (poly_sel_tool,
                                                     display,
                                                     coords);
 
+      hovering_first_point = gimp_polygon_select_tool_should_close (poly_sel_tool,
+                                                                    display,
+                                                                    coords);
+
       gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
 
-      if (poly_sel_tool->grabbed_point || poly_sel_tool->num_points == 0)
+      if (poly_sel_tool->num_points == 0 ||
+          (poly_sel_tool->grabbed_point && !hovering_first_point))
         {
           poly_sel_tool->show_pending_point = FALSE;
         }
@@ -250,8 +257,15 @@
         {
           poly_sel_tool->show_pending_point = TRUE;
 
-          poly_sel_tool->pending_point.x    = coords->x;
-          poly_sel_tool->pending_point.y    = coords->y;
+          if (hovering_first_point)
+            {
+              poly_sel_tool->pending_point = poly_sel_tool->points[0];
+            }
+          else
+            {
+              poly_sel_tool->pending_point.x = coords->x;
+              poly_sel_tool->pending_point.y = coords->y;
+            }
         }
 
       gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
@@ -299,6 +313,14 @@
         {
           poly_sel_tool->grabbed_point->x = coords->x;
           poly_sel_tool->grabbed_point->y = coords->y;
+
+          if (gimp_polygon_select_tool_should_close (poly_sel_tool,
+                                                     display,
+                                                     coords))
+            {
+              poly_sel_tool->pending_point.x = coords->x;
+              poly_sel_tool->pending_point.y = coords->y;
+            }
         }
       else
         {
@@ -433,9 +455,14 @@
 gimp_polygon_select_tool_commit (GimpPolygonSelectTool *poly_sel_tool,
                                  GimpDisplay           *display)
 {
-  gimp_polygon_select_tool_select (poly_sel_tool, display);
+  if (poly_sel_tool->num_points >= 3)
+    {
+      gimp_polygon_select_tool_select (poly_sel_tool, display);
+    }
 
   gimp_polygon_select_tool_halt (poly_sel_tool);
+
+  gimp_image_flush (display->image);
 }
 
 static void
@@ -533,14 +560,12 @@
 
   gimp_draw_tool_pause (draw_tool);
 
+  poly_sel_tool->num_points--;
+
   if (poly_sel_tool->num_points == 0)
     {
       gimp_polygon_select_tool_halt (poly_sel_tool);
     }
-  else
-    {
-      poly_sel_tool->num_points--;
-    }
 
   gimp_draw_tool_resume (draw_tool);
 }

Modified: branches/weskaggs/app/tools/gimppolygonselecttool.h
==============================================================================
--- branches/weskaggs/app/tools/gimppolygonselecttool.h	(original)
+++ branches/weskaggs/app/tools/gimppolygonselecttool.h	Wed Feb  6 17:19:00 2008
@@ -21,8 +21,8 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-#ifndef GIMP_POLYGON_SELECT_TOOL_H
-#define GIMP_POLYGON_SELECT_TOOL_H
+#ifndef __GIMP_POLYGON_SELECT_TOOL_H__
+#define __GIMP_POLYGON_SELECT_TOOL_H__
 
 
 #include "gimpselectiontool.h"
@@ -59,4 +59,4 @@
                                            GimpDisplay           *display);
 
 
-#endif /* GIMP_POLYGON_SELECT_TOOL_H */
+#endif /* __GIMP_POLYGON_SELECT_TOOL_H__ */

Modified: branches/weskaggs/app/tools/gimpthresholdtool.c
==============================================================================
--- branches/weskaggs/app/tools/gimpthresholdtool.c	(original)
+++ branches/weskaggs/app/tools/gimpthresholdtool.c	Wed Feb  6 17:19:00 2008
@@ -119,7 +119,7 @@
   GimpImageMapTool *im_tool = GIMP_IMAGE_MAP_TOOL (t_tool);
 
   t_tool->threshold = g_slice_new0 (Threshold);
-  t_tool->hist      = NULL;
+  t_tool->histogram = gimp_histogram_new ();
 
   im_tool->apply_func = (GimpImageMapApplyFunc) threshold;
   im_tool->apply_data = t_tool->threshold;
@@ -132,10 +132,10 @@
 
   g_slice_free (Threshold, t_tool->threshold);
 
-  if (t_tool->hist)
+  if (t_tool->histogram)
     {
-      gimp_histogram_free (t_tool->hist);
-      t_tool->hist = NULL;
+      gimp_histogram_unref (t_tool->histogram);
+      t_tool->histogram = NULL;
     }
 
   G_OBJECT_CLASS (parent_class)->finalize (object);
@@ -161,26 +161,11 @@
 
   gimp_config_reset (GIMP_CONFIG (t_tool->config));
 
-  if (! t_tool->hist)
-    t_tool->hist = gimp_histogram_new ();
-
-  t_tool->threshold->color = gimp_drawable_is_rgb (drawable);
-
   GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error);
 
-  gimp_drawable_calculate_histogram (drawable, t_tool->hist);
-
-  g_signal_handlers_block_by_func (t_tool->histogram_box->view,
-                                   gimp_threshold_tool_histogram_range,
-                                   t_tool);
+  gimp_drawable_calculate_histogram (drawable, t_tool->histogram);
   gimp_histogram_view_set_histogram (t_tool->histogram_box->view,
-                                     t_tool->hist);
-  gimp_histogram_view_set_range (t_tool->histogram_box->view,
-                                 t_tool->config->low  * 255.999,
-                                 t_tool->config->high * 255.999);
-  g_signal_handlers_unblock_by_func (t_tool->histogram_box->view,
-                                     gimp_threshold_tool_histogram_range,
-                                     t_tool);
+                                     t_tool->histogram);
 
   gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (t_tool));
 
@@ -216,9 +201,11 @@
 static void
 gimp_threshold_tool_map (GimpImageMapTool *image_map_tool)
 {
-  GimpThresholdTool *t_tool = GIMP_THRESHOLD_TOOL (image_map_tool);
+  GimpThresholdTool *t_tool   = GIMP_THRESHOLD_TOOL (image_map_tool);
+  GimpDrawable      *drawable = image_map_tool->drawable;
 
-  gimp_threshold_config_to_cruft (t_tool->config, t_tool->threshold);
+  gimp_threshold_config_to_cruft (t_tool->config, t_tool->threshold,
+                                  gimp_drawable_is_rgb (drawable));
 }
 
 
@@ -229,13 +216,14 @@
 static void
 gimp_threshold_tool_dialog (GimpImageMapTool *image_map_tool)
 {
-  GimpThresholdTool *t_tool       = GIMP_THRESHOLD_TOOL (image_map_tool);
-  GimpToolOptions   *tool_options = GIMP_TOOL_GET_OPTIONS (image_map_tool);
-  GtkWidget         *vbox;
-  GtkWidget         *hbox;
-  GtkWidget         *menu;
-  GtkWidget         *box;
-  GtkWidget         *button;
+  GimpThresholdTool   *t_tool       = GIMP_THRESHOLD_TOOL (image_map_tool);
+  GimpToolOptions     *tool_options = GIMP_TOOL_GET_OPTIONS (image_map_tool);
+  GimpThresholdConfig *config       = t_tool->config;
+  GtkWidget           *vbox;
+  GtkWidget           *hbox;
+  GtkWidget           *menu;
+  GtkWidget           *box;
+  GtkWidget           *button;
 
   vbox = image_map_tool->main_vbox;
 
@@ -255,6 +243,10 @@
 
   t_tool->histogram_box = GIMP_HISTOGRAM_BOX (box);
 
+  gimp_histogram_view_set_range (t_tool->histogram_box->view,
+                                 config->low  * 255.999,
+                                 config->high * 255.999);
+
   g_signal_connect (t_tool->histogram_box->view, "range-changed",
                     G_CALLBACK (gimp_threshold_tool_histogram_range),
                     t_tool);
@@ -284,10 +276,12 @@
 {
   GimpThresholdConfig *config = GIMP_THRESHOLD_CONFIG (object);
 
-  if (t_tool->histogram_box)
-    gimp_histogram_view_set_range (t_tool->histogram_box->view,
-                                   config->low  * 255.999,
-                                   config->high * 255.999);
+  if (! t_tool->histogram_box)
+    return;
+
+  gimp_histogram_view_set_range (t_tool->histogram_box->view,
+                                 config->low  * 255.999,
+                                 config->high * 255.999);
 
   gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (t_tool));
 }
@@ -315,11 +309,14 @@
 gimp_threshold_tool_auto_clicked (GtkWidget         *button,
                                   GimpThresholdTool *t_tool)
 {
-  gdouble low = gimp_histogram_get_threshold (t_tool->hist,
-                                              t_tool->threshold->color ?
-                                              GIMP_HISTOGRAM_RGB :
-                                              GIMP_HISTOGRAM_VALUE,
-                                              0, 255);
+  GimpDrawable *drawable = GIMP_IMAGE_MAP_TOOL (t_tool)->drawable;
+  gdouble       low;
+
+  low = gimp_histogram_get_threshold (t_tool->histogram,
+                                      gimp_drawable_is_rgb (drawable) ?
+                                      GIMP_HISTOGRAM_RGB :
+                                      GIMP_HISTOGRAM_VALUE,
+                                      0, 255);
 
   gimp_histogram_view_set_range (t_tool->histogram_box->view,
                                  low, 255.0);

Modified: branches/weskaggs/app/tools/gimpthresholdtool.h
==============================================================================
--- branches/weskaggs/app/tools/gimpthresholdtool.h	(original)
+++ branches/weskaggs/app/tools/gimpthresholdtool.h	Wed Feb  6 17:19:00 2008
@@ -42,7 +42,7 @@
   Threshold           *threshold;
 
   /*  dialog  */
-  GimpHistogram       *hist;
+  GimpHistogram       *histogram;
   GimpHistogramBox    *histogram_box;
 };
 

Modified: branches/weskaggs/app/widgets/gimpcontainerview.c
==============================================================================
--- branches/weskaggs/app/widgets/gimpcontainerview.c	(original)
+++ branches/weskaggs/app/widgets/gimpcontainerview.c	Wed Feb  6 17:19:00 2008
@@ -346,6 +346,9 @@
 
   g_return_if_fail (GIMP_IS_CONTAINER_VIEW (view));
   g_return_if_fail (container == NULL || GIMP_IS_CONTAINER (container));
+  if (container)
+    g_return_if_fail (g_type_is_a (container->children_type,
+                                   GIMP_TYPE_VIEWABLE));
 
   private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
 

Modified: branches/weskaggs/app/widgets/gimphistogrameditor.c
==============================================================================
--- branches/weskaggs/app/widgets/gimphistogrameditor.c	(original)
+++ branches/weskaggs/app/widgets/gimphistogrameditor.c	Wed Feb  6 17:19:00 2008
@@ -260,7 +260,7 @@
 
       if (editor->histogram)
         {
-          gimp_histogram_free (editor->histogram);
+          gimp_histogram_unref (editor->histogram);
           editor->histogram = NULL;
 
           gimp_histogram_view_set_histogram (view, NULL);
@@ -268,7 +268,7 @@
 
       if (editor->bg_histogram)
         {
-          gimp_histogram_free (editor->bg_histogram);
+          gimp_histogram_unref (editor->bg_histogram);
           editor->bg_histogram = NULL;
 
           gimp_histogram_view_set_background (view, NULL);
@@ -313,7 +313,7 @@
         {
           GimpHistogramView *view = GIMP_HISTOGRAM_BOX (editor->box)->view;
 
-          gimp_histogram_free (editor->bg_histogram);
+          gimp_histogram_unref (editor->bg_histogram);
           editor->bg_histogram = NULL;
 
           gimp_histogram_view_set_background (view, NULL);
@@ -386,7 +386,7 @@
     }
   else if (editor->bg_histogram)
     {
-      gimp_histogram_free (editor->bg_histogram);
+      gimp_histogram_unref (editor->bg_histogram);
       editor->bg_histogram = NULL;
 
       gimp_histogram_view_set_background (view, NULL);

Modified: branches/weskaggs/app/widgets/gimphistogramview.c
==============================================================================
--- branches/weskaggs/app/widgets/gimphistogramview.c	(original)
+++ branches/weskaggs/app/widgets/gimphistogramview.c	Wed Feb  6 17:19:00 2008
@@ -50,6 +50,7 @@
 };
 
 
+static void  gimp_histogram_view_finalize          (GObject        *object);
 static void  gimp_histogram_view_set_property      (GObject        *object,
                                                     guint           property_id,
                                                     const GValue   *value,
@@ -108,6 +109,7 @@
                   G_TYPE_INT,
                   G_TYPE_INT);
 
+  object_class->finalize             = gimp_histogram_view_finalize;
   object_class->get_property         = gimp_histogram_view_get_property;
   object_class->set_property         = gimp_histogram_view_set_property;
 
@@ -159,6 +161,26 @@
 }
 
 static void
+gimp_histogram_view_finalize (GObject *object)
+{
+  GimpHistogramView *view = GIMP_HISTOGRAM_VIEW (object);
+
+  if (view->histogram)
+    {
+      gimp_histogram_unref (view->histogram);
+      view->histogram = NULL;
+    }
+
+  if (view->bg_histogram)
+    {
+      gimp_histogram_unref (view->bg_histogram);
+      view->bg_histogram = NULL;
+    }
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
 gimp_histogram_view_set_property (GObject      *object,
                                   guint         property_id,
                                   const GValue *value,
@@ -569,10 +591,18 @@
 
   if (view->histogram != histogram)
     {
+      if (view->histogram)
+        gimp_histogram_unref (view->histogram);
+
       view->histogram = histogram;
 
-      if (histogram && view->channel >= gimp_histogram_n_channels (histogram))
-        gimp_histogram_view_set_channel (view, GIMP_HISTOGRAM_VALUE);
+      if (histogram)
+        {
+          gimp_histogram_ref (histogram);
+
+          if (view->channel >= gimp_histogram_n_channels (histogram))
+            gimp_histogram_view_set_channel (view, GIMP_HISTOGRAM_VALUE);
+        }
     }
 
   gtk_widget_queue_draw (GTK_WIDGET (view));
@@ -600,10 +630,18 @@
 
   if (view->bg_histogram != histogram)
     {
+      if (view->bg_histogram)
+        gimp_histogram_ref (view->bg_histogram);
+
       view->bg_histogram = histogram;
 
-      if (histogram && view->channel >= gimp_histogram_n_channels (histogram))
-        gimp_histogram_view_set_channel (view, GIMP_HISTOGRAM_VALUE);
+      if (histogram)
+        {
+          gimp_histogram_ref (histogram);
+
+          if (view->channel >= gimp_histogram_n_channels (histogram))
+            gimp_histogram_view_set_channel (view, GIMP_HISTOGRAM_VALUE);
+        }
     }
 
   gtk_widget_queue_draw (GTK_WIDGET (view));

Modified: branches/weskaggs/app/widgets/gimppropwidgets.c
==============================================================================
--- branches/weskaggs/app/widgets/gimppropwidgets.c	(original)
+++ branches/weskaggs/app/widgets/gimppropwidgets.c	Wed Feb  6 17:19:00 2008
@@ -35,6 +35,7 @@
 
 #include "widgets-types.h"
 
+#include "core/gimpcontext.h"
 #include "core/gimpviewable.h"
 
 #include "gimpcolorpanel.h"
@@ -713,6 +714,131 @@
 }
 
 
+/***********/
+/*  table  */
+/***********/
+
+GtkWidget *
+gimp_prop_table_new (GObject     *config,
+                     GType        owner_type,
+                     GimpContext *context)
+{
+  GtkWidget     *table;
+  GtkSizeGroup  *size_group;
+  GParamSpec   **param_specs;
+  guint          n_param_specs;
+  gint           i;
+  gint           row = 0;
+
+  g_return_val_if_fail (G_IS_OBJECT (config), NULL);
+  g_return_val_if_fail (context == NULL || GIMP_IS_CONTEXT (context), NULL);
+
+  param_specs = g_object_class_list_properties (G_OBJECT_GET_CLASS (config),
+                                                &n_param_specs);
+
+  size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+
+  table = gtk_table_new (3, 1, FALSE);
+  gtk_table_set_col_spacings (GTK_TABLE (table), 4);
+  gtk_table_set_row_spacings (GTK_TABLE (table), 2);
+
+  for (i = 0; i < n_param_specs; i++)
+    {
+      GParamSpec  *pspec  = param_specs[i];
+      GtkWidget   *widget = NULL;
+      const gchar *label  = NULL;
+
+      /*  ignore properties of parent classes of owner_type  */
+      if (! g_type_is_a (pspec->owner_type, owner_type))
+        continue;
+
+      if (G_IS_PARAM_SPEC_STRING (pspec))
+        {
+          static GQuark multiline_quark = 0;
+
+          if (! multiline_quark)
+            multiline_quark = g_quark_from_static_string ("multiline");
+
+          if (GIMP_IS_PARAM_SPEC_CONFIG_PATH (pspec))
+            {
+              widget = gimp_prop_file_chooser_button_new (config,
+                                                          pspec->name,
+                                                          g_param_spec_get_nick (pspec),
+                                                          GTK_FILE_CHOOSER_ACTION_OPEN);
+            }
+          else if (g_param_spec_get_qdata (pspec, multiline_quark))
+            {
+              GtkTextBuffer *buffer;
+              GtkWidget     *view;
+
+              buffer = gimp_prop_text_buffer_new (config, pspec->name, -1);
+              view = gtk_text_view_new_with_buffer (buffer);
+
+              widget = gtk_scrolled_window_new (NULL, NULL);
+              gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (widget),
+                                                   GTK_SHADOW_IN);
+              gtk_container_add (GTK_CONTAINER (widget), view);
+              gtk_widget_show (view);
+            }
+          else
+            {
+              widget = gimp_prop_entry_new (config, pspec->name, -1);
+            }
+
+          label  = g_param_spec_get_nick (pspec);
+        }
+      else if (G_IS_PARAM_SPEC_BOOLEAN (pspec))
+        {
+          widget = gimp_prop_check_button_new (config, pspec->name,
+                                               g_param_spec_get_nick (pspec));
+        }
+      else if (G_IS_PARAM_SPEC_INT (pspec)   ||
+               G_IS_PARAM_SPEC_UINT (pspec)  ||
+               G_IS_PARAM_SPEC_FLOAT (pspec) ||
+               G_IS_PARAM_SPEC_DOUBLE (pspec))
+        {
+          GtkObject *adj;
+          gint       digits = (G_IS_PARAM_SPEC_FLOAT (pspec) ||
+                               G_IS_PARAM_SPEC_DOUBLE (pspec)) ? 2 : 0;
+
+          adj = gimp_prop_scale_entry_new (config, pspec->name,
+                                           GTK_TABLE (table), 0, row++,
+                                           g_param_spec_get_nick (pspec),
+                                           1.0, 1.0, digits,
+                                           FALSE, 0.0, 0.0);
+
+          gtk_size_group_add_widget (size_group,
+                                     GIMP_SCALE_ENTRY_SPINBUTTON (adj));
+        }
+      else if (GIMP_IS_PARAM_SPEC_RGB (pspec))
+        {
+          widget = gimp_prop_color_button_new (config, pspec->name,
+                                               g_param_spec_get_nick (pspec),
+                                               128, 24,
+                                               GIMP_COLOR_AREA_SMALL_CHECKS);
+          gimp_color_panel_set_context (GIMP_COLOR_PANEL (widget), context);
+          label = g_param_spec_get_nick (pspec);
+        }
+      else
+        {
+          g_warning ("%s: not supported: %s (%s)\n", G_STRFUNC,
+                     g_type_name (G_TYPE_FROM_INSTANCE (pspec)), pspec->name);
+        }
+
+      if (widget)
+        gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
+                                   label, 0.0, 0.5,
+                                   widget, 2, FALSE);
+    }
+
+  g_object_unref (size_group);
+
+  g_free (param_specs);
+
+  return table;
+}
+
+
 /*******************************/
 /*  private utility functions  */
 /*******************************/

Modified: branches/weskaggs/app/widgets/gimppropwidgets.h
==============================================================================
--- branches/weskaggs/app/widgets/gimppropwidgets.h	(original)
+++ branches/weskaggs/app/widgets/gimppropwidgets.h	Wed Feb  6 17:19:00 2008
@@ -57,6 +57,7 @@
                                            GimpContext *context,
                                            gint         size);
 
+
 /*  GParamDouble, GParamDouble, GParamDouble, GParamDouble, GParamBoolean  */
 
 GtkWidget * gimp_prop_number_pair_entry_new
@@ -74,4 +75,11 @@
                                            gdouble      max_valid_value);
 
 
+/*  A view on all of an object's properties  */
+
+GtkWidget * gimp_prop_table_new           (GObject     *config,
+                                           GType        owner_type,
+                                           GimpContext *context);
+
+
 #endif /* __GIMP_APP_PROP_WIDGETS_H__ */

Modified: branches/weskaggs/libgimpconfig/gimpconfig-iface.c
==============================================================================
--- branches/weskaggs/libgimpconfig/gimpconfig-iface.c	(original)
+++ branches/weskaggs/libgimpconfig/gimpconfig-iface.c	Wed Feb  6 17:19:00 2008
@@ -58,6 +58,9 @@
 static gboolean     gimp_config_iface_equal       (GimpConfig       *a,
                                                    GimpConfig       *b);
 static void         gimp_config_iface_reset       (GimpConfig       *config);
+static gboolean     gimp_config_iface_copy        (GimpConfig       *src,
+                                                   GimpConfig       *dest,
+                                                   GParamFlags       flags);
 
 
 GType
@@ -95,6 +98,7 @@
       config_iface->duplicate   = gimp_config_iface_duplicate;
       config_iface->equal       = gimp_config_iface_equal;
       config_iface->reset       = gimp_config_iface_reset;
+      config_iface->copy        = gimp_config_iface_copy;
     }
 
   /*  always set these to NULL since we don't want to inherit them
@@ -167,7 +171,7 @@
 
   g_free (construct_params);
 
-  gimp_config_sync (object, dup, 0);
+  gimp_config_copy (config, GIMP_CONFIG (dup), 0);
 
   return GIMP_CONFIG (dup);
 }
@@ -236,6 +240,14 @@
   gimp_config_reset_properties (G_OBJECT (config));
 }
 
+static gboolean
+gimp_config_iface_copy (GimpConfig  *src,
+                        GimpConfig  *dest,
+                        GParamFlags  flags)
+{
+  return gimp_config_sync (G_OBJECT (src), G_OBJECT (dest), flags);
+}
+
 /**
  * gimp_config_serialize_to_file:
  * @config: a #GObject that implements the #GimpConfigInterface.
@@ -340,7 +352,7 @@
 }
 
 /**
- * gimp_config_deserialize:
+ * gimp_config_deserialize_file:
  * @config: a #GObject that implements the #GimpConfigInterface.
  * @filename: the name of the file to read configuration from.
  * @data: user data passed to the deserialize implementation.
@@ -372,9 +384,13 @@
   if (! scanner)
     return FALSE;
 
+  g_object_freeze_notify (G_OBJECT (config));
+
   success = GIMP_CONFIG_GET_INTERFACE (config)->deserialize (config,
                                                              scanner, 0, data);
 
+  g_object_thaw_notify (G_OBJECT (config));
+
   gimp_scanner_destroy (scanner);
 
   if (! success)
@@ -415,9 +431,13 @@
 
   scanner = gimp_scanner_new_string (text, text_len, error);
 
+  g_object_freeze_notify (G_OBJECT (config));
+
   success = GIMP_CONFIG_GET_INTERFACE (config)->deserialize (config,
                                                              scanner, 0, data);
 
+  g_object_thaw_notify (G_OBJECT (config));
+
   gimp_scanner_destroy (scanner);
 
   if (! success)
@@ -535,5 +555,46 @@
 {
   g_return_if_fail (GIMP_IS_CONFIG (config));
 
+  g_object_freeze_notify (G_OBJECT (config));
+
   GIMP_CONFIG_GET_INTERFACE (config)->reset (config);
+
+  g_object_thaw_notify (G_OBJECT (config));
+}
+
+/**
+ * gimp_config_copy:
+ * @src: a #GObject that implements the #GimpConfigInterface.
+ * @dest: another #GObject of the same type as @a.
+ * @flags: a mask of GParamFlags
+ *
+ * Compares all read- and write-able properties from @src and @dest
+ * that have all @flags set. Differing values are then copied from
+ * @src to @dest. If @flags is 0, all differing read/write properties.
+ *
+ * Properties marked as "construct-only" are not touched.
+ *
+ * Return value: %TRUE if @dest was modified, %FALSE otherwise
+ *
+ * Since: GIMP 2.6
+ **/
+gboolean
+gimp_config_copy (GimpConfig  *src,
+                  GimpConfig  *dest,
+                  GParamFlags  flags)
+{
+  gboolean changed;
+
+  g_return_val_if_fail (GIMP_IS_CONFIG (src), FALSE);
+  g_return_val_if_fail (GIMP_IS_CONFIG (dest), FALSE);
+  g_return_val_if_fail (G_TYPE_FROM_INSTANCE (src) == G_TYPE_FROM_INSTANCE (dest),
+                        FALSE);
+
+  g_object_freeze_notify (G_OBJECT (dest));
+
+  changed = GIMP_CONFIG_GET_INTERFACE (src)->copy (src, dest, flags);
+
+  g_object_thaw_notify (G_OBJECT (dest));
+
+  return changed;
 }

Modified: branches/weskaggs/libgimpconfig/gimpconfig-iface.h
==============================================================================
--- branches/weskaggs/libgimpconfig/gimpconfig-iface.h	(original)
+++ branches/weskaggs/libgimpconfig/gimpconfig-iface.h	Wed Feb  6 17:19:00 2008
@@ -62,6 +62,9 @@
   gboolean     (* equal)                (GimpConfig       *a,
                                          GimpConfig       *b);
   void         (* reset)                (GimpConfig       *config);
+  gboolean     (* copy)                 (GimpConfig       *src,
+                                         GimpConfig       *dest,
+                                         GParamFlags       flags);
 };
 
 
@@ -95,6 +98,9 @@
 gboolean      gimp_config_is_equal_to           (GimpConfig   *a,
                                                  GimpConfig   *b);
 void          gimp_config_reset                 (GimpConfig   *config);
+gboolean      gimp_config_copy                  (GimpConfig   *src,
+                                                 GimpConfig   *dest,
+                                                 GParamFlags   flags);
 
 
 G_END_DECLS

Modified: branches/weskaggs/libgimpconfig/gimpconfig-utils.c
==============================================================================
--- branches/weskaggs/libgimpconfig/gimpconfig-utils.c	(original)
+++ branches/weskaggs/libgimpconfig/gimpconfig-utils.c	Wed Feb  6 17:19:00 2008
@@ -216,6 +216,8 @@
   if (!diff)
     return FALSE;
 
+  g_object_freeze_notify (G_OBJECT (dest));
+
   for (list = diff; list; list = list->next)
     {
       GParamSpec *prop_spec = list->data;
@@ -233,6 +235,8 @@
         }
     }
 
+  g_object_thaw_notify (G_OBJECT (dest));
+
   g_list_free (diff);
 
   return TRUE;
@@ -306,9 +310,9 @@
         }
     }
 
-  g_free (property_specs);
-
   g_object_thaw_notify (object);
+
+  g_free (property_specs);
 }
 
 

Modified: branches/weskaggs/libgimpwidgets/gimpstock.c
==============================================================================
--- branches/weskaggs/libgimpwidgets/gimpstock.c	(original)
+++ branches/weskaggs/libgimpwidgets/gimpstock.c	Wed Feb  6 17:19:00 2008
@@ -258,6 +258,7 @@
   { GIMP_TOILET_PAPER,                   NULL,        0, 0, LIBGIMP_DOMAIN },
   { GIMP_STOCK_WEB,                      NULL,        0, 0, LIBGIMP_DOMAIN },
   { GIMP_STOCK_VIDEO,                    NULL,        0, 0, LIBGIMP_DOMAIN },
+  { GIMP_STOCK_GEGL,                     NULL,        0, 0, LIBGIMP_DOMAIN },
 
   { GIMP_STOCK_SHAPE_CIRCLE,             NULL,        0, 0, LIBGIMP_DOMAIN },
   { GIMP_STOCK_SHAPE_DIAMOND,            NULL,        0, 0, LIBGIMP_DOMAIN },
@@ -480,7 +481,8 @@
   { GIMP_TOILET_PAPER,                   stock_toilet_paper_24             },
   { GIMP_STOCK_WEB,                      stock_web_24                      },
   { GIMP_STOCK_WILBER,                   stock_wilber_22                   },
-  { GIMP_STOCK_VIDEO,                    stock_video_24                    }
+  { GIMP_STOCK_VIDEO,                    stock_video_24                    },
+  { GIMP_STOCK_GEGL,                     stock_gegl_24                     }
 };
 
 static const struct
@@ -643,6 +645,7 @@
   { GIMP_TOILET_PAPER,                   stock_toilet_paper_16             },
   { GIMP_STOCK_WEB,                      stock_web_16                      },
   { GIMP_STOCK_VIDEO,                    stock_video_16                    },
+  { GIMP_STOCK_GEGL,                     stock_gegl_16                     },
 
   { GIMP_STOCK_SHAPE_CIRCLE,             stock_shape_circle_16             },
   { GIMP_STOCK_SHAPE_SQUARE,             stock_shape_square_16             },

Modified: branches/weskaggs/libgimpwidgets/gimpstock.h
==============================================================================
--- branches/weskaggs/libgimpwidgets/gimpstock.h	(original)
+++ branches/weskaggs/libgimpwidgets/gimpstock.h	Wed Feb  6 17:19:00 2008
@@ -240,6 +240,7 @@
 
 #define GIMP_STOCK_WEB                      "gimp-web"
 #define GIMP_STOCK_VIDEO                    "gimp-video"
+#define GIMP_STOCK_GEGL                     "gimp-gegl"
 
 #define GIMP_STOCK_SHAPE_CIRCLE             "gimp-shape-circle"
 #define GIMP_STOCK_SHAPE_DIAMOND            "gimp-shape-diamond"

Modified: branches/weskaggs/menus/image-menu.xml.in
==============================================================================
--- branches/weskaggs/menus/image-menu.xml.in	(original)
+++ branches/weskaggs/menus/image-menu.xml.in	Wed Feb  6 17:19:00 2008
@@ -467,6 +467,7 @@
       <menuitem action="tools-levels" />
       <menuitem action="tools-curves" />
       <menuitem action="tools-posterize" />
+      <menuitem action="tools-gegl" />
       <separator />
       <menuitem action="drawable-desaturate" />
       <placeholder name="Invert">

Modified: branches/weskaggs/plug-ins/common/iwarp.c
==============================================================================
--- branches/weskaggs/plug-ins/common/iwarp.c	(original)
+++ branches/weskaggs/plug-ins/common/iwarp.c	Wed Feb  6 17:19:00 2008
@@ -301,10 +301,8 @@
         case GIMP_RUN_INTERACTIVE:
         case GIMP_RUN_WITH_LAST_VALS:
           gimp_get_data (PLUG_IN_PROC, &iwarp_vals);
-          gimp_tile_cache_ntiles (2 * (drawable->width + gimp_tile_width ()-1) /
-                                  gimp_tile_width ());
-          if (iwarp_dialog())
-            iwarp();
+          if (iwarp_dialog ())
+            iwarp ();
           gimp_set_data (PLUG_IN_PROC, &iwarp_vals, sizeof (iwarp_vals_t));
           gimp_displays_flush ();
           break;
@@ -683,7 +681,7 @@
   gboolean   padding;
 
   progress = 0;
-  max_progress = (yh-yl)*(xh-xl);
+  max_progress = (yh-yl) * (xh-xl);
 
   gimp_pixel_rgn_init (&dest_rgn, destdrawable,
                        xl, yl, xh-xl, yh-yl, TRUE, TRUE);
@@ -914,7 +912,6 @@
   guchar    *linebuffer = NULL;
   gdouble    dx, dy;
 
-
   dx = (gdouble) sel_width / max_current_preview_width;
   dy = (gdouble) sel_height / max_current_preview_height;
 
@@ -931,7 +928,6 @@
   preview_width  = (gint) (sel_width  / pre2img);
   preview_height = (gint) (sel_height / pre2img);
 
-
   if (srcimage)
     {
       srcimage = g_renew (guchar,
@@ -986,6 +982,8 @@
   tile_width  = gimp_tile_width ();
   tile_height = gimp_tile_height ();
 
+  gimp_tile_cache_ntiles (sel_width / tile_width + 1);
+
   iwarp_preview_init ();
   iwarp_cpy_images ();
 

Modified: branches/weskaggs/plug-ins/common/psd-save.c
==============================================================================
--- branches/weskaggs/plug-ins/common/psd-save.c	(original)
+++ branches/weskaggs/plug-ins/common/psd-save.c	Wed Feb  6 17:19:00 2008
@@ -1218,7 +1218,6 @@
   gint32 tile_height = gimp_tile_height();
 
   GimpDrawable *drawable = gimp_drawable_get (drawableID);
-  gint32 maskID = gimp_layer_get_mask(drawableID);
 
   gint32 height = drawable->height;
   gint32 width  = drawable->width;
@@ -1318,70 +1317,79 @@
     }
 
   /* Write layer mask, as last channel, id -2 */
-  if (maskID != -1) {
-    GimpDrawable *mdrawable = gimp_drawable_get(maskID);
-    len = 0;
-
-    gimp_pixel_rgn_init (&region, mdrawable, 0, 0,
-                         width, height, FALSE, FALSE);
-
-    if (ChanLenPosition)
-      {
-        write_gint16 (fd, 1, "Compression type (RLE)");
-        len += 2;
-        IF_DEEP_DBG printf ("\t\t\t\t. ChanLenPos, len %d\n", len);
-      }
-
-    if (ltable_offset > 0)
-      {
-        length_table_pos = ltable_offset + 2 * (bytes+1) * height;
-        IF_DEEP_DBG printf ("\t\t\t\t. ltable, pos %ld\n", length_table_pos);
-      }
-    else
-      {
-        length_table_pos = ftell(fd);
-
-        xfwrite (fd, LengthsTable, height * sizeof(gint16),
-                 "Dummy RLE length");
-        len += height * sizeof(gint16);
-        IF_DEEP_DBG printf ("\t\t\t\t. ltable, pos %ld len %d\n", length_table_pos, len);
-      }
-
-    for (y = 0; y < height; y += tile_height)
-      {
-        int tlen;
-        gimp_pixel_rgn_get_rect (&region, data, 0, y,
-                                 width, MIN(height - y, tile_height));
-        tlen = get_compress_channel_data (&data[0],
-                                          width,
-                                          MIN(height - y, tile_height),
-                                          1,
-                                          &LengthsTable[y],
-                                          rledata);
-        len += tlen;
-        xfwrite (fd, rledata, tlen, "Compressed mask data");
-        IF_DEEP_DBG printf ("\t\t\t\t. Writing compressed mask, stream of %d\n", tlen);
-      }
-
-    /* Write compressed lengths table */
-    fseek (fd, length_table_pos, SEEK_SET); /*POS WHERE???*/
-    for (j = 0; j < height; j++) /* write real length table */
-      {
-        write_gint16 (fd, LengthsTable[j], "RLE length");
-        IF_DEEP_DBG printf ("\t\t\t\t. Updating RLE len %d\n", LengthsTable[j]);
-      }
+  if (gimp_drawable_is_layer (drawableID))
+    {
+      gint32 maskID = gimp_layer_get_mask (drawableID);
+
+      if (maskID != -1)
+        {
+          GimpDrawable *mdrawable = gimp_drawable_get (maskID);
+          len = 0;
 
-    if (ChanLenPosition)    /* Update total compressed length */
-      {
-        fseek (fd, ChanLenPosition[bytes], SEEK_SET); /*+bytes OR SOMETHING*/
-        write_gint32 (fd, len, "channel data length");
-        IFDBG printf ("\t\tUpdating data len to %d, at %ld\n", len, ftell(fd));
-      }
-    fseek (fd, 0, SEEK_END);
-    IF_DEEP_DBG printf ("\t\t\t\t. Cur pos %ld\n", ftell(fd));
+          gimp_pixel_rgn_init (&region, mdrawable, 0, 0,
+                               width, height, FALSE, FALSE);
+
+          if (ChanLenPosition)
+            {
+              write_gint16 (fd, 1, "Compression type (RLE)");
+              len += 2;
+              IF_DEEP_DBG printf ("\t\t\t\t. ChanLenPos, len %d\n", len);
+            }
 
-    gimp_drawable_detach (mdrawable);
-  }
+          if (ltable_offset > 0)
+            {
+              length_table_pos = ltable_offset + 2 * (bytes+1) * height;
+              IF_DEEP_DBG printf ("\t\t\t\t. ltable, pos %ld\n",
+                                  length_table_pos);
+            }
+          else
+            {
+              length_table_pos = ftell(fd);
+
+              xfwrite (fd, LengthsTable, height * sizeof(gint16),
+                       "Dummy RLE length");
+              len += height * sizeof(gint16);
+              IF_DEEP_DBG printf ("\t\t\t\t. ltable, pos %ld len %d\n",
+                                  length_table_pos, len);
+            }
+
+          for (y = 0; y < height; y += tile_height)
+            {
+              int tlen;
+              gimp_pixel_rgn_get_rect (&region, data, 0, y,
+                                       width, MIN(height - y, tile_height));
+              tlen = get_compress_channel_data (&data[0],
+                                                width,
+                                                MIN(height - y, tile_height),
+                                                1,
+                                                &LengthsTable[y],
+                                                rledata);
+              len += tlen;
+              xfwrite (fd, rledata, tlen, "Compressed mask data");
+              IF_DEEP_DBG printf ("\t\t\t\t. Writing compressed mask, stream of %d\n", tlen);
+            }
+
+          /* Write compressed lengths table */
+          fseek (fd, length_table_pos, SEEK_SET); /*POS WHERE???*/
+          for (j = 0; j < height; j++) /* write real length table */
+            {
+              write_gint16 (fd, LengthsTable[j], "RLE length");
+              IF_DEEP_DBG printf ("\t\t\t\t. Updating RLE len %d\n",
+                                  LengthsTable[j]);
+            }
+
+          if (ChanLenPosition)    /* Update total compressed length */
+            {
+              fseek (fd, ChanLenPosition[bytes], SEEK_SET); /*+bytes OR SOMETHING*/
+              write_gint32 (fd, len, "channel data length");
+              IFDBG printf ("\t\tUpdating data len to %d, at %ld\n", len, ftell(fd));
+            }
+          fseek (fd, 0, SEEK_END);
+          IF_DEEP_DBG printf ("\t\t\t\t. Cur pos %ld\n", ftell(fd));
+
+          gimp_drawable_detach (mdrawable);
+        }
+    }
 
   gimp_drawable_detach (drawable);
 

Modified: branches/weskaggs/plug-ins/print/Makefile.am
==============================================================================
--- branches/weskaggs/plug-ins/print/Makefile.am	(original)
+++ branches/weskaggs/plug-ins/print/Makefile.am	Wed Feb  6 17:19:00 2008
@@ -44,6 +44,8 @@
 	print-draw-page.h	\
 	print-page-layout.c	\
 	print-page-layout.h	\
+	print-page-setup.h	\
+	print-page-setup.c	\
 	print-preview.c		\
 	print-preview.h		\
 	print-settings.c	\

Modified: branches/weskaggs/plug-ins/print/print-draw-page.c
==============================================================================
--- branches/weskaggs/plug-ins/print/print-draw-page.c	(original)
+++ branches/weskaggs/plug-ins/print/print-draw-page.c	Wed Feb  6 17:19:00 2008
@@ -33,16 +33,10 @@
 #define INT_BLEND(a,b,alpha,tmp)  (INT_MULT((a) - (b), alpha, tmp) + (b))
 
 
-static void  convert_from_rgb  (guchar          *pixels,
-                                gint             width);
-static void  convert_from_rgba (guchar          *pixels,
-                                gint             width);
-
-#if 0
-static void  draw_info_header  (GtkPrintContext *context,
-                                cairo_t         *cr,
-                                PrintData       *data);
-#endif
+static void  convert_from_rgb  (guchar *pixels,
+                                gint    width);
+static void  convert_from_rgba (guchar *pixels,
+                                gint    width);
 
 
 gboolean
@@ -80,19 +74,6 @@
   scale_x = cr_dpi_x / data->xres;
   scale_y = cr_dpi_y / data->yres;
 
-#if 0
-  /* print header if it is requested */
-  if (data->show_info_header)
-    {
-      draw_info_header (context, cr, data);
-
-/* In points */
-#define HEADER_HEIGHT (20 * 72.0 / 25.4)
-      cairo_translate (cr, 0, HEADER_HEIGHT);
-      cr_height -= HEADER_HEIGHT;
-    }
-#endif
-
   cairo_translate (cr,
                    data->offset_x / cr_dpi_x * 72.0,
                    data->offset_y / cr_dpi_y * 72.0);
@@ -182,134 +163,3 @@
       cairo_data[i] = 0xFF000000 | (r << 16) | (g << 8) | b;
     }
 }
-
-#if 0
-static void
-draw_info_header (GtkPrintContext *context,
-                  cairo_t         *cr,
-                  PrintData       *data)
-{
-  PangoLayout          *layout;
-  PangoFontDescription *desc;
-  gdouble               text_height;
-  gdouble               text_width;
-  gdouble               fname_text_width;
-  gint                  layout_height;
-  gint                  layout_width;
-  gchar                 date_buffer[100];
-  GDate                *date;
-  const gchar          *name_str;
-  GimpParasite         *parasite;
-  const gchar          *end_ptr;
-  gchar                *filename;
-  gdouble               cr_width;
-
-  cairo_save (cr);
-
-  cr_width  = gtk_print_context_get_width (context);
-  cairo_rectangle (cr, 0, 0, cr_width, HEADER_HEIGHT);
-  cairo_set_source_rgb (cr, 0.8, 0.8, 0.8);
-  cairo_fill_preserve (cr);
-
-  cairo_set_source_rgb (cr, 0, 0, 0);
-  cairo_set_line_width (cr, 1);
-  cairo_stroke (cr);
-
-  layout = gtk_print_context_create_pango_layout (context);
-
-  desc = pango_font_description_from_string ("sans 14");
-  pango_layout_set_font_description (layout, desc);
-  pango_font_description_free (desc);
-
-  pango_layout_set_width (layout, -1);
-  pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
-
-  /* image name */
-  pango_layout_set_text (layout, gimp_image_get_name (data->image_id), -1);
-
-  pango_layout_get_size (layout, &layout_width, &layout_height);
-  text_height = (gdouble) layout_height / PANGO_SCALE;
-
-  cairo_move_to (cr, 0.02 * cr_width,  (HEADER_HEIGHT - text_height) / 5);
-  pango_cairo_show_layout (cr, layout);
-
-  /* user name */
-  name_str = g_get_real_name ();
-  if (name_str && g_utf8_validate (name_str, -1, &end_ptr))
-    {
-      pango_layout_set_text (layout, name_str, -1);
-
-      pango_layout_get_size (layout, &layout_width, &layout_height);
-      text_height = (gdouble) layout_height / PANGO_SCALE;
-      text_width = (gdouble) layout_width / PANGO_SCALE;
-
-      cairo_move_to (cr, 0.5 * cr_width - 0.5 * text_width,
-                     (HEADER_HEIGHT - text_height) / 5);
-      pango_cairo_show_layout (cr, layout);
-    }
-
-  /* date */
-  date = g_date_new ();
-  g_date_set_time_t (date, time (NULL));
-  g_date_strftime (date_buffer, 100, "%x", date);
-  g_date_free (date);
-  pango_layout_set_text (layout, date_buffer, -1);
-
-  pango_layout_get_size (layout, &layout_width, &layout_height);
-  text_height = (gdouble) layout_height / PANGO_SCALE;
-  text_width = (gdouble) layout_width / PANGO_SCALE;
-
-  cairo_move_to (cr,
-                 0.98 * cr_width - text_width,
-                 (HEADER_HEIGHT - text_height) / 5);
-  pango_cairo_show_layout (cr, layout);
-
-  /* file name if any */
-  filename = gimp_image_get_filename (data->image_id);
-
-  if (filename)
-    {
-      pango_layout_set_text (layout,
-                             gimp_filename_to_utf8 (filename), -1);
-      g_free (filename);
-
-      pango_layout_get_size (layout, &layout_width, &layout_height);
-      text_height = (gdouble) layout_height / PANGO_SCALE;
-      fname_text_width = (gdouble) layout_width / PANGO_SCALE;
-
-      cairo_move_to (cr,
-                     0.02 * cr_width,  4 * (HEADER_HEIGHT - text_height) / 5);
-      pango_cairo_show_layout (cr, layout);
-    }
-  else
-    {
-      fname_text_width = 0;
-    }
-
-  /* image comment if it is short */
-  parasite = gimp_image_parasite_find (data->image_id, "gimp-comment");
-
-  if (parasite)
-    {
-      pango_layout_set_text (layout, gimp_parasite_data (parasite), -1);
-
-      pango_layout_get_size (layout, &layout_width, &layout_height);
-      text_height = (gdouble) layout_height / PANGO_SCALE;
-      text_width = (gdouble) layout_width / PANGO_SCALE;
-
-      if (fname_text_width + text_width < 0.8 * cr_width &&
-          text_height < 0.5 * HEADER_HEIGHT)
-        {
-          cairo_move_to (cr, 0.98 * cr_width - text_width,
-                         4 * (HEADER_HEIGHT - text_height) / 5);
-          pango_cairo_show_layout (cr, layout);
-        }
-
-      gimp_parasite_free (parasite);
-    }
-
-  g_object_unref (layout);
-
-  cairo_restore (cr);
-}
-#endif

Modified: branches/weskaggs/plug-ins/print/print-page-layout.c
==============================================================================
--- branches/weskaggs/plug-ins/print/print-page-layout.c	(original)
+++ branches/weskaggs/plug-ins/print/print-page-layout.c	Wed Feb  6 17:19:00 2008
@@ -58,13 +58,12 @@
 };
 
 
-static void        run_page_setup_dialog              (GtkWidget     *widget,
-                                                       PrintData     *data);
+static void        print_page_setup_notify       (GtkPrintOperation *operation);
 
-static GtkWidget * print_size_frame                   (PrintData     *data,
+static GtkWidget * print_size_frame                   (PrintData    *data,
                                                        GtkSizeGroup *label_group,
                                                        GtkSizeGroup *entry_group);
-static GtkWidget * print_offset_frame                 (PrintData     *data,
+static GtkWidget * print_offset_frame                 (PrintData    *data,
                                                        GtkSizeGroup *label_group,
                                                        GtkSizeGroup *entry_group);
 
@@ -145,14 +144,6 @@
   gtk_box_pack_start (GTK_BOX (hbox), info.area_label, TRUE, TRUE, 0);
   gtk_widget_show (info.area_label);
 
-  button = gtk_button_new_with_mnemonic (_("_Adjust Page Size "
-                                           "and Orientation"));
-  gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
-  g_signal_connect (G_OBJECT (button), "clicked",
-                    G_CALLBACK (run_page_setup_dialog),
-                    data);
-  gtk_widget_show (button);
-
   /*  main hbox  */
   main_hbox = gtk_hbox_new (FALSE, 12);
   gtk_box_pack_start (GTK_BOX (layout), main_hbox, TRUE, TRUE, 0);
@@ -170,20 +161,6 @@
   label_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
   entry_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
 
-#if 0
-  /* Commented out until the header becomes a little more configurable
-   * and we can provide a user interface to include/exclude information.
-   */
-  button = gtk_check_button_new_with_label ("Print image header");
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
-                                data->show_info_header);
-  gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
-  g_signal_connect (G_OBJECT (button), "toggled",
-                    G_CALLBACK (gimp_toggle_button_update),
-                    &data->show_info_header);
-  gtk_widget_show (button);
-#endif
-
   /* size entry area for the image's print size */
 
   frame = print_size_frame (data, label_group, entry_group);
@@ -221,45 +198,31 @@
 
   print_size_info_set_page_setup (&info);
 
+  g_signal_connect_object (data->operation, "notify::default-page-setup",
+                           G_CALLBACK (print_page_setup_notify),
+                           layout, 0);
+
   return layout;
 }
 
+#define SB_WIDTH 8
+
 static void
-run_page_setup_dialog (GtkWidget *widget,
-                       PrintData *data)
+print_page_setup_notify (GtkPrintOperation *operation)
 {
-  GtkPrintOperation *operation = data->operation;
-  GtkPrintSettings  *settings;
-  GtkPageSetup      *page_setup;
-  GtkWidget         *toplevel;
-
-  /* find a transient parent if possible */
-  toplevel = gtk_widget_get_toplevel (widget);
-  if (! GTK_WIDGET_TOPLEVEL (toplevel))
-    toplevel = NULL;
-
-  settings = gtk_print_operation_get_print_settings (operation);
-  if (! settings)
-    settings = gtk_print_settings_new ();
-
-  page_setup = gtk_print_operation_get_default_page_setup (operation);
-
-  page_setup = gtk_print_run_page_setup_dialog (GTK_WINDOW (toplevel),
-                                                page_setup, settings);
+  GtkPageSetup *setup;
 
-  gtk_print_operation_set_default_page_setup (operation, page_setup);
+  setup = gtk_print_operation_get_default_page_setup (operation);
 
   gimp_print_preview_set_page_setup (GIMP_PRINT_PREVIEW (info.preview),
-                                     page_setup);
+                                     setup);
 
   print_size_info_set_page_setup (&info);
 }
 
-#define SB_WIDTH 8
-
 
 static GtkWidget *
-print_size_frame (PrintData *data,
+print_size_frame (PrintData    *data,
                   GtkSizeGroup *label_group,
                   GtkSizeGroup *entry_group)
 {
@@ -901,7 +864,7 @@
 
   if (info->chain && gimp_chain_button_get_active (info->chain))
     {
-      gdouble ratio_x = page_width / (gdouble) info->image_width;
+      gdouble ratio_x = page_width  / (gdouble) info->image_width;
       gdouble ratio_y = page_height / (gdouble) info->image_height;
 
       if (ratio_x < ratio_y)

Modified: branches/weskaggs/plug-ins/print/print-settings.c
==============================================================================
--- branches/weskaggs/plug-ins/print/print-settings.c	(original)
+++ branches/weskaggs/plug-ins/print/print-settings.c	Wed Feb  6 17:19:00 2008
@@ -16,9 +16,6 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-#define PRINT_SETTINGS_MAJOR_VERSION 0
-#define PRINT_SETTINGS_MINOR_VERSION 3
-
 #include "config.h"
 
 #include <libgimp/gimp.h>
@@ -28,6 +25,10 @@
 #include "print-settings.h"
 
 
+#define PRINT_SETTINGS_MAJOR_VERSION 0
+#define PRINT_SETTINGS_MINOR_VERSION 4
+
+
 static GKeyFile * print_settings_key_file_from_settings      (PrintData         *data);
 
 static void       save_print_settings_resource_file          (GKeyFile          *settings_key_file);
@@ -117,7 +118,6 @@
   GtkPrintOperation *operation = data->operation;
   GtkPrintSettings  *settings;
   GKeyFile          *key_file  = g_key_file_new ();
-  GtkPageSetup      *page_setup;
 
   g_key_file_set_list_separator (key_file, '=');
 
@@ -130,57 +130,8 @@
   /* save the contents of the GtkPrintSettings for the operation */
   settings = gtk_print_operation_get_print_settings (operation);
   if (settings)
-    {
-      gtk_print_settings_foreach (settings, add_print_setting_to_key_file,
-                                  key_file);
-    }
-
-  /* page setup */
-  page_setup = gtk_print_operation_get_default_page_setup (operation);
-  if (page_setup)
-    {
-      GtkPaperSize       *paper_size;
-      GtkPageOrientation  orientation;
-      const gchar        *name;
-
-      orientation = gtk_page_setup_get_orientation (page_setup);
-      g_key_file_set_integer (key_file, "page-setup", "orientation",
-                              orientation);
-
-      paper_size = gtk_page_setup_get_paper_size (page_setup);
-
-      name = gtk_paper_size_get_name (paper_size);
-      if (name)
-        {
-          g_key_file_set_string (key_file, "paper-size", "name", name);
-
-          name = gtk_paper_size_get_ppd_name (paper_size);
-
-          if (name)
-            {
-              g_key_file_set_string (key_file, "paper-size", "ppd-name",
-                                     name);
-            }
-
-          if (name || gtk_paper_size_is_custom (paper_size))
-            {
-              g_key_file_set_string (key_file, "paper-size", "display-name",
-                                     gtk_paper_size_get_display_name (paper_size));
-              g_key_file_set_double (key_file, "paper-size", "width",
-                                     gtk_paper_size_get_width (paper_size,
-                                                               GTK_UNIT_POINTS));
-              g_key_file_set_double (key_file, "paper-size", "height",
-                                     gtk_paper_size_get_height (paper_size,
-                                                                GTK_UNIT_POINTS));
-            }
-        }
-    }
-
-#if 0
-  /* other settings */
-  g_key_file_set_boolean (key_file, "other-settings", "show-header",
-                          data->show_info_header);
-#endif
+    gtk_print_settings_foreach (settings, add_print_setting_to_key_file,
+                                key_file);
 
   return key_file;
 }
@@ -314,47 +265,12 @@
   return check_version (key_file);
 }
 
-static GtkPaperSize *
-load_paper_size_from_key_file (GKeyFile *key_file)
-{
-  const gchar *name;
-  const gchar *ppd_name;
-  const gchar *display_name;
-  gdouble      width;
-  gdouble      height;
-
-  name         = g_key_file_get_string (key_file, "paper-size", "name",
-                                        NULL);
-  ppd_name     = g_key_file_get_string (key_file, "paper-size", "ppd-name",
-                                        NULL);
-  display_name = g_key_file_get_string (key_file, "paper-size", "display-name",
-                                        NULL);
-  width        = g_key_file_get_double (key_file, "paper-size", "width",  NULL);
-  height       = g_key_file_get_double (key_file, "paper-size", "height", NULL);
-
-  if (ppd_name && display_name)
-    {
-      return gtk_paper_size_new_from_ppd (ppd_name,
-                                          display_name, width, height);
-    }
-
-  if (name && display_name)
-    {
-      return gtk_paper_size_new_custom (name,
-                                        display_name, width, height,
-                                        GTK_UNIT_POINTS);
-    }
-
-  return gtk_paper_size_new (name);
-}
-
 static gboolean
 load_print_settings_from_key_file (PrintData *data,
                                    GKeyFile  *key_file)
 {
   GtkPrintOperation  *operation = data->operation;
   GtkPrintSettings   *settings;
-  GtkPageSetup       *page_setup;
   gchar             **keys;
   gsize               n_keys;
   gint                i;
@@ -383,34 +299,6 @@
 
   g_strfreev (keys);
 
-  /* page setup parameters */
-
-  page_setup = gtk_print_operation_get_default_page_setup (operation);
-  if (! page_setup)
-    page_setup = gtk_page_setup_new ();
-
-  if (g_key_file_has_key (key_file, "paper-size", "name", NULL))
-    {
-      GtkPaperSize *paper_size = load_paper_size_from_key_file (key_file);
-
-      gtk_page_setup_set_paper_size_and_default_margins (page_setup,
-                                                         paper_size);
-    }
-
-  if (g_key_file_has_key (key_file, "page-setup", "orientation", NULL))
-    {
-      GtkPageOrientation  orientation;
-
-      orientation = g_key_file_get_integer (key_file,
-                                            "page-setup", "orientation", NULL);
-      gtk_page_setup_set_orientation (page_setup, orientation);
-      gtk_print_settings_set_orientation (settings, orientation);
-      data->orientation = orientation;
-    }
-
-  gtk_print_operation_set_default_page_setup (operation, page_setup);
-  g_object_unref (page_setup);
-
   if (g_key_file_has_key (key_file, "image-setup", "unit", NULL))
     {
       data->unit = g_key_file_get_integer (key_file,
@@ -447,20 +335,6 @@
                                                     "image-setup", "use-full-page", NULL);
     }
 
-#if 0
-  /* other settings */
-  if (g_key_file_has_key (key_file, "other-settings", "show-header", NULL))
-    {
-      data->show_info_header = g_key_file_get_boolean (key_file,
-                                                       "other-settings",
-                                                       "show-header", NULL);
-    }
-  else
-#endif
-    {
-      data->show_info_header = FALSE;
-    }
-
   gtk_print_operation_set_print_settings (operation, settings);
 
   return TRUE;

Modified: branches/weskaggs/plug-ins/print/print.c
==============================================================================
--- branches/weskaggs/plug-ins/print/print.c	(original)
+++ branches/weskaggs/plug-ins/print/print.c	Wed Feb  6 17:19:00 2008
@@ -26,13 +26,17 @@
 #include "print.h"
 #include "print-settings.h"
 #include "print-page-layout.h"
+#include "print-page-setup.h"
 #include "print-draw-page.h"
 
 #include "libgimp/stdplugins-intl.h"
 
 
-#define PRINT_PROC_NAME  "file-print-gtk"
-#define PLUG_IN_BINARY   "print"
+#define PLUG_IN_BINARY        "print"
+
+#define PRINT_PROC_NAME       "file-print-gtk"
+#define PAGE_SETUP_PROC_NAME  "file-print-gtk-page-setup"
+#define PRINT_TEMP_PROC_NAME  "file-print-gtk-page-setup-notify-temp"
 
 
 static void        query (void);
@@ -42,8 +46,9 @@
                           gint              *nreturn_vals,
                           GimpParam        **return_vals);
 
-static gboolean    print_image              (gint32             image_ID,
+static GimpPDBStatusType  print_image       (gint32             image_ID,
                                              gboolean           interactive);
+static GimpPDBStatusType  page_setup        (gint32             image_ID);
 
 static void        print_show_error         (const gchar       *message,
                                              gboolean           interactive);
@@ -64,6 +69,14 @@
 static GtkWidget * create_custom_widget     (GtkPrintOperation *operation,
                                              PrintData         *data);
 
+static gchar     * print_temp_proc_name     (gint32             image_ID);
+static gchar     * print_temp_proc_install  (gint32             image_ID);
+
+
+/*  Keep a reference to the current GtkPrintOperation
+ *  for access by the temporary procedure.
+ */
+static GtkPrintOperation *print_operation = NULL;
 
 
 const GimpPlugInInfo PLUG_IN_INFO =
@@ -89,7 +102,7 @@
                           N_("Print the image"),
                           "Print the image using the GTK+ Print API.",
                           "Bill Skaggs, Sven Neumann, Stefan RÃllin",
-                          "Bill Skaggs  <weskaggs primate ucdavis edu>",
+                          "Bill Skaggs <weskaggs primate ucdavis edu>",
                           "2006, 2007",
                           N_("_Print..."),
                           "*",
@@ -101,6 +114,20 @@
   gimp_plugin_icon_register (PRINT_PROC_NAME, GIMP_ICON_TYPE_STOCK_ID,
                              (const guint8 *) GTK_STOCK_PRINT);
 
+  gimp_install_procedure (PAGE_SETUP_PROC_NAME,
+                          N_("Adjust page size and orientation for printing"),
+                          "Adjust page size and orientation for printing for "
+                          "printing the image using the GTK+ Print API.",
+                          "Bill Skaggs, Sven Neumann, Stefan RÃllin",
+                          "Sven Neumann <sven gimp org>",
+                          "2008",
+                          N_("Page Set_up"),
+                          "*",
+                          GIMP_PLUGIN,
+                          G_N_ELEMENTS (print_args), 0,
+                          print_args, NULL);
+
+  gimp_plugin_menu_register (PAGE_SETUP_PROC_NAME, "<Image>/File/Send");
 }
 
 static void
@@ -112,9 +139,8 @@
 {
   static GimpParam  values[2];
   GimpRunMode       run_mode;
-  GimpPDBStatusType status = GIMP_PDB_SUCCESS;
+  GimpPDBStatusType status;
   gint32            image_ID;
-  gint32            drawable_ID;
 
   run_mode = param[0].data.d_int32;
 
@@ -123,21 +149,26 @@
   *nreturn_vals = 1;
   *return_vals  = values;
 
+  g_thread_init (NULL);
+
   values[0].type          = GIMP_PDB_STATUS;
   values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;
 
-  image_ID    = param[1].data.d_int32;
-  drawable_ID = param[2].data.d_int32;
+  image_ID = param[1].data.d_int32;
 
   if (strcmp (name, PRINT_PROC_NAME) == 0)
     {
-      g_thread_init (NULL);
-
-      gimp_ui_init (PLUG_IN_BINARY, FALSE);
-
-      if (! print_image (image_ID, run_mode == GIMP_RUN_INTERACTIVE))
+      status = print_image (image_ID, run_mode == GIMP_RUN_INTERACTIVE);
+    }
+  else if (strcmp (name, PAGE_SETUP_PROC_NAME) == 0)
+    {
+      if (run_mode == GIMP_RUN_INTERACTIVE)
         {
-          status = GIMP_PDB_EXECUTION_ERROR;
+          status = page_setup (image_ID);
+        }
+      else
+        {
+          status = GIMP_PDB_CALLING_ERROR;
         }
     }
   else
@@ -148,7 +179,7 @@
   values[0].data.d_status = status;
 }
 
-static gboolean
+static GimpPDBStatusType
 print_image (gint32    image_ID,
              gboolean  interactive)
 {
@@ -156,6 +187,7 @@
   GError            *error         = NULL;
   gint32             orig_image_ID = image_ID;
   gint32             drawable_ID   = gimp_image_get_active_drawable (image_ID);
+  gchar             *temp_proc;
   PrintData          data;
   GimpExportReturn   export;
 
@@ -165,12 +197,14 @@
                               GIMP_EXPORT_CAN_HANDLE_ALPHA);
 
   if (export == GIMP_EXPORT_CANCEL)
-    return FALSE;
+    return GIMP_PDB_EXECUTION_ERROR;
 
   operation = gtk_print_operation_new ();
 
   print_operation_set_name (operation, orig_image_ID);
 
+  print_page_setup_load (operation, orig_image_ID);
+
   /* fill in the PrintData struct */
   data.num_pages     = 1;
   data.image_id      = orig_image_ID;
@@ -200,8 +234,14 @@
                     G_CALLBACK (end_print),
                     &image_ID);
 
+  print_operation = operation;
+  temp_proc = print_temp_proc_install (orig_image_ID);
+  gimp_extension_enable ();
+
   if (interactive)
     {
+      gimp_ui_init (PLUG_IN_BINARY, FALSE);
+
       g_signal_connect_swapped (operation, "end-print",
                                 G_CALLBACK (save_print_settings),
                                 &data);
@@ -223,6 +263,10 @@
                                NULL, &error);
     }
 
+  gimp_uninstall_temp_proc (temp_proc);
+  g_free (temp_proc);
+  print_operation = NULL;
+
   g_object_unref (operation);
 
   if (gimp_image_is_valid (image_ID))
@@ -234,7 +278,43 @@
       g_error_free (error);
     }
 
-  return TRUE;
+  return GIMP_PDB_SUCCESS;
+}
+
+static GimpPDBStatusType
+page_setup (gint32 image_ID)
+{
+  GtkPrintOperation *operation;
+  gchar             *name;
+
+  gimp_ui_init (PLUG_IN_BINARY, FALSE);
+
+  operation = gtk_print_operation_new ();
+
+  print_page_setup_load (operation, image_ID);
+  print_page_setup_dialog (operation);
+  print_page_setup_save (operation);
+
+  g_object_unref (operation);
+
+  /* now notify a running print procedure about this change */
+  name = print_temp_proc_name (image_ID);
+
+  if (name)
+    {
+      GimpParam *return_vals;
+      gint       n_return_vals;
+
+      return_vals = gimp_run_procedure (name,
+                                        &n_return_vals,
+                                        GIMP_PDB_IMAGE, image_ID,
+                                        GIMP_PDB_END);
+      gimp_destroy_params (return_vals, n_return_vals);
+
+      g_free (name);
+    }
+
+  return GIMP_PDB_SUCCESS;
 }
 
 static void
@@ -320,3 +400,54 @@
 {
   return print_page_layout_gui (data);
 }
+
+static void
+print_temp_proc_run (const gchar      *name,
+                     gint              nparams,
+                     const GimpParam  *param,
+                     gint             *nreturn_vals,
+                     GimpParam       **return_vals)
+{
+  static GimpParam  values[1];
+
+  values[0].type          = GIMP_PDB_STATUS;
+  values[0].data.d_status = GIMP_PDB_SUCCESS;
+
+  *nreturn_vals = 1;
+  *return_vals  = values;
+
+  if (print_operation && nparams == 1)
+    print_page_setup_load (print_operation, param[0].data.d_int32);
+}
+
+static gchar *
+print_temp_proc_name (gint32 image_ID)
+{
+  return g_strdup_printf (PRINT_TEMP_PROC_NAME "-%d", image_ID);
+}
+
+static gchar *
+print_temp_proc_install (gint32  image_ID)
+{
+  static const GimpParamDef args[] =
+  {
+    { GIMP_PDB_IMAGE, "image", "Image to print" }
+  };
+
+  gchar *name = print_temp_proc_name (image_ID);
+
+  gimp_install_temp_proc (name,
+                          "DON'T USE THIS ONE",
+                          "Temporary procedure to notify the Print plug-in "
+                          "about changes to the Page Setup.",
+			  "Sven Neumann",
+			  "Sven Neumann",
+			  "2008",
+                          NULL,
+                          "",
+                          GIMP_TEMPORARY,
+                          G_N_ELEMENTS (args), 0, args, NULL,
+                          print_temp_proc_run);
+
+  return name;
+}

Modified: branches/weskaggs/plug-ins/print/print.h
==============================================================================
--- branches/weskaggs/plug-ins/print/print.h	(original)
+++ branches/weskaggs/plug-ins/print/print.h	Wed Feb  6 17:19:00 2008
@@ -30,7 +30,6 @@
   gint32              image_id;
   gint32              drawable_id;
   GimpUnit            unit;
-  gboolean            show_info_header;
   gdouble             xres;
   gdouble             yres;
   GimpUnit            image_unit;

Modified: branches/weskaggs/plug-ins/script-fu/script-fu.c
==============================================================================
--- branches/weskaggs/plug-ins/script-fu/script-fu.c	(original)
+++ branches/weskaggs/plug-ins/script-fu/script-fu.c	Wed Feb  6 17:19:00 2008
@@ -113,7 +113,7 @@
                           "Spencer Kimball & Peter Mattis",
                           "Spencer Kimball & Peter Mattis",
                           "1997",
-                          N_("Script-Fu _Console"),
+                          N_("_Console"),
                           NULL,
                           GIMP_PLUGIN,
                           G_N_ELEMENTS (console_args), 0,

Modified: branches/weskaggs/po/POTFILES.in
==============================================================================
--- branches/weskaggs/po/POTFILES.in	(original)
+++ branches/weskaggs/po/POTFILES.in	Wed Feb  6 17:19:00 2008
@@ -103,14 +103,21 @@
 app/core/gimpdata.c
 app/core/gimpdatafactory.c
 app/core/gimpdrawable-blend.c
+app/core/gimpdrawable-brightness-contrast.c
 app/core/gimpdrawable-bucket-fill.c
+app/core/gimpdrawable-color-balance.c
+app/core/gimpdrawable-colorize.c
+app/core/gimpdrawable-curves.c
 app/core/gimpdrawable-desaturate.c
 app/core/gimpdrawable-equalize.c
 app/core/gimpdrawable-foreground-extract.c
+app/core/gimpdrawable-hue-saturation.c
 app/core/gimpdrawable-invert.c
 app/core/gimpdrawable-levels.c
 app/core/gimpdrawable-offset.c
+app/core/gimpdrawable-posterize.c
 app/core/gimpdrawable-stroke.c
+app/core/gimpdrawable-threshold.c
 app/core/gimpdrawable-transform.c
 app/core/gimpdrawable.c
 app/core/gimpgradient-load.c
@@ -326,6 +333,7 @@
 app/tools/gimppenciltool.c
 app/tools/gimpperspectiveclonetool.c
 app/tools/gimpperspectivetool.c
+app/tools/gimppolygonselecttool.c
 app/tools/gimpposterizetool.c
 app/tools/gimprectangleoptions.c
 app/tools/gimprectangleselectoptions.c

Modified: branches/weskaggs/themes/Default/images/Makefile.am
==============================================================================
--- branches/weskaggs/themes/Default/images/Makefile.am	(original)
+++ branches/weskaggs/themes/Default/images/Makefile.am	Wed Feb  6 17:19:00 2008
@@ -52,6 +52,7 @@
 	stock-flip-horizontal-16.png			\
 	stock-flip-vertical-16.png			\
 	stock-floating-selection-16.png			\
+	stock-gegl-16.png				\
 	stock-gradient-bilinear-16.png			\
 	stock-gradient-conical-asymmetric-16.png	\
 	stock-gradient-conical-symmetric-16.png		\
@@ -159,6 +160,7 @@
 	stock-edit-16.png			\
 	stock-eye-20.png			\
 	stock-floating-selection-24.png		\
+	stock-gegl-24.png			\
 	stock-gravity-east-24.png		\
 	stock-gravity-north-24.png		\
 	stock-gravity-north-east-24.png		\

Modified: branches/weskaggs/themes/Default/images/tools/stock-tool-polygon-select-22.png
==============================================================================
Binary files. No diff available.

Modified: branches/weskaggs/tools/pdbgen/pdb/color.pdb
==============================================================================
--- branches/weskaggs/tools/pdbgen/pdb/color.pdb	(original)
+++ branches/weskaggs/tools/pdbgen/pdb/color.pdb	Wed Feb  6 17:19:00 2008
@@ -39,62 +39,16 @@
     );
 
     %invoke = (
+        headers => [ qw("core/gimpdrawable-brightness-contrast.h") ],
 	code => <<'CODE'
 {
-  if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
+  if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) ||
       gimp_drawable_is_indexed (drawable))
     success = FALSE;
 
   if (success)
-    {
-  if (gimp_use_gegl (gimp))
-    {
-      GeglNode *node = g_object_new (GEGL_TYPE_NODE,
-                                     "operation",  "brightness-contrast",
-                                     NULL);
-
-      gegl_node_set (node,
-                     "brightness", brightness / 127.0,
-                     "contrast",   (contrast < 0 ?
-                                    (contrast + 127.0) / 127.0 :
-                                    contrast * 4.0 / 127.0 + 1),
-                     NULL);
-
-      gimp_drawable_apply_operation (drawable, node, TRUE,
-                                     progress, _("Brightness-Contrast"));
-
-      g_object_unref (node);
-    }
-  else
-    {
-      gint x, y, width, height;
-
-      /* The application should occur only within selection bounds */
-      if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
-        {
-          GimpLut     *lut;
-          PixelRegion  srcPR, destPR;
-
-          lut = brightness_contrast_lut_new (brightness / 255.0,
-                                             contrast / 127.0,
-                                             gimp_drawable_bytes (drawable));
-
-          pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
-                             x, y, width, height, FALSE);
-          pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
-                             x, y, width, height, TRUE);
-
-          pixel_regions_process_parallel ((PixelProcessorFunc)
-                                          gimp_lut_process,
-                                          lut, 2, &srcPR, &destPR);
-
-          gimp_lut_free (lut);
-
-          gimp_drawable_merge_shadow (drawable, TRUE, _("Brightness-Contrast"));
-          gimp_drawable_update (drawable, x, y, width, height);
-        }
-    }
-    }
+    gimp_drawable_brightness_contrast (drawable, progress,
+                                       brightness, contrast);
 }
 CODE
     );
@@ -140,7 +94,7 @@
 	headers => [ qw("core/gimpdrawable-levels.h") ],
 	code => <<'CODE'
 {
-  if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
+  if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) ||
       gimp_drawable_is_indexed (drawable) ||
       (! gimp_drawable_has_alpha (drawable) &&
        channel == GIMP_HISTOGRAM_ALPHA) ||
@@ -179,11 +133,10 @@
     );
 
     %invoke = (
-        headers => [ qw("core/gimpdrawable-histogram.h"
-                        "core/gimpdrawable-levels.h") ],
+        headers => [ qw("core/gimpdrawable-levels.h") ],
         code => <<'CODE'
 {
-  if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
+  if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) ||
       gimp_drawable_is_indexed (drawable))
     success = FALSE;
 
@@ -203,11 +156,10 @@
     );
 
     %invoke = (
-        headers => [ qw("core/gimpdrawable-histogram.h"
-                        "core/gimpdrawable-levels.h") ],
+        headers => [ qw("core/gimpdrawable-levels.h") ],
         code => <<'CODE'
 {
-  if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
+  if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) ||
       gimp_drawable_is_indexed (drawable))
     success = FALSE;
 
@@ -237,57 +189,15 @@
     );
 
     %invoke = (
+        headers => [ qw("core/gimpdrawable-posterize.h") ],
 	code => <<'CODE'
 {
-  if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
+  if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) ||
       gimp_drawable_is_indexed (drawable))
     success = FALSE;
 
   if (success)
-    {
-  if (gimp_use_gegl (gimp))
-    {
-      GeglNode *node = g_object_new (GEGL_TYPE_NODE,
-                                     "operation", "gimp-posterize",
-                                     NULL);
-
-      gegl_node_set (node,
-                     "levels", levels,
-                     NULL);
-
-      gimp_drawable_apply_operation (drawable, node, TRUE,
-                                     progress, _("Levels"));
-
-      g_object_unref (node);
-    }
-  else
-    {
-      gint x, y, width, height;
-
-      /* The application should occur only within selection bounds */
-      if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
-        {
-          GimpLut     *lut;
-          PixelRegion  srcPR, destPR;
-
-          lut = posterize_lut_new (levels, gimp_drawable_bytes (drawable));
-
-          pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
-                             x, y, width, height, FALSE);
-          pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
-                             x, y, width, height, TRUE);
-
-          pixel_regions_process_parallel ((PixelProcessorFunc)
-                                          gimp_lut_process,
-                                          lut, 2, &srcPR, &destPR);
-
-          gimp_lut_free (lut);
-
-          gimp_drawable_merge_shadow (drawable, TRUE, _("Posterize"));
-          gimp_drawable_update (drawable, x, y, width, height);
-        }
-    }
-    }
+    gimp_drawable_posterize (drawable, progress, levels);
 }
 CODE
     );
@@ -312,7 +222,7 @@
 	headers => [ qw("core/gimpdrawable-desaturate.h") ],
 	code => <<'CODE'
 {
-  if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
+  if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) ||
       ! gimp_drawable_is_rgb (drawable))
     success = FALSE;
 
@@ -349,7 +259,7 @@
 	headers => [ qw("core/gimpdrawable-desaturate.h") ],
 	code => <<'CODE'
 {
-  if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
+  if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) ||
       ! gimp_drawable_is_rgb (drawable))
     success = FALSE;
 
@@ -386,7 +296,7 @@
 	headers => [ qw("core/gimpdrawable-equalize.h") ],
 	code => <<'CODE'
 {
-  if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
+  if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) ||
       gimp_drawable_is_indexed (drawable))
     success = FALSE;
 
@@ -417,7 +327,7 @@
 	headers => [ qw("core/gimpdrawable-invert.h") ],
 	code => <<'CODE'
 {
-  if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
+  if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) ||
       gimp_drawable_is_indexed (drawable))
     success = FALSE;
 
@@ -456,10 +366,10 @@
     );
 
     %invoke = (
-	headers => [ qw("base/curves.h" "core/gimpcurve.h") ],
+	headers => [ qw("core/gimpdrawable-curves.h") ],
 	code => <<'CODE'
 {
-  if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
+  if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) ||
       gimp_drawable_is_indexed (drawable) || (num_points & 1) ||
       (! gimp_drawable_has_alpha (drawable) &&
        channel == GIMP_HISTOGRAM_ALPHA) ||
@@ -468,65 +378,8 @@
     success = FALSE;
 
   if (success)
-    {
-      gint x, y, width, height;
-
-      /* The application should occur only within selection bounds */
-      if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
-        {
-          GimpCurve   *curve;
-          Curves       c;
-          gint         j;
-          PixelRegion  srcPR, destPR;
-          GimpLut     *lut;
-
-          /* FIXME: hack */
-          if (gimp_drawable_is_gray (drawable) &&
-              channel == GIMP_HISTOGRAM_ALPHA)
-            channel = 1;
-
-          lut = gimp_lut_new ();
-
-          curves_init (&c);
-
-          curve = GIMP_CURVE (gimp_curve_new ("curves_spline"));
-
-          gimp_data_freeze (GIMP_DATA (curve));
-
-          /*  unset the last point  */
-          gimp_curve_set_point (curve, GIMP_CURVE_NUM_POINTS - 1, -1, -1);
-
-          for (j = 0; j < num_points / 2; j++)
-            gimp_curve_set_point (curve, j,
-                                  control_pts[j * 2],
-                                  control_pts[j * 2 + 1]);
-
-          gimp_data_thaw (GIMP_DATA (curve));
-
-          gimp_curve_get_uchar (curve, c.curve[channel]);
-
-          g_object_unref (curve);
-
-          gimp_lut_setup (lut,
-                          (GimpLutFunc) curves_lut_func,
-                          &c,
-                          gimp_drawable_bytes (drawable));
-
-          pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
-                             x, y, width, height, FALSE);
-          pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
-                             x, y, width, height, TRUE);
-
-          pixel_regions_process_parallel ((PixelProcessorFunc)
-                                          gimp_lut_process,
-                                          lut, 2, &srcPR, &destPR);
-
-          gimp_lut_free (lut);
-
-          gimp_drawable_merge_shadow (drawable, TRUE, _("Curves"));
-          gimp_drawable_update (drawable, x, y, width, height);
-        }
-    }
+    gimp_drawable_curves_spline (drawable, progress,
+                                 channel, control_pts, num_points);
 }
 CODE
     );
@@ -559,10 +412,10 @@
     );
 
     %invoke = (
-	headers => [ qw("base/curves.h") ],
+	headers => [ qw("core/gimpdrawable-curves.h") ],
 	code => <<'CODE'
 {
-  if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
+  if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) ||
       gimp_drawable_is_indexed (drawable) || (num_bytes != 256) ||
       (! gimp_drawable_has_alpha (drawable) &&
        channel == GIMP_HISTOGRAM_ALPHA) ||
@@ -571,49 +424,8 @@
     success = FALSE;
 
   if (success)
-    {
-      gint x, y, width, height;
-
-      /* The application should occur only within selection bounds */
-      if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
-        {
-          Curves       c;
-          gint         j;
-          PixelRegion  srcPR, destPR;
-          GimpLut     *lut;
-
-          /* FIXME: hack */
-          if (gimp_drawable_is_gray (drawable) &&
-              channel == GIMP_HISTOGRAM_ALPHA)
-            channel = 1;
-
-          lut = gimp_lut_new ();
-
-          curves_init (&c);
-
-          for (j = 0; j < 256; j++)
-            c.curve[channel][j] = curve[j];
-
-          gimp_lut_setup (lut,
-                          (GimpLutFunc) curves_lut_func,
-                          &c,
-                          gimp_drawable_bytes (drawable));
-
-          pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
-                             x, y, width, height, FALSE);
-          pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
-                             x, y, width, height, TRUE);
-
-          pixel_regions_process_parallel ((PixelProcessorFunc)
-                                          gimp_lut_process,
-                                          lut, 2, &srcPR, &destPR);
-
-          gimp_lut_free (lut);
-
-          gimp_drawable_merge_shadow (drawable, TRUE, _("Curves"));
-          gimp_drawable_update (drawable, x, y, width, height);
-        }
-    }
+    gimp_drawable_curves_explicit (drawable, progress,
+                                   channel, curve, num_bytes);
 }
 CODE
     );
@@ -651,45 +463,18 @@
     );
 
     %invoke = (
-	headers => [ qw("base/color-balance.h") ],
+	headers => [ qw("core/gimpdrawable-color-balance.h") ],
 	code => <<'CODE'
 {
-  if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
+  if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) ||
       gimp_drawable_is_indexed (drawable))
     success = FALSE;
 
   if (success)
-    {
-      gint x, y, width, height;
-
-      /* The application should occur only within selection bounds */
-      if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
-        {
-          ColorBalance  cb;
-          PixelRegion   srcPR, destPR;
-
-          color_balance_init (&cb);
-
-          cb.preserve_luminosity = preserve_lum;
-
-          cb.cyan_red[transfer_mode]      = cyan_red;
-          cb.magenta_green[transfer_mode] = magenta_green;
-          cb.yellow_blue[transfer_mode]   = yellow_blue;
-
-          color_balance_create_lookup_tables (&cb);
-
-          pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
-                             x, y, width, height, FALSE);
-          pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
-                             x, y, width, height, TRUE);
-
-          pixel_regions_process_parallel ((PixelProcessorFunc) color_balance,
-                                          &cb, 2, &srcPR, &destPR);
-
-          gimp_drawable_merge_shadow (drawable, TRUE, _("Color Balance"));
-          gimp_drawable_update (drawable, x, y, width, height);
-        }
-    }
+    gimp_drawable_color_balance (drawable, progress,
+                                 transfer_mode,
+                                 cyan_red, magenta_green, yellow_blue,
+                                 preserve_lum);
 }
 CODE
     );
@@ -718,63 +503,16 @@
     );
 
     %invoke = (
-	headers => [ qw("base/colorize.h") ],
+	headers => [ qw("core/gimpdrawable-colorize.h") ],
 	code => <<'CODE'
 {
-  if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
+  if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) ||
       ! gimp_drawable_is_rgb (drawable))
     success = FALSE;
 
   if (success)
-    {
-  if (gimp_use_gegl (gimp))
-    {
-      GeglNode *node = g_object_new (GEGL_TYPE_NODE,
-                                     "operation", "gimp-colorize",
-                                     NULL);
-
-      gegl_node_set (node,
-                     "hue",        hue,
-                     "saturation", saturation,
-                     "lightness",  lightness,
-                     NULL);
-
-      gimp_drawable_apply_operation (drawable, node, TRUE,
-                                     progress, _("Colorize"));
-
-      g_object_unref (node);
-    }
-  else
-    {
-      gint x, y, width, height;
-
-      /* The application should occur only within selection bounds */
-      if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
-        {
-          Colorize     colors;
-          PixelRegion  srcPR, destPR;
-
-          colorize_init (&colors);
-
-          colors.hue        = hue;
-          colors.saturation = saturation;
-          colors.lightness  = lightness;
-
-          colorize_calculate (&colors);
-
-          pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
-                             x, y, width, height, FALSE);
-          pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
-                             x, y, width, height, TRUE);
-
-          pixel_regions_process_parallel ((PixelProcessorFunc) colorize,
-                                          &colors, 2, &srcPR, &destPR);
-
-          gimp_drawable_merge_shadow (drawable, TRUE, _("Colorize"));
-          gimp_drawable_update (drawable, x, y, width, height);
-        }
-    }
-    }
+    gimp_drawable_colorize (drawable, progress,
+                            hue, saturation, lightness);
 }
 CODE
     );
@@ -828,10 +566,11 @@
     );
 
     %invoke = (
-	headers => [ qw("core/gimpdrawable-histogram.h") ],
+	headers => [ qw("base/gimphistogram.h"
+                        "core/gimpdrawable-histogram.h") ],
 	code => <<'CODE'
 {
-  if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
+  if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) ||
       gimp_drawable_is_indexed (drawable) ||
       (! gimp_drawable_has_alpha (drawable) &&
        channel == GIMP_HISTOGRAM_ALPHA) ||
@@ -856,7 +595,7 @@
                                              start_range, end_range);
       percentile = count / pixels;
 
-      gimp_histogram_free (histogram);
+      gimp_histogram_unref (histogram);
     }
 }
 CODE
@@ -891,44 +630,16 @@
     );
 
     %invoke = (
-	headers => [ qw("base/hue-saturation.h") ],
+	headers => [ qw("core/gimpdrawable-hue-saturation.h") ],
 	code => <<'CODE'
 {
-  if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
+  if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) ||
       gimp_drawable_is_indexed (drawable))
     success = FALSE;
 
   if (success)
-    {
-      gint x, y, width, height;
-
-      /* The application should occur only within selection bounds */
-      if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
-        {
-          HueSaturation  hs;
-          PixelRegion    srcPR, destPR;
-
-          hue_saturation_init (&hs);
-
-          hs.hue[hue_range]        = hue_offset;
-          hs.lightness[hue_range]  = lightness;
-          hs.saturation[hue_range] = saturation;
-
-          /* Calculate the transfer arrays */
-          hue_saturation_calculate_transfers (&hs);
-
-          pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
-                             x, y, width, height, FALSE);
-          pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
-                             x, y, width, height, TRUE);
-
-	  pixel_regions_process_parallel ((PixelProcessorFunc) hue_saturation,
-                                          &hs, 2, &srcPR, &destPR);
-
-          gimp_drawable_merge_shadow (drawable, TRUE, _("Hue-Saturation"));
-          gimp_drawable_update (drawable, x, y, width, height);
-        }
-    }
+    gimp_drawable_hue_saturation (drawable, progress,
+                                  hue_range, hue_offset, saturation, lightness);
 }
 CODE
     );
@@ -956,59 +667,17 @@
     );
 
     %invoke = (
-	headers => [ qw("base/threshold.h") ],
+	headers => [ qw("core/gimpdrawable-threshold.h") ],
 	code => <<'CODE'
 {
-  if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
+  if (! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) ||
       gimp_drawable_is_indexed (drawable) ||
       (low_threshold > high_threshold))
     success = FALSE;
 
   if (success)
-    {
-  if (gimp_use_gegl (gimp))
-    {
-      GeglNode *node = g_object_new (GEGL_TYPE_NODE,
-                                     "operation", "gimp-threshold",
-                                     NULL);
-
-      gegl_node_set (node,
-                     "low",  low_threshold  / 255.0,
-                     "high", high_threshold / 255.0,
-                     NULL);
-
-      gimp_drawable_apply_operation (drawable, node, TRUE,
-                                     progress, _("Threshold"));
-
-      g_object_unref (node);
-    }
-  else
-    {
-      gint x, y, width, height;
-
-      /* The application should occur only within selection bounds */
-      if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
-        {
-          Threshold   tr;
-          PixelRegion srcPR, destPR;
-
-          tr.color          = gimp_drawable_is_rgb (drawable);
-          tr.low_threshold  = low_threshold;
-          tr.high_threshold = high_threshold;
-
-          pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
-                             x, y, width, height, FALSE);
-          pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
-                             x, y, width, height, TRUE);
-
-          pixel_regions_process_parallel ((PixelProcessorFunc) threshold,
-                                          &tr, 2, &srcPR, &destPR);
-
-          gimp_drawable_merge_shadow (drawable, TRUE, _("Threshold"));
-          gimp_drawable_update (drawable, x, y, width, height);
-        }
-    }
-    }
+    gimp_drawable_threshold (drawable, progress,
+                             low_threshold, high_threshold);
 }
 CODE
     );
@@ -1016,15 +685,8 @@
 
 
 @headers = qw(<gegl.h>
-              "base/gimphistogram.h"
-              "base/gimplut.h"
-              "base/lut-funcs.h"
-              "base/pixel-region.h"
-              "base/pixel-processor.h"
-              "core/gimp.h"
               "core/gimpdrawable.h"
-              "core/gimpdrawable-operation.h"
-              "core/gimpimage.h"
+              "gimppdb-utils.h"
               "gimp-intl.h");
 
 @procs = qw(brightness_contrast

Modified: branches/weskaggs/tools/pdbgen/pdb/drawable.pdb
==============================================================================
--- branches/weskaggs/tools/pdbgen/pdb/drawable.pdb	(original)
+++ branches/weskaggs/tools/pdbgen/pdb/drawable.pdb	Wed Feb  6 17:19:00 2008
@@ -70,7 +70,7 @@
 	headers => [ qw("plug-in/gimpplugin.h" "plug-in/gimppluginmanager.h") ],
 	code    => <<'CODE'
 {
-  if (gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     {
       const gchar *undo_desc = _("Plug-In");
 
@@ -1186,7 +1186,7 @@
     %invoke = (
 	code => <<'CODE'
 {
-  if (gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     gimp_drawable_offset (drawable, context, wrap_around, fill_type,
                           offset_x, offset_y);
   else
@@ -1254,7 +1254,7 @@
 	headers => [ qw("core/gimpdrawable-foreground-extract.h") ],
         code    => <<'CODE'
 {
-  if (gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     gimp_drawable_foreground_extract (drawable, mode, mask, progress);
   else
     success = FALSE;
@@ -1272,6 +1272,7 @@
               "core/gimpdrawable-offset.h"
               "core/gimplayer.h"
               "core/gimplayermask.h"
+              "gimppdb-utils.h"
               "gimp-intl.h");
 
 @procs = qw(drawable_is_valid

Modified: branches/weskaggs/tools/pdbgen/pdb/drawable_transform.pdb
==============================================================================
--- branches/weskaggs/tools/pdbgen/pdb/drawable_transform.pdb	(original)
+++ branches/weskaggs/tools/pdbgen/pdb/drawable_transform.pdb	Wed Feb  6 17:19:00 2008
@@ -25,10 +25,10 @@
 
 sub transform_invoke {
     my ($progress_text, $assemble_matrix, $check) = @_;
-    my $success_check = 'gimp_item_is_attached (GIMP_ITEM (drawable));';
+    my $success_check = 'gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error);';
 
     if ($check) {
-        $success_check = "(gimp_item_is_attached (GIMP_ITEM (drawable)) && " . $check . ");";
+        $success_check = "(gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) && " . $check . ");";
     }
 
     %invoke = (
@@ -71,10 +71,10 @@
 
 sub transform_default_invoke {
     my ($progress_text, $assemble_matrix, $check) = @_;
-    my $success_check = 'gimp_item_is_attached (GIMP_ITEM (drawable));';
+    my $success_check = 'gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error);';
 
     if ($check) {
-        $success_check = "(gimp_item_is_attached (GIMP_ITEM (drawable)) && " . $check . ");";
+        $success_check = "(gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) && " . $check . ");";
     }
 
     %invoke = (
@@ -166,7 +166,7 @@
 {
   gint x, y, width, height;
 
-  success = gimp_item_is_attached (GIMP_ITEM (drawable));
+  success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error);
 
   if (success &&
       gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@@ -463,7 +463,7 @@
 {
   gint x, y, width, height;
 
-  success = gimp_item_is_attached (GIMP_ITEM (drawable));
+  success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error);
 
   if (success &&
       gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@@ -1025,10 +1025,15 @@
 }
 
 
- headers = qw("libgimpmath/gimpmath.h" "config/gimpcoreconfig.h"
-              "core/gimp.h" "core/gimp-transform-utils.h" "core/gimpimage.h"
-              "core/gimpdrawable.h" "core/gimpdrawable-transform.h"
+ headers = qw("libgimpmath/gimpmath.h"
+              "config/gimpcoreconfig.h"
+              "core/gimp.h"
+              "core/gimp-transform-utils.h"
+              "core/gimpimage.h"
+              "core/gimpdrawable.h"
+              "core/gimpdrawable-transform.h"
               "core/gimpprogress.h"
+              "gimppdb-utils.h"
               "gimp-intl.h");
 
 @procs = qw(drawable_transform_flip_simple

Modified: branches/weskaggs/tools/pdbgen/pdb/edit.pdb
==============================================================================
--- branches/weskaggs/tools/pdbgen/pdb/edit.pdb	(original)
+++ branches/weskaggs/tools/pdbgen/pdb/edit.pdb	Wed Feb  6 17:19:00 2008
@@ -45,7 +45,7 @@
     %invoke = (
 	code => <<CODE
 {
-  if (gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     {
       GimpImage *image    = gimp_item_get_image (GIMP_ITEM (drawable));
       GError    *my_error = NULL;
@@ -94,7 +94,7 @@
     %invoke = (
 	code => <<CODE
 {
-  if (gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     {
       GimpImage *image    = gimp_item_get_image (GIMP_ITEM (drawable));
       GError    *my_error = NULL;
@@ -194,7 +194,8 @@
     %invoke = (
 	code => <<CODE
 {
-  if (gimp->global_buffer && gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (gimp->global_buffer &&
+      gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     {
       floating_sel = gimp_edit_paste (gimp_item_get_image (GIMP_ITEM (drawable)),
                                       drawable, gimp->global_buffer,
@@ -271,7 +272,7 @@
     %invoke = (
 	code => <<CODE
 {
-  if (gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     {
       GimpImage *image    = gimp_item_get_image (GIMP_ITEM (drawable));
       GError    *my_error = NULL;
@@ -323,7 +324,7 @@
     %invoke = (
 	code => <<CODE
 {
-  if (gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     {
       GimpImage *image    = gimp_item_get_image (GIMP_ITEM (drawable));
       GError    *my_error = NULL;
@@ -426,7 +427,7 @@
 {
   GimpBuffer *buffer = gimp_pdb_get_buffer (gimp, buffer_name, error);
 
-  if (buffer && gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (buffer && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     {
       floating_sel = gimp_edit_paste (gimp_item_get_image (GIMP_ITEM (drawable)),
                                       drawable, buffer,
@@ -501,7 +502,7 @@
     %invoke = (
 	code => <<CODE
 {
-  if (gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     {
       GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
 
@@ -541,7 +542,7 @@
     %invoke = (
 	code => <<CODE
 {
-  if (gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     {
       GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
 
@@ -609,7 +610,7 @@
 	                 "core/gimpchannel.h") ],
 	code => <<'CODE'
 {
-  if (gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     {
       GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
       gboolean   do_seed_fill;
@@ -693,7 +694,7 @@
 	                 "core/gimpchannel.h") ],
 	code => <<'CODE'
 {
-  if (gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     {
       GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
       gboolean   do_seed_fill;
@@ -770,7 +771,7 @@
         headers => [ qw("core/gimpdrawable-blend.h") ],
 	code => <<'CODE'
 {
-  success = gimp_item_is_attached (GIMP_ITEM (drawable));
+  success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error);
 
   if (success && supersample)
     {
@@ -826,7 +827,7 @@
 	headers => [ qw("core/gimpstrokedesc.h") ],
 	code => <<'CODE'
 {
-  if (gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     {
       GimpImage      *image = gimp_item_get_image (GIMP_ITEM (drawable));
       GimpStrokeDesc *desc  = gimp_stroke_desc_new (gimp, context);
@@ -867,7 +868,7 @@
 	headers => [ qw("core/gimpstrokedesc.h") ],
 	code => <<'CODE'
 {
-  if (gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     {
       GimpStrokeDesc *desc  = gimp_stroke_desc_new (gimp, context);
 

Modified: branches/weskaggs/tools/pdbgen/pdb/floating_sel.pdb
==============================================================================
--- branches/weskaggs/tools/pdbgen/pdb/floating_sel.pdb	(original)
+++ branches/weskaggs/tools/pdbgen/pdb/floating_sel.pdb	Wed Feb  6 17:19:00 2008
@@ -150,7 +150,7 @@
     %invoke = (
 	code => <<'CODE'
 {
-  if (gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     floating_sel_attach (layer, drawable);
   else
     success = FALSE;
@@ -224,6 +224,7 @@
 
 @headers = qw("core/gimplayer-floating-sel.h"
               "gimppdberror.h"
+              "gimppdb-utils.h"
               "gimp-intl.h");
 
 @procs = qw(floating_sel_remove floating_sel_anchor floating_sel_to_layer

Modified: branches/weskaggs/tools/pdbgen/pdb/layer.pdb
==============================================================================
--- branches/weskaggs/tools/pdbgen/pdb/layer.pdb	(original)
+++ branches/weskaggs/tools/pdbgen/pdb/layer.pdb	Wed Feb  6 17:19:00 2008
@@ -185,7 +185,7 @@
     %invoke = (
 	code => <<'CODE'
 {
-  if (gimp_item_is_attached (GIMP_ITEM (layer)))
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), error))
     gimp_layer_add_mask (layer, mask, TRUE);
   else
     success = FALSE;
@@ -214,7 +214,7 @@
     %invoke = (
 	code => <<'CODE'
 {
-  if (gimp_item_is_attached (GIMP_ITEM (layer)))
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), error))
     gimp_layer_apply_mask (layer, mode, TRUE);
   else
     success = FALSE;
@@ -250,7 +250,7 @@
     %invoke = (
 	code => <<'CODE'
 {
-  if (gimp_item_is_attached (GIMP_ITEM (layer)))
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), error))
     gimp_item_scale_by_origin (GIMP_ITEM (layer), new_width, new_height,
                                gimp->config->interpolation_type, NULL,
                                local_origin);
@@ -291,7 +291,7 @@
     %invoke = (
 	code => <<'CODE'
 {
-  if (gimp_item_is_attached (GIMP_ITEM (layer)))
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), error))
     gimp_item_resize (GIMP_ITEM (layer), context,
                       new_width, new_height, offx, offy);
   else
@@ -319,7 +319,7 @@
     %invoke = (
 	code => <<'CODE'
 {
-  if (gimp_item_is_attached (GIMP_ITEM (layer)))
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), error))
     gimp_layer_resize_to_image (layer, context);
   else
     success = FALSE;
@@ -953,6 +953,7 @@
               "core/gimp.h"
               "core/gimpimage-undo.h"
               "core/gimpitem-linked.h"
+              "gimppdb-utils.h"
               "gimp-intl.h");
 
 @procs = qw(layer_new layer_new_from_drawable layer_copy

Modified: branches/weskaggs/tools/pdbgen/pdb/paint_tools.pdb
==============================================================================
--- branches/weskaggs/tools/pdbgen/pdb/paint_tools.pdb	(original)
+++ branches/weskaggs/tools/pdbgen/pdb/paint_tools.pdb	Wed Feb  6 17:19:00 2008
@@ -55,7 +55,7 @@
 {
   GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-airbrush", error);
 
-  if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
 
@@ -100,7 +100,7 @@
 {
   GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-airbrush", error);
 
-  if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
 
@@ -156,7 +156,7 @@
 {
   GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-clone", error);
 
-  if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
 
@@ -205,7 +205,7 @@
 {
   GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-clone", error);
 
-  if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
 
@@ -246,7 +246,7 @@
 {
   GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-convolve", error);
 
-  if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
 
@@ -289,7 +289,7 @@
 {
   GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-convolve", error);
 
-  if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
 
@@ -333,7 +333,7 @@
 {
   GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-eraser", error);
 
-  if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
 
@@ -377,7 +377,7 @@
 {
   GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-eraser", error);
 
-  if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
 
@@ -426,7 +426,7 @@
 {
   GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-eraser", error);
 
-  if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
 
@@ -480,7 +480,7 @@
 {
   GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-heal", error);
 
-  if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
 
@@ -525,7 +525,7 @@
 {
   GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-heal", error);
 
-  if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
 
@@ -577,7 +577,7 @@
 {
   GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-paintbrush", error);
 
-  if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
 
@@ -634,7 +634,7 @@
 {
   GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-paintbrush", error);
 
-  if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
 
@@ -674,7 +674,7 @@
 {
   GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-pencil", error);
 
-  if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
 
@@ -713,7 +713,7 @@
 {
   GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-smudge", error);
 
-  if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
 
@@ -758,7 +758,7 @@
 {
   GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-smudge", error);
 
-  if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
 
@@ -802,7 +802,7 @@
 {
   GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-dodge-burn", error);
 
-  if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
 
@@ -849,7 +849,7 @@
 {
   GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-dodge-burn", error);
 
-  if (info && gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (info && gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
 

Modified: branches/weskaggs/tools/pdbgen/pdb/selection.pdb
==============================================================================
--- branches/weskaggs/tools/pdbgen/pdb/selection.pdb	(original)
+++ branches/weskaggs/tools/pdbgen/pdb/selection.pdb	Wed Feb  6 17:19:00 2008
@@ -184,7 +184,7 @@
     %invoke = (
 	code => <<'CODE'
 {
-  if (gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     {
       GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
 
@@ -548,7 +548,9 @@
 }
 
 
- headers = qw("core/gimpchannel-select.h" "core/gimppickable.h"
+ headers = qw("core/gimpchannel-select.h"
+              "core/gimppickable.h"
+              "gimppdb-utils.h"
               "gimp-intl.h");
 
 @procs = qw(selection_bounds selection_value selection_is_empty

Modified: branches/weskaggs/tools/pdbgen/pdb/text_tool.pdb
==============================================================================
--- branches/weskaggs/tools/pdbgen/pdb/text_tool.pdb	(original)
+++ branches/weskaggs/tools/pdbgen/pdb/text_tool.pdb	Wed Feb  6 17:19:00 2008
@@ -73,7 +73,7 @@
     %invoke = (
         code => <<'CODE'
 {
-  if (drawable && ! gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (drawable && ! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     success = FALSE;
 
   if (success)
@@ -193,7 +193,7 @@
     %invoke = (
         code => <<'CODE'
 {
-  if (drawable && ! gimp_item_is_attached (GIMP_ITEM (drawable)))
+  if (drawable && ! gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     success = FALSE;
 
   if (success)
@@ -266,7 +266,9 @@
 }
 
 
- headers = qw("libgimpbase/gimpbase.h" "text/gimptext-compat.h");
+ headers = qw("libgimpbase/gimpbase.h"
+              "text/gimptext-compat.h"
+              "gimppdb-utils.h");
 
 @procs = qw(text_fontname text_get_extents_fontname
             text text_get_extents);

Modified: branches/weskaggs/tools/pdbgen/pdb/transform_tools.pdb
==============================================================================
--- branches/weskaggs/tools/pdbgen/pdb/transform_tools.pdb	(original)
+++ branches/weskaggs/tools/pdbgen/pdb/transform_tools.pdb	Wed Feb  6 17:19:00 2008
@@ -38,7 +38,7 @@
 {
   gint x, y, width, height;
 
-  success = gimp_item_is_attached (GIMP_ITEM (drawable));
+  success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error);
 
   if (success &&
       gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@@ -95,7 +95,7 @@
 {
   gint x, y, width, height;
 
-  success = gimp_item_is_attached (GIMP_ITEM (drawable));
+  success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error);
 
   if (success &&
       gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@@ -159,7 +159,7 @@
 {
   gint x, y, width, height;
 
-  success = gimp_item_is_attached (GIMP_ITEM (drawable));
+  success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error);
 
   if (success &&
       gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@@ -232,7 +232,7 @@
 {
   gint x, y, width, height;
 
-  success = (gimp_item_is_attached (GIMP_ITEM (drawable)) &&
+  success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) &&
              x0 < x1 && y0 < y1);
 
   if (success &&
@@ -299,7 +299,7 @@
 {
   gint x, y, width, height;
 
-  success = gimp_item_is_attached (GIMP_ITEM (drawable));
+  success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error);
 
   if (success &&
       gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@@ -374,7 +374,7 @@
 {
   gint x, y, width, height;
 
-  success = gimp_item_is_attached (GIMP_ITEM (drawable));
+  success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error);
 
   if (success &&
       gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
@@ -410,10 +410,15 @@
 }
 
 
- headers = qw("libgimpmath/gimpmath.h" "config/gimpcoreconfig.h"
-              "core/gimp.h" "core/gimp-transform-utils.h" "core/gimpimage.h"
-              "core/gimpdrawable.h" "core/gimpdrawable-transform.h"
+ headers = qw("libgimpmath/gimpmath.h"
+              "config/gimpcoreconfig.h"
+              "core/gimp.h"
+              "core/gimp-transform-utils.h"
+              "core/gimpimage.h"
+              "core/gimpdrawable.h"
+              "core/gimpdrawable-transform.h"
               "core/gimpprogress.h"
+              "gimppdb-utils.h"
               "gimp-intl.h");
 
 @procs = qw(flip perspective rotate scale shear transform_2d);



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