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