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