Changeset 317 for trunk/dll/select.c
- Timestamp:
- Jul 13, 2006, 6:19:04 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/select.c
r204 r317 5 5 6 6 Copyright (c) 1993-98 M. Kimes 7 Copyright (c) 2004, 200 5Steven H. Levine7 Copyright (c) 2004, 2006 Steven H. Levine 8 8 9 9 01 Aug 04 SHL Rework lstrip/rstrip usage 10 10 25 May 05 SHL Rework for ULONGLONG 11 11 06 Jun 05 SHL Drop unused code 12 06 Jul 06 SHL Support compare content (IDM_SELECTSAMECONTENT) 12 13 13 14 ***********************************************************************/ … … 22 23 #include <string.h> 23 24 #include <share.h> 25 #include <io.h> 24 26 25 27 #include "fm3dll.h" … … 30 32 #pragma alloc_text(SELECT1,Deselect,HideAll,RemoveAll,ExpandAll,InvertAll) 31 33 32 33 VOID UnHilite (HWND hwndCnr,BOOL all,CHAR ***list) { 34 34 VOID UnHilite (HWND hwndCnr,BOOL all,CHAR ***list) 35 { 35 36 PCNRITEM pci; 36 37 INT numfiles = 0,numalloc = 0; … … 61 62 } 62 63 } 63 64 64 65 65 VOID SelectList (HWND hwndCnr,BOOL partial,BOOL deselect,BOOL clearfirst, … … 151 151 } 152 152 } 153 154 153 155 154 VOID SelectAll (HWND hwndCnr,BOOL files,BOOL dirs,CHAR *mask, … … 251 250 pci = (PCNRITEM)WinSendMsg(hwndCnr,CM_QUERYRECORD,MPFROMP(pci), 252 251 MPFROM2SHORT(CMA_NEXT,CMA_ITEMORDER)); 253 } 254 } 255 252 } // while 253 } 256 254 257 255 VOID DeselectAll (HWND hwndCnr,BOOL files,BOOL dirs,CHAR *mask,CHAR *text, … … 357 355 } 358 356 359 360 VOID Deselect (HWND hwndCnr) { 361 357 VOID Deselect (HWND hwndCnr) 358 { 362 359 PCNRITEM pcil; 363 360 … … 373 370 } 374 371 375 376 VOID HideAll (HWND hwndCnr) { 377 372 //=== HideAll() Hide all selected records === 373 374 VOID HideAll (HWND hwndCnr) 375 { 378 376 PCNRITEM pci,pciH; 379 377 INT attribute = CRA_CURSORED; … … 416 414 } 417 415 418 419 VOID MarkAll (HWND hwndCnr,BOOL quitit,BOOL target,BOOL source) { 420 416 VOID MarkAll (HWND hwndCnr,BOOL quitit,BOOL target,BOOL source) 417 { 421 418 PCNRITEM pci; 422 419 INT attribute = CRA_CURSORED; … … 445 442 } 446 443 447 448 VOID RemoveAll (HWND hwndCnr,ULONGLONG *pullTotalBytes,ULONG *pulTotalFiles) { 449 444 VOID RemoveAll (HWND hwndCnr,ULONGLONG *pullTotalBytes,ULONG *pulTotalFiles) 445 { 450 446 PCNRITEM pci; 451 447 INT attribute = CRA_CURSORED; … … 490 486 } 491 487 492 493 VOID SetMask (CHAR *str,MASK *mask) { 494 488 VOID SetMask (CHAR *str,MASK *mask) 489 { 495 490 register INT x; 496 491 register CHAR *p; … … 517 512 } 518 513 519 520 VOID ExpandAll (HWND hwndCnr,BOOL expand,PCNRITEM pciParent) { 521 514 VOID ExpandAll (HWND hwndCnr,BOOL expand,PCNRITEM pciParent) 515 { 522 516 PCNRITEM pci; 523 517 … … 543 537 } 544 538 545 546 VOID InvertAll (HWND hwndCnr) { 547 539 VOID InvertAll (HWND hwndCnr) 540 { 548 541 PCNRITEM pci; 549 542 … … 564 557 } 565 558 566 567 559 #pragma alloc_text (SELECT3,SpecialSelect) 568 560 #pragma alloc_text(SELECT4,FreeCnrs,SpecialSelect2,CompSSNames,CompSSNamesB) 569 561 570 571 VOID SpecialSelect (HWND hwndCnrS,HWND hwndCnrD,INT action,BOOL reset) { 572 562 VOID SpecialSelect (HWND hwndCnrS,HWND hwndCnrD,INT action,BOOL reset) 563 { 573 564 PCNRITEM pciS,pciD,*pciSa = NULL,*pciDa = NULL; 574 565 CNRINFO cnri; … … 788 779 break; 789 780 781 case IDM_SELECTSAMECONTENT: 782 // fixme 783 for (x = 0;x < numS;x++) { 784 if (~pciSa[x]->rc.flRecordAttr & CRA_FILTERED && 785 *pciSa[x]->szFileName && 786 *pciDa[x]->szFileName && 787 pciSa[x]->flags & CNRITEM_EXISTS && 788 pciDa[x]->flags & CNRITEM_EXISTS) { 789 790 FILE *fp1 = NULL; 791 FILE *fp2 = NULL; 792 BOOL gotMatch = FALSE; 793 BOOL gotError = FALSE; 794 CHAR buf1[1024]; 795 CHAR buf2[1024]; 796 HAB hab = WinQueryAnchorBlock(hwndCnrS); 797 798 fp1 = _fsopen(pciSa[x]->szFileName,"rb",SH_DENYNO); 799 if(!fp1) { 800 gotError = TRUE; 801 } 802 else { 803 fp2 = _fsopen(pciDa[x]->szFileName,"rb",SH_DENYNO); 804 if(!fp2) { 805 gotError = TRUE; 806 } 807 else { 808 size_t len1 = filelength(fileno(fp1)); 809 size_t len2 = filelength(fileno(fp2)); 810 if (len1 == len2) { 811 setbuf(fp1, NULL); 812 setbuf(fp2, NULL); 813 while (WinIsWindow(hab,hwndCnrS)) { 814 size_t numread1 = fread(buf1,1,1024,fp1); 815 size_t numread2 = fread(buf2,1,1024,fp2); 816 if (!numread1 || !numread2 || numread1 != numread2) { 817 if (ferror(fp1) || ferror(fp2)) 818 gotError = TRUE; 819 else if (feof(fp1) && feof(fp2)) 820 gotMatch = TRUE; 821 break; 822 } 823 else if (memcmp(buf1,buf2,numread1)) 824 break; 825 } // while 826 } // same len 827 } 828 } 829 830 if (fp1) 831 fclose(fp1); 832 833 if (fp2) 834 fclose(fp2); 835 836 if (gotError) { 837 // fixme 838 DosBeep(250,100); 839 saymsg(MB_CANCEL,HWND_DESKTOP, 840 "Compare Content", 841 "Unexpected error comparing..." 842 ); 843 } 844 if (gotMatch) { 845 if (!(pciSa[x]->rc.flRecordAttr & CRA_SELECTED)) 846 WinSendMsg(hwndCnrS,CM_SETRECORDEMPHASIS,MPFROMP(pciSa[x]), 847 MPFROM2SHORT(TRUE,CRA_SELECTED)); 848 if (!(pciDa[x]->rc.flRecordAttr & CRA_SELECTED)) 849 WinSendMsg(hwndCnrD,CM_SETRECORDEMPHASIS,MPFROMP(pciDa[x]), 850 MPFROM2SHORT(TRUE,CRA_SELECTED)); 851 } 852 } 853 if (!(x % 500)) 854 DosSleep(1L); 855 else if (!(x % 50)) 856 DosSleep(0L); 857 } // for records 858 break; 859 790 860 case IDM_SELECTBOTH: 791 861 for(x = 0;x < numS;x++) { … … 1078 1148 } 1079 1149 1080 1081 1150 struct SS { 1082 1151 PCNRITEM pci; … … 1095 1164 }; 1096 1165 1097 1098 static int CompSSNamesB (const void *s1,const void *s2) { 1099 1166 static int CompSSNamesB (const void *s1,const void *s2) 1167 { 1100 1168 struct SS *ss2 = (struct SS *)s2; 1101 1169 … … 1103 1171 } 1104 1172 1105 1106 static int CompSSNames (const void *s1,const void *s2) { 1107 1173 static int CompSSNames (const void *s1,const void *s2) 1174 { 1108 1175 struct SS *ss1 = (struct SS *)s1; 1109 1176 struct SS *ss2 = (struct SS *)s2; … … 1112 1179 } 1113 1180 1114 1115 VOID FreeCnrs (struct Cnr *Cnrs,INT numw) { 1116 1181 VOID FreeCnrs (struct Cnr *Cnrs,INT numw) 1182 { 1117 1183 register INT z; 1118 1184 … … 1125 1191 } 1126 1192 1127 1128 VOID SpecialSelect2 (HWND hwndParent,INT action) { 1129 1193 VOID SpecialSelect2 (HWND hwndParent,INT action) 1194 { 1130 1195 PCNRITEM pci; 1131 1196 HENUM henum;
Note:
See TracChangeset
for help on using the changeset viewer.