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