Index: /trunk/Ohana/src/kapa2/include/prototypes.h
===================================================================
--- /trunk/Ohana/src/kapa2/include/prototypes.h	(revision 16254)
+++ /trunk/Ohana/src/kapa2/include/prototypes.h	(revision 16255)
@@ -162,5 +162,5 @@
 void          DrawButton          PROTO((Graphic *graphic, Button *button));
 void          DrawBitmap          PROTO((Graphic *graphic, int x, int y, int dx, int dy, char *bitmap, int mode));
-void          CrossHairs          PROTO((Graphic *graphic, KapaImageWidget *image));
+void          CrossHairs          PROTO((Graphic *graphic, Picture *image));
 void          hh_hms              PROTO((char *line, double ra, double dec, char sep));
 
@@ -171,6 +171,6 @@
 void          PaintTickmarks      PROTO((Graphic *graphic, KapaImageWidget *image));
 
-void          Screen_to_Image     PROTO((double *x1, double *y1, double x2, double y2, KapaImageWidget *image));
-void          Image_to_Screen     PROTO((double *x1, double *y1, double x2, double y2, KapaImageWidget *image));
+void          Screen_to_Image     PROTO((double *x1, double *y1, double x2, double y2, Picture *picture));
+void          Image_to_Screen     PROTO((double *x1, double *y1, double x2, double y2, Picture *picture));
 
 void          DragColorbar        PROTO((Graphic *graphic, KapaImageWidget *image, XButtonEvent *mouse_event));
Index: /trunk/Ohana/src/kapa2/include/structures.h
===================================================================
--- /trunk/Ohana/src/kapa2/include/structures.h	(revision 16254)
+++ /trunk/Ohana/src/kapa2/include/structures.h	(revision 16255)
@@ -94,5 +94,6 @@
   int      DX, DY;	      // size of displayed picture (must be updated with new images...)
   int      expand;	      // zoomscale
-  double   Xo, Yo;	      // image pixel at screen center
+  double   X,  Y;	      // offset of image center
+  double   Xo, Yo;	      // reference image pixel (picture has X - Xo at center)
   XImage  *pix;
   char    *data;
Index: /trunk/Ohana/src/kapa2/src/ButtonFunctions.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/ButtonFunctions.c	(revision 16254)
+++ /trunk/Ohana/src/kapa2/src/ButtonFunctions.c	(revision 16255)
@@ -44,6 +44,6 @@
 int Recenter (Graphic *graphic, KapaImageWidget *image) {
 
-  image[0].X = 0;
-  image[0].Y = 0;
+  image[0].picture.X = 0;
+  image[0].picture.Y = 0;
  
   Remap (graphic, image);
Index: /trunk/Ohana/src/kapa2/src/Center.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/Center.c	(revision 16254)
+++ /trunk/Ohana/src/kapa2/src/Center.c	(revision 16255)
@@ -16,6 +16,6 @@
   if (image == NULL) return (TRUE);
 
-  image[0].picture.X = 0.5*image[0].image[0].matrix.Naxis[0] - X;
-  image[0].picture.Y = 0.5*image[0].image[0].matrix.Naxis[1] - Y;
+  image[0].picture.Xo = 0.5*image[0].image[0].matrix.Naxis[0] - X;
+  image[0].picture.Yo = 0.5*image[0].image[0].matrix.Naxis[1] - Y;
   if ((zoom != 0) && (zoom != -1)) {
     image[0].picture.expand = zoom;
Index: /trunk/Ohana/src/kapa2/src/CreateZoom16.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/CreateZoom16.c	(revision 16254)
+++ /trunk/Ohana/src/kapa2/src/CreateZoom16.c	(revision 16255)
@@ -15,4 +15,5 @@
 void CreateZoom16 (KapaImageWidget *image, Graphic *graphic, double x, double y) {
 
+# if (0)
   int i, j, ii, jj;
   int i_start, i_end, j_start, j_end;
@@ -152,3 +153,4 @@
 					image[0].zoom.data, image[0].zoom.dx, image[0].zoom.dy, 16, 0);
   
+# endif
 }
Index: /trunk/Ohana/src/kapa2/src/CreateZoom24.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/CreateZoom24.c	(revision 16254)
+++ /trunk/Ohana/src/kapa2/src/CreateZoom24.c	(revision 16255)
@@ -15,4 +15,5 @@
 void CreateZoom24 (KapaImageWidget *image, Graphic *graphic, double x, double y) {
 
+# if (0)
   int i, j, ii, jj, extra;
   int i_start, i_end, j_start, j_end;
@@ -186,3 +187,4 @@
 					image[0].zoom.data, image[0].zoom.dx, image[0].zoom.dy, 32, 0);
   
+# endif
 }
Index: /trunk/Ohana/src/kapa2/src/CreateZoom32.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/CreateZoom32.c	(revision 16254)
+++ /trunk/Ohana/src/kapa2/src/CreateZoom32.c	(revision 16255)
@@ -8,5 +8,5 @@
   int dropback;  /* this is a bit of a kludge... */
   int dx, dy, DX, DY;
-  double expand, zoomscale, Ix, Iy;
+  double expand, Sx, Sy, Ix, Iy;
   int expand_in, expand_out;
   unsigned int *out_pix, *out_pix2;
@@ -30,9 +30,19 @@
   back = graphic[0].back;
 
-  zoomscale = MAX (5, image[0].expand + 5);
-  expand = 1 / zoomscale;
-  expand_out = (int) zoomscale;
-  expand_in  = 1;
+  // set up expansions
+  assert ((image[0].zoom.expand >= 1) || (image[0].zoom.expand <= -2));
+  expand = expand_in = expand_out = 1.0;
+  if (image[0].zoom.expand > 0) {
+    expand = 1 / (1.0*image[0].zoom.expand);
+    expand_out = image[0].zoom.expand;
+    expand_in  = 1;
+  }
+  if (image[0].zoom.expand < 0) {
+    expand = fabs((double)image[0].zoom.expand);
+    expand_out = 1;
+    expand_in  = -image[0].zoom.expand;
+  }
 
+  // define the image sizes
   dx = image[0].zoom.dx;
   dy = image[0].zoom.dy;
@@ -40,13 +50,31 @@
   DY = image[0].image[0].matrix.Naxis[1];
   
-  /* Ix,Iy are the image coordinates of the first image pixel */
-  // x,y is the image coordinate of the zoombox center
-  Ix = x - expand*(int)(0.5*(dx + 1)) + 1;
-  Iy = y - expand*(int)(0.5*(dy + 1)) + 1;
+  // Ix, Iy are the image coordinates of the 0,0 screen pixel
+  Screen_to_Image (&Ix, &Iy, 0.0, 0.0, &image[0].picture);
 
-  i_start = MIN (MAX (-Ix / expand, (1 - FRAC(Ix)) / expand), dx - expand_out + 1);
-  j_start = MIN (MAX (-Iy / expand, (1 - FRAC(Iy)) / expand), dy - expand_out + 1);
-  i_end   = MAX (MIN ((DX-Ix) / expand, dx - expand_out + 1), 0);
-  j_end   = MAX (MIN ((DY-Iy) / expand, dy - expand_out + 1), 0);
+  // Ix, Iy are now limited to valid image coordinates
+  Ix = MIN (MAX (Ix, 0), DX);
+  Iy = MIN (MAX (Iy, 0), DY);
+
+  // Sx, Sy are the screen coordinates of the Ix,Iy pixel
+  Image_to_Screen (&Sx, &Sy, Ix,  Iy,  &image[0].picture);
+
+  // i_start, j_start are now limited to valid screen coordinates
+  i_start = MIN (MAX (Sx, 0), dx);
+  j_start = MIN (MAX (Sy, 0), dy);
+
+  // Ix, Iy are the image coordinates of the 0,0 screen pixel
+  Screen_to_Image (&Ix, &Iy, dx, dy, &image[0].picture);
+
+  // Ix, Iy are now limited to valid image coordinates
+  Ix = MIN (MAX (Ix, 0), DX);
+  Iy = MIN (MAX (Iy, 0), DY);
+
+  // Sx, Sy are the screen coordinates of the Ix,Iy pixel
+  Image_to_Screen (&Sx, &Sy, Ix,  Iy,  &image[0].picture);
+
+  // i_end, j_end are now limited to valid screen coordinates
+  i_end = MIN (MAX (Sx, 0), dx);
+  j_end = MIN (MAX (Sy, 0), dy);
 
   dropback = expand_out - (i_end - i_start) % expand_out;
@@ -58,4 +86,5 @@
   /********** below we do the mapping from buffer pixels (in) to picture pixels (out) **********/
 
+  // XXX can we just drop this?
   if ((i_end < i_start) || (j_end < j_start)) {
     for (j = 0; j < dx*dy; j++, out_pix++) 
Index: /trunk/Ohana/src/kapa2/src/CreateZoom8.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/CreateZoom8.c	(revision 16254)
+++ /trunk/Ohana/src/kapa2/src/CreateZoom8.c	(revision 16255)
@@ -15,4 +15,5 @@
 void CreateZoom8 (KapaImageWidget *image, Graphic *graphic, double x, double y) {
 
+# if (0)
   int i, j, ii, jj;
   int i_start, i_end, j_start, j_end;
@@ -138,3 +139,4 @@
 					image[0].zoom.data, image[0].zoom.dx, image[0].zoom.dy, 8, 0);
   
+# endif
 }
Index: /trunk/Ohana/src/kapa2/src/CrossHairs.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/CrossHairs.c	(revision 16254)
+++ /trunk/Ohana/src/kapa2/src/CrossHairs.c	(revision 16255)
@@ -1,5 +1,5 @@
 # include "Ximage.h"
 
-void CrossHairs (Graphic *graphic, KapaImageWidget *image) {
+void CrossHairs (Graphic *graphic, Picture *image) {
 
   int x0, x1, x5, x7;
@@ -7,14 +7,15 @@
   double zoomscale;
 
-  zoomscale = image[0].zoom;
-  x0 = (zoomscale) * (0.5 * (ZOOM_X + 1) / zoomscale - 2.5) + image[0].zoom.x;
-  x5 = (zoomscale) * (0.5 * (ZOOM_X + 1) / zoomscale - 0.5) + image[0].zoom.x;
-  x7 = (zoomscale) * (0.5 * (ZOOM_X + 1) / zoomscale + 0.5) + image[0].zoom.x;
-  x1 = (zoomscale) * (0.5 * (ZOOM_X + 1) / zoomscale + 2.5) + image[0].zoom.x;
+  // is this totally wrong??
+  zoomscale = image[0].expand;
+  x0 = (zoomscale) * (0.5 * (ZOOM_X + 1) / zoomscale - 2.5) + image[0].x;
+  x5 = (zoomscale) * (0.5 * (ZOOM_X + 1) / zoomscale - 0.5) + image[0].x;
+  x7 = (zoomscale) * (0.5 * (ZOOM_X + 1) / zoomscale + 0.5) + image[0].x;
+  x1 = (zoomscale) * (0.5 * (ZOOM_X + 1) / zoomscale + 2.5) + image[0].x;
 						    	 
-  y4 = (zoomscale) * (0.5 * (ZOOM_Y + 1) / zoomscale - 2.5) + image[0].zoom.y;
-  y2 = (zoomscale) * (0.5 * (ZOOM_Y + 1) / zoomscale - 0.5) + image[0].zoom.y;
-  y0 = (zoomscale) * (0.5 * (ZOOM_Y + 1) / zoomscale + 0.5) + image[0].zoom.y;
-  y5 = (zoomscale) * (0.5 * (ZOOM_Y + 1) / zoomscale + 2.5) + image[0].zoom.y;
+  y4 = (zoomscale) * (0.5 * (ZOOM_Y + 1) / zoomscale - 2.5) + image[0].y;
+  y2 = (zoomscale) * (0.5 * (ZOOM_Y + 1) / zoomscale - 0.5) + image[0].y;
+  y0 = (zoomscale) * (0.5 * (ZOOM_Y + 1) / zoomscale + 0.5) + image[0].y;
+  y5 = (zoomscale) * (0.5 * (ZOOM_Y + 1) / zoomscale + 2.5) + image[0].y;
 
 
Index: /trunk/Ohana/src/kapa2/src/CursorOps.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/CursorOps.c	(revision 16254)
+++ /trunk/Ohana/src/kapa2/src/CursorOps.c	(revision 16255)
@@ -3,5 +3,5 @@
 void Screen_to_Image (double *x1, double *y1, double x2, double y2, Picture *picture) {
 
-  double expand;
+  double xs, ys, expand;
 
   expand = 1.0;
@@ -23,5 +23,5 @@
 void Image_to_Screen (double *x1, double *y1, double x2, double y2, Picture *picture) {
 
-  double expand;
+  double xs, ys, expand;
 
   /* notice that here, expand is the reciprocal of the expand above */
@@ -30,5 +30,5 @@
     expand = picture[0].expand;
   } else {
-    expand = 1 / fabs((double)image[0].expand);
+    expand = 1 / fabs((double)picture[0].expand);
   }
   
Index: /trunk/Ohana/src/kapa2/src/Image.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/Image.c	(revision 16254)
+++ /trunk/Ohana/src/kapa2/src/Image.c	(revision 16255)
@@ -50,12 +50,18 @@
   image[0].picture.X      = 0.0;
   image[0].picture.Y      = 0.0;
+  image[0].picture.Xo     = 0.0;
+  image[0].picture.Yo     = 0.0;
   image[0].picture.expand = 1;
 
   image[0].zoom.X      	  = 0.0;
   image[0].zoom.Y      	  = 0.0;
+  image[0].zoom.Xo     	  = 0.0;
+  image[0].zoom.Yo     	  = 0.0;
   image[0].zoom.expand 	  = +5;
 
   image[0].wide.X      	  = 0.0;
   image[0].wide.Y      	  = 0.0;
+  image[0].wide.Xo     	  = 0.0;
+  image[0].wide.Yo     	  = 0.0;
   image[0].wide.expand 	  = -5;
 
@@ -148,5 +154,5 @@
 	       image[0].cmapbar.dx, image[0].cmapbar.dy);
 
-    CrossHairs (graphic, image);
+    CrossHairs (graphic, &image[0].zoom);
   
     /* erase everything below zoom box, then draw */
Index: /trunk/Ohana/src/kapa2/src/InterpretKeys.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/InterpretKeys.c	(revision 16254)
+++ /trunk/Ohana/src/kapa2/src/InterpretKeys.c	(revision 16255)
@@ -83,6 +83,6 @@
   // 0.5 image pixels is 1 screen pixel for expand == +2
   // 2.0 image pixels is 1 screen pixel for expand == -2
-  if (image[0].expand == 0) image[0].expand = 1;
-  offset = (image[0].expand > 0) ? 1.0 / image[0].expand : -image[0].expand;
+  if (image[0].picture.expand == 0) image[0].picture.expand = 1;
+  offset = (image[0].picture.expand > 0) ? 1.0 / image[0].picture.expand : -image[0].picture.expand;
   if (modstate & ControlMask) offset *= 100;
 
@@ -93,5 +93,5 @@
       SetColorScale (graphic, image);
       Remap (graphic, image);
-      Reorient (graphic, image, image[0].X, image[0].Y, 0);
+      Reorient (graphic, image, image[0].picture.X, image[0].picture.Y, 0);
       break;
 
@@ -100,5 +100,5 @@
       SetColorScale (graphic, image);
       Remap (graphic, image);
-      Reorient (graphic, image, image[0].X, image[0].Y, 0);
+      Reorient (graphic, image, image[0].picture.X, image[0].picture.Y, 0);
       break;
 
@@ -107,15 +107,15 @@
       SetColorScale (graphic, image);
       Remap (graphic, image);
-      Reorient (graphic, image, image[0].X, image[0].Y, 0);
+      Reorient (graphic, image, image[0].picture.X, image[0].picture.Y, 0);
       break;
 
     case XK_KP_Home:
     case XK_Home:
-      image[0].expand = 1;
-      Reorient (graphic, image, image[0].X, image[0].Y, 0);
+      image[0].picture.expand = 1;
+      Reorient (graphic, image, image[0].picture.X, image[0].picture.Y, 0);
       break;
     case XK_KP_End:
     case XK_End:
-      image[0].expand = 1;
+      image[0].picture.expand = 1;
       Reorient (graphic, image, 0, 0, 0);
       break;
@@ -130,34 +130,34 @@
     case XK_Prior:
     case XK_KP_Prior:
-      Reorient (graphic, image, image[0].X, image[0].Y, +1);
+      Reorient (graphic, image, image[0].picture.X, image[0].picture.Y, +1);
       break;
     case XK_Next:
     case XK_KP_Next:
-      Reorient (graphic, image, image[0].X, image[0].Y, -1);
+      Reorient (graphic, image, image[0].picture.X, image[0].picture.Y, -1);
       break;
     case XK_Up:
     case XK_KP_Up:
-      Reorient (graphic, image, image[0].X, image[0].Y + offset, 0);
+      Reorient (graphic, image, image[0].picture.X, image[0].picture.Y + offset, 0);
       break;
     case XK_Down:
     case XK_KP_Down:
-      Reorient (graphic, image, image[0].X, image[0].Y - offset, 0);
+      Reorient (graphic, image, image[0].picture.X, image[0].picture.Y - offset, 0);
       break;
     case XK_Left:
     case XK_KP_Left:
-      Reorient (graphic, image, image[0].X + offset, image[0].Y, 0);
+      Reorient (graphic, image, image[0].picture.X + offset, image[0].picture.Y, 0);
       break;
     case XK_Right:
     case XK_KP_Right:
-      Reorient (graphic, image, image[0].X - offset, image[0].Y, 0);
+      Reorient (graphic, image, image[0].picture.X - offset, image[0].picture.Y, 0);
       break;
 
     case XK_KP_Add:
       image[0].image[0].zero += 0.1*image[0].image[0].range;
-      Reorient (graphic, image, image[0].X, image[0].Y, 0);
+      Reorient (graphic, image, image[0].picture.X, image[0].picture.Y, 0);
       break;
     case XK_KP_Subtract:
       image[0].image[0].zero -= 0.1*image[0].image[0].range;
-      Reorient (graphic, image, image[0].X, image[0].Y, 0);
+      Reorient (graphic, image, image[0].picture.X, image[0].picture.Y, 0);
       break;
 
Index: /trunk/Ohana/src/kapa2/src/JPEGit24.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/JPEGit24.c	(revision 16254)
+++ /trunk/Ohana/src/kapa2/src/JPEGit24.c	(revision 16255)
@@ -8,4 +8,6 @@
 // XXX this currently writes out the jpeg for just the active image
 int JPEGit24 (int sock) {
+
+# if (0)
 
   struct jpeg_compress_struct cinfo;
@@ -75,16 +77,15 @@
   }
 
+  assert ((image[0].picture.expand >= 1) || (image[0].picture.expand <= -2));
   expand = expand_in = expand_out = 1.0;
-  if (image[0].expand == 0) /* set up expansions */
-    image[0].expand = 1;
-  if (image[0].expand > 0) {
-    expand = 1 / (1.0*image[0].expand);
-    expand_out = image[0].expand;
+  if (image[0].picture.expand > 0) {
+    expand = 1 / (1.0*image[0].picture.expand);
+    expand_out = image[0].picture.expand;
     expand_in  = 1;
   }
-  if (image[0].expand < 0) {
-    expand = fabs((double)image[0].expand);
+  if (image[0].picture.expand < 0) {
+    expand = fabs((double)image[0].picture.expand);
     expand_out = 1;
-    expand_in  = -image[0].expand;
+    expand_in  = -image[0].picture.expand;
   }
 
@@ -232,4 +233,6 @@
   jpeg_destroy_compress (&cinfo);
 
+
+# endif
   return (TRUE);
 }
Index: /trunk/Ohana/src/kapa2/src/PSOverlay.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/PSOverlay.c	(revision 16254)
+++ /trunk/Ohana/src/kapa2/src/PSOverlay.c	(revision 16255)
@@ -9,9 +9,9 @@
  
   expand = 1.0;
-  if (image[0].expand > 0) {
-    expand = 1 / (1.0*image[0].expand);
+  if (image[0].picture.expand > 0) {
+    expand = 1 / (1.0*image[0].picture.expand);
   }
-  if (image[0].expand < 0) {
-    expand = fabs((double)image[0].expand);
+  if (image[0].picture.expand < 0) {
+    expand = fabs((double)image[0].picture.expand);
   }
 
Index: /trunk/Ohana/src/kapa2/src/PaintOverlay.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/PaintOverlay.c	(revision 16254)
+++ /trunk/Ohana/src/kapa2/src/PaintOverlay.c	(revision 16255)
@@ -11,9 +11,9 @@
   
   expand = 1.0;
-  if (image[0].expand > 0) {
-    expand = 1 / (1.0*image[0].expand);
+  if (image[0].picture.expand > 0) {
+    expand = 1 / (1.0*image[0].picture.expand);
   }
-  if (image[0].expand < 0) {
-    expand = fabs((double)image[0].expand);
+  if (image[0].picture.expand < 0) {
+    expand = fabs((double)image[0].picture.expand);
   }
 
Index: /trunk/Ohana/src/kapa2/src/Remap16.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/Remap16.c	(revision 16254)
+++ /trunk/Ohana/src/kapa2/src/Remap16.c	(revision 16255)
@@ -3,4 +3,5 @@
 void Remap16 (Graphic *graphic, KapaImageWidget *image, Matrix *matrix) {
 
+# if (0)
   int i, j, ii, jj;
   int i_start, i_end, j_start, j_end;
@@ -165,4 +166,6 @@
   free (pixel1);
   free (pixel2);
+
+# endif
 }
 
Index: /trunk/Ohana/src/kapa2/src/Remap24.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/Remap24.c	(revision 16254)
+++ /trunk/Ohana/src/kapa2/src/Remap24.c	(revision 16255)
@@ -3,4 +3,5 @@
 void Remap24 (Graphic *graphic, KapaImageWidget *image, Matrix *matrix) {
 
+# if (0)
   int i, j, ii, jj;
   int i_start, i_end, j_start, j_end;
@@ -167,4 +168,6 @@
   free (pixel2);
   free (pixel3);
+
+# endif
 }
 
Index: /trunk/Ohana/src/kapa2/src/Remap32.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/Remap32.c	(revision 16254)
+++ /trunk/Ohana/src/kapa2/src/Remap32.c	(revision 16255)
@@ -23,19 +23,18 @@
 
   // set up expansions
+  assert ((image[0].picture.expand >= 1) || (image[0].picture.expand <= -2));
   expand = expand_in = expand_out = 1.0;
-  if (image[0].expand == 0) 
-    image[0].expand = 1;
-  if (image[0].expand > 0) {
-    expand = 1 / (1.0*image[0].expand);
-    expand_out = image[0].expand;
+  if (image[0].picture.expand > 0) {
+    expand = 1 / (1.0*image[0].picture.expand);
+    expand_out = image[0].picture.expand;
     expand_in  = 1;
   }
-  if (image[0].expand < 0) {
-    expand = fabs((double)image[0].expand);
+  if (image[0].picture.expand < 0) {
+    expand = fabs((double)image[0].picture.expand);
     expand_out = 1;
-    expand_in  = -image[0].expand;
+    expand_in  = -image[0].picture.expand;
   }
 
-  // define the image boundaries
+  // define the image sizes
   dx = image[0].picture.dx;
   dy = image[0].picture.dy;
Index: /trunk/Ohana/src/kapa2/src/Remap8.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/Remap8.c	(revision 16254)
+++ /trunk/Ohana/src/kapa2/src/Remap8.c	(revision 16255)
@@ -3,4 +3,5 @@
 void Remap8 (Graphic *graphic, KapaImageWidget *image, Matrix *matrix) {
 
+# if (0)
   int i, j, ii, jj;
   int i_start, i_end, j_start, j_end;
@@ -132,4 +133,6 @@
   image[0].picture.pix = XCreateImage (graphic[0].display, graphic[0].visual, graphic[0].depth, ZPixmap, 0, 
 					image[0].picture.data, image[0].picture.dx, image[0].picture.dy, 8, 0);
+
+# endif
 }
 
Index: /trunk/Ohana/src/kapa2/src/StatusBox.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/StatusBox.c	(revision 16254)
+++ /trunk/Ohana/src/kapa2/src/StatusBox.c	(revision 16255)
@@ -5,15 +5,17 @@
   double  x, y, z;
 
+  z = -1;
+
   if (image[0].MovePointer) {
     x = 0.5*image[0].image[0].matrix.Naxis[0];
     y = 0.5*image[0].image[0].matrix.Naxis[1];
-    z = -1;
-    image[0].x = x;
-    image[0].y = y;
-    image[0].z = z;
+    // z = -1;
+    image[0].zoom.x = x;
+    image[0].zoom.y = y;
+    // image[0].z = z;
   } else {
-    x = image[0].x;
-    y = image[0].y;
-    z = image[0].z;
+    x = image[0].zoom.x;
+    y = image[0].zoom.y;
+    // z = image[0].z;
   }
   
Index: /trunk/Ohana/src/kapa2/src/UpdatePointer.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/UpdatePointer.c	(revision 16254)
+++ /trunk/Ohana/src/kapa2/src/UpdatePointer.c	(revision 16255)
@@ -30,5 +30,5 @@
   skip:
     image[0].zoom.X = x;
-    image[0].zoom.Y = Y;
+    image[0].zoom.Y = y;
     
     UpdateStatusBox (graphic, image, x, y, z, 0);
@@ -40,5 +40,5 @@
 	       image[0].zoom.x, image[0].zoom.y, 
 	       image[0].zoom.dx, image[0].zoom.dy);
-    CrossHairs (graphic, image);
+    CrossHairs (graphic, &image[0].zoom);
     XFlush (graphic[0].display);
   }
Index: /trunk/Ohana/src/kapa2/src/UpdateStatusBox.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/UpdateStatusBox.c	(revision 16254)
+++ /trunk/Ohana/src/kapa2/src/UpdateStatusBox.c	(revision 16255)
@@ -21,5 +21,5 @@
     bzero (line, 100);
     sprintf (line, "(%d x %d) @ %d                                         ", 
-	     image[0].picture.dx, image[0].picture.dy, image[0].expand); 
+	     image[0].picture.dx, image[0].picture.dy, image[0].picture.expand); 
     XDrawString (graphic[0].display, graphic[0].window, graphic[0].gc, 
 		 image[0].text_x + PAD1, image[0].text_y + 4*textpad + 4*PAD1, line, 25);
Index: /trunk/Ohana/src/kapa2/src/bDrawOverlay.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/bDrawOverlay.c	(revision 16254)
+++ /trunk/Ohana/src/kapa2/src/bDrawOverlay.c	(revision 16255)
@@ -17,9 +17,9 @@
   
   expand = 1.0;
-  if (image[0].expand > 0) {
-    expand = 1 / (1.0*image[0].expand);
+  if (image[0].picture.expand > 0) {
+    expand = 1 / (1.0*image[0].picture.expand);
   }
-  if (image[0].expand < 0) {
-    expand = fabs((double)image[0].expand);
+  if (image[0].picture.expand < 0) {
+    expand = fabs((double)image[0].picture.expand);
   }
 
Index: /trunk/Ohana/src/kapa2/test/input
===================================================================
--- /trunk/Ohana/src/kapa2/test/input	(revision 16254)
+++ /trunk/Ohana/src/kapa2/test/input	(revision 16255)
@@ -1,2 +1,8 @@
+
+macro test1
+  mcreate a 512 512
+  set x = xramp(a)
+  tv x 0 512
+end
 
 macro go
