|
|
1.1 ! root 1: #define INCL_BITMAPFILEFORMAT ! 2: ! 3: #define INCL_DOSMEMMGR ! 4: #define INCL_DOSINFOSEG ! 5: #define INCL_DOSPROCESS ! 6: #define INCL_DOSSEMAPHORES ! 7: ! 8: #define INCL_DEV ! 9: #define INCL_BASE ! 10: ! 11: #define INCL_WINSYS ! 12: #define INCL_WININPUT ! 13: #define INCL_WINMENUS ! 14: #define INCL_WINDIALOGS ! 15: #define INCL_WINFRAMEMGR ! 16: #define INCL_WINPOINTERS ! 17: #define INCL_WINWINDOWMGR ! 18: #define INCL_WINMESSAGEMGR ! 19: #define INCL_WINRECTANGLES ! 20: #define INCL_WINSCROLLBARS ! 21: #define INCL_WINSWITCHLIST ! 22: #define INCL_WINENTRYFIELDS ! 23: ! 24: ! 25: #define INCL_GPIPATHS ! 26: #define INCL_GPILCIDS ! 27: #define INCL_GPIREGIONS ! 28: #define INCL_GPICONTROL ! 29: #define INCL_GPIBITMAPS ! 30: #define INCL_GPIPRIMITIVES ! 31: #define INCL_GPITRANSFORMS ! 32: ! 33: #define INCL_ERRORS ! 34: ! 35: #include <os2.h> ! 36: ! 37: #define CALLBACK EXPENTRY ! 38: ! 39: #define APPMENU 1 /* app menu */ ! 40: #define APPTABLE 1 /* app accel table */ ! 41: #define APPICON 1 ! 42: ! 43: #define SM_EXIT 1 /* menu item ids */ ! 44: #define SM_ZOOM 10 ! 45: #define SM_HELP 20 ! 46: #define SM_FILE 30 ! 47: #define MENU_RESUME 2 ! 48: #define MENU_EXIT 3 ! 49: #define MENU_PRINT 11 ! 50: #define MENU_STATUS 12 ! 51: #define MENU_SHOW 13 ! 52: #define MENU_HIDE 14 ! 53: #define MENU_ZOOMIN 15 ! 54: #define MENU_ZOOMOUT 16 ! 55: #define MENU_BYTEALIGN 17 ! 56: #define MENU_HELP_EXTENDED 21 ! 57: #define MENU_HELP_INDEX 22 ! 58: #define MENU_HELP_KEYS 23 ! 59: #define MENU_LOAD 31 ! 60: #define MENU_JUMBLE 40 ! 61: #define MENU_DUMMY 9999 ! 62: ! 63: ! 64: #define TITLEBAR 1 /* string table ids */ ! 65: #define TERMINATE 2 ! 66: #define XFORMFAIL 3 ! 67: #define HELP_EXTENDED 4 ! 68: #define HELP_INDEX 5 ! 69: #define HELP_KEYS 6 ! 70: ! 71: #define IDD_OPEN 256 ! 72: #define IDD_STATUS 257 ! 73: #define IDD_NULL 0 ! 74: ! 75: #define EID_NAME 258 ! 76: ! 77: #define SID_ZOOMFACT 259 ! 78: #define SID_STATUS 260 ! 79: ! 80: #define HID_ZOOM 261 ! 81: ! 82: #define ADD_HEAD_SEG 1 ! 83: #define ADD_TAIL_SEG 2 ! 84: #define DEL_SEG 3 ! 85: #define MAKE_TAIL_SEG 4 ! 86: #define MAKE_HEAD_SEG 5 ! 87: #define PICTURE_CREATE 0 ! 88: #define PICTURE_UPDATE 1 ! 89: #define ZOOM_MAX 8 ! 90: #define ZOOM_IN 1 ! 91: #define ZOOM_OUT -1 ! 92: #define UNITY 65536L ! 93: #define STACKSIZE 4096 /* async thread stack size */ ! 94: ! 95: ! 96: /*----------------------- helper macros --------------------------------------*/ ! 97: ! 98: #define ROUND_DOWN_MOD( arg, mod) \ ! 99: { \ ! 100: if( arg < 0) \ ! 101: { \ ! 102: arg -= mod - 1; \ ! 103: arg += arg % mod; \ ! 104: } else \ ! 105: arg -= arg % mod; \ ! 106: } ! 107: ! 108: #define ROUND_UP_MOD( arg, mod) \ ! 109: { \ ! 110: if( arg < 0) \ ! 111: { \ ! 112: arg -= arg % mod; \ ! 113: } else \ ! 114: { \ ! 115: arg += mod - 1; \ ! 116: arg -= arg % mod; \ ! 117: } \ ! 118: } ! 119: ! 120: /* ! 121: * macro will convert BITMAPFILEHEADER2 to BITMAPFILEHEADER ! 122: */ ! 123: #define PBFH1(A) ((PBITMAPFILEHEADER) (A)) ! 124: /* ! 125: * macro will convert BITMAPINFOHEADER2 to BITMAPINFOHEADER ! 126: */ ! 127: #define PBMP1(A) ((PBITMAPINFOHEADER) (A)) ! 128: ! 129: /* macro will adjust structure type depending on wiether old or new ! 130: * BITMAPINFOHEADER is read in from a BMP file. ! 131: */ ! 132: #define ADJUSTED_PBMP(A) (((A)->cbFix == sizeof(BITMAPINFOHEADER)) \ ! 133: ? PBMP1(A) : (PVOID)(A)) ! 134: ! 135: ! 136: ! 137: ! 138: #define STATUS_SHOW(A) \ ! 139: { \ ! 140: if (A) { \ ! 141: WinSendMsg( hwndStatusOption, \ ! 142: MM_SETITEMATTR, \ ! 143: MPFROM2SHORT( MENU_SHOW, TRUE), \ ! 144: MPFROM2SHORT( MIA_DISABLED, ~MIA_DISABLED)); \ ! 145: } \ ! 146: else { \ ! 147: WinSendMsg( hwndStatusOption, \ ! 148: MM_SETITEMATTR, \ ! 149: MPFROM2SHORT( MENU_SHOW, TRUE), \ ! 150: MPFROM2SHORT( MIA_DISABLED, MIA_DISABLED)); \ ! 151: } \ ! 152: } ! 153: ! 154: ! 155: #define STATUS_HIDE(A) \ ! 156: { \ ! 157: if (A) { \ ! 158: WinSendMsg( hwndStatusOption, \ ! 159: MM_SETITEMATTR, \ ! 160: MPFROM2SHORT( MENU_HIDE, TRUE), \ ! 161: MPFROM2SHORT( MIA_DISABLED, ~MIA_DISABLED)); \ ! 162: } \ ! 163: else { \ ! 164: WinSendMsg( hwndStatusOption, \ ! 165: MM_SETITEMATTR, \ ! 166: MPFROM2SHORT( MENU_HIDE, TRUE), \ ! 167: MPFROM2SHORT( MIA_DISABLED, MIA_DISABLED)); \ ! 168: } \ ! 169: } ! 170: ! 171: /*----------------------- inter-thread messages ------------------------------*/ ! 172: ! 173: #define UM_DIE WM_USER+1 /* instruct async thread to terminate */ ! 174: #define UM_DRAW WM_USER+2 /* draw the current picture */ ! 175: #define UM_VSCROLL WM_USER+3 /* perform scroll by recalculating the */ ! 176: /* default viewing transform */ ! 177: #define UM_HSCROLL WM_USER+4 /* perform scroll by recalculating the */ ! 178: /* default viewing transform */ ! 179: #define UM_SIZING WM_USER+5 /* perform sizing by recalculating the */ ! 180: /* default viewing transform */ ! 181: #define UM_ZOOM WM_USER+6 /* zoom the picture by recalculating */ ! 182: /* the default viewing transform */ ! 183: #define UM_REDRAW WM_USER+8 /* redraw the entire client window */ ! 184: #define UM_JUMBLE WM_USER+9 /* scatter the pieces on the window */ ! 185: #define UM_LOAD WM_USER+10 /* load a bitmap from disk */ ! 186: #define UM_LEFTDOWN WM_USER+11 /* correlate and prepare to drag */ ! 187: #define UM_MOUSEMOVE WM_USER+12 /* remove, reposition, and redraw */ ! 188: #define UM_LEFTUP WM_USER+13 /* stop dragging */ ! 189: #define UM_CHAR WM_USER+14 /* a keyboard key */ ! 190: #define UM_LAST WM_USER+15 ! 191: ! 192: ! 193: /*------------------------- correlation parameters ---------------------------*/ ! 194: ! 195: #define HITS 1L /* maximum number of hits to return */ ! 196: #define DEPTH 2L /* max depth of seg calls to return */ ! 197: ! 198: /*-------------------------- old-style bitmap header -------------------------*/ ! 199: ! 200: typedef struct { ! 201: USHORT wType; ! 202: ULONG dwSize; ! 203: int xHotspot; ! 204: int yHotspot; ! 205: ULONG dwBitsOffset; ! 206: USHORT bmWidth; ! 207: USHORT bmHeight; ! 208: USHORT bmPlanes; ! 209: USHORT bmBitcount; ! 210: } RCBITMAP; ! 211: typedef RCBITMAP FAR *PRCBITMAP; ! 212: ! 213: /*-------------------------- bitmap-related data -----------------------------*/ ! 214: typedef struct _LOADINFO { /* li */ ! 215: HFILE hf; ! 216: CHAR szFileName[CCHMAXPATH]; ! 217: } LOADINFO, FAR *PLOADINFO; /* pli */ ! 218: ! 219: ! 220: ! 221: /*-------------------------- segment list ------------------------------------*/ ! 222: ! 223: typedef struct _SEGLIST { /* sl */ ! 224: LONG lSegId; ! 225: struct _SEGLIST FAR * pslPrev; ! 226: struct _SEGLIST FAR * pslNext; ! 227: POINTL ptlLocation; /* piece location, world coordinates */ ! 228: RECTL rclCurrent; /* segment bounding box, model coords */ ! 229: RECTL rclBitBlt; /* segment bounding box, world coords */ ! 230: POINTL aptlBitBlt[4]; /* BitBlt parameters */ ! 231: LONG lAdjacent[8]; /* adjacent segments in original pict */ ! 232: struct _SEGLIST FAR * pslNextIsland; /* next member in island list */ ! 233: BOOL fIslandMark; /* used for marking island members */ ! 234: POINTL aptlSides[12]; /* control points for piece outline */ ! 235: HDC hdcHole; /* used to punch hole in target */ ! 236: HPS hpsHole; ! 237: HBITMAP hbmHole; ! 238: HDC hdcFill; /* used to fill hole */ ! 239: HPS hpsFill; ! 240: HBITMAP hbmFill; ! 241: POINTL ptlModelXlate; /* lM31 and lM31 for piece */ ! 242: BOOL fVisible; /* TRUE iff should be drawn */ ! 243: } SEGLIST ; ! 244: typedef SEGLIST FAR *PSEGLIST; /* psl */ ! 245: typedef PSEGLIST FAR *PPSEGLIST; /* ppsl */ ! 246: ! 247: ! 248: /*------------------------- Function Prototypes ------------------------------*/ ! 249: ! 250: extern VOID CalcBounds( VOID); ! 251: extern VOID CalcSize( MPARAM mp1, MPARAM mp2); ! 252: extern VOID CalcTransform( HWND hwnd); ! 253: extern VOID CheckPsl( PSEGLIST psl); ! 254: extern MRESULT EXPENTRY ClientWndProc( HWND hwnd, USHORT msg, MPARAM mp1, ! 255: MPARAM mp2); ! 256: extern PSEGLIST Correlate( PPOINTL pptl); ! 257: extern BOOL CreateBitmapHdcHps( PHDC phdc, PHPS phps); ! 258: extern BOOL CreatePicture( SHORT sUpdate); ! 259: extern BOOL DoDraw( HPS hps, HRGN hrgn, BOOL fPaint); ! 260: extern VOID DoHorzScroll( VOID); ! 261: extern VOID DoVertScroll( VOID); ! 262: extern VOID DrawPiece( HPS hps, PSEGLIST psl, BOOL fFill); ! 263: extern BOOL DumpPicture( VOID); ! 264: extern VOID Finalize( VOID); ! 265: extern BOOL Initialize( VOID); ! 266: extern VOID Jumble( VOID); ! 267: extern VOID LeftDown( MPARAM mp); ! 268: extern VOID LeftUp( VOID); ! 269: extern VOID Load( PLOADINFO pli); ! 270: extern VOID cdecl main( VOID); ! 271: extern VOID MarkIsland( PSEGLIST pslMark, BOOL fMark); ! 272: /* ! 273: VOID MessageInt( HWND, INT, PCH); ! 274: */ ! 275: extern VOID MouseMove( MPARAM mp); ! 276: extern VOID MyMessageBox( HWND hWnd, PSZ psz); ! 277: extern VOID FAR NewThread( VOID); ! 278: extern BOOL PrepareBitmap( VOID); ! 279: extern BOOL ReadBitmap( HFILE hfile); ! 280: extern VOID Redraw( VOID); ! 281: extern VOID ReportError( HAB hab); ! 282: extern VOID ResetScrollBars( VOID); ! 283: extern BOOL SegListCheck( INT iLoc); ! 284: extern PSEGLIST SegListGet( LONG lSeg); ! 285: extern PSEGLIST SegListUpdate( USHORT usOperation, PSEGLIST pslUpdate); ! 286: extern BOOL SendCommand( USHORT usCommand, MPARAM mp1, MPARAM mp2); ! 287: extern VOID SetDVTransform( FIXED fx11, FIXED fx12, FIXED fx21, ! 288: FIXED fx22, ! 289: FIXED l31,FIXED l32, FIXED lType); ! 290: extern VOID SetRect( PSEGLIST psl); ! 291: extern VOID ToBottom( PSEGLIST pslDown); ! 292: extern VOID ToggleMenuItem( USHORT usMenuMajor, USHORT usMenuMinor, ! 293: PBOOL pfFlag); ! 294: extern VOID DisplayZoomFactor(LONG lScaleFactor); ! 295: extern MRESULT WndProcCommand( HWND hwnd, USHORT msg, MPARAM mp1, ! 296: MPARAM mp2); ! 297: extern MRESULT WndProcCreate( HWND hwnd); ! 298: extern MRESULT WndProcPaint( VOID); ! 299: /* ! 300: MRESULT WndProcSize( MPARAM, MPARAM); ! 301: */ ! 302: extern VOID Zoom(VOID); ! 303: extern MRESULT EXPENTRY CheapWndProc(HWND hwnd, USHORT msg, MPARAM mp1, ! 304: MPARAM mp2); ! 305: extern MRESULT EXPENTRY CheapWndProc(HWND hwnd, USHORT msg, MPARAM mp1, ! 306: MPARAM mp2); ! 307: extern MRESULT EXPENTRY StatusDlgProc(HWND hwnd, USHORT msg, MPARAM mp1, ! 308: MPARAM mp2);
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.