home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / VSCPPv8.zip / VACPP / IBMCPP / samples / TOOLKIT / PM / BMPSAMP / GLOBALS.C < prev    next >
C/C++ Source or Header  |  1994-11-17  |  7KB  |  151 lines

  1. /******************************************************************************
  2. *
  3. *  File Name   : GLOBALS.C
  4. *
  5. *  Description : global data for Jigsaw
  6. *
  7. *  Copyright (C) 1992 IBM Corporation
  8. *
  9. *      DISCLAIMER OF WARRANTIES.  The following [enclosed] code is
  10. *      sample code created by IBM Corporation. This sample code is not
  11. *      part of any standard or IBM product and is provided to you solely
  12. *      for  the purpose of assisting you in the development of your
  13. *      applications.  The code is provided "AS IS", without
  14. *      warranty of any kind.  IBM shall not be liable for any damages
  15. *      arising out of your use of the sample code, even if they have been
  16. *      advised of the possibility of such damages.                                                    *
  17. *
  18. ******************************************************************************/
  19.  
  20. #include "jigsaw.h"
  21.  
  22. /*-------------------------- general definitions -----------------------------*/
  23.  
  24. HAB       habMain          = NULLHANDLE;  /* main thread anchor block handle  */
  25. HMQ       hmqMain          = NULLHANDLE;  /* main thread queue handle         */
  26. HWND      hwndFrame        = NULLHANDLE;  /* frame control handle             */
  27. HWND      hwndClient       = NULLHANDLE;  /* client area handle               */
  28. HWND      hwndMenu         = NULLHANDLE;  /* Menu handle                      */
  29. HDC       hdcClient        = NULLHANDLE;  /* window dc handle                 */
  30. HPS       hpsClient        = NULLHANDLE;  /* client area Gpi ps handle        */
  31. SIZEL     sizlMaxClient;                  /* max client area size             */
  32. HPS       hpsPaint         = NULLHANDLE;  /* ps for use in Main Thread        */
  33. HRGN      hrgnInvalid      = NULLHANDLE;  /* handle to the invalid region     */
  34.  
  35. HAB       habAsync         = NULLHANDLE;  /* async thread anchor block handle */
  36. HMQ       hmqAsync         = NULLHANDLE;  /* async thread queue handle        */
  37. TID       tidAsync;                       /* async thread id                  */
  38. SEL       selStack;                       /* async thread stack selector      */
  39. SHORT     sPrty            = -1;          /* async thread priority            */
  40.  
  41. HWND      hwndHorzScroll   = NULLHANDLE;  /* horizontal scroll bar window     */
  42. HWND      hwndVertScroll   = NULLHANDLE;  /* vertical scroll bar window       */
  43.  
  44. POINTS    ptsScrollPos,
  45.           ptsOldScrollPos;
  46. POINTS    ptsScrollMax,
  47.           ptsHalfScrollMax;
  48. POINTS    ptsScrollLine;
  49. POINTS    ptsScrollPage;
  50.  
  51. MATRIXLF  matlfIdentity    = { UNITY, 0, 0, 0, UNITY, 0, 0, 0, 1 };
  52. LONG      lScale;                         /* current zoom level               */
  53. POINTL    ptlScaleRef;                    /* scalefactor, detects size change */
  54.  
  55. POINTL    ptlOffset;
  56. POINTL    ptlBotLeft       = { 0, 0};
  57. POINTL    ptlTopRight      = { 3000, 3000};
  58. POINTL    ptlMoveStart;                /* model space point at start of move  */
  59. LONG      lLastSegId;                  /* last segment id assigned to a piece */
  60. LONG      lPickedSeg       = 0L;       /* seg id of piece selected for drag   */
  61. POINTL    ptlOffStart;                 /* segment xform xlate at move start   */
  62. RECTL     rclBounds;                   /* pict bounding box in model coords.  */
  63. POINTL    ptlOldMouse      = {0L, 0L}; /* current mouse posn                  */
  64. POINTL    ptlMouse         = {0L, 0L}; /* current mouse posn                  */
  65. BOOL      fButtonDownMain  = FALSE;    /* only drag if mouse down             */
  66. BOOL      fButtonDownAsync = FALSE;    /* only drag if mouse down             */
  67.  
  68. POINTL    ptlUpdtRef;
  69. POINTL    aptlUpdt[3];
  70. BOOL      fUpdtFirst;
  71. BOOL      fFirstLoad       = TRUE;
  72. BOOL    fPictureAssembled = TRUE;
  73.  
  74. /*-------------------------- segment list ------------------------------------*/
  75.  
  76. PSEGLIST pslHead           = NULL;            /* head of the list             */
  77. PSEGLIST pslTail           = NULL;            /* tail of the list             */
  78. PSEGLIST pslPicked         = NULL;            /* picked segment's list member */
  79.  
  80. /*-------------------------- bitmap-related data -----------------------------*/
  81.  
  82. LOADINFO li;
  83. PLOADINFO pli = &li;
  84.  
  85. HPS        hpsBitmapFile      = NULLHANDLE; /* bitmap straight from the file */
  86.  
  87. HDC        hdcBitmapFile      = NULLHANDLE;
  88. HBITMAP    hbmBitmapFile      = NULLHANDLE;
  89.  
  90. BITMAPINFOHEADER2  bmp2BitmapFile;
  91. PBITMAPINFOHEADER2 pbmp2BitmapFile    = &bmp2BitmapFile;
  92. BITMAPINFOHEADER2  bmp2BitmapFileRef;
  93. PBITMAPINFOHEADER2 pbmp2BitmapFileRef = &bmp2BitmapFileRef;
  94.  
  95. HPS        hpsBitmapSize  = NULLHANDLE;  /* bitmap sized to the current size */
  96. HDC        hdcBitmapSize  = NULLHANDLE;
  97. HBITMAP    hbmBitmapSize  = NULLHANDLE;
  98.  
  99. HPS        hpsBitmapBuff  = NULLHANDLE;/* image composed here, copied to scrn */
  100. HDC        hdcBitmapBuff  = NULLHANDLE;
  101. HBITMAP    hbmBitmapBuff  = NULLHANDLE;
  102.  
  103. HPS        hpsBitmapSave  = NULLHANDLE;/* save part of screen during dragging */
  104. HDC        hdcBitmapSave  = NULLHANDLE;
  105. HBITMAP    hbmBitmapSave  = NULLHANDLE;
  106.  
  107. BITMAPINFOHEADER2  bmp2BitmapSave;
  108. PBITMAPINFOHEADER2 pbmp2BitmapSave    = &bmp2BitmapSave;
  109.  
  110. DEVOPENSTRUC dop = { NULL
  111.                      , "DISPLAY"
  112.                      , NULL
  113.                      , NULL
  114.                      , NULL
  115.                      , NULL
  116.                      , NULL
  117.                      , NULL
  118.                      , NULL };
  119.  
  120.  
  121. /*--------------------------- Miscellaneous ----------------------------------*/
  122.  
  123. /*
  124.  *   These event semaphores are loosely used to signal events between Jigsaw's
  125.  *   two threads.  No DosWaitEventSem() calls are made at this time, since,
  126.  *   without reworking the code, this could block out a thread that should
  127.  *   continually process the message queue.  Semaphores are "Reset" while
  128.  *   being used (to signal event) and "Posted" when the event is over.
  129.  */
  130.  
  131. HEV     hevTerminate;    /* event semaphore - terminating Jigsaw...           */
  132. HEV     hevDrawOn;       /* event semaphore - enable/disable drawing          */
  133. HEV     hevMouse;        /* event semaphore - enable/disable mouse tracking   */
  134. HEV     hevLoadingBitmap;/* event semaphore - loading a bitmap file from disk */
  135. HEV     hevKillDraw;     /* event semaphore - stop drawing                    */
  136.  
  137. PSZ     pszBlankMsg    = "";
  138.  
  139. SWCNTRL swctl       = { 0, 0, 0, 0, 0, SWL_VISIBLE, SWL_JUMPABLE, 0, 0 };
  140. HSWITCH hsw;                           /* handle to a switch list entry       */
  141. char    szTitle[MESSAGELEN];           /* Title bar text                      */
  142. char    szErrorTitle[MESSAGELEN];      /* error Title bar text                */
  143. LONG    lByteAlignX, lByteAlignY;      /* memory alignment constants          */
  144.  
  145. BOOL fErrMem      = FALSE;             /* set if alloc async stack fails      */
  146. BOOL BmpLoaded    = FALSE;
  147.  
  148. USHORT         Currentchecked = IDM_SIZE_FULL;
  149.  
  150. /******************************* end GLOBALS.C *******************************/
  151.