Index: trunk/Ohana/src/kapa2/include/prototypes.h
===================================================================
--- trunk/Ohana/src/kapa2/include/prototypes.h	(revision 17465)
+++ trunk/Ohana/src/kapa2/include/prototypes.h	(revision 17466)
@@ -29,4 +29,6 @@
 int           DrawObjects         PROTO((KapaGraphWidget *graph));
 void          DrawLabels          PROTO((KapaGraphWidget *graph));
+void          EraseLabels         PROTO((KapaGraphWidget *graph));
+void          DrawLabelsRaw       PROTO((Graphic *graphic, KapaGraphWidget *graph, int color));
 void	      DrawTextlines	  PROTO((KapaGraphWidget *graph));
 void          DrawConnect         PROTO((KapaGraphWidget *graph, Gobjects *objects));
@@ -36,5 +38,5 @@
 void          DrawXErrors         PROTO((KapaGraphWidget *graph, Gobjects *objects));
 void          DrawYErrors         PROTO((KapaGraphWidget *graph, Gobjects *objects));
-void	      DrawTick		  PROTO((int fx, int fy, int dfx, int dfy, int P, double min, double max, double value, int mode, int naxis));
+void	      DrawTick		  PROTO((int fx, int fy, int dfx, int dfy, int P, double min, double max, double value, int IsLabel, int IsMajor, int naxis));
 void	      AxisTickScale	  PROTO((Axis *axis, double *major, double *minor));
 
@@ -108,5 +110,5 @@
 void          PSXErrors           PROTO((KapaGraphWidget *graph, Gobjects *objects, FILE *f));
 void          PSYErrors           PROTO((KapaGraphWidget *graph, Gobjects *objects, FILE *f));
-void	      PSTick		  PROTO((FILE *f, double fx, double fy, double dfx, double dfy, int P, double min, double max, double value, int mode, int naxis));
+void	      PSTick		  PROTO((FILE *f, double fx, double fy, double dfx, double dfy, int P, double min, double max, double value, int IsLabel, int IsMajor, int naxis));
 void          ClipLinePS          PROTO((double x0, double y0, double x1, double y1, double X0, double Y1, double X1, double Y0, FILE *f));
 int           PSimage    	  PROTO((KapaImageWidget *image, FILE *f));
@@ -127,5 +129,5 @@
 void	      bDrawXErrors	  PROTO((KapaGraphWidget *graph, Gobjects *object));
 void	      bDrawYErrors	  PROTO((KapaGraphWidget *graph, Gobjects *object));
-void	      bDrawTick		  PROTO((double fx, double fy, double dfx, double dfy, int P, double min, double max, double value, int mode, int naxis));
+void	      bDrawTick		  PROTO((double fx, double fy, double dfx, double dfy, int P, double min, double max, double value, int IsLabel, int IsMajor, int naxis));
 void	      bDrawClipLine	  PROTO((double x0, double y0, double x1, double y1, double X0, double Y1, double X1, double Y0));
 bDrawBuffer  *bDrawIt		  PROTO(());
Index: trunk/Ohana/src/kapa2/src/DrawFrame.c
===================================================================
--- trunk/Ohana/src/kapa2/src/DrawFrame.c	(revision 17465)
+++ trunk/Ohana/src/kapa2/src/DrawFrame.c	(revision 17466)
@@ -7,5 +7,5 @@
 void DrawFrame (KapaGraphWidget *graph) {
   
-  int i, fx, fy, dfx, dfy, P, IsLabel;
+  int i, fx, fy, dfx, dfy, P, IsLabel, IsMajor;
   double range, major, minor, first, next;
 
@@ -49,10 +49,10 @@
       }
       for (next = first; ((range > 0) && (next <= graph[0].axis[i].max)) || ((range < 0) && (next >= graph[0].axis[i].max));) {
-	IsLabel = FALSE;
-	if ((fabs((int)(next/major) - (next/major)) < 0.5*(minor/major)) || 
-	    (fabs ((int)((next + 0.5*minor)/major) - (next/major)) < 0.5*(minor/major)) ||
-	    (fabs ((int)((next - 0.5*minor)/major) - (next/major)) < 0.5*(minor/major)))
-	  IsLabel = graph[0].axis[i].islabel;
-	DrawTick (fx, fy, dfx, dfy, P, graph[0].axis[i].min, graph[0].axis[i].max, next, IsLabel, i);
+	IsMajor = FALSE;
+	IsMajor |= (fabs((int)(next/major) - (next/major)) < 0.5*(minor/major));
+	IsMajor |= (fabs((int)((next + 0.5*minor)/major) - (next/major)) < 0.5*(minor/major));
+	IsMajor |= (fabs ((int)((next - 0.5*minor)/major) - (next/major)) < 0.5*(minor/major));
+	IsLabel = (IsMajor && graph[0].axis[i].islabel);
+	DrawTick (fx, fy, dfx, dfy, P, graph[0].axis[i].min, graph[0].axis[i].max, next, IsLabel, IsMajor, i);
 	if (range > 0) 
 	  next += minor;
@@ -66,5 +66,5 @@
 void DrawTick (int fx, int fy, int dfx, int dfy, 
 	       int P, double min, double max, 
-	       double value, int mode, int naxis) {
+	       double value, int IsLabel, int IsMajor, int naxis) {
   
   int x, y, dx, dy, pos, dir, fontsize;
@@ -72,5 +72,5 @@
   char string[64], *fontname;
 
-  if (mode) { 
+  if (IsMajor) { 
     size = MAX (0.02, 7.0 / P); 
   } else {
@@ -95,5 +95,5 @@
 # endif
 
-  if (mode == 1) {
+  if (IsLabel) {
     fontname = GetRotFont (&fontsize);
     pos = 0;
Index: trunk/Ohana/src/kapa2/src/DrawLabels.c
===================================================================
--- trunk/Ohana/src/kapa2/src/DrawLabels.c	(revision 17465)
+++ trunk/Ohana/src/kapa2/src/DrawLabels.c	(revision 17466)
@@ -1,17 +1,30 @@
 # include "Ximage.h"
   
+void EraseLabels (KapaGraphWidget *graph) {
+  
+  Graphic *graphic;
+  graphic = GetGraphic();
+
+  DrawLabelsRaw (graphic, graph, graphic->back);
+}
+
 void DrawLabels (KapaGraphWidget *graph) {
   
+  Graphic *graphic;
+  graphic = GetGraphic();
+
+  DrawLabelsRaw (graphic, graph, graphic->fore);
+}
+
+void DrawLabelsRaw (Graphic *graphic, KapaGraphWidget *graph, int color) {
+
   int i, pos, x, y, size;
   double angle;
   char *fontname;
-  Graphic *graphic;
-
-  graphic = GetGraphic();
 
   pos = 0;
   fontname = GetRotFont (&size);
-  XSetForeground (graphic->display, graphic->gc, graphic->fore);
-  DrawRotTextInit (graphic->display, graphic->window, graphic->gc, graphic->fore, graphic->back);
+  XSetForeground (graphic->display, graphic->gc, color);
+  DrawRotTextInit (graphic->display, graphic->window, graphic->gc, color, graphic->back);
 
   /* each label is drawn independently */
Index: trunk/Ohana/src/kapa2/src/LoadLabels.c
===================================================================
--- trunk/Ohana/src/kapa2/src/LoadLabels.c	(revision 17465)
+++ trunk/Ohana/src/kapa2/src/LoadLabels.c	(revision 17466)
@@ -18,4 +18,5 @@
   label = KiiRecvData (sock);
 
+  if (USE_XWINDOW) EraseLabels (graph);
   bzero (graph[0].label[mode].text, LABEL_MAXLEN);
 
Index: trunk/Ohana/src/kapa2/src/LoadObject.c
===================================================================
--- trunk/Ohana/src/kapa2/src/LoadObject.c	(revision 17465)
+++ trunk/Ohana/src/kapa2/src/LoadObject.c	(revision 17466)
@@ -123,5 +123,5 @@
   }
   if (Nbytes_send != Npts_send*sizeof(float)) {
-    fprintf (stderr, "Kapa Communication error: unexpected data size %d vs %ld\n", Nbytes_send, Npts_send*sizeof(float));
+    fprintf (stderr, "Kapa Communication error: unexpected data size %d vs %d\n", Nbytes_send, Npts_send*sizeof(float));
   }
 
Index: trunk/Ohana/src/kapa2/src/PSFrame.c
===================================================================
--- trunk/Ohana/src/kapa2/src/PSFrame.c	(revision 17465)
+++ trunk/Ohana/src/kapa2/src/PSFrame.c	(revision 17466)
@@ -4,5 +4,5 @@
 int PSFrame (KapaGraphWidget *graph, FILE *f) {
   
-  int i, P, IsLabel, fontsize;
+  int i, P, IsLabel, IsMajor, fontsize;
   double fx, fy, dfx, dfy, range, major, minor, first, next;
   char *fontname;
@@ -38,10 +38,10 @@
       }
       for (next = first; ((range > 0) && (next <= graph[0].axis[i].max)) || ((range < 0) && (next >= graph[0].axis[i].max));) {
-	IsLabel = FALSE;
-	if ((fabs((int)(next/major) - (next/major)) < 0.5*(minor/major)) || 
-	    (fabs ((int)((next + 0.5*minor)/major) - (next/major)) < 0.5*(minor/major)) ||
-	    (fabs ((int)((next - 0.5*minor)/major) - (next/major)) < 0.5*(minor/major)))
-	  IsLabel = graph[0].axis[i].islabel;
-	PSTick (f, fx, fy, dfx, dfy, P, graph[0].axis[i].min, graph[0].axis[i].max, next, IsLabel, i);
+	IsMajor = FALSE;
+	IsMajor |= (fabs((int)(next/major) - (next/major)) < 0.5*(minor/major));
+	IsMajor |= (fabs ((int)((next + 0.5*minor)/major) - (next/major)) < 0.5*(minor/major));
+	IsMajor |= (fabs ((int)((next - 0.5*minor)/major) - (next/major)) < 0.5*(minor/major));
+	IsLabel = (IsMajor && graph[0].axis[i].islabel);
+	PSTick (f, fx, fy, dfx, dfy, P, graph[0].axis[i].min, graph[0].axis[i].max, next, IsLabel, IsMajor, i);
 	if (range > 0) 
 	  next += minor;
@@ -54,5 +54,5 @@
 }
 
-void PSTick (FILE *f, double fx, double fy, double dfx, double dfy, int P, double min, double max, double value, int mode, int naxis) {
+void PSTick (FILE *f, double fx, double fy, double dfx, double dfy, int P, double min, double max, double value, int IsLabel, int IsMajor, int naxis) {
   
   int pos, dir, fontsize;
@@ -62,6 +62,9 @@
   pos = size = 0;
 
-  if (mode == 1) { size = MAX (0.02, 7.0 / P); }
-  if (mode == 0) { size = MAX (0.01, 4.0 / P); }
+  if (IsMajor) { 
+    size = MAX (0.02, 7.0 / P); 
+  } else {
+    size = MAX (0.01, 4.0 / P); 
+  }
   
   n = P / sqrt ((double)(dfx*dfx + dfy*dfy));
@@ -76,5 +79,5 @@
   DrawLine (x, y, dx, dy);
 
-  if (mode == 1) {
+  if (IsLabel) {
     fontname = GetRotFont (&fontsize);
 
Index: trunk/Ohana/src/kapa2/src/bDrawFrame.c
===================================================================
--- trunk/Ohana/src/kapa2/src/bDrawFrame.c	(revision 17465)
+++ trunk/Ohana/src/kapa2/src/bDrawFrame.c	(revision 17466)
@@ -3,5 +3,5 @@
 int bDrawFrame (KapaGraphWidget *graph) {
   
-  int i, P, IsLabel, fontsize;
+  int i, P, IsLabel, IsMajor, fontsize;
   double fx, fy, dfx, dfy, range, major, minor, first, next;
   char *fontname;
@@ -36,10 +36,10 @@
       }
       for (next = first; ((range > 0) && (next <= graph[0].axis[i].max)) || ((range < 0) && (next >= graph[0].axis[i].max));) {
-	IsLabel = FALSE;
-	if ((fabs((int)(next/major) - (next/major)) < 0.5*(minor/major)) || 
-	    (fabs ((int)((next + 0.5*minor)/major) - (next/major)) < 0.5*(minor/major)) ||
-	    (fabs ((int)((next - 0.5*minor)/major) - (next/major)) < 0.5*(minor/major)))
-	  IsLabel = graph[0].axis[i].islabel;
-	bDrawTick (fx, fy, dfx, dfy, P, graph[0].axis[i].min, graph[0].axis[i].max, next, IsLabel, i);
+	IsMajor = FALSE;
+	IsMajor |= (fabs((int)(next/major) - (next/major)) < 0.5*(minor/major));
+	IsMajor |= (fabs ((int)((next + 0.5*minor)/major) - (next/major)) < 0.5*(minor/major));
+	IsMajor |= (fabs ((int)((next - 0.5*minor)/major) - (next/major)) < 0.5*(minor/major));
+	IsLabel = (IsMajor && graph[0].axis[i].islabel);
+	bDrawTick (fx, fy, dfx, dfy, P, graph[0].axis[i].min, graph[0].axis[i].max, next, IsLabel, IsMajor, i);
 	if (range > 0) 
 	  next += minor;
@@ -52,5 +52,5 @@
 }
 
-void bDrawTick (double fx, double fy, double dfx, double dfy, int P, double min, double max, double value, int mode, int naxis) {
+void bDrawTick (double fx, double fy, double dfx, double dfy, int P, double min, double max, double value, int IsLabel, int IsMajor, int naxis) {
   
   int pos, dir, fontsize;
@@ -60,6 +60,9 @@
   pos = size = 0;
 
-  if (mode == 1) { size = MAX (0.02, 7.0 / P); }
-  if (mode == 0) { size = MAX (0.01, 4.0 / P); }
+  if (IsMajor) { 
+    size = MAX (0.02, 7.0 / P); 
+  } else {
+    size = MAX (0.01, 4.0 / P); 
+  }
   
   n = P / sqrt ((double)(dfx*dfx + dfy*dfy));
@@ -74,5 +77,5 @@
   bDrawLine (x, y, x+dx, y+dy);
 
-  if (mode == 1) {
+  if (IsLabel) {
     fontname = GetRotFont (&fontsize);
 
