Changeset 3409 for trunk/src


Ignore:
Timestamp:
Apr 16, 2000, 8:26:59 PM (25 years ago)
Author:
cbratschi
Message:

new listview messages and styles, new resources

Location:
trunk/src/comctl32
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/comctl32/CCBase.cpp

    r3369 r3409  
    1 /* $Id: CCBase.cpp,v 1.7 2000-04-12 16:38:58 cbratschi Exp $ */
     1/* $Id: CCBase.cpp,v 1.8 2000-04-16 18:26:55 cbratschi Exp $ */
    22/*
    33 * COMCTL32 Base Functions and Macros for all Controls
     
    346346}
    347347
     348//NOTE for lstrcmpni*: both buffers must be at least shortLen+1 characters long!
     349
     350INT lstrcmpniA(CHAR *textA,CHAR *textB,INT len)
     351{
     352  CHAR tmp1,tmp2;
     353  INT res;
     354
     355  tmp1 = textA[len];
     356  textA[len] = 0;
     357  tmp2 = textB[len];
     358  textB[len] = 0;
     359
     360  res = lstrcmpiA(textA,textB);
     361
     362  textA[len] = tmp1;
     363  textB[len] = tmp2;
     364  return res;
     365}
     366
     367INT lstrcmpniAtoW(CHAR *textA,WCHAR* textB,INT len)
     368{
     369  WCHAR *tmp;
     370  INT res;
     371
     372  tmp = (WCHAR*)COMCTL32_Alloc((len+1)*sizeof(WCHAR));
     373  lstrcpynAtoW(tmp,textA,len+1);
     374
     375  res = lstrcmpniW(tmp,textB,len);
     376
     377  COMCTL32_Free(tmp);
     378  return res;
     379}
     380
     381
     382INT lstrcmpniW(WCHAR *textA,WCHAR *textB,INT len)
     383{
     384  WCHAR tmp1,tmp2;
     385  INT res;
     386
     387  tmp1 = textA[len];
     388  textA[len] = 0;
     389  tmp2 = textB[len];
     390  textB[len] = 0;
     391
     392  res = lstrcmpiW(textA,textB);
     393
     394  textA[len] = tmp1;
     395  textB[len] = tmp2;
     396  return res;
     397}
     398
     399INT lstrcmpniAW(WCHAR *textA,BOOL unicodeA,WCHAR *textB,BOOL unicodeB,INT len)
     400{
     401  if (unicodeA)
     402  {
     403    if (unicodeB)
     404    {
     405      return lstrcmpniW(textA,textB,len);
     406    } else
     407    {
     408      return lstrcmpniAtoW((LPSTR)textB,textA,len);
     409    }
     410  } else
     411  {
     412    if (unicodeB)
     413    {
     414      return lstrcmpniAtoW((LPSTR)textA,textB,len);
     415    } else
     416    {
     417      return lstrcmpniA((LPSTR)textA,(LPSTR)textB,len);
     418    }
     419  }
     420}
     421
    348422CHAR* lstrstrA(CHAR *text,CHAR *subtext)
    349423{
  • trunk/src/comctl32/CCBase.h

    r3369 r3409  
    1 /* $Id: CCBase.h,v 1.8 2000-04-12 16:38:58 cbratschi Exp $ */
     1/* $Id: CCBase.h,v 1.9 2000-04-16 18:26:56 cbratschi Exp $ */
    22/*
    33 * COMCTL32 Base Functions and Macros for all Controls
     
    4646VOID drawStubControl(HWND hwnd,HDC hdc);
    4747
     48#define lstrlenAW(text,unicode) (unicode ? lstrlenW((WCHAR*)text):lstrlenA((CHAR*)text))
     49
     50#define lstrcpyAW(textA,unicodeA,textB,unicodeB) (unicodeA ? (unicodeB ? lstrcpyW((WCHAR*)textA,(WCHAR*)textB):lstrcpyAtoW((WCHAR*)textA,(CHAR*)textB)):(unicodeB ? lstrcpyWtoA((CHAR*)textA,(WCHAR*)textB):lstrcpyA((CHAR*)textA,(CHAR*)textB)))
     51
    4852INT lstrcmpAtoW(CHAR *textA,WCHAR *textW);
    4953INT lstrcmpAW(WCHAR *textA,BOOL textaunicode,WCHAR *textB,BOOL textbunicode);
     54
     55//read note in CCBase.cpp!
     56INT lstrcmpniA(CHAR *textA,CHAR *textB,INT len);
     57INT lstrcmpniAtoW(CHAR *textA,WCHAR* textB,INT len);
     58INT lstrcmpniW(WCHAR *textA,WCHAR *textB,INT len);
     59INT lstrcmpniAW(WCHAR *textA,BOOL unicodeA,WCHAR *textB,BOOL unicodeB,INT len);
    5060
    5161CHAR*  lstrstrA(CHAR *text,CHAR *subtext);
     
    5565WCHAR* lstrstrAW(WCHAR *text,BOOL textunicode,WCHAR *subtext,BOOL subtextunicode);
    5666
     67#define TICKDIFF(start,end) ((end > start) ? (end-start):(0xFFFFFFFF-start+end))
     68
    5769#endif
  • trunk/src/comctl32/comctl32.cpp

    r2875 r3409  
    1 /* $Id: comctl32.cpp,v 1.1 2000-02-23 17:09:40 cbratschi Exp $ */
     1/* $Id: comctl32.cpp,v 1.2 2000-04-16 18:26:57 cbratschi Exp $ */
    22/*
    33 * Win32 common controls implementation
     
    813813 *
    814814 * NOTES
    815  *     Returns version of a comctl32.dll from IE4.01 SP1.
     815 *     IE4.01 SP1:
     816 *       4-72-3110-1
     817 *
     818 *     IE5:
     819 *       5-80-2014-1
    816820 */
    817821
     
    826830    }
    827831
    828     pdvi->dwMajorVersion = 4;
    829     pdvi->dwMinorVersion = 72;
    830     pdvi->dwBuildNumber = 3110;
     832    pdvi->dwMajorVersion = 5;
     833    pdvi->dwMinorVersion = 80;
     834    pdvi->dwBuildNumber = 2014;
    831835    pdvi->dwPlatformID = 1;
    832836
  • trunk/src/comctl32/comctl32.h

    r2820 r3409  
    1 /* $Id: comctl32.h,v 1.12 2000-02-18 17:13:37 cbratschi Exp $ */
     1/* $Id: comctl32.h,v 1.13 2000-04-16 18:26:57 cbratschi Exp $ */
    22/*
    33 * Win32 common controls implementation
     
    9191#define IDB_HIST_LARGE      131
    9292
     93//direction bitmaps
     94#define IDB_DIRECTION_ALL   132
     95#define IDB_DIRECTION_NS    133
     96#define IDB_DIRECTION WE    134
     97
     98//Header filter bitmap
     99#define IDB_HEADER_FILTER   140
     100
     101//cursors
     102#define IDC_COMCTL32_ERROR       20480
     103#define IDC_COMCTL32_INFORMATION 20481
     104#define IDC_COMCTL32_EXCLAMATION 20482
     105
     106#define IDC_COMCTL32_DRAGRECT      102
     107#define IDC_COMCTL32_ARROW1        104
     108#define IDC_COMCTL32_ARROW2        105
     109#define IDC_COMCTL32_DRAGHLINE     106
     110#define IDC_COMCTL32_SPLITHLINE    107
     111#define IDC_COMCTL32_HAND          108
     112#define IDC_COMCTL32_DIRECTION_NS  109
     113#define IDC_COMCTL32_DIRECTION_WE  110
     114#define IDC_COMCTL32_DIRECTION_ALL 111
     115#define IDC_COMCTL32_DIRECTION_N   112
     116#define IDC_COMCTL32_DIRECTION_S   113
     117#define IDC_COMCTL32_DIRECTION_E   114
     118#define IDC_COMCTL32_DIRECTION_W   115
     119#define IDC_COMCTL32_DIRECTION_NE  116
     120#define IDC_COMCTL32_DIRECTION_NW  117
     121#define IDC_COMCTL32_DIRECTION_SE  118
     122#define IDC_COMCTL32_DIRECTION_SW  119
     123
     124#define IDC_COMCTL32_SPLITVLINE    135
     125#define IDC_COMCTL32_ENTER         150
    93126
    94127/* Month calendar month menu popup */
  • trunk/src/comctl32/header.cpp

    r3385 r3409  
    1 /* $Id: header.cpp,v 1.6 2000-04-15 14:22:15 cbratschi Exp $ */
     1/* $Id: header.cpp,v 1.7 2000-04-16 18:26:57 cbratschi Exp $ */
    22/*
    33 *  Header control
     
    88 *
    99 *  TODO:
    10  *   - Control specific cursors (over dividers)
    11  *
    1210 *   - HDS_FILTERBAR
    1311 *   - HEADER_SetHotDivider()
     
    596594              *pFlags |= HHT_ONHEADER;
    597595              *pItem = iCount;
    598 //                      TRACE (header, "ON HEADER %d\n", iCount);
     596
    599597              return;
    600598            }
     
    609607                  *pFlags |= HHT_ONDIVOPEN;
    610608                  *pItem = iCount - 1;
    611 //                              TRACE (header, "ON DIVOPEN %d\n", *pItem);
     609
    612610                  return;
    613611                } else
     
    615613                  *pFlags |= HHT_ONDIVIDER;
    616614                  *pItem = iCount - 1;
    617 //                              TRACE (header, "ON DIVIDER %d\n", *pItem);
     615
    618616                  return;
    619617                }
     
    626624              *pFlags |= HHT_ONDIVIDER;
    627625              *pItem = iCount;
    628 //                      TRACE (header, "ON DIVIDER %d\n", *pItem);
     626
    629627              return;
    630628            }
     
    632630            *pFlags |= HHT_ONHEADER;
    633631            *pItem = iCount;
    634 //                  TRACE (header, "ON HEADER %d\n", iCount);
     632
    635633            return;
    636634          }
     
    648646            *pFlags |= HHT_ONDIVOPEN;
    649647            *pItem = infoPtr->uNumItem - 1;
    650 //                  TRACE (header, "ON DIVOPEN %d\n", *pItem);
     648
    651649            return;
    652650          } else
     
    654652            *pFlags |= HHT_ONDIVIDER;
    655653            *pItem = infoPtr->uNumItem-1;
    656 //                  TRACE (header, "ON DIVIDER %d\n", *pItem);
     654
    657655            return;
    658656          }
     
    661659        *pFlags |= HHT_NOWHERE;
    662660        *pItem = 1;
    663 //          TRACE (header, "NOWHERE\n");
     661
    664662        return;
    665663      }
     
    668666      if (lpPt->x < rect.left)
    669667      {
    670 //         TRACE (header, "TO LEFT\n");
    671668        *pFlags |= HHT_TOLEFT;
    672669      } else if (lpPt->x > rect.right)
    673670      {
    674 //          TRACE (header, "TO LEFT\n");
    675671        *pFlags |= HHT_TORIGHT;
    676672      }
     
    678674      if (lpPt->y < rect.top)
    679675      {
    680 //          TRACE (header, "ABOVE\n");
    681676        *pFlags |= HHT_ABOVE;
    682677      } else if (lpPt->y > rect.bottom)
    683678      {
    684 //          TRACE (header, "BELOW\n");
    685679        *pFlags |= HHT_BELOW;
    686680      }
     
    688682
    689683    *pItem = 1;
    690 //    TRACE (header, "flags=0x%X\n", *pFlags);
     684
    691685    return;
    692686}
     
    973967    HDC hdc;
    974968
    975 //    TRACE(header, "[iItem=%d]\n", iItem);
    976 
    977969    if ((iItem < 0) || (iItem >= (INT)infoPtr->uNumItem)) return FALSE;
    978970
     
    989981    {
    990982      HEADER_ITEM *oldItems = infoPtr->items;
    991 //        TRACE(header, "Complex delete! [iItem=%d]\n", iItem);
    992983
    993984      if (infoPtr->items[iItem].pszText) COMCTL32_Free(infoPtr->items[iItem].pszText);
     
    14081399    lpLayout->pwpos->flags = SWP_NOZORDER;
    14091400
    1410 //    TRACE (header, "Layout x=%d y=%d cx=%d cy=%d\n",
    1411 //           lpLayout->pwpos->x, lpLayout->pwpos->y,
    1412 //           lpLayout->pwpos->cx, lpLayout->pwpos->cy);
    1413 
    14141401    return TRUE;
    14151402}
     
    15391526    infoPtr->hFont = 0;
    15401527    infoPtr->items = 0;
    1541     infoPtr->hcurArrow = LoadCursorA (0, IDC_ARROWA);
    1542     infoPtr->hcurDivider = LoadCursorA (0, IDC_SIZEWEA);
    1543     infoPtr->hcurDivopen = LoadCursorA (0, IDC_SIZENSA);
     1528    infoPtr->hcurArrow = LoadCursorA(0,IDC_ARROWA);
     1529    infoPtr->hcurDivider = LoadCursorA(COMCTL32_hModule,MAKEINTRESOURCEA(IDC_COMCTL32_DRAGHLINE));
     1530    infoPtr->hcurDivopen = LoadCursorA(COMCTL32_hModule,MAKEINTRESOURCEA(IDC_COMCTL32_SPLITHLINE));
    15441531    infoPtr->bCaptured = FALSE;
    15451532    infoPtr->bPressed  = FALSE;
     
    16591646        ReleaseDC (hwnd, hdc);
    16601647
    1661 //      TRACE (header, "Pressed item %d!\n", nItem);
    16621648    } else if ((flags == HHT_ONDIVIDER) || (flags == HHT_ONDIVOPEN))
    16631649    {
     
    16801666            }
    16811667
    1682 //          TRACE (header, "Begin tracking item %d!\n", nItem);
    16831668        }
    16841669    }
     
    18831868          }
    18841869        }
    1885 //          TRACE (header, "Moving pressed item %d!\n", infoPtr->iMoveItem);
    18861870      } else if (infoPtr->bTracking)
    18871871      {
     
    20832067    INT   nItem;
    20842068
    2085 //    TRACE (header, "code=0x%X  id=0x%X\n", LOWORD(lParam), HIWORD(lParam));
    2086 
    20872069    GetCursorPos (&pt);
    20882070    ScreenToClient (hwnd, &pt);
     
    22632245
    22642246        default:
    2265 //            if (msg >= WM_USER)
    2266 //              ERR (header, "unknown msg %04x wp=%04x lp=%08lx\n",
    2267 //                   msg, wParam, lParam );
     2247            //if (msg >= WM_USER)
     2248            //  ERR (header, "unknown msg %04x wp=%04x lp=%08lx\n",
     2249            //       msg, wParam, lParam );
    22682250            return defComCtl32ProcA (hwnd, msg, wParam, lParam);
    22692251    }
  • trunk/src/comctl32/listview.cpp

    r3385 r3409  
    1 /*$Id: listview.cpp,v 1.13 2000-04-15 14:22:19 cbratschi Exp $*/
     1/*$Id: listview.cpp,v 1.14 2000-04-16 18:26:57 cbratschi Exp $*/
    22/*
    33 * Listview control
     
    1515 *   - rcView and origin (need testcase!!!)
    1616 *   - rcView not updated in LVM_SETITEMPOSITION and other messages
     17 *   - many position bugs
     18 *   - work area not used
     19 *   - custom draw
     20 *   - drag'n'drop (-> treeview)
     21 *   - edit timer
    1722 *   - LISTVIEW_SetBkImage
    1823 *   - LISTVIEW_GetBkImage
     
    2126 *   - LVS_OWNERDRAWFIXED
    2227 *   - LVS_EX_*
     28 *       LVS_EX_CHECKBOXES
     29 *       LVS_EX_TRACKSELECT
     30 *       LVS_EX_FULLROWSELECT
     31 *       LVS_EX_ONECLICKACTIVATE
     32 *       LVS_EX_TWOCLICKACTIVATE
     33 *       LVS_EX_FLATSB
     34 *       LVS_EX_REGIONAL
     35 *       LVS_EX_INFOTIP
     36 *       LVS_EX_UNDERLINEHOT
     37 *       LVS_EX_UNDERLINECOLD
     38 *       LVS_EX_MULTIWORKAREAS
    2339 *   - many things untested!
    2440 *
     
    2642 *   LISTVIEW_SetItemCount : not completed
    2743 *
    28  * Advanced functionality:
    29  *   LISTVIEW_GetNumberOfWorkAreas : not implemented
    30  *   LISTVIEW_GetHoverTime : not implemented
    31  *   LISTVIEW_GetISearchString : not implemented
    32  *
     44 * Status: all messages done, many styles not (yet) implemented
     45 * Version: 5.80
    3346 */
    3447
     
    7992#define LISTVIEW_SCROLL_DIV_SIZE 1
    8093
     94#define DEFAULT_HOVERTIME    500
     95#define LV_ISEARCH_DELAY     1000 //documented in ListView_Message_Processing.htm
     96
    8197/*
    8298 * macros
     
    85101/* retrieve the number of items in the listview */
    86102#define GETITEMCOUNT(infoPtr) ((infoPtr)->hdpaItems->nItemCount)
    87 
    88103
    89104HWND CreateEditLabel(LPCSTR text, DWORD style, INT x, INT y,
     
    92107
    93108#define LISTVIEW_GetInfoPtr(hwnd) ((LISTVIEW_INFO*)getInfoPtr(hwnd))
    94 
    95 INT WINAPI COMCTL32_StrCmpNIA(LPCSTR,LPCSTR,INT);
    96 
    97 #define strncasecmp COMCTL32_StrCmpNIA
    98109
    99110/*
     
    965976  {
    966977    LISTVIEW_GetItemPosition(hwnd, i, &ptItem);
     978
    967979    if (PtInRect(&rcSelRect, ptItem) != FALSE)
    968980    {
     
    10141026    POINT ptSelMark;
    10151027    RECT rcSel;
     1028
    10161029    LISTVIEW_GetItemPosition(hwnd, nItem, &ptItem);
    10171030    LISTVIEW_GetItemPosition(hwnd, infoPtr->nSelectionMark, &ptSelMark);
     
    10761089  {
    10771090    if (nItem > 0)
    1078       LISTVIEW_RemoveSelections(hwnd, 0, nItem - 1);
     1091      LISTVIEW_RemoveSelections(hwnd,0,nItem);
    10791092
    10801093    if (nItem < GETITEMCOUNT(infoPtr))
    1081       LISTVIEW_RemoveSelections(hwnd, nItem + 1, GETITEMCOUNT(infoPtr));
     1094      LISTVIEW_RemoveSelections(hwnd,nItem+1,GETITEMCOUNT(infoPtr));
    10821095  } else mask |= LVIS_SELECTED;
    10831096
    1084   LISTVIEW_SetItemState(hwnd,infoPtr->nFocusedItem,0,mask);
     1097
     1098  if (infoPtr->nFocusedItem != nItem) LISTVIEW_SetItemState(hwnd,infoPtr->nFocusedItem,0,mask);
    10851099  LISTVIEW_SetItemState(hwnd,nItem,LVIS_SELECTED | LVIS_FOCUSED,LVIS_SELECTED | LVIS_FOCUSED);
    10861100
     
    12001214  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
    12011215  LISTVIEW_ITEM *lpItem;
    1202 
    1203   while ((lpItem = (LISTVIEW_ITEM*)DPA_GetPtr(infoPtr->hdpaSelItems,0)) != NULL)
    1204   {
    1205     LISTVIEW_SetItemState(hwnd,DPA_GetPtrIndex(infoPtr->hdpaItems,lpItem),0,LVIS_SELECTED);
     1216  INT pos = 0;
     1217
     1218  while ((lpItem = (LISTVIEW_ITEM*)DPA_GetPtr(infoPtr->hdpaSelItems,pos)) != NULL)
     1219  {
     1220    INT nItem = DPA_GetPtrIndex(infoPtr->hdpaItems,lpItem);
     1221
     1222    if ((nItem >= nFirst) && (nItem < nLast))
     1223      LISTVIEW_SetItemState(hwnd,nItem,0,LVIS_SELECTED);
     1224    else
     1225      pos++;
    12061226  }
    12071227}
     
    16571677  /* get information needed for drawing the item */
    16581678  ZeroMemory(&lvItem, sizeof(LVITEMW));
    1659   lvItem.header.mask = LVIF_TEXT;
     1679  lvItem.header.mask = LVIF_TEXT | LVIF_IMAGE;
    16601680  lvItem.header.iItem = nItem;
    16611681  lvItem.header.iSubItem = nSubItem;
     
    16641684  lvItem.mustFree = FALSE;
    16651685  LISTVIEW_GetItem(hwnd,(LPLVITEMW)&lvItem,TRUE,TRUE);
     1686
     1687  if (infoPtr->dwExStyle & LVS_EX_SUBITEMIMAGES)
     1688  {
     1689    /* small icons */
     1690    if (infoPtr->himlSmall)
     1691    {
     1692      ImageList_SetBkColor(infoPtr->himlSmall,CLR_NONE);
     1693      ImageList_Draw(infoPtr->himlSmall,lvItem.header.iImage,hdc,rcItem.left,rcItem.top,ILD_NORMAL);
     1694
     1695      rcItem.left += infoPtr->iconSize.cx;
     1696    }
     1697  }
    16661698
    16671699  /* set item colors */
     
    19151947
    19161948  /* add 1 for displaying a partial item at the bottom */
    1917   nLast = nItem + LISTVIEW_GetCountPerColumn(hwnd)+1;
    1918   nLast = min(nLast, GETITEMCOUNT(infoPtr));
     1949  nLast = nItem+LISTVIEW_GetCountPerColumn(hwnd)+1;
     1950  nLast = min(nLast,GETITEMCOUNT(infoPtr));
    19191951
    19201952  /* send cache hint notification */
     
    19451977  }
    19461978
    1947   for (; nItem < nLast; nItem++)
    1948   {
    1949     for (j = 0; j < nColumnCount; j++)
     1979  for (;nItem < nLast;nItem++)
     1980  {
     1981    for (j = 0;j < nColumnCount;j++)
    19501982    {
    19511983      rcItem = rcHeader[j];
     
    19661998    nDrawPosY += infoPtr->nItemHeight;
    19671999  }
     2000
    19682001DR_END:
     2002  if (infoPtr->dwExStyle & LVS_EX_GRIDLINES)
     2003  {
     2004    HPEN hOldPen;
     2005
     2006    hOldPen = SelectObject(hdc,GetStockObject(BLACK_BRUSH));
     2007    for (j = 0;j < nColumnCount-1;j++)
     2008    {
     2009      MoveToEx(hdc,rcHeader[j].right+REPORT_MARGINX-1,infoPtr->rcList.top,NULL);
     2010      LineTo(hdc,rcHeader[j].right+REPORT_MARGINX-1,infoPtr->rcList.bottom);
     2011    }
     2012    SelectObject(hdc,hOldPen);
     2013  }
     2014
     2015
    19692016  COMCTL32_Free(rcHeader);
    19702017}
     
    34833530}
    34843531
    3485 /* LISTVIEW_GetHoverTime */
     3532static LRESULT LISTVIEW_GetHoverTime(HWND hwnd,WPARAM wParam,LPARAM lParam)
     3533{
     3534  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
     3535
     3536  return (LRESULT)infoPtr->hoverTime;
     3537}
     3538
     3539static LRESULT LISTVIEW_SetHoverTime(HWND hwnd,WPARAM wParam,LPARAM lParam)
     3540{
     3541  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
     3542  INT oldTime = infoPtr->hoverTime;
     3543
     3544  infoPtr->hoverTime = (INT)lParam;
     3545  if (infoPtr->hoverTime == -1) infoPtr->hoverTime = DEFAULT_HOVERTIME;
     3546
     3547  return (LRESULT)oldTime;
     3548}
    34863549
    34873550/***
     
    37553818}
    37563819
    3757 /* LISTVIEW_GetHoverTime */
    3758 
    37593820/***
    37603821 * DESCRIPTION:
     
    38433904}
    38443905
     3906static BOOL LISTVIEW_GetSubItemPosition(HWND hwnd,INT nItem,INT nSubItem,LPPOINT lpptPosition)
     3907{
     3908  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
     3909  RECT rect;
     3910
     3911  if (Header_GetItemRect(infoPtr->hwndHeader,nSubItem,&rect))
     3912  {
     3913    lpptPosition->x = rect.left+REPORT_MARGINX;
     3914    lpptPosition->y = ((nItem-LISTVIEW_GetTopIndex(hwnd))*infoPtr->nItemHeight)+infoPtr->rcList.top;
     3915
     3916    return TRUE;
     3917  }
     3918
     3919  return FALSE;
     3920}
     3921
    38453922/***
    38463923 * DESCRIPTION:
     
    38583935static LRESULT LISTVIEW_GetItemRect(HWND hwnd,INT nItem,LPRECT lprc,INT code)
    38593936{
    3860   LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd);
     3937  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
    38613938  BOOL bResult = FALSE;
    38623939  POINT ptOrigin;
     
    41774254}
    41784255
     4256static LRESULT LISTVIEW_GetSubItemRect(HWND hwnd,INT nItem,LPRECT lprc)
     4257{
     4258  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
     4259  INT nSubItem,code,nLabelWidth;
     4260  POINT ptItem;
     4261
     4262  if (!lprc || (infoPtr->uView != LVS_REPORT) || (nItem < 0) || (nItem >= GETITEMCOUNT(infoPtr))) return FALSE;
     4263
     4264  nSubItem = lprc->top;
     4265  if ((nSubItem < 0) || (nSubItem >= Header_GetItemCount(infoPtr->hwndHeader))) return FALSE;
     4266  if (!LISTVIEW_GetSubItemPosition(hwnd,nItem,nSubItem,&ptItem)) return FALSE;
     4267
     4268  code = lprc->left;
     4269
     4270  switch (code)
     4271  {
     4272    case LVIR_BOUNDS:
     4273      lprc->left = ptItem.x;
     4274      lprc->right = lprc->left;
     4275      lprc->top = ptItem.y;
     4276      lprc->bottom = lprc->top+infoPtr->nItemHeight;
     4277
     4278      if ((infoPtr->dwExStyle & LVS_EX_SUBITEMIMAGES) && infoPtr->himlSmall)
     4279      {
     4280        lprc->right += infoPtr->iconSize.cx;
     4281      }
     4282
     4283      nLabelWidth = LISTVIEW_GetLabelWidth(hwnd,nItem,nSubItem);
     4284      lprc->right += nLabelWidth;
     4285      break;
     4286
     4287    case LVIR_ICON:
     4288      if (infoPtr->dwExStyle & LVS_EX_SUBITEMIMAGES)
     4289      {
     4290        lprc->left = ptItem.x;
     4291        lprc->top = ptItem.y;
     4292        lprc->bottom = lprc->top+infoPtr->nItemHeight;
     4293
     4294        if (infoPtr->himlSmall)
     4295        {
     4296          lprc->right = lprc->left+infoPtr->iconSize.cx;
     4297        } else
     4298        {
     4299          lprc->right = lprc->left;
     4300        }
     4301        break;
     4302      } else return FALSE;
     4303
     4304    case LVIR_LABEL:
     4305      lprc->left = ptItem.x;
     4306      lprc->right = lprc->left;
     4307      lprc->top = ptItem.y;
     4308      lprc->bottom = lprc->top+infoPtr->nItemHeight;
     4309
     4310      nLabelWidth = LISTVIEW_GetLabelWidth(hwnd,nItem,nSubItem);
     4311      lprc->right += nLabelWidth;
     4312      break;
     4313
     4314    default:
     4315      return FALSE;
     4316  }
     4317
     4318  return TRUE;
     4319}
     4320
    41794321/***
    41804322 * DESCRIPTION:
     
    42204362LRESULT LISTVIEW_GetItemSpacing(HWND hwnd, BOOL bSmall)
    42214363{
    4222   LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd);
     4364  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
    42234365  LONG lResult;
    42244366
     
    44504592}
    44514593
    4452 /* LISTVIEW_GetNumberOfWorkAreas */
     4594static LRESULT LISTVIEW_GetNumberOfWorkAreas(HWND hwnd,WPARAM wParam,LPARAM lParam)
     4595{
     4596  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
     4597  LPINT lpuWorkAreas = (LPINT)lParam;
     4598
     4599  if (!lpuWorkAreas) return FALSE;
     4600
     4601  *lpuWorkAreas = infoPtr->nWorkAreas;
     4602
     4603  return TRUE;
     4604}
     4605
     4606static LRESULT LISTVIEW_GetWorkAreas(HWND hwnd,WPARAM wParam,LPARAM lParam)
     4607{
     4608  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
     4609  INT nWorkAreas = (INT)wParam;
     4610  LPRECT lprc = (LPRECT)lParam;
     4611
     4612  if ((nWorkAreas <= 0) || (nWorkAreas > infoPtr->nWorkAreas) || !lprc) return FALSE;
     4613
     4614  for (INT x = 0;x < nWorkAreas;x++)
     4615    lprc[x] = infoPtr->rcWorkAreas[x];
     4616
     4617  return TRUE;
     4618}
     4619
     4620static LRESULT LISTVIEW_SetWorkAreas(HWND hwnd,WPARAM wParam,LPARAM lParam)
     4621{
     4622  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
     4623  INT nWorkAreas = (INT)wParam;
     4624  LPRECT lprc = (LPRECT)lParam;
     4625
     4626  if ((nWorkAreas < 0) || (nWorkAreas > LV_MAX_WORKAREAS)) return FALSE;
     4627
     4628  COMCTL32_Free(infoPtr->rcWorkAreas);
     4629  if ((nWorkAreas == 0) || !lprc)
     4630  {
     4631    infoPtr->nWorkAreas = 0;
     4632    infoPtr->rcWorkAreas = NULL;
     4633  } else
     4634  {
     4635    infoPtr->nWorkAreas = nWorkAreas;
     4636    infoPtr->rcWorkAreas = (LPRECT)COMCTL32_Alloc(nWorkAreas*sizeof(RECT));
     4637    for (INT x = 0;x < nWorkAreas;x++)
     4638     infoPtr->rcWorkAreas[x] = lprc[x];
     4639  }
     4640
     4641  return TRUE;
     4642}
     4643
    44534644
    44544645/***
     
    44664657static LRESULT LISTVIEW_GetOrigin(HWND hwnd, LPPOINT lpptOrigin)
    44674658{
    4468   LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd);
     4659  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
    44694660
    44704661  if ((infoPtr->uView == LVS_SMALLICON) || (infoPtr->uView == LVS_ICON))
     
    45164707static LRESULT LISTVIEW_GetSelectionMark(HWND hwnd)
    45174708{
    4518   LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd);
     4709  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
    45194710
    45204711  return infoPtr->nSelectionMark;
     
    45974788}
    45984789
    4599 static BOOL LISTVIEW_InternalHitTestItem(HWND hwnd,LISTVIEW_INFO *infoPtr,INT nItem,LPLVHITTESTINFO lpHitTestInfo)
     4790static BOOL LISTVIEW_InternalHitTestItem(HWND hwnd,LISTVIEW_INFO *infoPtr,INT nItem,LPLVHITTESTINFO lpHitTestInfo,BOOL checkSubItems)
    46004791{
    46014792  RECT rcItem;
     4793
     4794  if (checkSubItems && (infoPtr->uView == LVS_REPORT))
     4795  {
     4796    INT nColumnCount = Header_GetItemCount(infoPtr->hwndHeader);
     4797    INT xDiff = -infoPtr->lefttop.x*infoPtr->scrollStep.x;
     4798
     4799    rcItem.top = infoPtr->rcList.top+(nItem-LISTVIEW_GetTopIndex(hwnd))*infoPtr->nItemHeight;
     4800    rcItem.bottom = rcItem.top+infoPtr->nItemHeight;
     4801    for (INT x = 0;x < nColumnCount;x++)
     4802    {
     4803      RECT rcColumn;
     4804
     4805      Header_GetItemRect(infoPtr->hwndHeader,x,&rcColumn);
     4806      rcItem.left = xDiff+REPORT_MARGINX+rcColumn.left;
     4807      rcItem.right = xDiff+rcColumn.right-REPORT_MARGINX;
     4808      if (PtInRect(&rcItem,lpHitTestInfo->pt))
     4809      {
     4810        rcItem.top = x;
     4811        rcItem.left = LVIR_BOUNDS;
     4812        if (LISTVIEW_GetSubItemRect(hwnd,nItem,&rcItem) && PtInRect(&rcItem,lpHitTestInfo->pt))
     4813        {
     4814          rcItem.top = x;
     4815          rcItem.left = LVIR_ICON;
     4816          if (LISTVIEW_GetSubItemRect(hwnd,nItem,&rcItem) && PtInRect(&rcItem,lpHitTestInfo->pt))
     4817          {
     4818            lpHitTestInfo->flags = LVHT_ONITEMICON;
     4819            lpHitTestInfo->iItem = nItem;
     4820            lpHitTestInfo->iSubItem = x;
     4821            return TRUE;
     4822          }
     4823
     4824          lpHitTestInfo->flags = LVHT_ONITEMLABEL;
     4825          lpHitTestInfo->iItem = nItem;
     4826          lpHitTestInfo->iSubItem = x;
     4827
     4828          return TRUE;
     4829        }
     4830      }
     4831    }
     4832    return FALSE;
     4833  }
    46024834
    46034835  if (LISTVIEW_GetItemRect(hwnd,nItem,&rcItem,LVIR_BOUNDS))
     
    46574889    if (nItem >= GETITEMCOUNT(infoPtr)) return -1;
    46584890
    4659     if (LISTVIEW_InternalHitTestItem(hwnd,infoPtr,nItem,lpHitTestInfo))
     4891    if (LISTVIEW_InternalHitTestItem(hwnd,infoPtr,nItem,lpHitTestInfo,FALSE))
    46604892      return nItem;
    46614893  } else if (infoPtr->uView == LVS_LIST)
     
    46684900    if (nItem >= GETITEMCOUNT(infoPtr)) return -1;
    46694901
    4670     if (LISTVIEW_InternalHitTestItem(hwnd,infoPtr,nItem,lpHitTestInfo))
     4902    if (LISTVIEW_InternalHitTestItem(hwnd,infoPtr,nItem,lpHitTestInfo,FALSE))
    46714903      return nItem;
    46724904  } else
     
    46764908    for (i = 0; i < GETITEMCOUNT(infoPtr); i++)
    46774909    {
    4678       if (LISTVIEW_InternalHitTestItem(hwnd,infoPtr,i,lpHitTestInfo))
     4910      if (LISTVIEW_InternalHitTestItem(hwnd,infoPtr,i,lpHitTestInfo,FALSE))
    46794911        return i;
    46804912    }
     
    47004932static LRESULT LISTVIEW_HitTest(HWND hwnd, LPLVHITTESTINFO lpHitTestInfo)
    47014933{
    4702   LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd);
     4934  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
    47034935  INT nItem = -1;
    47044936
     
    47084940  {
    47094941    lpHitTestInfo->flags = LVHT_TOLEFT;
    4710   }
    4711   else if (infoPtr->rcList.right < lpHitTestInfo->pt.x)
     4942  } else if (infoPtr->rcList.right < lpHitTestInfo->pt.x)
    47124943  {
    47134944    lpHitTestInfo->flags = LVHT_TORIGHT;
     
    47164947  {
    47174948    lpHitTestInfo->flags |= LVHT_ABOVE;
    4718   }
    4719   else if (infoPtr->rcList.bottom < lpHitTestInfo->pt.y)
     4949  } else if (infoPtr->rcList.bottom < lpHitTestInfo->pt.y)
    47204950  {
    47214951    lpHitTestInfo->flags |= LVHT_BELOW;
     
    47294959  return nItem;
    47304960}
     4961
     4962static LRESULT LISTVIEW_SubItemHitTest(HWND hwnd,LPLVHITTESTINFO lpHitTestInfo)
     4963{
     4964  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
     4965  INT nItem = -1;
     4966  INT nSubItem = -1;
     4967
     4968  lpHitTestInfo->flags = 0;
     4969  if (infoPtr->uView != LVS_REPORT) return -1;
     4970
     4971  if (infoPtr->rcList.left > lpHitTestInfo->pt.x)
     4972  {
     4973    lpHitTestInfo->flags = LVHT_TOLEFT;
     4974  } else if (infoPtr->rcList.right < lpHitTestInfo->pt.x)
     4975  {
     4976    lpHitTestInfo->flags = LVHT_TORIGHT;
     4977  }
     4978  if (infoPtr->rcList.top > lpHitTestInfo->pt.y)
     4979  {
     4980    lpHitTestInfo->flags |= LVHT_ABOVE;
     4981  } else if (infoPtr->rcList.bottom < lpHitTestInfo->pt.y)
     4982  {
     4983    lpHitTestInfo->flags |= LVHT_BELOW;
     4984  }
     4985
     4986  if (lpHitTestInfo->flags == 0)
     4987  {
     4988    INT nTop = LISTVIEW_GetTopIndex(hwnd),nItem;
     4989
     4990    nItem = nTop+((lpHitTestInfo->pt.y-infoPtr->rcList.top)/infoPtr->nItemHeight);
     4991    if (nItem >= GETITEMCOUNT(infoPtr)) return -1;
     4992
     4993    if (LISTVIEW_InternalHitTestItem(hwnd,infoPtr,nItem,lpHitTestInfo,TRUE))
     4994      return lpHitTestInfo->iSubItem;
     4995  }
     4996
     4997  return nSubItem;
     4998}
     4999
    47315000
    47325001/***
     
    54185687  /* store previous style */
    54195688  dwOldStyle = infoPtr->dwExStyle;
     5689
    54205690  /* set new style */
    54215691  infoPtr->dwExStyle = (dwOldStyle & ~dwMask) | (dwStyle & dwMask);
    5422   return (dwOldStyle);
     5692
     5693  //update report view
     5694  if ((((dwOldStyle & LVS_EX_GRIDLINES) != (infoPtr->dwExStyle & LVS_EX_GRIDLINES)) ||
     5695       ((dwOldStyle & LVS_EX_SUBITEMIMAGES) != (infoPtr->dwExStyle & LVS_EX_SUBITEMIMAGES))) &&
     5696      (infoPtr->uView == LVS_REPORT))
     5697  {
     5698    LISTVIEW_Refresh(hwnd);
     5699  }
     5700
     5701  //update header
     5702  if ((dwOldStyle & LVS_EX_HEADERDRAGDROP) != (infoPtr->dwExStyle & LVS_EX_HEADERDRAGDROP))
     5703  {
     5704    if (infoPtr->hwndHeader)
     5705    {
     5706      DWORD dwStyle = GetWindowLongA(infoPtr->hwndHeader,GWL_STYLE);
     5707
     5708      if (infoPtr->dwExStyle & LVS_EX_HEADERDRAGDROP)
     5709        dwStyle |= HDS_DRAGDROP;
     5710      else
     5711        dwStyle &= ~HDS_DRAGDROP;
     5712      SetWindowLongA(infoPtr->hwndHeader,GWL_STYLE,dwStyle);
     5713    }
     5714  }
     5715
     5716  return dwOldStyle;
    54235717}
    54245718
     
    54815775}
    54825776
    5483 /* LISTVIEW_SetIconSpacing */
     5777static LRESULT LISTVIEW_SetIconSpacing(HWND hwnd,WPARAM wParam,LPARAM lParam)
     5778{
     5779  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
     5780  DWORD oldIS = MAKELONG(infoPtr->iconSpacing.cx,infoPtr->iconSpacing.cy);
     5781  INT cx = LOWORD(lParam),cy = HIWORD(lParam);
     5782
     5783  if (cx == -1) cx = GetSystemMetrics(SM_CXICONSPACING);
     5784  if (cy == -1) cy = GetSystemMetrics(SM_CYICONSPACING);
     5785  if ((cx != infoPtr->iconSpacing.cx) || (cy != infoPtr->iconSpacing.cy))
     5786  {
     5787    infoPtr->iconSpacing.cx = cx;
     5788    infoPtr->iconSpacing.cy = cy;
     5789    if (((infoPtr->uView == LVS_ICON) || (infoPtr->uView == LVS_SMALLICON)) && (infoPtr->dwStyle & LVS_AUTOARRANGE))
     5790    {
     5791      LISTVIEW_Arrange(hwnd,LVA_DEFAULT);
     5792    }
     5793  }
     5794
     5795  return oldIS;
     5796}
    54845797
    54855798/***
     
    54985811static LRESULT LISTVIEW_SetImageList(HWND hwnd, INT nType, HIMAGELIST himl)
    54995812{
    5500   LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)LISTVIEW_GetInfoPtr(hwnd);
     5813  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
    55015814  HIMAGELIST himlTemp = 0;
    55025815
     
    58776190
    58786191  infoPtr->nSelectionMark = nIndex;
     6192
    58796193  return nOldIndex;
    58806194}
     
    59326246/* LISTVIEW_SetToolTips */
    59336247/* LISTVIEW_SetUnicodeFormat */
    5934 /* LISTVIEW_SetWorkAreas */
    59356248
    59366249/***
     
    60856398  infoPtr->pedititem = NULL;
    60866399  infoPtr->bDoEditLabel = FALSE;
     6400  infoPtr->hoverTime = DEFAULT_HOVERTIME;
    60876401
    60886402  /* get default font (icon title) */
     
    60996413
    61006414  /* set header font */
    6101   SendMessageA(infoPtr->hwndHeader, WM_SETFONT, (WPARAM)infoPtr->hFont,
    6102                (LPARAM)TRUE);
     6415  SendMessageA(infoPtr->hwndHeader,WM_SETFONT,(WPARAM)infoPtr->hFont,(LPARAM)TRUE);
    61036416
    61046417  if (uView == LVS_ICON)
     
    61066419    infoPtr->iconSize.cx = GetSystemMetrics(SM_CXICON);
    61076420    infoPtr->iconSize.cy = GetSystemMetrics(SM_CYICON);
    6108   }
    6109   else if (uView == LVS_REPORT)
     6421  } else if (uView == LVS_REPORT)
    61106422  {
    61116423    if (!(LVS_NOCOLUMNHEADER & lpcs->style))
     
    61166428    infoPtr->iconSize.cx = GetSystemMetrics(SM_CXSMICON);
    61176429    infoPtr->iconSize.cy = GetSystemMetrics(SM_CYSMICON);
    6118   }
    6119   else
     6430  } else
    61206431  {
    61216432    infoPtr->iconSize.cx = GetSystemMetrics(SM_CXSMICON);
     
    61306441  infoPtr->nItemWidth = LISTVIEW_GetItemWidth(hwnd);
    61316442  infoPtr->nItemHeight = LISTVIEW_GetItemHeight(hwnd);
     6443
     6444  //create tooltip
     6445  infoPtr->hwndToolTip = createToolTip(hwnd,TTF_TRACK | TTF_ABSOLUTE | TTF_TRANSPARENT,TRUE);
     6446  SendMessageA(infoPtr->hwndToolTip,WM_SETFONT,infoPtr->hFont,0);
     6447
    61326448
    61336449  return 0;
     
    64796795}
    64806796
    6481 /************************ Defines that LISTVIEW_ProcessLetterKeys uses *******************************/
    6482 #define KEY_DELAY       900
    6483 #define LISTVIEW_InitLvItemStruct(item,idx,TEXT)  \
    6484                     ZeroMemory(&(item), sizeof(LVITEMA)); \
    6485                     (item).mask = LVIF_TEXT; \
    6486                     (item).iItem = (idx); \
    6487                     (item).iSubItem = 0; \
    6488                     (item).pszText = (CHAR*)&(TEXT); \
    6489                     (item).cchTextMax = MAX_PATH
    6490 
    6491 /************************************************************************************************************************
    6492 * DESCRIPTION:
    6493 *       Processes keyboard messages generated by pressing the letter keys on the keyboard.
    6494 *       Assumes the list is sorted alphabetically, without regard to case.
    6495 *
    6496 * PARAMETERS:
    6497 *       [ I ]   HWND: handle to the window
    6498 *       [ I ]   WPARAM: the character code, the actual character
    6499 *       [ I ]   LPARAM: key data
    6500 *
    6501 *
    6502 * RETURN:
    6503 *       Zero.
    6504 *
    6505 * CHANGE LOG:
    6506 *       Feb 17, 2000 -------------> Creation of function.
    6507 *       Feb 22, 2000 -------------> Added macros.
    6508 * TODO:
    6509 *
    6510 *
    6511 ************************************************************************************************************************/
    6512 static INT LISTVIEW_ProcessLetterKeys( HWND hwnd, WPARAM charCode, LPARAM keyData )
    6513 {
    6514     LISTVIEW_INFO *infoPtr = NULL;
    6515     INT nItem = -1;
    6516     INT nSize = 0;
    6517     INT idx = 0;
    6518     BOOL bFoundMatchingFiles = FALSE;
    6519     LVITEMA item;
    6520     CHAR TEXT[ MAX_PATH ];
    6521     CHAR szCharCode[ 2 ];
    6522     DWORD timeSinceLastKeyPress = 0;
    6523 
    6524     sprintf( szCharCode, "%c", charCode );
    6525 
    6526     /* simple parameter checking  */
    6527     if ( !hwnd || !charCode || !keyData )
    6528         return 0;
    6529 
    6530     infoPtr = (LISTVIEW_INFO*)getInfoPtr(hwnd);
    6531 
    6532     if ( !infoPtr )
    6533         return 0;
    6534 
    6535     /* only allow the valid WM_CHARs through */
    6536     if ( isalnum( charCode ) || charCode == '.' || charCode == '`' || charCode == '!'
    6537           || charCode == '@' || charCode == '#' || charCode == '$' || charCode == '%'
    6538           || charCode == '^' || charCode == '&' || charCode == '*' || charCode == '('
    6539           || charCode == ')' || charCode == '-' || charCode == '_' || charCode == '+'
    6540           || charCode == '=' || charCode == '\\'|| charCode == ']' || charCode == '}'
    6541           || charCode == '[' || charCode == '{' || charCode == '/' || charCode == '?'
    6542           || charCode == '>' || charCode == '<' || charCode == ',' || charCode == '~')
    6543     {
    6544         timeSinceLastKeyPress = GetTickCount();
    6545 
    6546         nSize = GETITEMCOUNT( infoPtr );
    6547         /* if there are 0 items, there is no where to go */
    6548         if ( nSize == 0 )
    6549             return 0;
    6550         /*
    6551          * If the last charCode equals the current charCode then look
    6552          * to the next element in list to see if it matches the previous
    6553          * charCode.
    6554          */
    6555         if ( infoPtr->charCode == charCode )
    6556         {
    6557             if ( timeSinceLastKeyPress - infoPtr->timeSinceLastKeyPress < KEY_DELAY )
    6558             {    /* append new character to search string */
    6559                 lstrcatA( infoPtr->szSearchParam, szCharCode );
    6560                 infoPtr->nSearchParamLength++;
    6561 
    6562                 /* loop from start of list view */
    6563                 for( idx = infoPtr->nFocusedItem; idx < nSize; idx++ )
    6564                 {   /* get item */
    6565                     LISTVIEW_InitLvItemStruct( item, idx, TEXT );
    6566                     LISTVIEW_GetItem(hwnd,(LVITEMW*)&item,FALSE,FALSE);//CB:todo
    6567 
    6568                     /* compare items */
    6569                     if ( strncasecmp( item.pszText, infoPtr->szSearchParam,
    6570                                       infoPtr->nSearchParamLength ) == 0 )
    6571                     {
    6572                         nItem = idx;
    6573                         break;
    6574                     }
    6575                 }
    6576             }
    6577             else if ( infoPtr->timeSinceLastKeyPress > timeSinceLastKeyPress )
    6578             { /* The DWORD went over it's boundery?? Ergo assuming too slow??. */
    6579                 for ( idx = 0; idx < nSize; idx++ )
    6580                 {
    6581                     LISTVIEW_InitLvItemStruct( item, idx, TEXT );
    6582                     LISTVIEW_GetItem(hwnd,(LVITEMW*)&item,FALSE,FALSE);//CB:todo
    6583 
    6584                     if ( strncasecmp( &( item.pszText[ 0 ] ), szCharCode, 1 ) == 0 )
    6585                     {
    6586                         nItem = idx;
    6587                         break;
    6588                     }
    6589                 }
    6590                 lstrcpyA( infoPtr->szSearchParam, szCharCode );
    6591                 infoPtr->nSearchParamLength = 1;
    6592             }
    6593             else
    6594             {   /* Save szCharCode for use in later searches */
    6595                 lstrcpyA( infoPtr->szSearchParam, szCharCode );
    6596                 infoPtr->nSearchParamLength = 1;
    6597 
    6598                 LISTVIEW_InitLvItemStruct( item, infoPtr->nFocusedItem + 1, TEXT );
    6599                 LISTVIEW_GetItem(hwnd,(LVITEMW*)&item,FALSE,FALSE);//CB:todo
    6600 
    6601                 if ( strncasecmp( &( item.pszText[ 0 ] ), szCharCode, 1 ) == 0 )
    6602                     nItem = infoPtr->nFocusedItem + 1;
    6603                 else
    6604                 {   /*
    6605                      * Ok so there are no more folders that match
    6606                      * now we look for files.
    6607                      */
    6608                     for ( idx = infoPtr->nFocusedItem + 1; idx < nSize; idx ++ )
    6609                     {
    6610                         LISTVIEW_InitLvItemStruct( item, idx, TEXT );
    6611                         LISTVIEW_GetItem(hwnd,(LVITEMW*)&item,FALSE,FALSE);//CB:todo
    6612 
    6613                         if ( strncasecmp( &( item.pszText[ 0 ] ), szCharCode, 1 ) == 0 )
    6614                         {
    6615                             nItem = idx;
    6616                             bFoundMatchingFiles = TRUE;
    6617                             break;
    6618                         }
    6619                     }
    6620                     if ( !bFoundMatchingFiles )
    6621                     {  /* go back to first instance */
    6622                         for ( idx = 0; idx < nSize; idx ++ )
    6623                         {
    6624                             LISTVIEW_InitLvItemStruct( item,idx, TEXT );
    6625                             LISTVIEW_GetItem(hwnd,(LVITEMW*)&item,FALSE,FALSE);//CB:todo
    6626 
    6627                             if ( strncasecmp( &( item.pszText[ 0 ] ), szCharCode, 1 ) == 0 )
    6628                             {
    6629                                 nItem = idx;
    6630                                 break;
    6631                             }
    6632                         }
    6633                     }
    6634                 }
    6635             }
    6636         } /*END: if ( infoPtr->charCode == charCode )*/
    6637 
    6638         else /* different keypressed */
    6639         {
    6640             /* could be that they are spelling the file/directory for us */
    6641             if ( timeSinceLastKeyPress - infoPtr->timeSinceLastKeyPress > KEY_DELAY )
    6642             {   /*
    6643                  * Too slow, move to the first instance of the
    6644                  * charCode.
    6645                  */
    6646                 for ( idx = 0; idx < nSize; idx++ )
    6647                 {
    6648                     LISTVIEW_InitLvItemStruct( item,idx, TEXT );
    6649                     LISTVIEW_GetItem(hwnd,(LVITEMW*)&item,FALSE,FALSE);//CB:todo
    6650 
    6651                     if ( strncasecmp( &( item.pszText[ 0 ] ), szCharCode, 1 ) == 0 )
    6652                     {
    6653                         nItem = idx;
    6654                         break;
    6655                     }
    6656                 }
    6657                 lstrcpyA( infoPtr->szSearchParam, szCharCode );
    6658                 infoPtr->nSearchParamLength = 1;
    6659             }
    6660             else if ( infoPtr->timeSinceLastKeyPress > timeSinceLastKeyPress )
    6661             {  /* The DWORD went over it's boundery?? Ergo assuming too slow??. */
    6662                 for ( idx = 0; idx < nSize; idx++ )
    6663                 {
    6664                     LISTVIEW_InitLvItemStruct( item,idx, TEXT );
    6665                     LISTVIEW_GetItem(hwnd,(LVITEMW*)&item,FALSE,FALSE);//CB:todo
    6666 
    6667                     if ( strncasecmp( &( item.pszText[ 0 ] ), szCharCode, 1 ) == 0 )
    6668                     {
    6669                         nItem = idx;
    6670                         break;
    6671                     }
    6672                 }
    6673                 lstrcpyA( infoPtr->szSearchParam, szCharCode );
    6674                 infoPtr->nSearchParamLength = 1;
    6675             }
    6676             else /* Search for the string the user is typing */
    6677             {
    6678                 /* append new character to search string */
    6679                 lstrcatA( infoPtr->szSearchParam, szCharCode );
    6680                 infoPtr->nSearchParamLength++;
    6681 
    6682                 /* loop from start of list view */
    6683                 for( idx = 0; idx < nSize; idx++ )
    6684                 {   /* get item */
    6685                     LISTVIEW_InitLvItemStruct( item, idx, TEXT );
    6686                     LISTVIEW_GetItem(hwnd,(LVITEMW*)&item,FALSE,FALSE);//CB:todo
    6687 
    6688                     /* compare items */
    6689                     if ( strncasecmp( item.pszText, infoPtr->szSearchParam,
    6690                                       infoPtr->nSearchParamLength ) == 0 )
    6691                     {
    6692                         nItem = idx;
    6693                         break;
    6694                     }
    6695                 }
    6696             }
    6697         }/*END: else */
    6698     }
     6797static BOOL LISTVIEW_Compare(HWND hwnd,INT nItem,LPWSTR text,INT textlen,BOOL *matchLast)
     6798{
     6799  BOOL res;
     6800  INT itemlen;
     6801  LVINTERNALITEMW lvItem;
     6802
     6803  ZeroMemory(&lvItem,sizeof(LVITEMW));
     6804  lvItem.header.mask = LVIF_TEXT;
     6805  lvItem.header.iItem = nItem;
     6806  lvItem.header.cchTextMax = DISP_TEXT_SIZE;
     6807  lvItem.mustFree = FALSE;
     6808  LISTVIEW_GetItem(hwnd,(LPLVITEMW)&lvItem,TRUE,TRUE);
     6809
     6810  itemlen = lstrlenAW(lvItem.header.pszText,lvItem.unicode);
     6811  if (itemlen < textlen)
     6812  {
     6813    res = FALSE;
     6814  } else
     6815  {
     6816    res = (lstrcmpniAW(lvItem.header.pszText,lvItem.unicode,text,TRUE,textlen) == 0);
     6817  }
     6818  if (!res && matchLast)
     6819  {
     6820    textlen--;
     6821    if ((textlen > 0) && (itemlen >= textlen))
     6822      *matchLast = (lstrcmpniAW(lvItem.header.pszText,lvItem.unicode,text,TRUE,textlen) == 0);
    66996823    else
    6700         return 0;
    6701 
    6702     LISTVIEW_KeySelection(hwnd, nItem );
    6703 
    6704     /* Store the WM_CHAR for next time */
    6705     infoPtr->charCode = charCode;
    6706 
    6707     /* Store time */
    6708     infoPtr->timeSinceLastKeyPress = timeSinceLastKeyPress;
    6709 
    6710     return 0;
    6711 
    6712 }/*END:LISTVIEW_ProcessLetterKeys( HWND hwndParent, INT nVirtualKey, LONG lKeyData ) */
     6824      *matchLast = FALSE;
     6825  }
     6826  if (lvItem.mustFree) COMCTL32_Free(lvItem.header.pszText);
     6827
     6828  return res;
     6829}
     6830
     6831static INT LISTVIEW_Search(HWND hwnd,LISTVIEW_INFO *infoPtr,INT iItem,LPWSTR text,INT textlen,INT *nearest)
     6832{
     6833  INT start,item;
     6834  BOOL bMatchLast;
     6835
     6836  start = iItem;
     6837  if (nearest) *nearest = -1;
     6838
     6839  //search start to end
     6840  for (item = start;item < GETITEMCOUNT(infoPtr);item++)
     6841  {
     6842    if (nearest)
     6843    {
     6844      if (LISTVIEW_Compare(hwnd,item,text,textlen,(*nearest == -1) ? &bMatchLast:NULL))
     6845        return item;
     6846      else if ((*nearest == -1) && bMatchLast)
     6847        *nearest = item;
     6848    } else
     6849    {
     6850      if (LISTVIEW_Compare(hwnd,item,text,textlen,NULL))
     6851        return item;
     6852    }
     6853  }
     6854
     6855  //search first to start
     6856  for (item = 0;item < start;item++)
     6857  {
     6858    if (nearest)
     6859    {
     6860      if (LISTVIEW_Compare(hwnd,item,text,textlen,(*nearest == -1) ? &bMatchLast:NULL))
     6861        return item;
     6862      else if ((*nearest == -1) && bMatchLast)
     6863        *nearest = item;
     6864    } else
     6865    {
     6866      if (LISTVIEW_Compare(hwnd,item,text,textlen,NULL))
     6867        return item;
     6868    }
     6869  }
     6870
     6871  return -1;
     6872}
     6873
     6874//NOTE: sister function in treeview control -> sync changes
     6875
     6876static VOID LISTVIEW_ISearch(HWND hwnd,CHAR ch)
     6877{
     6878  LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(hwnd);
     6879  LPWSTR newString;
     6880  INT len,item,nearest = -1;
     6881  CHAR ch2[2];
     6882  DWORD dwISearchTime;
     6883  BOOL checkNearest = TRUE;
     6884
     6885  //check timer
     6886  dwISearchTime = GetTickCount();
     6887  if ((infoPtr->uISearchLen > 0) && (TICKDIFF(infoPtr->dwISearchTime,dwISearchTime) > LV_ISEARCH_DELAY))
     6888  {
     6889    COMCTL32_Free(infoPtr->pszISearch);
     6890    infoPtr->pszISearch = NULL;
     6891    infoPtr->uISearchLen = 0;
     6892  }
     6893
     6894  //prepare new search string
     6895  len = infoPtr->uISearchLen+1;
     6896  newString = (WCHAR*)COMCTL32_Alloc((len+1)*sizeof(WCHAR));
     6897
     6898  if (infoPtr->uISearchLen > 0) lstrcpyW(newString,infoPtr->pszISearch);
     6899
     6900  ch2[0] = ch;
     6901  ch2[1] = 0;
     6902  lstrcpyAtoW((LPWSTR)&newString[len-1],(LPSTR)&ch2);
     6903  for (INT x = 1;x < len;x++)
     6904  {
     6905    if (newString[0] != newString[x])
     6906    {
     6907      checkNearest = FALSE;
     6908      break;
     6909    }
     6910  }
     6911
     6912  //search
     6913
     6914  //start with selected item or root
     6915  if (infoPtr->nFocusedItem != -1)
     6916  {
     6917    item = infoPtr->nFocusedItem;
     6918
     6919    //check if new string is valid for old selection
     6920    if (LISTVIEW_Compare(hwnd,item,newString,len,NULL))
     6921      goto ISearchDone;
     6922
     6923    //no match, continue with next item
     6924    item++;
     6925  } else item = 0;
     6926
     6927  //scan
     6928  item = LISTVIEW_Search(hwnd,infoPtr,item,newString,len,checkNearest ? &nearest:NULL);
     6929
     6930  if ((item == -1) && (nearest != -1))
     6931  {
     6932    LISTVIEW_SetSelection(hwnd,nearest);
     6933    LISTVIEW_EnsureVisible(hwnd,nearest,FALSE);
     6934    infoPtr->dwISearchTime = GetTickCount();
     6935
     6936    COMCTL32_Free(newString);
     6937    return;
     6938  }
     6939
     6940ISearchDone:
     6941  //done
     6942  if (item != -1)
     6943  {
     6944    COMCTL32_Free(infoPtr->pszISearch);
     6945    infoPtr->pszISearch = newString;
     6946    infoPtr->uISearchLen = len;
     6947    LISTVIEW_SetSelection(hwnd,item);
     6948    LISTVIEW_EnsureVisible(hwnd,item,FALSE);
     6949    infoPtr->dwISearchTime = GetTickCount();
     6950  } else
     6951  {
     6952    COMCTL32_Free(newString);
     6953    MessageBeep(0xFFFFFFFF);
     6954  }
     6955}
     6956
     6957static LRESULT LISTVIEW_Char(HWND hwnd,WPARAM wParam,LPARAM lParam)
     6958{
     6959  CHAR ch = (CHAR)wParam;
     6960
     6961  LISTVIEW_ISearch(hwnd,ch);
     6962
     6963  return 0;
     6964}
    67136965
    67146966/***
     
    69397191  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
    69407192
     7193  //destroy tooltip
     7194  destroyToolTip(infoPtr->hwndToolTip);
     7195
    69417196  /* delete all items */
    69427197  LISTVIEW_DeleteAllItems(hwnd);
     
    72027457  if (hFont == 0)
    72037458  {
     7459    if (infoPtr->hFont == infoPtr->hDefaultFont) return 0;
    72047460    infoPtr->hFont = infoPtr->hDefaultFont;
    7205   }
    7206   else
    7207   {
     7461  } else
     7462  {
     7463    if (infoPtr->hFont == hFont) return 0;
    72087464    infoPtr->hFont = hFont;
    72097465  }
     
    72127468  {
    72137469    /* set header font */
    7214     SendMessageA(infoPtr->hwndHeader, WM_SETFONT, (WPARAM)hFont,
    7215                    MAKELPARAM(fRedraw, 0));
    7216   }
     7470    SendMessageA(infoPtr->hwndHeader,WM_SETFONT,(WPARAM)hFont,MAKELPARAM(fRedraw,0));
     7471  }
     7472
     7473  //set tooltip font
     7474  SendMessageA(infoPtr->hwndToolTip,WM_SETFONT,(WPARAM)hFont,fRedraw);
    72177475
    72187476  /* invalidate listview control client area */
     
    77357993static LRESULT LISTVIEW_GetISearchString(HWND hwnd,WPARAM wParam,LPARAM lParam,BOOL unicode)
    77367994{
     7995  LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(hwnd);
     7996  LPWSTR lpsz = (LPWSTR)lParam;
     7997
     7998  if (infoPtr->uISearchLen == 0) return 0;
     7999
     8000  if (unicode)
     8001    lstrcpyW(lpsz,infoPtr->pszISearch);
     8002  else
     8003    lstrcpyWtoA((LPSTR)lpsz,infoPtr->pszISearch);
     8004
     8005  return infoPtr->uISearchLen;
     8006}
     8007
     8008static LRESULT LISTVIEW_GetToolTips(HWND hwnd,WPARAM wParam,LPARAM lParam)
     8009{
     8010  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
     8011
     8012  return infoPtr->hwndToolTip;
     8013}
     8014
     8015static LRESULT LISTVIEW_SetToolTips(HWND hwnd,WPARAM wParam,LPARAM lParam)
     8016{
     8017  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO*)LISTVIEW_GetInfoPtr(hwnd);
     8018  HWND oldToolTip = infoPtr->hwndToolTip;
     8019
     8020  infoPtr->hwndToolTip = (HWND)lParam;
     8021
     8022  return oldToolTip;
     8023}
     8024
     8025static LRESULT LISTVIEW_MouseMove(HWND hwnd,WPARAM wParam,LPARAM lParam)
     8026{
    77378027  //CB: todo
    77388028
    7739   return 0;
     8029  return DefWindowProcA(hwnd,WM_MOUSEMOVE,wParam,lParam);
    77408030}
    77418031
     
    77568046      return LISTVIEW_Arrange(hwnd, (INT)wParam);
    77578047
    7758 
    77598048    case LVM_CREATEDRAGIMAGE:
    77608049      return LISTVIEW_CreateDragImage(hwnd,wParam,lParam);
     
    78268115      return LISTVIEW_GetHotItem(hwnd);
    78278116
    7828 /*      case LVM_GETHOVERTIME: */
     8117    case LVM_GETHOVERTIME:
     8118      return LISTVIEW_GetHoverTime(hwnd,wParam,lParam);
    78298119
    78308120    case LVM_GETIMAGELIST:
     
    78678157      return LISTVIEW_GetNextItem(hwnd, (INT)wParam, LOWORD(lParam));
    78688158
    7869 /*      case LVM_GETNUMBEROFWORKAREAS: */
     8159    case LVM_GETNUMBEROFWORKAREAS:
     8160      return LISTVIEW_GetNumberOfWorkAreas(hwnd,wParam,lParam);
    78708161
    78718162    case LVM_GETORIGIN:
     
    78848175      return LISTVIEW_GetStringWidth(hwnd,0,(LPWSTR)lParam,TRUE);
    78858176
    7886 /*      case LVM_GETSUBITEMRECT: */
     8177    case LVM_GETSUBITEMRECT:
     8178      return LISTVIEW_GetSubItemRect(hwnd,(INT)wParam,(LPRECT)lParam);
    78878179
    78888180    case LVM_GETTEXTBKCOLOR:
     
    78928184      return LISTVIEW_GetTextColor(hwnd);
    78938185
    7894 /*      case LVM_GETTOOLTIPS: */
     8186    case LVM_GETTOOLTIPS:
     8187      return LISTVIEW_GetToolTips(hwnd,wParam,lParam);
    78958188
    78968189    case LVM_GETTOPINDEX:
     
    79008193      return LISTVIEW_GetViewRect(hwnd, (LPRECT)lParam);
    79018194
    7902 /*      case LVM_GETWORKAREAS: */
     8195    case LVM_GETWORKAREAS:
     8196      return LISTVIEW_GetWorkAreas(hwnd,wParam,lParam);
    79038197
    79048198    case LVM_HITTEST:
    7905       return LISTVIEW_HitTest(hwnd, (LPLVHITTESTINFO)lParam);
     8199      return LISTVIEW_HitTest(hwnd,(LPLVHITTESTINFO)lParam);
    79068200
    79078201    case LVM_INSERTCOLUMNA:
     
    79568250      return LISTVIEW_SetHotItem(hwnd, (INT)wParam);
    79578251
    7958 /*      case LVM_SETHOVERTIME: */
    7959 /*      case LVM_SETICONSPACING: */
     8252    case LVM_SETHOVERTIME:
     8253      return LISTVIEW_SetHoverTime(hwnd,wParam,lParam);
     8254
     8255    case LVM_SETICONSPACING:
     8256      return LISTVIEW_SetIconSpacing(hwnd,wParam,lParam);
    79608257
    79618258    case LVM_SETIMAGELIST:
     
    79958292      return LISTVIEW_SetTextColor(hwnd, (COLORREF)lParam);
    79968293
    7997 /*      case LVM_SETTOOLTIPS: */
    7998 /*      case LVM_SETWORKAREAS: */
     8294    case LVM_SETTOOLTIPS:
     8295      return LISTVIEW_SetToolTips(hwnd,wParam,lParam);
     8296
     8297    case LVM_SETWORKAREAS:
     8298      return LISTVIEW_SetWorkAreas(hwnd,wParam,lParam);
    79998299
    80008300    case LVM_SORTITEMS:
    80018301      return LISTVIEW_SortItems(hwnd, wParam, lParam);
    80028302
    8003 /*      case LVM_SUBITEMHITTEST: */
     8303    case LVM_SUBITEMHITTEST:
     8304      return LISTVIEW_SubItemHitTest(hwnd,(LPLVHITTESTINFO)lParam);
    80048305
    80058306    case LVM_UPDATE:
     
    80078308
    80088309    case WM_CHAR:
    8009       return LISTVIEW_ProcessLetterKeys( hwnd, wParam, lParam );
     8310      return LISTVIEW_Char(hwnd,wParam,lParam);
    80108311
    80118312    case WM_COMMAND:
     
    80198320
    80208321    case WM_GETDLGCODE:
    8021       return DLGC_WANTCHARS | DLGC_WANTARROWS;
     8322      return DLGC_WANTCHARS | DLGC_WANTTAB | DLGC_WANTARROWS;
    80228323
    80238324    case WM_GETFONT:
     
    80428343      return LISTVIEW_LButtonUp(hwnd,(WORD)wParam,LOWORD(lParam),HIWORD(lParam));
    80438344
    8044 /*      case WM_MOUSEMOVE: */
    8045 /*          return LISTVIEW_MouseMove (hwnd, wParam, lParam); */
     8345    case WM_MOUSEMOVE:
     8346      return LISTVIEW_MouseMove (hwnd,wParam,lParam);
    80468347
    80478348    case WM_NCCREATE:
  • trunk/src/comctl32/rsrc.orc

    r3182 r3409  
    1 /* $Id: rsrc.orc,v 1.3 2000-03-21 17:30:44 cbratschi Exp $ */
     1/* $Id: rsrc.orc,v 1.4 2000-04-16 18:26:59 cbratschi Exp $ */
    22#include "winuser.h"
    33#include "comctl32.h"
     
    104104}
    105105
     106/* 120 */
    106107IDB_STD_SMALL BITMAP LOADONCALL DISCARDABLE
    107108{
     
    222223}
    223224
     225/* 121 */
    224226IDB_STD_LARGE BITMAP LOADONCALL DISCARDABLE
    225227{
     
    400402}
    401403
    402 /* BINRES idb_view_small.bmp */
     404/* 124 */
    403405IDB_VIEW_SMALL BITMAP LOADONCALL DISCARDABLE
    404406{
     
    665667}
    666668
     669/* 125 */
    667670IDB_VIEW_LARGE BITMAP LOADONCALL MOVEABLE DISCARDABLE
    668671{
     
    811814}
    812815
     816/* 130 */
    813817IDB_HIST_SMALL BITMAP LOADONCALL DISCARDABLE
    814818{
     
    854858}
    855859
     860/* 131 */
    856861IDB_HIST_LARGE BITMAP LOADONCALL DISCARDABLE
    857862{
     
    928933}
    929934
     935/* 132 */
     936IDB_DIRECTION_ALL BITMAP LOADONCALL DISCARDABLE
     937{
     938        '42 4D BC 00 00 00 00 00 00 00 3E 00 00 00 28 00'
     939        '00 00 1C 00 00 00 1C 00 00 00 01 00 01 00 00 00'
     940        '00 00 70 00 00 00 00 00 00 00 00 00 00 00 02 00'
     941        '00 00 00 00 00 00 FF FF FF 00 80 80 80 00 00 00'
     942        '00 00 00 00 00 00 00 00 00 00 00 06 00 00 00 0F'
     943        '00 00 00 1F 80 00 00 3F C0 00 00 7F E0 00 00 00'
     944        '00 00 01 00 08 00 03 00 0C 00 07 00 0E 00 0F 06'
     945        '0F 00 1F 0F 0F 80 1F 0F 0F 80 0F 06 0F 00 07 00'
     946        '0E 00 03 00 0C 00 01 00 08 00 00 00 00 00 00 7F'
     947        'E0 00 00 3F C0 00 00 1F 80 00 00 0F 00 00 00 06'
     948        '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     949        '00 00 00 00 00 00 00 00 00 00 00 00'
     950}
     951
     952/* 133 */
     953IDB_DIRECTION_NS BITMAP LOADONCALL DISCARDABLE
     954{
     955        '42 4D BC 00 00 00 00 00 00 00 3E 00 00 00 28 00'
     956        '00 00 1C 00 00 00 1C 00 00 00 01 00 01 00 00 00'
     957        '00 00 70 00 00 00 00 00 00 00 00 00 00 00 02 00'
     958        '00 00 00 00 00 00 FF FF FF 00 80 80 80 00 00 00'
     959        '00 00 00 00 00 00 00 00 00 00 00 06 00 00 00 0F'
     960        '00 00 00 1F 80 00 00 3F C0 00 00 7F E0 00 00 FF'
     961        'F0 00 01 FF F8 00 00 00 00 00 00 00 00 00 00 06'
     962        '00 00 00 0F 00 00 00 0F 00 00 00 06 00 00 00 00'
     963        '00 00 00 00 00 00 01 FF F8 00 00 FF F0 00 00 7F'
     964        'E0 00 00 3F C0 00 00 1F 80 00 00 0F 00 00 00 06'
     965        '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     966        '00 00 00 00 00 00 00 00 00 00 00 00'
     967}
     968
     969/* 134 */
     970IDB_DIRECTION_WE BITMAP LOADONCALL DISCARDABLE
     971{
     972        '42 4D BC 00 00 00 00 00 00 00 3E 00 00 00 28 00'
     973        '00 00 1C 00 00 00 1C 00 00 00 01 00 01 00 00 00'
     974        '00 00 70 00 00 00 00 00 00 00 00 00 00 00 02 00'
     975        '00 00 00 00 00 00 FF FF FF 00 80 80 80 00 00 00'
     976        '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     977        '00 00 00 00 00 00 00 00 00 00 00 40 20 00 00 C0'
     978        '30 00 01 C0 38 00 03 C0 3C 00 07 C0 3E 00 0F C6'
     979        '3F 00 1F CF 3F 80 1F CF 3F 80 0F C6 3F 00 07 C0'
     980        '3E 00 03 C0 3C 00 01 C0 38 00 00 C0 30 00 00 40'
     981        '20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     982        '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     983        '00 00 00 00 00 00 00 00 00 00 00 00'
     984}
     985
     986/* 140 */
     987IDB_HEADER_FILTER BITMAP LOADONCALL DISCARDABLE
     988{
     989        '42 4D D6 00 00 00 00 00 00 00 76 00 00 00 28 00'
     990        '00 00 0D 00 00 00 0C 00 00 00 01 00 04 00 00 00'
     991        '00 00 60 00 00 00 00 00 00 00 00 00 00 00 10 00'
     992        '00 00 00 00 00 00 00 00 00 00 80 00 00 00 00 80'
     993        '00 00 80 80 00 00 00 00 80 00 80 00 80 00 00 80'
     994        '80 00 C0 C0 C0 00 80 80 80 00 FF 00 00 00 00 FF'
     995        '00 00 FF FF 00 00 00 00 FF 00 FF 00 FF 00 00 FF'
     996        'FF 00 FF FF FF 00 44 44 44 44 44 44 40 00 44 44'
     997        '40 00 44 44 40 00 44 44 48 70 44 44 40 00 44 44'
     998        '48 70 44 44 40 00 44 44 48 70 44 44 40 00 44 44'
     999        '48 70 44 44 40 00 44 44 8F 78 04 44 40 00 44 48'
     1000        'F7 77 80 44 40 00 44 8F 77 77 78 04 40 00 48 FF'
     1001        'FF FF FF 80 40 00 48 88 88 88 88 80 40 00 44 44'
     1002        '44 44 44 44 40 00'
     1003}
     1004
     1005/*
     1006#define IDC_COMCTL32_ERROR       20480
     1007#define IDC_COMCTL32_INFORMATION 20481
     1008#define IDC_COMCTL32_EXCLAMATION 20482
     1009*/
     1010
     1011/* 102 */
     1012IDC_COMCTL32_DRAGRECT CURSOR LOADONCALL DISCARDABLE
     1013{
     1014        '00 00 02 00 01 00 20 20 02 00 10 00 10 00 30 01'
     1015        '00 00 16 00 00 00 28 00 00 00 20 00 00 00 40 00'
     1016        '00 00 01 00 01 00 00 00 00 00 00 02 00 00 00 00'
     1017        '00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00'
     1018        '00 00 FF FF FF 00 00 00 00 00 00 00 00 00 00 00'
     1019        'F8 00 0A AA FA A0 15 54 F9 40 08 01 F8 20 10 03'
     1020        'F8 40 08 07 FC 20 10 07 FC 40 08 05 FC 20 10 05'
     1021        'F4 40 08 05 54 20 10 01 54 40 08 01 50 20 10 01'
     1022        '50 40 08 01 50 20 10 00 40 40 08 00 00 20 10 00'
     1023        '00 40 08 00 00 20 10 00 00 40 08 00 00 20 10 00'
     1024        '00 40 0A AA AA A0 15 55 55 40 00 00 00 00 00 00'
     1025        '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     1026        '00 00 00 00 00 00 FF FF FF FF FF FF FF FF FF FF'
     1027        '07 FF F5 55 05 5F EA AB 06 BF F7 FE 07 DF EF FC'
     1028        '07 BF F7 F8 03 DF EF F8 03 BF F7 FA 03 DF EF FA'
     1029        '0B BF F7 FA AB DF EF FE AB BF F7 FE AF DF EF FE'
     1030        'AF BF F7 FE AF DF EF FF BF BF F7 FF FF DF EF FF'
     1031        'FF BF F7 FF FF DF EF FF FF BF F7 FF FF DF EF FF'
     1032        'FF BF F5 55 55 5F EA AA AA BF FF FF FF FF FF FF'
     1033        'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
     1034        'FF FF FF FF FF FF'
     1035}
     1036
     1037/* 104 */
     1038IDC_COMCTL32_ARROW1 CURSOR LOADONCALL DISCARDABLE
     1039{
     1040        '00 00 02 00 01 00 20 20 02 00 00 00 00 00 30 01'
     1041        '00 00 16 00 00 00 28 00 00 00 20 00 00 00 40 00'
     1042        '00 00 01 00 01 00 00 00 00 00 00 02 00 00 00 00'
     1043        '00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00'
     1044        '00 00 FF FF FF 00 00 00 00 00 00 00 00 00 00 00'
     1045        '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     1046        '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     1047        '00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 80'
     1048        '00 00 01 80 00 00 03 00 00 00 03 00 00 00 06 00'
     1049        '00 00 46 00 00 00 6C 00 00 00 7C 00 00 00 7F 80'
     1050        '00 00 7F 00 00 00 7E 00 00 00 7C 00 00 00 78 00'
     1051        '00 00 70 00 00 00 60 00 00 00 40 00 00 00 00 00'
     1052        '00 00 00 00 00 00 FF FF FF FF FF FF FF FF FF FF'
     1053        'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
     1054        'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
     1055        'FF FF FF FF FF FF FF FF FF FF FE 7F FF FF FC 3F'
     1056        'FF FF FC 3F FF FF F8 7F FF FF 78 7F FF FF 30 FF'
     1057        'FF FF 10 FF FF FF 01 FF FF FF 00 3F FF FF 00 3F'
     1058        'FF FF 00 7F FF FF 00 FF FF FF 01 FF FF FF 03 FF'
     1059        'FF FF 07 FF FF FF 0F FF FF FF 1F FF FF FF 3F FF'
     1060        'FF FF 7F FF FF FF'
     1061}
     1062
     1063/* 105 */
     1064IDC_COMCTL32_ARROW2 CURSOR LOADONCALL DISCARDABLE
     1065{
     1066        '00 00 02 00 01 00 20 20 02 00 00 00 00 00 30 01'
     1067        '00 00 16 00 00 00 28 00 00 00 20 00 00 00 40 00'
     1068        '00 00 01 00 01 00 00 00 00 00 00 02 00 00 00 00'
     1069        '00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00'
     1070        '00 00 FF FF FF 00 00 00 00 00 00 00 00 00 00 00'
     1071        '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     1072        '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     1073        '00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 80'
     1074        '00 00 01 80 00 00 03 00 00 00 03 00 00 00 06 00'
     1075        '00 00 46 00 00 00 64 00 00 00 7C 00 00 00 7F 80'
     1076        '00 00 7F 00 00 00 7E 00 00 00 7C 00 00 00 78 00'
     1077        '00 00 70 00 00 00 60 00 00 00 40 00 00 00 00 00'
     1078        '00 00 00 00 00 00 FF FF FF FF FF FF FF FF FF FF'
     1079        'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
     1080        'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
     1081        'FF FF FF FF FF FF FF FF FF FF FE 7F FF FF FC 3F'
     1082        'FF FF FC 3F FF FF F8 7F FF FF F8 7F FF FF 30 FF'
     1083        'FF FF 10 FF FF FF 01 FF FF FF 00 3F FF FF 00 3F'
     1084        'FF FF 00 7F FF FF 00 FF FF FF 01 FF FF FF 03 FF'
     1085        'FF FF 07 FF FF FF 0F FF FF FF 1F FF FF FF 3F FF'
     1086        'FF FF 7F FF FF FF'
     1087}
     1088
     1089/* 106 */
     1090IDC_COMCTL32_DRAGHLINE CURSOR LOADONCALL DISCARDABLE
     1091{
     1092        '00 00 02 00 01 00 20 20 02 00 08 00 08 00 30 01'
     1093        '00 00 16 00 00 00 28 00 00 00 20 00 00 00 40 00'
     1094        '00 00 01 00 01 00 00 00 00 00 00 02 00 00 00 00'
     1095        '00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00'
     1096        '00 00 FF FF FF 00 00 00 00 00 00 00 00 00 00 00'
     1097        '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     1098        '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     1099        '00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 E0'
     1100        '00 00 01 20 00 00 01 20 00 00 01 20 00 00 01 20'
     1101        '00 00 19 26 00 00 29 25 00 00 4F 3C 80 00 80 00'
     1102        '40 00 80 00 40 00 4F 3C 80 00 29 25 00 00 19 26'
     1103        '00 00 01 20 00 00 01 20 00 00 01 20 00 00 01 20'
     1104        '00 00 01 E0 00 00 FF FF FF FF FF FF FF FF FF FF'
     1105        'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
     1106        'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
     1107        'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FE 1F'
     1108        'FF FF FE 1F FF FF FE 1F FF FF FE 1F FF FF FE 1F'
     1109        'FF FF E6 19 FF FF C6 18 FF FF 80 00 7F FF 00 00'
     1110        '3F FF 00 00 3F FF 80 00 7F FF C6 18 FF FF E6 19'
     1111        'FF FF FE 1F FF FF FE 1F FF FF FE 1F FF FF FE 1F'
     1112        'FF FF FE 1F FF FF'
     1113}
     1114
     1115/* 107 */
     1116IDC_COMCTL32_SPLITHLINE CURSOR LOADONCALL DISCARDABLE
     1117{
     1118        '00 00 02 00 01 00 20 20 02 00 08 00 08 00 30 01'
     1119        '00 00 16 00 00 00 28 00 00 00 20 00 00 00 40 00'
     1120        '00 00 01 00 01 00 00 00 00 00 00 02 00 00 00 00'
     1121        '00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00'
     1122        '00 00 FF FF FF 00 00 00 00 00 00 00 00 00 00 00'
     1123        '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     1124        '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
     1125        '00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 F0'
     1126        '00 00 02 D0 00 00 02 D0 00 00 02 D0 00 00 02 D0'
     1127        '00 00 1A D6 00 00 2A D5 00 00 4E DC 80 00 80 C0'
     1128        '40 00 80 C0 40 00 4E DC 80 00 2A D5 00 00 1A D6'
     1129        '00 00 02 D0 00 00 02 D0 00 00 02 D0 00 00 02 D0'
     1130        '00 00 03 F0 00 00 FF FF FF FF FF FF FF FF FF FF'
     1131        'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
     1132        'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF'
     1133        'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FC 0F'
     1134        'FF FF FC 0F FF FF FC 0F FF FF FC 0F FF FF FC 0F'
     1135        'FF FF E4 09 FF FF C4 08 FF FF 80 00 7F FF 00 00'
     1136        '3F FF 00 00 3F FF 80 00 7F FF C4 08 FF FF E4 09'
     1137        'FF FF FC 0F FF FF FC 0F FF FF FC 0F FF FF FC 0F'
     1138        'FF FF FC 0F FF FF'
     1139}
     1140
     1141/*
     1142#define IDC_COMCTL32_HAND          108
     1143#define IDC_COMCTL32_DIRECTION_NS  109
     1144#define IDC_COMCTL32_DIRECTION_WE  110
     1145#define IDC_COMCTL32_DIRECTION_ALL 111
     1146#define IDC_COMCTL32_DIRECTION_N   112
     1147#define IDC_COMCTL32_DIRECTION_S   113
     1148#define IDC_COMCTL32_DIRECTION_E   114
     1149#define IDC_COMCTL32_DIRECTION_W   115
     1150#define IDC_COMCTL32_DIRECTION_NE  116
     1151#define IDC_COMCTL32_DIRECTION_NW  117
     1152#define IDC_COMCTL32_DIRECTION_SE  118
     1153#define IDC_COMCTL32_DIRECTION_SW  119
     1154
     1155#define IDC_COMCTL32_SPLITVLINE    135
     1156#define IDC_COMCTL32_ENTER         150
     1157*/
     1158
    9301159/////////////////////////////////////////////////////////////////////////////
    9311160//
    932 // Version (based on NT 4 SP3 user32.dll)
     1161// Version of the week
     1162//
     1163// based on NT 4 SP3 user32.dll:
     1164//   ProductVersion: 4.72.3110.1
     1165//   FileVersion:    4.72
     1166//
     1167// Windows 2000 (or IE 5 on any system):
     1168//   ProductVersion: 5.00.2014.216
     1169//   FileVersion:    5.80
    9331170//
    9341171
     
    9481185            VALUE "Comments", "Odin32 System Dll\0"
    9491186            VALUE "CompanyName", "Odin Team\0"
    950             VALUE "FileDescription", "COMCTL32 System Dll\0"
    951             VALUE "FileVersion", "4.72.3110.1\0"
     1187            VALUE "FileDescription", "Common Controls Library\0"
     1188            VALUE "FileVersion", "5.80\0"
    9521189            VALUE "InternalName", "COMCTL32\0"
    9531190            VALUE "LegalCopyright", "Copyright (C) 1999-2000\0"
     
    9551192            VALUE "OriginalFilename", "COMCTL32.DLL\0"
    9561193            VALUE "ProductName", "Odin32 - COMCTL32\0"
    957             VALUE "ProductVersion", "4.72.3110.1\0"
     1194            VALUE "ProductVersion", "5.00.2014.216\0"
    9581195        END
    9591196    END
  • trunk/src/comctl32/treeview.cpp

    r3385 r3409  
    1 /* $Id: treeview.cpp,v 1.9 2000-04-15 14:22:31 cbratschi Exp $ */
     1/* $Id: treeview.cpp,v 1.10 2000-04-16 18:26:59 cbratschi Exp $ */
    22/* Treeview control
    33 *
     
    17021702      return 0;
    17031703
    1704     case TV_ISEARCH_TIMER:
    1705       KillTimer(hwnd,TV_ISEARCH_TIMER);
    1706       infoPtr->Timer &= ~TV_ISEARCH_TIMER_SET;
    1707       return 0;
    1708 
    17091704    case TV_INFOTIP_TIMER:
    17101705      TREEVIEW_CheckInfoTip(hwnd);
     
    27602755  infoPtr = (TREEVIEW_INFO*)initControl(hwnd,sizeof(TREEVIEW_INFO));
    27612756
    2762   if (infoPtr == NULL) return 0;
     2757  if (!infoPtr) return 0;
    27632758
    27642759  hdc = GetDC(hwnd);
     
    43854380TREEVIEW_SelectItem (HWND hwnd, WPARAM wParam, LPARAM lParam)
    43864381{
    4387   return TREEVIEW_DoSelectItem (hwnd, wParam, (HTREEITEM) lParam, TVC_UNKNOWN);
     4382  return TREEVIEW_DoSelectItem(hwnd,wParam,(HTREEITEM)lParam,TVC_UNKNOWN);
    43884383}
    43894384
     
    48424837}
    48434838
    4844 static BOOL TREEVIEW_Compare(HWND hwnd,TREEVIEW_ITEM *item,LPWSTR text,INT textlen)
     4839static BOOL TREEVIEW_Compare(HWND hwnd,TREEVIEW_ITEM *item,LPWSTR text,INT textlen,BOOL *matchLast)
    48454840{
    48464841  WCHAR* itemtext;
    48474842  BOOL mustFree = FALSE,res;
     4843  INT itemlen;
    48484844
    48494845  if (item->pszText == LPSTR_TEXTCALLBACKW)
     
    48524848    itemtext = item->pszText;
    48534849
    4854   //simulate lstrcmpniW
    4855   res = (CompareStringW(LOCALE_SYSTEM_DEFAULT,NORM_IGNORECASE,itemtext,MIN(lstrlenW(itemtext),textlen),text,textlen) == 2);
     4850  itemlen = lstrlenW(itemtext);
     4851  if (itemlen < textlen)
     4852  {
     4853    res = FALSE;
     4854  } else
     4855  {
     4856    res = (lstrcmpniW(itemtext,text,textlen) == 0);
     4857  }
     4858  if (!res && matchLast)
     4859  {
     4860    textlen--;
     4861    if ((textlen > 0) && (itemlen >= textlen))
     4862      *matchLast = (lstrcmpniW(itemtext,text,textlen) == 0);
     4863    else
     4864      *matchLast = FALSE;
     4865  }
    48564866  if (mustFree) COMCTL32_Free(itemtext);
    48574867
     
    48594869}
    48604870
    4861 static TREEVIEW_ITEM* TREEVIEW_Search(HWND hwnd,TREEVIEW_INFO *infoPtr,INT iItem,LPWSTR text,INT textlen)
     4871static TREEVIEW_ITEM* TREEVIEW_Search(HWND hwnd,TREEVIEW_INFO *infoPtr,INT iItem,LPWSTR text,INT textlen,TREEVIEW_ITEM **nearest)
    48624872{
    48634873  TREEVIEW_ITEM *item,*start;
    4864   BOOL found = FALSE;
     4874  BOOL bMatchLast;
    48654875
    48664876  item = start = &infoPtr->items[iItem];
     4877  if (nearest) *nearest = NULL;
    48674878
    48684879  //search start to end
    48694880  while (item)
    48704881  {
    4871     if (TREEVIEW_Compare(hwnd,item,text,textlen)) return item;
     4882    if (nearest)
     4883    {
     4884      if (TREEVIEW_Compare(hwnd,item,text,textlen,(!*nearest) ? &bMatchLast:NULL))
     4885        return item;
     4886      else if (!*nearest && bMatchLast)
     4887        *nearest = item;
     4888    } else
     4889    {
     4890      if (TREEVIEW_Compare(hwnd,item,text,textlen,NULL))
     4891        return item;
     4892    }
    48724893    item = TREEVIEW_GetNextListItem(hwnd,infoPtr,item);
    48734894  }
    4874   if (!found)
    4875   {
    4876     iItem = (INT)infoPtr->TopRootItem;
    4877     item = &infoPtr->items[iItem];
    4878 
    4879     //search first to start
    4880     while (item != start)
    4881     {
    4882       if (TREEVIEW_Compare(hwnd,item,text,textlen)) return item;
    4883       item = TREEVIEW_GetNextListItem(hwnd,infoPtr,item);
     4895
     4896  iItem = (INT)infoPtr->TopRootItem;
     4897  item = &infoPtr->items[iItem];
     4898
     4899  //search first to start
     4900  while (item != start)
     4901  {
     4902    if (nearest)
     4903    {
     4904      if (TREEVIEW_Compare(hwnd,item,text,textlen,(!*nearest) ? &bMatchLast:NULL))
     4905        return item;
     4906      else if (!*nearest && bMatchLast)
     4907        *nearest = item;
     4908    } else
     4909    {
     4910      if (TREEVIEW_Compare(hwnd,item,text,textlen,NULL))
     4911        return item;
    48844912    }
     4913    item = TREEVIEW_GetNextListItem(hwnd,infoPtr,item);
    48854914  }
    48864915
     
    48884917}
    48894918
    4890 //CB: this method is CPU intense: optimize it and use a secondary thread
     4919//NOTE: sister function in listview control -> sync changes
    48914920
    48924921static VOID TREEVIEW_ISearch(HWND hwnd,CHAR ch)
     
    48964925  INT len,iItem;
    48974926  CHAR ch2[2];
    4898   TREEVIEW_ITEM *item;
     4927  TREEVIEW_ITEM *item,*nearest = NULL;
     4928  DWORD dwISearchTime;
     4929  BOOL checkNearest = TRUE;
    48994930
    49004931  //check timer
    4901   if (infoPtr->Timer & TV_ISEARCH_TIMER_SET)
    4902   {
    4903     KillTimer(hwnd,TV_ISEARCH_TIMER);
    4904     infoPtr->Timer &= ~TV_ISEARCH_TIMER_SET;
    4905   } else if (infoPtr->uISearchLen > 0)
     4932  dwISearchTime = GetTickCount();
     4933  if ((infoPtr->uISearchLen > 0) && (TICKDIFF(infoPtr->dwISearchTime,dwISearchTime) > TV_ISEARCH_DELAY))
    49064934  {
    49074935    COMCTL32_Free(infoPtr->pszISearch);
     
    49194947  ch2[1] = 0;
    49204948  lstrcpyAtoW((LPWSTR)&newString[len-1],(LPSTR)&ch2);
     4949  for (INT x = 1;x < len;x++)
     4950  {
     4951    if (newString[0] != newString[x])
     4952    {
     4953      checkNearest = FALSE;
     4954      break;
     4955    }
     4956  }
    49214957
    49224958  //search
    49234959
    4924   iItem = infoPtr->selectedItem ? (INT)infoPtr->selectedItem:(INT)infoPtr->TopRootItem;
    4925 
     4960  //start with selected item or root
    49264961  if (infoPtr->selectedItem)
    49274962  {
     4963    iItem = (INT)infoPtr->selectedItem;
    49284964    item = &infoPtr->items[iItem];
     4965
     4966    //check if new string is valid for old selection
     4967    if (TREEVIEW_Compare(hwnd,item,newString,len,NULL))
     4968      goto ISearchDone;
     4969
     4970    //no match, continue with next item
    49294971    item = TREEVIEW_GetNextListItem(hwnd,infoPtr,item);
    49304972    if (!item) item = &infoPtr->items[(INT)infoPtr->TopRootItem];
     
    49324974  } else iItem = (INT)infoPtr->TopRootItem;
    49334975
    4934   item = TREEVIEW_Search(hwnd,infoPtr,iItem,newString,len);
    4935   if (!item && infoPtr->selectedItem && infoPtr->pszISearch)
    4936   {
    4937     TREEVIEW_ITEM *next;
    4938 
    4939     item = &infoPtr->items[iItem];
    4940     next = TREEVIEW_Search(hwnd,infoPtr,(INT)item->hItem,infoPtr->pszISearch,infoPtr->uISearchLen);
    4941     if (next)
    4942     {
    4943       TREEVIEW_SelectItem(hwnd,(WPARAM)TVGN_CARET,(LPARAM)next->hItem);
    4944       TREEVIEW_EnsureVisible(hwnd,next->hItem);
    4945     }
     4976  //scan
     4977  item = TREEVIEW_Search(hwnd,infoPtr,iItem,newString,len,checkNearest ? &nearest:NULL);
     4978
     4979  if (!item && nearest)
     4980  {
     4981    TREEVIEW_SelectItem(hwnd,(WPARAM)TVGN_CARET,(LPARAM)nearest->hItem);
     4982    TREEVIEW_EnsureVisible(hwnd,nearest->hItem);
     4983    infoPtr->dwISearchTime = GetTickCount();
     4984
    49464985    COMCTL32_Free(newString);
    49474986    return;
    49484987  }
    49494988
     4989ISearchDone:
    49504990  //done
    49514991  if (item)
     
    49564996    TREEVIEW_SelectItem(hwnd,(WPARAM)TVGN_CARET,(LPARAM)item->hItem);
    49574997    TREEVIEW_EnsureVisible(hwnd,item->hItem);
    4958     SetTimer(hwnd,TV_ISEARCH_TIMER,TV_ISEARCH_DELAY,0);
    4959     infoPtr->Timer |= TV_ISEARCH_TIMER_SET;
     4998    infoPtr->dwISearchTime = GetTickCount();
    49604999  } else
    49615000  {
Note: See TracChangeset for help on using the changeset viewer.