Index: trunk/Ohana/src/kapa2/include/icons.h
===================================================================
--- trunk/Ohana/src/kapa2/include/icons.h	(revision 14500)
+++ trunk/Ohana/src/kapa2/include/icons.h	(revision 14590)
@@ -1,2 +1,18 @@
+
+#define icon_width 29
+#define icon_height 29
+static unsigned char icon_bits[] = {
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x07,
+   0x04, 0x41, 0x10, 0x04, 0x04, 0x41, 0x10, 0x04, 0x04, 0x41, 0x10, 0x04,
+   0x04, 0x41, 0x10, 0x04, 0x04, 0x41, 0x10, 0x04, 0xfc, 0xff, 0xff, 0x07,
+   0x04, 0x41, 0x10, 0x04, 0x04, 0x41, 0x10, 0x04, 0x04, 0x41, 0x10, 0x04,
+   0x04, 0x41, 0x10, 0x04, 0x04, 0x41, 0x10, 0x04, 0xfc, 0xff, 0xff, 0x07,
+   0x04, 0x41, 0x10, 0x04, 0x04, 0x41, 0x10, 0x04, 0x04, 0x41, 0x10, 0x04,
+   0x04, 0x41, 0x10, 0x04, 0x04, 0x41, 0x10, 0x04, 0xfc, 0xff, 0xff, 0x07,
+   0x04, 0x41, 0x10, 0x04, 0x04, 0x41, 0x10, 0x04, 0x04, 0x41, 0x10, 0x04,
+   0x04, 0x41, 0x10, 0x04, 0x04, 0x41, 0x10, 0x04, 0xfc, 0xff, 0xff, 0x07,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+
+/* *** icons for buttons, not used ***
 #define arrow_width 6
 #define arrow_height 9
@@ -19,17 +35,4 @@
    0xfc, 0x0f, 0xfc, 0x3f, 0xfc, 0x3f, 0xfc, 0x0f, 0xfc, 0x03, 0xfc, 0x00,
    0x3c, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00};
-#define icon_width 29
-#define icon_height 29
-static unsigned char icon_bits[] = {
-   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x07,
-   0x04, 0x41, 0x10, 0x04, 0x04, 0x41, 0x10, 0x04, 0x04, 0x41, 0x10, 0x04,
-   0x04, 0x41, 0x10, 0x04, 0x04, 0x41, 0x10, 0x04, 0xfc, 0xff, 0xff, 0x07,
-   0x04, 0x41, 0x10, 0x04, 0x04, 0x41, 0x10, 0x04, 0x04, 0x41, 0x10, 0x04,
-   0x04, 0x41, 0x10, 0x04, 0x04, 0x41, 0x10, 0x04, 0xfc, 0xff, 0xff, 0x07,
-   0x04, 0x41, 0x10, 0x04, 0x04, 0x41, 0x10, 0x04, 0x04, 0x41, 0x10, 0x04,
-   0x04, 0x41, 0x10, 0x04, 0x04, 0x41, 0x10, 0x04, 0xfc, 0xff, 0xff, 0x07,
-   0x04, 0x41, 0x10, 0x04, 0x04, 0x41, 0x10, 0x04, 0x04, 0x41, 0x10, 0x04,
-   0x04, 0x41, 0x10, 0x04, 0x04, 0x41, 0x10, 0x04, 0xfc, 0xff, 0xff, 0x07,
-   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
 #define stop_width 16
 #define stop_height 16
@@ -38,2 +41,3 @@
    0xf8, 0x1f, 0xf8, 0x1f, 0xf8, 0x1f, 0xf8, 0x1f, 0xf8, 0x1f, 0xf8, 0x1f,
    0xf8, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+*/
Index: trunk/Ohana/src/kapa2/include/prototypes.h
===================================================================
--- trunk/Ohana/src/kapa2/include/prototypes.h	(revision 14500)
+++ trunk/Ohana/src/kapa2/include/prototypes.h	(revision 14590)
@@ -23,4 +23,5 @@
 void          NameWindow          PROTO((Graphic *graphic, char *name));
 void          MapWindow           PROTO((Graphic *graphic));
+void CheckVisual (Graphic *graphic, int *argc, char **argv);
 
 /* X drawing utilities */
@@ -85,4 +86,5 @@
 int           SetActiveSectionByNumber PROTO((int N));
 int           ListSection         PROTO((int sock));
+void SetSectionSizes (Section *section);
 
 KapaGraphWidget *InitGraph        PROTO(());
@@ -188,2 +190,31 @@
 int	      Overlay3		  PROTO((Graphic *graphic, KapaImageWidget *image));
 int	      PSfunction	  PROTO((Graphic *graphic, KapaImageWidget *image));
+
+/* misc functions */
+void SetToolbox (int sock);
+int EraseOverlay (int sock);
+int LoadOverlay (int sock);
+int SaveOverlay (int sock);
+int CSaveOverlay (int sock);
+int JPEGit24 (int sock);
+
+int UpdatePointer (Graphic *graphic, XMotionEvent *event);
+int InterpretPresses (Graphic *graphic, XButtonEvent *event);
+int InterpretKeys (Graphic *graphic, XKeyEvent *event);
+void InitPipe (char *namedSocket);
+void EraseGraph (KapaGraphWidget *graph);
+void StatusBox (Graphic *graphic, KapaImageWidget *image);
+
+void CreatePicture (KapaImageWidget *image, Graphic *graphic);
+void CreateColorbar (KapaImageWidget *image, Graphic *graphic);
+void CreateZoom (KapaImageWidget *image, Graphic *graphic, double x, double y);
+void UpdateStatusBox (Graphic *graphic, KapaImageWidget *image, double x, double y, double z, int mode);
+
+void CreateZoom8  (KapaImageWidget *image, Graphic *graphic, double x, double y);
+void CreateZoom16 (KapaImageWidget *image, Graphic *graphic, double x, double y);
+void CreateZoom24 (KapaImageWidget *image, Graphic *graphic, double x, double y);
+void CreateZoom32 (KapaImageWidget *image, Graphic *graphic, double x, double y);
+
+int GetActiveSocket ();
+void InvertButton (Graphic *graphic, Button *button);
+void bDrawOverlay (KapaImageWidget *image, int N);
Index: trunk/Ohana/src/kapa2/include/structures.h
===================================================================
--- trunk/Ohana/src/kapa2/include/structures.h	(revision 14500)
+++ trunk/Ohana/src/kapa2/include/structures.h	(revision 14590)
@@ -13,5 +13,5 @@
   Cursor         cursor;
   int            x,  y;
-  int            dx, dy;
+  unsigned int   dx, dy;
   XColor         cmap[256];
   Colormap       colormap;
Index: trunk/Ohana/src/kapa2/src/CheckGeometry.c
===================================================================
--- trunk/Ohana/src/kapa2/src/CheckGeometry.c	(revision 14500)
+++ trunk/Ohana/src/kapa2/src/CheckGeometry.c	(revision 14590)
@@ -4,7 +4,5 @@
 void CheckGeometry (Graphic *graphic, int *argc, char **argv) {
 
-  int status, x, y, N;
-  unsigned int dx, dy;
-  int X, Y, dX, dY;
+  int status, N;
   char *temp_name;
   
Index: trunk/Ohana/src/kapa2/src/CheckPipe.c
===================================================================
--- trunk/Ohana/src/kapa2/src/CheckPipe.c	(revision 14500)
+++ trunk/Ohana/src/kapa2/src/CheckPipe.c	(revision 14590)
@@ -186,5 +186,5 @@
   
   if (!strcmp (word, "TOOL")) {
-    status = SetToolbox (sock);
+    SetToolbox (sock);
     KiiSendCommand (sock, 4, "DONE");
     FINISHED (TRUE);
Index: trunk/Ohana/src/kapa2/src/CreateZoom8.c
===================================================================
--- trunk/Ohana/src/kapa2/src/CreateZoom8.c	(revision 14500)
+++ trunk/Ohana/src/kapa2/src/CreateZoom8.c	(revision 14590)
@@ -68,5 +68,5 @@
   if ((i_end - i_start) % expand_out == 0) dropback = 0;
 
-  out_pix = (char *) image[0].zoom.data;
+  out_pix = (unsigned char *) image[0].zoom.data;
   imdata  = (float *) image[0].matrix.buffer;
   in_pix  = &imdata[DX*(int)MAX(Ry,0) + (int)MAX(Rx,0)];
Index: trunk/Ohana/src/kapa2/src/DefineSection.c
===================================================================
--- trunk/Ohana/src/kapa2/src/DefineSection.c	(revision 14500)
+++ trunk/Ohana/src/kapa2/src/DefineSection.c	(revision 14590)
@@ -4,5 +4,5 @@
 int DefineSection (int sock) {
   
-  int i, N, MoveSection;
+  int N, MoveSection;
   char name[128];
   double x, y, dx, dy;
Index: trunk/Ohana/src/kapa2/src/DrawButton.c
===================================================================
--- trunk/Ohana/src/kapa2/src/DrawButton.c	(revision 14500)
+++ trunk/Ohana/src/kapa2/src/DrawButton.c	(revision 14590)
@@ -2,6 +2,4 @@
 
 void DrawButton (Graphic *graphic, Button *button) {
-  
-  int y, dX;
   
   XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].back);
Index: trunk/Ohana/src/kapa2/src/EraseImage.c
===================================================================
--- trunk/Ohana/src/kapa2/src/EraseImage.c	(revision 14500)
+++ trunk/Ohana/src/kapa2/src/EraseImage.c	(revision 14590)
@@ -3,6 +3,4 @@
 int EraseImage () {
 
-  char buffer[256];
-  int i, status, N;
   Graphic *graphic;
   Section *section;
Index: trunk/Ohana/src/kapa2/src/EraseOverlay.c
===================================================================
--- trunk/Ohana/src/kapa2/src/EraseOverlay.c	(revision 14500)
+++ trunk/Ohana/src/kapa2/src/EraseOverlay.c	(revision 14590)
@@ -3,6 +3,5 @@
 int EraseOverlay (int sock) {
 
-  char buffer[256];
-  int i, status, N;
+  int i, N;
   Graphic *graphic;
   Section *section;
Index: trunk/Ohana/src/kapa2/src/EventLoop.c
===================================================================
--- trunk/Ohana/src/kapa2/src/EventLoop.c	(revision 14500)
+++ trunk/Ohana/src/kapa2/src/EventLoop.c	(revision 14590)
@@ -50,5 +50,5 @@
     if (LastEvent (display, MotionNotify,    &event)) UpdatePointer (graphic, (XMotionEvent *) &event);
     if (LastEvent (display, ButtonPress,     &event)) InterpretPresses (graphic, (XButtonEvent *) &event);
-    if (LastEvent (display, KeyPress,        &event)) InterpretKeys (graphic, &event);
+    if (LastEvent (display, KeyPress,        &event)) InterpretKeys (graphic, (XKeyEvent *) &event);
 
     /* drop and ignore the following StructureNotifyMask events */
Index: trunk/Ohana/src/kapa2/src/GetPixelCount.c
===================================================================
--- trunk/Ohana/src/kapa2/src/GetPixelCount.c	(revision 14500)
+++ trunk/Ohana/src/kapa2/src/GetPixelCount.c	(revision 14590)
@@ -3,6 +3,4 @@
 int GetPixelCount (int sock) {
   
-  int i;
-  double xmin, xmax, ymin, ymax;
   Graphic *graphic;
 
Index: trunk/Ohana/src/kapa2/src/InterpretKeys.c
===================================================================
--- trunk/Ohana/src/kapa2/src/InterpretKeys.c	(revision 14500)
+++ trunk/Ohana/src/kapa2/src/InterpretKeys.c	(revision 14590)
@@ -6,5 +6,5 @@
   double 	   X, Y, Z, R, D, offset;
   int    	   sock, DX, DY, modstate;
-  char   	  *name, string[16], line[40];
+  char   	  *name, string[16];
   KeySym           keysym;
   XComposeStatus   composestatus;
@@ -134,5 +134,5 @@
     case XK_Tab:
       image[0].MovePointer = image[0].MovePointer ^ TRUE;
-      if (image[0].MovePointer) UpdatePointer (graphic, image, (XMotionEvent *)event);
+      if (image[0].MovePointer) UpdatePointer (graphic, (XMotionEvent *)event);
       break;
   }
Index: trunk/Ohana/src/kapa2/src/InterpretPresses.c
===================================================================
--- trunk/Ohana/src/kapa2/src/InterpretPresses.c	(revision 14500)
+++ trunk/Ohana/src/kapa2/src/InterpretPresses.c	(revision 14590)
@@ -3,9 +3,8 @@
 int InterpretPresses (Graphic *graphic, XButtonEvent *event) {
 
-  int              sock, DX, DY, status, done, this_button, old_cursor;
-  char             name[16], line[40];
+  int              sock, DX, DY, status, done, this_button;
+  char             name[16];
   double           X, Y, Z, R, D;
   float           *imdata;
-  KeySym           keysym;
   Button          *button;
   Section         *section;
Index: trunk/Ohana/src/kapa2/src/JPEGit24.c
===================================================================
--- trunk/Ohana/src/kapa2/src/JPEGit24.c	(revision 14500)
+++ trunk/Ohana/src/kapa2/src/JPEGit24.c	(revision 14590)
@@ -33,5 +33,5 @@
   int dropback;  /* this is a bit of a kludge... */
   int dx, dy, DX, DY, pixelN;
-  int status, Nbytes, quality;
+  int quality;
   int expand_in, expand_out;
   double expand, Rx, Ry, X, Y;
Index: trunk/Ohana/src/kapa2/src/LoadFrame.c
===================================================================
--- trunk/Ohana/src/kapa2/src/LoadFrame.c	(revision 14500)
+++ trunk/Ohana/src/kapa2/src/LoadFrame.c	(revision 14590)
@@ -3,5 +3,5 @@
 int LoadFrame (int sock) {
   
-  int i, status;
+  int i;
   char Axis[16], Labels[16], Ticks[16];
   Section *section;
Index: trunk/Ohana/src/kapa2/src/LoadObject.c
===================================================================
--- trunk/Ohana/src/kapa2/src/LoadObject.c	(revision 14500)
+++ trunk/Ohana/src/kapa2/src/LoadObject.c	(revision 14590)
@@ -123,5 +123,5 @@
   }
   if (Nbytes_send != Npts_send*sizeof(float)) {
-    fprintf (stderr, "Kapa Communication error: unexpected data size %d vs %d\n", Nbytes_send, Npts_send*sizeof(float));
+    fprintf (stderr, "Kapa Communication error: unexpected data size %d vs %ld\n", Nbytes_send, Npts_send*sizeof(float));
   }
 
Index: trunk/Ohana/src/kapa2/src/LoadOverlay.c
===================================================================
--- trunk/Ohana/src/kapa2/src/LoadOverlay.c	(revision 14500)
+++ trunk/Ohana/src/kapa2/src/LoadOverlay.c	(revision 14590)
@@ -4,5 +4,5 @@
   
   int i, j, Ntotal, Nbytes, Nread, Nfound, Ntext, Nobjects, overnum;
-  int Noverlay, NOVERLAY, Ntextdata;
+  int Noverlay, Ntextdata;
   char *textdata, *buffer, *p, *q;
   Section *section;
Index: trunk/Ohana/src/kapa2/src/SetImageData.c
===================================================================
--- trunk/Ohana/src/kapa2/src/SetImageData.c	(revision 14500)
+++ trunk/Ohana/src/kapa2/src/SetImageData.c	(revision 14590)
@@ -3,6 +3,4 @@
 int SetImageData (int sock) {
   
-  int i;
-  double xmin, xmax, ymin, ymax;
   Graphic *graphic;
   Section *section;
@@ -55,6 +53,4 @@
 int SetImageCoords (int sock) {
   
-  int i;
-  double xmin, xmax, ymin, ymax;
   Graphic *graphic;
   Section *section;
Index: trunk/Ohana/src/kapa2/src/SetImageSize.c
===================================================================
--- trunk/Ohana/src/kapa2/src/SetImageSize.c	(revision 14500)
+++ trunk/Ohana/src/kapa2/src/SetImageSize.c	(revision 14590)
@@ -7,5 +7,5 @@
 void SetImageSize (Section *section) {
 
-  int Xs, Ys, Xe, Ye, dX, dY;
+  int Xs, Ys, dX, dY;
   int textpad, textdY, WdY; 
   KapaImageWidget *image;
