Changeset 1471


Ignore:
Timestamp:
Oct 14, 2009, 1:43:04 AM (16 years ago)
Author:
Steven Levine
Message:

Remember last filter mask selection
Use Ctrl-click to select state or commonly used directory quicklist entry without activating.
Use Ctrl-click to select walk dialog user list entry without activating.
Avoid drivebar MB2 exception
Remember last seek and scan mask selection across runs
Avoid traps when changing tree container display style
Restore missing drives to drive list dropdown
Minor documentation updates

Location:
trunk/dll
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/filldir.c

    r1459 r1471  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2001, 2008 Steven H. Levine
     9  Copyright (c) 2001, 2009 Steven H. Levine
    1010
    1111  10 Jan 04 SHL ProcessDirectory: avoid most large drive failures
     
    7979  22 Jul 09 GKY Streamline scanning code for faster Tree rescans
    8080  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
    8184
    8285***********************************************************************/
     
    99102#include "info.h"                       // Data declaration(s)
    100103#include "newview.h"                    // Data declaration(s)
     104#include "mainwnd.h"                    // hwndDrivelist
    101105#include "fm3str.h"
    102106#include "filldir.h"
     
    141145  PCNRITEM      pci;
    142146  HWND          hwndCnr;                // hwnd you want the message posted to
    143   HWND          hwndDrivesList;
    144   //BOOL        RamDrive;
    145147}
    146148STUBBYSCAN;
     
    209211  HAB thab;
    210212  HMQ hmq = (HMQ) 0;
    211   BOOL ret;
     213  BOOL ok;
    212214
    213215  DosError(FERR_DISABLEHARDERR);
     
    225227        IncrThreadUsage();
    226228        priority_normal();
    227         ret = Stubby(StubbyScan->hwndCnr, StubbyScan->pci);
    228         if (ret == 1) {
     229        ok = Stubby(StubbyScan->hwndCnr, StubbyScan->pci);
     230        if (ok) {
    229231          if (WinIsWindow((HAB)0, StubbyScan->hwndCnr)) {
    230232            ULONG flags = driveflags[toupper(*StubbyScan->pci->pszFileName) - 'A'];
     
    281283                         ProcessDir->partial,
    282284                         ProcessDir->stopflag,
    283                          ProcessDir->dcd,                       // Optional
     285                         ProcessDir->dcd,               // Optional
    284286                         ProcessDir->pulTotalFiles,     // Optional
    285287                         ProcessDir->pullTotalBytes);   // Optional
     
    532534  if (!*pffb->achName) {
    533535    pci->pszFileName = xstrdup(pszDirectory, pszSrcFile, __LINE__);
    534     //strcpy(pci->pszFileName, pszDirectory);
    535536  }
    536537  else {
     
    880881
    881882  PSZ pszFileSpec;
    882   //INT t;
    883883  PFILEFINDBUF4L paffbFound;
    884884  PFILEFINDBUF4L *papffbSelected;
     
    895895  ULONG ulReturnFiles = 0;
    896896  ULONGLONG ullReturnBytes = 0;
    897   //PCH pchEndPath;
    898897  APIRET rc;
    899898  PCNRITEM pci;
     
    925924
    926925  if (paffbFound && papffbSelected && pszFileSpec) {
    927     //t = strlen(szDirBase);
    928926    strcpy(pszFileSpec, szDirBase);
    929927    AddBackslashToPath(pszFileSpec);
    930     //pchEndPath = pszFileSpec + t;
    931     //if (*(pchEndPath - 1) != '\\') {
    932     //  memcpy(pchEndPath, "\\", 2);
    933     //  pchEndPath++;
    934     //}
    935928    strcat(pszFileSpec, "*");
    936929    DosError(FERR_DISABLEHARDERR);
     
    946939                       FIL_QUERYEASIZEL);
    947940    priority_normal();
    948     pszFileSpec[strlen(pszFileSpec) - 1] = 0;     // Chop off wildcard
     941    pszFileSpec[strlen(pszFileSpec) - 1] = 0;   // Chop off wildcard
    949942    if (!rc) {
    950943      do {
     
    10981091        else {
    10991092          // 04 Jan 08 SHL fixme like comp.c to handle less than ulSelCnt records
    1100           if (dcd && hwndStatus &&
     1093          if (hwndStatus && dcd &&
    11011094              dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent)) {
    11021095            WinSetWindowText(hwndStatus, GetPString(IDS_PLEASEWAITCOUNTINGTEXT));
     
    11671160    }
    11681161
     1162    // 13 Oct 09 SHL fixme to be saymsg if ERROR_NOT_READY and first try on volume
    11691163    if (rc && rc != ERROR_NO_MORE_FILES) {
    11701164      Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
     
    12311225} // FillDirCnr
    12321226
     1227/**
     1228 * Fill tree container and drives list
     1229 * Offer to update command line options if not already done and not suppressed
     1230 */
     1231
    12331232VOID FillTreeCnr(HWND hwndCnr, HWND hwndParent)
    12341233{
    1235   ULONG ulCurDriveNum, ulDriveMap, numtoinsert = 0;
     1234  ULONG ulCurDriveNum;
     1235  ULONG ulDriveMap;
     1236  ULONG numtoinsert = 0;
    12361237  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
    12411245  CHAR szFSType[CCHMAXPATH];
    12421246  FILESTATUS4L fsa4;
    12431247  APIRET rc;
    1244   //BOOL drivesbuilt = FALSE;
    12451248  ULONG startdrive = 3;
     1249  HWND hwndDrivelist;
     1250
    12461251  static BOOL didonce;
     1252  static ULONG ulLastDriveMap;
    12471253
    12481254  fDummy = TRUE;
    1249   *suggest = 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 |
    12521258                      DRIVE_NOLOADSUBJS | DRIVE_NOLOADLONGS |
    12531259                      DRIVE_INCLUDEFILES | DRIVE_SLOW | DRIVE_NOSTATS |
     
    12761282  }
    12771283
    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)
    12811295      numtoinsert++;
    12821296  }
     
    12971311  // 04 Jan 08 SHL fixme like comp.c to handle less than ulSelCnt records
    12981312  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) {
    13021316      CHAR s[80];
    13031317      ULONG flags = 0;
    13041318      ULONG size = sizeof(ULONG);
    13051319      struct {
    1306               ULONG serial;
    1307               CHAR volumelength;
    1308               CHAR volumelabel[CCHMAXPATH];
    1309              } volser;
    1310 
    1311       *szDrive = (CHAR)x + 'A';         // Build path spec
     1320        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
    13121326
    13131327      sprintf(s, "%c.DriveFlags", toupper(*szDrive));
    13141328      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) {
    13191333        // Hard drive (2..N)
    1320         if (!(driveflags[x] & DRIVE_NOPRESCAN)) {
     1334        if (~driveflags[iDrvNum] & DRIVE_NOPRESCAN) {
    13211335          *szFSType = 0;
    13221336          ulDriveType = 0;
    13231337          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;
    13261340          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) {
    13311345              CHAR Key[80];
    13321346
    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));
    13361350            }
    13371351          }
     
    13421356            pci->rc.flRecordAttr |= (CRA_CURSORED | CRA_SELECTED);
    13431357
    1344           if (!(driveflags[x] & DRIVE_REMOVABLE)) {
     1358          if (~driveflags[iDrvNum] & DRIVE_REMOVABLE) {
    13451359            // Fixed volume
    13461360            pci->attrFile |= FILE_DIRECTORY;
     
    13581372            if (rc && !didonce) {
    13591373              // Guess drive letter
    1360               if (!*suggest) {
    1361                 *suggest = '/';
    1362                 suggest[1] = 0;
     1374              if (!*szSuggest) {
     1375                *szSuggest = '/';
     1376                szSuggest[1] = 0;
    13631377              }
    13641378
    1365               sprintf(suggest + strlen(suggest), "%c" , toupper(*szDrive));
     1379              sprintf(szSuggest + strlen(szSuggest), "%c" , toupper(*szDrive));
    13661380              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);
    13721383              pci->pszDisplayName = xstrdup(szDrive, pszSrcFile, __LINE__);
    1373               szDrive[3] = 0;
     1384              szDrive[3] = 0;           // Restore nul
    13741385              pci->rc.pszIcon = pci->pszDisplayName;
    13751386              pci->attrFile = FILE_DIRECTORY;
    13761387              pci->pszDispAttr = FileAttrToString(pci->attrFile);
    1377               driveserial[x] = -1;
     1388              driveserial[iDrvNum] = -1;
    13781389            }
    13791390            else
     
    13831394            // Removable volume
    13841395            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);
    13901398            pci->pszDisplayName = xstrdup(szDrive, pszSrcFile, __LINE__);
    1391             szDrive[3] = 0;
     1399            szDrive[3] = 0;             // Restore nul
    13921400            pci->rc.pszIcon = pci->pszDisplayName;
    13931401            pci->attrFile = FILE_DIRECTORY;
     
    14041412          pci->rc.hptrIcon = hptrDunno;
    14051413          pci->pszFileName = xstrdup(szDrive, pszSrcFile, __LINE__);
    1406           if (fShowFSTypeInTree || fShowDriveLabelInTree) {
     1414          if (fShowFSTypeInTree || fShowDriveLabelInTree)
    14071415            strcat(szDrive, " [?]");
    1408           }
    14091416          pci->pszDisplayName = xstrdup(szDrive, pszSrcFile, __LINE__);
    14101417          szDrive[3] = 0;
     
    14161423          pci->attrFile = FILE_DIRECTORY;
    14171424          pci->pszDispAttr = FileAttrToString(pci->attrFile);
    1418           driveserial[x] = -1;
     1425          driveserial[iDrvNum] = -1;
    14191426        }
    14201427        }
     
    14301437        pci->attrFile = FILE_DIRECTORY;
    14311438        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;
    14341441      }
    14351442      pci->rc.flRecordAttr |= CRA_RECORDREADONLY;
    14361443      pci = (PCNRITEM) pci->rc.preccNextRecord; // next rec
    14371444    }
    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    }
    14401467  } // for drives
    14411468
    1442   //PostMsg(hwndMain, UM_BUILDDRIVEBAR, MPVOID, MPVOID);
    1443   //drivesbuilt = TRUE;
     1469  ulLastDriveMap = ulDriveMap;          // 13 Oct 09 SHL
    14441470
    14451471  // insert the drives
     
    14801506                                  MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
    14811507    }
    1482   }
    1483 
    1484   if (hwndParent) {
    1485     WinSendMsg(WinWindowFromID(WinQueryWindow(hwndParent, QW_PARENT),
    1486                                MAIN_DRIVELIST),
    1487                LM_DELETEALL, MPVOID, MPVOID);
    14881508  }
    14891509
     
    15661586  {
    15671587    STUBBYSCAN *stubbyScan;
    1568     HWND hwndDrivesList = WinWindowFromID(WinQueryWindow(hwndParent, QW_PARENT),
    1569                                           MAIN_DRIVELIST);
    15701588
    15711589    pci = (PCNRITEM) WinSendMsg(hwndCnr,
     
    15791597      stubbyScan->pci = pci;
    15801598      stubbyScan->hwndCnr = hwndCnr;
    1581       stubbyScan->hwndDrivesList = hwndDrivesList;
    15821599      pciNext = (PCNRITEM) WinSendMsg(hwndCnr,
    15831600                                      CM_QUERYRECORD,
     
    15851602                                      MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
    15861603      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
    15901608          if (~flags & DRIVE_INVALID &&
    15911609              ~flags & DRIVE_NOPRESCAN &&
     
    16001618              xfree(stubbyScan, pszSrcFile, __LINE__);
    16011619            }
    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
    16081621        }
    16091622        else {
     1623          // Diskette and not current drive
    16101624          WinSendMsg(hwndCnr,
    16111625                     CM_INVALIDATERECORD,
    16121626                     MPFROMP(&pci),
    16131627                     MPFROM2SHORT(1, CMA_ERASE | CMA_REPOSITION));
    1614           WinSendMsg(hwndDrivesList,
    1615                      LM_INSERTITEM,
    1616                      MPFROM2SHORT(LIT_SORTASCENDING, 0),
    1617                      MPFROMP(pci->pszFileName));
    16181628        }
    16191629      }
     
    16211631    } // while
    16221632  }
    1623   if (hwndParent)
    1624     WinSendMsg(WinWindowFromID(WinQueryWindow(hwndParent, QW_PARENT),
    1625                                MAIN_DRIVELIST), LM_SELECTITEM,
    1626               MPFROM2SHORT(0, 0), MPFROMLONG(TRUE));
     1633
     1634  // 13 Oct 09 SHL
     1635  if (hwndDrivelist)
     1636    WinSendMsg(hwndDrivelist, LM_SELECTITEM, MPFROM2SHORT(0, 0), MPFROMLONG(TRUE));
    16271637
    16281638  pci = (PCNRITEM) WinSendMsg(hwndCnr,
     
    16681678    BOOL includesyours = FALSE;
    16691679
    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)) {
    16721682      if (!DosDevConfig(&info, DEVINFO_FLOPPY) && info == 1) {
    1673         if (!*suggest) {
    1674           *suggest = '/';
    1675           suggest[1] = 0;
     1683        if (!*szSuggest) {
     1684          *szSuggest = '/';
     1685          szSuggest[1] = 0;
    16761686        }
    16771687        else
    1678           memmove(suggest + 2, suggest + 1, strlen(suggest));
    1679         suggest[1] = 'B';
    1680       }
    1681     }
    1682     if (*suggest) {
    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) {
    16851695          includesyours = TRUE;
    1686           sprintf(suggest + strlen(suggest), "%c", (char)(x + 'A'));
     1696          sprintf(szSuggest + strlen(szSuggest), "%c", (char)(iDrvNum + 'A'));
    16871697        }
    16881698      }
    1689       strcat(suggest, " %*");
     1699      strcat(szSuggest, " %*");
    16901700      saymsg(MB_YESNOCANCEL | MB_ICONEXCLAMATION,
    1691              (hwndParent) ? hwndParent : hwndCnr,
     1701             hwndParent ? hwndParent : hwndCnr,
    16921702             GetPString(IDS_SUGGESTTITLETEXT),
    16931703             GetPString(IDS_SUGGEST1TEXT),
    16941704             (includesyours) ? GetPString(IDS_SUGGEST2TEXT) : NullStr,
    1695              suggest);
     1705             szSuggest);
    16961706      if (MBID_YES) {
    16971707        char s[64];
    1698 
    1699         sprintf(s, "PARAMETERS=%s", suggest);
     1708        sprintf(s, "PARAMETERS=%s", szSuggest);
    17001709        WinCreateObject(WPProgram, "FM/2", s, FM3Folder, CO_UPDATEIFEXISTS);
    17011710        WinCreateObject(WPProgram,
     
    17171726        PrfWriteProfileData(fmprof, appname, "DontSuggestAgain", &fDontSuggestAgain, sizeof(BOOL));
    17181727      }
    1719     }
     1728    } // if suggest
    17201729  }
    17211730  didonce = TRUE;
     
    17861795  }
    17871796
     1797#if 0 // 26 Sep 09 SHL debug dup free complaints
    17881798  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);
    17901800  else {
    17911801    if (pci->pszFileName != NullStr)
     
    17931803    pci->pszFileName = NULL;            // Catch illegal references
    17941804  }
     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
    17951856
    17961857  // 08 Sep 08 SHL Remove excess logic
  • trunk/dll/filter.c

    r1398 r1471  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2004, 2008 Steven H.Levine
     9  Copyright (c) 2004, 2009 Steven H.Levine
    1010
    1111  01 Aug 04 SHL Rework lstrip/rstrip usage
     
    1919  07 Feb 09 GKY Eliminate Win_Error2 by moving function names to PCSZs used in Win_Error
    2020  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
    2122
    2223***********************************************************************/
     
    3940#include "errutil.h"                    // Dos_Error...
    4041#include "strutil.h"                    // GetPString
    41 #include "pathutil.h"                   // BldFullPathName
     42#include "pathutil.h"                   // BldFullPathName
    4243#include "filter.h"
    4344#include "select.h"                     // SetMask
     
    5152#pragma data_seg(FILTER_DATA)
    5253
     54static PCSZ PSCZ_FILTER_LASTMASK_SELECT = "Filter.LastMaskSelect";
     55
    5356static PSZ pszSrcFile = __FILE__;
    5457
    5558#define MAXNUMMASKS 50
    5659
    57 typedef struct LINKMASKS
    58 {
     60typedef struct LINKMASKS {
    5961  CHAR *mask;
    6062  struct LINKMASKS *next;
    61 }
    62 LINKMASKS;
     63} LINKMASKS;
    6364
    6465static LINKMASKS *maskhead = NULL;
     
    6768static VOID save_masks(VOID);
    6869
     70/**
     71 * Filter callback
     72 */
     73
    6974INT APIENTRY Filter(PMINIRECORDCORE rmini, PVOID arg)
    7075{
    71 
    72   MASK *mask = (MASK *) arg;
     76  MASK *mask = (MASK *)arg;
    7377  PCNRITEM r;
    74   register INT x;
     78  INT x;
    7579  INT ret = FALSE;
    7680  CHAR *file;
     
    96100        || ((mask->antiattr & FILE_DIRECTORY)
    97101            && !(r->attrFile & FILE_DIRECTORY)))
    98         return FALSE;
     102        return FALSE;
    99103    if (*mask->szMask) {
    100104      file = strrchr(r->pszFileName, '\\');
    101105      if (!file)
    102         file = strrchr(r->pszFileName, ':');
     106        file = strrchr(r->pszFileName, ':');
    103107      if (file)
    104         file++;
     108        file++;
    105109      else
    106         file = r->pszFileName;
     110        file = r->pszFileName;
    107111      if (mask->pszMasks[1]) {
    108         for (x = 0; mask->pszMasks[x]; x++) {
    109           if (*mask->pszMasks[x]) {
    110             if (*mask->pszMasks[x] != '/') {
    111               if (wildcard((strchr(mask->pszMasks[x], '\\') ||
    112                             strchr(mask->pszMasks[x], ':')) ?
    113                            r->pszFileName : file, mask->pszMasks[x], FALSE))
    114                 ret = TRUE;
    115             }
    116             else {
    117               if (wildcard((strchr(mask->pszMasks[x], '\\') ||
    118                             strchr(mask->pszMasks[x], ':')) ?
    119                            r->pszFileName : file, mask->pszMasks[x] + 1,
    120                            FALSE)) {
    121                 ret = FALSE;
    122                 break;
    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        }
    127131      }
    128132      else {
    129         if (wildcard((strchr(mask->szMask, '\\') ||
    130                       strchr(mask->szMask, ':')) ?
    131                      r->pszFileName : file, mask->szMask, FALSE))
    132           ret = TRUE;
     133        if (wildcard((strchr(mask->szMask, '\\') ||
     134                      strchr(mask->szMask, ':')) ?
     135                     r->pszFileName : file, mask->szMask, FALSE))
     136          ret = TRUE;
    133137      }
    134138    }
     
    141145}
    142146
    143 VOID load_masks(VOID)
     147/**
     148 * Load linked list of filter masks from FILTERS.DAT file
     149 */
     150
     151static VOID load_masks(VOID)
    144152{
    145 
    146   /* load linked list of filter masks from FILTERS.DAT file */
    147 
    148153  FILE *fp;
    149154  LINKMASKS *info, *last = NULL;
     
    173178        }
    174179      }
    175     }  //while
     180    } //while
    176181    fclose(fp);
    177182  }
    178183}
    179184
    180 VOID save_masks(VOID)
     185/**
     186 * Save linked list of filter masks to FILTERS.DAT file
     187 */
     188
     189static VOID save_masks(VOID)
    181190{
    182 
    183   /* save linked list of filter masks to FILTERS.DAT file */
    184 
    185191  LINKMASKS *info;
    186192  FILE *fp;
     
    206212}
    207213
    208 VOID add_mask(CHAR * mask)
     214/**
     215 * Add mask to end of internal list
     216 */
     217
     218static VOID add_mask(CHAR * mask)
    209219{
    210 
    211   LINKMASKS *info, *last = NULL;
     220  LINKMASKS *info;
     221  LINKMASKS *last = NULL;
    212222
    213223  if (!mask || !*mask)
     
    237247}
    238248
    239 VOID remove_mask(CHAR * mask)
     249/**
     250 * Remove mask from internal list
     251 */
     252
     253static VOID remove_mask(CHAR * mask)
    240254{
    241 
    242255  LINKMASKS *info, *last = NULL;
    243256
     
    262275}
    263276
     277/**
     278 * Select filter option dialog box procedure
     279 */
     280
    264281MRESULT EXPENTRY PickMaskDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
    265282{
     283  LINKMASKS *info;
     284  MASK *mask;
     285  SHORT sSelect;
     286  CHAR s[CCHMAXPATH];
     287  ULONG size;
     288  static SHORT sLastMaskSelect = LIT_NONE;
    266289
    267290  switch (msg) {
     
    270293                      MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
    271294    if (!mp2) {
     295      Runtime_Error(pszSrcFile, __LINE__, NULL);
    272296      WinDismissDlg(hwnd, 0);
    273297      break;
    274298    }
    275     if (!loadedmasks)
     299
     300    if (!loadedmasks) {
    276301      load_masks();
     302      size = sizeof(sLastMaskSelect);
     303      PrfQueryProfileData(fmprof, appname, PSCZ_FILTER_LASTMASK_SELECT, &sLastMaskSelect, &size);
     304    }
     305
    277306    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)
    303354        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
    339368      if (*mask->szMask) {
    340 
    341         CHAR s[CCHMAXPATH], *p;
    342 
     369        CHAR *p;
    343370        strcpy(s, mask->szMask);
    344371        if (!strchr(mask->szMask, '?') && !strchr(mask->szMask, '*')) {
     
    352379        WinSendDlgItemMsg(hwnd, MSK_MASK, EM_SETSEL,
    353380                          MPFROM2SHORT(0, CCHMAXPATH), MPVOID);
    354 //          *mask->szMask = 0;
    355381        PostMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
    356382      }
     383
    357384      if (mask->fIsTree) {
    358385        WinCheckButton(hwnd, MSK_DIRECTORY, TRUE);
     
    361388        WinEnableWindow(WinWindowFromID(hwnd, MSK_SHOWDIRS), FALSE);
    362389      }
     390
    363391      if (mask->fIsSeeAll) {
    364392        WinCheckButton(hwnd, MSK_DIRECTORY, FALSE);
     
    369397        WinEnableWindow(WinWindowFromID(hwnd, MSK_SHOWDIRS), FALSE);
    370398      }
     399
    371400      if (*mask->prompt)
    372401        WinSetWindowText(hwnd, mask->prompt);
     
    378407  case UM_SETUP:
    379408    {
    380       MASK *mask = WinQueryWindowPtr(hwnd, QWL_USER);
     409      mask = WinQueryWindowPtr(hwnd, QWL_USER);
    381410
    382411      if (mask && mask->fText) {
     
    408437                             50,
    409438                             swpE.cy, hwnd, HWND_TOP, 65535, NULL, NULL)) {
    410           Win_Error(hwnd, hwnd, pszSrcFile, __LINE__,
    411                     PCSZ_WINCREATEWINDOW);
     439          Win_Error(hwnd, hwnd, pszSrcFile, __LINE__,
     440                    PCSZ_WINCREATEWINDOW);
    412441        }
    413442        if (!WinCreateWindow(hwnd,
     
    420449                             swpL.cx - 54,
    421450                             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);
    428456        if (mask->szText) {
    429457          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);
    433460        }
    434461      }
     
    506533      case LN_SELECT:
    507534        {
    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,
    514536                                              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,
    520541                              MPFROM2SHORT(sSelect,
    521                                            CCHMAXPATH), MPFROMP(tempmask));
    522           WinSetDlgItemText(hwnd, MSK_MASK, tempmask);
     542                                           CCHMAXPATH), MPFROMP(s));
     543          }
     544          WinSetDlgItemText(hwnd, MSK_MASK, s);
    523545        }
    524546        break;
     
    535557    switch (SHORT1FROMMP(mp1)) {
    536558    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);
    575594        }
    576595      }
     
    582601    case MSK_DELETE:
    583602    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) {
    594639        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;
    633672          }
    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
    661685      }
    662686      break;
     
    670694
    671695    case DID_CANCEL:
     696      PrfWriteProfileData(fmprof, appname,
     697                          PSCZ_FILTER_LASTMASK_SELECT, &sLastMaskSelect, sizeof(sLastMaskSelect));
    672698      WinDismissDlg(hwnd, 0);
    673699      break;
  • trunk/dll/flesh.c

    r1409 r1471  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2005, 2008 Steven H. Levine
     9  Copyright (c) 2005, 2009 Steven H. Levine
    1010
    1111  24 May 05 SHL Rework Win_Error usage
     
    2323  25 Dec 08 GKY Add ProcessDirectoryThread to allow optional recursive drive scan at startup.
    2424  25 Dec 08 GKY Add DRIVE_RSCANNED flag to monitor for the first recursive drive scan per session
    25                 to prevent duplicate directory names in tree following a copy before initial scan.
     25                to prevent duplicate directory names in tree following a copy before initial scan.
    2626  08 Mar 09 GKY Additional strings move to PCSZs in init.c
    2727
     
    200200      ProcessDir = xmallocz(sizeof(PROCESSDIR), pszSrcFile, __LINE__);
    201201      if (!ProcessDir)
    202         return FALSE;
     202        return FALSE;
    203203      ProcessDir->hwndCnr = hwndCnr;
    204204      ProcessDir->pciParent = pciParent;
     
    213213
    214214      if (xbeginthread(ProcessDirectoryThread,
    215                        65536,
    216                        ProcessDir,
    217                        pszSrcFile,
    218                        __LINE__) == -1)
     215                       65536,
     216                       ProcessDir,
     217                       pszSrcFile,
     218                       __LINE__) == -1)
    219219      {
    220         xfree(ProcessDir, pszSrcFile, __LINE__);
    221       }
    222     }
    223     else  {
     220        xfree(ProcessDir, pszSrcFile, __LINE__);
     221      }
     222    }
     223    else {
    224224      ProcessDirectory(hwndCnr,
    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
     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
    234234    }
    235235  }
     
    268268#define DDEPTH 16
    269269
     270/**
     271 * Fill in drive tree subtree
     272 * @return TRUE if OK, else FALSE
     273 */
     274
    270275BOOL Stubby(HWND hwndCnr, PCNRITEM pciParent)
    271276{
     
    276281   */
    277282
    278   BOOL ret = FALSE;
     283  BOOL ok = FALSE;
    279284  FILEFINDBUF3 ffb[DDEPTH];
    280285  PFILEFINDBUF3 pffb;
     
    308313      str[1] != ':' ||
    309314      str[2] != '\\' || ((flags & DRIVE_IGNORE)))
    310     return FALSE;
     315    return FALSE;                       // Not a directory
    311316
    312317  //if (isalpha(*str) &&  // redundant check GKY 11/24/08
     
    314319    includefiles = TRUE;
    315320
    316 #if 0
    317   if (!isalpha(*str) ||   // redundant check GKY 11/24/08
    318       str[1] != ':' ||
    319       str[2] != '\\' ||
    320 #endif
    321321  if (flags & DRIVE_REMOTE)
    322322    isremote = TRUE;
     
    398398                                                     &nm))));
    399399    DosFindClose(hDir);
     400    // If drive B:
    400401    if (toupper(*pciParent->pszFileName) > 'B' &&
    401402        (*(pciParent->pszFileName + 1)) == ':' &&
     
    429430                           GetPString(IDS_FSDERRORTITLETEXT),
    430431                           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);
    434435              if (prc == MBID_NO) {
    435436                saymsg(MB_ENTER,
     
    469470      if (isadir) {
    470471
    471         PCNRITEM pci;
    472 
    473         if (WinIsWindow((HAB)0, hwndCnr)) {
    474           pci = WinSendMsg(hwndCnr,
    475                            CM_ALLOCRECORD,
    476                            MPFROMLONG(EXTRA_RECORD_BYTES), MPFROMLONG(1));
    477           if (!pci) {
    478             Win_Error(hwndCnr, HWND_DESKTOP, __FILE__, __LINE__,
    479                       GetPString(IDS_RECORDALLOCFAILEDTEXT));
    480           }
    481           else {
    482             RECORDINSERT ri;
    483             pci->pszFileName = NullStr;
    484             pci->pszDisplayName = pci->pszFileName;
    485             pci->rc.pszIcon = pci->pszDisplayName;
    486             memset(&ri, 0, sizeof(RECORDINSERT));
    487             ri.cb = sizeof(RECORDINSERT);
    488             ri.pRecordOrder = (PRECORDCORE) CMA_END;
    489             ri.pRecordParent = (PRECORDCORE) pciParent;
    490             ri.zOrder = (ULONG) CMA_TOP;
    491             ri.cRecordsInsert = 1;
    492             ri.fInvalidateRecord = TRUE;
    493             //DbgMsg(pszSrcFile, __LINE__, "Stubby %p CM_INSERTRECORD \"%s\" %.255s", hwndCnr, pci->pszFileName, pffb->achName); // 18 Dec 08 SHL fixme debug
    494             if (!WinSendMsg(hwndCnr,
    495                             CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri))) {
    496               DosSleep(50); //05 Aug 07 GKY 100
    497               WinSetFocus(HWND_DESKTOP, hwndCnr);
    498               if (WinIsWindow((HAB)0, hwndCnr)) {
    499                 //DbgMsg(pszSrcFile, __LINE__, "Stubby %p CM_INSERTRECORD %s", hwndCnr, pci->pszFileName); // 18 Dec 08 SHL fixme debug
    500                 if (!WinSendMsg(hwndCnr,
    501                                 CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri))) {
    502                   Win_Error(hwndCnr, HWND_DESKTOP, __FILE__, __LINE__,
    503                             GetPString(IDS_RECORDINSERTFAILEDTEXT));
    504                   FreeCnrItem(hwndCnr, pci);
    505                 }
    506                 else
    507                   ret = TRUE;
    508               }
    509             }
    510             else
    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        }
    514515      }
    515516      else if (toupper(*str) > 'B' && str[1] == ':' && str[2] == '\\' &&
     
    528529  }
    529530  else if (toupper(*str) > 'B' && rc != ERROR_NO_MORE_FILES) {
    530 
    531531    CHAR s[CCHMAXPATH + 80];
    532 
    533532    sprintf(s, GetPString(IDS_SEARCHERRORTEXT), rc, str);
    534533    Notify(s);
     
    538537
    539538  DosError(FERR_DISABLEHARDERR);
    540   return ret;
     539  return ok;
    541540}
    542541
  • trunk/dll/grep.c

    r1456 r1471  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2001, 2008 Steven H. Levine
     9  Copyright (c) 2001, 2009 Steven H. Levine
    1010
    1111  12 Feb 03 SHL InsertGrepFile: standardize EA math
     
    562562  PSZ p;
    563563  APIRET rc;
    564   // 06 Oct 07 SHL Correct size for xDosFindFirst
    565564  ULONG ulBufBytes = FilesToGet * sizeof(FILEFINDBUF4L);
    566565  static BOOL fDone;
     
    697696
    698697/**
    699  * Insert record into container
     698 * Insert one or more records into container
    700699 */
    701700
     
    826825      grep->insertedbytes += pffb->cbFile + CBLIST_TO_EASIZE(pffb->cbList);
    827826      grep->toinsert++;
    828       if (grep->toinsert == FilesToGet)
     827      // 07 Oct 09 SHL honor sync updates
     828      if (grep->toinsert == FilesToGet || fSyncUpdates)
    829829        return DoInsertion(grep, pitdSleep, pitdReport);
    830830      return TRUE;
  • trunk/dll/grep2.c

    r1438 r1471  
    2626  07 Feb 09 GKY Allow user to turn off alert and/or error beeps in settings notebook.
    2727  08 Mar 09 GKY Additional strings move to PCSZs in init.c
     28  07 Oct 09 SHL Remember last search mask across runs
    2829
    2930  fixme for more excess locals to be gone
     
    3637#include <share.h>
    3738#include <time.h>
    38 // #include <process.h>                    // _beginthread
    3939
    4040#define INCL_DOS
    4141#define INCL_WIN
    42 #define INCL_LONGLONG                   // dircnrs.h
    43 #define INCL_WINSTDCNR                  // makelist.h
     42#define INCL_LONGLONG                   // dircnrs.h
     43#define INCL_WINSTDCNR                  // makelist.h
    4444
    4545#include "fm3dll.h"
     
    5454#include "mle.h"
    5555#include "grep.h"
    56 #include "errutil.h"                    // Dos_Error...
    57 #include "strutil.h"                    // GetPString
    58 #include "pathutil.h"                   // BldFullPathName
    59 #include "walkem.h"                     // FillPathListBox
     56#include "errutil.h"                    // Dos_Error...
     57#include "strutil.h"                    // GetPString
     58#include "pathutil.h"                   // BldFullPathName
     59#include "walkem.h"                     // FillPathListBox
    6060#include "grep2.h"
    6161#include "wrappers.h"                   // xfgets
    62 #include "misc.h"                       // LoadLibPath
     62#include "misc.h"                       // LoadLibPath
    6363#include "strips.h"                     // bstrip
    6464#include "dirs.h"                       // save_dir2
    6565#include "fortify.h"
    6666#include "excputil.h"                   // xbeginthread
    67 #include "valid.h"                      // IsFile
     67#include "valid.h"                      // IsFile
    6868
    6969#pragma data_seg(DATA1)
    7070
    7171static PSZ pszSrcFile = __FILE__;
     72
     73static PCSZ PSCZ_GREP_LASTMASK_SELECT = "Grep_LastMaskSelect";
    7274
    7375MRESULT EXPENTRY EnvDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
     
    159161        bstrip(p);
    160162        if (!*p) {
    161           if (!fAlertBeepOff)
     163          if (!fAlertBeepOff)
    162164            DosBeep(50, 100);
    163165          WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, ENV_NAME));
     
    190192  SHORT sSelect;
    191193  CHAR *p;
    192   CHAR s[8192 + 14];
     194  GREPINFO *GrepInfo;
     195  ULONG size;
    193196  CHAR simple[8192];
    194197  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];
    199203  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;
    203207  static BOOL searchEAs = TRUE;
    204208  static BOOL searchFiles = TRUE;
    205   static BOOL changed = FALSE;
     209  static BOOL changed;
     210  static BOOL fInitDone;                // First time init done
    206211  static BOOL findifany = TRUE;
    207   static BOOL gRemember = FALSE;
    208   ULONG size;
     212  static BOOL gRemember;
    209213  static UINT newer = 0;
    210214  static UINT older = 0;
    211215  static ULONG greater = 0;
    212216  static ULONG lesser = 0;
     217  static SHORT sLastMaskSelect = LIT_NONE;
    213218
    214219  switch (msg) {
     
    220225    GrepInfo = mp2;
    221226    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
    224242    WinSetWindowULong(hwnd, QWL_USER, *(HWND *) GrepInfo->hwnd);
    225243    WinSendDlgItemMsg(hwnd,
     
    303321    WinEnableWindow(WinWindowFromID(hwnd, GREP_NOSIZEDUPES), FALSE);
    304322
     323    // Fill mask listbox
    305324    BldFullPathName(s, pFM2SaveDirectory, PCSZ_GREPMASKDAT);
    306325    fp = _fsopen(s, "r", SH_DENYWR);
     
    318337      fclose(fp);
    319338    }
     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));
    320343
    321344    FillPathListBox(hwnd,
    322345                    WinWindowFromID(hwnd, GREP_DRIVELIST),
    323346                    (HWND) 0, NULL, FALSE);
     347    // 25 Sep 09 SHL fixme select drive matching current container?
    324348    break;
    325349
     
    334358
    335359  case UM_FOCUSME:
    336     /* set focus to window hwnd in mp1 */
     360    // set focus to window hwnd in mp1
    337361    if (mp1)
    338362      WinSetFocus(HWND_DESKTOP, (HWND) mp1);
     
    409433          }
    410434        }
    411         break;                          // LN_ENTER
    412       }                                 // switch
     435        break; // LN_ENTER
     436      } // switch
    413437      break;
    414438
     
    435459                                              MPFROMSHORT(LIT_FIRST), MPVOID);
    436460          if (sSelect >= 0) {
     461            sLastMaskSelect = sSelect;
    437462            *s = 0;
    438463            if (WinQueryButtonCheckstate(hwnd, GREP_APPEND)) {
     
    650675          }
    651676          rstrip(s);
     677          // 25 Sep 09 SHL fixme to honor append
    652678          if (*s) {
    653679            strcat(s, simple);
     
    692718                          GREP_LISTBOX,
    693719                          LM_DELETEITEM, MPFROM2SHORT(sSelect, 0), MPVOID);
     720        if (sSelect >= sLastMaskSelect)
     721          sLastMaskSelect--;
    694722        changed = TRUE;
    695723      }
     
    812840      else {
    813841        // 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
    816843        p = xmalloc(8192 + 512, pszSrcFile, __LINE__);
    817844        if (!p)
     
    841868                              (PVOID) & searchEAs, sizeof(BOOL));
    842869        }
     870        PrfWriteProfileData(fmprof, appname,
     871                            PSCZ_GREP_LASTMASK_SELECT, &sLastMaskSelect, sizeof(sLastMaskSelect));
    843872        g.finddupes = WinQueryButtonCheckstate(hwnd, GREP_FINDDUPES) != 0;
    844873        if (g.finddupes) {
     
    854883        bstrip(p);
    855884        if (!*p) {
    856           if (!fAlertBeepOff)
     885          if (!fAlertBeepOff)
    857886            DosBeep(50, 100);
    858887          WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, GREP_MASK));
     
    9761005      }
    9771006      if (changed) {
    978         // Grep mask list changed
     1007        // Save modified mask list
    9791008        SHORT x;
    9801009
     
    9831012                                            LM_QUERYITEMCOUNT,
    9841013                                            MPVOID, MPVOID);
    985         if (sSelect > 0) {
     1014        // 07 Oct 09 SHL Rewrite if list empty
     1015        if (sSelect >= 0) {
    9861016          BldFullPathName(s, pFM2SaveDirectory, PCSZ_GREPMASKDAT);
    9871017          if (CheckDriveSpaceAvail(s, ullDATFileSpaceNeeded, 1) == 2)
  • trunk/dll/init.c

    r1452 r1471  
    7878  14 Mar 09 GKY PCSZ strings moved to compile time initialization
    7979  14 Mar 09 GKY Prevent execution of UM_SHOWME while drive scan is occuring replaces check for
    80                 saved drive containers.
     80                saved drive containers.
    8181  06 Jun 09 GKY Add option to show file system type or drive label in tree
    8282  28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code.
     
    8585  22 Jul 09 GKY Fix failure to restore the notebook setting for saving container states or not
    8686  12 Sep 09 GKY Change protectonly check to check for VKBD being loaded instead of starting
    87                 command.com. Prevents hang (at least until a Dos program is started) on a system
    88                 that has a broken MDOS install.
     87                command.com. Prevents hang (at least until a Dos program is started) on a system
     88                that has a broken MDOS install.
    8989
    9090***********************************************************************/
     
    117117#include "cmdline.h"                    // Data declaration(s)
    118118#include "fm2cmd.h"                     // Data declaration(s)
    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)
     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)
    125125#include "fm3dlg.h"
    126126#include "datamin.h"
     
    128128#include "fm3str.h"
    129129#include "version.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
     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
    136136#include "mainwnd.h"                    // BubbleProc, ChildButtonProc, DriveBackProc,
    137137                                        // DriveProc, LEDProc, MainWndProc, StatusProc
     
    10971097  if (DosCreateMutexSem(NULL, &hmtxFM2Delete, 0L, FALSE))
    10981098    Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
    1099               PCSZ_DOSCREATEMUTEXSEM);
     1099              PCSZ_DOSCREATEMUTEXSEM);
    11001100  if (DosCreateMutexSem(NULL, &hmtFillingTreeCnr, 0L, FALSE))
    11011101    Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
    1102               PCSZ_DOSCREATEMUTEXSEM);
     1102              PCSZ_DOSCREATEMUTEXSEM);
    11031103  if (DosCreateEventSem(NULL, &hevInitialCnrScanComplete, 0L, FALSE))
    11041104    Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
    1105               PCSZ_DOSCREATEEVENTSEM);
     1105              PCSZ_DOSCREATEEVENTSEM);
    11061106
    11071107  /*
     
    11811181      rc = DosQueryModuleHandle("VKBD", &hmod);
    11821182      if (rc != NO_ERROR) {
    1183         fProtectOnly = TRUE;
    1184         DbgMsg(pszSrcFile, __LINE__, "DosQModuleHandle VKBD returned %d fProtectOnly=%d", rc, fProtectOnly);
     1183        fProtectOnly = TRUE;
     1184        DbgMsg(pszSrcFile, __LINE__, "DosQModuleHandle VKBD returned %d fProtectOnly=%d", rc, fProtectOnly);
    11851185      }
    11861186      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        }
    11911192      }
    11921193    }
     
    13431344  PrfQueryProfileData(fmprof, appname, "ShowEnv", &fShowEnv, &size);
    13441345  PrfQueryProfileString(fmprof, appname, "TreeEnvVarList", "PATH;DPATH;LIBPATH;HELP;BOOKSHELF;",
    1345                         pszTreeEnvVarList, MaxComLineStrg);
     1346                        pszTreeEnvVarList, MaxComLineStrg);
    13461347  size = sizeof(BOOL);
    13471348  PrfQueryProfileData(fmprof, FM3Str, "ShowDriveOnly", &fShowDriveOnly, &size);
     
    14081409  size = sizeof(BOOL);
    14091410  PrfQueryProfileData(fmprof, appname, "ConfirmDelete", &fConfirmDelete, &size);
    1410   size = sizeof(BOOL); 
     1411  size = sizeof(BOOL);
    14111412  PrfQueryProfileData(fmprof, FM3Str, "SaveState", &fSaveState, &size);
    14121413  size = sizeof(BOOL);
  • trunk/dll/ipf/arclist.ipf

    r1417 r1471  
    66.*
    77.* 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
    1112.*
    1213.***********************************************************************
     
    119120enclosed directories (i.e. files are extracted into the directories they
    120121were archived "with," if any, rather than all going into the extract
    121 directory). :hp1.Extract All w/ Dirs &amp. Exit:ehp1. does the same
     122directory).
     123:p.
     124:hp1.Extract All w/ Dirs &amp. Exit:ehp1. does the same
    122125thing but closes the archive listing window after starting the
    123126extraction. (: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.*
    114:h2 res=90100 name=PANEL_COLLECTOR.Collector
    215:i1 id=aboutCollector.Collector
     
    108121:p.
    109122The :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.
     123filenames it finds based on the filemasks as it encounters them, if checked.
     124This is the recommended setting if you expect the filemask to match a relatively small number
     125of files.
     126If the checkbox is unchecked, FM/2 will report progress by displaying
     127the filename in process every couple of seconds.
     128This is the recommended setting if you expect the filemask to match a large number
     129of files and will speed up Seek and scan performance.
     130If you expect to match a large number of files, it is probably best to toggle
     131off :hp6.Immediate updates:ehp6. in the Config menu.
    112132:p.
    113133The :hp6.Search files:ehp6. checkbox, when checked, tells FM/2 to look
  • trunk/dll/ipf/fm3.ipf

    r1458 r1471  
    66.*
    77.* Copyright (c) 1993-98 M. Kimes
    8 .* Copyright (c) 2006 Steven H.Levine
     8.* Copyright (c) 2006, 2009 Steven H.Levine
    99.*
    1010.* 24 Sep 06 GKY ADD Change to F1 help
     
    873873quicklists:ehp1. command ( :color fc=default bc=palegray.F8:color fc=default bc=default. accelerator).
    874874:p.
    875 The first list (starting from the left) contains drives. If you select a
     875The first quicklist (starting from the left) contains drives. If you select a
    876876drive from the list, the Drive Tree scrolls to that drive and makes it the
    877877current object in the Drive Tree. This can be handy when you have the tree
     
    881881:p.
    882882.br
    883 The second list is the State list, containing the names of saved States of
     883The second list is the States quicklist, containing the names of saved States of
    884884the 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.
     885etc.). To add a State to this list, type the name into the entry field,
     886and select :hp1.Save State as name:ehp1. from the context menu.
     887FM/2 will save its current state under this name for later recall.
     888:p.
     889To delete a State, recall the State name from the States quicklist or type the State name
     890into the entry field and and select :hp1.Delete state:ehp1. from the context menu.
     891To recall a State name without switching to the State, hold down the
     892&CtrlKey. while selecting the State name from the list.
     893:p.
     894FM/2 provides one built-in State.
     895It is named FM2Shutdown and it can be used to restore FM/2 to the state it was in
     896when FM/2 was last shutdown. This State is opened on start up
     897if you have "Save dir window state" selected on the Monolithic tab of the
     898Configuration menu.
    892899:p.
    893900:artwork name='bitmaps\useradds.bmp' align=center.
     
    905912more flexible than the way DOS-think file managers do things.
    906913: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.
     914To edit a State, first recall it, then change what you want, then
     915resave the State.
     916:p.
     917To add a saved State to the current state, hold down the &ShiftKey.
     918key while selecting a State name from the list.
     919The container windows defined by the selected State will be added to the current container windows.
    912920:p.
    913921:artwork name='bitmaps\userstat.bmp' align=center.
    914922:p.
    915923.br
    916 The third list is the user-defined commands list. User-defined commands
     924The third list is the user-defined commands quicklist. User-defined commands
    917925allow you to extend FM/2 with commands of your own devising. You can
    918926add, change and delete commands with the :hp1.Config->Edit Commands:ehp1.
     
    922930:p.
    923931.br
    924 The fourth list is the commonly used directory list. You can add a
     932The fourth list is the commonly used directory quicklist. You can add a
    925933directory to this list as above; type in the name and select :hp1.Add
    926934pathname:ehp1. from a context menu.
     
    950958:color fc=default bc=palegray.M:color fc=default bc=default. accelerator key).
    951959:p.
    952 The commonly used directory list, in combination with the State list,
     960The commonly used directory quicklist, in combination with the States quicklist,
    953961allows you to quickly place FM/2 into precisely the configuration you
    954962need 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.*
    114:h1 res=91500 name=PANEL_WALKEM.Walk Directories
    215:i1 id=aboutWalkem.Walk Directories
     
    2033:hp1.Add:ehp1. when the desired directory name is displayed in the
    2134entry 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
     35highlight it and click :hp1.Delete:ehp1..
     36To switch to one of these
    2337user-defined directories, highlight it and click &OkayButton. or
    24 double-click the directory. You can add up to 100 directories.
     38double-click the directory.
     39To highlight the directory without switching, hold down the &CtrlKey.
     40and click on the directory.
    2541:p.
    2642You can also select directories from the Recent directories drop-down
     
    2844automatically as you traverse your drives. Just drop down the list
    2945and click the directory of choice.
     46To exit the drop down list without making a selection, click the drop down arrow
     47or Tab out of the drop down list with the Tab key.
    3048:p.
    3149When the desired directory is displayed in the bottom entry field of
    32 the dialog, click &OkayButton. to exit. Click &CancelButton. to
     50the dialog, click &OkayButton. to exit. Click the &CancelButton. to
    3351exit without selecting a directory.
    3452
  • trunk/dll/key.c

    r1444 r1471  
    5454  static INT width, direction, ticktock, counter;
    5555  static HPOINTER stick1, stick2, stick3, stick4, stick12, stick22, stick32,
    56     stick42, stick5, stick52;
     56                  stick42, stick5, stick52;
    5757
    5858  switch (msg) {
  • trunk/dll/mainwnd.c

    r1455 r1471  
    20562056        BOOL rdy, local;
    20572057        CHAR chDrv = *szDrv;
    2058         UINT iDrv;
     2058        UINT iDrv = chDrv - 'A';
    20592059
    20602060        strcat(szDrv, PCSZ_BACKSLASH);
     
    41014101          if (fUserComboBox) {
    41024102            if (!aheight) {
    4103 
    41044103              SWP swpTemp;
    4105 
    41064104              WinQueryWindowPos(WinWindowFromID(hwndDrivelist, CBID_EDIT),
    41074105                                &swpTemp);
     
    43184316      if (fUserComboBox) {
    43194317        if (!aheight) {
    4320 
    43214318          SWP swpTemp;
    4322 
    43234319          WinQueryWindowPos(WinWindowFromID(hwndDrivelist, CBID_EDIT),
    43244320                            &swpTemp);
     
    62816277          if (*path) {
    62826278            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;
    62836282              if (!strcmp(path, GetPString(IDS_NEWDIRECTORYTEXT))) {
    62846283                if (!LastDir ||
     
    63236322            else if (SHORT1FROMMP(mp1) == MAIN_SETUPLIST) {
    63246323              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;
    63296329              sprintf(szKey, "%s.NumDirsLastTime", path);       // path is state name
    63306330              if (!PrfQueryProfileData(fmprof,
     
    63696369            else if (SHORT1FROMMP(mp1) == MAIN_CMDLIST) {
    63706370
    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);
    63766374              if (sSelect >= 0)
    63776375                WinPostMsg(hwnd,
     
    63826380            }
    63836381          }
    6384         }
     6382        } // CBN_ENTER
    63856383        break;
    63866384
  • trunk/dll/treecnr.c

    r1456 r1471  
    106106#include "notebook.h"                   // CfgDlgProc
    107107#include "command.h"                    // RunCommand
    108 #include "worker.h"             // Action, MassAction
     108#include "worker.h"                     // Action, MassAction
    109109#include "mainwnd.h"                    // BubbleHelp, FindDirCnrByName, GetNextWindowPos
    110110#include "misc.h"                       // CnrDirectEdit, EmphasizeButton, FindDirCnr
    111                                 // FindDirCnr, FixSwitchList, OpenEdit, QuickPopup
    112                                 // SetSortChecks, SwitchCommand, CheckMenu
    113                                 // CurrentRecord, IsFm2Window
     111                                        // FindDirCnr, FixSwitchList, OpenEdit, QuickPopup
     112                                        // SetSortChecks, SwitchCommand, CheckMenu
     113                                        // CurrentRecord, IsFm2Window
    114114#include "common.h"                     // CommonCnrProc, CommonDriveCmd, CommonFrameWndProc
    115                                 // CommonTextProc
     115                                        // CommonTextProc
    116116#include "valid.h"                      // CheckDrive, DriveFlagsOne, IsValidDrive
    117117#include "chklist.h"                    // DropListProc
     
    838838        }
    839839      }
     840      // 21 Sep 09 SHL fixme to know why checking again - focus change?
    840841      if (dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent))
    841842        WinSetWindowText(hwndStatus, s);
  • trunk/dll/walkem.c

    r1438 r1471  
    3535  24 Aug 08 GKY Warn full drive on save of .DAT file; prevent loss of existing file
    3636  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
    3738
    3839***********************************************************************/
     
    10691070        APIRET rc;
    10701071
     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;
    10711076        DosError(FERR_DISABLEHARDERR);
    10721077        hDir = HDIR_CREATE;
     
    12341239
    12351240    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;
    12551252      }
    12561253      break;
     
    12701267        SWP swp;
    12711268        ULONG size = sizeof(SWP);
    1272 
    12731269        WinQueryWindowPos(hwnd, &swp);
    12741270        PrfWriteProfileData(fmprof, FM3Str, "WalkDir.Position", (PVOID) &swp,
Note: See TracChangeset for help on using the changeset viewer.