Changeset 1871 for trunk/dll/filldir.c


Ignore:
Timestamp:
Sep 21, 2015, 12:57:02 AM (10 years ago)
Author:
Gregg Young
Message:

Create CollapseAll and modify ExpandAll to reduce code overhead both to try and speed drive expansion. Change ExpandAll to allow it to loop in UM_EXPAND until until drive is completely expanded. Changes were need to work with Flesh, Stubby and UnFlesh being moved to a thread. Add code for Flesh to skip the directory entry added by Stubby (eliminate use of NULL/Nullstr pszFileNames by Stubby). Add code in Stubby to insert a complete container item. Add a flag to indicate when a directory needed to be Fleshed. Get expand and switch code to work with Flesh, UnFlesh and Stubby running on a thread. Loop and idle ExpandAll; Move tree expand to a thread; Have ShowTreeRec wait for the Flesh thread. Add a correction factor so directories don't get placed above the top of the tree container when a large drive has been expanded. Debug is mostly still in but all turned off.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/filldir.c

    r1868 r1871  
    119119  22 Aug 15 GKY Minimize the occurence of an A:\ Drive not ready error by moving the cursor
    120120                to the default drive.
    121   24 AUG 15 GKY Remove fDummy code
     121  24 Aug 15 GKY Remove fDummy code
     122  20 Sep 15 GKY Add code for Flesh to skip the directory entry added by Stubby (eliminate
     123                use of NULL/Nullstr pszFileNames by Stubby). Add code to relink pci chain
     124                following rename, delete, etc. Add "Expanding" window text.
    122125
    123126***********************************************************************/
     
    242245}
    243246
    244 static HPOINTER IDFile(PSZ p)
     247HPOINTER IDFile(PSZ p)
    245248{
    246249  HPOINTER hptr;
     
    304307}
    305308
    306 static BOOL IsDefaultIcon(HPOINTER hptr)
     309BOOL IsDefaultIcon(HPOINTER hptr)
    307310{
    308311  HPOINTER hptr2;
     
    827830                      const BOOL recurse,
    828831                      const BOOL partial,
    829                       CHAR *stopflag,
     832                      CHAR *stopflag,
    830833                      DIRCNRDATA *dcd,                  // Optional
    831834                      ULONG *pulTotalFiles,             // Optional
    832                       PULONGLONG pullTotalBytes)        // Optional
     835                      PULONGLONG pullTotalBytes,        // Optional
     836                      CHAR *LoadedFirstChild)           // Optional
    833837{
    834838  /**
     
    856860  PCNRITEM pci;
    857861  PCNRITEM pciFirst;
     862  PCNRITEM pciNext;
    858863  RECORDINSERT ri;
    859864  BOOL ok = TRUE;
     
    914919        pffbFile = paffbFound;
    915920        ulSelCnt = 0;
    916         for (;;) {
     921        for (;;) {
    917922          if (!*pffbFile->achName ||
    918923              (!filestoo && ~pffbFile->attrFile & FILE_DIRECTORY) ||
     
    920925               !pffbFile->achName[0] || pffbFile->achName[0] == '.' &&
    921926               (!pffbFile->achName[1] ||
    922                 (pffbFile->achName[1] == '.' && !pffbFile->achName[2])))) {
     927                (pffbFile->achName[1] == '.' && !pffbFile->achName[2])) ||
     928               (LoadedFirstChild && !stricmp(LoadedFirstChild, pffbFile->achName)))) {
    923929            // ulFindCnt--;             // Got . or .. or file to be skipped
    924930          }
     
    959965                ullBytes = FillInRecordFromFFB(hwndCnr, pci, pszFileSpec,
    960966                                               pffbFile, partial, dcd);
    961                 pci = (PCNRITEM) pci->rc.preccNextRecord;
     967                pciNext = pci;
     968                pci = (PCNRITEM) pci->rc.preccNextRecord;
     969                if (pci && (INT) pci != -1)
     970                  pci->pciPrevious = pciNext;
    962971                ullTotalBytes += ullBytes;
    963972              } // for
     
    10511060          ULONG ulRecsToInsert;
    10521061
    1053           if (pci ==NULL) {
     1062          if (pci == NULL) {
    10541063            if (!WinIsWindow(WinQueryAnchorBlock(hwndCnr), hwndCnr)) {
    10551064              ok = FALSE;
     
    10721081            else {
    10731082              // 04 Jan 08 SHL FIXME like comp.c to handle less than ulSelCnt records
    1074               if (hwndStatus && dcd &&
    1075                   dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent)) {
    1076                 WinSetWindowText(hwndStatus, (CHAR *) GetPString(IDS_PLEASEWAITCOUNTINGTEXT));
     1083              if (hwndStatus && dcd && dcd->hwndFrame ==
     1084                  WinQueryActiveWindow(dcd->hwndParent)) {
     1085                WinSetWindowText(hwndStatus, (CHAR *) GetPString(LoadedFirstChild ?
     1086                                                                 IDS_PLEASEWAITEXPANDINGTEXT :
     1087                                                                 IDS_PLEASEWAITCOUNTINGTEXT));
    10771088              }
    10781089              pci = pciFirst;
     
    10801091          }
    10811092          ullBytes = FillInRecordFromFFB(hwndCnr, pci, pszFileSpec,
    1082                                          pffbFile, partial, dcd);
    1083           pci = (PCNRITEM) pci->rc.preccNextRecord;
     1093                                         pffbFile, partial, dcd);
     1094          pciNext = pci;
     1095          pci = (PCNRITEM) pci->rc.preccNextRecord;
     1096          if (pci && (INT) pci != -1)
     1097            pci->pciPrevious = pciNext;
    10841098          ullTotalBytes += ullBytes;
    10851099          // 15 Sep 09 SHL allow timed updates to see
     
    11901204      if (!pci->pszFileName || !strcmp(pci->pszFileName, NullStr)) {
    11911205        // 2015-08-23 SHL FIXME debug
    1192         DbgMsg(pszSrcFile, __LINE__, "ProcessDirectory pci %p pci->pszFileName %p %s",
    1193                pci, pci->pszFileName,
    1194                pci->pszFileName == NullStr ? "NullStr" : "NULL");
     1206        //DbgMsg(pszSrcFile, __LINE__, "ProcessDirectory pci %p pci->pszFileName %p %s",
     1207        //       pci, pci->pszFileName,
     1208        //       pci->pszFileName == NullStr ? "NullStr" : "NULL");
    11951209        Runtime_Error(pszSrcFile, __LINE__, "pci->pszFileName NULL for %p", pci);
    11961210        return;
    11971211      }
    11981212      if ((pci->attrFile & FILE_DIRECTORY))
    1199         AddFleshWorkRequest(hwndCnr, pci, eStubby);
     1213        AddFleshWorkRequest(hwndCnr, pci, eStubby);
    12001214      pci = WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pci),
    12011215                       MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
     
    12261240                   dcd,
    12271241                   NULL,                // total files
    1228                    pullTotalBytes);
     1242                   pullTotalBytes,
     1243                   0);
    12291244  DosPostEventSem(CompactSem);
    12301245
     
    12681283  static ULONG ulLastDriveMap;
    12691284
    1270   DbgMsg(pszSrcFile, __LINE__, "FillTreeCnr hwndCnr %x hwndParent %x", hwndCnr, hwndParent);     // 2015-08-03 SHL FIXME debug
     1285  //DbgMsg(pszSrcFile, __LINE__, "FillTreeCnr hwndCnr %x hwndParent %x", hwndCnr, hwndParent);   // 2015-08-03 SHL FIXME debug
    12711286
    12721287  *szSuggest = 0;
     
    16751690
    16761691  fInitialDriveScan = FALSE;
    1677   DbgMsg(pszSrcFile, __LINE__, "fInitialDriveScan now FALSE");   // 2015-08-03 SHL FIXME debug
     1692  //DbgMsg(pszSrcFile, __LINE__, "fInitialDriveScan now FALSE");         // 2015-08-03 SHL FIXME debug
    16781693  DosPostEventSem(CompactSem);
    16791694
     
    17551770  didonce = TRUE;
    17561771
    1757   DbgMsg(pszSrcFile, __LINE__, "FillTreeCnr finished");  // 2015-08-03 SHL FIXME debug
     1772  //DbgMsg(pszSrcFile, __LINE__, "FillTreeCnr finished");        // 2015-08-03 SHL FIXME debug
    17581773
    17591774} // FillTreeCnr
     
    19731988  //  USHORT usTimerCheckCountdown      = RCI_ITEMS_PER_TIMER_CHECK;
    19741989  PCNRITEM pci;
     1990  PCNRITEM pciPrevious;
    19751991  ITIMER_DESC itdSleep = { 0 };         // 30 May 11 GKY
    19761992
     
    19952011      InitITimer(&itdSleep, 500);
    19962012      while (pci) {
    1997         FreeCnrItemData(pci);
    1998         pci = (PCNRITEM)pci->rc.preccNextRecord;
     2013        FreeCnrItemData(pci);
     2014        if (usCnt > 0)
     2015          pciPrevious = pci;
     2016        pci = (PCNRITEM)pci->rc.preccNextRecord;
    19992017        if (!pci)
    2000           break;
     2018          break;
     2019        if (usCnt > 0 && pciPrevious && pciPrevious->pciPrevious) {
     2020          pciPrevious->pciPrevious->rc.preccNextRecord = (MINIRECORDCORE *) pci;
     2021          pci->pciPrevious = pciPrevious->pciPrevious;
     2022          pciPrevious->pciPrevious = NULL;
     2023          pciPrevious->rc.preccNextRecord = NULL;
     2024        }
    20012025        if (remaining && --remaining == 0)
    20022026          break;
Note: See TracChangeset for help on using the changeset viewer.