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