|
|
1.1 ! root 1: #include "jigsaw.h" ! 2: ! 3: /*-------------------------- general definitions -----------------------------*/ ! 4: ! 5: HAB habMain = NULL; /* main thread anchor block handle */ ! 6: HMQ hmqMain = NULL; /* main thread queue handle */ ! 7: HWND hwndFrame = NULL; /* frame control handle */ ! 8: HWND hwndStatus = NULL; /* status dialog handle */ ! 9: HWND hwndClient = NULL; /* client area handle */ ! 10: HWND hwndZoomScrollBar= NULL; /* zoom scroll bar handle */ ! 11: HWND hwndMenu = NULL; /* Menu handle */ ! 12: HWND hwndStatusOption = NULL; /* status menu handle */ ! 13: HDC hdcClient = NULL; /* window dc handle */ ! 14: HPS hpsClient = NULL; /* client area Gpi ps handle */ ! 15: SIZEL sizlMaxClient; /* max client area size */ ! 16: HPS hpsPaint = NULL; /* ps for use in Main Thread */ ! 17: HRGN hrgnInvalid = NULL; /* handle to the invalid region */ ! 18: ! 19: HAB habAsync = NULL; /* async thread anchor block handle */ ! 20: HMQ hmqAsync = NULL; /* async thread queue handle */ ! 21: TID tidAsync; /* async thread id */ ! 22: SEL selStack; /* async thread stack selector */ ! 23: SHORT sPrty = -1; /* async thread priority */ ! 24: ! 25: HWND hwndHorzScroll = NULL; /* horizontal scroll bar window */ ! 26: HWND hwndVertScroll = NULL; /* vertical scroll bar window */ ! 27: ! 28: POINTS ptsScrollPos, ! 29: ptsOldScrollPos; ! 30: POINTS ptsScrollMax, ! 31: ptsHalfScrollMax; ! 32: POINTS ptsScrollLine; ! 33: POINTS ptsScrollPage; ! 34: ! 35: MATRIXLF matlfIdentity = { UNITY, 0, 0, 0, UNITY, 0, 0, 0, 1 }; ! 36: LONG lScale; /* current zoom level */ ! 37: POINTL ptlScaleRef; /* scalefactor, detects size change */ ! 38: ! 39: POINTL ptlOffset; ! 40: POINTL ptlBotLeft = { 0, 0}; ! 41: POINTL ptlTopRight = { 3000, 3000}; ! 42: POINTL ptlMoveStart; /* model space point at start of move */ ! 43: LONG lLastSegId; /* last segment id assigned to a piece */ ! 44: LONG lPickedSeg = 0L; /* seg id of piece selected for drag */ ! 45: POINTL ptlOffStart; /* segment xform xlate at move start */ ! 46: RECTL rclBounds; /* pict bounding box in model coords. */ ! 47: POINTL ptlOldMouse = {0L, 0L}; /* current mouse posn */ ! 48: POINTL ptlMouse = {0L, 0L}; /* current mouse posn */ ! 49: BOOL fButtonDownMain = FALSE; /* only drag if mouse down */ ! 50: BOOL fButtonDownAsync = FALSE; /* only drag if mouse down */ ! 51: ! 52: POINTL ptlUpdtRef; ! 53: POINTL aptlUpdt[3]; ! 54: BOOL fUpdtFirst; ! 55: BOOL fFirstLoad = TRUE; ! 56: ! 57: /*-------------------------- segment list ------------------------------------*/ ! 58: ! 59: PSEGLIST pslHead = NULL; /* head of the list */ ! 60: PSEGLIST pslTail = NULL; /* tail of the list */ ! 61: PSEGLIST pslPicked = NULL; /* picked segment's list member */ ! 62: ! 63: /*-------------------------- bitmap-related data -----------------------------*/ ! 64: ! 65: LOADINFO li; ! 66: PLOADINFO pli = &li; ! 67: ! 68: HPS hpsBitmapFile = NULL; /* bitmap straight from the ! 69: file */ ! 70: HDC hdcBitmapFile = NULL; ! 71: HBITMAP hbmBitmapFile = NULL; ! 72: ! 73: BITMAPINFOHEADER2 bmp2BitmapFile; ! 74: PBITMAPINFOHEADER2 pbmp2BitmapFile = &bmp2BitmapFile; ! 75: BITMAPINFOHEADER2 bmp2BitmapFileRef; ! 76: PBITMAPINFOHEADER2 pbmp2BitmapFileRef = &bmp2BitmapFileRef; ! 77: ! 78: HPS hpsBitmapSize = NULL; /* bitmap sized to the current ! 79: size */ ! 80: HDC hdcBitmapSize = NULL; ! 81: HBITMAP hbmBitmapSize = NULL; ! 82: ! 83: HPS hpsBitmapBuff = NULL; /* image composed here, copied to ! 84: scrn */ ! 85: HDC hdcBitmapBuff = NULL; ! 86: HBITMAP hbmBitmapBuff = NULL; ! 87: ! 88: HPS hpsBitmapSave = NULL; /* save part of screen during ! 89: dragging */ ! 90: HDC hdcBitmapSave = NULL; ! 91: HBITMAP hbmBitmapSave = NULL; ! 92: ! 93: BITMAPINFOHEADER2 bmp2BitmapSave; ! 94: PBITMAPINFOHEADER2 pbmp2BitmapSave = &bmp2BitmapSave; ! 95: ! 96: DEVOPENSTRUC dop = { NULL ! 97: , "DISPLAY" ! 98: , NULL ! 99: , NULL ! 100: , NULL ! 101: , NULL ! 102: , NULL ! 103: , NULL ! 104: , NULL }; ! 105: ! 106: ! 107: /*--------------------------- Miscellaneous ----------------------------------*/ ! 108: ! 109: ! 110: HMTX hmtxSzFmt; ! 111: ! 112: CHAR szFmt[50]; /* buffer used by sprintf() */ ! 113: CHAR szZoomFact[10]; ! 114: ! 115: HEV hevTerminate; ! 116: HEV hevDrawOn; ! 117: HEV hevMouse; ! 118: HEV hevLoadMsg; ! 119: HEV hevKillDraw; ! 120: ! 121: PSZ pszStartupMsg = "Welcome to Jigsaw"; ! 122: PSZ pszLoadMsg = "Patience, preparing puzzle pieces ..."; ! 123: PSZ pszError = "Error reading file."; ! 124: PSZ pszBlankMsg = ""; ! 125: ! 126: SWCNTRL swctl = { 0, 0, 0, 0, 0, SWL_VISIBLE, SWL_JUMPABLE, NULL, 0 }; ! 127: HSWITCH hsw; /* handle to a switch list entry */ ! 128: char szTitle[80]; /* Title bar text */ ! 129: ! 130: BOOL fErrMem = FALSE; /* set if alloc async stack fails */ ! 131: ! 132: LONG lByteAlignX, lByteAlignY; /* memory alignment constants */ ! 133: ! 134: ! 135:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.