12 |
|
|
13 |
|
#include "plot.h" |
14 |
|
|
15 |
+ |
#include "string.h" |
16 |
+ |
|
17 |
|
#undef TRUE |
18 |
|
|
19 |
|
#undef FALSE |
20 |
|
|
21 |
|
#include <X11/Xlib.h> |
22 |
|
|
23 |
+ |
extern void replay(int xmin, int ymin, int xmax, int ymax); |
24 |
|
|
25 |
|
#define BORWIDTH 5 |
26 |
|
|
85 |
|
int dxsize, dysize; /* window size */ |
86 |
|
int debug = False; /* use XSynchronize if true */ |
87 |
|
|
88 |
+ |
static void |
89 |
+ |
adjustsize() |
90 |
+ |
{ |
91 |
+ |
if (dxsize > dysize) |
92 |
+ |
dxsize = dysize; |
93 |
+ |
else |
94 |
+ |
dysize = dxsize; |
95 |
+ |
} |
96 |
+ |
|
97 |
+ |
|
98 |
+ |
void |
99 |
|
init(name, geom) /* initialize window */ |
100 |
|
char *name; |
101 |
|
char *geom; |
103 |
|
char defgeom[32]; |
104 |
|
XColor cdef,dum; |
105 |
|
XEvent evnt; |
92 |
– |
int dummy; |
106 |
|
|
107 |
|
curfont = curfill = curcol = -1; |
108 |
|
curlinetype = 0; |
115 |
|
(void) XSynchronize(dpy, True); |
116 |
|
|
117 |
|
dxsize = DisplayWidth(dpy,0) - 2*BORWIDTH-4; |
118 |
< |
dysize = DisplayHeight(dpy,0) - 2*BORWIDTH-26; |
106 |
< |
|
107 |
< |
/* temporary */ |
108 |
< |
dxsize = dxsize = 800; |
118 |
> |
dysize = DisplayHeight(dpy,0) - 2*BORWIDTH-100; |
119 |
|
adjustsize(); |
120 |
|
|
121 |
|
sprintf(defgeom, "=%dx%d+2+25", dxsize, dysize); |
174 |
|
} |
175 |
|
} |
176 |
|
|
167 |
– |
adjustsize() |
168 |
– |
{ |
169 |
– |
if (dxsize > dysize) |
170 |
– |
dxsize = dysize; |
171 |
– |
else |
172 |
– |
dysize = dxsize; |
173 |
– |
} |
177 |
|
|
178 |
+ |
void |
179 |
|
endpage() /* end of this graph */ |
180 |
|
{ |
181 |
|
XEvent evnt; |
208 |
|
|
209 |
|
|
210 |
|
|
211 |
+ |
void |
212 |
|
printstr(p) /* output a string */ |
213 |
|
|
214 |
|
register PRIMITIVE *p; |
248 |
|
|
249 |
|
|
250 |
|
|
251 |
+ |
void |
252 |
|
plotlseg(p) /* plot a line segment */ |
253 |
|
|
254 |
|
register PRIMITIVE *p; |
300 |
|
} |
301 |
|
|
302 |
|
|
303 |
+ |
void |
304 |
+ |
pXFlush() |
305 |
+ |
{ |
306 |
+ |
XFlush(dpy); |
307 |
+ |
} |
308 |
+ |
|
309 |
+ |
|
310 |
|
#ifdef nyet |
311 |
|
|
312 |
+ |
static void |
313 |
+ |
fill(xmin,ymin,xmax,ymax,pm) |
314 |
+ |
int xmin,ymin,xmax,ymax; |
315 |
+ |
Pixmap pm; |
316 |
+ |
{ |
317 |
+ |
if (pm != 0 && curpat != pm) |
318 |
+ |
{ |
319 |
+ |
XSetTile(dpy, gc, pm); |
320 |
+ |
curpat = pm; |
321 |
+ |
} |
322 |
+ |
XFillRectangle(dpy, wind, gc, xmin, ymin, xmax-xmin+1, ymax-ymin+1); |
323 |
+ |
} |
324 |
+ |
|
325 |
+ |
|
326 |
+ |
void |
327 |
|
fillrect(p) /* fill a rectangle */ |
328 |
|
|
329 |
|
register PRIMITIVE *p; |
343 |
|
|
344 |
|
|
345 |
|
|
346 |
+ |
void |
347 |
|
filltri(p) /* fill a triangle */ |
348 |
|
|
349 |
|
register PRIMITIVE *p; |
391 |
|
} |
392 |
|
|
393 |
|
|
394 |
< |
|
394 |
> |
vpod |
395 |
|
xform(xp, yp, p) /* transform a point according to p */ |
396 |
|
|
397 |
|
register int *xp, *yp; |
425 |
|
} |
426 |
|
|
427 |
|
|
428 |
< |
|
428 |
> |
void |
429 |
|
fillpoly(p) /* fill a polygon */ |
430 |
|
|
431 |
|
register PRIMITIVE *p; |
478 |
|
|
479 |
|
} |
480 |
|
|
452 |
– |
fill(xmin,ymin,xmax,ymax,pm) |
453 |
– |
int xmin,ymin,xmax,ymax; |
454 |
– |
Pixmap pm; |
455 |
– |
{ |
456 |
– |
if (pm != 0 && curpat != pm) |
457 |
– |
{ |
458 |
– |
XSetTile(dpy, gc, pm); |
459 |
– |
curpat = pm; |
460 |
– |
} |
461 |
– |
XFillRectangle(dpy, wind, gc, xmin, ymin, xmax-xmin+1, ymax-ymin+1); |
462 |
– |
} |
463 |
– |
|
481 |
|
#else |
482 |
|
|
483 |
< |
filltri() {} |
484 |
< |
fillpoly() {} |
485 |
< |
fillrect() {} |
469 |
< |
|
483 |
> |
void filltri(PRIMITIVE *p) {} |
484 |
> |
void fillpoly(PRIMITIVE *p) {} |
485 |
> |
void fillrect(PRIMITIVE *p) {} |
486 |
|
|
487 |
|
#endif |