Index: app/paint/Makefile.am
===================================================================
RCS file: /cvs/gnome/gimp/app/paint/Makefile.am,v
retrieving revision 1.28
diff -u -p -r1.28 Makefile.am
--- app/paint/Makefile.am	13 Feb 2005 15:08:05 -0000	1.28
+++ app/paint/Makefile.am	10 Aug 2006 13:37:07 -0000
@@ -42,6 +42,10 @@ libapppaint_a_sources = \
 	gimperaser.h		\
 	gimperaseroptions.c	\
 	gimperaseroptions.h	\
+	gimpheal.c	\
+	gimpheal.h	\
+	gimphealoptions.c	\
+	gimphealoptions.h	\
 	gimpink.c		\
 	gimpink.h		\
 	gimpink-blob.c		\
Index: app/paint/gimp-paint.c
===================================================================
RCS file: /cvs/gnome/gimp/app/paint/gimp-paint.c,v
retrieving revision 1.8
diff -u -p -r1.8 gimp-paint.c
--- app/paint/gimp-paint.c	7 Apr 2006 10:51:21 -0000	1.8
+++ app/paint/gimp-paint.c	10 Aug 2006 13:37:07 -0000
@@ -32,6 +32,7 @@
 #include "gimpconvolve.h"
 #include "gimpdodgeburn.h"
 #include "gimperaser.h"
+#include "gimpheal.h"
 #include "gimpink.h"
 #include "gimppaintoptions.h"
 #include "gimppaintbrush.h"
@@ -60,6 +61,7 @@ gimp_paint_init (Gimp *gimp)
     gimp_smudge_register,
     gimp_convolve_register,
     gimp_clone_register,
+    gimp_heal_register,
     gimp_ink_register,
     gimp_airbrush_register,
     gimp_eraser_register,
Index: app/paint/gimpbrushcore.c
===================================================================
RCS file: /cvs/gnome/gimp/app/paint/gimpbrushcore.c,v
retrieving revision 1.24
diff -u -p -r1.24 gimpbrushcore.c
--- app/paint/gimpbrushcore.c	15 May 2006 09:46:16 -0000	1.24
+++ app/paint/gimpbrushcore.c	10 Aug 2006 13:37:08 -0000
@@ -727,9 +727,9 @@ gimp_brush_core_set_brush (GimpBrushCore
 
 void
 gimp_brush_core_paste_canvas (GimpBrushCore            *core,
-                              GimpDrawable               *drawable,
-                              gdouble                        brush_opacity,
-                              gdouble                        image_opacity,
+                              GimpDrawable             *drawable,
+                              gdouble                   brush_opacity,
+                              gdouble                   image_opacity,
                               GimpLayerModeEffects      paint_mode,
                               GimpBrushApplicationMode  brush_hardness,
                               GimpPaintApplicationMode  mode)
Index: app/paint/gimpheal.c
===================================================================
RCS file: app/paint/gimpheal.c
diff -N app/paint/gimpheal.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ app/paint/gimpheal.c	10 Aug 2006 13:37:08 -0000
@@ -0,0 +1,671 @@
+/* The GIMP -- an image manipulation program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <glib-object.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "paint-types.h"
+
+#include "paint-funcs/paint-funcs.h"
+
+#include "base/pixel-region.h"
+#include "base/temp-buf.h"
+#include "base/tile-manager.h"
+
+#include "core/gimpitem.h"
+#include "core/gimppickable.h"
+#include "core/gimpimage.h"
+#include "core/gimpdrawable.h"
+#include "core/gimppattern.h"
+
+#include "gimpheal.h"
+#include "gimphealoptions.h"
+
+#include "gimp-intl.h"
+
+enum
+{
+  PROP_0,
+  PROP_SRC_DRAWABLE,
+  PROP_SRC_X,
+  PROP_SRC_Y
+};
+
+static void   gimp_heal_set_property     (GObject          *object,
+                                          guint             property_id,
+                                          const GValue     *value,
+                                          GParamSpec       *pspec);
+
+static void   gimp_heal_get_property     (GObject          *object,
+                                          guint             property_id,
+                                          GValue           *value,
+                                          GParamSpec       *pspec);
+
+static void   gimp_heal_paint            (GimpPaintCore    *paint_core,
+                                          GimpDrawable     *drawable,
+                                          GimpPaintOptions *paint_options,
+                                          GimpPaintState    paint_state,
+                                          guint32           time);
+
+static void   gimp_heal_motion           (GimpPaintCore    *paint_core,
+                                          GimpDrawable     *drawable,
+                                          GimpPaintOptions *paint_options);
+
+static void   gimp_heal_set_src_drawable (GimpHeal         *heal,
+                                          GimpDrawable     *drawable);
+
+G_DEFINE_TYPE (GimpHeal, gimp_heal, GIMP_TYPE_BRUSH_CORE)
+
+void
+gimp_heal_register (Gimp                      *gimp,
+                    GimpPaintRegisterCallback  callback)
+{
+  (* callback) (gimp,                    /* gimp */
+                GIMP_TYPE_HEAL,          /* paint type */
+                GIMP_TYPE_HEAL_OPTIONS,  /* paint options type */
+                "gimp-heal",             /* identifier */
+                _("Heal"),               /* blurb */
+                "gimp-tool-heal");       /* stock id */
+}
+
+static void
+gimp_heal_class_init (GimpHealClass *klass)
+{
+  GObjectClass       *object_class     = G_OBJECT_CLASS (klass);
+  GimpPaintCoreClass *paint_core_class = GIMP_PAINT_CORE_CLASS (klass);
+  GimpBrushCoreClass *brush_core_class = GIMP_BRUSH_CORE_CLASS (klass);
+
+  object_class->set_property           = gimp_heal_set_property;
+  object_class->get_property           = gimp_heal_get_property;
+
+  paint_core_class->paint              = gimp_heal_paint;
+
+  brush_core_class->handles_changing_brush = TRUE;
+
+  g_object_class_install_property (object_class, PROP_SRC_DRAWABLE,
+                                   g_param_spec_object ("src-drawable",
+                                                        NULL, NULL,
+                                                        GIMP_TYPE_DRAWABLE,
+                                                        GIMP_PARAM_READWRITE));
+
+  g_object_class_install_property (object_class, PROP_SRC_X,
+                                   g_param_spec_double ("src-x", NULL, NULL,
+                                                        0, GIMP_MAX_IMAGE_SIZE,
+                                                        0.0,
+                                                        GIMP_PARAM_READWRITE));
+
+  g_object_class_install_property (object_class, PROP_SRC_Y,
+                                   g_param_spec_double ("src-y", NULL, NULL,
+                                                        0, GIMP_MAX_IMAGE_SIZE,
+                                                        0.0,
+                                                        GIMP_PARAM_READWRITE));
+}
+
+static void
+gimp_heal_init (GimpHeal *heal)
+{
+  heal->set_source   = FALSE;
+
+  heal->src_drawable = NULL;
+  heal->src_x        = 0.0;
+  heal->src_y        = 0.0;
+
+  heal->offset_x     = 0.0;
+  heal->offset_y     = 0.0;
+  heal->first_stroke = TRUE;
+}
+
+static void
+gimp_heal_set_property (GObject      *object,
+                        guint         property_id,
+                        const GValue *value,
+                        GParamSpec   *pspec)
+{
+  GimpHeal *heal = GIMP_HEAL (object);
+
+  switch (property_id)
+    {
+    case PROP_SRC_DRAWABLE:
+      gimp_heal_set_src_drawable (heal, g_value_get_object (value));
+      break;
+    case PROP_SRC_X:
+      heal->src_x = g_value_get_double (value);
+      break;
+    case PROP_SRC_Y:
+      heal->src_y = g_value_get_double (value);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+    }
+}
+
+static void
+gimp_heal_get_property (GObject    *object,
+                        guint       property_id,
+                        GValue     *value,
+                        GParamSpec *pspec)
+{
+  GimpHeal *heal = GIMP_HEAL (object);
+
+  switch (property_id)
+    {
+    case PROP_SRC_DRAWABLE:
+      g_value_set_object (value, heal->src_drawable);
+      break;
+    case PROP_SRC_X:
+      g_value_set_int (value, heal->src_x);
+      break;
+    case PROP_SRC_Y:
+      g_value_set_int (value, heal->src_y);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+    }
+}
+
+static void
+gimp_heal_paint (GimpPaintCore    *paint_core,
+                 GimpDrawable     *drawable,
+                 GimpPaintOptions *paint_options,
+                 GimpPaintState    paint_state,
+                 guint32           time)
+{
+  GimpHeal        *heal = GIMP_HEAL (paint_core);
+
+  /* gimp passes the current state of the painting system to the function */
+  switch (paint_state)
+    {
+    case GIMP_PAINT_STATE_INIT:
+      /* heal->set_source is set by gimphealtool when CTRL is pressed */
+      if (heal->set_source)
+        {
+          /* defined later in this file, sets heal to the current drawable
+           * and notifies heal that the drawable is ready */
+          gimp_heal_set_src_drawable (heal, drawable);
+
+          /* get the current source coordinates from the paint core */
+          heal->src_x = paint_core->cur_coords.x;
+          heal->src_y = paint_core->cur_coords.y;
+
+          /* set first stroke to be true */
+          heal->first_stroke = TRUE;
+        }
+      break;
+
+    case GIMP_PAINT_STATE_MOTION:
+      if (heal->set_source)
+        {
+          /*  if the control key is down, move the src and return */
+          heal->src_x = paint_core->cur_coords.x;
+          heal->src_y = paint_core->cur_coords.y;
+
+          heal->first_stroke = TRUE;
+        }
+      else
+        {
+          /*  otherwise, update the target  */
+
+          /* get the current destination from the paint core */
+          gint dest_x = paint_core->cur_coords.x;
+          gint dest_y = paint_core->cur_coords.y;
+
+          /* if this is the first stroke, record the offset of the destination
+           * relative to the source */
+          if (heal->first_stroke)
+            {
+              heal->offset_x = heal->src_x - dest_x;
+              heal->offset_y = heal->src_y - dest_y;
+              
+              heal->first_stroke = FALSE;
+            }
+
+          /* if this is not the first stroke, set the source as 
+           * destination + offset */
+          heal->src_x = dest_x + heal->offset_x;
+          heal->src_y = dest_y + heal->offset_y;
+
+          /* defined later, does the actual cloning */
+          gimp_heal_motion (paint_core, drawable, paint_options);
+        }
+      break;
+
+    default:
+      break;
+    }
+
+  /* notify the brush that the src attributes have changed */
+  g_object_notify (G_OBJECT (heal), "src-x");
+  g_object_notify (G_OBJECT (heal), "src-y");
+}
+
+static void
+gimp_heal_substitute_0_for_1 (PixelRegion *pr)
+{
+  gint     i, j, k;
+
+  gint     height = pr->h;
+  gint     width  = pr->w;
+  gint     depth  = pr->bytes;
+
+  guchar  *pr_data = pr->data;
+
+  guchar  *p;
+  
+  for (i = 0; i < height; i++) 
+    {
+      p = pr_data;
+
+      for (j = 0; j < width; j++)
+        {
+          for (k = 0; k < depth; k++)
+            {
+              if (p[k] == 0)
+                p[k] = 1;
+            }
+
+          p += depth;
+        }
+
+      pr_data += pr->rowstride;
+    }
+}
+
+static void
+gimp_heal_divide (PixelRegion *topPR,
+                  PixelRegion *bottomPR,
+                  gdouble     *result)
+{
+  gint     i, j, k;
+
+  gint     height = topPR->h;
+  gint     width  = topPR->w;
+  gint     depth  = topPR->bytes;
+
+  guchar  *t_data = topPR->data;
+  guchar  *b_data = bottomPR->data;
+
+  guchar  *t;
+  guchar  *b;
+  gdouble *r      = result;
+  
+  for (i = 0; i < height; i++) 
+    {
+      t = t_data;
+      b = b_data;
+
+      for (j = 0; j < width; j++)
+        {
+          for (k = 0; k < depth; k++)
+            {
+              r[k] = (gdouble) (t[k]) / (gdouble) (b[k]);
+            }
+
+          t += depth;
+          b += depth;
+          r += depth;
+        }
+
+      t_data += topPR->rowstride;
+      b_data += bottomPR->rowstride;
+    }
+}
+
+static void
+gimp_heal_multiply (gdouble     *first,
+                    PixelRegion *secondPR,
+                    PixelRegion *resultPR)
+{
+  gint     i, j, k;
+
+  gint     height = secondPR->h;
+  gint     width  = secondPR->w;
+  gint     depth  = secondPR->bytes;
+
+  guchar  *s_data = secondPR->data;
+  guchar  *r_data = resultPR->data;
+
+  gdouble *f      = first;
+  guchar  *s;
+  guchar  *r;
+
+  for (i = 0; i < height; i++) 
+    {
+      s = s_data;
+      r = r_data;
+
+      for (j = 0; j < width; j++)
+        {
+          for (k = 0; k < depth; k++)
+            {
+              r[k] = (guchar) CLAMP0255 (ROUND (((gdouble) (f[k])) * ((gdouble) (s[k]))));
+            }
+
+          f += depth;
+          s += depth;
+          r += depth;
+        }
+
+      s_data += secondPR->rowstride;
+      r_data += resultPR->rowstride;
+    }
+}
+
+/**
+ * Perform one iteration of the laplace solver for matrix.  Store the result in
+ * solution and return the cummulative error of the solution.
+ */
+gdouble
+gimp_heal_laplace_iteration (gdouble *matrix,
+                             gint     height,
+                             gint     depth,
+                             gint     width,
+                             gdouble *solution)
+{
+  gint     rowstride  = width * depth;
+  gboolean done       = TRUE;
+  gint     i, j, k;
+  gdouble  err        = 0.0;
+  gdouble  tmp, diff;
+
+  for (i = 0; i < height; i++)
+    {
+      for (j = 0; j < width; j++)
+        {
+          if ((i == 0) || (i == (height - 1)) || (j == 0) || (j == (height - 1)))
+            /* do nothing at the boundary */
+            for (k = 0; k < depth; k++)
+              *(solution + k) = *(matrix + k);
+          else
+            {
+              /* calculate the mean of four neighbours for all color channels */
+              /* v[i][j] = 0.45 * (v[i][j-1]+v[i][j+1]+v[i-1][j]+v[i+1][j]) */
+              for (k = 0; k < depth; k++)
+                {
+                  tmp = *(solution + k);
+
+                  *(solution + k) = 0.25 *
+                                    ( *(matrix - depth + k)       /* west */
+                                    + *(matrix + depth + k)       /* east */
+                                    + *(matrix - rowstride + k)   /* north */
+                                    + *(matrix + rowstride + k)); /* south */
+
+                  diff = *(solution + k) - tmp;
+                  err += diff*diff;
+                }
+            }
+
+          /* advance pointers to data */
+          matrix += depth; solution += depth;
+        }
+    }
+
+  return sqrt (err);
+}
+
+/**
+ * Solve the laplace equation for matrix.
+ */
+void
+gimp_heal_laplace_loop (gdouble *matrix,
+                        gint     height,
+                        gint     depth,
+                        gint     width,
+                        gdouble *solution)
+{
+#define EPSILON   0.0001
+#define MAX_ITER  1000 
+
+  gint num_iter = 0;
+  gdouble err;
+
+  /* do one iteration and store the amount of error */
+  err = gimp_heal_laplace_iteration (matrix, height, depth, width, solution);
+  
+  /* copy solution to matrix */
+  memcpy (matrix, solution, width * height * depth * sizeof(double));
+
+  /* repeat until convergence or max iterations */
+  while (err > EPSILON) 
+    {  
+      err = gimp_heal_laplace_iteration (matrix, height, depth, width, solution);
+      memcpy (matrix, solution, width * height * depth * sizeof(double));
+
+      num_iter++;
+
+      if (num_iter >= MAX_ITER)
+        break;
+    }
+}
+
+/* Algorithm Design:
+ * T. Georgiev, "Image Reconstruction Invariant to Relighting", EUROGRAPHICS
+ * 2005, http://www.tgeorgiev.net/
+ */
+PixelRegion *
+gimp_heal_region (PixelRegion *tempPR,
+                  PixelRegion *srcPR)
+{
+  gdouble *i_1 = g_malloc (tempPR->h * tempPR->bytes * tempPR->w * sizeof (gdouble));
+  gdouble *i_2 = g_malloc (tempPR->h * tempPR->bytes * tempPR->w * sizeof (gdouble));
+
+  /* substitute 0's for 1's for the division and multiplication operations that
+   * come later */
+  gimp_heal_substitute_0_for_1 (srcPR);
+
+  /* divide tempPR by srcPR and store the result as a double in i_1 */
+  gimp_heal_divide (tempPR, srcPR, i_1);
+
+  /* FIXME: is a faster implementation needed? */
+  gimp_heal_laplace_loop (i_1, tempPR->h, tempPR->bytes, tempPR->w, i_2);
+
+  /* multiply a double by srcPR and store in tempPR */
+  gimp_heal_multiply (i_2, srcPR, tempPR);
+  
+  g_free (i_1);
+  g_free (i_2);
+
+  return tempPR;
+}
+
+static void
+gimp_heal_motion (GimpPaintCore     *paint_core,
+                  GimpDrawable      *drawable,
+                  GimpPaintOptions  *paint_options)
+{
+  GimpHeal            *heal             = GIMP_HEAL (paint_core);
+  GimpContext         *context          = GIMP_CONTEXT (paint_options);
+  GimpPressureOptions *pressure_options = paint_options->pressure_options;
+  GimpImage           *image;
+  TempBuf             *area;
+  TempBuf             *temp;
+  TileManager         *src_tiles; 
+  gdouble              opacity;
+  PixelRegion          tempPR;
+  PixelRegion          srcPR;
+  PixelRegion          destPR;
+
+  image = gimp_item_get_image (GIMP_ITEM (drawable));
+	
+  if (GIMP_IMAGE_TYPE_IS_INDEXED (image))
+    {
+      g_warning ("gimpheal: indexed images are not supported by the healing brush.\n");
+      return;
+    }
+
+  opacity = gimp_paint_options_get_fade (paint_options, image, paint_core->pixel_dist);
+
+  if (opacity == 0.0)
+    return;
+
+  if (!heal->src_drawable)
+    return;
+
+  area = gimp_paint_core_get_paint_area (paint_core, drawable, paint_options);
+  if (!area)
+    return;
+
+  /* FIXME: the area under the cursor and the source area should be x% larger
+   * than the brush size so that we have seamless blending.  Otherwise the brush
+   * must be a lot bigger than the area to heal in order to get good results.
+   * Having the user pick such a large brush is perhaps counter-intutitive? */
+   
+  /* Get the area underneath the cursor */
+  {
+    GimpItem *item = GIMP_ITEM (drawable);
+    TempBuf  *orig;
+    gint      x1, x2, y1, y2;
+
+    x1 = CLAMP (area->x, 0, gimp_item_width  (item));
+    y1 = CLAMP (area->y, 0, gimp_item_height (item));
+    x2 = CLAMP (area->x + area->width, 0, gimp_item_width   (item));
+    y2 = CLAMP (area->y + area->height, 0, gimp_item_height (item));
+
+    if (! (x2 - x1) || (! (y2 - y1)))
+      return;
+
+    orig = gimp_paint_core_get_orig_image (paint_core, drawable, x1, y1, x2, y2);
+
+    pixel_region_init_temp_buf (&srcPR, orig, 0, 0, x2 - x1, y2 - y1);
+  }
+
+  temp = temp_buf_new (srcPR.w, srcPR.h, srcPR.bytes, 0, 0, NULL); 
+
+  pixel_region_init_temp_buf (&tempPR, temp, 0, 0, srcPR.w, srcPR.h); 
+
+  copy_region (&srcPR, &tempPR);
+
+  /* now tempPR holds the data under the cursor */
+
+  temp_buf_data_clear (area);
+
+  /* get a copy of the location we will sample from */
+  {
+    GimpItem *item = GIMP_ITEM (drawable);
+    TempBuf  *orig;
+    gint      x1, x2, y1, y2;
+
+    x1 = CLAMP (area->x + heal->offset_x, 0, gimp_item_width (item));
+    y1 = CLAMP (area->y + heal->offset_y, 0, gimp_item_height (item));
+    x2 = CLAMP (area->x + heal->offset_x + area->width, 0, gimp_item_width (item));
+    y2 = CLAMP (area->y + heal->offset_y + area->height, 0, gimp_item_height (item));
+
+    if (! (x2 - x1) || (! (y2 - y1)))
+      return;
+
+    if (heal->src_drawable != drawable)
+      {
+        g_warning ("gimpheal: does not support healing between images.\n");
+        return;
+      }
+    else
+      {
+      orig = gimp_paint_core_get_orig_image (paint_core, drawable, x1, y1, x2, y2);
+
+      pixel_region_init_temp_buf (&srcPR, orig, 0, 0, x2 - x1, y2 - y1);
+      }
+  }
+
+  /* now srcPR holds the source area to sample from */
+
+  /* get the destination to paint to */
+  pixel_region_init_temp_buf (&destPR, area, 0, 0, srcPR.w, srcPR.h);
+
+  /* FIXME: Can we ensure that this is true in the code above?  
+   * Is it already guaranteed to be true before we get here? */
+  /* check that srcPR, tempPR, and destPR are the same size */
+  if ((srcPR.w     != tempPR.w    ) || (srcPR.w     != destPR.w    ) ||
+      (srcPR.h     != tempPR.h    ) || (srcPR.h     != destPR.h    )) 
+    {
+      g_warning ("gimpheal: source and destination are not same size.");
+      return;
+    }
+
+  /* heal tempPR using srcPR */
+  gimp_heal_region (&tempPR, &srcPR);
+
+  /* re-initialize tempPR so that it can be used within copy_region */
+  pixel_region_init_data (&tempPR, tempPR.data, tempPR.bytes, tempPR.rowstride,
+                          0, 0, tempPR.w, tempPR.h);
+
+  /* add an alpha region to the area if necessary */
+  if (! gimp_drawable_has_alpha (drawable)) 
+    add_alpha_region (&tempPR, &destPR);
+  else 
+    copy_region (&tempPR, &destPR);
+
+  if (pressure_options->opacity)
+    opacity *= PRESSURE_SCALE * paint_core->cur_coords.pressure;
+
+  gimp_brush_core_replace_canvas (GIMP_BRUSH_CORE (paint_core),
+                                  drawable,
+                                  MIN (opacity, GIMP_OPACITY_OPAQUE),
+                                  gimp_context_get_opacity (context),
+                                  gimp_paint_options_get_brush_mode (paint_options),
+                                  GIMP_PAINT_CONSTANT);
+}
+ 
+static void
+gimp_heal_src_drawable_removed (GimpDrawable *drawable,
+                                GimpHeal     *heal)
+{
+  /* set the drawable to NULL */
+  if (drawable == heal->src_drawable)
+    {
+      heal->src_drawable = NULL;
+    }
+
+  /* disconnect the signal handler for this function */
+  g_signal_handlers_disconnect_by_func (drawable,
+                                        gimp_heal_src_drawable_removed,
+                                        heal);
+}
+
+static void
+gimp_heal_set_src_drawable (GimpHeal     *heal,
+                            GimpDrawable *drawable)
+{
+  /* check if we already have a drawable */
+  if (heal->src_drawable == drawable)
+    return;
+
+  /* remove the current signal handler */
+  if (heal->src_drawable)
+    g_signal_handlers_disconnect_by_func (heal->src_drawable,
+                                          gimp_heal_src_drawable_removed,
+                                          heal);
+
+  /* set the drawable */
+  heal->src_drawable = drawable;
+
+  /* connect the signal handler that handles the "remove" signal */
+  if (heal->src_drawable)
+    g_signal_connect (heal->src_drawable, "removed",
+                      G_CALLBACK (gimp_heal_src_drawable_removed),
+                      heal);
+
+  /* notify heal that the source drawable is set */
+  g_object_notify (G_OBJECT (heal), "src-drawable");
+}
Index: app/paint/gimpheal.h
===================================================================
RCS file: app/paint/gimpheal.h
diff -N app/paint/gimpheal.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ app/paint/gimpheal.h	10 Aug 2006 13:37:08 -0000
@@ -0,0 +1,64 @@
+/* The GIMP -- an image manipulation program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GIMP_HEAL_H__
+#define __GIMP_HEAL_H__
+
+#include "gimpbrushcore.h"
+
+#define GIMP_TYPE_HEAL            (gimp_heal_get_type ())
+#define GIMP_HEAL(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_HEAL, GimpHeal))
+#define GIMP_HEAL_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_HEAL, GimpHealClass))
+#define GIMP_IS_HEAL(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_HEAL))
+#define GIMP_IS_HEAL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_HEAL))
+#define GIMP_HEAL_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_HEAL, GimpHealClass))
+
+typedef struct _GimpHeal      GimpHeal;
+typedef struct _GimpHealClass GimpHealClass;
+
+struct _GimpHeal
+{
+  GimpBrushCore parent_instance;
+
+  gboolean set_source;
+
+  GimpDrawable *src_drawable;
+  gdouble src_x;
+  gdouble src_y;
+
+  gdouble orig_src_x;
+  gdouble orig_src_y;
+
+  gdouble offset_x;
+  gdouble offset_y;
+  gboolean first_stroke;
+};
+
+struct _GimpHealClass
+{
+  GimpBrushCoreClass parent_class;
+};
+
+
+void    gimp_heal_register (Gimp                      *gimp,
+                               GimpPaintRegisterCallback  callback);
+
+GType   gimp_heal_get_type (void) G_GNUC_CONST;
+
+
+#endif  /*  __GIMP_HEAL_H__  */
Index: app/paint/gimpheal.o
===================================================================
RCS file: app/paint/gimpheal.o
diff -N app/paint/gimpheal.o
Binary files /dev/null and gimpheal.o differ
Index: app/paint/gimphealoptions.c
===================================================================
RCS file: app/paint/gimphealoptions.c
diff -N app/paint/gimphealoptions.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ app/paint/gimphealoptions.c	10 Aug 2006 13:37:09 -0000
@@ -0,0 +1,67 @@
+/* The GIMP -- an image manipulation program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <glib-object.h>
+
+#include "libgimpconfig/gimpconfig.h"
+
+#include "paint-types.h"
+#include "gimphealoptions.h"
+
+static void   gimp_heal_options_set_property (GObject      *object,
+                                              guint         property_id,
+                                              const GValue *value,
+                                              GParamSpec   *pspec);
+static void   gimp_heal_options_get_property (GObject      *object,
+                                              guint         property_id,
+                                              GValue       *value,
+                                              GParamSpec   *pspec);
+
+G_DEFINE_TYPE (GimpHealOptions, gimp_heal_options, GIMP_TYPE_PAINT_OPTIONS)
+
+static void
+gimp_heal_options_class_init (GimpHealOptionsClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->set_property = gimp_heal_options_set_property;
+  object_class->get_property = gimp_heal_options_get_property;
+}
+
+static void
+gimp_heal_options_init (GimpHealOptions *options)
+{
+}
+
+static void
+gimp_heal_options_set_property (GObject      *object,
+                                 guint         property_id,
+                                 const GValue *value,
+                                 GParamSpec   *pspec)
+{
+}
+
+static void
+gimp_heal_options_get_property (GObject    *object,
+                                 guint       property_id,
+                                 GValue     *value,
+                                 GParamSpec *pspec)
+{
+}
Index: app/paint/gimphealoptions.h
===================================================================
RCS file: app/paint/gimphealoptions.h
diff -N app/paint/gimphealoptions.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ app/paint/gimphealoptions.h	10 Aug 2006 13:37:09 -0000
@@ -0,0 +1,45 @@
+/* The GIMP -- an image manipulation program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GIMP_HEAL_OPTIONS_H__
+#define __GIMP_HEAL_OPTIONS_H__
+
+
+#include "gimppaintoptions.h"
+
+
+#define GIMP_TYPE_HEAL_OPTIONS            (gimp_heal_options_get_type ())
+#define GIMP_HEAL_OPTIONS(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_HEAL_OPTIONS, GimpHealOptions))
+#define GIMP_HEAL_OPTIONS_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_HEAL_OPTIONS, GimpHealOptionsClass))
+#define GIMP_IS_HEAL_OPTIONS(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_HEAL_OPTIONS))
+#define GIMP_IS_HEAL_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_HEAL_OPTIONS))
+#define GIMP_HEAL_OPTIONS_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_HEAL_OPTIONS, GimpHealOptionsClass))
+
+
+typedef struct _GimpHealOptions         GimpHealOptions;
+typedef struct _GimpPaintOptionsClass   GimpHealOptionsClass;
+
+struct _GimpHealOptions
+{
+  GimpPaintOptions paint_options;
+};
+  
+
+GType   gimp_heal_options_get_type (void) G_GNUC_CONST;
+
+#endif  /*  __GIMP_HEAL_OPTIONS_H__  */
Index: app/paint/gimphealoptions.o
===================================================================
RCS file: app/paint/gimphealoptions.o
diff -N app/paint/gimphealoptions.o
Binary files /dev/null and gimphealoptions.o differ
Index: app/paint/gimpink.c
===================================================================
RCS file: /cvs/gnome/gimp/app/paint/gimpink.c,v
retrieving revision 1.152
diff -u -p -r1.152 gimpink.c
--- app/paint/gimpink.c	15 May 2006 09:46:17 -0000	1.152
+++ app/paint/gimpink.c	10 Aug 2006 13:37:10 -0000
@@ -321,7 +321,7 @@ gimp_ink_motion (GimpPaintCore    *paint
       blob_to_render = blob_union;
     }
 
-  /* Get the the buffer */
+  /* Get the buffer */
   ink->cur_blob = blob_to_render;
   area = gimp_paint_core_get_paint_area (paint_core, drawable, paint_options);
   ink->cur_blob = NULL;
Index: app/paint/makefile.msc
===================================================================
RCS file: /cvs/gnome/gimp/app/paint/makefile.msc,v
retrieving revision 1.9
diff -u -p -r1.9 makefile.msc
--- app/paint/makefile.msc	19 Feb 2005 00:50:33 -0000	1.9
+++ app/paint/makefile.msc	10 Aug 2006 13:37:10 -0000
@@ -42,6 +42,8 @@ OBJECTS = \
 	gimpink-blob.obj \
 	gimpink-undo.obj \
 	gimpinkoptions.obj \
+  gimpheal.obj \
+  gimphealoptions.obj \
 	gimppaintbrush.obj \
 	gimppaintcore.obj \
 	gimppaintcore-stroke.obj \
Index: app/tools/Makefile.am
===================================================================
RCS file: /cvs/gnome/gimp/app/tools/Makefile.am,v
retrieving revision 1.98
diff -u -p -r1.98 Makefile.am
--- app/tools/Makefile.am	31 Jul 2006 11:42:49 -0000	1.98
+++ app/tools/Makefile.am	10 Aug 2006 13:37:11 -0000
@@ -76,6 +76,8 @@ libapptools_a_sources = \
 	gimpforegroundselecttool-undo.h	\
 	gimpfuzzyselecttool.c		\
 	gimpfuzzyselecttool.h		\
+	gimphealtool.c	\
+	gimphealtool.h	\
 	gimphistogramoptions.c		\
 	gimphistogramoptions.h		\
 	gimphuesaturationtool.c		\
Index: app/tools/gimp-tools.c
===================================================================
RCS file: /cvs/gnome/gimp/app/tools/gimp-tools.c,v
retrieving revision 1.29
diff -u -p -r1.29 gimp-tools.c
--- app/tools/gimp-tools.c	21 Jun 2006 21:59:03 -0000	1.29
+++ app/tools/gimp-tools.c	10 Aug 2006 13:37:11 -0000
@@ -62,6 +62,7 @@
 #include "gimpfreeselecttool.h"
 #include "gimpforegroundselecttool.h"
 #include "gimpfuzzyselecttool.h"
+#include "gimphealtool.h"
 #include "gimphuesaturationtool.h"
 #include "gimpinktool.h"
 #include "gimpiscissorstool.h"
@@ -132,6 +133,7 @@ gimp_tools_init (Gimp *gimp)
     gimp_smudge_tool_register,
     gimp_convolve_tool_register,
     gimp_clone_tool_register,
+    gimp_heal_tool_register,
     gimp_ink_tool_register,
     gimp_airbrush_tool_register,
     gimp_eraser_tool_register,
@@ -506,6 +508,10 @@ gimp_tools_register (GType              
   else if (tool_type == GIMP_TYPE_CLONE_TOOL)
     {
       paint_core_name = "gimp-clone";
+    }
+  else if (tool_type == GIMP_TYPE_HEAL_TOOL)
+    {
+      paint_core_name = "gimp-heal";
     }
   else if (tool_type == GIMP_TYPE_CONVOLVE_TOOL)
     {
Index: app/tools/gimphealtool.c
===================================================================
RCS file: app/tools/gimphealtool.c
diff -N app/tools/gimphealtool.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ app/tools/gimphealtool.c	10 Aug 2006 13:37:11 -0000
@@ -0,0 +1,369 @@
+/* The GIMP -- an image manipulation program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+
+#include "libgimpwidgets/gimpwidgets.h"
+
+#include "tools-types.h"
+
+#include "core/gimpchannel.h"      
+#include "core/gimpimage.h"
+#include "core/gimppickable.h"
+#include "core/gimptoolinfo.h"
+
+#include "paint/gimpheal.h"
+#include "paint/gimphealoptions.h"  
+
+#include "widgets/gimphelp-ids.h"
+#include "widgets/gimpviewablebox.h"
+#include "widgets/gimpwidgets-utils.h"
+
+#include "display/gimpdisplay.h"
+
+#include "gimphealtool.h"
+#include "gimppaintoptions-gui.h"
+#include "gimptoolcontrol.h"
+    
+#include "gimp-intl.h"
+
+#define TARGET_WIDTH  15
+#define TARGET_HEIGHT 15
+
+static void   gimp_heal_tool_button_press  (GimpTool        *tool,
+                                            GimpCoords      *coords,
+                                            guint32          time,
+                                            GdkModifierType  state,
+                                            GimpDisplay     *display);
+
+static void   gimp_heal_tool_motion        (GimpTool        *tool,
+                                            GimpCoords      *coords,
+                                            guint32          time,
+                                            GdkModifierType  state,
+                                            GimpDisplay     *display);
+
+static void   gimp_heal_tool_cursor_update (GimpTool        *tool,
+                                            GimpCoords      *coords,
+                                            GdkModifierType  state,
+                                            GimpDisplay     *display);
+
+static void   gimp_heal_tool_oper_update   (GimpTool        *tool,
+                                            GimpCoords      *coords,
+                                            GdkModifierType  state,
+                                            gboolean         proximity,
+                                            GimpDisplay     *display);
+
+static void   gimp_heal_tool_draw          (GimpDrawTool *draw_tool);
+
+static GtkWidget * gimp_heal_options_gui   (GimpToolOptions *tool_options);
+
+G_DEFINE_TYPE (GimpHealTool, gimp_heal_tool, GIMP_TYPE_PAINT_TOOL)
+
+void
+gimp_heal_tool_register (GimpToolRegisterCallback  callback,
+                         gpointer                  data)
+{
+  (* callback) (GIMP_TYPE_HEAL_TOOL,               /* tool type */
+                GIMP_TYPE_HEAL_OPTIONS,            /* tool option type */
+                gimp_heal_options_gui,             /* options gui */
+                GIMP_PAINT_OPTIONS_CONTEXT_MASK |  /* context properties */
+                GIMP_CONTEXT_PATTERN_MASK,
+                "gimp-heal-tool",                  /* identifier */
+                _("Heal"),                         /* blurb */
+                _("Heal image irregularities"),    /* help */
+                N_("_Heal"),                       /* menu path */
+                "H",                               /* menu accelerator */
+                NULL,                              /* help domain */
+                GIMP_HELP_TOOL_HEAL,               /* help data */
+                GIMP_STOCK_TOOL_HEAL,              /* stock id */
+                data);                             /* register */
+}
+
+static void
+gimp_heal_tool_class_init (GimpHealToolClass *klass)
+{
+  /* get parent classes where we override methods */
+  GimpToolClass     *tool_class      = GIMP_TOOL_CLASS (klass);
+  GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
+
+  /* override the methods */
+  tool_class->button_press  = gimp_heal_tool_button_press;
+  tool_class->motion        = gimp_heal_tool_motion;
+  tool_class->cursor_update = gimp_heal_tool_cursor_update;
+  tool_class->oper_update   = gimp_heal_tool_oper_update;
+
+  draw_tool_class->draw     = gimp_heal_tool_draw;
+}
+
+static void
+gimp_heal_tool_init (GimpHealTool *heal)
+{
+  GimpTool *tool = GIMP_TOOL (heal);
+
+  gimp_tool_control_set_tool_cursor     (tool->control,
+                                         GIMP_TOOL_CURSOR_HEAL);
+
+  gimp_tool_control_set_action_object_2 (tool->control,
+                                         "context/context-pattern-select-set");
+}
+
+static void
+gimp_heal_tool_button_press (GimpTool        *tool,
+                             GimpCoords      *coords,
+                             guint32          time,
+                             GdkModifierType  state,
+                             GimpDisplay     *display)
+{
+  GimpPaintTool   *paint_tool   = GIMP_PAINT_TOOL (tool);
+  GimpHealTool    *heal_tool    = GIMP_HEAL_TOOL (tool);
+  GimpHeal        *heal         = GIMP_HEAL (paint_tool->core);
+
+  /* pause the tool before drawing */
+  gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
+
+  /* use_saved_proj tells whether we keep the unmodified pixel projection
+   * around.  in this case no.  */
+  paint_tool->core->use_saved_proj = FALSE;
+
+  /* state holds a set of bit-flags to indicate the state of modifier keys and
+   * mouse buttons in various event types. Typical modifier keys are Shift,
+   * Control, Meta, Super, Hyper, Alt, Compose, Apple, CapsLock or ShiftLock. 
+   * Part of gtk -> GdkModifierType */
+  if ((state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) == GDK_CONTROL_MASK) 
+    /* we enter here only if CTRL is pressed */
+    {
+      /* mark that the source display has been set.  defined in gimpheal.h */
+      heal->set_source = TRUE;
+
+      /* if currently active display != the heal tools source display */
+      if (display != heal_tool->src_display)
+        {
+          /* check if the heal tools src display has been previously set */
+          if (heal_tool->src_display)
+            /* if so remove the pointer to the display */
+            g_object_remove_weak_pointer (G_OBJECT (heal_tool->src_display),
+                                          (gpointer *) &heal_tool->src_display);
+
+          /* set the heal tools source display to the currently active
+           * display */
+          heal_tool->src_display = display;
+          /* add a pointer to the display */
+          g_object_add_weak_pointer (G_OBJECT (display),
+                                     (gpointer *) &heal_tool->src_display);
+        }
+    }
+  else
+    {
+      /* note that the source is not being set */
+      heal->set_source = FALSE;
+
+      if (display == heal_tool->src_display)
+        {
+          paint_tool->core->use_saved_proj = TRUE;
+        }
+    }
+
+  /* chain up to call the parents functions */
+  GIMP_TOOL_CLASS (gimp_heal_tool_parent_class)->button_press (tool, coords, time, state,
+                                                display);
+
+  /* set the tool display's source position to match the current heal 
+   * implementation source position */
+  heal_tool->src_x = heal->src_x;
+  heal_tool->src_y = heal->src_y;
+
+  /* resume drawing */
+  gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
+}
+
+static void
+gimp_heal_tool_motion (GimpTool        *tool,
+                       GimpCoords      *coords,
+                       guint32          time,
+                       GdkModifierType  state,
+                       GimpDisplay     *display)
+{
+  GimpHealTool    *heal_tool    = GIMP_HEAL_TOOL (tool);
+  GimpPaintTool   *paint_tool   = GIMP_PAINT_TOOL (tool);
+  GimpHeal        *heal         = GIMP_HEAL (paint_tool->core);
+
+  /* pause drawing */
+  gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
+
+  /* check if CTRL is pressed */
+  if ((state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) == GDK_CONTROL_MASK)
+    /* if yes the source has been set */
+    heal->set_source = TRUE;
+  else
+    /* if no the source has not been set */
+    heal->set_source = FALSE;
+
+  /* chain up to the parent classes motion function */
+  GIMP_TOOL_CLASS (gimp_heal_tool_parent_class)->motion (tool, coords, time, state, display);
+
+  /* set the tool display's source to be the same as the heal implementation
+   * source */
+  heal_tool->src_x = heal->src_x;
+  heal_tool->src_y = heal->src_y;
+
+  /* resume drawing */
+  gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
+}
+
+static void
+gimp_heal_tool_cursor_update (GimpTool        *tool,
+                              GimpCoords      *coords,
+                              GdkModifierType  state,
+                              GimpDisplay     *display)
+{
+  GimpCursorType        cursor   = GIMP_CURSOR_MOUSE;
+  GimpCursorModifier    modifier = GIMP_CURSOR_MODIFIER_NONE;
+
+  /* if the cursor is in an active area */
+  if (gimp_image_coords_in_active_pickable (display->image, coords,
+                                            FALSE, TRUE))
+    {
+      /* set the cursor to the normal cursor */
+      cursor = GIMP_CURSOR_MOUSE;
+    }
+
+  if ((state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) == GDK_CONTROL_MASK)
+    {
+      cursor = GIMP_CURSOR_CROSSHAIR_SMALL;
+    }
+  else if (! GIMP_HEAL (GIMP_PAINT_TOOL (tool)->core)->src_drawable)
+    {
+      modifier = GIMP_CURSOR_MODIFIER_BAD;
+    }
+
+  /* set the cursor and the modifier cursor */
+  gimp_tool_control_set_cursor          (tool->control, cursor);
+  gimp_tool_control_set_cursor_modifier (tool->control, modifier);
+
+  /* chain up to the parent class */
+  GIMP_TOOL_CLASS (gimp_heal_tool_parent_class)->cursor_update (tool, coords, state, display);
+}
+
+static void
+gimp_heal_tool_oper_update (GimpTool        *tool,
+                            GimpCoords      *coords,
+                            GdkModifierType  state,
+                            gboolean         proximity,
+                            GimpDisplay     *display)
+{
+  GimpHealTool    *heal_tool = GIMP_HEAL_TOOL (tool);
+
+  /* chain up to the parent class */
+  GIMP_TOOL_CLASS (gimp_heal_tool_parent_class)->oper_update (tool, coords, state, proximity,
+                                               display);
+
+  /* FIXME: what does proximity mean? */
+  if (proximity)
+    {
+      GimpHeal *heal = GIMP_HEAL (GIMP_PAINT_TOOL (tool)->core);
+
+      if (heal->src_drawable == NULL)
+        {
+          /* if we haven't set the source drawable yet, make a notice to do so */
+          gimp_tool_replace_status (tool, display,
+                                    _("Ctrl-Click to set a heal source."));
+        }
+      else
+        {
+          /* pause drawing */
+          gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
+
+          /* set the tool source to match the implementation source */
+          heal_tool->src_x = heal->src_x;
+          heal_tool->src_y = heal->src_y;
+
+          if (! heal->first_stroke)
+            {
+              heal_tool->src_x = coords->x + heal->offset_x;
+              heal->src_y = coords->y + heal->offset_y;
+            }
+
+          /* resume drawing */
+          gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
+        }
+    }
+}
+
+static void
+gimp_heal_tool_draw (GimpDrawTool *draw_tool)
+{
+  GimpTool        *tool      = GIMP_TOOL (draw_tool);
+  GimpHealTool    *heal_tool = GIMP_HEAL_TOOL (draw_tool);
+  GimpHeal        *heal      = GIMP_HEAL (GIMP_PAINT_TOOL (tool)->core);
+
+  /* If we have a source drawable and display we can do the drawing */
+  if (heal->src_drawable && heal_tool->src_display)
+    {
+      /* make a temporary display and keep track of offsets */
+      GimpDisplay *tmp_display;
+      gint         off_x;
+      gint         off_y;
+
+      /* gimp_item_offsets reveals the X and Y offsets of the first parameter.
+       * this gets the location of the drawable. */
+      gimp_item_offsets (GIMP_ITEM (heal->src_drawable), &off_x, &off_y);
+
+      /* store the display for later */
+      tmp_display = draw_tool->display;
+
+      /* set the display */
+      draw_tool->display = heal_tool->src_display;
+
+      /* convenience function to simplify drawing */
+      gimp_draw_tool_draw_handle (draw_tool,
+                                  GIMP_HANDLE_CROSS,
+                                  heal_tool->src_x + off_x,
+                                  heal_tool->src_y + off_y,
+                                  TARGET_WIDTH, TARGET_HEIGHT,
+                                  GTK_ANCHOR_CENTER,
+                                  FALSE);
+
+      /* FIXME: why do we reset the display after calling the
+       * gimp_draw_tool_draw_handle function? */
+      draw_tool->display = tmp_display;
+    }
+
+  /* chain up to the parent draw function */
+  GIMP_DRAW_TOOL_CLASS (gimp_heal_tool_parent_class)->draw (draw_tool);
+}
+
+/* FIXME:  Tailor this to the healing brush */
+static GtkWidget *
+gimp_heal_options_gui (GimpToolOptions *tool_options)
+{
+  GObject   *config;
+  GtkWidget *vbox;
+  GtkWidget *frame;
+  GtkWidget *button;
+  GtkWidget *hbox;
+  GtkWidget *table;
+  GtkWidget *combo;
+
+  config = G_OBJECT (tool_options);
+
+  vbox = gimp_paint_options_gui (tool_options);
+
+  return vbox;
+}
Index: app/tools/gimphealtool.h
===================================================================
RCS file: app/tools/gimphealtool.h
diff -N app/tools/gimphealtool.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ app/tools/gimphealtool.h	10 Aug 2006 13:37:11 -0000
@@ -0,0 +1,54 @@
+/* The GIMP -- an image manipulation program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GIMP_HEAL_TOOL_H__
+#define __GIMP_HEAL_TOOL_H__
+
+#include "gimppainttool.h"
+
+#define GIMP_TYPE_HEAL_TOOL            (gimp_heal_tool_get_type ())
+#define GIMP_HEAL_TOOL(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_HEAL_TOOL, GimpHealTool))
+#define GIMP_HEAL_TOOL_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_HEAL_TOOL, GimpHealToolClass))
+#define GIMP_IS_HEAL_TOOL(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_HEAL_TOOL))
+#define GIMP_IS_HEAL_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_HEAL_TOOL))
+#define GIMP_HEAL_TOOL_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_HEAL_TOOL, GimpHealToolClass))
+
+typedef struct _GimpHealTool      GimpHealTool;
+typedef struct _GimpHealToolClass GimpHealToolClass;
+
+struct _GimpHealTool
+{
+  GimpPaintTool  parent_instance;
+
+  GimpDisplay   *src_display;   /* Detail about the source location to paint from */
+  gint           src_x;
+  gint           src_y;
+};
+
+struct _GimpHealToolClass
+{
+  GimpPaintToolClass parent_class;
+};
+
+
+void    gimp_heal_tool_register (GimpToolRegisterCallback  callback,
+                                    gpointer                  data);
+
+GType   gimp_heal_tool_get_type (void) G_GNUC_CONST;
+
+#endif  /*  __GIMP_HEAL_TOOL_H__  */
Index: app/tools/gimppaintoptions-gui.c
===================================================================
RCS file: /cvs/gnome/gimp/app/tools/gimppaintoptions-gui.c,v
retrieving revision 1.113
diff -u -p -r1.113 gimppaintoptions-gui.c
--- app/tools/gimppaintoptions-gui.c	20 Feb 2006 17:25:53 -0000	1.113
+++ app/tools/gimppaintoptions-gui.c	10 Aug 2006 13:37:12 -0000
@@ -44,6 +44,7 @@
 #include "gimpdodgeburntool.h"
 #include "gimpdodgeburntool.h"
 #include "gimperasertool.h"
+#include "gimphealtool.h"
 #include "gimpinktool.h"
 #include "gimppaintbrushtool.h"
 #include "gimppaintoptions-gui.h"
@@ -184,6 +185,7 @@ gimp_paint_options_gui (GimpToolOptions 
   /* the "hard edge" toggle */
   if (tool_type == GIMP_TYPE_ERASER_TOOL     ||
       tool_type == GIMP_TYPE_CLONE_TOOL      ||
+      tool_type == GIMP_TYPE_HEAL_TOOL       ||
       tool_type == GIMP_TYPE_CONVOLVE_TOOL   ||
       tool_type == GIMP_TYPE_DODGE_BURN_TOOL ||
       tool_type == GIMP_TYPE_SMUDGE_TOOL)
@@ -220,6 +222,7 @@ pressure_options_gui (GimpPressureOption
 
   if (g_type_is_a (tool_type, GIMP_TYPE_PAINTBRUSH_TOOL) ||
       tool_type == GIMP_TYPE_CLONE_TOOL                  ||
+      tool_type == GIMP_TYPE_HEAL_TOOL                   ||
       tool_type == GIMP_TYPE_CONVOLVE_TOOL               ||
       tool_type == GIMP_TYPE_DODGE_BURN_TOOL             ||
       tool_type == GIMP_TYPE_ERASER_TOOL                 ||
@@ -244,6 +247,7 @@ pressure_options_gui (GimpPressureOption
   /*  the opacity toggle  */
   if (g_type_is_a (tool_type, GIMP_TYPE_PAINTBRUSH_TOOL) ||
       tool_type == GIMP_TYPE_CLONE_TOOL                  ||
+      tool_type == GIMP_TYPE_HEAL_TOOL                   ||
       tool_type == GIMP_TYPE_DODGE_BURN_TOOL             ||
       tool_type == GIMP_TYPE_ERASER_TOOL)
     {
@@ -256,6 +260,7 @@ pressure_options_gui (GimpPressureOption
   /*  the pressure toggle  */
   if (tool_type == GIMP_TYPE_AIRBRUSH_TOOL   ||
       tool_type == GIMP_TYPE_CLONE_TOOL      ||
+      tool_type == GIMP_TYPE_HEAL_TOOL       ||
       tool_type == GIMP_TYPE_CONVOLVE_TOOL   ||
       tool_type == GIMP_TYPE_DODGE_BURN_TOOL ||
       tool_type == GIMP_TYPE_PAINTBRUSH_TOOL ||
@@ -280,6 +285,7 @@ pressure_options_gui (GimpPressureOption
 
   /*  the size toggle  */
   if (tool_type == GIMP_TYPE_CLONE_TOOL      ||
+      tool_type == GIMP_TYPE_HEAL_TOOL       ||
       tool_type == GIMP_TYPE_CONVOLVE_TOOL   ||
       tool_type == GIMP_TYPE_DODGE_BURN_TOOL ||
       tool_type == GIMP_TYPE_ERASER_TOOL     ||
@@ -323,6 +329,7 @@ fade_options_gui (GimpFadeOptions  *fade
 
   if (g_type_is_a (tool_type, GIMP_TYPE_PAINTBRUSH_TOOL) ||
       tool_type == GIMP_TYPE_CLONE_TOOL                  ||
+      tool_type == GIMP_TYPE_HEAL_TOOL                   ||
       tool_type == GIMP_TYPE_CONVOLVE_TOOL               ||
       tool_type == GIMP_TYPE_DODGE_BURN_TOOL             ||
       tool_type == GIMP_TYPE_ERASER_TOOL                 ||
@@ -382,6 +389,7 @@ jitter_options_gui (GimpJitterOptions  *
 
   if (g_type_is_a (tool_type, GIMP_TYPE_PAINTBRUSH_TOOL) ||
       tool_type == GIMP_TYPE_CLONE_TOOL                  ||
+      tool_type == GIMP_TYPE_HEAL_TOOL                   ||
       tool_type == GIMP_TYPE_CONVOLVE_TOOL               ||
       tool_type == GIMP_TYPE_DODGE_BURN_TOOL             ||
       tool_type == GIMP_TYPE_ERASER_TOOL                 ||
Index: app/tools/makefile.msc
===================================================================
RCS file: /cvs/gnome/gimp/app/tools/makefile.msc,v
retrieving revision 1.20
diff -u -p -r1.20 makefile.msc
--- app/tools/makefile.msc	25 Sep 2005 19:30:50 -0000	1.20
+++ app/tools/makefile.msc	10 Aug 2006 13:37:12 -0000
@@ -57,6 +57,7 @@ OBJECTS = \
 	gimpforegroundselecttool.obj \
 	gimpfreeselecttool.obj \
 	gimpfuzzyselecttool.obj \
+  gimphealtool.obj \
 	gimphistogramoptions.obj \
 	gimphuesaturationtool.obj \
 	gimpimagemapoptions.obj \
Index: app/widgets/gimpcursor.c
===================================================================
RCS file: /cvs/gnome/gimp/app/widgets/gimpcursor.c,v
retrieving revision 1.58
diff -u -p -r1.58 gimpcursor.c
--- app/widgets/gimpcursor.c	2 Jun 2006 15:11:15 -0000	1.58
+++ app/widgets/gimpcursor.c	10 Aug 2006 13:37:13 -0000
@@ -112,6 +112,8 @@
 #include "cursors/xbm/tool-airbrush-mask.xbm"
 #include "cursors/xbm/tool-clone.xbm"
 #include "cursors/xbm/tool-clone-mask.xbm"
+#include "cursors/xbm/tool-heal.xbm"
+#include "cursors/xbm/tool-heal-mask.xbm"
 #include "cursors/xbm/tool-blur.xbm"
 #include "cursors/xbm/tool-blur-mask.xbm"
 #include "cursors/xbm/tool-ink.xbm"
@@ -438,6 +440,13 @@ static GimpCursor gimp_tool_cursors[] =
     0, 0,
     tool_clone, NULL, NULL, NULL
   },
+  {
+    tool_heal_bits, tool_heal_mask_bits,
+    tool_heal_width, tool_heal_height,
+    0, 0,
+    tool_heal, NULL, NULL, NULL
+  },
+
   {
     tool_eraser_bits, tool_eraser_mask_bits,
     tool_eraser_width, tool_eraser_height,
Index: app/widgets/gimphelp-ids.h
===================================================================
RCS file: /cvs/gnome/gimp/app/widgets/gimphelp-ids.h,v
retrieving revision 1.77
diff -u -p -r1.77 gimphelp-ids.h
--- app/widgets/gimphelp-ids.h	13 Jun 2006 02:03:44 -0000	1.77
+++ app/widgets/gimphelp-ids.h	10 Aug 2006 13:37:13 -0000
@@ -253,6 +253,7 @@
 #define GIMP_HELP_TOOL_FREE_SELECT                "gimp-tool-free-select"
 #define GIMP_HELP_TOOL_FOREGROUND_SELECT          "gimp-tool-foreground-select"
 #define GIMP_HELP_TOOL_FUZZY_SELECT               "gimp-tool-fuzzy-select"
+#define GIMP_HELP_TOOL_HEAL                       "gimp-tool-heal"
 #define GIMP_HELP_TOOL_HUE_SATURATION             "gimp-tool-hue-saturation"
 #define GIMP_HELP_TOOL_INK                        "gimp-tool-ink"
 #define GIMP_HELP_TOOL_ISCISSORS                  "gimp-tool-iscissors"
Index: app/widgets/widgets-enums.h
===================================================================
RCS file: /cvs/gnome/gimp/app/widgets/widgets-enums.h,v
retrieving revision 1.47
diff -u -p -r1.47 widgets-enums.h
--- app/widgets/widgets-enums.h	2 Jun 2006 15:23:47 -0000	1.47
+++ app/widgets/widgets-enums.h	10 Aug 2006 13:37:14 -0000
@@ -251,6 +251,7 @@ typedef enum  /*< skip >*/
   GIMP_TOOL_CURSOR_AIRBRUSH,
   GIMP_TOOL_CURSOR_INK,
   GIMP_TOOL_CURSOR_CLONE,
+  GIMP_TOOL_CURSOR_HEAL,
   GIMP_TOOL_CURSOR_ERASER,
   GIMP_TOOL_CURSOR_SMUDGE,
   GIMP_TOOL_CURSOR_BLUR,
Index: cursors/Makefile.am
===================================================================
RCS file: /cvs/gnome/gimp/cursors/Makefile.am,v
retrieving revision 1.11
diff -u -p -r1.11 Makefile.am
--- cursors/Makefile.am	2 Jun 2006 15:11:17 -0000	1.11
+++ cursors/Makefile.am	10 Aug 2006 13:37:14 -0000
@@ -46,6 +46,7 @@ CURSOR_IMAGES = \
 	tool-free-select.png		\
 	tool-fuzzy-select.png		\
 	tool-hand.png			\
+	tool-heal.png			\
 	tool-ink.png			\
 	tool-iscissors.png		\
 	tool-measure.png		\
@@ -193,7 +194,9 @@ EXTRA_DIST = \
 	xbm/tool-measure.xbm			\
 	xbm/tool-measure-mask.xbm		\
 	xbm/tool-hand.xbm			\
-	xbm/tool-hand-mask.xbm
+	xbm/tool-hand-mask.xbm		\
+	xbm/tool-heal.xbm \
+  xbm/tool-heal-mask.xbm
 
 noinst_DATA = gimp-tool-cursors.h
 
Index: cursors/makefile.msc
===================================================================
RCS file: /cvs/gnome/gimp/cursors/makefile.msc,v
retrieving revision 1.2
diff -u -p -r1.2 makefile.msc
--- cursors/makefile.msc	25 Sep 2005 19:30:51 -0000	1.2
+++ cursors/makefile.msc	10 Aug 2006 13:37:14 -0000
@@ -35,6 +35,7 @@ CURSOR_LIST = \
 	tool_free_select		tool-free-select.png \
 	tool_fuzzy_select		tool-fuzzy-select.png \
 	tool_hand		tool-hand.png \
+  tool_heal   tool-heal.png \
 	tool_ink		tool-ink.png \
 	tool_iscissors		tool-iscissors.png \
 	tool_measure		tool-measure.png \
Index: cursors/tool-heal.png
===================================================================
RCS file: cursors/tool-heal.png
diff -N cursors/tool-heal.png
Binary files /dev/null and tool-heal.png differ
Index: cursors/xbm/tool-heal-mask.xbm
===================================================================
RCS file: cursors/xbm/tool-heal-mask.xbm
diff -N cursors/xbm/tool-heal-mask.xbm
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ cursors/xbm/tool-heal-mask.xbm	10 Aug 2006 13:37:14 -0000
@@ -0,0 +1,14 @@
+#define tool_heal_mask_width 32
+#define tool_heal_mask_height 32
+static unsigned char tool_heal_mask_bits[] = {
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07,
+   0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf8, 0x0f,
+   0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xe0, 0x03,
+   0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x80, 0xff, 0xff,
+   0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff,
+   0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, 0xfe, 0x3f };
Index: cursors/xbm/tool-heal.xbm
===================================================================
RCS file: cursors/xbm/tool-heal.xbm
diff -N cursors/xbm/tool-heal.xbm
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ cursors/xbm/tool-heal.xbm	10 Aug 2006 13:37:14 -0000
@@ -0,0 +1,14 @@
+#define tool_heal_width 32
+#define tool_heal_height 32
+static unsigned char tool_heal_bits[] = {
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x20, 0x03, 0x00,
+   0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x40, 0x0a, 0x00,
+   0x00, 0x20, 0x18, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x08, 0x60, 0x00,
+   0x00, 0x02, 0xc0, 0x01, 0x00, 0x03, 0xc0, 0x01, 0x00, 0x03, 0xc0, 0x01,
+   0x00, 0x00, 0xc0, 0x03, 0x00, 0x08, 0x60, 0x02, 0x00, 0x10, 0xb0, 0x02,
+   0x00, 0x20, 0x10, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x86, 0x03, 0x00,
+   0x00, 0x80, 0x03, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
Index: libgimpwidgets/gimpstock.c
===================================================================
RCS file: /cvs/gnome/gimp/libgimpwidgets/gimpstock.c,v
retrieving revision 1.87
diff -u -p -r1.87 gimpstock.c
--- libgimpwidgets/gimpstock.c	16 Jun 2006 15:06:57 -0000	1.87
+++ libgimpwidgets/gimpstock.c	10 Aug 2006 13:37:17 -0000
@@ -287,6 +287,7 @@ static const GtkStockItem gimp_stock_ite
   { GIMP_STOCK_TOOL_FOREGROUND_SELECT,   NULL,        0, 0, LIBGIMP_DOMAIN },
   { GIMP_STOCK_TOOL_FUZZY_SELECT,        NULL,        0, 0, LIBGIMP_DOMAIN },
   { GIMP_STOCK_TOOL_HUE_SATURATION,      NULL,        0, 0, LIBGIMP_DOMAIN },
+  { GIMP_STOCK_TOOL_HEAL,                NULL,        0, 0, LIBGIMP_DOMAIN },
   { GIMP_STOCK_TOOL_INK,                 NULL,        0, 0, LIBGIMP_DOMAIN },
   { GIMP_STOCK_TOOL_ISCISSORS,           NULL,        0, 0, LIBGIMP_DOMAIN },
   { GIMP_STOCK_TOOL_LEVELS,              NULL,        0, 0, LIBGIMP_DOMAIN },
@@ -422,6 +423,7 @@ gimp_stock_button_pixbufs[] =
   { GIMP_STOCK_TOOL_FREE_SELECT,         stock_tool_free_select_22         },
   { GIMP_STOCK_TOOL_FOREGROUND_SELECT,   stock_tool_foreground_select_22   },
   { GIMP_STOCK_TOOL_FUZZY_SELECT,        stock_tool_fuzzy_select_22        },
+  { GIMP_STOCK_TOOL_HEAL,                stock_tool_heal_22                },
   { GIMP_STOCK_TOOL_HUE_SATURATION,      stock_tool_hue_saturation_22      },
   { GIMP_STOCK_TOOL_INK,                 stock_tool_ink_22                 },
   { GIMP_STOCK_TOOL_ISCISSORS,           stock_tool_iscissors_22           },
@@ -568,6 +570,7 @@ gimp_stock_menu_pixbufs[] =
   { GIMP_STOCK_TOOL_FREE_SELECT,         stock_tool_free_select_16         },
   { GIMP_STOCK_TOOL_FOREGROUND_SELECT,   stock_tool_foreground_select_16   },
   { GIMP_STOCK_TOOL_FUZZY_SELECT,        stock_tool_fuzzy_select_16        },
+  { GIMP_STOCK_TOOL_HEAL,                stock_tool_heal_16                },
   { GIMP_STOCK_TOOL_HUE_SATURATION,      stock_tool_hue_saturation_16      },
   { GIMP_STOCK_TOOL_INK,                 stock_tool_ink_16                 },
   { GIMP_STOCK_TOOL_ISCISSORS,           stock_tool_iscissors_16           },
Index: libgimpwidgets/gimpstock.h
===================================================================
RCS file: /cvs/gnome/gimp/libgimpwidgets/gimpstock.h,v
retrieving revision 1.68
diff -u -p -r1.68 gimpstock.h
--- libgimpwidgets/gimpstock.h	16 Jun 2006 15:06:57 -0000	1.68
+++ libgimpwidgets/gimpstock.h	10 Aug 2006 13:37:17 -0000
@@ -118,6 +118,7 @@ G_BEGIN_DECLS
 #define GIMP_STOCK_TOOL_FREE_SELECT         "gimp-tool-free-select"
 #define GIMP_STOCK_TOOL_FOREGROUND_SELECT   "gimp-tool-foreground-select"
 #define GIMP_STOCK_TOOL_FUZZY_SELECT        "gimp-tool-fuzzy-select"
+#define GIMP_STOCK_TOOL_HEAL                "gimp-tool-heal"
 #define GIMP_STOCK_TOOL_HUE_SATURATION      "gimp-tool-hue-saturation"
 #define GIMP_STOCK_TOOL_INK                 "gimp-tool-ink"
 #define GIMP_STOCK_TOOL_ISCISSORS           "gimp-tool-iscissors"
Index: po/Makefile.in.in
===================================================================
RCS file: /cvs/gnome/gimp/po/Makefile.in.in,v
retrieving revision 1.48
diff -u -p -r1.48 Makefile.in.in
--- po/Makefile.in.in	14 Jul 2006 13:37:56 -0000	1.48
+++ po/Makefile.in.in	10 Aug 2006 13:37:19 -0000
@@ -11,13 +11,17 @@
 #
 # - Modified by jacob berkman <jacob@ximian.com> to install
 #   Makefile.in.in and po2tbl.sed.in for use with glib-gettextize
+#
+# - Modified by Rodney Dawes <dobey@novell.com> for use with intltool
+#
+# We have the following line for use by intltoolize:
+# INTLTOOL_MAKEFILE
 
 GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
 PACKAGE = @PACKAGE@
 VERSION = @VERSION@
 
 SHELL = /bin/sh
-@SET_MAKE@
 
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
@@ -27,20 +31,19 @@ VPATH = @srcdir@
 prefix = @prefix@
 exec_prefix = @exec_prefix@
 datadir = @datadir@
+datarootdir = @datarootdir@
 libdir = @libdir@
-localedir = $(libdir)/locale
-gnulocaledir = $(datadir)/locale
-gettextsrcdir = $(datadir)/glib-2.0/gettext/po
+DATADIRNAME = @DATADIRNAME@
+itlocaledir = $(prefix)/$(DATADIRNAME)/locale
 subdir = po
 install_sh = @install_sh@
-mkdir_p = @mkdir_p@
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+# Automake >= 1.8 provides @mkdir_p@.
+# Until it can be supposed, use the safe fallback:
+mkdir_p = $(install_sh) -d
 
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 
-CC = @CC@
-GENCAT = @GENCAT@
 GMSGFMT = @GMSGFMT@
 MSGFMT = @MSGFMT@
 XGETTEXT = @XGETTEXT@
@@ -49,35 +52,26 @@ INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
 MSGMERGE = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist
 GENPOT   = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot
 
-DEFS = @DEFS@
-CFLAGS = @CFLAGS@
-CPPFLAGS = @CPPFLAGS@
-
-INCLUDES = -I.. -I$(top_srcdir)/intl
-
-COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
-
-SOURCES = 
-POFILES = @POFILES@
-GMOFILES = @GMOFILES@
-DISTFILES = ChangeLog Makefile.in.in POTFILES.in \
-$(POFILES) $(GMOFILES) $(SOURCES)
+ALL_LINGUAS = @ALL_LINGUAS@
+
+PO_LINGUAS=$(shell if test -r $(srcdir)/LINGUAS; then grep -v "^\#" $(srcdir)/LINGUAS; fi)
+
+POFILES=$(shell if test -n "$(PO_LINGUAS)"; then LINGUAS="$(PO_LINGUAS)"; else LINGUAS="$(ALL_LINGUAS)"; fi; for lang in $$LINGUAS; do printf "$$lang.po "; done)
+
+DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(POFILES)
+EXTRA_DISTFILES = POTFILES.skip Makevars LINGUAS
 
 POTFILES = \
+#This Gets Replace for some reason
 
-CATALOGS = @CATALOGS@
-CATOBJEXT = @CATOBJEXT@
-INSTOBJEXT = @INSTOBJEXT@
+CATALOGS=$(shell if test -n "$(PO_LINGUAS)"; then LINGUAS="$(PO_LINGUAS)"; else LINGUAS="$(ALL_LINGUAS)"; fi; for lang in $$LINGUAS; do printf "$$lang.gmo "; done)
 
 .SUFFIXES:
-.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
-
-.c.o:
-	$(COMPILE) $<
+.SUFFIXES: .po .pox .gmo .mo .msg .cat
 
 .po.pox:
 	$(MAKE) $(GETTEXT_PACKAGE).pot
-	$(MSGMERGE) $< $(top_builddir)/po/$(GETTEXT_PACKAGE).pot -o $*pox
+	$(MSGMERGE) $< $(GETTEXT_PACKAGE).pot -o $*.pox
 
 .po.mo:
 	$(MSGFMT) -o $@ $<
@@ -88,7 +82,7 @@ INSTOBJEXT = @INSTOBJEXT@
 
 .po.cat:
 	sed -f ../intl/po2msg.sed < $< > $*.msg \
-	  && rm -f $@ && $(GENCAT) $@ $*.msg
+	  && rm -f $@ && gencat $@ $*.msg
 
 
 all: all-@USE_NLS@
@@ -99,115 +93,98 @@ all-no:
 $(GETTEXT_PACKAGE).pot: $(POTFILES)
 	$(GENPOT)
 
-install: install-exec install-data
-install-exec:
+install: install-data
 install-data: install-data-@USE_NLS@
 install-data-no: all
 install-data-yes: all
-	if test -n "$(MKINSTALLDIRS)"; then \
-	  $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
+	$(mkdir_p) $(DESTDIR)$(itlocaledir)
+	if test -n "$(PO_LINGUAS)"; then \
+	  linguas="$(PO_LINGUAS)"; \
 	else \
-	  $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
-	fi
-	@catalogs='$(CATALOGS)'; \
-	for cat in $$catalogs; do \
-	  cat=`basename $$cat`; \
-	  case "$$cat" in \
-	    *.gmo) destdir=$(gnulocaledir);; \
-	    *)     destdir=$(localedir);; \
-	  esac; \
-	  lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
-	  dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
-	  if test -n "$(MKINSTALLDIRS)"; then \
-	    $(MKINSTALLDIRS) $$dir; \
-	  else \
-	    $(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \
-	  fi; \
-	  if test -r $$cat; then \
-	    $(INSTALL_DATA) $$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
-	    echo "installing $$cat as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
-	  else \
-	    $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
-	    echo "installing $(srcdir)/$$cat as" \
-		 "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
-	  fi; \
-	  if test -r $$cat.m; then \
-	    $(INSTALL_DATA) $$cat.m $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
-	    echo "installing $$cat.m as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \
-	  else \
-	    if test -r $(srcdir)/$$cat.m ; then \
-	      $(INSTALL_DATA) $(srcdir)/$$cat.m \
-		$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
-	      echo "installing $(srcdir)/$$cat as" \
-		   "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \
+	  linguas="$(ALL_LINGUAS)"; \
+	fi; \
+	for lang in $$linguas; do \
+	  dir=$(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES; \
+	  $(mkdir_p) $$dir; \
+	  if test -r $$lang.gmo; then \
+	    $(INSTALL_DATA) $$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \
+	    echo "installing $$lang.gmo as $$dir/$(GETTEXT_PACKAGE).mo"; \
+	  else \
+	    $(INSTALL_DATA) $(srcdir)/$$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \
+	    echo "installing $(srcdir)/$$lang.gmo as" \
+		 "$$dir/$(GETTEXT_PACKAGE).mo"; \
+	  fi; \
+	  if test -r $$lang.gmo.m; then \
+	    $(INSTALL_DATA) $$lang.gmo.m $$dir/$(GETTEXT_PACKAGE).mo.m; \
+	    echo "installing $$lang.gmo.m as $$dir/$(GETTEXT_PACKAGE).mo.m"; \
+	  else \
+	    if test -r $(srcdir)/$$lang.gmo.m ; then \
+	      $(INSTALL_DATA) $(srcdir)/$$lang.gmo.m \
+		$$dir/$(GETTEXT_PACKAGE).mo.m; \
+	      echo "installing $(srcdir)/$$lang.gmo.m as" \
+		   "$$dir/$(GETTEXT_PACKAGE).mo.m"; \
 	    else \
 	      true; \
 	    fi; \
 	  fi; \
 	done
-	if test "$(PACKAGE)" = "glib"; then \
-	  if test -n "$(MKINSTALLDIRS)"; then \
-	    $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
-	  else \
-	    $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
-	  fi; \
-	  $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
-			  $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
-	else \
-	  : ; \
-	fi
+
+# Empty stubs to satisfy archaic automake needs
+dvi info tags TAGS ID:
 
 # Define this as empty until I found a useful application.
 installcheck:
 
 uninstall:
-	catalogs='$(CATALOGS)'; \
-	for cat in $$catalogs; do \
-	  cat=`basename $$cat`; \
-	  lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
-	  rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
-	  rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
-	  rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
-	  rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
+	if test -n "$(PO_LINGUAS)"; then \
+	  linguas="$(PO_LINGUAS)"; \
+	else \
+	  linguas="$(ALL_LINGUAS)"; \
+	fi; \
+	for lang in $$linguas; do \
+	  rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \
+	  rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo.m; \
 	done
-	if test "$(PACKAGE)" = "glib"; then \
-	  rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
-	fi
 
-check: all
-
-dvi info tags TAGS ID:
+check: all $(GETTEXT_PACKAGE).pot
 
 mostlyclean:
-	rm -f core core.* *.pox $(GETTEXT_PACKAGE).pot *.old.po cat-id-tbl.tmp
-	rm -fr *.o
+	rm -f *.pox $(GETTEXT_PACKAGE).pot *.old.po cat-id-tbl.tmp
 	rm -f .intltool-merge-cache
 
 clean: mostlyclean
 
 distclean: clean
-	rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
+	rm -f Makefile Makefile.in POTFILES stamp-it
+	rm -f *.mo *.msg *.cat *.cat.m *.gmo
 
 maintainer-clean: distclean
 	@echo "This command is intended for maintainers to use;"
 	@echo "it deletes files that may require special tools to rebuild."
-	rm -f $(GMOFILES)
+	rm -f Makefile.in.in
 
-distdir = ../$(GETTEXT_PACKAGE)-$(VERSION)/$(subdir)
-dist distdir: $(DISTFILES) $(GETTEXT_PACKAGE).pot
+distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
+dist distdir: $(DISTFILES)
 	dists="$(DISTFILES)"; \
+	extra_dists="$(EXTRA_DISTFILES)"; \
+	for file in $$extra_dists; do \
+	  test -f $(srcdir)/$$file && dists="$$dists $(srcdir)/$$file"; \
+	done; \
 	for file in $$dists; do \
-	  ln $(srcdir)/$$file $(distdir) 2> /dev/null \
-	    || cp -p $(srcdir)/$$file $(distdir); \
+	  test -f $$file || file="$(srcdir)/$$file"; \
+	  ln $$file $(distdir) 2> /dev/null \
+	    || cp -p $$file $(distdir); \
 	done
 
 update-po: Makefile
 	$(MAKE) $(GETTEXT_PACKAGE).pot
 	tmpdir=`pwd`; \
-	catalogs='$(CATALOGS)'; \
-	for cat in $$catalogs; do \
-	  cat=`basename $$cat`; \
-	  lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
+	if test -n "$(PO_LINGUAS)"; then \
+	  linguas="$(PO_LINGUAS)"; \
+	else \
+	  linguas="$(ALL_LINGUAS)"; \
+	fi; \
+	for lang in $$linguas; do \
 	  echo "$$lang:"; \
 	  result="`$(MSGMERGE) -o $$tmpdir/$$lang.new.po $$lang`"; \
 	  if $$result; then \
@@ -223,32 +200,20 @@ update-po: Makefile
 	      fi; \
 	    fi; \
 	  else \
-	    echo "msgmerge for $$cat failed!"; \
+	    echo "msgmerge for $$lang.gmo failed!"; \
 	    rm -f $$tmpdir/$$lang.new.po; \
 	  fi; \
 	done
 
-# POTFILES is created from POTFILES.in by stripping comments, empty lines
-# and Intltool tags (enclosed in square brackets), and appending a full
-# relative path to them
-POTFILES: POTFILES.in
-	( if test 'x$(srcdir)' != 'x.'; then \
-	    posrcprefix='$(top_srcdir)/'; \
-	  else \
-	    posrcprefix="../"; \
-	  fi; \
-	  rm -f $@-t $@ \
-	    && (sed -e '/^#/d' 						\
-		    -e "s/^\[.*\] +//" 					\
-		    -e '/^[ 	]*$$/d' 				\
-		    -e "s@.*@	$$posrcprefix& \\\\@" < $(srcdir)/$@.in	\
-		| sed -e '$$s/\\$$//') > $@-t \
-	    && chmod a-w $@-t \
-	    && mv $@-t $@ )
+Makefile POTFILES: stamp-it
+	@if test ! -f $@; then \
+	  rm -f stamp-it; \
+	  $(MAKE) stamp-it; \
+	fi
 
-Makefile: Makefile.in.in ../config.status POTFILES
+stamp-it: Makefile.in.in ../config.status POTFILES.in
 	cd .. \
-	  && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
+	  && CONFIG_FILES=$(subdir)/Makefile.in CONFIG_HEADERS= CONFIG_LINKS= \
 	       $(SHELL) ./config.status
 
 # Tell versions [3.59,3.63) of GNU make not to export all variables.
Index: themes/Default/images/Makefile.am
===================================================================
RCS file: /cvs/gnome/gimp/themes/Default/images/Makefile.am,v
retrieving revision 1.89
diff -u -p -r1.89 Makefile.am
--- themes/Default/images/Makefile.am	20 Jun 2006 14:18:49 -0000	1.89
+++ themes/Default/images/Makefile.am	10 Aug 2006 13:37:19 -0000
@@ -272,6 +272,8 @@ STOCK_TOOL_IMAGES = \
 	tools/stock-tool-fuzzy-select-22.png		\
 	tools/stock-tool-hue-saturation-16.png		\
 	tools/stock-tool-hue-saturation-22.png		\
+	tools/stock-tool-heal-16.png		\
+	tools/stock-tool-heal-22.png		\
 	tools/stock-tool-ink-16.png			\
 	tools/stock-tool-ink-22.png			\
 	tools/stock-tool-iscissors-16.png		\
Index: themes/Default/images/makefile.msc
===================================================================
RCS file: /cvs/gnome/gimp/themes/Default/images/makefile.msc,v
retrieving revision 1.14
diff -u -p -r1.14 makefile.msc
--- themes/Default/images/makefile.msc	25 Sep 2005 19:30:55 -0000	1.14
+++ themes/Default/images/makefile.msc	10 Aug 2006 13:37:20 -0000
@@ -249,6 +249,8 @@ STOCK_TOOL_VARIABLES = \
 	stock_tool_free_select_22		tools/stock-tool-free-select-22.png	\
 	stock_tool_fuzzy_select_16		tools/stock-tool-fuzzy-select-16.png	\
 	stock_tool_fuzzy_select_22		tools/stock-tool-fuzzy-select-22.png	\
+  stock_tool_heal_16		tools/stock-tool-heal-16.png	\
+	stock_tool_heal_22		tools/stock-tool-heal-22.png	\
 	stock_tool_hue_saturation_16		tools/stock-tool-hue-saturation-16.png	\
 	stock_tool_hue_saturation_22		tools/stock-tool-hue-saturation-22.png	\
 	stock_tool_ink_16		tools/stock-tool-ink-16.png	\
Index: themes/Default/images/tools/stock-tool-heal-16.png
===================================================================
RCS file: themes/Default/images/tools/stock-tool-heal-16.png
diff -N themes/Default/images/tools/stock-tool-heal-16.png
Binary files /dev/null and stock-tool-heal-16.png differ
Index: themes/Default/images/tools/stock-tool-heal-22.png
===================================================================
RCS file: themes/Default/images/tools/stock-tool-heal-22.png
diff -N themes/Default/images/tools/stock-tool-heal-22.png
Binary files /dev/null and stock-tool-heal-22.png differ
