1 | |
---|
2 | /* file XWUSRDEF.H |
---|
3 | * ========== |
---|
4 | * |
---|
5 | * version 3, 3-Sep-93 |
---|
6 | * |
---|
7 | * user interface of graphics module |
---|
8 | * K. Stammler, 6-AUG-1990 |
---|
9 | */ |
---|
10 | |
---|
11 | #ifndef __XWUSRDEF |
---|
12 | #define __XWUSRDEF |
---|
13 | |
---|
14 | |
---|
15 | #ifdef BC_G_XWINDOW |
---|
16 | |
---|
17 | |
---|
18 | /* graphics */ |
---|
19 | |
---|
20 | #define XWC_MAXWDW 7 |
---|
21 | /* maximum number of windows available */ |
---|
22 | #define XWC_CYCLEWDW -1 |
---|
23 | /* cycle windows (parameter in xw_popwdw) */ |
---|
24 | |
---|
25 | /* window attribute flags */ |
---|
26 | #define XWF_WINPUT 0x40 |
---|
27 | /* window is used as input window frequently */ |
---|
28 | |
---|
29 | |
---|
30 | /* types */ |
---|
31 | typedef float XWCOO; /* user coordinates */ |
---|
32 | typedef unsigned int WDW; /* window number */ |
---|
33 | |
---|
34 | /* not implemented */ |
---|
35 | #define xw_set_outputdir(d,s) |
---|
36 | |
---|
37 | |
---|
38 | /*------------*/ |
---|
39 | /* prototypes */ |
---|
40 | /*----------------------------------------------------------------------------*/ |
---|
41 | |
---|
42 | |
---|
43 | void xw_init( WDW wdw, int attribs, float xlo, float ylo, |
---|
44 | float width, float height, STATUS *status ); |
---|
45 | |
---|
46 | /* initialises graphic channels |
---|
47 | * |
---|
48 | * parameters of routine |
---|
49 | * WDW wdw; input; channels to be initialised |
---|
50 | * int attribs; input; window attributes |
---|
51 | * float xlo, ylo; input; position of window (in cm) |
---|
52 | * float width, height; input; size of window (in cm) |
---|
53 | * STATUS *status; output; return status |
---|
54 | */ |
---|
55 | |
---|
56 | |
---|
57 | /*----------------------------------------------------------------------------*/ |
---|
58 | |
---|
59 | |
---|
60 | void xw_exit( WDW wdw ); |
---|
61 | |
---|
62 | /* exits from graphic channel(s) |
---|
63 | * |
---|
64 | * parameters of routine |
---|
65 | * WDW wdw; input; window number |
---|
66 | */ |
---|
67 | |
---|
68 | |
---|
69 | /*----------------------------------------------------------------------------*/ |
---|
70 | |
---|
71 | |
---|
72 | void xw_finish( void ); |
---|
73 | |
---|
74 | /* closes all open graphic channels |
---|
75 | * |
---|
76 | * no parameters |
---|
77 | */ |
---|
78 | |
---|
79 | /*----------------------------------------------------------------------------*/ |
---|
80 | |
---|
81 | |
---|
82 | void xw_resizewdw( WDW wdw, float x, float y, float w, float h, |
---|
83 | STATUS *status ); |
---|
84 | |
---|
85 | /* resizes and repositions window |
---|
86 | * |
---|
87 | * parameters of routine |
---|
88 | * WDW wdw; input; window number |
---|
89 | * float x, y; input; new position of window (in cm) |
---|
90 | * float w, h; input; new size of window (in cm) |
---|
91 | * STATUS *status; output; return status |
---|
92 | */ |
---|
93 | |
---|
94 | |
---|
95 | /*----------------------------------------------------------------------------*/ |
---|
96 | |
---|
97 | |
---|
98 | void xw_popwdw( WDW wdw ); |
---|
99 | |
---|
100 | /* pops window on top of the others |
---|
101 | * |
---|
102 | * parameters of routine |
---|
103 | * WDW wdw; input; window number |
---|
104 | */ |
---|
105 | |
---|
106 | |
---|
107 | /*----------------------------------------------------------------------------*/ |
---|
108 | |
---|
109 | |
---|
110 | void xw_pushwdw( WDW wdw ); |
---|
111 | |
---|
112 | /* pushes window below the others |
---|
113 | * |
---|
114 | * parameters of routine |
---|
115 | * WDW wdw; input; window number |
---|
116 | */ |
---|
117 | |
---|
118 | |
---|
119 | /*----------------------------------------------------------------------------*/ |
---|
120 | |
---|
121 | |
---|
122 | void xw_erase( WDW wdw ); |
---|
123 | |
---|
124 | /* clears channel(s) |
---|
125 | * |
---|
126 | * parameters of routine |
---|
127 | * WDW wdw; input; window number |
---|
128 | */ |
---|
129 | |
---|
130 | |
---|
131 | /*----------------------------------------------------------------------------*/ |
---|
132 | |
---|
133 | |
---|
134 | void xw_setwdwname( WDW wdw, char name[] ); |
---|
135 | |
---|
136 | /* set new name of window |
---|
137 | * |
---|
138 | * parameters of routine |
---|
139 | * WDW wdw; input; window number |
---|
140 | * char name[]; input; new name |
---|
141 | */ |
---|
142 | |
---|
143 | |
---|
144 | /*----------------------------------------------------------------------------*/ |
---|
145 | |
---|
146 | |
---|
147 | void xw_setcoo( WDW wdw, XWCOO x, XWCOO y, XWCOO w, XWCOO h, |
---|
148 | STATUS *status ); |
---|
149 | |
---|
150 | /* sets new user coordinate system |
---|
151 | * |
---|
152 | * parameters of routine |
---|
153 | * WDW wdw; input; window number |
---|
154 | * XWCOO x, y; input; origin of user coordinates |
---|
155 | * XWCOO w, h; input; size of user coordinates |
---|
156 | * STATUS *status; output; return status |
---|
157 | */ |
---|
158 | |
---|
159 | |
---|
160 | /*----------------------------------------------------------------------------*/ |
---|
161 | |
---|
162 | |
---|
163 | void xw_moveto( WDW wdw, XWCOO x, XWCOO y ); |
---|
164 | |
---|
165 | /* moves to position (x,y) in user coordinates |
---|
166 | * |
---|
167 | * parameters of routine |
---|
168 | * WDW wdw; input; window number |
---|
169 | * XWCOO x, y; input; position to be moved to |
---|
170 | */ |
---|
171 | |
---|
172 | |
---|
173 | /*----------------------------------------------------------------------------*/ |
---|
174 | |
---|
175 | |
---|
176 | void xw_drawto( WDW wdw, int style, XWCOO x, XWCOO y ); |
---|
177 | |
---|
178 | /* moves to position (x,y) in user coordinates |
---|
179 | * |
---|
180 | * parameters of routine |
---|
181 | * WDW wdw; input; window number |
---|
182 | * int style; input; style block number |
---|
183 | * XWCOO x, y; input; position to be moved to |
---|
184 | */ |
---|
185 | |
---|
186 | |
---|
187 | /*----------------------------------------------------------------------------*/ |
---|
188 | |
---|
189 | |
---|
190 | void xw_arrayplot( WDW wdw, int style, long cnt, int red, XWCOO xoff, |
---|
191 | XWCOO xinc, XWCOO yoff, XWCOO yarr[], XWCOO yzoom, STATUS *status ); |
---|
192 | |
---|
193 | /* plots an array of data |
---|
194 | * |
---|
195 | * parameters of routine |
---|
196 | * WDW wdw; input; window number |
---|
197 | * int style; input; style block number |
---|
198 | * long cnt; input; length of data array |
---|
199 | * int red; input; reduction factor |
---|
200 | * XWCOO xoff; input; x-position of first sample |
---|
201 | * XWCOO xinc; input; x increment |
---|
202 | * XWCOO yoff; input; y-position of first sample |
---|
203 | * XWCOO yarr[]; input; data array |
---|
204 | * float yzoom; input; zoom factor in y-direction |
---|
205 | * STATUS *status; output; return status |
---|
206 | */ |
---|
207 | |
---|
208 | |
---|
209 | /*----------------------------------------------------------------------------*/ |
---|
210 | |
---|
211 | |
---|
212 | void xw_text( WDW wdw, int style, XWCOO x, XWCOO y, char text[] ); |
---|
213 | |
---|
214 | /* writes text at position (x,y) |
---|
215 | * |
---|
216 | * parameters of routine |
---|
217 | * WDW wdw; input; window number |
---|
218 | * int style; input; style block number |
---|
219 | * XWCOO x, y; input; position of text |
---|
220 | * char text[]; input; text to be written |
---|
221 | */ |
---|
222 | |
---|
223 | |
---|
224 | /*----------------------------------------------------------------------------*/ |
---|
225 | |
---|
226 | |
---|
227 | void xw_wrtch( WDW wdw, char ch ); |
---|
228 | |
---|
229 | /* writes single character to current write position |
---|
230 | * |
---|
231 | * parameters of routine |
---|
232 | * WDW wdw; input; window number |
---|
233 | * char ch; input; character to be written |
---|
234 | */ |
---|
235 | |
---|
236 | |
---|
237 | /*----------------------------------------------------------------------------*/ |
---|
238 | |
---|
239 | |
---|
240 | void xw_write( WDW wdw, char text[] ); |
---|
241 | |
---|
242 | /* writes text at the current write position |
---|
243 | * |
---|
244 | * parameters of routine |
---|
245 | * WDW wdw; input; window number |
---|
246 | * char text[]; input; text to be written |
---|
247 | */ |
---|
248 | |
---|
249 | |
---|
250 | /*----------------------------------------------------------------------------*/ |
---|
251 | |
---|
252 | |
---|
253 | void xw_read( WDW wdw, int maxlth, char text[] ); |
---|
254 | |
---|
255 | /* reads text string from window |
---|
256 | * |
---|
257 | * parameters of routine |
---|
258 | * WDW wdw; input; window number |
---|
259 | * int maxlth; input; maximum length of string |
---|
260 | * char text[]; output; string read |
---|
261 | */ |
---|
262 | |
---|
263 | |
---|
264 | /*----------------------------------------------------------------------------*/ |
---|
265 | |
---|
266 | |
---|
267 | void xw_getloc( WDW wdw, XWCOO *x, XWCOO *y, char *ch ); |
---|
268 | |
---|
269 | /* returns user selected mouse position and key |
---|
270 | * |
---|
271 | * parameters of routine |
---|
272 | * WDW wdw; input; window number |
---|
273 | * XWCOO *x, *y; output; selected position |
---|
274 | * char *ch; output; selected key (mouse button = '@') |
---|
275 | */ |
---|
276 | |
---|
277 | |
---|
278 | /*----------------------------------------------------------------------------*/ |
---|
279 | |
---|
280 | |
---|
281 | void xw_setstyle( WDW wdw, int style, char item[], char value[], |
---|
282 | STATUS *status ); |
---|
283 | |
---|
284 | /* sets attribute in style block number "style" |
---|
285 | * |
---|
286 | * parameters of routine |
---|
287 | * WDW wdw; input; window number |
---|
288 | * int style; input; style block number |
---|
289 | * char item[]; input; description of attribute |
---|
290 | * char value[]; input; new value of attribute (as string expression) |
---|
291 | * STATUS *status; output; return status |
---|
292 | */ |
---|
293 | |
---|
294 | |
---|
295 | /*----------------------------------------------------------------------------*/ |
---|
296 | |
---|
297 | |
---|
298 | void xw_charsize( WDW wdw, int style, float size, STATUS *status ); |
---|
299 | |
---|
300 | /* sets character size in units of display height |
---|
301 | * |
---|
302 | * parameters of routine |
---|
303 | * WDW wdw; input; window ID |
---|
304 | * int style; input; style number |
---|
305 | * float size; input; size of character in units of display height |
---|
306 | * STATUS *status; output; return status |
---|
307 | */ |
---|
308 | |
---|
309 | |
---|
310 | /*----------------------------------------------------------------------------*/ |
---|
311 | |
---|
312 | |
---|
313 | void xw_linestyle( WDW wdw, int style, int linestyle, STATUS *status ); |
---|
314 | |
---|
315 | /* sets line linestyle in style block number "style" |
---|
316 | * |
---|
317 | * parameters of routine |
---|
318 | * WDW wdw; input; window ID |
---|
319 | * int style; input; style block number |
---|
320 | * int linestyle; input; number of line style |
---|
321 | * STATUS *status; output; return status |
---|
322 | */ |
---|
323 | |
---|
324 | |
---|
325 | /*----------------------------------------------------------------------------*/ |
---|
326 | |
---|
327 | |
---|
328 | void xw_linewidth( WDW wdw, int style, int width, STATUS *status ); |
---|
329 | |
---|
330 | /* sets line width in pixels in style block "style" |
---|
331 | * |
---|
332 | * parameters of routine |
---|
333 | * WDW wdw; input; window number |
---|
334 | * int style; input; style block number |
---|
335 | * int width; input; width of line in pixels |
---|
336 | * STATUS *status; output; return status |
---|
337 | */ |
---|
338 | |
---|
339 | |
---|
340 | /*----------------------------------------------------------------------------*/ |
---|
341 | |
---|
342 | |
---|
343 | void xw_color( WDW wdw, int style, float red, float green, float blue, |
---|
344 | STATUS *status ); |
---|
345 | |
---|
346 | /* sets color of style block "style" |
---|
347 | * |
---|
348 | * parameters of routine |
---|
349 | * WDW wdw; input; window ID |
---|
350 | * int style; input; style block number |
---|
351 | * float red, green, blue; input; red, green and blue intensities (0..1) |
---|
352 | * STATUS *status; output; return status |
---|
353 | */ |
---|
354 | |
---|
355 | |
---|
356 | /*----------------------------------------------------------------------------*/ |
---|
357 | |
---|
358 | |
---|
359 | XWCOO xw_chheight( WDW wdw ); |
---|
360 | |
---|
361 | /* returns char height in user coordinates of last used style |
---|
362 | * |
---|
363 | * parameters of routine |
---|
364 | * WDW wdw; input; window number |
---|
365 | */ |
---|
366 | |
---|
367 | |
---|
368 | /*----------------------------------------------------------------------------*/ |
---|
369 | |
---|
370 | |
---|
371 | void xw_prepare( WDW wdw, STATUS *status ); |
---|
372 | |
---|
373 | /* prepares window for redraw |
---|
374 | * |
---|
375 | * parameters of routine |
---|
376 | * WDW wdw; input; window number |
---|
377 | * STATUS *status; output; return status |
---|
378 | */ |
---|
379 | |
---|
380 | |
---|
381 | /*----------------------------------------------------------------------------*/ |
---|
382 | |
---|
383 | |
---|
384 | void xw_cleanup( WDW wdw, char outf[], STATUS *status ); |
---|
385 | |
---|
386 | /* cleanup after redraw. not used here |
---|
387 | * |
---|
388 | * parameters of routine |
---|
389 | * WDW wdw; input; window number |
---|
390 | * char outf[]; output; name of output file |
---|
391 | * STATUS *status; output; return status |
---|
392 | */ |
---|
393 | |
---|
394 | |
---|
395 | /*----------------------------------------------------------------------------*/ |
---|
396 | |
---|
397 | |
---|
398 | void xw_redraw( WDW wdw, STATUS *status ); |
---|
399 | |
---|
400 | /* redraws window |
---|
401 | * |
---|
402 | * parameters of routine |
---|
403 | * WDW wdw; input; window number |
---|
404 | * STATUS *status; output; return status |
---|
405 | */ |
---|
406 | |
---|
407 | |
---|
408 | /*----------------------------------------------------------------------------*/ |
---|
409 | |
---|
410 | |
---|
411 | float xw_aspectratio( WDW wdw ); |
---|
412 | |
---|
413 | /* returns ratio of width to height |
---|
414 | * |
---|
415 | * parameter of routine |
---|
416 | * WDW wdw; input; window number |
---|
417 | */ |
---|
418 | |
---|
419 | |
---|
420 | /*----------------------------------------------------------------------------*/ |
---|
421 | |
---|
422 | |
---|
423 | void xw_updatewdw( void ); |
---|
424 | |
---|
425 | /* updates windows if necessary |
---|
426 | * no parameters |
---|
427 | */ |
---|
428 | |
---|
429 | |
---|
430 | /*----------------------------------------------------------------------------*/ |
---|
431 | |
---|
432 | |
---|
433 | void xw_flushbuffers( void ); |
---|
434 | |
---|
435 | /* flushes all output buffers of graphic windows |
---|
436 | * |
---|
437 | * no parameters |
---|
438 | */ |
---|
439 | |
---|
440 | |
---|
441 | /*----------------------------------------------------------------------------*/ |
---|
442 | |
---|
443 | |
---|
444 | void xw_arrayswap( BOOLEAN on_off ); |
---|
445 | |
---|
446 | /* switches arrayswap (swapping of x and y in xw_arrayplot) on or off |
---|
447 | * |
---|
448 | * parameters of routine |
---|
449 | * BOOLEAN on_off; input; TRUE=on, FALSE=off |
---|
450 | */ |
---|
451 | |
---|
452 | |
---|
453 | /*----------------------------------------------------------------------------*/ |
---|
454 | |
---|
455 | |
---|
456 | void xw_set_inputdir( char dir[], STATUS *status ); |
---|
457 | |
---|
458 | /* sets scratch directory |
---|
459 | * |
---|
460 | * parameters of routine |
---|
461 | * char dir[]; input; new directory name |
---|
462 | * STATUS *status; output; return status |
---|
463 | */ |
---|
464 | |
---|
465 | |
---|
466 | /*----------------------------------------------------------------------------*/ |
---|
467 | |
---|
468 | |
---|
469 | #else /* BC_G_XWINDOW */ |
---|
470 | |
---|
471 | |
---|
472 | #define xw_init(n,a,x,y,w,h,s) |
---|
473 | #define xw_exit(w) |
---|
474 | #define xw_finish() |
---|
475 | #define xw_resizewdw(n,x,y,w,h,s) |
---|
476 | #define xw_popwdw(w) |
---|
477 | #define xw_pushwdw(w) |
---|
478 | #define xw_erase(w) |
---|
479 | #define xw_setwdwname(w,n) |
---|
480 | #define xw_setcoo(n,x,y,w,h,s) |
---|
481 | #define xw_moveto(w,x,y) |
---|
482 | #define xw_drawto(w,s,x,y) |
---|
483 | #define xw_arrayplot(w,s,c,r,o,i,y,a,z,v) |
---|
484 | #define xw_text(w,s,x,y,t) |
---|
485 | #define xw_wrtch(w,c) |
---|
486 | #define xw_write(w,t) |
---|
487 | #define xw_read(w,m,t) |
---|
488 | #define xw_getloc(w,x,y,c) |
---|
489 | #define xw_setstyle(w,s,i,v,t) |
---|
490 | #define xw_charsize(w,s,z,t) |
---|
491 | #define xw_linestyle(w,s,l,t) |
---|
492 | #define xw_linewidth(w,s,d,t) |
---|
493 | #define xw_color(w,s,r,g,b,t) |
---|
494 | #define xw_chheight(w) 1 |
---|
495 | #define xw_prepare(w,s) |
---|
496 | #define xw_cleanup(w,o,s) |
---|
497 | #define xw_redraw(w,s) |
---|
498 | #define xw_aspectratio(w) 1.0 |
---|
499 | #define xw_updatewdw() |
---|
500 | #define xw_flushbuffers() |
---|
501 | #define xw_arrayswap(f) |
---|
502 | #define xw_set_outputdir(d,s) |
---|
503 | #define xw_set_inputdir(d,s) |
---|
504 | |
---|
505 | |
---|
506 | #endif /* BC_G_XWINDOW */ |
---|
507 | |
---|
508 | #endif /* __XWUSRDEF */ |
---|