diff options
author | Robert Pösel <robyer@seznam.cz> | 2012-07-19 10:37:35 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2012-07-19 10:37:35 +0000 |
commit | 41ca8e063b7948356854ae6a6f26c7550a940a41 (patch) | |
tree | 0d82931c7842cb81e002a4798842fad6fe2b5163 /plugins/Clist_modern/src/modern_clc.cpp | |
parent | 3b94f5999249803fde203c39e46c613d1658b704 (diff) |
Improved searching feature and related things.
git-svn-id: http://svn.miranda-ng.org/main/trunk@1041 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_modern/src/modern_clc.cpp')
-rw-r--r-- | plugins/Clist_modern/src/modern_clc.cpp | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 3b6034128d..bd4b53c681 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -333,8 +333,12 @@ static int clcSearchNextContact(HWND hwnd, struct ClcData *dat, int index, const }
if (group->cl.items[group->scanIndex]->type != CLCIT_DIVIDER)
{
- if ((prefixOk && CSTR_EQUAL == CompareString(LOCALE_INVARIANT, NORM_IGNORECASE, text, -1, group->cl.items[group->scanIndex]->szText, testlen)) ||
- (!prefixOk && !lstrcmpi(text, group->cl.items[group->scanIndex]->szText)))
+ TCHAR* lowered = CharLowerW(NEWTSTR_ALLOCA(group->cl.items[group->scanIndex]->szText));
+ if (_tcsstr(lowered, dat->szQuickSearch))
+
+ //if ((prefixOk && CSTR_EQUAL == CompareString(LOCALE_INVARIANT, NORM_IGNORECASE, text, -1, group->cl.items[group->scanIndex]->szText, testlen)) ||
+ // (!prefixOk && !lstrcmpi(text, group->cl.items[group->scanIndex]->szText)))
+
{
struct ClcGroup *contactGroup = group;
int contactScanIndex = group->scanIndex;
@@ -625,7 +629,18 @@ static LRESULT clcOnKeyDown(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wPa case VK_END: dat->selection = pcli->pfnGetGroupContentsCount(&dat->list,1)-1; selMoved = 1; break;
case VK_LEFT: changeGroupExpand = 1; break;
case VK_RIGHT: changeGroupExpand = 2; break;
- case VK_RETURN: pcli->pfnDoSelectionDefaultAction(hwnd,dat); SetCapture(hwnd); return 0;
+ case VK_RETURN: pcli->pfnDoSelectionDefaultAction(hwnd,dat); SetCapture(hwnd);
+
+ // TODO: clear filtering here somehow?
+ if (dat->filterSearch) {
+ dat->szQuickSearch[0] = 0;
+ pcli->pfnSaveStateAndRebuildList(hwnd, dat);
+ //pcli->pfnInvalidateRect(hwnd, NULL, FALSE);
+ } else {
+ dat->szQuickSearch[0] = 0;
+ }
+
+ return 0;
case VK_F2: cliBeginRenameSelection(hwnd,dat); /*SetCapture(hwnd);*/ return 0;
case VK_DELETE: pcli->pfnDeleteFromContactList(hwnd,dat); SetCapture(hwnd);return 0;
case VK_ESCAPE:
@@ -636,6 +651,10 @@ static LRESULT clcOnKeyDown(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wPa dat->iInsertionMark = -1;
dat->dragStage = 0;
ReleaseCapture();
+ } else if (dat->filterSearch && dat->szQuickSearch[0] != '\0') {
+ dat->szQuickSearch[0] = 0;
+ pcli->pfnSaveStateAndRebuildList(hwnd, dat);
+ //pcli->pfnInvalidateRect(hwnd, NULL, FALSE);
}
return 0;
}
@@ -660,7 +679,7 @@ static LRESULT clcOnKeyDown(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wPa int hit;
struct ClcContact *contact;
struct ClcGroup *group;
- dat->szQuickSearch[0] = 0;
+ //dat->szQuickSearch[0] = 0;
hit = cliGetRowByIndex(dat,dat->selection,&contact,&group);
if (hit != -1)
{
@@ -761,7 +780,7 @@ static LRESULT clcOnKeyDown(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wPa }
if (selMoved)
{
- dat->szQuickSearch[0] = 0;
+ //dat->szQuickSearch[0] = 0;
if (dat->selection >= pcli->pfnGetGroupContentsCount(&dat->list,1))
dat->selection = pcli->pfnGetGroupContentsCount(&dat->list,1)-1;
if (dat->selection < 0) dat->selection = 0;
@@ -927,7 +946,7 @@ static LRESULT clcOnLButtonDown(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM pcli->pfnEndRename(hwnd,dat,1);
dat->ptDragStart.x = (short)LOWORD(lParam);
dat->ptDragStart.y = (short)HIWORD(lParam);
- dat->szQuickSearch[0] = 0;
+ //dat->szQuickSearch[0] = 0;
hit = cliHitTest(hwnd,dat,(short)LOWORD(lParam),(short)HIWORD(lParam),&contact,&group,&hitFlags);
if (GetFocus() != hwnd) SetFocus(hwnd);
if (hit != -1 && !(hitFlags&CLCHT_NOWHERE))
|