Changeset 751 for trunk/dll/comp.c
- Timestamp:
- Aug 3, 2007, 1:05:48 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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];
Note:
See TracChangeset
for help on using the changeset viewer.