Changeset 1871 for trunk/dll


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.

Location:
trunk/dll
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/dircnrs.h

    r1682 r1871  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2001, 2008 Steven H. Levine
     9  Copyright (c) 2001, 2015 Steven H. Levine
    1010
    1111  05 Jan 08 SHL Move dircnrs.c definitions here
     
    1414                all the details view settings (both the global variables and those in the
    1515                DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.
    16   17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *.
     16  17 Jan 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *.
     17  20 Sep 15 GKY Add a flag to indicate when a directory needed to be Fleshed and a PCNRITEM
     18                previous to try to keep the pci chain intact on renames, delete etc to PCNRITEM
    1719
    1820***********************************************************************/
     
    4042
    4143typedef struct _CNRITEM
    42 {                               /* CONTAINER RECORD STRUCTURE */
     44{                               /* CONTAINER RECORD STRUCTURE must be first*/
    4345  MINIRECORDCORE rc;            /* Base information */
    4446  HWND hwndCnr;                 /* The container holding this record */
     
    5961  ULONG attrFile;               /* Attributes of this file */
    6062  ULONG flags;
     63  BOOL fleshed;
     64  struct _CNRITEM *pciPrevious;    // Address of pci we are linked to
    6165}
    6266CNRITEM, *PCNRITEM;
  • trunk/dll/dirsize.c

    r1673 r1871  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2001, 2010 Steven H. Levine
     9  Copyright (c) 2001, 2015 Steven H. Levine
    1010
    1111  16 Oct 02 SHL Handle large partitions
     
    5656                by temp file creation failures.
    5757  12 Jun 11 GKY Added SleepIfNeeded in the container fill loop
     58  20 Sep 15 GKY Move directory expansion to a thread. Split ExpandAll into ExpandAll and CollapseAll
     59                to try to speed proccessing else where.
    5860
    5961***********************************************************************/
     
    109111typedef struct
    110112{
     113  HWND hwndCnr;
     114  PCNRITEM pci;
     115} EXPANDSIZE;
     116
     117typedef struct
     118{
    111119  CHAR szDirName[CCHMAXPATH];
    112120  CHAR chStopFlag;
     
    497505  PostMsg(WinQueryWindow(hwndCnr, QW_PARENT),
    498506          UM_CONTAINER_FILLED, MPVOID, MPVOID);
     507# ifdef FORTIFY
     508  Fortify_LeaveScope();
     509#  endif
     510}
     511
     512static VOID ExpandCnrThread(VOID *args)
     513{
     514  HAB hab;
     515  HMQ hmq;
     516  INT x = 0;
     517  EXPANDSIZE *expandsize = (EXPANDSIZE *)args;
     518
     519  if (!expandsize) {
     520    Runtime_Error(pszSrcFile, __LINE__, NULL);
     521    return;
     522  }
     523# ifdef FORTIFY
     524  Fortify_EnterScope();
     525  Fortify_BecomeOwner(expandsize);              // We free dirsize
     526#  endif
     527
     528  DosError(FERR_DISABLEHARDERR);
     529
     530  priority_idle();
     531  hab = WinInitialize(0);
     532  if (hab) {
     533    hmq = WinCreateMsgQueue(hab, 0);
     534    if (hmq) {
     535      WinCancelShutdown(hmq, TRUE);
     536      ExpandAll(expandsize->hwndCnr, x, expandsize->pci);
     537      WinDestroyMsgQueue(hmq);
     538    }
     539    WinTerminate(hab);
     540  }
     541
     542  xfree(expandsize, pszSrcFile, __LINE__);
    499543# ifdef FORTIFY
    500544  Fortify_LeaveScope();
     
    10101054          WinEnableWindow(WinWindowFromID(hwnd, DSZ_PRINT), FALSE);
    10111055          WinEnableWindow(WinWindowFromID(hwnd, DID_CANCEL), FALSE);
    1012           // fixme to use thread - too slow on large trees
    1013           ExpandAll(WinWindowFromID(hwnd, DSZ_CNR),
    1014                     (SHORT1FROMMP(mp1) == DSZ_EXPAND), pci);
     1056          if (SHORT1FROMMP(mp1) == DSZ_EXPAND) {
     1057            EXPANDSIZE *expandsize;
     1058
     1059            expandsize = xmalloc(sizeof(EXPANDSIZE), pszSrcFile, __LINE__);
     1060            if (expandsize) {
     1061
     1062            expandsize->pci = pci;
     1063            expandsize->hwndCnr = WinWindowFromID(hwnd, DSZ_CNR);
     1064            if (xbeginthread(ExpandCnrThread,
     1065                             122880 * 5,
     1066                             expandsize,
     1067                             pszSrcFile,
     1068                             __LINE__) == -1)
     1069              xfree(expandsize, pszSrcFile, __LINE__);
     1070            }
     1071          }
     1072          else
     1073            CollapseAll(WinWindowFromID(hwnd, DSZ_CNR), pci);
    10151074          WinEnableWindow(WinWindowFromID(hwnd, DID_OK), TRUE);
    10161075          WinEnableWindow(WinWindowFromID(hwnd, IDM_HELP), TRUE);
  • 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;
  • trunk/dll/filldir.h

    r1550 r1871  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2001, 2008 Steven H. Levine
     9  Copyright (c) 2001, 2015 Steven H. Levine
    1010
    1111  05 Jan 08 SHL Split from fm3dll.h
     
    1414  06 Jun 09 GKY Add option to show file system type or drive label in tree
    1515  22 Jul 09 GKY Code changes to use semaphores to serialize drive scanning
     16  20 Sep 15 GKY Add code for Flesh to skip the directory entry added by Stubby (eliminate
     17                use of NULL/Nullstr pszFileNames by Stubby). Add code to relink pci chain
     18                following rename, delete, etc. Add "Expanding" window text.
    1619
    1720***********************************************************************/
     
    4144                      const BOOL recurse, const BOOL partial,
    4245                      CHAR *stopflag, DIRCNRDATA *pdcd,
    43                       PULONG pullTotalFiles, PULONGLONG pullTotalBytes);
     46                      PULONG pullTotalFiles, PULONGLONG pullTotalBytes,
     47                      CHAR *LoadedFirstChild);
    4448ULONGLONG FillInRecordFromFFB(HWND hwndCnr, PCNRITEM pci,
    4549                              const PSZ pszDirectory,
     
    5458INT RemoveCnrItems(HWND hwnd, PCNRITEM pci, USHORT usCnt, USHORT usFlags);
    5559VOID ProcessDirectoryThread(VOID * arg);
     60HPOINTER IDFile(PSZ p);
     61BOOL IsDefaultIcon(HPOINTER hptr);
    5662
    5763// Data declarations
  • trunk/dll/findrec.c

    r1865 r1871  
    1414  06 Aug 15 SHL Clean up and comment
    1515  23 Aug 15 SHL Protect FindCnrRecord filename arg
     16  20 Sep 15 GKY Add a correction factor so directories don't get placed above the top of the
     17                tree container when a large drive has been expanded.
    1618
    1719***********************************************************************/
     
    6365    pciParent = (PCNRITEM) CMA_FIRST;
    6466  pci = WinSendMsg(hwndCnr,
    65                    CM_SEARCHSTRING, MPFROMP(&srch), MPFROMP(pciParent));
     67                   CM_SEARCHSTRING, MPFROMP(&srch), MPFROMP(pciParent));
     68  //DbgMsg(pszSrcFile, __LINE__,"FindCnrItem pciParent %p pci %p file %s", pciParent,
     69  //      pci, file);
    6670  while (pci && (INT) pci != -1) {
    6771    if (!noenv || (pci->flags & (RECFLAGS_ENV | RECFLAGS_UNDERENV)) == 0) {
     
    123127  RECTL rcl;
    124128  RECTL rclViewport;
     129  RECTL rclFirst;
     130  RECTL rclLast;
     131  PMINIRECORDCORE pmiFirst;
     132  PMINIRECORDCORE pmiLast;
     133  INT correction;
    125134
     135  pmiFirst = WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(NULL),
     136                        MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
     137  pmiLast = WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(NULL),
     138                       MPFROM2SHORT(CMA_LAST, CMA_ITEMORDER));
     139  WinSendMsg(hwndCnr,
     140             CM_QUERYVIEWPORTRECT,
     141             MPFROMP(&rclViewport), MPFROM2SHORT(CMA_WINDOW , TRUE));
    126142  memset(&qrecrct, 0, sizeof(QUERYRECORDRECT));
    127143  qrecrct.cb = sizeof(QUERYRECORDRECT);
     
    133149    WinSendMsg(hwndCnr, CM_QUERYRECORDRECT, MPFROMP(&rcl), MPFROMP(&qrecrct));
    134150  }
     151  qrecrct.pRecord = (PRECORDCORE) pmiFirst;
     152  WinSendMsg(hwndCnr, CM_QUERYRECORDRECT, MPFROMP(&rclFirst), MPFROMP(&qrecrct));
     153  qrecrct.pRecord = (PRECORDCORE) pmiLast;
     154  WinSendMsg(hwndCnr, CM_QUERYRECORDRECT, MPFROMP(&rclLast), MPFROMP(&qrecrct));
     155  correction = 5 + ((abs(rclFirst.yTop) + abs(rclLast.yTop)) / 22500);
    135156  WinSendMsg(hwndCnr,
    136              CM_QUERYVIEWPORTRECT,
    137              MPFROMP(&rclViewport), MPFROM2SHORT(CMA_WINDOW, TRUE));
    138   //DbgMsg(pszSrcFile, __LINE__, "TOPPORT %i TOPRCL %i", rclViewport.yTop , rcl.yTop);
     157             CM_SCROLLWINDOW,
     158             MPFROMSHORT(CMA_VERTICAL),
     159             MPFROMLONG((rclViewport.yTop - (rcl.yTop) - correction)));
     160#if 0
     161  DbgMsg(pszSrcFile, __LINE__, "RECTLFIRST %i RECTLLAST %i %p",
     162         rclFirst.yTop, rclLast.yTop, pmiLast);
     163  DbgMsg(pszSrcFile, __LINE__, "TOPPORT %i TOPRCL %i RIGHTRCL %i",
     164         rclViewport.yTop , rcl.yTop, rcl.xRight);
     165#endif
    139166  WinSendMsg(hwndCnr,
    140167             CM_SCROLLWINDOW,
    141168             MPFROMSHORT(CMA_HORIZONTAL), MPFROMLONG(rcl.xRight - rclViewport.xRight));
    142   WinSendMsg(hwndCnr,
    143              CM_SCROLLWINDOW,
    144              MPFROMSHORT(CMA_VERTICAL),
    145              MPFROMLONG((rclViewport.yTop - (rcl.yTop) - 4)));
     169 
    146170}
    147171
  • trunk/dll/flesh.c

    r1867 r1871  
    3737  19 Aug 15 SHL Allow WaitFleshWorkListEmpty to wait for dependent items
    3838  23 Aug 15 GKY Fixed code to notify on drive with no subdirectories in first 64 entries
     39  20 Sep 15 GKY Add code for Flesh to skip the directory entry added by Stubby (eliminate
     40                use of NULL/Nullstr pszFileNames by Stubby). Add code in Stubby to insert a
     41                complete container item. Add a flag to indicate when a directory needed to be
     42                Fleshed
    3943
    4044***********************************************************************/
     
    6973#include "listutil.h"                   // List...
    7074#include "common.h"                     // IncrThreadUsage DecrThreadUsage
    71 
     75#include "pathutil.h"
    7276#if 0
    7377#define  __PMPRINTF__
     
    8488
    8589static PCSZ pszFleshFocusPath;  // 2015-08-20 SHL
    86 
     90#if 0
    8791BOOL fNoFleshDbgMsg;    // 2015-08-09 SHL FIXME to be gone
    88 
     92#endif
    8993#pragma data_seg(GLOBAL1)
    9094ULONG NoBrokenNotify;
     
    189193                ri.cRecordsInsert = 1;
    190194                ri.fInvalidateRecord = FALSE;
    191                 // 2015-08-03 SHL FIXME debug
     195#if 0           // 2015-08-03 SHL FIXME debug
    192196                if (pciL->pszFileName == NullStr)
    193197                  DbgMsg(pszSrcFile, __LINE__, "Stubby CM_INSERTRECORD pci %p pszFileName \"%s\"", pciL, pciL->pszFileName); // 2015-08-03 SHL FIXME debug
    194                 if (!WinSendMsg(hwndCnr,
     198#endif
     199                if (!WinSendMsg(hwndCnr,
    195200                                CM_INSERTRECORD, MPFROMP(pciL), MPFROMP(&ri)))
    196201                  FreeCnrItem(hwndCnr, pciL);
     
    238243    return FALSE;
    239244
    240   // 2015-08-03 SHL FIXME debug
     245#if 0  // 2015-08-03 SHL FIXME debug
    241246  if (!fNoFleshDbgMsg) {
    242247    DbgMsg(pszSrcFile, __LINE__, "Flesh %s pciParent %p pszFileName %p",
     
    246251           pciParent && (INT)pciParent != -1 ? pciParent->pszFileName : (PVOID)-1); // 2015-08-03 SHL FIXME debug
    247252  }
    248 
    249   pciL = (PCNRITEM)WinSendMsg(hwndCnr,
    250                               CM_QUERYRECORD,
    251                               MPFROMP(pciParent),
    252                               MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER));
    253 
     253#endif
    254254  // 2015-08-06 SHL allow pciL -1
    255255  // 2015-08-06 SHL FIXME to not need pszFileName check
    256   if (!pciL || (INT)pciL == -1 || !*pciL->pszFileName || !strcmp(pciL->pszFileName, NullStr)) {
    257 
     256  if (!pciParent->fleshed) {
     257    pciL = (PCNRITEM)WinSendMsg(hwndCnr,
     258                                CM_QUERYRECORD,
     259                                MPFROMP(pciParent),
     260                                MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER));
    258261    // No children or filename null
    259262    if (pciL && (INT)pciL != -1) {
     263      AddFleshWorkRequest(hwndCnr, pciL, eStubby);
    260264      // 2015-08-06 SHL FIXME to ensure this an not happen
    261       // if (!*pciL->pszFileName)
    262         // Runtime_Error(pszSrcFile, __LINE__, "Flesh called with pci %p pszFileName (null)", pciL);
    263 
     265      if (!*pciL->pszFileName || !strcmp(pciL->pszFileName, NullStr))
     266        Runtime_Error(pszSrcFile, __LINE__, "Flesh called with pci %p pszFileName (null)", pciL);
     267#if 0
    264268      if (!fNoFleshDbgMsg)
    265269        DbgMsg(pszSrcFile, __LINE__, "Flesh RemoveCnrItems() pciL %p \"%s\"",
     
    267271               pciL->pszFileName ? pciL->pszFileName : "(null)"); // 2015-08-04 SHL FIXME debug
    268272      // Assume refernces to pciL already removed from work list
    269       RemoveCnrItems(hwndCnr, pciL, 1, CMA_FREE);
    270     }
    271 
     273#endif
     274    }
    272275    dcd = INSTDATA(hwndCnr);
    273276    if (dcd && dcd->size != sizeof(DIRCNRDATA))
     
    287290                     dcd,
    288291                     NULL,              // total files
    289                      NULL);             // total bytes
     292                     NULL,               // total bytes
     293                     (pciL && (INT)pciL != -1) ? pciL->pszDisplayName : 0);
     294    pciParent->fleshed = TRUE;
    290295    return TRUE;
    291296  }
     
    306311  if (!pciParent || !hwndCnr)
    307312    return;
    308 
     313#if 0
    309314  if (!fNoFleshDbgMsg)
    310315    DbgMsg(pszSrcFile, __LINE__, "UnFlesh pciParent %p pszFileName \"%s\"", pciParent, pciParent->pszFileName ? pciParent->pszFileName : "(null)"); // 2015-08-03 SHL FIXME debug
    311 
     316#endif
    312317  for (;;) {
    313318    pciL = (PCNRITEM)WinSendMsg(hwndCnr,
     
    317322    if (!pciL || (INT)pciL == -1)
    318323      break;                    // Done
    319 
     324#if 0
    320325    if (!fNoFleshDbgMsg)
    321326      DbgMsg(pszSrcFile, __LINE__, "UnFlesh RemoveCnrItems() pciL %p \"%s\"", pciL, pciL->pszFileName ? pciL->pszFileName : "(null)"); // 2015-08-03 SHL FIXME debug
     327#endif
    322328    RemoveCnrItems(hwndCnr, pciL, 1, CMA_FREE);
    323329    removed = TRUE;
     
    328334               CM_INVALIDATERECORD,
    329335               MPFROMP(&pciParent),
    330                MPFROM2SHORT(1, CMA_ERASE | CMA_REPOSITION));
     336               MPFROM2SHORT(1, CMA_ERASE | CMA_REPOSITION));
     337    pciParent->fleshed = FALSE;
     338    DosSleep(1); // Let container items go away
    331339  }
    332340  return;
     
    368376  static BOOL brokenlan = FALSE, isbroken = FALSE;
    369377
     378  //DbgMsg(pszSrcFile, __LINE__,"Stubby pciParent %p", pciParent);
    370379  if (!pciParent || (INT)pciParent == -1 || !*pciParent->pszFileName
    371380      || pciParent->pszFileName == NullStr || !hwndCnr)
    372381    return FALSE;
    373 
     382#if 0
    374383  if (!fNoFleshDbgMsg)
    375384    DbgMsg(pszSrcFile, __LINE__, "Stubby pciParent %p pszFileName %s", pciParent, pciParent->pszFileName); // 2015-08-03 SHL FIXME debug
    376 
     385#endif
    377386  // Build wildcard
    378387  len = strlen(pciParent->pszFileName);
     
    386395  if (!isalpha(*wildcard) || wildcard[1] != ':' || wildcard[2] != '\\') {
    387396    MakeFullName(wildcard);
    388     DbgMsg(pszSrcFile, __LINE__, "Stubby MakeFullName returned %s", wildcard); // 2015-08-19 SHL FIXME debug
    389   }
    390 
     397    //DbgMsg(pszSrcFile, __LINE__, "Stubby MakeFullName returned %s", wildcard); // 2015-08-19 SHL FIXME debug
     398  }
    391399  drvNum = toupper(*pciParent->pszFileName) - 'A';
    392400  flags = driveflags[drvNum];
     
    421429  fl = includefiles ? FILE_DIRECTORY : MUST_HAVE_DIRECTORY;
    422430
    423   DbgMsg(pszSrcFile, __LINE__, "Stubby DosFindFirst(%s)", wildcard); // 2015-08-19 SHL FIXME debug
     431  //DbgMsg(pszSrcFile, __LINE__, "Stubby DosFindFirst(%s)", wildcard); // 2015-08-19 SHL FIXME debug
    424432
    425433  rc = DosFindFirst(wildcard,
     
    495503    goto None;                          // Done
    496504  }
    497 
    498 
    499505  if (!rc) {
    500506    DosFindClose(hDir);
     
    539545              (pffb->achName[1] != '.' || pffb->achName[2]))))
    540546        {
    541           // Got directory other than . or .. (or a file)
     547          // Got directory other than . or .. (or a file)
    542548          isadir = TRUE;
    543549          break;
     
    562568          }
    563569          else {
    564             RECORDINSERT ri;
    565             // 2015-08-19 SHL FIXME to use BldFullPathName(wildcard, ...)
    566             pci->pszFileName = NullStr; // 2015-08-19 SHL FIXME to doc why
    567             pci->pszDisplayName = NullStr;
    568             pci->rc.pszIcon = pci->pszDisplayName;
     570            RECORDINSERT ri;
     571            CHAR szBuffer[CCHMAXPATH + 14];
     572            CHAR *p;
     573            HPOINTER hptr;
     574
     575            p = strchr(wildcard, '*');
     576            *p = 0;;
     577            BldFullPathName(szBuffer, wildcard, pffb->achName);
     578            pci->pszFileName =  xstrdup(szBuffer, pszSrcFile, __LINE__); //NullStr;   // 2015-08-19 SHL FIXME to doc why
     579            p = strrchr(pci->pszFileName, '\\');
     580            p++;
     581            pci->pszDisplayName = p; //NullStr;
     582            pci->rc.pszIcon = pci->pszDisplayName;
     583            if (fForceUpper)
     584              strupr(pci->pszFileName);
     585            else if (fForceLower)
     586              strlwr(pci->pszFileName);
     587         
     588            flags = driveflags[toupper(*pci->pszFileName) - 'A'];
     589         
     590            // get an icon to use with it
     591            if (pffb->attrFile & FILE_DIRECTORY) {
     592              // is directory
     593              if (fNoIconsDirs ||
     594                  (flags & DRIVE_NOLOADICONS) ||
     595                  !isalpha(*pci->pszFileName)) {
     596                hptr = (HPOINTER) 0;
     597              }
     598              else
     599                hptr = WinLoadFileIcon(pci->pszFileName, FALSE);
     600            }
     601            else {
     602              // is file
     603              if (fNoIconsFiles ||
     604                  (flags & DRIVE_NOLOADICONS) ||
     605                  !isalpha(*pci->pszFileName)) {
     606                hptr = (HPOINTER) 0;
     607              }
     608              else
     609                hptr = WinLoadFileIcon(pci->pszFileName, FALSE);
     610         
     611              if (!hptr || IsDefaultIcon(hptr))
     612                hptr = IDFile(pci->pszFileName);
     613            }
     614         
     615            if (!hptr) {
     616              hptr = pffb->attrFile & FILE_DIRECTORY ?
     617                     hptrDir : pffb->attrFile & FILE_SYSTEM ?
     618                     hptrSystem : pffb->attrFile & FILE_HIDDEN ?
     619                     hptrHidden : pffb->attrFile & FILE_READONLY ?
     620                     hptrReadonly : hptrFile;
     621            }
     622            pci->rc.hptrIcon = hptr;
    569623            memset(&ri, 0, sizeof(RECORDINSERT));
    570624            ri.cb = sizeof(RECORDINSERT);
     
    574628            ri.cRecordsInsert = 1;
    575629            ri.fInvalidateRecord = TRUE;
    576              // 2015-08-03 SHL FIXME debug
     630#if 0        // 2015-08-03 SHL FIXME debug
    577631            if (pci->pszFileName == NullStr)
    578632              DbgMsg(pszSrcFile, __LINE__, "Stubby CM_INSERTRECORD %p \"%s\" %.255s", pci, pci->pszFileName, pffb->achName);
    579             if (!WinSendMsg(hwndCnr,
     633#endif
     634            if (!WinSendMsg(hwndCnr,
    580635                            CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri))) {
    581636              // Assume busy and try again
    582637              DosSleep(50); //05 Aug 07 GKY 100
    583638              WinSetFocus(HWND_DESKTOP, hwndCnr);
    584               if (WinIsWindow((HAB)0, hwndCnr)) {
     639              if (WinIsWindow((HAB)0, hwndCnr)) {
     640#if 0
    585641                if (!fNoFleshDbgMsg) {
    586                   // 2015-08-03 SHL FIXME debug
    587                   if (pci->pszFileName == NullStr)
    588                     DbgMsg(pszSrcFile, __LINE__, "Stubby CM_INSERTRECORD pci %p pszFileName \"%s\"", pci, pci->pszFileName); // 2015-08-03 SHL FIXME debug
    589                 }
     642                  // 2015-08-03 SHL FIXME debug
     643                  //if (pci->pszFileName == NullStr)
     644                  //  DbgMsg(pszSrcFile, __LINE__, "Stubby CM_INSERTRECORD pci %p pszFileName \"%s\"", pci, pci->pszFileName); // 2015-08-03 SHL FIXME debug
     645                }
     646#endif
    590647                if (!WinSendMsg(hwndCnr,
    591648                                CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri))) {
     
    594651                  FreeCnrItem(hwndCnr, pci);
    595652                }
    596                 else
     653                else
    597654                  ok = TRUE;
    598655              }
     
    670727    if (!item)
    671728      break;
    672     DbgMsg(pszSrcFile, __LINE__, "DeleteStaleFleshWorkListItems deleting %p %s", pci, pci->pszFileName ? pci->pszFileName : "(null)"); // 2015-08-03 SHL FIXME debug
     729    //DbgMsg(pszSrcFile, __LINE__, "DeleteStaleFleshWorkListItems deleting %p %s", pci, pci->pszFileName ? pci->pszFileName : "(null)"); // 2015-08-03 SHL FIXME debug
    673730    List2Delete(&FleshWorkList, item);
    674731    xfree(item, pszSrcFile, __LINE__);
     
    815872    return;             // Avoid hang
    816873  }
     874#if 0
    817875  else if (IsFleshWorkListEmpty()) {
    818876#   ifdef WaitFleshWorkListEmpty
     
    822880#   endif
    823881  }
     882#endif
    824883
    825884  // Can not wait if call from thread 1 or FleshWorkListThread
     
    859918      if (!item) {
    860919        if (waited)
    861           DosSleep(250);                // Let PM do some work
     920          DosSleep(100);                // Let PM do some work
    862921        break;                          // Dependents gone from work list
    863922      }
     
    889948  if (pszOld)
    890949    xfree((PVOID)pszOld, pszSrcFile, __LINE__);
    891   DbgMsg(pszSrcFile, __LINE__, "SetFleshFocusPath focus path set to %s", pszFleshFocusPath); // 2015-08-03 SHL FIXME debug
     950  //DbgMsg(pszSrcFile, __LINE__, "SetFleshFocusPath focus path set to %s", pszFleshFocusPath); // 2015-08-03 SHL FIXME debug
    892951
    893952}
     
    9481007        // Wait for new items to be added to list
    9491008        if (!item) {
    950           ULONG ul;
     1009          ULONG ul;
     1010#if 0
    9511011          if (!fNoFleshDbgMsg)
    9521012            DbgMsg(pszSrcFile, __LINE__, "FleshWorkThread work list empty - waiting"); // 2015-08-03 SHL FIXME debug
    953           xDosWaitEventSem(hevFleshWorkListChanged, SEM_INDEFINITE_WAIT);
    954           xDosResetEventSem(hevFleshWorkListChanged, &ul);
     1013#endif
     1014          xDosWaitEventSem(hevFleshWorkListChanged, SEM_INDEFINITE_WAIT);
     1015          xDosResetEventSem(hevFleshWorkListChanged, &ul);
     1016#if 0
    9551017          if (!fNoFleshDbgMsg)
    9561018            DbgMsg(pszSrcFile, __LINE__, "FleshWorkThread work hev posted"); // 2015-08-03 SHL FIXME debug
    957           continue;
     1019#endif
     1020          continue;
    9581021        }
    9591022
    960         if (WinIsWindow((HAB)0, item->hwndCnr)) {
    961 #if 0 // 2015-08-07 SHL FIXME debug
    962           // 2015-08-03 SHL FIXME debug
     1023        if (WinIsWindow((HAB)0, item->hwndCnr)) {
     1024#if 0     // 2015-08-07 SHL FIXME debug
    9631025          {
    9641026            static PSZ itemNames[] = {
     
    9791041
    9801042          switch (item->action) {
    981           case eUnFlesh:
    982             UnFlesh(item->hwndCnr, item->pci);
     1043          case eUnFlesh:
     1044            UnFlesh(item->hwndCnr, item->pci);
    9831045            break;
    9841046          case eFleshEnv:
     
    9871049          case eStubby:
    9881050            // DbgMsg(pszSrcFile, __LINE__, "FleshWorkThread pci %p pszFileName %s", stubbyArgs->pci, stubbyArgs->pci->pszFileName); // 2015-08-03 SHL FIXME debug
    989             Stubby(item->hwndCnr, item->pci);
     1051            priority_bumped();
     1052            Stubby(item->hwndCnr, item->pci);
     1053            priority_normal();
    9901054            break;
    9911055          case eFlesh:
     
    10411105  if (rc)
    10421106    return FALSE;                       // Give up
    1043 
    1044   /* DbgMsg is time consuming
     1107#if 0
     1108   /*DbgMsg is time consuming
    10451109     define FM2_NO_FLESH_DBGMSG to suppress
    10461110     2015-08-09 SHL FIXME to be gone
    1047    */
     1111     */
    10481112
    10491113  fNoFleshDbgMsg = getenv("FM2_NO_FLESH_DBGMSG") != NULL;
    1050 
     1114#endif
    10511115  tidFleshWorkListThread = xbeginthread(FleshWorkThread,
    10521116                           65536,
  • trunk/dll/fm3dll2.h

    r1803 r1871  
    803803#define UM_SETUP            (WM_USER + 85)
    804804#define UM_SETDIR           (WM_USER + 86)
     805#define UM_COLLAPSETREE     (WM_USER + 87)
     806#define UM_EXPANDTREE       (WM_USER + 88)
    805807// WM_USER + 1000 used in FTPAPI.H (IBM Toolkit)
    806808
  • trunk/dll/fm3res.rc

    r1805 r1871  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2003, 2014 Steven H. Levine
     9  Copyright (c) 2003, 2015 Steven H. Levine
    1010
    1111  08 Feb 03 SHL Enable SYS_FRAME
     
    7979                menu item on a jar file.
    8080  23 May 15 GKY Option to restart desktop to prevent icon loss from JAVA object
     81  20 Sep 15 GKY Add "Expanding" window text.
    8182 
    8283***********************************************************************/
     
    34173418    IDS_RESTARTDESKTOP                    "Restart Desktop?"
    34183419    IDS_SETTINGLOSEICON                   "If you don't restart the desktop before opening in settings view the icon will be lost"
    3419 
     3420    IDS_PLEASEWAITEXPANDINGTEXT           "Please wait--expanding can take 10+ min on huge drives"
    34203421
    34213422    // Add strings that need to be combined by GetPString here
  • trunk/dll/fm3str.h

    r1805 r1871  
    10571057#define IDS_ARCMISSINGEXE                                    1025
    10581058#define IDS_ARCMISSINGEXEVERBOSE                             1026
    1059 
     1059#define IDS_PLEASEWAITEXPANDINGTEXT                          1027
    10601060// The following strings were cut up form the string of the root name (ie IDS_SUGGEST1TEXT)
    10611061// This was done as part of the conversion to a StringTable where strings are limited to 255
  • trunk/dll/init.c

    r1868 r1871  
    139139  22 Aug 15 GKY Remove recurse scan code.
    140140  24 Aug 15 GKY Remove obsolete code fDontAsk?zip
     141  20 Sep 15 GKY Move tree expand to a thread.
    141142 
    142143***********************************************************************/
     
    262263BOOL fReminimize;
    263264BOOL fWantFirstTimeInit;
    264 BOOL fUseShellEnv;;
     265BOOL fUseShellEnv;
    265266HPOINTER hptrApp;
    266267HPOINTER hptrArc;
     
    897898    return FALSE;
    898899
     900  if (!StartExpandTreeThread())
     901     return FALSE;
     902
    899903  // timer messages are sent from a separate thread -- start it
    900904  if (!StartTimer()) {
     
    16461650
    16471651  // 2015-08-11 SHL FIXME debug
    1648   DbgMsg(pszSrcFile, __LINE__, "ShowEnv %u SwitchTree %u SwitchTreeExpand %u SwitchTreeOnFocus %u CollapseFirst %u", fShowEnv, fSwitchTreeOnDirChg, fSwitchTreeExpand, fSwitchTreeOnFocus, fCollapseFirst);
     1652  //DbgMsg(pszSrcFile, __LINE__, "ShowEnv %u SwitchTree %u SwitchTreeExpand %u SwitchTreeOnFocus %u CollapseFirst %u", fShowEnv, fSwitchTreeOnDirChg, fSwitchTreeExpand, fSwitchTreeOnFocus, fCollapseFirst);
    16491653 
    16501654  LoadDetailsSwitches(PCSZ_DIRCNR, &dsDirCnrDefault, FALSE);
  • trunk/dll/objcnr.c

    r1673 r1871  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2005, 2009 Steven H. Levine
     9  Copyright (c) 2005, 2015 Steven H. Levine
    1010
    1111  24 May 05 SHL Rework for CNRITEM.szSubject
     
    2525  08 Mar 09 GKY Additional strings move to PCSZs
    2626  28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code.
     27  20 Sep 15 GKY Update for modified ExpandAll
    2728
    2829***********************************************************************/
     
    365366                                                        CMA_ITEMORDER));
    366367        if (pci && (INT) pci != -1) {
    367           ExpandAll(WinWindowFromID(hwnd, OBJCNR_CNR), TRUE, pci);
     368          ExpandAll(WinWindowFromID(hwnd, OBJCNR_CNR), 0, pci);
    368369          if (id == QTREE_FRAME)
    369370            pci = (PCNRITEM) WinSendDlgItemMsg(hwnd, OBJCNR_CNR,
  • trunk/dll/select.c

    r1838 r1871  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2004, 2011 Steven H. Levine
     9  Copyright (c) 2004, 2015 Steven H. Levine
    1010
    1111  01 Aug 04 SHL Rework lstrip/rstrip usage
     
    3434  02 Aug 15 GKY Remove unneed SubbyScan code and improve suppression of blank lines and
    3535                duplicate subdirectory name caused by running Stubby in worker threads.
     36                20 Sep 15 GKY Create CollapseAll and modify ExpandAll to reduce code overhead
     37                both to try and speed drive expansion. Change ExpandAll to allow it to loop
     38                in UM_EXPAND until until drive is completely expanded. Changes were need to
     39                work with Flesh, Stubby and UnFlesh being moved to a thread
    3640
    3741***********************************************************************/
     
    6569#include "stristr.h"                    // findstring
    6670#include "fortify.h"
     71#include "flesh.h"
    6772#if 0
    6873#define  __PMPRINTF__
     
    564569}
    565570
    566 VOID ExpandAll(HWND hwndCnr, BOOL expand, PCNRITEM pciParent)
    567 {
    568   PCNRITEM pci;
    569 
     571BOOL ExpandAll(HWND hwndCnr, INT count, PCNRITEM pciParent)
     572{
     573  PCNRITEM pci;
     574  static BOOL fExpanding = FALSE;
     575  static INT counter = 1;
     576
     577  if (count != counter && count != 0) {
     578    if (count > counter) {
     579      fExpanding = FALSE;
     580      counter++;
     581    }
     582    else if (count < counter) {
     583      fExpanding = FALSE;
     584      counter = 1;
     585    }
     586  }
    570587  if (!pciParent)
    571588    pciParent = WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(NULL),
    572589                           MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
    573590  if (pciParent) {
    574     if (expand && ~pciParent->rc.flRecordAttr & CRA_EXPANDED)
     591    pci = (PCNRITEM) WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pciParent),
     592                                MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER));
     593    // Only expand items that have childern
     594    if (pci  && ~pciParent->rc.flRecordAttr & CRA_EXPANDED) {
    575595      WinSendMsg(hwndCnr, CM_EXPANDTREE, MPFROMP(pciParent), MPVOID);
    576     else if (!expand && (pciParent->rc.flRecordAttr & CRA_EXPANDED))
     596      if (count != 0) {
     597        fExpanding = TRUE;
     598        if (!IsFleshWorkListEmpty()) {
     599          WaitFleshWorkListEmpty(NULL); // Let it expand
     600        }
     601      }
     602    }
     603    while (pci && (INT)pci != -1) {
     604      ExpandAll(hwndCnr, count, pci);
     605      if (!IsFleshWorkListEmpty())
     606        WaitFleshWorkListEmpty(NULL); // Wait for container to catch up
     607      pci = (PCNRITEM) WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pci),
     608                                  MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
     609    }
     610  }
     611  //DosSleep(0);
     612  return fExpanding;
     613}
     614
     615VOID CollapseAll(HWND hwndCnr, PCNRITEM pciParent)
     616{
     617  PCNRITEM pci;
     618
     619  if (!pciParent)
     620    pciParent = WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(NULL),
     621                           MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
     622  if (pciParent) {
     623    pci = (PCNRITEM) WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pciParent),
     624                                MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER));
     625    if ((pciParent->rc.flRecordAttr & CRA_EXPANDED))
    577626      WinSendMsg(hwndCnr, CM_COLLAPSETREE, MPFROMP(pciParent), MPVOID);
    578     pci = (PCNRITEM) WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pciParent),
    579                                 MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER));
    580       while (pci && (INT)pci != -1) {
    581       ExpandAll(hwndCnr, expand, pci);
     627    while (pci && (INT)pci != -1) {
     628      CollapseAll(hwndCnr, pci);
    582629      pci = (PCNRITEM) WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pci),
    583                                   MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
     630                                  MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
    584631    }
    585632  }
  • trunk/dll/select.h

    r1227 r1871  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2008 Steven H. Levine
     9  Copyright (c) 2008, 2015 Steven H. Levine
    1010
    1111  Change log
     12  20 Sep 15 GKY Create CollapseAll and modify ExpandAll to reduce code overhead
     13                both to try and speed drive expansion. Change ExpandAll to allow it to loop
     14                in UM_EXPAND until until drive is completely expanded. Changes were need to
     15                work with Flesh, Stubby and UnFlesh being moved to a thread
    1216
    1317***********************************************************************/
     
    2125VOID DeselectAll(HWND hwndCnr, BOOL files, BOOL dirs, CHAR * mask,
    2226                 CHAR * text, BOOL arc);
    23 VOID ExpandAll(HWND hwndCnr, BOOL expand, PCNRITEM pciParent);
     27BOOL ExpandAll(HWND hwndCnr, INT count, PCNRITEM pciParent);
     28VOID CollapseAll(HWND hwndCnr, PCNRITEM pciParent);
    2429VOID HideAll(HWND hwndCnr);
    2530VOID InvertAll(HWND hwndCnr);
  • trunk/dll/treecnr.c

    r1868 r1871  
    104104  22 Aug 15 GKY Improve ability of maketop to get directory position in tree correct on first
    105105                open of states with large and/or deep tree structures
    106   24 AUG 15 GKY Remove fDummy code
     106  24 Aug 15 GKY Remove fDummy code
     107  20 Sep 15 GKY Get expand and switch code to work with Flesh, UnFlesh and Stubby running on
     108                a thread. Loop and idle ExpandAll; Add CollapseAll; Move tree expand to a
     109                thread; Have ShowTreeRec wait for the Flesh thread.
    107110
    108111***********************************************************************/
     
    199202static PSZ pszSrcFile = __FILE__;
    200203static BOOL fOkayMinimize;
     204static HMQ hmqExpandTree;
     205static BOOL fExpandAll;
    201206
    202207APIRET16 APIENTRY16 Dos16MemAvail(PULONG pulAvailMem);
     
    300305  CHAR chSaved;
    301306
    302   DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec called for pszDir_ \"%s\"", pszDir_); // 2015-08-04 SHL FIXME debug
     307  //DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec called for pszDir_ \"%s\"", pszDir_); // 2015-08-04 SHL FIXME debug
    303308
    304309  strcpy(szDirArg, pszDir_);            // Cache here in case arg content changed by some other thread
     
    313318    goto MakeTop;
    314319  }
    315 
    316320  // 2015-08-23 SHL FIXME to be gone - problem must be elsewhere
    317321  // 2015-08-22 GKY Without this FM2 has NULL pci->pszFileName errors and switch failures
     
    338342
    339343    // Walk down directory tree, expanding as needed
    340     DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec needs expand, szDirArg \"%s\", IsFleshWorkListEmpty %u", szDirArg, IsFleshWorkListEmpty()); // 2015-08-04 SHL FIXME debug
     344    //DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec needs expand, szDirArg \"%s\", IsFleshWorkListEmpty %u", szDirArg, IsFleshWorkListEmpty()); // 2015-08-04 SHL FIXME debug
    341345
    342346    strcpy(szDir, szDirArg);
     
    354358                           TRUE);               // noenv
    355359      if (!pciP || (INT)pciP == -1) {
    356         DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec FindCnrRecord(\"%s\") returned pciP %p", szDir, pciP); // 2015-08-04 SHL FIXME debug
     360        //DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec FindCnrRecord(\"%s\") returned pciP %p", szDir, pciP); // 2015-08-04 SHL FIXME debug
    357361        WaitFleshWorkListEmpty(szDirArg);       // 2015-08-23 SHL
    358362        break;                                  // No match
    359363      }
    360364
    361       DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec FindCnrRecord(\"%s\") returned %p \"%s\"", szDir, pciP, pciP->pszFileName); // 2015-08-04 SHL FIXME debug
     365      //DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec FindCnrRecord(\"%s\") returned %p \"%s\"", szDir, pciP, pciP->pszFileName); // 2015-08-04 SHL FIXME debug
    362366
    363367      if (!stricmp(szDirArg, pciP->pszFileName)) {
     
    370374
    371375      if (~pciP->rc.flRecordAttr & CRA_EXPANDED) {
    372         DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec expanding \"%s\"", pciP->pszFileName); // 2015-08-04 SHL FIXME debug
     376        //DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec expanding \"%s\"", pciP->pszFileName); // 2015-08-04 SHL FIXME debug
    373377        WinSendMsg(hwndCnr, CM_EXPANDTREE, MPFROMP(pciP), MPVOID);
    374378      }
     
    394398  } // for
    395399
    396   DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec retries %u pci %p pci->pszFileName \"%s\"",retries, pci, pci && (INT)pci != -1 ? pci->pszFileName : "(null)"); // 2015-08-04 SHL FIXME debug
     400  //DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec retries %u pci %p pci->pszFileName \"%s\"",retries, pci, pci && (INT)pci != -1 ? pci->pszFileName : "(null)"); // 2015-08-04 SHL FIXME debug
    397401
    398402  if (found) {
     
    439443      if (fSwitchTreeExpand && ~pciToSelect->rc.flRecordAttr & CRA_EXPANDED) {
    440444        // 2015-08-23 SHL FIXME debug
    441         DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec WinSendMsg(CM_EXPANDTREE, %p)", pciToSelect); // 2015-08-04 SHL FIXME debug
     445        //DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec WinSendMsg(CM_EXPANDTREE, %p)", pciToSelect); // 2015-08-04 SHL FIXME debug
    442446        WinSendMsg(hwndCnr, CM_EXPANDTREE, MPFROMP(pciToSelect), MPVOID);
    443447      }
    444       if (fTopDir || maketop) {
     448      if (maketop || fTopDir) {
     449        if (fCollapseFirst)
     450          WaitFleshWorkListEmpty(NULL); //Let the root expand first otherwise it makes top
    445451        // 2015-08-23 SHL FIXME debug
    446         DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec ShowCnrRecord(%p) fTopDir %i maketop %i", pciToSelect, fTopDir, maketop); // 2015-08-04 SHL FIXME debug
     452        //DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec ShowCnrRecord(%p) fTopDir %i maketop %i", pciToSelect, fTopDir, maketop); // 2015-08-04 SHL FIXME debug
    447453        ShowCnrRecord(hwndCnr, (PMINIRECORDCORE)pciToSelect);
    448454      }
     
    450456      if (!quickbail) {
    451457        WaitFleshWorkListEmpty(szDirArg);       // 2015-08-19 SHL try to ensure contents stable
    452         DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec WinSendMsg(CM_SETRECORDEMPHASIS, CRA_SELECTED | CRA_CURSORED) szDirArg \"%s\"", szDirArg); // 2015-08-04 SHL FIXME debug
     458        //DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec WinSendMsg(CM_SETRECORDEMPHASIS, CRA_SELECTED | CRA_CURSORED) szDirArg \"%s\"", szDirArg); // 2015-08-04 SHL FIXME debug
    453459        WinSendMsg(hwndCnr,
    454460                   CM_SETRECORDEMPHASIS,
     
    734740           See RestoreDirCnrState()
    735741        */
    736         DbgMsg(pszSrcFile, __LINE__, "TreeObjWndProc UM_SHOWME cDirectoriesRestored %u", cDirectoriesRestored); // 2015-08-04 SHL FIXME debug
    737         DbgMsg(pszSrcFile, __LINE__, "TreeObjWndProc UM_SHOWME \"%s\")", mp1); // 2015-08-04 SHL FIXME debug
     742        //DbgMsg(pszSrcFile, __LINE__, "TreeObjWndProc UM_SHOWME cDirectoriesRestored %u", cDirectoriesRestored); // 2015-08-04 SHL FIXME debug
     743        //DbgMsg(pszSrcFile, __LINE__, "TreeObjWndProc UM_SHOWME \"%s\")", mp1); // 2015-08-04 SHL FIXME debug
    738744
    739745        if (cDirectoriesRestored > 0)
     
    743749          BOOL tempsusp = dcd->suspendview;
    744750          BOOL tempfollow = fFollowTree;
    745           BOOL temptop;
     751          //BOOL temptop;
    746752          dcd->suspendview = TRUE;
    747753          fFollowTree = FALSE;
    748           if (mp2) {
     754#if 0     // 2015-09-20 GKY This doesn't appear to be needed since maketop is always TRUE
     755          if (mp2) {
    749756            temptop = fTopDir;
    750757            fTopDir = TRUE;
    751758          }
    752 
    753           DbgMsg(pszSrcFile, __LINE__, "TreeObjWndProc UM_SHOWME calling ShowTreeRec(\"%s\")", mp1); // 2015-08-04 SHL FIXME debug
     759#endif
     760          //DbgMsg(pszSrcFile, __LINE__, "TreeObjWndProc UM_SHOWME calling ShowTreeRec(\"%s\")", mp1); // 2015-08-04 SHL FIXME debug
    754761          ShowTreeRec(dcd->hwndCnr, (CHAR *)mp1, fCollapseFirst, TRUE);
    755           DbgMsg(pszSrcFile, __LINE__, "TreeObjWndProc UM_SHOWME calling PostMsg(IDM_UPDATE)"); // 2015-08-04 SHL FIXME debug
     762          //DbgMsg(pszSrcFile, __LINE__, "TreeObjWndProc UM_SHOWME calling PostMsg(IDM_UPDATE)"); // 2015-08-04 SHL FIXME debug
    756763          PostMsg(hwndTree, WM_COMMAND, MPFROM2SHORT(IDM_UPDATE, 0), MPVOID);
    757764
    758765          dcd->suspendview = (USHORT)tempsusp;  // Restore
    759           fFollowTree = tempfollow;             // Restore
     766          fFollowTree = tempfollow;             // Restore
     767#if 0
    760768          if (mp2)
    761             fTopDir = temptop;                  // Restore
     769            fTopDir = temptop;                  // Restore
     770#endif
    762771        }
    763772      }
     
    797806    else {
    798807      BOOL tempsusp = dcd->suspendview;
     808      INT x = 0;
     809      BOOL fExpanding = TRUE;
    799810
    800811      dcd->suspendview = TRUE;
    801       ExpandAll(dcd->hwndCnr,
    802                 (SHORT1FROMMP(mp1) == IDM_EXPAND), (PCNRITEM) mp2);
     812      priority_idle();
     813      if (SHORT1FROMMP(mp1) == IDM_EXPAND) {
     814        //DbgMsg(pszSrcFile, __LINE__,"UM_EXPAND Start");
     815        fExpandAll = TRUE;
     816        while (fExpanding) { // Not serialized not practical to wait on very large directories
     817          x++;
     818          if (!IsFleshWorkListEmpty()) {
     819            WaitFleshWorkListEmpty(NULL); // Let it expand
     820          }
     821          fExpanding = ExpandAll(dcd->hwndCnr, x, (PCNRITEM) mp2);
     822          DosSleep(240);
     823          //DbgMsg(pszSrcFile, __LINE__,"UM_EXPAND fExpanding %i count %i", fExpanding, x);
     824        }
     825        fExpandAll = FALSE;
     826      }
     827      else
     828        CollapseAll(dcd->hwndCnr, (PCNRITEM) mp2);
     829      priority_normal();
    803830      DosSleep(1); // Fixes tree epansion (dir text and icons all placed on
    804831                       // the same line as the drive) failure on startup using RWS
     
    967994                 CM_SCROLLWINDOW,
    968995                 MPFROMSHORT(CMA_HORIZONTAL), MPFROMLONG(-1));
    969       DbgMsg(pszSrcFile, __LINE__, "TreeObjWndProc FillTreeCnr()"); // 2015-08-04 SHL FIXME debug
     996      //DbgMsg(pszSrcFile, __LINE__, "TreeObjWndProc FillTreeCnr()"); // 2015-08-04 SHL FIXME debug
    970997      FillTreeCnr(dcd->hwndCnr, dcd->hwndParent);
    971998      if (fOkayMinimize) {
     
    9761003                 CM_INVALIDATERECORD,
    9771004                 MPVOID, MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION));
    978       DbgMsg(pszSrcFile, __LINE__, "TreeObjWndProc PostMsg(UM_RESCAN)"); // 2015-08-04 SHL FIXME debug
     1005      //DbgMsg(pszSrcFile, __LINE__, "TreeObjWndProc PostMsg(UM_RESCAN)"); // 2015-08-04 SHL FIXME debug
    9791006      PostMsg(dcd->hwndCnr, UM_RESCAN, MPVOID, MPVOID);
    9801007    }
     
    13331360        }
    13341361      }
    1335       DbgMsg(pszSrcFile, __LINE__, "TreeCnrWndProc UM_RESCAN PostMsg(UM_RESCAN2, %p %s)",
    1336              pci, pci && pci->pszFileName ? pci->pszFileName : "(null)"); // 2015-08-04 SHL FIXME debug
     1362      //DbgMsg(pszSrcFile, __LINE__, "TreeCnrWndProc UM_RESCAN PostMsg(UM_RESCAN2, %p %s)",
     1363      //       pci, pci && pci->pszFileName ? pci->pszFileName : "(null)"); // 2015-08-04 SHL FIXME debug
    13371364      PostMsg(dcd->hwndObject, UM_RESCAN2, MPFROMP(pci), MPVOID);
    13381365      if (hwndStatus2)
     
    19011928      case CN_COLLAPSETREE:
    19021929      case CN_EXPANDTREE:
    1903         {
    1904           PCNRITEM pci = (PCNRITEM) mp2;
    1905 
    1906           if (pci && (INT) pci != -1 && !(pci->flags & RECFLAGS_ENV)) {
    1907             if (driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_REMOVABLE) {
    1908 
    1909               struct
    1910               {
    1911                 ULONG serial;
    1912                 CHAR volumelength;
    1913                 CHAR volumelabel[CCHMAXPATH];
    1914               }
    1915               volser;
    1916 
    1917               memset(&volser, 0, sizeof(volser));
    1918               DosError(FERR_DISABLEHARDERR);
    1919               if (!DosQueryFSInfo(toupper(*pci->pszFileName) - '@',
    1920                                   FSIL_VOLSER, &volser,
    1921                                   (ULONG) sizeof(volser))) {
    1922                 if (SHORT2FROMMP(mp1) == CN_COLLAPSETREE &&
    1923                     !volser.serial ||
    1924                     driveserial[toupper(*pci->pszFileName) - 'A'] !=
    1925                     volser.serial)
    1926                 {
    1927                   WaitFleshWorkListEmpty(pci->pszFileName);     // 2015-08-19 SHL in case pci still in work list
    1928                   AddFleshWorkRequest(hwnd, pci, eUnFlesh);
    1929                 }
    1930                 if (SHORT2FROMMP(mp1) != CN_COLLAPSETREE ||
    1931                     (!volser.serial ||
    1932                      driveserial[toupper(*pci->pszFileName) - 'A'] !=
    1933                      volser.serial)) {
    1934                   if (SHORT2FROMMP(mp1) == CN_EXPANDTREE && AddFleshWorkRequest(hwnd, pci, eFlesh)
    1935                       &&!dcd->suspendview  && fTopDir) {
    1936                     PostMsg(hwnd, UM_TOPDIR, MPFROMP(pci), MPVOID);
    1937                     //DbgMsg(pszSrcFile, __LINE__, "UM_TOPDIR %p pci %p", hwnd, pci);
    1938                   }
    1939                 }
    1940                 driveserial[toupper(*pci->pszFileName) - 'A'] = volser.serial;
    1941               }
    1942               else {
    1943                 driveserial[toupper(*pci->pszFileName) - 'A'] = -1;
    1944                 WaitFleshWorkListEmpty(pci->pszFileName);       // 2015-08-19 SHL in case pci still in work list
    1945                 AddFleshWorkRequest(hwnd, pci, eUnFlesh);
    1946                 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
    1947                 if (!fAlertBeepOff)
    1948                   DosBeep(250, 100);
    1949               }
    1950             }
    1951             else if (SHORT2FROMMP(mp1) == CN_EXPANDTREE) {
    1952               // 2015-08-04 SHL
    1953 #if 1
    1954               AddFleshWorkRequest(hwnd, pci, eFlesh);   // forceFlesh
    1955               if (!dcd->suspendview && fTopDir) {
    1956                 DbgMsg(pszSrcFile, __LINE__, "TreeCnrWndProc UM_TOPDIR %p pci %p", hwnd, pci);  // 2015-08-04 SHL FIXME debug
    1957                 PostMsg(hwnd, UM_TOPDIR, MPFROMP(pci), MPVOID);
    1958               }
    1959 #else
    1960               if (Flesh(hwnd, pci) && !dcd->suspendview && fTopDir) {
    1961                 DbgMsg(pszSrcFile, __LINE__, "TreeCnrWndProc UM_TOPDIR %p pci %p", hwnd, pci);  // 2015-08-04 SHL FIXME debug
    1962                 PostMsg(hwnd, UM_TOPDIR, MPFROMP(pci), MPVOID);
    1963               }
    1964 #endif
    1965             }
    1966             if (SHORT2FROMMP(mp1) == CN_EXPANDTREE && !dcd->suspendview){
    1967               DbgMsg(pszSrcFile, __LINE__, "UM_FILTER %p pci %p", hwnd, pci);
    1968               WinSendMsg(hwnd, UM_FILTER, MPVOID, MPVOID);
    1969             }
    1970           }
    1971         }
     1930        WinPostQueueMsg(hmqExpandTree, CN_EXPANDTREE ? UM_EXPANDTREE :UM_COLLAPSETREE,
     1931                        mp2, MPFROMP(dcd));
    19721932        break;
    19731933      }                                 // switch WM_CONTROL
     
    19921952
    19931953      if (dir) {
    1994         DbgMsg(pszSrcFile, __LINE__, "TreeCnrWndProc UM_SHOWME PostMsg(UM_SHOWME, %s)", dir); // 2015-08-13 SHL FIXME debug
     1954        //DbgMsg(pszSrcFile, __LINE__, "TreeCnrWndProc UM_SHOWME PostMsg(UM_SHOWME, %s)", dir); // 2015-08-13 SHL FIXME debug
    19951955        if (!PostMsg(dcd->hwndObject, UM_SHOWME, MPFROMP(dir), MPVOID))
    19961956          free(dir);
     
    22862246            CHAR szDrv[CCHMAXPATH];
    22872247
    2288             strcpy(szDrv, pci->pszFileName);
     2248            strcpy(szDrv, pci->pszFileName);
    22892249            chDrvU = *pci->pszFileName;
    2290             chDrvU = toupper(chDrvU);
     2250            chDrvU = toupper(chDrvU);
     2251            //DbgMsg(pszSrcFile, __LINE__,"IDM_FILESMENU prevalid drive %s file %s",
     2252            //       szDrv, pci->pszFileName);
    22912253            MakeValidDir(szDrv);
    22922254            rdy = *szDrv == chDrvU;     // Drive not ready if MakeValidDir changes drive letter
     
    22972259            local = rdy && (!(driveflags[chDrvU - 'A'] & (DRIVE_REMOTE | DRIVE_VIRTUAL)));
    22982260            underenv = (pci->flags & RECFLAGS_UNDERENV) != 0;
    2299 
     2261            //DbgMsg(pszSrcFile, __LINE__,"IDM_FILESMENU postvalid drive %s rdy %i removable %i writeable %i local %i underenv %i",
     2262            //       szDrv, rdy, removable, writeable, local, underenv);
    23002263            CopyPresParams((HWND) mp2, hwndMainMenu);
    23012264            WinEnableMenuItem((HWND) mp2, IDM_INFO, rdy);
     
    24442407  case UM_DRIVECMD:
    24452408    if (mp1) {
    2446       DbgMsg(pszSrcFile, __LINE__, "TreeCnrWndProc UM_DRIVECMD ShowTreeRec(\"%s\")", mp1);
     2409      //DbgMsg(pszSrcFile, __LINE__, "TreeCnrWndProc UM_DRIVECMD ShowTreeRec(\"%s\")", mp1);
    24472410      ShowTreeRec(hwnd, (CHAR *)mp1, FALSE, TRUE);
    2448       DbgMsg(pszSrcFile, __LINE__, "TreeCnrWndProc PostMsg(IDM_UPDATE)");
     2411      //DbgMsg(pszSrcFile, __LINE__, "TreeCnrWndProc PostMsg(IDM_UPDATE)");
    24492412      PostMsg(hwndTree, WM_COMMAND, MPFROM2SHORT(IDM_UPDATE, 0), MPVOID);
    24502413    }
     
    29392902                  PostMsg(hwndMain, UM_BUILDDRIVEBAR, MPVOID, MPVOID);
    29402903              }
    2941               DbgMsg(pszSrcFile, __LINE__, " TreeCnrWndProc IDM_UPDATE %s", pci->pszFileName); // 2015-08-03 SHL FIXME debug
     2904              //DbgMsg(pszSrcFile, __LINE__, " TreeCnrWndProc IDM_UPDATE %s", pci->pszFileName); // 2015-08-03 SHL FIXME debug
    29422905              if (~driveflag & DRIVE_INVALID)
    29432906                AddFleshWorkRequest(hwnd, pci, eFlesh);
     
    32603223    break; // WM_DESTROY
    32613224  } // switch
     3225  //DbgMsg(pszSrcFile, __LINE__,"return oldproc msg %i mp1 %p mp2 %p", msg, mp1, mp2);
    32623226  if (dcd && dcd->oldproc){
    32633227    return dcd->oldproc(hwnd, msg, mp1, mp2);
     
    34353399}
    34363400
     3401static VOID ExpandTreeThread(VOID *args)
     3402{
     3403  QMSG   qmsg;
     3404  DIRCNRDATA *dcd;
     3405  HAB hab = WinInitialize(0);
     3406# ifdef FORTIFY
     3407  Fortify_EnterScope();
     3408#  endif
     3409  if (hab) {
     3410    hmqExpandTree = WinCreateMsgQueue(hab, 0);
     3411    if (hmqExpandTree) {
     3412      while (WinGetMsg(hab, &qmsg, (HWND) 0, UM_COLLAPSETREE, UM_EXPANDTREE)) {
     3413        dcd = (DIRCNRDATA *) qmsg.mp2;
     3414        if (!dcd)
     3415          Runtime_Error(pszSrcFile, __LINE__, NULL);
     3416        else {
     3417          PCNRITEM pci = (PCNRITEM) qmsg.mp1;
     3418
     3419          if (pci && (INT) pci != -1 && !(pci->flags & RECFLAGS_ENV)) {
     3420            if (driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_REMOVABLE) {
     3421   
     3422              struct
     3423              {
     3424                ULONG serial;
     3425                CHAR volumelength;
     3426                CHAR volumelabel[CCHMAXPATH];
     3427              }
     3428              volser;
     3429   
     3430              memset(&volser, 0, sizeof(volser));
     3431              DosError(FERR_DISABLEHARDERR);
     3432              if (!DosQueryFSInfo(toupper(*pci->pszFileName) - '@',
     3433                                  FSIL_VOLSER, &volser,
     3434                                  (ULONG) sizeof(volser))) {
     3435                if (qmsg.msg == UM_COLLAPSETREE &&
     3436                    !volser.serial ||
     3437                    driveserial[toupper(*pci->pszFileName) - 'A'] !=
     3438                    volser.serial)
     3439                { // 2015-08-28 GKY fixme? I think this code runs on the UI thread
     3440                  WaitFleshWorkListEmpty(pci->pszFileName);     // 2015-08-19 SHL in case pci still in work list
     3441                  AddFleshWorkRequest(dcd->hwndCnr, pci, eUnFlesh);
     3442                }
     3443                if (qmsg.msg != UM_COLLAPSETREE ||
     3444                    (!volser.serial ||
     3445                     driveserial[toupper(*pci->pszFileName) - 'A'] !=
     3446                     volser.serial)) {
     3447                  if (qmsg.msg == UM_EXPANDTREE && AddFleshWorkRequest(dcd->hwndCnr, pci, eFlesh)
     3448                      && !dcd->suspendview  && fTopDir) {
     3449                    DosSleep(1);
     3450                    WaitFleshWorkListEmpty(pci->pszFileName);
     3451                    PostMsg(dcd->hwndCnr, UM_TOPDIR, MPFROMP(pci), MPVOID);
     3452                  }
     3453                }
     3454                driveserial[toupper(*pci->pszFileName) - 'A'] = volser.serial;
     3455              }
     3456              else {
     3457                driveserial[toupper(*pci->pszFileName) - 'A'] = -1;
     3458                // 2015-08-28 GKY fixme? I think this code runs on the UI thread
     3459                WaitFleshWorkListEmpty(pci->pszFileName);       // 2015-08-19 SHL in case pci still in work list
     3460                AddFleshWorkRequest(dcd->hwndCnr, pci, eUnFlesh);
     3461                PostMsg(dcd->hwndCnr, UM_RESCAN, MPVOID, MPVOID);
     3462                if (!fAlertBeepOff)
     3463                  DosBeep(250, 100);
     3464              }
     3465            }
     3466            else if (qmsg.msg == UM_EXPANDTREE) {
     3467              // 2015-08-04 SHL
     3468              //DbgMsg(pszSrcFile, __LINE__, "TreeCnrWndProc qmsg.msg == UM_EXPANDTREE %p pci %p %s",
     3469              //       qmsg.hwnd, pci, pci->pszFileName);
     3470              if (fExpandAll)
     3471                DosSleep(1);
     3472              else {
     3473                while (!IsFleshWorkListEmpty())
     3474                  DosSleep(10); //Yield to Flesh thread
     3475              }
     3476              AddFleshWorkRequest(dcd->hwndCnr, pci, eFlesh);   // forceFlesh
     3477              if (!dcd->suspendview && fTopDir && !fSwitchTreeOnDirChg) {
     3478                //DbgMsg(pszSrcFile, __LINE__, "TreeCnrWndProc UM_TOPDIR %p pci %p %s",
     3479                //       qmsg.hwnd, pci, pci->pszFileName);  // 2015-08-04 SHL FIXME debug
     3480                PostMsg(dcd->hwndCnr, UM_TOPDIR, MPFROMP(pci), MPVOID);
     3481              }
     3482            }
     3483            if (qmsg.msg == UM_EXPANDTREE && !dcd->suspendview) {
     3484              //DbgMsg(pszSrcFile, __LINE__, "UM_FILTER %p pci %p %s",
     3485              //       dcd->hwndCnr, pci, pci->pszFileName);
     3486              WinSendMsg(dcd->hwndCnr, UM_FILTER, MPVOID, MPVOID);
     3487            }
     3488          }
     3489        }
     3490      }
     3491    }
     3492    WinDestroyMsgQueue(hmqExpandTree);
     3493  }
     3494  WinTerminate(hab);
     3495# ifdef FORTIFY
     3496  Fortify_LeaveScope();
     3497#  endif
     3498}
     3499
     3500BOOL StartExpandTreeThread()
     3501{
     3502  TID tid;
     3503  tid = xbeginthread(ExpandTreeThread,
     3504                     65536,
     3505                     NULL,
     3506                     pszSrcFile, __LINE__);
     3507  return tid != -1;
     3508
     3509}
     3510
    34373511#pragma alloc_text(TREECNR,TreeCnrWndProc,TreeObjWndProc,TreeClientWndProc)
    34383512#pragma alloc_text(TREECNR,TreeFrameWndProc,TreeTitleWndProc,ShowTreeRec)
  • trunk/dll/treecnr.h

    r1868 r1871  
    1515  23 Aug 15 SHL Protect ShowTreeRec dirname arg
    1616  24 AUG 15 GKY Remove fDummy code
     17  20 Sep 15 GKY Move tree expand to a thread.
    1718
    1819***********************************************************************/
     
    2829MRESULT EXPENTRY TreeObjWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
    2930MRESULT EXPENTRY TreeStatProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
     31BOOL StartExpandTreeThread();
    3032
    3133// Data declarations
Note: See TracChangeset for help on using the changeset viewer.