home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / os2sdk / os2sdk12 / linefrac / linefrac.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-07-05  |  19.6 KB  |  645 lines

  1. /**********************************************************************\
  2. *  General include for LineFractal application
  3. *
  4. *  Created by Microsoft Corporation, 1989
  5. *
  6. \**********************************************************************/
  7.  
  8. /*
  9.     Type definition
  10. */
  11. typedef double far * PDBL;
  12.  
  13.  
  14.  
  15. /*
  16.     Resource Ids for Linefractal application
  17. */
  18.  
  19. /* resources loaded via WinCreateStdWindow */
  20. #define IDR_LINEFRACTAL     0x01
  21.  
  22. /* pointers */
  23. #define IDR_TRACKINGPTR     0x10
  24. #define IDR_PASTINGPTR        0x11
  25. #define IDR_KOCH0        0x12
  26. #define IDR_KOCH1        0x13
  27. #define IDR_KOCH2        0x14
  28. #define IDR_KOCH3        0x15
  29.  
  30. /* dialog boxes */
  31. #define IDR_ABOUTDLG        0x20
  32. #define IDR_TIMERDELAYDLG    0x21
  33. #define IDR_BITMAPPARAMSDLG    0x22
  34. #define IDR_SWITCHDELAYDLG    0x23
  35. #define IDR_LINEATTRSDLG    0x24
  36. #define IDR_MARKERATTRSDLG    0x25
  37. #define IDR_AREAATTRSDLG    0x26
  38. #define IDR_IMAGEATTRSDLG    0x27
  39. #define IDR_MISCATTRSDLG    0x28
  40. #define IDR_DIMENSIONSDLG    0x29
  41. #define IDR_PTRPREFERENCESDLG    0x2A
  42.  
  43.  
  44.  
  45.  
  46. /**********************************************************************\
  47. *  IDD_ - ID for Dialog item
  48. *  IDM_ - ID for Menu commands
  49. *  IDS - ID for String table
  50. *  IDT - ID for Timers
  51. \**********************************************************************/
  52.  
  53. /* common dialog box control values */
  54. #define ID_NULL               0x0FE
  55. #define IDD_OK                  0x0FD
  56. #define IDD_CANCEL           0x0FC
  57.  
  58. /* redraw timer delay */
  59. #define IDD_MINDELAY        0x001
  60. #define IDD_MAXDELAY        0x002
  61.  
  62. /* bitmap parameters */
  63. #define IDD_BMCX         0x010
  64. #define IDD_BMCY         0x011
  65. #define IDD_BMPLANES        0x012
  66. #define IDD_BMBPP        0x013
  67.  
  68. /* thread-switch timer delay */
  69. #define IDD_SWITCHDELAY        0x020
  70.  
  71. /* line attributes */
  72. #define IDD_LINECOLOR        0x030
  73. #define IDD_LINEMIX        0x031
  74. #define IDD_LINEWIDTH        0x032
  75. #define IDD_LINEGEOMWIDTH    0x033
  76. #define IDD_LINETYPE        0x034
  77. #define IDD_LINEEND        0x035
  78. #define IDD_LINEJOIN        0x036
  79.  
  80. /* marker attributes */
  81. #define IDD_MARKCOLOR        0x040
  82. #define IDD_MARKBACKCOLOR    0x041
  83. #define IDD_MARKMIX        0x042
  84. #define IDD_MARKBACKMIX        0x043
  85. #define IDD_MARKSET        0x044
  86. #define IDD_MARKSYMBOL        0x045
  87. #define IDD_MARKCELLWIDTH    0x046
  88. #define IDD_MARKCELLHEIGHT    0x047
  89.  
  90. /* area attributes */
  91. #define IDD_AREACOLOR        0x050
  92. #define IDD_AREABACKCOLOR    0x051
  93. #define IDD_AREAMIX        0x052
  94. #define IDD_AREABACKMIX        0x053
  95. #define IDD_AREASET        0x054
  96. #define IDD_AREASYMBOL        0x055
  97. #define IDD_AREAREFX        0x056
  98. #define IDD_AREAREFY        0x057
  99.  
  100. /* image attributes */
  101. #define IDD_IMAGECOLOR        0x060
  102. #define IDD_IMAGEBACKCOLOR    0x061
  103. #define IDD_IMAGEMIX        0x062
  104. #define IDD_IMAGEBACKMIX     0x063
  105.  
  106. /* miscellaneous fractal attributes */
  107. #define IDD_RECURSION        0x070
  108. #define IDD_CPTMAX        0x071
  109. #define IDD_NUMSIDES        0x072
  110. #define IDD_ROTATION        0x073
  111.  
  112. /* fractal dimensions */
  113. #define IDD_XOFF         0x080
  114. #define IDD_YOFF         0x081
  115. #define IDD_XSCALE        0x082
  116. #define IDD_YSCALE        0x083
  117.  
  118. /* pointer preferences */
  119. #define IDD_PTRTHRESHOLD     0x090
  120. #define IDD_USERPTR0        0x091
  121. #define IDD_USERPTR1        0x092
  122. #define IDD_USERPTR2        0x093
  123. #define IDD_USERPTR3        0x094
  124.  
  125.  
  126.  
  127.  
  128. /* menus */
  129.  
  130. #define IDM_FILE         0x100
  131. #define IDM_LOAD          0x101
  132. #define IDM_SAVE          0x102
  133. #define IDM_ABOUT         0x103
  134.  
  135. #define IDM_EDIT         0x200
  136. #define IDM_SELECT         0x201
  137. #define IDM_SELECTALL         0x202
  138. #define IDM_CUT             0x203
  139. #define IDM_COPY          0x204
  140. #define IDM_PASTE         0x205
  141. #define IDM_USECLIPBRD         0x206
  142. #define IDM_PASTES         0x207
  143. #define IDM_PASTEDSA         0x208
  144. #define IDM_PASTEDSO         0x209
  145. #define IDM_PASTEDSX         0x20A
  146. #define IDM_PASTESN         0x20B
  147. #define IDM_PASTEDSAN         0x20C
  148. #define IDM_PASTEDSON         0x20D
  149. #define IDM_PASTEDSXN         0x20E
  150.  
  151. #define IDM_THREAD        0x300
  152. #define IDM_NEWTHREAD         0x310
  153. #define IDM_DCDIRECT          0x311
  154. #define IDM_DCMEMORY          0x312
  155. #define IDM_DCPOSTSCRIPT       0x313
  156. #define IDM_DCPROPRINTER       0x314
  157. #define IDM_THREADTOTOP         0x320
  158. #define IDM_THR0TOTOP          0x321
  159. #define IDM_THR1TOTOP          0x322
  160. #define IDM_THR2TOTOP          0x323
  161. #define IDM_THR3TOTOP          0x324
  162. #define IDM_THR4TOTOP          0x325
  163. #define IDM_THR5TOTOP          0x326
  164. #define IDM_THR6TOTOP          0x327
  165. #define IDM_THR7TOTOP          0x328
  166. #define IDM_THR8TOTOP          0x329
  167. #define IDM_THR9TOTOP          0x32A
  168. #define IDM_EDITTHREADPARAMS     0x330
  169. #define IDM_KILLTOPTHREAD     0x340
  170. #define IDM_KILLALLTHREADS     0x350
  171. #define IDM_AUTOSWITCH         0x360
  172. #define IDM_SWITCHDELAY         0x370
  173. #define IDM_UPDATEMENUS         0x380
  174. #define IDM_THREADINHERITANCE     0x390
  175.  
  176. #define IDM_CONTROL        0x400
  177. #define IDM_REDRAW         0x401
  178. #define IDM_ABORT         0x402
  179. #define IDM_CLEARBITMAP         0x403
  180. #define IDM_COPYBITMAPTOSCREEN     0x404
  181. #define IDM_SQUAREBITMAP      0x405
  182. #define IDM_RESIZEBITMAPTOWINDOW  0x406
  183. #define IDM_MOUSECHANGESRECURSION 0x407
  184. #define IDM_ANIMATEPTR         0x408
  185. #define IDM_PTRPREFERENCES     0x409
  186. #define IDM_TIMERDELAY         0x40A
  187.  
  188. #define IDM_FRACTAL        0x500
  189. #define IDM_FRACREDRAW         0x501
  190. #define IDM_SHARKTOOTH         0x502
  191. #define IDM_SAWTOOTH         0x503
  192. #define IDM_KOCH          0x504
  193. #define IDM_SPACEFILLER         0x505
  194. #define IDM_STOVE         0x506
  195. #define IDM_SQUAREWAVE         0x507
  196. #define IDM_HOURGLASS         0x508
  197.  
  198. #define IDM_PRIMITIVE        0x600
  199. #define IDM_PRIMREDRAW         0x601
  200. #define IDM_POLYLINE         0x602
  201. #define IDM_POLYFILLET         0x603
  202. #define IDM_POLYSPLINE         0x604
  203. #define IDM_POLYMARKER         0x605
  204. #define IDM_PEANO         0x606
  205.  
  206. #define IDM_ATTRIBUTES        0x700
  207. #define IDM_ATTRREDRAW         0x701
  208. #define IDM_LINEATTRS         0x702
  209. #define IDM_MARKERATTRS         0x703
  210. #define IDM_AREAATTRS         0x704
  211. #define IDM_IMAGEATTRS         0x705
  212. #define IDM_MISCATTRS         0x706
  213. #define IDM_DIMENSIONS         0x707
  214. #define IDM_DRAGDIMS         0x708
  215.  
  216. #define IDM_ENVIRONMENT        0x800
  217. #define IDM_AUTORESIZE         0x801
  218. #define IDM_AUTOSELECTDIMS     0x802
  219. #define IDM_CLEARONREDRAW     0x803
  220. #define IDM_AUTOSTARTREDRAW     0x804
  221. #define IDM_COLLECTBOUNDS     0x805
  222.  
  223.  
  224.  
  225.  
  226.  
  227. #define IDS_TITLE        1
  228. #define IDT_AUTOSTARTREDRAW    1
  229. #define IDT_AUTOSWITCH        2
  230.  
  231.  
  232.  
  233.  
  234. /************************************************************************
  235. *
  236. *   Constants
  237. *
  238. *   Miscellaneous constants.
  239. *
  240. ************************************************************************/
  241.  
  242. #define CCHSTR    12        /* work buffer size for MyGetWindowLong, etc */
  243.  
  244. #define MAX_POINT_COUNT     0x10000/sizeof(POINTL) /* number of points buffered up */
  245.  
  246. #define PI    3.1415926        /* useful in computing angles */
  247. #define TWO_PI    (2 * PI)        /*   ditto              */
  248.  
  249. #define EOLIST    0            /* End-of-list marker for xform */
  250.  
  251. #define NUM_PTR_SHAPES 4
  252.  
  253.  
  254.  
  255.  
  256. /************************************************************************
  257. *
  258. *   Aspect ratio structure.
  259. *
  260. ************************************************************************/
  261.  
  262. typedef struct _aspect
  263. {
  264.     LONG lHorz;
  265.     LONG lVert;
  266. } ASPECT;
  267.  
  268.  
  269.  
  270.  
  271. /************************************************************************
  272. *
  273. *   Line fractal transform structure.
  274. *
  275. *   The structure LINEFRAC defines a transform for a single line
  276. *   segment within a linefractal similarity transform.    A proper
  277. *   similarity transform would be a collection of segment transforms in
  278. *   the form of a linked list.
  279. *
  280. *   next        link to the next line segment
  281. *   angle        relative angle in radians, positive being
  282. *              counterclockwise
  283. *   length        relative length of a segment, as percentage of
  284. *              length segment on which transform was defined
  285. *   flip        orientation of transform at a segment
  286. *              FALSE ==> rotate transform by  angle[]
  287. *              TRUE  ==> rotate transform by -angle[]
  288. *                    (i.e. flip it)
  289. *
  290. ************************************************************************/
  291.  
  292. typedef struct _linefrac
  293. {
  294.     struct _linefrac *next;
  295.     double angle;
  296.     double length;
  297.     BOOL flip;
  298. } LINEFRAC;
  299. typedef LINEFRAC *PLINEFRAC;
  300.  
  301.  
  302.  
  303.  
  304. /************************************************************************
  305. *
  306. *   Transform-defaults structure.
  307. *
  308. ************************************************************************/
  309.  
  310. typedef struct
  311. {
  312.     PLINEFRAC pXform;
  313.     double xOff;
  314.     double yOff;
  315.     double xScale;
  316.     double yScale;
  317.     USHORT usSides;
  318. } XFORMDATA;
  319.  
  320.  
  321.  
  322.  
  323. /************************************************************************
  324. *
  325. *   Private bitmap info header.  This is to avoid having the extra
  326. *   cbFix space taken up in the per-thread data structure.  I use this
  327. *   only to store the data that will go into the real BITMAPINFOHEADER
  328. *   structure later.
  329. *
  330. ************************************************************************/
  331.  
  332. typedef struct
  333. {
  334.     USHORT cx;
  335.     USHORT cy;
  336.     USHORT cPlanes;
  337.     USHORT cBitCount;
  338. } MYBMINFO;
  339.  
  340.  
  341.  
  342.  
  343. #ifdef INCL_GLOBALS
  344. #define INCL_THREADS
  345. #endif
  346.  
  347. #ifdef INCL_THREADS
  348. /************************************************************************
  349. *
  350. *   Per-thread overhead structure.
  351. *
  352. ************************************************************************/
  353.  
  354. typedef struct _threadoh
  355. {
  356.     /* environment preferences */
  357.  
  358.     BOOL       fAutoSizePS;    /* PS resized on various events */
  359.     BOOL       fAutoSelectDims; /* scale and offset from fractal defaults */
  360.     BOOL       fClearOnRedraw;    /* clear surface at start of redraw */
  361.     BOOL       fAutoStartRedraw;/* random automatic redraw enabled */
  362.     BOOL       fCollectBounds;    /* collect bounds on primitives */
  363.  
  364.     BOOL       fFracRedraw;    /* redraw if fractal similarity xform changes */
  365.     BOOL       fPrimRedraw;    /* redraw if primitive changes */
  366.     BOOL       fAttrRedraw;    /* redraw if any attributes change */
  367.  
  368.     /* fractal attributes */
  369.  
  370.     LINEBUNDLE     lb;
  371.     ULONG     flLineAttrs;
  372. #define LFA_LINECOLOR        LBB_COLOR
  373. #define LFA_LINEMIX        LBB_MIX_MODE
  374. #define LFA_LINEWIDTH        LBB_WIDTH
  375. #define LFA_LINEGEOMWIDTH    LBB_GEOM_WIDTH
  376. #define LFA_LINETYPE        LBB_TYPE
  377. #define LFA_LINEEND        LBB_END
  378. #define LFA_LINEJOIN        LBB_JOIN
  379. #define LFA_LINEALL        (LBB_COLOR|LBB_MIX_MODE|LBB_WIDTH|LBB_GEOM_WIDTH|\
  380.                   LBB_TYPE|LBB_END|LBB_JOIN)
  381.  
  382.  
  383.     MARKERBUNDLE mb;
  384.     ULONG     flMarkerAttrs;
  385. #define LFA_MARKCOLOR        MBB_COLOR
  386. #define LFA_MARKBACKCOLOR    MBB_BACK_COLOR
  387. #define LFA_MARKMIX        MBB_MIX_MODE
  388. #define LFA_MARKBACKMIX     MBB_BACK_MIX_MODE
  389. #define LFA_MARKSET        MBB_SET
  390. #define LFA_MARKSYMBOL        MBB_SYMBOL
  391. #define LFA_MARKCELLWIDTH    MBB_BOX     /* part of sizfxCell field */
  392. #define LFA_MARKCELLHEIGHT    MBB_BOX     /* part of sizfxCell field */
  393. #define LFA_MARKALL        (MBB_COLOR|MBB_BACK_COLOR|MBB_MIX_MODE|MBB_BACK_MIX_MODE|\
  394.                   MBB_SET|MBB_SYMBOL|MBB_BOX)
  395.  
  396.  
  397.     AREABUNDLE     ab;
  398.     ULONG     flAreaAttrs;
  399. #define LFA_AREACOLOR        ABB_COLOR
  400. #define LFA_AREABACKCOLOR    ABB_BACK_COLOR
  401. #define LFA_AREAMIX        ABB_MIX_MODE
  402. #define LFA_AREABACKMIX     ABB_BACK_MIX_MODE
  403. #define LFA_AREASET        ABB_SET
  404. #define LFA_AREASYMBOL        ABB_SYMBOL
  405. #define LFA_AREAREFX        ABB_REF_POINT /* part of ptlRefPoint field */
  406. #define LFA_AREAREFY        ABB_REF_POINT /* part of ptlRefPoint field */
  407. #define LFA_AREAALL        (ABB_COLOR|ABB_BACK_COLOR|ABB_MIX_MODE|ABB_BACK_MIX_MODE|\
  408.                   ABB_SET|ABB_SYMBOL|ABB_REF_POINT)
  409.  
  410.  
  411.     IMAGEBUNDLE  ib;
  412.     ULONG     flImageAttrs;
  413. #define LFA_IMAGECOLOR        IBB_COLOR
  414. #define LFA_IMAGEBACKCOLOR    IBB_BACK_COLOR
  415. #define LFA_IMAGEMIX        IBB_MIX_MODE
  416. #define LFA_IMAGEBACKMIX    IBB_BACK_MIX_MODE
  417. #define LFA_IMAGEALL        (IBB_COLOR|IBB_BACK_COLOR|IBB_MIX_MODE|IBB_BACK_MIX_MODE)
  418.  
  419.  
  420.     /* miscellaneous other attributes */
  421.  
  422.     USHORT     usCurPrim;        /* primitive to draw with */
  423.     USHORT     usCurXform;        /* fractal to draw with */
  424.     USHORT     usRecursion;        /* level of recursion at which to draw */
  425.     USHORT     cptMax;            /* max batch size for point buffer */
  426.     USHORT     usPolygonSides;        /* number of sides on polygonal frame */
  427.     double     dblRotation;        /* rotation in radians of image */
  428.     double     dblXOff;         /* offset expressed as percentage of surface extents */
  429.     double     dblYOff;
  430.     double     dblXScale;        /* scale expressed as percentage of surface extents */
  431.     double     dblYScale;
  432.     ULONG      cxWCS;        /* dimensions of drawing in world space */
  433.     ULONG      cyWCS;
  434.  
  435.     ULONG      flMiscAttrs;
  436. #define LFA_CURPRIM        0x0001L
  437. #define LFA_CURXFORM        0x0002L
  438. #define LFA_RECURSION        0x0004L
  439. #define LFA_POLYGONSIDES    0x0008L
  440. #define LFA_CPTMAX        0x0010L
  441. #define LFA_XOFF        0x0020L
  442. #define LFA_YOFF        0x0040L
  443. #define LFA_XSCALE        0x0080L
  444. #define LFA_YSCALE        0x0100L
  445. #define LFA_ROTATION        0x0200L
  446. #define LFA_CXWCS        0x0400L
  447. #define LFA_CYWCS        0x0800L
  448.  
  449. #define LFA_MISCALL        0x0FFFL
  450.  
  451.  
  452.     /* fixed per-thread overhead */
  453.  
  454.     USHORT     dcType;        /* code identifying type of DC */
  455.     RECTL      rcl;        /* surface dimensions as a rectangle */
  456.     USHORT     cPlanes;     /* if bitmap, number of color planes */
  457.     USHORT     cBitCount;    /* if bitmap, number of color bits per pel */
  458.     ASPECT     AspectRatio;    /* DC's aspect ratio */
  459.  
  460.  
  461.     /********************************************************************
  462.     *
  463.     *  Per-process per-thread overhead.
  464.     *
  465.     *  Data after this point should not be saved
  466.     *  as part of a fractal context.
  467.     *
  468.     ********************************************************************/
  469.  
  470.     TID        tid;        /* thread id */
  471.     SEL        selStack;    /* thread stack selector */
  472.     HDC        hdc;
  473.     HBITMAP    hbm;
  474.     HPS        hps;
  475.     LONG       lSemRedraw;    /* redraw semaphore */
  476.     BOOL       fInterrupted;    /* fractal suicide flag recognized in recursion */
  477.     BOOL       fTimeToDie;    /* thread suicide flag */
  478.     BOOL       fUpdateAttrs;    /* TRUE --> new attributes since redraw */
  479.     BOOL       fBusy;        /* TRUE --> not waiting on semaphore */
  480.     PPOINTL    pptl;        /* fractal point buffer */
  481.     ULONG      cptl;        /* number of points in buffer */
  482.     RECTL      rclBounds;    /* bounds of last primitive drawn */
  483.     double     x;        /* current position */
  484.     double     y;
  485.     PMATRIXLF  pmatlf;        /* --> matrices for each side of ngon */
  486.  
  487. } THR;
  488. typedef THR *PTHR;
  489. #endif
  490.  
  491.  
  492.  
  493.  
  494. #ifdef INCL_GLOBALS
  495. /************************************************************************
  496. *
  497. *   Global data structure.  This makes it easier to save the state of
  498. *   the program to a file.
  499. *
  500. ************************************************************************/
  501.  
  502. #define MAX_THREADS 10
  503.  
  504. typedef struct _globaldata
  505. {
  506.     /********************************************************************
  507.     *
  508.     *  LineFrac session data.
  509.     *
  510.     *  The following can be saved to a file to record the user's
  511.     *  session.
  512.     *
  513.     ********************************************************************/
  514.  
  515.     BOOL      fAutoSwitch;         /* TRUE --> automatically cycle through threads */
  516.     BOOL      fUpdateMenusOnThreadSwitch;/* TRUE --> per-thread menu items not updated during animation */
  517.     BOOL      fThreadInheritance;     /* TRUE --> new threads are copies of top one */
  518.     USHORT    usSwitchDelay;         /* delay between automatic thread switches */
  519.     USHORT    usMinTimerDelay;         /* lower limit of random redraw delay */
  520.     USHORT    usMaxTimerDelay;         /* upper limit of random redraw delay */
  521.     BOOL      fMouseChangesRecursion;     /* TRUE --> mouse clicks change recursion */
  522.     BOOL      fAnimatePtr;         /* TRUE --> pointer changes with mouse movements */
  523.     USHORT    usUserPtr;         /* pointer to use when not animated */
  524.     USHORT    usPtrThreshold;         /* relates to speed of pointer animation */
  525.     USHORT    usRopIndex;         /* index into paste rop table */
  526.     BOOL      fUseClipbrd;         /* TRUE  --> edit operations use system clipboard */
  527.                      /* FALSE -->  ... use private bitmaps */
  528.     RECTL     rcl;             /* window dimensions */
  529.     USHORT    cThr;             /* number of threads */
  530.     USHORT    iThrTop;             /* top thread */
  531.  
  532.  
  533.     /********************************************************************
  534.     *
  535.     *  Per-process global data.
  536.     *
  537.     *  Data after this point should not be saved
  538.     *  as part of a linefrac session.
  539.     *
  540.     ********************************************************************/
  541.  
  542.     /* attributes:  user's input is put here; thread picks it up when
  543.      * told to redraw.
  544.      */
  545.  
  546.     BOOL     fUpdateAttrs;    /* TRUE --> no thread has read attrs yet */
  547.     LINEBUNDLE     lb;
  548.     ULONG     flLineAttrs;
  549.     MARKERBUNDLE mb;
  550.     ULONG     flMarkerAttrs;
  551.     AREABUNDLE     ab;
  552.     ULONG     flAreaAttrs;
  553.     IMAGEBUNDLE  ib;
  554.     ULONG     flImageAttrs;
  555.     USHORT     usCurPrim;     /* primitive to draw with */
  556.     USHORT     usCurXform;     /* fractal to draw with */
  557.     USHORT     usRecursion;     /* level of recursion at which to draw */
  558.     USHORT     cptMax;     /* max batch size for point buffer */
  559.     USHORT     usPolygonSides; /* number of sides on polygonal frame */
  560.     double     dblRotation;     /* rotation in radians of image */
  561.     double     dblXOff;     /* offset expressed as percentage of surface extents */
  562.     double     dblYOff;
  563.     double     dblXScale;     /* scale expressed as percentage of surface extents */
  564.     double     dblYScale;
  565.     ULONG     cxWCS;      /* dimensions of drawing in world space */
  566.     ULONG     cyWCS;
  567.     ULONG     flMiscAttrs;
  568.  
  569.     HAB       hab;
  570.     HMQ       hMsgQ;
  571.     HWND      hwnd;
  572.     HWND      hwndFrame;
  573.     HPOINTER  hptr[NUM_PTR_SHAPES];  /* array of pointer shapes to animate */
  574.     HPOINTER  hptrTrack;    /* pointer used when dragging a new rect */
  575.     HPOINTER  hptrPaste;    /* pointer used when dragging paste rect */
  576.     HPOINTER  hptrWait;     /* hourglass pointer for when top thread is busy */
  577.     USHORT    usPtrIncr;    /* +1 or -1, so pointer doesn't wrap in array */
  578.     USHORT    usPtrCounter;    /* counts WM_MOUSEMOVE messages */
  579.     USHORT    usCurPtr;     /* index into pointer array of current one */
  580.     BOOL      fFirstThread;    /* TRUE --> no threads initialized yet */
  581.     BOOL      fTimerOn;     /* TRUE --> auto redraw timer is on */
  582.     HDC       CutCopyDC;    /* DC for cut/copy private bit storage */
  583.     HPS       CutCopyPS;    /* PS for cut/copy private bit storage */
  584.     HBITMAP   CutCopyBM;    /* BM for cut/copy private bit storage */
  585.     RECTL     rclSelect;    /* most recently dragged selection rect */
  586.     RECTL     rclCutCopy;    /* most recent cut/copy rect */
  587.     ULONG     ulPasteROP;    /* BitBlt ROP to use when pasting */
  588.     BOOL      fHaveCutCopyDC;    /* TRUE --> cut/copy DC exists */
  589.     BOOL      fTracking;    /* TRUE --> dragging dimensions */
  590.     BOOL      fSelecting;    /* TRUE --> dragging cut/copy rect */
  591.     BOOL      fPasting;     /* TRUE --> dragging paste rect */
  592.     BOOL      fTempSelect;    /* TRUE --> selection rect just dragged */
  593.     BOOL      fShowSelectRc;    /* TRUE --> display selection rect */
  594.     BOOL      fHaveSelectRc;    /* TRUE --> have valid selection rect */
  595.     MYBMINFO  bm;        /* scratch space for various bitmap functions */
  596.     PTHR      pThrTop;        /* top thread */
  597.     PTHR      aThr[MAX_THREADS];/* array of threads */
  598.  
  599. } GLOBALDATA;
  600. #endif
  601.  
  602.  
  603.  
  604.  
  605. /************************************************************************
  606. *
  607. *   Handy macros to eliminate some typing.
  608. *
  609. ************************************************************************/
  610.  
  611. #define TOGGLE_BOOL(x)    ((x)=(!(x)))
  612.  
  613. #ifdef INCL_WINDIALOGS
  614.  
  615. #define SET_CHECK_BOX(x, y, z)                    \
  616.     WinSendDlgItemMsg((x),(y),BM_SETCHECK,            \
  617.         MPFROM2SHORT((z),0),0L)
  618.  
  619. #define TOGGLE_MENU_ITEM(x, y, z)                \
  620.     WinSendDlgItemMsg((x), FID_MENU, MM_SETITEMATTR,    \
  621.         MPFROM2SHORT((y),TRUE),                \
  622.         MPFROM2SHORT(MIA_CHECKED,(z)?MIA_CHECKED:0))
  623.  
  624. #define CHECK_MENU_ITEM(x, y)                    \
  625.     WinSendDlgItemMsg((x), FID_MENU, MM_SETITEMATTR,    \
  626.         MPFROM2SHORT((y),TRUE),                \
  627.         MPFROM2SHORT(MIA_CHECKED,MIA_CHECKED))
  628.  
  629. #define UNCHECK_MENU_ITEM(x, y)                 \
  630.     WinSendDlgItemMsg((x), FID_MENU, MM_SETITEMATTR,    \
  631.         MPFROM2SHORT((y),TRUE),                \
  632.         MPFROM2SHORT(MIA_CHECKED,0))
  633.  
  634. #define ENABLE_MENU_ITEM(x, y)                    \
  635.     WinSendDlgItemMsg((x), FID_MENU, MM_SETITEMATTR,    \
  636.         MPFROM2SHORT((y),TRUE),                \
  637.         MPFROM2SHORT(MIA_DISABLED,0))
  638.  
  639. #define DISABLE_MENU_ITEM(x, y)                 \
  640.     WinSendDlgItemMsg((x), FID_MENU, MM_SETITEMATTR,    \
  641.         MPFROM2SHORT((y),TRUE),                \
  642.         MPFROM2SHORT(MIA_DISABLED,MIA_DISABLED))
  643.  
  644. #endif
  645.