[159] | 1 |
|
---|
| 2 | /***********************************************************************
|
---|
| 3 |
|
---|
| 4 | $Id: objcnr.c 1063 2008-07-11 03:33:36Z 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
|
---|
[751] | 17 | 01 Aug 07 SHL Rework to sync with CNRITEM mods
|
---|
[756] | 18 | 03 Aug 07 GKY Enlarged and made setable everywhere Findbuf (speed file loading)
|
---|
[775] | 19 | 06 Aug 07 GKY Reduce DosSleep times (ticket 148)
|
---|
[783] | 20 | 13 Aug 07 SHL Avoid realloc - not needed; sanitize code
|
---|
| 21 | 13 Aug 07 SHL Move #pragma alloc_text to end for OpenWatcom compat
|
---|
[787] | 22 | 14 Aug 07 SHL Revert ProcessDir DosSleep to 0
|
---|
[985] | 23 | 29 Feb 08 GKY Use xfree where appropriate
|
---|
[159] | 24 |
|
---|
| 25 | ***********************************************************************/
|
---|
| 26 |
|
---|
[907] | 27 | #include <stdlib.h>
|
---|
| 28 | #include <string.h>
|
---|
| 29 | #include <ctype.h>
|
---|
| 30 | #include <process.h> // _beginthread
|
---|
| 31 |
|
---|
[2] | 32 | #define INCL_DOS
|
---|
| 33 | #define INCL_WIN
|
---|
[783] | 34 | #define INCL_DOSERRORS
|
---|
[841] | 35 | #define INCL_LONGLONG
|
---|
[2] | 36 |
|
---|
| 37 | #include "fm3dlg.h"
|
---|
| 38 | #include "fm3str.h"
|
---|
[907] | 39 | #include "errutil.h" // Dos_Error...
|
---|
| 40 | #include "strutil.h" // GetPString
|
---|
| 41 | #include "fm3dll.h"
|
---|
[2] | 42 |
|
---|
[1017] | 43 | #include "fortify.h"
|
---|
| 44 |
|
---|
[551] | 45 | typedef struct
|
---|
| 46 | {
|
---|
[2] | 47 | CHAR *filename;
|
---|
[551] | 48 | HWND hwndCnr;
|
---|
[2] | 49 | CHAR *stopflag;
|
---|
[551] | 50 | }
|
---|
| 51 | DIRSIZE;
|
---|
[2] | 52 |
|
---|
[551] | 53 | typedef struct
|
---|
| 54 | {
|
---|
[2] | 55 | CHAR *dirname;
|
---|
[551] | 56 | CHAR stopflag;
|
---|
| 57 | BOOL dying;
|
---|
| 58 | BOOL working;
|
---|
| 59 | }
|
---|
| 60 | TEMP;
|
---|
[2] | 61 |
|
---|
[349] | 62 | #pragma data_seg(DATA1)
|
---|
[2] | 63 |
|
---|
[349] | 64 | static PSZ pszSrcFile = __FILE__;
|
---|
[2] | 65 |
|
---|
[349] | 66 | static HWND objcnrwnd;
|
---|
[2] | 67 |
|
---|
[783] | 68 | static VOID ProcessDir(HWND hwndCnr,
|
---|
| 69 | CHAR *filename,
|
---|
| 70 | PCNRITEM pciParent,
|
---|
| 71 | CHAR *stopflag)
|
---|
[349] | 72 | {
|
---|
[551] | 73 | CHAR maskstr[CCHMAXPATH], *endpath, *p;
|
---|
[783] | 74 | ULONG ulFindCnt, ulFindMax;
|
---|
| 75 | ULONG ulBufBytes;
|
---|
[551] | 76 | HDIR hdir;
|
---|
[841] | 77 | PFILEFINDBUF3L pffbArray;
|
---|
[551] | 78 | APIRET rc;
|
---|
| 79 | RECORDINSERT ri;
|
---|
| 80 | PCNRITEM pciP;
|
---|
[783] | 81 | HPOINTER hptr;
|
---|
[2] | 82 |
|
---|
[841] | 83 | ulBufBytes = sizeof(FILEFINDBUF3L) * FilesToGet;
|
---|
[783] | 84 | pffbArray = xmalloc(ulBufBytes, pszSrcFile, __LINE__);
|
---|
| 85 | if (!pffbArray)
|
---|
| 86 | return; // Error already reported
|
---|
[551] | 87 | strcpy(maskstr, filename);
|
---|
| 88 | if (maskstr[strlen(maskstr) - 1] != '\\')
|
---|
| 89 | strcat(maskstr, "\\");
|
---|
[2] | 90 | endpath = &maskstr[strlen(maskstr)];
|
---|
[551] | 91 | strcat(maskstr, "*");
|
---|
[2] | 92 | hdir = HDIR_CREATE;
|
---|
[783] | 93 | ulFindCnt = 1;
|
---|
[838] | 94 | rc = xDosFindFirst(filename, &hdir,
|
---|
| 95 | FILE_NORMAL | FILE_READONLY | FILE_ARCHIVED |
|
---|
| 96 | FILE_SYSTEM | FILE_HIDDEN | MUST_HAVE_DIRECTORY,
|
---|
[841] | 97 | pffbArray, ulBufBytes, &ulFindCnt, FIL_STANDARDL);
|
---|
[551] | 98 | if (!rc)
|
---|
[2] | 99 | DosFindClose(hdir);
|
---|
[783] | 100 | // work around furshluginer FAT root bug
|
---|
| 101 | else if (IsRoot(filename))
|
---|
| 102 | rc = 0;
|
---|
[2] | 103 |
|
---|
[783] | 104 | if ((!rc && (pffbArray->attrFile & FILE_DIRECTORY))) {
|
---|
[731] | 105 | pciP = WinSendMsg(hwndCnr,
|
---|
| 106 | CM_ALLOCRECORD,
|
---|
[751] | 107 | MPFROMLONG(EXTRA_RECORD_BYTES),
|
---|
[761] | 108 | MPFROMLONG(1));
|
---|
[551] | 109 | if (!pciP) {
|
---|
[783] | 110 | Win_Error(hwndCnr, HWND_DESKTOP, pszSrcFile, __LINE__, "CM_ALLOCRECORD");
|
---|
[1039] | 111 | free(pffbArray);
|
---|
[2] | 112 | return;
|
---|
| 113 | }
|
---|
[730] | 114 | pciP->pszFileName = xstrdup(filename, pszSrcFile, __LINE__);
|
---|
[751] | 115 | pciP->pszDispAttr = NullStr;
|
---|
| 116 | pciP->pszSubject = NullStr;
|
---|
[762] | 117 | pciP->pszLongName = NullStr;
|
---|
[551] | 118 | if (strlen(filename) < 4)
|
---|
[751] | 119 | pciP->pszDisplayName = pciP->pszFileName;
|
---|
[2] | 120 | else {
|
---|
[730] | 121 | p = strrchr(pciP->pszFileName, '\\');
|
---|
[551] | 122 | if (!p)
|
---|
[756] | 123 | pciP->pszDisplayName = pciP->pszFileName;
|
---|
[551] | 124 | else if (*(p + 1))
|
---|
| 125 | p++;
|
---|
[751] | 126 | pciP->pszDisplayName = p;
|
---|
[2] | 127 | }
|
---|
[751] | 128 | pciP->rc.pszIcon = pciP->pszDisplayName;
|
---|
[551] | 129 | if (fForceUpper)
|
---|
[730] | 130 | strupr(pciP->pszFileName);
|
---|
[551] | 131 | else if (fForceLower)
|
---|
[730] | 132 | strlwr(pciP->pszFileName);
|
---|
[2] | 133 | pciP->rc.flRecordAttr |= CRA_RECORDREADONLY;
|
---|
| 134 | }
|
---|
| 135 | else {
|
---|
[1039] | 136 | free(pffbArray);
|
---|
[783] | 137 | Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
| 138 | GetPString(IDS_CANTFINDDIRTEXT), filename);
|
---|
[2] | 139 | return;
|
---|
| 140 | }
|
---|
| 141 |
|
---|
[783] | 142 | hptr = WinLoadFileIcon(pciP->pszFileName, FALSE);
|
---|
| 143 | if (hptr)
|
---|
| 144 | pciP->rc.hptrIcon = hptr;
|
---|
| 145 |
|
---|
[551] | 146 | if (!pciP->rc.hptrIcon || pciP->rc.hptrIcon == hptrFile) /* OS/2 bug bug bug bug */
|
---|
[2] | 147 | pciP->rc.hptrIcon = hptrDir;
|
---|
[783] | 148 |
|
---|
[551] | 149 | memset(&ri, 0, sizeof(RECORDINSERT));
|
---|
| 150 | ri.cb = sizeof(RECORDINSERT);
|
---|
| 151 | ri.pRecordOrder = (PRECORDCORE) CMA_END;
|
---|
| 152 | ri.pRecordParent = (PRECORDCORE) pciParent;
|
---|
| 153 | ri.zOrder = (USHORT) CMA_TOP;
|
---|
[771] | 154 | ri.cRecordsInsert = 1;
|
---|
[551] | 155 | ri.fInvalidateRecord = TRUE;
|
---|
| 156 | if (!WinSendMsg(hwndCnr, CM_INSERTRECORD, MPFROMP(pciP), MPFROMP(&ri))) {
|
---|
[1039] | 157 | free(pffbArray);
|
---|
[2] | 158 | return;
|
---|
| 159 | }
|
---|
| 160 | hdir = HDIR_CREATE;
|
---|
[551] | 161 | if (!isalpha(*maskstr) || maskstr[1] != ':' || maskstr[2] != '\\' ||
|
---|
| 162 | ((driveflags[toupper(*maskstr) - 'A'] & DRIVE_REMOTE) && fRemoteBug))
|
---|
[783] | 163 | ulFindMax = 1;
|
---|
[2] | 164 | else
|
---|
[783] | 165 | ulFindMax = FilesToGet;
|
---|
| 166 | ulFindCnt = ulFindMax;
|
---|
[838] | 167 | rc = xDosFindFirst(maskstr, &hdir,
|
---|
| 168 | FILE_NORMAL | FILE_READONLY | FILE_ARCHIVED |
|
---|
| 169 | FILE_SYSTEM | FILE_HIDDEN | MUST_HAVE_DIRECTORY,
|
---|
[841] | 170 | pffbArray, ulBufBytes, &ulFindCnt, FIL_STANDARDL);
|
---|
[551] | 171 | if (!rc) {
|
---|
[841] | 172 | PFILEFINDBUF3L pffbFile;
|
---|
[551] | 173 | ULONG x;
|
---|
[2] | 174 |
|
---|
[551] | 175 | while (!rc) {
|
---|
[783] | 176 | pffbFile = pffbArray;
|
---|
| 177 | for (x = 0; x < ulFindCnt; x++) {
|
---|
[551] | 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;
|
---|
[841] | 190 | pffbFile = (PFILEFINDBUF3L)((PBYTE)pffbFile + pffbFile->oNextEntryOffset);
|
---|
[783] | 191 | } // for
|
---|
[787] | 192 | DosSleep(0); // Let's others at same priority get some work done
|
---|
[551] | 193 | if (*stopflag)
|
---|
| 194 | break;
|
---|
[783] | 195 | ulFindCnt = ulFindMax;
|
---|
[850] | 196 | rc = xDosFindNext(hdir, pffbArray, ulBufBytes, &ulFindCnt, FIL_STANDARDL);
|
---|
[783] | 197 | } // while
|
---|
[2] | 198 | DosFindClose(hdir);
|
---|
| 199 | }
|
---|
[783] | 200 |
|
---|
| 201 | if (rc && rc != ERROR_NO_MORE_FILES) {
|
---|
| 202 | Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
| 203 | GetPString(IDS_CANTFINDDIRTEXT), filename);
|
---|
| 204 | }
|
---|
| 205 |
|
---|
[1039] | 206 | free(pffbArray);
|
---|
[551] | 207 | WinSendMsg(hwndCnr, CM_INVALIDATERECORD, MPFROMP(&pciP),
|
---|
| 208 | MPFROM2SHORT(1, 0));
|
---|
[2] | 209 | }
|
---|
| 210 |
|
---|
[551] | 211 | static VOID FillCnrsThread(VOID * args)
|
---|
[349] | 212 | {
|
---|
[551] | 213 | HAB hab;
|
---|
| 214 | HMQ hmq;
|
---|
[783] | 215 | DIRSIZE *dirsize = (DIRSIZE *)args;
|
---|
[2] | 216 |
|
---|
[1038] | 217 | # ifdef FORTIFY
|
---|
| 218 | Fortify_EnterScope();
|
---|
[1063] | 219 | # endif
|
---|
[783] | 220 | if (!dirsize) {
|
---|
| 221 | Runtime_Error(pszSrcFile, __LINE__, "no data");
|
---|
[2] | 222 | return;
|
---|
[783] | 223 | }
|
---|
[2] | 224 |
|
---|
| 225 | DosError(FERR_DISABLEHARDERR);
|
---|
| 226 |
|
---|
| 227 | hab = WinInitialize(0);
|
---|
[551] | 228 | if (hab) {
|
---|
| 229 | hmq = WinCreateMsgQueue(hab, 0);
|
---|
| 230 | if (hmq) {
|
---|
| 231 | WinCancelShutdown(hmq, TRUE);
|
---|
| 232 | ProcessDir(dirsize->hwndCnr, dirsize->filename, (PCNRITEM) NULL,
|
---|
| 233 | dirsize->stopflag);
|
---|
[2] | 234 | DosPostEventSem(CompactSem);
|
---|
| 235 | WinDestroyMsgQueue(hmq);
|
---|
| 236 | }
|
---|
| 237 | WinTerminate(hab);
|
---|
| 238 | }
|
---|
[551] | 239 | PostMsg(WinQueryWindow(dirsize->hwndCnr, QW_PARENT), UM_CONTAINER_FILLED,
|
---|
| 240 | MPVOID, MPVOID);
|
---|
[1039] | 241 | free(dirsize);
|
---|
[1017] | 242 | # ifdef FORTIFY
|
---|
| 243 | Fortify_LeaveScope();
|
---|
[1063] | 244 | # endif
|
---|
[2] | 245 | }
|
---|
| 246 |
|
---|
[551] | 247 | MRESULT EXPENTRY ObjCnrDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
[349] | 248 | {
|
---|
[2] | 249 | TEMP *data;
|
---|
| 250 |
|
---|
[551] | 251 | switch (msg) {
|
---|
| 252 | case WM_INITDLG:
|
---|
| 253 | if (objcnrwnd) {
|
---|
| 254 | Runtime_Error(pszSrcFile, __LINE__, "objcnrwnd set");
|
---|
| 255 | WinSetWindowPos(objcnrwnd, HWND_TOP, 0, 0, 0, 0,
|
---|
| 256 | SWP_RESTORE | SWP_SHOW | SWP_ACTIVATE | SWP_ZORDER);
|
---|
| 257 | WinDismissDlg(hwnd, 0);
|
---|
| 258 | break;
|
---|
| 259 | }
|
---|
| 260 | if (!mp2) {
|
---|
| 261 | Runtime_Error(pszSrcFile, __LINE__, "mp2 NULL");
|
---|
| 262 | WinDismissDlg(hwnd, 0);
|
---|
| 263 | break;
|
---|
| 264 | }
|
---|
| 265 | objcnrwnd = hwnd;
|
---|
| 266 | data = xmallocz(sizeof(TEMP), pszSrcFile, __LINE__);
|
---|
| 267 | if (!data) {
|
---|
| 268 | WinDismissDlg(hwnd, 0);
|
---|
| 269 | break;
|
---|
| 270 | }
|
---|
[1009] | 271 | data->dirname = (CHAR *)mp2;
|
---|
[574] | 272 | WinSetWindowPtr(hwnd, QWL_USER, (PVOID) data);
|
---|
[551] | 273 | if (*data->dirname)
|
---|
| 274 | WinSetDlgItemText(hwnd, OBJCNR_DIR, data->dirname);
|
---|
| 275 | {
|
---|
| 276 | DIRSIZE *dirsize;
|
---|
[1063] | 277 | # ifdef FORTIFY
|
---|
| 278 | Fortify_EnterScope();
|
---|
| 279 | # endif
|
---|
[551] | 280 | dirsize = xmalloc(sizeof(DIRSIZE), pszSrcFile, __LINE__);
|
---|
| 281 | if (!dirsize) {
|
---|
| 282 | WinDismissDlg(hwnd, 0);
|
---|
| 283 | break;
|
---|
[2] | 284 | }
|
---|
[1009] | 285 | dirsize->stopflag = (CHAR *)&data->stopflag;
|
---|
[551] | 286 | dirsize->filename = data->dirname;
|
---|
| 287 | dirsize->hwndCnr = WinWindowFromID(hwnd, OBJCNR_CNR);
|
---|
| 288 | if (_beginthread(FillCnrsThread, NULL, 65536 * 8, (PVOID) dirsize) ==
|
---|
| 289 | -1) {
|
---|
| 290 | Runtime_Error(pszSrcFile, __LINE__,
|
---|
| 291 | GetPString(IDS_COULDNTSTARTTHREADTEXT));
|
---|
[1039] | 292 | free(dirsize);
|
---|
[1063] | 293 | # ifdef FORTIFY
|
---|
| 294 | Fortify_LeaveScope();
|
---|
| 295 | # endif
|
---|
[551] | 296 | WinDismissDlg(hwnd, 0);
|
---|
| 297 | break;
|
---|
[349] | 298 | }
|
---|
[551] | 299 | else
|
---|
| 300 | data->working = TRUE;
|
---|
| 301 | }
|
---|
| 302 | PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
|
---|
| 303 | break;
|
---|
[2] | 304 |
|
---|
[551] | 305 | case UM_SETUP:
|
---|
| 306 | // WinEnableWindowUpdate(WinWindowFromID(hwnd,OBJCNR_CNR),FALSE);
|
---|
| 307 | {
|
---|
| 308 | CNRINFO cnri;
|
---|
[2] | 309 |
|
---|
[551] | 310 | memset(&cnri, 0, sizeof(CNRINFO));
|
---|
| 311 | cnri.cb = sizeof(CNRINFO);
|
---|
| 312 | WinSendDlgItemMsg(hwnd, OBJCNR_CNR, CM_QUERYCNRINFO,
|
---|
| 313 | MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
|
---|
| 314 | cnri.cyLineSpacing = 0;
|
---|
| 315 | cnri.cxTreeIndent = 12L;
|
---|
| 316 | cnri.pszCnrTitle = GetPString(IDS_WORKINGTEXT);
|
---|
| 317 | cnri.flWindowAttr = CV_TREE | CV_FLOW |
|
---|
| 318 | CA_CONTAINERTITLE | CA_TITLESEPARATOR | CA_TREELINE;
|
---|
| 319 | if (WinQueryWindowUShort(hwnd, QWS_ID) == QTREE_FRAME)
|
---|
| 320 | cnri.flWindowAttr |= CV_MINI;
|
---|
| 321 | WinSendDlgItemMsg(hwnd, OBJCNR_CNR, CM_SETCNRINFO, MPFROMP(&cnri),
|
---|
| 322 | MPFROMLONG(CMA_FLWINDOWATTR | CMA_LINESPACING |
|
---|
| 323 | CMA_CXTREEINDENT));
|
---|
| 324 | }
|
---|
| 325 | return 0;
|
---|
[2] | 326 |
|
---|
[551] | 327 | case UM_CONTAINER_FILLED:
|
---|
| 328 | WinSetDlgItemText(hwnd, OBJCNR_NOTE, NullStr);
|
---|
[2] | 329 | // WinEnableWindowUpdate(WinWindowFromID(hwnd,OBJCNR_CNR),TRUE);
|
---|
[551] | 330 | WinSendDlgItemMsg(hwnd, OBJCNR_CNR, CM_INVALIDATERECORD, MPVOID,
|
---|
| 331 | MPFROM2SHORT(0, CMA_ERASE | CMA_INVALIDATE));
|
---|
| 332 | data = INSTDATA(hwnd);
|
---|
| 333 | if (data) {
|
---|
| 334 | data->working = FALSE;
|
---|
| 335 | if (data->dying)
|
---|
| 336 | WinDismissDlg(hwnd, 0);
|
---|
| 337 | {
|
---|
| 338 | PCNRITEM pci;
|
---|
| 339 | USHORT id;
|
---|
[2] | 340 |
|
---|
[551] | 341 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
| 342 | pci = (PCNRITEM) WinSendDlgItemMsg(hwnd, OBJCNR_CNR,
|
---|
| 343 | CM_QUERYRECORD,
|
---|
| 344 | MPVOID,
|
---|
| 345 | MPFROM2SHORT(CMA_FIRST,
|
---|
| 346 | CMA_ITEMORDER));
|
---|
| 347 | if (pci && (INT) pci != -1) {
|
---|
| 348 | ExpandAll(WinWindowFromID(hwnd, OBJCNR_CNR), TRUE, pci);
|
---|
| 349 | if (id == QTREE_FRAME)
|
---|
| 350 | pci = (PCNRITEM) WinSendDlgItemMsg(hwnd, OBJCNR_CNR,
|
---|
| 351 | CM_QUERYRECORD,
|
---|
| 352 | MPFROMP(pci),
|
---|
| 353 | MPFROM2SHORT(CMA_FIRSTCHILD,
|
---|
| 354 | CMA_ITEMORDER));
|
---|
| 355 | }
|
---|
| 356 | if ((!pci || (INT) pci == -1) && id == QTREE_FRAME) {
|
---|
| 357 | Notify(GetPString(IDS_NODIRSUNDERTEXT));
|
---|
| 358 | WinDismissDlg(hwnd, 0);
|
---|
| 359 | break;
|
---|
| 360 | }
|
---|
[2] | 361 | }
|
---|
[551] | 362 | }
|
---|
| 363 | return 0;
|
---|
[2] | 364 |
|
---|
[551] | 365 | case WM_CONTROL:
|
---|
| 366 | switch (SHORT1FROMMP(mp1)) {
|
---|
| 367 | case OBJCNR_CNR:
|
---|
| 368 | if (SHORT2FROMMP(mp1) == CN_ENTER) {
|
---|
[2] | 369 |
|
---|
[551] | 370 | PCNRITEM pci = (PCNRITEM) ((PNOTIFYRECORDENTER) mp2)->pRecord;
|
---|
[2] | 371 |
|
---|
[551] | 372 | if (pci && (INT) pci != -1)
|
---|
| 373 | WinSendDlgItemMsg(hwnd, DID_OK, BM_CLICK, MPVOID, MPVOID);
|
---|
[2] | 374 | }
|
---|
[551] | 375 | break;
|
---|
| 376 | }
|
---|
| 377 | return 0;
|
---|
[2] | 378 |
|
---|
[551] | 379 | case WM_COMMAND:
|
---|
| 380 | switch (SHORT1FROMMP(mp1)) {
|
---|
| 381 | case IDM_HELP:
|
---|
| 382 | if (hwndHelp) {
|
---|
[2] | 383 |
|
---|
[551] | 384 | USHORT id;
|
---|
[2] | 385 |
|
---|
[551] | 386 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
[2] | 387 |
|
---|
[551] | 388 | if (id == QTREE_FRAME)
|
---|
| 389 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
---|
| 390 | MPFROM2SHORT(HELP_QUICKTREE, 0),
|
---|
| 391 | MPFROMSHORT(HM_RESOURCEID));
|
---|
| 392 | else
|
---|
| 393 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
---|
| 394 | MPFROM2SHORT(HELP_OBJECTPATH, 0),
|
---|
| 395 | MPFROMSHORT(HM_RESOURCEID));
|
---|
| 396 | }
|
---|
| 397 | break;
|
---|
[2] | 398 |
|
---|
[551] | 399 | case OBJCNR_DESKTOP:
|
---|
| 400 | case DID_OK:
|
---|
| 401 | data = INSTDATA(hwnd);
|
---|
| 402 | if (data) {
|
---|
[2] | 403 |
|
---|
[551] | 404 | PCNRITEM pci;
|
---|
[2] | 405 |
|
---|
[551] | 406 | if (data->working) {
|
---|
| 407 | Runtime_Error(pszSrcFile, __LINE__, "working unexpected");
|
---|
| 408 | break;
|
---|
| 409 | }
|
---|
| 410 | if (SHORT1FROMMP(mp1) == OBJCNR_DESKTOP) {
|
---|
| 411 | WinDismissDlg(hwnd, 2);
|
---|
| 412 | break;
|
---|
| 413 | }
|
---|
| 414 | pci = (PCNRITEM) WinSendDlgItemMsg(hwnd, OBJCNR_CNR,
|
---|
| 415 | CM_QUERYRECORDEMPHASIS,
|
---|
| 416 | MPFROMLONG(CMA_FIRST),
|
---|
| 417 | MPFROMSHORT(CRA_CURSORED));
|
---|
| 418 | if (pci && (INT) pci != -1)
|
---|
[730] | 419 | strcpy(data->dirname, pci->pszFileName);
|
---|
[551] | 420 | WinDismissDlg(hwnd, 1);
|
---|
[2] | 421 | }
|
---|
[551] | 422 | break;
|
---|
[2] | 423 |
|
---|
[551] | 424 | case DID_CANCEL:
|
---|
[2] | 425 | data = INSTDATA(hwnd);
|
---|
[551] | 426 | if (data) {
|
---|
| 427 | if (data->working) {
|
---|
[689] | 428 | data->dying = (CHAR)TRUE;
|
---|
| 429 | data->stopflag = (CHAR)0xff;
|
---|
[551] | 430 | break;
|
---|
| 431 | }
|
---|
| 432 | WinDismissDlg(hwnd, 0);
|
---|
| 433 | }
|
---|
[2] | 434 | break;
|
---|
[551] | 435 | }
|
---|
| 436 | return 0;
|
---|
| 437 |
|
---|
| 438 | case WM_DESTROY:
|
---|
| 439 | objcnrwnd = (HWND) 0;
|
---|
| 440 | data = INSTDATA(hwnd);
|
---|
[1009] | 441 | xfree(data, pszSrcFile, __LINE__);
|
---|
[551] | 442 | break;
|
---|
[2] | 443 | }
|
---|
[551] | 444 | return WinDefDlgProc(hwnd, msg, mp1, mp2);
|
---|
[2] | 445 | }
|
---|
[783] | 446 |
|
---|
| 447 | #pragma alloc_text(OBJCNR,ProcessDir,FillCnrsThread,ObjCnrDlgProc)
|
---|