82 |
|
int dxsize, dysize; /* window size */ |
83 |
|
int debug = False; /* use XSynchronize if true */ |
84 |
|
|
85 |
+ |
static void |
86 |
+ |
adjustsize() |
87 |
+ |
{ |
88 |
+ |
if (dxsize > dysize) |
89 |
+ |
dxsize = dysize; |
90 |
+ |
else |
91 |
+ |
dysize = dxsize; |
92 |
+ |
} |
93 |
+ |
|
94 |
+ |
|
95 |
+ |
void |
96 |
|
init(name, geom) /* initialize window */ |
97 |
|
char *name; |
98 |
|
char *geom; |
100 |
|
char defgeom[32]; |
101 |
|
XColor cdef,dum; |
102 |
|
XEvent evnt; |
92 |
– |
int dummy; |
103 |
|
|
104 |
|
curfont = curfill = curcol = -1; |
105 |
|
curlinetype = 0; |
112 |
|
(void) XSynchronize(dpy, True); |
113 |
|
|
114 |
|
dxsize = DisplayWidth(dpy,0) - 2*BORWIDTH-4; |
115 |
< |
dysize = DisplayHeight(dpy,0) - 2*BORWIDTH-26; |
106 |
< |
|
107 |
< |
/* temporary */ |
108 |
< |
dxsize = dxsize = 800; |
115 |
> |
dysize = DisplayHeight(dpy,0) - 2*BORWIDTH-100; |
116 |
|
adjustsize(); |
117 |
|
|
118 |
|
sprintf(defgeom, "=%dx%d+2+25", dxsize, dysize); |
171 |
|
} |
172 |
|
} |
173 |
|
|
167 |
– |
adjustsize() |
168 |
– |
{ |
169 |
– |
if (dxsize > dysize) |
170 |
– |
dxsize = dysize; |
171 |
– |
else |
172 |
– |
dysize = dxsize; |
173 |
– |
} |
174 |
|
|
175 |
+ |
void |
176 |
|
endpage() /* end of this graph */ |
177 |
|
{ |
178 |
|
XEvent evnt; |
205 |
|
|
206 |
|
|
207 |
|
|
208 |
+ |
void |
209 |
|
printstr(p) /* output a string */ |
210 |
|
|
211 |
|
register PRIMITIVE *p; |
245 |
|
|
246 |
|
|
247 |
|
|
248 |
+ |
void |
249 |
|
plotlseg(p) /* plot a line segment */ |
250 |
|
|
251 |
|
register PRIMITIVE *p; |
297 |
|
} |
298 |
|
|
299 |
|
|
300 |
+ |
void |
301 |
+ |
pXFlush() |
302 |
+ |
{ |
303 |
+ |
XFlush(dpy); |
304 |
+ |
} |
305 |
+ |
|
306 |
+ |
|
307 |
|
#ifdef nyet |
308 |
|
|
309 |
+ |
static void |
310 |
+ |
fill(xmin,ymin,xmax,ymax,pm) |
311 |
+ |
int xmin,ymin,xmax,ymax; |
312 |
+ |
Pixmap pm; |
313 |
+ |
{ |
314 |
+ |
if (pm != 0 && curpat != pm) |
315 |
+ |
{ |
316 |
+ |
XSetTile(dpy, gc, pm); |
317 |
+ |
curpat = pm; |
318 |
+ |
} |
319 |
+ |
XFillRectangle(dpy, wind, gc, xmin, ymin, xmax-xmin+1, ymax-ymin+1); |
320 |
+ |
} |
321 |
+ |
|
322 |
+ |
|
323 |
+ |
void |
324 |
|
fillrect(p) /* fill a rectangle */ |
325 |
|
|
326 |
|
register PRIMITIVE *p; |
340 |
|
|
341 |
|
|
342 |
|
|
343 |
+ |
void |
344 |
|
filltri(p) /* fill a triangle */ |
345 |
|
|
346 |
|
register PRIMITIVE *p; |
388 |
|
} |
389 |
|
|
390 |
|
|
391 |
< |
|
391 |
> |
vpod |
392 |
|
xform(xp, yp, p) /* transform a point according to p */ |
393 |
|
|
394 |
|
register int *xp, *yp; |
422 |
|
} |
423 |
|
|
424 |
|
|
425 |
< |
|
425 |
> |
void |
426 |
|
fillpoly(p) /* fill a polygon */ |
427 |
|
|
428 |
|
register PRIMITIVE *p; |
475 |
|
|
476 |
|
} |
477 |
|
|
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 |
– |
|
478 |
|
#else |
479 |
|
|
480 |
< |
filltri() {} |
481 |
< |
fillpoly() {} |
482 |
< |
fillrect() {} |
469 |
< |
|
480 |
> |
void filltri(PRIMITIVE *p) {} |
481 |
> |
void fillpoly(PRIMITIVE *p) {} |
482 |
> |
void fillrect(PRIMITIVE *p) {} |
483 |
|
|
484 |
|
#endif |