Some simple patches to allow us to embed JGimp directly
into the GIMP.










diff -rua gimp-1.2.3/app/brushes_cmds.c gimp-1.2.3.jgimp_embedded/app/brushes_cmds.c
--- gimp-1.2.3/app/brushes_cmds.c	2001-11-13 00:19:07.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/app/brushes_cmds.c	2002-12-29 02:19:46.000000000 -0500
@@ -18,12 +18,12 @@
 
 /* NOTE: This file is autogenerated by pdbgen.pl. */
 
+#include <string.h>
+
 #include "config.h"
 
 #include "procedural_db.h"
 
-#include <string.h>
-
 #include "apptypes.h"
 #include "gimpbrush.h"
 #include "gimpbrushlist.h"



diff -rua gimp-1.2.3/app/brush_select_cmds.c gimp-1.2.3.jgimp_embedded/app/brush_select_cmds.c
--- gimp-1.2.3/app/brush_select_cmds.c	2001-11-13 00:19:07.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/app/brush_select_cmds.c	2002-12-29 02:19:30.000000000 -0500
@@ -18,12 +18,12 @@
 
 /* NOTE: This file is autogenerated by pdbgen.pl. */
 
+#include <string.h>
+
 #include "config.h"
 
 #include "procedural_db.h"
 
-#include <string.h>
-
 #include "apptypes.h"
 #include "brush_select.h"
 #include "gimpbrushlist.h"









diff -rua gimp-1.2.3/app/channels_dialog.c gimp-1.2.3.jgimp_embedded/app/channels_dialog.c
--- gimp-1.2.3/app/channels_dialog.c	2000-12-18 10:14:05.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/app/channels_dialog.c	2002-12-29 13:49:01.000000000 -0500
@@ -2544,7 +2544,7 @@
 		     NULL);
 
   gtk_signal_connect_object (GTK_OBJECT (options->query_box), "destroy",
-			     GTK_SIGNAL_FUNC (g_free),
+			     GTK_SIGNAL_FUNC (free),
 			     (GtkObject *) options);
 
   /*  The main hbox  */
@@ -2707,7 +2707,7 @@
 		     NULL);
 
   gtk_signal_connect_object (GTK_OBJECT (options->query_box), "destroy",
-			     GTK_SIGNAL_FUNC (g_free),
+			     GTK_SIGNAL_FUNC (free),
 			     (GtkObject *) options);
 
   /*  The main hbox  */






diff -rua gimp-1.2.3/app/colormap_dialog.c gimp-1.2.3.jgimp_embedded/app/colormap_dialog.c
--- gimp-1.2.3/app/colormap_dialog.c	2000-12-16 16:36:52.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/app/colormap_dialog.c	2002-12-29 02:25:49.000000000 -0500
@@ -16,6 +16,10 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
 #include "config.h"
 
 #include <gtk/gtk.h>

diff -rua gimp-1.2.3/app/colormap_dialog.i.c gimp-1.2.3.jgimp_embedded/app/colormap_dialog.i.c
--- gimp-1.2.3/app/colormap_dialog.i.c	2000-04-27 13:27:27.000000000 -0400
+++ gimp-1.2.3.jgimp_embedded/app/colormap_dialog.i.c	2002-12-29 02:25:49.000000000 -0500
@@ -1,9 +1,5 @@
 #include "config.h"
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
 #include <gdk/gdkkeysyms.h>
 
 #include "color_notebook.h"



diff -rua gimp-1.2.3/app/color_notebook.c gimp-1.2.3.jgimp_embedded/app/color_notebook.c
--- gimp-1.2.3/app/color_notebook.c	2000-12-16 16:36:52.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/app/color_notebook.c	2002-12-29 02:22:59.000000000 -0500
@@ -19,15 +19,15 @@
  */
 #define __COLOR_NOTEBOOK_C__ 1
 
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
 #include "config.h"
 
 #include <gmodule.h>
 #include <gtk/gtk.h>
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
 #include "color_notebook.h"
 #include "gimpui.h"
 
@@ -233,7 +233,14 @@
     {
       next = csel->next;
 
+#ifdef free
+#define _refree free
+#undef free
+#endif
       csel->info->m.free (csel->selector_data);
+#ifdef _refree
+#define free _refree
+#endif
 
       csel->info->refs--;
       if (csel->info->refs == 0 && !csel->info->active)






diff -rua gimp-1.2.3/app/commands.c gimp-1.2.3.jgimp_embedded/app/commands.c
--- gimp-1.2.3/app/commands.c	2001-10-09 18:08:20.000000000 -0400
+++ gimp-1.2.3.jgimp_embedded/app/commands.c	2002-12-29 13:51:40.000000000 -0500
@@ -826,7 +826,7 @@
 
   gtk_signal_connect_object (GTK_OBJECT (image_resize->resize->resize_shell),
 			     "destroy",
-			     GTK_SIGNAL_FUNC (g_free),
+			     GTK_SIGNAL_FUNC (free),
 			     (GtkObject *) image_resize);
 
   gtk_widget_show (image_resize->resize->resize_shell);
@@ -863,7 +863,7 @@
 
   gtk_signal_connect_object (GTK_OBJECT (image_scale->resize->resize_shell),
 			     "destroy",
-			     GTK_SIGNAL_FUNC (g_free),
+			     GTK_SIGNAL_FUNC (free),
 			     (GtkObject *) image_scale);
 
   gtk_widget_show (image_scale->resize->resize_shell);



diff -rua gimp-1.2.3/app/convert_cmds.c gimp-1.2.3.jgimp_embedded/app/convert_cmds.c
--- gimp-1.2.3/app/convert_cmds.c	2001-11-13 00:19:09.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/app/convert_cmds.c	2002-12-29 02:26:09.000000000 -0500
@@ -18,12 +18,12 @@
 
 /* NOTE: This file is autogenerated by pdbgen.pl. */
 
+#include <string.h>
+
 #include "config.h"
 
 #include "procedural_db.h"
 
-#include <string.h>
-
 #include "convert.h"
 #include "gimage.h"
 #include "palette.h"







diff -rua gimp-1.2.3/app/datafiles.c gimp-1.2.3.jgimp_embedded/app/datafiles.c
--- gimp-1.2.3/app/datafiles.c	2000-04-23 16:27:39.000000000 -0400
+++ gimp-1.2.3.jgimp_embedded/app/datafiles.c	2002-12-29 02:27:05.000000000 -0500
@@ -18,13 +18,14 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
 #include "config.h"
 
 #include <glib.h>
 
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #ifdef HAVE_UNISTD_H







diff -rua gimp-1.2.3/app/docindex.c gimp-1.2.3.jgimp_embedded/app/docindex.c
--- gimp-1.2.3/app/docindex.c	2001-11-13 00:19:09.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/app/docindex.c	2002-12-29 13:59:53.000000000 -0500
@@ -242,7 +242,7 @@
       else
 	{
 	  g_list_foreach (idea_list, load_from_list, NULL);
-	  g_list_foreach (idea_list, (GFunc) g_free, NULL);
+	  g_list_foreach (idea_list, (GFunc) free, NULL);
 	  g_list_free (idea_list);
 	  idea_list = 0;
 	}
@@ -317,7 +317,7 @@
 {
   if (idea_list)
     {
-      g_list_foreach (idea_list, (GFunc) g_free, NULL);
+      g_list_foreach (idea_list, (GFunc) free, NULL);
       g_list_free (idea_list);
       idea_list = 0;
     }



diff -rua gimp-1.2.3/app/drawable_cmds.c gimp-1.2.3.jgimp_embedded/app/drawable_cmds.c
--- gimp-1.2.3/app/drawable_cmds.c	2001-11-13 00:19:09.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/app/drawable_cmds.c	2002-12-29 02:27:28.000000000 -0500
@@ -18,12 +18,12 @@
 
 /* NOTE: This file is autogenerated by pdbgen.pl. */
 
+#include <string.h>
+
 #include "config.h"
 
 #include "procedural_db.h"
 
-#include <string.h>
-
 #include "apptypes.h"
 #include "channel.h"
 #include "drawable.h"









diff -rua gimp-1.2.3/app/errorconsole.c gimp-1.2.3.jgimp_embedded/app/errorconsole.c
--- gimp-1.2.3/app/errorconsole.c	2000-12-16 16:36:53.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/app/errorconsole.c	2002-12-29 02:27:46.000000000 -0500
@@ -19,14 +19,15 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-#include "config.h"
-
-#include <glib.h>
-
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
+
+#include "config.h"
+
+#include <glib.h>
+
 #ifdef HAVE_DIRENT_H
 #include <dirent.h>
 #endif




diff -rua gimp-1.2.3/app/fileops.c gimp-1.2.3.jgimp_embedded/app/fileops.c
--- gimp-1.2.3/app/fileops.c	2001-11-13 00:19:10.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/app/fileops.c	2002-12-29 02:28:06.000000000 -0500
@@ -17,6 +17,11 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
 #include "config.h"
 
 #ifdef HAVE_SYS_PARAM_H
@@ -27,10 +32,6 @@
 
 #include <ctype.h>
 #include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif

diff -rua gimp-1.2.3/app/fileops_cmds.c gimp-1.2.3.jgimp_embedded/app/fileops_cmds.c
--- gimp-1.2.3/app/fileops_cmds.c	2001-11-13 00:19:10.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/app/fileops_cmds.c	2002-12-29 02:28:22.000000000 -0500
@@ -18,6 +18,8 @@
 
 /* NOTE: This file is autogenerated by pdbgen.pl. */
 
+#include <string.h>
+
 #include "config.h"
 
 #include "procedural_db.h"
@@ -27,7 +29,6 @@
 #define mkdir(path,mode) _mkdir(path)
 #endif
 
-#include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 
@@ -68,12 +69,14 @@
   PlugInProcDef *file_proc;
   ProcRecord *proc;
 
+printf("In file_load_invoker\n");
   file_proc = file_proc_find (load_procs, (gchar *) args[2].value.pdb_pointer);
   if (!file_proc)
     return procedural_db_return_args (&file_load_proc, FALSE);
 
   proc = &file_proc->db_info;
 
+printf("Calling procedural_db_execute with %s as proc name\n", proc->name);
   return procedural_db_execute (proc->name, args);
 }
 











diff -rua gimp-1.2.3/app/general.c gimp-1.2.3.jgimp_embedded/app/general.c
--- gimp-1.2.3/app/general.c	2001-12-24 19:36:18.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/app/general.c	2002-12-29 02:28:41.000000000 -0500
@@ -15,12 +15,13 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
-#include <glib.h>
-
-#include <ctype.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+
+#include <glib.h>
+
+#include <ctype.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <time.h>





diff -rua gimp-1.2.3/app/gimpbrush.c gimp-1.2.3.jgimp_embedded/app/gimpbrush.c
--- gimp-1.2.3/app/gimpbrush.c	2001-10-09 18:08:26.000000000 -0400
+++ gimp-1.2.3.jgimp_embedded/app/gimpbrush.c	2002-12-29 02:28:55.000000000 -0500
@@ -16,13 +16,13 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-#include "config.h"
-
-#include <glib.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 
+#include "config.h"
+
+#include <glib.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #ifdef HAVE_UNISTD_H




diff -rua gimp-1.2.3/app/gimpbrushpipe.c gimp-1.2.3.jgimp_embedded/app/gimpbrushpipe.c
--- gimp-1.2.3/app/gimpbrushpipe.c	2001-10-09 18:08:26.000000000 -0400
+++ gimp-1.2.3.jgimp_embedded/app/gimpbrushpipe.c	2002-12-29 02:29:13.000000000 -0500
@@ -17,13 +17,13 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-#include "config.h"
-
-#include <glib.h>
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
 
+#include "config.h"
+
+#include <glib.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #ifdef HAVE_UNISTD_H
























diff -rua gimp-1.2.3/app/gradient_select_cmds.c gimp-1.2.3.jgimp_embedded/app/gradient_select_cmds.c
--- gimp-1.2.3/app/gradient_select_cmds.c	2001-11-13 00:19:17.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/app/gradient_select_cmds.c	2002-12-29 02:29:45.000000000 -0500
@@ -18,12 +18,12 @@
 
 /* NOTE: This file is autogenerated by pdbgen.pl. */
 
+#include <string.h>
+
 #include "config.h"
 
 #include "procedural_db.h"
 
-#include <string.h>
-
 #include "gimpcontext.h"
 #include "gradient_header.h"
 #include "gradient_select.h"













diff -rua gimp-1.2.3/app/image_cmds.c gimp-1.2.3.jgimp_embedded/app/image_cmds.c
--- gimp-1.2.3/app/image_cmds.c	2001-11-24 17:06:38.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/app/image_cmds.c	2002-12-29 02:30:06.000000000 -0500
@@ -18,12 +18,12 @@
 
 /* NOTE: This file is autogenerated by pdbgen.pl. */
 
+#include <string.h>
+
 #include "config.h"
 
 #include "procedural_db.h"
 
-#include <string.h>
-
 #include "apptypes.h"
 #include "channel.h"
 #include "cursorutil.h"




diff -rua gimp-1.2.3/app/image_render.c gimp-1.2.3.jgimp_embedded/app/image_render.c
--- gimp-1.2.3/app/image_render.c	2000-12-16 16:36:54.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/app/image_render.c	2002-12-30 00:09:03.000000000 -0500
@@ -39,7 +39,7 @@
 
 struct _RenderInfo
 {
-  GDisplay *gdisp;
+  GimpImage *gimage;
   TileManager *src_tiles;
   guint *alpha;
   guchar *scale;
@@ -225,6 +225,7 @@
 	      int       w,
 	      int       h)
 {
+/*
   RenderInfo info;
   int image_type;
 
@@ -243,15 +244,98 @@
       g_message ("unsupported destination bytes per pixel: %d", info.dest_bpp);
       return;
     }
+*/
 
   /* Currently, only RGBA and GRAYA projection types are used - the rest
    * are in case of future need.  -- austin, 28th Nov 1998. */
-  if (image_type != RGBA_GIMAGE && image_type != GRAYA_GIMAGE)
+/*  if (image_type != RGBA_GIMAGE && image_type != GRAYA_GIMAGE)
       g_warning ("using untested projection type %d", image_type);
 
   (* render_funcs[image_type]) (&info);
+*/
+	render_image_into_buffer(gdisp->gimage, gximage_get_data(), gximage_get_bpp(), gximage_get_bpl(),
+								x + gdisp->offset_x, y + gdisp->offset_y,
+								w, h,
+								SCALEFACTOR_X(gdisp),
+								SCALEFACTOR_Y(gdisp));
+
 }
 
+/*
+ * MAT add: Renders into a generic buffer
+ *          rather than a GDisplay object
+ */
+void
+render_image_into_buffer(GimpImage *gimage,
+		void *buffer,
+		int dest_bpp,
+		int dest_bpl,
+		int x,
+		int y,
+		int width,
+		int height,
+		float scale_x,
+		float scale_y)
+{
+  RenderInfo info;
+  int image_type;
+
+  info.gimage = gimage;
+  info.src_tiles = gimage_projection (gimage);
+  info.x = x;
+  info.y = y;
+  info.w = width;
+  info.h = height;
+  info.scalex = scale_x;
+  info.scaley = scale_y;
+  info.src_x = info.x / info.scalex;
+  info.src_y = info.y / info.scaley; 
+  info.src_bpp = gimage_projection_bytes (gimage);
+  info.dest = buffer;
+  info.dest_bpp = dest_bpp;
+  info.dest_bpl = gximage_get_bpl ();
+  info.dest_width = info.w * info.dest_bpp;
+  info.byte_order = gximage_get_byte_order ();
+  info.scale = render_image_accelerate_scaling (width, info.x, info.scalex);
+  info.alpha = NULL;
+
+  switch (gimage_projection_type (gimage))
+    {
+    case RGBA_GIMAGE:
+    case GRAYA_GIMAGE:
+    case INDEXEDA_GIMAGE:
+      info.alpha = render_image_init_alpha (gimage_projection_opacity (gimage));
+      break;
+    default:
+      /* nothing special needs doing */
+      break;
+    }
+
+  /*
+   * End initialization of the info variable
+   */
+
+  image_type = gimage_projection_type (gimage);
+  if ((image_type < 0) || (image_type > 5))
+    {
+      g_message ("unknown gimage projection type: %d",
+		 gimage_projection_type (gimage));
+      return;
+    }
+
+  if ((info.dest_bpp < 1) || (info.dest_bpp > 4))
+    {
+      g_message ("unsupported destination bytes per pixel: %d", info.dest_bpp);
+      return;
+    }
+
+  /* Currently, only RGBA and GRAYA projection types are used - the rest
+   * are in case of future need.  -- austin, 28th Nov 1998. */
+  if (image_type != RGBA_GIMAGE && image_type != GRAYA_GIMAGE)
+      g_warning ("using untested projection type %d", image_type);
+
+  (* render_funcs[image_type]) (&info);
+}
 
 
 /*************************/
@@ -272,7 +356,7 @@
   float error;
   float step;
 
-  cmap = gimage_cmap (info->gdisp->gimage);
+  cmap = gimage_cmap (info->gimage);
 
   y = info->y;
   ye = info->y + info->h;
@@ -344,7 +428,7 @@
   float error;
   float step;
 
-  cmap = gimage_cmap (info->gdisp->gimage);
+  cmap = gimage_cmap (info->gimage);
   alpha = info->alpha;
 
   y = info->y;
@@ -724,7 +808,7 @@
 			int         w,
 			int         h)
 {
-  info->gdisp = gdisp;
+  info->gimage = gdisp->gimage;
   info->src_tiles = gimage_projection (gdisp->gimage);
   info->x = x + gdisp->offset_x;
   info->y = y + gdisp->offset_y;

diff -rua gimp-1.2.3/app/image_render.h gimp-1.2.3.jgimp_embedded/app/image_render.h
--- gimp-1.2.3/app/image_render.h	1998-04-13 01:39:01.000000000 -0400
+++ gimp-1.2.3.jgimp_embedded/app/image_render.h	2002-12-30 00:08:23.000000000 -0500
@@ -42,6 +42,21 @@
 		   int       y,
 		   int       w,
 		   int       h);
+/*
+ * MAT add: Renders into a generic buffer
+ *          rather than a GDisplay object
+ */
+void
+render_image_into_buffer(GimpImage *gimage,  /* The image to render */
+		void *buffer,                        /* The buffer to render to */
+		int dest_bpp,                        /* Destination buffer's bytes per pixel */
+		int dest_bpl,                        /* Destination buffer's bytes per line */
+		int x,                               /* x value to start rendering from */
+		int y,                               /* y value to start rendering from */
+		int width,                           /* width of area to render */
+		int height,                          /* height of area to render */
+		float scale_x,                       /* scale in x of rendering */
+		float scale_y);                      /* scale in y of rendering */
 
 /*
  *  Extern variables














































diff -rua gimp-1.2.3/app/layers_dialog.c gimp-1.2.3.jgimp_embedded/app/layers_dialog.c
--- gimp-1.2.3/app/layers_dialog.c	2001-11-13 00:19:20.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/app/layers_dialog.c	2002-12-29 14:03:19.000000000 -0500
@@ -3566,7 +3566,7 @@
 		     NULL);
 
   gtk_signal_connect_object (GTK_OBJECT (options->query_box), "destroy",
-			     GTK_SIGNAL_FUNC (g_free),
+			     GTK_SIGNAL_FUNC (free),
 			     (GtkObject *) options);
 
   /*  The main vbox  */
@@ -3750,7 +3750,7 @@
 		     NULL);
 
   gtk_signal_connect_object (GTK_OBJECT (options->query_box), "destroy",
-			     GTK_SIGNAL_FUNC (g_free),
+			     GTK_SIGNAL_FUNC (free),
 			     (GtkObject *) options);
 
   /*  The main vbox  */
@@ -3845,7 +3845,7 @@
 		     NULL);
 
   gtk_signal_connect_object (GTK_OBJECT (options->query_box), "destroy",
-			     GTK_SIGNAL_FUNC (g_free),
+			     GTK_SIGNAL_FUNC (free),
 			     (GtkObject *) options);
 
   /*  The radio frame and box  */
@@ -3950,7 +3950,7 @@
 
   gtk_signal_connect_object (GTK_OBJECT (options->resize->resize_shell),
 			     "destroy",
-			     GTK_SIGNAL_FUNC (g_free),
+			     GTK_SIGNAL_FUNC (free),
 			     (GtkObject *) options);
 
   gtk_widget_show (options->resize->resize_shell);
@@ -4036,7 +4036,7 @@
 
   gtk_signal_connect_object (GTK_OBJECT (options->resize->resize_shell),
 			     "destroy",
-			     GTK_SIGNAL_FUNC (g_free),
+			     GTK_SIGNAL_FUNC (free),
 			     (GtkObject *) options);
 
   gtk_widget_show (options->resize->resize_shell);
@@ -4106,7 +4106,7 @@
 		     NULL);
 
   gtk_signal_connect_object (GTK_OBJECT (options->query_box), "destroy",
-			     GTK_SIGNAL_FUNC (g_free),
+			     GTK_SIGNAL_FUNC (free),
 			     (GtkObject *) options);
 
   /*  The main vbox  */









diff -rua gimp-1.2.3/app/main.c gimp-1.2.3.jgimp_embedded/app/main.c
--- gimp-1.2.3/app/main.c	2000-12-16 16:36:54.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/app/main.c	2002-12-21 22:07:18.000000000 -0500
@@ -54,6 +54,8 @@
 
 #include "libgimp/gimpintl.h"
 
+#include "jgimp_gimp_adapter.h"
+
 #ifdef G_OS_WIN32
 #include <windows.h>
 #else
@@ -67,6 +69,8 @@
 				     const gchar    *msg,
 				     gpointer        user_data);
 
+static gboolean run_as_camellie = FALSE;
+
 /* GLOBAL data */
 gboolean no_interface      = FALSE;
 gboolean no_data           = FALSE;
@@ -281,6 +285,11 @@
 	      argv[i] = NULL;
             }
 	}
+      else if (strcmp (argv[i], "--camellie") == 0)  
+	{
+		argv[i] = NULL;
+		run_as_camellie = TRUE;
+	}
       /*
        *    ANYTHING ELSE starting with a '-' is an error.
        */
@@ -349,6 +358,7 @@
       exit (0);
     }
 
+
   g_log_set_handler ("Gimp",
 		     G_LOG_LEVEL_MESSAGE,
 		     gimp_message_func,
@@ -398,6 +408,16 @@
   /* Check the user_installation */
   user_install_verify (init);
 
+  if (run_as_camellie)
+    {
+		/*
+		 * This will install a callback that is regularly called
+		 * from the main event loop. The first time it calls our
+		 * callback, jgimp will load the JVM and install itself.
+		 */
+		jgimp_install_g_main_callback_hooks();
+	}
+
   /* Main application loop */
   if (!app_exit_finish_done ())
     gtk_main ();



diff -rua gimp-1.2.3/app/Makefile.in gimp-1.2.3.jgimp_embedded/app/Makefile.in
--- gimp-1.2.3/app/Makefile.in	2002-02-11 16:46:17.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/app/Makefile.in	2002-12-29 04:13:31.000000000 -0500
@@ -190,6 +190,11 @@
 
 @OS_WIN32_TRUE@noinst_DATA = .libs/libgimpapp.a
 
+# Stub: Fix these later to get this from configure script
+JAVA_DIR = /usr/local/java
+JGIMP_JARFILE_LOCATION=$(libdir)/gimp/1.2/jar_files/extensions/jgimp.jar
+JGIMP_DEFAULT_EXTENSIONS_DIR=$(libdir)/gimp/1.2/jar_files/extensions/
+
 scriptdata = 
 
 bin_PROGRAMS = gimp-1.2
@@ -198,21 +203,21 @@
 libgimpim_a_SOURCES =  	gimpdrawable.c			gimpdrawable.h			gimpdrawableP.h			gimpimage.c			gimpimage.h			gimpimageP.h			gimpobject.c			gimpobject.h			gimppreviewcache.h		gimppreviewcache.c		gimpset.c			gimpset.h			gimpsetP.h			gimpsignal.c			gimpsignal.h
 
 
-gimp_1_2_SOURCES =  	about_dialog.c			about_dialog.h			airbrush.c			airbrush.h			app_procs.c			app_procs.h			appenv.h			apptypes.h			asupsample.c			asupsample.h			authors.h			batch.c				batch.h				bezier_select.c			bezier_select.h			bezier_selectP.h		blend.c				blend.h				blob.c                  	blob.h                  	boundary.c			boundary.h			boundaryF.h			brightness_contrast.c		brightness_contrast.h		brush_edit.c			brush_edit.h			brush_header.h			brush_scale.c			brush_scale.h			brush_select.c			brush_select.h			brush_select_cmds.c		brushes_cmds.c			bucket_fill.c			bucket_fill.h			by_color_select.c		by_color_select.h		channel.c			channel.h			channel_pvt.h			channel_cmds.c			channels_dialog.c		channels_dialog.h		channel_ops.c			channel_ops.h			channel_ops_cmds.c		clone.c				clone.h				color_area.c			color_area.h			color_balance.c			color_balance.h			color_cmds.c			color_notebook.c		color_notebook.h		color_panel.c			color_panel.h			color_picker.c			color_picker.h			color_select.c			color_select.h			color_transfer.c		color_transfer.h		colormaps.c			colormaps.h			colormap_dialog.c		colormap_dialog.h		commands.c			commands.h			context_manager.c		context_manager.h		convert.c			convert.h			convert_cmds.c			convolve.c			convolve.h			crop.c				crop.h				cursorutil.c			cursorutil.h			curves.c			curves.h			datafiles.c			datafiles.h			desaturate.c			desaturate.h			devices.c			devices.h			dialog_types.h			dialog_handler.c		dialog_handler.h		disp_callbacks.c		disp_callbacks.h		display_cmds.c			docindex.c			docindex.h			dodgeburn.c			dodgeburn.h			draw_core.c			draw_core.h			drawable.c			drawable.h			drawable_pvt.h			drawable_cmds.c			edit_cmds.c			edit_selection.c		edit_selection.h		ellipse_select.c		ellipse_select.h		eraser.c			eraser.h			errorconsole.c			errorconsole.h			errors.c			errors.h			equalize.c			equalize.h			fileops.c			fileops.h			fileopsP.h			fileops_cmds.c			flip_tool.c			flip_tool.h			floating_sel.c			floating_sel.h			floating_sel_cmds.c		file_new_dialog.c		file_new_dialog.h		free_select.c			free_select.h			fsdither.h			fuzzy_select.c			fuzzy_select.h			gdisplay.c			gdisplay.h			gdisplayP.h			gdisplayF.h			gdisplay_ops.c			gdisplay_ops.h			general.c			general.h			gimage.c			gimage.h			gimage_mask.c			gimage_mask.h			gimpbrush.c			gimpbrush.h			gimpbrushgenerated.c		gimpbrushgenerated.h		gimpbrushlist.c			gimpbrushlist.h			gimpbrushpipe.c			gimpbrushpipe.h			gimpcontext.c			gimpcontext.h			gimpcontextpreview.c		gimpcontextpreview.h		gimpdnd.c			gimpdnd.h			gimphelp.c			gimphelp.h			gimphistogram.c			gimphistogram.h			gimplist.c			gimplist.h			gimplistP.h			gimplut.c			gimplut.h			gimplutP.h			gimpparasite.c			gimpparasite.h			gimpprogress.c			gimpprogress.h			gimprc.c			gimprc.h			gimprc_cmds.c			gimpui.c			gimpui.h			gimpunit.c			global_edit.c			global_edit.h			gradient.c			gradientP.h			gradient_header.h		gradient_select.h		gradient_select.c		gradient_select_cmds.c		gradient.h			gradients_cmds.c		gtkwrapbox.c			gtkwrapbox.h			gtkhwrapbox.c			gtkhwrapbox.h			gtkvwrapbox.c			gtkvwrapbox.h			guides_cmds.c			gximage.c			gximage.h			help_cmds.c			histogramwidget.c		histogramwidget.h		histogram_tool.c		histogram_tool.h		hue_saturation.c		hue_saturation.h		image_cmds.c			image_map.c			image_map.h			image_new.c			image_new.h			image_render.c			image_render.h			indicator_area.c		indicator_area.h		info_dialog.c			info_dialog.h			info_window.c			info_window.h			ink.c                   	ink.h		        	interface.c			interface.h			internal_procs.c		internal_procs.h		invert.c			invert.h			iscissors.c			iscissors.h			layer.c				layer.h				layer_pvt.h			layer_cmds.c			layer_select.c			layer_select.h			layers_dialog.c			layers_dialog.h			layers_dialogP.h		lc_dialog.c			lc_dialog.h			lc_dialogP.h			levels.c			levels.h			lut_funcs.c			lut_funcs.h			magnify.c			magnify.h			main.c				marching_ants.h			measure.c			measure.h			menus.c				menus.h				message_cmds.c			misc_cmds.c			module_db.c			module_db.h			move.c				move.h				nav_window.c			nav_window.h			ops_buttons.c			ops_buttons.h			palette.c			palette_entries.h		palette.h			palette_cmds.c			palette_select.c		palette_select.h		paletteP.h			paint_core.c			paint_core.h			paint_core_kernels.h		paint_funcs.c			paint_funcs.h			paint_options.h			paintbrush.c			paintbrush.h			parasite_cmds.c			parasitelist.c			parasitelist.h			parasitelistP.h			path.c				path.h				pathP.h				path_transform.h		paths_cmds.c			paths_dialog.c			paths_dialog.h			paths_dialogP.h			pattern_header.h		pattern_select.c		pattern_select.h		pattern_select_cmds.c		patterns.c			patterns.h			patterns_cmds.c			pencil.c			pencil.h			perspective_tool.c		perspective_tool.h		pixel_processor.c		pixel_processor.h		pixel_region.c			pixel_region.h			pixel_regionP.h			pixmaps.h			pixmaps2.h			plug_in.c			plug_in.h			plug_in_cmds.c			posterize.c			posterize.h			preferences_dialog.c		preferences_dialog.h		procedural_db.c			procedural_db.h			procedural_db_cmds.c		qmask.c				qmask.h				rect_select.c			rect_select.h			rect_selectP.h			regex.h				regex.c				resolution_calibrate.c		resolution_calibrate.h		resize.c			resize.h			rotate_tool.c			rotate_tool.h			scale.c				scale.h				scale_tool.c			scale_tool.h			scan_convert.c			scan_convert.h			scroll.c			scroll.h			selection.c			selection.h			selection_cmds.c		selection_options.h		session.h			session.c			shear_tool.c			shear_tool.h			smudge.c			smudge.h			temp_buf.c			temp_buf.h			text_tool.c			text_tool.h			text_tool_cmds.c		threshold.c			threshold.h			tile.c				tile.h				tile_pvt.h			tile_cache.c			tile_cache.h			tile_manager.c			tile_manager.h			tile_manager_pvt.h		tile_swap.c			tile_swap.h			tips_dialog.c			tips_dialog.h			tool_options.c			tool_options.h			tools.c				tools.h				toolsF.h			tools_cmds.c			transform_core.c		transform_core.h		transform_tool.c		transform_tool.h		undo.c				undo.h				undo_cmds.c			undo_history.c			undo_types.h			unitrc.h			unit_cmds.c			user_install.c			user_install.h			wilber.h			xcf.c				xcf.h
+gimp_1_2_SOURCES =  	about_dialog.c			about_dialog.h			airbrush.c			airbrush.h			app_procs.c			app_procs.h			appenv.h			apptypes.h			asupsample.c			asupsample.h			authors.h			batch.c				batch.h				bezier_select.c			bezier_select.h			bezier_selectP.h		blend.c				blend.h				blob.c                  	blob.h                  	boundary.c			boundary.h			boundaryF.h			brightness_contrast.c		brightness_contrast.h		brush_edit.c			brush_edit.h			brush_header.h			brush_scale.c			brush_scale.h			brush_select.c			brush_select.h			brush_select_cmds.c		brushes_cmds.c			bucket_fill.c			bucket_fill.h			by_color_select.c		by_color_select.h		channel.c			channel.h			channel_pvt.h			channel_cmds.c			channels_dialog.c		channels_dialog.h		channel_ops.c			channel_ops.h			channel_ops_cmds.c		clone.c				clone.h				color_area.c			color_area.h			color_balance.c			color_balance.h			color_cmds.c			color_notebook.c		color_notebook.h		color_panel.c			color_panel.h			color_picker.c			color_picker.h			color_select.c			color_select.h			color_transfer.c		color_transfer.h		colormaps.c			colormaps.h			colormap_dialog.c		colormap_dialog.h		commands.c			commands.h			context_manager.c		context_manager.h		convert.c			convert.h			convert_cmds.c			convolve.c			convolve.h			crop.c				crop.h				cursorutil.c			cursorutil.h			curves.c			curves.h			datafiles.c			datafiles.h			desaturate.c			desaturate.h			devices.c			devices.h			dialog_types.h			dialog_handler.c		dialog_handler.h		disp_callbacks.c		disp_callbacks.h		display_cmds.c			docindex.c			docindex.h			dodgeburn.c			dodgeburn.h			draw_core.c			draw_core.h			drawable.c			drawable.h			drawable_pvt.h			drawable_cmds.c			edit_cmds.c			edit_selection.c		edit_selection.h		ellipse_select.c		ellipse_select.h		eraser.c			eraser.h			errorconsole.c			errorconsole.h			errors.c			errors.h			equalize.c			equalize.h			fileops.c			fileops.h			fileopsP.h			fileops_cmds.c			flip_tool.c			flip_tool.h			floating_sel.c			floating_sel.h			floating_sel_cmds.c		file_new_dialog.c		file_new_dialog.h		free_select.c			free_select.h			fsdither.h			fuzzy_select.c			fuzzy_select.h			gdisplay.c			gdisplay.h			gdisplayP.h			gdisplayF.h			gdisplay_ops.c			gdisplay_ops.h			general.c			general.h			gimage.c			gimage.h			gimage_mask.c			gimage_mask.h			gimpbrush.c			gimpbrush.h			gimpbrushgenerated.c		gimpbrushgenerated.h		gimpbrushlist.c			gimpbrushlist.h			gimpbrushpipe.c			gimpbrushpipe.h			gimpcontext.c			gimpcontext.h			gimpcontextpreview.c		gimpcontextpreview.h		gimpdnd.c			gimpdnd.h			gimphelp.c			gimphelp.h			gimphistogram.c			gimphistogram.h			gimplist.c			gimplist.h			gimplistP.h			gimplut.c			gimplut.h			gimplutP.h			gimpparasite.c			gimpparasite.h			gimpprogress.c			gimpprogress.h			gimprc.c			gimprc.h			gimprc_cmds.c			gimpui.c			gimpui.h			gimpunit.c			global_edit.c			global_edit.h			gradient.c			gradientP.h			gradient_header.h		gradient_select.h		gradient_select.c		gradient_select_cmds.c		gradient.h			gradients_cmds.c		gtkwrapbox.c			gtkwrapbox.h			gtkhwrapbox.c			gtkhwrapbox.h			gtkvwrapbox.c			gtkvwrapbox.h			guides_cmds.c			gximage.c			gximage.h			help_cmds.c			histogramwidget.c		histogramwidget.h		histogram_tool.c		histogram_tool.h		hue_saturation.c		hue_saturation.h		image_cmds.c			image_map.c			image_map.h			image_new.c			image_new.h			image_render.c			image_render.h			indicator_area.c		indicator_area.h		info_dialog.c			info_dialog.h			info_window.c			info_window.h			ink.c                   	ink.h		        	interface.c			interface.h			internal_procs.c		internal_procs.h		invert.c			invert.h			iscissors.c			iscissors.h			layer.c				layer.h				layer_pvt.h			layer_cmds.c			layer_select.c			layer_select.h			layers_dialog.c			layers_dialog.h			layers_dialogP.h		lc_dialog.c			lc_dialog.h			lc_dialogP.h			levels.c			levels.h			lut_funcs.c			lut_funcs.h			magnify.c			magnify.h			main.c				marching_ants.h			measure.c			measure.h			menus.c				menus.h				message_cmds.c			misc_cmds.c			module_db.c			module_db.h			move.c				move.h				nav_window.c			nav_window.h			ops_buttons.c			ops_buttons.h			palette.c			palette_entries.h		palette.h			palette_cmds.c			palette_select.c		palette_select.h		paletteP.h			paint_core.c			paint_core.h			paint_core_kernels.h		paint_funcs.c			paint_funcs.h			paint_options.h			paintbrush.c			paintbrush.h			parasite_cmds.c			parasitelist.c			parasitelist.h			parasitelistP.h			path.c				path.h				pathP.h				path_transform.h		paths_cmds.c			paths_dialog.c			paths_dialog.h			paths_dialogP.h			pattern_header.h		pattern_select.c		pattern_select.h		pattern_select_cmds.c		patterns.c			patterns.h			patterns_cmds.c			pencil.c			pencil.h			perspective_tool.c		perspective_tool.h		pixel_processor.c		pixel_processor.h		pixel_region.c			pixel_region.h			pixel_regionP.h			pixmaps.h			pixmaps2.h			plug_in.c			plug_in.h			plug_in_cmds.c			posterize.c			posterize.h			preferences_dialog.c		preferences_dialog.h		procedural_db.c			procedural_db.h			procedural_db_cmds.c		qmask.c				qmask.h				rect_select.c			rect_select.h			rect_selectP.h			regex.h				regex.c				resolution_calibrate.c		resolution_calibrate.h		resize.c			resize.h			rotate_tool.c			rotate_tool.h			scale.c				scale.h				scale_tool.c			scale_tool.h			scan_convert.c			scan_convert.h			scroll.c			scroll.h			selection.c			selection.h			selection_cmds.c		selection_options.h		session.h			session.c			shear_tool.c			shear_tool.h			smudge.c			smudge.h			temp_buf.c			temp_buf.h			text_tool.c			text_tool.h			text_tool_cmds.c		threshold.c			threshold.h			tile.c				tile.h				tile_pvt.h			tile_cache.c			tile_cache.h			tile_manager.c			tile_manager.h			tile_manager_pvt.h		tile_swap.c			tile_swap.h			tips_dialog.c			tips_dialog.h			tool_options.c			tool_options.h			tools.c				tools.h				toolsF.h			tools_cmds.c			transform_core.c		transform_core.h		transform_tool.c		transform_tool.h		undo.c				undo.h				undo_cmds.c			undo_history.c			undo_types.h			unitrc.h			unit_cmds.c			user_install.c			user_install.h			wilber.h			xcf.c				xcf.h			jgimp.c			jgimp.h			jgimp_constants.h			jgimp_data_conversions.c			jgimp_data_conversions.h			jgimp_gimp_adapter.h			jgimp_gimp_embedded_adapter.c			jgimp_extended_proxy.c			jgimp_jni_utils.c			jgimp_jni_utils.h			jgimp_native_functions.c			JGimpPlugInProxy.h
 
 
 EXTRA_DIST =  	colormap_dialog.i.c		colormap_dialog.i.h		colormap_dialog.p.h		colormap_dialog.t.h		makefile.mingw			makefile.mingw.in		makefile.msc			gimp.rc				gimp.sym			wilber.ico			libgimpapp.la
 
 
-gimp_1_2_LDFLAGS = -export-dynamic -export-symbols $(srcdir)/gimp.sym $(mwindows)
+gimp_1_2_LDFLAGS = -export-dynamic -export-symbols $(srcdir)/gimp.sym $(mwindows) 
 
-AM_CPPFLAGS =  	-DLIBDIR=\""$(gimpplugindir)"\"		-DLOCALEDIR=\""$(localedir)"\"		-DREGEX_MALLOC				-DG_LOG_DOMAIN=\"Gimp\"			@GIMP_THREAD_FLAGS@ 			@GIMP_MP_FLAGS@
+AM_CPPFLAGS =  	-DLIBDIR=\""$(gimpplugindir)"\"		-DLOCALEDIR=\""$(localedir)"\"		-DREGEX_MALLOC				-DG_LOG_DOMAIN=\"Gimp\"			@GIMP_THREAD_FLAGS@ 			@GIMP_MP_FLAGS@			-DJGIMP_JARFILE_LOCATION=\"$(JGIMP_JARFILE_LOCATION)\" -DJGIMP_DEFAULT_EXTENSIONS_DIR=\"$(JGIMP_DEFAULT_EXTENSIONS_DIR)\"
 
 
-INCLUDES =  	-I$(top_srcdir)				-I$(top_srcdir)/intl			$(GTK_CFLAGS)				-I$(includedir)
+INCLUDES =  	-I$(top_srcdir)				-I$(top_srcdir)/intl			$(GTK_CFLAGS)				-I$(includedir)			-I$(JAVA_DIR)/include			-I$(JAVA_DIR)/include/linux
 
 
-gimp_1_2_LDADD =  	$(gimp_exp)					$(gimp_win32_resource)				libgimpim.a					$(top_builddir)/libgimp/libgimpi.a		$(GTK_LIBS)					$(GIMP_THREAD_LIBS)				$(GIMP_MP_LIBS)					$(INTLLIBS)
+gimp_1_2_LDADD =  	$(gimp_exp)					$(gimp_win32_resource)				libgimpim.a					$(top_builddir)/libgimp/libgimpi.a		$(GTK_LIBS)					$(GIMP_THREAD_LIBS)				$(GIMP_MP_LIBS)					$(INTLLIBS)			-L$(JAVA_DIR)/jre/lib/i386 -L$(JAVA_DIR)/jre/lib/i386/client -Wl,-rpath,$(JAVA_DIR)/jre/lib/i386:$(JAVA_DIR)/jre/lib/i386/client			-ljava			-lpthread		-L/home/mterry/dmalloc/lib		-ldmallocth
 
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_HEADER = ../config.h
@@ -296,7 +301,13 @@
 tools.$(OBJEXT) tools_cmds.$(OBJEXT) transform_core.$(OBJEXT) \
 transform_tool.$(OBJEXT) undo.$(OBJEXT) undo_cmds.$(OBJEXT) \
 undo_history.$(OBJEXT) unit_cmds.$(OBJEXT) user_install.$(OBJEXT) \
-xcf.$(OBJEXT)
+xcf.$(OBJEXT) \
+jgimp.$(OBJEXT) \
+jgimp_data_conversions.$(OBJEXT) \
+jgimp_extended_proxy.$(OBJEXT) \
+jgimp_gimp_embedded_adapter.$(OBJEXT) \
+jgimp_jni_utils.$(OBJEXT) \
+jgimp_native_functions.$(OBJEXT)
 @OS_WIN32_TRUE@gimp_1_2_DEPENDENCIES =  gimp.exp gimp-win32res.o \
 @OS_WIN32_TRUE@libgimpim.a $(top_builddir)/libgimp/libgimpi.a
 @OS_WIN32_FALSE@gimp_1_2_DEPENDENCIES =  libgimpim.a \
@@ -2653,6 +2664,12 @@
 	gimprc.h parasitelist.h xcf.h drawable_pvt.h gimpdrawableP.h \
 	layer_pvt.h channel_pvt.h tile_manager_pvt.h pathP.h \
 	../libgimp/gimplimits.h ../libgimp/gimpintl.h
+jgimp.o: jgimp.c jgimp.h jgimp_constants.h jgimp_jni_utils.h
+jgimp_data_conversions.o: jgimp_data_conversions.c jgimp_data_conversions.h ../libgimp/gimp.h
+jgimp_extended_proxy.o: jgimp_extended_proxy.c JGimpExtendedProxy.h gimpimage.h
+jgimp_gimp_embedded_adapter.o: jgimp_gimp_embedded_adapter.c jgimp_gimp_adapter.h procedural_db.h gimpdrawable.h ../libgimp/gimp.h
+jgimp_jni_utils.o: jgimp_jni_utils.c jgimp_jni_utils.h jgimp_constants.h
+jgimp_native_functions.o: jgimp_native_functions.c JGimpPlugInProxy.h jgimp_data_conversions.h jgimp_gimp_adapter.h jgimp_constants.h jgimp_jni_utils.h jgimp_plugin_handler.h ../libgimp/gimp.h
 
 info-am:
 info: info-am





diff -rua gimp-1.2.3/app/module_db.c gimp-1.2.3.jgimp_embedded/app/module_db.c
--- gimp-1.2.3/app/module_db.c	2001-10-09 18:08:31.000000000 -0400
+++ gimp-1.2.3.jgimp_embedded/app/module_db.c	2002-12-29 02:30:46.000000000 -0500
@@ -18,12 +18,13 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
+#include <string.h>
+
 #include "config.h"
 
 #include <glib.h>
 
 #include <stdio.h>
-#include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #ifdef HAVE_UNISTD_H





diff -rua gimp-1.2.3/app/paintbrush.c gimp-1.2.3.jgimp_embedded/app/paintbrush.c
--- gimp-1.2.3/app/paintbrush.c	2000-12-18 10:14:06.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/app/paintbrush.c	2002-12-31 17:10:07.000000000 -0500
@@ -24,7 +24,6 @@
 
 #include "appenv.h"
 #include "drawable.h"
-#include "gdisplay.h"
 #include "gimpbrushlist.h"
 #include "gimpui.h"
 #include "gradient.h"
@@ -354,13 +353,13 @@
 		       GimpDrawable *drawable,
 		       int           state)
 {  
-  GDisplay *gdisp = gdisplay_active ();
+  GImage *gimage = NULL;
   double fade_out;
   double gradient_length;	
   double unit_factor;
   
-  g_return_val_if_fail (gdisp != NULL, NULL);
-
+  gimage = drawable_gimage (drawable);
+  g_return_val_if_fail((gimage != NULL), NULL);
 #if TIMED_BRUSH
   static GTimer *timer = NULL;
 #endif
@@ -380,13 +379,13 @@
 	  fade_out = paintbrush_options->fade_out;
 	  break;
 	case GIMP_UNIT_PERCENT:
-	  fade_out = MAX (gdisp->gimage->width, gdisp->gimage->height) * 
+	  fade_out = MAX (gimage->width, gimage->height) * 
 	    paintbrush_options->fade_out / 100;
 	  break;
 	default:
 	  unit_factor = gimp_unit_get_factor (paintbrush_options->fade_unit);
 	  fade_out = paintbrush_options->fade_out * 
-	    MAX (gdisp->gimage->xresolution, gdisp->gimage->yresolution) / unit_factor;
+	    MAX (gimage->xresolution, gimage->yresolution) / unit_factor;
 	  break;
 	}
       
@@ -396,13 +395,13 @@
 	  gradient_length = paintbrush_options->gradient_length;
 	  break;
 	case GIMP_UNIT_PERCENT:
-	  gradient_length = MAX (gdisp->gimage->width, gdisp->gimage->height) * 
+	  gradient_length = MAX (gimage->width, gimage->height) * 
 	    paintbrush_options->gradient_length / 100;
 	  break;
 	default:
 	  unit_factor = gimp_unit_get_factor (paintbrush_options->gradient_unit);
 	  gradient_length = paintbrush_options->gradient_length * 
-	    MAX (gdisp->gimage->xresolution, gdisp->gimage->yresolution) / unit_factor;
+	    MAX (gimage->xresolution, gimage->yresolution) / unit_factor;
 	  break;
 	}
       



diff -rua gimp-1.2.3/app/paint_core.c gimp-1.2.3.jgimp_embedded/app/paint_core.c
--- gimp-1.2.3/app/paint_core.c	2001-11-13 00:19:21.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/app/paint_core.c	2002-12-30 19:45:15.000000000 -0500
@@ -374,6 +374,143 @@
   paint_core->brush = current_brush;
 }
 
+
+/*
+ * Non-GUI, but interactive paint tool for alternative GUI
+ * implementations. Adapted from paint_core_button_press by
+ * MAT.
+ *
+ * This function assumes that tool has its private data
+ * intialized to a PaintCore object.
+ *
+ * Use the start_options to specify how to set up the input
+ * variables (x/y/pressure/tilts/distances).
+ *
+ * This function only does painting, and does not do auxiliary
+ * stuff like picking colors or restricting line drawing to
+ * certain angles. No external state from the keyboard
+ * or mouse is passed in either. It is assumed that all these
+ * details are handled prior to calling this function.
+ *
+ */
+void
+paint_core_non_gui_start_painting (Tool *tool, 
+             GimpDrawable *drawable,
+			 NonGUIPaintStartOptions start_options,
+             gdouble x,
+			 gdouble y,
+			 double pressure,
+			 double xtilt,
+			 double ytilt
+#ifdef GTK_HAVE_SIX_VALUATORS
+			 , double wheel
+#endif /* GTK_HAVE_SIX_VALUATORS */
+		)
+{
+  PaintCore    *paint_core;
+  GimpBrush    *current_brush;
+  gboolean      draw_line;
+
+  g_return_if_fail (tool != NULL);
+  paint_core = (PaintCore *) tool->private;
+
+  g_return_if_fail (paint_core != NULL);
+  g_return_if_fail (drawable != NULL);
+
+  if (! paint_core_init (paint_core, drawable, x, y))
+    return;
+
+  draw_line = FALSE;
+
+  paint_core->curpressure = pressure;
+  paint_core->curxtilt = xtilt;
+  paint_core->curytilt = ytilt;
+#ifdef GTK_HAVE_SIX_VALUATORS
+  paint_core->curwheel = wheel;
+#endif /* GTK_HAVE_SIX_VALUATORS */ 
+  paint_core->state = 0;
+  paint_core->pick_state = FALSE;
+
+  tool->state        = ACTIVE;
+  tool->gdisp_ptr    = NULL;
+  tool->paused_count = 0;
+
+  if (start_options == NON_GUI_PAINT_REINITIALIZE_INPUT_VALUES)
+  {
+      /*  initialize some values  */
+      paint_core->startx        = paint_core->lastx        = paint_core->curx = x;
+      paint_core->starty        = paint_core->lasty        = paint_core->cury = y;
+      paint_core->startpressure = paint_core->lastpressure = paint_core->curpressure;
+      paint_core->startytilt    = paint_core->lastytilt    = paint_core->curytilt;
+      paint_core->startxtilt    = paint_core->lastxtilt    = paint_core->curxtilt;
+#ifdef GTK_HAVE_SIX_VALUATORS
+      paint_core->startwheel    = paint_core->lastwheel    = paint_core->curwheel;
+#endif /* GTK_HAVE_SIX_VALUATORS */
+      paint_core->distance   = 0.0;
+    }
+
+  /*  If shift is down and this is not the first paint
+   *  stroke, then draw a line from the last coords to the pointer
+   */
+  else if (start_options == NON_GUI_PAINT_DRAW_LINE_FROM_LAST_POSITION)
+    {
+      draw_line = TRUE;
+      paint_core->startx        = paint_core->lastx;
+      paint_core->starty        = paint_core->lasty;
+      paint_core->startpressure = paint_core->lastpressure;
+      paint_core->startxtilt    = paint_core->lastxtilt;
+      paint_core->startytilt    = paint_core->lastytilt;
+#ifdef GTK_HAVE_SIX_VALUATORS
+      paint_core->startwheel    = paint_core->lastwheel;
+#endif /* GTK_HAVE_SIX_VALUATORS */
+
+    }
+
+  /*  Let the specific painting function initialize itself  */
+  (* paint_core->paint_func) (paint_core, drawable, INIT_PAINT);
+
+  /*  store the current brush pointer  */
+  current_brush = paint_core->brush;
+
+  /*  Paint to the image  */
+  if (draw_line)
+    {
+      paint_core_interpolate (paint_core, drawable);
+
+      paint_core->lastx        = paint_core->curx;
+      paint_core->lasty        = paint_core->cury;
+      paint_core->lastpressure = paint_core->curpressure;
+      paint_core->lastxtilt    = paint_core->curxtilt;
+      paint_core->lastytilt    = paint_core->curytilt;
+#ifdef GTK_HAVE_SIX_VALUATORS
+      paint_core->lastwheel    = paint_core->curwheel;
+#endif /* GTK_HAVE_SIX_VALUATORS */
+    }
+  else
+    {
+      /* If we current point == last point, check if the brush
+       * wants to be painted in that case. (Direction dependent
+       * pixmap brush pipes don't, as they don't know which
+       * pixmap to select.)
+       */
+      if (paint_core->lastx != paint_core->curx
+	  || paint_core->lasty != paint_core->cury
+	  || (* GIMP_BRUSH_CLASS (GTK_OBJECT (paint_core->brush)
+				  ->klass)->want_null_motion) (paint_core))
+	{
+	  if (paint_core->flags & TOOL_CAN_HANDLE_CHANGING_BRUSH)
+	    paint_core->brush =
+	      (* GIMP_BRUSH_CLASS (GTK_OBJECT (paint_core->brush)
+				   ->klass)->select_brush) (paint_core);
+
+	  (* paint_core->paint_func) (paint_core, drawable, MOTION_PAINT);
+	}
+    }
+
+  /*  restore the current brush pointer  */
+  paint_core->brush = current_brush;
+}
+
 void
 paint_core_button_release (Tool           *tool,
 			   GdkEventButton *bevent,
@@ -408,6 +545,37 @@
   gdisplays_flush ();
 }
 
+/*
+ * Non-GUI, but interactive paint tool for alternative GUI
+ * implementations. Adapted from paint_core_button_release by
+ * MAT.
+ *
+ * This function assumes that tool has its private data
+ * intialized to a PaintCore object.
+ *
+ * This function only does painting, and does not do auxiliary
+ * stuff like flushing the displays.
+ *
+ */
+void
+paint_core_non_gui_stop_painting (Tool *tool,
+                                  GimpDrawable *drawable)
+{
+  PaintCore *paint_core;
+
+  paint_core = (PaintCore *) tool->private;
+
+  /*  Let the specific painting function finish up  */
+  (* paint_core->paint_func) (paint_core, drawable, FINISH_PAINT);
+
+  /*  Set tool state to inactive -- no longer painting */
+  tool->state = INACTIVE;
+
+  paint_core->pick_state = FALSE;
+
+  paint_core_finish (paint_core, drawable, tool->ID);
+}
+
 void
 paint_core_motion (Tool           *tool, 
 		   GdkEventMotion *mevent, 
@@ -462,6 +630,57 @@
 #endif /* GTK_HAVE_SIX_VALUATORS */
 }
 
+/*
+ * Non-GUI, but interactive paint tool for alternative GUI
+ * implementations. Adapted from paint_core_button_release by
+ * MAT.
+ *
+ * This function assumes that tool has its private data
+ * intialized to a PaintCore object.
+ *
+ * This function only does painting, and does not do auxiliary
+ * stuff like flushing the displays or color picking.
+ *
+ */
+void
+paint_core_non_gui_motion_painting (Tool *tool, 
+             GimpDrawable *drawable,
+             gdouble x,
+			 gdouble y,
+			 double pressure,
+			 double xtilt,
+			 double ytilt
+#ifdef GTK_HAVE_SIX_VALUATORS
+			 , double wheel
+#endif /* GTK_HAVE_SIX_VALUATORS */
+		)
+{
+  PaintCore *paint_core;
+
+  paint_core = (PaintCore *) tool->private;
+
+  paint_core->curx = x;
+  paint_core->cury = y;
+  paint_core->curpressure = pressure;
+  paint_core->curxtilt    = xtilt;
+  paint_core->curytilt    = ytilt;
+#ifdef GTK_HAVE_SIX_VALUATORS
+  paint_core->curwheel    = wheel;
+#endif /* GTK_HAVE_SIX_VALUATORS */
+  paint_core->state       = 0;
+
+  paint_core_interpolate (paint_core, drawable);
+
+  paint_core->lastx        = paint_core->curx;
+  paint_core->lasty        = paint_core->cury;
+  paint_core->lastpressure = paint_core->curpressure;
+  paint_core->lastxtilt    = paint_core->curxtilt;
+  paint_core->lastytilt    = paint_core->curytilt;
+#ifdef GTK_HAVE_SIX_VALUATORS
+  paint_core->lastwheel    = paint_core->curwheel;
+#endif /* GTK_HAVE_SIX_VALUATORS */
+}
+
 void
 paint_core_cursor_update (Tool           *tool, 
 			  GdkEventMotion *mevent, 

diff -rua gimp-1.2.3/app/paint_core.h gimp-1.2.3.jgimp_embedded/app/paint_core.h
--- gimp-1.2.3/app/paint_core.h	2000-12-16 16:36:54.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/app/paint_core.h	2002-12-30 19:16:36.000000000 -0500
@@ -47,6 +47,13 @@
                                             */
 } ToolFlags;
 
+typedef enum
+{
+	NON_GUI_PAINT_KEEP_LAST_INPUT_VALUES = 1,            /* Keep last input values */
+	NON_GUI_PAINT_DRAW_LINE_FROM_LAST_POSITION,          /* Draw a line from the last position to the new position */
+	NON_GUI_PAINT_REINITIALIZE_INPUT_VALUES              /* Reinitialize all values to start fresh */
+} NonGUIPaintStartOptions;
+
 typedef void * (* PaintFunc)   (PaintCore *, GimpDrawable *, int);
 struct _paint_core
 {
@@ -122,6 +129,76 @@
 void          paint_core_button_release  (Tool *tool, GdkEventButton *bevent, gpointer gdisp_ptr);
 void          paint_core_motion          (Tool *tool, GdkEventMotion *mevent, gpointer gdisp_ptr);
 void          paint_core_cursor_update   (Tool *tool, GdkEventMotion *mevent, gpointer gdisp_ptr);
+/*
+ * Non-GUI, but interactive paint tool for alternative GUI
+ * implementations. Adapted from paint_core_button_press by
+ * MAT.
+ *
+ * This function assumes that tool has its private data
+ * intialized to a PaintCore object.
+ *
+ * Use the start_options to specify how to set up the input
+ * variables (x/y/pressure/tilts/distances).
+ *
+ * This function only does painting, and does not do auxiliary
+ * stuff like picking colors or restricting line drawing to
+ * certain angles. No external state from the keyboard
+ * or mouse is passed in either. It is assumed that all these
+ * details are handled prior to calling this function.
+ *
+ */
+void
+paint_core_non_gui_start_painting (Tool *tool, 
+             GimpDrawable *drawable,
+			 NonGUIPaintStartOptions start_options,
+             gdouble x,
+			 gdouble y,
+			 double pressure,
+			 double xtilt,
+			 double ytilt
+#ifdef GTK_HAVE_SIX_VALUATORS
+			 , double wheel
+#endif /* GTK_HAVE_SIX_VALUATORS */
+		);
+/*
+ * Non-GUI, but interactive paint tool for alternative GUI
+ * implementations. Adapted from paint_core_button_release by
+ * MAT.
+ *
+ * This function assumes that tool has its private data
+ * intialized to a PaintCore object.
+ *
+ * This function only does painting, and does not do auxiliary
+ * stuff like flushing the displays.
+ *
+ */
+void
+paint_core_non_gui_stop_painting (Tool *tool,
+                                  GimpDrawable *drawable);
+/*
+ * Non-GUI, but interactive paint tool for alternative GUI
+ * implementations. Adapted from paint_core_button_release by
+ * MAT.
+ *
+ * This function assumes that tool has its private data
+ * intialized to a PaintCore object.
+ *
+ * This function only does painting, and does not do auxiliary
+ * stuff like flushing the displays or color picking.
+ *
+ */
+void
+paint_core_non_gui_motion_painting (Tool *tool, 
+             GimpDrawable *drawable,
+             gdouble x,
+			 gdouble y,
+			 double pressure,
+			 double xtilt,
+			 double ytilt
+#ifdef GTK_HAVE_SIX_VALUATORS
+			 , double wheel
+#endif /* GTK_HAVE_SIX_VALUATORS */
+		);
 
 void          paint_core_control         (Tool                *tool, 
 					  ToolAction           action, 









diff -rua gimp-1.2.3/app/paths_cmds.c gimp-1.2.3.jgimp_embedded/app/paths_cmds.c
--- gimp-1.2.3/app/paths_cmds.c	2001-11-13 00:19:22.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/app/paths_cmds.c	2002-12-29 02:31:11.000000000 -0500
@@ -18,12 +18,12 @@
 
 /* NOTE: This file is autogenerated by pdbgen.pl. */
 
+#include <string.h>
+
 #include "config.h"
 
 #include "procedural_db.h"
 
-#include <string.h>
-
 #include "gimage.h"
 #include "path.h"
 #include "pathP.h"



diff -rua gimp-1.2.3/app/patterns.c gimp-1.2.3.jgimp_embedded/app/patterns.c
--- gimp-1.2.3/app/patterns.c	2001-10-09 18:08:41.000000000 -0400
+++ gimp-1.2.3.jgimp_embedded/app/patterns.c	2002-12-29 02:31:38.000000000 -0500
@@ -16,13 +16,13 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-#include "config.h"
-
-#include <glib.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
+#include "config.h"
+
+#include <glib.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #ifdef HAVE_UNISTD_H

diff -rua gimp-1.2.3/app/patterns_cmds.c gimp-1.2.3.jgimp_embedded/app/patterns_cmds.c
--- gimp-1.2.3/app/patterns_cmds.c	2001-11-13 00:19:22.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/app/patterns_cmds.c	2002-12-29 02:31:52.000000000 -0500
@@ -18,12 +18,12 @@
 
 /* NOTE: This file is autogenerated by pdbgen.pl. */
 
+#include <string.h>
+
 #include "config.h"
 
 #include "procedural_db.h"
 
-#include <string.h>
-
 #include "gimpcontext.h"
 #include "patterns.h"
 


diff -rua gimp-1.2.3/app/pattern_select_cmds.c gimp-1.2.3.jgimp_embedded/app/pattern_select_cmds.c
--- gimp-1.2.3/app/pattern_select_cmds.c	2001-11-13 00:19:22.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/app/pattern_select_cmds.c	2002-12-29 02:31:25.000000000 -0500
@@ -18,12 +18,12 @@
 
 /* NOTE: This file is autogenerated by pdbgen.pl. */
 
+#include <string.h>
+
 #include "config.h"
 
 #include "procedural_db.h"
 
-#include <string.h>
-
 #include "gimpcontext.h"
 #include "pattern_select.h"
 







diff -rua gimp-1.2.3/app/pixel_processor.c gimp-1.2.3.jgimp_embedded/app/pixel_processor.c
--- gimp-1.2.3/app/pixel_processor.c	2000-10-17 14:32:40.000000000 -0400
+++ gimp-1.2.3.jgimp_embedded/app/pixel_processor.c	2002-12-29 02:32:12.000000000 -0500
@@ -18,6 +18,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
+#include <string.h>
 #include "config.h"
 
 #include "pixel_processor.h"
@@ -26,7 +27,6 @@
 #include "gimprc.h"
 #include <stdarg.h>
 #include <stdio.h>
-#include <string.h>
 
 #ifdef ENABLE_MP
 



diff -rua gimp-1.2.3/app/plug_in.c gimp-1.2.3.jgimp_embedded/app/plug_in.c
--- gimp-1.2.3/app/plug_in.c	2001-01-15 16:44:02.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/app/plug_in.c	2002-12-29 02:32:25.000000000 -0500
@@ -16,6 +16,9 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
 #include "config.h"
 
 #ifdef HAVE_SYS_PARAM_H
@@ -26,9 +29,6 @@
 
 #include <errno.h>
 #include <signal.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
 #ifdef HAVE_SYS_WAIT_H
 #include <sys/wait.h>
 #endif

diff -rua gimp-1.2.3/app/plug_in_cmds.c gimp-1.2.3.jgimp_embedded/app/plug_in_cmds.c
--- gimp-1.2.3/app/plug_in_cmds.c	2001-11-13 00:19:22.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/app/plug_in_cmds.c	2002-12-29 02:32:38.000000000 -0500
@@ -18,13 +18,13 @@
 
 /* NOTE: This file is autogenerated by pdbgen.pl. */
 
+#include <stdlib.h>
+#include <string.h>
+
 #include "config.h"
 
 #include "procedural_db.h"
 
-#include <stdlib.h>
-#include <string.h>
-
 #include "appenv.h"
 #include "plug_in.h"
 #include "regex.h"







diff -rua gimp-1.2.3/app/procedural_db_cmds.c gimp-1.2.3.jgimp_embedded/app/procedural_db_cmds.c
--- gimp-1.2.3/app/procedural_db_cmds.c	2001-11-13 00:19:22.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/app/procedural_db_cmds.c	2002-12-29 02:32:56.000000000 -0500
@@ -18,14 +18,14 @@
 
 /* NOTE: This file is autogenerated by pdbgen.pl. */
 
-#include "config.h"
-
-#include "procedural_db.h"
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
+#include "config.h"
+
+#include "procedural_db.h"
+
 #include "regex.h"
 
 #include "libgimp/gimpintl.h"






diff -rua gimp-1.2.3/app/resize.c gimp-1.2.3.jgimp_embedded/app/resize.c
--- gimp-1.2.3/app/resize.c	2000-12-16 16:36:54.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/app/resize.c	2002-12-29 14:04:46.000000000 -0500
@@ -230,10 +230,10 @@
 		       NULL);
 
     gtk_signal_connect_object (GTK_OBJECT (resize->resize_shell), "destroy",
-			       GTK_SIGNAL_FUNC (g_free),
+			       GTK_SIGNAL_FUNC (free),
 			       (GtkObject *) private);
     gtk_signal_connect_object (GTK_OBJECT (resize->resize_shell), "destroy",
-			       GTK_SIGNAL_FUNC (g_free),
+			       GTK_SIGNAL_FUNC (free),
 			       (GtkObject *) resize);
   }
 






diff -rua gimp-1.2.3/app/scan_convert.c gimp-1.2.3.jgimp_embedded/app/scan_convert.c
--- gimp-1.2.3/app/scan_convert.c	2002-01-20 13:00:45.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/app/scan_convert.c	2002-12-29 02:33:16.000000000 -0500
@@ -16,6 +16,8 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
+#include <string.h>
+
 #include "config.h"
 
 #include <glib.h>
@@ -24,8 +26,6 @@
 #include "scan_convert.h"
 #include "libgimp/gimpmath.h"
 
-#include <string.h>
-
 #ifdef DEBUG
 #define TRC(x) printf x
 #else








diff -rua gimp-1.2.3/app/temp_buf.c gimp-1.2.3.jgimp_embedded/app/temp_buf.c
--- gimp-1.2.3/app/temp_buf.c	2001-11-13 00:19:22.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/app/temp_buf.c	2002-12-29 02:33:36.000000000 -0500
@@ -16,17 +16,17 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
+#include <stdlib.h>
+#include <string.h>
 #include "config.h"
 
 #include <glib.h>
 
 #include <errno.h>
-#include <stdlib.h>
 #include <stdio.h>
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
-#include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 


diff -rua gimp-1.2.3/app/text_tool_cmds.c gimp-1.2.3.jgimp_embedded/app/text_tool_cmds.c
--- gimp-1.2.3/app/text_tool_cmds.c	2001-11-13 00:19:23.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/app/text_tool_cmds.c	2002-12-29 02:33:49.000000000 -0500
@@ -18,13 +18,13 @@
 
 /* NOTE: This file is autogenerated by pdbgen.pl. */
 
+#include <string.h>
+
 #include "config.h"
 
 #include "procedural_db.h"
 
 #include <stdio.h>
-#include <string.h>
-
 #include "appenv.h"
 #include "drawable.h"
 #include "layer.h"







diff -rua gimp-1.2.3/app/tile_swap.c gimp-1.2.3.jgimp_embedded/app/tile_swap.c
--- gimp-1.2.3/app/tile_swap.c	2001-11-22 17:10:40.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/app/tile_swap.c	2002-12-29 02:34:05.000000000 -0500
@@ -1,9 +1,9 @@
+#include <string.h>
 #include "config.h"
 
 #include <glib.h>
 
 #include <errno.h>
-#include <string.h>
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/stat.h>












diff -rua gimp-1.2.3/app/user_install.c gimp-1.2.3.jgimp_embedded/app/user_install.c
--- gimp-1.2.3/app/user_install.c	2001-11-22 17:10:40.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/app/user_install.c	2002-12-29 02:34:31.000000000 -0500
@@ -17,14 +17,14 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-#include "config.h"
-
+#include <stdlib.h>
 #include <string.h>
 
+#include "config.h"
+
 #include <glib.h>
 
 #include <stdio.h>
-#include <stdlib.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #ifdef HAVE_UNISTD_H






























diff -rua gimp-1.2.3/gimp-zip gimp-1.2.3.jgimp_embedded/gimp-zip
--- gimp-1.2.3/gimp-zip	2002-02-10 01:21:47.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/gimp-zip	2002-12-29 14:42:37.000000000 -0500
@@ -7,7 +7,7 @@
 DEVZIP=/tmp/gimp-dev-1.2.3-`date +%Y%m%d`.zip
 GIFZIP=/tmp/gimp-gif-1.2.3-`date +%Y%m%d`.zip
 
-cd /usr/local
+cd /home/mterry/gimp_buffer_tests/
 
 rm $ZIP
 zip -r $ZIP -@ <<EOF




































































diff -rua gimp-1.2.3/libgimp/gimpenv.c gimp-1.2.3.jgimp_embedded/libgimp/gimpenv.c
--- gimp-1.2.3/libgimp/gimpenv.c	2002-02-09 22:01:51.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/libgimp/gimpenv.c	2002-12-29 02:16:17.000000000 -0500
@@ -22,7 +22,6 @@
 
 #include "config.h"
 
-#include <glib.h>
 #include <string.h>
 #include <ctype.h>
 #include <sys/types.h>
@@ -31,6 +30,7 @@
 #include <unistd.h>
 #endif
 
+#include <glib.h>
 #include "gimpenv.h"
 #include "gimpfeatures.h"
 







diff -rua gimp-1.2.3/libgimp/gimpfileselection.c gimp-1.2.3.jgimp_embedded/libgimp/gimpfileselection.c
--- gimp-1.2.3/libgimp/gimpfileselection.c	2000-12-16 19:28:32.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/libgimp/gimpfileselection.c	2002-12-29 02:16:37.000000000 -0500
@@ -21,6 +21,7 @@
  */
 #include "config.h"
 
+#include <string.h>
 #include <glib.h>         /* Needed here by Win32 gcc compilation */
 
 #include <sys/types.h>
@@ -28,7 +29,6 @@
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
-#include <string.h>
 
 #include <gtk/gtk.h>
 

















































diff -rua gimp-1.2.3/libgimp/gimppatheditor.c gimp-1.2.3.jgimp_embedded/libgimp/gimppatheditor.c
--- gimp-1.2.3/libgimp/gimppatheditor.c	2001-11-22 17:11:02.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/libgimp/gimppatheditor.c	2002-12-29 14:07:12.000000000 -0500
@@ -228,7 +228,7 @@
       list_item = gtk_list_item_new_with_label (current_dir);
       gtk_object_set_data_full (GTK_OBJECT (list_item), "gimp_path_editor",
 				current_dir,
-				(GtkDestroyNotify) g_free);
+				(GtkDestroyNotify) free);
       directory_list = g_list_append (directory_list, list_item);
       gtk_signal_connect (GTK_OBJECT (list_item), "select",
 			  GTK_SIGNAL_FUNC (gimp_path_editor_select_callback),
@@ -452,7 +452,7 @@
       list_item = gtk_list_item_new_with_label (directory);
       gtk_object_set_data_full (GTK_OBJECT (list_item), "gimp_path_editor",
 				directory,
-				(GtkDestroyNotify) g_free);
+				(GtkDestroyNotify) free);
       append_list = g_list_append (append_list, list_item);
       gtk_signal_connect (GTK_OBJECT (list_item), "select",
 			  GTK_SIGNAL_FUNC (gimp_path_editor_select_callback),
@@ -472,7 +472,7 @@
       gtk_object_set_data_full (GTK_OBJECT (gpe->selected_item),
 				"gimp_path_editor",
 				directory,
-				(GtkDestroyNotify) g_free);
+				(GtkDestroyNotify) free);
     }
 
   gtk_signal_emit (GTK_OBJECT (gpe), gimp_path_editor_signals[PATH_CHANGED]);





















































diff -rua gimp-1.2.3/libgimp/gimpwidgets.c gimp-1.2.3.jgimp_embedded/libgimp/gimpwidgets.c
--- gimp-1.2.3/libgimp/gimpwidgets.c	2001-11-13 00:20:37.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/libgimp/gimpwidgets.c	2002-12-29 14:07:32.000000000 -0500
@@ -943,7 +943,7 @@
   gcd->last_y                 = y;
 
   gtk_signal_connect_object (GTK_OBJECT (sizeentry), "destroy",
-			     GTK_SIGNAL_FUNC (g_free),
+			     GTK_SIGNAL_FUNC (free),
 			     (GtkObject *) gcd);
 
   gtk_signal_connect (GTK_OBJECT (sizeentry), "value_changed", 
@@ -1053,7 +1053,7 @@
 			     GTK_SIGNAL_FUNC (gtk_object_unref),
 			     GTK_OBJECT (adjustment));
   gtk_signal_connect_object (GTK_OBJECT (hbox), "destroy",
-			     GTK_SIGNAL_FUNC (g_free),
+			     GTK_SIGNAL_FUNC (free),
 			     (GtkObject *) gmsed);
 
   gmsed->adjustment = adjustment;
















































































































diff -rua gimp-1.2.3/plug-ins/common/gbr.c gimp-1.2.3.jgimp_embedded/plug-ins/common/gbr.c
--- gimp-1.2.3/plug-ins/common/gbr.c	2000-12-18 14:38:43.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/plug-ins/common/gbr.c	2002-12-29 03:31:21.000000000 -0500
@@ -14,6 +14,8 @@
  * TODO: Give some better error reporting on not opening files/bad headers
  *       etc. 
  */
+#include <stdlib.h>
+#include <string.h>
 
 #include "config.h"
 
@@ -27,8 +29,6 @@
 #endif
 #include <ctype.h>
 #include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 #include <math.h>
 
 #ifdef G_OS_WIN32









































diff -rua gimp-1.2.3/plug-ins/common/jpeg.c gimp-1.2.3.jgimp_embedded/plug-ins/common/jpeg.c
--- gimp-1.2.3/plug-ins/common/jpeg.c	2002-02-11 16:24:34.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/plug-ins/common/jpeg.c	2002-12-29 03:32:34.000000000 -0500
@@ -119,6 +119,8 @@
  * using the "volatile" keyword.   Here endeth the lesson.
  */
 
+#include <stdlib.h>
+#include <string.h>
 
 #include "config.h"   /* configure cares about HAVE_PROGRESSIVE_JPEG */
 
@@ -128,8 +130,6 @@
 #include <setjmp.h>
 #include <signal.h>
 #include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #ifdef HAVE_UNISTD_H


















































diff -rua gimp-1.2.3/plug-ins/common/psd.c gimp-1.2.3.jgimp_embedded/plug-ins/common/psd.c
--- gimp-1.2.3/plug-ins/common/psd.c	2000-08-23 15:13:41.000000000 -0400
+++ gimp-1.2.3.jgimp_embedded/plug-ins/common/psd.c	2002-12-29 03:34:56.000000000 -0500
@@ -148,14 +148,14 @@
 
 #define IFDBG if (PSD_DEBUG)
 
+#include <stdlib.h>
+#include <string.h>
 #include "config.h"
 
 #include <stdio.h>
-#include <stdlib.h>
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
-#include <string.h>
 
 #include <glib.h>
 
@@ -368,7 +368,9 @@
 static void xfread(FILE *fd, void *buf, long len, gchar *why);
 static void xfread_interlaced(FILE *fd, guchar *buf, long len, gchar *why,
 			      gint step);
+/*
 static void* xmalloc(size_t n);
+*/
 static void read_whole_file(FILE *fd);
 static void reshuffle_cmap(guchar *map256);
 static guchar* getpascalstring(FILE *fd, gchar *why);
@@ -2709,6 +2711,7 @@
 }
 
 
+/*
 static void *
 xmalloc(size_t n)
 {
@@ -2730,6 +2733,7 @@
   gimp_quit();
   return NULL;
 }
+*/
 
 
 static void




diff -rua gimp-1.2.3/plug-ins/common/psp.c gimp-1.2.3.jgimp_embedded/plug-ins/common/psp.c
--- gimp-1.2.3/plug-ins/common/psp.c	2000-08-24 10:17:32.000000000 -0400
+++ gimp-1.2.3.jgimp_embedded/plug-ins/common/psp.c	2002-12-29 03:35:14.000000000 -0500
@@ -34,14 +34,14 @@
 
 #define IFDBG(level) if (PSP_DEBUG >= level)
 
+#include <stdlib.h>
+#include <string.h>
 #include "config.h"
 
 #include <glib.h>		/* We want glib.h first because of some
 				 * pretty obscure Win32 compilation issues.
 				 */
 #include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <zlib.h>














































































diff -rua gimp-1.2.3/plug-ins/dbbrowser/dbbrowser_utils.c gimp-1.2.3.jgimp_embedded/plug-ins/dbbrowser/dbbrowser_utils.c
--- gimp-1.2.3/plug-ins/dbbrowser/dbbrowser_utils.c	2001-10-09 18:10:58.000000000 -0400
+++ gimp-1.2.3.jgimp_embedded/plug-ins/dbbrowser/dbbrowser_utils.c	2002-12-29 14:13:23.000000000 -0500
@@ -694,7 +694,7 @@
       func_name = g_strdup (proc_list[i]);
 
       gtk_clist_set_row_data_full (GTK_CLIST (dbbrowser->clist), j,
-				   func_name, g_free);
+				   func_name, free);
     }
 
   if (num_procs > 0)





diff -rua gimp-1.2.3/plug-ins/faxg3/faxg3.c gimp-1.2.3.jgimp_embedded/plug-ins/faxg3/faxg3.c
--- gimp-1.2.3/plug-ins/faxg3/faxg3.c	2000-08-21 23:27:06.000000000 -0400
+++ gimp-1.2.3.jgimp_embedded/plug-ins/faxg3/faxg3.c	2002-12-29 02:43:00.000000000 -0500
@@ -18,12 +18,12 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
+#include <stdlib.h>
 #include "config.h"
 
 #include <glib.h>		/* For G_OS_WIN32 */
 
 #include <stdio.h>
-#include <stdlib.h>
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif


































diff -rua gimp-1.2.3/plug-ins/gap/gap_dbbrowser_utils.c gimp-1.2.3.jgimp_embedded/plug-ins/gap/gap_dbbrowser_utils.c
--- gimp-1.2.3/plug-ins/gap/gap_dbbrowser_utils.c	2001-11-13 00:20:38.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/plug-ins/gap/gap_dbbrowser_utils.c	2002-12-29 14:41:04.000000000 -0500
@@ -34,13 +34,12 @@
    0.08  26th sept 97  by Thomas NOEL <thomas@minet.net> )
 */
 
-#include "config.h"
 
-#include <string.h>
+#include "gap_dbbrowser_utils.h"
+#include "config.h"
 
 #include "libgimp/stdplugins-intl.h"
 
-#include "gap_dbbrowser_utils.h"
 
 
 extern int gap_debug;
@@ -735,7 +734,7 @@
         func_name = g_strdup (proc_list[i]);
 
         gtk_clist_set_row_data_full(GTK_CLIST(dbbrowser->clist), j,
-                                    func_name, g_free);
+                                    func_name, free);
     }
   }
  

diff -rua gimp-1.2.3/plug-ins/gap/gap_dbbrowser_utils.h gimp-1.2.3.jgimp_embedded/plug-ins/gap/gap_dbbrowser_utils.h
--- gimp-1.2.3/plug-ins/gap/gap_dbbrowser_utils.h	2000-08-21 23:27:08.000000000 -0400
+++ gimp-1.2.3.jgimp_embedded/plug-ins/gap/gap_dbbrowser_utils.h	2002-12-29 02:47:26.000000000 -0500
@@ -41,7 +41,9 @@
 
 /* end of configuration */
 
+#include <string.h>
 #include <stdlib.h>
+
 #include "gtk/gtk.h"
 #include "libgimp/gimp.h"
 # include "gap_filter.h"









































diff -rua gimp-1.2.3/plug-ins/gfig/gfig.c gimp-1.2.3.jgimp_embedded/plug-ins/gfig/gfig.c
--- gimp-1.2.3/plug-ins/gfig/gfig.c	2001-10-09 18:10:59.000000000 -0400
+++ gimp-1.2.3.jgimp_embedded/plug-ins/gfig/gfig.c	2002-12-29 02:48:28.000000000 -0500
@@ -46,18 +46,18 @@
  *      http://www.wilberworks.com/bugs.cgi
  */
 
+#include <stdlib.h>
+#include <string.h>
 #include "config.h"
 
 #include <glib.h>
 
 #include <stdio.h>
-#include <stdlib.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
-#include <string.h>
 #ifdef HAVE_DIRENT_H
 #include <dirent.h>
 #endif











































diff -rua gimp-1.2.3/plug-ins/ifscompose/ifscompose_storage.c gimp-1.2.3.jgimp_embedded/plug-ins/ifscompose/ifscompose_storage.c
--- gimp-1.2.3/plug-ins/ifscompose/ifscompose_storage.c	2001-11-13 00:20:51.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/plug-ins/ifscompose/ifscompose_storage.c	2002-12-29 15:07:58.000000000 -0500
@@ -375,7 +375,7 @@
 			     NULL,
 			     "using default values...",
 			     TRUE);
-      g_list_foreach (el_list, (GFunc)g_free, NULL);
+      g_list_foreach (el_list, (GFunc)free, NULL);
       g_list_free (el_list);
       return FALSE;
     }



















































diff -rua gimp-1.2.3/plug-ins/imagemap/imap_mru.c gimp-1.2.3.jgimp_embedded/plug-ins/imagemap/imap_mru.c
--- gimp-1.2.3/plug-ins/imagemap/imap_mru.c	1999-10-24 16:57:14.000000000 -0400
+++ gimp-1.2.3.jgimp_embedded/plug-ins/imagemap/imap_mru.c	2002-12-29 15:09:06.000000000 -0500
@@ -37,7 +37,7 @@
 void 
 mru_destruct(MRU_t *mru)
 {
-   g_list_foreach(mru->list, (GFunc) g_free, NULL);
+   g_list_foreach(mru->list, (GFunc)free, NULL);
    g_free(mru);
 }
 






diff -rua gimp-1.2.3/plug-ins/imagemap/imap_polygon.c gimp-1.2.3.jgimp_embedded/plug-ins/imagemap/imap_polygon.c
--- gimp-1.2.3/plug-ins/imagemap/imap_polygon.c	2001-11-13 00:20:52.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/plug-ins/imagemap/imap_polygon.c	2002-12-29 15:09:22.000000000 -0500
@@ -108,7 +108,7 @@
 static void
 polygon_free_list(Polygon_t *polygon)
 {
-   g_list_foreach(polygon->points, (GFunc) g_free, NULL);
+   g_list_foreach(polygon->points, (GFunc)free, NULL);
    g_list_free(polygon->points);
    polygon->points = NULL;
 }


















































































diff -rua gimp-1.2.3/plug-ins/print/print_gimp.h gimp-1.2.3.jgimp_embedded/plug-ins/print/print_gimp.h
--- gimp-1.2.3/plug-ins/print/print_gimp.h	2000-10-03 21:47:59.000000000 -0400
+++ gimp-1.2.3.jgimp_embedded/plug-ins/print/print_gimp.h	2002-12-29 02:51:07.000000000 -0500
@@ -29,6 +29,8 @@
 #ifndef __PRINT_GIMP_H__
 #define __PRINT_GIMP_H__
 
+#include "print.h"
+
 #include <gtk/gtk.h>
 
 /*
@@ -43,8 +45,6 @@
 #include <libgimp/gimp.h>
 #include <libgimp/gimpui.h>
 
-#include "print.h"
-
 /*
  * All Gimp-specific code is in this file.
  */



























diff -rua gimp-1.2.3/plug-ins/script-fu/script-fu-scripts.c gimp-1.2.3.jgimp_embedded/plug-ins/script-fu/script-fu-scripts.c
--- gimp-1.2.3/plug-ins/script-fu/script-fu-scripts.c	2001-11-22 17:11:13.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/plug-ins/script-fu/script-fu-scripts.c	2002-12-29 14:14:15.000000000 -0500
@@ -16,13 +16,13 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
 #include "config.h"
 
 #include <glib.h>		/* Include early for obscure Win32
 				   build reasons */
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
 #include <sys/types.h>
 #if HAVE_DIRENT_H
 #include <dirent.h>
@@ -1111,7 +1111,7 @@
 
 	    case SF_OPTION:
 	      g_slist_foreach (script->arg_defaults[i].sfa_option.list, 
-			       (GFunc)g_free, NULL);
+			       (GFunc)free, NULL);
 	      if (script->arg_defaults[i].sfa_option.list)
 		g_slist_free (script->arg_defaults[i].sfa_option.list);
 	      break;


diff -rua gimp-1.2.3/plug-ins/script-fu/script-fu-server.c gimp-1.2.3.jgimp_embedded/plug-ins/script-fu/script-fu-server.c
--- gimp-1.2.3/plug-ins/script-fu/script-fu-server.c	2001-11-13 00:21:08.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/plug-ins/script-fu/script-fu-server.c	2002-12-29 02:41:48.000000000 -0500
@@ -16,14 +16,14 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
 #include <glib.h>		/* For G_OS_WIN32 */
 
 #ifndef G_OS_WIN32
 
 #include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
 #include <ctype.h>
 #include <unistd.h>
 #include <time.h>



diff -rua gimp-1.2.3/plug-ins/sel2path/curve.c gimp-1.2.3.jgimp_embedded/plug-ins/sel2path/curve.c
--- gimp-1.2.3/plug-ins/sel2path/curve.c	2000-03-10 06:29:24.000000000 -0500
+++ gimp-1.2.3.jgimp_embedded/plug-ins/sel2path/curve.c	2002-12-29 02:52:20.000000000 -0500
@@ -17,10 +17,10 @@
 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
+#include "global.h"
 #include <glib.h>
 
 #include "config.h"
-#include "global.h"
 #include "curve.h"
 
 



diff -rua gimp-1.2.3/plug-ins/sel2path/fit.c gimp-1.2.3.jgimp_embedded/plug-ins/sel2path/fit.c
--- gimp-1.2.3/plug-ins/sel2path/fit.c	2000-05-22 13:10:23.000000000 -0400
+++ gimp-1.2.3.jgimp_embedded/plug-ins/sel2path/fit.c	2002-12-29 02:52:38.000000000 -0500
@@ -22,9 +22,9 @@
 #include <math.h>
 #include <assert.h>
 
+#include "global.h"
 #include <glib.h>
 
-#include "global.h"
 #include "spline.h"
 #include "vector.h"
 








diff -rua gimp-1.2.3/plug-ins/sel2path/sel2path.c gimp-1.2.3.jgimp_embedded/plug-ins/sel2path/sel2path.c
--- gimp-1.2.3/plug-ins/sel2path/sel2path.c	2000-08-23 19:11:04.000000000 -0400
+++ gimp-1.2.3.jgimp_embedded/plug-ins/sel2path/sel2path.c	2002-12-29 02:53:04.000000000 -0500
@@ -27,13 +27,13 @@
  * 0.1 First version.
  */
 
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 #include "config.h"
 
 #include <glib.h>
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 #include <math.h>
 
 #include <gtk/gtk.h>


diff -rua gimp-1.2.3/plug-ins/sel2path/spline.c gimp-1.2.3.jgimp_embedded/plug-ins/sel2path/spline.c
--- gimp-1.2.3/plug-ins/sel2path/spline.c	2000-09-26 18:54:30.000000000 -0400
+++ gimp-1.2.3.jgimp_embedded/plug-ins/sel2path/spline.c	2002-12-29 02:53:22.000000000 -0500
@@ -18,9 +18,9 @@
 
 #include <assert.h>
 
+#include "global.h"
 #include <glib.h>
 
-#include "global.h"
 #include "bounding-box.h"
 #include "spline.h"
 #include "vector.h"


diff -rua gimp-1.2.3/plug-ins/sel2path/vector.c gimp-1.2.3.jgimp_embedded/plug-ins/sel2path/vector.c
--- gimp-1.2.3/plug-ins/sel2path/vector.c	2000-07-30 14:37:33.000000000 -0400
+++ gimp-1.2.3.jgimp_embedded/plug-ins/sel2path/vector.c	2002-12-29 02:53:36.000000000 -0500
@@ -16,12 +16,12 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
+#include "global.h"
 #include <glib.h>
 
 #include <math.h>
 #include <assert.h>
 
-#include "global.h"
 #include "config.h"
 
 #include "vector.h"
