? app/macro.h
? app/macro.c
? app/macro.scm
? app/macro_support.scm
Index: configure.in
===================================================================
RCS file: /cvs/gnome/gimp/configure.in,v
retrieving revision 1.171
diff -u -r1.171 configure.in
--- configure.in	1999/06/28 13:28:29	1.171
+++ configure.in	1999/07/07 04:27:04
@@ -331,6 +331,8 @@
 
 AC_FUNC_ALLOCA
 
+GUILE_FLAGS
+
 dnl Check for sys/select.h
 
 AC_MSG_CHECKING([fd_set and sys/select])
@@ -629,6 +631,8 @@
 plug-ins/megawidget/Makefile
 plug-ins/gpc/Makefile
 plug-ins/dbbrowser/Makefile
+plug-ins/guile-fu/Makefile
+plug-ins/guile-fu/scripts/Makefile
 plug-ins/script-fu/Makefile
 plug-ins/script-fu/scripts/Makefile
 plug-ins/webbrowser/Makefile
Index: app/Makefile.am
===================================================================
RCS file: /cvs/gnome/gimp/app/Makefile.am,v
retrieving revision 1.86
diff -u -r1.86 Makefile.am
--- app/Makefile.am	1999/07/03 08:31:49	1.86
+++ app/Makefile.am	1999/07/07 04:27:04
@@ -28,6 +28,8 @@
 	gimpsignal.h
 
 gimp_SOURCES = \
+	macro.h			\
+	macro.c			\
 	about_dialog.c		\
 	about_dialog.h		\
 	actionarea.c		\
@@ -409,6 +411,7 @@
 	-DLIBDIR=\""$(gimpplugindir)"\"	\
 	-DLOCALEDIR=\""$(localedir)"\"	\
 	-DREGEX_MALLOC			\
+	-DMACROS			\
 	@GIMP_THREAD_FLAGS@ 		\
 	@GIMP_MP_FLAGS@
 
Index: app/app_procs.c
===================================================================
RCS file: /cvs/gnome/gimp/app/app_procs.c,v
retrieving revision 1.88
diff -u -r1.88 app_procs.c
--- app/app_procs.c	1999/06/26 03:11:25	1.88
+++ app/app_procs.c	1999/07/07 04:27:04
@@ -70,6 +70,7 @@
 #include "palette.h"
 #include "patterns.h"
 #include "plug_in.h"
+#include "macro.h"
 #include "module_db.h"
 #include "procedural_db.h"
 #include "session.h"
@@ -490,6 +491,7 @@
   procedural_db_init ();
   RESET_BAR();
   internal_procs_init ();
+  macro_register ();
 
   RESET_BAR();
   parse_buffers_init ();
Index: app/appenv.h
===================================================================
RCS file: /cvs/gnome/gimp/app/appenv.h,v
retrieving revision 1.14
diff -u -r1.14 appenv.h
--- app/appenv.h	1999/02/22 19:30:02	1.14
+++ app/appenv.h	1999/07/07 04:27:04
@@ -68,4 +68,6 @@
 extern GimpSet* image_context;
 extern MessageHandlerType message_handler;
 
+#include "macro.h"
+
 #endif /*  APPENV_H  */
Index: app/clone.c
===================================================================
RCS file: /cvs/gnome/gimp/app/clone.c,v
retrieving revision 1.26
diff -u -r1.26 clone.c
--- app/clone.c	1999/07/06 15:18:24	1.26
+++ app/clone.c	1999/07/07 04:27:04
@@ -312,9 +312,22 @@
       if (clone_options->type == PATTERN_CLONE)
 	if (!get_active_pattern ())
 	  g_message (_("No patterns available for this operation."));
+#ifdef MACROS
+      macro_add ("(clone start %d %d %d %d %d %f %f)\n",
+                 pdb_image_to_id (gimp_drawable_gimage (drawable)),
+                 gimp_drawable_get_tattoo (drawable),
+                 pdb_image_to_id (gimp_drawable_gimage (src_drawable_)),
+                 gimp_drawable_get_tattoo (src_drawable_),
+                 clone_options->type,
+                 (gfloat) src_x,
+                 (gfloat) src_y);
+#endif
       break;
 
     case FINISH_PAINT :
+#ifdef MACROS
+      macro_add ("(clone finish)\n");
+#endif
       draw_core_stop (paint_core->core, active_tool);
       if (clone_options->aligned == AlignNo && !first)
       {
Index: app/ellipse_select.c
===================================================================
RCS file: /cvs/gnome/gimp/app/ellipse_select.c,v
retrieving revision 1.15
diff -u -r1.15 ellipse_select.c
--- app/ellipse_select.c	1999/07/02 17:40:10	1.15
+++ app/ellipse_select.c	1999/07/07 04:27:04
@@ -49,6 +49,14 @@
 {
   Channel * new_mask;
 
+#ifdef MACROS
+  macro_add ("(ellipse_select %d %f %f %f %f %d %d %d %f)\n",
+             pdb_image_to_id (gimage),
+             (gfloat) x, (gfloat) y,
+             (gfloat) w, (gfloat) h,
+             op, antialias, feather, feather_radius);
+#endif
+
   /*  if applicable, replace the current selection  */
   if (op == SELECTION_REPLACE)
     gimage_mask_clear (gimage);
Index: app/gimpbrushlist.c
===================================================================
RCS file: /cvs/gnome/gimp/app/gimpbrushlist.c,v
retrieving revision 1.19
diff -u -r1.19 gimpbrushlist.c
--- app/gimpbrushlist.c	1999/04/23 20:53:24	1.19
+++ app/gimpbrushlist.c	1999/07/07 04:27:04
@@ -41,6 +41,7 @@
 #include "devices.h"
 #include "errors.h"
 #include "general.h"
+#include "gimpcontext.h"
 #include "gimprc.h"
 #include "gimpsignal.h"
 #include "menus.h"
@@ -412,6 +413,14 @@
 			 gimp_brush_list_get_brush_index(brush_list, brush));
 
   device_status_update (current_device);
+
+#ifdef MACROS
+  macro_add ("(brush select \"%s\" %f %d %d)\n",
+             brush->name,
+             gimp_context_get_opacity (gimp_context_get_current ()),
+             gimp_brush_get_spacing (get_active_brush ()),
+             gimp_context_get_paint_mode (gimp_context_get_current ()));
+#endif
 }
 
 
Index: app/paint_core.c
===================================================================
RCS file: /cvs/gnome/gimp/app/paint_core.c,v
retrieving revision 1.52
diff -u -r1.52 paint_core.c
--- app/paint_core.c	1999/07/02 17:40:10	1.52
+++ app/paint_core.c	1999/07/07 04:27:04
@@ -46,6 +46,25 @@
 #define    SQR(x) ((x) * (x))
 #define    EPSILON  0.00001
 
+#include <sys/time.h>
+#include <unistd.h>
+
+#if 0
+#define TIMERS \
+  struct timeval _x_[2];
+
+#define TIMERS_START \
+  gettimeofday (&_x_[0], NULL)
+
+#define TIMERS_STOP(n)  \
+  gettimeofday (&_x_[1], NULL); \
+  printf ("%d - %10d\n", n, (_x_[1].tv_sec*1000000+_x_[1].tv_usec) - (_x_[0].tv_sec*1000000+_x_[0].tv_usec));
+#else
+#define TIMERS
+#define TIMERS_START
+#define TIMERS_STOP(n)
+#endif
+
 /*  global variables--for use in the various paint tools  */
 PaintCore  non_gui_paint_core;
 
@@ -136,6 +155,59 @@
 	},
 };
 
+#ifdef MACROS
+void
+pc_macro (PaintCore * paint_core,
+          GimpDrawable *drawable,
+          gint how)
+{
+  static numstrokes = 0;
+  static maxstrokes = 0;
+  static gfloat * strokes = NULL;
+  
+  switch (how)
+    {
+    case INIT_PAINT:
+      numstrokes = 0;
+      break;
+      
+    case MOTION_PAINT:
+      if (numstrokes >= maxstrokes)
+        {
+          gfloat * s = g_new (gfloat, 2 * (maxstrokes + 50));
+          if (strokes)
+            memcpy (s, strokes, 2 * sizeof(gfloat) * numstrokes);
+          g_free (strokes);
+          strokes = s;
+          maxstrokes += 50;
+        }
+      strokes[2*numstrokes]   = paint_core->curx;
+      strokes[2*numstrokes+1] = paint_core->cury;
+      numstrokes++;
+      break;
+      
+    case FINISH_PAINT:
+      {
+        gint i;
+
+        macro_add ("(strokes start %d)\n", numstrokes);
+        for (i=0; i<numstrokes; i++)
+          {
+            macro_add ("(stroke pt %f %f)\n",
+                       strokes[2*i], strokes[2*i+1]);
+          }
+        macro_add ("(strokes finish)\n");
+      }
+      numstrokes = 0;
+      break;
+        
+    case PAUSE_PAINT:
+    case RESUME_PAINT:
+    }
+}
+#endif
+
+
 static void
 paint_core_sample_color (GimpDrawable *drawable, 
 			 int x, 
@@ -245,6 +317,9 @@
 		      NULL, NULL, bevent->time);
   
   /*  Let the specific painting function initialize itself  */
+#ifdef MACROS
+  pc_macro (paint_core, drawable, INIT_PAINT);
+#endif
   (* paint_core->paint_func) (paint_core, drawable, INIT_PAINT);
 
   if (paint_core->pick_colors
@@ -269,8 +344,13 @@
       paint_core->lastytilt = paint_core->curytilt;
     }
   else
-    (* paint_core->paint_func) (paint_core, drawable, MOTION_PAINT);
-
+    {
+#ifdef MACROS
+      pc_macro (paint_core, drawable, MOTION_PAINT);
+#endif
+      (* paint_core->paint_func) (paint_core, drawable, MOTION_PAINT);
+    }
+  
   gdisplay_flush_now (gdisp);
 }
 
@@ -294,6 +374,9 @@
   gdk_flush ();
 
   /*  Let the specific painting function finish up  */
+#ifdef MACROS
+  pc_macro (paint_core, gimage_active_drawable (gdisp->gimage), FINISH_PAINT);
+#endif
   (* paint_core->paint_func) (paint_core, gimage_active_drawable (gdisp->gimage), FINISH_PAINT);
 
   /*  Set tool state to inactive -- no longer painting */
@@ -341,6 +424,7 @@
   paint_core->lastpressure = paint_core->curpressure;
   paint_core->lastxtilt = paint_core->curxtilt;
   paint_core->lastytilt = paint_core->curytilt;
+
 }
 
 void
@@ -457,7 +541,10 @@
     case RESUME:
       break;
 
-    case HALT:
+    case HALT :
+#ifdef MACROS
+      pc_macro (paint_core, drawable, FINISH_PAINT);
+#endif
       (* paint_core->paint_func) (paint_core, drawable, FINISH_PAINT);
       draw_core_stop (paint_core->core, tool);
       paint_core_cleanup ();
@@ -732,6 +819,9 @@
   total = dist + paint_core->distance;
   initial = paint_core->distance;
 
+#ifdef MACROS
+  pc_macro (paint_core, drawable, MOTION_PAINT);
+#endif
   while (paint_core->distance < total)
     {
       n = (int) (paint_core->distance / paint_core->spacing + 1.0 + EPSILON);
@@ -1241,10 +1331,13 @@
   PixelRegion srcPR;
   TileManager *alt = NULL;
   int offx, offy;
-
+  TIMERS;
+  
   if (! (gimage = drawable_gimage (drawable)))
     return;
 
+  TIMERS_START;
+  
   /*  set undo blocks  */
   set_undo_tiles (drawable,
 		  canvas_buf->x, canvas_buf->y,
@@ -1269,6 +1362,9 @@
   else  /*  mode != CONSTANT  */
     brush_to_canvas_buf (paint_core, brush_mask, brush_opacity);
 
+  TIMERS_STOP(1);
+  TIMERS_START;
+
   /*  intialize canvas buf source pixel regions  */
   srcPR.bytes = canvas_buf->bytes;
   srcPR.x = 0; srcPR.y = 0;
@@ -1283,6 +1379,8 @@
 		      alt,  /*  specify an alternative src1  */
 		      canvas_buf->x, canvas_buf->y);
 
+  TIMERS_STOP(2);
+  
   /*  Update the undo extents  */
   paint_core->x1 = MINIMUM (paint_core->x1, canvas_buf->x);
   paint_core->y1 = MINIMUM (paint_core->y1, canvas_buf->y);
Index: app/paintbrush.c
===================================================================
RCS file: /cvs/gnome/gimp/app/paintbrush.c,v
retrieving revision 1.32
diff -u -r1.32 paintbrush.c
--- app/paintbrush.c	1999/07/06 18:13:59	1.32
+++ app/paintbrush.c	1999/07/07 04:27:04
@@ -294,6 +294,16 @@
   switch (state)
     {
     case INIT_PAINT :
+
+#ifdef MACROS
+      macro_add ("(paintbrush start %d %d %f %f %d)\n",
+                 pdb_image_to_id (gimp_drawable_gimage (drawable)),
+                 gimp_drawable_get_tattoo (drawable),
+                 paintbrush_options->fade_out, 
+                 paintbrush_options->gradient_length,
+                 paintbrush_options->incremental);
+#endif
+      
 #if TIMED_BRUSH
       timer = g_timer_new();
       g_timer_start(timer);
@@ -310,6 +320,10 @@
       break;
 
     case FINISH_PAINT :
+#ifdef MACROS
+      macro_add ("(paintbrush finish)\n");
+#endif
+
 #if TIMED_BRUSH
       if (timer)
       {
Index: app/palette.c
===================================================================
RCS file: /cvs/gnome/gimp/app/palette.c,v
retrieving revision 1.45
diff -u -r1.45 palette.c
--- app/palette.c	1999/06/14 22:17:37	1.45
+++ app/palette.c	1999/07/07 04:27:05
@@ -252,6 +252,10 @@
   foreground[1] = g;
   foreground[2] = b;
 
+#ifdef MACROS
+  macro_add ("(palette foreground %d %d %d)\n", r, g, b);
+#endif
+  
   palette_get_foreground (&rr, &gg, &bb);
   if (no_interface == FALSE)
     {
@@ -272,6 +276,10 @@
   background[0] = r;
   background[1] = g;
   background[2] = b;
+
+#ifdef MACROS
+  macro_add ("(palette background %d %d %d)\n", r, g, b);
+#endif
 
   palette_get_background (&rr, &gg, &bb);
   if (no_interface == FALSE)
Index: app/patterns.c
===================================================================
RCS file: /cvs/gnome/gimp/app/patterns.c,v
retrieving revision 1.16
diff -u -r1.16 patterns.c
--- app/patterns.c	1999/05/05 12:31:49	1.16
+++ app/patterns.c	1999/07/07 04:27:05
@@ -304,6 +304,10 @@
     pattern_select_select (pattern_select_dialog, pattern->index);
 
   device_status_update (current_device);
+
+#ifdef MACROS
+  macro_add ("(pattern select \"%s\")\n", pattern->name);
+#endif
 }
 
 
Index: app/pencil.c
===================================================================
RCS file: /cvs/gnome/gimp/app/pencil.c,v
retrieving revision 1.14
diff -u -r1.14 pencil.c
--- app/pencil.c	1999/07/06 15:18:24	1.14
+++ app/pencil.c	1999/07/07 04:27:05
@@ -50,6 +50,11 @@
   switch (state)
     {
     case INIT_PAINT :
+#ifdef MACROS
+      macro_add ("(pencil start %d %d)\n",
+                 pdb_image_to_id (gimp_drawable_gimage (drawable)),
+                 gimp_drawable_get_tattoo (drawable));
+#endif
       break;
 
     case MOTION_PAINT :
@@ -57,6 +62,9 @@
       break;
 
     case FINISH_PAINT :
+#ifdef MACROS
+      macro_add ("(pencil finish)\n");
+#endif
       break;
 
     default :
Index: app/rect_select.c
===================================================================
RCS file: /cvs/gnome/gimp/app/rect_select.c,v
retrieving revision 1.42
diff -u -r1.42 rect_select.c
--- app/rect_select.c	1999/07/02 17:40:10	1.42
+++ app/rect_select.c	1999/07/07 04:27:14
@@ -59,6 +59,14 @@
 {
   Channel * new_mask;
 
+#ifdef MACROS
+  macro_add ("(rect_select %d %f %f %f %f %d %d %f)\n",
+             pdb_image_to_id (gimage),
+             (gfloat) x, (gfloat) y,
+             (gfloat) w, (gfloat) h,
+             op, feather, feather_radius);
+#endif
+
   /*  if applicable, replace the current selection  */
   if (op == SELECTION_REPLACE)
     gimage_mask_clear (gimage);
Index: plug-ins/Makefile.am
===================================================================
RCS file: /cvs/gnome/gimp/plug-ins/Makefile.am,v
retrieving revision 1.54
diff -u -r1.54 Makefile.am
--- plug-ins/Makefile.am	1999/07/03 08:31:50	1.54
+++ plug-ins/Makefile.am	1999/07/07 04:27:14
@@ -9,6 +9,7 @@
 	megawidget		\
 	gpc			\
 	dbbrowser		\
+	guile-fu		\
 	script-fu		\
 	$(GIMP_PERL)		\
 	AlienMap		\
