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