Changeset 1455 for trunk/dll/treecnr.c


Ignore:
Timestamp:
Sep 15, 2009, 4:43:55 AM (16 years ago)
Author:
Steven Levine
Message:

Blink thread LEDs while worker threads are working
Drop expermental code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/treecnr.c

    r1447 r1455  
    6969  06 Jun 09 GKY Status line to show file sys/label not shown in tree; shortened to fit split status
    7070  07 Jun 09 GKY Fixed double names in tree container when collapsed tree is accessed
    71                 before recursive scan
     71                before recursive scan
    7272  12 Jul 09 GKY Add option to show file system type or drive label in tree
    73                 (get NOPRESCAN drives working)
     73                (get NOPRESCAN drives working)
    7474  22 Jul 09 GKY Code changes to use semaphores to serialize drive scanning
    7575  22 Jul 09 GKY Consolidated driveflag setting code in DriveFlagsOne
    7676  22 Jul 09 GKY Streamline scanning code for faster Tree rescans
     77  14 Sep 09 SHL Drop experimental code
    7778
    7879***********************************************************************/
     
    280281        if (!stricmp(dirname, pciP->pszFileName))
    281282          break;                        // Found it
    282         if (~pciP->rc.flRecordAttr & CRA_EXPANDED)
    283           WinSendMsg(hwndCnr, CM_EXPANDTREE, MPFROMP(pciP), MPVOID);
     283        if (~pciP->rc.flRecordAttr & CRA_EXPANDED)
     284          WinSendMsg(hwndCnr, CM_EXPANDTREE, MPFROMP(pciP), MPVOID);
    284285        strcpy(szDir, dirname);
    285286        if (p - szDir >= strlen(szDir))
     
    336337                          MPFROM2SHORT(CMA_PARENT, CMA_ITEMORDER));
    337338        if (pciP && (INT) pciP != -1) {
    338           if (!(pciP->rc.flRecordAttr & CRA_EXPANDED))
    339             WinSendMsg(hwndCnr, CM_EXPANDTREE, MPFROMP(pciP), MPVOID);
     339          if (!(pciP->rc.flRecordAttr & CRA_EXPANDED))
     340            WinSendMsg(hwndCnr, CM_EXPANDTREE, MPFROMP(pciP), MPVOID);
    340341          pciToSelect = pciP;
    341342        }
     
    352353        ShowCnrRecord(hwndCnr, (PMINIRECORDCORE) pciToSelect);
    353354      }
    354       if (fSwitchTreeExpand && ~pciToSelect->rc.flRecordAttr & CRA_EXPANDED) 
    355         WinSendMsg(hwndCnr, CM_EXPANDTREE, MPFROMP(pciToSelect), MPVOID);
     355      if (fSwitchTreeExpand && ~pciToSelect->rc.flRecordAttr & CRA_EXPANDED)
     356        WinSendMsg(hwndCnr, CM_EXPANDTREE, MPFROMP(pciToSelect), MPVOID);
    356357      if (!quickbail) {
    357358        WinSendMsg(hwndCnr,
     
    643644          temptop = fTopDir;
    644645          fTopDir = TRUE;
    645         }
    646         ShowTreeRec(dcd->hwndCnr, (CHAR *)mp1, fCollapseFirst, TRUE);
    647         PostMsg(hwndTree, WM_COMMAND, MPFROM2SHORT(IDM_UPDATE, 0), MPVOID);
     646        }
     647        ShowTreeRec(dcd->hwndCnr, (CHAR *)mp1, fCollapseFirst, TRUE);
     648        PostMsg(hwndTree, WM_COMMAND, MPFROM2SHORT(IDM_UPDATE, 0), MPVOID);
    648649        dcd->suspendview = tempsusp;
    649650        fFollowTree = tempfollow;
     
    780781              else
    781782                *szFree = 0;
    782               driveserial[toupper(*pci->pszFileName) - 'A'] = volser.serial;
    783               if (CheckDrive(toupper(*pci->pszFileName), FileSystem, &type) == -1 ||
    784                   fShowFSTypeInTree)
    785                 strcpy(FileSystem, NullStr);
    786               if (fShowDriveLabelInTree)
    787                 strcpy(szTmpLabel, NullStr);
    788               else
    789                 strcpy(szTmpLabel, volser.volumelabel);
    790               if (fSplitStatus) {
    791                 CHAR temp[CCHMAXPATH] = " [";
    792 
    793                 strcat(temp, s);
    794                 strcat(temp, "]");
    795                 sprintf(s,
    796                         GetPString(fShowFSTypeInTree ? IDS_TREESTATUSSTART1TEXT :
    797                                    fShowDriveLabelInTree
    798                                    ? IDS_TREESTATUSSTART2TEXT : IDS_TREESTATUSSTARTTEXT),
    799                         toupper(*pci->pszFileName), FileSystem,
    800                         szTmpLabel, volser.serial, szFree);
    801                 strcat(s, temp);
    802               }
    803               else {
    804                 strcat(s, " [");
    805                 sprintf(&s[strlen(s)],
    806                         GetPString(fShowFSTypeInTree ? IDS_TREESTATUSSTART1TEXT :
    807                                    fShowDriveLabelInTree
    808                                    ? IDS_TREESTATUSSTART2TEXT : IDS_TREESTATUSSTARTTEXT),
    809                         toupper(*pci->pszFileName), FileSystem,
    810                         szTmpLabel, volser.serial, szFree);
    811                 strcat(s, "]");
    812               }
     783              driveserial[toupper(*pci->pszFileName) - 'A'] = volser.serial;
     784              if (CheckDrive(toupper(*pci->pszFileName), FileSystem, &type) == -1 ||
     785                  fShowFSTypeInTree)
     786                strcpy(FileSystem, NullStr);
     787              if (fShowDriveLabelInTree)
     788                strcpy(szTmpLabel, NullStr);
     789              else
     790                strcpy(szTmpLabel, volser.volumelabel);
     791              if (fSplitStatus) {
     792                CHAR temp[CCHMAXPATH] = " [";
     793
     794                strcat(temp, s);
     795                strcat(temp, "]");
     796                sprintf(s,
     797                        GetPString(fShowFSTypeInTree ? IDS_TREESTATUSSTART1TEXT :
     798                                   fShowDriveLabelInTree
     799                                   ? IDS_TREESTATUSSTART2TEXT : IDS_TREESTATUSSTARTTEXT),
     800                        toupper(*pci->pszFileName), FileSystem,
     801                        szTmpLabel, volser.serial, szFree);
     802                strcat(s, temp);
     803              }
     804              else {
     805                strcat(s, " [");
     806                sprintf(&s[strlen(s)],
     807                        GetPString(fShowFSTypeInTree ? IDS_TREESTATUSSTART1TEXT :
     808                                   fShowDriveLabelInTree
     809                                   ? IDS_TREESTATUSSTART2TEXT : IDS_TREESTATUSSTARTTEXT),
     810                        toupper(*pci->pszFileName), FileSystem,
     811                        szTmpLabel, volser.serial, szFree);
     812                strcat(s, "]");
     813              }
    813814              if (!fMoreButtons) {
    814815                if (*dcd->mask.szMask ||
     
    854855      WinSendMsg(dcd->hwndCnr,
    855856                 CM_SCROLLWINDOW,
    856                 MPFROMSHORT(CMA_HORIZONTAL), MPFROMLONG(-1));
     857                MPFROMSHORT(CMA_HORIZONTAL), MPFROMLONG(-1));
    857858      DosRequestMutexSem(hmtFillingTreeCnr, SEM_INDEFINITE_WAIT);
    858859      FillTreeCnr(dcd->hwndCnr, dcd->hwndParent);
     
    18131814                  if (Flesh(hwnd, pci) &&
    18141815                      SHORT2FROMMP(mp1) == CN_EXPANDTREE &&
    1815                       !dcd->suspendview && fTopDir) {
    1816                     PostMsg(hwnd, UM_TOPDIR, MPFROMP(pci), MPVOID);
    1817                     //DbgMsg(pszSrcFile, __LINE__, "UM_TOPDIR %p pci %p", hwnd, pci);
    1818                   }
     1816                      !dcd->suspendview && fTopDir) {
     1817                    PostMsg(hwnd, UM_TOPDIR, MPFROMP(pci), MPVOID);
     1818                    //DbgMsg(pszSrcFile, __LINE__, "UM_TOPDIR %p pci %p", hwnd, pci);
     1819                  }
    18191820                }
    18201821                driveserial[toupper(*pci->pszFileName) - 'A'] = volser.serial;
     
    18291830            }
    18301831            else if (SHORT2FROMMP(mp1) == CN_EXPANDTREE) {
    1831               if (Flesh(hwnd, pci) && !dcd->suspendview && fTopDir){
    1832                 PostMsg(hwnd, UM_TOPDIR, MPFROMP(pci), MPVOID);
    1833                 //DbgMsg(pszSrcFile, __LINE__, "UM_TOPDIR %p pci %p", hwnd, pci);
    1834               }
    1835             }
    1836             if (SHORT2FROMMP(mp1) == CN_EXPANDTREE && !dcd->suspendview){
    1837               WinSendMsg(hwnd, UM_FILTER, MPVOID, MPVOID);
    1838               //DbgMsg(pszSrcFile, __LINE__, "UM_FILTER %p pci %p", hwnd, pci);
    1839             }
     1832              if (Flesh(hwnd, pci) && !dcd->suspendview && fTopDir){
     1833                PostMsg(hwnd, UM_TOPDIR, MPFROMP(pci), MPVOID);
     1834                //DbgMsg(pszSrcFile, __LINE__, "UM_TOPDIR %p pci %p", hwnd, pci);
     1835              }
     1836            }
     1837            if (SHORT2FROMMP(mp1) == CN_EXPANDTREE && !dcd->suspendview){
     1838              WinSendMsg(hwnd, UM_FILTER, MPVOID, MPVOID);
     1839              //DbgMsg(pszSrcFile, __LINE__, "UM_FILTER %p pci %p", hwnd, pci);
     1840            }
    18401841          }
    18411842        }
     
    18971898          (INT) pci != -1 &&
    18981899          !(pci->rc.flRecordAttr & CRA_INUSE) &&
    1899           !(pci->flags & RECFLAGS_ENV) && IsFullName(pci->pszFileName)) {
    1900         x = (INT) (toupper(*pci->pszFileName) - 'A');
     1900          !(pci->flags & RECFLAGS_ENV) && IsFullName(pci->pszFileName)) {
     1901        x = (INT) (toupper(*pci->pszFileName) - 'A');
    19011902        if (driveflags[x] & DRIVE_INVALID) {
    19021903          if (!fAlertBeepOff)
    19031904            DosBeep(50, 100);
    19041905          if (hwndStatus)
    1905             WinSetWindowText(hwndStatus, GetPString(IDS_RESCANSUGTEXT));
    1906           DosReleaseMutexSem(hmtFillingTreeCnr);
     1906            WinSetWindowText(hwndStatus, GetPString(IDS_RESCANSUGTEXT));
     1907          DosReleaseMutexSem(hmtFillingTreeCnr);
    19071908          return 0;
    19081909        }
     
    19231924              }
    19241925            } // for
    1925             RemoveCnrItems(hwnd, pciP, 1, CMA_FREE | CMA_INVALIDATE);
    1926             DosReleaseMutexSem(hmtFillingTreeCnr);
     1926            RemoveCnrItems(hwnd, pciP, 1, CMA_FREE | CMA_INVALIDATE);
     1927            DosReleaseMutexSem(hmtFillingTreeCnr);
    19271928            return 0;
    19281929          }
     
    19361937            CHAR volumelabel[CCHMAXPATH];
    19371938          }
    1938           volser;
    1939           CHAR FileSystem[CCHMAXPATH];
    1940           CHAR szBuf[CCHMAXPATH];
     1939          volser;
     1940          CHAR FileSystem[CCHMAXPATH];
     1941          CHAR szBuf[CCHMAXPATH];
    19411942
    19421943          pciL = pciP = pci;
     
    19551956          if ((driveflags[x] & DRIVE_NOPRESCAN) || (toupper(*pci->pszFileName) > 'B' &&
    19561957               !(driveflags[x] & DRIVE_CDROM))) {
    1957             DriveFlagsOne(x, FileSystem, &volser);
    1958             SelectDriveIcon(pciP);
     1958            DriveFlagsOne(x, FileSystem, &volser);
     1959            SelectDriveIcon(pciP);
    19591960            if (hwndMain)
    19601961              PostMsg(hwndMain, UM_BUILDDRIVEBAR, MPVOID, MPVOID);
     
    19651966                                  FSIL_VOLSER, &volser,
    19661967                                  (ULONG) sizeof(volser));
    1967           if (!status) {
     1968          if (!status) {
    19681969            if (!volser.serial || driveserial[x] != volser.serial) {
    19691970              UnFlesh(hwnd, pciP);
     
    19771978            if (!pciL)
    19781979              Flesh(hwnd, pciP);
    1979             if ((fShowFSTypeInTree || fShowDriveLabelInTree) &&
    1980                 strlen(pciP->pszFileName) < 4) {
    1981               strcpy(szBuf, pciP->pszFileName);
    1982               strcat(szBuf, " [");
    1983               strcat(szBuf, fShowFSTypeInTree ? FileSystem : volser.volumelabel);
    1984               strcat(szBuf, "]");
    1985               pciP->pszDisplayName = xstrdup(szBuf, pszSrcFile, __LINE__);
    1986               pciP->rc.pszIcon = pciP->pszDisplayName;
    1987             }
    1988             WinSendMsg(hwnd,
    1989                        CM_INVALIDATERECORD,
    1990                        MPFROMP(&pciP),
    1991                        MPFROM2SHORT(1, CMA_ERASE | CMA_REPOSITION));
    1992           }
     1980            if ((fShowFSTypeInTree || fShowDriveLabelInTree) &&
     1981                strlen(pciP->pszFileName) < 4) {
     1982              strcpy(szBuf, pciP->pszFileName);
     1983              strcat(szBuf, " [");
     1984              strcat(szBuf, fShowFSTypeInTree ? FileSystem : volser.volumelabel);
     1985              strcat(szBuf, "]");
     1986              pciP->pszDisplayName = xstrdup(szBuf, pszSrcFile, __LINE__);
     1987              pciP->rc.pszIcon = pciP->pszDisplayName;
     1988            }
     1989            WinSendMsg(hwnd,
     1990                       CM_INVALIDATERECORD,
     1991                       MPFROMP(&pciP),
     1992                       MPFROM2SHORT(1, CMA_ERASE | CMA_REPOSITION));
     1993          }
    19931994          else {
    19941995            driveserial[x] = -1;
    19951996            UnFlesh(hwnd, pci);
    19961997            PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
    1997             PostMsg(hwnd, UM_SETUP2, MPFROMP(pci), MPFROMLONG(status));
    1998             DosReleaseMutexSem(hmtFillingTreeCnr);
     1998            PostMsg(hwnd, UM_SETUP2, MPFROMP(pci), MPFROMLONG(status));
     1999            DosReleaseMutexSem(hmtFillingTreeCnr);
    19992000            return 0;
    20002001          }
     
    20182019            if ((shiftstate & (KC_CTRL | KC_ALT)) == (KC_CTRL | KC_ALT)) {
    20192020              PostMsg(hwnd,
    2020                       WM_COMMAND, MPFROM2SHORT(IDM_SHOWALLFILES, 0), MPVOID);
    2021               DosReleaseMutexSem(hmtFillingTreeCnr);
     2021                      WM_COMMAND, MPFROM2SHORT(IDM_SHOWALLFILES, 0), MPVOID);
     2022              DosReleaseMutexSem(hmtFillingTreeCnr);
    20222023              return 0;
    20232024            }
    20242025            if ((shiftstate & (KC_CTRL | KC_SHIFT)) == (KC_CTRL | KC_SHIFT)) {
    2025               OpenObject(pci->pszFileName, Settings, dcd->hwndFrame);
    2026               DosReleaseMutexSem(hmtFillingTreeCnr);
     2026              OpenObject(pci->pszFileName, Settings, dcd->hwndFrame);
     2027              DosReleaseMutexSem(hmtFillingTreeCnr);
    20272028              return 0;
    20282029            }
    20292030            if (!(shiftstate & (KC_CTRL | KC_SHIFT))) {
    20302031              if (!ParentIsDesktop(hwnd, dcd->hwndParent)) {
    2031                 if (FindDirCnrByName(pci->pszFileName, TRUE)) {
    2032                   DosReleaseMutexSem(hmtFillingTreeCnr);
    2033                   return 0;
    2034                 }
     2032                if (FindDirCnrByName(pci->pszFileName, TRUE)) {
     2033                  DosReleaseMutexSem(hmtFillingTreeCnr);
     2034                  return 0;
     2035                }
    20352036              }
    20362037            }
     
    20542055              }
    20552056              OpenObject(pci->pszFileName, s, dcd->hwndFrame);
    2056               DosReleaseMutexSem(hmtFillingTreeCnr);
     2057              DosReleaseMutexSem(hmtFillingTreeCnr);
    20572058              return 0;
    20582059            }
     
    20972098        PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_MKDIR, 0), MPVOID);
    20982099      if (fFollowTree)
    2099         WinSetFocus(HWND_DESKTOP, hwnd);
     2100        WinSetFocus(HWND_DESKTOP, hwnd);
    21002101      DosReleaseMutexSem(hmtFillingTreeCnr);
    21012102    }
     
    23422343          *s = info->device;
    23432344          pci = FindCnrRecord(hwnd, s, NULL, FALSE, FALSE, TRUE);
    2344           if (pci && (INT) pci != -1) {
    2345             INT x = info->device - 'A';
    2346             CHAR  FileSystem[CCHMAXPATH];
     2345          if (pci && (INT) pci != -1) {
     2346            INT x = info->device - 'A';
     2347            CHAR  FileSystem[CCHMAXPATH];
    23472348
    23482349            driveserial[x] = -1;
     
    25882589        runemf2(SEPARATE | WINDOWED | BACKGROUND | MINIMIZED | WAIT,
    25892590                HWND_DESKTOP, pszSrcFile, __LINE__, NULL, NULL,
    2590                 "%s %s", PCSZ_LVMEXE, "/RediscoverPRM");
     2591                "%s %s", PCSZ_LVMEXE, "/RediscoverPRM");
    25912592        PostMsg(hwndTree, WM_COMMAND, MPFROM2SHORT(IDM_RESCAN, 0), MPVOID);
    25922593        break;
     
    27482749
    27492750      case IDM_UPDATE:
    2750         {
     2751        {
    27512752          PCNRITEM pci = (PCNRITEM)CurrentRecord(hwnd);
    2752           if (pci && (INT)pci != -1) {
    2753             struct
    2754             {
    2755               ULONG serial;
    2756               CHAR volumelength;
    2757               CHAR volumelabel[CCHMAXPATH];
    2758             }
    2759             volser;
    2760             INT x = toupper(*pci->pszFileName) - 'A';
    2761             CHAR FileSystem[CCHMAXPATH], szBuf[CCHMAXPATH];
     2753          if (pci && (INT)pci != -1) {
     2754            struct
     2755            {
     2756              ULONG serial;
     2757              CHAR volumelength;
     2758              CHAR volumelabel[CCHMAXPATH];
     2759            }
     2760            volser;
     2761            INT x = toupper(*pci->pszFileName) - 'A';
     2762            CHAR FileSystem[CCHMAXPATH], szBuf[CCHMAXPATH];
    27622763
    27632764            UINT driveflag = driveflags[x];
    27642765            if (pci->attrFile & FILE_DIRECTORY) {
    27652766              if (pci->flags & RECFLAGS_UNDERENV)
    2766                 break;
    2767               DosRequestMutexSem(hmtFillingTreeCnr, SEM_INDEFINITE_WAIT);
     2767                break;
     2768              DosRequestMutexSem(hmtFillingTreeCnr, SEM_INDEFINITE_WAIT);
    27682769              UnFlesh(hwnd, pci);
    27692770              // Check if drive type might need update
    27702771              if ((driveflag & (DRIVE_INVALID | DRIVE_NOPRESCAN)) ||
    2771                   (~driveflag & DRIVE_NOPRESCAN && pci->rc.hptrIcon == hptrDunno)) {
     2772                  (~driveflag & DRIVE_NOPRESCAN && pci->rc.hptrIcon == hptrDunno)) {
    27722773                DriveFlagsOne(x, FileSystem, &volser);
    27732774                driveflag = driveflags[x];
     
    27762777                else  if (strlen(pci->pszFileName) < 4) {
    27772778                  SelectDriveIcon(pci);
    2778                 }
    2779                 if ((fShowFSTypeInTree || fShowDriveLabelInTree) &&
    2780                     strlen(pci->pszFileName) < 4) {
    2781                   strcpy(szBuf, pci->pszFileName);
    2782                   strcat(szBuf, " [");
    2783                   strcat(szBuf, fShowFSTypeInTree ? FileSystem : volser.volumelabel);
    2784                   strcat(szBuf, "]");
    2785                   pci->pszDisplayName = xstrdup(szBuf, pszSrcFile, __LINE__);
    2786                   pci->rc.pszIcon = pci->pszDisplayName;
    2787                 }
     2779                }
     2780                if ((fShowFSTypeInTree || fShowDriveLabelInTree) &&
     2781                    strlen(pci->pszFileName) < 4) {
     2782                  strcpy(szBuf, pci->pszFileName);
     2783                  strcat(szBuf, " [");
     2784                  strcat(szBuf, fShowFSTypeInTree ? FileSystem : volser.volumelabel);
     2785                  strcat(szBuf, "]");
     2786                  pci->pszDisplayName = xstrdup(szBuf, pszSrcFile, __LINE__);
     2787                  pci->rc.pszIcon = pci->pszDisplayName;
     2788                }
    27882789                WinSendMsg(hwnd,
    27892790                           CM_INVALIDATERECORD,
     
    27942795              }
    27952796              if (~driveflag & DRIVE_INVALID)
    2796                 Flesh(hwnd, pci);
    2797               DosReleaseMutexSem(hmtFillingTreeCnr);
     2797                Flesh(hwnd, pci);
     2798              DosReleaseMutexSem(hmtFillingTreeCnr);
    27982799            }
    27992800          }
     
    30043005    return 0;
    30053006
    3006   case WM_TIMER:
    3007     return ActionWMTimer(hwnd, mp1, mp2);
    3008 
    30093007  case WM_SAVEAPPLICATION:
    30103008    if (dcd && !ParentIsDesktop(hwnd, dcd->hwndParent)) {
     
    32383236                                     NULL,
    32393237                                     CCS_AUTOPOSITION | CCS_MINIICONS |
    3240                                      CCS_MINIRECORDCORE, 
     3238                                     CCS_MINIRECORDCORE,
    32413239                                     0,
    32423240                                     0,
     
    32573255        if (ParentIsDesktop(hwndFrame, hwndParent)) {
    32583256          WinSetWindowText(WinWindowFromID(hwndFrame, FID_TITLEBAR), "VTree");
    3259           FixSwitchList(hwndFrame, "VTree");
    3260           DosPostEventSem(hevInitialCnrScanComplete);
    3261           DosCloseEventSem(hevInitialCnrScanComplete);
    3262           fInitialDriveScan = FALSE;
     3257          FixSwitchList(hwndFrame, "VTree");
     3258          DosPostEventSem(hevInitialCnrScanComplete);
     3259          DosCloseEventSem(hevInitialCnrScanComplete);
     3260          fInitialDriveScan = FALSE;
    32633261        }
    32643262        else {
Note: See TracChangeset for help on using the changeset viewer.