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