Changeset 1871 for trunk/dll/treecnr.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/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)
Note: See TracChangeset for help on using the changeset viewer.