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