Index: /branches/eam_branch_20080223/Ohana/src/kapa2/include/buttons.h
===================================================================
--- /branches/eam_branch_20080223/Ohana/src/kapa2/include/buttons.h	(revision 16771)
+++ /branches/eam_branch_20080223/Ohana/src/kapa2/include/buttons.h	(revision 16772)
@@ -119,2 +119,26 @@
    0x42, 0x84, 0x84, 0x00, 0x42, 0x84, 0x84, 0x00, 0x62, 0xc4, 0xc4, 0x00,
    0x5c, 0xb9, 0xb8, 0x00};
+#define flipx_width 25
+#define flipx_height 25
+static unsigned char flipx_bits[] = {
+   0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x01, 0x00, 0x80, 0x10, 0x02, 0x00,
+   0x40, 0x00, 0x04, 0x00, 0x20, 0x10, 0x08, 0x00, 0x10, 0x10, 0x10, 0x00,
+   0x08, 0x00, 0x20, 0x00, 0x04, 0x10, 0x40, 0x00, 0x02, 0x10, 0x80, 0x00,
+   0x01, 0x00, 0x00, 0x01, 0x02, 0x10, 0x80, 0x00, 0x04, 0x10, 0x40, 0x00,
+   0x08, 0x00, 0x20, 0x00, 0x10, 0x10, 0x10, 0x00, 0x20, 0x10, 0x08, 0x00,
+   0x40, 0x00, 0x04, 0x00, 0x80, 0x10, 0x02, 0x00, 0x00, 0x11, 0x01, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
+   0x00, 0x10, 0x00, 0x00 };
+#define flipy_width 25
+#define flipy_height 25
+static unsigned char flipy_bits[] = {
+   0x00, 0x10, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00,
+   0x00, 0x82, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x80, 0x00, 0x02, 0x00,
+   0x40, 0x00, 0x04, 0x00, 0x20, 0x00, 0x08, 0x00, 0x10, 0x00, 0x10, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0xb7, 0x6d, 0xdb, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x20, 0x00, 0x08, 0x00,
+   0x40, 0x00, 0x04, 0x00, 0x80, 0x00, 0x02, 0x00, 0x00, 0x01, 0x01, 0x00,
+   0x00, 0x82, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00,
+   0x00, 0x10, 0x00, 0x00 };
Index: /branches/eam_branch_20080223/Ohana/src/kapa2/include/prototypes.h
===================================================================
--- /branches/eam_branch_20080223/Ohana/src/kapa2/include/prototypes.h	(revision 16771)
+++ /branches/eam_branch_20080223/Ohana/src/kapa2/include/prototypes.h	(revision 16772)
@@ -195,4 +195,6 @@
 int	      RecenterRescale	  PROTO((Graphic *graphic, KapaImageWidget *image));
 int	      ToggleDEG		  PROTO((Graphic *graphic, KapaImageWidget *image));
+int	      FlipImageX	  PROTO((Graphic *graphic, KapaImageWidget *image));
+int	      FlipImageY	  PROTO((Graphic *graphic, KapaImageWidget *image));
 int	      Overlay0		  PROTO((Graphic *graphic, KapaImageWidget *image));
 int	      Overlay1		  PROTO((Graphic *graphic, KapaImageWidget *image));
Index: /branches/eam_branch_20080223/Ohana/src/kapa2/include/structures.h
===================================================================
--- /branches/eam_branch_20080223/Ohana/src/kapa2/include/structures.h	(revision 16771)
+++ /branches/eam_branch_20080223/Ohana/src/kapa2/include/structures.h	(revision 16772)
@@ -180,4 +180,6 @@
   Button   heat_button;
   Button   overlay_button[NOVERLAYS];
+  Button   flipx_button;
+  Button   flipy_button;
 
   // location of the status box
Index: /branches/eam_branch_20080223/Ohana/src/kapa2/src/ButtonFunctions.c
===================================================================
--- /branches/eam_branch_20080223/Ohana/src/kapa2/src/ButtonFunctions.c	(revision 16771)
+++ /branches/eam_branch_20080223/Ohana/src/kapa2/src/ButtonFunctions.c	(revision 16772)
@@ -17,5 +17,4 @@
   CreateWide (graphic, image); 
   Refresh ();
-  XFlush (graphic[0].display);
   return (TRUE);
 }
@@ -29,5 +28,4 @@
   CreateWide (graphic, image); 
   Refresh ();
-  XFlush (graphic[0].display);
   return (TRUE);
 }
@@ -41,5 +39,4 @@
   CreateWide (graphic, image); 
   Refresh ();
-  XFlush (graphic[0].display);
   return (TRUE);
 }
@@ -52,5 +49,4 @@
   Remap (graphic, image);
   Refresh ();
-  FlushDisplay (graphic[0].display);
   return (TRUE);
 
@@ -62,5 +58,4 @@
   Remap (graphic, image);
   Refresh ();
-  FlushDisplay (graphic[0].display);
   return (TRUE);
 
@@ -75,14 +70,34 @@
   Remap (graphic, image);
   Refresh ();
-  FlushDisplay (graphic[0].display);
   return (TRUE);
 
 }
 
+int FlipImageX (Graphic *graphic, KapaImageWidget *image) {
+
+  image[0].picture.flipx = !image[0].picture.flipx;
+  image[0].zoom.flipx 	 = !image[0].zoom.flipx;
+  image[0].wide.flipx 	 = !image[0].wide.flipx;
+ 
+  Remap (graphic, image);
+  CreateWide (graphic, image);
+  Refresh ();
+  return (TRUE);
+}
+
+int FlipImageY (Graphic *graphic, KapaImageWidget *image) {
+
+  image[0].picture.flipy = !image[0].picture.flipy;
+  image[0].zoom.flipy 	 = !image[0].zoom.flipy;
+  image[0].wide.flipy 	 = !image[0].wide.flipy;
+ 
+  Remap (graphic, image);
+  CreateWide (graphic, image);
+  Refresh ();
+  return (TRUE);
+}
+
 int ToggleDEG (Graphic *graphic, KapaImageWidget *image) {
 
-  image[0].picture.flipy = !image[0].picture.flipy;
-  image[0].zoom.flipy = !image[0].zoom.flipy;
-  image[0].wide.flipy = !image[0].wide.flipy;
   image[0].DecimalDegrees = image[0].DecimalDegrees ^ TRUE;
   StatusBox (graphic, image);
@@ -97,5 +112,4 @@
   image[0].overlay[0].active = image[0].overlay[0].active ^ TRUE;
   Refresh ();
-  FlushDisplay (graphic[0].display);
   return (TRUE);
 
@@ -106,5 +120,4 @@
   image[0].overlay[1].active = image[0].overlay[1].active ^ TRUE;
   Refresh ();
-  FlushDisplay (graphic[0].display);
   return (TRUE);
 
@@ -115,5 +128,4 @@
   image[0].overlay[2].active = image[0].overlay[2].active ^ TRUE;
   Refresh ();
-  FlushDisplay (graphic[0].display);
   return (TRUE);
 
@@ -124,5 +136,4 @@
   image[0].overlay[3].active = image[0].overlay[3].active ^ TRUE;
   Refresh ();
-  FlushDisplay (graphic[0].display);
   return (TRUE);
 
Index: /branches/eam_branch_20080223/Ohana/src/kapa2/src/CheckButtons.c
===================================================================
--- /branches/eam_branch_20080223/Ohana/src/kapa2/src/CheckButtons.c	(revision 16771)
+++ /branches/eam_branch_20080223/Ohana/src/kapa2/src/CheckButtons.c	(revision 16772)
@@ -26,4 +26,10 @@
     button = &image[0].hms_button;
 
+  if (InButton (event, &image[0].flipx_button)) 
+    button = &image[0].flipx_button;
+
+  if (InButton (event, &image[0].flipy_button)) 
+    button = &image[0].flipy_button;
+
   for (i = 0; i < NOVERLAYS; i++) {
     if (InButton (event, &image[0].overlay_button[i])) 
Index: /branches/eam_branch_20080223/Ohana/src/kapa2/src/Image.c
===================================================================
--- /branches/eam_branch_20080223/Ohana/src/kapa2/src/Image.c	(revision 16771)
+++ /branches/eam_branch_20080223/Ohana/src/kapa2/src/Image.c	(revision 16772)
@@ -106,4 +106,10 @@
   InitButtonSize (&image[0].hms_button, hms_width, hms_height, hms_bits);
   InitButtonFunc (&image[0].hms_button, ToggleDEG);
+
+  InitButtonSize (&image[0].flipx_button, flipx_width, flipx_height, flipx_bits);
+  InitButtonFunc (&image[0].flipx_button, FlipImageX);
+
+  InitButtonSize (&image[0].flipy_button, flipy_width, flipy_height, flipy_bits);
+  InitButtonFunc (&image[0].flipy_button, FlipImageY);
 
   return (image);
@@ -175,4 +181,7 @@
     DrawButton (graphic, &image[0].hms_button);
 
+    DrawButton (graphic, &image[0].flipx_button);
+    DrawButton (graphic, &image[0].flipy_button);
+
     for (i = 0; i < NOVERLAYS; i++) {
       DrawButton (graphic, &image[0].overlay_button[i]);
Index: /branches/eam_branch_20080223/Ohana/src/kapa2/src/SetImageSize.c
===================================================================
--- /branches/eam_branch_20080223/Ohana/src/kapa2/src/SetImageSize.c	(revision 16771)
+++ /branches/eam_branch_20080223/Ohana/src/kapa2/src/SetImageSize.c	(revision 16772)
@@ -26,6 +26,11 @@
   dY = graphic[0].dy * section[0].dy;
 
+  textpad = USE_XWINDOW ? graphic[0].font[0].ascent : 10;
+  textdY = 6*textpad + 7*PAD1;
+  WdY = MAX (ZOOM_Y, textdY + 2*BUTTON_HEIGHT + PAD1);
+
   switch (image[0].location) {
-    case 0:
+
+    case 0: // no zoom / status / wide
       if (section->graph) {
 	  image[0].picture.x  = graph[0].axis[0].fx;
@@ -43,8 +48,5 @@
       return;
 
-    case 1:
-      textpad = USE_XWINDOW ? graphic[0].font[0].ascent : 10;
-      textdY = 6*textpad + 7*PAD1;
-      WdY = MAX (ZOOM_Y, textdY + 2*BUTTON_HEIGHT + PAD1);
+    case 1: // zoom / status / wide on bottom
 
       if (section->graph) {
@@ -110,16 +112,20 @@
       image[0].recenter_button.y = image[0].PS_button.y;
 
+      // add just below
+      image[0].flipx_button.x = image[0].recenter_button.x + image[0].recenter_button.dx + PAD1;
+      image[0].flipx_button.y = image[0].recenter_button.y;
+
+      image[0].flipy_button.x = image[0].hms_button.x + image[0].hms_button.dx + PAD1;
+      image[0].flipy_button.y = image[0].hms_button.y;
+
       // XXX zoom should scale somewhat with the image? (with a min and a max)
       // XXX actually, it is limited by the buttons and status region
       image[0].wide.dx = ZOOM_X; 
       image[0].wide.dy = ZOOM_Y;
-      image[0].wide.x = image[0].recenter_button.x + image[0].recenter_button.dx + PAD1;
-      image[0].wide.y = image[0].PS_button.y;
-      break;
-
-    case 3:
-      textpad = USE_XWINDOW ? graphic[0].font[0].ascent : 10;
-      textdY = 6*textpad + 7*PAD1;
-      WdY = MAX (ZOOM_Y, textdY + 2*BUTTON_HEIGHT + PAD1);
+      image[0].wide.x = image[0].flipx_button.x + image[0].flipx_button.dx + PAD1;
+      image[0].wide.y = image[0].zoom.y;
+      break;
+
+    case 3: // zoom / status / wide on top
 
       if (section->graph) {
@@ -185,13 +191,20 @@
       image[0].recenter_button.y = image[0].PS_button.y;
 
+      // add just below
+      image[0].flipx_button.x = image[0].recenter_button.x + image[0].recenter_button.dx + PAD1;
+      image[0].flipx_button.y = image[0].recenter_button.y;
+
+      image[0].flipy_button.x = image[0].hms_button.x + image[0].hms_button.dx + PAD1;
+      image[0].flipy_button.y = image[0].hms_button.y;
+
       // XXX zoom should scale somewhat with the image? (with a min and a max)
       // XXX actually, it is limited by the buttons and status region
       image[0].wide.dx = ZOOM_X; 
       image[0].wide.dy = ZOOM_Y;
-      image[0].wide.x = image[0].PS_button.x;
-      image[0].wide.y = image[0].PS_button.y + BUTTON_HEIGHT + PAD1;
-      break;
-
-    case 2:
+      image[0].wide.x = image[0].flipx_button.x + image[0].flipx_button.dx + PAD1;
+      image[0].wide.y = image[0].zoom.y;
+      break;
+
+    case 2: // zoom / status / wide on left
 
       if (section->graph) {
@@ -220,5 +233,4 @@
 
       /** everything below is tied in x-dir to the zoom box **/
-      textpad = USE_XWINDOW ? graphic[0].font[0].ascent : 10;
       image[0].text_x = image[0].zoom.x;
       image[0].text_y = image[0].zoom.y + image[0].zoom.dy + PAD1;
@@ -258,13 +270,20 @@
       image[0].recenter_button.y = image[0].PS_button.y;
 
+      // add just below
+      image[0].flipx_button.x = image[0].PS_button.x;
+      image[0].flipx_button.y = image[0].PS_button.y + BUTTON_HEIGHT + PAD1;
+
+      image[0].flipy_button.x = image[0].flipx_button.x + image[0].flipx_button.dx + PAD1;
+      image[0].flipy_button.y = image[0].flipx_button.y;
+
       // XXX zoom should scale somewhat with the image? (with a min and a max)
       // XXX actually, it is limited by the buttons and status region
       image[0].wide.dx = ZOOM_X; 
       image[0].wide.dy = ZOOM_Y;
-      image[0].wide.x = image[0].recenter_button.x + image[0].recenter_button.dx + PAD1;
-      image[0].wide.y = image[0].PS_button.y;
-      break;
-
-    case 4:
+      image[0].wide.x = image[0].flipx_button.x;
+      image[0].wide.y = image[0].flipx_button.y + BUTTON_HEIGHT + PAD1;
+      break;
+
+    case 4:  // zoom / status / wide on right
 
       if (section->graph) {
@@ -293,5 +312,4 @@
 
       /** everything below is tied in x-dir to the zoom box **/
-      textpad = USE_XWINDOW ? graphic[0].font[0].ascent : 10;
       image[0].text_x = image[0].zoom.x;
       image[0].text_y = image[0].zoom.y + image[0].zoom.dy + PAD1;
@@ -331,10 +349,17 @@
       image[0].recenter_button.y = image[0].PS_button.y;
 
+      // add just below
+      image[0].flipx_button.x = image[0].zoom.x;
+      image[0].flipx_button.y = image[0].PS_button.y + BUTTON_HEIGHT + PAD1;
+
+      image[0].flipy_button.x = image[0].flipx_button.x + image[0].flipx_button.dx + PAD1;
+      image[0].flipy_button.y = image[0].flipx_button.y;
+
       // XXX zoom should scale somewhat with the image? (with a min and a max)
       // XXX actually, it is limited by the buttons and status region
       image[0].wide.dx = ZOOM_X; 
       image[0].wide.dy = ZOOM_Y;
-      image[0].wide.x = image[0].PS_button.x;
-      image[0].wide.y = image[0].PS_button.y + BUTTON_HEIGHT + PAD1;
+      image[0].wide.x = image[0].flipx_button.x;
+      image[0].wide.y = image[0].flipx_button.y + BUTTON_HEIGHT + PAD1;
       break;
 
