Changeset 155
- Timestamp:
- May 26, 2005, 4:17:45 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/dll/collect.c ¶
r145 r155 7 7 8 8 Copyright (c) 1993-98 M. Kimes 9 Copyright (c) 2003, 2005 Steven H. Levine9 Copyright (c) 2003, 2005 Steven H. Levine 10 10 11 11 15 Oct 02 MK Baseline … … 14 14 23 May 05 SHL Use QWL_USER 15 15 24 May 05 SHL Rework Win_Error usage 16 25 May 05 SHL Use ULONGLONG and CommaFmtULL 17 25 May 05 SHL Rework for FillInRecordFromFFB 16 18 17 19 ***********************************************************************/ … … 21 23 #define INCL_GPI 22 24 #define INCL_DOSERRORS 23 25 #define INCL_LONGLONG 24 26 #include <os2.h> 27 25 28 #include <stdarg.h> 26 29 #include <stdio.h> … … 31 34 #include <share.h> 32 35 #include <limits.h> 36 33 37 #include "fm3dll.h" 34 38 #include "fm3dlg.h" … … 53 57 MRESULT EXPENTRY CollectorTextProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) 54 58 { 59 LONGLONG ullBytes; 60 55 61 static BOOL emphasized = FALSE; 56 62 static HWND hwndButtonPopup = (HWND)0; … … 588 594 RECORDINSERT ri; 589 595 ULONG ulMaxFiles; 590 ULONG totalbytes;596 ULONGLONG ullTotalBytes; 591 597 CHAR fullname[CCHMAXPATH]; 592 598 … … 629 635 priority_normal(); 630 636 *fb4.achName = 0; 631 totalbytes = FillInRecordFromFFB(dcd->hwndCnr,pci, 632 fullname, 633 &fb4,FALSE, 634 dcd); 635 if (totalbytes != -1) { 636 dcd->totalbytes += totalbytes; 637 if (dcd->totalbytes == -1) 638 dcd->totalbytes--; // fixme for real someday 639 } 637 ullTotalBytes = FillInRecordFromFFB(dcd->hwndCnr, 638 pci, 639 fullname, 640 &fb4, 641 FALSE, 642 dcd); 643 dcd->ullTotalBytes += ullTotalBytes; 640 644 pciP = pci; 641 645 pci = (PCNRITEM)pci->rc.preccNextRecord; … … 733 737 MPFROMLONG(EXTRA_RECORD_BYTES), 734 738 MPFROMLONG(1L)); 735 if(pci) { 736 dcd->totalbytes += FillInRecordFromFSA(dcd->hwndCnr,pci, 739 if (pci) 740 { 741 dcd->ullTotalBytes += FillInRecordFromFSA(dcd->hwndCnr,pci, 737 742 fullname, 738 743 &fs4,FALSE,dcd); … … 954 959 955 960 956 MRESULT EXPENTRY CollectorCnrWndProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {957 961 MRESULT EXPENTRY CollectorCnrWndProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) 962 { 958 963 DIRCNRDATA *dcd = WinQueryWindowPtr(hwnd,QWL_USER); 959 964 INT tempsortFlags; … … 1000 1005 case '\n': 1001 1006 dcd->lasttime = 0; 1002 *dcd-> comnam= 0;1007 *dcd->szCommonName = 0; 1003 1008 break; 1004 1009 default: 1005 1010 thistime = WinQueryMsgTime(WinQueryAnchorBlock(hwnd)); 1006 1011 if(thistime > dcd->lasttime + 1250) 1007 *dcd-> comnam= 0;1012 *dcd->szCommonName = 0; 1008 1013 dcd->lasttime = thistime; 1009 if(SHORT1FROMMP(mp2) == ' ' && !dcd-> comnam)1014 if(SHORT1FROMMP(mp2) == ' ' && !dcd->szCommonName) 1010 1015 break; 1011 1016 KbdRetry: 1012 len = strlen(dcd-> comnam);1017 len = strlen(dcd->szCommonName); 1013 1018 if(len >= CCHMAXPATH - 1) { 1014 *dcd-> comnam= 0;1019 *dcd->szCommonName = 0; 1015 1020 len = 0; 1016 1021 } 1017 dcd-> comnam[len] = toupper(SHORT1FROMMP(mp2));1018 dcd-> comnam[len + 1] = 0;1022 dcd->szCommonName[len] = toupper(SHORT1FROMMP(mp2)); 1023 dcd->szCommonName[len + 1] = 0; 1019 1024 memset(&srch,0,sizeof(SEARCHSTRING)); 1020 1025 srch.cb = (ULONG)sizeof(SEARCHSTRING); 1021 srch.pszSearch = (PSZ)dcd-> comnam;1026 srch.pszSearch = (PSZ)dcd->szCommonName; 1022 1027 srch.fsPrefix = TRUE; 1023 1028 srch.fsCaseSensitive = FALSE; … … 1030 1035 1031 1036 /* make found item current item */ 1032 if(!stricmp(pci->pszFileName,dcd-> comnam))1037 if(!stricmp(pci->pszFileName,dcd->szCommonName)) 1033 1038 attrib |= CRA_SELECTED; 1034 1039 WinSendMsg(hwnd,CM_SETRECORDEMPHASIS,MPFROMP(pci), … … 1040 1045 else { 1041 1046 if(SHORT1FROMMP(mp2) == ' ') { 1042 dcd-> comnam[len] = 0;1047 dcd->szCommonName[len] = 0; 1043 1048 break; 1044 1049 } 1045 *dcd-> comnam= 0;1050 *dcd->szCommonName = 0; 1046 1051 dcd->lasttime = 0; 1047 1052 if(len) // retry as first letter if no match … … 1166 1171 dcd->totalfiles = cnri.cRecords; 1167 1172 commafmt(tf,sizeof(tf),dcd->totalfiles); 1168 if(dcd->totalbytes > 1024) 1169 commafmt(tb,sizeof(tb),dcd->totalbytes / 1024L); 1170 else 1171 commafmt(tb,sizeof(tb),dcd->totalbytes); 1172 sprintf(s,"%s / %s%s",tf,tb,(dcd->totalbytes > 1024) ? "k" : "b"); 1173 CommaFmtULL(tb,sizeof(tb),dcd->ullTotalBytes,' '); 1174 sprintf(s,"%s / %s",tf,tb); 1173 1175 WinSetDlgItemText(dcd->hwndClient,DIR_TOTALS,s); 1176 1174 1177 commafmt(tf,sizeof(tf),dcd->selectedfiles); 1175 if(dcd->selectedbytes > 1024) 1176 commafmt(tb,sizeof(tb),dcd->selectedbytes / 1024L); 1177 else 1178 commafmt(tb,sizeof(tb),dcd->selectedbytes); 1179 sprintf(s,"%s / %s%s",tf,tb,(dcd->selectedbytes > 1024) ? "k" : "b"); 1178 CommaFmtULL(tb,sizeof(tb),dcd->selectedbytes,' '); 1179 sprintf(s,"%s / %s",tf,tb); 1180 1180 WinSetDlgItemText(dcd->hwndClient,DIR_SELECTED,s); 1181 1181 1182 if(hwndStatus && 1182 1183 dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent)) { … … 1222 1223 p = pci->pszFileName; 1223 1224 } 1224 commafmt(tb,sizeof(tb),pci->cbFile + pci->easize);1225 CommaFmtULL(tb,sizeof(tb),pci->cbFile + pci->easize,' '); 1225 1226 if(!fMoreButtons) 1226 sprintf(s," %sb %04u/%02u/%02u %02u:%02u:%02u [%s] %s", 1227 { 1228 sprintf(s," %s %04u/%02u/%02u %02u:%02u:%02u [%s] %s", 1227 1229 tb,pci->date.year,pci->date.month, 1228 1230 pci->date.day,pci->time.hours,pci->time.minutes, 1229 1231 pci->time.seconds,pci->pszDispAttr,p); 1230 else { 1231 *tf = 0; 1232 } 1233 else 1234 { 1232 1235 if(pci->cbFile + pci->easize > 1024) 1233 commafmt(tf,sizeof(tf), 1234 (pci->cbFile + pci->easize) / 1024); 1236 CommaFmtULL(tf,sizeof(tf),pci->cbFile + pci->easize, 'K'); 1237 else 1238 *tf = 0; 1235 1239 sprintf(s,GetPString(IDS_STATUSSIZETEXT), 1236 1240 tb, 1237 (*tf)? " (" : NullStr,1241 *tf ? " (" : NullStr, 1238 1242 tf, 1239 (*tf) ? "k)" : NullStr);1243 *tf ? ")" : NullStr); 1240 1244 } 1241 1245 WinSetWindowText(hwndStatus2,s); … … 1755 1759 dcd->suspendview = 1; 1756 1760 RemoveAll(hwnd, 1757 &dcd-> totalbytes,1761 &dcd->ullTotalBytes, 1758 1762 &dcd->totalfiles); 1759 1763 dcd->suspendview = 0; … … 1778 1782 MPVOID, 1779 1783 MPFROM2SHORT(0,CMA_FREE | CMA_INVALIDATE)); 1780 dcd-> totalbytes = dcd->selectedbytes = dcd->selectedfiles =1784 dcd->ullTotalBytes = dcd->selectedbytes = dcd->selectedfiles = 1781 1785 dcd->totalfiles = 0L; 1782 1786 PostMsg(hwnd, … … 2569 2573 dcd->selectedfiles--; 2570 2574 } 2571 if(!dcd->suspendview) { 2575 if(!dcd->suspendview) 2576 { 2572 2577 commafmt(tf,sizeof(tf),dcd->selectedfiles); 2573 if(dcd->selectedbytes > 1024) 2574 commafmt(tb,sizeof(tb),dcd->selectedbytes / 1024L); 2575 else 2576 commafmt(tb,sizeof(tb),dcd->selectedbytes); 2577 sprintf(s,"%s / %s%s",tf,tb, 2578 (dcd->selectedbytes > 1024) ? "k" : "b"); 2578 CommaFmtULL(tb,sizeof(tb),dcd->selectedbytes,' '); 2579 sprintf(s,"%s / %s",tf,tb); 2579 2580 WinSetDlgItemText(dcd->hwndClient,DIR_SELECTED,s); 2580 2581 } … … 2599 2600 p = pci->pszFileName; 2600 2601 } 2601 commafmt(tb,sizeof(tb),pci->cbFile + pci->easize);2602 CommaFmtULL(tb,sizeof(tb),pci->cbFile + pci->easize,' '); 2602 2603 if(!fMoreButtons) 2603 sprintf(s," %s b%04u/%02u/%02u %02u:%02u:%02u [%s] %s",2604 sprintf(s," %s %04u/%02u/%02u %02u:%02u:%02u [%s] %s", 2604 2605 tb,pci->date.year, 2605 2606 pci->date.month,pci->date.day,pci->time.hours, 2606 2607 pci->time.minutes,pci->time.seconds, 2607 2608 pci->pszDispAttr,p); 2608 else { 2609 *tf = 0; 2610 if(pci->cbFile + pci->easize > 1024) 2611 commafmt(tf,sizeof(tf), 2612 (pci->cbFile + pci->easize) / 1024); 2609 else 2610 { 2611 if (pci->cbFile + pci->easize > 1024) 2612 CommaFmtULL(tf,sizeof(tf),pci->cbFile + pci->easize, ' '); 2613 else 2614 *tf = 0; 2613 2615 sprintf(s,GetPString(IDS_STATUSSIZETEXT), 2614 2616 tb, 2615 (*tf)? " (" : NullStr,2617 *tf ? " (" : NullStr, 2616 2618 tf, 2617 (*tf) ? "k)" : NullStr);2619 *tf ? ")" : NullStr); 2618 2620 } 2619 2621 WinSetWindowText(hwndStatus2,s); … … 2778 2780 2779 2781 2780 HWND StartCollector (HWND hwndParent,INT flags) {2781 2782 HWND StartCollector (HWND hwndParent,INT flags) 2783 { 2782 2784 HWND hwndFrame = (HWND)0,hwndClient; 2783 2785 ULONG FrameFlags = FCF_TITLEBAR | FCF_SYSMENU |
Note:
See TracChangeset
for help on using the changeset viewer.