Changeset 787 for trunk/dll/treecnr.c


Ignore:
Timestamp:
Aug 19, 2007, 11:02:37 PM (18 years ago)
Author:
Steven Levine
Message:

Rework UM_FILLSETUPLIST IDM_SAVEDIRCNRSTATE and ..._setups() logic for ticket# 109 and #31
Add GetMSecTimer()
Use GetMSecTimer in DbgMsg
Tweak notebook.ipf scanning page
Move more #pragma alloc_text statements to end of files for OpenWatcom
Delete obsoletes
Revert ExpandAll() ShowTreeRec() DosSleeps to 0 - DosSleep(1) was slowing down inner loops
Drop afFilesToGet - use FilesToGet directly
Optimze ShowTreeRec() collapse logic - was really slow

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/treecnr.c

    r775 r787  
    1919  15 Aug 06 SHL Rework SetMask args
    2020  31 Aug 06 JS  Add more partitioning menu items
    21   22 OCT 06 GKY Add NDFS32 support
     21  22 Oct 06 GKY Add NDFS32 support
    2222  29 Dec 06 GKY Fixed menu gray out for remote drives (added variable "remote")
    2323  29 Dec 06 GKY Enabled edit of drive flags on "not ready" drives
     
    3636  02 Aug 07 SHL Sync with CNRITEM mods
    3737  06 Aug 07 GKY Reduce DosSleep times (ticket 148)
     38  14 Aug 07 SHL Revert ShowTreeRec DosSleep to 0
     39  14 Aug 07 SHL Optimze ShowTreeRec collapse - was really slow
    3840
    3941***********************************************************************/
     
    143145}
    144146
    145 VOID ShowTreeRec(HWND hwndCnr, CHAR * dirname, BOOL collapsefirst,
     147VOID ShowTreeRec(HWND hwndCnr,
     148                 CHAR *dirname,
     149                 BOOL collapsefirst,
    146150                 BOOL maketop)
    147151{
     
    153157  CHAR szDir[CCHMAXPATH], *p;
    154158
    155   /* is it already the current record? */
     159  // already positioned to requested record?
    156160  pci = WinSendMsg(hwndCnr,
    157161                   CM_QUERYRECORDEMPHASIS,
    158162                   MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
    159163  if (pci && (INT) pci != -1 && !stricmp(pci->pszFileName, dirname)) {
    160     quickbail = TRUE;
    161     goto MakeTop;                       /* skip lookup bullsh*t */
     164    // DbgMsg(pszSrcFile, __LINE__, "already at %s collapse %u maketop %u", dirname, collapsefirst, maketop);   // 14 Aug 07 SHL fixme
     165    quickbail = TRUE;                   // Bypass repositioning
     166    goto MakeTop;
    162167  }
    163168  WinEnableWindowUpdate(hwndCnr, FALSE);
     169  DbgMsg(pszSrcFile, __LINE__, "finding %s collapse %u maketop %u", dirname, collapsefirst, maketop);   // 14 Aug 07 SHL fixme
    164170  pci = FindCnrRecord(hwndCnr, dirname, NULL, TRUE, FALSE, TRUE);
    165171  if (!pci || (INT) pci == -1) {
     
    168174    szDir[2] = '\\';
    169175    szDir[3] = 0;
    170     p = szDir + 3;
     176    p = szDir + 3;                      // Point after root backslash
    171177    for (;;) {
    172178      pciP = FindCnrRecord(hwndCnr, szDir, NULL, TRUE, FALSE, TRUE);
    173179      if (pciP && (INT) pciP != -1) {
    174180        if (!stricmp(dirname, pciP->pszFileName))
    175           break;
    176         if (!(pciP->rc.flRecordAttr & CRA_EXPANDED))
     181          break;                        // Found it
     182        if (~pciP->rc.flRecordAttr & CRA_EXPANDED)
    177183          WinSendMsg(hwndCnr, CM_EXPANDTREE, MPFROMP(pciP), MPVOID);
    178184        strcpy(szDir, dirname);
    179185        if (p - szDir >= strlen(szDir))
    180           break;
     186          break;                        // Not root dir
    181187        p = strchr(p, '\\');
    182188        if (p) {
    183           *p = 0;
     189          *p = 0;                       // fixme?
    184190          p++;
    185191        }
     
    189195      else
    190196        break;
    191       DosSleep(1);
    192     }
     197      DosSleep(0);
     198    } // for
    193199    pci = FindCnrRecord(hwndCnr, dirname, NULL, TRUE, FALSE, TRUE);
    194200  }
     201  DbgMsg(pszSrcFile, __LINE__, "found");        // 14 Aug 07 SHL fixme
    195202  if (pci && (INT) pci != -1) {
    196     if (!(pci->rc.flRecordAttr & CRA_CURSORED)) {
     203    if (~pci->rc.flRecordAttr & CRA_CURSORED) {
    197204      if (collapsefirst) {
    198         /* collapse top level of all branches */
     205        DbgMsg(pszSrcFile, __LINE__, "collapsing");     // 14 Aug 07 SHL fixme
    199206        pciP = WinSendMsg(hwndCnr,
    200207                          CM_QUERYRECORD,
    201208                          MPVOID, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
    202209        while (pciP && (INT) pciP != -1) {
    203           if (toupper(*pciP->pszFileName) == toupper(*dirname))
    204             /* collapse all levels if branch is our drive */
    205             ExpandAll(hwndCnr, FALSE, pciP);
    206           else if (pciP->rc.flRecordAttr & CRA_EXPANDED)
     210#if 1
     211          if (pciP->rc.flRecordAttr & CRA_EXPANDED) {
     212            // collapse top level of all branches
    207213            WinSendMsg(hwndCnr, CM_COLLAPSETREE, MPFROMP(pciP), MPVOID);
     214          }
     215#else // fixme to be gone
     216          if (toupper(*pciP->pszFileName) == toupper(*dirname)) {
     217            // collapse all levels if branch is our drive
     218            if (pciP->rc.flRecordAttr & CRA_EXPANDED)
     219              ExpandAll(hwndCnr, FALSE, pciP);
     220          }
     221          else if (pciP->rc.flRecordAttr & CRA_EXPANDED) {
     222            // collapse top level of all branches
     223            WinSendMsg(hwndCnr, CM_COLLAPSETREE, MPFROMP(pciP), MPVOID);
     224          }
     225#endif
    208226          pciP = WinSendMsg(hwndCnr,
    209227                            CM_QUERYRECORD,
    210228                            MPFROMP(pciP),
    211229                            MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
    212         }
     230        } // while
    213231      }
    214232      /* expand all parent branches */
     233      DbgMsg(pszSrcFile, __LINE__, "expanding parents");        // 14 Aug 07 SHL fixme
    215234      pciToSelect = pci;
    216235      for (;;) {
     
    226245        else
    227246          break;
    228         DosSleep(1);
    229       }
     247        DosSleep(1);                    // Let GUI update
     248      } // for
    230249    }
    231250    /* make record visible */
    232251  MakeTop:
     252    DbgMsg(pszSrcFile, __LINE__, "moving into view");   // 14 Aug 07 SHL fixme
    233253    pciToSelect = pci;
    234254    if (pciToSelect && (INT) pciToSelect != -1) {
    235       if (fTopDir || maketop)
     255      if (fTopDir || maketop) {
    236256        ShowCnrRecord(hwndCnr, (PMINIRECORDCORE) pciToSelect);
    237       if (fSwitchTreeExpand && !(pciToSelect->rc.flRecordAttr & CRA_EXPANDED))
     257      }
     258      if (fSwitchTreeExpand && ~pciToSelect->rc.flRecordAttr & CRA_EXPANDED) {
     259        DbgMsg(pszSrcFile, __LINE__, "expanding current");      // 14 Aug 07 SHL fixme
    238260        WinSendMsg(hwndCnr, CM_EXPANDTREE, MPFROMP(pciToSelect), MPVOID);
    239       if (quickbail) {
    240         WinEnableWindowUpdate(hwndCnr, TRUE);
    241         return;
    242       }
    243       WinSendMsg(hwndCnr,
    244                  CM_SETRECORDEMPHASIS,
    245                  MPFROMP(pciToSelect),
    246                  MPFROM2SHORT(TRUE, CRA_SELECTED | CRA_CURSORED));
     261        DbgMsg(pszSrcFile, __LINE__, "expanded");       // 14 Aug 07 SHL fixme
     262      }
     263      if (!quickbail) {
     264        WinSendMsg(hwndCnr,
     265                   CM_SETRECORDEMPHASIS,
     266                   MPFROMP(pciToSelect),
     267                   MPFROM2SHORT(TRUE, CRA_SELECTED | CRA_CURSORED));
     268      }
    247269    }
    248270  }
     271  DbgMsg(pszSrcFile, __LINE__, "done"); // 14 Aug 07 SHL fixme
    249272  WinEnableWindowUpdate(hwndCnr, TRUE);
     273  DosSleep(1);                  // Let GUI update
    250274}
    251275
     
    517541
    518542  case UM_SHOWME:
     543    // DbgMsg(pszSrcFile, __LINE__, "UM_SHOWME mp1 %p mp2 %p", mp1, mp2);       // 14 Aug 07 SHL fixme
    519544    if (mp1) {
    520545      dcd = INSTDATA(hwnd);
     546      // DbgMsg(pszSrcFile, __LINE__, "UM_SHOWME dcd %p", dcd); // 14 Aug 07 SHL fixme
    521547      if (dcd) {
    522548        BOOL tempsusp, tempfollow, temptop;
Note: See TracChangeset for help on using the changeset viewer.