Changeset 1858 for trunk/dll/treecnr.c


Ignore:
Timestamp:
Aug 20, 2015, 7:31:14 AM (10 years ago)
Author:
Steven Levine
Message:

Rework FlestWaitForWorkListEmpty to support wait for parents of path
Clean up some obsolete code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/treecnr.c

    r1857 r1858  
    326326
    327327    // Try again expanding as needed
    328 
    329     DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec need expand"); // 2015-08-04 SHL FIXME debug
     328    DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec need expand, IsFleshWorkListEmpty %u", IsFleshWorkListEmpty()); // 2015-08-04 SHL FIXME debug
    330329
    331330    cDirLen = strlen(pszDir_);
     
    347346      if (!pciP || (INT)pciP == -1) {
    348347        DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec FindCnrRecord(%s) returned %p", szDir, pciP); // 2015-08-04 SHL FIXME debug
    349         WaitFleshWorkListEmpty();               // 2015-08-13 SHL
     348        WaitFleshWorkListEmpty(szDir);          // 2015-08-19 SHL
    350349        DosSleep(1000);
    351350        break;                                  // No match
     
    364363        WinSendMsg(hwndCnr, CM_EXPANDTREE, MPFROMP(pciP), MPVOID);
    365364        DosSleep(100);                          // 2015-08-13 SHL Let PM catch up
    366         // WaitFleshWorkListEmpty();            // 2015-08-13 SHL
    367       }
    368 
    369       WaitFleshWorkListEmpty();         // 2015-08-13 SHL
     365      }
     366
     367      WaitFleshWorkListEmpty(szDir);    // 2015-08-19 SHL
    370368
    371369      // Add next component to path
     
    433431
    434432      if (!quickbail) {
    435         WaitFleshWorkListEmpty();       // 2015-08-07 SHL FIXME try to ensure contents stable
     433        WaitFleshWorkListEmpty(pszDir_);        // 2015-08-19 SHL try to ensure contents stable
    436434        DbgMsg(pszSrcFile, __LINE__, "WinSendMsg(CM_SETRECORDEMPHASIS, CRA_SELECTED | CRA_CURSORED) \"%s\"", pszDir_); // 2015-08-04 SHL FIXME debug
    437435        WinSendMsg(hwndCnr,
     
    707705  DIRCNRDATA *dcd;
    708706
    709 #if 0 // 2015-08-04 SHL FIXME to be gone
    710   APIRET rc;
    711 #endif // 2015-08-04 SHL FIXME to be gone
    712 
    713707  switch (msg) {
    714708  case UM_SHOWME:
     
    720714      if (dcd) {
    721715
    722 #if 0 // 2015-08-04 SHL FIXME to be gone
    723         rc = DosWaitEventSem(hevTreeCnrScanComplete, SEM_INDEFINITE_WAIT);
    724         if (rc)
    725           Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosPostEventSem");
    726 #endif // 2015-08-04 SHL FIXME to be gone
    727 
    728716        /* Hold off if switching on focus change and
    729717           RestoreDirCnrState has restored one or directory directory containers
    730718           See RestoreDirCnrState()
    731719        */
    732         DbgMsg(pszSrcFile, __LINE__, "TreeObjWndProc UM_SHOWME cDirectoriesRestored %u", cDirectoriesRestored, fInitialDriveScan); // 2015-08-04 SHL FIXME debug
     720        DbgMsg(pszSrcFile, __LINE__, "TreeObjWndProc UM_SHOWME cDirectoriesRestored %u", cDirectoriesRestored); // 2015-08-04 SHL FIXME debug
    733721        DbgMsg(pszSrcFile, __LINE__, "TreeObjWndProc UM_SHOWME %s)", mp1); // 2015-08-04 SHL FIXME debug
    734722
     
    940928            pci = FindParentRecord(dcd->hwndCnr, pci);
    941929            driveserial[toupper(*pci->pszFileName) - 'A'] = -1;
    942             WaitFleshWorkListEmpty();   // 2015-08-13 SHL in case pci still in work list
     930            WaitFleshWorkListEmpty(pci->pszFileName);   // 2015-08-19 SHL in case pci still in work list
    943931            AddFleshWorkRequest(dcd->hwndCnr, pci, eUnFlesh);
    944932          }
     
    952940
    953941  case UM_RESCAN:
    954     // populate container
    955 #if 0 // 2015-08-04 SHL FIXME to be gone
    956     rc = DosWaitEventSem(hevTreeCnrScanComplete, SEM_INDEFINITE_WAIT);
    957     if (rc)
    958       Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosWaitEventSem");
    959     rc = DosResetEventSem(hevTreeCnrScanComplete, &ulScanPostCnt);
    960     if (rc)
    961       Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosResetEventSem");
    962 #endif // 2015-08-04 SHL FIXME to be gone
    963 
     942    // Populate container
    964943    dcd = WinQueryWindowPtr(hwnd, QWL_USER);
    965944    if (!dcd)
     
    19311910                    volser.serial)
    19321911                {
    1933                   WaitFleshWorkListEmpty();     // 2015-08-13 SHL in case pci still in work list
     1912                  WaitFleshWorkListEmpty(pci->pszFileName);     // 2015-08-19 SHL in case pci still in work list
    19341913                  AddFleshWorkRequest(hwnd, pci, eUnFlesh);
    19351914                }
     
    19481927              else {
    19491928                driveserial[toupper(*pci->pszFileName) - 'A'] = -1;
    1950                 WaitFleshWorkListEmpty();       // 2015-08-13 SHL in case pci still in work list
     1929                WaitFleshWorkListEmpty(pci->pszFileName);       // 2015-08-19 SHL in case pci still in work list
    19511930                AddFleshWorkRequest(hwnd, pci, eUnFlesh);
    19521931                PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
     
    20262005      INT x;
    20272006
    2028 #if 0 // 2015-08-04 SHL FIXME to be gone
    2029       rc = DosRequestMutexSem(hmtxScanning, SEM_INDEFINITE_WAIT);
    2030       if (rc)
    2031         Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosRequestMutexSem");
    2032 #endif // 2015-08-04 SHL FIXME to be gone
    2033 
    2034 #if 0 // 2015-08-04 SHL FIXME to be gone
    2035       rc = DosQueryEventSem(hevTreeCnrScanComplete, &ulScanPostCnt);
    2036       if (rc)
    2037         Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosQueryEventSem");
    2038       if (ulScanPostCnt < 1)
    2039         return 0;
    2040       rc = DosResetEventSem(hevTreeCnrScanComplete, &ulScanPostCnt);
    2041       if (rc)
    2042         Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosResetEventSem");
    2043 #endif // 2015-08-04 SHL FIXME to be gone
    2044 
    20452007      if (fFollowTree)
    20462008        fl = 0;
     
    20572019          if (hwndStatus)
    20582020            WinSetWindowText(hwndStatus, (CHAR *) GetPString(IDS_RESCANSUGTEXT));
    2059 
    2060 #if 0 // 2015-08-04 SHL FIXME to be gone
    2061           rc = DosPostEventSem(hevTreeCnrScanComplete);
    2062           if (rc && rc != ERROR_ALREADY_POSTED)
    2063             Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosPostEventSem");
    2064 #endif // 2015-08-04 SHL FIXME to be gone
    2065 
    20662021          return 0;
    20672022        }
     
    20832038            } // for
    20842039            RemoveCnrItems(hwnd, pciP, 1, CMA_FREE | CMA_INVALIDATE);
    2085 
    2086 #if 0 // 2015-08-04 SHL FIXME to be gone
    2087             rc = DosPostEventSem(hevTreeCnrScanComplete);
    2088             if (rc && rc != ERROR_ALREADY_POSTED)
    2089               Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosPostEventSem");
    2090 #endif // 2015-08-04 SHL FIXME to be gone
    20912040            return 0;
    20922041          }
     
    21312080          if (!rc) {
    21322081            if (!volser.serial || driveserial[x] != volser.serial) {
    2133 #if 1 // 2015-08-04 SHL FIXME to be gone
    21342082              AddFleshWorkRequest(hwnd, pciP, eFlesh);  // forceFlesh
    2135 #else
    2136               Flesh(hwnd, pciP);
    2137 #endif // 2015-08-04 SHL FIXME to be gone
    21382083              driveserial[x] = volser.serial;
    21392084            }
     
    21432088                              MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER));
    21442089            if (!pciL) {
    2145 #if 1 // 2015-08-04 SHL FIXME to be gone
    21462090              AddFleshWorkRequest(hwnd, pciP, eFlesh);  // forceFlesh
    2147 #else
    2148               Flesh(hwnd, pciP);
    2149 #endif // 2015-08-04 SHL FIXME to be gone
    21502091            }
    21512092            if ((fShowFSTypeInTree || fShowDriveLabelInTree) &&
     
    21652106          else {
    21662107            driveserial[x] = -1;
    2167             WaitFleshWorkListEmpty();   // 2015-08-13 SHL in case pci still in work list
     2108            WaitFleshWorkListEmpty(NULL);       // 2015-08-13 SHL in case pci still in work list
    21682109            AddFleshWorkRequest(hwnd, pci, eUnFlesh);
    21692110            PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
    21702111            PostMsg(hwnd, UM_SETUP2, MPFROMP(pci), MPFROMLONG(rc));
    2171 
    2172 #if 0 // 2015-08-04 SHL FIXME to be gone
    2173             rc = DosPostEventSem(hevTreeCnrScanComplete);
    2174             if (rc && rc != ERROR_ALREADY_POSTED)
    2175               Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosPostEventSem");
    2176 #endif // 2015-08-04 SHL FIXME to be gone
    21772112            return 0;
    21782113          }
     
    21972132              PostMsg(hwnd,
    21982133                      WM_COMMAND, MPFROM2SHORT(IDM_SHOWALLFILES, 0), MPVOID);
    2199 
    2200 #if 0 // 2015-08-04 SHL FIXME to be gone
    2201               rc = DosPostEventSem(hevTreeCnrScanComplete);
    2202               if (rc && rc != ERROR_ALREADY_POSTED)
    2203                 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosPostEventSem");
    2204 #endif // 2015-08-04 SHL FIXME to be gone
    22052134              return 0;
    22062135            }
    22072136            if ((shiftstate & (KC_CTRL | KC_SHIFT)) == (KC_CTRL | KC_SHIFT)) {
    22082137              OpenObject(pci->pszFileName, Settings, dcd->hwndFrame);
    2209 
    2210 #if 0 // 2015-08-04 SHL FIXME to be gone
    2211               rc = DosPostEventSem(hevTreeCnrScanComplete);
    2212               if (rc && rc != ERROR_ALREADY_POSTED)
    2213                 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosPostEventSem");
    2214 #endif // 2015-08-04 SHL FIXME to be gone
    22152138              return 0;
    22162139            }
     
    22182141              if (!ParentIsDesktop(hwnd, dcd->hwndParent)) {
    22192142                if (FindDirCnrByName(pci->pszFileName, TRUE)) {
    2220 
    2221 #if 0 // 2015-08-04 SHL FIXME to be gone
    2222                   rc = DosPostEventSem(hevTreeCnrScanComplete);
    2223                   if (rc && rc != ERROR_ALREADY_POSTED)
    2224                     Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosPostEventSem");
    2225 #endif // 2015-08-04 SHL FIXME to be gone
    22262143                  return 0;
    22272144                }
     
    22472164              }
    22482165              OpenObject(pci->pszFileName, s, dcd->hwndFrame);
    2249 
    2250 #if 0 // 2015-08-04 SHL FIXME to be gone
    2251               rc = DosPostEventSem(hevTreeCnrScanComplete);
    2252               if (rc && rc != ERROR_ALREADY_POSTED)
    2253                 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosPostEventSem");
    2254 #endif // 2015-08-04 SHL FIXME to be gone
    22552166              return 0;
    22562167            }
     
    22962207      if (fFollowTree)
    22972208        WinSetFocus(HWND_DESKTOP, hwnd);
    2298 
    2299 #if 0 // 2015-08-04 SHL FIXME to be gone
    2300       rc = DosPostEventSem(hevTreeCnrScanComplete);
    2301       if (rc && rc != ERROR_ALREADY_POSTED)
    2302         Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosPostEventSem");
    2303 #endif // 2015-08-04 SHL FIXME to be gone
    23042209    }
    23052210    return 0;
     
    29922897                break;
    29932898
    2994 #if 0 // 2015-08-04 SHL FIXME to be gone
    2995               rc = DosRequestMutexSem(hmtxScanning, SEM_INDEFINITE_WAIT);
    2996               if (rc)
    2997                 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosRequestMutexSem");
    2998 #endif // 2015-08-04 SHL FIXME to be gone
    2999 
    3000 #if 0 // 2015-08-04 SHL FIXME to be gone
    3001               rc = DosResetEventSem(hevTreeCnrScanComplete, &ulScanPostCnt);
    3002               if (rc)
    3003                 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosResetEventSem");
    3004 #endif // 2015-08-04 SHL FIXME to be gone
    3005 
    3006               // Can't wait here
    3007               // WaitFleshWorkListEmpty();      // 2015-08-13 SHL in case pci still in work list
    30082899              AddFleshWorkRequest(hwnd, pci, eUnFlesh);
     2900
    30092901              // Check if drive type might need update
    30102902              if ((driveflag & (DRIVE_INVALID | DRIVE_NOPRESCAN)) ||
     
    30352927              if (~driveflag & DRIVE_INVALID)
    30362928                AddFleshWorkRequest(hwnd, pci, eFlesh);
    3037 #if 0 // 2015-08-04 SHL FIXME to be gone
    3038               rc = DosPostEventSem(hevTreeCnrScanComplete);
    3039               if (rc && rc != ERROR_ALREADY_POSTED)
    3040                 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosPostEventSem");
    3041 #endif // 2015-08-04 SHL FIXME to be gone
    30422929            }
    30432930          }
Note: See TracChangeset for help on using the changeset viewer.