Changeset 150
- Timestamp:
- May 26, 2005, 3:58:27 AM (20 years ago)
- File:
-
- 1 edited
-
trunk/dll/dircnrs.c (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/dircnrs.c
r145 r150 7 7 8 8 Copyright (c) 1993-98 M. Kimes 9 Copyright (c) 2001, 2005 Steven H. Levine9 Copyright (c) 2001, 2005 Steven H. Levine 10 10 11 11 16 Oct 02 SHL Handle large partitions … … 13 13 23 May 05 SHL Use QWL_USER 14 14 24 May 05 SHL Rework Win_Error usage 15 25 May 05 SHL Use ULONGLONG and CommaFmtULL 15 16 16 17 ***********************************************************************/ … … 20 21 #define INCL_GPI 21 22 #define INCL_DOSERRORS 23 #define INCL_LONGLONG 22 24 23 25 #include <os2.h> … … 630 632 631 633 632 MRESULT EXPENTRY DirObjWndProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {633 634 MRESULT EXPENTRY DirObjWndProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) 635 { 634 636 DIRCNRDATA *dcd; 635 637 … … 699 701 700 702 FSALLOCATE fsa; 701 CHAR s[CCHMAXPATH * 2],tf[81],tb[81], fbytes[81];703 CHAR s[CCHMAXPATH * 2],tf[81],tb[81],szBuf[81]; 702 704 703 705 DosError(FERR_DISABLEHARDERR); 704 706 if(!DosQueryFSInfo(toupper(*dcd->directory) - '@', 705 707 FSIL_ALLOC,&fsa,sizeof(FSALLOCATE))) { 706 strcpy( fbytes," {");707 commafmt(fbytes + 3,sizeof(fbytes) - 5,708 (ULONG)(((float)fsa.cUnitAvail *709 (fsa.cSectorUnit * fsa.cbSector)) / 1024L));710 strcat( fbytes,GetPString(IDS_KFREETEXT));711 strcat( fbytes,"}");708 strcpy(szBuf," {"); 709 CommaFmtULL(szBuf + 3,sizeof(szBuf) - 5, 710 (ULONGLONG)fsa.cUnitAvail * (fsa.cSectorUnit * fsa.cbSector), 711 'K'); 712 strcat(szBuf,GetPString(IDS_KFREETEXT)); 713 strcat(szBuf,"}"); 712 714 } 713 715 else 714 * fbytes= 0;716 *szBuf = 0; 715 717 commafmt(tf,sizeof(tf),dcd->totalfiles); 716 commafmt(tb,sizeof(tb),dcd->totalbytes);718 CommaFmtULL(tb,sizeof(tb),dcd->ullTotalBytes,' '); 717 719 if(!fMoreButtons) 718 720 sprintf(s," [%s / %sb]%s%s%s%s %s",tf,tb, 719 fbytes,721 szBuf, 720 722 (*dcd->mask.szMask || dcd->mask.antiattr || 721 723 dcd->mask.attrFile != ALLATTRS) ? " (" : NullStr, … … 728 730 dcd->directory); 729 731 else 730 sprintf(s," [%s / %sb]%s %s",tf,tb, fbytes,732 sprintf(s," [%s / %sb]%s %s",tf,tb,szBuf, 731 733 dcd->directory); 732 734 if(dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent)) … … 810 812 dcd->directory, 811 813 dcd); 812 dcd-> totalbytes = dcd->totalfiles =814 dcd->ullTotalBytes = dcd->totalfiles = 813 815 dcd->selectedfiles = dcd->selectedbytes = 0; 814 816 WinSetDlgItemText(dcd->hwndClient, … … 844 846 } 845 847 dcd->firsttree = FALSE; 846 dcd->totalbytes = FillDirCnr(dcd->hwndCnr, 847 dcd->directory, 848 dcd); 848 // fixme to check errors 849 FillDirCnr(dcd->hwndCnr, 850 dcd->directory, 851 dcd, 852 &dcd->ullTotalBytes); 849 853 PostMsg(dcd->hwndCnr, 850 854 UM_RESCAN, … … 1258 1262 case '\n': 1259 1263 dcd->lasttime = 0; 1260 *dcd-> comnam= 0;1264 *dcd->szCommonName = 0; 1261 1265 break; 1262 1266 default: 1263 1267 thistime = WinQueryMsgTime(WinQueryAnchorBlock(hwnd)); 1264 1268 if(thistime > dcd->lasttime + 1250) 1265 *dcd-> comnam= 0;1269 *dcd->szCommonName = 0; 1266 1270 dcd->lasttime = thistime; 1267 if(SHORT1FROMMP(mp2) == ' ' && !dcd-> comnam)1271 if(SHORT1FROMMP(mp2) == ' ' && !dcd->szCommonName) 1268 1272 break; 1269 1273 KbdRetry: 1270 len = strlen(dcd-> comnam);1274 len = strlen(dcd->szCommonName); 1271 1275 if(len >= CCHMAXPATH - 1) { 1272 *dcd-> comnam= 0;1276 *dcd->szCommonName = 0; 1273 1277 len = 0; 1274 1278 } 1275 dcd-> comnam[len] = toupper(SHORT1FROMMP(mp2));1276 dcd-> comnam[len + 1] = 0;1279 dcd->szCommonName[len] = toupper(SHORT1FROMMP(mp2)); 1280 dcd->szCommonName[len + 1] = 0; 1277 1281 memset(&srch,0,sizeof(SEARCHSTRING)); 1278 1282 srch.cb = (ULONG)sizeof(SEARCHSTRING); 1279 srch.pszSearch = (PSZ)dcd-> comnam;1283 srch.pszSearch = (PSZ)dcd->szCommonName; 1280 1284 srch.fsPrefix = TRUE; 1281 1285 srch.fsCaseSensitive = FALSE; … … 1288 1292 1289 1293 /* make found item current item */ 1290 if(!stricmp(pci->pszFileName,dcd-> comnam))1294 if(!stricmp(pci->pszFileName,dcd->szCommonName)) 1291 1295 attrib |= CRA_SELECTED; 1292 1296 WinSendMsg(hwnd,CM_SETRECORDEMPHASIS,MPFROMP(pci), … … 1298 1302 else { 1299 1303 if(SHORT1FROMMP(mp2) == ' ') { 1300 dcd-> comnam[len] = 0;1304 dcd->szCommonName[len] = 0; 1301 1305 break; 1302 1306 } 1303 *dcd-> comnam= 0;1307 *dcd->szCommonName = 0; 1304 1308 dcd->lasttime = 0; 1305 1309 if(len) // retry as first letter if no match … … 1505 1509 dcd->totalfiles = cnri.cRecords; 1506 1510 commafmt(tb,sizeof(tb),dcd->totalfiles); 1507 if(dcd->totalbytes < 1024) 1508 commafmt(tf,sizeof(tf),dcd->totalbytes); 1509 else 1510 commafmt(tf,sizeof(tf),dcd->totalbytes / 1024L); 1511 sprintf(s,"%s / %s%s",tb,tf,(dcd->totalbytes < 1024) ? "b" : "k"); 1511 CommaFmtULL(tf,sizeof(tf),dcd->ullTotalBytes,'K'); 1512 sprintf(s,"%s / %s",tb,tf); 1512 1513 WinSetDlgItemText(dcd->hwndClient,DIR_TOTALS,s); 1513 1514 commafmt(tb,sizeof(tb),dcd->selectedfiles); 1514 if(dcd->selectedbytes < 1024) 1515 commafmt(tf,sizeof(tf),dcd->selectedbytes); 1516 else 1517 commafmt(tf,sizeof(tf),dcd->selectedbytes / 1024L); 1518 sprintf(s,"%s / %s%s",tb,tf,(dcd->selectedbytes < 1024) ? "b" : "k"); 1515 CommaFmtULL(tf,sizeof(tf),dcd->selectedbytes,'K'); 1516 sprintf(s,"%s / %s",tb,tf); 1519 1517 WinSetDlgItemText(dcd->hwndClient,DIR_SELECTED,s); 1520 1518 if(hwndStatus && … … 1531 1529 MPFROMLONG(CMA_FIRST), 1532 1530 MPFROMSHORT(CRA_CURSORED)); 1533 if(pci && (INT)pci != -1) { 1534 if(fSplitStatus && 1535 hwndStatus2) { 1536 commafmt(tb,sizeof(tb),pci->cbFile + pci->easize); 1531 if(pci && (INT)pci != -1) 1532 { 1533 if(fSplitStatus && hwndStatus2) 1534 { 1535 CommaFmtULL(tb,sizeof(tb),pci->cbFile + pci->easize,' '); 1537 1536 if(!fMoreButtons) 1538 1537 sprintf(s, … … 1549 1548 else { 1550 1549 *tf = 0; 1551 if(pci->cbFile + pci->easize > 1024) 1552 commafmt(tf,sizeof(tf), 1553 (pci->cbFile + pci->easize) / 1024); 1550 if (pci->cbFile + pci->easize > 1024) 1551 { 1552 CommaFmtULL(tf,sizeof(tf), 1553 pci->cbFile + pci->easize,'K'); 1554 } 1554 1555 sprintf(s, 1555 1556 GetPString(IDS_STATUSSIZETEXT), 1556 1557 tb, 1557 (*tf)? " (" : NullStr,1558 *tf ? " (" : NullStr, 1558 1559 tf, 1559 (*tf) ? "k)" : NullStr);1560 *tf ? ")" : NullStr); 1560 1561 } 1561 1562 WinSetWindowText(hwndStatus2,s); … … 3439 3440 PNOTIFYRECORDEMPHASIS pre = mp2; 3440 3441 PCNRITEM pci; 3441 CHAR s[CCHMAXPATHCOMP + 91],tb[81],tf[81], 3442 *tbk; 3442 CHAR s[CCHMAXPATHCOMP + 91],tb[81],tf[81]; 3443 3443 3444 3444 pci = (PCNRITEM)((pre) ? pre->pRecord : NULL); … … 3467 3467 dcd->selectedfiles--; 3468 3468 } 3469 if(!dcd->suspendview) { 3469 if(!dcd->suspendview) 3470 { 3470 3471 commafmt(tf,sizeof(tf),dcd->selectedfiles); 3471 if(dcd->selectedbytes > 1024) { 3472 tbk = "k"; 3473 commafmt(tb,sizeof(tb),dcd->selectedbytes / 1024L); 3474 } 3475 else { 3476 tbk = "b"; 3477 commafmt(tb,sizeof(tb),dcd->selectedbytes); 3478 } 3479 sprintf(s,"%s / %s%s",tf,tb,tbk); 3472 CommaFmtULL(tb,sizeof(tb),dcd->selectedbytes,'K'); 3473 sprintf(s,"%s / %s",tf,tb); 3480 3474 WinSetDlgItemText(dcd->hwndClient,DIR_SELECTED,s); 3481 3475 } … … 3500 3494 if(pre->fEmphasisMask & CRA_CURSORED) { 3501 3495 if(pci->rc.flRecordAttr & CRA_CURSORED) { 3502 if(fSplitStatus && hwndStatus2) { 3503 commafmt(tb,sizeof(tb),pci->cbFile + pci->easize); 3496 if(fSplitStatus && hwndStatus2) 3497 { 3498 CommaFmtULL(tb,sizeof(tb),pci->cbFile + pci->easize,' '); 3504 3499 if(!fMoreButtons) 3500 { 3505 3501 sprintf(s," %sb %04u/%02u/%02u %02u:%02u:%02u [%s] %s", 3506 3502 tb,pci->date.year, … … 3508 3504 pci->time.minutes,pci->time.seconds, 3509 3505 pci->pszDispAttr,pci->pszFileName); 3506 } 3510 3507 else { 3511 3508 *tf = 0; 3512 3509 if(pci->cbFile + pci->easize > 1024) 3513 commafmt(tf,sizeof(tf), 3514 (pci->cbFile + pci->easize) / 1024); 3510 { 3511 CommaFmtULL(tf,sizeof(tf), 3512 pci->cbFile + pci->easize,'K'); 3513 } 3515 3514 sprintf(s,GetPString(IDS_STATUSSIZETEXT), 3516 3515 tb, 3517 (*tf)? " (" : NullStr,3516 *tf ? " (" : NullStr, 3518 3517 tf, 3519 (*tf) ? "k)" : NullStr);3518 *tf ? ")" : NullStr); 3520 3519 } 3521 3520 WinSetWindowText(hwndStatus2,s);
Note:
See TracChangeset
for help on using the changeset viewer.
