Changeset 1854


Ignore:
Timestamp:
Aug 18, 2015, 6:55:46 PM (10 years ago)
Author:
Steven Levine
Message:

Clean up and comment

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/findrec.c

    r1673 r1854  
    55
    66  Copyright (c) 1993-98 M. Kimes
    7   Copyright (c) 2003, 2008 Steven H.Levine
     7  Copyright (c) 2003, 2015 Steven H.Levine
    88
    99  Find records
     
    1111  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
    1212  28 Dec 08 GKY Containers will only scroll to the right if needed to show end of selected
    13                 item and will scroll left to eliminate space after a selected item. Ticket 204
     13                item and will scroll left to eliminate space after a selected item. Ticket 204
     14  06 Aug 15 SHL Clean up and comment
    1415
    1516***********************************************************************/
     
    5657  srch.fsPrefix = FALSE;
    5758  srch.fsCaseSensitive = FALSE;
    58   srch.usView = CV_TREE;               
     59  srch.usView = CV_TREE;
    5960  if (!pciParent)
    6061    pciParent = (PCNRITEM) CMA_FIRST;
     
    6364  while (pci && (INT) pci != -1) {
    6465    if (!noenv || (pci->flags & (RECFLAGS_ENV | RECFLAGS_UNDERENV)) == 0) {
    65       if (!partmatch) {                 // full name must match full name
     66      // CNRITEM for file/directory
     67      if (!partmatch) {                 // file name must match full name
    6668        if (!stricmp(pci->pszFileName, filename))
    67           return pci;                   // success
     69          return pci;                   // got full match
    6870      }
    6971      else {                            // only root name must match
    70         if (strlen(pci->pszFileName) > 3) {
     72        // partial match
     73        if (strlen(pci->pszFileName) <= 3)
     74          p = pci->pszFileName;                 // Root
     75        else {
    7176          p = strrchr(pci->pszFileName, '\\');
    72           if (!p) {
     77          if (p)
     78            p++;                        // After slash
     79          else {
    7380            p = strrchr(pci->pszFileName, ':');
    7481            if (p)
    75               p++;
     82              p++;                      // After colon
    7683            else
    77               p = pci->pszFileName;
     84              p = pci->pszFileName;     // Must be bare file name
    7885          }
    79           else
    80             p++;
    8186        }
    82         else
    83           p = pci->pszFileName;
    8487        if (!stricmp(p, file))
    85           return pci;                   // success
     88          return pci;                   // got partial match
    8689      }
    8790    }
     
    124127  qrecrct.fsExtent = (CMA_ICON | CMA_TEXT | CMA_TREEICON);
    125128  if (!WinSendMsg(hwndCnr,
    126                   CM_QUERYRECORDRECT, MPFROMP(&rcl), MPFROMP(&qrecrct))) {
     129                  CM_QUERYRECORDRECT, MPFROMP(&rcl), MPFROMP(&qrecrct))) {
    127130    qrecrct.fsExtent = CMA_TEXT | CMA_TREEICON;
    128131    WinSendMsg(hwndCnr, CM_QUERYRECORDRECT, MPFROMP(&rcl), MPFROMP(&qrecrct));
     
    130133  WinSendMsg(hwndCnr,
    131134             CM_QUERYVIEWPORTRECT,
    132              MPFROMP(&rclViewport), MPFROM2SHORT(CMA_WINDOW, TRUE));
     135             MPFROMP(&rclViewport), MPFROM2SHORT(CMA_WINDOW, TRUE));
    133136  //DbgMsg(pszSrcFile, __LINE__, "TOPPORT %i TOPRCL %i", rclViewport.yTop , rcl.yTop);
    134137  WinSendMsg(hwndCnr,
    135138             CM_SCROLLWINDOW,
    136              MPFROMSHORT(CMA_HORIZONTAL), MPFROMLONG(rcl.xRight - rclViewport.xRight));
     139             MPFROMSHORT(CMA_HORIZONTAL), MPFROMLONG(rcl.xRight - rclViewport.xRight));
    137140  WinSendMsg(hwndCnr,
    138141             CM_SCROLLWINDOW,
    139142             MPFROMSHORT(CMA_VERTICAL),
    140              MPFROMLONG((rclViewport.yTop - (rcl.yTop) - 4)));
     143             MPFROMLONG((rclViewport.yTop - (rcl.yTop) - 4)));
    141144}
    142145
Note: See TracChangeset for help on using the changeset viewer.