Changeset 1411 for trunk/dll/treecnr.c


Ignore:
Timestamp:
Mar 29, 2009, 10:33:07 PM (16 years ago)
Author:
Steven Levine
Message:

Rework extended container search to use common logic
Update docs to match code
Shift now reverses configured state of extended container search enable
Backslash optional in not ambiguous

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/treecnr.c

    r1407 r1411  
    6464  08 Mar 09 GKY Renamed commafmt.h i18nutil.h
    6565  08 Mar 09 GKY Additional strings move to PCSZs in init.c
     66  12 Mar 09 SHL Use common SearchContainer
    6667  14 Mar 09 GKY Prevent execution of UM_SHOWME while drive scan is occuring
    6768
     
    625626#     endif
    626627      if (StubbyScanCount != 0) { //prevent treeswitch from hanging fm2 during startup GKY 3-14-09
    627         DosSleep(50);
    628         PostMsg(hwndTree, UM_SHOWME, mp1, MPVOID);
     628        DosSleep(50);
     629        PostMsg(hwndTree, UM_SHOWME, mp1, MPVOID);
    629630      }
    630631      dcd = INSTDATA(hwnd);
     
    971972  static APPNOTIFY *apphead = NULL, *apptail = NULL;
    972973  DIRCNRDATA *dcd = INSTDATA(hwnd);
     974  PCNRITEM pci;
    973975
    974976  switch (msg) {
     
    10001002          PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_DELETE, 0), MPVOID);
    10011003        break;
    1002       }
    1003     }
    1004     if (shiftstate || fNoSearch)
    1005       break;
    1006     if (SHORT1FROMMP(mp1) & KC_CHAR) {
    1007 
    1008       ULONG thistime, len;
    1009       SEARCHSTRING srch;
    1010       PCNRITEM pci;
    1011 
    1012       if (!dcd)
    1013         break;
    1014       switch (SHORT1FROMMP(mp2)) {
    1015       case '\x1b':
    1016       case '\r':
    1017       case '\n':
    1018         dcd->lasttime = 0;
    1019         *dcd->szCommonName = 0;
    1020         break;
    1021       default:
    1022         thistime = WinQueryMsgTime(WinQueryAnchorBlock(hwnd));
    1023         if (thistime > dcd->lasttime + 1250)
    1024           *dcd->szCommonName = 0;
    1025         dcd->lasttime = thistime;
    1026         if (SHORT1FROMMP(mp2) == ' ' && !*dcd->szCommonName)
    1027           break;
    1028       KbdRetry:
    1029         len = strlen(dcd->szCommonName);
    1030         if (len >= CCHMAXPATH - 1) {
    1031           *dcd->szCommonName = 0;
    1032           len = 0;
    1033         }
    1034         dcd->szCommonName[len] = toupper(SHORT1FROMMP(mp2));
    1035         dcd->szCommonName[len + 1] = 0;
    1036         memset(&srch, 0, sizeof(SEARCHSTRING));
    1037         srch.cb = (ULONG) sizeof(SEARCHSTRING);
    1038         srch.pszSearch = (PSZ) dcd->szCommonName;
    1039         srch.fsPrefix = TRUE;
    1040         srch.fsCaseSensitive = FALSE;
    1041         srch.usView = CV_ICON;
    1042         pci = WinSendMsg(hwnd,
    1043                          CM_SEARCHSTRING,
    1044                          MPFROMP(&srch), MPFROMLONG(CMA_FIRST));
    1045         if (pci && (INT) pci != -1) {
    1046           /* make found item current item */
    1047           WinSendMsg(hwnd,
    1048                      CM_SETRECORDEMPHASIS,
    1049                      MPFROMP(pci), MPFROM2SHORT(TRUE, CRA_CURSORED));
    1050           /* make sure that record shows in viewport */
    1051           ShowCnrRecord(hwnd, (PMINIRECORDCORE) pci);
    1052           return (MRESULT) TRUE;
    1053         }
    1054         else {
    1055           if (SHORT1FROMMP(mp2) == ' ') {
    1056             dcd->szCommonName[len] = 0;
    1057             break;
    1058           }
    1059           *dcd->szCommonName = 0;
    1060           dcd->lasttime = 0;
    1061           if (len)                      // retry as first letter if no match
    1062             goto KbdRetry;
    1063         }
    1064         break;
    1065       }
    1066     }
    1067     break;
     1004      } // switch
     1005    }
     1006
     1007    if (SearchContainer(hwnd, msg, mp1, mp2))
     1008      return (MRESULT)TRUE;             // Avoid default handler
     1009
     1010    break;                              // Let default handler see key
    10681011
    10691012  case WM_MOUSEMOVE:
     
    11271070  case UM_FILESMENU:
    11281071    {
    1129       PCNRITEM pci;
    11301072      HWND menuHwnd = (HWND) 0;
    11311073      FSALLOCATE fsa;
     
    12301172          WinSetWindowText(WinWindowFromID(dcd->hwndFrame,
    12311173                                           MAIN_STATUS), pci->pszFileName);
    1232         if (fMoreButtons && hwndName) {
    1233           CHAR szDate[DATE_BUF_BYTES];
    1234 
    1235           DateFormat(szDate, pci->date);
     1174        if (fMoreButtons && hwndName) {
     1175          CHAR szDate[DATE_BUF_BYTES];
     1176
     1177          DateFormat(szDate, pci->date);
    12361178          WinSetWindowText(hwndName, pci->pszFileName);
    12371179          sprintf(str, "%s %02u%s%02u%s%02u", szDate,
    1238                   pci->time.hours, TimeSeparator,
    1239                   pci->time.minutes, TimeSeparator, pci->time.seconds);
     1180                  pci->time.hours, TimeSeparator,
     1181                  pci->time.minutes, TimeSeparator, pci->time.seconds);
    12401182          WinSetWindowText(hwndDate, str);
    12411183          WinSetWindowText(hwndAttr, pci->pszDispAttr);
     
    18471789                UnFlesh(hwnd, pci);
    18481790                PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
    1849                 if (!fAlertBeepOff)
     1791                if (!fAlertBeepOff)
    18501792                  DosBeep(250, 100);
    18511793              }
     
    19161858          !(pci->flags & RECFLAGS_ENV) && IsFullName(pci->pszFileName)) {
    19171859        if (driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_INVALID) {
    1918           if (!fAlertBeepOff)
     1860          if (!fAlertBeepOff)
    19191861            DosBeep(50, 100);
    19201862          if (hwndStatus)
Note: See TracChangeset for help on using the changeset viewer.