Changeset 943
- Timestamp:
 - Feb 10, 2008, 7:39:00 PM (18 years ago)
 - File:
 - 
      
- 1 edited
 
- 
          
  trunk/dll/seeall.c (modified) (56 diffs)
 
 
Legend:
- Unmodified
 - Added
 - Removed
 
- 
      
trunk/dll/seeall.c
r907 r943 115 115 ALLFILES *afhead; 116 116 ALLFILES **afindex; 117 ULONG af files;117 ULONG afheadcnt; 118 118 ULONG afalloc; 119 119 ULONG longest; … … 123 123 ULONG selected; 124 124 ULONGLONG ullSelectedBytes; 125 ULONG afi files;125 ULONG afindexcnt; 126 126 ULONG lastselected; 127 127 ULONG lastdirection; … … 1185 1185 mask.attrFile != pAD->mask.attrFile || 1186 1186 mask.antiattr != pAD->mask.antiattr)) { 1187 for (x = 0; x < pAD->afi files; x++) {1188 y = (pAD->invertsort) ? (pAD->afi files- 1) - x : x;1187 for (x = 0; x < pAD->afindexcnt; x++) { 1188 y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - x : x; 1189 1189 ret = FALSE; 1190 1190 if (mask.pszMasks[1]) { … … 1297 1297 register ULONG x; 1298 1298 1299 if (ad->afhead && ad->af files) {1300 for (x = 0; x < ad->af files; x++) {1299 if (ad->afhead && ad->afheadcnt) { 1300 for (x = 0; x < ad->afheadcnt; x++) { 1301 1301 if (ad->afhead[x].fullname) 1302 1302 free(ad->afhead[x].fullname); … … 1309 1309 } 1310 1310 DosPostEventSem(CompactSem); 1311 ad->afalloc = ad->afi files = ad->affiles= ad->longest = ad->longestw =1311 ad->afalloc = ad->afindexcnt = ad->afheadcnt = ad->longest = ad->longestw = 1312 1312 ad->maxx = ad->horzscroll = 0; 1313 1313 } … … 1325 1325 1326 1326 if (ad->selected) { 1327 for (x = 0; x < ad->afi files; x++) {1328 y = (ad->invertsort) ? (ad->afi files- 1) - x : x;1327 for (x = 0; x < ad->afindexcnt; x++) { 1328 y = (ad->invertsort) ? (ad->afindexcnt - 1) - x : x; 1329 1329 if (ad->afindex[y]->flags & AF_SELECTED) { 1330 1330 error = AddToList(ad->afindex[y]->fullname, &list, … … 1350 1350 BOOL didone = FALSE; 1351 1351 1352 for (x = 0; x < pAD->afi files; x++) {1353 y = (pAD->invertsort) ? (pAD->afi files- 1) - x : x;1352 for (x = 0; x < pAD->afindexcnt; x++) { 1353 y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - x : x; 1354 1354 if (list) { 1355 1355 ret = FALSE; … … 1417 1417 for (z = 0; list[z] && !ad->stopflag; z++) { 1418 1418 ret = FALSE; 1419 for (x = 0; x < ad->af files; x++) {1419 for (x = 0; x < ad->afheadcnt; x++) { 1420 1420 if (!stricmp(list[z], ad->afhead[x].fullname)) { 1421 1421 ret = TRUE; … … 1454 1454 DosFindClose(hdir); 1455 1455 if (!(ffb.attrFile & FILE_DIRECTORY)) { 1456 if (!ad->afalloc || ad->af files> ad->afalloc - 1) {1456 if (!ad->afalloc || ad->afheadcnt > ad->afalloc - 1) { 1457 1457 1458 1458 ALLFILES *temp, **templ; … … 1480 1480 } 1481 1481 } 1482 ad->afhead[ad->af files].fullname =1482 ad->afhead[ad->afheadcnt].fullname = 1483 1483 xstrdup(list[z], pszSrcFile, __LINE__); 1484 if (ad->afhead[ad->af files].fullname) {1485 p = strrchr(ad->afhead[ad->af files].fullname, '\\');1484 if (ad->afhead[ad->afheadcnt].fullname) { 1485 p = strrchr(ad->afhead[ad->afheadcnt].fullname, '\\'); 1486 1486 if (!p) 1487 p = ad->afhead[ad->af files].fullname;1487 p = ad->afhead[ad->afheadcnt].fullname; 1488 1488 else 1489 1489 p++; 1490 ad->afhead[ad->af files].filename = p;1491 ad->afhead[ad->af files].cbFile = ffb.cbFile;1492 ad->afhead[ad->af files].date = ffb.fdateLastWrite;1493 ad->afhead[ad->af files].time = ffb.ftimeLastWrite;1494 ad->afhead[ad->af files].attrFile = (USHORT) ffb.attrFile;1495 ad->afhead[ad->af files].flags = 0;1496 if (ad->longest < strlen(ad->afhead[ad->af files].filename))1497 ad->longest = strlen(ad->afhead[ad->af files].filename);1498 if (ad->longestw < strlen(ad->afhead[ad->af files].fullname))1499 ad->longestw = strlen(ad->afhead[ad->af files].fullname);1500 1501 ad->af files++;1490 ad->afhead[ad->afheadcnt].filename = p; 1491 ad->afhead[ad->afheadcnt].cbFile = ffb.cbFile; 1492 ad->afhead[ad->afheadcnt].date = ffb.fdateLastWrite; 1493 ad->afhead[ad->afheadcnt].time = ffb.ftimeLastWrite; 1494 ad->afhead[ad->afheadcnt].attrFile = (USHORT) ffb.attrFile; 1495 ad->afhead[ad->afheadcnt].flags = 0; 1496 if (ad->longest < strlen(ad->afhead[ad->afheadcnt].filename)) 1497 ad->longest = strlen(ad->afhead[ad->afheadcnt].filename); 1498 if (ad->longestw < strlen(ad->afhead[ad->afheadcnt].fullname)) 1499 ad->longestw = strlen(ad->afhead[ad->afheadcnt].fullname); 1500 1501 ad->afheadcnt++; 1502 1502 } 1503 1503 else { … … 1605 1605 pAD->selected = 0; 1606 1606 pAD->ullSelectedBytes = 0; 1607 for (x = 0, y = 0; x < pAD->af files; x++) {1607 for (x = 0, y = 0; x < pAD->afheadcnt; x++) { 1608 1608 if (!(pAD->afhead[x].flags & (AF_DELETED | AF_FILTERED))) { 1609 1609 if (pAD->afhead[x].flags & AF_SELECTED) { … … 1614 1614 } 1615 1615 } // for x 1616 pAD->afi files= y;1616 pAD->afindexcnt = y; 1617 1617 PostMsg(hwnd, UM_SETUP3, MPVOID, MPVOID); 1618 if (!pAD->stopflag && pAD->pfnCompare && pAD->afi files) {1618 if (!pAD->stopflag && pAD->pfnCompare && pAD->afindexcnt) { 1619 1619 WinSendMsg(hwnd, UM_RESCAN, MPFROMLONG(1), MPVOID); 1620 qsort(pAD->afindex, pAD->afi files, sizeof(ALLFILES *), pAD->pfnCompare);1620 qsort(pAD->afindex, pAD->afindexcnt, sizeof(ALLFILES *), pAD->pfnCompare); 1621 1621 } 1622 1622 } … … 1641 1641 WinCancelShutdown(hmq2, TRUE); 1642 1642 IncrThreadUsage(); 1643 if (ad->cursored <= ad->afi files) {1644 for (x = 0; x < ad->af files; x++)1643 if (ad->cursored <= ad->afindexcnt) { 1644 for (x = 0; x < ad->afheadcnt; x++) 1645 1645 ad->afhead[x].flags &= (~(AF_DUPE | AF_SELECTED)); 1646 1646 DosSleep(0); //26 Aug 07 GKY 1 1647 for (x = 0; x < ad->af files&& !ad->stopflag; x++) {1647 for (x = 0; x < ad->afheadcnt && !ad->stopflag; x++) { 1648 1648 if (!(ad->afhead[x].flags & (AF_DUPE | AF_FILTERED))) { 1649 1649 if (!(x % 50)) { 1650 1650 sprintf(s, 1651 GetPString(IDS_DUPECHECKINGOFTEXT), x, ad->af files);1651 GetPString(IDS_DUPECHECKINGOFTEXT), x, ad->afheadcnt); 1652 1652 WinSetWindowText(ad->hwndStatus, s); 1653 1653 } 1654 for (z = 0; z < ad->af files&& !ad->stopflag; z++) {1654 for (z = 0; z < ad->afheadcnt && !ad->stopflag; z++) { 1655 1655 if (x != z && 1656 1656 !(ad->afhead[z].flags & (AF_DUPE | AF_FILTERED))) … … 1724 1724 } 1725 1725 } // for 1726 for (x = 0; x < ad->af files&& !ad->stopflag; x++) {1726 for (x = 0; x < ad->afheadcnt && !ad->stopflag; x++) { 1727 1727 if (!(ad->afhead[x].flags & AF_DUPE)) 1728 1728 ad->afhead[x].flags |= AF_FILTERED; … … 1753 1753 CHAR *p; 1754 1754 1755 if (ad->cursored <= ad->afi files) {1755 if (ad->cursored <= ad->afindexcnt) { 1756 1756 x = ad->cursored - 1; 1757 x = (ad->invertsort) ? (ad->afi files- 1) - x : x;1757 x = (ad->invertsort) ? (ad->afindexcnt - 1) - x : x; 1758 1758 p = strrchr(ad->afindex[x]->filename, '.'); 1759 1759 if (p) { … … 1766 1766 if (WinDlgBox(HWND_DESKTOP, hwnd, PickMaskDlgProc, 1767 1767 FM3ModHandle, MSK_FRAME, MPFROMP(&ad->mask))) { 1768 for (x = 0; x < ad->af files; x++) {1768 for (x = 0; x < ad->afheadcnt; x++) { 1769 1769 ret = FALSE; 1770 1770 if (ad->mask.pszMasks[1]) { … … 1836 1836 { 1837 1837 ALLDATA *pAD = WinQueryWindowPtr(hwnd, QWL_USER); 1838 ULONG oldaf files = pAD->affiles;1838 ULONG oldafheadcnt = pAD->afheadcnt; 1839 1839 register ULONG x, y; 1840 1840 1841 for (x = 0; x < pAD->af files; x++) {1841 for (x = 0; x < pAD->afheadcnt; x++) { 1842 1842 if (pAD->afhead[x].flags & AF_DELETED) { 1843 for (y = x; y < pAD->af files; y++) {1843 for (y = x; y < pAD->afheadcnt; y++) { 1844 1844 if (~pAD->afhead[y].flags & AF_DELETED) 1845 1845 break; … … 1852 1852 } 1853 1853 memmove(&(pAD->afhead[x]), &(pAD->afhead[y]), 1854 (pAD->af files- y) * sizeof(ALLFILES));1855 pAD->af files-= (y - x);1854 (pAD->afheadcnt - y) * sizeof(ALLFILES)); 1855 pAD->afheadcnt -= (y - x); 1856 1856 } 1857 1857 } // for x 1858 if (pAD->af files != oldaffiles) {1858 if (pAD->afheadcnt != oldafheadcnt) { 1859 1859 1860 1860 ALLFILES *tempa, **templ; 1861 1861 1862 if (!pAD->af files)1862 if (!pAD->afheadcnt) 1863 1863 FreeAllFilesList(hwnd); 1864 1864 else { 1865 1865 tempa = 1866 xrealloc(pAD->afhead, pAD->af files* sizeof(ALLFILES), pszSrcFile,1866 xrealloc(pAD->afhead, pAD->afheadcnt * sizeof(ALLFILES), pszSrcFile, 1867 1867 __LINE__); 1868 1868 if (tempa) { 1869 1869 pAD->afhead = tempa; 1870 pAD->afalloc = pAD->af files;1870 pAD->afalloc = pAD->afheadcnt; 1871 1871 } 1872 1872 templ = 1873 xrealloc(pAD->afindex, pAD->af files* sizeof(ALLFILES *), pszSrcFile,1873 xrealloc(pAD->afindex, pAD->afheadcnt * sizeof(ALLFILES *), pszSrcFile, 1874 1874 __LINE__); 1875 1875 if (templ) … … 1879 1879 } 1880 1880 } 1881 return pAD->af files;1881 return pAD->afheadcnt; 1882 1882 } 1883 1883 … … 1942 1942 *enddir = 0; 1943 1943 strcpy(enddir, pffbFile->achName); 1944 if (!ad->afalloc || ad->af files> ad->afalloc - 1) {1944 if (!ad->afalloc || ad->afheadcnt > ad->afalloc - 1) { 1945 1945 1946 1946 ALLFILES *temp; … … 1959 1959 } 1960 1960 } 1961 ad->afhead[ad->af files].fullname =1961 ad->afhead[ad->afheadcnt].fullname = 1962 1962 xstrdup(filename, pszSrcFile, __LINE__); 1963 if (!ad->afhead[ad->af files].fullname) {1963 if (!ad->afhead[ad->afheadcnt].fullname) { 1964 1964 ad->stopflag = 1; 1965 1965 break; 1966 1966 } 1967 1967 else { 1968 ad->afhead[ad->af files].filename =1969 ad->afhead[ad->af files].fullname + (enddir - filename);1970 ad->afhead[ad->af files].cbFile = pffbFile->cbFile;1971 ad->afhead[ad->af files].date = pffbFile->fdateLastWrite;1972 ad->afhead[ad->af files].time = pffbFile->ftimeLastWrite;1973 ad->afhead[ad->af files].attrFile = (USHORT) pffbFile->attrFile;1974 ad->afhead[ad->af files].flags = 0;1975 ad->af files++;1968 ad->afhead[ad->afheadcnt].filename = 1969 ad->afhead[ad->afheadcnt].fullname + (enddir - filename); 1970 ad->afhead[ad->afheadcnt].cbFile = pffbFile->cbFile; 1971 ad->afhead[ad->afheadcnt].date = pffbFile->fdateLastWrite; 1972 ad->afhead[ad->afheadcnt].time = pffbFile->ftimeLastWrite; 1973 ad->afhead[ad->afheadcnt].attrFile = (USHORT) pffbFile->attrFile; 1974 ad->afhead[ad->afheadcnt].flags = 0; 1975 ad->afheadcnt++; 1976 1976 if (ad->longest < pffbFile->cchName) 1977 1977 ad->longest = pffbFile->cchName; … … 2038 2038 } 2039 2039 } 2040 if (ad->afalloc != ad->af files) {2040 if (ad->afalloc != ad->afheadcnt) { 2041 2041 2042 2042 ALLFILES *tempa, **templ; 2043 2043 2044 2044 tempa = 2045 xrealloc(ad->afhead, sizeof(ALLFILES) * ad->af files, pszSrcFile,2045 xrealloc(ad->afhead, sizeof(ALLFILES) * ad->afheadcnt, pszSrcFile, 2046 2046 __LINE__); 2047 2047 if (tempa) { 2048 2048 ad->afhead = tempa; 2049 ad->afalloc = ad->af files;2049 ad->afalloc = ad->afheadcnt; 2050 2050 } 2051 2051 templ = 2052 xrealloc(ad->afindex, sizeof(ALLFILES *) * ad->af files, pszSrcFile,2052 xrealloc(ad->afindex, sizeof(ALLFILES *) * ad->afheadcnt, pszSrcFile, 2053 2053 __LINE__); 2054 2054 if (templ) … … 2230 2230 ULONG len, y; 2231 2231 2232 y = (ad->invertsort) ? (ad->afi files- 1) - whichfile : whichfile;2232 y = (ad->invertsort) ? (ad->afindexcnt - 1) - whichfile : whichfile; 2233 2233 ptl.y = (Rectl->yTop - 2234 2234 (ad->lMaxHeight * (((whichfile + 1) - topfile) + 1))); 2235 2235 ptl.x = ad->horzscroll; 2236 if (ptl.y < Rectl->yBottom || ptl.y > Rectl->yTop || y > ad->afi files)2236 if (ptl.y < Rectl->yBottom || ptl.y > Rectl->yTop || y > ad->afindexcnt) 2237 2237 return; 2238 2238 GpiSetBackMix(hps, BM_OVERPAINT); … … 2635 2635 // fprintf(stderr,"Seeall: UM_SETUP3\n"); 2636 2636 if (pAD) { 2637 pAD->multiplier = pAD->afi files/ 32767;2638 if (pAD->multiplier * 32767 != pAD->afi files)2637 pAD->multiplier = pAD->afindexcnt / 32767; 2638 if (pAD->multiplier * 32767 != pAD->afindexcnt) 2639 2639 pAD->multiplier++; 2640 2640 if (!pAD->multiplier) … … 2652 2652 WinSendMsg(pAD->hvscroll, SBM_SETTHUMBSIZE, 2653 2653 MPFROM2SHORT((SHORT) numlines, 2654 (SHORT) min(pAD->afi files, 32767)),2655 MPFROM2SHORT(1, pAD->afi files+ 1));2654 (SHORT) min(pAD->afindexcnt, 32767)), 2655 MPFROM2SHORT(1, pAD->afindexcnt + 1)); 2656 2656 WinSendMsg(pAD->hhscroll, SBM_SETSCROLLBAR, 2657 2657 MPFROMSHORT((SHORT) abs(pAD->horzscroll)), … … 2660 2660 MPFROMSHORT((SHORT) (pAD->topfile / pAD->multiplier)), 2661 2661 MPFROM2SHORT(1, 2662 (SHORT) (pAD->afi files/ pAD->multiplier) -2662 (SHORT) (pAD->afindexcnt / pAD->multiplier) - 2663 2663 (numlines - 1))); 2664 if (pAD->afi files- pAD->topfile < numlines) {2665 pAD->topfile = ((pAD->afi files- pAD->topfile) - numlines);2664 if (pAD->afindexcnt - pAD->topfile < numlines) { 2665 pAD->topfile = ((pAD->afindexcnt - pAD->topfile) - numlines); 2666 2666 WinInvalidateRect(hwnd, NULL, FALSE); 2667 2667 } … … 2687 2687 if (mp1) { 2688 2688 strcpy(s, GetPString(IDS_SORTINGTEXT)); 2689 if (pAD->afi files) {2690 commafmt(tm, sizeof(tm), pAD->afi files);2689 if (pAD->afindexcnt) { 2690 commafmt(tm, sizeof(tm), pAD->afindexcnt); 2691 2691 strcat(s, tm); 2692 2692 } … … 2694 2694 else { 2695 2695 strcpy(s, GetPString(IDS_WORKINGTEXT)); 2696 if (pAD->af files) {2697 commafmt(tm, sizeof(tm), pAD->af files);2696 if (pAD->afheadcnt) { 2697 commafmt(tm, sizeof(tm), pAD->afheadcnt); 2698 2698 strcat(s, tm); 2699 2699 } … … 2711 2711 if (mp1) { 2712 2712 strcpy(s, GetPString(IDS_SORTINGTEXT)); 2713 if (pAD->afi files) {2714 commafmt(tm, sizeof(tm), pAD->afi files);2713 if (pAD->afindexcnt) { 2714 commafmt(tm, sizeof(tm), pAD->afindexcnt); 2715 2715 strcat(s, tm); 2716 2716 } … … 2720 2720 } 2721 2721 } 2722 else if (pAD->afi files) {2723 y = (pAD->invertsort) ? (pAD->afi files- 1) - (pAD->cursored - 1) :2722 else if (pAD->afindexcnt) { 2723 y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - (pAD->cursored - 1) : 2724 2724 pAD->cursored - 1; 2725 commafmt(tm, sizeof(tm), pAD->afi files);2725 commafmt(tm, sizeof(tm), pAD->afindexcnt); 2726 2726 commafmt(ts, sizeof(ts), pAD->selected); 2727 2727 CommaFmtULL(tb, sizeof(tb), pAD->ullSelectedBytes, ' '); … … 2730 2730 tm, 2731 2731 GetPString(IDS_FILETEXT), 2732 &"s"[pAD->afi files== 1],2732 &"s"[pAD->afindexcnt == 1], 2733 2733 (*pAD->mask.szMask || 2734 2734 (pAD->mask.attrFile & (~FILE_DIRECTORY)) != … … 2831 2831 break; 2832 2832 case VK_DOWN: 2833 if (pAD->cursored < pAD->afi files2833 if (pAD->cursored < pAD->afindexcnt 2834 2834 && pAD->cursored < pAD->topfile + numlines) { 2835 2835 if (shiftstate & KC_SHIFT) … … 2860 2860 if ((shiftstate & KC_CTRL) || 2861 2861 pAD->cursored == (pAD->topfile - 1) + numlines) { 2862 pAD->cursored = pAD->afi files;2863 pAD->topfile = (pAD->afi files+ 1) - numlines;2864 if (pAD->topfile > pAD->afi files)2862 pAD->cursored = pAD->afindexcnt; 2863 pAD->topfile = (pAD->afindexcnt + 1) - numlines; 2864 if (pAD->topfile > pAD->afindexcnt) 2865 2865 pAD->topfile = 1; 2866 2866 WinInvalidateRect(hwnd, NULL, FALSE); … … 2868 2868 else { 2869 2869 pAD->cursored = (pAD->topfile - 1) + numlines; 2870 if (pAD->cursored > pAD->afi files)2871 pAD->cursored = pAD->afi files;2870 if (pAD->cursored > pAD->afindexcnt) 2871 pAD->cursored = pAD->afindexcnt; 2872 2872 PaintLine(hwnd, pAD->hps, pAD->cursored - 1, pAD->topfile, 2873 2873 &rcl); … … 2938 2938 pAD->szCommonName[len] = toupper(SHORT1FROMMP(mp2)); 2939 2939 pAD->szCommonName[len + 1] = 0; 2940 for (x = pAD->cursored - (len > 0); x < pAD->afi files; x++) {2941 y = (pAD->invertsort) ? (pAD->afi files- 1) - x : x;2940 for (x = pAD->cursored - (len > 0); x < pAD->afindexcnt; x++) { 2941 y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - x : x; 2942 2942 if (pAD->fullnames) { 2943 2943 if (!strnicmp(pAD->afindex[y]->fullname, pAD->szCommonName, … … 2957 2957 if (!found) { 2958 2958 for (x = 0; x < pAD->cursored - (len > 0); x++) { 2959 y = (pAD->invertsort) ? (pAD->afi files- 1) - x : x;2959 y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - x : x; 2960 2960 if (pAD->fullnames) { 2961 2961 if (!strnicmp(pAD->afindex[y]->fullname, pAD->szCommonName, … … 2989 2989 pAD->topfile = 1; 2990 2990 else if (pAD->cursored > 2991 (pAD->afi files+ 1) - (numlines / 2))2992 pAD->topfile = (pAD->afi files+ 1) - numlines;2991 (pAD->afindexcnt + 1) - (numlines / 2)) 2992 pAD->topfile = (pAD->afindexcnt + 1) - numlines; 2993 2993 else 2994 2994 pAD->topfile = pAD->cursored - (numlines / 2); … … 3076 3076 whichfile = numlines - 1; 3077 3077 whichfile += (pAD->topfile - 1); 3078 y = (pAD->invertsort) ? (pAD->afi files- 1) - whichfile : whichfile;3079 if (y < pAD->afi files&& pAD->lastselected != whichfile) {3078 y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - whichfile : whichfile; 3079 if (y < pAD->afindexcnt && pAD->lastselected != whichfile) { 3080 3080 if (pAD->lastselected != (ULONG) - 1) { 3081 3081 inc = (pAD->lastselected < whichfile) ? 1 : -1; 3082 3082 for (x = pAD->lastselected + inc; 3083 x != whichfile && x < pAD->afi files;3083 x != whichfile && x < pAD->afindexcnt; 3084 3084 (pAD->lastselected < whichfile) ? x++ : x--) { 3085 y = (pAD->invertsort) ? (pAD->afi files- 1) - x : x;3085 y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - x : x; 3086 3086 if (pAD->afindex[y]->flags & AF_SELECTED) { 3087 3087 pAD->afindex[y]->flags &= ~AF_SELECTED; … … 3155 3155 POINTS pts; 3156 3156 3157 if (pAD->afi files) {3157 if (pAD->afindexcnt) { 3158 3158 WinQueryWindowRect(hwnd, &Rectl); 3159 3159 numlines = NumLines(&Rectl, pAD); … … 3166 3166 whichfile = numlines - 1; 3167 3167 whichfile += (pAD->topfile - 1); 3168 if (whichfile + 1 > pAD->afi files)3168 if (whichfile + 1 > pAD->afindexcnt) 3169 3169 break; 3170 y = (pAD->invertsort) ? (pAD->afi files- 1) - whichfile : whichfile;3170 y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - whichfile : whichfile; 3171 3171 wascursored = pAD->cursored; 3172 3172 pAD->cursored = whichfile + 1; 3173 3173 if (pAD->cursored != wascursored) 3174 3174 PaintLine(hwnd, pAD->hps, wascursored - 1, pAD->topfile, &Rectl); 3175 if (y < pAD->afi files) {3175 if (y < pAD->afindexcnt) { 3176 3176 if (msg == WM_BUTTON1CLICK || fUnHilite) { 3177 3177 if (pAD->afindex[y]->flags & AF_SELECTED) { … … 3289 3289 (rc == 0 && pAD->selected != 0)); 3290 3290 WinEnableMenuItem(pAD->hwndPopup, IDM_SELECTALL, 3291 (rc == 0 && pAD->afi files!= 0));3291 (rc == 0 && pAD->afindexcnt != 0)); 3292 3292 WinEnableMenuItem(pAD->hwndPopup, IDM_SELECTMASK, 3293 (rc == 0 && pAD->afi files!= 0));3293 (rc == 0 && pAD->afindexcnt != 0)); 3294 3294 WinEnableMenuItem(pAD->hwndPopup, IDM_DESELECTALL, 3295 (rc == 0 && pAD->afi files!= 0));3295 (rc == 0 && pAD->afindexcnt != 0)); 3296 3296 WinEnableMenuItem(pAD->hwndPopup, IDM_DESELECTMASK, 3297 (rc == 0 && pAD->afi files!= 0));3297 (rc == 0 && pAD->afindexcnt != 0)); 3298 3298 WinEnableMenuItem(pAD->hwndPopup, IDM_INVERT, 3299 (rc == 0 && pAD->afi files!= 0));3299 (rc == 0 && pAD->afindexcnt != 0)); 3300 3300 WinEnableMenuItem(pAD->hwndPopup, IDM_FILTER, 3301 (rc == 0 && pAD->af files!= 0));3301 (rc == 0 && pAD->afheadcnt != 0)); 3302 3302 if (!rc) 3303 3303 DosReleaseMutexSem(pAD->hmtxScan); … … 3317 3317 pAD->cursored = 1; 3318 3318 pAD->multiplier = 1; 3319 if (!pAD->afi files) {3319 if (!pAD->afindexcnt) { 3320 3320 DosBeep(250, 50); 3321 3321 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); … … 3354 3354 WinQueryWindowRect(hwnd, &Rectl); 3355 3355 numlines = NumLines(&Rectl, pAD); 3356 if (pAD->afi files&& numlines) {3357 if (pAD->topfile > (pAD->afi files+ 1) - numlines)3358 pAD->topfile = (pAD->afi files+ 1) - numlines;3359 if (pAD->topfile > pAD->afi files)3356 if (pAD->afindexcnt && numlines) { 3357 if (pAD->topfile > (pAD->afindexcnt + 1) - numlines) 3358 pAD->topfile = (pAD->afindexcnt + 1) - numlines; 3359 if (pAD->topfile > pAD->afindexcnt) 3360 3360 pAD->topfile = 1; 3361 3361 if (!pAD->topfile) … … 3365 3365 else if (pAD->cursored > (pAD->topfile + numlines) - 1) 3366 3366 pAD->cursored = (pAD->topfile + numlines) - 1; 3367 if (pAD->cursored > pAD->afi files)3368 pAD->cursored = pAD->afi files;3367 if (pAD->cursored > pAD->afindexcnt) 3368 pAD->cursored = pAD->afindexcnt; 3369 3369 } 3370 3370 else 3371 3371 pAD->topfile = pAD->cursored = 1; 3372 if (numlines && pAD->afi files) {3372 if (numlines && pAD->afindexcnt) { 3373 3373 GpiSetBackMix(hpsp, BM_OVERPAINT); 3374 3374 wascursored = TRUE; 3375 for (x = pAD->topfile - 1; x < pAD->afi files; x++) {3375 for (x = pAD->topfile - 1; x < pAD->afindexcnt; x++) { 3376 3376 ptl.x = pAD->horzscroll; 3377 3377 if (wascursored) { /* reestablish normal colors */ … … 3384 3384 if (x == pAD->cursored - 1) 3385 3385 wascursored = TRUE; 3386 y = (pAD->invertsort) ? (pAD->afi files- 1) - x : x;3386 y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - x : x; 3387 3387 ptl.y = (Rectl.yTop - 3388 3388 (pAD->lMaxHeight * (((x + 1) - pAD->topfile) + 1))); … … 3472 3472 MPFROMSHORT((SHORT) (pAD->topfile / pAD->multiplier)), 3473 3473 MPFROM2SHORT(1, 3474 (SHORT) (pAD->afi files/ pAD->multiplier) -3474 (SHORT) (pAD->afindexcnt / pAD->multiplier) - 3475 3475 (numlines - 1))); 3476 3476 WinSendMsg(pAD->hhscroll, SBM_SETSCROLLBAR, … … 3542 3542 RECTL rcl; 3543 3543 3544 if (pAD->afi files) {3544 if (pAD->afindexcnt) { 3545 3545 WinQueryWindowRect(hwnd, &rcl); 3546 3546 numlines = NumLines(&rcl, pAD); … … 3551 3551 if (pAD->topfile > 1) { 3552 3552 pAD->topfile -= numlines; 3553 if (pAD->topfile > pAD->afi files||3554 pAD->topfile > (pAD->afi files+ 1) - numlines)3553 if (pAD->topfile > pAD->afindexcnt || 3554 pAD->topfile > (pAD->afindexcnt + 1) - numlines) 3555 3555 pAD->topfile = 1; 3556 3556 if (pAD->cursored > pAD->topfile + numlines) 3557 3557 pAD->cursored = pAD->topfile + numlines; 3558 if (pAD->cursored > pAD->afi files)3559 pAD->cursored = pAD->afi files;3558 if (pAD->cursored > pAD->afindexcnt) 3559 pAD->cursored = pAD->afindexcnt; 3560 3560 WinInvalidateRect(hwnd, NULL, FALSE); 3561 3561 } 3562 3562 break; 3563 3563 case SB_PAGEDOWN: 3564 if (pAD->topfile <= pAD->afi files- numlines) {3564 if (pAD->topfile <= pAD->afindexcnt - numlines) { 3565 3565 pAD->topfile += numlines; 3566 if (pAD->topfile > (pAD->afi files+ 1) - numlines)3567 pAD->topfile = (pAD->afi files+ 1) - numlines;3566 if (pAD->topfile > (pAD->afindexcnt + 1) - numlines) 3567 pAD->topfile = (pAD->afindexcnt + 1) - numlines; 3568 3568 if (pAD->cursored < pAD->topfile) 3569 3569 pAD->cursored = pAD->topfile; 3570 3570 if (pAD->cursored > (pAD->topfile + numlines) - 1) 3571 3571 pAD->cursored = (pAD->topfile + numlines) - 1; 3572 if (pAD->cursored > pAD->afi files)3573 pAD->cursored = pAD->afi files;3572 if (pAD->cursored > pAD->afindexcnt) 3573 pAD->cursored = pAD->afindexcnt; 3574 3574 WinInvalidateRect(hwnd, NULL, FALSE); 3575 3575 } 3576 3576 break; 3577 3577 case SB_LINEDOWN: 3578 if (pAD->topfile <= pAD->afi files- numlines) {3578 if (pAD->topfile <= pAD->afindexcnt - numlines) { 3579 3579 3580 3580 RECTL Rectl, iRectl; … … 3585 3585 else if (pAD->cursored > (pAD->topfile + numlines) - 1) 3586 3586 pAD->cursored = (pAD->topfile + numlines) - 1; 3587 if (pAD->cursored > pAD->afi files)3588 pAD->cursored = pAD->afi files;3587 if (pAD->cursored > pAD->afindexcnt) 3588 pAD->cursored = pAD->afindexcnt; 3589 3589 WinQueryWindowRect(hwnd, &Rectl); 3590 3590 WinScrollWindow(hwnd, 0, pAD->lMaxHeight, … … 3610 3610 MPFROMSHORT((SHORT) (pAD->topfile / 3611 3611 pAD->multiplier)), 3612 MPFROM2SHORT(1, (SHORT) (pAD->afi files/3612 MPFROM2SHORT(1, (SHORT) (pAD->afindexcnt / 3613 3613 pAD->multiplier) - 3614 3614 (numlines - 1))); … … 3625 3625 else if (pAD->cursored > (pAD->topfile + numlines) - 1) 3626 3626 pAD->cursored = (pAD->topfile + numlines) - 1; 3627 if (pAD->cursored > pAD->afi files)3628 pAD->cursored = pAD->afi files;3627 if (pAD->cursored > pAD->afindexcnt) 3628 pAD->cursored = pAD->afindexcnt; 3629 3629 WinQueryWindowRect(hwnd, &Rectl); 3630 3630 WinScrollWindow(hwnd, 0, -pAD->lMaxHeight, … … 3654 3654 MPFROMSHORT((SHORT) (pAD->topfile / 3655 3655 pAD->multiplier)), 3656 MPFROM2SHORT(1, (SHORT) (pAD->afi files/3656 MPFROM2SHORT(1, (SHORT) (pAD->afindexcnt / 3657 3657 pAD->multiplier) - 3658 3658 (numlines - 1))); … … 3661 3661 case SB_SLIDERTRACK: 3662 3662 if ((SHORT1FROMMP(mp2) >= 1) || 3663 (SHORT1FROMMP(mp2)) <= pAD->afi files) {3663 (SHORT1FROMMP(mp2)) <= pAD->afindexcnt) { 3664 3664 pAD->topfile = (ULONG) SHORT1FROMMP(mp2) * pAD->multiplier; 3665 if (pAD->topfile > (pAD->afi files+ 1) - numlines)3666 pAD->topfile = (pAD->afi files+ 1) - numlines;3665 if (pAD->topfile > (pAD->afindexcnt + 1) - numlines) 3666 pAD->topfile = (pAD->afindexcnt + 1) - numlines; 3667 3667 if (!pAD->topfile) 3668 3668 pAD->topfile = 1; … … 3671 3671 else if (pAD->cursored > pAD->topfile + numlines) 3672 3672 pAD->cursored = pAD->topfile + numlines; 3673 if (pAD->cursored > pAD->afi files)3674 pAD->cursored = pAD->afi files;3673 if (pAD->cursored > pAD->afindexcnt) 3674 pAD->cursored = pAD->afindexcnt; 3675 3675 WinInvalidateRect(hwnd, NULL, FALSE); 3676 3676 } … … 3746 3746 rc = DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN); 3747 3747 WinEnableMenuItem((HWND) mp2, IDM_SELECTALL, (rc == 0 && 3748 pAD->afi files!= 0 &&3749 (pAD->afi files!=3748 pAD->afindexcnt != 0 && 3749 (pAD->afindexcnt != 3750 3750 pAD->selected || 3751 3751 !pAD->selected))); 3752 3752 WinEnableMenuItem((HWND) mp2, IDM_SELECTMASK, (rc == 0 && 3753 pAD->afi files!= 0 &&3754 (pAD->afi files!=3753 pAD->afindexcnt != 0 && 3754 (pAD->afindexcnt != 3755 3755 pAD->selected || 3756 3756 !pAD->selected))); 3757 3757 WinEnableMenuItem((HWND) mp2, IDM_DESELECTALL, (rc == 0 && 3758 pAD->afi files!= 03758 pAD->afindexcnt != 0 3759 3759 && pAD->selected)); 3760 3760 WinEnableMenuItem((HWND) mp2, IDM_DESELECTMASK, 3761 (rc == 0 && pAD->afi files!= 0) && pAD->selected);3761 (rc == 0 && pAD->afindexcnt != 0) && pAD->selected); 3762 3762 WinEnableMenuItem((HWND) mp2, IDM_INVERT, 3763 (rc == 0 && pAD->afi files!= 0));3763 (rc == 0 && pAD->afindexcnt != 0)); 3764 3764 if (!rc) 3765 3765 DosReleaseMutexSem(pAD->hmtxScan); … … 3803 3803 WinEnableMenuItem((HWND) mp2, IDM_RESCAN, (rc == 0)); 3804 3804 WinEnableMenuItem((HWND) mp2, IDM_FILTER, (rc == 0 && 3805 pAD->af files!= 0));3805 pAD->afheadcnt != 0)); 3806 3806 if (!rc) 3807 3807 DosReleaseMutexSem(pAD->hmtxScan);  
  Note:
 See   TracChangeset
 for help on using the changeset viewer.
  