Changeset 751
- Timestamp:
- Aug 2, 2007, 11:05:48 PM (13 years ago)
- Location:
- trunk/dll
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/arccnrs.c
r740 r751 40 40 10 Jun 07 GKY Add CheckPmDrgLimit including IsFm2Window as part of work around PM drag limit 41 41 16 Jun 07 SHL Use DosQueryAppType not DosQAppType 42 02 Aug 07 SHL Sync with ARCITEM mods 42 43 43 44 ***********************************************************************/ … … 60 61 #include <limits.h> 61 62 #include <process.h> // _beginthread 63 #include <malloc.h> // _heapchk 62 64 63 65 #include "fm3dll.h" … … 307 309 } 308 310 311 /** 312 * Free storage associated with archive container item 313 * Caller is responsible for correcting pointers 314 */ 315 316 static VOID FreeArcItemData(PARCITEM pai) 317 { 318 // DbgMsg(pszSrcFile, __LINE__, "FreeArcItemData %p", pai); 319 320 if (pai->pszFileName && pai->pszFileName != NullStr) 321 xfree(pai->pszFileName); 322 } 323 324 /** 325 * Remove item from archive container and free associated storage if requested 326 */ 327 328 static VOID RemoveArcItems(HWND hwnd, PARCITEM pai, USHORT usCnt, USHORT usFlags) 329 { 330 if (usCnt == 0) { 331 if (pai != NULL) 332 Runtime_Error(pszSrcFile, __LINE__, "pai not NULL"); 333 else { 334 for (;;) { 335 pai = (PARCITEM)WinSendMsg(hwnd, CM_QUERYRECORD, MPVOID, 336 MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); 337 if (!pai) 338 break; 339 else if ((INT)pai == -1) { 340 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,"CM_QUERYRECORD"); 341 break; 342 } 343 else 344 RemoveArcItems(hwnd, pai, 1, usFlags); 345 } 346 } 347 } 348 else if (usCnt != 1) 349 Runtime_Error(pszSrcFile, __LINE__, "count not 1"); 350 else { 351 // DbgMsg(pszSrcFile, __LINE__, "RemoveArcItems %p %u %s", pai, usCnt, pai->pszFileName); 352 353 if (usFlags & CMA_FREE) 354 FreeArcItemData(pai); 355 356 if ((INT)WinSendMsg(hwnd, CM_REMOVERECORD, MPFROMP(&pai), MPFROM2SHORT(usCnt, usFlags)) == -1) { 357 // Win_Error2(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,IDS_CMREMOVEERRTEXT); 358 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,"CM_REMOVERECORD hwnd %x pai %p", hwnd, pai); 359 } 360 } 361 } 362 363 /** 364 * Empty all records from an archive container and free associated storage and 365 * Free up field infos 366 */ 367 368 static VOID EmptyArcCnr(HWND hwnd) 369 { 370 #if 1 // fixme to disable or to be configurable 371 { 372 int state = _heapchk(); 373 if (state != _HEAPOK) 374 Runtime_Error(pszSrcFile, __LINE__, "heap corrupted %d", state); 375 } 376 #endif 377 378 // Remove all ARCITEM records 379 RemoveArcItems(hwnd, NULL, 0, CMA_FREE); 380 381 // Use common code to remove rest 382 EmptyCnr(hwnd); 383 } 384 309 385 //== FillArcCnr() generate archive content list and fill container window == 310 386 … … 359 435 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 360 436 else { 361 WinSendMsg(hwndCnr, 362 CM_REMOVERECORD, 363 MPVOID, 364 MPFROM2SHORT(0, CMA_FREE | CMA_INVALIDATE | CMA_ERASE)); 437 RemoveArcItems(hwndCnr, NULL, 0, CMA_FREE | CMA_INVALIDATE | CMA_ERASE); 365 438 *arcinfo = info; 366 439 highest = info->osizepos; … … 3215 3288 WinDestroyWindow(ArcCnrMenu); 3216 3289 ArcMenu = ArcCnrMenu = (HWND) 0; 3217 Empty Cnr(hwnd);3290 EmptyArcCnr(hwnd); 3218 3291 break; 3219 3292 } -
trunk/dll/collect.c
r750 r751 37 37 10 Jun 07 GKY Add CheckPmDrgLimit including IsFm2Window as part of work around PM drag limit 38 38 05 Jul 07 SHL CollectorCnrWndProc: just warn if busy 39 02 Aug 07 SHL Minor clean up39 02 Aug 07 SHL Sync with CNRITEM mods 40 40 41 41 ***********************************************************************/ … … 609 609 else 610 610 pciFirst = pci; 611 WinSendMsg(hwnd, CM_FREERECORD, MPFROMP(&pciT), MPFROMSHORT(1));611 FreeCnrItem(hwnd, pciT); 612 612 ulMaxFiles--; 613 613 } … … 1658 1658 MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); 1659 1659 if (pci && (INT) pci != -1) { 1660 WinSendMsg(hwnd, 1661 CM_REMOVERECORD, 1662 MPVOID, MPFROM2SHORT(0, CMA_FREE | CMA_INVALIDATE)); 1660 RemoveCnrItems(hwnd, NULL, 0, CMA_FREE | CMA_INVALIDATE); 1663 1661 dcd->ullTotalBytes = dcd->selectedbytes = dcd->selectedfiles = 1664 1662 dcd->totalfiles = 0; … … 2561 2559 } 2562 2560 else 2563 WinSendMsg(hwnd, 2564 CM_REMOVERECORD, 2565 MPFROMP(&pci), 2566 MPFROM2SHORT(1, 2567 CMA_FREE | CMA_INVALIDATE | CMA_ERASE)); 2561 RemoveCnrItems(hwnd, pci, 1, CMA_FREE | CMA_INVALIDATE | CMA_ERASE); 2568 2562 } 2569 2563 } -
trunk/dll/common.c
r593 r751 7 7 8 8 Copyright (c) 1993, 1998 M. Kimes 9 Copyright (c) 2001, 200 6Steven H. Levine9 Copyright (c) 2001, 2007 Steven H. Levine 10 10 11 11 13 Aug 05 SHL Renames … … 17 17 22 Mar 07 GKY Use QWL_USER 18 18 30 Mar 07 GKY Remove GetPString for window class names 19 02 Aug 07 SHL Sync with CNRITEM mods 19 20 20 21 ***********************************************************************/ … … 742 743 else if (mp2) { 743 744 if ((INT) mp1 == -1) { 744 745 745 PCNRITEM pci = (PCNRITEM) mp2; 746 747 WinSendMsg(hwnd, 748 CM_REMOVERECORD, 749 MPFROMP(&pci), 750 MPFROM2SHORT(1, CMA_FREE | CMA_INVALIDATE)); 746 RemoveCnrItems(hwnd, pci, 1, CMA_FREE | CMA_INVALIDATE); 751 747 } 752 748 else { -
trunk/dll/comp.c
r748 r751 431 431 432 432 if (!*pciD->pszFileName) { 433 // Other side is blank 434 WinSendMsg(hwndCnrS, CM_REMOVERECORD, MPFROMP(&pci), 435 MPFROM2SHORT(1, CMA_FREE | CMA_INVALIDATE)); 433 // Other side is blank - remove from both sides 434 RemoveCnrItems(hwndCnrS, pci, 1, CMA_FREE | CMA_INVALIDATE); 436 435 if (pciD->rc.flRecordAttr & CRA_SELECTED) 437 436 WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciD), 438 437 MPFROM2SHORT(FALSE, CRA_SELECTED)); 439 WinSendMsg(hwndCnrD, CM_REMOVERECORD, MPFROMP(&pciD), 440 MPFROM2SHORT(1, CMA_FREE | CMA_INVALIDATE)); 438 RemoveCnrItems(hwndCnrD, pciD, 1, CMA_FREE | CMA_INVALIDATE); 441 439 } 442 440 else { 443 // Other side is not blank 441 // Other side is not blank - update just this side 444 442 FreeCnrItemData(pci); 443 pci->pszFileName = NullStr; 444 pci->pszDisplayName = pci->pszFileName; 445 pci->rc.pszIcon = pci->pszFileName; 446 pci->pszLongname = NullStr; 447 pci->pszSubject = NullStr; 445 448 pci->flags = 0; 446 449 WinSendMsg(hwndCnrS, CM_INVALIDATERECORD, MPFROMP(&pci), … … 457 460 case IDM_MOVE: 458 461 if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR)) 459 sprintf(newname, "%s%s%s", cmp->leftdir, 460 cmp->leftdir[strlen(cmp->leftdir) - 1] == 461 '\\' ? NullStr : "\\", pci->pszFileName); 462 // 02 Aug 07 SHL fixme to replace this kind of stuff with _makepath or equivalent 463 sprintf(newname, "%s%s%s", 464 cmp->leftdir, 465 cmp->leftdir[strlen(cmp->leftdir) - 1] == '\\' ? 466 NullStr : "\\", 467 pci->pszDisplayName); 462 468 else 463 sprintf(newname, "%s%s%s", cmp->rightdir, 464 cmp->rightdir[strlen(cmp->rightdir) - 1] == 465 '\\' ? NullStr : "\\", pci->pszFileName); 469 sprintf(newname, "%s%s%s", 470 cmp->rightdir, 471 cmp->rightdir[strlen(cmp->rightdir) - 1] == '\\' ? 472 NullStr : "\\", 473 pci->pszDisplayName); 466 474 // Make directory if required 467 475 strcpy(dirname, newname); … … 486 494 pciD->pszDisplayName = pciD->pszFileName + strlen(cmp->leftdir); 487 495 if (cmp->leftdir[strlen(cmp->leftdir) - 1] != '\\') 488 pciD->psz FileName++;496 pciD->pszDisplayName++; 489 497 } 490 498 else { 491 499 pciD->pszDisplayName = pciD->pszFileName + strlen(cmp->rightdir); 492 500 if (cmp->rightdir[strlen(cmp->rightdir) - 1] != '\\') 493 pciD->pszFileName++; 494 } 495 strcpy(pciD->szDispAttr, pci->szDispAttr); 501 pciD->pszDisplayName++; 502 } 503 // 02 Aug 07 SHL fixme to know Longname transfer is correct? 504 pciD->pszLongname = pci->pszLongname; 505 if (pciD->pszSubject != NullStr) { 506 xfree(pciD->pszSubject); 507 pciD->pszSubject = NullStr; 508 } 496 509 pciD->attrFile = pci->attrFile; 510 pciD->pszDispAttr = pci->pszDispAttr; 497 511 pciD->flags = 0; 498 512 pciD->date = pci->date; … … 504 518 pciD->cbFile = pci->cbFile; 505 519 pciD->easize = pci->easize; 506 pciD->pszSubject = NullStr; 507 pci->pszFileName = NullStr; 520 521 if (pci->pszFileName != NullStr) { 522 xfree(pci->pszFileName); 523 pci->pszFileName = NullStr; 524 pci->pszDisplayName = pci->pszFileName; 525 pci->rc.pszIcon = pci->pszFileName; 526 } 527 if (pci->pszSubject != NullStr) { 528 xfree(pci->pszSubject); 529 pci->pszSubject = NullStr; 530 } 508 531 pci->flags = 0; 532 509 533 WinSendMsg(hwndCnrS, CM_INVALIDATERECORD, MPFROMP(&pci), 510 534 MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED)); … … 527 551 case IDM_COPY: 528 552 if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR)) 529 sprintf(newname, "%s%s%s", cmp->leftdir, 530 cmp->leftdir[strlen(cmp->leftdir) - 1] == 531 '\\' ? NullStr : "\\", pci->pszFileName); 553 sprintf(newname, "%s%s%s", 554 cmp->leftdir, 555 cmp->leftdir[strlen(cmp->leftdir) - 1] == '\\' ? 556 NullStr : "\\", 557 pci->pszDisplayName); 532 558 else 533 sprintf(newname, "%s%s%s", cmp->rightdir, 534 cmp->rightdir[strlen(cmp->rightdir) - 1] == 535 '\\' ? NullStr : "\\", pci->pszFileName); 559 sprintf(newname, "%s%s%s", 560 cmp->rightdir, 561 cmp->rightdir[strlen(cmp->rightdir) - 1] == '\\' ? 562 NullStr : "\\", 563 pci->pszDisplayName); 536 564 // Make directory if required 537 565 strcpy(dirname, newname); … … 564 592 FreeCnrItemData(pciD); 565 593 pciD->pszFileName = xstrdup(newname, pszSrcFile, __LINE__); 594 pciD->pszLongname = NullStr; 595 pciD->pszSubject = NullStr; 566 596 if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR)) { 567 597 pciD->pszDisplayName = pciD->pszFileName + strlen(cmp->leftdir); 568 598 if (cmp->leftdir[strlen(cmp->leftdir) - 1] != '\\') 569 pciD->psz FileName++;599 pciD->pszDisplayName++; 570 600 } 571 601 else { 572 602 pciD->pszDisplayName = pciD->pszFileName + strlen(cmp->rightdir); 573 603 if (cmp->rightdir[strlen(cmp->rightdir) - 1] != '\\') 574 pciD->pszFileName++; 575 } 576 strcpy(pciD->szDispAttr, pci->szDispAttr); 604 pciD->pszDisplayName++; 605 } 577 606 pciD->attrFile = pci->attrFile; 607 pciD->pszDispAttr = pci->pszDispAttr; 578 608 pciD->flags = CNRITEM_EXISTS; 579 609 pciD->date = pci->date; … … 585 615 pciD->cbFile = pci->cbFile; 586 616 pciD->easize = pci->easize; 587 pci->pszSubject = NullStr; 588 pci->pszLongname = NullStr; 617 618 // 02 Aug 07 SHL fixme to know why subject cleared? 619 if (pci->pszSubject != NullStr) { 620 xfree(pci->pszSubject); 621 pci->pszSubject = NullStr; 622 } 623 // 02 Aug 07 SHL fixme to know why - should already be set? 589 624 pci->flags = CNRITEM_EXISTS; 625 590 626 WinSendMsg(hwndCnrS, CM_INVALIDATERECORD, MPFROMP(&pci), 591 627 MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED)); … … 771 807 //=== FillCnrsThread() Fill left and right containers === 772 808 773 static VOID FillCnrsThread(VOID * 809 static VOID FillCnrsThread(VOID *args) 774 810 { 775 811 COMPARE *cmp = (COMPARE *) args; … … 777 813 HMQ hmq; 778 814 BOOL notified = FALSE; 779 const PSZ attrstring = "RHS\0DA"; 815 780 816 HWND hwndLeft, hwndRight; 781 817 CHAR szBuf[CCHMAXPATH]; … … 801 837 INT l; 802 838 INT r; 803 INT y;804 UINT i;805 839 ULONG cntr; 806 840 FILELIST **filesl = NULL; … … 817 851 PCNRITEM pcil; 818 852 PCNRITEM pcir; 819 PCNRITEM pcit;820 853 RECORDINSERT ri; 821 854 CHAR *pch; … … 833 866 priority_normal(); 834 867 // Clear containers 835 WinSendMsg(hwndRight, CM_REMOVERECORD, 836 MPVOID, MPFROM2SHORT(0, CMA_FREE | CMA_INVALIDATE)); 837 WinSendMsg(hwndLeft, CM_REMOVERECORD, 838 MPVOID, MPFROM2SHORT(0, CMA_FREE | CMA_INVALIDATE)); 868 RemoveCnrItems(hwndRight, NULL, 0, CMA_FREE | CMA_INVALIDATE); 869 RemoveCnrItems(hwndLeft, NULL, 0, CMA_FREE | CMA_INVALIDATE); 839 870 cmp->cmp->totalleft = cmp->cmp->totalright = 0; 840 871 … … 1026 1057 pcilFirst = WinSendMsg(hwndLeft, 1027 1058 CM_ALLOCRECORD, 1028 MPFROMLONG(EXTRA_RECORD_BYTES 2),1059 MPFROMLONG(EXTRA_RECORD_BYTES), 1029 1060 MPFROMLONG(recsNeeded)); 1030 1061 if (!pcilFirst) { … … 1036 1067 if (recsNeeded) { 1037 1068 pcirFirst = WinSendMsg(hwndRight, CM_ALLOCRECORD, 1038 MPFROMLONG(EXTRA_RECORD_BYTES 2),1069 MPFROMLONG(EXTRA_RECORD_BYTES), 1039 1070 MPFROMLONG(recsNeeded)); 1040 1071 if (!pcirFirst) { … … 1042 1073 recsNeeded); 1043 1074 recsNeeded = 0; 1044 pcil = pcilFirst; 1045 while (pcil) { 1046 pcit = (PCNRITEM) pcil->rc.preccNextRecord; 1047 WinSendMsg(hwndLeft, CM_FREERECORD, 1048 MPFROMP(&pcil), MPFROMSHORT(1)); 1049 pcil = pcit; 1050 } 1075 FreeCnrItemList(hwndLeft, pcilFirst); 1051 1076 } 1052 1077 } … … 1059 1084 pcir->hwndCnr = hwndRight; 1060 1085 pcir->rc.hptrIcon = (HPOINTER) 0; 1061 pcir->pszDispAttr = pcir->szDispAttr;1062 1063 1086 pcil->hwndCnr = hwndLeft; 1064 1087 pcil->rc.hptrIcon = (HPOINTER) 0; 1065 pcil->pszDispAttr = pcil->szDispAttr;1066 1088 1067 1089 if (filesl && filesl[l]) { … … 1082 1104 pcil->pszDisplayName = pcil->pszFileName + lenl; 1083 1105 pcil->attrFile = filesl[l]->attrFile; 1084 y = 0; 1085 for (i = 0; i < 6; i++) { 1086 if (attrstring[i]) { 1087 pcil->szDispAttr[y++] = (CHAR)(pcil->attrFile & (1 << i) ? 1088 attrstring[i] : '-'); 1089 } 1090 } 1091 pcil->szDispAttr[5] = 0; 1106 pcil->pszDispAttr = FileAttrToString(pcil->attrFile); 1092 1107 pcil->cbFile = filesl[l]->cbFile; 1093 1108 pcil->easize = filesl[l]->easize; … … 1128 1143 pcir->attrFile = filesr[r]->attrFile; 1129 1144 // pcir->rc.hptrIcon = hptrFile; 1130 y = 0; 1131 for (i = 0; i < 6; i++) { 1132 if (attrstring[i]) { 1133 pcir->szDispAttr[y++] = (CHAR)(pcir->attrFile & (1 << i) ? 1134 attrstring[i] : '-'); 1135 } 1136 } 1137 pcir->szDispAttr[5] = 0; 1145 pcir->pszDispAttr = FileAttrToString(pcir->attrFile); 1138 1146 pcir->cbFile = filesr[r]->cbFile; 1139 1147 pcir->easize = filesr[r]->easize; … … 1227 1235 pch += 5; 1228 1236 } 1229 *pch = 0; // fixme to be gone? 1230 // fixme to known why not displayed - defect? 1231 pcil->pszSubject = *szBuf ? strdup(szBuf) : NullStr; 1237 // fixme to know why not displayed - defect? 1238 pcil->pszSubject = *szBuf ? 1239 xstrdup(szBuf, pszSrcFile, __LINE__) : 1240 NullStr; 1232 1241 1233 1242 } // if on both sides … … 1596 1605 } 1597 1606 1598 pcil->rc.pszIcon = pcil->pszFileName; // fixme to be pszDisplayName? 1599 pcir->rc.pszIcon = pcir->pszFileName; 1600 pcil->pszLongname = pcil->pszFileName; 1601 pcir->pszLongname = pcir->pszFileName; 1607 pcil->rc.pszIcon = pcil->pszDisplayName; 1608 pcir->rc.pszIcon = pcir->pszDisplayName; 1609 1610 pcil->pszLongname = NullStr; 1611 pcir->pszLongname = NullStr; 1602 1612 1603 1613 if (!pcil->pszSubject) … … 1605 1615 if (!pcir->pszSubject) 1606 1616 pcil->pszSubject = NullStr; 1617 1618 if (!pcil->pszDispAttr) 1619 pcil->pszDispAttr = NullStr; 1620 if (!pcir->pszDispAttr) 1621 pcil->pszDispAttr = NullStr; 1607 1622 1608 1623 // fixme to be time based - every 2 sec should be OK … … 1638 1653 MPFROMP(pcilFirst), MPFROMP(&ri))) { 1639 1654 Win_Error(hwndLeft, cmp->hwnd, pszSrcFile, __LINE__, "CM_INSERTRECORD"); 1640 pcil = pcilFirst; 1641 while (pcil) { 1642 pcit = (PCNRITEM) pcil->rc.preccNextRecord; 1643 WinSendMsg(hwndLeft, CM_FREERECORD, 1644 MPFROMP(&pcil), MPFROMSHORT(1)); 1645 pcil = pcit; 1646 } 1655 FreeCnrItemList(hwndLeft, pcilFirst); 1647 1656 numfilesl = 0; 1648 1657 } … … 1655 1664 ri.cRecordsInsert = recsNeeded; 1656 1665 ri.fInvalidateRecord = FALSE; 1666 1657 1667 if (!WinSendMsg(hwndRight, CM_INSERTRECORD, 1658 1668 MPFROMP(pcirFirst), MPFROMP(&ri))) { 1659 Win_Error(hwndLeft, cmp->hwnd, pszSrcFile, __LINE__, "CM_INSERTRECORD"); 1660 WinSendMsg(hwndLeft, CM_REMOVERECORD, 1661 MPVOID, MPFROM2SHORT(0, CMA_FREE | CMA_INVALIDATE)); 1662 pcir = pcirFirst; 1663 while (pcir) { 1664 pcit = (PCNRITEM) pcir->rc.preccNextRecord; 1665 WinSendMsg(hwndRight, CM_FREERECORD, 1666 MPFROMP(&pcir), MPFROMSHORT(1)); 1667 pcir = pcit; 1668 } 1669 Win_Error(hwndRight, cmp->hwnd, pszSrcFile, __LINE__, "CM_INSERTRECORD"); 1670 RemoveCnrItems(hwndLeft, NULL, 0, CMA_FREE | CMA_INVALIDATE); 1671 FreeCnrItemList(hwndRight, pcirFirst); 1669 1672 numfilesr = 0; 1670 1673 } … … 1729 1732 { 1730 1733 USHORT ids[] = { COMP_LEFTDIR, COMP_RIGHTDIR, COMP_TOTALLEFT, 1731 1732 1733 };1734 registerINT x;1734 COMP_TOTALRIGHT, COMP_SELLEFT, COMP_SELRIGHT, 1735 0 1736 }; 1737 INT x; 1735 1738 1736 1739 for (x = 0; ids[x]; x++) … … 2189 2192 cnri.pszCnrTitle = cmp->leftdir; 2190 2193 cnri.flWindowAttr = CV_DETAIL | CV_MINI | 2191 CA_CONTAINERTITLE | CA_TITLESEPARATOR |2192 CA_DETAILSVIEWTITLES | CA_OWNERDRAW;2194 CA_CONTAINERTITLE | CA_TITLESEPARATOR | 2195 CA_DETAILSVIEWTITLES | CA_OWNERDRAW; 2193 2196 WinSendDlgItemMsg(hwnd, COMP_LEFTDIR, CM_SETCNRINFO, MPFROMP(&cnri), 2194 2197 MPFROMLONG(CMA_CNRTITLE | CMA_FLWINDOWATTR)); … … 2351 2354 if (ofile[strlen(ofile) - 1] != '\\') 2352 2355 strcat(ofile, "\\"); 2353 strcat(ofile, pci->psz FileName);2356 strcat(ofile, pci->pszDisplayName); 2354 2357 if (*compare) { 2355 2358 CHAR *fakelist[3]; -
trunk/dll/dircnrs.c
r730 r751 27 27 12 May 07 SHL Use dcd->ulItemsToUnHilite; sync with UnHilite arg mods 28 28 10 Jun 07 GKY Add CheckPmDrgLimit including IsFm2Window as part of work around PM drag limit 29 02 Aug 07 SHL Sync with CNRITEM mods 29 30 30 31 ***********************************************************************/ … … 736 737 WinSetWindowText(WinWindowFromID(dcd->hwndFrame, FID_TITLEBAR), s); 737 738 } 738 WinSendMsg(dcd->hwndCnr, 739 CM_REMOVERECORD, 740 MPVOID, 741 MPFROM2SHORT(0, CMA_FREE | CMA_INVALIDATE | CMA_ERASE)); 739 RemoveCnrItems(dcd->hwndCnr, NULL, 0, CMA_FREE | CMA_INVALIDATE | CMA_ERASE); 742 740 AdjustCnrColsForFSType(dcd->hwndCnr, dcd->directory, dcd); 743 741 dcd->ullTotalBytes = dcd->totalfiles = … … 3222 3220 if (!*dcd->directory || IsValidDir(dcd->directory)) { 3223 3221 NotifyError(pci->pszFileName, status); 3224 WinSendMsg(hwnd, 3225 CM_REMOVERECORD, 3226 MPFROMP(&pci), 3227 MPFROM2SHORT(1, 3228 CMA_FREE | CMA_INVALIDATE | 3229 CMA_ERASE)); 3222 RemoveCnrItems(hwnd, pci, 1, CMA_FREE | CMA_INVALIDATE | CMA_ERASE); 3230 3223 if (hwndStatus) 3231 3224 WinSetWindowText(hwndStatus, -
trunk/dll/dirsize.c
r739 r751 85 85 { 86 86 CHAR maskstr[CCHMAXPATH]; 87 CHAR szBuf[CCHMAXPATH]; 87 88 CHAR *pEndMask; 88 89 register char *p; … … 113 114 114 115 hdir = HDIR_CREATE; 115 nm = 1 L;116 nm = 1; 116 117 memset(pffb, 0, sizeof(FILEFINDBUF4)); 117 118 DosError(FERR_DISABLEHARDERR); … … 135 136 return FALSE; 136 137 } 137 pci = WinSendMsg(hwndCnr, CM_ALLOCRECORD, MPFROMLONG(EXTRA_RECORD_BYTES 2),138 MPFROMLONG(1 L));138 pci = WinSendMsg(hwndCnr, CM_ALLOCRECORD, MPFROMLONG(EXTRA_RECORD_BYTES), 139 MPFROMLONG(1)); 139 140 if (!pci) { 140 141 free(pffb); … … 148 149 DosError(FERR_DISABLEHARDERR); 149 150 pci->rc.hptrIcon = hptrDir; 150 *pci->szDispAttr = 0;151 151 pci->attrFile = 0; 152 pci->pszSubject = xstrdup(NullStr, pszSrcFile, __LINE__); 152 pci->pszDispAttr = NullStr; 153 pci->pszSubject = NullStr; 153 154 } 154 155 else { … … 163 164 164 165 if (strlen(pszFileName) < 4 || top) 165 pci->pszFileName = xstrdup(pszFileName, pszSrcFile, __LINE__);166 pci->pszFileName = xstrdup(pszFileName, pszSrcFile, __LINE__); 166 167 else { 167 168 p = strrchr(pszFileName, '\\'); … … 170 171 else 171 172 p++; // After last backslash 172 // Handle quoted names? 173 // Handle quoted names 174 // fixme to understand this - why lose path prefix? 173 175 sp = strchr(pszFileName, ' ') != NULL ? "\"" : NullStr; 174 pci->pszFileName = xmalloc(CCHMAXPATH, pszSrcFile, __LINE__); // fixme to optimize alloc 175 pp = pci->pszFileName; 176 if (*sp) { 177 *pp = *sp; // Need quotes 178 pp++; 179 *pp = 0; 180 } 176 pp = szBuf; 177 if (*sp) 178 *pp++ = *sp; // Need quotes 181 179 strcpy(pp, p); 182 180 if (*sp) 183 181 strcat(pp, sp); 184 } 185 pci->pszLongname = pci->pszFileName; 186 pci->rc.pszIcon = pci->pszLongname; 182 pci->pszFileName = xstrdup(szBuf, pszSrcFile, __LINE__); 183 } 184 // fixme to know why - it appears to be indirectly saving length, but why? 185 pci->pszDisplayName = pci->pszFileName + strlen(pci->pszFileName); 186 pci->pszLongname = pci->pszFileName; // fixme to be sure? 187 pci->rc.pszIcon = pci->pszFileName; 187 188 pci->rc.flRecordAttr |= CRA_RECORDREADONLY; 188 189 if (fForceUpper) … … 196 197 ri.pRecordParent = (PRECORDCORE) pciParent; 197 198 ri.zOrder = (USHORT) CMA_TOP; 198 ri.cRecordsInsert = 1 L;199 ri.cRecordsInsert = 1; 199 200 ri.fInvalidateRecord = TRUE; 200 201 if (!WinSendMsg(hwndCnr, CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri))) { … … 203 204 } 204 205 hdir = HDIR_CREATE; 205 nm = 1 L;206 nm = 1; 206 207 rc = DosFindFirst(maskstr, &hdir, 207 208 FILE_NORMAL | FILE_READONLY | FILE_ARCHIVED | … … 216 217 priority_normal(); 217 218 //printf("Found %lu\n",nm); 218 for (x = 0 L; x < nm; x++) {219 for (x = 0; x < nm; x++) { 219 220 pffbFile = (FILEFINDBUF4 *) fb; 220 221 //printf("%s\n",pffbFile->achName); … … 247 248 if (*pchStopFlag) 248 249 break; 249 DosSleep( 0L);250 nm = 1 L; /* FilesToGet */250 DosSleep(1); 251 nm = 1; /* FilesToGet */ 251 252 rc = DosFindNext(hdir, pffb, sizeof(FILEFINDBUF4), &nm); 252 253 } // while more found … … 276 277 277 278 float fltPct = 0.0; 279 USHORT c; 278 280 CHAR szCurDir[80]; 279 281 CHAR szSubDir[80]; … … 301 303 } 302 304 // Need unique buffer 23 Jul 07 SHL 303 305 pci->pszLongname = xmalloc(2, pszSrcFile, __LINE__); 304 306 pci->pszLongname[0] = 0; // Make null string 305 307 pci->pszLongname[1] = 1; // Flag root - hack cough … … 323 325 CommaFmtULL(szSubDir, sizeof(szSubDir), pci->easize, 'K'); 324 326 CommaFmtULL(szAllDir, sizeof(szAllDir), pci->cbFile + pci->easize, 'K'); 325 pci->pszFileName = xrealloc(pci->pszFileName, strlen(pci->pszFileName) + 100, 327 c = pci->pszDisplayName - pci->pszFileName; 328 pci->pszFileName = xrealloc(pci->pszFileName, 329 CCHMAXPATH, 326 330 pszSrcFile, 327 331 __LINE__); // 23 Jul 07 SHL 328 sprintf(pci->pszFileName + strlen(pci->pszFileName),332 sprintf(pci->pszFileName + c, 329 333 " %s + %s = %s (%.02lf%%%s)\r%s", 330 334 szCurDir, 331 335 szSubDir, 332 336 szAllDir, 333 fltPct, isroot ? GetPString(IDS_OFDRIVETEXT) : NullStr, szBar); 337 fltPct, 338 isroot ? GetPString(IDS_OFDRIVETEXT) : NullStr, 339 szBar); 340 pci->pszFileName = xrealloc(pci->pszFileName, 341 strlen(pci->pszFileName) + 1, 342 pszSrcFile, 343 __LINE__); // 23 Jul 07 SHL 344 pci->pszDisplayName = pci->pszFileName + c; 334 345 WinSendMsg(hwndCnr, 335 346 CM_INVALIDATERECORD, MPFROMP(&pci), MPFROM2SHORT(1, 0)); … … 377 388 CMA_ITEMORDER)); 378 389 while (pci && (INT) pci != -1) { 379 DosSleep( 0L);390 DosSleep(1); 380 391 PrintToFile(hwndCnr, indent + 1, pci, fp); 381 392 pci = (PCNRITEM) WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pci), … … 462 473 dirsize->pszFileName = pState->szDirName; 463 474 dirsize->hwndCnr = WinWindowFromID(hwnd, DSZ_CNR); 464 if (_beginthread(FillCnrThread, NULL, 122880L * 5 L, (PVOID)dirsize) ==475 if (_beginthread(FillCnrThread, NULL, 122880L * 5, (PVOID)dirsize) == 465 476 -1) { 466 477 Runtime_Error(pszSrcFile, __LINE__, … … 489 500 MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO))); 490 501 cnri.cyLineSpacing = 0; 491 cnri.cxTreeIndent = 12 L;502 cnri.cxTreeIndent = 12; 492 503 cnri.flWindowAttr = CV_TREE | CV_FLOW | CA_TREELINE | CA_OWNERDRAW; 493 504 WinSendDlgItemMsg(hwnd, DSZ_CNR, CM_SETCNRINFO, MPFROMP(&cnri), … … 760 771 memset(szTemp, 0, sizeof(szTemp)); 761 772 strncpy(szTemp, pci->pszFileName, 762 pci->psz FileName - pci->pszFileName);773 pci->pszDisplayName - pci->pszFileName); 763 774 strrev(szTemp); 764 775 if (*szFileName && *szTemp != '\\') … … 771 782 strrev(szFileName); 772 783 if (!fVTreeOpensWPS) 773 OpenDirCnr((HWND) 0, 774 (hwndMain) ? hwndMain : HWND_DESKTOP, 775 hwnd, FALSE, szFileName); 784 OpenDirCnr((HWND)0, 785 hwndMain ? hwndMain : HWND_DESKTOP, 786 hwnd, 787 FALSE, 788 szFileName); 776 789 else { 777 790 … … 908 921 if (pState) 909 922 pState->chStopFlag = (BYTE)0xff; 910 DosSleep(1 L);923 DosSleep(1); 911 924 break; 912 925 … … 917 930 if (pState->hptr) 918 931 WinDestroyPointer(pState->hptr); 919 DosSleep(33 L);932 DosSleep(33); 920 933 free(pState); // Let's hope no one is still looking 921 934 } -
trunk/dll/filldir.c
r745 r751 33 33 23 Jul 07 SHL Sync with CNRITEM updates (ticket#24) 34 34 29 Jul 07 SHL Add CNRITEM free and remove support (ticket#24) 35 02 Aug 07 SHL Add FileAttrToString 35 36 36 37 ***********************************************************************/ … … 47 48 #include <ctype.h> 48 49 #include <time.h> 50 #include <malloc.h> // _heapchk 49 51 50 52 #include "fm3dll.h" … … 54 56 55 57 #pragma alloc_text(FILLDIR,FillInRecordFromFFB,FillInRecordFromFSA,IDFile) 56 #pragma alloc_text(FILLDIR1,ProcessDirectory,FillDirCnr,FillTreeCnr )58 #pragma alloc_text(FILLDIR1,ProcessDirectory,FillDirCnr,FillTreeCnr,FileAttrToString) 57 59 #pragma alloc_text(EMPTYCNR,EmptyCnr) 60 61 /** 62 * Return display string given standard file attribute mask 63 * @param fileAttr attribute mask in FILEFINDBUF format 64 * @return fixed length string for display 65 */ 66 67 const PSZ FileAttrToString(ULONG fileAttr) 68 { 69 // From os2win.h 70 // FILE_ATTRIBUTE_READONLY 0x00000001 71 // FILE_ATTRIBUTE_HIDDEN 0x00000002 72 // FILE_ATTRIBUTE_SYSTEM 0x00000004 73 // 0x00000008 74 // FILE_ATTRIBUTE_DIRECTORY 0x00000010 75 // FILE_ATTRIBUTE_ARCHIVE 0x00000020 76 77 static CHAR *apszAttrString[] = { 78 // RHSDA 79 "-----", 80 "R----", 81 "-H---", 82 "RH---", 83 "--S--", 84 "R-S--", 85 "-HS--", 86 "RHS--", 87 "---D-", 88 "R--D-", 89 "-H-D-", 90 "RH-D-", 91 "--SD-", 92 "R-SD-", 93 "-HSD-", 94 "RHSD-", 95 "----A", 96 "R---A", 97 "-H--A", 98 "RH--A", 99 "--S-A", 100 "R-S-A", 101 "-HS-A", 102 "RHS-A", 103 "---DA", 104 "R--DA", 105 "-H-DA", 106 "RH-DA", 107 "--SDA", 108 "R-SDA", 109 "-HSDA", 110 "RHSDA" 111 }; 112 113 fileAttr = ((fileAttr & 0x30) >> 1) | (fileAttr & 7); // Drop don't care bit from index 114 115 return apszAttrString[fileAttr]; 116 117 } 58 118 59 119 static HPOINTER IDFile(PSZ p) … … 175 235 /* fill in a container record from a FILEFINDBUF4 structure */ 176 236 177 CHAR attrstring[] = "RHS\0DA";178 237 CHAR *p; 179 238 HPOINTER hptr; 180 UINT x;181 UINT y;182 239 183 240 pci->hwndCnr = hwndCnr; … … 194 251 if (pszDirectory[c - 1] != '\\') 195 252 c2++; 196 pci->pszFileName = xmalloc(c + c2, 197 pszSrcFile, 198 __LINE__); 253 pci->pszFileName = xmalloc(c + c2, pszSrcFile, __LINE__); 199 254 memcpy(pci->pszFileName, pszDirectory, c + 1); 200 255 p = pci->pszFileName + c - 1; … … 249 304 } 250 305 } 251 // If still need subject - fixme to just point NullStr252 306 if (!pci->pszSubject) 253 pci->pszSubject = xstrdup(NullStr, pszSrcFile, __LINE__);307 pci->pszSubject = NullStr; 254 308 255 309 /* load the object's longname */ … … 297 351 } 298 352 } 299 // If still need long name set - fixme to just point to NullStr300 353 if (!pci->pszLongname) 301 pci->pszLongname = xstrdup(NullStr, pszSrcFile, __LINE__);354 pci->pszLongname = NullStr; 302 355 303 356 /* do anything required to case of filename */ … … 385 438 pci->cbFile = pffb->cbFile; 386 439 pci->attrFile = pffb->attrFile; 387 /* build attribute string for display */ 388 y = 0; 389 for (x = 0; x < 6; x++) { 390 if (attrstring[x]) { 391 pci->szDispAttr[y++] = 392 (CHAR) ((pci->attrFile & (1 << x)) ? attrstring[x] : '-'); 393 } 394 } 395 pci->szDispAttr[5] = 0; 396 pci->pszDispAttr = pci->szDispAttr; 440 pci->pszDispAttr = FileAttrToString(pci->attrFile); 397 441 pci->rc.pszIcon = pci->pszDisplayName; 398 442 pci->rc.hptrIcon = hptr; … … 428 472 { 429 473 HPOINTER hptr; 430 CHAR attrstring[] = "RHS\0DA";431 474 CHAR *p; 432 INT x;433 INT y;434 475 435 476 /* fill in a container record from a FILESTATUS4 structure */ … … 481 522 } 482 523 } 483 // If still need subject buffer - fixme to just point to NullStr484 524 if (!pci->pszSubject) 485 pci->pszSubject = xstrdup(NullStr, pszSrcFile, __LINE__);525 pci->pszSubject = NullStr; 486 526 487 527 pci->pszLongname = 0; … … 530 570 } 531 571 } 532 // If still need long name set - fixme to just point to NullStr533 572 if (!pci->pszLongname) 534 pci->pszLongname = xstrdup(NullStr, pszSrcFile, __LINE__);573 pci->pszLongname = NullStr; 535 574 536 575 if (fForceUpper) … … 607 646 pci->cbFile = pfsa4->cbFile; 608 647 pci->attrFile = pfsa4->attrFile; 609 y = 0; 610 for (x = 0; x < 6; x++) 611 if (attrstring[x]) 612 pci->szDispAttr[y++] = (CHAR) ((pci->attrFile & (1 << x)) ? 613 attrstring[x] : '-'); 614 pci->szDispAttr[5] = 0; 615 pci->pszDispAttr = pci->szDispAttr; 648 pci->pszDispAttr = FileAttrToString(pci->attrFile); 616 649 pci->rc.pszIcon = pci->pszDisplayName; 617 650 pci->rc.hptrIcon = hptr; … … 677 710 PCNRITEM pci; 678 711 PCNRITEM pciFirst; 679 PCNRITEM pcit;680 712 RECORDINSERT ri; 681 713 PBYTE pByte; … … 802 834 ok = FALSE; 803 835 ullTotalBytes = 0; 804 if (WinIsWindow((HAB) 0, hwndCnr)) { 805 pci = pciFirst; 806 while (pci) { 807 pcit = (PCNRITEM) pci->rc.preccNextRecord; 808 WinSendMsg(hwndCnr, 809 CM_FREERECORD, 810 MPFROMP(&pci), MPFROMSHORT(1)); 811 pci = pcit; 812 } 813 } 836 if (WinIsWindow((HAB) 0, hwndCnr)) 837 FreeCnrItemList(hwndCnr, pciFirst); 814 838 } 815 839 } … … 907 931 ok = FALSE; 908 932 ullTotalBytes = 0; 909 if (WinIsWindow((HAB) 0, hwndCnr)) { 910 pci = pciFirst; 911 while (pci) { 912 pcit = (PCNRITEM) pci->rc.preccNextRecord; 913 WinSendMsg(hwndCnr, CM_FREERECORD, 914 MPFROMP(&pci), MPFROMSHORT(1)); 915 pci = pcit; 916 } 917 } 933 if (WinIsWindow((HAB) 0, hwndCnr)) 934 FreeCnrItemList(hwndCnr, pciFirst); 918 935 } 919 936 } … … 977 994 DosPostEventSem(CompactSem); 978 995 996 #if 1 // fixme to disable or to be configurable 997 { 998 int state = _heapchk(); 999 if (state != _HEAPOK) 1000 Runtime_Error(pszSrcFile, __LINE__, "heap corrupted %d", state); 1001 } 1002 #endif 1003 979 1004 } // FillDirCnr 980 1005 … … 1032 1057 pciFirst = WinSendMsg(hwndCnr, 1033 1058 CM_ALLOCRECORD, 1034 MPFROMLONG(EXTRA_RECORD_BYTES 2),1059 MPFROMLONG(EXTRA_RECORD_BYTES), 1035 1060 MPFROMLONG((ULONG) numtoinsert)); 1036 1061 } … … 1152 1177 pci->rc.pszIcon = pci->pszDisplayName; 1153 1178 pci->attrFile = FILE_DIRECTORY; 1154 strcpy(pci->szDispAttr, "----D-"); 1155 pci->pszDispAttr = pci->szDispAttr; 1179 pci->pszDispAttr = FileAttrToString(pci->attrFile); 1156 1180 driveserial[x] = -1; 1157 1181 } … … 1165 1189 pci->rc.pszIcon = pci->pszDisplayName; 1166 1190 pci->attrFile = FILE_DIRECTORY; 1167 strcpy(pci->szDispAttr, "----D-"); 1168 pci->pszDispAttr = pci->szDispAttr; 1191 pci->pszDispAttr = FileAttrToString(pci->attrFile); 1169 1192 } 1170 1193 SelectDriveIcon(pci); … … 1176 1199 pci->rc.pszIcon = pci->pszFileName; 1177 1200 pci->attrFile = FILE_DIRECTORY; 1178 strcpy(pci->szDispAttr, "----D-"); 1179 pci->pszDispAttr = pci->szDispAttr; 1201 pci->pszDispAttr = FileAttrToString(pci->attrFile); 1180 1202 driveserial[x] = -1; 1181 1203 } … … 1188 1210 pci->rc.pszIcon = pci->pszDisplayName; 1189 1211 pci->attrFile = FILE_DIRECTORY; 1190 strcpy(pci->szDispAttr, "----D-"); 1191 pci->pszDispAttr = pci->szDispAttr; 1212 pci->pszDispAttr = FileAttrToString(pci->attrFile); 1192 1213 driveflags[x] |= (DRIVE_REMOVABLE | DRIVE_NOLONGNAMES); 1193 1214 driveserial[x] = -1; … … 1253 1274 pciParent = WinSendMsg(hwndCnr, 1254 1275 CM_ALLOCRECORD, 1255 MPFROMLONG(EXTRA_RECORD_BYTES 2), MPFROMLONG(1));1276 MPFROMLONG(EXTRA_RECORD_BYTES), MPFROMLONG(1)); 1256 1277 if (pciParent) { 1257 1278 pciParent->flags |= RECFLAGS_ENV; 1258 1279 pciParent->pszFileName = xstrdup(GetPString(IDS_ENVVARSTEXT), pszSrcFile, __LINE__); 1259 //pciParent->pszFileName = pciParent->szFileName;1260 1280 pciParent->rc.hptrIcon = hptrEnv; 1261 1281 pciParent->rc.pszIcon = pciParent->pszFileName; 1262 strcpy(pciParent->szDispAttr, "------"); 1263 pciParent->pszDispAttr = pciParent->szDispAttr; 1282 pciParent->pszDispAttr = FileAttrToString(0); 1264 1283 memset(&ri, 0, sizeof(RECORDINSERT)); 1265 1284 ri.cb = sizeof(RECORDINSERT); … … 1289 1308 pci = WinSendMsg(hwndCnr, 1290 1309 CM_ALLOCRECORD, 1291 MPFROMLONG(EXTRA_RECORD_BYTES 2),1310 MPFROMLONG(EXTRA_RECORD_BYTES), 1292 1311 MPFROMLONG(1)); 1293 1312 if (pci) { … … 1298 1317 pci->rc.hptrIcon = hptrEnv; 1299 1318 pci->rc.pszIcon = pci->pszFileName; 1300 strcpy(pci->szDispAttr, "------"); 1301 pci->pszDispAttr = pci->szDispAttr; 1319 pci->pszDispAttr = FileAttrToString(0); 1302 1320 memset(&ri, 0, sizeof(RECORDINSERT)); 1303 1321 ri.cb = sizeof(RECORDINSERT); … … 1312 1330 Win_Error2(hwndCnr, HWND_DESKTOP, pszSrcFile, __LINE__, 1313 1331 IDS_CMINSERTERRTEXT); 1314 WinSendMsg(hwndCnr, CM_FREERECORD, MPFROMP(&pci), 1315 MPFROMSHORT(1)); 1332 FreeCnrItem(hwndCnr, pci); 1316 1333 } 1317 1334 } … … 1324 1341 } 1325 1342 else 1326 WinSendMsg(hwndCnr, 1327 CM_FREERECORD, MPFROMP(&pciParent), MPFROMSHORT(1)); 1343 FreeCnrItem(hwndCnr, pciParent); 1328 1344 } 1329 1345 } // if show env … … 1480 1496 PFIELDINFO pfi; 1481 1497 1498 #if 1 // fixme to disable or to be configurable 1499 { 1500 int state = _heapchk(); 1501 if (state != _HEAPOK) 1502 Runtime_Error(pszSrcFile, __LINE__, "heap corrupted %d", state); 1503 } 1504 #endif 1505 1482 1506 // Remove all records 1483 1507 RemoveCnrItems(hwnd, NULL, 0, CMA_FREE); … … 1491 1515 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,"CM_REMOVEDETAILFIELDINFO hwnd %x", hwnd); 1492 1516 } 1493 1494 // DbgMsg(pszSrcFile, __LINE__, "EmptyCnr hwnd %p emptied", hwnd);1495 1517 } 1496 1518 1497 1519 /** 1498 1520 * Free storage associated with container item 1521 * Caller is responsible for correcting pointers 1499 1522 */ 1500 1523 1501 staticVOID FreeCnrItemData(PCNRITEM pci)1524 VOID FreeCnrItemData(PCNRITEM pci) 1502 1525 { 1503 1526 // DbgMsg(pszSrcFile, __LINE__, "FreeCnrItemData %p", pci); … … 1518 1541 */ 1519 1542 1520 VOIDFreeCnrItem(HWND hwnd, PCNRITEM pci)1543 INT FreeCnrItem(HWND hwnd, PCNRITEM pci) 1521 1544 { 1545 INT remaining; 1546 1522 1547 // DbgMsg(pszSrcFile, __LINE__, "FreeCnrItem hwnd %x pci %p", hwnd, pci); 1523 1548 1524 1549 FreeCnrItemData(pci); 1525 1550 1526 if ((INT)WinSendMsg(hwnd, CM_FREERECORD, MPFROMP(&pci), MPFROMSHORT(1)) == -1) { 1551 remaining = (INT)WinSendMsg(hwnd, CM_FREERECORD, MPFROMP(&pci), MPFROMSHORT(1)); 1552 if (remaining == -1) { 1527 1553 // Win_Error2(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,IDS_CMFREEERRTEXT); 1528 1554 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,"CM_FREERECORD hwnd %x pci %p", hwnd, pci); 1529 1555 } 1556 return remaining; 1530 1557 } 1531 1558 1532 1559 /** 1533 * Remove item from container and freeassociated storage1560 * Free container item list and associated storage 1534 1561 */ 1535 1562 1536 VOID RemoveCnrItems(HWND hwnd, PCNRITEM pci, USHORT usCnt, USHORT usFlags)1563 VOID FreeCnrItemList(HWND hwnd, PCNRITEM pciFirst) 1537 1564 { 1565 PCNRITEM pci = pciFirst; 1566 PCNRITEM pciNext; 1567 1568 while (pci) { 1569 pciNext = (PCNRITEM) pci->rc.preccNextRecord; 1570 if (FreeCnrItem(hwnd, pci) == -1) 1571 break; // Avoid cascading errors 1572 pci = pciNext; 1573 } 1574 } 1575 1576 /** 1577 * Remove item(s) from container and free associated storage if requested 1578 * @returns count of items remaining in container or -1 if error 1579 */ 1580 1581 INT RemoveCnrItems(HWND hwnd, PCNRITEM pci, USHORT usCnt, USHORT usFlags) 1582 { 1583 INT remaining; 1584 1538 1585 if (usCnt == 0) { 1539 if (pci != NULL) 1586 if (pci != NULL) { 1540 1587 Runtime_Error(pszSrcFile, __LINE__, "pci not NULL"); 1588 remaining = -1; 1589 } 1541 1590 else { 1542 1591 for (;;) { 1543 1592 pci = (PCNRITEM)WinSendMsg(hwnd, CM_QUERYRECORD, MPVOID, 1544 1593 MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); 1545 if (!pci) 1546 break; 1594 if (!pci) { 1595 remaining = 0; 1596 break; // Done 1597 } 1547 1598 else if ((INT)pci == -1) { 1548 1599 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,"CM_QUERYRECORD"); 1600 remaining = -1; 1549 1601 break; 1550 1602 } 1551 else 1552 RemoveCnrItems(hwnd, pci, 1, usFlags); 1553 } 1554 } 1555 } 1556 else if (usCnt != 1) 1603 else { 1604 remaining = RemoveCnrItems(hwnd, pci, 1, usFlags); 1605 if (remaining == -1) 1606 break; 1607 } 1608 } // for 1609 } 1610 } 1611 else if (usCnt != 1) { 1557 1612 Runtime_Error(pszSrcFile, __LINE__, "count not 1"); 1613 remaining = -1; 1614 } 1558 1615 else { 1559 1616 // DbgMsg(pszSrcFile, __LINE__, "RemoveCnrItems %p %u %s", pci, usCnt, pci->pszFileName); 1560 1617 1561 FreeCnrItemData(pci); 1562 1563 if ((INT)WinSendMsg(hwnd, CM_REMOVERECORD, MPFROMP(&pci), MPFROM2SHORT(usCnt, CMA_FREE)) == -1) { 1618 if (usFlags & CMA_FREE) 1619 FreeCnrItemData(pci); 1620 1621 remaining = (INT)WinSendMsg(hwnd, CM_REMOVERECORD, MPFROMP(&pci), MPFROM2SHORT(usCnt, usFlags)); 1622 if (remaining == -1) { 1564 1623 // Win_Error2(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,IDS_CMREMOVEERRTEXT); 1565 1624 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,"CM_REMOVERECORD hwnd %x pci %p", hwnd, pci); 1566 1625 } 1567 1626 } 1627 return remaining; 1568 1628 } 1569 1629 -
trunk/dll/flesh.c
r739 r751 7 7 8 8 Copyright (c) 1993-98 M. Kimes 9 Copyright (c) 2005 -07 Steven H. Levine9 Copyright (c) 2005, 2007 Steven H. Levine 10 10 11 11 24 May 05 SHL Rework Win_Error usage … … 16 16 19 Oct 06 SHL Stubby - correct . and .. detect 17 17 22 Mar 07 GKY Use QWL_USER 18 01 Aug 07 SHL Sync with CNRITEM mods 18 19 19 20 ***********************************************************************/ … … 102 103 pciL = WinSendMsg(hwndCnr, 103 104 CM_ALLOCRECORD, 104 MPFROMLONG(EXTRA_RECORD_BYTES 2),105 MPFROMLONG(EXTRA_RECORD_BYTES), 105 106 MPFROMLONG(1)); 106 107 if (pciL) { 107 108 pciL->pszFileName = xstrdup(fullpath, pszSrcFile, __LINE__); 108 109 pciL->rc.pszIcon = pciL->pszFileName; 109 110 if (!fNoIconsDirs && 110 111 (!isalpha(*fullpath) || … … 115 116 pciL->rc.hptrIcon = hptrDir; 116 117 pciL->attrFile = FILE_DIRECTORY; 117 strcpy(pciL->szDispAttr, "----D-"); 118 pciL->pszDispAttr = pciL->szDispAttr; 118 pciL->pszDispAttr = FileAttrToString(pciL->attrFile); 119 119 memset(&ri, 0, sizeof(ri)); 120 120 ri.cb = sizeof(ri); … … 126 126 if (!WinSendMsg(hwndCnr, 127 127 CM_INSERTRECORD, MPFROMP(pciL), MPFROMP(&ri))) 128 WinSendMsg(hwndCnr, 129 CM_FREERECORD, MPFROMP(&pciL), MPFROMSHORT(1)); 128 FreeCnrItem(hwndCnr, pciL); 130 129 } 131 130 } … … 165 164 MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER)); 166 165 if (!pciL || !*pciL->pszFileName) { 167 if (pciL && (INT) pciL != -1) { 168 WinSendMsg(hwndCnr, 169 CM_REMOVERECORD, MPFROMP(&pciL), MPFROM2SHORT(1, CMA_FREE)); 170 } 166 if (pciL && (INT) pciL != -1) 167 RemoveCnrItems(hwndCnr, pciL, 1, CMA_FREE); 171 168 dcd = INSTDATA(hwndCnr); 172 169 if (dcd && dcd->size != sizeof(DIRCNRDATA)) … … 203 200 if (pciL && (INT) pciL != -1) { 204 201 ret = TRUE; 205 WinSendMsg(hwndCnr, 206 CM_REMOVERECORD, MPFROMP(&pciL), MPFROM2SHORT(1, CMA_FREE)); 202 RemoveCnrItems(hwndCnr, pciL, 1, CMA_FREE); 207 203 } 208 204 else … … 343 339 DosFindClose(hDir); 344 340 if (toupper(*pciParent->pszFileName) > 'B' && 345 341 (*(pciParent->pszFileName + 1)) == ':' && 346 342 (*(pciParent->pszFileName + 2)) == '\\' && !(*(pciParent->pszFileName + 3))) { 347 343 … … 420 416 pci = WinSendMsg(hwndCnr, 421 417 CM_ALLOCRECORD, 422 MPFROMLONG(EXTRA_RECORD_BYTES 2), MPFROMLONG(1L));418 MPFROMLONG(EXTRA_RECORD_BYTES), MPFROMLONG(1L)); 423 419 if (!pci) { 424 420 Win_Error(hwndCnr, HWND_DESKTOP, __FILE__, __LINE__, … … 427 423 else { 428 424 RECORDINSERT ri; 429 //pci->pszFileName = pci->szFileName; 430 pci->pszFileName = xstrdup(NullStr, pszSrcFile, __LINE__); 431 pci->rc.pszIcon = pci->pszFileName; 432 // 23 Jul 07 SHL fixme to ensure pszDisplay set appropriately 425 pci->pszFileName = NullStr; 426 pci->pszDisplayName = pci->pszFileName; 427 pci->rc.pszIcon = pci->pszDisplayName; 433 428 memset(&ri, 0, sizeof(RECORDINSERT)); 434 429 ri.cb = sizeof(RECORDINSERT); … … 440 435 if (!WinSendMsg(hwndCnr, 441 436 CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri))) { 442 DosSleep(100 L);437 DosSleep(100); 443 438 WinSetFocus(HWND_DESKTOP, hwndCnr); 444 if (WinIsWindow((HAB) 439 if (WinIsWindow((HAB)0, hwndCnr)) { 445 440 if (!WinSendMsg(hwndCnr, 446 441 CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri))) { 447 442 Win_Error(hwndCnr, HWND_DESKTOP, __FILE__, __LINE__, 448 443 GetPString(IDS_RECORDINSERTFAILEDTEXT)); 449 WinSendMsg(hwndCnr, 450 CM_FREERECORD, MPFROMP(&pci), MPFROMSHORT(1)); 444 FreeCnrItem(hwndCnr, pci); 451 445 } 452 446 else -
trunk/dll/fm3dll.h
r748 r751 53 53 22 Jul 07 GKY Update CNRITEM to optimize RAM usage 54 54 23 Jul 07 SHL More CNRITEM updates (ticket#24) 55 01 Aug 07 SHL More CNRITEM and ARCITEM updates (ticket#24) 55 56 56 57 ***********************************************************************/ … … 155 156 #define CONTAINER_COLUMNS 13 /* Number of columns in details view */ 156 157 #define RGBFROMPARTS(r,g,b) (((r) * 65536) + ((g) * 256) + (b)) 157 #define EXTRA_RECORD_BYTES2 (sizeof(CNRITEM) - sizeof(MINIRECORDCORE)) 158 #define EXTRA_RECORD_BYTES ( EXTRA_RECORD_BYTES2 + (CCHMAXPATHCOMP - 1))158 159 #define EXTRA_RECORD_BYTES (sizeof(CNRITEM) - sizeof(MINIRECORDCORE)) 159 160 #define EXTRA_ARCRECORD_BYTES (sizeof(ARCITEM) - sizeof(MINIRECORDCORE)) 161 160 162 #define ALLATTRS (FILE_NORMAL | FILE_DIRECTORY | FILE_ARCHIVED |\ 161 163 FILE_HIDDEN | FILE_READONLY | FILE_SYSTEM) … … 407 409 MINIRECORDCORE rc; /* Base information */ 408 410 HWND hwndCnr; /* The container holding this record */ 409 PSZ pszFileName; // Points to buffer holding full pathname 411 PSZ pszFileName; // Points to buffer holding full pathname or NullStr 410 412 PSZ pszDisplayName; // Points to displayable part of path name - used by CFA_STRING 411 //CHAR szFileName[CCHMAXPATH]; // Path name - fixme to rename to szPathName? 412 //CHAR szSubject[40]; /* Subject string */ 413 CHAR *pszSubject; // Points subject buffer - used by fm/2 and by CFA_STRING 413 CHAR *pszSubject; // Points subject buffer or Nullstr - used by fm/2 and by CFA_STRING 414 414 CHAR *pszDispAttr; // Points to szDispAttr - required by CFA_STRING 415 415 CDATE date; /* Last write date of file */ … … 419 419 CDATE crdate; /* Creation date of file */ 420 420 CTIME crtime; /* Creation time of file */ 421 CHAR szDispAttr[6]; /* Attrib string for details display */422 421 CHAR *pszLongname; // Points to long name buffer - used by code and by CFA_STRING 423 422 ULONGLONG cbFile; /* File size */ … … 425 424 ULONG attrFile; /* Attributes of this file */ 426 425 ULONG flags; 427 //CHAR szLongname[1]; // Holds .LONGNAME EA or root flag428 426 } 429 427 CNRITEM, *PCNRITEM; … … 433 431 MINIRECORDCORE rc; // Base information 434 432 HWND hwndCnr; /* Container holding this record */ 435 PSZ pszFileName; // Point er to full path name433 PSZ pszFileName; // Points to full path name or NullStr 436 434 PSZ pszDisplayName; // Points to displayable part of path name - used by CFA_STRING 437 // CHAR szFileName[CCHMAXPATH]; // File name438 435 CHAR szDate[40]; // File's assembled date 439 436 PSZ pszDate; // Pointer to date … … 626 623 /* filldir.c */ 627 624 VOID EmptyCnr(HWND hwnd); 625 const PSZ FileAttrToString(ULONG fileAttr); 628 626 VOID FillDirCnr(HWND hwndCnr, CHAR *pszDirectory, DIRCNRDATA *pdcd, 629 627 PULONGLONG pullBytes); … … 641 639 const PSZ pszFileName, const PFILESTATUS4 pfsa4, 642 640 const BOOL partial, DIRCNRDATA *pdcd); 643 VOID FreeCnrItem(HWND hwnd, PCNRITEM pci); 641 INT FreeCnrItem(HWND hwnd, PCNRITEM pci); 642 VOID FreeCnrItemList(HWND hwnd, PCNRITEM pciFirst); 644 643 VOID FreeCnrItemData(PCNRITEM pci); 645 VOIDRemoveCnrItems(HWND hwnd, PCNRITEM pci, USHORT usCnt, USHORT usFlags);644 INT RemoveCnrItems(HWND hwnd, PCNRITEM pci, USHORT usCnt, USHORT usFlags); 646 645 647 646 /* flesh.c */ -
trunk/dll/misc.c
r747 r751 26 26 05 Jul 07 GKY Fix menu removals for WORKPLACE_PROCESS=YES 27 27 23 Jul 07 SHL Sync with CNRITEM updates (ticket#24) 28 31 Jul 07 SHL Clean up and report errors (ticket#24) 28 29 29 30 ***********************************************************************/ … … 83 84 PIB *ppib; 84 85 TIB *ptib; 85 APIRET rc;86 87 rc = DosGetInfoBlocks(&ptib, &ppib); 86 BOOL yes; 87 APIRET rc = DosGetInfoBlocks(&ptib, &ppib); 88 88 89 if (rc) { 89 90 Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__, 90 91 "DosGetInfoBlocks"); 92 yes = FALSE; 91 93 } 92 94 else { … … 94 96 TID tid; 95 97 96 if (WinQueryWindowProcess(hwnd, &pid, &tid)) { 97 if (chkTid) { 98 // Is window owned by FM2 process on same thread? 99 if (pid == ppib->pib_ulpid && tid == ptib->tib_ptib2->tib2_ultid) 100 return TRUE; 101 } 102 // Is window owned by some FM2 thread 103 else if (pid == ppib->pib_ulpid) 104 return TRUE; 105 } 106 } 107 return FALSE; 98 // Check window owned by FM2 process 99 // Check say same thread too, if requested 100 // OK for window to be dead - just return FALSE 101 yes = WinQueryWindowProcess(hwnd, &pid, &tid) && 102 pid == ppib->pib_ulpid && 103 (!chkTid || tid == ptib->tib_ptib2->tib2_ultid); 104 } 105 return yes; 108 106 } 109 107 … … 381 379 !stricmp(FileSystem, JFS) || 382 380 !stricmp(FileSystem, FAT32) || 383 384 385 386 381 !stricmp(FileSystem, RAMFS) || 382 !stricmp(FileSystem, NDFS32) || 383 !stricmp(FileSystem, NTFS) || 384 !stricmp(FileSystem, HPFS386)) { 387 385 hasCreateDT = TRUE; 388 386 hasAccessDT = TRUE; … … 430 428 BOOL *bool; 431 429 432 bool = (dcd) ? &dcd->detailssubject : &detailssubject; 433 AdjustCnrColVis(hwndCnr, ((compare) ? GetPString(IDS_STATUS) : 434 GetPString(IDS_SUBJ)), *bool, FALSE); 435 bool = (dcd) ? &dcd->detailsattr : &detailsattr; 430 bool = dcd ? &dcd->detailssubject : &detailssubject; 431 AdjustCnrColVis(hwndCnr, 432 compare ? GetPString(IDS_STATUS) : GetPString(IDS_SUBJ), 433 *bool, 434 FALSE); 435 436 bool = dcd ? &dcd->detailsattr : &detailsattr; 436 437 AdjustCnrColVis(hwndCnr, GetPString(IDS_ATTR), *bool, FALSE); 437 bool = (dcd)? &dcd->detailsicon : &detailsicon;438 bool = dcd ? &dcd->detailsicon : &detailsicon; 438 439 AdjustCnrColVis(hwndCnr, GetPString(IDS_ICON), *bool, FALSE); 439 bool = (dcd)? &dcd->detailslwdate : &detailslwdate;440 bool = dcd ? &dcd->detailslwdate : &detailslwdate; 440 441 AdjustCnrColVis(hwndCnr, GetPString(IDS_LWDATE), *bool, FALSE); 441 bool = (dcd)? &dcd->detailslwtime : &detailslwtime;442 bool = dcd ? &dcd->detailslwtime : &detailslwtime; 442 443 AdjustCnrColVis(hwndCnr, GetPString(IDS_LWTIME), *bool, FALSE); 443 bool = (dcd)? &dcd->detailsea : &detailsea;444 bool = dcd ? &dcd->detailsea : &detailsea; 444 445 AdjustCnrColVis(hwndCnr, GetPString(IDS_EA), *bool, FALSE); 445 bool = (dcd)? &dcd->detailssize : &detailssize;446 bool = dcd ? &dcd->detailssize : &detailssize; 446 447 AdjustCnrColVis(hwndCnr, GetPString(IDS_SIZE), *bool, FALSE); 448 447 449 if (!directory) { 448 bool = (dcd)? &dcd->detailsladate : &detailsladate;450 bool = dcd ? &dcd->detailsladate : &detailsladate; 449 451 AdjustCnrColVis(hwndCnr, GetPString(IDS_LADATE), *bool, FALSE); 450 bool = (dcd)? &dcd->detailslatime : &detailslatime;452 bool = dcd ? &dcd->detailslatime : &detailslatime; 451 453 AdjustCnrColVis(hwndCnr, GetPString(IDS_LATIME), *bool, FALSE); 452 bool = (dcd)? &dcd->detailscrdate : &detailscrdate;454 bool = dcd ? &dcd->detailscrdate : &detailscrdate; 453 455 AdjustCnrColVis(hwndCnr, GetPString(IDS_CRDATE), *bool, FALSE); 454 bool = (dcd)? &dcd->detailscrtime : &detailscrtime;456 bool = dcd ? &dcd->detailscrtime : &detailscrtime; 455 457 AdjustCnrColVis(hwndCnr, GetPString(IDS_CRTIME), *bool, FALSE); 456 bool = (dcd)? &dcd->detailslongname : &detailslongname;458 bool = dcd ? &dcd->detailslongname : &detailslongname; 457 459 AdjustCnrColVis(hwndCnr, GetPString(IDS_LNAME), *bool, FALSE); 458 460 WinSendMsg(hwndCnr, CM_INVALIDATEDETAILFIELDINFO, MPVOID, MPVOID); … … 462 464 } 463 465 464 BOOL SetCnrCols(HWND hwndCnr, BOOL compare)466 BOOL SetCnrCols(HWND hwndCnr, BOOL isCompCnr) 465 467 { 466 468 BOOL fSuccess = TRUE; … … 472 474 MPFROMLONG(CONTAINER_COLUMNS), NULL); 473 475 474 if (pfi) { 476 if (!pfi) { 477 Win_Error(hwndCnr, HWND_DESKTOP, pszSrcFile, __LINE__, "CM_ALLOCDETAILFIELDINFO"); 478 fSuccess = FALSE; 479 } 480 else { 475 481 476 482 PFIELDINFO pfiFirst; … … 518 524 pfi = pfi->pNextFieldInfo; 519 525 pfi->flData = CFA_STRING | CFA_LEFT | CFA_SEPARATOR; 520 if ( compare)526 if (isCompCnr) 521 527 pfi->flData |= CFA_FIREADONLY; 522 528 pfi->flTitle = CFA_CENTER | CFA_FITITLEREADONLY; 523 pfi->pTitleData = ( compare) ? GetPString(IDS_STATUS) :529 pfi->pTitleData = (isCompCnr) ? GetPString(IDS_STATUS) : 524 530 GetPString(IDS_SUBJ); 525 531 pfi->offStruct = FIELDOFFSET(CNRITEM, pszSubject); … … 610 616 611 617 if (!WinSendMsg(hwndCnr, CM_INSERTDETAILFIELDINFO, MPFROMP(pfiFirst), 612 MPFROMP(&fii))) 618 MPFROMP(&fii))) { 619 Win_Error(hwndCnr, HWND_DESKTOP, pszSrcFile, __LINE__, "CM_INSERTDETAILFIELDINFO"); 613 620 fSuccess = FALSE; 614 } 615 else 616 fSuccess = FALSE; 621 } 622 } 617 623 618 624 if (fSuccess) { … … 634 640 if (!WinSendMsg(hwndCnr, CM_SETCNRINFO, MPFROMP(&cnri), 635 641 MPFROMLONG(CMA_PFIELDINFOLAST | CMA_PFIELDINFOOBJECT | 636 CMA_XVERTSPLITBAR))) 642 CMA_XVERTSPLITBAR))) { 643 Win_Error(hwndCnr, HWND_DESKTOP, pszSrcFile, __LINE__, "CM_SETCNRINFO"); 637 644 fSuccess = FALSE; 645 } 638 646 } 639 647 … … 682 690 ULONG ealen; 683 691 USHORT len; 684 685 692 CHAR *eaval; 693 LONG retlen; 686 694 687 695 retlen = WinQueryWindowText(hwndMLE, sizeof(szSubject), szSubject); … … 733 741 734 742 CHAR longname[CCHMAXPATHCOMP]; 735 743 LONG retlen; 736 744 737 745 *longname = 0; … … 739 747 longname[retlen + 1] = 0; 740 748 chop_at_crnl(longname); 741 742 749 WinSetWindowText(hwndMLE, longname); 750 pci->pszFileName = xrealloc(pci->pszFileName, sizeof(longname), pszSrcFile, __LINE__); 743 751 return (MRESULT) WriteLongName(pci->pszFileName, longname); 744 752 } 745 746 747 748 753 else { 754 pci->pszFileName = pci->pszDisplayName; 755 WinQueryWindowText(hwndMLE, sizeof(szData), szData); 756 pci->pszFileName = xrealloc(pci->pszFileName, sizeof(szData), pszSrcFile, __LINE__); 749 757 if (strchr(szData, '?') || 750 758 strchr(szData, '*') || IsRoot(pci->pszFileName)) 751 759 return (MRESULT) FALSE; 752 760 /* If the text changed, rename the file system object. */ 753 761 chop_at_crnl(szData); 754 762 bstrip(szData); 755 763 if (!IsFullName(szData)) 756 764 Runtime_Error(pszSrcFile, __LINE__, "bad name"); … … 759 767 FIL_QUERYFULLNAME, 760 768 testname, sizeof(testname))) 761 769 return FALSE; 762 770 if (DosQueryPathInfo(pci->pszFileName, 763 771 FIL_QUERYFULLNAME, szData, sizeof(szData))) … … 936 944 { 937 945 WinCheckMenuItem(hwnd, IDM_SHOWLNAMES, 938 (dcd)? dcd->detailslongname : detailslongname);946 dcd ? dcd->detailslongname : detailslongname); 939 947 WinCheckMenuItem(hwnd, IDM_SHOWSUBJECT, 940 (dcd)? dcd->detailssubject : detailssubject);941 WinCheckMenuItem(hwnd, IDM_SHOWEAS, (dcd)? dcd->detailsea : detailsea);948 dcd ? dcd->detailssubject : detailssubject); 949 WinCheckMenuItem(hwnd, IDM_SHOWEAS, dcd ? dcd->detailsea : detailsea); 942 950 WinCheckMenuItem(hwnd, IDM_SHOWSIZE, 943 (dcd)? dcd->detailssize : detailssize);951 dcd ? dcd->detailssize : detailssize); 944 952 WinCheckMenuItem(hwnd, IDM_SHOWICON, 945 (dcd)? dcd->detailsicon : detailsicon);953 dcd ? dcd->detailsicon : detailsicon); 946 954 WinCheckMenuItem(hwnd, IDM_SHOWLWDATE, 947 (dcd)? dcd->detailslwdate : detailslwdate);955 dcd ? dcd->detailslwdate : detailslwdate); 948 956 WinCheckMenuItem(hwnd, IDM_SHOWLWTIME, 949 (dcd)? dcd->detailslwtime : detailslwtime);957 dcd ? dcd->detailslwtime : detailslwtime); 950 958 WinCheckMenuItem(hwnd, IDM_SHOWLADATE, 951 (dcd)? dcd->detailsladate : detailsladate);959 dcd ? dcd->detailsladate : detailsladate); 952 960 WinCheckMenuItem(hwnd, IDM_SHOWLATIME, 953 (dcd)? dcd->detailslatime : detailslatime);961 dcd ? dcd->detailslatime : detailslatime); 954 962 WinCheckMenuItem(hwnd, IDM_SHOWCRDATE, 955 (dcd)? dcd->detailscrdate : detailscrdate);963 dcd ? dcd->detailscrdate : detailscrdate); 956 964 WinCheckMenuItem(hwnd, IDM_SHOWCRTIME, 957 (dcd)? dcd->detailscrtime : detailscrtime);965 dcd ? dcd->detailscrtime : detailscrtime); 958 966 WinCheckMenuItem(hwnd, IDM_SHOWATTR, 959 (dcd)? dcd->detailsattr : detailsattr);967 dcd ? dcd->detailsattr : detailsattr); 960 968 } 961 969 … … 975 983 switch (cmd) { 976 984 case IDM_SHOWLNAMES: 977 bool = (dcd)? &dcd->detailslongname : &detailslongname;985 bool = dcd ? &dcd->detailslongname : &detailslongname; 978 986 strcpy(eos, "DetailsLongname"); 979 987 break; 980 988 case IDM_SHOWSUBJECT: 981 bool = (dcd)? &dcd->detailssubject : &detailssubject;989 bool = dcd ? &dcd->detailssubject : &detailssubject; 982 990 strcpy(eos, "DetailsSubject"); 983 991 break; 984 992 case IDM_SHOWEAS: 985 bool = (dcd)? &dcd->detailsea : &detailsea;993 bool = dcd ? &dcd->detailsea : &detailsea; 986 994 strcpy(eos, "DetailsEA"); 987 995 break; 988 996 case IDM_SHOWSIZE: 989 bool = (dcd)? &dcd->detailssize : &detailssize;997 bool = dcd ? &dcd->detailssize : &detailssize; 990 998 strcpy(eos, "DetailsSize"); 991 999 break; 992 1000 case IDM_SHOWICON: 993 bool = (dcd)? &dcd->detailsicon : &detailsicon;1001 bool = dcd ? &dcd->detailsicon : &detailsicon; 994 1002 strcpy(eos, "DetailsIcon"); 995 1003 break; 996 1004 case IDM_SHOWLWDATE: 997 bool = (dcd)? &dcd->detailslwdate : &detailslwdate;1005 bool = dcd ? &dcd->detailslwdate : &detailslwdate; 998 1006 strcpy(eos, "DetailsLWDate"); 999 1007 break; 1000 1008 case IDM_SHOWLWTIME: 1001 bool = (dcd)? &dcd->detailslwtime : &detailslwtime;1009 bool = dcd ? &dcd->detailslwtime : &detailslwtime; 1002 1010 strcpy(eos, "DetailsLWTime"); 1003 1011 break; 1004 1012 case IDM_SHOWLADATE: 1005 bool = (dcd)? &dcd->detailsladate : &detailsladate;1013 bool = dcd ? &dcd->detailsladate : &detailsladate; 1006 1014 strcpy(eos, "DetailsLADate"); 1007 1015 break; 1008 1016 case IDM_SHOWLATIME: 1009 bool = (dcd)? &dcd->detailslatime : &detailslatime;1017 bool = dcd ? &dcd->detailslatime : &detailslatime; 1010 1018 strcpy(eos, "DetailsLATime"); 1011 1019 break; 1012 1020 case IDM_SHOWCRDATE: 1013 bool = (dcd)? &dcd->detailscrdate : &detailscrdate;1021 bool = dcd ? &dcd->detailscrdate : &detailscrdate; 1014 1022 strcpy(eos, "DetailsCRDate"); 1015 1023 break; 1016 1024 case IDM_SHOWCRTIME: 1017 bool = (dcd)? &dcd->detailscrtime : &detailscrtime;1025 bool = dcd ? &dcd->detailscrtime : &detailscrtime; 1018 1026 strcpy(eos, "DetailsCRTime"); 1019 1027 break; 1020 1028 case IDM_SHOWATTR: 1021 bool = (dcd)? &dcd->detailsattr : &detailsattr;1029 bool = dcd ? &dcd->detailsattr : &detailsattr; 1022 1030 strcpy(eos, "DetailsAttr"); 1023 1031 break; … … 1384 1392 // If window owned by some other process or some other thread? 1385 1393 if (!IsFm2Window(h, 1)) { 1386 1394 QMSG qmsg; 1387 1395 for (;;) { 1388 1396 DosSleep(1); -
trunk/dll/objcnr.c
r731 r751 15 15 03 Nov 06 SHL Renames 16 16 22 Mar 07 GKY Use QWL_USER 17 01 Aug 07 SHL Rework to sync with CNRITEM mods 17 18 18 19 ***********************************************************************/ … … 93 94 pciP = WinSendMsg(hwndCnr, 94 95 CM_ALLOCRECORD, 95 MPFROMLONG(EXTRA_RECORD_BYTES 2),96 MPFROMLONG(EXTRA_RECORD_BYTES), 96 97 MPFROMLONG(1L)); 97 98 if (!pciP) { … … 100 101 } 101 102 pciP->pszFileName = xstrdup(filename, pszSrcFile, __LINE__); 102 pciP->pszDispAttr = pciP->szDispAttr; 103 *pciP->szDispAttr = 0; 104 //pciP->pszSubject = pciP->szSubject; 105 pciP->pszSubject = xstrdup(NullStr, pszSrcFile, __LINE__); // 23 Jul 07 SHL 106 //pciP->pszLongname = pciP->szLongname; 107 pciP->pszLongname = xstrdup(NullStr, pszSrcFile, __LINE__); 103 pciP->pszDispAttr = NullStr; 104 pciP->pszSubject = NullStr; 105 pciP->pszLongname = NullStr; 108 106 if (strlen(filename) < 4) 109 pciP->psz FileName = pciP->pszFileName;107 pciP->pszDisplayName = pciP->pszFileName; 110 108 else { 111 109 p = strrchr(pciP->pszFileName, '\\'); … … 114 112 else if (*(p + 1)) 115 113 p++; 116 pciP->psz FileName = p;117 } 118 pciP->rc.pszIcon = pciP->psz FileName;114 pciP->pszDisplayName = p; 115 } 116 pciP->rc.pszIcon = pciP->pszDisplayName; 119 117 if (fForceUpper) 120 118 strupr(pciP->pszFileName); -
trunk/dll/select.c
r748 r751 20 20 12 May 07 SHL Use dcd->ulItemsToUnHilite 21 21 14 Jun 07 SHL SelectAll: make odd expression go away 22 0 1 Aug 07 SHL Clean up while auditing for CNRITEM sync22 02 Aug 07 SHL Sync with CNRITEM mods 23 23 24 24 ***********************************************************************/ … … 484 484 MPFROM2SHORT(0, CRA_SELECTED)); 485 485 if (fSyncUpdates) 486 WinSendMsg(hwndCnr, CM_REMOVERECORD, MPFROMP(&pci), 487 MPFROM2SHORT(1, CMA_FREE | CMA_INVALIDATE)); 486 RemoveCnrItems(hwndCnr, pci, 1, CMA_FREE | CMA_INVALIDATE); 488 487 else 489 WinSendMsg(hwndCnr, CM_REMOVERECORD, MPFROMP(&pci), 490 MPFROM2SHORT(1, CMA_FREE)); 488 RemoveCnrItems(hwndCnr, pci, 1, CMA_FREE); 491 489 if (attribute == CRA_CURSORED) 492 490 break; -
trunk/dll/treecnr.c
r739 r751 34 34 10 Jun 07 GKY Mouse button 3 white space click to fail silently 35 35 05 Jul 07 SHL Disable leftover debug code 36 02 Aug 07 SHL Sync with CNRITEM mods 36 37 37 38 ***********************************************************************/ … … 697 698 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 698 699 else { 699 WinSendMsg(dcd->hwndCnr, 700 CM_REMOVERECORD, 701 MPVOID, 702 MPFROM2SHORT(0, CMA_FREE | CMA_INVALIDATE | CMA_ERASE)); 700 RemoveCnrItems(dcd->hwndCnr, NULL, 0, CMA_FREE | CMA_INVALIDATE | CMA_ERASE); 703 701 WinSendMsg(dcd->hwndCnr, 704 702 CM_SCROLLWINDOW, MPFROMSHORT(CMA_VERTICAL), MPFROMLONG(-1)); … … 1743 1741 break; 1744 1742 } 1745 } // for 1746 WinSendMsg(hwnd, 1747 CM_REMOVERECORD, 1748 MPFROMP(&pciP), 1749 MPFROM2SHORT(1, CMA_FREE | CMA_INVALIDATE)); 1743 } // for 1744 RemoveCnrItems(hwnd, pciP, 1, CMA_FREE | CMA_INVALIDATE); 1750 1745 return 0; 1751 1746 } … … 1934 1929 if (!(driveflags[toupper(*pci->pszFileName) - 'A'] & 1935 1930 DRIVE_INCLUDEFILES)) 1936 WinSendMsg(hwnd, 1937 CM_REMOVERECORD, 1938 MPFROMP(&pci), 1939 MPFROM2SHORT(1, CMA_FREE | CMA_INVALIDATE)); 1931 RemoveCnrItems(hwnd, pci, 1, CMA_FREE | CMA_INVALIDATE); 1940 1932 else { 1941 1933 … … 1952 1944 if (!IsRoot(pci->pszFileName)) { 1953 1945 NotifyError(pci->pszFileName, status); 1954 WinSendMsg(hwnd, 1955 CM_REMOVERECORD, 1956 MPFROMP(&pci), 1957 MPFROM2SHORT(1, CMA_FREE | CMA_INVALIDATE)); 1946 RemoveCnrItems(hwnd, pci, 1, CMA_FREE | CMA_INVALIDATE); 1958 1947 } 1959 1948 } … … 2191 2180 if (driveflags[info->device - 'A'] & 2192 2181 (DRIVE_INVALID | DRIVE_IGNORE)) 2193 WinSendMsg(hwnd, 2194 CM_REMOVERECORD, 2195 MPFROMP(&pci), MPFROM2SHORT(1, CMA_FREE)); 2182 RemoveCnrItems(hwnd, pci, 1, CMA_FREE); 2196 2183 else 2197 2184 Flesh(hwnd, pci); -
trunk/dll/update.c
r730 r751 7 7 8 8 Copyright (c) 1993-98 M. Kimes 9 Copyright (c) 2003, 200 6Steven H. Levine9 Copyright (c) 2003, 2007 Steven H. Levine 10 10 11 11 12 Feb 03 SHL Standardize EA math … … 17 17 20 Feb 07 GKY Add SelectDriveIcon() 18 18 09 Mar 07 GKY Cleanup SelectDriveIcon using "driveflag =" from Steven 19 02 Aug 07 SHL Sync with CNRITEM mods 19 20 20 21 ***********************************************************************/ … … 42 43 UINT driveflag = driveflags[toupper(*pci->pszFileName) - 'A']; 43 44 *pci->pszFileName = toupper(*pci->pszFileName); 44 45 46 45 if (isalpha(*pci->pszFileName) && 46 toupper(*pci->pszFileName) > 'B') { 47 if (driveflag & DRIVE_CDROM) 47 48 pci->rc.hptrIcon = hptrCDROM; 48 49 else 49 50 pci->rc.hptrIcon = 50 51 (driveflag & DRIVE_REMOVABLE) ? hptrRemovable 51 52 53 52 :(driveflag & DRIVE_VIRTUAL) ? hptrVirtual 53 :(driveflag & DRIVE_REMOTE) ? hptrRemote 54 :(driveflag & DRIVE_RAMDISK) ? hptrRamdisk 54 55 :(driveflag & DRIVE_ZIPSTREAM) ? hptrZipstrm : hptrDrive; 55 56 } 56 57 else 57 58 58 pci->rc.hptrIcon = hptrFloppy; 59 return pci->rc.hptrIcon; 59 60 } 60 61 PCNRITEM UpdateCnrRecord(HWND hwndCnr, CHAR * filename, BOOL partial, … … 64 65 FILEFINDBUF4 ffb; 65 66 HDIR hDir = HDIR_CREATE; 66 ULONG nm = 1 L;67 ULONG nm = 1; 67 68 ULONG oldemphasis = 0; 68 69 APIRET status; … … 128 129 #endif 129 130 if ((!fForceUpper && !fForceLower && strcmp(pci->pszFileName, filename)) || 130 131 132 133 134 135 136 137 138 139 131 pci->cbFile != ffb.cbFile || pci->attrFile != ffb.attrFile || 132 pci->easize != CBLIST_TO_EASIZE(ffb.cbList) || pci->date.day != 133 ffb.fdateLastWrite.day || pci->date.month != ffb.fdateLastWrite.month || 134 pci->date.year != ffb.fdateLastWrite.year + 1980 || pci->time.seconds != 135 ffb.ftimeLastWrite.twosecs * 2 || pci->time.minutes != ffb.ftimeLastWrite.minutes || 136 pci->time.hours != ffb.ftimeLastWrite.hours || pci->ladate.day != 137 ffb.fdateLastAccess.day || pci->ladate.month != ffb.fdateLastAccess.month || 138 pci->ladate.year != ffb.fdateLastAccess.year + 1980 || pci->latime.seconds != 139 ffb.ftimeLastAccess.twosecs * 2 || pci->latime.minutes != 140 ffb.ftimeLastAccess.minutes || pci->latime.hours != ffb.ftimeLastAccess.hours) { /* changed; update */ 140 141 #ifdef DEBUG 141 142 updated = TRUE; … … 144 145 ffb.cchName = 0; 145 146 FillInRecordFromFFB(hwndCnr, pci, filename, &ffb, partial, dcd); 146 147 147 if (strlen(pci->pszFileName) < 4) 148 SelectDriveIcon(pci); 148 149 oldemphasis = pci->rc.flRecordAttr & (CRA_SELECTED | CRA_CURSORED); 149 150 if (oldemphasis) … … 174 175 pci = WinSendMsg(hwndCnr, 175 176 CM_ALLOCRECORD, 176 MPFROMLONG(EXTRA_RECORD_BYTES), MPFROMLONG(1 L));177 MPFROMLONG(EXTRA_RECORD_BYTES), MPFROMLONG(1)); 177 178 if (pci) { 178 179 *ffb.achName = 0; … … 180 181 pci, 181 182 filename, &ffb, partial, dcd); 182 183 183 if (strlen(pci->pszFileName) < 4) 184 SelectDriveIcon(pci); 184 185 memset(&ri, 0, sizeof(RECORDINSERT)); 185 186 ri.cb = sizeof(RECORDINSERT); … … 187 188 ri.pRecordParent = (PRECORDCORE) NULL; 188 189 ri.zOrder = (USHORT) CMA_TOP; 189 ri.cRecordsInsert = 1 L;190 ri.cRecordsInsert = 1; 190 191 ri.fInvalidateRecord = TRUE; 191 192 if (WinSendMsg(hwndCnr, … … 218 219 CM_ALLOCRECORD, 219 220 MPFROMLONG(EXTRA_RECORD_BYTES), 220 MPFROMLONG(1 L));221 MPFROMLONG(1)); 221 222 if (pci) { 222 223 … … 226 227 FillInRecordFromFFB(hwndCnr, 227 228 pci, filename, &ffb, partial, dcd); 228 229 229 if (strlen(pci->pszFileName) < 4) 230 SelectDriveIcon(pci); 230 231 memset(&ri, 0, sizeof(RECORDINSERT)); 231 232 ri.cb = sizeof(RECORDINSERT); … … 233 234 ri.pRecordParent = (PRECORDCORE) pciParent; 234 235 ri.zOrder = (USHORT) CMA_TOP; 235 ri.cRecordsInsert = 1 L;236 ri.cRecordsInsert = 1; 236 237 ri.fInvalidateRecord = TRUE; 237 238 if (WinSendMsg(hwndCnr, … … 263 264 pci = WinSendMsg(hwndCnr, 264 265 CM_ALLOCRECORD, 265 MPFROMLONG(EXTRA_RECORD_BYTES), MPFROMLONG(1 L));266 MPFROMLONG(EXTRA_RECORD_BYTES), MPFROMLONG(1)); 266 267 if (pci) { 267 268 … … 273 274 pci, 274 275 filename, &ffb, partial, dcd); 275 276 276 if (strlen(pci->pszFileName) < 4) 277 SelectDriveIcon(pci); 277 278 memset(&ri, 0, sizeof(RECORDINSERT)); 278 279 ri.cb = sizeof(RECORDINSERT); … … 280 281 ri.pRecordParent = (PRECORDCORE) pciParent; 281 282 ri.zOrder = (USHORT) CMA_TOP; 282 ri.cRecordsInsert = 1 L;283 ri.cRecordsInsert = 1; 283 284 ri.fInvalidateRecord = TRUE; 284 285 if (WinSendMsg(hwndCnr, … … 314 315 if (dcd->type == DIR_FRAME) 315 316 dcd->ullTotalBytes -= pci->cbFile + pci->easize; 316 WinSendMsg(hwndCnr, 317 CM_REMOVERECORD, 318 MPFROMP(&pci), MPFROM2SHORT(1, CMA_FREE | CMA_INVALIDATE)); 319 pci = (PCNRITEM) NULL; 317 RemoveCnrItems(hwndCnr, pci, 1, CMA_FREE | CMA_INVALIDATE); 318 pci = NULL; 320 319 PostMsg(hwndCnr, UM_RESCAN, MPVOID, MPVOID); 321 320 } … … 339 338 FILEFINDBUF4 ffb; 340 339 HDIR hDir; 341 ULONG nm = 1 L;340 ULONG nm = 1; 342 341 INT x; 343 342 INT numlist = 0; … … 431 430 FillInRecordFromFFB(hwndCnr, 432 431 pci, filename[x], &ffb, partial, dcd); 433 434 432 if (IsRoot(pci->pszFileName)) 433 SelectDriveIcon(pci); 435 434 WinSendMsg(hwndCnr, 436 435 CM_SETRECORDEMPHASIS, … … 447 446 pci = WinSendMsg(hwndCnr, 448 447 CM_ALLOCRECORD, 449 MPFROMLONG(EXTRA_RECORD_BYTES), MPFROMLONG(1 L));448 MPFROMLONG(EXTRA_RECORD_BYTES), MPFROMLONG(1)); 450 449 if (pci) { 451 450 ret = TRUE; … … 455 454 filename[x], 456 455 &ffb, partial, dcd); 457 458 456 if (strlen(pci->pszFileName) < 4) 457 SelectDriveIcon(pci); 459 458 memset(&ri, 0, sizeof(RECORDINSERT)); 460 459 ri.cb = sizeof(RECORDINSERT); … … 462 461 ri.pRecordParent = (PRECORDCORE) NULL; 463 462 ri.zOrder = (USHORT) CMA_TOP; 464 ri.cRecordsInsert = 1 L;463 ri.cRecordsInsert = 1; 465 464 ri.fInvalidateRecord = FALSE; 466 465 if (WinSendMsg(hwndCnr, … … 475 474 } 476 475 else 477 WinSendMsg(hwndCnr, 478 CM_FREERECORD, MPFROMP(&pci), MPFROMSHORT(1)); 476 FreeCnrItem(hwndCnr, pci); 479 477 } 480 478 } … … 497 495 CM_ALLOCRECORD, 498 496 MPFROMLONG(EXTRA_RECORD_BYTES), 499 MPFROMLONG(1 L));497 MPFROMLONG(1)); 500 498 if (pci) { 501 499 … … 509 507 filename[x], 510 508 &ffb, partial, dcd); 511 512 509 if (strlen(pci->pszFileName) < 4) 510 SelectDriveIcon(pci); 513 511 memset(&ri, 0, sizeof(RECORDINSERT)); 514 512 ri.cb = sizeof(RECORDINSERT); … … 516 514 ri.pRecordParent = (PRECORDCORE) pciParent; 517 515 ri.zOrder = (USHORT) CMA_TOP; 518 ri.cRecordsInsert = 1 L;516 ri.cRecordsInsert = 1; 519 517 ri.fInvalidateRecord = FALSE; 520 518 if (WinSendMsg(hwndCnr, … … 529 527 } 530 528 else 531 WinSendMsg(hwndCnr, 532 CM_FREERECORD, 533 MPFROMP(&pci), MPFROMSHORT(1)); 529 FreeCnrItem(hwndCnr, pci); 534 530 } 535 531 } … … 544 540 CM_ALLOCRECORD, 545 541 MPFROMLONG(EXTRA_RECORD_BYTES), 546 MPFROMLONG(1 L));542 MPFROMLONG(1)); 547 543 if (pci) { 548 544 … … 556 552 filename[x], 557 553 &ffb, partial, dcd); 558 559 554 if (strlen(pci->pszFileName) < 4) 555 SelectDriveIcon(pci); 560 556 memset(&ri, 0, sizeof(RECORDINSERT)); 561 557 ri.cb = sizeof(RECORDINSERT); … … 563 559 ri.pRecordParent = (PRECORDCORE) pciParent; 564 560 ri.zOrder = (USHORT) CMA_TOP; 565 ri.cRecordsInsert = 1 L;561 ri.cRecordsInsert = 1; 566 562 ri.fInvalidateRecord = FALSE; 567 563 if (WinSendMsg(hwndCnr, … … 576 572 } 577 573 else 578 WinSendMsg(hwndCnr, 579 CM_FREERECORD, MPFROMP(&pci), MPFROMSHORT(1)); 574 FreeCnrItem(hwndCnr, pci); 580 575 } 581 576 } … … 597 592 if (dcd->type == DIR_FRAME) 598 593 dcd->ullTotalBytes -= (pci->cbFile + pci->easize); 599 if (WinSendMsg(hwndCnr, 600 CM_REMOVERECORD, 601 MPFROMP(&pci), 602 MPFROM2SHORT(1, 603 CMA_FREE | (numremain == 604 1 ? CMA_INVALIDATE : 0)))) { 594 // 02 Aug 07 SHL rc check was wrong 595 if (RemoveCnrItems(hwndCnr, pci, 1, 596 CMA_FREE | 597 numremain == 1 ? CMA_INVALIDATE : 0) != -1) { 605 598 numremain--; 606 599 repos = TRUE; 607 600 } 608 601 } 609 } // for602 } // for x 610 603 } 611 604 if (repos || (pciList && numlist)) {
Note: See TracChangeset
for help on using the changeset viewer.