1 /* This file contains some general definitions for the Figaro/PGPLOT X Window */ 2 /* display server. */ 3 4 /* Sam Southard, Jr. */ 5 /* Created: 6-Nov-1990 */ 6 /* 7-Nov-1990 SNS/CIT Added default values */ 7 /* 8-Nov-1990 SNS/CIT Added LG_WIN_DEPTH, MAXSTRLEN, MALLOC_ERR, BADCOM, */ 8 /* and INCCOM */ 9 /* 16-Nov-1990 SNS/CIT Added LG_MAX_HEIGHT and LG_MAX_WIDTH. */ 10 /* 10-Dec-1990 SNS/CIT wininfo struct added. VMS changes merged in. */ 11 /* LG_DEPTH changed to LG_MIN_DEPTH. BM_MIN_DEPTH 12 /* added. */ 13 /* 11-Dec-1990 SNS/CIT winname and iconname added to wininfo structure. */ 14 /* BM_MIN_WIDTH, BM_MIN_HEIGHT, BM_WIDTH, BM_HEIGHT, */ 15 /* BM_MAX_WIDTH, BM_MAX_HEIGHT, and BM_COLORS added. */ 16 /* pix member of wininfo structure now a pointer. */ 17 /* 12-Dec-1990 SNS/CIT LG_BDWIDTH changed to BORDER_WIDTH. BLANK_WIDTH 18 /* added. Image, line, maxh, minh, maxw, and minw */ 19 /* members added to wininfo structure. */ 20 /* 17-Dec-1990 SNS/CIT colors member added to wininfo structure. */ 21 /* 18-Dec-1990 SNS/CIT cursx and cursy members added to wininfo structure. */ 22 /* 13-Mar-1991 SNS/CIT yoff member removed from wininfo structure. */ 23 /* 29-Mar-1991 SNS/CIT line member removed from wininfo structure. */ 24 /* 10-May-1991 SNS/CIT FAIL changed to -1. */ 25 /* 26-Jul-1991 SNS/CIT Added bw member to wininfo structure for B&W */ 26 /* 30-Jul-1991 SNS/CIT Added BM_MIN_COLORS definition. Added allcells and */ 27 /* usecells member to wininfo structure for fastdisp */ 28 /* 31-Jul-1991 SNS/CIT Added im, imdat, xoff, yoff, imwidth, imheight, */ 29 /* modlut, mlx, mly, slope, offset, and visual members */ 30 /* to wininfo structure. Added BM_MAX_SH_COLS and */ 31 /* BM_MIN_SH_COLS definitions. */ 32 /* 1-Aug-1991 SNS/CIT Added showcur, curxsc, curxoff, curysc, curyoff, dsc, */ 33 /* doff, zim, zimdat, and zfac members to wininfo */ 34 /* structure. */ 35 /* 2-Aug-1991 SNS/CIT Max window sized increased to 2048x2048. xoff & yoff */ 36 /* member of wininfo are now relative to raw data. */ 37 /* 20-Aug-1991 SNS/CIT font and icon members added to wininfo structure */ 38 /* 22-Aug-1991 SNS/CIT LOC_WIDTH and LOC_HEIGHT added. */ 39 /* 27-Aug-1991 SNS/CIT invert member added to wininfo structure */ 40 /* 3-Sep-1991 SNS/CIT CM_WIDTH and CM_HEIGHT added. */ 41 /* 4-Oct-1991 SNS/CIT resource structure added. */ 42 /* 7-Oct-1991 SNS/CIT KeySym members of resource structure added. */ 43 /* 9-Oct-1991 SNS/CIT Font member of wininfo structure removed */ 44 /* 14-Oct-1991 SNS/CIT Allcells and usecells members of wininfo removed */ 45 /* 17-Oct-1991 SNS/CIT Modified to deal with 8 and 16 bit images */ 46 /* 22-Nov-1991 SNS/CIT Resource structure now includes a PS output file, a */ 47 /* printer, the number of microseconds to sleep between */ 48 /* client existance checks, whether or not we should */ 49 /* force the location window pixels to be square, and */ 50 /* the number of color cells to copy from the default 51 /* color map to any private color map. */ 52 /* 25-Nov-1991 SNS/CIT Now has separate zoom factors for X & Y and allows */ 53 /* user specification of the behaviour of line plots. */ 54 /* 27-Nov-1991 SNS/CIT Now has one more way of controlling line plots. */ 55 /* 31-Jan-1992 SNS/CIT LEAVE_COLORS added and leavecolors added to the */ 56 /* resource structure */ 57 /* 18-Feb-1992 SNS/CIT LG_MIN_COLORS added and lgcolors added to the */ 58 /* resource structure. */ 59 /* 24-Feb-1992 SNS/CIT Ro member added to the wininfo structure. Visual */ 60 /* type #defines added. */ 61 /* 3-Mar-1992 SNS/CIT visclass member added to resource structure. */ 62 /* 8-Apr-1992 SNS/CIT USLEEP_TIME changed to 10000 */ 63 /* 9-Apr-1992 SNS/CIT No longer uses a minimum or maximum dimensions for */ 64 /* the windows. */ 65 /* 10-Apr-1992 SNS/CIT winxoff and winyoff members added to the wininfo */ 66 /* structure. */ 67 /* 7-May-1992 SNS/CIT lgcross added to resource structure. */ 68 /* 24-Jun-1992 SNS/CIT Added space for histogram equalization key and size */ 69 /* 25-Jun-1992 SNS/CIT plothist added to resource structues. */ 70 /* 26-Jun-1992 SNS/CIT HALF_TICK added. */ 71 /* 30-Sep-1992 SNS/CIT LUT wrap resources and RCS id string added. */ 72 /* 14-Oct-1992 SNS/CIT RCS id string now only added if INC_HEADER_RCS */ 73 /* #define'd. Space for MOUSEMODE and DOBOX keys added. */ 74 /* Now protected from doubel #include'sion */ 75 76 #ifndef INC_FIGDISP_H 77 #define INC_FIGDISP_H 78 79 #ifndef lint 80 #ifdef INC_HEADER_RCS 81 static char figdisp_h_rcsid[]="@(#)$Id: figdisp.h,v 1.12 1992/10/19 02:18:32 figaro Exp $"; 82 #endif 83 #endif 84 85 /* The figdisp structure needs definitions from Xutil.h */ 86 #include <X11/Xlib.h> 87 #include <X11/Xutil.h> 88 89 /* some return value definitions */ 90 91 /* The basics: */ 92 #define FAIL 1 /* used if a routine fails for some reason. */ 93 #define SUCCEED 0 /* the opposite of FAIL. MUST be 0 because 0 is the */ 94 /* only value which can be uniquely identified in a */ 95 /* test case (all other return values are failures */ 96 /* of some sort) */ 97 98 /* some more advanced: */ 99 #define ALREADY_RUNNING 2 /* Another copy of the display routine is */ 100 /* already running */ 101 #define MALLOC_ERR 3 /* An error allocating something */ 102 #define BADCOM 4 /* Someone gave us a bad command */ 103 #define INCCOM 5 /* The last command in a command buffer was */ 104 /* incomplete */ 105 106 /* some default values */ 107 #define LG_WIDTH 512 /* default width of the line graphics window */ 108 #define LG_HEIGHT 512 /* default height of the line graphics window */ 109 #define LG_MIN_WIDTH 64 /* The minimum line graphics window width */ 110 #define LG_MIN_HEIGHT 64 /* The minimum line graphics window height */ 111 #ifdef VMS 112 /* Our VMS Machines don't have as much memory */ 113 #define LG_MAX_WIDTH 512 /* The maximum line graphics window width */ 114 #define LG_MAX_HEIGHT 512 /* The maximum line graphics window height */ 115 #else 116 #define LG_MAX_WIDTH 2048 /* The maximum line graphics window width */ 117 #define LG_MAX_HEIGHT 2048 /* The maximum line graphics window height */ 118 #endif 119 #define LG_COLORS 16 /* The number of colors for line graphics */ 120 #define LG_MIN_COLORS 2 /* Minimum number of colors for line graphics */ 121 #define LG_MIN_DEPTH 4 /* The minimum depth of the line graphics */ 122 /* window. Right now should be equal to log */ 123 /* base 2 of LG_COLORS */ 124 #define BORDER_WIDTH 1 /* width of the window border */ 125 #define BLANK_WIDTH 5 /* width of the blank area between drawing */ 126 /* surface and window border */ 127 #define BM_MIN_DEPTH 8 /* The minimum depth of bitmap window */ 128 #define BM_WIDTH 512 /* default width of bitmap window */ 129 #define BM_HEIGHT 512 /* default height of bitmap window */ 130 #define BM_MIN_WIDTH 64 /* minimum width of bitmap window */ 131 #define BM_MIN_HEIGHT 64 /* minimum height of bitmap window */ 132 #define BM_MAX_WIDTH 2048 /* maximum width of bitmap window. */ 133 #define BM_MAX_HEIGHT 2048 /* maximum height of bitmap window */ 134 #define BM_COLORS 65536 /* number of colors for bitmaps */ 135 #define BM_MIN_COLORS 170 /* minimum number of colors for bitmaps */ 136 #define BM_MAX_SH_COLS 225 /* maximum number of colors to use when we're */ 137 /* sharing a color table */ 138 #define BM_MIN_SH_COLS 200 /* minimum number of colors to use when we're */ 139 /* sharing a color table */ 140 #define LOC_WIDTH 128 /* the default location window width */ 141 #define LOC_HEIGHT 128 /* the default location window height */ 142 #define CM_WIDTH 256 /* default width of the color map window */ 143 #define CM_HEIGHT 32 /* default height of the color map window */ 144 #define MIN_USLEEP_TIME 10000 /* The minimum number of microseconds to */ 145 /* wait between existance checks */ 146 #define USLEEP_TIME 10000 /* The default number of microseconds to wait */ 147 /* between existance checks */ 148 #define SAVE_COLORS 6 /* The default number of colors to copy from */ 149 /* the default colormap to any private */ 150 /* color map we use. */ 151 #define LEAVE_COLORS 0 /* The default number of colors to leave */ 152 /* available in the default color map */ 153 #define HIST_WIDTH 0 /* The default width of the histogram area */ 154 /* 0 = use entire image */ 155 #define HIST_HEIGHT 0 /* The default height of the histogram area */ 156 #define HALF_TICK 2 /* Half the size of axis tick, in X11 pixels */ 157 #define INIT_LUT_WRAP 1 /* The default initial LUT wrap factor */ 158 159 /* some misc. constants */ 160 #define MAXSTRLEN 80 /* The maximum string length */ 161 #define UseDefaultCmap 1 /* Use the default color map */ 162 #define UseRWVisual 2 /* Use a read/write visual */ 163 #define UseROVisual 3 /* Use a read only visual */ 164 165 /* These are two phony visual classes. The assume that the normal X visuals */ 166 /* do not clash. For Openwindows 2.0, visuals classes are non-negative, so */ 167 /* this is a valid assumption. */ 168 #define AnyVis -1 /* Use any visual */ 169 #define DefaultVis -2 /* Use only the default visual */ 170 171 /* The number of characters in the box window */ 172 #define BOX_COL_CHARS 16 173 174 /* The window information structure */ 175 struct wininfo { 176 Window win; /* The window for display */ 177 unsigned long *pix; /* The pixel values */ 178 Pixmap pixmap; /* The pixmap */ 179 int mapped; /* True if window is mapped */ 180 unsigned int height; /* current window height */ 181 unsigned int width; /* current window width */ 182 XTextProperty winname; /* The window's name */ 183 XTextProperty iconname; /* The icon's name */ 184 XImage *image; /* An image for the window's data */ 185 unsigned char *imdat; /* The window's data */ 186 int winxoff; /* The offset from the start of the window to the */ 187 int winyoff; /* start of the Ximage structure */ 188 int colors; /* the number of colors used by this window */ 189 int cursx; /* The X position of the cursor */ 190 int cursy; /* the Y position of the cursor */ 191 int bw; /* If the display is black & white */ 192 int ro; /* If the display is read only */ 193 int xoff,yoff; /* offset from image data OF APPROPRIATE ZOOM FACTOR */ 194 /* into Ximage */ 195 int imwidth,imheight; /* width & height of the image */ 196 int modlut; /* true is we're modifying the LUTs */ 197 int mlx,mly; /* the place where we started modifying the luts */ 198 double slope; /* slope of the LUT transfer function */ 199 double offset; /* offset of the LUT transfer function */ 200 int showcur; /* show cursor position */ 201 float curxsc; /* cursor x scale value */ 202 float curxoff; /* cursor x offset value */ 203 float curysc; /* cursor y scale value */ 204 float curyoff; /* cursor y offset value */ 205 float dsc; /* data scale value */ 206 float doff; /* data offset value */ 207 int xzoom; /* X zoom factor */ 208 int yzoom; /* Y zoom factor */ 209 Pixmap icon; /* this window's icon */ 210 int invert; /* true if we want to invert the color maps */ 211 }; 212 213 /* the geometry structure */ 214 struct geometry { 215 int w; /* the width */ 216 int h; /* the height */ 217 int x; /* the x position */ 218 int y; /* the y position */ 219 }; 220 221 /* The rawdata union */ 222 223 union rawdata { 224 unsigned short *b16; /* for 16 bit data */ 225 unsigned char *b8; /* for 8 bit data */ 226 }; 227 228 /* The keysym array definitions */ 229 #define ZOOMIN 0 230 #define ZOOMNORM 1 231 #define ZOOMOUT 2 232 #define HELP 3 233 #define CURSOR 4 234 #define RECENTER 5 235 #define SHOWLOC 6 236 #define QUIT 7 237 #define SHOWCM 8 238 #define SHOWPAT 9 239 #define ROW 10 240 #define IMPS 11 241 #define WINPS 12 242 #define INVERT 13 243 #define SEEING 14 244 #define COL 15 245 #define DECSLIT 16 246 #define INCSLIT 17 247 #define RESSLIT 18 248 #define INHIBIT 19 249 #define ZOOMXIN 20 250 #define ZOOMXOUT 21 251 #define ZOOMYIN 22 252 #define ZOOMYOUT 23 253 #define HISTOGRAM 24 254 #define DECLUTWRAP 25 255 #define INCLUTWRAP 26 256 #define RESLUTWRAP 27 257 #define MOUSEMODE 28 258 #define DOBOX 29 259 260 #define NKEYS 30 /* the total number of defined keys */ 261 262 /* the various resources which affect the display server operation */ 263 struct resource { 264 struct geometry bmgeo; /* the bitmap geometry */ 265 struct geometry lggeo; /* the line graphics geometry */ 266 struct geometry pgeo; /* the patch geometry */ 267 struct geometry cgeo; /* the color map geometry */ 268 struct geometry lgeo; /* the location geometry */ 269 struct geometry histgeo; /* geometry of histogram area */ 270 int maxcolors; /* number of shared colors to use */ 271 int mincolors; /* minimum shared colors to use */ 272 int maxpcolors; /* maximum number of private colors to use */ 273 int minpcolors; /* minimum number of private colors to use */ 274 int showhelp; /* true if we should show help */ 275 KeySym keys[NKEYS]; /* the keys we use */ 276 XFontStruct *textfont; /* The font to use for labels inside windows */ 277 char *psfile; /* The PostScript output file */ 278 char *printer; /* The printer to use */ 279 int sleeptime; /* The number of microseconds to sleep between */ 280 /* existance checks. See waitevent.c for details. */ 281 int forcesquare; /* true if we should force location window */ 282 /* pixels to be square */ 283 int savecolors; /* The number of colors to copy from the default */ 284 /* colormap to a private color map. */ 285 int leavecolors; /* The number of colors to leave available */ 286 /* in the default colormap. */ 287 int lefttoright; /* true if the user always wants a line plot */ 288 /* to go from left to right, even if he moved */ 289 /* the mouse from right to left */ 290 int ascendcoord; /* True if arbitrary line plots should follow */ 291 /* ascending coordinates (which one determined by the */ 292 /* slope of the line) */ 293 int bottotop; /* True if column plots should go from bottom to top */ 294 int ascendy; /* True if column plots should follow ascending Y */ 295 /* values. If true, takes precedence over bottotop. */ 296 int rowltor; /* True if row plots should go from left to right */ 297 int ascendx; /* True if row plots should follow ascending X. If */ 298 /* true, takes precedence over rowltor. */ 299 int id; /* The figdisp id. Used to allow multiple figdisps */ 300 /* on the same screen. */ 301 int lgcolors; /* The number of colors for the line graphics screen */ 302 int visclass; /* The visual class allowed */ 303 int lgcross; /* True if we should use the crosshair cursor for the */ 304 /* line graphics window. */ 305 int plothist; /* True if line plots should be in histogram form */ 306 int initwrap; /* The initial LUT wrap factor */ 307 }; 308 309 #endif /* INC_FIGDISP_H */ 310