[76] | 1 |
|
---|
| 2 | /***********************************************************************
|
---|
| 3 |
|
---|
| 4 | $Id: comp.c 924 2008-01-17 00:40:52Z stevenhl $
|
---|
| 5 |
|
---|
| 6 | Compare directories
|
---|
| 7 |
|
---|
| 8 | Copyright (c) 1993-02 M. Kimes
|
---|
[907] | 9 | Copyright (c) 2003, 2008 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
|
---|
[846] | 38 | 20 Aug 07 SHL A few more speed up tweaks. Some experimental timing code
|
---|
[814] | 39 | 26 Aug 07 GKY DosSleep(1) in loops changed to (0)
|
---|
[846] | 40 | 27 Sep 07 SHL Correct ULONGLONG size formatting
|
---|
[897] | 41 | 30 Dec 07 GKY Use TestCDates for compare by file date/time
|
---|
[907] | 42 | 04 Jan 08 SHL Avoid traps if CM_ALLOCRECORD returns less that requested
|
---|
| 43 | 05 Jan 08 SHL Use WM_TIMER for progress messaging
|
---|
| 44 | 05 Jan 08 SHL Use ITIMER_DESC for hogging control
|
---|
[919] | 45 | 12 Jan 08 SHL Correct select count display regression
|
---|
[924] | 46 | 12 Jan 08 SHL Localize SpecialSelect here and rename
|
---|
| 47 | 12 Jan 08 SHL Use SleepIfNeeded
|
---|
| 48 | 12 Jan 08 SHL Reduce/eliminate more DosSleep calls
|
---|
[76] | 49 |
|
---|
| 50 | ***********************************************************************/
|
---|
| 51 |
|
---|
[907] | 52 | #include <stdlib.h>
|
---|
| 53 | #include <string.h>
|
---|
| 54 | #include <share.h>
|
---|
| 55 | #include <io.h>
|
---|
| 56 | #include <process.h> // _beginthread
|
---|
| 57 |
|
---|
[2] | 58 | #define INCL_DOS
|
---|
| 59 | #define INCL_WIN
|
---|
[783] | 60 | #define INCL_DOSERRORS
|
---|
[2] | 61 | #define INCL_GPI
|
---|
[157] | 62 | #define INCL_LONGLONG
|
---|
[2] | 63 |
|
---|
| 64 | #include "fm3dlg.h"
|
---|
| 65 | #include "fm3str.h"
|
---|
[907] | 66 | #include "pathutil.h" // BldFullPathName
|
---|
| 67 | #include "filldir.h" // EmptyCnr...
|
---|
| 68 | #include "makelist.h" // AddToFileList...
|
---|
| 69 | #include "errutil.h" // Dos_Error...
|
---|
| 70 | #include "strutil.h" // GetPString
|
---|
| 71 | #include "tmrsvcs.h" // IsITimerExpired
|
---|
| 72 | #include "comp.h"
|
---|
| 73 | #include "fm3dll.h"
|
---|
[2] | 74 |
|
---|
[551] | 75 | typedef struct
|
---|
| 76 | {
|
---|
| 77 | CHAR filename[CCHMAXPATH];
|
---|
| 78 | CHAR dirname[CCHMAXPATH];
|
---|
| 79 | BOOL recurse;
|
---|
| 80 | }
|
---|
| 81 | SNAPSTUFF;
|
---|
[2] | 82 |
|
---|
[362] | 83 | static PSZ pszSrcFile = __FILE__;
|
---|
| 84 |
|
---|
[316] | 85 | //=== SnapShot() Write directory tree to file and recurse if requested ===
|
---|
[2] | 86 |
|
---|
[783] | 87 | static VOID SnapShot(char *path, FILE *fp, BOOL recurse)
|
---|
[157] | 88 | {
|
---|
[841] | 89 | PFILEFINDBUF4L pffb;
|
---|
[551] | 90 | char *mask, *enddir;
|
---|
| 91 | HDIR hdir = HDIR_CREATE;
|
---|
[783] | 92 | ULONG ulFindCnt;
|
---|
[2] | 93 |
|
---|
[783] | 94 | // 13 Aug 07 SHL fimxe to use FileToGet
|
---|
[841] | 95 | pffb = xmalloc(sizeof(FILEFINDBUF4L), pszSrcFile, __LINE__);
|
---|
[783] | 96 | if (pffb) {
|
---|
[551] | 97 | mask = xmalloc(CCHMAXPATH, pszSrcFile, __LINE__);
|
---|
| 98 | if (mask) {
|
---|
[783] | 99 | BldFullPathName(mask, path, "*");
|
---|
| 100 | // sprintf(mask,
|
---|
| 101 | // "%s%s*",
|
---|
| 102 | // path, (path[strlen(path) - 1] != '\\') ? "\\" : NullStr);
|
---|
[551] | 103 | enddir = strrchr(mask, '\\');
|
---|
[2] | 104 | enddir++;
|
---|
[783] | 105 | ulFindCnt = 1;
|
---|
| 106 | // 13 Aug 07 SHL fixme to report errors
|
---|
[838] | 107 | if (!xDosFindFirst(mask,
|
---|
[907] | 108 | &hdir,
|
---|
[838] | 109 | FILE_NORMAL | FILE_DIRECTORY |
|
---|
| 110 | FILE_ARCHIVED | FILE_READONLY | FILE_HIDDEN |
|
---|
| 111 | FILE_SYSTEM,
|
---|
[841] | 112 | pffb, sizeof(FILEFINDBUF4L), &ulFindCnt, FIL_QUERYEASIZEL)) {
|
---|
[551] | 113 | do {
|
---|
[783] | 114 | strcpy(enddir, pffb->achName);
|
---|
| 115 | if (!(pffb->attrFile & FILE_DIRECTORY))
|
---|
[846] | 116 | // 27 Sep 07 SHL fixme to use CommaFmtULL
|
---|
[551] | 117 | fprintf(fp,
|
---|
[846] | 118 | "\"%s\",%u,%llu,%04u/%02u/%02u,%02u:%02u:%02u,%lu,%lu,N\n",
|
---|
[551] | 119 | mask,
|
---|
| 120 | enddir - mask,
|
---|
[783] | 121 | pffb->cbFile,
|
---|
| 122 | (pffb->fdateLastWrite.year + 1980),
|
---|
| 123 | pffb->fdateLastWrite.month,
|
---|
| 124 | pffb->fdateLastWrite.day,
|
---|
| 125 | pffb->ftimeLastWrite.hours,
|
---|
| 126 | pffb->ftimeLastWrite.minutes,
|
---|
| 127 | pffb->ftimeLastWrite.twosecs,
|
---|
[846] | 128 | pffb->attrFile,
|
---|
| 129 | pffb->cbList > 4 ? pffb->cbList / 2 : 0);
|
---|
[517] | 130 | // Skip . and ..
|
---|
[551] | 131 | else if (recurse &&
|
---|
[783] | 132 | (pffb->achName[0] != '.' ||
|
---|
| 133 | (pffb->achName[1] &&
|
---|
| 134 | (pffb->achName[1] != '.' || pffb->achName[2])))) {
|
---|
[551] | 135 | SnapShot(mask, fp, recurse);
|
---|
| 136 | }
|
---|
[783] | 137 | ulFindCnt = 1;
|
---|
[850] | 138 | } while (!xDosFindNext(hdir, pffb, sizeof(FILEFINDBUF4L), &ulFindCnt, FIL_QUERYEASIZEL));
|
---|
[551] | 139 | DosFindClose(hdir);
|
---|
[2] | 140 | }
|
---|
| 141 | free(mask);
|
---|
| 142 | }
|
---|
[783] | 143 | free(pffb);
|
---|
[2] | 144 | }
|
---|
| 145 | }
|
---|
| 146 |
|
---|
[316] | 147 | //=== StartSnap() Write directory tree to snapshot file ===
|
---|
[2] | 148 |
|
---|
[919] | 149 | static VOID StartSnap(VOID *pargs)
|
---|
[316] | 150 | {
|
---|
[919] | 151 | SNAPSTUFF *sf = (SNAPSTUFF *)pargs;
|
---|
[551] | 152 | FILE *fp;
|
---|
| 153 | CHAR *p;
|
---|
[2] | 154 |
|
---|
[551] | 155 | if (sf) {
|
---|
| 156 | if (*sf->dirname && *sf->filename) {
|
---|
[2] | 157 | priority_normal();
|
---|
| 158 | p = sf->dirname;
|
---|
[551] | 159 | while (*p) {
|
---|
| 160 | if (*p == '/')
|
---|
| 161 | *p = '\\';
|
---|
| 162 | p++;
|
---|
[2] | 163 | }
|
---|
[551] | 164 | if (*(p - 1) != '\\') {
|
---|
| 165 | *p = '\\';
|
---|
| 166 | p++;
|
---|
[2] | 167 | }
|
---|
[551] | 168 | fp = xfopen(sf->filename, "w", pszSrcFile, __LINE__);
|
---|
[362] | 169 | if (fp) {
|
---|
[551] | 170 | fprintf(fp, "\"%s\"\n", sf->dirname);
|
---|
| 171 | SnapShot(sf->dirname, fp, sf->recurse);
|
---|
| 172 | fclose(fp);
|
---|
[2] | 173 | }
|
---|
| 174 | }
|
---|
| 175 | free(sf);
|
---|
| 176 | }
|
---|
| 177 | }
|
---|
| 178 |
|
---|
[316] | 179 | //=== CompareFilesThread() Compare files and update container select flags ===
|
---|
[2] | 180 |
|
---|
[919] | 181 | static VOID CompareFilesThread(VOID *args)
|
---|
[316] | 182 | {
|
---|
[2] | 183 | FCOMPARE fc;
|
---|
[551] | 184 | HAB hab2;
|
---|
| 185 | HMQ hmq2;
|
---|
| 186 | FILE *fp1, *fp2;
|
---|
[847] | 187 | ULONG len1, len2;
|
---|
[841] | 188 | ULONG offset = 0;
|
---|
[551] | 189 | LONG numread1, numread2;
|
---|
| 190 | CHAR s[1024], ss[1024], *p1, *p2;
|
---|
[2] | 191 |
|
---|
[551] | 192 | if (args) {
|
---|
[919] | 193 | fc = *(FCOMPARE *)args;
|
---|
[2] | 194 | hab2 = WinInitialize(0);
|
---|
[551] | 195 | if (hab2) {
|
---|
| 196 | hmq2 = WinCreateMsgQueue(hab2, 0);
|
---|
| 197 | if (hmq2) {
|
---|
| 198 | WinCancelShutdown(hmq2, TRUE);
|
---|
[535] | 199 | IncrThreadUsage();
|
---|
[551] | 200 | if (!IsFile(fc.file1) || IsRoot(fc.file1)) {
|
---|
| 201 | p1 = strrchr(fc.file2, '\\');
|
---|
| 202 | if (p1) {
|
---|
| 203 | if (fc.file1[strlen(fc.file1) - 1] == '\\')
|
---|
| 204 | p1++;
|
---|
| 205 | strcat(fc.file1, p1);
|
---|
| 206 | }
|
---|
[362] | 207 | }
|
---|
[551] | 208 | else if (!IsFile(fc.file2) || IsRoot(fc.file2)) {
|
---|
| 209 | p1 = strrchr(fc.file1, '\\');
|
---|
| 210 | if (p1) {
|
---|
| 211 | if (fc.file2[strlen(fc.file2) - 1] == '\\')
|
---|
| 212 | p1++;
|
---|
| 213 | strcat(fc.file2, p1);
|
---|
| 214 | }
|
---|
| 215 | }
|
---|
| 216 | sprintf(s, GetPString(IDS_COMPCOMPARETEXT), fc.file1);
|
---|
| 217 | AddToListboxBottom(fc.hwndList, s);
|
---|
| 218 | sprintf(s, GetPString(IDS_COMPTOTEXT), fc.file2);
|
---|
| 219 | AddToListboxBottom(fc.hwndList, s);
|
---|
| 220 | fp1 = _fsopen(fc.file1, "rb", SH_DENYNO);
|
---|
| 221 | if (!fp1) {
|
---|
| 222 | sprintf(s, GetPString(IDS_COMPCANTOPENTEXT), fc.file1);
|
---|
| 223 | AddToListboxBottom(fc.hwndList, s);
|
---|
| 224 | WinSetWindowText(fc.hwndHelp, GetPString(IDS_ERRORTEXT));
|
---|
| 225 | }
|
---|
[362] | 226 | else {
|
---|
[551] | 227 | fp2 = _fsopen(fc.file2, "rb", SH_DENYNO);
|
---|
| 228 | if (!fp2) {
|
---|
| 229 | sprintf(s, GetPString(IDS_COMPCANTOPENTEXT), fc.file2);
|
---|
| 230 | AddToListboxBottom(fc.hwndList, s);
|
---|
| 231 | WinSetWindowText(fc.hwndHelp, GetPString(IDS_ERRORTEXT));
|
---|
[362] | 232 | }
|
---|
| 233 | else {
|
---|
[847] | 234 | len1 = filelength(fileno(fp1));
|
---|
| 235 | len2 = filelength(fileno(fp2));
|
---|
[551] | 236 | if (len1 != len2) {
|
---|
| 237 | strcpy(s, GetPString(IDS_COMPDIFSIZESTEXT));
|
---|
| 238 | AddToListboxBottom(fc.hwndList, s);
|
---|
| 239 | sprintf(s, GetPString(IDS_COMPVSBYTESTEXT), len1, len2);
|
---|
| 240 | AddToListboxBottom(fc.hwndList, s);
|
---|
| 241 | WinSetWindowText(fc.hwndHelp,
|
---|
| 242 | GetPString(IDS_COMPDONTMATCHTEXT));
|
---|
| 243 | }
|
---|
| 244 | else {
|
---|
| 245 | WinSetWindowText(fc.hwndHelp,
|
---|
| 246 | GetPString(IDS_COMPCOMPARINGTEXT));
|
---|
| 247 | while (WinIsWindow(hab2, fc.hwndList)) {
|
---|
| 248 | numread1 = fread(s, 1, 1024, fp1);
|
---|
| 249 | numread2 = fread(ss, 1, 1024, fp2);
|
---|
| 250 | if (numread1 != numread2 || feof(fp1) != feof(fp2)) {
|
---|
| 251 | sprintf(s, GetPString(IDS_COMPREADERRORTEXT),
|
---|
| 252 | offset, offset);
|
---|
| 253 | AddToListboxBottom(fc.hwndList, s);
|
---|
| 254 | WinSetWindowText(fc.hwndHelp, GetPString(IDS_ERRORTEXT));
|
---|
| 255 | break;
|
---|
| 256 | }
|
---|
| 257 | else if (!numread1 && feof(fp1) && feof(fp2)) {
|
---|
| 258 | AddToListboxBottom(fc.hwndList,
|
---|
| 259 | GetPString(IDS_COMPFILESMATCHTEXT));
|
---|
| 260 | if (!stricmp(fc.file1, fc.file2))
|
---|
| 261 | AddToListboxBottom(fc.hwndList,
|
---|
| 262 | GetPString(IDS_COMPWONDERWHYTEXT));
|
---|
| 263 | WinSetWindowText(fc.hwndHelp,
|
---|
| 264 | GetPString(IDS_COMPCOMPLETETEXT));
|
---|
| 265 | break;
|
---|
| 266 | }
|
---|
| 267 | else if (numread1 <= 0 || numread2 <= 0) {
|
---|
| 268 | if (offset == len1)
|
---|
| 269 | break;
|
---|
| 270 | else {
|
---|
| 271 | sprintf(s, GetPString(IDS_COMPMATCHREADERRORTEXT),
|
---|
| 272 | offset, offset);
|
---|
| 273 | WinSetWindowText(fc.hwndHelp,
|
---|
| 274 | GetPString(IDS_COMPODDERRORTEXT));
|
---|
| 275 | AddToListboxBottom(fc.hwndList, s);
|
---|
| 276 | break;
|
---|
| 277 | }
|
---|
| 278 | }
|
---|
| 279 | else if (memcmp(s, ss, numread1)) {
|
---|
| 280 | p1 = s;
|
---|
| 281 | p2 = ss;
|
---|
| 282 | while (p1 < s + numread1) {
|
---|
| 283 | if (*p1 != *p2) {
|
---|
| 284 | sprintf(s, GetPString(IDS_COMPMISMATCHERRORTEXT),
|
---|
| 285 | offset + (p1 - s), offset + (p1 - s));
|
---|
| 286 | AddToListboxBottom(fc.hwndList, s);
|
---|
| 287 | WinSetWindowText(fc.hwndHelp,
|
---|
| 288 | GetPString(IDS_COMPDONTMATCHTEXT));
|
---|
| 289 | break;
|
---|
| 290 | }
|
---|
| 291 | p1++;
|
---|
| 292 | p2++;
|
---|
| 293 | }
|
---|
| 294 | break;
|
---|
| 295 | }
|
---|
| 296 | offset += numread1;
|
---|
| 297 | }
|
---|
| 298 | }
|
---|
| 299 | fclose(fp2);
|
---|
| 300 | }
|
---|
| 301 | fclose(fp1);
|
---|
| 302 | }
|
---|
[535] | 303 | DecrThreadUsage();
|
---|
[551] | 304 | WinDestroyMsgQueue(hmq2);
|
---|
[2] | 305 | }
|
---|
| 306 | WinTerminate(hab2);
|
---|
| 307 | }
|
---|
| 308 | }
|
---|
| 309 | }
|
---|
| 310 |
|
---|
[316] | 311 | //=== CFileDlgProc() Select directories to compare dialog procedure ===
|
---|
[2] | 312 |
|
---|
[551] | 313 | MRESULT EXPENTRY CFileDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
[316] | 314 | {
|
---|
[2] | 315 | FCOMPARE *fc;
|
---|
| 316 |
|
---|
[551] | 317 | switch (msg) {
|
---|
| 318 | case WM_INITDLG:
|
---|
| 319 | if (!mp2)
|
---|
| 320 | WinDismissDlg(hwnd, 0);
|
---|
| 321 | else {
|
---|
[574] | 322 | WinSetWindowPtr(hwnd, QWL_USER, mp2);
|
---|
[919] | 323 | fc = (FCOMPARE *)mp2;
|
---|
[551] | 324 | fc->hwndReport = hwnd;
|
---|
| 325 | fc->hwndList = WinWindowFromID(hwnd, FCMP_LISTBOX);
|
---|
| 326 | fc->hwndHelp = WinWindowFromID(hwnd, FCMP_HELP);
|
---|
| 327 | if (!*fc->file1 || !fc->file2) {
|
---|
| 328 | WinDismissDlg(hwnd, 0);
|
---|
| 329 | break;
|
---|
[2] | 330 | }
|
---|
[551] | 331 | MakeFullName(fc->file1);
|
---|
| 332 | MakeFullName(fc->file2);
|
---|
| 333 | if (!stricmp(fc->file1, fc->file2)) {
|
---|
| 334 | saymsg(MB_CANCEL, hwnd,
|
---|
| 335 | GetPString(IDS_COMPSILLYALERTTEXT),
|
---|
| 336 | GetPString(IDS_COMPTOITSELFTEXT));
|
---|
| 337 | WinDismissDlg(hwnd, 0);
|
---|
| 338 | break;
|
---|
| 339 | }
|
---|
[919] | 340 | if (_beginthread(CompareFilesThread, NULL, 65536, (PVOID)fc) == -1) {
|
---|
[551] | 341 | Runtime_Error(pszSrcFile, __LINE__,
|
---|
| 342 | GetPString(IDS_COULDNTSTARTTHREADTEXT));
|
---|
| 343 | WinDismissDlg(hwnd, 0);
|
---|
| 344 | }
|
---|
| 345 | }
|
---|
| 346 | break;
|
---|
[2] | 347 |
|
---|
[551] | 348 | case WM_ADJUSTWINDOWPOS:
|
---|
| 349 | PostMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
|
---|
| 350 | break;
|
---|
[2] | 351 |
|
---|
[551] | 352 | case UM_SETDIR:
|
---|
| 353 | PaintRecessedWindow(WinWindowFromID(hwnd, FCMP_HELP),
|
---|
[919] | 354 | (HPS)0, FALSE, TRUE);
|
---|
[551] | 355 | return 0;
|
---|
[2] | 356 |
|
---|
[551] | 357 | case WM_COMMAND:
|
---|
| 358 | switch (SHORT1FROMMP(mp1)) {
|
---|
| 359 | case DID_OK:
|
---|
| 360 | WinDismissDlg(hwnd, 0);
|
---|
| 361 | break;
|
---|
| 362 | case DID_CANCEL:
|
---|
| 363 | WinDismissDlg(hwnd, 1);
|
---|
| 364 | break;
|
---|
| 365 | }
|
---|
| 366 | return 0;
|
---|
[2] | 367 |
|
---|
[551] | 368 | case WM_DESTROY:
|
---|
[924] | 369 | DosSleep(50); // Let others die first
|
---|
[551] | 370 | break;
|
---|
[2] | 371 | }
|
---|
[551] | 372 | return WinDefDlgProc(hwnd, msg, mp1, mp2);
|
---|
[2] | 373 | }
|
---|
| 374 |
|
---|
[316] | 375 | //=== ActionCnrThread() Do requested action on container contents ===
|
---|
[2] | 376 |
|
---|
[731] | 377 | static VOID ActionCnrThread(VOID *args)
|
---|
[316] | 378 | {
|
---|
[731] | 379 | COMPARE *cmp = (COMPARE *)args;
|
---|
[551] | 380 | HAB hab;
|
---|
| 381 | HMQ hmq;
|
---|
| 382 | HWND hwndCnrS, hwndCnrD;
|
---|
[924] | 383 | PCNRITEM pciS, pciD, pciNextS, pciNextD;
|
---|
[769] | 384 | CHAR szNewName[CCHMAXPATH], szDirName[CCHMAXPATH], *p;
|
---|
[551] | 385 | APIRET rc;
|
---|
[924] | 386 | ITIMER_DESC itdSleep = { 0 };
|
---|
[2] | 387 |
|
---|
[748] | 388 | if (!cmp) {
|
---|
[773] | 389 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
[2] | 390 | return;
|
---|
[748] | 391 | }
|
---|
[2] | 392 |
|
---|
| 393 | DosError(FERR_DISABLEHARDERR);
|
---|
| 394 |
|
---|
| 395 | hab = WinInitialize(0);
|
---|
[551] | 396 | if (hab) {
|
---|
| 397 | hmq = WinCreateMsgQueue(hab, 0);
|
---|
| 398 | if (hmq) {
|
---|
| 399 | WinCancelShutdown(hmq, TRUE);
|
---|
[535] | 400 | IncrThreadUsage();
|
---|
[2] | 401 | priority_normal();
|
---|
[551] | 402 | switch (cmp->action) {
|
---|
| 403 | case COMP_DELETELEFT:
|
---|
| 404 | hwndCnrS = WinWindowFromID(cmp->hwnd, COMP_LEFTDIR);
|
---|
| 405 | hwndCnrD = WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR);
|
---|
| 406 | cmp->action = IDM_DELETE;
|
---|
| 407 | break;
|
---|
| 408 | case COMP_DELETERIGHT:
|
---|
| 409 | hwndCnrS = WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR);
|
---|
| 410 | hwndCnrD = WinWindowFromID(cmp->hwnd, COMP_LEFTDIR);
|
---|
| 411 | cmp->action = IDM_DELETE;
|
---|
| 412 | break;
|
---|
| 413 | case COMP_MOVELEFT:
|
---|
| 414 | cmp->action = IDM_MOVE;
|
---|
| 415 | hwndCnrS = WinWindowFromID(cmp->hwnd, COMP_LEFTDIR);
|
---|
| 416 | hwndCnrD = WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR);
|
---|
| 417 | break;
|
---|
| 418 | case COMP_MOVERIGHT:
|
---|
| 419 | cmp->action = IDM_MOVE;
|
---|
| 420 | hwndCnrS = WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR);
|
---|
| 421 | hwndCnrD = WinWindowFromID(cmp->hwnd, COMP_LEFTDIR);
|
---|
| 422 | break;
|
---|
| 423 | case COMP_COPYLEFT:
|
---|
| 424 | cmp->action = IDM_COPY;
|
---|
| 425 | hwndCnrS = WinWindowFromID(cmp->hwnd, COMP_LEFTDIR);
|
---|
| 426 | hwndCnrD = WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR);
|
---|
| 427 | break;
|
---|
| 428 | case COMP_COPYRIGHT:
|
---|
| 429 | cmp->action = IDM_COPY;
|
---|
| 430 | hwndCnrS = WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR);
|
---|
| 431 | hwndCnrD = WinWindowFromID(cmp->hwnd, COMP_LEFTDIR);
|
---|
| 432 | break;
|
---|
| 433 | default:
|
---|
| 434 | Runtime_Error(pszSrcFile, __LINE__, "bad case %u", cmp->action);
|
---|
| 435 | goto Abort;
|
---|
[2] | 436 | }
|
---|
| 437 |
|
---|
[924] | 438 | pciS = WinSendMsg(hwndCnrS, CM_QUERYRECORD, MPVOID,
|
---|
[551] | 439 | MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
|
---|
[748] | 440 | pciD = WinSendMsg(hwndCnrD, CM_QUERYRECORD, MPVOID,
|
---|
[551] | 441 | MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
|
---|
[316] | 442 |
|
---|
[907] | 443 | WinStartTimer(hab, cmp->hwnd, ID_TIMER, 2000);
|
---|
[924] | 444 | InitITimer(&itdSleep, 500); // Sleep every 500 mSec
|
---|
[907] | 445 |
|
---|
[924] | 446 | while (pciS && (INT)pciS != -1 && pciD && (INT)pciD != -1) {
|
---|
[748] | 447 |
|
---|
[924] | 448 | pciNextS = WinSendMsg(hwndCnrS, CM_QUERYRECORD, MPFROMP(pciS),
|
---|
[551] | 449 | MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
|
---|
[748] | 450 | pciNextD = WinSendMsg(hwndCnrD, CM_QUERYRECORD, MPFROMP(pciD),
|
---|
[551] | 451 | MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
|
---|
[748] | 452 |
|
---|
[924] | 453 | if (*pciS->pszFileName && pciS->rc.flRecordAttr & CRA_SELECTED) {
|
---|
[748] | 454 |
|
---|
| 455 | // Source name not blank
|
---|
[551] | 456 | switch (cmp->action) {
|
---|
| 457 | case IDM_DELETE:
|
---|
[924] | 458 | if (!unlinkf("%s", pciS->pszFileName)) {
|
---|
| 459 | WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciS),
|
---|
[551] | 460 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
[748] | 461 |
|
---|
| 462 | if (!*pciD->pszFileName) {
|
---|
[751] | 463 | // Other side is blank - remove from both sides
|
---|
[924] | 464 | RemoveCnrItems(hwndCnrS, pciS, 1, CMA_FREE | CMA_INVALIDATE);
|
---|
[748] | 465 | if (pciD->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 466 | WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciD),
|
---|
[551] | 467 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
[751] | 468 | RemoveCnrItems(hwndCnrD, pciD, 1, CMA_FREE | CMA_INVALIDATE);
|
---|
[551] | 469 | }
|
---|
[742] | 470 | else {
|
---|
[751] | 471 | // Other side is not blank - update just this side
|
---|
[924] | 472 | FreeCnrItemData(pciS);
|
---|
| 473 | pciS->pszDisplayName = pciS->pszFileName;
|
---|
| 474 | pciS->rc.pszIcon = pciS->pszFileName;
|
---|
| 475 | pciS->flags = 0; // Just on one side
|
---|
| 476 | WinSendMsg(hwndCnrS, CM_INVALIDATERECORD, MPFROMP(&pciS),
|
---|
[551] | 477 | MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
|
---|
[924] | 478 | pciD->flags = 0; // Just on one side
|
---|
| 479 | if (pciD->pszSubject != NullStr) {
|
---|
| 480 | xfree(pciD->pszSubject);
|
---|
| 481 | pciD->pszSubject = NullStr;
|
---|
| 482 | }
|
---|
[551] | 483 | }
|
---|
| 484 | if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_LEFTDIR))
|
---|
| 485 | cmp->cmp->totalleft--;
|
---|
| 486 | else
|
---|
| 487 | cmp->cmp->totalright--;
|
---|
[924] | 488 | // DosSleep(0); // 8-26-07 GKY 1 // 12 Jan 08 SHL
|
---|
[551] | 489 | }
|
---|
| 490 | break;
|
---|
[2] | 491 |
|
---|
[551] | 492 | case IDM_MOVE:
|
---|
| 493 | if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR))
|
---|
[924] | 494 | BldFullPathName(szNewName, cmp->leftdir, pciS->pszDisplayName);
|
---|
[769] | 495 | else
|
---|
[924] | 496 | BldFullPathName(szNewName, cmp->rightdir, pciS->pszDisplayName);
|
---|
[748] | 497 | // Make directory if required
|
---|
[769] | 498 | strcpy(szDirName, szNewName);
|
---|
| 499 | p = strrchr(szDirName, '\\');
|
---|
[551] | 500 | if (p) {
|
---|
[769] | 501 | if (p > szDirName + 2)
|
---|
[551] | 502 | p++;
|
---|
| 503 | *p = 0;
|
---|
[769] | 504 | if (IsFile(szDirName) == -1)
|
---|
| 505 | MassMkdir(hwndMain, szDirName);
|
---|
[551] | 506 | }
|
---|
[924] | 507 | rc = docopyf(MOVE, pciS->pszFileName, "%s", szNewName);
|
---|
| 508 | if (!rc && stricmp(pciS->pszFileName, szNewName)) {
|
---|
| 509 | WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciS),
|
---|
[551] | 510 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
[748] | 511 | if (pciD->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 512 | WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciD),
|
---|
[551] | 513 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
[748] | 514 | FreeCnrItemData(pciD);
|
---|
[769] | 515 | pciD->pszFileName = xstrdup(szNewName, pszSrcFile, __LINE__);
|
---|
[551] | 516 | if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR)) {
|
---|
[748] | 517 | pciD->pszDisplayName = pciD->pszFileName + strlen(cmp->leftdir);
|
---|
[551] | 518 | if (cmp->leftdir[strlen(cmp->leftdir) - 1] != '\\')
|
---|
[751] | 519 | pciD->pszDisplayName++;
|
---|
[551] | 520 | }
|
---|
| 521 | else {
|
---|
[748] | 522 | pciD->pszDisplayName = pciD->pszFileName + strlen(cmp->rightdir);
|
---|
[551] | 523 | if (cmp->rightdir[strlen(cmp->rightdir) - 1] != '\\')
|
---|
[751] | 524 | pciD->pszDisplayName++;
|
---|
[742] | 525 | }
|
---|
[769] | 526 | // 02 Aug 07 SHL fixme to know if LongName transfer is correct?
|
---|
[924] | 527 | pciD->pszLongName = pciS->pszLongName;
|
---|
[751] | 528 | if (pciD->pszSubject != NullStr) {
|
---|
| 529 | xfree(pciD->pszSubject);
|
---|
| 530 | pciD->pszSubject = NullStr;
|
---|
| 531 | }
|
---|
[924] | 532 | pciD->attrFile = pciS->attrFile;
|
---|
| 533 | pciD->pszDispAttr = pciS->pszDispAttr;
|
---|
[769] | 534 | pciD->flags = 0; // Just on one side
|
---|
[924] | 535 | pciD->date = pciS->date;
|
---|
| 536 | pciD->time = pciS->time;
|
---|
| 537 | pciD->ladate = pciS->ladate;
|
---|
| 538 | pciD->latime = pciS->latime;
|
---|
| 539 | pciD->crdate = pciS->crdate;
|
---|
| 540 | pciD->crtime = pciS->crtime;
|
---|
| 541 | pciD->cbFile = pciS->cbFile;
|
---|
| 542 | pciD->easize = pciS->easize;
|
---|
[751] | 543 |
|
---|
[924] | 544 | if (pciS->pszFileName != NullStr) {
|
---|
| 545 | xfree(pciS->pszFileName);
|
---|
| 546 | pciS->pszFileName = NullStr;
|
---|
| 547 | pciS->pszDisplayName = pciS->pszFileName;
|
---|
| 548 | pciS->rc.pszIcon = pciS->pszFileName;
|
---|
[751] | 549 | }
|
---|
[924] | 550 | if (pciS->pszSubject != NullStr) {
|
---|
| 551 | xfree(pciS->pszSubject);
|
---|
| 552 | pciS->pszSubject = NullStr;
|
---|
[751] | 553 | }
|
---|
[924] | 554 | pciS->flags = 0; // Just on one side
|
---|
[751] | 555 |
|
---|
[924] | 556 | WinSendMsg(hwndCnrS, CM_INVALIDATERECORD, MPFROMP(&pciS),
|
---|
[551] | 557 | MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
|
---|
[924] | 558 |
|
---|
[748] | 559 | WinSendMsg(hwndCnrD, CM_INVALIDATERECORD, MPFROMP(&pciD),
|
---|
[551] | 560 | MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
|
---|
[924] | 561 |
|
---|
| 562 | if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_LEFTDIR))
|
---|
| 563 | cmp->cmp->totalleft--;
|
---|
| 564 | else
|
---|
| 565 | cmp->cmp->totalright--;
|
---|
[551] | 566 | }
|
---|
| 567 | else if (rc) {
|
---|
| 568 | rc = Dos_Error(MB_ENTERCANCEL,
|
---|
| 569 | rc,
|
---|
| 570 | HWND_DESKTOP,
|
---|
| 571 | pszSrcFile,
|
---|
| 572 | __LINE__,
|
---|
| 573 | GetPString(IDS_COMPMOVEFAILEDTEXT),
|
---|
[924] | 574 | pciS->pszFileName, szNewName);
|
---|
[748] | 575 | if (rc == MBID_CANCEL) // Cause loop to break
|
---|
| 576 | pciNextS = NULL;
|
---|
[551] | 577 | }
|
---|
| 578 | break;
|
---|
[2] | 579 |
|
---|
[551] | 580 | case IDM_COPY:
|
---|
[769] | 581 | if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR))
|
---|
[924] | 582 | BldFullPathName(szNewName, cmp->leftdir, pciS->pszDisplayName);
|
---|
[769] | 583 | else
|
---|
[924] | 584 | BldFullPathName(szNewName, cmp->rightdir, pciS->pszDisplayName);
|
---|
[748] | 585 | // Make directory if required
|
---|
[769] | 586 | strcpy(szDirName, szNewName);
|
---|
| 587 | p = strrchr(szDirName, '\\');
|
---|
[551] | 588 | if (p) {
|
---|
[769] | 589 | if (p > szDirName + 2)
|
---|
[551] | 590 | p++;
|
---|
| 591 | *p = 0;
|
---|
[769] | 592 | if (IsFile(szDirName) == -1)
|
---|
| 593 | MassMkdir(hwndMain, szDirName);
|
---|
[551] | 594 | }
|
---|
[924] | 595 | rc = docopyf(COPY, pciS->pszFileName, "%s", szNewName);
|
---|
[551] | 596 | if (rc) {
|
---|
| 597 | rc = Dos_Error(MB_ENTERCANCEL,
|
---|
| 598 | rc,
|
---|
| 599 | HWND_DESKTOP,
|
---|
| 600 | pszSrcFile,
|
---|
| 601 | __LINE__,
|
---|
| 602 | GetPString(IDS_COMPCOPYFAILEDTEXT),
|
---|
[924] | 603 | pciS->pszFileName, szNewName);
|
---|
[551] | 604 | if (rc == MBID_CANCEL)
|
---|
[748] | 605 | pciNextS = NULL; // Cause loop to break
|
---|
[551] | 606 | }
|
---|
| 607 | else {
|
---|
[924] | 608 | WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciS),
|
---|
[551] | 609 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
[748] | 610 | if (pciD->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 611 | WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciD),
|
---|
[551] | 612 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
[924] | 613 | // 12 Jan 08 SHL
|
---|
| 614 | if (pciD->pszFileName == NullStr) {
|
---|
| 615 | if (hwndCnrD == WinWindowFromID(cmp->hwnd, COMP_LEFTDIR))
|
---|
| 616 | cmp->totalleft++;
|
---|
| 617 | else
|
---|
| 618 | cmp->totalright++;
|
---|
| 619 | }
|
---|
[748] | 620 | FreeCnrItemData(pciD);
|
---|
[769] | 621 | pciD->pszFileName = xstrdup(szNewName, pszSrcFile, __LINE__);
|
---|
[551] | 622 | if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR)) {
|
---|
[748] | 623 | pciD->pszDisplayName = pciD->pszFileName + strlen(cmp->leftdir);
|
---|
[551] | 624 | if (cmp->leftdir[strlen(cmp->leftdir) - 1] != '\\')
|
---|
[751] | 625 | pciD->pszDisplayName++;
|
---|
[362] | 626 | }
|
---|
| 627 | else {
|
---|
[748] | 628 | pciD->pszDisplayName = pciD->pszFileName + strlen(cmp->rightdir);
|
---|
[551] | 629 | if (cmp->rightdir[strlen(cmp->rightdir) - 1] != '\\')
|
---|
[751] | 630 | pciD->pszDisplayName++;
|
---|
[742] | 631 | }
|
---|
[924] | 632 | pciD->attrFile = pciS->attrFile;
|
---|
| 633 | pciD->pszDispAttr = pciS->pszDispAttr;
|
---|
[769] | 634 | pciD->flags = CNRITEM_EXISTS; // Now on both sides
|
---|
[924] | 635 | pciD->date = pciS->date;
|
---|
| 636 | pciD->time = pciS->time;
|
---|
| 637 | pciD->ladate = pciS->ladate;
|
---|
| 638 | pciD->latime = pciS->latime;
|
---|
| 639 | pciD->crdate = pciS->crdate;
|
---|
| 640 | pciD->crtime = pciS->crtime;
|
---|
| 641 | pciD->cbFile = pciS->cbFile;
|
---|
| 642 | pciD->easize = pciS->easize;
|
---|
[751] | 643 |
|
---|
[769] | 644 | // Forget status until we regenerate it
|
---|
[924] | 645 | if (pciS->pszSubject != NullStr) {
|
---|
| 646 | xfree(pciS->pszSubject);
|
---|
| 647 | pciS->pszSubject = NullStr;
|
---|
[751] | 648 | }
|
---|
[924] | 649 | pciS->flags = CNRITEM_EXISTS; // Now on both sides
|
---|
[751] | 650 |
|
---|
[924] | 651 | WinSendMsg(hwndCnrS, CM_INVALIDATERECORD, MPFROMP(&pciS),
|
---|
[551] | 652 | MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
|
---|
[748] | 653 | WinSendMsg(hwndCnrD, CM_INVALIDATERECORD, MPFROMP(&pciD),
|
---|
[551] | 654 | MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
|
---|
| 655 | }
|
---|
| 656 | break;
|
---|
[2] | 657 |
|
---|
[551] | 658 | default:
|
---|
| 659 | break;
|
---|
[748] | 660 | } // switch
|
---|
| 661 |
|
---|
| 662 | } // if have name
|
---|
| 663 |
|
---|
[924] | 664 | pciS = pciNextS;
|
---|
[748] | 665 | pciD = pciNextD;
|
---|
| 666 |
|
---|
[924] | 667 | SleepIfNeeded(&itdSleep, 0);
|
---|
[748] | 668 | } // while
|
---|
[551] | 669 | Abort:
|
---|
[907] | 670 | WinStopTimer(hab, cmp->hwnd, ID_TIMER);
|
---|
[2] | 671 | WinDestroyMsgQueue(hmq);
|
---|
| 672 | }
|
---|
[907] | 673 | PostMsg(cmp->hwnd, UM_CONTAINER_FILLED, MPFROMLONG(1L), MPVOID);
|
---|
| 674 | PostMsg(cmp->hwnd, WM_COMMAND, MPFROM2SHORT(IDM_DESELECTALL, 0), MPVOID);
|
---|
[535] | 675 | DecrThreadUsage();
|
---|
[2] | 676 | WinTerminate(hab);
|
---|
| 677 | }
|
---|
| 678 | free(cmp);
|
---|
| 679 | }
|
---|
| 680 |
|
---|
[924] | 681 | VOID CompSelect(HWND hwndCnrS, HWND hwndCnrD, INT action, BOOL reset);
|
---|
| 682 |
|
---|
[316] | 683 | //=== SelectCnrsThread() Update container selection flags thread ===
|
---|
[2] | 684 |
|
---|
[919] | 685 | static VOID SelectCnrsThread(VOID *args)
|
---|
[316] | 686 | {
|
---|
[919] | 687 | COMPARE *cmp = (COMPARE *)args;
|
---|
[551] | 688 | HAB hab;
|
---|
| 689 | HMQ hmq;
|
---|
[2] | 690 |
|
---|
[783] | 691 | if (!cmp) {
|
---|
| 692 | Runtime_Error(pszSrcFile, __LINE__, "no data");
|
---|
[2] | 693 | return;
|
---|
[783] | 694 | }
|
---|
[2] | 695 |
|
---|
| 696 | DosError(FERR_DISABLEHARDERR);
|
---|
| 697 |
|
---|
| 698 | hab = WinInitialize(0);
|
---|
[551] | 699 | if (hab) {
|
---|
| 700 | hmq = WinCreateMsgQueue(hab, 0);
|
---|
| 701 | if (hmq) {
|
---|
| 702 | WinCancelShutdown(hmq, TRUE);
|
---|
[535] | 703 | IncrThreadUsage();
|
---|
[2] | 704 | priority_normal();
|
---|
[907] | 705 | WinStartTimer(hab, cmp->hwnd, ID_TIMER, 2000);
|
---|
[551] | 706 | switch (cmp->action) {
|
---|
| 707 | case IDM_INVERT:
|
---|
| 708 | InvertAll(WinWindowFromID(cmp->hwnd, COMP_LEFTDIR));
|
---|
| 709 | InvertAll(WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR));
|
---|
| 710 | break;
|
---|
[2] | 711 |
|
---|
[551] | 712 | case IDM_DESELECTALL:
|
---|
| 713 | Deselect(WinWindowFromID(cmp->hwnd, COMP_LEFTDIR));
|
---|
| 714 | Deselect(WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR));
|
---|
| 715 | break;
|
---|
[2] | 716 |
|
---|
[551] | 717 | default:
|
---|
[924] | 718 | // 13 Jan 08 SHL fixme to decide if cmp->reset can ever get set
|
---|
| 719 | // if not lots of code can disappear
|
---|
| 720 | if (cmp->reset)
|
---|
| 721 | DbgMsg(pszSrcFile, __LINE__, "cmp->reset is TRUE");
|
---|
| 722 | CompSelect(WinWindowFromID(cmp->hwnd, COMP_LEFTDIR),
|
---|
| 723 | WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR),
|
---|
| 724 | cmp->action, cmp->reset);
|
---|
[551] | 725 | break;
|
---|
[2] | 726 | }
|
---|
[907] | 727 | WinStopTimer(hab, cmp->hwnd, ID_TIMER);
|
---|
[551] | 728 | if (!PostMsg(cmp->hwnd, UM_CONTAINER_FILLED, MPFROMLONG(1L), MPVOID))
|
---|
| 729 | WinSendMsg(cmp->hwnd, UM_CONTAINER_FILLED, MPFROMLONG(1L), MPVOID);
|
---|
[2] | 730 | WinDestroyMsgQueue(hmq);
|
---|
| 731 | }
|
---|
[535] | 732 | DecrThreadUsage();
|
---|
[2] | 733 | WinTerminate(hab);
|
---|
| 734 | }
|
---|
| 735 | free(cmp);
|
---|
| 736 | }
|
---|
| 737 |
|
---|
[748] | 738 | /**
|
---|
[924] | 739 | * Do select actions for compare directories containers
|
---|
| 740 | * @param action is select mode
|
---|
| 741 | * @param reset requests flags by regenerated
|
---|
| 742 | */
|
---|
| 743 |
|
---|
| 744 | VOID CompSelect(HWND hwndCnrS, HWND hwndCnrD, INT action, BOOL reset)
|
---|
| 745 | {
|
---|
| 746 | PCNRITEM pciS, pciD, *pciSa = NULL, *pciDa = NULL;
|
---|
| 747 | CNRINFO cnri;
|
---|
| 748 | BOOL slow = FALSE;
|
---|
| 749 | UINT x, numD, numS;
|
---|
| 750 | INT ret = 0;
|
---|
| 751 | ITIMER_DESC itdSleep = { 0 };
|
---|
| 752 |
|
---|
| 753 | if (!hwndCnrS || !hwndCnrD) {
|
---|
| 754 | Runtime_Error(pszSrcFile, __LINE__, "hwndCnrS %p hwndCnrD %p", hwndCnrS, hwndCnrD);
|
---|
| 755 | return;
|
---|
| 756 | }
|
---|
| 757 |
|
---|
| 758 | memset(&cnri, 0, sizeof(CNRINFO));
|
---|
| 759 | cnri.cb = sizeof(CNRINFO);
|
---|
| 760 | WinSendMsg(hwndCnrD, CM_QUERYCNRINFO, MPFROMP(&cnri),
|
---|
| 761 | MPFROMLONG(sizeof(CNRINFO)));
|
---|
| 762 | numD = cnri.cRecords;
|
---|
| 763 | memset(&cnri, 0, sizeof(CNRINFO));
|
---|
| 764 | cnri.cb = sizeof(CNRINFO);
|
---|
| 765 | WinSendMsg(hwndCnrS, CM_QUERYCNRINFO, MPFROMP(&cnri),
|
---|
| 766 | MPFROMLONG(sizeof(CNRINFO)));
|
---|
| 767 | numS = cnri.cRecords;
|
---|
| 768 | if (!numD || numS != numD) {
|
---|
| 769 | Runtime_Error(pszSrcFile, __LINE__, "numD %u != numS %u", numD, numS);
|
---|
| 770 | return;
|
---|
| 771 | }
|
---|
| 772 |
|
---|
| 773 | pciDa = xmalloc(sizeof(PCNRITEM) * numD, pszSrcFile, __LINE__);
|
---|
| 774 | if (!pciDa)
|
---|
| 775 | return;
|
---|
| 776 |
|
---|
| 777 | pciSa = xmalloc(sizeof(PCNRITEM) * numS, pszSrcFile, __LINE__);
|
---|
| 778 | if (!pciSa) {
|
---|
| 779 | free(pciDa);
|
---|
| 780 | return;
|
---|
| 781 | }
|
---|
| 782 |
|
---|
| 783 | InitITimer(&itdSleep, 500); // Sleep every 500 mSec
|
---|
| 784 |
|
---|
| 785 | Restart:
|
---|
| 786 |
|
---|
| 787 | memset(pciDa, 0, sizeof(PCNRITEM) * numD);
|
---|
| 788 | memset(pciSa, 0, sizeof(PCNRITEM) * numS);
|
---|
| 789 |
|
---|
| 790 | pciD = (PCNRITEM)WinSendMsg(hwndCnrD, CM_QUERYRECORD, MPVOID,
|
---|
| 791 | MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
|
---|
| 792 | x = 0;
|
---|
| 793 | while (pciD && (INT)pciD != -1 && x < numD) {
|
---|
| 794 | if (reset)
|
---|
| 795 | pciD->flags = 0;
|
---|
| 796 | pciDa[x] = pciD;
|
---|
| 797 | x++;
|
---|
| 798 | if (!slow)
|
---|
| 799 | pciD = (PCNRITEM) pciD->rc.preccNextRecord;
|
---|
| 800 | else
|
---|
| 801 | pciD = (PCNRITEM) WinSendMsg(hwndCnrD, CM_QUERYRECORD, MPFROMP(pciD),
|
---|
| 802 | MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
|
---|
| 803 | SleepIfNeeded(&itdSleep, 0);
|
---|
| 804 | } // while
|
---|
| 805 |
|
---|
| 806 | if (numD != x) {
|
---|
| 807 | // Something out of sync - fixme to document why
|
---|
| 808 | if (!slow) {
|
---|
| 809 | slow = TRUE;
|
---|
| 810 | goto Restart;
|
---|
| 811 | }
|
---|
| 812 | free(pciDa);
|
---|
| 813 | free(pciSa);
|
---|
| 814 | Runtime_Error(pszSrcFile, __LINE__, "numD %u != x %lu", numD, x);
|
---|
| 815 | return;
|
---|
| 816 | }
|
---|
| 817 |
|
---|
| 818 | pciS = (PCNRITEM) WinSendMsg(hwndCnrS, CM_QUERYRECORD, MPVOID,
|
---|
| 819 | MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
|
---|
| 820 | x = 0;
|
---|
| 821 | while (pciS && (INT)pciS != -1 && x < numS) {
|
---|
| 822 | if (reset)
|
---|
| 823 | pciS->flags = 0;
|
---|
| 824 | pciSa[x] = pciS;
|
---|
| 825 | x++;
|
---|
| 826 | if (!slow)
|
---|
| 827 | pciS = (PCNRITEM) pciS->rc.preccNextRecord;
|
---|
| 828 | else
|
---|
| 829 | pciS = (PCNRITEM) WinSendMsg(hwndCnrS, CM_QUERYRECORD, MPFROMP(pciS),
|
---|
| 830 | MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
|
---|
| 831 | SleepIfNeeded(&itdSleep, 0);
|
---|
| 832 | } // while
|
---|
| 833 |
|
---|
| 834 | if (numS != x) {
|
---|
| 835 | if (!slow) {
|
---|
| 836 | slow = TRUE;
|
---|
| 837 | goto Restart;
|
---|
| 838 | }
|
---|
| 839 | free(pciSa);
|
---|
| 840 | free(pciDa);
|
---|
| 841 | Runtime_Error(pszSrcFile, __LINE__, "numS (%lu) != x (%lu)", numS, x);
|
---|
| 842 | return;
|
---|
| 843 | }
|
---|
| 844 |
|
---|
| 845 | if (reset) {
|
---|
| 846 | // Update flags for files that exist on both sides
|
---|
| 847 | for (x = 0; x < numS; x++) {
|
---|
| 848 |
|
---|
| 849 | if (!*pciSa[x]->pszFileName || !*pciDa[x]->pszFileName) {
|
---|
| 850 | // 12 Jan 08 SHL clear flags
|
---|
| 851 | pciSa[x]->flags = 0; // File exists on one side only
|
---|
| 852 | pciDa[x]->flags = 0;
|
---|
| 853 | continue;
|
---|
| 854 | }
|
---|
| 855 |
|
---|
| 856 | pciSa[x]->flags |= CNRITEM_EXISTS; // File exists on both sides
|
---|
| 857 | pciDa[x]->flags |= CNRITEM_EXISTS;
|
---|
| 858 | if (pciSa[x]->cbFile + pciSa[x]->easize >
|
---|
| 859 | pciDa[x]->cbFile + pciDa[x]->easize) {
|
---|
| 860 | pciSa[x]->flags |= CNRITEM_LARGER;
|
---|
| 861 | pciDa[x]->flags |= CNRITEM_SMALLER;
|
---|
| 862 | }
|
---|
| 863 | else if (pciSa[x]->cbFile + pciSa[x]->easize <
|
---|
| 864 | pciDa[x]->cbFile + pciDa[x]->easize) {
|
---|
| 865 | pciSa[x]->flags |= CNRITEM_SMALLER;
|
---|
| 866 | pciDa[x]->flags |= CNRITEM_LARGER;
|
---|
| 867 | }
|
---|
| 868 | ret = TestCDates(&pciDa[x]->date, &pciDa[x]->time,
|
---|
| 869 | &pciSa[x]->date, &pciSa[x]->time);
|
---|
| 870 | if (ret == 1)
|
---|
| 871 | /* 13 Jan 08 SHL fixme to be gone?
|
---|
| 872 | ((pciSa[x]->date.year > pciDa[x]->date.year) ? TRUE :
|
---|
| 873 | (pciSa[x]->date.year < pciDa[x]->date.year) ? FALSE :
|
---|
| 874 | (pciSa[x]->date.month > pciDa[x]->date.month) ? TRUE :
|
---|
| 875 | (pciSa[x]->date.month < pciDa[x]->date.month) ? FALSE :
|
---|
| 876 | (pciSa[x]->date.day > pciDa[x]->date.day) ? TRUE :
|
---|
| 877 | (pciSa[x]->date.day < pciDa[x]->date.day) ? FALSE :
|
---|
| 878 | (pciSa[x]->time.hours > pciDa[x]->time.hours) ? TRUE :
|
---|
| 879 | (pciSa[x]->time.hours < pciDa[x]->time.hours) ? FALSE :
|
---|
| 880 | (pciSa[x]->time.minutes > pciDa[x]->time.minutes) ? TRUE :
|
---|
| 881 | (pciSa[x]->time.minutes < pciDa[x]->time.minutes) ? FALSE :
|
---|
| 882 | (pciSa[x]->time.seconds > pciDa[x]->time.seconds) ? TRUE :
|
---|
| 883 | (pciSa[x]->time.seconds < pciDa[x]->time.seconds) ? FALSE : FALSE)
|
---|
| 884 | */
|
---|
| 885 | {
|
---|
| 886 | pciSa[x]->flags |= CNRITEM_NEWER;
|
---|
| 887 | pciDa[x]->flags |= CNRITEM_OLDER;
|
---|
| 888 | }
|
---|
| 889 | else if (ret == -1)
|
---|
| 890 | /* 13 Jan 08 SHL fixme to be gone?
|
---|
| 891 | ((pciSa[x]->date.year < pciDa[x]->date.year) ? TRUE :
|
---|
| 892 | (pciSa[x]->date.year > pciDa[x]->date.year) ? FALSE :
|
---|
| 893 | (pciSa[x]->date.month < pciDa[x]->date.month) ? TRUE :
|
---|
| 894 | (pciSa[x]->date.month > pciDa[x]->date.month) ? FALSE :
|
---|
| 895 | (pciSa[x]->date.day < pciDa[x]->date.day) ? TRUE :
|
---|
| 896 | (pciSa[x]->date.day > pciDa[x]->date.day) ? FALSE :
|
---|
| 897 | (pciSa[x]->time.hours < pciDa[x]->time.hours) ? TRUE :
|
---|
| 898 | (pciSa[x]->time.hours > pciDa[x]->time.hours) ? FALSE :
|
---|
| 899 | (pciSa[x]->time.minutes < pciDa[x]->time.minutes) ? TRUE :
|
---|
| 900 | (pciSa[x]->time.minutes > pciDa[x]->time.minutes) ? FALSE :
|
---|
| 901 | (pciSa[x]->time.seconds < pciDa[x]->time.seconds) ? TRUE :
|
---|
| 902 | (pciSa[x]->time.seconds > pciDa[x]->time.seconds) ? FALSE :
|
---|
| 903 | FALSE)
|
---|
| 904 | */
|
---|
| 905 | {
|
---|
| 906 | pciSa[x]->flags |= CNRITEM_OLDER;
|
---|
| 907 | pciDa[x]->flags |= CNRITEM_NEWER;
|
---|
| 908 | }
|
---|
| 909 | SleepIfNeeded(&itdSleep, 0);
|
---|
| 910 | } // for
|
---|
| 911 | } // if reset
|
---|
| 912 |
|
---|
| 913 | switch (action) {
|
---|
| 914 | case IDM_SELECTIDENTICAL:
|
---|
| 915 | for (x = 0; x < numS; x++) {
|
---|
| 916 | if (~pciSa[x]->rc.flRecordAttr & CRA_FILTERED &&
|
---|
| 917 | pciSa[x]->flags & CNRITEM_EXISTS &&
|
---|
| 918 | ~pciSa[x]->flags & CNRITEM_SMALLER &&
|
---|
| 919 | ~pciSa[x]->flags & CNRITEM_LARGER &&
|
---|
| 920 | ~pciSa[x]->flags & CNRITEM_NEWER &&
|
---|
| 921 | ~pciSa[x]->flags & CNRITEM_OLDER) {
|
---|
| 922 | if (~pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 923 | WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciSa[x]),
|
---|
| 924 | MPFROM2SHORT(TRUE, CRA_SELECTED));
|
---|
| 925 | if (~pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 926 | WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciDa[x]),
|
---|
| 927 | MPFROM2SHORT(TRUE, CRA_SELECTED));
|
---|
| 928 | }
|
---|
| 929 | SleepIfNeeded(&itdSleep, 0);
|
---|
| 930 | } // for
|
---|
| 931 | break;
|
---|
| 932 |
|
---|
| 933 | case IDM_SELECTSAME:
|
---|
| 934 | for (x = 0; x < numS; x++) {
|
---|
| 935 | if (~pciSa[x]->rc.flRecordAttr & CRA_FILTERED &&
|
---|
| 936 | pciSa[x]->flags & CNRITEM_EXISTS &&
|
---|
| 937 | ~pciSa[x]->flags & CNRITEM_SMALLER &&
|
---|
| 938 | ~pciSa[x]->flags & CNRITEM_LARGER) {
|
---|
| 939 | if (~pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 940 | WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciSa[x]),
|
---|
| 941 | MPFROM2SHORT(TRUE, CRA_SELECTED));
|
---|
| 942 | if (~pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 943 | WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciDa[x]),
|
---|
| 944 | MPFROM2SHORT(TRUE, CRA_SELECTED));
|
---|
| 945 | }
|
---|
| 946 | SleepIfNeeded(&itdSleep, 0);
|
---|
| 947 | } // for
|
---|
| 948 | break;
|
---|
| 949 |
|
---|
| 950 | case IDM_SELECTSAMECONTENT:
|
---|
| 951 | for (x = 0; x < numS; x++) {
|
---|
| 952 | if (~pciSa[x]->rc.flRecordAttr & CRA_FILTERED &&
|
---|
| 953 | pciSa[x]->flags & CNRITEM_EXISTS)
|
---|
| 954 | {
|
---|
| 955 | FILE *fp1 = NULL;
|
---|
| 956 | FILE *fp2 = NULL;
|
---|
| 957 | BOOL gotMatch = FALSE;
|
---|
| 958 | UINT errLineNo = 0;
|
---|
| 959 | UINT compErrno = 0;
|
---|
| 960 | CHAR buf1[1024];
|
---|
| 961 | CHAR buf2[1024];
|
---|
| 962 | HAB hab = WinQueryAnchorBlock(hwndCnrS);
|
---|
| 963 |
|
---|
| 964 | if (!*pciSa[x]->pszFileName ||
|
---|
| 965 | !*pciDa[x]->pszFileName) {
|
---|
| 966 | Runtime_Error(pszSrcFile, __LINE__,
|
---|
| 967 | "CNRITEM_EXISTS set with null file name for index %u", x);
|
---|
| 968 | break;
|
---|
| 969 | }
|
---|
| 970 |
|
---|
| 971 | fp1 = _fsopen(pciSa[x]->pszFileName, "rb", SH_DENYNO);
|
---|
| 972 | if (!fp1) {
|
---|
| 973 | errLineNo = __LINE__;
|
---|
| 974 | compErrno = errno;
|
---|
| 975 | }
|
---|
| 976 | else {
|
---|
| 977 | fp2 = _fsopen(pciDa[x]->pszFileName, "rb", SH_DENYNO);
|
---|
| 978 | if (!fp2) {
|
---|
| 979 | errLineNo = __LINE__;
|
---|
| 980 | compErrno = errno;
|
---|
| 981 | }
|
---|
| 982 | else {
|
---|
| 983 | size_t len1 = filelength(fileno(fp1));
|
---|
| 984 | size_t len2 = filelength(fileno(fp2));
|
---|
| 985 |
|
---|
| 986 | if (len1 == len2) {
|
---|
| 987 | setbuf(fp1, NULL);
|
---|
| 988 | setbuf(fp2, NULL);
|
---|
| 989 | while (WinIsWindow(hab, hwndCnrS)) {
|
---|
| 990 | size_t numread1 = fread(buf1, 1, 1024, fp1);
|
---|
| 991 | size_t numread2 = fread(buf2, 1, 1024, fp2);
|
---|
| 992 |
|
---|
| 993 | if (!numread1 || !numread2 || numread1 != numread2) {
|
---|
| 994 | if (ferror(fp1) || ferror(fp2)) {
|
---|
| 995 | errLineNo = __LINE__;
|
---|
| 996 | compErrno = errno;
|
---|
| 997 | }
|
---|
| 998 | else if (feof(fp1) && feof(fp2))
|
---|
| 999 | gotMatch = TRUE;
|
---|
| 1000 | break;
|
---|
| 1001 | }
|
---|
| 1002 | else if (memcmp(buf1, buf2, numread1))
|
---|
| 1003 | break;
|
---|
| 1004 | } // while
|
---|
| 1005 | } // same len
|
---|
| 1006 | }
|
---|
| 1007 | }
|
---|
| 1008 |
|
---|
| 1009 | if (fp1)
|
---|
| 1010 | fclose(fp1);
|
---|
| 1011 |
|
---|
| 1012 | if (fp2)
|
---|
| 1013 | fclose(fp2);
|
---|
| 1014 |
|
---|
| 1015 | if (errLineNo) {
|
---|
| 1016 | Runtime_Error(pszSrcFile, errLineNo,
|
---|
| 1017 | "error %d while comparing", compErrno);
|
---|
| 1018 | }
|
---|
| 1019 |
|
---|
| 1020 | if (gotMatch) {
|
---|
| 1021 | if (~pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 1022 | WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciSa[x]),
|
---|
| 1023 | MPFROM2SHORT(TRUE, CRA_SELECTED));
|
---|
| 1024 | if (~pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 1025 | WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciDa[x]),
|
---|
| 1026 | MPFROM2SHORT(TRUE, CRA_SELECTED));
|
---|
| 1027 | }
|
---|
| 1028 | }
|
---|
| 1029 | SleepIfNeeded(&itdSleep, 0);
|
---|
| 1030 | } // for
|
---|
| 1031 | break;
|
---|
| 1032 |
|
---|
| 1033 | case IDM_SELECTBOTH:
|
---|
| 1034 | for (x = 0; x < numS; x++) {
|
---|
| 1035 | if (~pciSa[x]->rc.flRecordAttr & CRA_FILTERED &&
|
---|
| 1036 | pciSa[x]->flags & CNRITEM_EXISTS) {
|
---|
| 1037 | if (~pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 1038 | WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciSa[x]),
|
---|
| 1039 | MPFROM2SHORT(TRUE, CRA_SELECTED));
|
---|
| 1040 | if (~pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 1041 | WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciDa[x]),
|
---|
| 1042 | MPFROM2SHORT(TRUE, CRA_SELECTED));
|
---|
| 1043 | }
|
---|
| 1044 | SleepIfNeeded(&itdSleep, 0);
|
---|
| 1045 | } // for
|
---|
| 1046 | break;
|
---|
| 1047 |
|
---|
| 1048 | case IDM_SELECTONE:
|
---|
| 1049 | for (x = 0; x < numS; x++) {
|
---|
| 1050 | if (~pciSa[x]->rc.flRecordAttr & CRA_FILTERED &&
|
---|
| 1051 | ~pciSa[x]->flags & CNRITEM_EXISTS) {
|
---|
| 1052 | if (*pciSa[x]->pszFileName) {
|
---|
| 1053 | if (~pciSa[x]->rc.flRecordAttr & CRA_SELECTED) {
|
---|
| 1054 | WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciSa[x]),
|
---|
| 1055 | MPFROM2SHORT(TRUE, CRA_SELECTED));
|
---|
| 1056 | }
|
---|
| 1057 | }
|
---|
| 1058 | else if (~pciDa[x]->rc.flRecordAttr & CRA_SELECTED) {
|
---|
| 1059 | WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciDa[x]),
|
---|
| 1060 | MPFROM2SHORT(TRUE, CRA_SELECTED));
|
---|
| 1061 | }
|
---|
| 1062 | }
|
---|
| 1063 | SleepIfNeeded(&itdSleep, 0);
|
---|
| 1064 | } // for
|
---|
| 1065 | break;
|
---|
| 1066 |
|
---|
| 1067 | case IDM_SELECTBIGGER:
|
---|
| 1068 | for (x = 0; x < numS; x++) {
|
---|
| 1069 | if (~pciSa[x]->rc.flRecordAttr & CRA_FILTERED) {
|
---|
| 1070 | if (pciSa[x]->flags & CNRITEM_LARGER) {
|
---|
| 1071 | if (~pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 1072 | WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciSa[x]),
|
---|
| 1073 | MPFROM2SHORT(TRUE, CRA_SELECTED));
|
---|
| 1074 | }
|
---|
| 1075 | else if (pciDa[x]->flags & CNRITEM_LARGER) {
|
---|
| 1076 | if (~pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 1077 | WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciDa[x]),
|
---|
| 1078 | MPFROM2SHORT(TRUE, CRA_SELECTED));
|
---|
| 1079 | }
|
---|
| 1080 | }
|
---|
| 1081 | SleepIfNeeded(&itdSleep, 0);
|
---|
| 1082 | } // for
|
---|
| 1083 | break;
|
---|
| 1084 |
|
---|
| 1085 | case IDM_SELECTSMALLER:
|
---|
| 1086 | for (x = 0; x < numS; x++) {
|
---|
| 1087 | if (~pciSa[x]->rc.flRecordAttr & CRA_FILTERED) {
|
---|
| 1088 | if (pciSa[x]->flags & CNRITEM_SMALLER) {
|
---|
| 1089 | if (~pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 1090 | WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciSa[x]),
|
---|
| 1091 | MPFROM2SHORT(TRUE, CRA_SELECTED));
|
---|
| 1092 | }
|
---|
| 1093 | else if (pciDa[x]->flags & CNRITEM_SMALLER) {
|
---|
| 1094 | if (~pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 1095 | WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciDa[x]),
|
---|
| 1096 | MPFROM2SHORT(TRUE, CRA_SELECTED));
|
---|
| 1097 | }
|
---|
| 1098 | }
|
---|
| 1099 | SleepIfNeeded(&itdSleep, 0);
|
---|
| 1100 | } // for
|
---|
| 1101 | break;
|
---|
| 1102 |
|
---|
| 1103 | case IDM_SELECTNEWER:
|
---|
| 1104 | for (x = 0; x < numS; x++) {
|
---|
| 1105 | if (~pciSa[x]->rc.flRecordAttr & CRA_FILTERED) {
|
---|
| 1106 | if (pciSa[x]->flags & CNRITEM_NEWER) {
|
---|
| 1107 | if (~pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 1108 | WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciSa[x]),
|
---|
| 1109 | MPFROM2SHORT(TRUE, CRA_SELECTED));
|
---|
| 1110 | }
|
---|
| 1111 | else if (pciDa[x]->flags & CNRITEM_NEWER) {
|
---|
| 1112 | if (~pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 1113 | WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciDa[x]),
|
---|
| 1114 | MPFROM2SHORT(TRUE, CRA_SELECTED));
|
---|
| 1115 | }
|
---|
| 1116 | }
|
---|
| 1117 | SleepIfNeeded(&itdSleep, 0);
|
---|
| 1118 | } // for
|
---|
| 1119 | break;
|
---|
| 1120 |
|
---|
| 1121 | case IDM_SELECTOLDER:
|
---|
| 1122 | for (x = 0; x < numS; x++) {
|
---|
| 1123 | if (~pciSa[x]->rc.flRecordAttr & CRA_FILTERED) {
|
---|
| 1124 | if (pciSa[x]->flags & CNRITEM_OLDER) {
|
---|
| 1125 | if (~pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 1126 | WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciSa[x]),
|
---|
| 1127 | MPFROM2SHORT(TRUE, CRA_SELECTED));
|
---|
| 1128 | }
|
---|
| 1129 | else if (pciDa[x]->flags & CNRITEM_OLDER) {
|
---|
| 1130 | if (~pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 1131 | WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciDa[x]),
|
---|
| 1132 | MPFROM2SHORT(TRUE, CRA_SELECTED));
|
---|
| 1133 | }
|
---|
| 1134 | }
|
---|
| 1135 | SleepIfNeeded(&itdSleep, 0);
|
---|
| 1136 | } // for
|
---|
| 1137 | break;
|
---|
| 1138 |
|
---|
| 1139 | case IDM_DESELECTBOTH:
|
---|
| 1140 | for (x = 0; x < numS; x++) {
|
---|
| 1141 | if (~pciSa[x]->rc.flRecordAttr & CRA_FILTERED &&
|
---|
| 1142 | pciSa[x]->flags & CNRITEM_EXISTS) {
|
---|
| 1143 | if (pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 1144 | WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciSa[x]),
|
---|
| 1145 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
| 1146 | if (pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 1147 | WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciDa[x]),
|
---|
| 1148 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
| 1149 | }
|
---|
| 1150 | SleepIfNeeded(&itdSleep, 0);
|
---|
| 1151 | } // for
|
---|
| 1152 | break;
|
---|
| 1153 |
|
---|
| 1154 | case IDM_DESELECTONE:
|
---|
| 1155 | for (x = 0; x < numS; x++) {
|
---|
| 1156 | if (~pciSa[x]->rc.flRecordAttr & CRA_FILTERED) {
|
---|
| 1157 | if (~pciSa[x]->flags & CNRITEM_EXISTS) {
|
---|
| 1158 | if (*pciSa[x]->pszFileName) {
|
---|
| 1159 | if (pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 1160 | WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciSa[x]),
|
---|
| 1161 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
| 1162 | }
|
---|
| 1163 | else if (pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 1164 | WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciDa[x]),
|
---|
| 1165 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
| 1166 | }
|
---|
| 1167 | }
|
---|
| 1168 | SleepIfNeeded(&itdSleep, 0);
|
---|
| 1169 | } // for
|
---|
| 1170 | break;
|
---|
| 1171 |
|
---|
| 1172 | case IDM_DESELECTBIGGER:
|
---|
| 1173 | for (x = 0; x < numS; x++) {
|
---|
| 1174 | if (~pciSa[x]->rc.flRecordAttr & CRA_FILTERED) {
|
---|
| 1175 | if (pciSa[x]->flags & CNRITEM_LARGER) {
|
---|
| 1176 | if (pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 1177 | WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciSa[x]),
|
---|
| 1178 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
| 1179 | }
|
---|
| 1180 | else if (pciDa[x]->flags & CNRITEM_LARGER) {
|
---|
| 1181 | if (pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 1182 | WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciDa[x]),
|
---|
| 1183 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
| 1184 | }
|
---|
| 1185 | }
|
---|
| 1186 | SleepIfNeeded(&itdSleep, 0);
|
---|
| 1187 | } // for
|
---|
| 1188 | break;
|
---|
| 1189 |
|
---|
| 1190 | case IDM_DESELECTSMALLER:
|
---|
| 1191 | for (x = 0; x < numS; x++) {
|
---|
| 1192 | if (~pciSa[x]->rc.flRecordAttr & CRA_FILTERED) {
|
---|
| 1193 | if (pciSa[x]->flags & CNRITEM_SMALLER) {
|
---|
| 1194 | if (pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 1195 | WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciSa[x]),
|
---|
| 1196 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
| 1197 | }
|
---|
| 1198 | else if (pciDa[x]->flags & CNRITEM_SMALLER) {
|
---|
| 1199 | if (pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 1200 | WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciDa[x]),
|
---|
| 1201 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
| 1202 | }
|
---|
| 1203 | }
|
---|
| 1204 | SleepIfNeeded(&itdSleep, 0);
|
---|
| 1205 | } // for
|
---|
| 1206 | break;
|
---|
| 1207 |
|
---|
| 1208 | case IDM_DESELECTNEWER:
|
---|
| 1209 | for (x = 0; x < numS; x++) {
|
---|
| 1210 | if (~pciSa[x]->rc.flRecordAttr & CRA_FILTERED) {
|
---|
| 1211 | if (pciSa[x]->flags & CNRITEM_NEWER) {
|
---|
| 1212 | if (pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 1213 | WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciSa[x]),
|
---|
| 1214 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
| 1215 | }
|
---|
| 1216 | else if (pciDa[x]->flags & CNRITEM_NEWER) {
|
---|
| 1217 | if (pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 1218 | WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciDa[x]),
|
---|
| 1219 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
| 1220 | }
|
---|
| 1221 | }
|
---|
| 1222 | SleepIfNeeded(&itdSleep, 0);
|
---|
| 1223 | } // for
|
---|
| 1224 | break;
|
---|
| 1225 |
|
---|
| 1226 | case IDM_DESELECTOLDER:
|
---|
| 1227 | for (x = 0; x < numS; x++) {
|
---|
| 1228 | if (~pciSa[x]->rc.flRecordAttr & CRA_FILTERED) {
|
---|
| 1229 | if (pciSa[x]->flags & CNRITEM_OLDER) {
|
---|
| 1230 | if (pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 1231 | WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciSa[x]),
|
---|
| 1232 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
| 1233 | }
|
---|
| 1234 | else if (pciDa[x]->flags & CNRITEM_OLDER) {
|
---|
| 1235 | if (pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 1236 | WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciDa[x]),
|
---|
| 1237 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
| 1238 | }
|
---|
| 1239 | }
|
---|
| 1240 | SleepIfNeeded(&itdSleep, 0);
|
---|
| 1241 | } // for
|
---|
| 1242 | break;
|
---|
| 1243 |
|
---|
| 1244 | default:
|
---|
| 1245 | break;
|
---|
| 1246 | }
|
---|
| 1247 |
|
---|
| 1248 | if (reset) {
|
---|
| 1249 | while (numS) {
|
---|
| 1250 | WinSendMsg(hwndCnrS, CM_INVALIDATERECORD,
|
---|
| 1251 | MPFROMP(pciSa), MPFROM2SHORT((min(numS, 65535)), 0));
|
---|
| 1252 | // DosSleep(0); //Let screen update // 12 Jan 08 SHL
|
---|
| 1253 | WinSendMsg(hwndCnrD, CM_INVALIDATERECORD,
|
---|
| 1254 | MPFROMP(pciDa), MPFROM2SHORT((min(numD, 65535)), 0));
|
---|
| 1255 | numS -= min(numS, 65535);
|
---|
| 1256 | // if (numS) // 12 Jan 08 SHL
|
---|
| 1257 | // DosSleep(0); //26 Aug 07 GKY 1
|
---|
| 1258 | SleepIfNeeded(&itdSleep, 0); // 12 Jan 08 SHL
|
---|
| 1259 | } // while
|
---|
| 1260 | }
|
---|
| 1261 |
|
---|
| 1262 | free(pciSa);
|
---|
| 1263 | free(pciDa);
|
---|
| 1264 | DosPostEventSem(CompactSem);
|
---|
| 1265 | }
|
---|
| 1266 |
|
---|
| 1267 | /**
|
---|
[748] | 1268 | * Build FILELIST given pathname
|
---|
| 1269 | */
|
---|
| 1270 |
|
---|
[907] | 1271 | static VOID FillDirList(CHAR *str, UINT skiplen, BOOL recurse,
|
---|
| 1272 | FILELIST ***list, UINT *pnumfiles, UINT *pnumalloc)
|
---|
[551] | 1273 | {
|
---|
[748] | 1274 | CHAR *enddir;
|
---|
| 1275 | ULONG x;
|
---|
[551] | 1276 | CHAR *maskstr;
|
---|
[841] | 1277 | PFILEFINDBUF4L pffbArray;
|
---|
| 1278 | PFILEFINDBUF4L pffbFile;
|
---|
[551] | 1279 | HDIR hDir;
|
---|
[783] | 1280 | ULONG ulFindCnt;
|
---|
[841] | 1281 | ULONG ulBufBytes = sizeof(FILEFINDBUF4L) * FilesToGet;
|
---|
[551] | 1282 | APIRET rc;
|
---|
[2] | 1283 |
|
---|
[748] | 1284 | if (!str || !*str) {
|
---|
[773] | 1285 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
[2] | 1286 | return;
|
---|
[748] | 1287 | }
|
---|
| 1288 |
|
---|
[846] | 1289 | // DbgMsg(pszSrcFile, __LINE__, "FillDirList start %s", str);
|
---|
| 1290 |
|
---|
[551] | 1291 | maskstr = xmalloc(CCHMAXPATH, pszSrcFile, __LINE__);
|
---|
| 1292 | if (!maskstr)
|
---|
[2] | 1293 | return;
|
---|
[783] | 1294 | pffbArray = xmalloc(ulBufBytes, pszSrcFile, __LINE__);
|
---|
| 1295 | if (!pffbArray) {
|
---|
[2] | 1296 | free(maskstr);
|
---|
| 1297 | return;
|
---|
| 1298 | }
|
---|
| 1299 | x = strlen(str);
|
---|
[551] | 1300 | memcpy(maskstr, str, x + 1);
|
---|
[2] | 1301 | enddir = maskstr + x;
|
---|
[551] | 1302 | if (*(enddir - 1) != '\\') {
|
---|
[2] | 1303 | *enddir = '\\';
|
---|
| 1304 | enddir++;
|
---|
| 1305 | *enddir = 0;
|
---|
| 1306 | }
|
---|
| 1307 | *enddir = '*';
|
---|
| 1308 | *(enddir + 1) = 0;
|
---|
| 1309 | hDir = HDIR_CREATE;
|
---|
| 1310 | DosError(FERR_DISABLEHARDERR);
|
---|
[783] | 1311 | ulFindCnt = FilesToGet;
|
---|
[838] | 1312 | rc = xDosFindFirst(maskstr, &hDir,
|
---|
[907] | 1313 | FILE_NORMAL | FILE_READONLY | FILE_ARCHIVED |
|
---|
[838] | 1314 | FILE_SYSTEM | FILE_HIDDEN |
|
---|
| 1315 | (recurse ? FILE_DIRECTORY : 0),
|
---|
[841] | 1316 | pffbArray, ulBufBytes, &ulFindCnt, FIL_QUERYEASIZEL);
|
---|
[551] | 1317 | if (!rc) {
|
---|
[783] | 1318 | do {
|
---|
| 1319 | pffbFile = pffbArray;
|
---|
| 1320 | for (x = 0; x < ulFindCnt; x++) {
|
---|
| 1321 | if (pffbFile->attrFile & FILE_DIRECTORY) {
|
---|
[517] | 1322 | // Skip . and ..
|
---|
[551] | 1323 | if (recurse &&
|
---|
[783] | 1324 | (pffbFile->achName[0] != '.' ||
|
---|
| 1325 | (pffbFile->achName[1] &&
|
---|
| 1326 | (pffbFile->achName[1] != '.' || pffbFile->achName[2])))) {
|
---|
[551] | 1327 | if (fForceUpper)
|
---|
[783] | 1328 | strupr(pffbFile->achName);
|
---|
[551] | 1329 | else if (fForceLower)
|
---|
[783] | 1330 | strlwr(pffbFile->achName);
|
---|
| 1331 | memcpy(enddir, pffbFile->achName, pffbFile->cchName + 1);
|
---|
[907] | 1332 | FillDirList(maskstr, skiplen, recurse, list, pnumfiles, pnumalloc);
|
---|
[551] | 1333 | }
|
---|
| 1334 | }
|
---|
| 1335 | else {
|
---|
| 1336 | if (fForceUpper)
|
---|
[783] | 1337 | strupr(pffbFile->achName);
|
---|
[551] | 1338 | else if (fForceLower)
|
---|
[783] | 1339 | strlwr(pffbFile->achName);
|
---|
| 1340 | memcpy(enddir, pffbFile->achName, pffbFile->cchName + 1);
|
---|
| 1341 | if (AddToFileList(maskstr + skiplen,
|
---|
[907] | 1342 | pffbFile, list, pnumfiles, pnumalloc)) {
|
---|
[551] | 1343 | goto Abort;
|
---|
[783] | 1344 | }
|
---|
[551] | 1345 | }
|
---|
[841] | 1346 | pffbFile = (PFILEFINDBUF4L)((PBYTE)pffbFile + pffbFile->oNextEntryOffset);
|
---|
[783] | 1347 | } // for
|
---|
[2] | 1348 | DosError(FERR_DISABLEHARDERR);
|
---|
[783] | 1349 | ulFindCnt = FilesToGet;
|
---|
[850] | 1350 | rc = xDosFindNext(hDir, pffbArray, ulBufBytes, &ulFindCnt, FIL_QUERYEASIZEL);
|
---|
[783] | 1351 | } while (!rc);
|
---|
| 1352 |
|
---|
| 1353 | Abort:
|
---|
| 1354 |
|
---|
[2] | 1355 | DosFindClose(hDir);
|
---|
[846] | 1356 | DosSleep(0);
|
---|
[2] | 1357 | }
|
---|
[783] | 1358 |
|
---|
| 1359 | if (rc && rc != ERROR_NO_MORE_FILES) {
|
---|
| 1360 | Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
| 1361 | GetPString(IDS_CANTFINDDIRTEXT), maskstr);
|
---|
| 1362 | }
|
---|
| 1363 |
|
---|
[2] | 1364 | free(maskstr);
|
---|
[783] | 1365 | free(pffbArray);
|
---|
[846] | 1366 |
|
---|
| 1367 | // DbgMsg(pszSrcFile, __LINE__, "FillDirList finish %s", str);
|
---|
[2] | 1368 | }
|
---|
| 1369 |
|
---|
[924] | 1370 | /**
|
---|
| 1371 | * Compare names for qsort
|
---|
| 1372 | */
|
---|
[2] | 1373 |
|
---|
[551] | 1374 | static int CompNames(const void *n1, const void *n2)
|
---|
[316] | 1375 | {
|
---|
[919] | 1376 | FILELIST *fl1 = *(FILELIST **)n1;
|
---|
| 1377 | FILELIST *fl2 = *(FILELIST **)n2;
|
---|
[2] | 1378 |
|
---|
[551] | 1379 | return stricmp(fl1->fname, fl2->fname);
|
---|
[2] | 1380 | }
|
---|
| 1381 |
|
---|
[316] | 1382 | //=== FillCnrsThread() Fill left and right containers ===
|
---|
[2] | 1383 |
|
---|
[751] | 1384 | static VOID FillCnrsThread(VOID *args)
|
---|
[316] | 1385 | {
|
---|
[919] | 1386 | COMPARE *cmp = (COMPARE *)args;
|
---|
[551] | 1387 | HAB hab;
|
---|
| 1388 | HMQ hmq;
|
---|
| 1389 | BOOL notified = FALSE;
|
---|
[907] | 1390 | ITIMER_DESC itdSleep = { 0 };
|
---|
[751] | 1391 |
|
---|
[551] | 1392 | HWND hwndLeft, hwndRight;
|
---|
[748] | 1393 | CHAR szBuf[CCHMAXPATH];
|
---|
| 1394 | CNRINFO cnri;
|
---|
[2] | 1395 |
|
---|
[748] | 1396 | if (!cmp) {
|
---|
[773] | 1397 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
[2] | 1398 | _endthread();
|
---|
[748] | 1399 | }
|
---|
[2] | 1400 |
|
---|
[846] | 1401 | // DbgMsg(pszSrcFile, __LINE__, "FillCnrsThread enter");
|
---|
| 1402 |
|
---|
[2] | 1403 | DosError(FERR_DISABLEHARDERR);
|
---|
| 1404 |
|
---|
[907] | 1405 | InitITimer(&itdSleep, 500); // Sleep every 500 mSec
|
---|
| 1406 |
|
---|
[2] | 1407 | hab = WinInitialize(0);
|
---|
[551] | 1408 | if (!hab)
|
---|
| 1409 | Win_Error(NULLHANDLE, NULLHANDLE, pszSrcFile, __LINE__, "WinInitialize");
|
---|
[362] | 1410 | else {
|
---|
[551] | 1411 | hmq = WinCreateMsgQueue(hab, 0);
|
---|
| 1412 | if (!hmq)
|
---|
| 1413 | Win_Error(NULLHANDLE, NULLHANDLE, pszSrcFile, __LINE__,
|
---|
| 1414 | "WinCreateMsgQueue");
|
---|
[362] | 1415 | else {
|
---|
[551] | 1416 | INT x;
|
---|
[907] | 1417 | UINT l;
|
---|
| 1418 | UINT r;
|
---|
[919] | 1419 | // UINT cntr;
|
---|
[551] | 1420 | FILELIST **filesl = NULL;
|
---|
| 1421 | FILELIST **filesr = NULL;
|
---|
[907] | 1422 | UINT numallocl = 0;
|
---|
| 1423 | UINT numallocr = 0;
|
---|
[897] | 1424 | INT ret = 0;
|
---|
[769] | 1425 | UINT lenl; // Directory prefix length
|
---|
| 1426 | UINT lenr;
|
---|
[748] | 1427 | UINT recsNeeded;
|
---|
[907] | 1428 | UINT recsGotten;
|
---|
[551] | 1429 | PCNRITEM pcilFirst;
|
---|
| 1430 | PCNRITEM pcirFirst;
|
---|
[907] | 1431 | PCNRITEM pcilLast;
|
---|
| 1432 | PCNRITEM pcirLast;
|
---|
[551] | 1433 | PCNRITEM pcil;
|
---|
| 1434 | PCNRITEM pcir;
|
---|
| 1435 | RECORDINSERT ri;
|
---|
| 1436 | CHAR *pch;
|
---|
[2] | 1437 |
|
---|
[551] | 1438 | WinCancelShutdown(hmq, TRUE);
|
---|
[535] | 1439 | IncrThreadUsage();
|
---|
[907] | 1440 | WinStartTimer(hab, cmp->hwnd, ID_TIMER, 2000);
|
---|
| 1441 |
|
---|
[551] | 1442 | hwndLeft = WinWindowFromID(cmp->hwnd, COMP_LEFTDIR);
|
---|
| 1443 | hwndRight = WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR);
|
---|
[2] | 1444 | lenl = strlen(cmp->leftdir);
|
---|
[551] | 1445 | if (cmp->leftdir[strlen(cmp->leftdir) - 1] != '\\')
|
---|
| 1446 | lenl++;
|
---|
[2] | 1447 | lenr = strlen(cmp->rightdir);
|
---|
[551] | 1448 | if (cmp->rightdir[strlen(cmp->rightdir) - 1] != '\\')
|
---|
| 1449 | lenr++;
|
---|
[2] | 1450 | priority_normal();
|
---|
[748] | 1451 | // Clear containers
|
---|
[751] | 1452 | RemoveCnrItems(hwndRight, NULL, 0, CMA_FREE | CMA_INVALIDATE);
|
---|
| 1453 | RemoveCnrItems(hwndLeft, NULL, 0, CMA_FREE | CMA_INVALIDATE);
|
---|
[917] | 1454 | cmp->cmp->totalleft = 0;
|
---|
| 1455 | cmp->cmp->totalright = 0;
|
---|
[2] | 1456 |
|
---|
[748] | 1457 | // Build list of all files in left directory
|
---|
[551] | 1458 | if (fForceLower)
|
---|
| 1459 | strlwr(cmp->leftdir);
|
---|
| 1460 | else if (fForceUpper)
|
---|
| 1461 | strupr(cmp->leftdir);
|
---|
| 1462 | FillDirList(cmp->leftdir, lenl, cmp->includesubdirs,
|
---|
[907] | 1463 | &filesl, &cmp->cmp->totalleft, &numallocl);
|
---|
[2] | 1464 |
|
---|
[551] | 1465 | if (filesl)
|
---|
[917] | 1466 | qsort(filesl, cmp->cmp->totalleft, sizeof(CHAR *), CompNames);
|
---|
[748] | 1467 |
|
---|
[846] | 1468 | // DbgMsg(pszSrcFile, __LINE__, "FillCnrsThread sorted filesl");
|
---|
| 1469 |
|
---|
[748] | 1470 | // Build list of all files in right directory
|
---|
[551] | 1471 | if (!*cmp->rightlist) {
|
---|
| 1472 | if (fForceLower)
|
---|
| 1473 | strlwr(cmp->rightdir);
|
---|
| 1474 | else if (fForceUpper)
|
---|
| 1475 | strupr(cmp->rightdir);
|
---|
| 1476 | FillDirList(cmp->rightdir, lenr, cmp->includesubdirs,
|
---|
[907] | 1477 | &filesr, &cmp->cmp->totalright, &numallocr);
|
---|
[2] | 1478 | }
|
---|
[551] | 1479 | else {
|
---|
[748] | 1480 | // Use snapshot file
|
---|
[551] | 1481 | FILE *fp;
|
---|
[841] | 1482 | FILEFINDBUF4L fb4;
|
---|
[551] | 1483 | CHAR str[CCHMAXPATH * 2], *p;
|
---|
[2] | 1484 |
|
---|
[551] | 1485 | memset(&fb4, 0, sizeof(fb4));
|
---|
| 1486 | fp = fopen(cmp->rightlist, "r");
|
---|
| 1487 | if (!fp)
|
---|
| 1488 | Runtime_Error(pszSrcFile, __LINE__, "can not open %s (%d)",
|
---|
| 1489 | cmp->rightlist, errno);
|
---|
[362] | 1490 | else {
|
---|
[551] | 1491 | while (!feof(fp)) {
|
---|
[748] | 1492 | // First get name of directory
|
---|
[551] | 1493 | if (!xfgets_bstripcr(str, sizeof(str), fp, pszSrcFile, __LINE__))
|
---|
| 1494 | break; // EOF
|
---|
| 1495 | p = str;
|
---|
| 1496 | if (*p == '\"') {
|
---|
[748] | 1497 | // Quoted
|
---|
[551] | 1498 | p++;
|
---|
| 1499 | if (*p && *p != '\"') {
|
---|
| 1500 | p = strchr(p, '\"');
|
---|
| 1501 | if (p) {
|
---|
| 1502 | *p = 0;
|
---|
| 1503 | if (*(str + 1)) {
|
---|
| 1504 | strcpy(cmp->rightdir, str + 1);
|
---|
| 1505 | if (fForceUpper)
|
---|
| 1506 | strupr(cmp->rightdir);
|
---|
| 1507 | else if (fForceLower)
|
---|
| 1508 | strlwr(cmp->rightdir);
|
---|
| 1509 | p = cmp->rightdir + (strlen(cmp->rightdir) - 1);
|
---|
| 1510 | if (p - cmp->rightdir > 3 && *p == '\\')
|
---|
| 1511 | *p = 0; // Chop trailing slash
|
---|
| 1512 | break;
|
---|
| 1513 | }
|
---|
| 1514 | }
|
---|
| 1515 | }
|
---|
| 1516 | }
|
---|
[748] | 1517 | } // while !EOF
|
---|
[2] | 1518 |
|
---|
[748] | 1519 | memset(&cnri, 0, sizeof(cnri));
|
---|
| 1520 | cnri.cb = sizeof(cnri);
|
---|
| 1521 | cnri.pszCnrTitle = cmp->rightdir;
|
---|
| 1522 | if (!WinSendMsg(hwndRight, CM_SETCNRINFO,
|
---|
| 1523 | MPFROMP(&cnri), MPFROMLONG(CMA_CNRTITLE))) {
|
---|
| 1524 | Win_Error(hwndRight, cmp->hwnd, pszSrcFile, __LINE__, "CM_SETCNRINFO");
|
---|
[551] | 1525 | }
|
---|
[748] | 1526 |
|
---|
[551] | 1527 | if (*cmp->rightdir) {
|
---|
[769] | 1528 | lenr = strlen(cmp->rightdir);
|
---|
| 1529 | if (cmp->rightdir[strlen(cmp->rightdir) - 1] != '\\')
|
---|
| 1530 | lenr++;
|
---|
[551] | 1531 | while (!feof(fp)) {
|
---|
| 1532 | if (!xfgets_bstripcr
|
---|
| 1533 | (str, sizeof(str), fp, pszSrcFile, __LINE__))
|
---|
| 1534 | break;
|
---|
| 1535 | p = str;
|
---|
| 1536 | if (*p == '\"') {
|
---|
| 1537 | p++;
|
---|
| 1538 | if (*p && *p != '\"') {
|
---|
| 1539 | p = strchr(p, '\"');
|
---|
| 1540 | if (p) {
|
---|
| 1541 | *p = 0;
|
---|
| 1542 | p++;
|
---|
| 1543 | if (*p == ',') {
|
---|
| 1544 | p++;
|
---|
| 1545 | if (!cmp->includesubdirs && atol(p) > lenr)
|
---|
| 1546 | continue;
|
---|
| 1547 | p = strchr(p, ',');
|
---|
| 1548 | if (p) {
|
---|
| 1549 | p++;
|
---|
[846] | 1550 | // 27 Sep 07 SHL fixme to do ULONGLONG conversion
|
---|
[551] | 1551 | fb4.cbFile = atol(p);
|
---|
| 1552 | p = strchr(p, ',');
|
---|
| 1553 | if (p) {
|
---|
| 1554 | p++;
|
---|
| 1555 | fb4.fdateLastWrite.year = atol(p) - 1980;
|
---|
| 1556 | p = strchr(p, '/');
|
---|
| 1557 | if (p) {
|
---|
| 1558 | p++;
|
---|
| 1559 | fb4.fdateLastWrite.month = atol(p);
|
---|
| 1560 | p = strchr(p, '/');
|
---|
| 1561 | if (p) {
|
---|
| 1562 | p++;
|
---|
| 1563 | fb4.fdateLastWrite.day = atol(p);
|
---|
| 1564 | p = strchr(p, ',');
|
---|
| 1565 | if (p) {
|
---|
| 1566 | p++;
|
---|
| 1567 | fb4.ftimeLastWrite.hours = atol(p);
|
---|
| 1568 | p = strchr(p, ':');
|
---|
| 1569 | if (p) {
|
---|
| 1570 | p++;
|
---|
| 1571 | fb4.ftimeLastWrite.minutes = atol(p);
|
---|
| 1572 | p = strchr(p, ':');
|
---|
| 1573 | if (p) {
|
---|
| 1574 | p++;
|
---|
| 1575 | fb4.ftimeLastWrite.twosecs = atol(p);
|
---|
| 1576 | p = strchr(p, ',');
|
---|
| 1577 | if (p) {
|
---|
| 1578 | p++;
|
---|
| 1579 | fb4.attrFile = atol(p);
|
---|
| 1580 | p = strchr(p, ',');
|
---|
| 1581 | if (p) {
|
---|
| 1582 | p++;
|
---|
| 1583 | fb4.cbList = atol(p) * 2;
|
---|
| 1584 | if (fForceUpper)
|
---|
| 1585 | strupr(str + 1);
|
---|
| 1586 | else if (fForceLower)
|
---|
| 1587 | strlwr(str + 1);
|
---|
| 1588 | if (AddToFileList((str + 1) + lenr,
|
---|
| 1589 | &fb4,
|
---|
| 1590 | &filesr,
|
---|
[917] | 1591 | &cmp->cmp->totalright,
|
---|
[551] | 1592 | &numallocr))
|
---|
| 1593 | break;
|
---|
| 1594 | }
|
---|
| 1595 | }
|
---|
| 1596 | }
|
---|
| 1597 | }
|
---|
| 1598 | }
|
---|
| 1599 | }
|
---|
| 1600 | }
|
---|
| 1601 | }
|
---|
| 1602 | }
|
---|
| 1603 | }
|
---|
| 1604 | }
|
---|
| 1605 | }
|
---|
| 1606 | }
|
---|
[748] | 1607 | } // while
|
---|
| 1608 | } // if have rightdir
|
---|
[551] | 1609 | fclose(fp);
|
---|
| 1610 | }
|
---|
[748] | 1611 | } // if snapshot file
|
---|
[316] | 1612 |
|
---|
[551] | 1613 | if (filesr)
|
---|
[917] | 1614 | qsort(filesr, cmp->cmp->totalright, sizeof(CHAR *), CompNames);
|
---|
[2] | 1615 |
|
---|
[846] | 1616 | // DbgMsg(pszSrcFile, __LINE__, "FillCnrsThread sorted filesr");
|
---|
| 1617 |
|
---|
[748] | 1618 | // We now have two lists of files, both sorted.
|
---|
| 1619 | // Count total number of container entries required on each side
|
---|
[2] | 1620 | l = r = 0;
|
---|
[316] | 1621 | recsNeeded = 0;
|
---|
[551] | 1622 | while ((filesl && filesl[l]) || (filesr && filesr[r])) {
|
---|
[748] | 1623 |
|
---|
| 1624 | if (filesl && filesl[l]) {
|
---|
| 1625 | if (filesr && filesr[r])
|
---|
| 1626 | x = stricmp(filesl[l]->fname, filesr[r]->fname);
|
---|
[551] | 1627 | else
|
---|
[748] | 1628 | x = -1; // Left side list longer
|
---|
[551] | 1629 | }
|
---|
[748] | 1630 | else
|
---|
| 1631 | x = +1; // Right side list longer
|
---|
| 1632 |
|
---|
| 1633 | if (x <= 0)
|
---|
| 1634 | l++; // On left side
|
---|
| 1635 | if (x >= 0)
|
---|
| 1636 | r++; // On right side
|
---|
| 1637 |
|
---|
| 1638 | recsNeeded++; // Keep count of how many entries req'd
|
---|
| 1639 |
|
---|
| 1640 | } // while
|
---|
| 1641 |
|
---|
[907] | 1642 | // Say building list - fixme to post?
|
---|
[551] | 1643 | WinSendMsg(cmp->hwnd, UM_CONTAINERHWND, MPVOID, MPVOID);
|
---|
[748] | 1644 |
|
---|
| 1645 | // Now insert records into the containers
|
---|
[551] | 1646 | if (recsNeeded) {
|
---|
| 1647 | pcilFirst = WinSendMsg(hwndLeft,
|
---|
| 1648 | CM_ALLOCRECORD,
|
---|
[751] | 1649 | MPFROMLONG(EXTRA_RECORD_BYTES),
|
---|
[551] | 1650 | MPFROMLONG(recsNeeded));
|
---|
| 1651 | if (!pcilFirst) {
|
---|
[742] | 1652 | Win_Error(hwndLeft, cmp->hwnd, pszSrcFile, __LINE__, "CM_ALLOCRECORD %u failed",
|
---|
| 1653 | recsNeeded);
|
---|
[551] | 1654 | recsNeeded = 0;
|
---|
| 1655 | }
|
---|
[316] | 1656 | }
|
---|
[362] | 1657 | if (recsNeeded) {
|
---|
[551] | 1658 | pcirFirst = WinSendMsg(hwndRight, CM_ALLOCRECORD,
|
---|
[751] | 1659 | MPFROMLONG(EXTRA_RECORD_BYTES),
|
---|
[551] | 1660 | MPFROMLONG(recsNeeded));
|
---|
| 1661 | if (!pcirFirst) {
|
---|
[742] | 1662 | Win_Error(hwndRight, cmp->hwnd, pszSrcFile, __LINE__, "CM_ALLOCRECORD %u failed",
|
---|
| 1663 | recsNeeded);
|
---|
[551] | 1664 | recsNeeded = 0;
|
---|
[751] | 1665 | FreeCnrItemList(hwndLeft, pcilFirst);
|
---|
[551] | 1666 | }
|
---|
[2] | 1667 | }
|
---|
[748] | 1668 |
|
---|
[362] | 1669 | if (recsNeeded) {
|
---|
[748] | 1670 |
|
---|
[846] | 1671 | // DbgMsg(pszSrcFile, __LINE__, "FillCnrsThread filling");
|
---|
| 1672 |
|
---|
[919] | 1673 | l = 0;
|
---|
| 1674 | r = 0;
|
---|
[551] | 1675 | pcil = pcilFirst;
|
---|
| 1676 | pcir = pcirFirst;
|
---|
[919] | 1677 | pcilLast = NULL;
|
---|
| 1678 | pcirLast = NULL;
|
---|
[907] | 1679 |
|
---|
| 1680 | recsGotten = 0;
|
---|
[919] | 1681 | cmp->cmp->totalleft = 0;
|
---|
| 1682 | cmp->cmp->totalright = 0;
|
---|
[907] | 1683 |
|
---|
[551] | 1684 | while ((filesl && filesl[l]) || (filesr && filesr[r])) {
|
---|
[907] | 1685 |
|
---|
[919] | 1686 | // 12 Jan 08 SHL fixme to have message in string table
|
---|
[907] | 1687 | if (!pcil) {
|
---|
[919] | 1688 | Runtime_Error(pszSrcFile, __LINE__, "Insufficient memory or %u items (%u)",
|
---|
| 1689 | recsNeeded, recsGotten);
|
---|
[907] | 1690 | break;
|
---|
| 1691 | }
|
---|
| 1692 |
|
---|
[919] | 1693 | // 12 Jan 08 SHL fixme to have message in string table
|
---|
[907] | 1694 | if (!pcir) {
|
---|
[919] | 1695 | Runtime_Error(pszSrcFile, __LINE__, "Insufficient memory or %u items (%u)",
|
---|
| 1696 | recsNeeded, recsGotten);
|
---|
[907] | 1697 | break;
|
---|
| 1698 | }
|
---|
| 1699 | recsGotten++;
|
---|
[551] | 1700 | pcir->hwndCnr = hwndRight;
|
---|
[919] | 1701 | pcir->rc.hptrIcon = (HPOINTER)0;
|
---|
[551] | 1702 | pcil->hwndCnr = hwndLeft;
|
---|
[919] | 1703 | pcil->rc.hptrIcon = (HPOINTER)0;
|
---|
[748] | 1704 |
|
---|
| 1705 | if (filesl && filesl[l]) {
|
---|
| 1706 | if (filesr && filesr[r])
|
---|
| 1707 | x = stricmp(filesl[l]->fname, filesr[r]->fname);
|
---|
| 1708 | else
|
---|
| 1709 | x = -1; // Left side list longer
|
---|
| 1710 | }
|
---|
| 1711 | else
|
---|
| 1712 | x = +1; // Right side list longer
|
---|
| 1713 |
|
---|
| 1714 | if (x <= 0) {
|
---|
[769] | 1715 | // File appears on left side
|
---|
[919] | 1716 | cmp->cmp->totalleft++;
|
---|
[769] | 1717 | BldFullPathName(szBuf, cmp->leftdir, filesl[l]->fname);
|
---|
| 1718 | pcil->pszFileName = xstrdup(szBuf, pszSrcFile, __LINE__);
|
---|
[748] | 1719 | pcil->pszDisplayName = pcil->pszFileName + lenl;
|
---|
| 1720 | pcil->attrFile = filesl[l]->attrFile;
|
---|
[751] | 1721 | pcil->pszDispAttr = FileAttrToString(pcil->attrFile);
|
---|
[748] | 1722 | pcil->cbFile = filesl[l]->cbFile;
|
---|
[919] | 1723 | // 12 Jan 08 SHL fixme to used cached size here too
|
---|
| 1724 | CommaFmtULL(szBuf, sizeof(szBuf), pcil->cbFile, ' ');
|
---|
| 1725 | pcil->pszFmtFileSize = xstrdup(szBuf, pszSrcFile, __LINE__);
|
---|
[748] | 1726 | pcil->easize = filesl[l]->easize;
|
---|
| 1727 | pcil->date.day = filesl[l]->date.day;
|
---|
| 1728 | pcil->date.month = filesl[l]->date.month;
|
---|
| 1729 | pcil->date.year = filesl[l]->date.year + 1980;
|
---|
| 1730 | pcil->time.seconds = filesl[l]->time.twosecs * 2;
|
---|
| 1731 | pcil->time.minutes = filesl[l]->time.minutes;
|
---|
| 1732 | pcil->time.hours = filesl[l]->time.hours;
|
---|
| 1733 | pcil->ladate.day = filesl[l]->ladate.day;
|
---|
| 1734 | pcil->ladate.month = filesl[l]->ladate.month;
|
---|
| 1735 | pcil->ladate.year = filesl[l]->ladate.year + 1980;
|
---|
| 1736 | pcil->latime.seconds = filesl[l]->latime.twosecs * 2;
|
---|
| 1737 | pcil->latime.minutes = filesl[l]->latime.minutes;
|
---|
| 1738 | pcil->latime.hours = filesl[l]->latime.hours;
|
---|
| 1739 | pcil->crdate.day = filesl[l]->crdate.day;
|
---|
| 1740 | pcil->crdate.month = filesl[l]->crdate.month;
|
---|
| 1741 | pcil->crdate.year = filesl[l]->crdate.year + 1980;
|
---|
| 1742 | pcil->crtime.seconds = filesl[l]->crtime.twosecs * 2;
|
---|
| 1743 | pcil->crtime.minutes = filesl[l]->crtime.minutes;
|
---|
| 1744 | pcil->crtime.hours = filesl[l]->crtime.hours;
|
---|
| 1745 | if (*cmp->dcd.mask.szMask) {
|
---|
[919] | 1746 | if (!Filter((PMINIRECORDCORE)pcil, (PVOID)&cmp->dcd.mask)) {
|
---|
[748] | 1747 | pcil->rc.flRecordAttr |= CRA_FILTERED;
|
---|
| 1748 | pcir->rc.flRecordAttr |= CRA_FILTERED;
|
---|
| 1749 | }
|
---|
| 1750 | }
|
---|
| 1751 | } // if on left
|
---|
| 1752 |
|
---|
| 1753 | if (x >= 0) {
|
---|
[769] | 1754 | // File appears on right side
|
---|
[919] | 1755 | cmp->cmp->totalright++;
|
---|
[773] | 1756 | BldFullPathName(szBuf, cmp->rightdir, filesr[r]->fname);
|
---|
[769] | 1757 | pcir->pszFileName = xstrdup(szBuf, pszSrcFile, __LINE__); // 31 Jul 07 SHL
|
---|
[748] | 1758 | pcir->pszDisplayName = pcir->pszFileName + lenr;
|
---|
| 1759 | pcir->attrFile = filesr[r]->attrFile;
|
---|
| 1760 | // pcir->rc.hptrIcon = hptrFile;
|
---|
[751] | 1761 | pcir->pszDispAttr = FileAttrToString(pcir->attrFile);
|
---|
[748] | 1762 | pcir->cbFile = filesr[r]->cbFile;
|
---|
[919] | 1763 | // 12 Jan 08 SHL fixme to used cached size here too
|
---|
| 1764 | CommaFmtULL(szBuf, sizeof(szBuf), pcir->cbFile, ' ');
|
---|
| 1765 | pcir->pszFmtFileSize = xstrdup(szBuf, pszSrcFile, __LINE__);
|
---|
[748] | 1766 | pcir->easize = filesr[r]->easize;
|
---|
| 1767 | pcir->date.day = filesr[r]->date.day;
|
---|
| 1768 | pcir->date.month = filesr[r]->date.month;
|
---|
| 1769 | pcir->date.year = filesr[r]->date.year + 1980;
|
---|
| 1770 | pcir->time.seconds = filesr[r]->time.twosecs * 2;
|
---|
| 1771 | pcir->time.minutes = filesr[r]->time.minutes;
|
---|
| 1772 | pcir->time.hours = filesr[r]->time.hours;
|
---|
| 1773 | pcir->ladate.day = filesr[r]->ladate.day;
|
---|
| 1774 | pcir->ladate.month = filesr[r]->ladate.month;
|
---|
| 1775 | pcir->ladate.year = filesr[r]->ladate.year + 1980;
|
---|
| 1776 | pcir->latime.seconds = filesr[r]->latime.twosecs * 2;
|
---|
| 1777 | pcir->latime.minutes = filesr[r]->latime.minutes;
|
---|
| 1778 | pcir->latime.hours = filesr[r]->latime.hours;
|
---|
| 1779 | pcir->crdate.day = filesr[r]->crdate.day;
|
---|
| 1780 | pcir->crdate.month = filesr[r]->crdate.month;
|
---|
| 1781 | pcir->crdate.year = filesr[r]->crdate.year + 1980;
|
---|
| 1782 | pcir->crtime.seconds = filesr[r]->crtime.twosecs * 2;
|
---|
| 1783 | pcir->crtime.minutes = filesr[r]->crtime.minutes;
|
---|
| 1784 | pcir->crtime.hours = filesr[r]->crtime.hours;
|
---|
[790] | 1785 | // Bypass check if already filtered on left side
|
---|
| 1786 | if (~pcir->rc.flRecordAttr & CRA_FILTERED &&
|
---|
[748] | 1787 | *cmp->dcd.mask.szMask) {
|
---|
| 1788 | if (!Filter((PMINIRECORDCORE)pcir, (PVOID)&cmp->dcd.mask)) {
|
---|
| 1789 | pcil->rc.flRecordAttr |= CRA_FILTERED;
|
---|
| 1790 | pcir->rc.flRecordAttr |= CRA_FILTERED;
|
---|
| 1791 | }
|
---|
| 1792 | }
|
---|
| 1793 | } // if on right
|
---|
| 1794 |
|
---|
| 1795 | if (x == 0) {
|
---|
| 1796 | // File appears on both sides
|
---|
[769] | 1797 | pcil->flags |= CNRITEM_EXISTS;
|
---|
| 1798 | pcir->flags |= CNRITEM_EXISTS;
|
---|
| 1799 | pch = szBuf;
|
---|
[748] | 1800 | // Subject field holds status messages
|
---|
| 1801 | *pch = 0;
|
---|
| 1802 | if (pcil->cbFile + pcil->easize > pcir->cbFile + pcir->easize) {
|
---|
| 1803 | pcil->flags |= CNRITEM_LARGER;
|
---|
| 1804 | pcir->flags |= CNRITEM_SMALLER;
|
---|
| 1805 | strcpy(pch, GetPString(IDS_LARGERTEXT));
|
---|
| 1806 | pch += 6;
|
---|
| 1807 | }
|
---|
| 1808 | else if (pcil->cbFile + pcil->easize <
|
---|
| 1809 | pcir->cbFile + pcir->easize) {
|
---|
| 1810 | pcil->flags |= CNRITEM_SMALLER;
|
---|
| 1811 | pcir->flags |= CNRITEM_LARGER;
|
---|
| 1812 | strcpy(pch, GetPString(IDS_SMALLERTEXT));
|
---|
| 1813 | pch += 7;
|
---|
[907] | 1814 | }
|
---|
| 1815 | ret = TestCDates(&pcir->date, &pcir->time,
|
---|
| 1816 | &pcil->date, &pcil->time);
|
---|
| 1817 | if (ret == 1)
|
---|
[924] | 1818 | /* 13 Jan 08 SHL fixme to be gone
|
---|
| 1819 | ((pcil->date.year > pcir->date.year) ? TRUE :
|
---|
[748] | 1820 | (pcil->date.year < pcir->date.year) ? FALSE :
|
---|
| 1821 | (pcil->date.month > pcir->date.month) ? TRUE :
|
---|
| 1822 | (pcil->date.month < pcir->date.month) ? FALSE :
|
---|
| 1823 | (pcil->date.day > pcir->date.day) ? TRUE :
|
---|
| 1824 | (pcil->date.day < pcir->date.day) ? FALSE :
|
---|
| 1825 | (pcil->time.hours > pcir->time.hours) ? TRUE :
|
---|
| 1826 | (pcil->time.hours < pcir->time.hours) ? FALSE :
|
---|
| 1827 | (pcil->time.minutes > pcir->time.minutes) ? TRUE :
|
---|
| 1828 | (pcil->time.minutes < pcir->time.minutes) ? FALSE :
|
---|
| 1829 | (pcil->time.seconds > pcir->time.seconds) ? TRUE :
|
---|
[924] | 1830 | (pcil->time.seconds < pcir->time.seconds) ? FALSE : FALSE)
|
---|
| 1831 | */
|
---|
| 1832 | {
|
---|
[748] | 1833 | pcil->flags |= CNRITEM_NEWER;
|
---|
| 1834 | pcir->flags |= CNRITEM_OLDER;
|
---|
[769] | 1835 | if (pch != szBuf) {
|
---|
[748] | 1836 | strcpy(pch, ", ");
|
---|
| 1837 | pch += 2;
|
---|
| 1838 | }
|
---|
| 1839 | strcpy(pch, GetPString(IDS_NEWERTEXT));
|
---|
| 1840 | pch += 5;
|
---|
| 1841 | }
|
---|
[907] | 1842 | else if (ret == -1)
|
---|
[924] | 1843 | /* 13 Jan 08 SHL fixme to be gone
|
---|
| 1844 | ((pcil->date.year < pcir->date.year) ? TRUE :
|
---|
| 1845 | (pcil->date.year > pcir->date.year) ? FALSE :
|
---|
| 1846 | (pcil->date.month < pcir->date.month) ? TRUE :
|
---|
| 1847 | (pcil->date.month > pcir->date.month) ? FALSE :
|
---|
| 1848 | (pcil->date.day < pcir->date.day) ? TRUE :
|
---|
| 1849 | (pcil->date.day > pcir->date.day) ? FALSE :
|
---|
| 1850 | (pcil->time.hours < pcir->time.hours) ? TRUE :
|
---|
| 1851 | (pcil->time.hours > pcir->time.hours) ? FALSE :
|
---|
| 1852 | (pcil->time.minutes < pcir->time.minutes) ? TRUE :
|
---|
| 1853 | (pcil->time.minutes > pcir->time.minutes) ? FALSE :
|
---|
| 1854 | (pcil->time.seconds < pcir->time.seconds) ? TRUE :
|
---|
| 1855 | (pcil->time.seconds > pcir->time.seconds) ? FALSE :
|
---|
| 1856 | FALSE)
|
---|
| 1857 | */
|
---|
| 1858 | {
|
---|
[748] | 1859 | pcil->flags |= CNRITEM_OLDER;
|
---|
| 1860 | pcir->flags |= CNRITEM_NEWER;
|
---|
[769] | 1861 | if (pch != szBuf) {
|
---|
[748] | 1862 | strcpy(pch, ", ");
|
---|
| 1863 | pch += 2;
|
---|
| 1864 | }
|
---|
| 1865 | strcpy(pch, GetPString(IDS_OLDERTEXT));
|
---|
| 1866 | pch += 5;
|
---|
| 1867 | }
|
---|
[769] | 1868 | pcil->pszSubject = *szBuf ?
|
---|
| 1869 | xstrdup(szBuf, pszSrcFile, __LINE__) :
|
---|
[751] | 1870 | NullStr;
|
---|
[748] | 1871 |
|
---|
| 1872 | } // if on both sides
|
---|
| 1873 |
|
---|
[919] | 1874 | if (x <= 0)
|
---|
| 1875 | free(filesl[l++]); // Done with item on left
|
---|
[748] | 1876 |
|
---|
[919] | 1877 | if (x >= 0)
|
---|
| 1878 | free(filesr[r++]); // Done with item on right
|
---|
[748] | 1879 |
|
---|
| 1880 | // Ensure empty buffers point somewhere
|
---|
| 1881 | if (!pcil->pszFileName) {
|
---|
| 1882 | pcil->pszFileName = NullStr;
|
---|
| 1883 | pcil->pszDisplayName = pcil->pszFileName;
|
---|
| 1884 | }
|
---|
| 1885 |
|
---|
| 1886 | if (!pcir->pszFileName) {
|
---|
| 1887 | pcir->pszFileName = NullStr;
|
---|
| 1888 | pcir->pszDisplayName = pcir->pszFileName;
|
---|
| 1889 | }
|
---|
| 1890 |
|
---|
[751] | 1891 | pcil->rc.pszIcon = pcil->pszDisplayName;
|
---|
| 1892 | pcir->rc.pszIcon = pcir->pszDisplayName;
|
---|
[748] | 1893 |
|
---|
[762] | 1894 | pcil->pszLongName = NullStr;
|
---|
| 1895 | pcir->pszLongName = NullStr;
|
---|
[751] | 1896 |
|
---|
[748] | 1897 | if (!pcil->pszSubject)
|
---|
| 1898 | pcil->pszSubject = NullStr;
|
---|
| 1899 | if (!pcir->pszSubject)
|
---|
[790] | 1900 | pcir->pszSubject = NullStr;
|
---|
[748] | 1901 |
|
---|
[751] | 1902 | if (!pcil->pszDispAttr)
|
---|
| 1903 | pcil->pszDispAttr = NullStr;
|
---|
| 1904 | if (!pcir->pszDispAttr)
|
---|
[790] | 1905 | pcir->pszDispAttr = NullStr;
|
---|
[751] | 1906 |
|
---|
[907] | 1907 | // Avoid hogging systems
|
---|
| 1908 | SleepIfNeeded(&itdSleep, 0);
|
---|
[748] | 1909 |
|
---|
[907] | 1910 | pcilLast = pcil;
|
---|
| 1911 | pcirLast = pcir;
|
---|
[919] | 1912 | pcil = (PCNRITEM)pcil->rc.preccNextRecord;
|
---|
| 1913 | pcir = (PCNRITEM)pcir->rc.preccNextRecord;
|
---|
[748] | 1914 |
|
---|
| 1915 | } // while filling left or right
|
---|
| 1916 |
|
---|
[907] | 1917 | // If stopped early CM_ALLOCATERECORD partially failed
|
---|
| 1918 | // Free up container records we did not use on other side
|
---|
[919] | 1919 | // Free up items we did not insert in container
|
---|
[907] | 1920 | if (recsGotten < recsNeeded) {
|
---|
| 1921 | if (pcil) {
|
---|
[919] | 1922 | if (pcilLast)
|
---|
| 1923 | pcilLast->rc.preccNextRecord = NULL;
|
---|
| 1924 | else
|
---|
| 1925 | pcilFirst = NULL;
|
---|
[907] | 1926 | FreeCnrItemList(hwndLeft, pcil);
|
---|
| 1927 | }
|
---|
| 1928 | if (filesl) {
|
---|
[919] | 1929 | for(; filesl[l]; l++)
|
---|
[907] | 1930 | free(filesl[l]);
|
---|
| 1931 | }
|
---|
| 1932 | if (pcir) {
|
---|
[919] | 1933 | if (pcirLast)
|
---|
| 1934 | pcirLast->rc.preccNextRecord = NULL;
|
---|
| 1935 | else
|
---|
| 1936 | pcirFirst = NULL;
|
---|
[907] | 1937 | FreeCnrItemList(hwndRight, pcir);
|
---|
| 1938 | }
|
---|
| 1939 | if (filesr) {
|
---|
[919] | 1940 | for (; filesr[r]; r++)
|
---|
[907] | 1941 | free(filesr[r]);
|
---|
| 1942 | }
|
---|
[917] | 1943 | // Reduce count to match what is in containers
|
---|
[907] | 1944 | recsNeeded = recsGotten;
|
---|
| 1945 | } // if insufficient resources
|
---|
| 1946 |
|
---|
[551] | 1947 | if (filesl)
|
---|
| 1948 | free(filesl); // Free header - have already freed elements
|
---|
| 1949 | filesl = NULL;
|
---|
| 1950 | if (filesr)
|
---|
| 1951 | free(filesr);
|
---|
| 1952 | filesr = NULL;
|
---|
[907] | 1953 |
|
---|
| 1954 | // Say inserting
|
---|
[551] | 1955 | WinSendMsg(cmp->hwnd, UM_CONTAINERDIR, MPVOID, MPVOID);
|
---|
[748] | 1956 |
|
---|
[907] | 1957 | // Insert left side
|
---|
[551] | 1958 | memset(&ri, 0, sizeof(RECORDINSERT));
|
---|
| 1959 | ri.cb = sizeof(RECORDINSERT);
|
---|
[919] | 1960 | ri.pRecordOrder = (PRECORDCORE)CMA_END;
|
---|
| 1961 | ri.pRecordParent = (PRECORDCORE)NULL;
|
---|
| 1962 | ri.zOrder = (ULONG)CMA_TOP;
|
---|
[551] | 1963 | ri.cRecordsInsert = recsNeeded;
|
---|
| 1964 | ri.fInvalidateRecord = FALSE;
|
---|
[919] | 1965 |
|
---|
[551] | 1966 | if (!WinSendMsg(hwndLeft, CM_INSERTRECORD,
|
---|
| 1967 | MPFROMP(pcilFirst), MPFROMP(&ri))) {
|
---|
[742] | 1968 | Win_Error(hwndLeft, cmp->hwnd, pszSrcFile, __LINE__, "CM_INSERTRECORD");
|
---|
[751] | 1969 | FreeCnrItemList(hwndLeft, pcilFirst);
|
---|
[917] | 1970 | cmp->cmp->totalleft = 0;
|
---|
[551] | 1971 | }
|
---|
[748] | 1972 |
|
---|
[907] | 1973 | // Insert right side
|
---|
[551] | 1974 | memset(&ri, 0, sizeof(RECORDINSERT));
|
---|
| 1975 | ri.cb = sizeof(RECORDINSERT);
|
---|
[919] | 1976 | ri.pRecordOrder = (PRECORDCORE)CMA_END;
|
---|
| 1977 | ri.pRecordParent = (PRECORDCORE)NULL;
|
---|
| 1978 | ri.zOrder = (ULONG)CMA_TOP;
|
---|
[551] | 1979 | ri.cRecordsInsert = recsNeeded;
|
---|
| 1980 | ri.fInvalidateRecord = FALSE;
|
---|
[751] | 1981 |
|
---|
[551] | 1982 | if (!WinSendMsg(hwndRight, CM_INSERTRECORD,
|
---|
| 1983 | MPFROMP(pcirFirst), MPFROMP(&ri))) {
|
---|
[751] | 1984 | Win_Error(hwndRight, cmp->hwnd, pszSrcFile, __LINE__, "CM_INSERTRECORD");
|
---|
| 1985 | RemoveCnrItems(hwndLeft, NULL, 0, CMA_FREE | CMA_INVALIDATE);
|
---|
| 1986 | FreeCnrItemList(hwndRight, pcirFirst);
|
---|
[917] | 1987 | cmp->cmp->totalright = 0;
|
---|
[551] | 1988 | }
|
---|
[748] | 1989 |
|
---|
[846] | 1990 | // DbgMsg(pszSrcFile, __LINE__, "FillCnrsThread filled");
|
---|
| 1991 |
|
---|
[748] | 1992 | } // if recsNeeded
|
---|
| 1993 |
|
---|
[907] | 1994 | WinStopTimer(hab, cmp->hwnd, ID_TIMER);
|
---|
| 1995 |
|
---|
[2] | 1996 | Deselect(hwndLeft);
|
---|
| 1997 | Deselect(hwndRight);
|
---|
[748] | 1998 |
|
---|
[846] | 1999 | // DbgMsg(pszSrcFile, __LINE__, "FillCnrsThread deselected");
|
---|
| 2000 |
|
---|
[907] | 2001 | // Request window update
|
---|
[551] | 2002 | if (!PostMsg(cmp->hwnd, UM_CONTAINER_FILLED, MPVOID, MPVOID))
|
---|
| 2003 | WinSendMsg(cmp->hwnd, UM_CONTAINER_FILLED, MPVOID, MPVOID);
|
---|
[2] | 2004 | notified = TRUE;
|
---|
[748] | 2005 |
|
---|
[846] | 2006 | // DbgMsg(pszSrcFile, __LINE__, "FillCnrsThread FILLED posted");
|
---|
| 2007 |
|
---|
[362] | 2008 | if (filesl)
|
---|
[748] | 2009 | FreeList((CHAR **)filesl); // Must have failed to create container
|
---|
[362] | 2010 | if (filesr)
|
---|
[748] | 2011 | FreeList((CHAR **)filesr);
|
---|
| 2012 |
|
---|
[2] | 2013 | WinDestroyMsgQueue(hmq);
|
---|
[907] | 2014 | } // if have queue
|
---|
| 2015 | if (!notified)
|
---|
| 2016 | PostMsg(cmp->hwnd, UM_CONTAINER_FILLED, MPVOID, MPVOID);
|
---|
[535] | 2017 | DecrThreadUsage();
|
---|
[2] | 2018 | WinTerminate(hab);
|
---|
| 2019 | }
|
---|
| 2020 | free(cmp);
|
---|
| 2021 | DosPostEventSem(CompactSem);
|
---|
[846] | 2022 |
|
---|
| 2023 | // DbgMsg(pszSrcFile, __LINE__, "FillCnrsThread exit");
|
---|
[2] | 2024 | }
|
---|
| 2025 |
|
---|
[773] | 2026 | // fixme to be gone - use variable
|
---|
| 2027 | #define hwndLeft (WinWindowFromID(hwnd,COMP_LEFTDIR))
|
---|
| 2028 | #define hwndRight (WinWindowFromID(hwnd,COMP_RIGHTDIR))
|
---|
[2] | 2029 |
|
---|
[316] | 2030 | //=== CompareDlgProc() Compare directories dialog procedure ===
|
---|
[2] | 2031 |
|
---|
[551] | 2032 | MRESULT EXPENTRY CompareDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
[316] | 2033 | {
|
---|
[551] | 2034 | COMPARE *cmp;
|
---|
[773] | 2035 | BOOL temp;
|
---|
[907] | 2036 | CHAR s[81];
|
---|
[362] | 2037 |
|
---|
[773] | 2038 | static HPOINTER hptr;
|
---|
[2] | 2039 |
|
---|
[551] | 2040 | switch (msg) {
|
---|
| 2041 | case WM_INITDLG:
|
---|
[919] | 2042 | cmp = (COMPARE *)mp2;
|
---|
[551] | 2043 | if (!cmp) {
|
---|
| 2044 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
| 2045 | WinDismissDlg(hwnd, 0);
|
---|
| 2046 | }
|
---|
| 2047 | else {
|
---|
| 2048 | if (!hptr)
|
---|
| 2049 | hptr = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, COMPARE_ICON);
|
---|
| 2050 | WinDefDlgProc(hwnd, WM_SETICON, MPFROMLONG(hptr), MPVOID);
|
---|
| 2051 | cmp->hwnd = hwnd;
|
---|
[919] | 2052 | WinSetWindowPtr(hwnd, QWL_USER, (PVOID)cmp);
|
---|
[551] | 2053 | SetCnrCols(hwndLeft, TRUE);
|
---|
| 2054 | SetCnrCols(hwndRight, TRUE);
|
---|
| 2055 | WinSendMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
|
---|
| 2056 | WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
|
---|
| 2057 | PostMsg(hwnd, UM_STRETCH, MPVOID, MPVOID);
|
---|
| 2058 | {
|
---|
| 2059 | USHORT ids[] = { COMP_LEFTDIR, COMP_RIGHTDIR, COMP_TOTALLEFT,
|
---|
[751] | 2060 | COMP_TOTALRIGHT, COMP_SELLEFT, COMP_SELRIGHT,
|
---|
| 2061 | 0
|
---|
| 2062 | };
|
---|
[919] | 2063 | UINT x;
|
---|
[924] | 2064 | for (x = 0; ids[x]; x++) {
|
---|
[551] | 2065 | SetPresParams(WinWindowFromID(hwnd, ids[x]),
|
---|
| 2066 | &RGBGREY,
|
---|
| 2067 | &RGBBLACK, &RGBBLACK, GetPString(IDS_8HELVTEXT));
|
---|
[924] | 2068 | }
|
---|
[2] | 2069 | }
|
---|
[551] | 2070 | }
|
---|
| 2071 | break;
|
---|
[2] | 2072 |
|
---|
[551] | 2073 | case UM_STRETCH:
|
---|
| 2074 | {
|
---|
| 2075 | SWP swp, swpC;
|
---|
| 2076 | LONG titl, szbx, szby, sz;
|
---|
| 2077 | HWND hwndActive;
|
---|
[2] | 2078 |
|
---|
[551] | 2079 | WinQueryWindowPos(hwnd, &swp);
|
---|
| 2080 | if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE))) {
|
---|
| 2081 | hwndActive = WinQueryFocus(HWND_DESKTOP);
|
---|
| 2082 | szbx = SysVal(SV_CXSIZEBORDER);
|
---|
| 2083 | szby = SysVal(SV_CYSIZEBORDER);
|
---|
| 2084 | titl = SysVal(SV_CYTITLEBAR);
|
---|
| 2085 | titl += 26;
|
---|
| 2086 | swp.cx -= (szbx * 2);
|
---|
| 2087 | sz = (swp.cx / 8);
|
---|
| 2088 | WinQueryWindowPos(WinWindowFromID(hwnd, COMP_LEFTDIR), &swpC);
|
---|
| 2089 | WinSetWindowPos(WinWindowFromID(hwnd, COMP_LEFTDIR), HWND_TOP,
|
---|
| 2090 | szbx + 6,
|
---|
| 2091 | swpC.y,
|
---|
| 2092 | (swp.cx / 2) - (szbx + 6),
|
---|
| 2093 | ((swp.cy - swpC.y) - titl) - szby,
|
---|
| 2094 | SWP_MOVE | SWP_SIZE);
|
---|
| 2095 | WinSetWindowPos(WinWindowFromID(hwnd, COMP_RIGHTDIR), HWND_TOP,
|
---|
| 2096 | (swp.cx / 2) + (szbx + 6),
|
---|
| 2097 | swpC.y,
|
---|
| 2098 | (swp.cx / 2) - (szbx + 6),
|
---|
| 2099 | ((swp.cy - swpC.y) - titl) - szby,
|
---|
| 2100 | SWP_MOVE | SWP_SIZE);
|
---|
| 2101 | WinSetWindowPos(WinWindowFromID(hwnd, COMP_TOTALLEFTHDR), HWND_TOP,
|
---|
| 2102 | szbx + 6,
|
---|
| 2103 | ((swp.cy - titl) - szby) + 4,
|
---|
| 2104 | sz - (szbx + 6), 20, SWP_MOVE | SWP_SIZE);
|
---|
| 2105 | WinSetWindowPos(WinWindowFromID(hwnd, COMP_TOTALLEFT), HWND_TOP,
|
---|
| 2106 | sz + (szbx + 6),
|
---|
| 2107 | ((swp.cy - titl) - szby) + 4,
|
---|
| 2108 | sz - (szbx + 6), 20, SWP_MOVE | SWP_SIZE);
|
---|
| 2109 | WinSetWindowPos(WinWindowFromID(hwnd, COMP_SELLEFTHDR), HWND_TOP,
|
---|
| 2110 | (sz * 2) + (szbx + 6),
|
---|
| 2111 | ((swp.cy - titl) - szby) + 4,
|
---|
| 2112 | sz - (szbx + 6), 20, SWP_MOVE | SWP_SIZE);
|
---|
| 2113 | WinSetWindowPos(WinWindowFromID(hwnd, COMP_SELLEFT), HWND_TOP,
|
---|
| 2114 | (sz * 3) + (szbx + 6),
|
---|
| 2115 | ((swp.cy - titl) - szby) + 4,
|
---|
| 2116 | sz - (szbx + 6), 20, SWP_MOVE | SWP_SIZE);
|
---|
| 2117 | WinSetWindowPos(WinWindowFromID(hwnd, COMP_TOTALRIGHTHDR), HWND_TOP,
|
---|
| 2118 | (sz * 4) + (szbx + 6),
|
---|
| 2119 | ((swp.cy - titl) - szby) + 4,
|
---|
| 2120 | sz - (szbx + 6), 20, SWP_MOVE | SWP_SIZE);
|
---|
| 2121 | WinSetWindowPos(WinWindowFromID(hwnd, COMP_TOTALRIGHT), HWND_TOP,
|
---|
| 2122 | (sz * 5) + (szbx + 6),
|
---|
| 2123 | ((swp.cy - titl) - szby) + 4,
|
---|
| 2124 | sz - (szbx + 6), 20, SWP_MOVE | SWP_SIZE);
|
---|
| 2125 | WinSetWindowPos(WinWindowFromID(hwnd, COMP_SELRIGHTHDR), HWND_TOP,
|
---|
| 2126 | (sz * 6) + (szbx + 6),
|
---|
| 2127 | ((swp.cy - titl) - szby) + 4,
|
---|
| 2128 | sz - (szbx + 6), 20, SWP_MOVE | SWP_SIZE);
|
---|
| 2129 | WinSetWindowPos(WinWindowFromID(hwnd, COMP_SELRIGHT), HWND_TOP,
|
---|
| 2130 | (sz * 7) + (szbx + 6),
|
---|
| 2131 | ((swp.cy - titl) - szby) + 4,
|
---|
| 2132 | sz - (szbx + 6), 20, SWP_MOVE | SWP_SIZE);
|
---|
| 2133 | PaintRecessedWindow(WinWindowFromID(hwnd, COMP_TOTALLEFT),
|
---|
[919] | 2134 | (HPS)0, FALSE, FALSE);
|
---|
[551] | 2135 | PaintRecessedWindow(WinWindowFromID(hwnd, COMP_SELLEFT),
|
---|
[919] | 2136 | (HPS)0, FALSE, FALSE);
|
---|
[551] | 2137 | PaintRecessedWindow(WinWindowFromID(hwnd, COMP_TOTALRIGHT),
|
---|
[919] | 2138 | (HPS)0, FALSE, FALSE);
|
---|
[551] | 2139 | PaintRecessedWindow(WinWindowFromID(hwnd, COMP_SELRIGHT),
|
---|
[919] | 2140 | (HPS)0, FALSE, FALSE);
|
---|
| 2141 | PaintRecessedWindow(hwndLeft, (HPS)0,
|
---|
[551] | 2142 | (hwndActive == hwndLeft), TRUE);
|
---|
[919] | 2143 | PaintRecessedWindow(hwndRight, (HPS)0,
|
---|
[551] | 2144 | (hwndActive == hwndRight), TRUE);
|
---|
[2] | 2145 | }
|
---|
[551] | 2146 | }
|
---|
| 2147 | return 0;
|
---|
[2] | 2148 |
|
---|
[551] | 2149 | case WM_ADJUSTWINDOWPOS:
|
---|
| 2150 | PostMsg(hwnd, UM_STRETCH, MPVOID, MPVOID);
|
---|
| 2151 | break;
|
---|
[2] | 2152 |
|
---|
[551] | 2153 | case UM_SETUP:
|
---|
| 2154 | {
|
---|
| 2155 | CNRINFO cnri;
|
---|
| 2156 | BOOL tempsubj;
|
---|
[2] | 2157 |
|
---|
[551] | 2158 | cmp = INSTDATA(hwnd);
|
---|
[919] | 2159 | if (!cmp)
|
---|
| 2160 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
| 2161 | else {
|
---|
[551] | 2162 | cmp->dcd.size = sizeof(DIRCNRDATA);
|
---|
| 2163 | cmp->dcd.type = DIR_FRAME;
|
---|
| 2164 | cmp->dcd.hwndFrame = hwnd;
|
---|
| 2165 | cmp->dcd.hwndClient = hwnd;
|
---|
| 2166 | cmp->dcd.mask.attrFile = (FILE_DIRECTORY | FILE_ARCHIVED |
|
---|
| 2167 | FILE_READONLY | FILE_SYSTEM | FILE_HIDDEN);
|
---|
| 2168 | LoadDetailsSwitches("DirCmp", &cmp->dcd);
|
---|
| 2169 | cmp->dcd.detailslongname = FALSE;
|
---|
[748] | 2170 | cmp->dcd.detailsicon = FALSE; // TRUE;
|
---|
[2] | 2171 | }
|
---|
[551] | 2172 | memset(&cnri, 0, sizeof(CNRINFO));
|
---|
| 2173 | cnri.cb = sizeof(CNRINFO);
|
---|
| 2174 | WinSendDlgItemMsg(hwnd, COMP_LEFTDIR, CM_QUERYCNRINFO,
|
---|
| 2175 | MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
|
---|
| 2176 | cnri.flWindowAttr |= (CA_OWNERDRAW | CV_MINI);
|
---|
| 2177 | cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET - 68;
|
---|
| 2178 | WinSendDlgItemMsg(hwnd, COMP_LEFTDIR, CM_SETCNRINFO, MPFROMP(&cnri),
|
---|
| 2179 | MPFROMLONG(CMA_FLWINDOWATTR | CMA_XVERTSPLITBAR));
|
---|
| 2180 | memset(&cnri, 0, sizeof(CNRINFO));
|
---|
| 2181 | cnri.cb = sizeof(CNRINFO);
|
---|
| 2182 | WinSendDlgItemMsg(hwnd, COMP_RIGHTDIR, CM_QUERYCNRINFO,
|
---|
| 2183 | MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
|
---|
| 2184 | cnri.flWindowAttr |= (CA_OWNERDRAW | CV_MINI);
|
---|
| 2185 | cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET - 54;
|
---|
| 2186 | WinSendDlgItemMsg(hwnd, COMP_RIGHTDIR, CM_SETCNRINFO, MPFROMP(&cnri),
|
---|
| 2187 | MPFROMLONG(CMA_FLWINDOWATTR | CMA_XVERTSPLITBAR));
|
---|
| 2188 | AdjustCnrColRO(hwndLeft, GetPString(IDS_FILENAMECOLTEXT), TRUE, FALSE);
|
---|
| 2189 | AdjustCnrColRO(hwndLeft, GetPString(IDS_LONGNAMECOLTEXT), TRUE, FALSE);
|
---|
| 2190 | AdjustCnrColRO(hwndRight, GetPString(IDS_FILENAMECOLTEXT), TRUE, FALSE);
|
---|
| 2191 | AdjustCnrColRO(hwndRight, GetPString(IDS_LONGNAMECOLTEXT), TRUE, FALSE);
|
---|
| 2192 | AdjustCnrColsForPref(hwndLeft, cmp->leftdir, &cmp->dcd, TRUE);
|
---|
| 2193 | tempsubj = cmp->dcd.detailssubject;
|
---|
| 2194 | cmp->dcd.detailssubject = FALSE;
|
---|
| 2195 | AdjustCnrColsForPref(hwndRight, cmp->rightdir, &cmp->dcd, TRUE);
|
---|
| 2196 | if (*cmp->rightlist) {
|
---|
| 2197 | AdjustCnrColVis(hwndRight, GetPString(IDS_LADATECOLTEXT), FALSE,
|
---|
| 2198 | FALSE);
|
---|
| 2199 | AdjustCnrColVis(hwndRight, GetPString(IDS_LATIMECOLTEXT), FALSE,
|
---|
| 2200 | FALSE);
|
---|
| 2201 | AdjustCnrColVis(hwndRight, GetPString(IDS_CRDATECOLTEXT), FALSE,
|
---|
| 2202 | FALSE);
|
---|
| 2203 | AdjustCnrColVis(hwndRight, GetPString(IDS_CRTIMECOLTEXT), FALSE,
|
---|
| 2204 | FALSE);
|
---|
| 2205 | }
|
---|
| 2206 | cmp->dcd.detailssubject = tempsubj;
|
---|
| 2207 | }
|
---|
| 2208 | return 0;
|
---|
[2] | 2209 |
|
---|
[551] | 2210 | case WM_DRAWITEM:
|
---|
| 2211 | if (mp2) {
|
---|
[748] | 2212 | POWNERITEM pown = (POWNERITEM)mp2;
|
---|
[551] | 2213 | PCNRDRAWITEMINFO pcown;
|
---|
| 2214 | PCNRITEM pci;
|
---|
[2] | 2215 |
|
---|
[748] | 2216 | pcown = (PCNRDRAWITEMINFO)pown->hItem;
|
---|
[551] | 2217 | if (pcown) {
|
---|
[919] | 2218 | pci = (PCNRITEM)pcown->pRecord;
|
---|
[748] | 2219 | // 01 Aug 07 SHL if field null or blank, we draw
|
---|
| 2220 | // fixme to know why - probably to optimize and bypass draw?
|
---|
| 2221 | if (pci && (INT)pci != -1 && !*pci->pszFileName)
|
---|
[551] | 2222 | return MRFROMLONG(TRUE);
|
---|
[2] | 2223 | }
|
---|
[551] | 2224 | }
|
---|
| 2225 | return 0;
|
---|
[2] | 2226 |
|
---|
[551] | 2227 | case UM_CONTAINERHWND:
|
---|
[907] | 2228 | // Building list
|
---|
[551] | 2229 | WinSetDlgItemText(hwnd, COMP_NOTE, GetPString(IDS_COMPHOLDBLDLISTTEXT));
|
---|
| 2230 | return 0;
|
---|
[2] | 2231 |
|
---|
[551] | 2232 | case UM_CONTAINERDIR:
|
---|
[907] | 2233 | // Filling container
|
---|
[551] | 2234 | WinSetDlgItemText(hwnd, COMP_NOTE, GetPString(IDS_COMPHOLDFILLCNRTEXT));
|
---|
| 2235 | return 0;
|
---|
[2] | 2236 |
|
---|
[907] | 2237 | case WM_TIMER:
|
---|
| 2238 | // Show current totals
|
---|
| 2239 | cmp = INSTDATA(hwnd);
|
---|
| 2240 | if (!cmp) {
|
---|
| 2241 | Runtime_Error(pszSrcFile, __LINE__, "pCompare NULL");
|
---|
| 2242 | WinDismissDlg(hwnd, 0);
|
---|
| 2243 | }
|
---|
| 2244 | else {
|
---|
| 2245 | // 05 Jan 08 SHL fixme to use timer id to optimize output
|
---|
| 2246 | sprintf(s, " %d", cmp->totalleft);
|
---|
| 2247 | WinSetDlgItemText(hwnd, COMP_TOTALLEFT, s);
|
---|
| 2248 | sprintf(s, " %d", cmp->totalright);
|
---|
| 2249 | WinSetDlgItemText(hwnd, COMP_TOTALRIGHT, s);
|
---|
| 2250 | sprintf(s, " %d", cmp->selleft);
|
---|
| 2251 | WinSetDlgItemText(hwnd, COMP_SELLEFT, s);
|
---|
| 2252 | sprintf(s, " %d", cmp->selright);
|
---|
| 2253 | WinSetDlgItemText(hwnd, COMP_SELRIGHT, s);
|
---|
| 2254 | }
|
---|
| 2255 | break;
|
---|
| 2256 |
|
---|
[551] | 2257 | case UM_CONTAINER_FILLED:
|
---|
| 2258 | cmp = INSTDATA(hwnd);
|
---|
| 2259 | if (!cmp) {
|
---|
| 2260 | Runtime_Error(pszSrcFile, __LINE__, "pCompare NULL");
|
---|
| 2261 | WinDismissDlg(hwnd, 0);
|
---|
| 2262 | }
|
---|
| 2263 | else {
|
---|
| 2264 | cmp->filling = FALSE;
|
---|
| 2265 | WinEnableWindow(hwndLeft, TRUE);
|
---|
| 2266 | WinEnableWindow(hwndRight, TRUE);
|
---|
| 2267 | WinEnableWindowUpdate(hwndLeft, TRUE);
|
---|
| 2268 | WinEnableWindowUpdate(hwndRight, TRUE);
|
---|
| 2269 | sprintf(s, " %d", cmp->totalleft);
|
---|
| 2270 | WinSetDlgItemText(hwnd, COMP_TOTALLEFT, s);
|
---|
| 2271 | sprintf(s, " %d", cmp->totalright);
|
---|
| 2272 | WinSetDlgItemText(hwnd, COMP_TOTALRIGHT, s);
|
---|
| 2273 | sprintf(s, " %d", cmp->selleft);
|
---|
| 2274 | WinSetDlgItemText(hwnd, COMP_SELLEFT, s);
|
---|
| 2275 | sprintf(s, " %d", cmp->selright);
|
---|
| 2276 | WinSetDlgItemText(hwnd, COMP_SELRIGHT, s);
|
---|
[919] | 2277 | // 12 Jan 08 SHL fixme to have SetEnables(COMPARE* pcmp, BOOL fEnable)
|
---|
| 2278 | // to replace duplicated code here and elsewhere
|
---|
[551] | 2279 | WinEnableWindow(WinWindowFromID(hwnd, DID_OK), TRUE);
|
---|
| 2280 | WinEnableWindow(WinWindowFromID(hwnd, DID_CANCEL), TRUE);
|
---|
| 2281 | WinEnableWindow(WinWindowFromID(hwnd, COMP_COLLECT), TRUE);
|
---|
| 2282 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTBOTH), TRUE);
|
---|
| 2283 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTONE), TRUE);
|
---|
| 2284 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTNEWER), TRUE);
|
---|
| 2285 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTOLDER), TRUE);
|
---|
| 2286 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTBIGGER), TRUE);
|
---|
| 2287 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSMALLER), TRUE);
|
---|
| 2288 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTBOTH), TRUE);
|
---|
| 2289 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTONE), TRUE);
|
---|
| 2290 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTNEWER), TRUE);
|
---|
| 2291 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTOLDER), TRUE);
|
---|
| 2292 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTBIGGER), TRUE);
|
---|
| 2293 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTSMALLER), TRUE);
|
---|
| 2294 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTALL), TRUE);
|
---|
| 2295 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSAMECONTENT), TRUE);
|
---|
| 2296 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTIDENTICAL), TRUE);
|
---|
| 2297 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSAME), TRUE);
|
---|
| 2298 | WinEnableWindow(WinWindowFromID(hwnd, IDM_INVERT), TRUE);
|
---|
| 2299 | WinEnableWindow(WinWindowFromID(hwnd, COMP_SETDIRS), TRUE);
|
---|
| 2300 | WinEnableWindow(WinWindowFromID(hwnd, COMP_DELETELEFT), TRUE);
|
---|
| 2301 | WinEnableWindow(WinWindowFromID(hwnd, COMP_FILTER), TRUE);
|
---|
| 2302 | if (!*cmp->rightlist) {
|
---|
| 2303 | WinEnableWindow(WinWindowFromID(hwnd, COMP_COPYLEFT), TRUE);
|
---|
| 2304 | WinEnableWindow(WinWindowFromID(hwnd, COMP_MOVELEFT), TRUE);
|
---|
| 2305 | WinEnableWindow(WinWindowFromID(hwnd, COMP_DELETERIGHT), TRUE);
|
---|
| 2306 | WinEnableWindow(WinWindowFromID(hwnd, COMP_COPYRIGHT), TRUE);
|
---|
| 2307 | WinEnableWindow(WinWindowFromID(hwnd, COMP_MOVERIGHT), TRUE);
|
---|
[362] | 2308 | }
|
---|
[551] | 2309 | WinEnableWindow(WinWindowFromID(hwnd, COMP_INCLUDESUBDIRS), TRUE);
|
---|
[919] | 2310 | WinEnableWindow(WinWindowFromID(hwnd, COMP_HIDENOTSELECTED), TRUE);
|
---|
| 2311 | if (*cmp->dcd.mask.szMask) {
|
---|
| 2312 | sprintf(s,
|
---|
| 2313 | GetPString(IDS_COMPREADYFILTEREDTEXT),
|
---|
| 2314 | cmp->dcd.mask.szMask);
|
---|
| 2315 | WinSetDlgItemText(hwnd, COMP_NOTE, s);
|
---|
| 2316 | }
|
---|
[551] | 2317 | else
|
---|
| 2318 | WinSetDlgItemText(hwnd, COMP_NOTE, GetPString(IDS_COMPREADYTEXT));
|
---|
| 2319 | }
|
---|
| 2320 | break;
|
---|
| 2321 |
|
---|
| 2322 | case WM_INITMENU:
|
---|
| 2323 | cmp = INSTDATA(hwnd);
|
---|
| 2324 | if (cmp) {
|
---|
| 2325 | switch (SHORT1FROMMP(mp1)) {
|
---|
| 2326 | case IDM_COMMANDSMENU:
|
---|
| 2327 | SetupCommandMenu(cmp->dcd.hwndLastMenu, hwnd);
|
---|
| 2328 | break;
|
---|
[2] | 2329 | }
|
---|
[551] | 2330 | }
|
---|
| 2331 | break;
|
---|
[2] | 2332 |
|
---|
[551] | 2333 | case WM_MENUEND:
|
---|
| 2334 | cmp = INSTDATA(hwnd);
|
---|
| 2335 | if (cmp) {
|
---|
[919] | 2336 | if ((HWND)mp2 == cmp->dcd.hwndLastMenu) {
|
---|
[551] | 2337 | MarkAll(hwndLeft, TRUE, FALSE, TRUE);
|
---|
| 2338 | MarkAll(hwndRight, TRUE, FALSE, TRUE);
|
---|
| 2339 | WinDestroyWindow(cmp->dcd.hwndLastMenu);
|
---|
[919] | 2340 | cmp->dcd.hwndLastMenu = (HWND)0;
|
---|
[2] | 2341 | }
|
---|
[551] | 2342 | }
|
---|
| 2343 | break;
|
---|
[2] | 2344 |
|
---|
[551] | 2345 | case WM_CONTROL:
|
---|
| 2346 | switch (SHORT1FROMMP(mp1)) {
|
---|
| 2347 | case COMP_INCLUDESUBDIRS:
|
---|
| 2348 | switch (SHORT2FROMMP(mp1)) {
|
---|
| 2349 | case BN_CLICKED:
|
---|
| 2350 | cmp = INSTDATA(hwnd);
|
---|
| 2351 | if (cmp)
|
---|
| 2352 | *cmp->rightlist = 0;
|
---|
| 2353 | PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
|
---|
| 2354 | PostMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
|
---|
| 2355 | break;
|
---|
[2] | 2356 | }
|
---|
| 2357 | break;
|
---|
[551] | 2358 | case COMP_HIDENOTSELECTED:
|
---|
| 2359 | switch (SHORT2FROMMP(mp1)) {
|
---|
| 2360 | case BN_CLICKED:
|
---|
| 2361 | WinSendMsg(hwnd, UM_HIDENOTSELECTED, MPVOID, MPVOID);
|
---|
| 2362 | break;
|
---|
| 2363 | }
|
---|
| 2364 | break;
|
---|
[2] | 2365 |
|
---|
[551] | 2366 | case COMP_LEFTDIR:
|
---|
| 2367 | case COMP_RIGHTDIR:
|
---|
| 2368 | switch (SHORT2FROMMP(mp1)) {
|
---|
| 2369 | case CN_KILLFOCUS:
|
---|
| 2370 | PaintRecessedWindow(WinWindowFromID(hwnd, SHORT1FROMMP(mp1)),
|
---|
[919] | 2371 | (HPS)0, FALSE, TRUE);
|
---|
[551] | 2372 | break;
|
---|
[2] | 2373 |
|
---|
[551] | 2374 | case CN_SETFOCUS:
|
---|
| 2375 | PaintRecessedWindow(WinWindowFromID(hwnd, SHORT1FROMMP(mp1)),
|
---|
[919] | 2376 | (HPS)0, TRUE, TRUE);
|
---|
[551] | 2377 | break;
|
---|
[2] | 2378 |
|
---|
[551] | 2379 | case CN_ENTER:
|
---|
| 2380 | if (mp2) {
|
---|
[2] | 2381 |
|
---|
[919] | 2382 | PCNRITEM pci = (PCNRITEM)((PNOTIFYRECORDENTER)mp2)->pRecord;
|
---|
[551] | 2383 | HWND hwndCnr = WinWindowFromID(hwnd, SHORT1FROMMP(mp1));
|
---|
[2] | 2384 |
|
---|
[551] | 2385 | SetShiftState();
|
---|
| 2386 | if (pci) {
|
---|
[748] | 2387 | if (pci->rc.flRecordAttr & CRA_INUSE || !pci || !*pci->pszFileName)
|
---|
[551] | 2388 | break;
|
---|
| 2389 | WinSendMsg(hwndCnr, CM_SETRECORDEMPHASIS, MPFROMP(pci),
|
---|
| 2390 | MPFROM2SHORT(TRUE, CRA_INUSE));
|
---|
| 2391 | if (pci->attrFile & FILE_DIRECTORY) {
|
---|
| 2392 | if ((shiftstate & (KC_CTRL | KC_SHIFT)) == (KC_CTRL | KC_SHIFT))
|
---|
[730] | 2393 | OpenObject(pci->pszFileName, Settings, hwnd);
|
---|
[551] | 2394 | else
|
---|
[730] | 2395 | OpenObject(pci->pszFileName, Default, hwnd);
|
---|
[551] | 2396 | }
|
---|
| 2397 | else
|
---|
| 2398 | DefaultViewKeys(hwnd, hwnd, HWND_DESKTOP, NULL,
|
---|
[730] | 2399 | pci->pszFileName);
|
---|
[551] | 2400 | WinSendMsg(hwndCnr, CM_SETRECORDEMPHASIS,
|
---|
| 2401 | MPFROMP(pci),
|
---|
[919] | 2402 | MPFROM2SHORT(FALSE,
|
---|
| 2403 | CRA_INUSE | (fUnHilite ? CRA_SELECTED : 0)));
|
---|
[551] | 2404 | }
|
---|
| 2405 | }
|
---|
| 2406 | break;
|
---|
[2] | 2407 |
|
---|
[551] | 2408 | case CN_CONTEXTMENU:
|
---|
| 2409 | cmp = INSTDATA(hwnd);
|
---|
| 2410 | if (cmp) {
|
---|
[919] | 2411 | PCNRITEM pci = (PCNRITEM)mp2;
|
---|
[551] | 2412 | USHORT id = COMP_CNRMENU;
|
---|
[2] | 2413 |
|
---|
[551] | 2414 | if (cmp->dcd.hwndLastMenu)
|
---|
| 2415 | WinDestroyWindow(cmp->dcd.hwndLastMenu);
|
---|
[919] | 2416 | cmp->dcd.hwndLastMenu = (HWND)0;
|
---|
[551] | 2417 | cmp->hwndCalling = WinWindowFromID(hwnd, SHORT1FROMMP(mp1));
|
---|
| 2418 | if (pci) {
|
---|
[748] | 2419 | if (!pci || !*pci->pszFileName || *cmp->rightlist)
|
---|
[551] | 2420 | break;
|
---|
| 2421 | id = COMP_MENU;
|
---|
| 2422 | WinSendMsg(cmp->hwndCalling, CM_SETRECORDEMPHASIS,
|
---|
| 2423 | MPFROMP(pci), MPFROM2SHORT(TRUE, CRA_CURSORED));
|
---|
| 2424 | }
|
---|
| 2425 | cmp->dcd.hwndLastMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id);
|
---|
| 2426 | if (cmp->dcd.hwndLastMenu) {
|
---|
| 2427 | if (id == COMP_CNRMENU) {
|
---|
| 2428 | if (SHORT1FROMMP(mp1) == COMP_RIGHTDIR)
|
---|
| 2429 | WinSendMsg(cmp->dcd.hwndLastMenu, MM_DELETEITEM,
|
---|
| 2430 | MPFROM2SHORT(IDM_SHOWSUBJECT, FALSE), MPVOID);
|
---|
| 2431 | SetDetailsSwitches(cmp->dcd.hwndLastMenu, &cmp->dcd);
|
---|
| 2432 | if (SHORT1FROMMP(mp1) == COMP_LEFTDIR)
|
---|
| 2433 | WinSendMsg(cmp->dcd.hwndLastMenu, MM_DELETEITEM,
|
---|
| 2434 | MPFROM2SHORT(IDM_LOADLISTFILE, 0), MPVOID);
|
---|
| 2435 | else if (*cmp->rightlist)
|
---|
| 2436 | WinSendMsg(cmp->dcd.hwndLastMenu, MM_DELETEITEM,
|
---|
| 2437 | MPFROM2SHORT(IDM_SAVELISTFILE, 0), MPVOID);
|
---|
| 2438 | }
|
---|
| 2439 | PopupMenu(hwnd, hwnd, cmp->dcd.hwndLastMenu);
|
---|
| 2440 | }
|
---|
| 2441 | }
|
---|
| 2442 | break;
|
---|
[2] | 2443 |
|
---|
[551] | 2444 | case CN_INITDRAG:
|
---|
| 2445 | cmp = INSTDATA(hwnd);
|
---|
| 2446 | if (*cmp->rightlist && SHORT1FROMMP(mp1) == COMP_RIGHTDIR)
|
---|
| 2447 | break;
|
---|
| 2448 | DoFileDrag(WinWindowFromID(hwnd, SHORT1FROMMP(mp1)),
|
---|
[919] | 2449 | (HWND)0, mp2, NULL, NULL, TRUE);
|
---|
[551] | 2450 | break;
|
---|
[2] | 2451 |
|
---|
[551] | 2452 | case CN_BEGINEDIT:
|
---|
| 2453 | case CN_REALLOCPSZ:
|
---|
| 2454 | // fixme to be gone - field edits not allowed
|
---|
| 2455 | Runtime_Error(pszSrcFile, __LINE__,
|
---|
| 2456 | "CN_BEGINEDIT/CN_REALLOCPSZ unexpected");
|
---|
| 2457 | break;
|
---|
[2] | 2458 |
|
---|
[551] | 2459 | case CN_EMPHASIS:
|
---|
| 2460 | {
|
---|
[919] | 2461 | PNOTIFYRECORDEMPHASIS pnre = mp2;
|
---|
| 2462 | if (pnre->fEmphasisMask & CRA_SELECTED) {
|
---|
| 2463 | PCNRITEM pci = (PCNRITEM)pnre->pRecord;
|
---|
[551] | 2464 | if (pci) {
|
---|
[919] | 2465 | if (!*pci->pszFileName) {
|
---|
| 2466 | // 12 Jan 08 SHL fixme to know if select counts need update?
|
---|
[551] | 2467 | if (pci->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 2468 | WinSendDlgItemMsg(hwnd, SHORT1FROMMP(mp1),
|
---|
| 2469 | CM_SETRECORDEMPHASIS,
|
---|
| 2470 | MPFROMP(pci),
|
---|
| 2471 | MPFROM2SHORT(FALSE, CRA_SELECTED));
|
---|
| 2472 | }
|
---|
| 2473 | else {
|
---|
| 2474 | cmp = INSTDATA(hwnd);
|
---|
[919] | 2475 | if (SHORT1FROMMP(mp1) == COMP_LEFTDIR) {
|
---|
| 2476 | cmp->selleft +=
|
---|
| 2477 | pci->rc.flRecordAttr & CRA_SELECTED ? 1 : -1;
|
---|
| 2478 | // If window not enabled WM_TIMER will update display
|
---|
| 2479 | if (WinIsWindowEnabled(hwndLeft)) {
|
---|
| 2480 | sprintf(s, " %d", cmp->selleft);
|
---|
| 2481 | WinSetDlgItemText(hwnd, COMP_SELLEFT, s);
|
---|
| 2482 | }
|
---|
[551] | 2483 | }
|
---|
[919] | 2484 | else if (SHORT1FROMMP(mp1) == COMP_RIGHTDIR) {
|
---|
| 2485 | cmp->selright +=
|
---|
| 2486 | pci->rc.flRecordAttr & CRA_SELECTED ? 1 : -1;
|
---|
| 2487 | if (WinIsWindowEnabled(hwndRight)) {
|
---|
| 2488 | sprintf(s, " %d", cmp->selright);
|
---|
| 2489 | WinSetDlgItemText(hwnd, COMP_SELRIGHT, s);
|
---|
[551] | 2490 | }
|
---|
| 2491 | }
|
---|
[919] | 2492 | else {
|
---|
| 2493 | Runtime_Error(pszSrcFile, __LINE__,
|
---|
| 2494 | "mp1 %u unexpected", SHORT1FROMMP(mp1));
|
---|
| 2495 | }
|
---|
[551] | 2496 | }
|
---|
| 2497 | }
|
---|
| 2498 | }
|
---|
| 2499 | }
|
---|
| 2500 | break;
|
---|
[2] | 2501 |
|
---|
[551] | 2502 | case CN_SCROLL:
|
---|
| 2503 | cmp = INSTDATA(hwnd);
|
---|
| 2504 | if (!cmp->forcescroll) {
|
---|
[2] | 2505 |
|
---|
[551] | 2506 | PNOTIFYSCROLL pns = mp2;
|
---|
[2] | 2507 |
|
---|
[551] | 2508 | if (pns->fScroll & CMA_VERTICAL) {
|
---|
| 2509 | cmp->forcescroll = TRUE;
|
---|
[919] | 2510 | // Scroll other window to match
|
---|
| 2511 | WinSendDlgItemMsg(hwnd,
|
---|
| 2512 | SHORT1FROMMP(mp1) == COMP_LEFTDIR ?
|
---|
| 2513 | COMP_RIGHTDIR : COMP_LEFTDIR,
|
---|
| 2514 | CM_SCROLLWINDOW,
|
---|
| 2515 | MPFROMSHORT(CMA_VERTICAL),
|
---|
[551] | 2516 | MPFROMLONG(pns->lScrollInc));
|
---|
| 2517 | cmp->forcescroll = FALSE;
|
---|
| 2518 | }
|
---|
| 2519 | }
|
---|
| 2520 | break;
|
---|
[919] | 2521 | } // switch COMP_LEFTDIR mp1
|
---|
| 2522 | break; // COMP_LEFTDIR / COMP_RIGHTDIR
|
---|
| 2523 | } // switch WM_CONTROL mp1
|
---|
[551] | 2524 | return 0; // WM_CONTROL
|
---|
[2] | 2525 |
|
---|
[551] | 2526 | case UM_SETDIR:
|
---|
| 2527 | cmp = INSTDATA(hwnd);
|
---|
| 2528 | if (cmp) {
|
---|
| 2529 | COMPARE *forthread;
|
---|
| 2530 | CNRINFO cnri;
|
---|
| 2531 | cmp->includesubdirs = WinQueryButtonCheckstate(hwnd,
|
---|
| 2532 | COMP_INCLUDESUBDIRS);
|
---|
| 2533 | memset(&cnri, 0, sizeof(CNRINFO));
|
---|
| 2534 | cnri.cb = sizeof(CNRINFO);
|
---|
| 2535 | cnri.pszCnrTitle = cmp->leftdir;
|
---|
| 2536 | cnri.flWindowAttr = CV_DETAIL | CV_MINI |
|
---|
[751] | 2537 | CA_CONTAINERTITLE | CA_TITLESEPARATOR |
|
---|
| 2538 | CA_DETAILSVIEWTITLES | CA_OWNERDRAW;
|
---|
[551] | 2539 | WinSendDlgItemMsg(hwnd, COMP_LEFTDIR, CM_SETCNRINFO, MPFROMP(&cnri),
|
---|
| 2540 | MPFROMLONG(CMA_CNRTITLE | CMA_FLWINDOWATTR));
|
---|
| 2541 | cnri.pszCnrTitle = cmp->rightdir;
|
---|
| 2542 | WinSendDlgItemMsg(hwnd, COMP_RIGHTDIR, CM_SETCNRINFO, MPFROMP(&cnri),
|
---|
| 2543 | MPFROMLONG(CMA_CNRTITLE | CMA_FLWINDOWATTR));
|
---|
| 2544 | WinCheckButton(hwnd, COMP_HIDENOTSELECTED, 0);
|
---|
| 2545 | cmp->filling = TRUE;
|
---|
| 2546 | forthread = xmalloc(sizeof(COMPARE), pszSrcFile, __LINE__);
|
---|
| 2547 | if (!forthread)
|
---|
| 2548 | WinDismissDlg(hwnd, 0);
|
---|
| 2549 | else {
|
---|
| 2550 | *forthread = *cmp;
|
---|
| 2551 | forthread->cmp = cmp;
|
---|
[919] | 2552 | if (_beginthread(FillCnrsThread, NULL, 122880, (PVOID)forthread) ==
|
---|
[551] | 2553 | -1) {
|
---|
| 2554 | Runtime_Error(pszSrcFile, __LINE__,
|
---|
| 2555 | GetPString(IDS_COULDNTSTARTTHREADTEXT));
|
---|
| 2556 | WinDismissDlg(hwnd, 0);
|
---|
| 2557 | free(forthread);
|
---|
| 2558 | }
|
---|
[362] | 2559 | else {
|
---|
[551] | 2560 | WinEnableWindowUpdate(hwndLeft, FALSE);
|
---|
| 2561 | WinEnableWindowUpdate(hwndRight, FALSE);
|
---|
| 2562 | cmp->selleft = cmp->selright = 0;
|
---|
| 2563 | WinSetDlgItemText(hwnd, COMP_SELLEFT, "0");
|
---|
| 2564 | WinSetDlgItemText(hwnd, COMP_SELRIGHT, "0");
|
---|
| 2565 | WinSetDlgItemText(hwnd, COMP_TOTALLEFT, "0");
|
---|
| 2566 | WinSetDlgItemText(hwnd, COMP_TOTALRIGHT, "0");
|
---|
| 2567 | WinSetDlgItemText(hwnd, COMP_NOTE,
|
---|
| 2568 | GetPString(IDS_COMPHOLDREADDISKTEXT));
|
---|
| 2569 | WinEnableWindow(hwndRight, FALSE);
|
---|
| 2570 | WinEnableWindow(hwndLeft, FALSE);
|
---|
| 2571 | WinEnableWindow(WinWindowFromID(hwnd, DID_OK), FALSE);
|
---|
| 2572 | WinEnableWindow(WinWindowFromID(hwnd, DID_CANCEL), FALSE);
|
---|
| 2573 | WinEnableWindow(WinWindowFromID(hwnd, COMP_COLLECT), FALSE);
|
---|
| 2574 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTBOTH), FALSE);
|
---|
| 2575 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTONE), FALSE);
|
---|
| 2576 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTNEWER), FALSE);
|
---|
| 2577 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTOLDER), FALSE);
|
---|
| 2578 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTBIGGER), FALSE);
|
---|
| 2579 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSMALLER), FALSE);
|
---|
| 2580 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTBOTH), FALSE);
|
---|
| 2581 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTONE), FALSE);
|
---|
| 2582 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTNEWER), FALSE);
|
---|
| 2583 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTOLDER), FALSE);
|
---|
| 2584 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTBIGGER), FALSE);
|
---|
| 2585 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTSMALLER), FALSE);
|
---|
| 2586 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTALL), FALSE);
|
---|
| 2587 | WinEnableWindow(WinWindowFromID(hwnd, COMP_SETDIRS), FALSE);
|
---|
| 2588 | WinEnableWindow(WinWindowFromID(hwnd, COMP_DELETELEFT), FALSE);
|
---|
| 2589 | WinEnableWindow(WinWindowFromID(hwnd, COMP_DELETERIGHT), FALSE);
|
---|
| 2590 | WinEnableWindow(WinWindowFromID(hwnd, COMP_COPYLEFT), FALSE);
|
---|
| 2591 | WinEnableWindow(WinWindowFromID(hwnd, COMP_MOVELEFT), FALSE);
|
---|
| 2592 | WinEnableWindow(WinWindowFromID(hwnd, COMP_COPYRIGHT), FALSE);
|
---|
| 2593 | WinEnableWindow(WinWindowFromID(hwnd, COMP_MOVERIGHT), FALSE);
|
---|
[919] | 2594 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSAMECONTENT), FALSE);
|
---|
[551] | 2595 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTIDENTICAL), FALSE);
|
---|
| 2596 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSAME), FALSE);
|
---|
| 2597 | WinEnableWindow(WinWindowFromID(hwnd, IDM_INVERT), FALSE);
|
---|
| 2598 | WinEnableWindow(WinWindowFromID(hwnd, COMP_FILTER), FALSE);
|
---|
[919] | 2599 | WinEnableWindow(WinWindowFromID(hwnd, COMP_INCLUDESUBDIRS), FALSE);
|
---|
| 2600 | WinEnableWindow(WinWindowFromID(hwnd, COMP_HIDENOTSELECTED), FALSE);
|
---|
[551] | 2601 | }
|
---|
[2] | 2602 | }
|
---|
[551] | 2603 | }
|
---|
| 2604 | return 0;
|
---|
[2] | 2605 |
|
---|
[551] | 2606 | case UM_FILTER:
|
---|
| 2607 | cmp = INSTDATA(hwnd);
|
---|
| 2608 | if (cmp) {
|
---|
| 2609 | if (mp1) {
|
---|
| 2610 | DosEnterCritSec();
|
---|
[919] | 2611 | SetMask((CHAR *)mp1, &cmp->dcd.mask);
|
---|
[551] | 2612 | DosExitCritSec();
|
---|
[2] | 2613 | }
|
---|
[919] | 2614 | WinSetDlgItemText(hwnd, COMP_NOTE,
|
---|
| 2615 | GetPString(IDS_COMPHOLDFILTERINGTEXT));
|
---|
| 2616 | // cmp->dcd.suspendview = 1; // 12 Jan 08 SHL appears not to be used here
|
---|
| 2617 | priority_idle(); // Don't hog resources
|
---|
[551] | 2618 | WinSendMsg(hwndLeft, CM_FILTER, MPFROMP(Filter),
|
---|
| 2619 | MPFROMP(&cmp->dcd.mask));
|
---|
| 2620 | WinSendMsg(hwndRight, CM_FILTER, MPFROMP(Filter),
|
---|
| 2621 | MPFROMP(&cmp->dcd.mask));
|
---|
[919] | 2622 | priority_normal();
|
---|
| 2623 | // cmp->dcd.suspendview = 0; // 12 Jan 08 SHL appears not to be used here
|
---|
| 2624 | if (*cmp->dcd.mask.szMask) {
|
---|
| 2625 | sprintf(s,
|
---|
| 2626 | GetPString(IDS_COMPREADYFILTEREDTEXT),
|
---|
| 2627 | cmp->dcd.mask.szMask);
|
---|
| 2628 | WinSetDlgItemText(hwnd, COMP_NOTE, s);
|
---|
| 2629 | }
|
---|
[551] | 2630 | else
|
---|
| 2631 | WinSetDlgItemText(hwnd, COMP_NOTE, GetPString(IDS_COMPREADYTEXT));
|
---|
| 2632 | }
|
---|
| 2633 | return 0;
|
---|
[2] | 2634 |
|
---|
[551] | 2635 | case UM_HIDENOTSELECTED:
|
---|
| 2636 | cmp = INSTDATA(hwnd);
|
---|
| 2637 | if (cmp) {
|
---|
| 2638 | USHORT wantHide = WinQueryButtonCheckstate(hwnd,
|
---|
| 2639 | COMP_HIDENOTSELECTED);
|
---|
[316] | 2640 |
|
---|
[919] | 2641 | // cmp->dcd.suspendview = 1; // 12 Jan 08 SHL appears not to be used here
|
---|
[551] | 2642 | if (wantHide) {
|
---|
| 2643 | BOOL needRefresh = FALSE;
|
---|
| 2644 | HWND hwndl = WinWindowFromID(cmp->hwnd, COMP_LEFTDIR);
|
---|
| 2645 | HWND hwndr = WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR);
|
---|
| 2646 | PCNRITEM pcil = WinSendMsg(hwndl, CM_QUERYRECORD, MPVOID,
|
---|
| 2647 | MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
|
---|
| 2648 | PCNRITEM pcir = WinSendMsg(hwndr, CM_QUERYRECORD, MPVOID,
|
---|
| 2649 | MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
|
---|
| 2650 |
|
---|
[919] | 2651 | while (pcil && (INT)pcil != -1 && pcir && (INT)pcir != -1) {
|
---|
[551] | 2652 | if (~pcil->rc.flRecordAttr & CRA_SELECTED &&
|
---|
| 2653 | ~pcir->rc.flRecordAttr & CRA_SELECTED) {
|
---|
| 2654 | pcil->rc.flRecordAttr |= CRA_FILTERED;
|
---|
| 2655 | pcir->rc.flRecordAttr |= CRA_FILTERED;
|
---|
| 2656 | needRefresh = TRUE;
|
---|
[316] | 2657 | }
|
---|
[551] | 2658 | pcil = WinSendMsg(hwndl, CM_QUERYRECORD, MPFROMP(pcil),
|
---|
| 2659 | MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
|
---|
| 2660 | pcir = WinSendMsg(hwndr, CM_QUERYRECORD, MPFROMP(pcir),
|
---|
| 2661 | MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
|
---|
[748] | 2662 | } // while
|
---|
[551] | 2663 | if (needRefresh) {
|
---|
| 2664 | WinSendMsg(hwndl, CM_INVALIDATERECORD,
|
---|
| 2665 | MPVOID, MPFROM2SHORT(0, CMA_REPOSITION));
|
---|
| 2666 | WinSendMsg(hwndr, CM_INVALIDATERECORD,
|
---|
| 2667 | MPVOID, MPFROM2SHORT(0, CMA_REPOSITION));
|
---|
[316] | 2668 | }
|
---|
| 2669 | }
|
---|
[551] | 2670 | else {
|
---|
| 2671 | WinSendMsg(hwndLeft, CM_FILTER, MPFROMP(Filter),
|
---|
| 2672 | MPFROMP(&cmp->dcd.mask));
|
---|
| 2673 | WinSendMsg(hwndRight, CM_FILTER, MPFROMP(Filter),
|
---|
| 2674 | MPFROMP(&cmp->dcd.mask));
|
---|
| 2675 | }
|
---|
[919] | 2676 | // cmp->dcd.suspendview = 0; // 12 Jan 08 SHL appears not to be used here
|
---|
| 2677 | if (*cmp->dcd.mask.szMask) {
|
---|
| 2678 | sprintf(s,
|
---|
| 2679 | GetPString(IDS_COMPREADYFILTEREDTEXT),
|
---|
| 2680 | cmp->dcd.mask.szMask);
|
---|
| 2681 | WinSetDlgItemText(hwnd, COMP_NOTE, s);
|
---|
| 2682 | }
|
---|
[551] | 2683 | else
|
---|
| 2684 | WinSetDlgItemText(hwnd, COMP_NOTE, GetPString(IDS_COMPREADYTEXT));
|
---|
| 2685 | }
|
---|
| 2686 | return 0;
|
---|
[316] | 2687 |
|
---|
[551] | 2688 | case WM_COMMAND:
|
---|
| 2689 | switch (SHORT1FROMMP(mp1)) {
|
---|
| 2690 | case IDM_COMPARE:
|
---|
| 2691 | cmp = INSTDATA(hwnd);
|
---|
| 2692 | if (cmp) {
|
---|
| 2693 | PCNRITEM pci;
|
---|
| 2694 | CHAR ofile[CCHMAXPATH];
|
---|
[2] | 2695 |
|
---|
[919] | 2696 | pci = (PCNRITEM)WinSendMsg(cmp->hwndCalling,
|
---|
| 2697 | CM_QUERYRECORDEMPHASIS,
|
---|
| 2698 | MPFROMLONG(CMA_FIRST),
|
---|
| 2699 | MPFROMSHORT(CRA_CURSORED));
|
---|
[748] | 2700 | // 01 Aug 07 SHL
|
---|
| 2701 | if (pci && *pci->pszFileName) {
|
---|
[551] | 2702 | if (cmp->hwndCalling == hwndLeft)
|
---|
| 2703 | strcpy(ofile, cmp->rightdir);
|
---|
| 2704 | else
|
---|
| 2705 | strcpy(ofile, cmp->leftdir);
|
---|
| 2706 | if (ofile[strlen(ofile) - 1] != '\\')
|
---|
| 2707 | strcat(ofile, "\\");
|
---|
[751] | 2708 | strcat(ofile, pci->pszDisplayName);
|
---|
[551] | 2709 | if (*compare) {
|
---|
| 2710 | CHAR *fakelist[3];
|
---|
[730] | 2711 | fakelist[0] = pci->pszFileName;
|
---|
[551] | 2712 | fakelist[1] = ofile;
|
---|
| 2713 | fakelist[2] = NULL;
|
---|
| 2714 | ExecOnList(hwnd, compare,
|
---|
[907] | 2715 | WINDOWED | SEPARATEKEEP, NULL, fakelist, NULL,
|
---|
| 2716 | pszSrcFile, __LINE__);
|
---|
[551] | 2717 | }
|
---|
| 2718 | else {
|
---|
| 2719 | FCOMPARE fc;
|
---|
| 2720 | memset(&fc, 0, sizeof(fc));
|
---|
| 2721 | fc.size = sizeof(fc);
|
---|
| 2722 | fc.hwndParent = hwnd;
|
---|
[730] | 2723 | strcpy(fc.file1, pci->pszFileName);
|
---|
[551] | 2724 | strcpy(fc.file2, ofile);
|
---|
| 2725 | WinDlgBox(HWND_DESKTOP, hwnd,
|
---|
[919] | 2726 | CFileDlgProc, FM3ModHandle, FCMP_FRAME, (PVOID)&fc);
|
---|
[551] | 2727 | }
|
---|
| 2728 | }
|
---|
| 2729 | }
|
---|
| 2730 | break;
|
---|
[2] | 2731 |
|
---|
[551] | 2732 | case COMP_FILTER:
|
---|
| 2733 | case IDM_FILTER:
|
---|
| 2734 | cmp = INSTDATA(hwnd);
|
---|
| 2735 | if (cmp) {
|
---|
| 2736 | BOOL empty = FALSE;
|
---|
| 2737 | PCNRITEM pci;
|
---|
| 2738 | CHAR *p;
|
---|
| 2739 | BOOL temp;
|
---|
[2] | 2740 |
|
---|
[551] | 2741 | if (!*cmp->dcd.mask.szMask) {
|
---|
| 2742 | empty = TRUE;
|
---|
| 2743 | temp = fSelectedAlways;
|
---|
| 2744 | fSelectedAlways = TRUE;
|
---|
[748] | 2745 | pci = (PCNRITEM)CurrentRecord(hwnd);
|
---|
[551] | 2746 | fSelectedAlways = temp;
|
---|
[748] | 2747 | // 01 Aug 07 SHL
|
---|
| 2748 | if (pci && ~pci->attrFile & FILE_DIRECTORY) {
|
---|
[730] | 2749 | p = strrchr(pci->pszFileName, '\\');
|
---|
[551] | 2750 | if (p) {
|
---|
| 2751 | p++;
|
---|
| 2752 | strcpy(cmp->dcd.mask.szMask, p);
|
---|
| 2753 | }
|
---|
| 2754 | }
|
---|
| 2755 | }
|
---|
| 2756 | cmp->dcd.mask.fNoAttribs = TRUE;
|
---|
| 2757 | cmp->dcd.mask.attrFile = ALLATTRS;
|
---|
| 2758 | cmp->dcd.mask.antiattr = 0;
|
---|
| 2759 | if (WinDlgBox(HWND_DESKTOP, hwnd, PickMaskDlgProc,
|
---|
| 2760 | FM3ModHandle, MSK_FRAME, MPFROMP(&cmp->dcd.mask))) {
|
---|
| 2761 | cmp->dcd.mask.attrFile = ALLATTRS;
|
---|
| 2762 | cmp->dcd.mask.antiattr = 0;
|
---|
| 2763 | WinSendMsg(hwnd, UM_FILTER, MPVOID, MPVOID);
|
---|
| 2764 | }
|
---|
| 2765 | else if (empty) {
|
---|
| 2766 | *cmp->dcd.mask.szMask = 0;
|
---|
| 2767 | cmp->dcd.mask.attrFile = ALLATTRS;
|
---|
| 2768 | cmp->dcd.mask.antiattr = 0;
|
---|
| 2769 | }
|
---|
| 2770 | }
|
---|
| 2771 | break;
|
---|
[2] | 2772 |
|
---|
[551] | 2773 | case IDM_SHOWSUBJECT:
|
---|
| 2774 | case IDM_SHOWEAS:
|
---|
| 2775 | case IDM_SHOWSIZE:
|
---|
| 2776 | case IDM_SHOWLWDATE:
|
---|
| 2777 | case IDM_SHOWLWTIME:
|
---|
| 2778 | case IDM_SHOWLADATE:
|
---|
| 2779 | case IDM_SHOWLATIME:
|
---|
| 2780 | case IDM_SHOWCRDATE:
|
---|
| 2781 | case IDM_SHOWCRTIME:
|
---|
| 2782 | case IDM_SHOWATTR:
|
---|
| 2783 | cmp = INSTDATA(hwnd);
|
---|
| 2784 | if (cmp) {
|
---|
| 2785 | DIRCNRDATA dcd1;
|
---|
| 2786 | BOOL tempsubj;
|
---|
[2] | 2787 |
|
---|
[551] | 2788 | dcd1 = cmp->dcd;
|
---|
| 2789 | AdjustDetailsSwitches(hwndLeft,
|
---|
[919] | 2790 | (HWND)0, SHORT1FROMMP(mp1),
|
---|
[551] | 2791 | cmp->leftdir, "DirCmp", &cmp->dcd, TRUE);
|
---|
| 2792 | tempsubj = cmp->dcd.detailssubject;
|
---|
| 2793 | cmp->dcd = dcd1;
|
---|
| 2794 | cmp->dcd.detailssubject = FALSE;
|
---|
| 2795 | AdjustDetailsSwitches(hwndRight,
|
---|
| 2796 | cmp->dcd.hwndLastMenu, SHORT1FROMMP(mp1),
|
---|
| 2797 | cmp->rightdir, "DirCmp", &cmp->dcd, TRUE);
|
---|
| 2798 | cmp->dcd.detailssubject = tempsubj;
|
---|
| 2799 | }
|
---|
| 2800 | break;
|
---|
[2] | 2801 |
|
---|
[551] | 2802 | case IDM_LOADLISTFILE:
|
---|
| 2803 | cmp = INSTDATA(hwnd);
|
---|
| 2804 | if (cmp) {
|
---|
| 2805 | CHAR fullname[CCHMAXPATH];
|
---|
[2] | 2806 |
|
---|
[551] | 2807 | strcpy(fullname, "*.PMD");
|
---|
| 2808 | if (insert_filename(HWND_DESKTOP, fullname, TRUE, FALSE) &&
|
---|
| 2809 | *fullname && !strchr(fullname, '*') && !strchr(fullname, '?')) {
|
---|
| 2810 | strcpy(cmp->rightlist, fullname);
|
---|
| 2811 | PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
|
---|
| 2812 | PostMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
|
---|
| 2813 | }
|
---|
| 2814 | }
|
---|
| 2815 | break;
|
---|
[2] | 2816 |
|
---|
[551] | 2817 | case IDM_SAVELISTFILE:
|
---|
| 2818 | cmp = INSTDATA(hwnd);
|
---|
| 2819 | if (cmp) {
|
---|
| 2820 | SNAPSTUFF *sf;
|
---|
| 2821 | CHAR fullname[CCHMAXPATH];
|
---|
[2] | 2822 |
|
---|
[551] | 2823 | strcpy(fullname, "*.PMD");
|
---|
| 2824 | if (export_filename(HWND_DESKTOP, fullname, 1) && *fullname &&
|
---|
| 2825 | !strchr(fullname, '*') && !strchr(fullname, '?')) {
|
---|
| 2826 | sf = xmallocz(sizeof(SNAPSTUFF), pszSrcFile, __LINE__);
|
---|
| 2827 | if (sf) {
|
---|
| 2828 | strcpy(sf->filename, fullname);
|
---|
| 2829 | if (hwndLeft == cmp->hwndCalling)
|
---|
| 2830 | strcpy(sf->dirname, cmp->leftdir);
|
---|
| 2831 | else
|
---|
| 2832 | strcpy(sf->dirname, cmp->rightdir);
|
---|
| 2833 | sf->recurse = cmp->includesubdirs;
|
---|
[919] | 2834 | if (_beginthread(StartSnap, NULL, 65536, (PVOID)sf) == -1) {
|
---|
[551] | 2835 | Runtime_Error(pszSrcFile, __LINE__,
|
---|
| 2836 | GetPString(IDS_COULDNTSTARTTHREADTEXT));
|
---|
| 2837 | free(sf);
|
---|
| 2838 | }
|
---|
| 2839 | }
|
---|
| 2840 | }
|
---|
| 2841 | }
|
---|
| 2842 | break;
|
---|
[2] | 2843 |
|
---|
[551] | 2844 | case COMP_SETDIRS:
|
---|
| 2845 | cmp = INSTDATA(hwnd);
|
---|
| 2846 | if (cmp) {
|
---|
| 2847 | WALK2 wa;
|
---|
| 2848 | memset(&wa, 0, sizeof(wa));
|
---|
| 2849 | wa.size = sizeof(wa);
|
---|
| 2850 | strcpy(wa.szCurrentPath1, cmp->leftdir);
|
---|
| 2851 | strcpy(wa.szCurrentPath2, cmp->rightdir);
|
---|
[919] | 2852 | if (WinDlgBox(HWND_DESKTOP,
|
---|
| 2853 | hwnd,
|
---|
| 2854 | WalkTwoCmpDlgProc,
|
---|
| 2855 | FM3ModHandle,
|
---|
| 2856 | WALK2_FRAME,
|
---|
[551] | 2857 | MPFROMP(&wa)) &&
|
---|
[769] | 2858 | !IsFile(wa.szCurrentPath1) &&
|
---|
| 2859 | !IsFile(wa.szCurrentPath2)) {
|
---|
[551] | 2860 | strcpy(cmp->leftdir, wa.szCurrentPath1);
|
---|
| 2861 | strcpy(cmp->rightdir, wa.szCurrentPath2);
|
---|
| 2862 | *cmp->rightlist = 0;
|
---|
| 2863 | PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
|
---|
| 2864 | PostMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
|
---|
| 2865 | }
|
---|
| 2866 | }
|
---|
| 2867 | break;
|
---|
[2] | 2868 |
|
---|
[551] | 2869 | case COMP_COPYLEFT:
|
---|
| 2870 | case COMP_MOVELEFT:
|
---|
| 2871 | case COMP_COPYRIGHT:
|
---|
| 2872 | case COMP_MOVERIGHT:
|
---|
| 2873 | case COMP_DELETELEFT:
|
---|
| 2874 | case COMP_DELETERIGHT:
|
---|
| 2875 | cmp = INSTDATA(hwnd);
|
---|
| 2876 | if (cmp) {
|
---|
| 2877 | COMPARE *forthread;
|
---|
[2] | 2878 |
|
---|
[551] | 2879 | cmp->filling = TRUE;
|
---|
| 2880 | forthread = xmalloc(sizeof(COMPARE), pszSrcFile, __LINE__);
|
---|
| 2881 | if (forthread) {
|
---|
| 2882 | *forthread = *cmp;
|
---|
| 2883 | forthread->cmp = cmp;
|
---|
| 2884 | forthread->action = SHORT1FROMMP(mp1);
|
---|
[919] | 2885 | if (_beginthread(ActionCnrThread, NULL, 122880, (PVOID)forthread)
|
---|
[551] | 2886 | == -1) {
|
---|
| 2887 | Runtime_Error(pszSrcFile, __LINE__,
|
---|
| 2888 | GetPString(IDS_COULDNTSTARTTHREADTEXT));
|
---|
| 2889 | free(forthread);
|
---|
| 2890 | }
|
---|
| 2891 | else {
|
---|
| 2892 | WinEnableWindowUpdate(hwndLeft, FALSE);
|
---|
| 2893 | WinEnableWindowUpdate(hwndRight, FALSE);
|
---|
| 2894 | switch (SHORT1FROMMP(mp1)) {
|
---|
| 2895 | case COMP_DELETELEFT:
|
---|
| 2896 | case COMP_DELETERIGHT:
|
---|
| 2897 | WinSetDlgItemText(hwnd, COMP_NOTE,
|
---|
| 2898 | GetPString(IDS_COMPHOLDDELETINGTEXT));
|
---|
| 2899 | break;
|
---|
| 2900 | case COMP_MOVELEFT:
|
---|
| 2901 | case COMP_MOVERIGHT:
|
---|
| 2902 | WinSetDlgItemText(hwnd, COMP_NOTE,
|
---|
| 2903 | GetPString(IDS_COMPHOLDMOVINGTEXT));
|
---|
| 2904 | break;
|
---|
| 2905 | case COMP_COPYLEFT:
|
---|
| 2906 | case COMP_COPYRIGHT:
|
---|
| 2907 | WinSetDlgItemText(hwnd, COMP_NOTE,
|
---|
| 2908 | GetPString(IDS_COMPHOLDCOPYINGTEXT));
|
---|
| 2909 | break;
|
---|
| 2910 | default:
|
---|
[919] | 2911 | Runtime_Error(pszSrcFile, __LINE__, "mp1 %u unexpected", SHORT1FROMMP(mp1));
|
---|
[551] | 2912 | }
|
---|
| 2913 | WinEnableWindow(hwndRight, FALSE);
|
---|
| 2914 | WinEnableWindow(hwndLeft, FALSE);
|
---|
| 2915 | WinEnableWindow(WinWindowFromID(hwnd, DID_OK), FALSE);
|
---|
| 2916 | WinEnableWindow(WinWindowFromID(hwnd, DID_CANCEL), FALSE);
|
---|
| 2917 | WinEnableWindow(WinWindowFromID(hwnd, COMP_COLLECT), FALSE);
|
---|
| 2918 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTBOTH), FALSE);
|
---|
| 2919 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTONE), FALSE);
|
---|
| 2920 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTNEWER), FALSE);
|
---|
| 2921 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTOLDER), FALSE);
|
---|
| 2922 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTBIGGER), FALSE);
|
---|
| 2923 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSMALLER), FALSE);
|
---|
| 2924 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTBOTH), FALSE);
|
---|
| 2925 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTONE), FALSE);
|
---|
| 2926 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTNEWER), FALSE);
|
---|
| 2927 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTOLDER), FALSE);
|
---|
| 2928 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTBIGGER), FALSE);
|
---|
[919] | 2929 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTSMALLER), FALSE);
|
---|
[551] | 2930 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTALL), FALSE);
|
---|
| 2931 | WinEnableWindow(WinWindowFromID(hwnd, COMP_SETDIRS), FALSE);
|
---|
| 2932 | WinEnableWindow(WinWindowFromID(hwnd, COMP_DELETELEFT), FALSE);
|
---|
| 2933 | WinEnableWindow(WinWindowFromID(hwnd, COMP_DELETERIGHT), FALSE);
|
---|
| 2934 | WinEnableWindow(WinWindowFromID(hwnd, COMP_COPYLEFT), FALSE);
|
---|
| 2935 | WinEnableWindow(WinWindowFromID(hwnd, COMP_MOVELEFT), FALSE);
|
---|
| 2936 | WinEnableWindow(WinWindowFromID(hwnd, COMP_COPYRIGHT), FALSE);
|
---|
| 2937 | WinEnableWindow(WinWindowFromID(hwnd, COMP_MOVERIGHT), FALSE);
|
---|
[919] | 2938 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSAMECONTENT), FALSE);
|
---|
| 2939 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTIDENTICAL), FALSE);
|
---|
[551] | 2940 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSAME), FALSE);
|
---|
| 2941 | WinEnableWindow(WinWindowFromID(hwnd, IDM_INVERT), FALSE);
|
---|
| 2942 | WinEnableWindow(WinWindowFromID(hwnd, COMP_FILTER), FALSE);
|
---|
[919] | 2943 | WinEnableWindow(WinWindowFromID(hwnd, COMP_INCLUDESUBDIRS), FALSE);
|
---|
| 2944 | WinEnableWindow(WinWindowFromID(hwnd, COMP_HIDENOTSELECTED), FALSE);
|
---|
[551] | 2945 | }
|
---|
| 2946 | }
|
---|
| 2947 | }
|
---|
| 2948 | break;
|
---|
[2] | 2949 |
|
---|
[551] | 2950 | case DID_OK:
|
---|
| 2951 | WinDismissDlg(hwnd, 0);
|
---|
| 2952 | break;
|
---|
| 2953 | case DID_CANCEL:
|
---|
| 2954 | WinDismissDlg(hwnd, 1);
|
---|
| 2955 | break;
|
---|
[2] | 2956 |
|
---|
[551] | 2957 | case IDM_HELP:
|
---|
| 2958 | if (hwndHelp)
|
---|
| 2959 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
---|
| 2960 | MPFROM2SHORT(HELP_COMPARE, 0), MPFROMSHORT(HM_RESOURCEID));
|
---|
| 2961 | break;
|
---|
[2] | 2962 |
|
---|
[551] | 2963 | case IDM_DESELECTALL:
|
---|
| 2964 | case IDM_SELECTNEWER:
|
---|
| 2965 | case IDM_SELECTOLDER:
|
---|
| 2966 | case IDM_SELECTBIGGER:
|
---|
| 2967 | case IDM_SELECTSMALLER:
|
---|
| 2968 | case IDM_DESELECTNEWER:
|
---|
| 2969 | case IDM_DESELECTOLDER:
|
---|
| 2970 | case IDM_DESELECTBIGGER:
|
---|
| 2971 | case IDM_DESELECTSMALLER:
|
---|
| 2972 | case IDM_DESELECTONE:
|
---|
| 2973 | case IDM_DESELECTBOTH:
|
---|
| 2974 | case IDM_SELECTBOTH:
|
---|
| 2975 | case IDM_SELECTONE:
|
---|
| 2976 | case IDM_SELECTSAMECONTENT:
|
---|
[748] | 2977 | case IDM_SELECTIDENTICAL: // Name, size and time
|
---|
| 2978 | case IDM_SELECTSAME: // Name and size
|
---|
[551] | 2979 | case IDM_INVERT:
|
---|
| 2980 | cmp = INSTDATA(hwnd);
|
---|
| 2981 | if (!cmp)
|
---|
| 2982 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
| 2983 | else {
|
---|
| 2984 | COMPARE *forthread;
|
---|
| 2985 |
|
---|
| 2986 | cmp->filling = TRUE;
|
---|
| 2987 | forthread = xmalloc(sizeof(COMPARE), pszSrcFile, __LINE__);
|
---|
| 2988 | if (forthread) {
|
---|
| 2989 | *forthread = *cmp;
|
---|
| 2990 | forthread->cmp = cmp;
|
---|
| 2991 | forthread->action = SHORT1FROMMP(mp1);
|
---|
[919] | 2992 | if (_beginthread(SelectCnrsThread, NULL, 65536, (PVOID)forthread)
|
---|
[551] | 2993 | == -1) {
|
---|
| 2994 | Runtime_Error(pszSrcFile, __LINE__,
|
---|
| 2995 | GetPString(IDS_COULDNTSTARTTHREADTEXT));
|
---|
| 2996 | free(forthread);
|
---|
| 2997 | }
|
---|
[362] | 2998 | else {
|
---|
[551] | 2999 | WinEnableWindowUpdate(hwndLeft, FALSE);
|
---|
| 3000 | WinEnableWindowUpdate(hwndRight, FALSE);
|
---|
| 3001 | switch (SHORT1FROMMP(mp1)) {
|
---|
| 3002 | case IDM_DESELECTALL:
|
---|
| 3003 | case IDM_DESELECTNEWER:
|
---|
| 3004 | case IDM_DESELECTOLDER:
|
---|
| 3005 | case IDM_DESELECTBIGGER:
|
---|
| 3006 | case IDM_DESELECTSMALLER:
|
---|
| 3007 | case IDM_DESELECTONE:
|
---|
| 3008 | case IDM_DESELECTBOTH:
|
---|
| 3009 | WinSetDlgItemText(hwnd, COMP_NOTE,
|
---|
| 3010 | GetPString(IDS_COMPHOLDDESELTEXT));
|
---|
| 3011 | break;
|
---|
| 3012 | case IDM_INVERT:
|
---|
| 3013 | WinSetDlgItemText(hwnd, COMP_NOTE,
|
---|
| 3014 | GetPString(IDS_COMPHOLDINVERTTEXT));
|
---|
| 3015 | break;
|
---|
| 3016 | default:
|
---|
| 3017 | WinSetDlgItemText(hwnd, COMP_NOTE,
|
---|
| 3018 | GetPString(IDS_COMPHOLDSELTEXT));
|
---|
| 3019 | break;
|
---|
| 3020 | }
|
---|
| 3021 | WinEnableWindow(hwndRight, FALSE);
|
---|
| 3022 | WinEnableWindow(hwndLeft, FALSE);
|
---|
| 3023 | WinEnableWindow(WinWindowFromID(hwnd, DID_OK), FALSE);
|
---|
| 3024 | WinEnableWindow(WinWindowFromID(hwnd, DID_CANCEL), FALSE);
|
---|
| 3025 | WinEnableWindow(WinWindowFromID(hwnd, COMP_COLLECT), FALSE);
|
---|
| 3026 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTBOTH), FALSE);
|
---|
| 3027 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTONE), FALSE);
|
---|
| 3028 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTNEWER), FALSE);
|
---|
| 3029 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTOLDER), FALSE);
|
---|
| 3030 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTBIGGER), FALSE);
|
---|
| 3031 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSMALLER), FALSE);
|
---|
| 3032 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTBOTH), FALSE);
|
---|
| 3033 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTONE), FALSE);
|
---|
| 3034 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTNEWER), FALSE);
|
---|
| 3035 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTOLDER), FALSE);
|
---|
| 3036 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTBIGGER), FALSE);
|
---|
[919] | 3037 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTSMALLER), FALSE);
|
---|
[551] | 3038 | WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTALL), FALSE);
|
---|
[919] | 3039 | WinEnableWindow(WinWindowFromID(hwnd, COMP_INCLUDESUBDIRS), FALSE);
|
---|
| 3040 | WinEnableWindow(WinWindowFromID(hwnd, COMP_HIDENOTSELECTED), FALSE);
|
---|
[551] | 3041 | WinEnableWindow(WinWindowFromID(hwnd, COMP_SETDIRS), FALSE);
|
---|
| 3042 | WinEnableWindow(WinWindowFromID(hwnd, COMP_DELETELEFT), FALSE);
|
---|
| 3043 | WinEnableWindow(WinWindowFromID(hwnd, COMP_DELETERIGHT), FALSE);
|
---|
| 3044 | WinEnableWindow(WinWindowFromID(hwnd, COMP_COPYLEFT), FALSE);
|
---|
| 3045 | WinEnableWindow(WinWindowFromID(hwnd, COMP_MOVELEFT), FALSE);
|
---|
| 3046 | WinEnableWindow(WinWindowFromID(hwnd, COMP_COPYRIGHT), FALSE);
|
---|
| 3047 | WinEnableWindow(WinWindowFromID(hwnd, COMP_MOVERIGHT), FALSE);
|
---|
[919] | 3048 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSAMECONTENT), FALSE);
|
---|
| 3049 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTIDENTICAL), FALSE);
|
---|
[551] | 3050 | WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSAME), FALSE);
|
---|
| 3051 | WinEnableWindow(WinWindowFromID(hwnd, IDM_INVERT), FALSE);
|
---|
| 3052 | WinEnableWindow(WinWindowFromID(hwnd, COMP_FILTER), FALSE);
|
---|
| 3053 | }
|
---|
| 3054 | }
|
---|
| 3055 | }
|
---|
| 3056 | break;
|
---|
[2] | 3057 |
|
---|
[551] | 3058 | case COMP_COLLECT:
|
---|
| 3059 | cmp = INSTDATA(hwnd);
|
---|
[773] | 3060 | if (!cmp)
|
---|
| 3061 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
| 3062 | else {
|
---|
| 3063 | CHAR **listl;
|
---|
| 3064 | CHAR **listr = NULL;
|
---|
[551] | 3065 | if (!Collector) {
|
---|
| 3066 | SWP swp;
|
---|
| 3067 | HWND hwndC;
|
---|
[773] | 3068 | if (!fAutoTile &&
|
---|
| 3069 | !ParentIsDesktop(hwnd, cmp->hwndParent) &&
|
---|
| 3070 | !fExternalCollector &&
|
---|
| 3071 | !strcmp(realappname, FM3Str)) {
|
---|
[551] | 3072 | GetNextWindowPos(cmp->hwndParent, &swp, NULL, NULL);
|
---|
[773] | 3073 | }
|
---|
| 3074 | hwndC = StartCollector(fExternalCollector ||
|
---|
| 3075 | strcmp(realappname, FM3Str) ?
|
---|
| 3076 | HWND_DESKTOP :
|
---|
| 3077 | cmp->hwndParent,
|
---|
| 3078 | 4);
|
---|
[551] | 3079 | if (hwndC) {
|
---|
[773] | 3080 | if (!fAutoTile &&
|
---|
| 3081 | !ParentIsDesktop(hwnd, cmp->hwndParent) &&
|
---|
| 3082 | !fExternalCollector &&
|
---|
| 3083 | !strcmp(realappname, FM3Str)) {
|
---|
| 3084 | WinSetWindowPos(hwndC, HWND_TOP,
|
---|
| 3085 | swp.x, swp.y, swp.cx, swp.cy,
|
---|
| 3086 | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER);
|
---|
| 3087 | }
|
---|
| 3088 | else if (!ParentIsDesktop(hwnd, cmp->hwndParent) &&
|
---|
| 3089 | fAutoTile &&
|
---|
| 3090 | !strcmp(realappname, FM3Str)) {
|
---|
[551] | 3091 | TileChildren(cmp->hwndParent, TRUE);
|
---|
[773] | 3092 | }
|
---|
[924] | 3093 | // DosSleep(32); // 05 Aug 07 GKY 64
|
---|
| 3094 | DosSleep(1); // 12 Jan 08 SHL Let screen update
|
---|
[551] | 3095 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(COMP_COLLECT, 0), MPVOID);
|
---|
| 3096 | break;
|
---|
| 3097 | }
|
---|
| 3098 | }
|
---|
| 3099 | else
|
---|
| 3100 | StartCollector(cmp->hwndParent, 4);
|
---|
[2] | 3101 |
|
---|
[773] | 3102 | temp = fSelectedAlways;
|
---|
| 3103 | fSelectedAlways = TRUE;
|
---|
| 3104 | listl = BuildList(hwndLeft);
|
---|
| 3105 | if (!*cmp->rightlist)
|
---|
| 3106 | listr = BuildList(hwndRight);
|
---|
| 3107 | fSelectedAlways = temp;
|
---|
| 3108 |
|
---|
[551] | 3109 | if (listl || listr) {
|
---|
| 3110 | if (Collector) {
|
---|
[773] | 3111 | // 07 Aug 07 SHL Avoid collected from empty list
|
---|
| 3112 | if (listl && listl[0] && *listl[0]) {
|
---|
| 3113 | if (PostMsg(Collector, WM_COMMAND,
|
---|
| 3114 | MPFROM2SHORT(IDM_COLLECTOR, 0), MPFROMP(listl)))
|
---|
| 3115 | listl = NULL; // Collector will free
|
---|
[551] | 3116 | }
|
---|
[773] | 3117 | if (listr && listr[0] && *listr[0]) {
|
---|
| 3118 | if (PostMsg(Collector, WM_COMMAND,
|
---|
| 3119 | MPFROM2SHORT(IDM_COLLECTOR, 0), MPFROMP(listr)))
|
---|
| 3120 | listr = NULL; // Collector will free
|
---|
[551] | 3121 | }
|
---|
| 3122 | WinSetWindowPos(WinQueryWindow(WinQueryWindow(Collector,
|
---|
| 3123 | QW_PARENT),
|
---|
[773] | 3124 | QW_PARENT),
|
---|
| 3125 | HWND_TOP, 0, 0, 0, 0,
|
---|
[551] | 3126 | SWP_ACTIVATE);
|
---|
| 3127 | }
|
---|
[773] | 3128 | FreeList(listl);
|
---|
| 3129 | FreeList(listr);
|
---|
[551] | 3130 | }
|
---|
[2] | 3131 | }
|
---|
[551] | 3132 | break;
|
---|
| 3133 | }
|
---|
| 3134 | return 0;
|
---|
[2] | 3135 |
|
---|
[551] | 3136 | case WM_CLOSE:
|
---|
| 3137 | WinDismissDlg(hwnd, 0);
|
---|
| 3138 | return 0;
|
---|
[2] | 3139 |
|
---|
[551] | 3140 | case WM_DESTROY:
|
---|
| 3141 | cmp = INSTDATA(hwnd);
|
---|
| 3142 | if (cmp) {
|
---|
| 3143 | if (cmp->dcd.hwndLastMenu)
|
---|
| 3144 | WinDestroyWindow(cmp->dcd.hwndLastMenu);
|
---|
| 3145 | if (cmp->dcd.hwndObject) {
|
---|
[919] | 3146 | WinSetWindowPtr(cmp->dcd.hwndObject, QWL_USER, (PVOID)NULL);
|
---|
[551] | 3147 | if (!PostMsg(cmp->dcd.hwndObject, WM_CLOSE, MPVOID, MPVOID))
|
---|
| 3148 | WinSendMsg(cmp->dcd.hwndObject, WM_CLOSE, MPVOID, MPVOID);
|
---|
[2] | 3149 | }
|
---|
[551] | 3150 | free(cmp);
|
---|
| 3151 | }
|
---|
| 3152 | EmptyCnr(hwndLeft);
|
---|
| 3153 | EmptyCnr(hwndRight);
|
---|
| 3154 | DosPostEventSem(CompactSem);
|
---|
| 3155 | break;
|
---|
[2] | 3156 | }
|
---|
[551] | 3157 | return WinDefDlgProc(hwnd, msg, mp1, mp2);
|
---|
[2] | 3158 | }
|
---|
[783] | 3159 |
|
---|
| 3160 | #pragma alloc_text(COMPAREDIR,FillCnrsThread,FillDirList,CompNames,BldFullPathName)
|
---|
| 3161 | #pragma alloc_text(COMPAREDIR1,CompareDlgProc)
|
---|
| 3162 | #pragma alloc_text(COMPAREDIR2,SelectCnrsThread,ActionCnrThread)
|
---|
| 3163 | #pragma alloc_text(COMPAREFILE,CFileDlgProc,CompareFilesThread)
|
---|
| 3164 | #pragma alloc_text(SNAPSHOT,SnapShot,StartSnap)
|
---|
[924] | 3165 | #pragma alloc_text(COMPSELECT,CompSelect)
|
---|
[783] | 3166 |
|
---|