Changeset 1471
- Timestamp:
- Oct 14, 2009, 1:43:04 AM (16 years ago)
- Location:
- trunk/dll
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/filldir.c
r1459 r1471 7 7 8 8 Copyright (c) 1993-98 M. Kimes 9 Copyright (c) 2001, 200 8Steven H. Levine9 Copyright (c) 2001, 2009 Steven H. Levine 10 10 11 11 10 Jan 04 SHL ProcessDirectory: avoid most large drive failures … … 79 79 22 Jul 09 GKY Streamline scanning code for faster Tree rescans 80 80 15 Sep 09 SHL Show rescan progress while filling container 81 26 Sep 09 SHL Add FreeCnrItemData debug code - do not let into the wild 82 13 Oct 09 SHL Avoid szDriver overflow in FillTreeCnr 83 13 Oct 09 SHL Restore missing drives in drive drop-down listbox; optimize updates 81 84 82 85 ***********************************************************************/ … … 99 102 #include "info.h" // Data declaration(s) 100 103 #include "newview.h" // Data declaration(s) 104 #include "mainwnd.h" // hwndDrivelist 101 105 #include "fm3str.h" 102 106 #include "filldir.h" … … 141 145 PCNRITEM pci; 142 146 HWND hwndCnr; // hwnd you want the message posted to 143 HWND hwndDrivesList;144 //BOOL RamDrive;145 147 } 146 148 STUBBYSCAN; … … 209 211 HAB thab; 210 212 HMQ hmq = (HMQ) 0; 211 BOOL ret;213 BOOL ok; 212 214 213 215 DosError(FERR_DISABLEHARDERR); … … 225 227 IncrThreadUsage(); 226 228 priority_normal(); 227 ret= Stubby(StubbyScan->hwndCnr, StubbyScan->pci);228 if ( ret == 1) {229 ok = Stubby(StubbyScan->hwndCnr, StubbyScan->pci); 230 if (ok) { 229 231 if (WinIsWindow((HAB)0, StubbyScan->hwndCnr)) { 230 232 ULONG flags = driveflags[toupper(*StubbyScan->pci->pszFileName) - 'A']; … … 281 283 ProcessDir->partial, 282 284 ProcessDir->stopflag, 283 ProcessDir->dcd, 285 ProcessDir->dcd, // Optional 284 286 ProcessDir->pulTotalFiles, // Optional 285 287 ProcessDir->pullTotalBytes); // Optional … … 532 534 if (!*pffb->achName) { 533 535 pci->pszFileName = xstrdup(pszDirectory, pszSrcFile, __LINE__); 534 //strcpy(pci->pszFileName, pszDirectory);535 536 } 536 537 else { … … 880 881 881 882 PSZ pszFileSpec; 882 //INT t;883 883 PFILEFINDBUF4L paffbFound; 884 884 PFILEFINDBUF4L *papffbSelected; … … 895 895 ULONG ulReturnFiles = 0; 896 896 ULONGLONG ullReturnBytes = 0; 897 //PCH pchEndPath;898 897 APIRET rc; 899 898 PCNRITEM pci; … … 925 924 926 925 if (paffbFound && papffbSelected && pszFileSpec) { 927 //t = strlen(szDirBase);928 926 strcpy(pszFileSpec, szDirBase); 929 927 AddBackslashToPath(pszFileSpec); 930 //pchEndPath = pszFileSpec + t;931 //if (*(pchEndPath - 1) != '\\') {932 // memcpy(pchEndPath, "\\", 2);933 // pchEndPath++;934 //}935 928 strcat(pszFileSpec, "*"); 936 929 DosError(FERR_DISABLEHARDERR); … … 946 939 FIL_QUERYEASIZEL); 947 940 priority_normal(); 948 pszFileSpec[strlen(pszFileSpec) - 1] = 0; 941 pszFileSpec[strlen(pszFileSpec) - 1] = 0; // Chop off wildcard 949 942 if (!rc) { 950 943 do { … … 1098 1091 else { 1099 1092 // 04 Jan 08 SHL fixme like comp.c to handle less than ulSelCnt records 1100 if ( dcd && hwndStatus&&1093 if (hwndStatus && dcd && 1101 1094 dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent)) { 1102 1095 WinSetWindowText(hwndStatus, GetPString(IDS_PLEASEWAITCOUNTINGTEXT)); … … 1167 1160 } 1168 1161 1162 // 13 Oct 09 SHL fixme to be saymsg if ERROR_NOT_READY and first try on volume 1169 1163 if (rc && rc != ERROR_NO_MORE_FILES) { 1170 1164 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, … … 1231 1225 } // FillDirCnr 1232 1226 1227 /** 1228 * Fill tree container and drives list 1229 * Offer to update command line options if not already done and not suppressed 1230 */ 1231 1233 1232 VOID FillTreeCnr(HWND hwndCnr, HWND hwndParent) 1234 1233 { 1235 ULONG ulCurDriveNum, ulDriveMap, numtoinsert = 0; 1234 ULONG ulCurDriveNum; 1235 ULONG ulDriveMap; 1236 ULONG numtoinsert = 0; 1236 1237 ULONG ulDriveType; 1237 PCNRITEM pci, pciFirst = NULL, pciNext, pciParent = NULL; 1238 INT x;// removable; 1239 CHAR suggest[32]; 1240 CHAR szDrive[] = " :\\"; 1238 PCNRITEM pci, pciFirst = NULL; 1239 PCNRITEM pciNext; 1240 PCNRITEM pciParent = NULL; 1241 UINT iDrvNum; 1242 ULONG ulDriveMapMask; 1243 CHAR szSuggest[32]; // Suggested startup command line parameters 1244 CHAR szDrive[CCHMAXPATH] = " :\\"; // 13 Oct 09 SHL 1241 1245 CHAR szFSType[CCHMAXPATH]; 1242 1246 FILESTATUS4L fsa4; 1243 1247 APIRET rc; 1244 //BOOL drivesbuilt = FALSE;1245 1248 ULONG startdrive = 3; 1249 HWND hwndDrivelist; 1250 1246 1251 static BOOL didonce; 1252 static ULONG ulLastDriveMap; 1247 1253 1248 1254 fDummy = TRUE; 1249 *s uggest = 0;1250 for ( x = 0; x < 26; x++) {1251 driveflags[ x] &= (DRIVE_IGNORE | DRIVE_NOPRESCAN | DRIVE_NOLOADICONS |1255 *szSuggest = 0; 1256 for (iDrvNum = 0; iDrvNum < 26; iDrvNum++) { 1257 driveflags[iDrvNum] &= (DRIVE_IGNORE | DRIVE_NOPRESCAN | DRIVE_NOLOADICONS | 1252 1258 DRIVE_NOLOADSUBJS | DRIVE_NOLOADLONGS | 1253 1259 DRIVE_INCLUDEFILES | DRIVE_SLOW | DRIVE_NOSTATS | … … 1276 1282 } 1277 1283 1278 // Calc number of drive items to create 1279 for (x = 0; x < 26; x++) { 1280 if ((ulDriveMap & (1L << x)) && !(driveflags[x] & DRIVE_IGNORE)) 1284 // Find drive list combobox if it exists 1285 if (hwndParent) { 1286 hwndDrivelist = WinWindowFromID(WinQueryWindow(hwndParent, QW_PARENT), 1287 MAIN_DRIVELIST); 1288 } 1289 else 1290 hwndDrivelist = NULLHANDLE; 1291 1292 // Calc number of top level drive tree items to create 1293 for (iDrvNum = 0; iDrvNum < 26; iDrvNum++) { 1294 if ((ulDriveMap & (1L << iDrvNum)) && ~driveflags[iDrvNum] & DRIVE_IGNORE) 1281 1295 numtoinsert++; 1282 1296 } … … 1297 1311 // 04 Jan 08 SHL fixme like comp.c to handle less than ulSelCnt records 1298 1312 pci = pciFirst; 1299 for ( x = 0; x < 26; x++) {1300 if ((ulDriveMap & (1L << x)) && !(driveflags[x] & DRIVE_IGNORE)) {1301 1313 for (iDrvNum = 0; iDrvNum < 26; iDrvNum++) { 1314 ulDriveMapMask = 1L << iDrvNum; 1315 if (ulDriveMap & ulDriveMapMask && ~driveflags[iDrvNum] & DRIVE_IGNORE) { 1302 1316 CHAR s[80]; 1303 1317 ULONG flags = 0; 1304 1318 ULONG size = sizeof(ULONG); 1305 1319 struct { 1306 1307 1308 1309 1310 1311 *szDrive = (CHAR) x + 'A'; // Build path spec1320 ULONG serial; 1321 CHAR volumelength; 1322 CHAR volumelabel[CCHMAXPATH]; 1323 } volser; 1324 1325 *szDrive = (CHAR)iDrvNum + 'A'; // Stuff drive letter - assume already have rest of path 1312 1326 1313 1327 sprintf(s, "%c.DriveFlags", toupper(*szDrive)); 1314 1328 if (PrfQueryProfileData(fmprof, appname, s, &flags, &size)) { 1315 driveflags[ toupper(*szDrive) - 'A'] |= flags;1316 } 1317 1318 if ( x> 1) {1329 driveflags[iDrvNum] |= flags; 1330 } 1331 1332 if (iDrvNum > 1) { 1319 1333 // Hard drive (2..N) 1320 if ( !(driveflags[x] & DRIVE_NOPRESCAN)) {1334 if (~driveflags[iDrvNum] & DRIVE_NOPRESCAN) { 1321 1335 *szFSType = 0; 1322 1336 ulDriveType = 0; 1323 1337 memset(&volser, 0, sizeof(volser)); 1324 DriveFlagsOne( x, szFSType, &volser);1325 driveserial[ x] = volser.serial;1338 DriveFlagsOne(iDrvNum, szFSType, &volser); 1339 driveserial[iDrvNum] = volser.serial; 1326 1340 memset(&fsa4, 0, sizeof(FILESTATUS4L)); 1327 if (!fVerifyOffChecked[ x]) {1328 if (driveflags[ x] & DRIVE_REMOVABLE)1329 driveflags[ x] |= DRIVE_WRITEVERIFYOFF;1330 if ( !(driveflags[x] & DRIVE_INVALID)) {1341 if (!fVerifyOffChecked[iDrvNum]) { 1342 if (driveflags[iDrvNum] & DRIVE_REMOVABLE) 1343 driveflags[iDrvNum] |= DRIVE_WRITEVERIFYOFF; 1344 if (~driveflags[iDrvNum] & DRIVE_INVALID) { 1331 1345 CHAR Key[80]; 1332 1346 1333 sprintf(Key, "%c.VerifyOffChecked", (CHAR) ( x+ 'A'));1334 fVerifyOffChecked[ x] = TRUE;1335 PrfWriteProfileData(fmprof, appname, Key, &fVerifyOffChecked[ x], sizeof(BOOL));1347 sprintf(Key, "%c.VerifyOffChecked", (CHAR) (iDrvNum + 'A')); 1348 fVerifyOffChecked[iDrvNum] = TRUE; 1349 PrfWriteProfileData(fmprof, appname, Key, &fVerifyOffChecked[iDrvNum], sizeof(BOOL)); 1336 1350 } 1337 1351 } … … 1342 1356 pci->rc.flRecordAttr |= (CRA_CURSORED | CRA_SELECTED); 1343 1357 1344 if ( !(driveflags[x] & DRIVE_REMOVABLE)) {1358 if (~driveflags[iDrvNum] & DRIVE_REMOVABLE) { 1345 1359 // Fixed volume 1346 1360 pci->attrFile |= FILE_DIRECTORY; … … 1358 1372 if (rc && !didonce) { 1359 1373 // Guess drive letter 1360 if (!*s uggest) {1361 *s uggest = '/';1362 s uggest[1] = 0;1374 if (!*szSuggest) { 1375 *szSuggest = '/'; 1376 szSuggest[1] = 0; 1363 1377 } 1364 1378 1365 sprintf(s uggest + strlen(suggest), "%c" , toupper(*szDrive));1379 sprintf(szSuggest + strlen(szSuggest), "%c" , toupper(*szDrive)); 1366 1380 pci->pszFileName = xstrdup(szDrive, pszSrcFile, __LINE__); 1367 if (fShowFSTypeInTree || fShowDriveLabelInTree) { 1368 strcat(szDrive, " ["); 1369 strcat(szDrive, szFSType); 1370 strcat(szDrive, "]"); 1371 } 1381 if (fShowFSTypeInTree || fShowDriveLabelInTree) 1382 sprintf(szDrive + strlen(szDrive), " [%s]", szFSType); 1372 1383 pci->pszDisplayName = xstrdup(szDrive, pszSrcFile, __LINE__); 1373 szDrive[3] = 0; 1384 szDrive[3] = 0; // Restore nul 1374 1385 pci->rc.pszIcon = pci->pszDisplayName; 1375 1386 pci->attrFile = FILE_DIRECTORY; 1376 1387 pci->pszDispAttr = FileAttrToString(pci->attrFile); 1377 driveserial[ x] = -1;1388 driveserial[iDrvNum] = -1; 1378 1389 } 1379 1390 else … … 1383 1394 // Removable volume 1384 1395 pci->pszFileName = xstrdup(szDrive, pszSrcFile, __LINE__); 1385 if (fShowFSTypeInTree || fShowDriveLabelInTree) { 1386 strcat(szDrive, " ["); 1387 strcat(szDrive, szFSType); 1388 strcat(szDrive, "]"); 1389 } 1396 if (fShowFSTypeInTree || fShowDriveLabelInTree) 1397 sprintf(szDrive + strlen(szDrive), " [%s]", szFSType); 1390 1398 pci->pszDisplayName = xstrdup(szDrive, pszSrcFile, __LINE__); 1391 szDrive[3] = 0; 1399 szDrive[3] = 0; // Restore nul 1392 1400 pci->rc.pszIcon = pci->pszDisplayName; 1393 1401 pci->attrFile = FILE_DIRECTORY; … … 1404 1412 pci->rc.hptrIcon = hptrDunno; 1405 1413 pci->pszFileName = xstrdup(szDrive, pszSrcFile, __LINE__); 1406 if (fShowFSTypeInTree || fShowDriveLabelInTree) {1414 if (fShowFSTypeInTree || fShowDriveLabelInTree) 1407 1415 strcat(szDrive, " [?]"); 1408 }1409 1416 pci->pszDisplayName = xstrdup(szDrive, pszSrcFile, __LINE__); 1410 1417 szDrive[3] = 0; … … 1416 1423 pci->attrFile = FILE_DIRECTORY; 1417 1424 pci->pszDispAttr = FileAttrToString(pci->attrFile); 1418 driveserial[ x] = -1;1425 driveserial[iDrvNum] = -1; 1419 1426 } 1420 1427 } … … 1430 1437 pci->attrFile = FILE_DIRECTORY; 1431 1438 pci->pszDispAttr = FileAttrToString(pci->attrFile); 1432 driveflags[ x] |= (DRIVE_REMOVABLE | DRIVE_NOLONGNAMES);1433 driveserial[ x] = -1;1439 driveflags[iDrvNum] |= (DRIVE_REMOVABLE | DRIVE_NOLONGNAMES); 1440 driveserial[iDrvNum] = -1; 1434 1441 } 1435 1442 pci->rc.flRecordAttr |= CRA_RECORDREADONLY; 1436 1443 pci = (PCNRITEM) pci->rc.preccNextRecord; // next rec 1437 1444 } 1438 else if (!(ulDriveMap & (1L << x))) 1439 driveflags[x] |= DRIVE_INVALID; 1445 else if (~ulDriveMap & ulDriveMapMask) 1446 driveflags[iDrvNum] |= DRIVE_INVALID; 1447 1448 // 13 Oct 09 SHL 1449 // Update drives list dropdown 1450 if ((ulDriveMap ^ ulLastDriveMap) & ulDriveMapMask) { 1451 if (ulDriveMap & ulDriveMapMask) { 1452 WinSendMsg(hwndDrivelist, 1453 LM_INSERTITEM, 1454 MPFROM2SHORT(LIT_SORTASCENDING, 0), 1455 MPFROMP(szDrive)); 1456 } 1457 else { 1458 // Drive went away 1459 SHORT sSelect = (SHORT)WinSendMsg(hwndDrivelist, 1460 LM_SEARCHSTRING, 1461 MPFROM2SHORT(0, LIT_FIRST), 1462 MPFROMP(szDrive)); 1463 if (sSelect >= 0) 1464 WinSendMsg(hwndDrivelist, LM_DELETEITEM, MPFROMSHORT(sSelect), MPVOID); 1465 } 1466 } 1440 1467 } // for drives 1441 1468 1442 //PostMsg(hwndMain, UM_BUILDDRIVEBAR, MPVOID, MPVOID); 1443 //drivesbuilt = TRUE; 1469 ulLastDriveMap = ulDriveMap; // 13 Oct 09 SHL 1444 1470 1445 1471 // insert the drives … … 1480 1506 MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); 1481 1507 } 1482 }1483 1484 if (hwndParent) {1485 WinSendMsg(WinWindowFromID(WinQueryWindow(hwndParent, QW_PARENT),1486 MAIN_DRIVELIST),1487 LM_DELETEALL, MPVOID, MPVOID);1488 1508 } 1489 1509 … … 1566 1586 { 1567 1587 STUBBYSCAN *stubbyScan; 1568 HWND hwndDrivesList = WinWindowFromID(WinQueryWindow(hwndParent, QW_PARENT),1569 MAIN_DRIVELIST);1570 1588 1571 1589 pci = (PCNRITEM) WinSendMsg(hwndCnr, … … 1579 1597 stubbyScan->pci = pci; 1580 1598 stubbyScan->hwndCnr = hwndCnr; 1581 stubbyScan->hwndDrivesList = hwndDrivesList;1582 1599 pciNext = (PCNRITEM) WinSendMsg(hwndCnr, 1583 1600 CM_QUERYRECORD, … … 1585 1602 MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); 1586 1603 if (~pci->flags & RECFLAGS_ENV) { 1587 ULONG drvNum = toupper(*pci->pszFileName) - 'A'; // 0..25 1588 if (drvNum == ulCurDriveNum || drvNum >= 2) { 1589 ULONG flags = driveflags[drvNum]; // Speed up 1604 iDrvNum = toupper(*pci->pszFileName) - 'A'; // 0..25 1605 if (iDrvNum == ulCurDriveNum || iDrvNum >= 2) { 1606 // Hard drive or current drive 1607 ULONG flags = driveflags[iDrvNum]; // Speed up 1590 1608 if (~flags & DRIVE_INVALID && 1591 1609 ~flags & DRIVE_NOPRESCAN && … … 1600 1618 xfree(stubbyScan, pszSrcFile, __LINE__); 1601 1619 } 1602 } // if drive for scanning 1603 else 1604 WinSendMsg(hwndDrivesList, 1605 LM_INSERTITEM, 1606 MPFROM2SHORT(LIT_SORTASCENDING, 0), 1607 MPFROMP(pci->pszFileName)); 1620 } // if drive needs to be scanned 1608 1621 } 1609 1622 else { 1623 // Diskette and not current drive 1610 1624 WinSendMsg(hwndCnr, 1611 1625 CM_INVALIDATERECORD, 1612 1626 MPFROMP(&pci), 1613 1627 MPFROM2SHORT(1, CMA_ERASE | CMA_REPOSITION)); 1614 WinSendMsg(hwndDrivesList,1615 LM_INSERTITEM,1616 MPFROM2SHORT(LIT_SORTASCENDING, 0),1617 MPFROMP(pci->pszFileName));1618 1628 } 1619 1629 } … … 1621 1631 } // while 1622 1632 } 1623 if (hwndParent) 1624 WinSendMsg(WinWindowFromID(WinQueryWindow(hwndParent, QW_PARENT),1625 MAIN_DRIVELIST), LM_SELECTITEM, 1626 1633 1634 // 13 Oct 09 SHL 1635 if (hwndDrivelist) 1636 WinSendMsg(hwndDrivelist, LM_SELECTITEM, MPFROM2SHORT(0, 0), MPFROMLONG(TRUE)); 1627 1637 1628 1638 pci = (PCNRITEM) WinSendMsg(hwndCnr, … … 1668 1678 BOOL includesyours = FALSE; 1669 1679 1670 // 10 Jan 08 SHL fixme to understand fFirstTime 1671 if (!fDontSuggestAgain && (*suggest || (!(driveflags[1] & DRIVE_IGNORE) && fFirstTime))) {1680 // 10 Jan 08 SHL fixme to understand fFirstTime - looks obsolete to me - probably mean didonce? 1681 if (!fDontSuggestAgain && (*szSuggest || ~driveflags[1] & DRIVE_IGNORE && fFirstTime)) { 1672 1682 if (!DosDevConfig(&info, DEVINFO_FLOPPY) && info == 1) { 1673 if (!*s uggest) {1674 *s uggest = '/';1675 s uggest[1] = 0;1683 if (!*szSuggest) { 1684 *szSuggest = '/'; 1685 szSuggest[1] = 0; 1676 1686 } 1677 1687 else 1678 memmove(s uggest + 2, suggest + 1, strlen(suggest));1679 s uggest[1] = 'B';1680 } 1681 } 1682 if (*s uggest) {1683 for ( x = 2; x < 26; x++) {1684 if (driveflags[ x] & DRIVE_IGNORE) {1688 memmove(szSuggest + 2, szSuggest + 1, strlen(szSuggest)); 1689 szSuggest[1] = 'B'; 1690 } 1691 } 1692 if (*szSuggest) { 1693 for (iDrvNum = 2; iDrvNum < 26; iDrvNum++) { 1694 if (driveflags[iDrvNum] & DRIVE_IGNORE) { 1685 1695 includesyours = TRUE; 1686 sprintf(s uggest + strlen(suggest), "%c", (char)(x+ 'A'));1696 sprintf(szSuggest + strlen(szSuggest), "%c", (char)(iDrvNum + 'A')); 1687 1697 } 1688 1698 } 1689 strcat(s uggest, " %*");1699 strcat(szSuggest, " %*"); 1690 1700 saymsg(MB_YESNOCANCEL | MB_ICONEXCLAMATION, 1691 (hwndParent)? hwndParent : hwndCnr,1701 hwndParent ? hwndParent : hwndCnr, 1692 1702 GetPString(IDS_SUGGESTTITLETEXT), 1693 1703 GetPString(IDS_SUGGEST1TEXT), 1694 1704 (includesyours) ? GetPString(IDS_SUGGEST2TEXT) : NullStr, 1695 s uggest);1705 szSuggest); 1696 1706 if (MBID_YES) { 1697 1707 char s[64]; 1698 1699 sprintf(s, "PARAMETERS=%s", suggest); 1708 sprintf(s, "PARAMETERS=%s", szSuggest); 1700 1709 WinCreateObject(WPProgram, "FM/2", s, FM3Folder, CO_UPDATEIFEXISTS); 1701 1710 WinCreateObject(WPProgram, … … 1717 1726 PrfWriteProfileData(fmprof, appname, "DontSuggestAgain", &fDontSuggestAgain, sizeof(BOOL)); 1718 1727 } 1719 } 1728 } // if suggest 1720 1729 } 1721 1730 didonce = TRUE; … … 1786 1795 } 1787 1796 1797 #if 0 // 26 Sep 09 SHL debug dup free complaints 1788 1798 if (!pci->pszFileName) 1789 Runtime_Error(pszSrcFile, __LINE__, "FreeCnrItemData attempting free %p data twice", pci);1799 Runtime_Error(pszSrcFile, __LINE__, "FreeCnrItemData attempting to free %p data twice", pci); 1790 1800 else { 1791 1801 if (pci->pszFileName != NullStr) … … 1793 1803 pci->pszFileName = NULL; // Catch illegal references 1794 1804 } 1805 #else 1806 { 1807 #define HIST_COUNT 50 1808 static struct { 1809 PCNRITEM pci; 1810 PSZ pszFileName; 1811 } history[HIST_COUNT]; 1812 static volatile UINT iHistNdx; 1813 UINT i; 1814 1815 if (!pci->pszFileName) { 1816 // Looks like pci was already freed 1817 // Try to locate original file name in history buffer 1818 for (i = 0; i < HIST_COUNT && pci != history[i].pci; i++) { } // Scan 1819 if (i < HIST_COUNT) { 1820 Runtime_Error(pszSrcFile, __LINE__, "FreeCnrItemData attempting to free %p data twice, fileName was %.260s", 1821 pci, history[i].pszFileName); 1822 } else { 1823 Runtime_Error(pszSrcFile, __LINE__, "FreeCnrItemData attempting to free %p data twice", pci); 1824 } 1825 } 1826 else { 1827 PSZ psz; 1828 PSZ *ppsz; 1829 // Grab a history slot 1830 // This should work well enoungh to prevent MT/SMP conflicts 1831 for (;;) { 1832 i = iHistNdx; 1833 if (++i >= HIST_COUNT) 1834 i = 0; 1835 if (++iHistNdx >= HIST_COUNT) 1836 iHistNdx = 0; 1837 if (i == iHistNdx) break; 1838 } 1839 ppsz = &history[iHistNdx].pszFileName; 1840 psz = *ppsz; 1841 if (psz) 1842 free(psz); 1843 if (pci->pszFileName && pci->pszFileName != NullStr) 1844 *ppsz = strdup(pci->pszFileName); 1845 else 1846 *ppsz = NULL; 1847 history[iHistNdx].pci = pci; 1848 if (pci->pszFileName != NullStr) 1849 free(pci->pszFileName); 1850 pci->pszFileName = NULL; // Catch illegal references and dup free attempts 1851 } 1852 } 1853 1854 1855 #endif 1795 1856 1796 1857 // 08 Sep 08 SHL Remove excess logic -
trunk/dll/filter.c
r1398 r1471 7 7 8 8 Copyright (c) 1993-98 M. Kimes 9 Copyright (c) 2004, 200 8Steven H.Levine9 Copyright (c) 2004, 2009 Steven H.Levine 10 10 11 11 01 Aug 04 SHL Rework lstrip/rstrip usage … … 19 19 07 Feb 09 GKY Eliminate Win_Error2 by moving function names to PCSZs used in Win_Error 20 20 07 Feb 09 GKY Allow user to turn off alert and/or error beeps in settings notebook. 21 28 Sep 09 SHL Remember last selected mask listbox entry 21 22 22 23 ***********************************************************************/ … … 39 40 #include "errutil.h" // Dos_Error... 40 41 #include "strutil.h" // GetPString 41 #include "pathutil.h" 42 #include "pathutil.h" // BldFullPathName 42 43 #include "filter.h" 43 44 #include "select.h" // SetMask … … 51 52 #pragma data_seg(FILTER_DATA) 52 53 54 static PCSZ PSCZ_FILTER_LASTMASK_SELECT = "Filter.LastMaskSelect"; 55 53 56 static PSZ pszSrcFile = __FILE__; 54 57 55 58 #define MAXNUMMASKS 50 56 59 57 typedef struct LINKMASKS 58 { 60 typedef struct LINKMASKS { 59 61 CHAR *mask; 60 62 struct LINKMASKS *next; 61 } 62 LINKMASKS; 63 } LINKMASKS; 63 64 64 65 static LINKMASKS *maskhead = NULL; … … 67 68 static VOID save_masks(VOID); 68 69 70 /** 71 * Filter callback 72 */ 73 69 74 INT APIENTRY Filter(PMINIRECORDCORE rmini, PVOID arg) 70 75 { 71 72 MASK *mask = (MASK *) arg; 76 MASK *mask = (MASK *)arg; 73 77 PCNRITEM r; 74 registerINT x;78 INT x; 75 79 INT ret = FALSE; 76 80 CHAR *file; … … 96 100 || ((mask->antiattr & FILE_DIRECTORY) 97 101 && !(r->attrFile & FILE_DIRECTORY))) 98 102 return FALSE; 99 103 if (*mask->szMask) { 100 104 file = strrchr(r->pszFileName, '\\'); 101 105 if (!file) 102 106 file = strrchr(r->pszFileName, ':'); 103 107 if (file) 104 108 file++; 105 109 else 106 110 file = r->pszFileName; 107 111 if (mask->pszMasks[1]) { 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 112 for (x = 0; mask->pszMasks[x]; x++) { 113 if (*mask->pszMasks[x]) { 114 if (*mask->pszMasks[x] != '/') { 115 if (wildcard((strchr(mask->pszMasks[x], '\\') || 116 strchr(mask->pszMasks[x], ':')) ? 117 r->pszFileName : file, mask->pszMasks[x], FALSE)) 118 ret = TRUE; 119 } 120 else { 121 if (wildcard((strchr(mask->pszMasks[x], '\\') || 122 strchr(mask->pszMasks[x], ':')) ? 123 r->pszFileName : file, mask->pszMasks[x] + 1, 124 FALSE)) { 125 ret = FALSE; 126 break; 127 } 128 } 129 } 130 } 127 131 } 128 132 else { 129 130 131 132 133 if (wildcard((strchr(mask->szMask, '\\') || 134 strchr(mask->szMask, ':')) ? 135 r->pszFileName : file, mask->szMask, FALSE)) 136 ret = TRUE; 133 137 } 134 138 } … … 141 145 } 142 146 143 VOID load_masks(VOID) 147 /** 148 * Load linked list of filter masks from FILTERS.DAT file 149 */ 150 151 static VOID load_masks(VOID) 144 152 { 145 146 /* load linked list of filter masks from FILTERS.DAT file */147 148 153 FILE *fp; 149 154 LINKMASKS *info, *last = NULL; … … 173 178 } 174 179 } 175 } 180 } //while 176 181 fclose(fp); 177 182 } 178 183 } 179 184 180 VOID save_masks(VOID) 185 /** 186 * Save linked list of filter masks to FILTERS.DAT file 187 */ 188 189 static VOID save_masks(VOID) 181 190 { 182 183 /* save linked list of filter masks to FILTERS.DAT file */184 185 191 LINKMASKS *info; 186 192 FILE *fp; … … 206 212 } 207 213 208 VOID add_mask(CHAR * mask) 214 /** 215 * Add mask to end of internal list 216 */ 217 218 static VOID add_mask(CHAR * mask) 209 219 { 210 211 LINKMASKS * info, *last = NULL;220 LINKMASKS *info; 221 LINKMASKS *last = NULL; 212 222 213 223 if (!mask || !*mask) … … 237 247 } 238 248 239 VOID remove_mask(CHAR * mask) 249 /** 250 * Remove mask from internal list 251 */ 252 253 static VOID remove_mask(CHAR * mask) 240 254 { 241 242 255 LINKMASKS *info, *last = NULL; 243 256 … … 262 275 } 263 276 277 /** 278 * Select filter option dialog box procedure 279 */ 280 264 281 MRESULT EXPENTRY PickMaskDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 265 282 { 283 LINKMASKS *info; 284 MASK *mask; 285 SHORT sSelect; 286 CHAR s[CCHMAXPATH]; 287 ULONG size; 288 static SHORT sLastMaskSelect = LIT_NONE; 266 289 267 290 switch (msg) { … … 270 293 MPFROM2SHORT(CCHMAXPATH, 0), MPVOID); 271 294 if (!mp2) { 295 Runtime_Error(pszSrcFile, __LINE__, NULL); 272 296 WinDismissDlg(hwnd, 0); 273 297 break; 274 298 } 275 if (!loadedmasks) 299 300 if (!loadedmasks) { 276 301 load_masks(); 302 size = sizeof(sLastMaskSelect); 303 PrfQueryProfileData(fmprof, appname, PSCZ_FILTER_LASTMASK_SELECT, &sLastMaskSelect, &size); 304 } 305 277 306 WinSetWindowPtr(hwnd, QWL_USER, mp2); 278 { /* fill list box */ 279 LINKMASKS *info; 280 281 info = maskhead; 282 while (info) { 283 WinSendDlgItemMsg(hwnd, MSK_LISTBOX, LM_INSERTITEM, 284 MPFROM2SHORT(LIT_SORTASCENDING, 0), 285 MPFROMP(info->mask)); 286 info = info->next; 287 } 288 } 289 { 290 MASK *mask = (MASK *) mp2; 291 292 if (mask->fNoAttribs) { 293 WinEnableWindow(WinWindowFromID(hwnd, MSK_SYSTEM), FALSE); 294 WinEnableWindow(WinWindowFromID(hwnd, MSK_HIDDEN), FALSE); 295 WinEnableWindow(WinWindowFromID(hwnd, MSK_READONLY), FALSE); 296 WinEnableWindow(WinWindowFromID(hwnd, MSK_ARCHIVED), FALSE); 297 WinEnableWindow(WinWindowFromID(hwnd, MSK_DIRECTORY), FALSE); 298 WinEnableWindow(WinWindowFromID(hwnd, MSK_MUSTSYSTEM), FALSE); 299 WinEnableWindow(WinWindowFromID(hwnd, MSK_MUSTHIDDEN), FALSE); 300 WinEnableWindow(WinWindowFromID(hwnd, MSK_MUSTREADONLY), FALSE); 301 WinEnableWindow(WinWindowFromID(hwnd, MSK_MUSTARCHIVED), FALSE); 302 WinEnableWindow(WinWindowFromID(hwnd, MSK_MUSTDIRECTORY), FALSE); 307 308 info = maskhead; 309 while (info) { 310 WinSendDlgItemMsg(hwnd, MSK_LISTBOX, LM_INSERTITEM, 311 MPFROM2SHORT(LIT_SORTASCENDING, 0), 312 MPFROMP(info->mask)); 313 info = info->next; 314 } 315 if (sLastMaskSelect >= 0) 316 WinSendDlgItemMsg(hwnd, MSK_LISTBOX, LM_SELECTITEM, 317 MPFROMSHORT(sLastMaskSelect), MPFROMSHORT(TRUE)); 318 319 mask = (MASK *)mp2; 320 321 if (mask->fNoAttribs) { 322 WinEnableWindow(WinWindowFromID(hwnd, MSK_SYSTEM), FALSE); 323 WinEnableWindow(WinWindowFromID(hwnd, MSK_HIDDEN), FALSE); 324 WinEnableWindow(WinWindowFromID(hwnd, MSK_READONLY), FALSE); 325 WinEnableWindow(WinWindowFromID(hwnd, MSK_ARCHIVED), FALSE); 326 WinEnableWindow(WinWindowFromID(hwnd, MSK_DIRECTORY), FALSE); 327 WinEnableWindow(WinWindowFromID(hwnd, MSK_MUSTSYSTEM), FALSE); 328 WinEnableWindow(WinWindowFromID(hwnd, MSK_MUSTHIDDEN), FALSE); 329 WinEnableWindow(WinWindowFromID(hwnd, MSK_MUSTREADONLY), FALSE); 330 WinEnableWindow(WinWindowFromID(hwnd, MSK_MUSTARCHIVED), FALSE); 331 WinEnableWindow(WinWindowFromID(hwnd, MSK_MUSTDIRECTORY), FALSE); 332 WinEnableWindow(WinWindowFromID(hwnd, MSK_SHOWDIRS), FALSE); 333 } 334 else { 335 WinCheckButton(hwnd, MSK_SYSTEM, (mask->attrFile & FILE_SYSTEM) != 0); 336 WinCheckButton(hwnd, MSK_HIDDEN, (mask->attrFile & FILE_HIDDEN) != 0); 337 WinCheckButton(hwnd, MSK_READONLY, 338 (mask->attrFile & FILE_READONLY) != 0); 339 WinCheckButton(hwnd, MSK_ARCHIVED, 340 (mask->attrFile & FILE_ARCHIVED) != 0); 341 WinCheckButton(hwnd, MSK_DIRECTORY, 342 (mask->attrFile & FILE_DIRECTORY) != 0); 343 WinCheckButton(hwnd, MSK_MUSTSYSTEM, 344 (mask->antiattr & FILE_SYSTEM) != 0); 345 WinCheckButton(hwnd, MSK_MUSTHIDDEN, 346 (mask->antiattr & FILE_HIDDEN) != 0); 347 WinCheckButton(hwnd, MSK_MUSTREADONLY, 348 (mask->antiattr & FILE_READONLY) != 0); 349 WinCheckButton(hwnd, MSK_MUSTARCHIVED, 350 (mask->antiattr & FILE_ARCHIVED) != 0); 351 WinCheckButton(hwnd, MSK_MUSTDIRECTORY, 352 (mask->antiattr & FILE_DIRECTORY) != 0); 353 if (mask->fNoDirs) 303 354 WinEnableWindow(WinWindowFromID(hwnd, MSK_SHOWDIRS), FALSE); 304 } 305 else { 306 WinCheckButton(hwnd, MSK_SYSTEM, (mask->attrFile & FILE_SYSTEM) != 0); 307 WinCheckButton(hwnd, MSK_HIDDEN, (mask->attrFile & FILE_HIDDEN) != 0); 308 WinCheckButton(hwnd, MSK_READONLY, 309 (mask->attrFile & FILE_READONLY) != 0); 310 WinCheckButton(hwnd, MSK_ARCHIVED, 311 (mask->attrFile & FILE_ARCHIVED) != 0); 312 WinCheckButton(hwnd, MSK_DIRECTORY, 313 (mask->attrFile & FILE_DIRECTORY) != 0); 314 WinCheckButton(hwnd, MSK_MUSTSYSTEM, 315 (mask->antiattr & FILE_SYSTEM) != 0); 316 WinCheckButton(hwnd, MSK_MUSTHIDDEN, 317 (mask->antiattr & FILE_HIDDEN) != 0); 318 WinCheckButton(hwnd, MSK_MUSTREADONLY, 319 (mask->antiattr & FILE_READONLY) != 0); 320 WinCheckButton(hwnd, MSK_MUSTARCHIVED, 321 (mask->antiattr & FILE_ARCHIVED) != 0); 322 WinCheckButton(hwnd, MSK_MUSTDIRECTORY, 323 (mask->antiattr & FILE_DIRECTORY) != 0); 324 if (mask->fNoDirs) 325 WinEnableWindow(WinWindowFromID(hwnd, MSK_SHOWDIRS), FALSE); 326 else 327 WinCheckButton(hwnd, MSK_SHOWDIRS, (mask->fShowDirs != FALSE)); 328 WinEnableWindow(WinWindowFromID(hwnd, MSK_MUSTSYSTEM), 329 (mask->attrFile & FILE_SYSTEM) != 0); 330 WinEnableWindow(WinWindowFromID(hwnd, MSK_MUSTHIDDEN), 331 (mask->attrFile & FILE_HIDDEN) != 0); 332 WinEnableWindow(WinWindowFromID(hwnd, MSK_MUSTARCHIVED), 333 (mask->attrFile & FILE_ARCHIVED) != 0); 334 WinEnableWindow(WinWindowFromID(hwnd, MSK_MUSTREADONLY), 335 (mask->attrFile & FILE_READONLY) != 0); 336 WinEnableWindow(WinWindowFromID(hwnd, MSK_MUSTDIRECTORY), 337 (mask->attrFile & FILE_DIRECTORY) != 0); 338 } 355 else 356 WinCheckButton(hwnd, MSK_SHOWDIRS, (mask->fShowDirs != FALSE)); 357 WinEnableWindow(WinWindowFromID(hwnd, MSK_MUSTSYSTEM), 358 (mask->attrFile & FILE_SYSTEM) != 0); 359 WinEnableWindow(WinWindowFromID(hwnd, MSK_MUSTHIDDEN), 360 (mask->attrFile & FILE_HIDDEN) != 0); 361 WinEnableWindow(WinWindowFromID(hwnd, MSK_MUSTARCHIVED), 362 (mask->attrFile & FILE_ARCHIVED) != 0); 363 WinEnableWindow(WinWindowFromID(hwnd, MSK_MUSTREADONLY), 364 (mask->attrFile & FILE_READONLY) != 0); 365 WinEnableWindow(WinWindowFromID(hwnd, MSK_MUSTDIRECTORY), 366 (mask->attrFile & FILE_DIRECTORY) != 0); 367 339 368 if (*mask->szMask) { 340 341 CHAR s[CCHMAXPATH], *p; 342 369 CHAR *p; 343 370 strcpy(s, mask->szMask); 344 371 if (!strchr(mask->szMask, '?') && !strchr(mask->szMask, '*')) { … … 352 379 WinSendDlgItemMsg(hwnd, MSK_MASK, EM_SETSEL, 353 380 MPFROM2SHORT(0, CCHMAXPATH), MPVOID); 354 // *mask->szMask = 0;355 381 PostMsg(hwnd, UM_SETDIR, MPVOID, MPVOID); 356 382 } 383 357 384 if (mask->fIsTree) { 358 385 WinCheckButton(hwnd, MSK_DIRECTORY, TRUE); … … 361 388 WinEnableWindow(WinWindowFromID(hwnd, MSK_SHOWDIRS), FALSE); 362 389 } 390 363 391 if (mask->fIsSeeAll) { 364 392 WinCheckButton(hwnd, MSK_DIRECTORY, FALSE); … … 369 397 WinEnableWindow(WinWindowFromID(hwnd, MSK_SHOWDIRS), FALSE); 370 398 } 399 371 400 if (*mask->prompt) 372 401 WinSetWindowText(hwnd, mask->prompt); … … 378 407 case UM_SETUP: 379 408 { 380 MASK *mask = WinQueryWindowPtr(hwnd, QWL_USER);409 mask = WinQueryWindowPtr(hwnd, QWL_USER); 381 410 382 411 if (mask && mask->fText) { … … 408 437 50, 409 438 swpE.cy, hwnd, HWND_TOP, 65535, NULL, NULL)) { 410 411 439 Win_Error(hwnd, hwnd, pszSrcFile, __LINE__, 440 PCSZ_WINCREATEWINDOW); 412 441 } 413 442 if (!WinCreateWindow(hwnd, … … 420 449 swpL.cx - 54, 421 450 swpE.cy, hwnd, HWND_TOP, MSK_TEXT, NULL, NULL)) { 422 Win_Error(hwnd, hwnd, pszSrcFile, __LINE__, 423 PCSZ_WINCREATEWINDOW); 424 } 425 WinSendDlgItemMsg(hwnd, 426 MSK_TEXT, 427 EM_SETTEXTLIMIT, MPFROM2SHORT(256, 0), MPVOID); 451 Win_Error(hwnd, hwnd, pszSrcFile, __LINE__, 452 PCSZ_WINCREATEWINDOW); 453 } 454 WinSendDlgItemMsg(hwnd, MSK_TEXT, EM_SETTEXTLIMIT, 455 MPFROM2SHORT(256, 0), MPVOID); 428 456 if (mask->szText) { 429 457 WinSetDlgItemText(hwnd, MSK_TEXT, mask->szText); 430 WinSendDlgItemMsg(hwnd, 431 MSK_TEXT, 432 EM_SETSEL, MPFROM2SHORT(0, 256), MPVOID); 458 WinSendDlgItemMsg(hwnd, MSK_TEXT, EM_SETSEL, 459 MPFROM2SHORT(0, 256), MPVOID); 433 460 } 434 461 } … … 506 533 case LN_SELECT: 507 534 { 508 SHORT sSelect; 509 CHAR tempmask[CCHMAXPATH]; 510 511 sSelect = (SHORT) WinSendDlgItemMsg(hwnd, 512 MSK_LISTBOX, 513 LM_QUERYSELECTION, 535 sSelect = (SHORT) WinSendDlgItemMsg(hwnd, MSK_LISTBOX, LM_QUERYSELECTION, 514 536 MPFROMSHORT(LIT_FIRST), MPVOID); 515 *tempmask = 0; 516 if (sSelect >= 0) 517 WinSendDlgItemMsg(hwnd, 518 MSK_LISTBOX, 519 LM_QUERYITEMTEXT, 537 *s = 0; 538 if (sSelect >= 0) { 539 sLastMaskSelect = sSelect; 540 WinSendDlgItemMsg(hwnd, MSK_LISTBOX, LM_QUERYITEMTEXT, 520 541 MPFROM2SHORT(sSelect, 521 CCHMAXPATH), MPFROMP(tempmask)); 522 WinSetDlgItemText(hwnd, MSK_MASK, tempmask); 542 CCHMAXPATH), MPFROMP(s)); 543 } 544 WinSetDlgItemText(hwnd, MSK_MASK, s); 523 545 } 524 546 break; … … 535 557 switch (SHORT1FROMMP(mp1)) { 536 558 case MSK_ALL: 537 { 538 MASK *mask = (MASK *) INSTDATA(hwnd); 539 540 if (mask) { 541 if (!mask->fNoAttribs) { 542 WinCheckButton(hwnd, MSK_SYSTEM, TRUE); 543 WinCheckButton(hwnd, MSK_HIDDEN, TRUE); 544 WinCheckButton(hwnd, MSK_READONLY, TRUE); 545 WinCheckButton(hwnd, MSK_ARCHIVED, TRUE); 546 WinCheckButton(hwnd, MSK_DIRECTORY, TRUE); 547 WinCheckButton(hwnd, MSK_MUSTSYSTEM, FALSE); 548 WinCheckButton(hwnd, MSK_MUSTHIDDEN, FALSE); 549 WinCheckButton(hwnd, MSK_MUSTREADONLY, FALSE); 550 WinCheckButton(hwnd, MSK_MUSTARCHIVED, FALSE); 551 WinCheckButton(hwnd, MSK_MUSTDIRECTORY, FALSE); 552 if (!mask->fNoDirs) 553 WinCheckButton(hwnd, MSK_SHOWDIRS, TRUE); 554 WinEnableWindow(WinWindowFromID(hwnd, MSK_MUSTSYSTEM), TRUE); 555 WinEnableWindow(WinWindowFromID(hwnd, MSK_MUSTHIDDEN), TRUE); 556 WinEnableWindow(WinWindowFromID(hwnd, MSK_MUSTARCHIVED), TRUE); 557 WinEnableWindow(WinWindowFromID(hwnd, MSK_MUSTREADONLY), TRUE); 558 WinEnableWindow(WinWindowFromID(hwnd, MSK_MUSTDIRECTORY), TRUE); 559 } 560 if (mask->fIsTree) { 561 WinCheckButton(hwnd, MSK_DIRECTORY, TRUE); 562 WinCheckButton(hwnd, MSK_MUSTDIRECTORY, FALSE); 563 WinCheckButton(hwnd, MSK_SHOWDIRS, FALSE); 564 WinEnableWindow(WinWindowFromID(hwnd, MSK_DIRECTORY), FALSE); 565 WinEnableWindow(WinWindowFromID(hwnd, MSK_SHOWDIRS), FALSE); 566 } 567 if (mask->fIsSeeAll) { 568 WinCheckButton(hwnd, MSK_DIRECTORY, FALSE); 569 WinCheckButton(hwnd, MSK_MUSTDIRECTORY, FALSE); 570 WinCheckButton(hwnd, MSK_SHOWDIRS, FALSE); 571 WinEnableWindow(WinWindowFromID(hwnd, MSK_DIRECTORY), FALSE); 572 WinEnableWindow(WinWindowFromID(hwnd, MSK_MUSTDIRECTORY), FALSE); 573 WinEnableWindow(WinWindowFromID(hwnd, MSK_SHOWDIRS), FALSE); 574 } 559 mask = (MASK *)INSTDATA(hwnd); 560 if (mask) { 561 if (!mask->fNoAttribs) { 562 WinCheckButton(hwnd, MSK_SYSTEM, TRUE); 563 WinCheckButton(hwnd, MSK_HIDDEN, TRUE); 564 WinCheckButton(hwnd, MSK_READONLY, TRUE); 565 WinCheckButton(hwnd, MSK_ARCHIVED, TRUE); 566 WinCheckButton(hwnd, MSK_DIRECTORY, TRUE); 567 WinCheckButton(hwnd, MSK_MUSTSYSTEM, FALSE); 568 WinCheckButton(hwnd, MSK_MUSTHIDDEN, FALSE); 569 WinCheckButton(hwnd, MSK_MUSTREADONLY, FALSE); 570 WinCheckButton(hwnd, MSK_MUSTARCHIVED, FALSE); 571 WinCheckButton(hwnd, MSK_MUSTDIRECTORY, FALSE); 572 if (!mask->fNoDirs) 573 WinCheckButton(hwnd, MSK_SHOWDIRS, TRUE); 574 WinEnableWindow(WinWindowFromID(hwnd, MSK_MUSTSYSTEM), TRUE); 575 WinEnableWindow(WinWindowFromID(hwnd, MSK_MUSTHIDDEN), TRUE); 576 WinEnableWindow(WinWindowFromID(hwnd, MSK_MUSTARCHIVED), TRUE); 577 WinEnableWindow(WinWindowFromID(hwnd, MSK_MUSTREADONLY), TRUE); 578 WinEnableWindow(WinWindowFromID(hwnd, MSK_MUSTDIRECTORY), TRUE); 579 } 580 if (mask->fIsTree) { 581 WinCheckButton(hwnd, MSK_DIRECTORY, TRUE); 582 WinCheckButton(hwnd, MSK_MUSTDIRECTORY, FALSE); 583 WinCheckButton(hwnd, MSK_SHOWDIRS, FALSE); 584 WinEnableWindow(WinWindowFromID(hwnd, MSK_DIRECTORY), FALSE); 585 WinEnableWindow(WinWindowFromID(hwnd, MSK_SHOWDIRS), FALSE); 586 } 587 if (mask->fIsSeeAll) { 588 WinCheckButton(hwnd, MSK_DIRECTORY, FALSE); 589 WinCheckButton(hwnd, MSK_MUSTDIRECTORY, FALSE); 590 WinCheckButton(hwnd, MSK_SHOWDIRS, FALSE); 591 WinEnableWindow(WinWindowFromID(hwnd, MSK_DIRECTORY), FALSE); 592 WinEnableWindow(WinWindowFromID(hwnd, MSK_MUSTDIRECTORY), FALSE); 593 WinEnableWindow(WinWindowFromID(hwnd, MSK_SHOWDIRS), FALSE); 575 594 } 576 595 } … … 582 601 case MSK_DELETE: 583 602 case DID_OK: 584 { 585 CHAR test[CCHMAXPATH]; 586 MASK *mask; 587 SHORT sSelect; 588 589 mask = INSTDATA(hwnd); 590 *test = 0; 591 WinQueryDlgItemText(hwnd, MSK_MASK, CCHMAXPATH, test); 592 test[CCHMAXPATH - 1] = 0; 593 bstrip(test); 603 mask = INSTDATA(hwnd); 604 *s = 0; 605 WinQueryDlgItemText(hwnd, MSK_MASK, CCHMAXPATH, s); // Entry field 606 s[CCHMAXPATH - 1] = 0; 607 bstrip(s); 608 if (SHORT1FROMMP(mp1) == DID_OK) { 609 mask->attrFile = 610 (WinQueryButtonCheckstate(hwnd, MSK_SYSTEM) * 611 FILE_SYSTEM) | (WinQueryButtonCheckstate(hwnd, 612 MSK_HIDDEN) * 613 FILE_HIDDEN) | (WinQueryButtonCheckstate(hwnd, 614 MSK_READONLY) 615 * 616 FILE_READONLY) | 617 (WinQueryButtonCheckstate(hwnd, MSK_ARCHIVED) * 618 FILE_ARCHIVED) | (WinQueryButtonCheckstate(hwnd, 619 MSK_DIRECTORY) * 620 FILE_DIRECTORY); 621 mask->antiattr = 622 (WinQueryButtonCheckstate(hwnd, MSK_MUSTSYSTEM) * 623 FILE_SYSTEM) | (WinQueryButtonCheckstate(hwnd, 624 MSK_MUSTHIDDEN) * 625 FILE_HIDDEN) | (WinQueryButtonCheckstate(hwnd, 626 MSK_MUSTREADONLY) 627 * 628 FILE_READONLY) | 629 (WinQueryButtonCheckstate(hwnd, MSK_MUSTARCHIVED) * 630 FILE_ARCHIVED) | (WinQueryButtonCheckstate(hwnd, 631 MSK_MUSTDIRECTORY) * 632 FILE_DIRECTORY); 633 mask->fShowDirs = 634 (WinQueryButtonCheckstate(hwnd, MSK_SHOWDIRS) != FALSE); 635 if (mask->fText) 636 WinQueryDlgItemText(hwnd, MSK_TEXT, 256, mask->szText); 637 } 638 if (*s) { 594 639 if (SHORT1FROMMP(mp1) == DID_OK) { 595 mask->attrFile = 596 (WinQueryButtonCheckstate(hwnd, MSK_SYSTEM) * 597 FILE_SYSTEM) | (WinQueryButtonCheckstate(hwnd, 598 MSK_HIDDEN) * 599 FILE_HIDDEN) | (WinQueryButtonCheckstate(hwnd, 600 MSK_READONLY) 601 * 602 FILE_READONLY) | 603 (WinQueryButtonCheckstate(hwnd, MSK_ARCHIVED) * 604 FILE_ARCHIVED) | (WinQueryButtonCheckstate(hwnd, 605 MSK_DIRECTORY) * 606 FILE_DIRECTORY); 607 mask->antiattr = 608 (WinQueryButtonCheckstate(hwnd, MSK_MUSTSYSTEM) * 609 FILE_SYSTEM) | (WinQueryButtonCheckstate(hwnd, 610 MSK_MUSTHIDDEN) * 611 FILE_HIDDEN) | (WinQueryButtonCheckstate(hwnd, 612 MSK_MUSTREADONLY) 613 * 614 FILE_READONLY) | 615 (WinQueryButtonCheckstate(hwnd, MSK_MUSTARCHIVED) * 616 FILE_ARCHIVED) | (WinQueryButtonCheckstate(hwnd, 617 MSK_MUSTDIRECTORY) * 618 FILE_DIRECTORY); 619 mask->fShowDirs = 620 (WinQueryButtonCheckstate(hwnd, MSK_SHOWDIRS) != FALSE); 621 if (mask->fText) 622 WinQueryDlgItemText(hwnd, MSK_TEXT, 256, mask->szText); 623 } 624 if (*test) { 625 if (SHORT1FROMMP(mp1) == DID_OK) { 626 strcpy(mask->szMask, test); 627 add_mask(test); 628 save_masks(); 629 //DosEnterCritSec(); // GKY 11-30-08 moved to SetMask 630 SetMask(mask->szMask, mask); 631 //DosExitCritSec(); 632 WinDismissDlg(hwnd, 1); 640 strcpy(mask->szMask, s); 641 add_mask(s); 642 save_masks(); 643 SetMask(mask->szMask, mask); 644 sLastMaskSelect = (SHORT)WinSendDlgItemMsg(hwnd, MSK_LISTBOX, LM_INSERTITEM, 645 MPFROM2SHORT(LIT_SORTASCENDING, 0), 646 MPFROMP(s)); 647 PrfWriteProfileData(fmprof, appname, 648 PSCZ_FILTER_LASTMASK_SELECT, &sLastMaskSelect, sizeof(sLastMaskSelect)); 649 WinDismissDlg(hwnd, 1); 650 } 651 else { 652 // MSK_DELETE 653 WinSetDlgItemText(hwnd, MSK_MASK, NullStr); 654 remove_mask(s); 655 save_masks(); 656 sSelect = (SHORT) WinSendDlgItemMsg(hwnd, MSK_LISTBOX, LM_SEARCHSTRING, 657 MPFROM2SHORT(0, LIT_FIRST), MPFROMP(s)); 658 if (sSelect >= 0) { 659 WinSendDlgItemMsg(hwnd, MSK_LISTBOX, LM_DELETEITEM, 660 MPFROM2SHORT(sSelect, 0), MPVOID); 661 // Try to select next item 662 if (!WinSendDlgItemMsg(hwnd, MSK_LISTBOX, LM_SELECTITEM, 663 MPFROMSHORT(sSelect), MPFROMSHORT(TRUE))) { 664 sSelect = (SHORT)WinSendDlgItemMsg(hwnd, MSK_LISTBOX, LM_QUERYITEMCOUNT, 665 MPVOID, MPVOID); 666 sSelect--; 667 if (sSelect >= 0) 668 WinSendDlgItemMsg(hwnd, MSK_LISTBOX, LM_SELECTITEM, 669 MPFROMSHORT(sSelect), MPFROMSHORT(TRUE)); 670 } 671 sLastMaskSelect = sSelect; 633 672 } 634 else { 635 WinSetDlgItemText(hwnd, MSK_MASK, NullStr); 636 remove_mask(test); 637 save_masks(); 638 sSelect = (SHORT) WinSendDlgItemMsg(hwnd, 639 MSK_LISTBOX, 640 LM_SEARCHSTRING, 641 MPFROM2SHORT(0, LIT_FIRST), 642 MPFROMP(test)); 643 if (sSelect >= 0) 644 WinSendDlgItemMsg(hwnd, 645 MSK_LISTBOX, 646 LM_DELETEITEM, 647 MPFROM2SHORT(sSelect, 0), MPVOID); 648 } 649 } 650 else { 651 if (SHORT1FROMMP(mp1) == DID_OK) { 652 *mask->szMask = 0; 653 //DosEnterCritSec(); // GKY 11-30-08 moved to SetMask 654 SetMask(mask->szMask, mask); 655 //DosExitCritSec(); 656 WinDismissDlg(hwnd, 1); 657 } 658 else if (!fAlertBeepOff) 659 DosBeep(50, 100); // MSK_DELETE 660 } 673 } 674 } 675 else { 676 if (SHORT1FROMMP(mp1) == DID_OK) { 677 *mask->szMask = 0; 678 SetMask(mask->szMask, mask); 679 PrfWriteProfileData(fmprof, appname, 680 PSCZ_FILTER_LASTMASK_SELECT, &sLastMaskSelect, sizeof(sLastMaskSelect)); 681 WinDismissDlg(hwnd, 1); 682 } 683 else if (!fAlertBeepOff) 684 DosBeep(50, 100); // MSK_DELETE 661 685 } 662 686 break; … … 670 694 671 695 case DID_CANCEL: 696 PrfWriteProfileData(fmprof, appname, 697 PSCZ_FILTER_LASTMASK_SELECT, &sLastMaskSelect, sizeof(sLastMaskSelect)); 672 698 WinDismissDlg(hwnd, 0); 673 699 break; -
trunk/dll/flesh.c
r1409 r1471 7 7 8 8 Copyright (c) 1993-98 M. Kimes 9 Copyright (c) 2005, 200 8Steven H. Levine9 Copyright (c) 2005, 2009 Steven H. Levine 10 10 11 11 24 May 05 SHL Rework Win_Error usage … … 23 23 25 Dec 08 GKY Add ProcessDirectoryThread to allow optional recursive drive scan at startup. 24 24 25 Dec 08 GKY Add DRIVE_RSCANNED flag to monitor for the first recursive drive scan per session 25 25 to prevent duplicate directory names in tree following a copy before initial scan. 26 26 08 Mar 09 GKY Additional strings move to PCSZs in init.c 27 27 … … 200 200 ProcessDir = xmallocz(sizeof(PROCESSDIR), pszSrcFile, __LINE__); 201 201 if (!ProcessDir) 202 202 return FALSE; 203 203 ProcessDir->hwndCnr = hwndCnr; 204 204 ProcessDir->pciParent = pciParent; … … 213 213 214 214 if (xbeginthread(ProcessDirectoryThread, 215 216 217 218 215 65536, 216 ProcessDir, 217 pszSrcFile, 218 __LINE__) == -1) 219 219 { 220 221 } 222 } 223 else 220 xfree(ProcessDir, pszSrcFile, __LINE__); 221 } 222 } 223 else { 224 224 ProcessDirectory(hwndCnr, 225 226 227 228 229 230 231 232 233 225 pciParent, 226 pciParent->pszFileName, 227 includefiles, // filestoo 228 TRUE, // recurse 229 TRUE, // partial 230 NULL, // stop flag 231 dcd, 232 NULL, // total files 233 NULL); // total bytes 234 234 } 235 235 } … … 268 268 #define DDEPTH 16 269 269 270 /** 271 * Fill in drive tree subtree 272 * @return TRUE if OK, else FALSE 273 */ 274 270 275 BOOL Stubby(HWND hwndCnr, PCNRITEM pciParent) 271 276 { … … 276 281 */ 277 282 278 BOOL ret= FALSE;283 BOOL ok = FALSE; 279 284 FILEFINDBUF3 ffb[DDEPTH]; 280 285 PFILEFINDBUF3 pffb; … … 308 313 str[1] != ':' || 309 314 str[2] != '\\' || ((flags & DRIVE_IGNORE))) 310 return FALSE; 315 return FALSE; // Not a directory 311 316 312 317 //if (isalpha(*str) && // redundant check GKY 11/24/08 … … 314 319 includefiles = TRUE; 315 320 316 #if 0317 if (!isalpha(*str) || // redundant check GKY 11/24/08318 str[1] != ':' ||319 str[2] != '\\' ||320 #endif321 321 if (flags & DRIVE_REMOTE) 322 322 isremote = TRUE; … … 398 398 &nm)))); 399 399 DosFindClose(hDir); 400 // If drive B: 400 401 if (toupper(*pciParent->pszFileName) > 'B' && 401 402 (*(pciParent->pszFileName + 1)) == ':' && … … 429 430 GetPString(IDS_FSDERRORTITLETEXT), 430 431 GetPString(IDS_FSDERRORTEXT), 431 (isremote) ?432 GetPString(IDS_REMOTETEXT) :433 GetPString(IDS_LOCALTEXT),*str);432 isremote ? GetPString(IDS_REMOTETEXT) : 433 GetPString(IDS_LOCALTEXT), 434 *str); 434 435 if (prc == MBID_NO) { 435 436 saymsg(MB_ENTER, … … 469 470 if (isadir) { 470 471 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 ret= TRUE;508 509 510 511 ret= TRUE;512 513 472 PCNRITEM pci; 473 474 if (WinIsWindow((HAB)0, hwndCnr)) { 475 pci = WinSendMsg(hwndCnr, 476 CM_ALLOCRECORD, 477 MPFROMLONG(EXTRA_RECORD_BYTES), MPFROMLONG(1)); 478 if (!pci) { 479 Win_Error(hwndCnr, HWND_DESKTOP, __FILE__, __LINE__, 480 GetPString(IDS_RECORDALLOCFAILEDTEXT)); 481 } 482 else { 483 RECORDINSERT ri; 484 pci->pszFileName = NullStr; 485 pci->pszDisplayName = pci->pszFileName; 486 pci->rc.pszIcon = pci->pszDisplayName; 487 memset(&ri, 0, sizeof(RECORDINSERT)); 488 ri.cb = sizeof(RECORDINSERT); 489 ri.pRecordOrder = (PRECORDCORE) CMA_END; 490 ri.pRecordParent = (PRECORDCORE) pciParent; 491 ri.zOrder = (ULONG) CMA_TOP; 492 ri.cRecordsInsert = 1; 493 ri.fInvalidateRecord = TRUE; 494 //DbgMsg(pszSrcFile, __LINE__, "Stubby %p CM_INSERTRECORD \"%s\" %.255s", hwndCnr, pci->pszFileName, pffb->achName); // 18 Dec 08 SHL fixme debug 495 if (!WinSendMsg(hwndCnr, 496 CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri))) { 497 DosSleep(50); //05 Aug 07 GKY 100 498 WinSetFocus(HWND_DESKTOP, hwndCnr); 499 if (WinIsWindow((HAB)0, hwndCnr)) { 500 //DbgMsg(pszSrcFile, __LINE__, "Stubby %p CM_INSERTRECORD %s", hwndCnr, pci->pszFileName); // 18 Dec 08 SHL fixme debug 501 if (!WinSendMsg(hwndCnr, 502 CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri))) { 503 Win_Error(hwndCnr, HWND_DESKTOP, __FILE__, __LINE__, 504 GetPString(IDS_RECORDINSERTFAILEDTEXT)); 505 FreeCnrItem(hwndCnr, pci); 506 } 507 else 508 ok = TRUE; 509 } 510 } 511 else 512 ok = TRUE; 513 } 514 } 514 515 } 515 516 else if (toupper(*str) > 'B' && str[1] == ':' && str[2] == '\\' && … … 528 529 } 529 530 else if (toupper(*str) > 'B' && rc != ERROR_NO_MORE_FILES) { 530 531 531 CHAR s[CCHMAXPATH + 80]; 532 533 532 sprintf(s, GetPString(IDS_SEARCHERRORTEXT), rc, str); 534 533 Notify(s); … … 538 537 539 538 DosError(FERR_DISABLEHARDERR); 540 return ret;539 return ok; 541 540 } 542 541 -
trunk/dll/grep.c
r1456 r1471 7 7 8 8 Copyright (c) 1993-98 M. Kimes 9 Copyright (c) 2001, 200 8Steven H. Levine9 Copyright (c) 2001, 2009 Steven H. Levine 10 10 11 11 12 Feb 03 SHL InsertGrepFile: standardize EA math … … 562 562 PSZ p; 563 563 APIRET rc; 564 // 06 Oct 07 SHL Correct size for xDosFindFirst565 564 ULONG ulBufBytes = FilesToGet * sizeof(FILEFINDBUF4L); 566 565 static BOOL fDone; … … 697 696 698 697 /** 699 * Insert recordinto container698 * Insert one or more records into container 700 699 */ 701 700 … … 826 825 grep->insertedbytes += pffb->cbFile + CBLIST_TO_EASIZE(pffb->cbList); 827 826 grep->toinsert++; 828 if (grep->toinsert == FilesToGet) 827 // 07 Oct 09 SHL honor sync updates 828 if (grep->toinsert == FilesToGet || fSyncUpdates) 829 829 return DoInsertion(grep, pitdSleep, pitdReport); 830 830 return TRUE; -
trunk/dll/grep2.c
r1438 r1471 26 26 07 Feb 09 GKY Allow user to turn off alert and/or error beeps in settings notebook. 27 27 08 Mar 09 GKY Additional strings move to PCSZs in init.c 28 07 Oct 09 SHL Remember last search mask across runs 28 29 29 30 fixme for more excess locals to be gone … … 36 37 #include <share.h> 37 38 #include <time.h> 38 // #include <process.h> // _beginthread39 39 40 40 #define INCL_DOS 41 41 #define INCL_WIN 42 #define INCL_LONGLONG 43 #define INCL_WINSTDCNR 42 #define INCL_LONGLONG // dircnrs.h 43 #define INCL_WINSTDCNR // makelist.h 44 44 45 45 #include "fm3dll.h" … … 54 54 #include "mle.h" 55 55 #include "grep.h" 56 #include "errutil.h" 57 #include "strutil.h" 58 #include "pathutil.h" 59 #include "walkem.h" 56 #include "errutil.h" // Dos_Error... 57 #include "strutil.h" // GetPString 58 #include "pathutil.h" // BldFullPathName 59 #include "walkem.h" // FillPathListBox 60 60 #include "grep2.h" 61 61 #include "wrappers.h" // xfgets 62 #include "misc.h" 62 #include "misc.h" // LoadLibPath 63 63 #include "strips.h" // bstrip 64 64 #include "dirs.h" // save_dir2 65 65 #include "fortify.h" 66 66 #include "excputil.h" // xbeginthread 67 #include "valid.h" 67 #include "valid.h" // IsFile 68 68 69 69 #pragma data_seg(DATA1) 70 70 71 71 static PSZ pszSrcFile = __FILE__; 72 73 static PCSZ PSCZ_GREP_LASTMASK_SELECT = "Grep_LastMaskSelect"; 72 74 73 75 MRESULT EXPENTRY EnvDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) … … 159 161 bstrip(p); 160 162 if (!*p) { 161 163 if (!fAlertBeepOff) 162 164 DosBeep(50, 100); 163 165 WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, ENV_NAME)); … … 190 192 SHORT sSelect; 191 193 CHAR *p; 192 CHAR s[8192 + 14]; 194 GREPINFO *GrepInfo; 195 ULONG size; 193 196 CHAR simple[8192]; 194 197 CHAR path[CCHMAXPATH]; 195 GREPINFO *GrepInfo; 196 197 static CHAR lastmask[8192] = "*"; 198 static CHAR lasttext[4096] = ""; 198 CHAR s[8192 + 14]; 199 200 // 07 Oct 09 SHL fixme to not be static and save to profile? 201 static CHAR lastmask[8192]; 202 static CHAR lasttext[4096]; 199 203 static BOOL recurse = TRUE; 200 static BOOL sensitive = FALSE;201 static BOOL absolute = FALSE;202 static BOOL sayfiles = TRUE;204 static BOOL sensitive; 205 static BOOL absolute; 206 static BOOL sayfiles; 203 207 static BOOL searchEAs = TRUE; 204 208 static BOOL searchFiles = TRUE; 205 static BOOL changed = FALSE; 209 static BOOL changed; 210 static BOOL fInitDone; // First time init done 206 211 static BOOL findifany = TRUE; 207 static BOOL gRemember = FALSE; 208 ULONG size; 212 static BOOL gRemember; 209 213 static UINT newer = 0; 210 214 static UINT older = 0; 211 215 static ULONG greater = 0; 212 216 static ULONG lesser = 0; 217 static SHORT sLastMaskSelect = LIT_NONE; 213 218 214 219 switch (msg) { … … 220 225 GrepInfo = mp2; 221 226 if (GrepInfo->szGrepPath && IsFile(GrepInfo->szGrepPath) == 0) { 222 BldFullPathName(lastmask, GrepInfo->szGrepPath, "*"); 223 } 227 BldFullPathName(lastmask, GrepInfo->szGrepPath, "*"); // Directory passed 228 sLastMaskSelect = LIT_NONE; 229 fInitDone = TRUE; 230 } 231 else if (sLastMaskSelect == LIT_NONE) { 232 size = sizeof(sLastMaskSelect); 233 PrfQueryProfileData(fmprof, appname, PSCZ_GREP_LASTMASK_SELECT, &sLastMaskSelect, &size); 234 if (sLastMaskSelect >= 0) 235 fInitDone = TRUE; 236 } 237 if (!fInitDone) { 238 lastmask[0] = '*'; 239 lastmask[1] = 0; 240 } 241 224 242 WinSetWindowULong(hwnd, QWL_USER, *(HWND *) GrepInfo->hwnd); 225 243 WinSendDlgItemMsg(hwnd, … … 303 321 WinEnableWindow(WinWindowFromID(hwnd, GREP_NOSIZEDUPES), FALSE); 304 322 323 // Fill mask listbox 305 324 BldFullPathName(s, pFM2SaveDirectory, PCSZ_GREPMASKDAT); 306 325 fp = _fsopen(s, "r", SH_DENYWR); … … 318 337 fclose(fp); 319 338 } 339 // 25 Sep 09 SHL Reselect last last used item 340 if (sLastMaskSelect >= 0) 341 WinSendDlgItemMsg(hwnd, GREP_LISTBOX, LM_SELECTITEM, 342 MPFROMSHORT(sLastMaskSelect), MPFROMSHORT(TRUE)); 320 343 321 344 FillPathListBox(hwnd, 322 345 WinWindowFromID(hwnd, GREP_DRIVELIST), 323 346 (HWND) 0, NULL, FALSE); 347 // 25 Sep 09 SHL fixme select drive matching current container? 324 348 break; 325 349 … … 334 358 335 359 case UM_FOCUSME: 336 / * set focus to window hwnd in mp1 */360 // set focus to window hwnd in mp1 337 361 if (mp1) 338 362 WinSetFocus(HWND_DESKTOP, (HWND) mp1); … … 409 433 } 410 434 } 411 break; 412 } 435 break; // LN_ENTER 436 } // switch 413 437 break; 414 438 … … 435 459 MPFROMSHORT(LIT_FIRST), MPVOID); 436 460 if (sSelect >= 0) { 461 sLastMaskSelect = sSelect; 437 462 *s = 0; 438 463 if (WinQueryButtonCheckstate(hwnd, GREP_APPEND)) { … … 650 675 } 651 676 rstrip(s); 677 // 25 Sep 09 SHL fixme to honor append 652 678 if (*s) { 653 679 strcat(s, simple); … … 692 718 GREP_LISTBOX, 693 719 LM_DELETEITEM, MPFROM2SHORT(sSelect, 0), MPVOID); 720 if (sSelect >= sLastMaskSelect) 721 sLastMaskSelect--; 694 722 changed = TRUE; 695 723 } … … 812 840 else { 813 841 // 07 Feb 08 SHL - fixme to malloc and free in thread 814 static GREP g; // Passed to thread 815 842 static GREP g; // Passed to thread 816 843 p = xmalloc(8192 + 512, pszSrcFile, __LINE__); 817 844 if (!p) … … 841 868 (PVOID) & searchEAs, sizeof(BOOL)); 842 869 } 870 PrfWriteProfileData(fmprof, appname, 871 PSCZ_GREP_LASTMASK_SELECT, &sLastMaskSelect, sizeof(sLastMaskSelect)); 843 872 g.finddupes = WinQueryButtonCheckstate(hwnd, GREP_FINDDUPES) != 0; 844 873 if (g.finddupes) { … … 854 883 bstrip(p); 855 884 if (!*p) { 856 885 if (!fAlertBeepOff) 857 886 DosBeep(50, 100); 858 887 WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, GREP_MASK)); … … 976 1005 } 977 1006 if (changed) { 978 // Grep mask list changed1007 // Save modified mask list 979 1008 SHORT x; 980 1009 … … 983 1012 LM_QUERYITEMCOUNT, 984 1013 MPVOID, MPVOID); 985 if (sSelect > 0) { 1014 // 07 Oct 09 SHL Rewrite if list empty 1015 if (sSelect >= 0) { 986 1016 BldFullPathName(s, pFM2SaveDirectory, PCSZ_GREPMASKDAT); 987 1017 if (CheckDriveSpaceAvail(s, ullDATFileSpaceNeeded, 1) == 2) -
trunk/dll/init.c
r1452 r1471 78 78 14 Mar 09 GKY PCSZ strings moved to compile time initialization 79 79 14 Mar 09 GKY Prevent execution of UM_SHOWME while drive scan is occuring replaces check for 80 80 saved drive containers. 81 81 06 Jun 09 GKY Add option to show file system type or drive label in tree 82 82 28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code. … … 85 85 22 Jul 09 GKY Fix failure to restore the notebook setting for saving container states or not 86 86 12 Sep 09 GKY Change protectonly check to check for VKBD being loaded instead of starting 87 88 87 command.com. Prevents hang (at least until a Dos program is started) on a system 88 that has a broken MDOS install. 89 89 90 90 ***********************************************************************/ … … 117 117 #include "cmdline.h" // Data declaration(s) 118 118 #include "fm2cmd.h" // Data declaration(s) 119 #include "printer.h" 120 #include "flesh.h" 121 #include "worker.h" 122 #include "filldir.h" 123 #include "defview.h" 124 #include "draglist.h" 119 #include "printer.h" // Data declaration(s) 120 #include "flesh.h" // Data declaration(s) 121 #include "worker.h" // Data declaration(s) 122 #include "filldir.h" // Data declaration(s) 123 #include "defview.h" // Data declaration(s) 124 #include "draglist.h" // Data declaration(s) 125 125 #include "fm3dlg.h" 126 126 #include "datamin.h" … … 128 128 #include "fm3str.h" 129 129 #include "version.h" 130 #include "pathutil.h" 131 #include "arccnrs.h" 132 #include "errutil.h" 133 #include "strutil.h" 134 #include "valid.h" 135 #include "autoview.h" 130 #include "pathutil.h" // BldFullPathName 131 #include "arccnrs.h" // ArcClientWndProc 132 #include "errutil.h" // Dos_Error... 133 #include "strutil.h" // GetPString 134 #include "valid.h" // ArgDriveFlags 135 #include "autoview.h" // AutoViewProc 136 136 #include "mainwnd.h" // BubbleProc, ChildButtonProc, DriveBackProc, 137 137 // DriveProc, LEDProc, MainWndProc, StatusProc … … 1097 1097 if (DosCreateMutexSem(NULL, &hmtxFM2Delete, 0L, FALSE)) 1098 1098 Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__, 1099 1099 PCSZ_DOSCREATEMUTEXSEM); 1100 1100 if (DosCreateMutexSem(NULL, &hmtFillingTreeCnr, 0L, FALSE)) 1101 1101 Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__, 1102 1102 PCSZ_DOSCREATEMUTEXSEM); 1103 1103 if (DosCreateEventSem(NULL, &hevInitialCnrScanComplete, 0L, FALSE)) 1104 1104 Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__, 1105 1105 PCSZ_DOSCREATEEVENTSEM); 1106 1106 1107 1107 /* … … 1181 1181 rc = DosQueryModuleHandle("VKBD", &hmod); 1182 1182 if (rc != NO_ERROR) { 1183 1184 1183 fProtectOnly = TRUE; 1184 DbgMsg(pszSrcFile, __LINE__, "DosQModuleHandle VKBD returned %d fProtectOnly=%d", rc, fProtectOnly); 1185 1185 } 1186 1186 else { 1187 rc = DosQueryModuleHandle("VMOUSE", &hmod); 1188 if (rc != NO_ERROR) 1189 fProtectOnly = TRUE; 1190 DbgMsg(pszSrcFile, __LINE__, "DosQModuleHandle VMOUSE returned %d fProtectOnly=%d", rc, fProtectOnly); 1187 rc = DosQueryModuleHandle("VMOUSE", &hmod); 1188 if (rc != NO_ERROR) { 1189 fProtectOnly = TRUE; 1190 DbgMsg(pszSrcFile, __LINE__, "DosQModuleHandle VMOUSE returned %d fProtectOnly=%d", rc, fProtectOnly); 1191 } 1191 1192 } 1192 1193 } … … 1343 1344 PrfQueryProfileData(fmprof, appname, "ShowEnv", &fShowEnv, &size); 1344 1345 PrfQueryProfileString(fmprof, appname, "TreeEnvVarList", "PATH;DPATH;LIBPATH;HELP;BOOKSHELF;", 1345 1346 pszTreeEnvVarList, MaxComLineStrg); 1346 1347 size = sizeof(BOOL); 1347 1348 PrfQueryProfileData(fmprof, FM3Str, "ShowDriveOnly", &fShowDriveOnly, &size); … … 1408 1409 size = sizeof(BOOL); 1409 1410 PrfQueryProfileData(fmprof, appname, "ConfirmDelete", &fConfirmDelete, &size); 1410 size = sizeof(BOOL); 1411 size = sizeof(BOOL); 1411 1412 PrfQueryProfileData(fmprof, FM3Str, "SaveState", &fSaveState, &size); 1412 1413 size = sizeof(BOOL); -
trunk/dll/ipf/arclist.ipf
r1417 r1471 6 6 .* 7 7 .* Copyright (c) 1993-98 M. Kimes 8 .* Copyright (c) 2004 Steven H.Levine 9 .* 10 .* Revisions 31 Jul 04 SHL - Rework file name position description 8 .* Copyright (c) 2004, 2009 Steven H.Levine 9 .* 10 .* 31 Jul 04 SHL Rework file name position description 11 .* 28 Sep 09 SHL Minor updates 11 12 .* 12 13 .*********************************************************************** … … 119 120 enclosed directories (i.e. files are extracted into the directories they 120 121 were archived "with," if any, rather than all going into the extract 121 directory). :hp1.Extract All w/ Dirs &. Exit:ehp1. does the same 122 directory). 123 :p. 124 :hp1.Extract All w/ Dirs &. Exit:ehp1. does the same 122 125 thing but closes the archive listing window after starting the 123 126 extraction. (:hp2.Note:ehp2. that if all you want to do to an archive -
trunk/dll/ipf/collect.ipf
r1419 r1471 1 .*********************************************************************** 2 .* 3 .* $Id$ 4 .* 5 .* Collector 6 .* 7 .* Copyright (c) 1993-98 M. Kimes 8 .* Copyright (c) 2006, 2009 Steven H.Levine 9 .* 10 .* 29 Apr 09 SHL Expand say files usage help 11 .* 12 .*********************************************************************** 13 .* 1 14 :h2 res=90100 name=PANEL_COLLECTOR.Collector 2 15 :i1 id=aboutCollector.Collector … … 108 121 :p. 109 122 The :hp6.Say files as found:ehp6. checkbox tells FM/2 to display the 110 filenames it finds based on the filemasks as it encounters them, if 111 checked. 123 filenames it finds based on the filemasks as it encounters them, if checked. 124 This is the recommended setting if you expect the filemask to match a relatively small number 125 of files. 126 If the checkbox is unchecked, FM/2 will report progress by displaying 127 the filename in process every couple of seconds. 128 This is the recommended setting if you expect the filemask to match a large number 129 of files and will speed up Seek and scan performance. 130 If you expect to match a large number of files, it is probably best to toggle 131 off :hp6.Immediate updates:ehp6. in the Config menu. 112 132 :p. 113 133 The :hp6.Search files:ehp6. checkbox, when checked, tells FM/2 to look -
trunk/dll/ipf/fm3.ipf
r1458 r1471 6 6 .* 7 7 .* Copyright (c) 1993-98 M. Kimes 8 .* Copyright (c) 2006 Steven H.Levine8 .* Copyright (c) 2006, 2009 Steven H.Levine 9 9 .* 10 10 .* 24 Sep 06 GKY ADD Change to F1 help … … 873 873 quicklists:ehp1. command ( :color fc=default bc=palegray.F8:color fc=default bc=default. accelerator). 874 874 :p. 875 The first list (starting from the left) contains drives. If you select a875 The first quicklist (starting from the left) contains drives. If you select a 876 876 drive from the list, the Drive Tree scrolls to that drive and makes it the 877 877 current object in the Drive Tree. This can be handy when you have the tree … … 881 881 :p. 882 882 .br 883 The second list is the State 883 The second list is the States quicklist, containing the names of saved States of 884 884 the FM/2 window (what directories are open, where the windows are located, 885 etc.). You can add to this list by typing a name into the entry field, 886 requesting a context menu on the entry field, then selecting :hp1.Save 887 State as name:ehp1. from the context menu. FM/2 will save its current 888 State under that name for later recall. FM/2 provides one state automatically. 889 It is called FM2Shutdown and it will restore FM/2 to the state it was in 890 when it was last shutdown. This is the same state that is opened on start up 891 if you have "Save state of dir windows" selected. 885 etc.). To add a State to this list, type the name into the entry field, 886 and select :hp1.Save State as name:ehp1. from the context menu. 887 FM/2 will save its current state under this name for later recall. 888 :p. 889 To delete a State, recall the State name from the States quicklist or type the State name 890 into the entry field and and select :hp1.Delete state:ehp1. from the context menu. 891 To recall a State name without switching to the State, hold down the 892 &CtrlKey. while selecting the State name from the list. 893 :p. 894 FM/2 provides one built-in State. 895 It is named FM2Shutdown and it can be used to restore FM/2 to the state it was in 896 when FM/2 was last shutdown. This State is opened on start up 897 if you have "Save dir window state" selected on the Monolithic tab of the 898 Configuration menu. 892 899 :p. 893 900 :artwork name='bitmaps\useradds.bmp' align=center. … … 905 912 more flexible than the way DOS-think file managers do things. 906 913 :p. 907 To "edit" a State, first recall it, then change what you want, then 908 delete the State name, then save it again. 909 :p. 910 Holding down the &ShiftKey. 911 key while selecting a state name prevents FM/2 from closing windows that are already open. 914 To edit a State, first recall it, then change what you want, then 915 resave the State. 916 :p. 917 To add a saved State to the current state, hold down the &ShiftKey. 918 key while selecting a State name from the list. 919 The container windows defined by the selected State will be added to the current container windows. 912 920 :p. 913 921 :artwork name='bitmaps\userstat.bmp' align=center. 914 922 :p. 915 923 .br 916 The third list is the user-defined commands list. User-defined commands924 The third list is the user-defined commands quicklist. User-defined commands 917 925 allow you to extend FM/2 with commands of your own devising. You can 918 926 add, change and delete commands with the :hp1.Config->Edit Commands:ehp1. … … 922 930 :p. 923 931 .br 924 The fourth list is the commonly used directory list. You can add a932 The fourth list is the commonly used directory quicklist. You can add a 925 933 directory to this list as above; type in the name and select :hp1.Add 926 934 pathname:ehp1. from a context menu. … … 950 958 :color fc=default bc=palegray.M:color fc=default bc=default. accelerator key). 951 959 :p. 952 The commonly used directory list, in combination with the Statelist,960 The commonly used directory quicklist, in combination with the States quicklist, 953 961 allows you to quickly place FM/2 into precisely the configuration you 954 962 need to get real work done. -
trunk/dll/ipf/walkem.ipf
r1419 r1471 1 .*********************************************************************** 2 .* 3 .* $Id$ 4 .* 5 .* Walk dialog help 6 .* 7 .* Copyright (c) 1993-98 M. Kimes 8 .* Copyright (c) 2002, 2009 Steven H.Levine 9 .* 10 .* 07 Oct 09 SHL Drop 100 file limit text 11 .* 12 .*********************************************************************** 13 .* 1 14 :h1 res=91500 name=PANEL_WALKEM.Walk Directories 2 15 :i1 id=aboutWalkem.Walk Directories … … 20 33 :hp1.Add:ehp1. when the desired directory name is displayed in the 21 34 entry field at the bottom of the window. To delete a directory, 22 highlight it and click :hp1.Delete:ehp1.. To switch to one of these 35 highlight it and click :hp1.Delete:ehp1.. 36 To switch to one of these 23 37 user-defined directories, highlight it and click &OkayButton. or 24 double-click the directory. You can add up to 100 directories. 38 double-click the directory. 39 To highlight the directory without switching, hold down the &CtrlKey. 40 and click on the directory. 25 41 :p. 26 42 You can also select directories from the Recent directories drop-down … … 28 44 automatically as you traverse your drives. Just drop down the list 29 45 and click the directory of choice. 46 To exit the drop down list without making a selection, click the drop down arrow 47 or Tab out of the drop down list with the Tab key. 30 48 :p. 31 49 When the desired directory is displayed in the bottom entry field of 32 the dialog, click &OkayButton. to exit. Click &CancelButton. to50 the dialog, click &OkayButton. to exit. Click the &CancelButton. to 33 51 exit without selecting a directory. 34 52 -
trunk/dll/key.c
r1444 r1471 54 54 static INT width, direction, ticktock, counter; 55 55 static HPOINTER stick1, stick2, stick3, stick4, stick12, stick22, stick32, 56 56 stick42, stick5, stick52; 57 57 58 58 switch (msg) { -
trunk/dll/mainwnd.c
r1455 r1471 2056 2056 BOOL rdy, local; 2057 2057 CHAR chDrv = *szDrv; 2058 UINT iDrv ;2058 UINT iDrv = chDrv - 'A'; 2059 2059 2060 2060 strcat(szDrv, PCSZ_BACKSLASH); … … 4101 4101 if (fUserComboBox) { 4102 4102 if (!aheight) { 4103 4104 4103 SWP swpTemp; 4105 4106 4104 WinQueryWindowPos(WinWindowFromID(hwndDrivelist, CBID_EDIT), 4107 4105 &swpTemp); … … 4318 4316 if (fUserComboBox) { 4319 4317 if (!aheight) { 4320 4321 4318 SWP swpTemp; 4322 4323 4319 WinQueryWindowPos(WinWindowFromID(hwndDrivelist, CBID_EDIT), 4324 4320 &swpTemp); … … 6281 6277 if (*path) { 6282 6278 if (SHORT1FROMMP(mp1) == MAIN_USERLIST) { 6279 // 06 Oct 09 SHL Ctrl-select selects, but suppresses open 6280 if ((shiftstate & (KC_CTRL | KC_SHIFT | KC_ALT)) == KC_CTRL) 6281 break; 6283 6282 if (!strcmp(path, GetPString(IDS_NEWDIRECTORYTEXT))) { 6284 6283 if (!LastDir || … … 6323 6322 else if (SHORT1FROMMP(mp1) == MAIN_SETUPLIST) { 6324 6323 CHAR szKey[80]; 6325 ULONG size, numsaves = 0; 6326 6327 SetShiftState(); 6328 size = sizeof(ULONG); 6324 ULONG numsaves = 0; 6325 ULONG size = sizeof(ULONG); 6326 // 06 Oct 09 SHL Ctrl-select selects, but suppresses open 6327 if ((shiftstate & (KC_CTRL | KC_SHIFT | KC_ALT)) == KC_CTRL) 6328 break; 6329 6329 sprintf(szKey, "%s.NumDirsLastTime", path); // path is state name 6330 6330 if (!PrfQueryProfileData(fmprof, … … 6369 6369 else if (SHORT1FROMMP(mp1) == MAIN_CMDLIST) { 6370 6370 6371 SHORT sSelect; 6372 6373 sSelect = (SHORT) WinSendMsg(hwndCmdlist, 6374 LM_QUERYSELECTION, 6375 MPFROMSHORT(LIT_FIRST), MPVOID); 6371 SHORT sSelect = (SHORT) WinSendMsg(hwndCmdlist, 6372 LM_QUERYSELECTION, 6373 MPFROMSHORT(LIT_FIRST), MPVOID); 6376 6374 if (sSelect >= 0) 6377 6375 WinPostMsg(hwnd, … … 6382 6380 } 6383 6381 } 6384 } 6382 } // CBN_ENTER 6385 6383 break; 6386 6384 -
trunk/dll/treecnr.c
r1456 r1471 106 106 #include "notebook.h" // CfgDlgProc 107 107 #include "command.h" // RunCommand 108 #include "worker.h" // Action, MassAction108 #include "worker.h" // Action, MassAction 109 109 #include "mainwnd.h" // BubbleHelp, FindDirCnrByName, GetNextWindowPos 110 110 #include "misc.h" // CnrDirectEdit, EmphasizeButton, FindDirCnr 111 // FindDirCnr, FixSwitchList, OpenEdit, QuickPopup112 // SetSortChecks, SwitchCommand, CheckMenu113 // CurrentRecord, IsFm2Window111 // FindDirCnr, FixSwitchList, OpenEdit, QuickPopup 112 // SetSortChecks, SwitchCommand, CheckMenu 113 // CurrentRecord, IsFm2Window 114 114 #include "common.h" // CommonCnrProc, CommonDriveCmd, CommonFrameWndProc 115 // CommonTextProc115 // CommonTextProc 116 116 #include "valid.h" // CheckDrive, DriveFlagsOne, IsValidDrive 117 117 #include "chklist.h" // DropListProc … … 838 838 } 839 839 } 840 // 21 Sep 09 SHL fixme to know why checking again - focus change? 840 841 if (dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent)) 841 842 WinSetWindowText(hwndStatus, s); -
trunk/dll/walkem.c
r1438 r1471 35 35 24 Aug 08 GKY Warn full drive on save of .DAT file; prevent loss of existing file 36 36 28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code. 37 06 Oct 09 SHL Ctrl-select selects Walk Dialog listbox entry, but suppresses action 37 38 38 39 ***********************************************************************/ … … 1069 1070 APIRET rc; 1070 1071 1072 // 06 Oct 09 SHL Ctrl-select selects, but suppresses action 1073 SetShiftState(); 1074 if ((shiftstate & (KC_CTRL | KC_SHIFT | KC_ALT)) == KC_CTRL) 1075 break; 1071 1076 DosError(FERR_DISABLEHARDERR); 1072 1077 hDir = HDIR_CREATE; … … 1234 1239 1235 1240 case WALK_DELETE: 1236 *szBuff = 0; 1237 WinQueryDlgItemText(hwnd, WALK_PATH, CCHMAXPATH, szBuff); 1238 bstrip(szBuff); 1239 while ((p = strchr(szBuff, '/')) != NULL) 1240 *p = '\\'; 1241 if (*szBuff && !IsFile(szBuff)) { 1242 MakeFullName(szBuff); 1243 sSelect = (SHORT) WinSendDlgItemMsg(hwnd, 1244 WALK_USERLIST, 1245 LM_SEARCHSTRING, 1246 MPFROM2SHORT(0, LIT_FIRST), 1247 MPFROMP(szBuff)); 1248 if (sSelect >= 0) { 1249 WinSendDlgItemMsg(hwnd, 1250 WALK_USERLIST, 1251 LM_DELETEITEM, MPFROM2SHORT(sSelect, 0), MPVOID); 1252 remove_udir(szBuff); 1253 wa->changed = 1; 1254 } 1241 // 07 Oct 09 SHL Delete current selection, like docs says 1242 sSelect = (SHORT)WinSendDlgItemMsg(hwnd, 1243 WALK_USERLIST, 1244 LM_QUERYSELECTION, 1245 MPFROMSHORT(LIT_FIRST), MPVOID); 1246 if (sSelect >= 0) { 1247 WinSendDlgItemMsg(hwnd, 1248 WALK_USERLIST, 1249 LM_DELETEITEM, MPFROM2SHORT(sSelect, 0), MPVOID); 1250 remove_udir(szBuff); 1251 wa->changed = 1; 1255 1252 } 1256 1253 break; … … 1270 1267 SWP swp; 1271 1268 ULONG size = sizeof(SWP); 1272 1273 1269 WinQueryWindowPos(hwnd, &swp); 1274 1270 PrfWriteProfileData(fmprof, FM3Str, "WalkDir.Position", (PVOID) &swp,
Note:
See TracChangeset
for help on using the changeset viewer.