source: trunk/dll/comp.c@ 689

Last change on this file since 689 was 689, checked in by Steven Levine, 18 years ago

Commit OpenWatcom compatibility updates

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