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