Index: unk/Ohana/src/kapa2/src/CheckFontName.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/CheckFontName.c	(revision 13335)
+++ 	(revision )
@@ -1,28 +1,0 @@
-# include "Ximage.h"
-
-/************** CheckFontName *************/
-void CheckFontName (int *argc, char **argv, char *fontname) {
-
-  int N;
-
-  if ((N = get_argument (*argc, argv, "-font"))) {
-    if (N + 1 < *argc) {
-      strcpy (fontname, argv[N + 1]);
-      remove_argument(N, argc, argv);
-      remove_argument(N, argc, argv);
-    } else {
-      fprintf (stderr, "error: usage is -font fontname\n");
-      exit (0);
-    }
-  }   
-  if ((N = get_argument (*argc, argv, "-fn"))) {
-    if (N + 1 < *argc) {
-      strcpy (fontname, argv[N + 1]);
-      remove_argument(N, argc, argv);
-      remove_argument(N, argc, argv);
-    } else {
-      fprintf (stderr, "error: usage is -fn fontname\n");
-      exit (0);
-    }
-  }   
-}
Index: unk/Ohana/src/kapa2/src/DefineLayout.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/DefineLayout.c	(revision 13335)
+++ 	(revision )
@@ -1,56 +1,0 @@
-# include "Ximage.h"
-# define PAD 40
-
-/* general initialization for things not specific to X */
-void DefineLayout (int argc, char **argv) {
-
-  int i;
-  
-  /** initiate connection with server **/
-  if (!FOREGROUND) {	
-    if (argc < 2) {
-      fprintf (stderr, "socket path not specified\n");
-      exit (0);
-    }
-    sock = KiiWait (argv[1]);
-  }
-
-  InitRotFonts ();
-
-  /** set up defaults for display region **/
-  /* default startup uses one graphic region, filling the window */
-  
-  Nsection = 1;
-  ALLOCATE (section, Layout, Nsection);
-  TheSection = 0;
-
-  /* set up axis positions */
-  for (i = 0; i < 4; i++) {
-    section[0].axis[i].min = 0.0;
-    section[0].axis[i].max = 1.0;
-    section[0].axis[i].isaxis = FALSE;
-    section[0].axis[i].areticks = FALSE;
-    section[0].axis[i].islabel = FALSE;
-  }    
-  for (i = 0; i < 8; i++) {
-    strcpy (section[0].label[i].text, "");
-  }
-  section[0].x  = 0;
-  section[0].dx = 1; 
-  section[0].y  = 0; 
-  section[0].dy = 1; 
-  strcpy (section[0].name, "default");
-
-  PositionPicture (&section[0]);
-
-  section[0].Nobjects = 0;
-  section[0].Nptext = 0;
-
-  ALLOCATE (section[0].objects, Gobjects, 1);  /* allocate so later free will not crash! */
-  section[0].objects[0].x   = section[0].objects[0].y   = section[0].objects[0].z = (float *) NULL;
-  section[0].objects[0].dxm = section[0].objects[0].dxp = (float *) NULL;
-  section[0].objects[0].dym = section[0].objects[0].dyp = (float *) NULL;
-  
-  ALLOCATE (section[0].ptext, Label, 1);       /* allocate so later free will not crash! */
-
-}
Index: unk/Ohana/src/kapa2/src/DrawPtext.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/DrawPtext.c	(revision 13335)
+++ 	(revision )
@@ -1,36 +1,0 @@
-# include "Ximage.h"
-  
-void DrawPtext (Layout *layout) {
-  
-  int i, x, y, size;
-  double angle;
-  char *fontname;
-
-  fontname = GetRotFont (&size);
-  XSetForeground (graphic.display, graphic.gc, graphic.fore);
-  DrawRotTextInit (graphic.display, graphic.window, graphic.gc, graphic.fore, graphic.back);
-
-  for (i = 0; i < layout[0].Nptext; i++) {
-    if (strcmp (layout[0].ptext[i].text, "")) {
-      angle = layout[0].ptext[i].angle;
-      x = layout[0].ptext[i].x;
-      y = layout[0].ptext[i].y;
-      SetRotFont (layout[0].ptext[i].font, layout[0].ptext[i].size);
-      DrawRotText (x, y, layout[0].ptext[i].text, 5, angle);
-    }
-  }
-  SetRotFont (fontname, size);
-}
-
-  /* pos values
-            
- 4____2___5 
-  |       | 
-  |       | 
- 1|   8   |3
-  |       |
-  |       |
-  ---------
-  6   0   7
-
-  */
Index: unk/Ohana/src/kapa2/src/DrawText.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/DrawText.c	(revision 13335)
+++ 	(revision )
@@ -1,39 +1,0 @@
-# include "Ximage.h"
-  
-/* Draw text centered at x,y */
-
-void DrawText (int x, int y, char *string, int pos) {
-
-  char *c;
-  int dx, dy;
-
-  for (c = string; (*c == ' ') || (*c == '\t'); c++);
-  if (*c == 0) return;
-  
-  dx  = XTextWidth (graphic.font, c, strlen(c));
-  dy  = graphic.font[0].ascent;
-  switch (pos) {
-  case 0: XDrawString (graphic.display, graphic.window, graphic.gc, x - dx,   y + dy,   c, strlen(c)); break;
-  case 1: XDrawString (graphic.display, graphic.window, graphic.gc, x - dx/2, y + dy,   c, strlen(c)); break;
-  case 2: XDrawString (graphic.display, graphic.window, graphic.gc, x,        y + dy,   c, strlen(c)); break;
-  case 3: XDrawString (graphic.display, graphic.window, graphic.gc, x - dx,   y + dy/2, c, strlen(c)); break;
-  case 4: XDrawString (graphic.display, graphic.window, graphic.gc, x - dx/2, y + dy/2, c, strlen(c)); break;
-  case 5: XDrawString (graphic.display, graphic.window, graphic.gc, x,        y + dy/2, c, strlen(c)); break;
-  case 6: XDrawString (graphic.display, graphic.window, graphic.gc, x - dx,   y,        c, strlen(c)); break;
-  case 7: XDrawString (graphic.display, graphic.window, graphic.gc, x - dx/2, y,        c, strlen(c)); break;
-  case 8: XDrawString (graphic.display, graphic.window, graphic.gc, x,        y,        c, strlen(c)); break;
-  }
-}
-
-/*
-            
- 6____7___8
-  |       | 
-  |       | 
- 3|   4   |5
-  |       |
-  |       |
-  ---------
- 0    1   2
-
-*/
Index: unk/Ohana/src/kapa2/src/ErasePlot.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/ErasePlot.c	(revision 13335)
+++ 	(revision )
@@ -1,66 +1,0 @@
-# include "Ximage.h"
-# define TESTFREE(a) { if ((a) != (float *) NULL) free (a);}
-
-// XXX need to define cases:
-// * erase just the current graph (delete objects & redraw)
-// * erase all graphs
-// * drop all sections
-
-int ErasePlot (int ClearSection) {
-  
-  int i, j;
-
-  for (j = 0; j < Nsection; j++) {
-
-    /* free data objects, then re-alloc those needed */
-    for (i = 0; i < section[j].Nobjects; i++) {
-      TESTFREE (section[j].objects[i].x);
-      TESTFREE (section[j].objects[i].y);
-      TESTFREE (section[j].objects[i].z);
-      TESTFREE (section[j].objects[i].dxm);
-      TESTFREE (section[j].objects[i].dxp);
-      TESTFREE (section[j].objects[i].dym);
-      TESTFREE (section[j].objects[i].dyp);
-    }
-    
-    /* reset axes and labels */
-    for (i = 0; i < 4; i++) {
-      section[j].axis[i].isaxis = FALSE;
-      section[j].axis[i].islabel = FALSE;
-      section[j].axis[i].areticks = FALSE;
-    }
-    for (i = 0; i < 8; i++) {
-      strcpy (section[j].label[i].text, "");
-    }
-    
-    /* free objects and text entries, or re-zero */
-    if (ClearSection && (j != 0)) {
-      free (section[j].objects);
-      free (section[j].ptext);
-    } else {
-      section[j].Nobjects = 0;
-      REALLOCATE (section[j].objects, Gobjects, 1);
-      section[j].Nptext = 0;
-      REALLOCATE (section[j].ptext, Label, 1);
-    }
-  }
-
-  if (ClearSection) {
-    Nsection = 1;
-    TheSection = 0;
-    REALLOCATE (section, Layout, Nsection);
-  }
-
-  if (USE_XWINDOW) XClearWindow (graphic.display, graphic.window);
-  Refresh (1);
-
-  return (TRUE);
-  
-}
-
-
-/** note that 'section' is the global variable
-    of type 'Layout' which carries data and info 
-    about each graph section 
-**/
-
Index: unk/Ohana/src/kapa2/src/FlashButton.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/FlashButton.c	(revision 13335)
+++ 	(revision )
@@ -1,22 +1,0 @@
-# include "Ximage.h"
-
-void FlashButton (Graphic *graphic, Button *button) {
-
-  unsigned long black, white;
-
-  black =  graphic[0].black;
-  white =  graphic[0].white;
-  graphic[0].black = white;
-  graphic[0].white = black;
-
-  DrawButton (graphic, button);
-  XFlush (graphic[0].display);
-/*  usleep (20000);  removed - not a standard C sleep command, apparently! */
-  
-  graphic[0].black = black;
-  graphic[0].white = white;
-  DrawButton (graphic, button);
-  XFlush (graphic[0].display);
-
-}
-
Index: unk/Ohana/src/kapa2/src/JPEGit.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/JPEGit.c	(revision 13335)
+++ 	(revision )
@@ -1,153 +1,0 @@
-# include "Ximage.h"
-# include "jpeglib.h"
-
-int JPEGit (Graphic *graphic, Layout *layout) {
-  
-  struct jpeg_compress_struct cinfo;
-  struct jpeg_error_mgr jerr;
-  JSAMPROW row_pointer[1];	/* pointer to JSAMPLE row[s] */
-  JSAMPLE *image_buffer;	/* Points to data for current line */
-
-  int j, k, m;
-  unsigned char *buff;
-  double Nchar, Npix, start, slope, frac;
-  int quality;
-  unsigned long pcolor;
-
-  char filename[1024];
-  int Nbytes, status;
-
-  XImage *tmpimage;
-
-  FILE *f;
-  
-  /* expect a line telling the number of bytes and a filename */
-  status = read (layout[0].Ximage, filename, 16);
-  filename[16] = 0;
-  sscanf (filename, "%*s %d", &Nbytes);
-  status = read (layout[0].Ximage, filename, Nbytes);
-  filename[status] = 0; /* make the string easy to parse */
-
-  /* 
-  switch (graphic[0].Nbits) {
-  case 8:
-    break;
-  case 16:
-    fprintf (stderr, "converter to 16 bit not yet implemented\n");
-    return (TRUE);
-    break;
-  case 24:
-    fprintf (stderr, "converter to 24 bit not yet implemented\n");
-    return (TRUE);
-    break;
-  case 32:
-    fprintf (stderr, "converter to 32 bit not yet implemented\n");
-    return (TRUE);
-    break;
-  }
-  */
-
-  /* set up the error handler , initialize the JPEG compression object. */
-  cinfo.err = jpeg_std_error (&jerr);
-  jpeg_create_compress (&cinfo);
-
-  f = fopen (filename, "w");
-  if (f == (FILE *) NULL) {
-    fprintf (stderr, "failed to open %s for output\n", filename);
-    return (TRUE);
-  }
-  jpeg_stdio_dest(&cinfo, f);
-  
-  quality = 75;
-  cinfo.image_width = layout[0].picture.dx; 	/* image width and height, in pixels */
-  cinfo.image_height = layout[0].picture.dy;
-# ifdef GREYSCALE
-  cinfo.input_components = 1;		        /* # of color components per pixel */
-  cinfo.in_color_space = JCS_GRAYSCALE; 	/* colorspace of input image */
-# else 
-  cinfo.input_components = 3;		        
-  cinfo.in_color_space = JCS_RGB; 	
-# endif
-  jpeg_set_defaults (&cinfo);
-  jpeg_set_quality (&cinfo, quality, TRUE       /* limit to baseline-JPEG values */);
-  jpeg_start_compress (&cinfo, TRUE);
-
-  ALLOCATE (image_buffer, JSAMPLE, 3*layout[0].picture.dx);
-  buff = (unsigned char *)layout[0].picture.data;
-  slope = layout[0].slope;
-  start = layout[0].start;
-  Nchar = 255.0;                                /* range of output values */
-  Npix = layout[0].Npixels;
-  frac = Nchar / Npix;
-  
-  {
-    XWindowAttributes WindowAttributes;
-    Pixmap tmp_pixmap;
-    Window tmp_window;
-    
-    XGetWindowAttributes (graphic[0].display, graphic[0].window, &WindowAttributes);
-    
-    tmp_pixmap = XCreatePixmap (graphic[0].display, graphic[0].window, graphic[0].dx, graphic[0].dy, WindowAttributes.depth);
-
-    tmp_window = graphic[0].window;
-    graphic[0].window = tmp_pixmap;
-
-    Refresh (graphic, layout, 0);
-
-    tmpimage = XGetImage (graphic[0].display, graphic[0].window, layout[0].picture.x+1, layout[0].picture.y+1, layout[0].picture.dx, layout[0].picture.dy, 0xffffffff, ZPixmap);
-
-    for (j = 0; (j < layout[0].picture.dy) && (cinfo.next_scanline < cinfo.image_height); j++) {
-      for (k = 0; k < layout[0].picture.dx; k++) {
-	pcolor = XGetPixel (tmpimage, k, j);
-	if (pcolor == layout[0].white) { 
-	  image_buffer[3*k+0] = Nchar;
-	  image_buffer[3*k+1] = Nchar;
-	  image_buffer[3*k+2] = Nchar;
-	  continue;
-	}
-	if (pcolor == layout[0].overlay[0].color) { 
-	  image_buffer[3*k+0] = Nchar;
-	  image_buffer[3*k+1] = 0;
-	  image_buffer[3*k+2] = 0;
-	  continue;
-	}
-	if (pcolor == layout[0].overlay[1].color) { 
-	  image_buffer[3*k+0] = 0;
-	  image_buffer[3*k+1] = Nchar;
-	  image_buffer[3*k+2] = 0;
-	  continue;
-	}
-	if (pcolor == layout[0].overlay[2].color) { 
-	  image_buffer[3*k+0] = 0;
-	  image_buffer[3*k+1] = 0;
-	  image_buffer[3*k+2] = Nchar;
-	  continue;
-	}
-	if (pcolor == layout[0].overlay[3].color) { 
-	  image_buffer[3*k+0] = Nchar;
-	  image_buffer[3*k+1] = Nchar;
-	  image_buffer[3*k+2] = 0;
-	  continue;
-	}
-	for (m = 0; (layout[0].cmap[m].pixel != pcolor) && (m < Npix); m++);
-	/* val = Nchar - frac * MIN (MAX (start + m * slope, 0), Npix); */
-	image_buffer[3*k+0] = layout[0].cmap[m].red / 256;
-	image_buffer[3*k+1] = layout[0].cmap[m].green / 256;
-	image_buffer[3*k+2] = layout[0].cmap[m].blue / 256;
-      }
-      row_pointer[0] = image_buffer;
-      (void) jpeg_write_scanlines (&cinfo, row_pointer, 1);
-    }
-    graphic[0].window = tmp_window;
-    XFreePixmap (graphic[0].display, tmp_pixmap);
-  }
-
-  XDestroyImage (tmpimage);
-
-  jpeg_finish_compress (&cinfo);
-  fclose (f);
-  jpeg_destroy_compress (&cinfo);
-
-  return (TRUE);
-
-}
Index: unk/Ohana/src/kapa2/src/ListSection.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/ListSection.c	(revision 13335)
+++ 	(revision )
@@ -1,35 +1,0 @@
-# include "Ximage.h"
-
-int ListSection () {
-  
-  int i, ThisSection;
-  char name[128];
-
-  KiiScanMessage (sock, "%s", name);
-
-  if (!strcmp (name, "*")) {
-    for (i = 0; i < Nsection; i++) {
-      fprintf (stderr, "%s: %6.3f %6.3f %6.3f %6.3f\n", 
-	       section[i].name, section[i].x, section[i].y, section[i].dx, section[i].dy);
-    }
-    return (TRUE);
-  }
-
-  ThisSection = -1;
-  for (i = 0; i < Nsection; i++) {
-    if (!strcmp (name, section[i].name)) {
-      ThisSection = i;
-      break;
-    }
-  }
-  if (ThisSection == -1) {
-    fprintf (stderr, "section %s not found\n", name);
-    return (TRUE);
-  }
-
-  fprintf (stderr, "%s: %6.3f %6.3f %6.3f %6.3f\n", 
-	   section[ThisSection].name, 
-	   section[ThisSection].x, section[ThisSection].y, 
-	   section[ThisSection].dx, section[ThisSection].dy);
-  return (TRUE);
-}
Index: unk/Ohana/src/kapa2/src/PSPtext.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/PSPtext.c	(revision 13335)
+++ 	(revision )
@@ -1,33 +1,0 @@
-# include "Ximage.h"
-  
-void PSPtext (Layout *layout, FILE *f) {
-
-  int i, x, y, size;
-  double angle;
-  char *fontname;
-
-  fontname = GetRotFont (&size);
-  for (i = 0; i < layout[0].Nptext; i++) {
-    if (strcmp (layout[0].ptext[i].text, "")) {
-      angle = layout[0].ptext[i].angle;
-      x = layout[0].ptext[i].x;
-      y = graphic.dy - layout[0].ptext[i].y;
-      SetRotFont (layout[0].ptext[i].font, layout[0].ptext[i].size);
-      PSRotText (f, x, y, layout[0].ptext[i].text, 5, angle);
-    }
-  }
-  SetRotFont (fontname, size);
-}
-
-  /* pos values
-            
- 4____2___5 
-  |       | 
-  |       | 
- 1|   8   |3
-  |       |
-  |       |
-  ---------
-  6   0   7
-
-  */
Index: unk/Ohana/src/kapa2/src/PositionPicture.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/PositionPicture.c	(revision 13335)
+++ 	(revision )
@@ -1,95 +1,0 @@
-# include "Ximage.h"
-
-void PositionPicture (Layout *layout) {
-
-  int fontsize, bump, Nc;
-  double PADx, PADy, Dx, Dy;
-  double PXm, PXp, PYm, PYp;
-  double X0, Y0, dX, dY;
-  char string[64], *fontname;
-
-  fontname = GetRotFont (&fontsize);
-
-  /* window has outer bounding box with margins Wx, Wy 
-     section commands subdivide the internal box (Dx,Dy)
-   */
-
-  PADx = MAX (graphic.dx / 20.0, fontsize);
-  PADy = MAX (graphic.dy / 20.0, fontsize);
-  Dx = graphic.dx - 2*PADx;
-  Dy = graphic.dy - 2*PADy;
-
-  /* each graph has a padding PXm, PXp, PYm, PYp */
-  PXm = (layout[0].axis[1].islabel) ? 4*fontsize : 0;
-  PXp = (layout[0].axis[3].islabel) ? 4*fontsize : 0;
-  PYm = (layout[0].axis[0].islabel) ? 4*fontsize : 0;
-  PYp = (layout[0].axis[2].islabel) ? 4*fontsize : 0;
- 
-  X0 = PADx + PXm + (Dx * layout[0].x);
-  Y0 = PADy + PYm + (Dy * layout[0].y);
-  dX = (Dx * layout[0].dx) - PXp - PXm;
-  dY = (Dy * layout[0].dy) - PYp - PYm;
-
-  /* define locations of coordinate axes */
-  layout[0].axis[0].fx  = X0;
-  layout[0].axis[0].fy  = graphic.dy - Y0;
-  layout[0].axis[0].dfx = dX;
-  layout[0].axis[0].dfy = 0;
-  
-  layout[0].axis[1].fx  = X0;
-  layout[0].axis[1].fy  = graphic.dy - Y0;
-  layout[0].axis[1].dfx = 0;
-  layout[0].axis[1].dfy = -dY;
-
-  layout[0].axis[2].fx  = X0;
-  layout[0].axis[2].fy  = graphic.dy - Y0 - dY;
-  layout[0].axis[2].dfx = dX;
-  layout[0].axis[2].dfy = 0;
-
-  layout[0].axis[3].fx  = X0 + dX;
-  layout[0].axis[3].fy  = graphic.dy - Y0;
-  layout[0].axis[3].dfx = 0;
-  layout[0].axis[3].dfy = -dY;
-
-  PADx = 0.8*fontsize + 2;
-  PADy = 3.0*fontsize + 4;
-
-  /* define locations of axis labels */
-  layout[0].label[LABELX0].x = layout[0].axis[0].fx + 0.5*layout[0].axis[0].dfx;
-  bump = (layout[0].axis[0].islabel) ? PADy : PADx;
-  layout[0].label[LABELX0].y = layout[0].axis[0].fy + bump;
-
-  layout[0].label[LABELX1].x = layout[0].axis[2].fx + 0.5*layout[0].axis[2].dfx;
-  bump = (layout[0].axis[2].islabel) ? PADy : PADx;
-  layout[0].label[LABELX1].y = layout[0].axis[2].fy - bump;
-
-  sprintf (string, "%4g", layout[0].axis[1].min);
-  Nc = strlen (string);
-  sprintf (string, "%4g", layout[0].axis[1].max);
-  Nc = MAX (Nc, strlen (string));
-
-  layout[0].label[LABELY0].y = layout[0].axis[1].fy + 0.5*layout[0].axis[1].dfy;
-  bump = (layout[0].axis[1].islabel) ? (0.8*Nc*fontsize + 1) : PADx;
-  layout[0].label[LABELY0].x = layout[0].axis[1].fx - bump;
-
-  sprintf (string, "%4g", layout[0].axis[1].min);
-  Nc = strlen (string);
-  sprintf (string, "%4g", layout[0].axis[1].max);
-  Nc = MAX (Nc, strlen (string));
-
-  layout[0].label[LABELY1].y = layout[0].axis[3].fy + 0.5*layout[0].axis[3].dfy;
-  bump = (layout[0].axis[3].islabel) ? (0.8*Nc*fontsize + 1) : PADx;
-  layout[0].label[LABELY1].x = layout[0].axis[3].fx + bump;
-  
-  /* these are wrong and have to be adjusted to sit in the corners */
-
-  layout[0].label[LABELUL].x = layout[0].axis[2].fx - PADx;
-  layout[0].label[LABELUL].y = layout[0].axis[2].fy - PADx;
-  layout[0].label[LABELUR].x = layout[0].axis[2].fx + layout[0].axis[2].dfx + PADx;
-  layout[0].label[LABELUR].y = layout[0].axis[2].fy - PADx;
-  layout[0].label[LABELLL].x = layout[0].axis[0].fx - PADx;
-  layout[0].label[LABELLL].y = layout[0].axis[0].fy + PADx;
-  layout[0].label[LABELLR].x = layout[0].axis[0].fx + layout[0].axis[0].dfx + PADx;
-  layout[0].label[LABELLR].y = layout[0].axis[0].fy + PADx;
-
-}
Index: unk/Ohana/src/kapa2/src/Rescale.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/Rescale.c	(revision 13335)
+++ 	(revision )
@@ -1,16 +1,0 @@
-# include "Ximage.h"
-
-void
-Rescale (graphic, layout)
-Graphic graphic[];
-Layout  layout[];
-{
-
-  fprintf (stdout, "enter new zero, range: ");
-  fscanf (stdin, "%lf%lf", &layout[0].zero, &layout[0].range);
-
-  Remap (graphic, layout, &layout[0].matrix);
-  Refresh (graphic, layout, 0);
-  
-  XFlush (graphic[0].display);
-}
Index: unk/Ohana/src/kapa2/src/Stop.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/Stop.c	(revision 13335)
+++ 	(revision )
@@ -1,8 +1,0 @@
-# include "Ximage.h"
-
-int Stop () {
-  return (FALSE);
-}
-
-/******  this function looks stupid, but it has to be like this:
-  it is called as a pointer to function **/
Index: unk/Ohana/src/kapa2/src/cursor.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/cursor.c	(revision 13335)
+++ 	(revision )
@@ -1,118 +1,0 @@
-# include "Ximage.h"
-
-/* # define IgnoreMask (long) (ClientMessage | ButtonReleaseMask | PointerMotionMask) */
-# define IgnoreMask (long) (~(StructureNotifyMask | SubstructureNotifyMask | ExposureMask | KeyPressMask | ButtonPressMask))
-
-int LastEvent (Display *display, int type, XEvent *event);
-
-int cursor () {
-
-  Display        *display;
-  XEvent          event;
-  KeySym          keysym;
-  int             status, value;
-  XComposeStatus  composestatus;
-  char            string[10], line[40], *name;
-  double          x, y;
-  char            buffer[10];
-  XButtonEvent   *mouse_event;
-  Section        *section;
-  Graphic        *graphic;
-  KapaGraphWidget *graph;
-
-  graphic = GetGraphic();
-  display = graphic->display;
-  section = GetActiveSection();
-  graph = section->graph;
-
-  while (1) {
-    
-    /* check the pipe for messages */
-    status = read (sock, buffer, 4);
-    buffer[4] = 0;
-    
-    if (status == -1) goto events;
-    if (status ==  0) return (FALSE);
-    if (status ==  4) {
-      if (!strcmp (buffer, "NCUR")) return (TRUE);
-      goto events;
-    }
-    fprintf (stderr, "weird signal: too many or few bytes!  %d\n", status);
-    return (TRUE);
-
-  events:
-    if (XEventsQueued (display, QueuedAfterFlush) < 1) {
-      usleep (50000);
-      continue;
-    }
-
-    /* check for x events */
-
-    /* grab the last entry for these events */
-    if (LastEvent (display, ConfigureNotify, &event)) Reconfig (&event);
-    if (LastEvent (display, CirculateNotify, &event)) Reconfig (&event);
-    if (LastEvent (display, Expose,          &event)) Refresh (1);
-
-    if (LastEvent (display, MappingNotify,   &event)) XRefreshKeyboardMapping ((XMappingEvent *) &event);
-	
-    /* drop and ignore the following StructureNotifyMask events */
-    LastEvent (display, GravityNotify, &event);
-    LastEvent (display, ReparentNotify, &event);
-    LastEvent (display, MapNotify, &event);
-    LastEvent (display, UnmapNotify, &event);
-
-    /* handle button presses */
-    /* XXX put this in something */
-    /* XXX this will need to know whether to return graph or image coords */
-    if (LastEvent (display, ButtonPress, &event) && (graph != NULL)) {
-      mouse_event = (XButtonEvent *) &event;
-      sprintf (string, "Button%d", mouse_event[0].button);
-      x = (mouse_event[0].x - graph[0].axis[0].fx)*(graph[0].axis[0].max - graph[0].axis[0].min)/graph[0].axis[0].dfx + graph[0].axis[0].min;
-      y = (mouse_event[0].y - graph[0].axis[1].fy)*(graph[0].axis[1].max - graph[0].axis[1].min)/graph[0].axis[1].dfy + graph[0].axis[1].min;
-      snprintf (line, 40, "%12s %12.6f %12.6f ", string, x, y);
-      write (sock, line, 40);
-    }
-
-    /* handle key presses */
-    if (LastEvent (display, KeyPress, &event) && (graph != NULL)) {
-      value = XLookupString ((XKeyEvent *) &event, string, 9, &keysym, &composestatus);
-      name = XKeysymToString (keysym);
-
-      // ignore unmapped keys
-      if (name == NULL) continue;
-
-      x = (event.xkey.x - graph[0].axis[0].fx)*(graph[0].axis[0].max - graph[0].axis[0].min)/graph[0].axis[0].dfx + graph[0].axis[0].min;
-      y = (event.xkey.y - graph[0].axis[1].fy)*(graph[0].axis[1].max - graph[0].axis[1].min)/graph[0].axis[1].dfy + graph[0].axis[1].min;
-
-      // skip the following keys: 
-      if (!strcmp (name, "Shift_L")) continue;
-      if (!strcmp (name, "Shift_R")) continue;
-      if (!strcmp (name, "Control_L")) continue;
-      if (!strcmp (name, "Control_R")) continue;
-      if (!strcmp (name, "Alt_L")) continue;
-      if (!strcmp (name, "Alt_R")) continue;
-      if (!strcmp (name, "Super_L")) continue;
-      if (!strcmp (name, "Super_R")) continue;
-      if (!strcmp (name, "Caps_Lock")) continue;
-      if (!strcmp (name, "Pause")) continue;
-      if (!strcmp (name, "Continue")) continue;
-      if (!strcmp (name, "Num_Lock")) continue;
-      if (!strcmp (name, "Scroll_Lock")) continue;
-      if (!strcmp (name, "Print")) continue;
-      if (!strcmp (name, "(null)")) continue;
-
-      snprintf (line, 40, "%12s %12.6f %12.6f ", name, x, y);
-      write (sock, line, 40);
-    }
-
-    /* remove those events we will ignore */
-    while (XCheckMaskEvent (display, IgnoreMask, &event)) continue;
-
-    /* events to remove which have no mask component */
-    while (XCheckTypedEvent (display, ClientMessage, &event)) continue;
-    while (XCheckTypedEvent (display, SelectionClear, &event)) continue;
-    while (XCheckTypedEvent (display, SelectionNotify, &event)) continue;
-    while (XCheckTypedEvent (display, SelectionRequest, &event)) continue;
-  }
-  return (FALSE);
-}
