Changeset 1550


Ignore:
Timestamp:
Nov 3, 2010, 3:50:42 AM (15 years ago)
Author:
Gregg Young
Message:

This actually fixes the double names in the tree container. It also streamlines the initial scan code by eliminating multiple redundant scans.

Location:
trunk/dll
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/filldir.c

    r1549 r1550  
    135135static PSZ pszSrcFile = __FILE__;
    136136static BOOL fFirstTime;
     137INT FixedVolume = 0;
    137138
    138139#pragma data_seg(GLOBAL1)
     
    215216  HAB thab;
    216217  HMQ hmq = (HMQ) 0;
    217   BOOL ok;
     218  //BOOL ok;
     219  static INT ProcessDirCount = 0;
    218220
    219221  DosError(FERR_DISABLEHARDERR);
     
    231233        IncrThreadUsage();
    232234        priority_normal();
    233         ok = Stubby(StubbyScan->hwndCnr, StubbyScan->pci);
    234         if (ok) {
    235           if (WinIsWindow((HAB)0, StubbyScan->hwndCnr)) {
    236             ULONG flags = driveflags[toupper(*StubbyScan->pci->pszFileName) - 'A'];
    237 
    238             if ((fRScanLocal && ~flags & DRIVE_REMOTE && ~flags & DRIVE_VIRTUAL) ||
    239                  (fRScanRemote && flags & DRIVE_REMOTE) ||
    240                  (fRScanVirtual && flags & DRIVE_VIRTUAL)) {
    241               if (!(flags & ((fRScanNoWrite ? 0 : DRIVE_NOTWRITEABLE) ||
    242                              (fRScanSlow ? 0 : DRIVE_SLOW)))) {
    243                 UnFlesh(StubbyScan->hwndCnr, StubbyScan->pci);
    244                 Flesh(StubbyScan->hwndCnr, StubbyScan->pci);
    245               }
    246             }
    247           }
    248         }
     235        if (WinIsWindow((HAB)0, StubbyScan->hwndCnr)) {
     236          ULONG flags = driveflags[toupper(*StubbyScan->pci->pszFileName) - 'A'];
     237
     238          if ((fRScanLocal && ~flags & DRIVE_REMOTE && ~flags & DRIVE_VIRTUAL) ||
     239               (fRScanRemote && flags & DRIVE_REMOTE) ||
     240               (fRScanVirtual && flags & DRIVE_VIRTUAL)) {
     241            if (!(flags & ((fRScanNoWrite ? 0 : DRIVE_NOTWRITEABLE) ||
     242                           (fRScanSlow ? 0 : DRIVE_SLOW)))) {
     243              UnFlesh(StubbyScan->hwndCnr, StubbyScan->pci);
     244              Flesh(StubbyScan->hwndCnr, StubbyScan->pci);
     245            }
     246          }
     247          else {
     248            Stubby(StubbyScan->hwndCnr, StubbyScan->pci);
     249            //if (!ok)
     250             // FixedVolume--;
     251          }       
     252        }
    249253        WinDestroyMsgQueue(hmq);
    250254      }
     
    254258    free(StubbyScan);
    255259  } // if StubbyScan
     260  ProcessDirCount++;
     261  DbgMsg(pszSrcFile, __LINE__, "ProcessDirCount %i FixedVolume %i",
     262         ProcessDirCount, FixedVolume);
     263  if (fInitialDriveScan && ProcessDirCount >= FixedVolume) {
     264    fInitialDriveScan = FALSE;
     265    DosPostEventSem(hevInitialCnrScanComplete);
     266    DosCloseEventSem(hevInitialCnrScanComplete);
     267    if (fSwitchTree && hwndTree && fSaveState && pszFocusDir) {
     268       // Keep drive tree in sync with directory container
     269      if (hwndMain) {
     270        //if (TopWindow(hwndMain, (HWND) 0) == dcd->hwndFrame)
     271          if (!PostMsg(hwndTree, UM_SHOWME, MPFROMP(pszFocusDir), MPVOID))
     272            free(pszFocusDir);
     273      }
     274      else {
     275        if (!PostMsg(hwndTree, UM_SHOWME, MPFROMP(pszFocusDir), MPVOID))
     276          free(pszFocusDir);
     277      }
     278    }
     279  }
    256280# ifdef FORTIFY
    257281  Fortify_LeaveScope();
     
    260284}
    261285
     286#if 0
    262287VOID ProcessDirectoryThread(VOID * arg)
    263288{
     
    265290  HAB thab;
    266291  HMQ hmq = (HMQ) 0;
     292 
    267293
    268294  DosError(FERR_DISABLEHARDERR);
     
    273299
    274300  ProcessDir = (PROCESSDIR *)arg;
    275   if (ProcessDir && ProcessDir->pciParent && ProcessDir->pciParent->pszFileName && ProcessDir->hwndCnr) {
     301  if (ProcessDir && ProcessDir->pciParent && ProcessDir->pciParent->pszFileName &&
     302      ProcessDir->hwndCnr) {
    276303    thab = WinInitialize(0);
    277304    if (thab) {
     
    297324    free(ProcessDir);
    298325  } // if ProcessDir
    299   if (fInitialDriveScan) {
    300     fInitialDriveScan = FALSE;
    301     DosPostEventSem(hevInitialCnrScanComplete);
    302     DosCloseEventSem(hevInitialCnrScanComplete);
    303   }
    304326# ifdef FORTIFY
    305327  Fortify_LeaveScope();
     
    307329
    308330}
     331# endif
    309332
    310333static HPOINTER IDFile(PSZ p)
     
    13691392
    13701393          if (~driveflags[iDrvNum] & DRIVE_REMOVABLE) {
    1371             // Fixed volume
     1394            // Fixed volume
     1395            if (~flags & DRIVE_INVALID && ~flags & DRIVE_NOPRESCAN)
     1396              FixedVolume++;
    13721397            pci->attrFile |= FILE_DIRECTORY;
    13731398            DosError(FERR_DISABLEHARDERR);
  • trunk/dll/filldir.h

    r1444 r1550  
    6262extern HPOINTER hptrReadonly;
    6363extern HPOINTER hptrSystem;
     64extern INT FixedVolume;
    6465
    6566typedef struct {
  • trunk/dll/findrec.c

    r1549 r1550  
    124124  qrecrct.fsExtent = (CMA_ICON | CMA_TEXT | CMA_TREEICON);
    125125  if (!WinSendMsg(hwndCnr,
    126                   CM_QUERYRECORDRECT, MPFROMP(&rcl), MPFROMP(&qrecrct))) {
     126                  CM_QUERYRECORDRECT, MPFROMP(&rcl), MPFROMP(&qrecrct))) {
    127127    qrecrct.fsExtent = CMA_TEXT | CMA_TREEICON;
    128128    WinSendMsg(hwndCnr, CM_QUERYRECORDRECT, MPFROMP(&rcl), MPFROMP(&qrecrct));
     
    134134  WinSendMsg(hwndCnr,
    135135             CM_SCROLLWINDOW,
    136              MPFROMSHORT(CMA_VERTICAL),
    137              MPFROMLONG((rclViewport.yTop - (rcl.yTop) - 4)));
     136             MPFROMSHORT(CMA_HORIZONTAL), MPFROMLONG(rcl.xRight - rclViewport.xRight));
    138137  WinSendMsg(hwndCnr,
    139138             CM_SCROLLWINDOW,
    140              MPFROMSHORT(CMA_HORIZONTAL), MPFROMLONG(rcl.xRight - rclViewport.xRight));
     139             MPFROMSHORT(CMA_VERTICAL),
     140             MPFROMLONG((rclViewport.yTop - (rcl.yTop) - 4)));
    141141}
    142142
  • trunk/dll/flesh.c

    r1505 r1550  
    201201        DRIVE_INCLUDEFILES)
    202202      includefiles = TRUE;
     203#if 0
    203204    if (fInitialDriveScan) {
    204205      PROCESSDIR *ProcessDir;
     
    228229    }
    229230    else {
     231# endif
    230232      ProcessDirectory(hwndCnr,
    231233                       pciParent,
     
    238240                       NULL,            // total files
    239241                       NULL);           // total bytes
    240     }
     242    //}
    241243  }
    242244  driveflags[*pciParent->pszFileName - 'A'] |= DRIVE_RSCANNED;
  • trunk/dll/mainwnd.c

    r1549 r1550  
    235235PCSZ FM3Str  = "FM/3";
    236236RGB2 RGBGREY;
     237PSZ pszFocusDir;
    237238
    238239#pragma data_seg(DATA1)
     
    33243325            RemoveOldCnrSwitches(szPrefix, x);
    33253326            continue;
    3326           }
     3327          }
     3328          if (x == 0 && fSwitchTree)
     3329            pszFocusDir = xstrdup(szDir, pszSrcFile, __LINE__);
    33273330          LoadDetailsSwitches(szKeyBase, &localdcd.ds, TRUE);
    33283331          hwndDir = (HWND) WinSendMsg(hwndClient,
  • trunk/dll/mainwnd.h

    r1438 r1550  
    8989extern HWND hwndTree;
    9090extern USHORT shiftstate;
     91extern PSZ pszFocusDir;
    9192
    9293#define STATE_NAME_MAX_BYTES 256
  • trunk/dll/treecnr.c

    r1549 r1550  
    359359    if (pciToSelect && (INT) pciToSelect != -1) {
    360360      //DbgMsg(pszSrcFile, __LINE__, "TOP %i %i", fTopDir, maketop);
     361      if (fSwitchTreeExpand && ~pciToSelect->rc.flRecordAttr & CRA_EXPANDED)
     362        WinSendMsg(hwndCnr, CM_EXPANDTREE, MPFROMP(pciToSelect), MPVOID);
    361363      if (fTopDir || maketop) {
    362364        ShowCnrRecord(hwndCnr, (PMINIRECORDCORE) pciToSelect);
    363365      }
    364       if (fSwitchTreeExpand && ~pciToSelect->rc.flRecordAttr & CRA_EXPANDED)
    365         WinSendMsg(hwndCnr, CM_EXPANDTREE, MPFROMP(pciToSelect), MPVOID);
    366366      if (!quickbail) {
    367367        WinSendMsg(hwndCnr,
     
    654654          fTopDir = TRUE;
    655655        }
    656         if (fInitialDriveScan)
    657           DosWaitEventSem(hevInitialCnrScanComplete, SEM_INDEFINITE_WAIT);
    658656        ShowTreeRec(dcd->hwndCnr, (CHAR *)mp1, fCollapseFirst, TRUE);
     657        // fixme Is this PostMsg needed if recursive scan has already been done?
    659658        PostMsg(hwndTree, WM_COMMAND, MPFROM2SHORT(IDM_UPDATE, 0), MPVOID);
    660659        dcd->suspendview = (USHORT) tempsusp;
Note: See TracChangeset for help on using the changeset viewer.