--- ray/src/meta/x11plot.c 2003/02/22 02:07:26 1.1 +++ ray/src/meta/x11plot.c 2007/11/21 18:51:05 1.4 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: x11plot.c,v 1.1 2003/02/22 02:07:26 greg Exp $"; +static const char RCSid[] = "$Id: x11plot.c,v 1.4 2007/11/21 18:51:05 greg Exp $"; #endif /* * X window plotting functions @@ -12,12 +12,15 @@ static const char RCSid[] = "$Id: x11plot.c,v 1.1 2003 #include "plot.h" +#include "string.h" + #undef TRUE #undef FALSE #include +extern void replay(int xmin, int ymin, int xmax, int ymax); #define BORWIDTH 5 @@ -82,6 +85,17 @@ int pixel[4]; int dxsize, dysize; /* window size */ int debug = False; /* use XSynchronize if true */ +static void +adjustsize() +{ + if (dxsize > dysize) + dxsize = dysize; + else + dysize = dxsize; +} + + +void init(name, geom) /* initialize window */ char *name; char *geom; @@ -89,7 +103,6 @@ char *geom; char defgeom[32]; XColor cdef,dum; XEvent evnt; - int dummy; curfont = curfill = curcol = -1; curlinetype = 0; @@ -102,10 +115,7 @@ char *geom; (void) XSynchronize(dpy, True); dxsize = DisplayWidth(dpy,0) - 2*BORWIDTH-4; - dysize = DisplayHeight(dpy,0) - 2*BORWIDTH-26; - - /* temporary */ - dxsize = dxsize = 800; + dysize = DisplayHeight(dpy,0) - 2*BORWIDTH-100; adjustsize(); sprintf(defgeom, "=%dx%d+2+25", dxsize, dysize); @@ -164,14 +174,8 @@ char *geom; } } -adjustsize() - { - if (dxsize > dysize) - dxsize = dysize; - else - dysize = dxsize; - } +void endpage() /* end of this graph */ { XEvent evnt; @@ -204,6 +208,7 @@ endpage() /* end of this graph */ +void printstr(p) /* output a string */ register PRIMITIVE *p; @@ -243,6 +248,7 @@ register PRIMITIVE *p; +void plotlseg(p) /* plot a line segment */ register PRIMITIVE *p; @@ -294,8 +300,30 @@ register PRIMITIVE *p; } +void +pXFlush() +{ + XFlush(dpy); +} + + #ifdef nyet +static void +fill(xmin,ymin,xmax,ymax,pm) +int xmin,ymin,xmax,ymax; +Pixmap pm; +{ + if (pm != 0 && curpat != pm) + { + XSetTile(dpy, gc, pm); + curpat = pm; + } + XFillRectangle(dpy, wind, gc, xmin, ymin, xmax-xmin+1, ymax-ymin+1); +} + + +void fillrect(p) /* fill a rectangle */ register PRIMITIVE *p; @@ -315,6 +343,7 @@ register PRIMITIVE *p; +void filltri(p) /* fill a triangle */ register PRIMITIVE *p; @@ -362,7 +391,7 @@ register PRIMITIVE *p; } - +vpod xform(xp, yp, p) /* transform a point according to p */ register int *xp, *yp; @@ -396,7 +425,7 @@ register PRIMITIVE *p; } - +void fillpoly(p) /* fill a polygon */ register PRIMITIVE *p; @@ -449,23 +478,10 @@ register PRIMITIVE *p; } -fill(xmin,ymin,xmax,ymax,pm) -int xmin,ymin,xmax,ymax; -Pixmap pm; - { - if (pm != 0 && curpat != pm) - { - XSetTile(dpy, gc, pm); - curpat = pm; - } - XFillRectangle(dpy, wind, gc, xmin, ymin, xmax-xmin+1, ymax-ymin+1); - } - #else -filltri() {} -fillpoly() {} -fillrect() {} - +void filltri(PRIMITIVE *p) {} +void fillpoly(PRIMITIVE *p) {} +void fillrect(PRIMITIVE *p) {} #endif