Mercurial > hg > aim92
comparison glib/windows.h @ 0:5242703e91d3 tip
Initial checkin for AIM92 aimR8.2 (last updated May 1997).
author | tomwalters |
---|---|
date | Fri, 20 May 2011 15:19:45 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:5242703e91d3 |
---|---|
1 /* | |
2 Copyright (c) Applied Psychology Unit, Medical Research Council. 1988, 1989 | |
3 =========================================================================== | |
4 | |
5 Permission to use, copy, modify, and distribute this software without fee | |
6 is hereby granted for research purposes, provided that this copyright | |
7 notice appears in all copies and in all supporting documentation, and that | |
8 the software is not redistributed for any fee (except for a nominal shipping | |
9 charge). Anyone wanting to incorporate all or part of this software in a | |
10 commercial product must obtain a license from the Medical Research Council. | |
11 | |
12 The MRC makes no representations about the suitability of this | |
13 software for any purpose. It is provided "as is" without express or implied | |
14 warranty. | |
15 | |
16 THE MRC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING | |
17 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE | |
18 A.P.U. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY | |
19 DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN | |
20 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
21 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
22 */ | |
23 | |
24 /* | |
25 windows.h | |
26 ========= | |
27 | |
28 A rather wave drawing oriented interface to window systems | |
29 | |
30 | |
31 | |
32 Authors : John Holdsworth, Paul Manson. | |
33 Written : 22nd March, 1989. | |
34 | |
35 Edited : | |
36 | |
37 04 April 1989 (Paul Manson) -- Altered the axes entry point to also pass | |
38 the WindowObject (it is needed so that the | |
39 axes have something to attach to) | |
40 | |
41 06 July 1989 (Paul Manson) -- Altered the <name> argument of newDisplayWindow() | |
42 to refer to the name of the window to be created, | |
43 rather than the display to use. | |
44 | |
45 01 April 1990 (John Holdsworth) -- function operation changed to more general | |
46 segment operation to draw part of a wave. | |
47 The macro Function() preforms as before. | |
48 | |
49 */ | |
50 | |
51 /* allowed extry pointy for a generic window object */ | |
52 | |
53 typedef struct _window_entries { | |
54 short (*x )( /* WindowOjbect info */ ) ; | |
55 short (*y )( /* WindowOjbect info */ ) ; | |
56 short (*width )( /* WindowOjbect info */ ) ; | |
57 short (*height )( /* WindowOjbect info */ ) ; | |
58 void (*draw )( /* WindowOjbect info, short *xs, *ys, int points */ ) ; | |
59 void (*clear )( /* WindowOjbect info */ ) ; | |
60 void (*close )( /* WindowOjbect info */ ) ; | |
61 int (*store )( /* WindowOjbect info */ ) ; | |
62 void (*recall )( /* WindowOjbect info, int which */ ) ; | |
63 void (*fillRow )( /* WindowOjbect info, int row, pixels[], width */ ) ; | |
64 void (*fillCol )( /* WindowOjbect info, int col, pixels[], height */ ) ; | |
65 void (*function)( /* WindowOjbect info, short *ys, int segment, skip ; | |
66 double offset, scale ; int start, points */ ) ; | |
67 int (*read )( /* WindowObject info, FILE *fptr, int which */ ) ; | |
68 void (*write )( /* WindowObject info, FILE *fptr */ ) ; | |
69 char (*pause )( /* WindowObject info */ ) ; | |
70 void (*axes )( /* WindowObject info, char *title ; | |
71 double xmin, xmax ; char *xtitle ; | |
72 double ymin, ymax ; char *ytitle */ ) ; | |
73 void (*marker )( /* WindowObject info, char *text, int start, pts */ ) ; | |
74 int (*special )( /* WindowObject info, int code, char *data */ ) ; | |
75 } windowEntries /* windowMethods */ ; | |
76 | |
77 typedef struct _window_class { | |
78 struct _window_class *super ; | |
79 windowEntries entries ; | |
80 } windowsClass ; | |
81 | |
82 /* external interface to window object */ | |
83 | |
84 typedef struct _window_object { | |
85 windowEntries *entries ; | |
86 char window[4] ; /* Window may be accessed as *( (Window) &window_object->window ) */ | |
87 /* struct { user data goes here in sub-class 1st item of which is window } ; */ | |
88 } *WindowObject ; | |
89 | |
90 | |
91 /* best guess at image structure for portable drawing optimisation */ | |
92 | |
93 typedef struct _window_image { | |
94 char *data ; int bytes_per_line, height, left_bit, right_bit, start_bit ; | |
95 } *WindowImage ; | |
96 | |
97 extern WindowImage window__current_image( /* WindowObject window */ ) ; | |
98 | |
99 /* #define prototypes to simulate operation as objects and check types */ | |
100 | |
101 | |
102 #define Width( _w ) \ | |
103 ( _w )->entries->width( _w ) | |
104 | |
105 #define Height( _w ) \ | |
106 ( _w )->entries->height( _w ) | |
107 | |
108 | |
109 #define Draw( _w, _xs , _ys , _points ) \ | |
110 ( _w )->entries->draw( _w, (short *) (_xs), (short *) (_ys), (int) (_points) ) | |
111 | |
112 #define Plot( _w, _xs , _ys , _points ) \ | |
113 ( _w )->entries->draw( _w, (short *) (_xs), (short *) (_ys), (int) -(_points) ) | |
114 | |
115 | |
116 #define Clear( _w ) \ | |
117 ( _w )->entries->clear( _w ) | |
118 | |
119 #define Close( _w ) \ | |
120 ( _w )->entries->close( _w ) | |
121 | |
122 | |
123 #define Store( _w ) \ | |
124 ( _w )->entries->store( _w ) | |
125 | |
126 #define Recall( _w, _which ) \ | |
127 ( _w )->entries->recall( _w, (int) ( _which ) ) | |
128 | |
129 | |
130 #define FillRow( _w, _row , _input , _black , _white , _match , _height ) \ | |
131 ( _w )->entries->fillRow( _w, (int) (_row), (short *) (_input), (int) (_black), (int) (_white), (int *) (_match), (int) (_height) ) | |
132 | |
133 #define FillCol( _w, _col , _input , _black , _white , _match , _height ) \ | |
134 ( _w )->entries->fillCol( _w, (int) (_col), (short *) (_input), (int) (_black), (int) (_white), (int *) (_match), (int) (_height) ) | |
135 | |
136 | |
137 /* function provided for backward compatability */ | |
138 | |
139 #define Function( _w, _ys , _points , _skip , _offset , _scale ) \ | |
140 ( _w )->entries->function( _w, (short *) ( _ys ), abs( (int) ( _points ) ), (int) ( _skip ), (double) ( _offset ), (double) ( _scale ), (int)0, (int)_points ) | |
141 | |
142 #define Segment( _w, _ys , _segment , _skip , _offset , _scale , _start , _points ) \ | |
143 ( _w )->entries->function( _w, (short *) ( _ys ), (int) ( _segment ), (int) ( _skip ), (double) ( _offset ), (double) ( _scale ), (int) ( _start ), (int) ( _points ) ) | |
144 | |
145 | |
146 #define Read( _w, _file, _which ) \ | |
147 ( _w )->entries->read( _w, _file, (int) (_which) ) | |
148 | |
149 #define Write( _w, _file ) \ | |
150 ( _w )->entries->write( _w, _file ) | |
151 | |
152 | |
153 #define Pause( _w ) \ | |
154 ( _w )->entries->pause( _w ) | |
155 | |
156 #define Axes( _w, _title , _xmin , _xmax , _xtitle , _ymin, _ymax , _ytitle ) \ | |
157 ( _w )->entries->axes( _w, (char *) (_title), (double) (_xmin), (double) (_xmax), (char *) (_xtitle), (double) (_ymin), (double) (_ymax), (char *) (_ytitle) ) | |
158 | |
159 #define Marker( _w, _label , _p, _points ) \ | |
160 ( _w )->entries->marker( _w, (char *) (_label), (int) _p, (int) _points ) | |
161 | |
162 #define Special( _w, _code , _data ) \ | |
163 ( _w )->entries->special( _w, (char *) (_code), (char *) (_data) ) | |
164 | |
165 | |
166 /* standard window object creation routines */ | |
167 | |
168 #define NewDisplayWindow( _name, _default_x, _default_y, _default_width, _default_height, _pixels ) \ | |
169 newDisplayWindow( _name, _default_x, _default_y, _default_width, _default_height, _pixels ) | |
170 | |
171 #define NewFILEWindow( _name, _default_x, _default_y, _default_width, _default_height, _pixels ) \ | |
172 newFILEWindow( _name, _default_x, _default_y, _default_width, _default_height, _pixels ) | |
173 | |
174 #define NewPSWindow( _name, _default_x, _default_y, _default_width, _default_height, _pixels ) \ | |
175 newPSWindow( _name, _default_x, _default_y, _default_width, _default_height, _pixels ) | |
176 | |
177 #define NewNullWindow( ) \ | |
178 newNullWindow( ) | |
179 | |
180 extern WindowObject newDisplayWindow(), newPSWindow(), newPostScriptWindow(), newFILEWindow(), newNullWindow(), NullWindowObject ; | |
181 | |
182 extern windowsClass *initPostScriptClass(), *initDisplayPostScriptClass() ; |