| [159] | 1 |  | 
|---|
|  | 2 | /*********************************************************************** | 
|---|
|  | 3 |  | 
|---|
|  | 4 | $Id: objcnr.c 574 2007-03-23 22:37:07Z gyoung $ | 
|---|
|  | 5 |  | 
|---|
|  | 6 | Object containers | 
|---|
|  | 7 |  | 
|---|
|  | 8 | Copyright (c) 1993-98 M. Kimes | 
|---|
| [574] | 9 | Copyright (c) 2005, 2007 Steven H. Levine | 
|---|
| [159] | 10 |  | 
|---|
|  | 11 | 24 May 05 SHL Rework for CNRITEM.szSubject | 
|---|
| [349] | 12 | 13 Jul 06 SHL Use Runtime_Error | 
|---|
| [488] | 13 | 01 Sep 06 SHL Do not complain for normal cancel | 
|---|
| [517] | 14 | 19 Oct 06 SHL Correct . and .. detect | 
|---|
| [531] | 15 | 03 Nov 06 SHL Renames | 
|---|
| [574] | 16 | 22 Mar 07 GKY Use QWL_USER | 
|---|
| [159] | 17 |  | 
|---|
|  | 18 | ***********************************************************************/ | 
|---|
|  | 19 |  | 
|---|
| [2] | 20 | #define INCL_DOS | 
|---|
|  | 21 | #define INCL_WIN | 
|---|
| [349] | 22 | #include <os2.h> | 
|---|
| [2] | 23 |  | 
|---|
|  | 24 | #include <stdio.h> | 
|---|
|  | 25 | #include <stdlib.h> | 
|---|
|  | 26 | #include <string.h> | 
|---|
|  | 27 | #include <ctype.h> | 
|---|
| [349] | 28 |  | 
|---|
| [2] | 29 | #include "fm3dll.h" | 
|---|
|  | 30 | #include "fm3dlg.h" | 
|---|
|  | 31 | #include "fm3str.h" | 
|---|
|  | 32 |  | 
|---|
| [551] | 33 | typedef struct | 
|---|
|  | 34 | { | 
|---|
| [2] | 35 | CHAR *filename; | 
|---|
| [551] | 36 | HWND hwndCnr; | 
|---|
| [2] | 37 | CHAR *stopflag; | 
|---|
| [551] | 38 | } | 
|---|
|  | 39 | DIRSIZE; | 
|---|
| [2] | 40 |  | 
|---|
| [551] | 41 | typedef struct | 
|---|
|  | 42 | { | 
|---|
| [2] | 43 | CHAR *dirname; | 
|---|
| [551] | 44 | CHAR stopflag; | 
|---|
|  | 45 | BOOL dying; | 
|---|
|  | 46 | BOOL working; | 
|---|
|  | 47 | } | 
|---|
|  | 48 | TEMP; | 
|---|
| [2] | 49 |  | 
|---|
| [349] | 50 | #pragma data_seg(DATA1) | 
|---|
| [2] | 51 |  | 
|---|
| [349] | 52 | static PSZ pszSrcFile = __FILE__; | 
|---|
| [2] | 53 |  | 
|---|
| [349] | 54 | static HWND objcnrwnd; | 
|---|
| [2] | 55 |  | 
|---|
| [531] | 56 | #pragma alloc_text(OBJCNR,ProcessDir,FillCnrsThread,ObjCnrDlgProc) | 
|---|
| [349] | 57 |  | 
|---|
| [551] | 58 | static VOID ProcessDir(HWND hwndCnr, CHAR * filename, PCNRITEM pciParent, | 
|---|
|  | 59 | CHAR * stopflag) | 
|---|
| [349] | 60 | { | 
|---|
| [551] | 61 | CHAR maskstr[CCHMAXPATH], *endpath, *p; | 
|---|
|  | 62 | ULONG nm, ulM; | 
|---|
|  | 63 | HDIR hdir; | 
|---|
|  | 64 | FILEFINDBUF3 *ffb, *fft; | 
|---|
|  | 65 | APIRET rc; | 
|---|
|  | 66 | RECORDINSERT ri; | 
|---|
|  | 67 | PCNRITEM pciP; | 
|---|
| [2] | 68 |  | 
|---|
| [551] | 69 | ffb = xmalloc(sizeof(FILEFINDBUF3), pszSrcFile, __LINE__); | 
|---|
|  | 70 | if (!ffb) | 
|---|
| [2] | 71 | return; | 
|---|
| [551] | 72 | strcpy(maskstr, filename); | 
|---|
|  | 73 | if (maskstr[strlen(maskstr) - 1] != '\\') | 
|---|
|  | 74 | strcat(maskstr, "\\"); | 
|---|
| [2] | 75 | endpath = &maskstr[strlen(maskstr)]; | 
|---|
| [551] | 76 | strcat(maskstr, "*"); | 
|---|
| [2] | 77 | hdir = HDIR_CREATE; | 
|---|
|  | 78 | nm = 1L; | 
|---|
|  | 79 | rc = DosFindFirst(filename, &hdir, | 
|---|
| [551] | 80 | FILE_NORMAL | FILE_READONLY | FILE_ARCHIVED | | 
|---|
|  | 81 | FILE_SYSTEM | FILE_HIDDEN | MUST_HAVE_DIRECTORY, | 
|---|
|  | 82 | ffb, sizeof(FILEFINDBUF3), &nm, FIL_STANDARD); | 
|---|
|  | 83 | if (!rc) | 
|---|
| [2] | 84 | DosFindClose(hdir); | 
|---|
|  | 85 |  | 
|---|
| [551] | 86 | if (rc) {                             /* work around furshluginer FAT bug... */ | 
|---|
|  | 87 | if (IsRoot(filename)) | 
|---|
| [2] | 88 | rc = 0; | 
|---|
|  | 89 | } | 
|---|
|  | 90 |  | 
|---|
| [551] | 91 | if ((!rc && (ffb->attrFile & FILE_DIRECTORY))) { | 
|---|
|  | 92 | pciP = | 
|---|
|  | 93 | WinSendMsg(hwndCnr, CM_ALLOCRECORD, MPFROMLONG(EXTRA_RECORD_BYTES2), | 
|---|
|  | 94 | MPFROMLONG(1L)); | 
|---|
|  | 95 | if (!pciP) { | 
|---|
| [2] | 96 | free(ffb); | 
|---|
|  | 97 | return; | 
|---|
|  | 98 | } | 
|---|
| [551] | 99 | strcpy(pciP->szFileName, filename); | 
|---|
| [2] | 100 | pciP->pszDispAttr = pciP->szDispAttr; | 
|---|
| [159] | 101 | pciP->pszSubject = pciP->szSubject; | 
|---|
|  | 102 | pciP->pszLongname = pciP->szLongname; | 
|---|
| [2] | 103 | pciP->pszDispAttr = pciP->szDispAttr; | 
|---|
| [159] | 104 | *pciP->szDispAttr = *pciP->szLongname = *pciP->szSubject = 0; | 
|---|
| [551] | 105 | if (strlen(filename) < 4) | 
|---|
| [2] | 106 | pciP->pszFileName = pciP->szFileName; | 
|---|
|  | 107 | else { | 
|---|
| [551] | 108 | p = strrchr(pciP->szFileName, '\\'); | 
|---|
|  | 109 | if (!p) | 
|---|
|  | 110 | pciP->pszFileName = pciP->szFileName; | 
|---|
|  | 111 | else if (*(p + 1)) | 
|---|
|  | 112 | p++; | 
|---|
| [2] | 113 | pciP->pszFileName = p; | 
|---|
|  | 114 | } | 
|---|
|  | 115 | pciP->rc.pszIcon = pciP->pszFileName; | 
|---|
| [551] | 116 | if (fForceUpper) | 
|---|
| [2] | 117 | strupr(pciP->szFileName); | 
|---|
| [551] | 118 | else if (fForceLower) | 
|---|
| [2] | 119 | strlwr(pciP->szFileName); | 
|---|
|  | 120 | pciP->rc.flRecordAttr |= CRA_RECORDREADONLY; | 
|---|
|  | 121 | } | 
|---|
|  | 122 | else { | 
|---|
|  | 123 | free(ffb); | 
|---|
|  | 124 | Dos_Error(MB_ENTER, | 
|---|
| [551] | 125 | rc, | 
|---|
|  | 126 | HWND_DESKTOP, | 
|---|
|  | 127 | pszSrcFile, | 
|---|
|  | 128 | __LINE__, GetPString(IDS_CANTFINDDIRTEXT), filename); | 
|---|
| [2] | 129 | return; | 
|---|
|  | 130 | } | 
|---|
|  | 131 | { | 
|---|
|  | 132 | HPOINTER hptr; | 
|---|
|  | 133 |  | 
|---|
|  | 134 | hptr = WinLoadFileIcon(pciP->szFileName, FALSE); | 
|---|
| [551] | 135 | if (hptr) | 
|---|
| [2] | 136 | pciP->rc.hptrIcon = hptr; | 
|---|
|  | 137 | } | 
|---|
| [551] | 138 | if (!pciP->rc.hptrIcon || pciP->rc.hptrIcon == hptrFile)      /* OS/2 bug bug bug bug */ | 
|---|
| [2] | 139 | pciP->rc.hptrIcon = hptrDir; | 
|---|
| [551] | 140 | memset(&ri, 0, sizeof(RECORDINSERT)); | 
|---|
|  | 141 | ri.cb = sizeof(RECORDINSERT); | 
|---|
|  | 142 | ri.pRecordOrder = (PRECORDCORE) CMA_END; | 
|---|
|  | 143 | ri.pRecordParent = (PRECORDCORE) pciParent; | 
|---|
|  | 144 | ri.zOrder = (USHORT) CMA_TOP; | 
|---|
|  | 145 | ri.cRecordsInsert = 1L; | 
|---|
|  | 146 | ri.fInvalidateRecord = TRUE; | 
|---|
|  | 147 | if (!WinSendMsg(hwndCnr, CM_INSERTRECORD, MPFROMP(pciP), MPFROMP(&ri))) { | 
|---|
| [2] | 148 | free(ffb); | 
|---|
|  | 149 | return; | 
|---|
|  | 150 | } | 
|---|
|  | 151 | hdir = HDIR_CREATE; | 
|---|
| [551] | 152 | if (!isalpha(*maskstr) || maskstr[1] != ':' || maskstr[2] != '\\' || | 
|---|
|  | 153 | ((driveflags[toupper(*maskstr) - 'A'] & DRIVE_REMOTE) && fRemoteBug)) | 
|---|
| [2] | 154 | ulM = 1L; | 
|---|
|  | 155 | else | 
|---|
| [551] | 156 | ulM = min(FilesToGet, 225); | 
|---|
|  | 157 | if (ulM > 1L) { | 
|---|
|  | 158 | fft = xrealloc(ffb, sizeof(FILEFINDBUF3) * ulM, pszSrcFile, __LINE__); | 
|---|
|  | 159 | if (!fft) | 
|---|
| [2] | 160 | ulM = 1L; | 
|---|
|  | 161 | else | 
|---|
|  | 162 | ffb = fft; | 
|---|
|  | 163 | } | 
|---|
|  | 164 | nm = ulM; | 
|---|
|  | 165 | rc = DosFindFirst(maskstr, &hdir, | 
|---|
| [551] | 166 | FILE_NORMAL | FILE_READONLY | FILE_ARCHIVED | | 
|---|
|  | 167 | FILE_SYSTEM | FILE_HIDDEN | MUST_HAVE_DIRECTORY, ffb, | 
|---|
|  | 168 | sizeof(FILEFINDBUF3) * ulM, &nm, FIL_STANDARD); | 
|---|
|  | 169 | if (!rc) { | 
|---|
| [2] | 170 |  | 
|---|
| [551] | 171 | register PBYTE fb = (PBYTE) ffb; | 
|---|
|  | 172 | FILEFINDBUF3 *pffbFile; | 
|---|
|  | 173 | ULONG x; | 
|---|
| [2] | 174 |  | 
|---|
| [551] | 175 | while (!rc) { | 
|---|
|  | 176 | for (x = 0L; x < nm; x++) { | 
|---|
|  | 177 | pffbFile = (FILEFINDBUF3 *) fb; | 
|---|
|  | 178 | if (*stopflag) | 
|---|
|  | 179 | break; | 
|---|
|  | 180 | if ((pffbFile->attrFile & FILE_DIRECTORY) && | 
|---|
| [517] | 181 | // Skip . and .. | 
|---|
| [551] | 182 | (pffbFile->achName[0] != '.' || | 
|---|
| [517] | 183 | (pffbFile->achName[1] && | 
|---|
| [551] | 184 | (pffbFile->achName[1] != '.' || pffbFile->achName[2])))) { | 
|---|
|  | 185 | strcpy(endpath, pffbFile->achName); | 
|---|
|  | 186 | ProcessDir(hwndCnr, maskstr, pciP, stopflag); | 
|---|
|  | 187 | } | 
|---|
|  | 188 | if (!pffbFile->oNextEntryOffset) | 
|---|
|  | 189 | break; | 
|---|
|  | 190 | fb += pffbFile->oNextEntryOffset; | 
|---|
| [2] | 191 | } | 
|---|
|  | 192 | DosSleep(0L); | 
|---|
| [551] | 193 | if (*stopflag) | 
|---|
|  | 194 | break; | 
|---|
| [2] | 195 | nm = ulM; | 
|---|
| [551] | 196 | rc = DosFindNext(hdir, ffb, sizeof(FILEFINDBUF3) * ulM, &nm); | 
|---|
| [2] | 197 | } | 
|---|
|  | 198 | DosFindClose(hdir); | 
|---|
|  | 199 | } | 
|---|
|  | 200 | free(ffb); | 
|---|
| [551] | 201 | WinSendMsg(hwndCnr, CM_INVALIDATERECORD, MPFROMP(&pciP), | 
|---|
|  | 202 | MPFROM2SHORT(1, 0)); | 
|---|
| [2] | 203 | } | 
|---|
|  | 204 |  | 
|---|
| [551] | 205 | static VOID FillCnrsThread(VOID * args) | 
|---|
| [349] | 206 | { | 
|---|
| [551] | 207 | HAB hab; | 
|---|
|  | 208 | HMQ hmq; | 
|---|
|  | 209 | DIRSIZE *dirsize = (DIRSIZE *) args; | 
|---|
| [2] | 210 |  | 
|---|
| [551] | 211 | if (!dirsize) | 
|---|
| [2] | 212 | return; | 
|---|
|  | 213 |  | 
|---|
|  | 214 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 215 |  | 
|---|
|  | 216 | hab = WinInitialize(0); | 
|---|
| [551] | 217 | if (hab) { | 
|---|
|  | 218 | hmq = WinCreateMsgQueue(hab, 0); | 
|---|
|  | 219 | if (hmq) { | 
|---|
|  | 220 | WinCancelShutdown(hmq, TRUE); | 
|---|
|  | 221 | ProcessDir(dirsize->hwndCnr, dirsize->filename, (PCNRITEM) NULL, | 
|---|
|  | 222 | dirsize->stopflag); | 
|---|
| [2] | 223 | DosPostEventSem(CompactSem); | 
|---|
|  | 224 | WinDestroyMsgQueue(hmq); | 
|---|
|  | 225 | } | 
|---|
|  | 226 | WinTerminate(hab); | 
|---|
|  | 227 | } | 
|---|
| [551] | 228 | PostMsg(WinQueryWindow(dirsize->hwndCnr, QW_PARENT), UM_CONTAINER_FILLED, | 
|---|
|  | 229 | MPVOID, MPVOID); | 
|---|
| [2] | 230 | free(dirsize); | 
|---|
|  | 231 | } | 
|---|
|  | 232 |  | 
|---|
| [551] | 233 | MRESULT EXPENTRY ObjCnrDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 
|---|
| [349] | 234 | { | 
|---|
| [2] | 235 | TEMP *data; | 
|---|
|  | 236 |  | 
|---|
| [551] | 237 | switch (msg) { | 
|---|
|  | 238 | case WM_INITDLG: | 
|---|
|  | 239 | if (objcnrwnd) { | 
|---|
|  | 240 | Runtime_Error(pszSrcFile, __LINE__, "objcnrwnd set"); | 
|---|
|  | 241 | WinSetWindowPos(objcnrwnd, HWND_TOP, 0, 0, 0, 0, | 
|---|
|  | 242 | SWP_RESTORE | SWP_SHOW | SWP_ACTIVATE | SWP_ZORDER); | 
|---|
|  | 243 | WinDismissDlg(hwnd, 0); | 
|---|
|  | 244 | break; | 
|---|
|  | 245 | } | 
|---|
|  | 246 | if (!mp2) { | 
|---|
|  | 247 | Runtime_Error(pszSrcFile, __LINE__, "mp2 NULL"); | 
|---|
|  | 248 | WinDismissDlg(hwnd, 0); | 
|---|
|  | 249 | break; | 
|---|
|  | 250 | } | 
|---|
|  | 251 | objcnrwnd = hwnd; | 
|---|
|  | 252 | data = xmallocz(sizeof(TEMP), pszSrcFile, __LINE__); | 
|---|
|  | 253 | if (!data) { | 
|---|
|  | 254 | WinDismissDlg(hwnd, 0); | 
|---|
|  | 255 | break; | 
|---|
|  | 256 | } | 
|---|
|  | 257 | data->dirname = (CHAR *) mp2; | 
|---|
| [574] | 258 | WinSetWindowPtr(hwnd, QWL_USER, (PVOID) data); | 
|---|
| [551] | 259 | if (*data->dirname) | 
|---|
|  | 260 | WinSetDlgItemText(hwnd, OBJCNR_DIR, data->dirname); | 
|---|
|  | 261 | { | 
|---|
|  | 262 | DIRSIZE *dirsize; | 
|---|
|  | 263 |  | 
|---|
|  | 264 | dirsize = xmalloc(sizeof(DIRSIZE), pszSrcFile, __LINE__); | 
|---|
|  | 265 | if (!dirsize) { | 
|---|
|  | 266 | WinDismissDlg(hwnd, 0); | 
|---|
|  | 267 | break; | 
|---|
| [2] | 268 | } | 
|---|
| [551] | 269 | dirsize->stopflag = (CHAR *) & data->stopflag; | 
|---|
|  | 270 | dirsize->filename = data->dirname; | 
|---|
|  | 271 | dirsize->hwndCnr = WinWindowFromID(hwnd, OBJCNR_CNR); | 
|---|
|  | 272 | if (_beginthread(FillCnrsThread, NULL, 65536 * 8, (PVOID) dirsize) == | 
|---|
|  | 273 | -1) { | 
|---|
|  | 274 | Runtime_Error(pszSrcFile, __LINE__, | 
|---|
|  | 275 | GetPString(IDS_COULDNTSTARTTHREADTEXT)); | 
|---|
|  | 276 | free(dirsize); | 
|---|
|  | 277 | WinDismissDlg(hwnd, 0); | 
|---|
|  | 278 | break; | 
|---|
| [349] | 279 | } | 
|---|
| [551] | 280 | else | 
|---|
|  | 281 | data->working = TRUE; | 
|---|
|  | 282 | } | 
|---|
|  | 283 | PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID); | 
|---|
|  | 284 | break; | 
|---|
| [2] | 285 |  | 
|---|
| [551] | 286 | case UM_SETUP: | 
|---|
|  | 287 | // WinEnableWindowUpdate(WinWindowFromID(hwnd,OBJCNR_CNR),FALSE); | 
|---|
|  | 288 | { | 
|---|
|  | 289 | CNRINFO cnri; | 
|---|
| [2] | 290 |  | 
|---|
| [551] | 291 | memset(&cnri, 0, sizeof(CNRINFO)); | 
|---|
|  | 292 | cnri.cb = sizeof(CNRINFO); | 
|---|
|  | 293 | WinSendDlgItemMsg(hwnd, OBJCNR_CNR, CM_QUERYCNRINFO, | 
|---|
|  | 294 | MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO))); | 
|---|
|  | 295 | cnri.cyLineSpacing = 0; | 
|---|
|  | 296 | cnri.cxTreeIndent = 12L; | 
|---|
|  | 297 | cnri.pszCnrTitle = GetPString(IDS_WORKINGTEXT); | 
|---|
|  | 298 | cnri.flWindowAttr = CV_TREE | CV_FLOW | | 
|---|
|  | 299 | CA_CONTAINERTITLE | CA_TITLESEPARATOR | CA_TREELINE; | 
|---|
|  | 300 | if (WinQueryWindowUShort(hwnd, QWS_ID) == QTREE_FRAME) | 
|---|
|  | 301 | cnri.flWindowAttr |= CV_MINI; | 
|---|
|  | 302 | WinSendDlgItemMsg(hwnd, OBJCNR_CNR, CM_SETCNRINFO, MPFROMP(&cnri), | 
|---|
|  | 303 | MPFROMLONG(CMA_FLWINDOWATTR | CMA_LINESPACING | | 
|---|
|  | 304 | CMA_CXTREEINDENT)); | 
|---|
|  | 305 | } | 
|---|
|  | 306 | return 0; | 
|---|
| [2] | 307 |  | 
|---|
| [551] | 308 | case UM_CONTAINER_FILLED: | 
|---|
|  | 309 | WinSetDlgItemText(hwnd, OBJCNR_NOTE, NullStr); | 
|---|
| [2] | 310 | //      WinEnableWindowUpdate(WinWindowFromID(hwnd,OBJCNR_CNR),TRUE); | 
|---|
| [551] | 311 | WinSendDlgItemMsg(hwnd, OBJCNR_CNR, CM_INVALIDATERECORD, MPVOID, | 
|---|
|  | 312 | MPFROM2SHORT(0, CMA_ERASE | CMA_INVALIDATE)); | 
|---|
|  | 313 | data = INSTDATA(hwnd); | 
|---|
|  | 314 | if (data) { | 
|---|
|  | 315 | data->working = FALSE; | 
|---|
|  | 316 | if (data->dying) | 
|---|
|  | 317 | WinDismissDlg(hwnd, 0); | 
|---|
|  | 318 | { | 
|---|
|  | 319 | PCNRITEM pci; | 
|---|
|  | 320 | USHORT id; | 
|---|
| [2] | 321 |  | 
|---|
| [551] | 322 | id = WinQueryWindowUShort(hwnd, QWS_ID); | 
|---|
|  | 323 | pci = (PCNRITEM) WinSendDlgItemMsg(hwnd, OBJCNR_CNR, | 
|---|
|  | 324 | CM_QUERYRECORD, | 
|---|
|  | 325 | MPVOID, | 
|---|
|  | 326 | MPFROM2SHORT(CMA_FIRST, | 
|---|
|  | 327 | CMA_ITEMORDER)); | 
|---|
|  | 328 | if (pci && (INT) pci != -1) { | 
|---|
|  | 329 | ExpandAll(WinWindowFromID(hwnd, OBJCNR_CNR), TRUE, pci); | 
|---|
|  | 330 | if (id == QTREE_FRAME) | 
|---|
|  | 331 | pci = (PCNRITEM) WinSendDlgItemMsg(hwnd, OBJCNR_CNR, | 
|---|
|  | 332 | CM_QUERYRECORD, | 
|---|
|  | 333 | MPFROMP(pci), | 
|---|
|  | 334 | MPFROM2SHORT(CMA_FIRSTCHILD, | 
|---|
|  | 335 | CMA_ITEMORDER)); | 
|---|
|  | 336 | } | 
|---|
|  | 337 | if ((!pci || (INT) pci == -1) && id == QTREE_FRAME) { | 
|---|
|  | 338 | Notify(GetPString(IDS_NODIRSUNDERTEXT)); | 
|---|
|  | 339 | WinDismissDlg(hwnd, 0); | 
|---|
|  | 340 | break; | 
|---|
|  | 341 | } | 
|---|
| [2] | 342 | } | 
|---|
| [551] | 343 | } | 
|---|
|  | 344 | return 0; | 
|---|
| [2] | 345 |  | 
|---|
| [551] | 346 | case WM_CONTROL: | 
|---|
|  | 347 | switch (SHORT1FROMMP(mp1)) { | 
|---|
|  | 348 | case OBJCNR_CNR: | 
|---|
|  | 349 | if (SHORT2FROMMP(mp1) == CN_ENTER) { | 
|---|
| [2] | 350 |  | 
|---|
| [551] | 351 | PCNRITEM pci = (PCNRITEM) ((PNOTIFYRECORDENTER) mp2)->pRecord; | 
|---|
| [2] | 352 |  | 
|---|
| [551] | 353 | if (pci && (INT) pci != -1) | 
|---|
|  | 354 | WinSendDlgItemMsg(hwnd, DID_OK, BM_CLICK, MPVOID, MPVOID); | 
|---|
| [2] | 355 | } | 
|---|
| [551] | 356 | break; | 
|---|
|  | 357 | } | 
|---|
|  | 358 | return 0; | 
|---|
| [2] | 359 |  | 
|---|
| [551] | 360 | case WM_COMMAND: | 
|---|
|  | 361 | switch (SHORT1FROMMP(mp1)) { | 
|---|
|  | 362 | case IDM_HELP: | 
|---|
|  | 363 | if (hwndHelp) { | 
|---|
| [2] | 364 |  | 
|---|
| [551] | 365 | USHORT id; | 
|---|
| [2] | 366 |  | 
|---|
| [551] | 367 | id = WinQueryWindowUShort(hwnd, QWS_ID); | 
|---|
| [2] | 368 |  | 
|---|
| [551] | 369 | if (id == QTREE_FRAME) | 
|---|
|  | 370 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP, | 
|---|
|  | 371 | MPFROM2SHORT(HELP_QUICKTREE, 0), | 
|---|
|  | 372 | MPFROMSHORT(HM_RESOURCEID)); | 
|---|
|  | 373 | else | 
|---|
|  | 374 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP, | 
|---|
|  | 375 | MPFROM2SHORT(HELP_OBJECTPATH, 0), | 
|---|
|  | 376 | MPFROMSHORT(HM_RESOURCEID)); | 
|---|
|  | 377 | } | 
|---|
|  | 378 | break; | 
|---|
| [2] | 379 |  | 
|---|
| [551] | 380 | case OBJCNR_DESKTOP: | 
|---|
|  | 381 | case DID_OK: | 
|---|
|  | 382 | data = INSTDATA(hwnd); | 
|---|
|  | 383 | if (data) { | 
|---|
| [2] | 384 |  | 
|---|
| [551] | 385 | PCNRITEM pci; | 
|---|
| [2] | 386 |  | 
|---|
| [551] | 387 | if (data->working) { | 
|---|
|  | 388 | Runtime_Error(pszSrcFile, __LINE__, "working unexpected"); | 
|---|
|  | 389 | break; | 
|---|
|  | 390 | } | 
|---|
|  | 391 | if (SHORT1FROMMP(mp1) == OBJCNR_DESKTOP) { | 
|---|
|  | 392 | WinDismissDlg(hwnd, 2); | 
|---|
|  | 393 | break; | 
|---|
|  | 394 | } | 
|---|
|  | 395 | pci = (PCNRITEM) WinSendDlgItemMsg(hwnd, OBJCNR_CNR, | 
|---|
|  | 396 | CM_QUERYRECORDEMPHASIS, | 
|---|
|  | 397 | MPFROMLONG(CMA_FIRST), | 
|---|
|  | 398 | MPFROMSHORT(CRA_CURSORED)); | 
|---|
|  | 399 | if (pci && (INT) pci != -1) | 
|---|
|  | 400 | strcpy(data->dirname, pci->szFileName); | 
|---|
|  | 401 | WinDismissDlg(hwnd, 1); | 
|---|
| [2] | 402 | } | 
|---|
| [551] | 403 | break; | 
|---|
| [2] | 404 |  | 
|---|
| [551] | 405 | case DID_CANCEL: | 
|---|
| [2] | 406 | data = INSTDATA(hwnd); | 
|---|
| [551] | 407 | if (data) { | 
|---|
|  | 408 | if (data->working) { | 
|---|
|  | 409 | data->dying = TRUE; | 
|---|
|  | 410 | data->stopflag = 0xff; | 
|---|
|  | 411 | break; | 
|---|
|  | 412 | } | 
|---|
|  | 413 | WinDismissDlg(hwnd, 0); | 
|---|
|  | 414 | } | 
|---|
| [2] | 415 | break; | 
|---|
| [551] | 416 | } | 
|---|
|  | 417 | return 0; | 
|---|
|  | 418 |  | 
|---|
|  | 419 | case WM_DESTROY: | 
|---|
|  | 420 | objcnrwnd = (HWND) 0; | 
|---|
|  | 421 | data = INSTDATA(hwnd); | 
|---|
|  | 422 | if (data) | 
|---|
|  | 423 | free(data); | 
|---|
|  | 424 | break; | 
|---|
| [2] | 425 | } | 
|---|
| [551] | 426 | return WinDefDlgProc(hwnd, msg, mp1, mp2); | 
|---|
| [2] | 427 | } | 
|---|