home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / apps / dtp / ghost / gs301src / atari / st_defs.h < prev    next >
Text File  |  1994-09-11  |  14KB  |  486 lines

  1. /* Copyright (C) 1989, 1992, 1993 Aladdin Enterprises.  All rights reserved.
  2.  
  3. This file is part of Ghostscript.
  4.  
  5. Ghostscript is distributed in the hope that it will be useful, but
  6. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  7. to anyone for the consequences of using it or for whether it serves any
  8. particular purpose or works at all, unless he says so in writing.  Refer
  9. to the Ghostscript General Public License for full details.
  10.  
  11. Everyone is granted permission to copy, modify and redistribute
  12. Ghostscript, but only under the conditions described in the Ghostscript
  13. General Public License.  A copy of this license is supposed to have been
  14. given to you along with Ghostscript so you can know your rights and
  15. responsibilities.  It should be in a file named COPYING.  Among other
  16. things, the copyright notice and this notice must be preserved on all
  17. copies.  */
  18.  
  19. /* ataridef.h */
  20.  
  21. /* Definitions for the Atari platforms. */
  22.  
  23. #define MIN(x, y) ((x <= y) ? x : y)
  24. #define MAX(x, y) ((x >= y) ? x : y)
  25.  
  26. /* Window Types. */
  27.  
  28. #define TEXT    (0)
  29. #define OBJ    (1)
  30. #define BIT    (2)
  31.  
  32. /* Definitions which determine the size of the console window. */
  33.  
  34. #define LINES       (24)
  35. #define CLIMIT        (COLUMNS + 2)
  36. #define COLUMNS     (80)
  37.  
  38. /* Definitions for menu objects. */
  39.  
  40. #define ABOUT        (11)
  41.  
  42. #define OPEN        (20)
  43. #define PAGES        (21)
  44. #define PRINT        (22)
  45. #define PREV        (24)
  46. #define NEXT        (25)
  47. #define LOAD        (27)
  48. #define SAVE        (28)
  49. #define QUIT        (30)
  50.  
  51. #define CYCLEF        (32)
  52. #define CYCLEB        (33)
  53. #define ICON        (35)
  54. #define CLOSE        (36)
  55. #define COPY        (38)
  56.  
  57. #define PSHELP        (42)
  58. #define NOPAUSE        (43)
  59. #define DEVICE        (45)
  60. #define PAGESIZE    (46)
  61. #define RES        (47)
  62.  
  63. /* Definitions for about dialog objects. */
  64.  
  65. #define ABO_GEN        (1)
  66. #define ABO_FONT    (2)
  67. #define ABO_ERR        (3)
  68. #define ABO_FEAT    (4)
  69.  
  70. /* Definitions for resolution dialog objects. */
  71.  
  72. #define RES_HUP        (2)
  73. #define RES_TUP        (3)
  74. #define RES_HDN        (4)
  75. #define RES_TDN        (5)
  76. #define RES_HUN        (6)
  77. #define RES_TEN        (7)
  78. #define RES_OUP        (8)
  79. #define RES_ODN        (9)
  80. #define RES_ONE        (10)
  81. #define RES_DEF        (11)
  82. #define RES_CAN        (12)
  83. #define RES_DONE    (13)
  84. #define RES_APP        (14)
  85.  
  86. /* Definitions for device dialog objects. */
  87.  
  88. #define DEVICES     (8)
  89. #define FIRSTDEV        (6)
  90. #define LASTDEV         (13)
  91. #define SIZES        (8)
  92. #define DNAMELEN    (16)
  93.  
  94. #define DEV_DEF        (1)
  95. #define DEV_CAN        (2)
  96. #define DEV_APP        (3)
  97. #define DEV_DONE    (4)
  98.  
  99. /* Definitions for page size dialog objects. */
  100.  
  101. #define SIZ_DEF        (1)
  102. #define SIZ_CAN        (2)
  103. #define SIZ_APP        (3)
  104. #define SIZ_DONE    (4)
  105.  
  106. /* Definitions for the print dialog objects. */
  107.  
  108. #define PR_DEF      (1)
  109. #define PR_CAN      (2)
  110. #define PR_PR       (3)
  111. #define PR_PANEL    (4)
  112. #define PR_IFILE    (5)
  113. #define PR_DEV      (6)
  114. #define PR_FSTR     (7)
  115. #define PR_DSTR     (8)
  116. #define PR_PRN      (9)
  117. #define PR_CEN     (10)
  118. #define PR_OFILE   (11)
  119.  
  120. /* Definitions for GEM events. */
  121.  
  122. #define WF_BOTTOM    (25)
  123. #define WF_ICONIFY    (26)
  124. #define WF_UNICONIFY    (27)
  125.  
  126. #define WM_UNTOPPED    (30)
  127. #define WM_ONTOP    (31)
  128. #define WM_BOTTOMED    (33)        /*      window backdrop */
  129. #define WM_ICONIFY    (34)        /*     window -> icon */
  130. #define WM_UNICONIFY    (35)        /*    icon -> window */
  131. #define WM_ALLICONIFY   (36)
  132.  
  133. #define SMALLER        (0x4000)    /* CF : Iconify with MultiTOS */
  134. #define COMMAND        (100)        /* New message type. */
  135. #define PGFILTER    (110)        /* New message type. */
  136. #define PGSELECT    (120)        /* New message type. */
  137.  
  138. /* Miscellaneous definitions. */
  139.  
  140. #define UL        (unsigned long)
  141. #define ON        (1)
  142. #define OFF        (0)
  143. #define MAXLEN        (256)
  144. #define DIRT_RECT     (0)    /* Redraw only the dirty part of the window. */
  145. #define FULL_WIN      (1)    /* Redraw the full window. */
  146. #define DEFINED_INTENSITY    (0)
  147.  
  148. /* Default filenames. */
  149.  
  150. #define CONFIGFILE    "stgs.rc"
  151. #define CONFIGBAK    "stgs.bak"
  152. #define PROLOG        "gs_pro.ps"
  153. #define PAGE_PREFIX    "gs_pg"
  154.  
  155. #define OPENHELP    "open"
  156. #define PAGHELP        "page"
  157. #define OUTHELP        "print"
  158. #define LOADHELP    "load"
  159. #define SAVEHELP    "save"
  160. #define PREVHELP    "prev"
  161. #define NEXTHELP    "next"
  162. #define DEVHELP        "dev"
  163. #define RESHELP        "res"
  164. #define SIZHELP        "size"
  165. #define PAUSEHELP    "nopause"
  166. #define PSFHELP        "pshelp"
  167. #define ICONHELP    "icon"
  168. #define CYCLEHELP    "cycle"
  169. #define CLOSEHELP    "close"
  170. #define COPYHELP    "copy"
  171.  
  172. #define GENHELP        "general"
  173. #define FONTHELP    "font"
  174. #define ERRHELP        "error"
  175. #define FEATHELP    "feature"
  176.  
  177. /* Positions of the objects in the Pobject array. */
  178.  
  179. #define MENUOBJ        (0)
  180. #define ABOUTOBJ    (1)
  181. #define RESOBJ        (2)
  182. #define ICONOBJ        (3)
  183. #define DEVOBJ        (4)
  184. #define SIZOBJ        (5)
  185. #define OUTOBJ        (6)
  186. #define SAVEMSG        (7)
  187. #define NOBJS        (8)
  188.  
  189. /* Window Titles */
  190.  
  191. #define B_TITL " GS Image "
  192. #define C_TITL " GS Image Copy "
  193. #define T_TITL " GS Console "
  194. #define I_TITL " GS "
  195. #define A_TITL " GS Information "
  196. #define R_TITL " GS Pixels/Inch "
  197. #define D_TITL " GS Device "
  198. #define S_TITL " GS Page Size "
  199. #define H_TITL " GS Help "
  200. #define O_TITL " GS Print "
  201. #define P_TITL " GS Pages "
  202.  
  203. /* Window Gadgets. */
  204.  
  205. #define B_GADGETS (NAME+CLOSER+MOVER+SIZER+FULLER+VSLIDE\
  206.             +HSLIDE+UPARROW+DNARROW+LFARROW+RTARROW)
  207. #define C_GADGETS (NAME+CLOSER+MOVER+SIZER+FULLER+VSLIDE\
  208.             +HSLIDE+UPARROW+DNARROW+LFARROW+RTARROW)
  209. #define T_GADGETS (NAME+MOVER+SIZER+FULLER+VSLIDE\
  210.             +HSLIDE+UPARROW+DNARROW+LFARROW+RTARROW)
  211. #define I_GADGETS (NAME+MOVER+FULLER)
  212. #define A_GADGETS (CLOSER+NAME+MOVER)
  213. #define R_GADGETS (CLOSER+NAME+MOVER)
  214. #define D_GADGETS (CLOSER+NAME+MOVER)
  215. #define S_GADGETS (CLOSER+NAME+MOVER)
  216. #define O_GADGETS (CLOSER+NAME+MOVER)
  217. #define P_GADGETS (CLOSER+NAME+MOVER)
  218. #define H_GADGETS (NAME+CLOSER+MOVER+SIZER+FULLER+VSLIDE\
  219.             +HSLIDE+UPARROW+DNARROW+LFARROW+RTARROW)
  220.  
  221. /* Macros for the colorinfo structure. */
  222.  
  223. #define DITH_GRAY(depth)\
  224.   (depth == 24 ? 195840 : depth == 16 ? 1535 : depth == 8 ? 39 :\
  225.    depth == 4 ? 7 : depth == 2 ? 2 : 1)
  226. #define DITH_RGB(depth)\
  227.   (depth == 24 ? 256 : depth == 16 ? 40 : depth == 8 ? 6 :\
  228.    depth == 4 ? 2 : depth == 2 ? 2 : 1)
  229.  
  230. /* General window structure. */
  231.  
  232. typedef struct window {
  233.     short handle;    /* window handle */
  234.     short type;        /* type of window (text, object, bit) */
  235.     void  *obj;        /* pointer to object contained in window */
  236.     short gadgets;    /* which window gadgets are enabled */
  237.     char  *title;    /* pointer to window title */
  238.     short opened;    /* flag for window state */
  239.     short iconified;    /* true if iconified */
  240.     GRECT canvas;    /* size of window work area */
  241.     GRECT frame;    /* sized of entire window */
  242.     GRECT oframe;    /* last frame size */
  243.     GRECT mframe;    /* maximum frame size */
  244.     int (*redraw)();    /* routine for window redraw */
  245.     int (*move)();    /* routine for window move */
  246.     int (*size)();    /* routine for window resize */
  247.     int (*arrow)();    /* routine for window arrows */
  248.     int (*hslide)();    /* routine for horizontal slider */
  249.     int (*vslide)();    /* routine for vertical slider */
  250.     int (*keybd)();    /* routine for keyboard event */
  251.     int (*button)();    /* routine for button event */
  252. } WINDOW;
  253.  
  254. #define DEFINE_TEXTWIN(obj, gadgets, title, keybd, button) {\
  255.     -1,\
  256.     TEXT,\
  257.     obj,\
  258.     gadgets,\
  259.     title,\
  260.     0,\
  261.     0,\
  262.     {0, 0, 0, 0},\
  263.     {0, 0, 0, 0},\
  264.     {0, 0, 0, 0},\
  265.     {0, 0, 0, 0},\
  266.     txtw_redraw,\
  267.     txtw_move,\
  268.     txtw_size,\
  269.     txtw_arrow,\
  270.     txtw_hslide,\
  271.     txtw_vslide,\
  272.     keybd,\
  273.     button\
  274. }
  275.  
  276. #define DEFINE_OBJWIN(obj, gadgets, title, keybd, button) {\
  277.     -1,\
  278.     OBJ,\
  279.     obj,\
  280.     gadgets,\
  281.     title,\
  282.     0,\
  283.     0,\
  284.     {0, 0, 0, 0},\
  285.     {0, 0, 0, 0},\
  286.     {0, 0, 0, 0},\
  287.     {0, 0, 0, 0},\
  288.     objw_redraw,\
  289.     objw_move,\
  290.     NULL,\
  291.     NULL,\
  292.     NULL,\
  293.     NULL,\
  294.     keybd,\
  295.     button\
  296. }
  297.  
  298. #define DEFINE_BITWIN(obj, gadgets, title, keybd, button) {\
  299.     -1,\
  300.     BIT,\
  301.     obj,\
  302.     gadgets,\
  303.     title,\
  304.     0,\
  305.     0,\
  306.     {0, 0, 0, 0},\
  307.     {0, 0, 0, 0},\
  308.     {0, 0, 0, 0},\
  309.     {0, 0, 0, 0},\
  310.     bitw_redraw,\
  311.     bitw_move,\
  312.     bitw_size,\
  313.     bitw_arrow,\
  314.     bitw_hslide,\
  315.     bitw_vslide,\
  316.     keybd,\
  317.     button\
  318. }
  319.  
  320. /* Structure for connecting windows in a double-linked list. */
  321.  
  322. typedef struct WinList {
  323.     WINDOW *Win;
  324.     struct WinList *Prev;
  325.     struct WinList *Next;
  326. } WINLIST;
  327.  
  328. /* Structure for text in windows. */
  329.  
  330. typedef struct wintext {
  331.     char   (*buff)[COLUMNS+1];    /* text buffer */
  332.     int       bsize;    /* buffer size in lines of length COLUMNS+1. */
  333.     int    bw, bh;    /* width and height of the used buffer. */
  334.     int    top;        /* position of the top of page wrt screen */
  335.     int    edge;    /* position of the left edge of page wrt screen */
  336.     int    cx, cy;    /* cursor position in raster coordinates */
  337.     short  xoff, yoff;    /* offset of text wrt top left corner of page */
  338.     short  cstate;    /* cursor state (on/off) */
  339.     short  wc, hc;    /* width and height of the character in current font */
  340.     short  lins, cols;    /* width and height of the textwin in characters */
  341.     short  ln, cn;    /* the current line and column */
  342.     short  fl, ll;    /* first and last lines in the text buffer */
  343.     short  fdl, ldl;    /* first and last displayed lines */
  344.     short  fdc, ldc;    /* first and last displayed columns */
  345.     short  scrolled;    /* state of scrolling */
  346. } WINTEXT;
  347.  
  348. #define DEFINE_WINTEXT {\
  349.     0,\
  350.     0,\
  351.     COLUMNS+1, LINES,\
  352.     0,\
  353.     0,\
  354.     0, 0,\
  355.     0, 0,\
  356.     0,\
  357.     0, 0,\
  358.     0, 0,\
  359.     0, 0,\
  360.     0, LINES-1,\
  361.     0, LINES-1,\
  362.     0, 0,\
  363.     0\
  364. }
  365.  
  366. /* Structure for the characteristics of a virtual workstation. */
  367.  
  368. typedef struct vwrk {
  369.     int VdiHandle;        /* vdi workstation handle */
  370.     int XRes;            /* x resolution of screen in pixels */
  371.     int YRes;            /* y resolution of screen in pixels */
  372.     float AspectRatio;        /* the aspect ratio */
  373.     GRECT full;            /* x, y, w, and h for the full screen */
  374.     int ColorBits;        /* number of bit which represent a color */
  375.     unsigned short MaxRGB;    /* maximum number of displayable colors */
  376.     short TrueColor;        /* truecolor mode? */
  377.     uint PaletteSize;        /* size of the palette */
  378.     short GSPalette;        /* was palette installed by GS */
  379.     int *Palette;        /* pointer to Ghostscript's palette */
  380.     int *OldPalette;        /* pointer to the system palette */
  381.     int *ColorReg;        /* array containing the color register
  382.                    corresponding to a given vdi index */
  383.     int Wchar;            /* Character cell width */
  384.     int Hchar;            /* Character cell height */
  385.     int Wbox;            /* Character box width */
  386.     int Hbox;            /* Character box height */
  387. } VWRK;
  388.  
  389. /* Structure describing a GEM event. */
  390.  
  391. typedef struct event {
  392.     int WaitEvent;        /* which events to wait for */
  393.     int Event;            /* the current event */
  394.     int Message[8];        /* receive message buffer */
  395.     ushort SendMsg[8];        /* send message buffer */
  396.     int WaitButtonState;    /* which button state to wait for */
  397.     int ButtonState;        /* button state at time of event */
  398.     int Clicks;            /* Number of clicks detected */
  399.     int MouseX;            /* mouse x position at time of event */
  400.     int MouseY;            /* mouse y position at time of event */
  401.     int KeyState;        /* keyboard state at time of event */
  402.     int Key;            /* the key which was pressed */
  403.     int KeyMenu;        /* keyboard equivalent of a menu event */
  404.     int KeyScroll;        /* keyboard equivalent of a scroll event */
  405. } EVENT;
  406.  
  407. #define DEFINE_EVENT {\
  408.     0,                /* WaitEvent */\
  409.     0,                /* Event */\
  410.     {0, 0, 0, 0, 0, 0, 0, 0},    /* Message[] */\
  411.     {0, 0, 0, 0, 0, 0, 0, 0},    /* SendMsg[] */\
  412.     0,                /* WaitButtonState */\
  413.     0,              /* ButtonState */\
  414.     0,              /* Clicks */\
  415.     0,                /* MouseX */\
  416.     0,              /* MouseY */\
  417.     0,              /* KeyState */\
  418.     0,              /* Key */\
  419.     0,                /* KeyMenu */\
  420.     -1                /* KeyScroll */\
  421. }
  422.  
  423. /* Structure describing the bitmap images created by GS */
  424.  
  425. typedef struct graphic {
  426.     int PlotX;            /* x position of upper left corner of image */
  427.     int PlotY;            /* y position of upper left corner of image */
  428.     int XRes;            /* x pixels per inch */
  429.     int YRes;            /* y pixels per inch */
  430.     int Width;            /* width of image */
  431.     int Height;            /* height of image */
  432.     int StepX;            /* x increment cursor keys will move image */
  433.     int StepY;            /* y increment cursor keys will move image */
  434.     MFDB image;            /* MFDB describing the bitmap image */
  435.     MFDB screen;        /* MFDB describing the screen */
  436. } GRAPHIC;
  437.  
  438. /* Structure describing an individual page from a PostScript document. */
  439.  
  440. typedef struct pageinfo {
  441.     short extracted;
  442.     fpos_t start;
  443.     int       length;
  444. } PAGEINFO;
  445.  
  446. /* Structure describing a PostScript document. */
  447.  
  448. typedef struct document {
  449.     char name[MAXLEN];
  450.     int maxpages;
  451.     int numpages;
  452.     int currentpage;
  453.     PAGEINFO *pageinf;
  454. } DOCUMENT;
  455.  
  456. /* Structure for the Ghostscript program state. */
  457.  
  458. typedef struct pstate {
  459.     short ApId;            /* the GEM id for this application */
  460.     short MultiTOS;        /* MultiTOS is true if AES-Version >=0x400 */
  461.     short Windows;        /* are windows enabled? */
  462.     int   TopWin;        /* Handle of top window. */
  463.     short PSHelp;        /* use PostScript formatted help */
  464.     short SelectPages;        /* filter individual pages from input file */
  465.     short Device;               /* the current output device type */
  466.     short LastDevice;           /* the last active device type */
  467.     char CurrentDir[MAXLEN];    /* the current directory */
  468.     char DirSpec[MAXLEN];    /* dir selected with file selector */
  469.     char FileSel[MAXLEN];    /* file selected with the file selector */
  470.     char Infile[MAXLEN];    /* input file */
  471.     char Outfile[MAXLEN];    /* output file */
  472.     char Command[MAXLEN];    /* string for Ghostscript command */
  473.     char DevString[MAXLEN];    /* the name of the current device */
  474.     int PaletteCount;        /* # of palette entries which have been set */
  475.     short Chunky8;        /* flag indicating 8-bit chunky image format */
  476.     short Gdebug;        /* debug flag */
  477.     short Debug8;        /* when set, forces GS to use 8-bit color */
  478.     short Debug16;        /* when set, forces GS to use 16-bit color */
  479.     int pxy[8];            /* array for general x,y coodinates */
  480.     EVENT *Event;        /* the current event */
  481.     OBJECT *Pobject[NOBJS];    /* pointers to all non-menu objects */
  482.     DOCUMENT *Doc;        /* structure describing the current document */
  483. } PSTATE;
  484.  
  485. /* end ataridef.h */
  486.