[76] | 1 |
|
---|
| 2 | /***********************************************************************
|
---|
| 3 |
|
---|
| 4 | $Id: comp.c 790 2007-08-20 16:54:43Z stevenhl $
|
---|
| 5 |
|
---|
| 6 | Compare directories
|
---|
| 7 |
|
---|
| 8 | Copyright (c) 1993-02 M. Kimes
|
---|
[574] | 9 | Copyright (c) 2003, 2007 Steven H. Levine
|
---|
[76] | 10 |
|
---|
[145] | 11 | 16 Oct 02 MK Baseline
|
---|
| 12 | 04 Nov 03 SHL Force window refresh after subdir toggle
|
---|
| 13 | 01 Aug 04 SHL Rework lstrip/rstrip usage
|
---|
| 14 | 24 May 05 SHL Rework Win_Error usage
|
---|
[157] | 15 | 24 May 05 SHL Rework for CNRITEM.szSubject
|
---|
| 16 | 25 May 05 SHL Rework with ULONGLONG
|
---|
[199] | 17 | 06 Jun 05 SHL Drop unused
|
---|
[362] | 18 | 12 Jul 06 SHL Renames and comments
|
---|
| 19 | 13 Jul 06 SHL Use Runtime_Error
|
---|
[366] | 20 | 26 Jul 06 SHL Drop unreachable CN_... code
|
---|
[406] | 21 | 29 Jul 06 SHL Use xfgets_bstripcr
|
---|
[448] | 22 | 15 Aug 06 SHL Turn off hide not selected on dir change
|
---|
[517] | 23 | 19 Oct 06 SHL Correct . and .. detect
|
---|
[535] | 24 | 03 Nov 06 SHL Count thread usage
|
---|
[574] | 25 | 22 Mar 07 GKY Use QWL_USER
|
---|
[742] | 26 | 29 Jul 07 SHL Use Win_Error to report container errors
|
---|
[748] | 27 | 01 Aug 07 SHL Rework to sync with CNRITEM mods
|
---|
| 28 | 01 Aug 07 SHL Rework to remove vast amount of duplicate code
|
---|
[756] | 29 | 03 Aug 07 GKY Enlarged and made setable everywhere Findbuf (speed file loading)
|
---|
[773] | 30 | 06 Aug 07 SHL Move BldFullPathName here to be near primary caller
|
---|
| 31 | 07 Aug 07 SHL COMP_COLLECT: Avoid collecting empty entries when nothing selected
|
---|
[775] | 32 | 06 Aug 07 GKY Reduce DosSleep times (ticket 148)
|
---|
[783] | 33 | 13 Aug 07 SHL Sync code with other FilesToGet usage
|
---|
| 34 | 13 Aug 07 SHL Move #pragma alloc_text to end for OpenWatcom compat
|
---|
[790] | 35 | 20 Aug 07 SHL Correct remaining pcil/pcir typos (we hope)
|
---|
| 36 | 20 Aug 07 SHL Revert to DosSleep(0)
|
---|
| 37 | 20 Aug 07 SHL Use GetMSecTimer for timing
|
---|
[76] | 38 |
|
---|
| 39 | ***********************************************************************/
|
---|
| 40 |
|
---|
[2] | 41 | #define INCL_DOS
|
---|
| 42 | #define INCL_WIN
|
---|
[783] | 43 | #define INCL_DOSERRORS
|
---|
[2] | 44 | #define INCL_GPI
|
---|
[157] | 45 | #define INCL_LONGLONG
|
---|
| 46 | #include <os2.h>
|
---|
[2] | 47 |
|
---|
| 48 | #include <stdio.h>
|
---|
| 49 | #include <stdlib.h>
|
---|
| 50 | #include <string.h>
|
---|
| 51 | #include <ctype.h>
|
---|
| 52 | #include <share.h>
|
---|
| 53 | #include <io.h>
|
---|
[689] | 54 | #include <process.h> // _beginthread
|
---|
[157] | 55 |
|
---|
[2] | 56 | #include "fm3dll.h"
|
---|
| 57 | #include "fm3dlg.h"
|
---|
| 58 | #include "fm3str.h"
|
---|
| 59 |
|
---|
[551] | 60 | typedef struct
|
---|
| 61 | {
|
---|
| 62 | CHAR filename[CCHMAXPATH];
|
---|
| 63 | CHAR dirname[CCHMAXPATH];
|
---|
| 64 | BOOL recurse;
|
---|
| 65 | }
|
---|
| 66 | SNAPSTUFF;
|
---|
[2] | 67 |
|
---|
[362] | 68 | static PSZ pszSrcFile = __FILE__;
|
---|
| 69 |
|
---|
[773] | 70 | /**
|
---|
| 71 | * Build full path name in callers buffer given directory
|
---|
| 72 | * name and filename
|
---|
| 73 | * @param pszPathName points to drive/directory if not NULL
|
---|
| 74 | * @returns pointer to full path name in caller's buffer
|
---|
| 75 | * @note OK for pszFullPathName and pszPathName to point to same buffer
|
---|
| 76 | *
|
---|
| 77 | */
|
---|
| 78 |
|
---|
| 79 | PSZ BldFullPathName(PSZ pszFullPathName, PSZ pszPathName, PSZ pszFileName)
|
---|
| 80 | {
|
---|
| 81 | UINT c = pszPathName ? strlen(pszPathName) : 0;
|
---|
| 82 | if (c > 0) {
|
---|
| 83 | memcpy(pszFullPathName, pszPathName, c);
|
---|
| 84 | if (pszFullPathName[c - 1] != '\\')
|
---|
| 85 | pszFullPathName[c++] = '\\';
|
---|
| 86 | }
|
---|
| 87 | strcpy(pszFullPathName + c, pszFileName);
|
---|
| 88 | return pszFullPathName;
|
---|
| 89 | }
|
---|
| 90 |
|
---|
[316] | 91 | //=== SnapShot() Write directory tree to file and recurse if requested ===
|
---|
[2] | 92 |
|
---|
[783] | 93 | static VOID SnapShot(char *path, FILE *fp, BOOL recurse)
|
---|
[157] | 94 | {
|
---|
[783] | 95 | PFILEFINDBUF4 pffb;
|
---|
[551] | 96 | char *mask, *enddir;
|
---|
| 97 | HDIR hdir = HDIR_CREATE;
|
---|
[783] | 98 | ULONG ulFindCnt;
|
---|
[2] | 99 |
|
---|
[783] | 100 | // 13 Aug 07 SHL fimxe to use FileToGet
|
---|
| 101 | pffb = xmalloc(sizeof(FILEFINDBUF4), pszSrcFile, __LINE__);
|
---|
| 102 | if (pffb) {
|
---|
[551] | 103 | mask = xmalloc(CCHMAXPATH, pszSrcFile, __LINE__);
|
---|
| 104 | if (mask) {
|
---|
[783] | 105 | BldFullPathName(mask, path, "*");
|
---|
| 106 | // sprintf(mask,
|
---|
| 107 | // "%s%s*",
|
---|
| 108 | // path, (path[strlen(path) - 1] != '\\') ? "\\" : NullStr);
|
---|
[551] | 109 | enddir = strrchr(mask, '\\');
|
---|
[2] | 110 | enddir++;
|
---|
[783] | 111 | ulFindCnt = 1;
|
---|
| 112 | // 13 Aug 07 SHL fixme to report errors
|
---|
[551] | 113 | if (!DosFindFirst(mask,
|
---|
| 114 | &hdir,
|
---|
| 115 | FILE_NORMAL | FILE_DIRECTORY |
|
---|
| 116 | FILE_ARCHIVED | FILE_READONLY | FILE_HIDDEN |
|
---|
| 117 | FILE_SYSTEM,
|
---|
[783] | 118 | pffb, sizeof(FILEFINDBUF4), &ulFindCnt, FIL_QUERYEASIZE)) {
|
---|
[551] | 119 | do {
|
---|
[783] | 120 | strcpy(enddir, pffb->achName);
|
---|
| 121 | if (!(pffb->attrFile & FILE_DIRECTORY))
|
---|
[551] | 122 | fprintf(fp,
|
---|
| 123 | "\"%s\",%u,%lu,%04u/%02u/%02u,%02u:%02u:%02u,%lu,%lu,N\n",
|
---|
| 124 | mask,
|
---|
| 125 | enddir - mask,
|
---|
[783] | 126 | pffb->cbFile,
|
---|
| 127 | (pffb->fdateLastWrite.year + 1980),
|
---|
| 128 | pffb->fdateLastWrite.month,
|
---|
| 129 | pffb->fdateLastWrite.day,
|
---|
| 130 | pffb->ftimeLastWrite.hours,
|
---|
| 131 | pffb->ftimeLastWrite.minutes,
|
---|
| 132 | pffb->ftimeLastWrite.twosecs,
|
---|
| 133 | pffb->attrFile, (pffb->cbList > 4) ? (pffb->cbList / 2) : 0);
|
---|
[517] | 134 | // Skip . and ..
|
---|
[551] | 135 | else if (recurse &&
|
---|
[783] | 136 | (pffb->achName[0] != '.' ||
|
---|
| 137 | (pffb->achName[1] &&
|
---|
| 138 | (pffb->achName[1] != '.' || pffb->achName[2])))) {
|
---|
[551] | 139 | SnapShot(mask, fp, recurse);
|
---|
| 140 | }
|
---|
[783] | 141 | ulFindCnt = 1;
|
---|
| 142 | } while (!DosFindNext(hdir, pffb, sizeof(FILEFINDBUF4), &ulFindCnt));
|
---|
[551] | 143 | DosFindClose(hdir);
|
---|
[2] | 144 | }
|
---|
| 145 | free(mask);
|
---|
| 146 | }
|
---|
[783] | 147 | free(pffb);
|
---|
[2] | 148 | }
|
---|
| 149 | }
|
---|
| 150 |
|
---|
[316] | 151 | //=== StartSnap() Write directory tree to snapshot file ===
|
---|
[2] | 152 |
|
---|
[551] | 153 | static VOID StartSnap(VOID * dummy)
|
---|
[316] | 154 | {
|
---|
[551] | 155 | SNAPSTUFF *sf = (SNAPSTUFF *) dummy;
|
---|
| 156 | FILE *fp;
|
---|
| 157 | CHAR *p;
|
---|
[2] | 158 |
|
---|
[551] | 159 | if (sf) {
|
---|
| 160 | if (*sf->dirname && *sf->filename) {
|
---|
[2] | 161 | priority_normal();
|
---|
| 162 | p = sf->dirname;
|
---|
[551] | 163 | while (*p) {
|
---|
| 164 | if (*p == '/')
|
---|
| 165 | *p = '\\';
|
---|
| 166 | p++;
|
---|
[2] | 167 | }
|
---|
[551] | 168 | if (*(p - 1) != '\\') {
|
---|
| 169 | *p = '\\';
|
---|
| 170 | p++;
|
---|
[2] | 171 | }
|
---|
[551] | 172 | fp = xfopen(sf->filename, "w", pszSrcFile, __LINE__);
|
---|
[362] | 173 | if (fp) {
|
---|
[551] | 174 | fprintf(fp, "\"%s\"\n", sf->dirname);
|
---|
| 175 | SnapShot(sf->dirname, fp, sf->recurse);
|
---|
| 176 | fclose(fp);
|
---|
[2] | 177 | }
|
---|
| 178 | }
|
---|
| 179 | free(sf);
|
---|
| 180 | }
|
---|
| 181 | }
|
---|
| 182 |
|
---|
[316] | 183 | //=== CompareFilesThread() Compare files and update container select flags ===
|
---|
[2] | 184 |
|
---|
[551] | 185 | static VOID CompareFilesThread(VOID * args)
|
---|
[316] | 186 | {
|
---|
[2] | 187 | FCOMPARE fc;
|
---|
[551] | 188 | HAB hab2;
|
---|
| 189 | HMQ hmq2;
|
---|
| 190 | FILE *fp1, *fp2;
|
---|
| 191 | ULONG len1, len2, offset = 0L;
|
---|
| 192 | LONG numread1, numread2;
|
---|
| 193 | CHAR s[1024], ss[1024], *p1, *p2;
|
---|
[2] | 194 |
|
---|
[551] | 195 | if (args) {
|
---|
| 196 | fc = *(FCOMPARE *) args;
|
---|
[2] | 197 | hab2 = WinInitialize(0);
|
---|
[551] | 198 | if (hab2) {
|
---|
| 199 | hmq2 = WinCreateMsgQueue(hab2, 0);
|
---|
| 200 | if (hmq2) {
|
---|
| 201 | WinCancelShutdown(hmq2, TRUE);
|
---|
[535] | 202 | IncrThreadUsage();
|
---|
[551] | 203 | if (!IsFile(fc.file1) || IsRoot(fc.file1)) {
|
---|
| 204 | p1 = strrchr(fc.file2, '\\');
|
---|
| 205 | if (p1) {
|
---|
| 206 | if (fc.file1[strlen(fc.file1) - 1] == '\\')
|
---|
| 207 | p1++;
|
---|
| 208 | strcat(fc.file1, p1);
|
---|
| 209 | }
|
---|
[362] | 210 | }
|
---|
[551] | 211 | else if (!IsFile(fc.file2) || IsRoot(fc.file2)) {
|
---|
| 212 | p1 = strrchr(fc.file1, '\\');
|
---|
| 213 | if (p1) {
|
---|
| 214 | if (fc.file2[strlen(fc.file2) - 1] == '\\')
|
---|
| 215 | p1++;
|
---|
| 216 | strcat(fc.file2, p1);
|
---|
| 217 | }
|
---|
| 218 | }
|
---|
| 219 | sprintf(s, GetPString(IDS_COMPCOMPARETEXT), fc.file1);
|
---|
| 220 | AddToListboxBottom(fc.hwndList, s);
|
---|
| 221 | sprintf(s, GetPString(IDS_COMPTOTEXT), fc.file2);
|
---|
| 222 | AddToListboxBottom(fc.hwndList, s);
|
---|
| 223 | fp1 = _fsopen(fc.file1, "rb", SH_DENYNO);
|
---|
| 224 | if (!fp1) {
|
---|
| 225 | sprintf(s, GetPString(IDS_COMPCANTOPENTEXT), fc.file1);
|
---|
| 226 | AddToListboxBottom(fc.hwndList, s);
|
---|
| 227 | WinSetWindowText(fc.hwndHelp, GetPString(IDS_ERRORTEXT));
|
---|
| 228 | }
|
---|
[362] | 229 | else {
|
---|
[551] | 230 | fp2 = _fsopen(fc.file2, "rb", SH_DENYNO);
|
---|
| 231 | if (!fp2) {
|
---|
| 232 | sprintf(s, GetPString(IDS_COMPCANTOPENTEXT), fc.file2);
|
---|
| 233 | AddToListboxBottom(fc.hwndList, s);
|
---|
| 234 | WinSetWindowText(fc.hwndHelp, GetPString(IDS_ERRORTEXT));
|
---|
[362] | 235 | }
|
---|
| 236 | else {
|
---|
[551] | 237 | len1 = filelength(fileno(fp1));
|
---|
| 238 | len2 = filelength(fileno(fp2));
|
---|
| 239 | if (len1 != len2) {
|
---|
| 240 | strcpy(s, GetPString(IDS_COMPDIFSIZESTEXT));
|
---|
| 241 | AddToListboxBottom(fc.hwndList, s);
|
---|
| 242 | sprintf(s, GetPString(IDS_COMPVSBYTESTEXT), len1, len2);
|
---|
| 243 | AddToListboxBottom(fc.hwndList, s);
|
---|
| 244 | WinSetWindowText(fc.hwndHelp,
|
---|
| 245 | GetPString(IDS_COMPDONTMATCHTEXT));
|
---|
| 246 | }
|
---|
| 247 | else {
|
---|
| 248 | WinSetWindowText(fc.hwndHelp,
|
---|
| 249 | GetPString(IDS_COMPCOMPARINGTEXT));
|
---|
| 250 | while (WinIsWindow(hab2, fc.hwndList)) {
|
---|
| 251 | numread1 = fread(s, 1, 1024, fp1);
|
---|
| 252 | numread2 = fread(ss, 1, 1024, fp2);
|
---|
| 253 | if (numread1 != numread2 || feof(fp1) != feof(fp2)) {
|
---|
| 254 | sprintf(s, GetPString(IDS_COMPREADERRORTEXT),
|
---|
| 255 | offset, offset);
|
---|
| 256 | AddToListboxBottom(fc.hwndList, s);
|
---|
| 257 | WinSetWindowText(fc.hwndHelp, GetPString(IDS_ERRORTEXT));
|
---|
| 258 | break;
|
---|
| 259 | }
|
---|
| 260 | else if (!numread1 && feof(fp1) && feof(fp2)) {
|
---|
| 261 | AddToListboxBottom(fc.hwndList,
|
---|
| 262 | GetPString(IDS_COMPFILESMATCHTEXT));
|
---|
| 263 | if (!stricmp(fc.file1, fc.file2))
|
---|
| 264 | AddToListboxBottom(fc.hwndList,
|
---|
| 265 | GetPString(IDS_COMPWONDERWHYTEXT));
|
---|
| 266 | WinSetWindowText(fc.hwndHelp,
|
---|
| 267 | GetPString(IDS_COMPCOMPLETETEXT));
|
---|
| 268 | break;
|
---|
| 269 | }
|
---|
| 270 | else if (numread1 <= 0 || numread2 <= 0) {
|
---|
| 271 | if (offset == len1)
|
---|
| 272 | break;
|
---|
| 273 | else {
|
---|
| 274 | sprintf(s, GetPString(IDS_COMPMATCHREADERRORTEXT),
|
---|
| 275 | offset, offset);
|
---|
| 276 | WinSetWindowText(fc.hwndHelp,
|
---|
| 277 | GetPString(IDS_COMPODDERRORTEXT));
|
---|
| 278 | AddToListboxBottom(fc.hwndList, s);
|
---|
| 279 | break;
|
---|
| 280 | }
|
---|
| 281 | }
|
---|
| 282 | else if (memcmp(s, ss, numread1)) {
|
---|
| 283 | p1 = s;
|
---|
| 284 | p2 = ss;
|
---|
| 285 | while (p1 < s + numread1) {
|
---|
| 286 | if (*p1 != *p2) {
|
---|
| 287 | sprintf(s, GetPString(IDS_COMPMISMATCHERRORTEXT),
|
---|
| 288 | offset + (p1 - s), offset + (p1 - s));
|
---|
| 289 | AddToListboxBottom(fc.hwndList, s);
|
---|
| 290 | WinSetWindowText(fc.hwndHelp,
|
---|
| 291 | GetPString(IDS_COMPDONTMATCHTEXT));
|
---|
| 292 | break;
|
---|
| 293 | }
|
---|
| 294 | p1++;
|
---|
| 295 | p2++;
|
---|
| 296 | }
|
---|
| 297 | break;
|
---|
| 298 | }
|
---|
| 299 | offset += numread1;
|
---|
| 300 | }
|
---|
| 301 | }
|
---|
| 302 | fclose(fp2);
|
---|
| 303 | }
|
---|
| 304 | fclose(fp1);
|
---|
| 305 | }
|
---|
[535] | 306 | DecrThreadUsage();
|
---|
[551] | 307 | WinDestroyMsgQueue(hmq2);
|
---|
[2] | 308 | }
|
---|
| 309 | WinTerminate(hab2);
|
---|
| 310 | }
|
---|
| 311 | }
|
---|
| 312 | }
|
---|
| 313 |
|
---|
[316] | 314 | //=== CFileDlgProc() Select directories to compare dialog procedure ===
|
---|
[2] | 315 |
|
---|
[551] | 316 | MRESULT EXPENTRY CFileDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
[316] | 317 | {
|
---|
[2] | 318 | FCOMPARE *fc;
|
---|
| 319 |
|
---|
[551] | 320 | switch (msg) {
|
---|
| 321 | case WM_INITDLG:
|
---|
| 322 | if (!mp2)
|
---|
| 323 | WinDismissDlg(hwnd, 0);
|
---|
| 324 | else {
|
---|
[574] | 325 | WinSetWindowPtr(hwnd, QWL_USER, mp2);
|
---|
[551] | 326 | fc = (FCOMPARE *) mp2;
|
---|
| 327 | fc->hwndReport = hwnd;
|
---|
| 328 | fc->hwndList = WinWindowFromID(hwnd, FCMP_LISTBOX);
|
---|
| 329 | fc->hwndHelp = WinWindowFromID(hwnd, FCMP_HELP);
|
---|
| 330 | if (!*fc->file1 || !fc->file2) {
|
---|
| 331 | WinDismissDlg(hwnd, 0);
|
---|
| 332 | break;
|
---|
[2] | 333 | }
|
---|
[551] | 334 | MakeFullName(fc->file1);
|
---|
| 335 | MakeFullName(fc->file2);
|
---|
| 336 | if (!stricmp(fc->file1, fc->file2)) {
|
---|
| 337 | saymsg(MB_CANCEL, hwnd,
|
---|
| 338 | GetPString(IDS_COMPSILLYALERTTEXT),
|
---|
| 339 | GetPString(IDS_COMPTOITSELFTEXT));
|
---|
| 340 | WinDismissDlg(hwnd, 0);
|
---|
| 341 | break;
|
---|
| 342 | }
|
---|
| 343 | if (_beginthread(CompareFilesThread, NULL, 65536, (PVOID) fc) == -1) {
|
---|
| 344 | Runtime_Error(pszSrcFile, __LINE__,
|
---|
| 345 | GetPString(IDS_COULDNTSTARTTHREADTEXT));
|
---|
| 346 | WinDismissDlg(hwnd, 0);
|
---|
| 347 | }
|
---|
| 348 | }
|
---|
| 349 | break;
|
---|
[2] | 350 |
|
---|
[551] | 351 | case WM_ADJUSTWINDOWPOS:
|
---|
| 352 | PostMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
|
---|
| 353 | break;
|
---|
[2] | 354 |
|
---|
[551] | 355 | case UM_SETDIR:
|
---|
| 356 | PaintRecessedWindow(WinWindowFromID(hwnd, FCMP_HELP),
|
---|
| 357 | (HPS) 0, FALSE, TRUE);
|
---|
| 358 | return 0;
|
---|
[2] | 359 |
|
---|
[551] | 360 | case WM_COMMAND:
|
---|
| 361 | switch (SHORT1FROMMP(mp1)) {
|
---|
| 362 | case DID_OK:
|
---|
| 363 | WinDismissDlg(hwnd, 0);
|
---|
| 364 | break;
|
---|
| 365 | case DID_CANCEL:
|
---|
| 366 | WinDismissDlg(hwnd, 1);
|
---|
| 367 | break;
|
---|
| 368 | }
|
---|
| 369 | return 0;
|
---|
[2] | 370 |
|
---|
[551] | 371 | case WM_DESTROY:
|
---|
[771] | 372 | DosSleep(50);//05 Aug 07 GKY 100
|
---|
[551] | 373 | break;
|
---|
[2] | 374 | }
|
---|
[551] | 375 | return WinDefDlgProc(hwnd, msg, mp1, mp2);
|
---|
[2] | 376 | }
|
---|
| 377 |
|
---|
[316] | 378 | //=== ActionCnrThread() Do requested action on container contents ===
|
---|
[2] | 379 |
|
---|
[731] | 380 | static VOID ActionCnrThread(VOID *args)
|
---|
[316] | 381 | {
|
---|
[731] | 382 | COMPARE *cmp = (COMPARE *)args;
|
---|
[551] | 383 | HAB hab;
|
---|
| 384 | HMQ hmq;
|
---|
| 385 | HWND hwndCnrS, hwndCnrD;
|
---|
[748] | 386 | PCNRITEM pci, pciD, pciNextS, pciNextD;
|
---|
[769] | 387 | CHAR szNewName[CCHMAXPATH], szDirName[CCHMAXPATH], *p;
|
---|
[551] | 388 | APIRET rc;
|
---|
[2] | 389 |
|
---|
[748] | 390 | if (!cmp) {
|
---|
[773] | 391 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
[2] | 392 | return;
|
---|
[748] | 393 | }
|
---|
[2] | 394 |
|
---|
| 395 | DosError(FERR_DISABLEHARDERR);
|
---|
| 396 |
|
---|
| 397 | hab = WinInitialize(0);
|
---|
[551] | 398 | if (hab) {
|
---|
| 399 | hmq = WinCreateMsgQueue(hab, 0);
|
---|
| 400 | if (hmq) {
|
---|
| 401 | WinCancelShutdown(hmq, TRUE);
|
---|
[535] | 402 | IncrThreadUsage();
|
---|
[2] | 403 | priority_normal();
|
---|
[551] | 404 | switch (cmp->action) {
|
---|
| 405 | case COMP_DELETELEFT:
|
---|
| 406 | hwndCnrS = WinWindowFromID(cmp->hwnd, COMP_LEFTDIR);
|
---|
| 407 | hwndCnrD = WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR);
|
---|
| 408 | cmp->action = IDM_DELETE;
|
---|
| 409 | break;
|
---|
| 410 | case COMP_DELETERIGHT:
|
---|
| 411 | hwndCnrS = WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR);
|
---|
| 412 | hwndCnrD = WinWindowFromID(cmp->hwnd, COMP_LEFTDIR);
|
---|
| 413 | cmp->action = IDM_DELETE;
|
---|
| 414 | break;
|
---|
| 415 | case COMP_MOVELEFT:
|
---|
| 416 | cmp->action = IDM_MOVE;
|
---|
| 417 | hwndCnrS = WinWindowFromID(cmp->hwnd, COMP_LEFTDIR);
|
---|
| 418 | hwndCnrD = WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR);
|
---|
| 419 | break;
|
---|
| 420 | case COMP_MOVERIGHT:
|
---|
| 421 | cmp->action = IDM_MOVE;
|
---|
| 422 | hwndCnrS = WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR);
|
---|
| 423 | hwndCnrD = WinWindowFromID(cmp->hwnd, COMP_LEFTDIR);
|
---|
| 424 | break;
|
---|
| 425 | case COMP_COPYLEFT:
|
---|
| 426 | cmp->action = IDM_COPY;
|
---|
| 427 | hwndCnrS = WinWindowFromID(cmp->hwnd, COMP_LEFTDIR);
|
---|
| 428 | hwndCnrD = WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR);
|
---|
| 429 | break;
|
---|
| 430 | case COMP_COPYRIGHT:
|
---|
| 431 | cmp->action = IDM_COPY;
|
---|
| 432 | hwndCnrS = WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR);
|
---|
| 433 | hwndCnrD = WinWindowFromID(cmp->hwnd, COMP_LEFTDIR);
|
---|
| 434 | break;
|
---|
| 435 | default:
|
---|
| 436 | Runtime_Error(pszSrcFile, __LINE__, "bad case %u", cmp->action);
|
---|
| 437 | goto Abort;
|
---|
[2] | 438 | }
|
---|
| 439 |
|
---|
[551] | 440 | pci = WinSendMsg(hwndCnrS, CM_QUERYRECORD, MPVOID,
|
---|
| 441 | MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
|
---|
[748] | 442 | pciD = WinSendMsg(hwndCnrD, CM_QUERYRECORD, MPVOID,
|
---|
[551] | 443 | MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
|
---|
[316] | 444 |
|
---|
[748] | 445 | while (pci && (INT)pci != -1 && pciD && (INT)pciD != -1) {
|
---|
| 446 |
|
---|
| 447 | pciNextS = WinSendMsg(hwndCnrS, CM_QUERYRECORD, MPFROMP(pci),
|
---|
[551] | 448 | MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
|
---|
[748] | 449 | pciNextD = WinSendMsg(hwndCnrD, CM_QUERYRECORD, MPFROMP(pciD),
|
---|
[551] | 450 | MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
|
---|
[748] | 451 |
|
---|
| 452 | if (*pci->pszFileName && pci->rc.flRecordAttr & CRA_SELECTED) {
|
---|
| 453 |
|
---|
| 454 | // Source name not blank
|
---|
[551] | 455 | switch (cmp->action) {
|
---|
| 456 | case IDM_DELETE:
|
---|
[730] | 457 | if (!unlinkf("%s", pci->pszFileName)) {
|
---|
[551] | 458 | WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pci),
|
---|
| 459 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
[748] | 460 |
|
---|
| 461 | if (!*pciD->pszFileName) {
|
---|
[751] | 462 | // Other side is blank - remove from both sides
|
---|
| 463 | RemoveCnrItems(hwndCnrS, pci, 1, CMA_FREE | CMA_INVALIDATE);
|
---|
[748] | 464 | if (pciD->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 465 | WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciD),
|
---|
[551] | 466 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
[751] | 467 | RemoveCnrItems(hwndCnrD, pciD, 1, CMA_FREE | CMA_INVALIDATE);
|
---|
[551] | 468 | }
|
---|
[742] | 469 | else {
|
---|
[751] | 470 | // Other side is not blank - update just this side
|
---|
[748] | 471 | FreeCnrItemData(pci);
|
---|
[751] | 472 | pci->pszDisplayName = pci->pszFileName;
|
---|
| 473 | pci->rc.pszIcon = pci->pszFileName;
|
---|
[551] | 474 | pci->flags = 0;
|
---|
| 475 | WinSendMsg(hwndCnrS, CM_INVALIDATERECORD, MPFROMP(&pci),
|
---|
| 476 | MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
|
---|
| 477 | }
|
---|
| 478 | if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_LEFTDIR))
|
---|
| 479 | cmp->cmp->totalleft--;
|
---|
| 480 | else
|
---|
| 481 | cmp->cmp->totalright--;
|
---|
[748] | 482 | DosSleep(1);
|
---|
[551] | 483 | }
|
---|
| 484 | break;
|
---|
[2] | 485 |
|
---|
[551] | 486 | case IDM_MOVE:
|
---|
| 487 | if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR))
|
---|
[769] | 488 | BldFullPathName(szNewName, cmp->leftdir, pci->pszDisplayName);
|
---|
| 489 | //sprintf(szNewName, "%s%s%s",
|
---|
[763] | 490 | // cmp->leftdir,
|
---|
| 491 | // cmp->leftdir[strlen(cmp->leftdir) - 1] == '\\' ?
|
---|
[769] | 492 | // NullStr : "\\",
|
---|
| 493 | // pci->pszDisplayName);
|
---|
| 494 | else
|
---|
| 495 | BldFullPathName(szNewName, cmp->rightdir, pci->pszDisplayName);
|
---|
| 496 | //sprintf(szNewName, "%s%s%s",
|
---|
[763] | 497 | // cmp->rightdir,
|
---|
[765] | 498 | // cmp->rightdir[strlen(cmp->rightdir) - 1] == '\\' ?
|
---|
[769] | 499 | // NullStr : "\\",
|
---|
[765] | 500 | // pci->pszDisplayName);
|
---|
[748] | 501 | // Make directory if required
|
---|
[769] | 502 | strcpy(szDirName, szNewName);
|
---|
| 503 | p = strrchr(szDirName, '\\');
|
---|
[551] | 504 | if (p) {
|
---|
[769] | 505 | if (p > szDirName + 2)
|
---|
[551] | 506 | p++;
|
---|
| 507 | *p = 0;
|
---|
[769] | 508 | if (IsFile(szDirName) == -1)
|
---|
| 509 | MassMkdir(hwndMain, szDirName);
|
---|
[551] | 510 | }
|
---|
[769] | 511 | rc = docopyf(MOVE, pci->pszFileName, "%s", szNewName);
|
---|
| 512 | if (!rc && stricmp(pci->pszFileName, szNewName)) {
|
---|
[551] | 513 | WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pci),
|
---|
| 514 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
[748] | 515 | if (pciD->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 516 | WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciD),
|
---|
[551] | 517 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
[748] | 518 | FreeCnrItemData(pciD);
|
---|
[769] | 519 | pciD->pszFileName = xstrdup(szNewName, pszSrcFile, __LINE__);
|
---|
[551] | 520 | if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR)) {
|
---|
[748] | 521 | pciD->pszDisplayName = pciD->pszFileName + strlen(cmp->leftdir);
|
---|
[551] | 522 | if (cmp->leftdir[strlen(cmp->leftdir) - 1] != '\\')
|
---|
[751] | 523 | pciD->pszDisplayName++;
|
---|
[551] | 524 | }
|
---|
| 525 | else {
|
---|
[748] | 526 | pciD->pszDisplayName = pciD->pszFileName + strlen(cmp->rightdir);
|
---|
[551] | 527 | if (cmp->rightdir[strlen(cmp->rightdir) - 1] != '\\')
|
---|
[751] | 528 | pciD->pszDisplayName++;
|
---|
[742] | 529 | }
|
---|
[769] | 530 | // 02 Aug 07 SHL fixme to know if LongName transfer is correct?
|
---|
[762] | 531 | pciD->pszLongName = pci->pszLongName;
|
---|
[751] | 532 | if (pciD->pszSubject != NullStr) {
|
---|
| 533 | xfree(pciD->pszSubject);
|
---|
| 534 | pciD->pszSubject = NullStr;
|
---|
| 535 | }
|
---|
[748] | 536 | pciD->attrFile = pci->attrFile;
|
---|
[751] | 537 | pciD->pszDispAttr = pci->pszDispAttr;
|
---|
[769] | 538 | pciD->flags = 0; // Just on one side
|
---|
[748] | 539 | pciD->date = pci->date;
|
---|
| 540 | pciD->time = pci->time;
|
---|
| 541 | pciD->ladate = pci->ladate;
|
---|
| 542 | pciD->latime = pci->latime;
|
---|
| 543 | pciD->crdate = pci->crdate;
|
---|
| 544 | pciD->crtime = pci->crtime;
|
---|
| 545 | pciD->cbFile = pci->cbFile;
|
---|
| 546 | pciD->easize = pci->easize;
|
---|
[751] | 547 |
|
---|
| 548 | if (pci->pszFileName != NullStr) {
|
---|
| 549 | xfree(pci->pszFileName);
|
---|
| 550 | pci->pszFileName = NullStr;
|
---|
| 551 | pci->pszDisplayName = pci->pszFileName;
|
---|
| 552 | pci->rc.pszIcon = pci->pszFileName;
|
---|
| 553 | }
|
---|
| 554 | if (pci->pszSubject != NullStr) {
|
---|
| 555 | xfree(pci->pszSubject);
|
---|
| 556 | pci->pszSubject = NullStr;
|
---|
| 557 | }
|
---|
[551] | 558 | pci->flags = 0;
|
---|
[751] | 559 |
|
---|
[551] | 560 | WinSendMsg(hwndCnrS, CM_INVALIDATERECORD, MPFROMP(&pci),
|
---|
| 561 | MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
|
---|
[748] | 562 | WinSendMsg(hwndCnrD, CM_INVALIDATERECORD, MPFROMP(&pciD),
|
---|
[551] | 563 | MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
|
---|
| 564 | }
|
---|
| 565 | else if (rc) {
|
---|
| 566 | rc = Dos_Error(MB_ENTERCANCEL,
|
---|
| 567 | rc,
|
---|
| 568 | HWND_DESKTOP,
|
---|
| 569 | pszSrcFile,
|
---|
| 570 | __LINE__,
|
---|
| 571 | GetPString(IDS_COMPMOVEFAILEDTEXT),
|
---|
[769] | 572 | pci->pszFileName, szNewName);
|
---|
[748] | 573 | if (rc == MBID_CANCEL) // Cause loop to break
|
---|
| 574 | pciNextS = NULL;
|
---|
[551] | 575 | }
|
---|
| 576 | break;
|
---|
[2] | 577 |
|
---|
[551] | 578 | case IDM_COPY:
|
---|
[769] | 579 | if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR))
|
---|
| 580 | BldFullPathName(szNewName, cmp->leftdir, pci->pszDisplayName);
|
---|
| 581 | //sprintf(szNewName, "%s%s%s",
|
---|
[763] | 582 | // cmp->leftdir,
|
---|
| 583 | // cmp->leftdir[strlen(cmp->leftdir) - 1] == '\\' ?
|
---|
[769] | 584 | // NullStr : "\\",
|
---|
[765] | 585 | // pci->pszDisplayName);
|
---|
[769] | 586 | else
|
---|
| 587 | BldFullPathName(szNewName, cmp->rightdir, pci->pszDisplayName);
|
---|
| 588 | //sprintf(szNewName, "%s%s%s",
|
---|
[763] | 589 | // cmp->rightdir,
|
---|
| 590 | // cmp->rightdir[strlen(cmp->rightdir) - 1] == '\\' ?
|
---|
[769] | 591 | // NullStr : "\\",
|
---|
[763] | 592 | // pci->pszDisplayName);
|
---|
[748] | 593 | // Make directory if required
|
---|
[769] | 594 | strcpy(szDirName, szNewName);
|
---|
| 595 | p = strrchr(szDirName, '\\');
|
---|
[551] | 596 | if (p) {
|
---|
[769] | 597 | if (p > szDirName + 2)
|
---|
[551] | 598 | p++;
|
---|
| 599 | *p = 0;
|
---|
[769] | 600 | if (IsFile(szDirName) == -1)
|
---|
| 601 | MassMkdir(hwndMain, szDirName);
|
---|
[551] | 602 | }
|
---|
[769] | 603 | rc = docopyf(COPY, pci->pszFileName, "%s", szNewName);
|
---|
[551] | 604 | if (rc) {
|
---|
| 605 | rc = Dos_Error(MB_ENTERCANCEL,
|
---|
| 606 | rc,
|
---|
| 607 | HWND_DESKTOP,
|
---|
| 608 | pszSrcFile,
|
---|
| 609 | __LINE__,
|
---|
| 610 | GetPString(IDS_COMPCOPYFAILEDTEXT),
|
---|
[769] | 611 | pci->pszFileName, szNewName);
|
---|
[551] | 612 | if (rc == MBID_CANCEL)
|
---|
[748] | 613 | pciNextS = NULL; // Cause loop to break
|
---|
[551] | 614 | }
|
---|
| 615 | else {
|
---|
| 616 | WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pci),
|
---|
| 617 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
[748] | 618 | if (pciD->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 619 | WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciD),
|
---|
[551] | 620 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
[748] | 621 | FreeCnrItemData(pciD);
|
---|
[769] | 622 | pciD->pszFileName = xstrdup(szNewName, pszSrcFile, __LINE__);
|
---|
[551] | 623 | if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR)) {
|
---|
[748] | 624 | pciD->pszDisplayName = pciD->pszFileName + strlen(cmp->leftdir);
|
---|
[551] | 625 | if (cmp->leftdir[strlen(cmp->leftdir) - 1] != '\\')
|
---|
[751] | 626 | pciD->pszDisplayName++;
|
---|
[362] | 627 | }
|
---|
| 628 | else {
|
---|
[748] | 629 | pciD->pszDisplayName = pciD->pszFileName + strlen(cmp->rightdir);
|
---|
[551] | 630 | if (cmp->rightdir[strlen(cmp->rightdir) - 1] != '\\')
|
---|
[751] | 631 | pciD->pszDisplayName++;
|
---|
[742] | 632 | }
|
---|
[748] | 633 | pciD->attrFile = pci->attrFile;
|
---|
[751] | 634 | pciD->pszDispAttr = pci->pszDispAttr;
|
---|
[769] | 635 | pciD->flags = CNRITEM_EXISTS; // Now on both sides
|
---|
[748] | 636 | pciD->date = pci->date;
|
---|
| 637 | pciD->time = pci->time;
|
---|
| 638 | pciD->ladate = pci->ladate;
|
---|
| 639 | pciD->latime = pci->latime;
|
---|
| 640 | pciD->crdate = pci->crdate;
|
---|
| 641 | pciD->crtime = pci->crtime;
|
---|
| 642 | pciD->cbFile = pci->cbFile;
|
---|
| 643 | pciD->easize = pci->easize;
|
---|
[751] | 644 |
|
---|
[769] | 645 | // Forget status until we regenerate it
|
---|
[751] | 646 | if (pci->pszSubject != NullStr) {
|
---|
| 647 | xfree(pci->pszSubject);
|
---|
| 648 | pci->pszSubject = NullStr;
|
---|
| 649 | }
|
---|
[769] | 650 | pci->flags = CNRITEM_EXISTS;
|
---|
[751] | 651 |
|
---|
[551] | 652 | WinSendMsg(hwndCnrS, CM_INVALIDATERECORD, MPFROMP(&pci),
|
---|
| 653 | MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
|
---|
[748] | 654 | WinSendMsg(hwndCnrD, CM_INVALIDATERECORD, MPFROMP(&pciD),
|
---|
[551] | 655 | MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
|
---|
| 656 | }
|
---|
| 657 | break;
|
---|
[2] | 658 |
|
---|
[551] | 659 | default:
|
---|
| 660 | break;
|
---|
[748] | 661 | } // switch
|
---|
| 662 |
|
---|
| 663 | } // if have name
|
---|
| 664 |
|
---|
| 665 | pci = pciNextS;
|
---|
| 666 | pciD = pciNextD;
|
---|
| 667 |
|
---|
| 668 | } // while
|
---|
[551] | 669 | Abort:
|
---|
[2] | 670 | WinDestroyMsgQueue(hmq);
|
---|
| 671 | }
|
---|
[535] | 672 | DecrThreadUsage();
|
---|
[2] | 673 | WinTerminate(hab);
|
---|
| 674 | }
|
---|
[551] | 675 | PostMsg(cmp->hwnd, UM_CONTAINER_FILLED, MPFROMLONG(1L), MPVOID);
|
---|
| 676 | PostMsg(cmp->hwnd, WM_COMMAND, MPFROM2SHORT(IDM_DESELECTALL, 0), MPVOID);
|
---|
[2] | 677 | free(cmp);
|
---|
| 678 | }
|
---|
| 679 |
|
---|
[316] | 680 | //=== SelectCnrsThread() Update container selection flags thread ===
|
---|
[2] | 681 |
|
---|
[551] | 682 | static VOID SelectCnrsThread(VOID * args)
|
---|
[316] | 683 | {
|
---|
[551] | 684 | COMPARE *cmp = (COMPARE *) args;
|
---|
| 685 | HAB hab;
|
---|
| 686 | HMQ hmq;
|
---|
[2] | 687 |
|
---|
[783] | 688 | if (!cmp) {
|
---|
| 689 | Runtime_Error(pszSrcFile, __LINE__, "no data");
|
---|
[2] | 690 | return;
|
---|
[783] | 691 | }
|
---|
[2] | 692 |
|
---|
| 693 | DosError(FERR_DISABLEHARDERR);
|
---|
| 694 |
|
---|
| 695 | hab = WinInitialize(0);
|
---|
[551] | 696 | if (hab) {
|
---|
| 697 | hmq = WinCreateMsgQueue(hab, 0);
|
---|
| 698 | if (hmq) {
|
---|
| 699 | WinCancelShutdown(hmq, TRUE);
|
---|
[535] | 700 | IncrThreadUsage();
|
---|
[2] | 701 | priority_normal();
|
---|
[551] | 702 | switch (cmp->action) {
|
---|
| 703 | case IDM_INVERT:
|
---|
| 704 | InvertAll(WinWindowFromID(cmp->hwnd, COMP_LEFTDIR));
|
---|
| 705 | InvertAll(WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR));
|
---|
| 706 | break;
|
---|
[2] | 707 |
|
---|
[551] | 708 | case IDM_DESELECTALL:
|
---|
| 709 | Deselect(WinWindowFromID(cmp->hwnd, COMP_LEFTDIR));
|
---|
| 710 | Deselect(WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR));
|
---|
| 711 | break;
|
---|
[2] | 712 |
|
---|
[551] | 713 | default:
|
---|
| 714 | SpecialSelect(WinWindowFromID(cmp->hwnd, COMP_LEFTDIR),
|
---|
| 715 | WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR),
|
---|
| 716 | cmp->action, cmp->reset);
|
---|
| 717 | break;
|
---|
[2] | 718 | }
|
---|
[551] | 719 | if (!PostMsg(cmp->hwnd, UM_CONTAINER_FILLED, MPFROMLONG(1L), MPVOID))
|
---|
| 720 | WinSendMsg(cmp->hwnd, UM_CONTAINER_FILLED, MPFROMLONG(1L), MPVOID);
|
---|
[2] | 721 | WinDestroyMsgQueue(hmq);
|
---|
| 722 | }
|
---|
[535] | 723 | DecrThreadUsage();
|
---|
[2] | 724 | WinTerminate(hab);
|
---|
| 725 | }
|
---|
| 726 | free(cmp);
|
---|
| 727 | }
|
---|
| 728 |
|
---|
[748] | 729 | /**
|
---|
| 730 | * Build FILELIST given pathname
|
---|
| 731 | */
|
---|
| 732 |
|
---|
| 733 | static VOID FillDirList(CHAR *str, INT skiplen, BOOL recurse,
|
---|
| 734 | FILELIST ***list, INT *numfiles, INT *numalloc)
|
---|
[551] | 735 | {
|
---|
[748] | 736 | CHAR *enddir;
|
---|
| 737 | ULONG x;
|
---|
[551] | 738 | CHAR *maskstr;
|
---|
[783] | 739 | PFILEFINDBUF4 pffbArray;
|
---|
| 740 | PFILEFINDBUF4 pffbFile;
|
---|
[551] | 741 | HDIR hDir;
|
---|
[783] | 742 | ULONG ulFindCnt;
|
---|
| 743 | ULONG ulBufBytes = sizeof(FILEFINDBUF4) * FilesToGet;
|
---|
[551] | 744 | APIRET rc;
|
---|
[2] | 745 |
|
---|
[748] | 746 | if (!str || !*str) {
|
---|
[773] | 747 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
[2] | 748 | return;
|
---|
[748] | 749 | }
|
---|
| 750 |
|
---|
[551] | 751 | maskstr = xmalloc(CCHMAXPATH, pszSrcFile, __LINE__);
|
---|
| 752 | if (!maskstr)
|
---|
[2] | 753 | return;
|
---|
[783] | 754 | pffbArray = xmalloc(ulBufBytes, pszSrcFile, __LINE__);
|
---|
| 755 | if (!pffbArray) {
|
---|
[2] | 756 | free(maskstr);
|
---|
| 757 | return;
|
---|
| 758 | }
|
---|
| 759 | x = strlen(str);
|
---|
[551] | 760 | memcpy(maskstr, str, x + 1);
|
---|
[2] | 761 | enddir = maskstr + x;
|
---|
[551] | 762 | if (*(enddir - 1) != '\\') {
|
---|
[2] | 763 | *enddir = '\\';
|
---|
| 764 | enddir++;
|
---|
| 765 | *enddir = 0;
|
---|
| 766 | }
|
---|
| 767 | *enddir = '*';
|
---|
| 768 | *(enddir + 1) = 0;
|
---|
| 769 | hDir = HDIR_CREATE;
|
---|
| 770 | DosError(FERR_DISABLEHARDERR);
|
---|
[783] | 771 | ulFindCnt = FilesToGet;
|
---|
[2] | 772 | rc = DosFindFirst(maskstr, &hDir,
|
---|
[783] | 773 | FILE_NORMAL | FILE_READONLY | FILE_ARCHIVED |
|
---|
| 774 | FILE_SYSTEM | FILE_HIDDEN |
|
---|
| 775 | (recurse ? FILE_DIRECTORY : 0),
|
---|
| 776 | pffbArray, ulBufBytes, &ulFindCnt, FIL_QUERYEASIZE);
|
---|
[551] | 777 | if (!rc) {
|
---|
[783] | 778 | do {
|
---|
| 779 | pffbFile = pffbArray;
|
---|
| 780 | for (x = 0; x < ulFindCnt; x++) {
|
---|
| 781 | if (pffbFile->attrFile & FILE_DIRECTORY) {
|
---|
[517] | 782 | // Skip . and ..
|
---|
[551] | 783 | if (recurse &&
|
---|
[783] | 784 | (pffbFile->achName[0] != '.' ||
|
---|
| 785 | (pffbFile->achName[1] &&
|
---|
| 786 | (pffbFile->achName[1] != '.' || pffbFile->achName[2])))) {
|
---|
[551] | 787 | if (fForceUpper)
|
---|
[783] | 788 | strupr(pffbFile->achName);
|
---|
[551] | 789 | else if (fForceLower)
|
---|
[783] | 790 | strlwr(pffbFile->achName);
|
---|
| 791 | memcpy(enddir, pffbFile->achName, pffbFile->cchName + 1);
|
---|
[551] | 792 | FillDirList(maskstr, skiplen, recurse, list, numfiles, numalloc);
|
---|
| 793 | }
|
---|
| 794 | }
|
---|
| 795 | else {
|
---|
| 796 | if (fForceUpper)
|
---|
[783] | 797 | strupr(pffbFile->achName);
|
---|
[551] | 798 | else if (fForceLower)
|
---|
[783] | 799 | strlwr(pffbFile->achName);
|
---|
| 800 | memcpy(enddir, pffbFile->achName, pffbFile->cchName + 1);
|
---|
| 801 | if (AddToFileList(maskstr + skiplen,
|
---|
| 802 | pffbFile, list, numfiles, numalloc)) {
|
---|
[551] | 803 | goto Abort;
|
---|
[783] | 804 | }
|
---|
[551] | 805 | }
|
---|
[783] | 806 | pffbFile = (PFILEFINDBUF4)((PBYTE)pffbFile + pffbFile->oNextEntryOffset);
|
---|
| 807 | } // for
|
---|
[2] | 808 | DosError(FERR_DISABLEHARDERR);
|
---|
[783] | 809 | ulFindCnt = FilesToGet;
|
---|
| 810 | rc = DosFindNext(hDir, pffbArray, ulBufBytes, &ulFindCnt);
|
---|
| 811 | } while (!rc);
|
---|
| 812 |
|
---|
| 813 | Abort:
|
---|
| 814 |
|
---|
[2] | 815 | DosFindClose(hDir);
|
---|
[748] | 816 | DosSleep(1);
|
---|
[2] | 817 | }
|
---|
[783] | 818 |
|
---|
| 819 | if (rc && rc != ERROR_NO_MORE_FILES) {
|
---|
| 820 | Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
| 821 | GetPString(IDS_CANTFINDDIRTEXT), maskstr);
|
---|
| 822 | }
|
---|
| 823 |
|
---|
[2] | 824 | free(maskstr);
|
---|
[783] | 825 | free(pffbArray);
|
---|
[2] | 826 | }
|
---|
| 827 |
|
---|
[316] | 828 | //=== CompNames() Compare names for qsort ===
|
---|
[2] | 829 |
|
---|
[551] | 830 | static int CompNames(const void *n1, const void *n2)
|
---|
[316] | 831 | {
|
---|
[551] | 832 | FILELIST *fl1 = *(FILELIST **) n1;
|
---|
| 833 | FILELIST *fl2 = *(FILELIST **) n2;
|
---|
[2] | 834 |
|
---|
[551] | 835 | return stricmp(fl1->fname, fl2->fname);
|
---|
[2] | 836 | }
|
---|
| 837 |
|
---|
[316] | 838 | //=== FillCnrsThread() Fill left and right containers ===
|
---|
[2] | 839 |
|
---|
[751] | 840 | static VOID FillCnrsThread(VOID *args)
|
---|
[316] | 841 | {
|
---|
[551] | 842 | COMPARE *cmp = (COMPARE *) args;
|
---|
| 843 | HAB hab;
|
---|
| 844 | HMQ hmq;
|
---|
| 845 | BOOL notified = FALSE;
|
---|
[751] | 846 |
|
---|
[790] | 847 | ULONG lastMSec = GetMSecTimer();
|
---|
| 848 | ULONG ul;
|
---|
| 849 |
|
---|
[551] | 850 | HWND hwndLeft, hwndRight;
|
---|
[748] | 851 | CHAR szBuf[CCHMAXPATH];
|
---|
| 852 | CNRINFO cnri;
|
---|
[2] | 853 |
|
---|
[748] | 854 | if (!cmp) {
|
---|
[773] | 855 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
[2] | 856 | _endthread();
|
---|
[748] | 857 | }
|
---|
[2] | 858 |
|
---|
| 859 | DosError(FERR_DISABLEHARDERR);
|
---|
| 860 |
|
---|
| 861 | hab = WinInitialize(0);
|
---|
[551] | 862 | if (!hab)
|
---|
| 863 | Win_Error(NULLHANDLE, NULLHANDLE, pszSrcFile, __LINE__, "WinInitialize");
|
---|
[362] | 864 | else {
|
---|
[551] | 865 | hmq = WinCreateMsgQueue(hab, 0);
|
---|
| 866 | if (!hmq)
|
---|
| 867 | Win_Error(NULLHANDLE, NULLHANDLE, pszSrcFile, __LINE__,
|
---|
| 868 | "WinCreateMsgQueue");
|
---|
[362] | 869 | else {
|
---|
[551] | 870 | INT x;
|
---|
| 871 | INT l;
|
---|
| 872 | INT r;
|
---|
| 873 | ULONG cntr;
|
---|
| 874 | FILELIST **filesl = NULL;
|
---|
| 875 | FILELIST **filesr = NULL;
|
---|
| 876 | INT numfilesl = 0;
|
---|
| 877 | INT numfilesr = 0;
|
---|
| 878 | INT numallocl = 0;
|
---|
| 879 | INT numallocr = 0;
|
---|
[769] | 880 | UINT lenl; // Directory prefix length
|
---|
| 881 | UINT lenr;
|
---|
[748] | 882 | UINT recsNeeded;
|
---|
[551] | 883 | PCNRITEM pcilFirst;
|
---|
| 884 | PCNRITEM pcirFirst;
|
---|
| 885 | PCNRITEM pcil;
|
---|
| 886 | PCNRITEM pcir;
|
---|
| 887 | RECORDINSERT ri;
|
---|
| 888 | CHAR *pch;
|
---|
[2] | 889 |
|
---|
[551] | 890 | WinCancelShutdown(hmq, TRUE);
|
---|
[535] | 891 | IncrThreadUsage();
|
---|
[551] | 892 | hwndLeft = WinWindowFromID(cmp->hwnd, COMP_LEFTDIR);
|
---|
| 893 | hwndRight = WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR);
|
---|
[2] | 894 | lenl = strlen(cmp->leftdir);
|
---|
[551] | 895 | if (cmp->leftdir[strlen(cmp->leftdir) - 1] != '\\')
|
---|
| 896 | lenl++;
|
---|
[2] | 897 | lenr = strlen(cmp->rightdir);
|
---|
[551] | 898 | if (cmp->rightdir[strlen(cmp->rightdir) - 1] != '\\')
|
---|
| 899 | lenr++;
|
---|
[2] | 900 | priority_normal();
|
---|
[748] | 901 | // Clear containers
|
---|
[751] | 902 | RemoveCnrItems(hwndRight, NULL, 0, CMA_FREE | CMA_INVALIDATE);
|
---|
| 903 | RemoveCnrItems(hwndLeft, NULL, 0, CMA_FREE | CMA_INVALIDATE);
|
---|
[2] | 904 | cmp->cmp->totalleft = cmp->cmp->totalright = 0;
|
---|
| 905 |
|
---|
[748] | 906 | // Build list of all files in left directory
|
---|
[551] | 907 | if (fForceLower)
|
---|
| 908 | strlwr(cmp->leftdir);
|
---|
| 909 | else if (fForceUpper)
|
---|
| 910 | strupr(cmp->leftdir);
|
---|
| 911 | FillDirList(cmp->leftdir, lenl, cmp->includesubdirs,
|
---|
| 912 | &filesl, &numfilesl, &numallocl);
|
---|
[2] | 913 |
|
---|
[551] | 914 | if (filesl)
|
---|
| 915 | qsort(filesl, numfilesl, sizeof(CHAR *), CompNames);
|
---|
[748] | 916 |
|
---|
| 917 | // Build list of all files in right directory
|
---|
[551] | 918 | if (!*cmp->rightlist) {
|
---|
| 919 | if (fForceLower)
|
---|
| 920 | strlwr(cmp->rightdir);
|
---|
| 921 | else if (fForceUpper)
|
---|
| 922 | strupr(cmp->rightdir);
|
---|
| 923 | FillDirList(cmp->rightdir, lenr, cmp->includesubdirs,
|
---|
| 924 | &filesr, &numfilesr, &numallocr);
|
---|
[2] | 925 | }
|
---|
[551] | 926 | else {
|
---|
[748] | 927 | // Use snapshot file
|
---|
[551] | 928 | FILE *fp;
|
---|
| 929 | FILEFINDBUF4 fb4;
|
---|
| 930 | CHAR str[CCHMAXPATH * 2], *p;
|
---|
[2] | 931 |
|
---|
[551] | 932 | memset(&fb4, 0, sizeof(fb4));
|
---|
| 933 | fp = fopen(cmp->rightlist, "r");
|
---|
| 934 | if (!fp)
|
---|
| 935 | Runtime_Error(pszSrcFile, __LINE__, "can not open %s (%d)",
|
---|
| 936 | cmp->rightlist, errno);
|
---|
[362] | 937 | else {
|
---|
[551] | 938 | while (!feof(fp)) {
|
---|
[748] | 939 | // First get name of directory
|
---|
[551] | 940 | if (!xfgets_bstripcr(str, sizeof(str), fp, pszSrcFile, __LINE__))
|
---|
| 941 | break; // EOF
|
---|
| 942 | p = str;
|
---|
| 943 | if (*p == '\"') {
|
---|
[748] | 944 | // Quoted
|
---|
[551] | 945 | p++;
|
---|
| 946 | if (*p && *p != '\"') {
|
---|
| 947 | p = strchr(p, '\"');
|
---|
| 948 | if (p) {
|
---|
| 949 | *p = 0;
|
---|
| 950 | if (*(str + 1)) {
|
---|
| 951 | strcpy(cmp->rightdir, str + 1);
|
---|
| 952 | if (fForceUpper)
|
---|
| 953 | strupr(cmp->rightdir);
|
---|
| 954 | else if (fForceLower)
|
---|
| 955 | strlwr(cmp->rightdir);
|
---|
| 956 | p = cmp->rightdir + (strlen(cmp->rightdir) - 1);
|
---|
| 957 | if (p - cmp->rightdir > 3 && *p == '\\')
|
---|
| 958 | *p = 0; // Chop trailing slash
|
---|
| 959 | break;
|
---|
| 960 | }
|
---|
| 961 | }
|
---|
| 962 | }
|
---|
| 963 | }
|
---|
[748] | 964 | } // while !EOF
|
---|
[2] | 965 |
|
---|
[748] | 966 | memset(&cnri, 0, sizeof(cnri));
|
---|
| 967 | cnri.cb = sizeof(cnri);
|
---|
| 968 | cnri.pszCnrTitle = cmp->rightdir;
|
---|
| 969 | if (!WinSendMsg(hwndRight, CM_SETCNRINFO,
|
---|
| 970 | MPFROMP(&cnri), MPFROMLONG(CMA_CNRTITLE))) {
|
---|
| 971 | Win_Error(hwndRight, cmp->hwnd, pszSrcFile, __LINE__, "CM_SETCNRINFO");
|
---|
[551] | 972 | }
|
---|
[748] | 973 |
|
---|
[551] | 974 | if (*cmp->rightdir) {
|
---|
[769] | 975 | lenr = strlen(cmp->rightdir);
|
---|
| 976 | if (cmp->rightdir[strlen(cmp->rightdir) - 1] != '\\')
|
---|
| 977 | lenr++;
|
---|
[551] | 978 | while (!feof(fp)) {
|
---|
| 979 | if (!xfgets_bstripcr
|
---|
| 980 | (str, sizeof(str), fp, pszSrcFile, __LINE__))
|
---|
| 981 | break;
|
---|
| 982 | p = str;
|
---|
| 983 | if (*p == '\"') {
|
---|
| 984 | p++;
|
---|
| 985 | if (*p && *p != '\"') {
|
---|
| 986 | p = strchr(p, '\"');
|
---|
| 987 | if (p) {
|
---|
| 988 | *p = 0;
|
---|
| 989 | p++;
|
---|
| 990 | if (*p == ',') {
|
---|
| 991 | p++;
|
---|
| 992 | if (!cmp->includesubdirs && atol(p) > lenr)
|
---|
| 993 | continue;
|
---|
| 994 | p = strchr(p, ',');
|
---|
| 995 | if (p) {
|
---|
| 996 | p++;
|
---|
| 997 | fb4.cbFile = atol(p);
|
---|
| 998 | p = strchr(p, ',');
|
---|
| 999 | if (p) {
|
---|
| 1000 | p++;
|
---|
| 1001 | fb4.fdateLastWrite.year = atol(p) - 1980;
|
---|
| 1002 | p = strchr(p, '/');
|
---|
| 1003 | if (p) {
|
---|
| 1004 | p++;
|
---|
| 1005 | fb4.fdateLastWrite.month = atol(p);
|
---|
| 1006 | p = strchr(p, '/');
|
---|
| 1007 | if (p) {
|
---|
| 1008 | p++;
|
---|
| 1009 | fb4.fdateLastWrite.day = atol(p);
|
---|
| 1010 | p = strchr(p, ',');
|
---|
| 1011 | if (p) {
|
---|
| 1012 | p++;
|
---|
| 1013 | fb4.ftimeLastWrite.hours = atol(p);
|
---|
| 1014 | p = strchr(p, ':');
|
---|
| 1015 | if (p) {
|
---|
| 1016 | p++;
|
---|
| 1017 | fb4.ftimeLastWrite.minutes = atol(p);
|
---|
| 1018 | p = strchr(p, ':');
|
---|
| 1019 | if (p) {
|
---|
| 1020 | p++;
|
---|
| 1021 | fb4.ftimeLastWrite.twosecs = atol(p);
|
---|
| 1022 | p = strchr(p, ',');
|
---|
| 1023 | if (p) {
|
---|
| 1024 | p++;
|
---|
| 1025 | fb4.attrFile = atol(p);
|
---|
| 1026 | p = strchr(p, ',');
|
---|
| 1027 | if (p) {
|
---|
| 1028 | p++;
|
---|
| 1029 | fb4.cbList = atol(p) * 2;
|
---|
| 1030 | if (fForceUpper)
|
---|
| 1031 | strupr(str + 1);
|
---|
| 1032 | else if (fForceLower)
|
---|
| 1033 | strlwr(str + 1);
|
---|
| 1034 | if (AddToFileList((str + 1) + lenr,
|
---|
| 1035 | &fb4,
|
---|
| 1036 | &filesr,
|
---|
| 1037 | &numfilesr,
|
---|
| 1038 | &numallocr))
|
---|
| 1039 | break;
|
---|
| 1040 | }
|
---|
| 1041 | }
|
---|
| 1042 | }
|
---|
| 1043 | }
|
---|
| 1044 | }
|
---|
| 1045 | }
|
---|
| 1046 | }
|
---|
| 1047 | }
|
---|
| 1048 | }
|
---|
| 1049 | }
|
---|
| 1050 | }
|
---|
| 1051 | }
|
---|
| 1052 | }
|
---|
[748] | 1053 | } // while
|
---|
| 1054 | } // if have rightdir
|
---|
[551] | 1055 | fclose(fp);
|
---|
| 1056 | }
|
---|
[748] | 1057 | } // if snapshot file
|
---|
[316] | 1058 |
|
---|
[551] | 1059 | if (filesr)
|
---|
| 1060 | qsort(filesr, numfilesr, sizeof(CHAR *), CompNames);
|
---|
[2] | 1061 |
|
---|
[748] | 1062 | // We now have two lists of files, both sorted.
|
---|
| 1063 | // Count total number of container entries required on each side
|
---|
[2] | 1064 | l = r = 0;
|
---|
[316] | 1065 | recsNeeded = 0;
|
---|
[551] | 1066 | while ((filesl && filesl[l]) || (filesr && filesr[r])) {
|
---|
[748] | 1067 |
|
---|
| 1068 | if (filesl && filesl[l]) {
|
---|
| 1069 | if (filesr && filesr[r])
|
---|
| 1070 | x = stricmp(filesl[l]->fname, filesr[r]->fname);
|
---|
[551] | 1071 | else
|
---|
[748] | 1072 | x = -1; // Left side list longer
|
---|
[551] | 1073 | }
|
---|
[748] | 1074 | else
|
---|
| 1075 | x = +1; // Right side list longer
|
---|
| 1076 |
|
---|
| 1077 | if (x <= 0)
|
---|
| 1078 | l++; // On left side
|
---|
| 1079 | if (x >= 0)
|
---|
| 1080 | r++; // On right side
|
---|
| 1081 |
|
---|
| 1082 | recsNeeded++; // Keep count of how many entries req'd
|
---|
| 1083 |
|
---|
| 1084 | } // while
|
---|
| 1085 |
|
---|
[551] | 1086 | WinSendMsg(cmp->hwnd, UM_CONTAINERHWND, MPVOID, MPVOID);
|
---|
[748] | 1087 |
|
---|
| 1088 | // Now insert records into the containers
|
---|
[2] | 1089 | cntr = 0;
|
---|
| 1090 | l = r = 0;
|
---|
[551] | 1091 | if (recsNeeded) {
|
---|
| 1092 | pcilFirst = WinSendMsg(hwndLeft,
|
---|
| 1093 | CM_ALLOCRECORD,
|
---|
[751] | 1094 | MPFROMLONG(EXTRA_RECORD_BYTES),
|
---|
[551] | 1095 | MPFROMLONG(recsNeeded));
|
---|
| 1096 | if (!pcilFirst) {
|
---|
[742] | 1097 | Win_Error(hwndLeft, cmp->hwnd, pszSrcFile, __LINE__, "CM_ALLOCRECORD %u failed",
|
---|
| 1098 | recsNeeded);
|
---|
[551] | 1099 | recsNeeded = 0;
|
---|
| 1100 | }
|
---|
[316] | 1101 | }
|
---|
[362] | 1102 | if (recsNeeded) {
|
---|
[551] | 1103 | pcirFirst = WinSendMsg(hwndRight, CM_ALLOCRECORD,
|
---|
[751] | 1104 | MPFROMLONG(EXTRA_RECORD_BYTES),
|
---|
[551] | 1105 | MPFROMLONG(recsNeeded));
|
---|
| 1106 | if (!pcirFirst) {
|
---|
[742] | 1107 | Win_Error(hwndRight, cmp->hwnd, pszSrcFile, __LINE__, "CM_ALLOCRECORD %u failed",
|
---|
| 1108 | recsNeeded);
|
---|
[551] | 1109 | recsNeeded = 0;
|
---|
[751] | 1110 | FreeCnrItemList(hwndLeft, pcilFirst);
|
---|
[551] | 1111 | }
|
---|
[2] | 1112 | }
|
---|
[748] | 1113 |
|
---|
[362] | 1114 | if (recsNeeded) {
|
---|
[748] | 1115 |
|
---|
[551] | 1116 | pcil = pcilFirst;
|
---|
| 1117 | pcir = pcirFirst;
|
---|
| 1118 | while ((filesl && filesl[l]) || (filesr && filesr[r])) {
|
---|
| 1119 | pcir->hwndCnr = hwndRight;
|
---|
[748] | 1120 | pcir->rc.hptrIcon = (HPOINTER) 0;
|
---|
[551] | 1121 | pcil->hwndCnr = hwndLeft;
|
---|
| 1122 | pcil->rc.hptrIcon = (HPOINTER) 0;
|
---|
[748] | 1123 |
|
---|
| 1124 | if (filesl && filesl[l]) {
|
---|
| 1125 | if (filesr && filesr[r])
|
---|
| 1126 | x = stricmp(filesl[l]->fname, filesr[r]->fname);
|
---|
| 1127 | else
|
---|
| 1128 | x = -1; // Left side list longer
|
---|
| 1129 | }
|
---|
| 1130 | else
|
---|
| 1131 | x = +1; // Right side list longer
|
---|
| 1132 |
|
---|
| 1133 | if (x <= 0) {
|
---|
[769] | 1134 | // File appears on left side
|
---|
| 1135 | BldFullPathName(szBuf, cmp->leftdir, filesl[l]->fname);
|
---|
[763] | 1136 | //sprintf(szBuf, "%s%s%s", cmp->leftdir,
|
---|
| 1137 | // (cmp->leftdir[strlen(cmp->leftdir) - 1] == '\\') ?
|
---|
| 1138 | // NullStr : "\\", filesl[l]->fname);
|
---|
[769] | 1139 | pcil->pszFileName = xstrdup(szBuf, pszSrcFile, __LINE__);
|
---|
[748] | 1140 | pcil->pszDisplayName = pcil->pszFileName + lenl;
|
---|
| 1141 | pcil->attrFile = filesl[l]->attrFile;
|
---|
[751] | 1142 | pcil->pszDispAttr = FileAttrToString(pcil->attrFile);
|
---|
[748] | 1143 | pcil->cbFile = filesl[l]->cbFile;
|
---|
| 1144 | pcil->easize = filesl[l]->easize;
|
---|
| 1145 | pcil->date.day = filesl[l]->date.day;
|
---|
| 1146 | pcil->date.month = filesl[l]->date.month;
|
---|
| 1147 | pcil->date.year = filesl[l]->date.year + 1980;
|
---|
| 1148 | pcil->time.seconds = filesl[l]->time.twosecs * 2;
|
---|
| 1149 | pcil->time.minutes = filesl[l]->time.minutes;
|
---|
| 1150 | pcil->time.hours = filesl[l]->time.hours;
|
---|
| 1151 | pcil->ladate.day = filesl[l]->ladate.day;
|
---|
| 1152 | pcil->ladate.month = filesl[l]->ladate.month;
|
---|
| 1153 | pcil->ladate.year = filesl[l]->ladate.year + 1980;
|
---|
| 1154 | pcil->latime.seconds = filesl[l]->latime.twosecs * 2;
|
---|
| 1155 | pcil->latime.minutes = filesl[l]->latime.minutes;
|
---|
| 1156 | pcil->latime.hours = filesl[l]->latime.hours;
|
---|
| 1157 | pcil->crdate.day = filesl[l]->crdate.day;
|
---|
| 1158 | pcil->crdate.month = filesl[l]->crdate.month;
|
---|
| 1159 | pcil->crdate.year = filesl[l]->crdate.year + 1980;
|
---|
| 1160 | pcil->crtime.seconds = filesl[l]->crtime.twosecs * 2;
|
---|
| 1161 | pcil->crtime.minutes = filesl[l]->crtime.minutes;
|
---|
| 1162 | pcil->crtime.hours = filesl[l]->crtime.hours;
|
---|
| 1163 | if (*cmp->dcd.mask.szMask) {
|
---|
| 1164 | if (!Filter((PMINIRECORDCORE) pcil, (PVOID)&cmp->dcd.mask)) {
|
---|
| 1165 | pcil->rc.flRecordAttr |= CRA_FILTERED;
|
---|
| 1166 | pcir->rc.flRecordAttr |= CRA_FILTERED;
|
---|
| 1167 | }
|
---|
| 1168 | }
|
---|
| 1169 | } // if on left
|
---|
| 1170 |
|
---|
| 1171 | if (x >= 0) {
|
---|
[769] | 1172 | // File appears on right side
|
---|
[773] | 1173 | BldFullPathName(szBuf, cmp->rightdir, filesr[r]->fname);
|
---|
[769] | 1174 | //sprintf(szBuf, "%s%s%s", cmp->rightdir,
|
---|
| 1175 | // (cmp->rightdir[strlen(cmp->rightdir) - 1] == '\\') ?
|
---|
| 1176 | // NullStr : "\\", filesr[r]->fname);
|
---|
| 1177 | pcir->pszFileName = xstrdup(szBuf, pszSrcFile, __LINE__); // 31 Jul 07 SHL
|
---|
[748] | 1178 | pcir->pszDisplayName = pcir->pszFileName + lenr;
|
---|
| 1179 | pcir->attrFile = filesr[r]->attrFile;
|
---|
| 1180 | // pcir->rc.hptrIcon = hptrFile;
|
---|
[751] | 1181 | pcir->pszDispAttr = FileAttrToString(pcir->attrFile);
|
---|
[748] | 1182 | pcir->cbFile = filesr[r]->cbFile;
|
---|
| 1183 | pcir->easize = filesr[r]->easize;
|
---|
| 1184 | pcir->date.day = filesr[r]->date.day;
|
---|
| 1185 | pcir->date.month = filesr[r]->date.month;
|
---|
| 1186 | pcir->date.year = filesr[r]->date.year + 1980;
|
---|
| 1187 | pcir->time.seconds = filesr[r]->time.twosecs * 2;
|
---|
| 1188 | pcir->time.minutes = filesr[r]->time.minutes;
|
---|
| 1189 | pcir->time.hours = filesr[r]->time.hours;
|
---|
| 1190 | pcir->ladate.day = filesr[r]->ladate.day;
|
---|
| 1191 | pcir->ladate.month = filesr[r]->ladate.month;
|
---|
| 1192 | pcir->ladate.year = filesr[r]->ladate.year + 1980;
|
---|
| 1193 | pcir->latime.seconds = filesr[r]->latime.twosecs * 2;
|
---|
| 1194 | pcir->latime.minutes = filesr[r]->latime.minutes;
|
---|
| 1195 | pcir->latime.hours = filesr[r]->latime.hours;
|
---|
| 1196 | pcir->crdate.day = filesr[r]->crdate.day;
|
---|
| 1197 | pcir->crdate.month = filesr[r]->crdate.month;
|
---|
| 1198 | pcir->crdate.year = filesr[r]->crdate.year + 1980;
|
---|
| 1199 | pcir->crtime.seconds = filesr[r]->crtime.twosecs * 2;
|
---|
| 1200 | pcir->crtime.minutes = filesr[r]->crtime.minutes;
|
---|
| 1201 | pcir->crtime.hours = filesr[r]->crtime.hours;
|
---|
[790] | 1202 | // Bypass check if already filtered on left side
|
---|
| 1203 | if (~pcir->rc.flRecordAttr & CRA_FILTERED &&
|
---|
[748] | 1204 | *cmp->dcd.mask.szMask) {
|
---|
| 1205 | if (!Filter((PMINIRECORDCORE)pcir, (PVOID)&cmp->dcd.mask)) {
|
---|
| 1206 | pcil->rc.flRecordAttr |= CRA_FILTERED;
|
---|
| 1207 | pcir->rc.flRecordAttr |= CRA_FILTERED;
|
---|
| 1208 | }
|
---|
| 1209 | }
|
---|
| 1210 | } // if on right
|
---|
| 1211 |
|
---|
| 1212 | if (x == 0) {
|
---|
| 1213 | // File appears on both sides
|
---|
[769] | 1214 | pcil->flags |= CNRITEM_EXISTS;
|
---|
| 1215 | pcir->flags |= CNRITEM_EXISTS;
|
---|
| 1216 | pch = szBuf;
|
---|
[748] | 1217 | // Subject field holds status messages
|
---|
| 1218 | *pch = 0;
|
---|
| 1219 | if (pcil->cbFile + pcil->easize > pcir->cbFile + pcir->easize) {
|
---|
| 1220 | pcil->flags |= CNRITEM_LARGER;
|
---|
| 1221 | pcir->flags |= CNRITEM_SMALLER;
|
---|
| 1222 | strcpy(pch, GetPString(IDS_LARGERTEXT));
|
---|
| 1223 | pch += 6;
|
---|
| 1224 | }
|
---|
| 1225 | else if (pcil->cbFile + pcil->easize <
|
---|
| 1226 | pcir->cbFile + pcir->easize) {
|
---|
| 1227 | pcil->flags |= CNRITEM_SMALLER;
|
---|
| 1228 | pcir->flags |= CNRITEM_LARGER;
|
---|
| 1229 | strcpy(pch, GetPString(IDS_SMALLERTEXT));
|
---|
| 1230 | pch += 7;
|
---|
| 1231 | }
|
---|
| 1232 | if ((pcil->date.year > pcir->date.year) ? TRUE :
|
---|
| 1233 | (pcil->date.year < pcir->date.year) ? FALSE :
|
---|
| 1234 | (pcil->date.month > pcir->date.month) ? TRUE :
|
---|
| 1235 | (pcil->date.month < pcir->date.month) ? FALSE :
|
---|
| 1236 | (pcil->date.day > pcir->date.day) ? TRUE :
|
---|
| 1237 | (pcil->date.day < pcir->date.day) ? FALSE :
|
---|
| 1238 | (pcil->time.hours > pcir->time.hours) ? TRUE :
|
---|
| 1239 | (pcil->time.hours < pcir->time.hours) ? FALSE :
|
---|
| 1240 | (pcil->time.minutes > pcir->time.minutes) ? TRUE :
|
---|
| 1241 | (pcil->time.minutes < pcir->time.minutes) ? FALSE :
|
---|
| 1242 | (pcil->time.seconds > pcir->time.seconds) ? TRUE :
|
---|
| 1243 | (pcil->time.seconds < pcir->time.seconds) ? FALSE : FALSE) {
|
---|
| 1244 | pcil->flags |= CNRITEM_NEWER;
|
---|
| 1245 | pcir->flags |= CNRITEM_OLDER;
|
---|
[769] | 1246 | if (pch != szBuf) {
|
---|
[748] | 1247 | strcpy(pch, ", ");
|
---|
| 1248 | pch += 2;
|
---|
| 1249 | }
|
---|
| 1250 | strcpy(pch, GetPString(IDS_NEWERTEXT));
|
---|
| 1251 | pch += 5;
|
---|
| 1252 | }
|
---|
| 1253 | else if ((pcil->date.year < pcir->date.year) ? TRUE :
|
---|
| 1254 | (pcil->date.year > pcir->date.year) ? FALSE :
|
---|
| 1255 | (pcil->date.month < pcir->date.month) ? TRUE :
|
---|
| 1256 | (pcil->date.month > pcir->date.month) ? FALSE :
|
---|
| 1257 | (pcil->date.day < pcir->date.day) ? TRUE :
|
---|
| 1258 | (pcil->date.day > pcir->date.day) ? FALSE :
|
---|
| 1259 | (pcil->time.hours < pcir->time.hours) ? TRUE :
|
---|
| 1260 | (pcil->time.hours > pcir->time.hours) ? FALSE :
|
---|
| 1261 | (pcil->time.minutes < pcir->time.minutes) ? TRUE :
|
---|
| 1262 | (pcil->time.minutes > pcir->time.minutes) ? FALSE :
|
---|
| 1263 | (pcil->time.seconds < pcir->time.seconds) ? TRUE :
|
---|
| 1264 | (pcil->time.seconds > pcir->time.seconds) ? FALSE :
|
---|
| 1265 | FALSE) {
|
---|
| 1266 | pcil->flags |= CNRITEM_OLDER;
|
---|
| 1267 | pcir->flags |= CNRITEM_NEWER;
|
---|
[769] | 1268 | if (pch != szBuf) {
|
---|
[748] | 1269 | strcpy(pch, ", ");
|
---|
| 1270 | pch += 2;
|
---|
| 1271 | }
|
---|
| 1272 | strcpy(pch, GetPString(IDS_OLDERTEXT));
|
---|
| 1273 | pch += 5;
|
---|
| 1274 | }
|
---|
[769] | 1275 | pcil->pszSubject = *szBuf ?
|
---|
| 1276 | xstrdup(szBuf, pszSrcFile, __LINE__) :
|
---|
[751] | 1277 | NullStr;
|
---|
[748] | 1278 |
|
---|
| 1279 | } // if on both sides
|
---|
| 1280 |
|
---|
| 1281 | if (x <= 0) {
|
---|
| 1282 | free(filesl[l]);
|
---|
| 1283 | l++;
|
---|
| 1284 | }
|
---|
| 1285 |
|
---|
| 1286 | if (x >= 0) {
|
---|
| 1287 | free(filesr[r]);
|
---|
| 1288 | r++;
|
---|
| 1289 | }
|
---|
| 1290 |
|
---|
| 1291 | // Ensure empty buffers point somewhere
|
---|
| 1292 | if (!pcil->pszFileName) {
|
---|
| 1293 | pcil->pszFileName = NullStr;
|
---|
| 1294 | pcil->pszDisplayName = pcil->pszFileName;
|
---|
| 1295 | }
|
---|
| 1296 |
|
---|
| 1297 | if (!pcir->pszFileName) {
|
---|
| 1298 | pcir->pszFileName = NullStr;
|
---|
| 1299 | pcir->pszDisplayName = pcir->pszFileName;
|
---|
| 1300 | }
|
---|
| 1301 |
|
---|
[751] | 1302 | pcil->rc.pszIcon = pcil->pszDisplayName;
|
---|
| 1303 | pcir->rc.pszIcon = pcir->pszDisplayName;
|
---|
[748] | 1304 |
|
---|
[762] | 1305 | pcil->pszLongName = NullStr;
|
---|
| 1306 | pcir->pszLongName = NullStr;
|
---|
[751] | 1307 |
|
---|
[748] | 1308 | if (!pcil->pszSubject)
|
---|
| 1309 | pcil->pszSubject = NullStr;
|
---|
| 1310 | if (!pcir->pszSubject)
|
---|
[790] | 1311 | pcir->pszSubject = NullStr;
|
---|
[748] | 1312 |
|
---|
[751] | 1313 | if (!pcil->pszDispAttr)
|
---|
| 1314 | pcil->pszDispAttr = NullStr;
|
---|
| 1315 | if (!pcir->pszDispAttr)
|
---|
[790] | 1316 | pcir->pszDispAttr = NullStr;
|
---|
[751] | 1317 |
|
---|
[790] | 1318 | #if 0 // 20 Aug 07 SHL fixme to be gone
|
---|
[551] | 1319 | if (!(cntr % 500))
|
---|
[748] | 1320 | DosSleep(1);
|
---|
[551] | 1321 | else if (!(cntr % 50))
|
---|
[790] | 1322 | DosSleep(0);
|
---|
[551] | 1323 | cntr++;
|
---|
[790] | 1324 | #else
|
---|
| 1325 | if ((cntr++ % 500) == 0) {
|
---|
| 1326 | ul = GetMSecTimer();
|
---|
| 1327 | if (ul - lastMSec >= 1000) {
|
---|
| 1328 | lastMSec = ul;
|
---|
| 1329 | DosSleep(1);
|
---|
| 1330 | }
|
---|
| 1331 | }
|
---|
| 1332 | #endif
|
---|
[748] | 1333 |
|
---|
[551] | 1334 | pcil = (PCNRITEM) pcil->rc.preccNextRecord;
|
---|
| 1335 | pcir = (PCNRITEM) pcir->rc.preccNextRecord;
|
---|
[748] | 1336 |
|
---|
| 1337 | } // while filling left or right
|
---|
| 1338 |
|
---|
[551] | 1339 | if (filesl)
|
---|
| 1340 | free(filesl); // Free header - have already freed elements
|
---|
| 1341 | filesl = NULL;
|
---|
| 1342 | if (filesr)
|
---|
| 1343 | free(filesr);
|
---|
| 1344 | filesr = NULL;
|
---|
[748] | 1345 | // Insert 'em
|
---|
[551] | 1346 | WinSendMsg(cmp->hwnd, UM_CONTAINERDIR, MPVOID, MPVOID);
|
---|
[748] | 1347 |
|
---|
[551] | 1348 | memset(&ri, 0, sizeof(RECORDINSERT));
|
---|
| 1349 | ri.cb = sizeof(RECORDINSERT);
|
---|
| 1350 | ri.pRecordOrder = (PRECORDCORE) CMA_END;
|
---|
| 1351 | ri.pRecordParent = (PRECORDCORE) NULL;
|
---|
| 1352 | ri.zOrder = (ULONG) CMA_TOP;
|
---|
| 1353 | ri.cRecordsInsert = recsNeeded;
|
---|
| 1354 | ri.fInvalidateRecord = FALSE;
|
---|
| 1355 | if (!WinSendMsg(hwndLeft, CM_INSERTRECORD,
|
---|
| 1356 | MPFROMP(pcilFirst), MPFROMP(&ri))) {
|
---|
[742] | 1357 | Win_Error(hwndLeft, cmp->hwnd, pszSrcFile, __LINE__, "CM_INSERTRECORD");
|
---|
[751] | 1358 | FreeCnrItemList(hwndLeft, pcilFirst);
|
---|
[551] | 1359 | numfilesl = 0;
|
---|
| 1360 | }
|
---|
[748] | 1361 |
|
---|
[551] | 1362 | memset(&ri, 0, sizeof(RECORDINSERT));
|
---|
| 1363 | ri.cb = sizeof(RECORDINSERT);
|
---|
| 1364 | ri.pRecordOrder = (PRECORDCORE) CMA_END;
|
---|
| 1365 | ri.pRecordParent = (PRECORDCORE) NULL;
|
---|
| 1366 | ri.zOrder = (ULONG) CMA_TOP;
|
---|
| 1367 | ri.cRecordsInsert = recsNeeded;
|
---|
| 1368 | ri.fInvalidateRecord = FALSE;
|
---|
[751] | 1369 |
|
---|
[551] | 1370 | if (!WinSendMsg(hwndRight, CM_INSERTRECORD,
|
---|
| 1371 | MPFROMP(pcirFirst), MPFROMP(&ri))) {
|
---|
[751] | 1372 | Win_Error(hwndRight, cmp->hwnd, pszSrcFile, __LINE__, "CM_INSERTRECORD");
|
---|
| 1373 | RemoveCnrItems(hwndLeft, NULL, 0, CMA_FREE | CMA_INVALIDATE);
|
---|
| 1374 | FreeCnrItemList(hwndRight, pcirFirst);
|
---|
[551] | 1375 | numfilesr = 0;
|
---|
| 1376 | }
|
---|
[748] | 1377 |
|
---|
[551] | 1378 | cmp->cmp->totalleft = numfilesl;
|
---|
| 1379 | cmp->cmp->totalright = numfilesr;
|
---|
[748] | 1380 |
|
---|
| 1381 | } // if recsNeeded
|
---|
| 1382 |
|
---|
[2] | 1383 | Deselect(hwndLeft);
|
---|
| 1384 | Deselect(hwndRight);
|
---|
[748] | 1385 |
|
---|
[551] | 1386 | if (!PostMsg(cmp->hwnd, UM_CONTAINER_FILLED, MPVOID, MPVOID))
|
---|
| 1387 | WinSendMsg(cmp->hwnd, UM_CONTAINER_FILLED, MPVOID, MPVOID);
|
---|
[2] | 1388 | notified = TRUE;
|
---|
[748] | 1389 |
|
---|
[362] | 1390 | if (filesl)
|
---|
[748] | 1391 | FreeList((CHAR **)filesl); // Must have failed to create container
|
---|
[362] | 1392 | if (filesr)
|
---|
[748] | 1393 | FreeList((CHAR **)filesr);
|
---|
| 1394 |
|
---|
[2] | 1395 | WinDestroyMsgQueue(hmq);
|
---|
| 1396 | }
|
---|
[535] | 1397 | DecrThreadUsage();
|
---|
[2] | 1398 | WinTerminate(hab);
|
---|
| 1399 | }
|
---|
[362] | 1400 | if (!notified)
|
---|
[551] | 1401 | PostMsg(cmp->hwnd, UM_CONTAINER_FILLED, MPVOID, MPVOID);
|
---|
[2] | 1402 | free(cmp);
|
---|
| 1403 | DosPostEventSem(CompactSem);
|
---|
| 1404 | }
|
---|
| 1405 |
|
---|
[773] | 1406 | // fixme to be gone - use variable
|
---|
| 1407 | #define hwndLeft (WinWindowFromID(hwnd,COMP_LEFTDIR))
|
---|
| 1408 | #define hwndRight (WinWindowFromID(hwnd,COMP_RIGHTDIR))
|
---|
[2] | 1409 |
|
---|
[316] | 1410 | //=== CompareDlgProc() Compare directories dialog procedure ===
|
---|
[2] | 1411 |
|
---|
[551] | 1412 | MRESULT EXPENTRY CompareDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
[316] | 1413 | {
|
---|
[551] | 1414 | COMPARE *cmp;
|
---|
[773] | 1415 | BOOL temp;
|
---|
[362] | 1416 |
|
---|
[773] | 1417 | static HPOINTER hptr;
|
---|
[2] | 1418 |
|
---|
[551] | 1419 | switch (msg) {
|
---|
| 1420 | case WM_INITDLG:
|
---|
| 1421 | cmp = (COMPARE *) mp2;
|
---|
| 1422 | if (!cmp) {
|
---|
| 1423 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
| 1424 | WinDismissDlg(hwnd, 0);
|
---|
| 1425 | }
|
---|
| 1426 | else {
|
---|
| 1427 | if (!hptr)
|
---|
| 1428 | hptr = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, COMPARE_ICON);
|
---|
| 1429 | WinDefDlgProc(hwnd, WM_SETICON, MPFROMLONG(hptr), MPVOID);
|
---|
| 1430 | cmp->hwnd = hwnd;
|
---|
| 1431 | WinSetWindowPtr(hwnd, QWL_USER, (PVOID) cmp);
|
---|
| 1432 | SetCnrCols(hwndLeft, TRUE);
|
---|
| 1433 | SetCnrCols(hwndRight, TRUE);
|
---|
| 1434 | WinSendMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
|
---|
| 1435 | WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
|
---|
| 1436 | PostMsg(hwnd, UM_STRETCH, MPVOID, MPVOID);
|
---|
| 1437 | {
|
---|
| 1438 | USHORT ids[] = { COMP_LEFTDIR, COMP_RIGHTDIR, COMP_TOTALLEFT,
|
---|
[751] | 1439 | COMP_TOTALRIGHT, COMP_SELLEFT, COMP_SELRIGHT,
|
---|
| 1440 | 0
|
---|
| 1441 | };
|
---|
| 1442 | INT x;
|
---|
[2] | 1443 |
|
---|
[551] | 1444 | for (x = 0; ids[x]; x++)
|
---|
| 1445 | SetPresParams(WinWindowFromID(hwnd, ids[x]),
|
---|
| 1446 | &RGBGREY,
|
---|
| 1447 | &RGBBLACK, &RGBBLACK, GetPString(IDS_8HELVTEXT));
|
---|
[2] | 1448 | }
|
---|
[551] | 1449 | }
|
---|
| 1450 | break;
|
---|
[2] | 1451 |
|
---|
[551] | 1452 | case UM_STRETCH:
|
---|
| 1453 | {
|
---|
| 1454 | SWP swp, swpC;
|
---|
| 1455 | LONG titl, szbx, szby, sz;
|
---|
| 1456 | HWND hwndActive;
|
---|
[2] | 1457 |
|
---|
[551] | 1458 | WinQueryWindowPos(hwnd, &swp);
|
---|
| 1459 | if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE))) {
|
---|
| 1460 | hwndActive = WinQueryFocus(HWND_DESKTOP);
|
---|
| 1461 | szbx = SysVal(SV_CXSIZEBORDER);
|
---|
| 1462 | szby = SysVal(SV_CYSIZEBORDER);
|
---|
| 1463 | titl = SysVal(SV_CYTITLEBAR);
|
---|
| 1464 | titl += 26;
|
---|
| 1465 | swp.cx -= (szbx * 2);
|
---|
| 1466 | sz = (swp.cx / 8);
|
---|
| 1467 | WinQueryWindowPos(WinWindowFromID(hwnd, COMP_LEFTDIR), &swpC);
|
---|
| 1468 | WinSetWindowPos(WinWindowFromID(hwnd, COMP_LEFTDIR), HWND_TOP,
|
---|
| 1469 | szbx + 6,
|
---|
| 1470 | swpC.y,
|
---|
| 1471 | (swp.cx / 2) - (szbx + 6),
|
---|
| 1472 | ((swp.cy - swpC.y) - titl) - szby,
|
---|
| 1473 | SWP_MOVE | SWP_SIZE);
|
---|
| 1474 | WinSetWindowPos(WinWindowFromID(hwnd, COMP_RIGHTDIR), HWND_TOP,
|
---|
| 1475 | (swp.cx / 2) + (szbx + 6),
|
---|
| 1476 | swpC.y,
|
---|
| 1477 | (swp.cx / 2) - (szbx + 6),
|
---|
| 1478 | ((swp.cy - swpC.y) - titl) - szby,
|
---|
| 1479 | SWP_MOVE | SWP_SIZE);
|
---|
| 1480 | WinSetWindowPos(WinWindowFromID(hwnd, COMP_TOTALLEFTHDR), HWND_TOP,
|
---|
| 1481 | szbx + 6,
|
---|
| 1482 | ((swp.cy - titl) - szby) + 4,
|
---|
| 1483 | sz - (szbx + 6), 20, SWP_MOVE | SWP_SIZE);
|
---|
| 1484 | WinSetWindowPos(WinWindowFromID(hwnd, COMP_TOTALLEFT), HWND_TOP,
|
---|
| 1485 | sz + (szbx + 6),
|
---|
| 1486 | ((swp.cy - titl) - szby) + 4,
|
---|
| 1487 | sz - (szbx + 6), 20, SWP_MOVE | SWP_SIZE);
|
---|
| 1488 | WinSetWindowPos(WinWindowFromID(hwnd, COMP_SELLEFTHDR), HWND_TOP,
|
---|
| 1489 | (sz * 2) + (szbx + 6),
|
---|
| 1490 | ((swp.cy - titl) - szby) + 4,
|
---|
| 1491 | sz - (szbx + 6), 20, SWP_MOVE | SWP_SIZE);
|
---|
| 1492 | WinSetWindowPos(WinWindowFromID(hwnd, COMP_SELLEFT), HWND_TOP,
|
---|
| 1493 | (sz * 3) + (szbx + 6),
|
---|
| 1494 | ((swp.cy - titl) - szby) + 4,
|
---|
| 1495 | sz - (szbx + 6), 20, SWP_MOVE | SWP_SIZE);
|
---|
| 1496 | WinSetWindowPos(WinWindowFromID(hwnd, COMP_TOTALRIGHTHDR), HWND_TOP,
|
---|
| 1497 | (sz * 4) + (szbx + 6),
|
---|
| 1498 | ((swp.cy - titl) - szby) + 4,
|
---|
| 1499 | sz - (szbx + 6), 20, SWP_MOVE | SWP_SIZE);
|
---|
| 1500 | WinSetWindowPos(WinWindowFromID(hwnd, COMP_TOTALRIGHT), HWND_TOP,
|
---|
| 1501 | (sz * 5) + (szbx + 6),
|
---|
| 1502 | ((swp.cy - titl) - szby) + 4,
|
---|
| 1503 | sz - (szbx + 6), 20, SWP_MOVE | SWP_SIZE);
|
---|
| 1504 | WinSetWindowPos(WinWindowFromID(hwnd, COMP_SELRIGHTHDR), HWND_TOP,
|
---|
| 1505 | (sz * 6) + (szbx + 6),
|
---|
| 1506 | ((swp.cy - titl) - szby) + 4,
|
---|
| 1507 | sz - (szbx + 6), 20, SWP_MOVE | SWP_SIZE);
|
---|
| 1508 | WinSetWindowPos(WinWindowFromID(hwnd, COMP_SELRIGHT), HWND_TOP,
|
---|
| 1509 | (sz * 7) + (szbx + 6),
|
---|
| 1510 | ((swp.cy - titl) - szby) + 4,
|
---|
| 1511 | sz - (szbx + 6), 20, SWP_MOVE | SWP_SIZE);
|
---|
| 1512 | PaintRecessedWindow(WinWindowFromID(hwnd, COMP_TOTALLEFT),
|
---|
| 1513 | (HPS) 0, FALSE, FALSE);
|
---|
| 1514 | PaintRecessedWindow(WinWindowFromID(hwnd, COMP_SELLEFT),
|
---|
| 1515 | (HPS) 0, FALSE, FALSE);
|
---|
| 1516 | PaintRecessedWindow(WinWindowFromID(hwnd, COMP_TOTALRIGHT),
|
---|
| 1517 | (HPS) 0, FALSE, FALSE);
|
---|
| 1518 | PaintRecessedWindow(WinWindowFromID(hwnd, COMP_SELRIGHT),
|
---|
| 1519 | (HPS) 0, FALSE, FALSE);
|
---|
| 1520 | PaintRecessedWindow(hwndLeft, (HPS) 0,
|
---|
| 1521 | (hwndActive == hwndLeft), TRUE);
|
---|
| 1522 | PaintRecessedWindow(hwndRight, (HPS) 0,
|
---|
| 1523 | (hwndActive == hwndRight), TRUE);
|
---|
[2] | 1524 | }
|
---|
[551] | 1525 | }
|
---|
| 1526 | return 0;
|
---|
[2] | 1527 |
|
---|
[551] | 1528 | case WM_ADJUSTWINDOWPOS:
|
---|
| 1529 | PostMsg(hwnd, UM_STRETCH, MPVOID, MPVOID);
|
---|
| 1530 | break;
|
---|
[2] | 1531 |
|
---|
[551] | 1532 | case UM_SETUP:
|
---|
| 1533 | {
|
---|
| 1534 | CNRINFO cnri;
|
---|
| 1535 | BOOL tempsubj;
|
---|
[2] | 1536 |
|
---|
[551] | 1537 | cmp = INSTDATA(hwnd);
|
---|
| 1538 | if (cmp) {
|
---|
| 1539 | cmp->dcd.size = sizeof(DIRCNRDATA);
|
---|
| 1540 | cmp->dcd.type = DIR_FRAME;
|
---|
| 1541 | cmp->dcd.hwndFrame = hwnd;
|
---|
| 1542 | cmp->dcd.hwndClient = hwnd;
|
---|
| 1543 | cmp->dcd.mask.attrFile = (FILE_DIRECTORY | FILE_ARCHIVED |
|
---|
| 1544 | FILE_READONLY | FILE_SYSTEM | FILE_HIDDEN);
|
---|
| 1545 | LoadDetailsSwitches("DirCmp", &cmp->dcd);
|
---|
| 1546 | cmp->dcd.detailslongname = FALSE;
|
---|
[748] | 1547 | cmp->dcd.detailsicon = FALSE; // TRUE;
|
---|
[2] | 1548 | }
|
---|
[551] | 1549 | memset(&cnri, 0, sizeof(CNRINFO));
|
---|
| 1550 | cnri.cb = sizeof(CNRINFO);
|
---|
| 1551 | WinSendDlgItemMsg(hwnd, COMP_LEFTDIR, CM_QUERYCNRINFO,
|
---|
| 1552 | MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
|
---|
| 1553 | cnri.flWindowAttr |= (CA_OWNERDRAW | CV_MINI);
|
---|
| 1554 | cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET - 68;
|
---|
| 1555 | WinSendDlgItemMsg(hwnd, COMP_LEFTDIR, CM_SETCNRINFO, MPFROMP(&cnri),
|
---|
| 1556 | MPFROMLONG(CMA_FLWINDOWATTR | CMA_XVERTSPLITBAR));
|
---|
| 1557 | memset(&cnri, 0, sizeof(CNRINFO));
|
---|
| 1558 | cnri.cb = sizeof(CNRINFO);
|
---|
| 1559 | WinSendDlgItemMsg(hwnd, COMP_RIGHTDIR, CM_QUERYCNRINFO,
|
---|
| 1560 | MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
|
---|
| 1561 | cnri.flWindowAttr |= (CA_OWNERDRAW | CV_MINI);
|
---|
| 1562 | cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET - 54;
|
---|
| 1563 | WinSendDlgItemMsg(hwnd, COMP_RIGHTDIR, CM_SETCNRINFO, MPFROMP(&cnri),
|
---|
| 1564 | MPFROMLONG(CMA_FLWINDOWATTR | CMA_XVERTSPLITBAR));
|
---|
| 1565 | AdjustCnrColRO(hwndLeft, GetPString(IDS_FILENAMECOLTEXT), TRUE, FALSE);
|
---|
| 1566 | AdjustCnrColRO(hwndLeft, GetPString(IDS_LONGNAMECOLTEXT), TRUE, FALSE);
|
---|
| 1567 | AdjustCnrColRO(hwndRight, GetPString(IDS_FILENAMECOLTEXT), TRUE, FALSE);
|
---|
| 1568 | AdjustCnrColRO(hwndRight, GetPString(IDS_LONGNAMECOLTEXT), TRUE, FALSE);
|
---|
| 1569 | AdjustCnrColsForPref(hwndLeft, cmp->leftdir, &cmp->dcd, TRUE);
|
---|
| 1570 | tempsubj = cmp->dcd.detailssubject;
|
---|
| 1571 | cmp->dcd.detailssubject = FALSE;
|
---|
| 1572 | AdjustCnrColsForPref(hwndRight, cmp->rightdir, &cmp->dcd, TRUE);
|
---|
| 1573 | if (*cmp->rightlist) {
|
---|
| 1574 | AdjustCnrColVis(hwndRight, GetPString(IDS_LADATECOLTEXT), FALSE,
|
---|
| 1575 | FALSE);
|
---|
| 1576 | AdjustCnrColVis(hwndRight, GetPString(IDS_LATIMECOLTEXT), FALSE,
|
---|
| 1577 | FALSE);
|
---|
| 1578 | AdjustCnrColVis(hwndRight, GetPString(IDS_CRDATECOLTEXT), FALSE,
|
---|
| 1579 | FALSE);
|
---|
| 1580 | AdjustCnrColVis(hwndRight, GetPString(IDS_CRTIMECOLTEXT), FALSE,
|
---|
| 1581 | FALSE);
|
---|
| 1582 | }
|
---|
| 1583 | cmp->dcd.detailssubject = tempsubj;
|
---|
| 1584 | }
|
---|
| 1585 | return 0;
|
---|
[2] | 1586 |
|
---|
[551] | 1587 | case WM_DRAWITEM:
|
---|
| 1588 | if (mp2) {
|
---|
[748] | 1589 | POWNERITEM pown = (POWNERITEM)mp2;
|
---|
[551] | 1590 | PCNRDRAWITEMINFO pcown;
|
---|
| 1591 | PCNRITEM pci;
|
---|
[2] | 1592 |
|
---|
[748] | 1593 | pcown = (PCNRDRAWITEMINFO)pown->hItem;
|
---|
[551] | 1594 | if (pcown) {
|
---|
| 1595 | pci = (PCNRITEM) pcown->pRecord;
|
---|
[748] | 1596 | // 01 Aug 07 SHL if field null or blank, we draw
|
---|
| 1597 | // fixme to know why - probably to optimize and bypass draw?
|
---|
| 1598 | if (pci && (INT)pci != -1 && !*pci->pszFileName)
|
---|
[551] | 1599 | return MRFROMLONG(TRUE);
|
---|
[2] | 1600 | }
|
---|
[551] | 1601 | }
|
---|
| 1602 | return 0;
|
---|
[2] | 1603 |
|
---|
[551] | 1604 | case UM_CONTAINERHWND:
|
---|
| 1605 | WinSetDlgItemText(hwnd, COMP_NOTE, GetPString(IDS_COMPHOLDBLDLISTTEXT));
|
---|
| 1606 | return 0;
|
---|
[2] | 1607 |
|
---|
[551] | 1608 | case UM_CONTAINERDIR:
|
---|
| 1609 | WinSetDlgItemText(hwnd, COMP_NOTE, GetPString(IDS_COMPHOLDFILLCNRTEXT));
|
---|
| 1610 | return 0;
|
---|
[2] | 1611 |
|
---|
[551] | 1612 | case UM_CONTAINER_FILLED:
|
---|
| 1613 | cmp = INSTDATA(hwnd);
|
---|
| 1614 | if (!cmp) {
|
---|
| 1615 | Runtime_Error(pszSrcFile, __LINE__, "pCompare NULL");
|
---|
| 1616 | WinDismissDlg(hwnd, 0);
|
---|
| 1617 | }
|
---|
| 1618 | else {
|
---|
| 1619 | CHAR s[81];
|
---|
| 1620 |
|
---|
| 1621 | cmp->filling = FALSE;
|
---|
| 1622 | WinEnableWindow(hwndLeft, TRUE);
|
---|
| 1623 | WinEnableWindow(hwndRight, TRUE);
|
---|
| 1624 | WinEnableWindowUpdate(hwndLeft, TRUE);
|
---|
| 1625 | WinEnableWindowUpdate(hwndRight, TRUE);
|
---|
| 1626 | sprintf(s, " %d", cmp->totalleft);
|
---|
| 1627 | WinSetDlgItemText(hwnd, COMP_TOTALLEFT, s);
|
---|
| 1628 | sprintf(s, " %d", cmp->totalright);
|
---|
| 1629 | WinSetDlgItemText(hwnd, COMP_TOTALRIGHT, s);
|
---|
| 1630 | sprintf(s, " %d", cmp->selleft);
|
---|
| 1631 | WinSetDlgItemText(hwnd, COMP_SELLEFT, s);
|
---|
| 1632 | sprintf(s, " %d", cmp->selright);
|
---|
| 1633 | WinSetDlgItemText(hwnd, COMP_SELRIGHT, s);
|
---|
| 1634 | WinEnableWindow(WinWindowFromID(hwnd, DID_OK), TRUE);
|
---|
| 1635 | WinEnableWindow(WinWindowFromID(hwnd, DID_CANCEL), TRUE);
|
---|
| 1636 | WinEnableWindow(WinWindowFromID(hwnd, COMP_COLLECT), TRUE);
|
---|
| 1637 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTBOTH), TRUE);
|
---|
| 1638 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTONE), TRUE);
|
---|
| 1639 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTNEWER), TRUE);
|
---|
| 1640 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTOLDER), TRUE);
|
---|
| 1641 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTBIGGER), TRUE);
|
---|
| 1642 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSMALLER), TRUE);
|
---|
| 1643 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTBOTH), TRUE);
|
---|
| 1644 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTONE), TRUE);
|
---|
| 1645 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTNEWER), TRUE);
|
---|
| 1646 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTOLDER), TRUE);
|
---|
| 1647 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTBIGGER), TRUE);
|
---|
| 1648 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTSMALLER), TRUE);
|
---|
| 1649 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTALL), TRUE);
|
---|
| 1650 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSAMECONTENT), TRUE);
|
---|
| 1651 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTIDENTICAL), TRUE);
|
---|
| 1652 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSAME), TRUE);
|
---|
| 1653 | WinEnableWindow(WinWindowFromID(hwnd, IDM_INVERT), TRUE);
|
---|
| 1654 | WinEnableWindow(WinWindowFromID(hwnd, COMP_SETDIRS), TRUE);
|
---|
| 1655 | WinEnableWindow(WinWindowFromID(hwnd, COMP_DELETELEFT), TRUE);
|
---|
| 1656 | WinEnableWindow(WinWindowFromID(hwnd, COMP_FILTER), TRUE);
|
---|
| 1657 | if (!*cmp->rightlist) {
|
---|
| 1658 | WinEnableWindow(WinWindowFromID(hwnd, COMP_COPYLEFT), TRUE);
|
---|
| 1659 | WinEnableWindow(WinWindowFromID(hwnd, COMP_MOVELEFT), TRUE);
|
---|
| 1660 | WinEnableWindow(WinWindowFromID(hwnd, COMP_DELETERIGHT), TRUE);
|
---|
| 1661 | WinEnableWindow(WinWindowFromID(hwnd, COMP_COPYRIGHT), TRUE);
|
---|
| 1662 | WinEnableWindow(WinWindowFromID(hwnd, COMP_MOVERIGHT), TRUE);
|
---|
[362] | 1663 | }
|
---|
[551] | 1664 | WinEnableWindow(WinWindowFromID(hwnd, COMP_INCLUDESUBDIRS), TRUE);
|
---|
| 1665 | if (*cmp->dcd.mask.szMask)
|
---|
| 1666 | WinSetDlgItemText(hwnd, COMP_NOTE,
|
---|
| 1667 | GetPString(IDS_COMPREADYFILTEREDTEXT));
|
---|
| 1668 | else
|
---|
| 1669 | WinSetDlgItemText(hwnd, COMP_NOTE, GetPString(IDS_COMPREADYTEXT));
|
---|
| 1670 | }
|
---|
| 1671 | break;
|
---|
| 1672 |
|
---|
| 1673 | case WM_INITMENU:
|
---|
| 1674 | cmp = INSTDATA(hwnd);
|
---|
| 1675 | if (cmp) {
|
---|
| 1676 | switch (SHORT1FROMMP(mp1)) {
|
---|
| 1677 | case IDM_COMMANDSMENU:
|
---|
| 1678 | SetupCommandMenu(cmp->dcd.hwndLastMenu, hwnd);
|
---|
| 1679 | break;
|
---|
[2] | 1680 | }
|
---|
[551] | 1681 | }
|
---|
| 1682 | break;
|
---|
[2] | 1683 |
|
---|
[551] | 1684 | case WM_MENUEND:
|
---|
| 1685 | cmp = INSTDATA(hwnd);
|
---|
| 1686 | if (cmp) {
|
---|
| 1687 | if ((HWND) mp2 == cmp->dcd.hwndLastMenu) {
|
---|
| 1688 | MarkAll(hwndLeft, TRUE, FALSE, TRUE);
|
---|
| 1689 | MarkAll(hwndRight, TRUE, FALSE, TRUE);
|
---|
| 1690 | WinDestroyWindow(cmp->dcd.hwndLastMenu);
|
---|
| 1691 | cmp->dcd.hwndLastMenu = (HWND) 0;
|
---|
[2] | 1692 | }
|
---|
[551] | 1693 | }
|
---|
| 1694 | break;
|
---|
[2] | 1695 |
|
---|
[551] | 1696 | case WM_CONTROL:
|
---|
| 1697 | switch (SHORT1FROMMP(mp1)) {
|
---|
| 1698 | case COMP_INCLUDESUBDIRS:
|
---|
| 1699 | switch (SHORT2FROMMP(mp1)) {
|
---|
| 1700 | case BN_CLICKED:
|
---|
| 1701 | cmp = INSTDATA(hwnd);
|
---|
| 1702 | if (cmp)
|
---|
| 1703 | *cmp->rightlist = 0;
|
---|
| 1704 | PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
|
---|
| 1705 | PostMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
|
---|
| 1706 | break;
|
---|
[2] | 1707 | }
|
---|
| 1708 | break;
|
---|
[551] | 1709 | case COMP_HIDENOTSELECTED:
|
---|
| 1710 | switch (SHORT2FROMMP(mp1)) {
|
---|
| 1711 | case BN_CLICKED:
|
---|
| 1712 | WinSendMsg(hwnd, UM_HIDENOTSELECTED, MPVOID, MPVOID);
|
---|
| 1713 | break;
|
---|
| 1714 | }
|
---|
| 1715 | break;
|
---|
[2] | 1716 |
|
---|
[551] | 1717 | case COMP_LEFTDIR:
|
---|
| 1718 | case COMP_RIGHTDIR:
|
---|
| 1719 | switch (SHORT2FROMMP(mp1)) {
|
---|
| 1720 | case CN_KILLFOCUS:
|
---|
| 1721 | PaintRecessedWindow(WinWindowFromID(hwnd, SHORT1FROMMP(mp1)),
|
---|
| 1722 | (HPS) 0, FALSE, TRUE);
|
---|
| 1723 | break;
|
---|
[2] | 1724 |
|
---|
[551] | 1725 | case CN_SETFOCUS:
|
---|
| 1726 | PaintRecessedWindow(WinWindowFromID(hwnd, SHORT1FROMMP(mp1)),
|
---|
| 1727 | (HPS) 0, TRUE, TRUE);
|
---|
| 1728 | break;
|
---|
[2] | 1729 |
|
---|
[551] | 1730 | case CN_ENTER:
|
---|
| 1731 | if (mp2) {
|
---|
[2] | 1732 |
|
---|
[551] | 1733 | PCNRITEM pci = (PCNRITEM) ((PNOTIFYRECORDENTER) mp2)->pRecord;
|
---|
| 1734 | HWND hwndCnr = WinWindowFromID(hwnd, SHORT1FROMMP(mp1));
|
---|
[2] | 1735 |
|
---|
[551] | 1736 | SetShiftState();
|
---|
| 1737 | if (pci) {
|
---|
[748] | 1738 | if (pci->rc.flRecordAttr & CRA_INUSE || !pci || !*pci->pszFileName)
|
---|
[551] | 1739 | break;
|
---|
| 1740 | WinSendMsg(hwndCnr, CM_SETRECORDEMPHASIS, MPFROMP(pci),
|
---|
| 1741 | MPFROM2SHORT(TRUE, CRA_INUSE));
|
---|
| 1742 | if (pci->attrFile & FILE_DIRECTORY) {
|
---|
| 1743 | if ((shiftstate & (KC_CTRL | KC_SHIFT)) == (KC_CTRL | KC_SHIFT))
|
---|
[730] | 1744 | OpenObject(pci->pszFileName, Settings, hwnd);
|
---|
[551] | 1745 | else
|
---|
[730] | 1746 | OpenObject(pci->pszFileName, Default, hwnd);
|
---|
[551] | 1747 | }
|
---|
| 1748 | else
|
---|
| 1749 | DefaultViewKeys(hwnd, hwnd, HWND_DESKTOP, NULL,
|
---|
[730] | 1750 | pci->pszFileName);
|
---|
[551] | 1751 | WinSendMsg(hwndCnr, CM_SETRECORDEMPHASIS,
|
---|
| 1752 | MPFROMP(pci),
|
---|
| 1753 | MPFROM2SHORT(FALSE, CRA_INUSE |
|
---|
| 1754 | ((fUnHilite) ? CRA_SELECTED : 0)));
|
---|
| 1755 | }
|
---|
| 1756 | }
|
---|
| 1757 | break;
|
---|
[2] | 1758 |
|
---|
[551] | 1759 | case CN_CONTEXTMENU:
|
---|
| 1760 | cmp = INSTDATA(hwnd);
|
---|
| 1761 | if (cmp) {
|
---|
[2] | 1762 |
|
---|
[551] | 1763 | PCNRITEM pci = (PCNRITEM) mp2;
|
---|
| 1764 | USHORT id = COMP_CNRMENU;
|
---|
[2] | 1765 |
|
---|
[551] | 1766 | if (cmp->dcd.hwndLastMenu)
|
---|
| 1767 | WinDestroyWindow(cmp->dcd.hwndLastMenu);
|
---|
| 1768 | cmp->dcd.hwndLastMenu = (HWND) 0;
|
---|
| 1769 | cmp->hwndCalling = WinWindowFromID(hwnd, SHORT1FROMMP(mp1));
|
---|
| 1770 | if (pci) {
|
---|
[748] | 1771 | if (!pci || !*pci->pszFileName || *cmp->rightlist)
|
---|
[551] | 1772 | break;
|
---|
| 1773 | id = COMP_MENU;
|
---|
| 1774 | WinSendMsg(cmp->hwndCalling, CM_SETRECORDEMPHASIS,
|
---|
| 1775 | MPFROMP(pci), MPFROM2SHORT(TRUE, CRA_CURSORED));
|
---|
| 1776 | }
|
---|
| 1777 | cmp->dcd.hwndLastMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id);
|
---|
| 1778 | if (cmp->dcd.hwndLastMenu) {
|
---|
| 1779 | if (id == COMP_CNRMENU) {
|
---|
| 1780 | if (SHORT1FROMMP(mp1) == COMP_RIGHTDIR)
|
---|
| 1781 | WinSendMsg(cmp->dcd.hwndLastMenu, MM_DELETEITEM,
|
---|
| 1782 | MPFROM2SHORT(IDM_SHOWSUBJECT, FALSE), MPVOID);
|
---|
| 1783 | SetDetailsSwitches(cmp->dcd.hwndLastMenu, &cmp->dcd);
|
---|
| 1784 | if (SHORT1FROMMP(mp1) == COMP_LEFTDIR)
|
---|
| 1785 | WinSendMsg(cmp->dcd.hwndLastMenu, MM_DELETEITEM,
|
---|
| 1786 | MPFROM2SHORT(IDM_LOADLISTFILE, 0), MPVOID);
|
---|
| 1787 | else if (*cmp->rightlist)
|
---|
| 1788 | WinSendMsg(cmp->dcd.hwndLastMenu, MM_DELETEITEM,
|
---|
| 1789 | MPFROM2SHORT(IDM_SAVELISTFILE, 0), MPVOID);
|
---|
| 1790 | }
|
---|
| 1791 | PopupMenu(hwnd, hwnd, cmp->dcd.hwndLastMenu);
|
---|
| 1792 | }
|
---|
| 1793 | }
|
---|
| 1794 | break;
|
---|
[2] | 1795 |
|
---|
[551] | 1796 | case CN_INITDRAG:
|
---|
| 1797 | cmp = INSTDATA(hwnd);
|
---|
| 1798 | if (*cmp->rightlist && SHORT1FROMMP(mp1) == COMP_RIGHTDIR)
|
---|
| 1799 | break;
|
---|
| 1800 | DoFileDrag(WinWindowFromID(hwnd, SHORT1FROMMP(mp1)),
|
---|
| 1801 | (HWND) 0, mp2, NULL, NULL, TRUE);
|
---|
| 1802 | break;
|
---|
[2] | 1803 |
|
---|
[551] | 1804 | case CN_BEGINEDIT:
|
---|
| 1805 | case CN_REALLOCPSZ:
|
---|
| 1806 | // fixme to be gone - field edits not allowed
|
---|
| 1807 | Runtime_Error(pszSrcFile, __LINE__,
|
---|
| 1808 | "CN_BEGINEDIT/CN_REALLOCPSZ unexpected");
|
---|
| 1809 | break;
|
---|
[2] | 1810 |
|
---|
[551] | 1811 | case CN_EMPHASIS:
|
---|
| 1812 | {
|
---|
| 1813 | PNOTIFYRECORDEMPHASIS pre = mp2;
|
---|
| 1814 | PCNRITEM pci;
|
---|
[2] | 1815 |
|
---|
[551] | 1816 | if (pre->fEmphasisMask & CRA_SELECTED) {
|
---|
| 1817 | pci = (PCNRITEM) pre->pRecord;
|
---|
| 1818 | if (pci) {
|
---|
[748] | 1819 | if (!pci || !*pci->pszFileName) {
|
---|
[551] | 1820 | if (pci->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 1821 | WinSendDlgItemMsg(hwnd, SHORT1FROMMP(mp1),
|
---|
| 1822 | CM_SETRECORDEMPHASIS,
|
---|
| 1823 | MPFROMP(pci),
|
---|
| 1824 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
| 1825 | }
|
---|
| 1826 | else {
|
---|
[2] | 1827 |
|
---|
[551] | 1828 | CHAR s[81];
|
---|
[2] | 1829 |
|
---|
[551] | 1830 | cmp = INSTDATA(hwnd);
|
---|
| 1831 | if (pci->rc.flRecordAttr & CRA_SELECTED) {
|
---|
| 1832 | if (SHORT1FROMMP(mp1) == COMP_LEFTDIR)
|
---|
| 1833 | cmp->selleft++;
|
---|
| 1834 | else
|
---|
| 1835 | cmp->selright++;
|
---|
| 1836 | }
|
---|
| 1837 | else {
|
---|
| 1838 | if (SHORT1FROMMP(mp1) == COMP_LEFTDIR) {
|
---|
| 1839 | if (cmp->selleft)
|
---|
| 1840 | cmp->selleft--;
|
---|
| 1841 | }
|
---|
| 1842 | else {
|
---|
| 1843 | if (cmp->selright)
|
---|
| 1844 | cmp->selright--;
|
---|
| 1845 | }
|
---|
| 1846 | }
|
---|
| 1847 | if (SHORT1FROMMP(mp1) == COMP_LEFTDIR) {
|
---|
| 1848 | if (WinIsWindowEnabled(hwndLeft) || !(cmp->selleft % 50)) {
|
---|
| 1849 | sprintf(s, " %d", cmp->selleft);
|
---|
| 1850 | WinSetDlgItemText(hwnd, COMP_SELLEFT, s);
|
---|
| 1851 | }
|
---|
| 1852 | }
|
---|
| 1853 | else {
|
---|
| 1854 | if (WinIsWindowEnabled(hwndRight) || !(cmp->selright % 50)) {
|
---|
| 1855 | sprintf(s, " %d", cmp->selright);
|
---|
| 1856 | WinSetDlgItemText(hwnd, COMP_SELRIGHT, s);
|
---|
| 1857 | }
|
---|
| 1858 | }
|
---|
| 1859 | }
|
---|
| 1860 | }
|
---|
| 1861 | }
|
---|
| 1862 | }
|
---|
| 1863 | break;
|
---|
[2] | 1864 |
|
---|
[551] | 1865 | case CN_SCROLL:
|
---|
| 1866 | cmp = INSTDATA(hwnd);
|
---|
| 1867 | if (!cmp->forcescroll) {
|
---|
[2] | 1868 |
|
---|
[551] | 1869 | PNOTIFYSCROLL pns = mp2;
|
---|
[2] | 1870 |
|
---|
[551] | 1871 | if (pns->fScroll & CMA_VERTICAL) {
|
---|
| 1872 | cmp->forcescroll = TRUE;
|
---|
| 1873 | WinSendDlgItemMsg(hwnd, (SHORT1FROMMP(mp1) == COMP_LEFTDIR) ?
|
---|
| 1874 | COMP_RIGHTDIR : COMP_LEFTDIR,
|
---|
| 1875 | CM_SCROLLWINDOW, MPFROMSHORT(CMA_VERTICAL),
|
---|
| 1876 | MPFROMLONG(pns->lScrollInc));
|
---|
| 1877 | cmp->forcescroll = FALSE;
|
---|
| 1878 | }
|
---|
| 1879 | }
|
---|
| 1880 | break;
|
---|
[2] | 1881 | }
|
---|
[551] | 1882 | break; // COMP_RIGHTDIR
|
---|
| 1883 | }
|
---|
| 1884 | return 0; // WM_CONTROL
|
---|
[2] | 1885 |
|
---|
[551] | 1886 | case UM_SETDIR:
|
---|
| 1887 | cmp = INSTDATA(hwnd);
|
---|
| 1888 | if (cmp) {
|
---|
[2] | 1889 |
|
---|
[551] | 1890 | COMPARE *forthread;
|
---|
| 1891 | CNRINFO cnri;
|
---|
[2] | 1892 |
|
---|
[551] | 1893 | cmp->includesubdirs = WinQueryButtonCheckstate(hwnd,
|
---|
| 1894 | COMP_INCLUDESUBDIRS);
|
---|
| 1895 | memset(&cnri, 0, sizeof(CNRINFO));
|
---|
| 1896 | cnri.cb = sizeof(CNRINFO);
|
---|
| 1897 | cnri.pszCnrTitle = cmp->leftdir;
|
---|
| 1898 | cnri.flWindowAttr = CV_DETAIL | CV_MINI |
|
---|
[751] | 1899 | CA_CONTAINERTITLE | CA_TITLESEPARATOR |
|
---|
| 1900 | CA_DETAILSVIEWTITLES | CA_OWNERDRAW;
|
---|
[551] | 1901 | WinSendDlgItemMsg(hwnd, COMP_LEFTDIR, CM_SETCNRINFO, MPFROMP(&cnri),
|
---|
| 1902 | MPFROMLONG(CMA_CNRTITLE | CMA_FLWINDOWATTR));
|
---|
| 1903 | cnri.pszCnrTitle = cmp->rightdir;
|
---|
| 1904 | WinSendDlgItemMsg(hwnd, COMP_RIGHTDIR, CM_SETCNRINFO, MPFROMP(&cnri),
|
---|
| 1905 | MPFROMLONG(CMA_CNRTITLE | CMA_FLWINDOWATTR));
|
---|
| 1906 | WinCheckButton(hwnd, COMP_HIDENOTSELECTED, 0);
|
---|
| 1907 | cmp->filling = TRUE;
|
---|
| 1908 | forthread = xmalloc(sizeof(COMPARE), pszSrcFile, __LINE__);
|
---|
| 1909 | if (!forthread)
|
---|
| 1910 | WinDismissDlg(hwnd, 0);
|
---|
| 1911 | else {
|
---|
| 1912 | *forthread = *cmp;
|
---|
| 1913 | forthread->cmp = cmp;
|
---|
| 1914 | if (_beginthread(FillCnrsThread, NULL, 122880, (PVOID) forthread) ==
|
---|
| 1915 | -1) {
|
---|
| 1916 | Runtime_Error(pszSrcFile, __LINE__,
|
---|
| 1917 | GetPString(IDS_COULDNTSTARTTHREADTEXT));
|
---|
| 1918 | WinDismissDlg(hwnd, 0);
|
---|
| 1919 | free(forthread);
|
---|
| 1920 | }
|
---|
[362] | 1921 | else {
|
---|
[551] | 1922 | WinEnableWindowUpdate(hwndLeft, FALSE);
|
---|
| 1923 | WinEnableWindowUpdate(hwndRight, FALSE);
|
---|
| 1924 | cmp->selleft = cmp->selright = 0;
|
---|
| 1925 | WinSetDlgItemText(hwnd, COMP_SELLEFT, "0");
|
---|
| 1926 | WinSetDlgItemText(hwnd, COMP_SELRIGHT, "0");
|
---|
| 1927 | WinSetDlgItemText(hwnd, COMP_TOTALLEFT, "0");
|
---|
| 1928 | WinSetDlgItemText(hwnd, COMP_TOTALRIGHT, "0");
|
---|
| 1929 | WinSetDlgItemText(hwnd, COMP_NOTE,
|
---|
| 1930 | GetPString(IDS_COMPHOLDREADDISKTEXT));
|
---|
| 1931 | WinEnableWindow(hwndRight, FALSE);
|
---|
| 1932 | WinEnableWindow(hwndLeft, FALSE);
|
---|
| 1933 | WinEnableWindow(WinWindowFromID(hwnd, DID_OK), FALSE);
|
---|
| 1934 | WinEnableWindow(WinWindowFromID(hwnd, DID_CANCEL), FALSE);
|
---|
| 1935 | WinEnableWindow(WinWindowFromID(hwnd, COMP_COLLECT), FALSE);
|
---|
| 1936 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTBOTH), FALSE);
|
---|
| 1937 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTONE), FALSE);
|
---|
| 1938 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTNEWER), FALSE);
|
---|
| 1939 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTOLDER), FALSE);
|
---|
| 1940 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTBIGGER), FALSE);
|
---|
| 1941 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSMALLER), FALSE);
|
---|
| 1942 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTBOTH), FALSE);
|
---|
| 1943 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTONE), FALSE);
|
---|
| 1944 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTNEWER), FALSE);
|
---|
| 1945 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTOLDER), FALSE);
|
---|
| 1946 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTBIGGER), FALSE);
|
---|
| 1947 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTSMALLER), FALSE);
|
---|
| 1948 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTALL), FALSE);
|
---|
| 1949 | WinEnableWindow(WinWindowFromID(hwnd, COMP_INCLUDESUBDIRS), FALSE);
|
---|
| 1950 | WinEnableWindow(WinWindowFromID(hwnd, COMP_SETDIRS), FALSE);
|
---|
| 1951 | WinEnableWindow(WinWindowFromID(hwnd, COMP_DELETELEFT), FALSE);
|
---|
| 1952 | WinEnableWindow(WinWindowFromID(hwnd, COMP_DELETERIGHT), FALSE);
|
---|
| 1953 | WinEnableWindow(WinWindowFromID(hwnd, COMP_COPYLEFT), FALSE);
|
---|
| 1954 | WinEnableWindow(WinWindowFromID(hwnd, COMP_MOVELEFT), FALSE);
|
---|
| 1955 | WinEnableWindow(WinWindowFromID(hwnd, COMP_COPYRIGHT), FALSE);
|
---|
| 1956 | WinEnableWindow(WinWindowFromID(hwnd, COMP_MOVERIGHT), FALSE);
|
---|
| 1957 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSAMECONTENT),
|
---|
| 1958 | FALSE);
|
---|
| 1959 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTIDENTICAL), FALSE);
|
---|
| 1960 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSAME), FALSE);
|
---|
| 1961 | WinEnableWindow(WinWindowFromID(hwnd, IDM_INVERT), FALSE);
|
---|
| 1962 | WinEnableWindow(WinWindowFromID(hwnd, COMP_FILTER), FALSE);
|
---|
| 1963 | }
|
---|
[2] | 1964 | }
|
---|
[551] | 1965 | }
|
---|
| 1966 | return 0;
|
---|
[2] | 1967 |
|
---|
[551] | 1968 | case UM_FILTER:
|
---|
| 1969 | cmp = INSTDATA(hwnd);
|
---|
| 1970 | if (cmp) {
|
---|
| 1971 | if (mp1) {
|
---|
| 1972 | DosEnterCritSec();
|
---|
| 1973 | SetMask((CHAR *) mp1, &cmp->dcd.mask);
|
---|
| 1974 | DosExitCritSec();
|
---|
[2] | 1975 | }
|
---|
[551] | 1976 | cmp->dcd.suspendview = 1;
|
---|
| 1977 | WinSendMsg(hwndLeft, CM_FILTER, MPFROMP(Filter),
|
---|
| 1978 | MPFROMP(&cmp->dcd.mask));
|
---|
| 1979 | WinSendMsg(hwndRight, CM_FILTER, MPFROMP(Filter),
|
---|
| 1980 | MPFROMP(&cmp->dcd.mask));
|
---|
| 1981 | cmp->dcd.suspendview = 0;
|
---|
| 1982 | if (*cmp->dcd.mask.szMask)
|
---|
| 1983 | WinSetDlgItemText(hwnd, COMP_NOTE,
|
---|
| 1984 | GetPString(IDS_COMPREADYFILTEREDTEXT));
|
---|
| 1985 | else
|
---|
| 1986 | WinSetDlgItemText(hwnd, COMP_NOTE, GetPString(IDS_COMPREADYTEXT));
|
---|
| 1987 | }
|
---|
| 1988 | return 0;
|
---|
[2] | 1989 |
|
---|
[551] | 1990 | case UM_HIDENOTSELECTED:
|
---|
| 1991 | cmp = INSTDATA(hwnd);
|
---|
| 1992 | if (cmp) {
|
---|
| 1993 | USHORT wantHide = WinQueryButtonCheckstate(hwnd,
|
---|
| 1994 | COMP_HIDENOTSELECTED);
|
---|
[316] | 1995 |
|
---|
[551] | 1996 | cmp->dcd.suspendview = 1;
|
---|
| 1997 | if (wantHide) {
|
---|
| 1998 | BOOL needRefresh = FALSE;
|
---|
| 1999 | HWND hwndl = WinWindowFromID(cmp->hwnd, COMP_LEFTDIR);
|
---|
| 2000 | HWND hwndr = WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR);
|
---|
| 2001 | PCNRITEM pcil = WinSendMsg(hwndl, CM_QUERYRECORD, MPVOID,
|
---|
| 2002 | MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
|
---|
| 2003 | PCNRITEM pcir = WinSendMsg(hwndr, CM_QUERYRECORD, MPVOID,
|
---|
| 2004 | MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
|
---|
| 2005 |
|
---|
| 2006 | while (pcil && (INT) pcil != -1 && pcir && (INT) pcir != -1) {
|
---|
| 2007 | if (~pcil->rc.flRecordAttr & CRA_SELECTED &&
|
---|
| 2008 | ~pcir->rc.flRecordAttr & CRA_SELECTED) {
|
---|
| 2009 | pcil->rc.flRecordAttr |= CRA_FILTERED;
|
---|
| 2010 | pcir->rc.flRecordAttr |= CRA_FILTERED;
|
---|
| 2011 | needRefresh = TRUE;
|
---|
[316] | 2012 | }
|
---|
[551] | 2013 | pcil = WinSendMsg(hwndl, CM_QUERYRECORD, MPFROMP(pcil),
|
---|
| 2014 | MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
|
---|
| 2015 | pcir = WinSendMsg(hwndr, CM_QUERYRECORD, MPFROMP(pcir),
|
---|
| 2016 | MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
|
---|
[748] | 2017 | } // while
|
---|
[551] | 2018 | if (needRefresh) {
|
---|
| 2019 | WinSendMsg(hwndl, CM_INVALIDATERECORD,
|
---|
| 2020 | MPVOID, MPFROM2SHORT(0, CMA_REPOSITION));
|
---|
| 2021 | WinSendMsg(hwndr, CM_INVALIDATERECORD,
|
---|
| 2022 | MPVOID, MPFROM2SHORT(0, CMA_REPOSITION));
|
---|
[316] | 2023 | }
|
---|
| 2024 | }
|
---|
[551] | 2025 | else {
|
---|
| 2026 | WinSendMsg(hwndLeft, CM_FILTER, MPFROMP(Filter),
|
---|
| 2027 | MPFROMP(&cmp->dcd.mask));
|
---|
| 2028 | WinSendMsg(hwndRight, CM_FILTER, MPFROMP(Filter),
|
---|
| 2029 | MPFROMP(&cmp->dcd.mask));
|
---|
| 2030 | }
|
---|
| 2031 | cmp->dcd.suspendview = 0;
|
---|
| 2032 | if (*cmp->dcd.mask.szMask)
|
---|
| 2033 | WinSetDlgItemText(hwnd, COMP_NOTE,
|
---|
| 2034 | GetPString(IDS_COMPREADYFILTEREDTEXT));
|
---|
| 2035 | else
|
---|
| 2036 | WinSetDlgItemText(hwnd, COMP_NOTE, GetPString(IDS_COMPREADYTEXT));
|
---|
| 2037 | }
|
---|
| 2038 | return 0;
|
---|
[316] | 2039 |
|
---|
[551] | 2040 | case WM_COMMAND:
|
---|
| 2041 | switch (SHORT1FROMMP(mp1)) {
|
---|
| 2042 | case IDM_COMPARE:
|
---|
| 2043 | cmp = INSTDATA(hwnd);
|
---|
| 2044 | if (cmp) {
|
---|
[2] | 2045 |
|
---|
[551] | 2046 | PCNRITEM pci;
|
---|
| 2047 | CHAR ofile[CCHMAXPATH];
|
---|
[2] | 2048 |
|
---|
[551] | 2049 | pci = (PCNRITEM) WinSendMsg(cmp->hwndCalling,
|
---|
| 2050 | CM_QUERYRECORDEMPHASIS,
|
---|
| 2051 | MPFROMLONG(CMA_FIRST),
|
---|
| 2052 | MPFROMSHORT(CRA_CURSORED));
|
---|
[748] | 2053 | // 01 Aug 07 SHL
|
---|
| 2054 | if (pci && *pci->pszFileName) {
|
---|
[551] | 2055 | if (cmp->hwndCalling == hwndLeft)
|
---|
| 2056 | strcpy(ofile, cmp->rightdir);
|
---|
| 2057 | else
|
---|
| 2058 | strcpy(ofile, cmp->leftdir);
|
---|
| 2059 | if (ofile[strlen(ofile) - 1] != '\\')
|
---|
| 2060 | strcat(ofile, "\\");
|
---|
[751] | 2061 | strcat(ofile, pci->pszDisplayName);
|
---|
[551] | 2062 | if (*compare) {
|
---|
| 2063 | CHAR *fakelist[3];
|
---|
[730] | 2064 | fakelist[0] = pci->pszFileName;
|
---|
[551] | 2065 | fakelist[1] = ofile;
|
---|
| 2066 | fakelist[2] = NULL;
|
---|
| 2067 | ExecOnList(hwnd, compare,
|
---|
| 2068 | WINDOWED | SEPARATEKEEP, NULL, fakelist, NULL);
|
---|
| 2069 | }
|
---|
| 2070 | else {
|
---|
| 2071 | FCOMPARE fc;
|
---|
| 2072 | memset(&fc, 0, sizeof(fc));
|
---|
| 2073 | fc.size = sizeof(fc);
|
---|
| 2074 | fc.hwndParent = hwnd;
|
---|
[730] | 2075 | strcpy(fc.file1, pci->pszFileName);
|
---|
[551] | 2076 | strcpy(fc.file2, ofile);
|
---|
| 2077 | WinDlgBox(HWND_DESKTOP, hwnd,
|
---|
| 2078 | CFileDlgProc, FM3ModHandle, FCMP_FRAME, (PVOID) & fc);
|
---|
| 2079 | }
|
---|
| 2080 | }
|
---|
| 2081 | }
|
---|
| 2082 | break;
|
---|
[2] | 2083 |
|
---|
[551] | 2084 | case COMP_FILTER:
|
---|
| 2085 | case IDM_FILTER:
|
---|
| 2086 | cmp = INSTDATA(hwnd);
|
---|
| 2087 | if (cmp) {
|
---|
[2] | 2088 |
|
---|
[551] | 2089 | BOOL empty = FALSE;
|
---|
| 2090 | PCNRITEM pci;
|
---|
| 2091 | CHAR *p;
|
---|
| 2092 | BOOL temp;
|
---|
[2] | 2093 |
|
---|
[551] | 2094 | if (!*cmp->dcd.mask.szMask) {
|
---|
| 2095 | empty = TRUE;
|
---|
| 2096 | temp = fSelectedAlways;
|
---|
| 2097 | fSelectedAlways = TRUE;
|
---|
[748] | 2098 | pci = (PCNRITEM)CurrentRecord(hwnd);
|
---|
[551] | 2099 | fSelectedAlways = temp;
|
---|
[748] | 2100 | // 01 Aug 07 SHL
|
---|
| 2101 | if (pci && ~pci->attrFile & FILE_DIRECTORY) {
|
---|
[730] | 2102 | p = strrchr(pci->pszFileName, '\\');
|
---|
[551] | 2103 | if (p) {
|
---|
| 2104 | p++;
|
---|
| 2105 | strcpy(cmp->dcd.mask.szMask, p);
|
---|
| 2106 | }
|
---|
| 2107 | }
|
---|
| 2108 | }
|
---|
| 2109 | cmp->dcd.mask.fNoAttribs = TRUE;
|
---|
| 2110 | cmp->dcd.mask.attrFile = ALLATTRS;
|
---|
| 2111 | cmp->dcd.mask.antiattr = 0;
|
---|
| 2112 | if (WinDlgBox(HWND_DESKTOP, hwnd, PickMaskDlgProc,
|
---|
| 2113 | FM3ModHandle, MSK_FRAME, MPFROMP(&cmp->dcd.mask))) {
|
---|
| 2114 | cmp->dcd.mask.attrFile = ALLATTRS;
|
---|
| 2115 | cmp->dcd.mask.antiattr = 0;
|
---|
| 2116 | WinSendMsg(hwnd, UM_FILTER, MPVOID, MPVOID);
|
---|
| 2117 | }
|
---|
| 2118 | else if (empty) {
|
---|
| 2119 | *cmp->dcd.mask.szMask = 0;
|
---|
| 2120 | cmp->dcd.mask.attrFile = ALLATTRS;
|
---|
| 2121 | cmp->dcd.mask.antiattr = 0;
|
---|
| 2122 | }
|
---|
| 2123 | }
|
---|
| 2124 | break;
|
---|
[2] | 2125 |
|
---|
[551] | 2126 | case IDM_SHOWSUBJECT:
|
---|
| 2127 | case IDM_SHOWEAS:
|
---|
| 2128 | case IDM_SHOWSIZE:
|
---|
| 2129 | case IDM_SHOWLWDATE:
|
---|
| 2130 | case IDM_SHOWLWTIME:
|
---|
| 2131 | case IDM_SHOWLADATE:
|
---|
| 2132 | case IDM_SHOWLATIME:
|
---|
| 2133 | case IDM_SHOWCRDATE:
|
---|
| 2134 | case IDM_SHOWCRTIME:
|
---|
| 2135 | case IDM_SHOWATTR:
|
---|
| 2136 | cmp = INSTDATA(hwnd);
|
---|
| 2137 | if (cmp) {
|
---|
[2] | 2138 |
|
---|
[551] | 2139 | DIRCNRDATA dcd1;
|
---|
| 2140 | BOOL tempsubj;
|
---|
[2] | 2141 |
|
---|
[551] | 2142 | dcd1 = cmp->dcd;
|
---|
| 2143 | AdjustDetailsSwitches(hwndLeft,
|
---|
| 2144 | (HWND) 0, SHORT1FROMMP(mp1),
|
---|
| 2145 | cmp->leftdir, "DirCmp", &cmp->dcd, TRUE);
|
---|
| 2146 | tempsubj = cmp->dcd.detailssubject;
|
---|
| 2147 | cmp->dcd = dcd1;
|
---|
| 2148 | cmp->dcd.detailssubject = FALSE;
|
---|
| 2149 | AdjustDetailsSwitches(hwndRight,
|
---|
| 2150 | cmp->dcd.hwndLastMenu, SHORT1FROMMP(mp1),
|
---|
| 2151 | cmp->rightdir, "DirCmp", &cmp->dcd, TRUE);
|
---|
| 2152 | cmp->dcd.detailssubject = tempsubj;
|
---|
| 2153 | }
|
---|
| 2154 | break;
|
---|
[2] | 2155 |
|
---|
[551] | 2156 | case IDM_LOADLISTFILE:
|
---|
| 2157 | cmp = INSTDATA(hwnd);
|
---|
| 2158 | if (cmp) {
|
---|
[2] | 2159 |
|
---|
[551] | 2160 | CHAR fullname[CCHMAXPATH];
|
---|
[2] | 2161 |
|
---|
[551] | 2162 | strcpy(fullname, "*.PMD");
|
---|
| 2163 | if (insert_filename(HWND_DESKTOP, fullname, TRUE, FALSE) &&
|
---|
| 2164 | *fullname && !strchr(fullname, '*') && !strchr(fullname, '?')) {
|
---|
| 2165 | strcpy(cmp->rightlist, fullname);
|
---|
| 2166 | PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
|
---|
| 2167 | PostMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
|
---|
| 2168 | }
|
---|
| 2169 | }
|
---|
| 2170 | break;
|
---|
[2] | 2171 |
|
---|
[551] | 2172 | case IDM_SAVELISTFILE:
|
---|
| 2173 | cmp = INSTDATA(hwnd);
|
---|
| 2174 | if (cmp) {
|
---|
[2] | 2175 |
|
---|
[551] | 2176 | SNAPSTUFF *sf;
|
---|
| 2177 | CHAR fullname[CCHMAXPATH];
|
---|
[2] | 2178 |
|
---|
[551] | 2179 | strcpy(fullname, "*.PMD");
|
---|
| 2180 | if (export_filename(HWND_DESKTOP, fullname, 1) && *fullname &&
|
---|
| 2181 | !strchr(fullname, '*') && !strchr(fullname, '?')) {
|
---|
| 2182 | sf = xmallocz(sizeof(SNAPSTUFF), pszSrcFile, __LINE__);
|
---|
| 2183 | if (sf) {
|
---|
| 2184 | strcpy(sf->filename, fullname);
|
---|
| 2185 | if (hwndLeft == cmp->hwndCalling)
|
---|
| 2186 | strcpy(sf->dirname, cmp->leftdir);
|
---|
| 2187 | else
|
---|
| 2188 | strcpy(sf->dirname, cmp->rightdir);
|
---|
| 2189 | sf->recurse = cmp->includesubdirs;
|
---|
| 2190 | if (_beginthread(StartSnap, NULL, 65536, (PVOID) sf) == -1) {
|
---|
| 2191 | Runtime_Error(pszSrcFile, __LINE__,
|
---|
| 2192 | GetPString(IDS_COULDNTSTARTTHREADTEXT));
|
---|
| 2193 | free(sf);
|
---|
| 2194 | }
|
---|
| 2195 | }
|
---|
| 2196 | }
|
---|
| 2197 | }
|
---|
| 2198 | break;
|
---|
[2] | 2199 |
|
---|
[551] | 2200 | case COMP_SETDIRS:
|
---|
| 2201 | cmp = INSTDATA(hwnd);
|
---|
| 2202 | if (cmp) {
|
---|
[2] | 2203 |
|
---|
[551] | 2204 | WALK2 wa;
|
---|
[2] | 2205 |
|
---|
[551] | 2206 | memset(&wa, 0, sizeof(wa));
|
---|
| 2207 | wa.size = sizeof(wa);
|
---|
| 2208 | strcpy(wa.szCurrentPath1, cmp->leftdir);
|
---|
| 2209 | strcpy(wa.szCurrentPath2, cmp->rightdir);
|
---|
| 2210 | if (WinDlgBox(HWND_DESKTOP, hwnd, WalkTwoCmpDlgProc,
|
---|
| 2211 | FM3ModHandle, WALK2_FRAME,
|
---|
| 2212 | MPFROMP(&wa)) &&
|
---|
[769] | 2213 | !IsFile(wa.szCurrentPath1) &&
|
---|
| 2214 | !IsFile(wa.szCurrentPath2)) {
|
---|
[551] | 2215 | strcpy(cmp->leftdir, wa.szCurrentPath1);
|
---|
| 2216 | strcpy(cmp->rightdir, wa.szCurrentPath2);
|
---|
| 2217 | *cmp->rightlist = 0;
|
---|
| 2218 | PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
|
---|
| 2219 | PostMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
|
---|
| 2220 | }
|
---|
| 2221 | }
|
---|
| 2222 | break;
|
---|
[2] | 2223 |
|
---|
[551] | 2224 | case COMP_COPYLEFT:
|
---|
| 2225 | case COMP_MOVELEFT:
|
---|
| 2226 | case COMP_COPYRIGHT:
|
---|
| 2227 | case COMP_MOVERIGHT:
|
---|
| 2228 | case COMP_DELETELEFT:
|
---|
| 2229 | case COMP_DELETERIGHT:
|
---|
| 2230 | cmp = INSTDATA(hwnd);
|
---|
| 2231 | if (cmp) {
|
---|
[2] | 2232 |
|
---|
[551] | 2233 | COMPARE *forthread;
|
---|
[2] | 2234 |
|
---|
[551] | 2235 | cmp->filling = TRUE;
|
---|
| 2236 | forthread = xmalloc(sizeof(COMPARE), pszSrcFile, __LINE__);
|
---|
| 2237 | if (forthread) {
|
---|
| 2238 | *forthread = *cmp;
|
---|
| 2239 | forthread->cmp = cmp;
|
---|
| 2240 | forthread->action = SHORT1FROMMP(mp1);
|
---|
| 2241 | if (_beginthread(ActionCnrThread, NULL, 122880, (PVOID) forthread)
|
---|
| 2242 | == -1) {
|
---|
| 2243 | Runtime_Error(pszSrcFile, __LINE__,
|
---|
| 2244 | GetPString(IDS_COULDNTSTARTTHREADTEXT));
|
---|
| 2245 | free(forthread);
|
---|
| 2246 | }
|
---|
| 2247 | else {
|
---|
| 2248 | WinEnableWindowUpdate(hwndLeft, FALSE);
|
---|
| 2249 | WinEnableWindowUpdate(hwndRight, FALSE);
|
---|
| 2250 | switch (SHORT1FROMMP(mp1)) {
|
---|
| 2251 | case COMP_DELETELEFT:
|
---|
| 2252 | case COMP_DELETERIGHT:
|
---|
| 2253 | WinSetDlgItemText(hwnd, COMP_NOTE,
|
---|
| 2254 | GetPString(IDS_COMPHOLDDELETINGTEXT));
|
---|
| 2255 | break;
|
---|
| 2256 | case COMP_MOVELEFT:
|
---|
| 2257 | case COMP_MOVERIGHT:
|
---|
| 2258 | WinSetDlgItemText(hwnd, COMP_NOTE,
|
---|
| 2259 | GetPString(IDS_COMPHOLDMOVINGTEXT));
|
---|
| 2260 | break;
|
---|
| 2261 | case COMP_COPYLEFT:
|
---|
| 2262 | case COMP_COPYRIGHT:
|
---|
| 2263 | WinSetDlgItemText(hwnd, COMP_NOTE,
|
---|
| 2264 | GetPString(IDS_COMPHOLDCOPYINGTEXT));
|
---|
| 2265 | break;
|
---|
| 2266 | default:
|
---|
| 2267 | WinSetDlgItemText(hwnd, COMP_NOTE,
|
---|
| 2268 | GetPString(IDS_COMPHOLDDUNNOTEXT));
|
---|
| 2269 | break;
|
---|
| 2270 | }
|
---|
| 2271 | WinEnableWindow(hwndRight, FALSE);
|
---|
| 2272 | WinEnableWindow(hwndLeft, FALSE);
|
---|
| 2273 | WinEnableWindow(WinWindowFromID(hwnd, DID_OK), FALSE);
|
---|
| 2274 | WinEnableWindow(WinWindowFromID(hwnd, DID_CANCEL), FALSE);
|
---|
| 2275 | WinEnableWindow(WinWindowFromID(hwnd, COMP_COLLECT), FALSE);
|
---|
| 2276 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTBOTH), FALSE);
|
---|
| 2277 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTONE), FALSE);
|
---|
| 2278 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTNEWER), FALSE);
|
---|
| 2279 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTOLDER), FALSE);
|
---|
| 2280 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTBIGGER), FALSE);
|
---|
| 2281 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSMALLER), FALSE);
|
---|
| 2282 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTBOTH), FALSE);
|
---|
| 2283 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTONE), FALSE);
|
---|
| 2284 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTNEWER), FALSE);
|
---|
| 2285 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTOLDER), FALSE);
|
---|
| 2286 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTBIGGER), FALSE);
|
---|
| 2287 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTSMALLER),
|
---|
| 2288 | FALSE);
|
---|
| 2289 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTALL), FALSE);
|
---|
| 2290 | WinEnableWindow(WinWindowFromID(hwnd, COMP_INCLUDESUBDIRS),
|
---|
| 2291 | FALSE);
|
---|
| 2292 | WinEnableWindow(WinWindowFromID(hwnd, COMP_SETDIRS), FALSE);
|
---|
| 2293 | WinEnableWindow(WinWindowFromID(hwnd, COMP_DELETELEFT), FALSE);
|
---|
| 2294 | WinEnableWindow(WinWindowFromID(hwnd, COMP_DELETERIGHT), FALSE);
|
---|
| 2295 | WinEnableWindow(WinWindowFromID(hwnd, COMP_COPYLEFT), FALSE);
|
---|
| 2296 | WinEnableWindow(WinWindowFromID(hwnd, COMP_MOVELEFT), FALSE);
|
---|
| 2297 | WinEnableWindow(WinWindowFromID(hwnd, COMP_COPYRIGHT), FALSE);
|
---|
| 2298 | WinEnableWindow(WinWindowFromID(hwnd, COMP_MOVERIGHT), FALSE);
|
---|
| 2299 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSAMECONTENT),
|
---|
| 2300 | FALSE);
|
---|
| 2301 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTIDENTICAL),
|
---|
| 2302 | FALSE);
|
---|
| 2303 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSAME), FALSE);
|
---|
| 2304 | WinEnableWindow(WinWindowFromID(hwnd, IDM_INVERT), FALSE);
|
---|
| 2305 | WinEnableWindow(WinWindowFromID(hwnd, COMP_FILTER), FALSE);
|
---|
| 2306 | }
|
---|
| 2307 | }
|
---|
| 2308 | }
|
---|
| 2309 | break;
|
---|
[2] | 2310 |
|
---|
[551] | 2311 | case DID_OK:
|
---|
| 2312 | WinDismissDlg(hwnd, 0);
|
---|
| 2313 | break;
|
---|
| 2314 | case DID_CANCEL:
|
---|
| 2315 | WinDismissDlg(hwnd, 1);
|
---|
| 2316 | break;
|
---|
[2] | 2317 |
|
---|
[551] | 2318 | case IDM_HELP:
|
---|
| 2319 | if (hwndHelp)
|
---|
| 2320 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
---|
| 2321 | MPFROM2SHORT(HELP_COMPARE, 0), MPFROMSHORT(HM_RESOURCEID));
|
---|
| 2322 | break;
|
---|
[2] | 2323 |
|
---|
[551] | 2324 | case IDM_DESELECTALL:
|
---|
| 2325 | case IDM_SELECTNEWER:
|
---|
| 2326 | case IDM_SELECTOLDER:
|
---|
| 2327 | case IDM_SELECTBIGGER:
|
---|
| 2328 | case IDM_SELECTSMALLER:
|
---|
| 2329 | case IDM_DESELECTNEWER:
|
---|
| 2330 | case IDM_DESELECTOLDER:
|
---|
| 2331 | case IDM_DESELECTBIGGER:
|
---|
| 2332 | case IDM_DESELECTSMALLER:
|
---|
| 2333 | case IDM_DESELECTONE:
|
---|
| 2334 | case IDM_DESELECTBOTH:
|
---|
| 2335 | case IDM_SELECTBOTH:
|
---|
| 2336 | case IDM_SELECTONE:
|
---|
| 2337 | case IDM_SELECTSAMECONTENT:
|
---|
[748] | 2338 | case IDM_SELECTIDENTICAL: // Name, size and time
|
---|
| 2339 | case IDM_SELECTSAME: // Name and size
|
---|
[551] | 2340 | case IDM_INVERT:
|
---|
| 2341 | cmp = INSTDATA(hwnd);
|
---|
| 2342 | if (!cmp)
|
---|
| 2343 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
| 2344 | else {
|
---|
| 2345 | COMPARE *forthread;
|
---|
| 2346 |
|
---|
| 2347 | cmp->filling = TRUE;
|
---|
| 2348 | forthread = xmalloc(sizeof(COMPARE), pszSrcFile, __LINE__);
|
---|
| 2349 | if (forthread) {
|
---|
| 2350 | *forthread = *cmp;
|
---|
| 2351 | forthread->cmp = cmp;
|
---|
| 2352 | forthread->action = SHORT1FROMMP(mp1);
|
---|
| 2353 | if (_beginthread(SelectCnrsThread, NULL, 65536, (PVOID) forthread)
|
---|
| 2354 | == -1) {
|
---|
| 2355 | Runtime_Error(pszSrcFile, __LINE__,
|
---|
| 2356 | GetPString(IDS_COULDNTSTARTTHREADTEXT));
|
---|
| 2357 | free(forthread);
|
---|
| 2358 | }
|
---|
[362] | 2359 | else {
|
---|
[551] | 2360 | WinEnableWindowUpdate(hwndLeft, FALSE);
|
---|
| 2361 | WinEnableWindowUpdate(hwndRight, FALSE);
|
---|
| 2362 | switch (SHORT1FROMMP(mp1)) {
|
---|
| 2363 | case IDM_DESELECTALL:
|
---|
| 2364 | case IDM_DESELECTNEWER:
|
---|
| 2365 | case IDM_DESELECTOLDER:
|
---|
| 2366 | case IDM_DESELECTBIGGER:
|
---|
| 2367 | case IDM_DESELECTSMALLER:
|
---|
| 2368 | case IDM_DESELECTONE:
|
---|
| 2369 | case IDM_DESELECTBOTH:
|
---|
| 2370 | WinSetDlgItemText(hwnd, COMP_NOTE,
|
---|
| 2371 | GetPString(IDS_COMPHOLDDESELTEXT));
|
---|
| 2372 | break;
|
---|
| 2373 | case IDM_INVERT:
|
---|
| 2374 | WinSetDlgItemText(hwnd, COMP_NOTE,
|
---|
| 2375 | GetPString(IDS_COMPHOLDINVERTTEXT));
|
---|
| 2376 | break;
|
---|
| 2377 | default:
|
---|
| 2378 | WinSetDlgItemText(hwnd, COMP_NOTE,
|
---|
| 2379 | GetPString(IDS_COMPHOLDSELTEXT));
|
---|
| 2380 | break;
|
---|
| 2381 | }
|
---|
| 2382 | WinEnableWindow(hwndRight, FALSE);
|
---|
| 2383 | WinEnableWindow(hwndLeft, FALSE);
|
---|
| 2384 | WinEnableWindow(WinWindowFromID(hwnd, DID_OK), FALSE);
|
---|
| 2385 | WinEnableWindow(WinWindowFromID(hwnd, DID_CANCEL), FALSE);
|
---|
| 2386 | WinEnableWindow(WinWindowFromID(hwnd, COMP_COLLECT), FALSE);
|
---|
| 2387 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTBOTH), FALSE);
|
---|
| 2388 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTONE), FALSE);
|
---|
| 2389 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTNEWER), FALSE);
|
---|
| 2390 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTOLDER), FALSE);
|
---|
| 2391 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTBIGGER), FALSE);
|
---|
| 2392 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSMALLER), FALSE);
|
---|
| 2393 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTBOTH), FALSE);
|
---|
| 2394 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTONE), FALSE);
|
---|
| 2395 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTNEWER), FALSE);
|
---|
| 2396 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTOLDER), FALSE);
|
---|
| 2397 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTBIGGER), FALSE);
|
---|
| 2398 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTSMALLER),
|
---|
| 2399 | FALSE);
|
---|
| 2400 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTALL), FALSE);
|
---|
| 2401 | WinEnableWindow(WinWindowFromID(hwnd, COMP_INCLUDESUBDIRS),
|
---|
| 2402 | FALSE);
|
---|
| 2403 | WinEnableWindow(WinWindowFromID(hwnd, COMP_SETDIRS), FALSE);
|
---|
| 2404 | WinEnableWindow(WinWindowFromID(hwnd, COMP_DELETELEFT), FALSE);
|
---|
| 2405 | WinEnableWindow(WinWindowFromID(hwnd, COMP_DELETERIGHT), FALSE);
|
---|
| 2406 | WinEnableWindow(WinWindowFromID(hwnd, COMP_COPYLEFT), FALSE);
|
---|
| 2407 | WinEnableWindow(WinWindowFromID(hwnd, COMP_MOVELEFT), FALSE);
|
---|
| 2408 | WinEnableWindow(WinWindowFromID(hwnd, COMP_COPYRIGHT), FALSE);
|
---|
| 2409 | WinEnableWindow(WinWindowFromID(hwnd, COMP_MOVERIGHT), FALSE);
|
---|
| 2410 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSAMECONTENT),
|
---|
| 2411 | FALSE);
|
---|
| 2412 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTIDENTICAL),
|
---|
| 2413 | FALSE);
|
---|
| 2414 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSAME), FALSE);
|
---|
| 2415 | WinEnableWindow(WinWindowFromID(hwnd, IDM_INVERT), FALSE);
|
---|
| 2416 | WinEnableWindow(WinWindowFromID(hwnd, COMP_FILTER), FALSE);
|
---|
| 2417 | }
|
---|
| 2418 | }
|
---|
| 2419 | }
|
---|
| 2420 | break;
|
---|
[2] | 2421 |
|
---|
[551] | 2422 | case COMP_COLLECT:
|
---|
| 2423 | cmp = INSTDATA(hwnd);
|
---|
[773] | 2424 | if (!cmp)
|
---|
| 2425 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
| 2426 | else {
|
---|
| 2427 | CHAR **listl;
|
---|
| 2428 | CHAR **listr = NULL;
|
---|
[551] | 2429 | if (!Collector) {
|
---|
| 2430 | SWP swp;
|
---|
| 2431 | HWND hwndC;
|
---|
[773] | 2432 | if (!fAutoTile &&
|
---|
| 2433 | !ParentIsDesktop(hwnd, cmp->hwndParent) &&
|
---|
| 2434 | !fExternalCollector &&
|
---|
| 2435 | !strcmp(realappname, FM3Str)) {
|
---|
[551] | 2436 | GetNextWindowPos(cmp->hwndParent, &swp, NULL, NULL);
|
---|
[773] | 2437 | }
|
---|
| 2438 | hwndC = StartCollector(fExternalCollector ||
|
---|
| 2439 | strcmp(realappname, FM3Str) ?
|
---|
| 2440 | HWND_DESKTOP :
|
---|
| 2441 | cmp->hwndParent,
|
---|
| 2442 | 4);
|
---|
[551] | 2443 | if (hwndC) {
|
---|
[773] | 2444 | if (!fAutoTile &&
|
---|
| 2445 | !ParentIsDesktop(hwnd, cmp->hwndParent) &&
|
---|
| 2446 | !fExternalCollector &&
|
---|
| 2447 | !strcmp(realappname, FM3Str)) {
|
---|
| 2448 | WinSetWindowPos(hwndC, HWND_TOP,
|
---|
| 2449 | swp.x, swp.y, swp.cx, swp.cy,
|
---|
| 2450 | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER);
|
---|
| 2451 | }
|
---|
| 2452 | else if (!ParentIsDesktop(hwnd, cmp->hwndParent) &&
|
---|
| 2453 | fAutoTile &&
|
---|
| 2454 | !strcmp(realappname, FM3Str)) {
|
---|
[551] | 2455 | TileChildren(cmp->hwndParent, TRUE);
|
---|
[773] | 2456 | }
|
---|
[790] | 2457 | DosSleep(32); // 05 Aug 07 GKY 64
|
---|
[551] | 2458 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(COMP_COLLECT, 0), MPVOID);
|
---|
| 2459 | break;
|
---|
| 2460 | }
|
---|
| 2461 | }
|
---|
| 2462 | else
|
---|
| 2463 | StartCollector(cmp->hwndParent, 4);
|
---|
[2] | 2464 |
|
---|
[773] | 2465 | temp = fSelectedAlways;
|
---|
| 2466 | fSelectedAlways = TRUE;
|
---|
| 2467 | listl = BuildList(hwndLeft);
|
---|
| 2468 | if (!*cmp->rightlist)
|
---|
| 2469 | listr = BuildList(hwndRight);
|
---|
| 2470 | fSelectedAlways = temp;
|
---|
| 2471 |
|
---|
[551] | 2472 | if (listl || listr) {
|
---|
| 2473 | if (Collector) {
|
---|
[773] | 2474 | // 07 Aug 07 SHL Avoid collected from empty list
|
---|
| 2475 | if (listl && listl[0] && *listl[0]) {
|
---|
| 2476 | if (PostMsg(Collector, WM_COMMAND,
|
---|
| 2477 | MPFROM2SHORT(IDM_COLLECTOR, 0), MPFROMP(listl)))
|
---|
| 2478 | listl = NULL; // Collector will free
|
---|
[551] | 2479 | }
|
---|
[773] | 2480 | if (listr && listr[0] && *listr[0]) {
|
---|
| 2481 | if (PostMsg(Collector, WM_COMMAND,
|
---|
| 2482 | MPFROM2SHORT(IDM_COLLECTOR, 0), MPFROMP(listr)))
|
---|
| 2483 | listr = NULL; // Collector will free
|
---|
[551] | 2484 | }
|
---|
| 2485 | WinSetWindowPos(WinQueryWindow(WinQueryWindow(Collector,
|
---|
| 2486 | QW_PARENT),
|
---|
[773] | 2487 | QW_PARENT),
|
---|
| 2488 | HWND_TOP, 0, 0, 0, 0,
|
---|
[551] | 2489 | SWP_ACTIVATE);
|
---|
| 2490 | }
|
---|
[773] | 2491 | FreeList(listl);
|
---|
| 2492 | FreeList(listr);
|
---|
[551] | 2493 | }
|
---|
[2] | 2494 | }
|
---|
[551] | 2495 | break;
|
---|
| 2496 | }
|
---|
| 2497 | return 0;
|
---|
[2] | 2498 |
|
---|
[551] | 2499 | case WM_CLOSE:
|
---|
| 2500 | WinDismissDlg(hwnd, 0);
|
---|
| 2501 | return 0;
|
---|
[2] | 2502 |
|
---|
[551] | 2503 | case WM_DESTROY:
|
---|
| 2504 | cmp = INSTDATA(hwnd);
|
---|
| 2505 | if (cmp) {
|
---|
| 2506 | if (cmp->dcd.hwndLastMenu)
|
---|
| 2507 | WinDestroyWindow(cmp->dcd.hwndLastMenu);
|
---|
| 2508 | if (cmp->dcd.hwndObject) {
|
---|
[574] | 2509 | WinSetWindowPtr(cmp->dcd.hwndObject, QWL_USER, (PVOID) NULL);
|
---|
[551] | 2510 | if (!PostMsg(cmp->dcd.hwndObject, WM_CLOSE, MPVOID, MPVOID))
|
---|
| 2511 | WinSendMsg(cmp->dcd.hwndObject, WM_CLOSE, MPVOID, MPVOID);
|
---|
[2] | 2512 | }
|
---|
[551] | 2513 | free(cmp);
|
---|
| 2514 | }
|
---|
| 2515 | EmptyCnr(hwndLeft);
|
---|
| 2516 | EmptyCnr(hwndRight);
|
---|
| 2517 | DosPostEventSem(CompactSem);
|
---|
| 2518 | break;
|
---|
[2] | 2519 | }
|
---|
[551] | 2520 | return WinDefDlgProc(hwnd, msg, mp1, mp2);
|
---|
[2] | 2521 | }
|
---|
[783] | 2522 |
|
---|
| 2523 | #pragma alloc_text(COMPAREDIR,FillCnrsThread,FillDirList,CompNames,BldFullPathName)
|
---|
| 2524 | #pragma alloc_text(COMPAREDIR1,CompareDlgProc)
|
---|
| 2525 | #pragma alloc_text(COMPAREDIR2,SelectCnrsThread,ActionCnrThread)
|
---|
| 2526 | #pragma alloc_text(COMPAREFILE,CFileDlgProc,CompareFilesThread)
|
---|
| 2527 | #pragma alloc_text(SNAPSHOT,SnapShot,StartSnap)
|
---|
| 2528 |
|
---|