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