Changeset 316 for trunk/dll/comp.c
- Timestamp:
- Jul 13, 2006, 6:17:43 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/comp.c
r199 r316 7 7 8 8 Copyright (c) 1993-02 M. Kimes 9 Copyright (c) 2003, 200 5Steven H. Levine9 Copyright (c) 2003, 2006 Steven H. Levine 10 10 11 11 16 Oct 02 MK Baseline … … 16 16 25 May 05 SHL Rework with ULONGLONG 17 17 06 Jun 05 SHL Drop unused 18 12 Jul 06 SHL Renames and comments 18 19 19 20 ***********************************************************************/ … … 36 37 #include "fm3str.h" 37 38 38 #pragma alloc_text(COMPAREDIR,FillCnrs ,FillDirList,CompNames)39 #pragma alloc_text(COMPAREDIR,FillCnrsThread,FillDirList,CompNames) 39 40 #pragma alloc_text(COMPAREDIR1,CompareDlgProc) 40 #pragma alloc_text(COMPAREDIR2,SelectCnrs ,ActionCnr)41 #pragma alloc_text(COMPAREFILE,CFileDlgProc,CompareFiles )41 #pragma alloc_text(COMPAREDIR2,SelectCnrsThread,ActionCnrThread) 42 #pragma alloc_text(COMPAREFILE,CFileDlgProc,CompareFilesThread) 42 43 #pragma alloc_text(SNAPSHOT,SnapShot,StartSnap) 43 44 … … 48 49 } SNAPSTUFF; 49 50 50 51 void SnapShot (char *path,FILE *fp,BOOL recurse) 51 //=== SnapShot() Write directory tree to file and recurse if requested === 52 53 static VOID SnapShot (char *path,FILE *fp,BOOL recurse) 52 54 { 53 55 FILEFINDBUF4 *fb; … … 104 106 } 105 107 106 107 VOID StartSnap (VOID *dummy) { 108 108 //=== StartSnap() Write directory tree to snapshot file === 109 110 static VOID StartSnap (VOID *dummy) 111 { 109 112 SNAPSTUFF *sf = (SNAPSTUFF *)dummy; 110 113 FILE *fp; … … 135 138 } 136 139 137 138 VOID CompareFiles (VOID *args) { 139 140 //=== CompareFilesThread() Compare files and update container select flags === 141 142 static VOID CompareFilesThread (VOID *args) 143 { 140 144 FCOMPARE fc; 141 145 HAB hab2; … … 261 265 } 262 266 263 264 MRESULT EXPENTRY CFileDlgProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) { 265 267 //=== CFileDlgProc() Select directories to compare dialog procedure === 268 269 MRESULT EXPENTRY CFileDlgProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) 270 { 266 271 FCOMPARE *fc; 267 272 … … 289 294 break; 290 295 } 291 if(_beginthread(CompareFiles ,296 if(_beginthread(CompareFilesThread, 292 297 NULL, 293 298 65536, … … 332 337 } 333 338 334 335 static VOID ActionCnr (VOID *args) { 336 339 //=== ActionCnrThread() Do requested action on container contents === 340 341 static VOID ActionCnrThread (VOID *args) 342 { 337 343 COMPARE *cmp = (COMPARE *)args; 338 344 HAB hab; … … 395 401 MPFROM2SHORT(CMA_FIRST,CMA_ITEMORDER)); 396 402 while(pci && (INT)pci != -1 && pciO && (INT)pciO != -1) { 403 397 404 pcin = WinSendMsg(hwndCnrS,CM_QUERYRECORD,MPFROMP(pci), 398 405 MPFROM2SHORT(CMA_NEXT,CMA_ITEMORDER)); … … 571 578 default: 572 579 break; 573 } 580 } // switch 574 581 } 575 582 pci = pcin; 576 583 pciO = pciOn; 577 } 584 } // while 578 585 Abort: 579 586 WinDestroyMsgQueue(hmq); … … 586 593 } 587 594 588 589 static VOID SelectCnrs (VOID *args) { 590 595 //=== SelectCnrsThread() Update container selection flags thread === 596 597 static VOID SelectCnrsThread (VOID *args) 598 { 591 599 COMPARE *cmp = (COMPARE *)args; 592 600 HAB hab; … … 629 637 free(cmp); 630 638 } 631 632 639 633 640 static VOID FillDirList (CHAR *str,INT skiplen,BOOL recurse, … … 716 723 } 717 724 718 719 static int CompNames (const void *n1,const void *n2) { 720 725 //=== CompNames() Compare names for qsort === 726 727 static int CompNames (const void *n1,const void *n2) 728 { 721 729 FILELIST *fl1 = *(FILELIST **)n1; 722 730 FILELIST *fl2 = *(FILELIST **)n2; … … 725 733 } 726 734 727 728 static VOID FillCnrs (VOID *args) { 729 735 //=== FillCnrsThread() Fill left and right containers === 736 737 static VOID FillCnrsThread (VOID *args) 738 { 730 739 COMPARE *cmp = (COMPARE *)args; 731 740 HAB hab; … … 745 754 if(hmq) { 746 755 747 register INT x,l,r,y; 748 register ULONG cntr; 749 FILELIST **filesl = NULL,**filesr = NULL; 750 INT numfilesl = 0,numfilesr = 0,numallocl = 0,numallocr = 0, 751 lenl,lenr,high; 752 PCNRITEM pcilFirst,pcirFirst,pcil,pcir,pcit; 756 INT x; 757 INT l; 758 INT r; 759 INT y; 760 ULONG cntr; 761 FILELIST **filesl = NULL; 762 FILELIST **filesr = NULL; 763 INT numfilesl = 0; 764 INT numfilesr = 0; 765 INT numallocl = 0; 766 INT numallocr = 0; 767 INT lenl; // Directory prefix length 768 INT lenr; 769 UINT recsNeeded; // fixme to check ovf 770 PCNRITEM pcilFirst; 771 PCNRITEM pcirFirst; 772 PCNRITEM pcil; 773 PCNRITEM pcir; 774 PCNRITEM pcit; 753 775 RECORDINSERT ri; 754 register CHAR *cl;776 CHAR *pch; 755 777 756 778 WinCancelShutdown(hmq,TRUE); … … 790 812 &filesr,&numfilesr,&numallocr); 791 813 } 792 else { /* load snapshot file */ 793 814 else 815 { 816 /* use snapshot file */ 794 817 FILE *fp; 795 818 FILEFINDBUF4 fb4; … … 799 822 fp = fopen(cmp->rightlist,"r"); 800 823 if(fp) { 801 while(!feof(fp)) { /* first get name of directory */ 824 while(!feof(fp)) { 825 /* first get name of directory */ 802 826 if(!fgets(str,sizeof(str) - 1,fp)) 803 break; 827 break; // EOF 804 828 str[sizeof(str) - 1] = 0; 805 829 bstrip(str); 806 830 p = str; 807 831 if(*p == '\"') { 832 /* Quoted */ 808 833 p++; 809 834 if(*p && *p != '\"') { … … 819 844 p = cmp->rightdir + (strlen(cmp->rightdir) - 1); 820 845 if(p - cmp->rightdir > 3 && *p == '\\') 821 *p = 0; 846 *p = 0; // Chop trailing slash 822 847 break; 823 848 } … … 825 850 } 826 851 } 827 } 852 } // while !EOF 828 853 { 829 854 CNRINFO cnri; … … 915 940 } 916 941 } 917 } 918 } 942 } // while 943 } // if have rightdir 919 944 fclose(fp); 920 945 } 921 946 else 922 947 DosBeep(50,100); 923 } 948 } // if snapshot file 949 924 950 if(filesr) 925 951 qsort(filesr,numfilesr,sizeof(CHAR *),CompNames); … … 928 954 /* first, count total number of container entries required */ 929 955 l = r = 0; 930 cntr= 0;956 recsNeeded = 0; 931 957 while((filesl && filesl[l]) || (filesr && filesr[r])) { 932 958 if((filesl && filesl[l]) && (filesr && filesr[r])) { 933 959 x = stricmp(filesl[l]->fname,filesr[r]->fname); 934 960 if(!x) { 935 l++; 961 l++; // In both 936 962 r++; 937 963 } 938 964 else if(x < 0) 939 l++; 965 l++; // In left only 940 966 else 941 r++; 967 r++; // In right only 942 968 } 943 969 else if(filesl && filesl[l]) 944 l++; 970 l++; // In left only 945 971 else /* filesr && filesr[r] */ 946 r++; 947 cntr++; /* keep count of how many entries req'd */ 948 } 949 high = cntr; 972 r++; // In right only 973 recsNeeded++; /* keep count of how many entries req'd */ 974 } 950 975 WinSendMsg(cmp->hwnd,UM_CONTAINERHWND,MPVOID,MPVOID); 951 976 /* now insert records into the containers */ 952 977 cntr = 0; 953 978 l = r = 0; 954 if( high) {979 if(recsNeeded) { 955 980 pcilFirst = WinSendMsg(hwndLeft, 956 981 CM_ALLOCRECORD, 957 982 MPFROMLONG(EXTRA_RECORD_BYTES2), 958 MPFROMLONG( high));983 MPFROMLONG(recsNeeded)); 959 984 if(!pcilFirst) { 960 high= 0;985 recsNeeded = 0; 961 986 DosBeep(100,100); 962 987 } 988 } 989 if(recsNeeded) { 963 990 pcirFirst = WinSendMsg(hwndRight,CM_ALLOCRECORD, 964 991 MPFROMLONG(EXTRA_RECORD_BYTES2), 965 MPFROMLONG( high));992 MPFROMLONG(recsNeeded)); 966 993 if(!pcirFirst) { 967 high= 0;994 recsNeeded = 0; 968 995 DosBeep(100,100); 969 996 pcil = pcilFirst; … … 976 1003 } 977 1004 } 978 if( high) {1005 if(recsNeeded) { 979 1006 pcil = pcilFirst; 980 1007 pcir = pcirFirst; … … 997 1024 x = stricmp(filesl[l]->fname,filesr[r]->fname); 998 1025 if(!x) { 1026 // Same 999 1027 sprintf(pcil->szFileName,"%s%s%s",cmp->leftdir, 1000 1028 (cmp->leftdir[strlen(cmp->leftdir) - 1] == '\\') ? … … 1003 1031 pcil->pszFileName = pcil->szFileName + lenl; 1004 1032 pcil->attrFile = filesl[l]->attrFile; 1033 y = 0; 1034 for(x = 0;x < 6;x++) { 1035 if(attrstring[x]) 1036 pcil->szDispAttr[y++] = (CHAR)((pcil->attrFile & (1 << x)) ? 1037 attrstring[x] : '-'); 1038 } 1039 pcil->szDispAttr[5] = 0; 1040 pcil->cbFile = filesl[l]->cbFile; 1041 pcil->easize = filesl[l]->easize; 1042 pcil->date.day = filesl[l]->date.day; 1043 pcil->date.month = filesl[l]->date.month; 1044 pcil->date.year = filesl[l]->date.year + 1980; 1045 pcil->time.seconds = filesl[l]->time.twosecs * 2; 1046 pcil->time.minutes = filesl[l]->time.minutes; 1047 pcil->time.hours = filesl[l]->time.hours; 1048 pcil->ladate.day = filesl[l]->ladate.day; 1049 pcil->ladate.month = filesl[l]->ladate.month; 1050 pcil->ladate.year = filesl[l]->ladate.year + 1980; 1051 pcil->latime.seconds = filesl[l]->latime.twosecs * 2; 1052 pcil->latime.minutes = filesl[l]->latime.minutes; 1053 pcil->latime.hours = filesl[l]->latime.hours; 1054 pcil->crdate.day = filesl[l]->crdate.day; 1055 pcil->crdate.month = filesl[l]->crdate.month; 1056 pcil->crdate.year = filesl[l]->crdate.year + 1980; 1057 pcil->crtime.seconds = filesl[l]->crtime.twosecs * 2; 1058 pcil->crtime.minutes = filesl[l]->crtime.minutes; 1059 pcil->crtime.hours = filesl[l]->crtime.hours; 1060 if(*cmp->dcd.mask.szMask) { 1061 if(!Filter((PMINIRECORDCORE)pcil,(PVOID)&cmp->dcd.mask)) { 1062 pcil->rc.flRecordAttr |= CRA_FILTERED; 1063 pcir->rc.flRecordAttr |= CRA_FILTERED; 1064 } 1065 } 1066 sprintf(pcir->szFileName,"%s%s%s",cmp->rightdir, 1067 (cmp->rightdir[strlen(cmp->rightdir) - 1] == '\\') ? 1068 NullStr : "\\",filesr[r]->fname); 1069 pcir->pszFileName = pcir->szFileName + lenr; 1070 pcir->attrFile = filesr[r]->attrFile; 1071 // pcir->rc.hptrIcon = hptrFile; 1072 y = 0; 1073 for(x = 0;x < 6;x++) 1074 if(attrstring[x]) 1075 pcir->szDispAttr[y++] = (CHAR)((pcir->attrFile & (1 << x)) ? 1076 attrstring[x] : '-'); 1077 pcir->szDispAttr[5] = 0; 1078 pcir->cbFile = filesr[r]->cbFile; 1079 pcir->easize = filesr[r]->easize; 1080 pcir->date.day = filesr[r]->date.day; 1081 pcir->date.month = filesr[r]->date.month; 1082 pcir->date.year = filesr[r]->date.year + 1980; 1083 pcir->time.seconds = filesr[r]->time.twosecs * 2; 1084 pcir->time.minutes = filesr[r]->time.minutes; 1085 pcir->time.hours = filesr[r]->time.hours; 1086 pcir->ladate.day = filesr[r]->ladate.day; 1087 pcir->ladate.month = filesr[r]->ladate.month; 1088 pcir->ladate.year = filesr[r]->ladate.year + 1980; 1089 pcir->latime.seconds = filesr[r]->latime.twosecs * 2; 1090 pcir->latime.minutes = filesr[r]->latime.minutes; 1091 pcir->latime.hours = filesr[r]->latime.hours; 1092 pcir->crdate.day = filesr[r]->crdate.day; 1093 pcir->crdate.month = filesr[r]->crdate.month; 1094 pcir->crdate.year = filesr[r]->crdate.year + 1980; 1095 pcir->crtime.seconds = filesr[r]->crtime.twosecs * 2; 1096 pcir->crtime.minutes = filesr[r]->crtime.minutes; 1097 pcir->crtime.hours = filesr[r]->crtime.hours; 1098 pcil->flags |= CNRITEM_EXISTS; 1099 pcir->flags |= CNRITEM_EXISTS; 1100 pch = pcil->szSubject; 1101 if(pcil->cbFile + pcil->easize > 1102 pcir->cbFile + pcir->easize) { 1103 pcil->flags |= CNRITEM_LARGER; 1104 pcir->flags |= CNRITEM_SMALLER; 1105 strcpy(pch,GetPString(IDS_LARGERTEXT)); 1106 pch += 6; 1107 } 1108 else if(pcil->cbFile + pcil->easize < 1109 pcir->cbFile + pcir->easize) { 1110 pcil->flags |= CNRITEM_SMALLER; 1111 pcir->flags |= CNRITEM_LARGER; 1112 strcpy(pch,GetPString(IDS_SMALLERTEXT)); 1113 pch += 7; 1114 } 1115 if((pcil->date.year > pcir->date.year) ? TRUE : 1116 (pcil->date.year < pcir->date.year) ? FALSE : 1117 (pcil->date.month > pcir->date.month) ? TRUE : 1118 (pcil->date.month < pcir->date.month) ? FALSE : 1119 (pcil->date.day > pcir->date.day) ? TRUE : 1120 (pcil->date.day < pcir->date.day) ? FALSE : 1121 (pcil->time.hours > pcir->time.hours) ? TRUE : 1122 (pcil->time.hours < pcir->time.hours) ? FALSE : 1123 (pcil->time.minutes > pcir->time.minutes) ? TRUE : 1124 (pcil->time.minutes < pcir->time.minutes) ? FALSE : 1125 (pcil->time.seconds > pcir->time.seconds) ? TRUE : 1126 (pcil->time.seconds < pcir->time.seconds) ? FALSE : FALSE) { 1127 pcil->flags |= CNRITEM_NEWER; 1128 pcir->flags |= CNRITEM_OLDER; 1129 if(pch != pcil->szSubject) { 1130 strcpy(pch,", "); 1131 pch += 2; 1132 } 1133 strcpy(pch,GetPString(IDS_NEWERTEXT)); 1134 pch += 5; 1135 } 1136 else if((pcil->date.year < pcir->date.year) ? TRUE : 1137 (pcil->date.year > pcir->date.year) ? FALSE : 1138 (pcil->date.month < pcir->date.month) ? TRUE : 1139 (pcil->date.month > pcir->date.month) ? FALSE : 1140 (pcil->date.day < pcir->date.day) ? TRUE : 1141 (pcil->date.day > pcir->date.day) ? FALSE : 1142 (pcil->time.hours < pcir->time.hours) ? TRUE : 1143 (pcil->time.hours > pcir->time.hours) ? FALSE : 1144 (pcil->time.minutes < pcir->time.minutes) ? TRUE : 1145 (pcil->time.minutes > pcir->time.minutes) ? FALSE : 1146 (pcil->time.seconds < pcir->time.seconds) ? TRUE : 1147 (pcil->time.seconds > pcir->time.seconds) ? FALSE : 1148 FALSE) { 1149 pcil->flags |= CNRITEM_OLDER; 1150 pcir->flags |= CNRITEM_NEWER; 1151 if(pch != pcil->szSubject) { 1152 strcpy(pch,", "); 1153 pch += 2; 1154 } 1155 strcpy(pch,GetPString(IDS_OLDERTEXT)); 1156 pch += 5; 1157 } 1158 *pch = 0; 1159 r++; 1160 l++; 1161 } 1162 else if(x < 0) { 1163 // Just on left 1164 sprintf(pcil->szFileName,"%s%s%s",cmp->leftdir, 1165 (cmp->leftdir[strlen(cmp->leftdir) - 1] == '\\') ? 1166 NullStr : "\\",filesl[l]->fname); 1167 pcil->pszFileName = pcil->szFileName + lenl; 1168 pcil->attrFile = filesl[l]->attrFile; 1169 // pcil->rc.hptrIcon = hptrFile; 1005 1170 y = 0; 1006 1171 for(x = 0;x < 6;x++) … … 1035 1200 } 1036 1201 } 1202 free(filesl[l]); 1203 l++; 1204 } 1205 else { 1206 // Just on right 1037 1207 sprintf(pcir->szFileName,"%s%s%s",cmp->rightdir, 1038 1208 (cmp->rightdir[strlen(cmp->rightdir) - 1] == '\\') ? … … 1040 1210 pcir->pszFileName = pcir->szFileName + lenr; 1041 1211 pcir->attrFile = filesr[r]->attrFile; 1042 // pcir->rc.hptrIcon = hptrFile; 1043 y = 0; 1044 for(x = 0;x < 6;x++) 1045 if(attrstring[x]) 1046 pcir->szDispAttr[y++] = (CHAR)((pcir->attrFile & (1 << x)) ? 1047 attrstring[x] : '-'); 1048 pcir->szDispAttr[5] = 0; 1049 pcir->cbFile = filesr[r]->cbFile; 1050 pcir->easize = filesr[r]->easize; 1051 pcir->date.day = filesr[r]->date.day; 1052 pcir->date.month = filesr[r]->date.month; 1053 pcir->date.year = filesr[r]->date.year + 1980; 1054 pcir->time.seconds = filesr[r]->time.twosecs * 2; 1055 pcir->time.minutes = filesr[r]->time.minutes; 1056 pcir->time.hours = filesr[r]->time.hours; 1057 pcir->ladate.day = filesr[r]->ladate.day; 1058 pcir->ladate.month = filesr[r]->ladate.month; 1059 pcir->ladate.year = filesr[r]->ladate.year + 1980; 1060 pcir->latime.seconds = filesr[r]->latime.twosecs * 2; 1061 pcir->latime.minutes = filesr[r]->latime.minutes; 1062 pcir->latime.hours = filesr[r]->latime.hours; 1063 pcir->crdate.day = filesr[r]->crdate.day; 1064 pcir->crdate.month = filesr[r]->crdate.month; 1065 pcir->crdate.year = filesr[r]->crdate.year + 1980; 1066 pcir->crtime.seconds = filesr[r]->crtime.twosecs * 2; 1067 pcir->crtime.minutes = filesr[r]->crtime.minutes; 1068 pcir->crtime.hours = filesr[r]->crtime.hours; 1069 pcil->flags |= CNRITEM_EXISTS; 1070 pcir->flags |= CNRITEM_EXISTS; 1071 cl = pcil->szSubject; 1072 if(pcil->cbFile + pcil->easize > 1073 pcir->cbFile + pcir->easize) { 1074 pcil->flags |= CNRITEM_LARGER; 1075 pcir->flags |= CNRITEM_SMALLER; 1076 strcpy(cl,GetPString(IDS_LARGERTEXT)); 1077 cl += 6; 1078 } 1079 else if(pcil->cbFile + pcil->easize < 1080 pcir->cbFile + pcir->easize) { 1081 pcil->flags |= CNRITEM_SMALLER; 1082 pcir->flags |= CNRITEM_LARGER; 1083 strcpy(cl,GetPString(IDS_SMALLERTEXT)); 1084 cl += 7; 1085 } 1086 if((pcil->date.year > pcir->date.year) ? TRUE : 1087 (pcil->date.year < pcir->date.year) ? FALSE : 1088 (pcil->date.month > pcir->date.month) ? TRUE : 1089 (pcil->date.month < pcir->date.month) ? FALSE : 1090 (pcil->date.day > pcir->date.day) ? TRUE : 1091 (pcil->date.day < pcir->date.day) ? FALSE : 1092 (pcil->time.hours > pcir->time.hours) ? TRUE : 1093 (pcil->time.hours < pcir->time.hours) ? FALSE : 1094 (pcil->time.minutes > pcir->time.minutes) ? TRUE : 1095 (pcil->time.minutes < pcir->time.minutes) ? FALSE : 1096 (pcil->time.seconds > pcir->time.seconds) ? TRUE : 1097 (pcil->time.seconds < pcir->time.seconds) ? FALSE : FALSE) { 1098 pcil->flags |= CNRITEM_NEWER; 1099 pcir->flags |= CNRITEM_OLDER; 1100 if(cl != pcil->szSubject) { 1101 strcpy(cl,", "); 1102 cl += 2; 1103 } 1104 strcpy(cl,GetPString(IDS_NEWERTEXT)); 1105 cl += 5; 1106 } 1107 else if((pcil->date.year < pcir->date.year) ? TRUE : 1108 (pcil->date.year > pcir->date.year) ? FALSE : 1109 (pcil->date.month < pcir->date.month) ? TRUE : 1110 (pcil->date.month > pcir->date.month) ? FALSE : 1111 (pcil->date.day < pcir->date.day) ? TRUE : 1112 (pcil->date.day > pcir->date.day) ? FALSE : 1113 (pcil->time.hours < pcir->time.hours) ? TRUE : 1114 (pcil->time.hours > pcir->time.hours) ? FALSE : 1115 (pcil->time.minutes < pcir->time.minutes) ? TRUE : 1116 (pcil->time.minutes > pcir->time.minutes) ? FALSE : 1117 (pcil->time.seconds < pcir->time.seconds) ? TRUE : 1118 (pcil->time.seconds > pcir->time.seconds) ? FALSE : 1119 FALSE) { 1120 pcil->flags |= CNRITEM_OLDER; 1121 pcir->flags |= CNRITEM_NEWER; 1122 if(cl != pcil->szSubject) { 1123 strcpy(cl,", "); 1124 cl += 2; 1125 } 1126 strcpy(cl,GetPString(IDS_OLDERTEXT)); 1127 cl += 5; 1128 } 1129 *cl = 0; 1130 r++; 1131 l++; 1132 } 1133 else if(x < 0) { 1134 sprintf(pcil->szFileName,"%s%s%s",cmp->leftdir, 1135 (cmp->leftdir[strlen(cmp->leftdir) - 1] == '\\') ? 1136 NullStr : "\\",filesl[l]->fname); 1137 pcil->pszFileName = pcil->szFileName + lenl; 1138 pcil->attrFile = filesl[l]->attrFile; 1139 // pcil->rc.hptrIcon = hptrFile; 1140 y = 0; 1141 for(x = 0;x < 6;x++) 1142 if(attrstring[x]) 1143 pcil->szDispAttr[y++] = (CHAR)((pcil->attrFile & (1 << x)) ? 1144 attrstring[x] : '-'); 1145 pcil->szDispAttr[5] = 0; 1146 pcil->cbFile = filesl[l]->cbFile; 1147 pcil->easize = filesl[l]->easize; 1148 pcil->date.day = filesl[l]->date.day; 1149 pcil->date.month = filesl[l]->date.month; 1150 pcil->date.year = filesl[l]->date.year + 1980; 1151 pcil->time.seconds = filesl[l]->time.twosecs * 2; 1152 pcil->time.minutes = filesl[l]->time.minutes; 1153 pcil->time.hours = filesl[l]->time.hours; 1154 pcil->ladate.day = filesl[l]->ladate.day; 1155 pcil->ladate.month = filesl[l]->ladate.month; 1156 pcil->ladate.year = filesl[l]->ladate.year + 1980; 1157 pcil->latime.seconds = filesl[l]->latime.twosecs * 2; 1158 pcil->latime.minutes = filesl[l]->latime.minutes; 1159 pcil->latime.hours = filesl[l]->latime.hours; 1160 pcil->crdate.day = filesl[l]->crdate.day; 1161 pcil->crdate.month = filesl[l]->crdate.month; 1162 pcil->crdate.year = filesl[l]->crdate.year + 1980; 1163 pcil->crtime.seconds = filesl[l]->crtime.twosecs * 2; 1164 pcil->crtime.minutes = filesl[l]->crtime.minutes; 1165 pcil->crtime.hours = filesl[l]->crtime.hours; 1166 if(*cmp->dcd.mask.szMask) { 1167 if(!Filter((PMINIRECORDCORE)pcil,(PVOID)&cmp->dcd.mask)) { 1168 pcil->rc.flRecordAttr |= CRA_FILTERED; 1169 pcir->rc.flRecordAttr |= CRA_FILTERED; 1170 } 1171 } 1172 free(filesl[l]); 1173 l++; 1174 } 1175 else { 1176 sprintf(pcir->szFileName,"%s%s%s",cmp->rightdir, 1177 (cmp->rightdir[strlen(cmp->rightdir) - 1] == '\\') ? 1178 NullStr : "\\",filesr[r]->fname); 1179 pcir->pszFileName = pcir->szFileName + lenr; 1180 pcir->attrFile = filesr[r]->attrFile; 1181 // pcir->rc.hptrIcon = hptrFile; 1212 // pcir->rc.hptrIcon = hptrFile; 1182 1213 y = 0; 1183 1214 for(x = 0;x < 6;x++) … … 1217 1248 } 1218 1249 else if(filesl && filesl[l]) { 1250 // Just on left 1219 1251 sprintf(pcil->szFileName,"%s%s%s",cmp->leftdir, 1220 1252 (cmp->leftdir[strlen(cmp->leftdir) - 1] == '\\') ? … … 1222 1254 pcil->pszFileName = pcil->szFileName + lenl; 1223 1255 pcil->attrFile = filesl[l]->attrFile; 1224 //pcil->rc.hptrIcon = hptrFile;1256 // pcil->rc.hptrIcon = hptrFile; 1225 1257 y = 0; 1226 1258 for(x = 0;x < 6;x++) … … 1258 1290 l++; 1259 1291 } 1260 else { /* filesr && filesr[r] */ 1292 else { 1293 /* filesr && filesr[r] */ 1294 // Just on right 1261 1295 sprintf(pcir->szFileName,"%s%s%s",cmp->rightdir, 1262 1296 (cmp->rightdir[strlen(cmp->rightdir) - 1] == '\\') ? … … 1264 1298 pcir->pszFileName = pcir->szFileName + lenr; 1265 1299 pcir->attrFile = filesr[r]->attrFile; 1266 //pcir->rc.hptrIcon = hptrFile;1300 // pcir->rc.hptrIcon = hptrFile; 1267 1301 y = 0; 1268 1302 for(x = 0;x < 6;x++) … … 1307 1341 pcil = (PCNRITEM)pcil->rc.preccNextRecord; 1308 1342 pcir = (PCNRITEM)pcir->rc.preccNextRecord; 1309 } 1343 } // while 1310 1344 if(filesl) 1311 free(filesl); 1345 free(filesl); // Free header - have already freed elements 1312 1346 filesl = NULL; 1313 1347 if(filesr) … … 1321 1355 ri.pRecordParent = (PRECORDCORE)NULL; 1322 1356 ri.zOrder = (ULONG)CMA_TOP; 1323 ri.cRecordsInsert = high;1357 ri.cRecordsInsert = recsNeeded; 1324 1358 ri.fInvalidateRecord = FALSE; 1325 1359 if(!WinSendMsg(hwndLeft,CM_INSERTRECORD, … … 1339 1373 ri.pRecordParent = (PRECORDCORE)NULL; 1340 1374 ri.zOrder = (ULONG)CMA_TOP; 1341 ri.cRecordsInsert = high;1375 ri.cRecordsInsert = recsNeeded; 1342 1376 ri.fInvalidateRecord = FALSE; 1343 1377 if(!WinSendMsg(hwndRight,CM_INSERTRECORD, … … 1356 1390 cmp->cmp->totalleft = numfilesl; 1357 1391 cmp->cmp->totalright = numfilesr; 1358 } 1392 } // if recsNeeded 1359 1393 Deselect(hwndLeft); 1360 1394 Deselect(hwndRight); … … 1363 1397 notified = TRUE; 1364 1398 if(filesl) 1365 FreeList((CHAR **)filesl); 1399 FreeList((CHAR **)filesl); // Must have failed to create container 1366 1400 if(filesr) 1367 1401 FreeList((CHAR **)filesr); … … 1383 1417 #define hwndRight (WinWindowFromID(hwnd,COMP_RIGHTDIR)) 1384 1418 1385 1386 MRESULT EXPENTRY CompareDlgProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) { 1387 1419 //=== CompareDlgProc() Compare directories dialog procedure === 1420 1421 MRESULT EXPENTRY CompareDlgProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) 1422 { 1388 1423 COMPARE *cmp; 1389 1424 static HPOINTER hptr = (HPOINTER)0; … … 1611 1646 WinEnableWindowUpdate(hwndLeft,TRUE); 1612 1647 WinEnableWindowUpdate(hwndRight,TRUE); 1613 //if(!mp1) {1648 // if(!mp1) { 1614 1649 { 1615 1650 CHAR s[81]; … … 1640 1675 WinEnableWindow(WinWindowFromID(hwnd,IDM_DESELECTSMALLER),TRUE); 1641 1676 WinEnableWindow(WinWindowFromID(hwnd,IDM_DESELECTALL),TRUE); 1677 WinEnableWindow(WinWindowFromID(hwnd,IDM_SELECTSAMECONTENT),TRUE); 1642 1678 WinEnableWindow(WinWindowFromID(hwnd,IDM_SELECTIDENTICAL),TRUE); 1643 1679 WinEnableWindow(WinWindowFromID(hwnd,IDM_SELECTSAME),TRUE); … … 1700 1736 PostMsg(hwnd,UM_SETUP,MPVOID,MPVOID); 1701 1737 PostMsg(hwnd,UM_SETDIR,MPVOID,MPVOID); 1738 break; 1739 } 1740 break; 1741 case COMP_HIDENOTSELECTED: 1742 switch(SHORT2FROMMP(mp1)) { 1743 case BN_CLICKED: 1744 WinSendMsg(hwnd,UM_HIDENOTSELECTED,MPVOID,MPVOID); 1702 1745 break; 1703 1746 } … … 1937 1980 break; 1938 1981 } 1939 break; 1940 } 1941 return 0; 1982 break; // COMP_RIGHTDIR 1983 } 1984 return 0; // WM_CONTROL 1942 1985 1943 1986 case UM_SETDIR: … … 1966 2009 *forthread = *cmp; 1967 2010 forthread->cmp = cmp; 1968 if(_beginthread(FillCnrs ,NULL,122880,(PVOID)forthread) != -1) {2011 if(_beginthread(FillCnrsThread,NULL,122880,(PVOID)forthread) != -1) { 1969 2012 WinEnableWindowUpdate(hwndLeft,FALSE); 1970 2013 WinEnableWindowUpdate(hwndRight,FALSE); … … 2002 2045 WinEnableWindow(WinWindowFromID(hwnd,COMP_COPYRIGHT),FALSE); 2003 2046 WinEnableWindow(WinWindowFromID(hwnd,COMP_MOVERIGHT),FALSE); 2047 WinEnableWindow(WinWindowFromID(hwnd,IDM_SELECTSAMECONTENT),FALSE); 2004 2048 WinEnableWindow(WinWindowFromID(hwnd,IDM_SELECTIDENTICAL),FALSE); 2005 2049 WinEnableWindow(WinWindowFromID(hwnd,IDM_SELECTSAME),FALSE); … … 2031 2075 WinSendMsg(hwndLeft,CM_FILTER,MPFROMP(Filter),MPFROMP(&cmp->dcd.mask)); 2032 2076 WinSendMsg(hwndRight,CM_FILTER,MPFROMP(Filter),MPFROMP(&cmp->dcd.mask)); 2077 cmp->dcd.suspendview = 0; 2078 if(*cmp->dcd.mask.szMask) 2079 WinSetDlgItemText(hwnd,COMP_NOTE, 2080 GetPString(IDS_COMPREADYFILTEREDTEXT)); 2081 else 2082 WinSetDlgItemText(hwnd,COMP_NOTE, 2083 GetPString(IDS_COMPREADYTEXT)); 2084 } 2085 return 0; 2086 2087 case UM_HIDENOTSELECTED: 2088 cmp = INSTDATA(hwnd); 2089 if(cmp) { 2090 USHORT wantHide = WinQueryButtonCheckstate(hwnd, 2091 COMP_HIDENOTSELECTED); 2092 2093 cmp->dcd.suspendview = 1; 2094 if (wantHide) { 2095 BOOL needRefresh = FALSE; 2096 HWND hwndl = WinWindowFromID(cmp->hwnd,COMP_LEFTDIR); 2097 HWND hwndr = WinWindowFromID(cmp->hwnd,COMP_RIGHTDIR); 2098 PCNRITEM pcil = WinSendMsg(hwndl,CM_QUERYRECORD,MPVOID, 2099 MPFROM2SHORT(CMA_FIRST,CMA_ITEMORDER)); 2100 PCNRITEM pcir = WinSendMsg(hwndr,CM_QUERYRECORD,MPVOID, 2101 MPFROM2SHORT(CMA_FIRST,CMA_ITEMORDER)); 2102 while(pcil && (INT)pcil != -1 && pcir && (INT)pcir != -1) { 2103 if (~pcil->rc.flRecordAttr & CRA_SELECTED && 2104 ~pcir->rc.flRecordAttr & CRA_SELECTED) { 2105 pcil->rc.flRecordAttr |= CRA_FILTERED; 2106 pcir->rc.flRecordAttr |= CRA_FILTERED; 2107 needRefresh = TRUE; 2108 } 2109 pcil = WinSendMsg(hwndl,CM_QUERYRECORD,MPFROMP(pcil), 2110 MPFROM2SHORT(CMA_NEXT,CMA_ITEMORDER)); 2111 pcir = WinSendMsg(hwndr,CM_QUERYRECORD,MPFROMP(pcir), 2112 MPFROM2SHORT(CMA_NEXT,CMA_ITEMORDER)); 2113 } // while 2114 if (needRefresh) { 2115 WinSendMsg(hwndl,CM_INVALIDATERECORD, 2116 MPVOID,MPFROM2SHORT(0,CMA_REPOSITION)); 2117 WinSendMsg(hwndr,CM_INVALIDATERECORD, 2118 MPVOID,MPFROM2SHORT(0,CMA_REPOSITION)); 2119 } 2120 } 2121 else { 2122 WinSendMsg(hwndLeft,CM_FILTER,MPFROMP(Filter),MPFROMP(&cmp->dcd.mask)); 2123 WinSendMsg(hwndRight,CM_FILTER,MPFROMP(Filter),MPFROMP(&cmp->dcd.mask)); 2124 } 2033 2125 cmp->dcd.suspendview = 0; 2034 2126 if(*cmp->dcd.mask.szMask) … … 2247 2339 forthread->cmp = cmp; 2248 2340 forthread->action = SHORT1FROMMP(mp1); 2249 if(_beginthread(ActionCnr ,NULL,122880,(PVOID)forthread) != -1) {2341 if(_beginthread(ActionCnrThread,NULL,122880,(PVOID)forthread) != -1) { 2250 2342 WinEnableWindowUpdate(hwndLeft,FALSE); 2251 2343 WinEnableWindowUpdate(hwndRight,FALSE); … … 2297 2389 WinEnableWindow(WinWindowFromID(hwnd,COMP_COPYRIGHT),FALSE); 2298 2390 WinEnableWindow(WinWindowFromID(hwnd,COMP_MOVERIGHT),FALSE); 2391 WinEnableWindow(WinWindowFromID(hwnd,IDM_SELECTSAMECONTENT),FALSE); 2299 2392 WinEnableWindow(WinWindowFromID(hwnd,IDM_SELECTIDENTICAL),FALSE); 2300 2393 WinEnableWindow(WinWindowFromID(hwnd,IDM_SELECTSAME),FALSE); … … 2339 2432 case IDM_SELECTBOTH: 2340 2433 case IDM_SELECTONE: 2341 case IDM_SELECTIDENTICAL: 2342 case IDM_SELECTSAME: 2434 case IDM_SELECTSAMECONTENT: 2435 case IDM_SELECTIDENTICAL: // name, size and time 2436 case IDM_SELECTSAME: // name and size 2343 2437 case IDM_INVERT: 2344 2438 cmp = INSTDATA(hwnd); … … 2353 2447 forthread->cmp = cmp; 2354 2448 forthread->action = SHORT1FROMMP(mp1); 2355 if(_beginthread(SelectCnrs ,NULL,65536,(PVOID)forthread) != -1) {2449 if(_beginthread(SelectCnrsThread,NULL,65536,(PVOID)forthread) != -1) { 2356 2450 WinEnableWindowUpdate(hwndLeft,FALSE); 2357 2451 WinEnableWindowUpdate(hwndRight,FALSE); … … 2402 2496 WinEnableWindow(WinWindowFromID(hwnd,COMP_COPYRIGHT),FALSE); 2403 2497 WinEnableWindow(WinWindowFromID(hwnd,COMP_MOVERIGHT),FALSE); 2498 WinEnableWindow(WinWindowFromID(hwnd,IDM_SELECTSAMECONTENT),FALSE); 2404 2499 WinEnableWindow(WinWindowFromID(hwnd,IDM_SELECTIDENTICAL),FALSE); 2405 2500 WinEnableWindow(WinWindowFromID(hwnd,IDM_SELECTSAME),FALSE); 2406 2501 WinEnableWindow(WinWindowFromID(hwnd,IDM_INVERT),FALSE); 2407 2502 WinEnableWindow(WinWindowFromID(hwnd,COMP_FILTER),FALSE); 2408 switch(SHORT1FROMMP(mp1)) {2409 case IDM_DESELECTALL:2410 case IDM_INVERT:2411 break;2412 default:2413 break;2414 }2415 2503 } 2416 2504 else {
Note:
See TracChangeset
for help on using the changeset viewer.