From 966de6f48098ae0a11067c7f1eca262712118531 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 21 Nov 2013 21:52:18 +0000 Subject: timer for clearing plugin's name filter git-svn-id: http://svn.miranda-ng.org/main/trunk@6956 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/plugins/pluginopts.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'src/modules/plugins') diff --git a/src/modules/plugins/pluginopts.cpp b/src/modules/plugins/pluginopts.cpp index 9aaedd74fd..d3b362ad84 100644 --- a/src/modules/plugins/pluginopts.cpp +++ b/src/modules/plugins/pluginopts.cpp @@ -32,6 +32,7 @@ HANDLE hevLoadModule, hevUnloadModule; bool bOldMode = false; static CMString szFilter; +static UINT_PTR timerID; ///////////////////////////////////////////////////////////////////////////////////////// // Plugins options page dialog @@ -225,10 +226,14 @@ static LRESULT CALLBACK PluginListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LP lvfi.flags = LVFI_PARAM; lvfi.lParam = (LPARAM)p; int idx = ListView_FindItem(hwnd, 0, &lvfi); - if (idx != -1) { - ListView_SetItemState(hwnd, idx, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); - ListView_EnsureVisible(hwnd, idx, FALSE); - } + if (idx == -1) + continue; + + ListView_SetItemState(hwnd, idx, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); + ListView_EnsureVisible(hwnd, idx, FALSE); + if (timerID != 0) + KillTimer(hwnd, timerID); + timerID = SetTimer(hwnd, 1, 1500, 0); return TRUE; } } @@ -238,6 +243,14 @@ static LRESULT CALLBACK PluginListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LP } return TRUE; + case WM_TIMER: + if (wParam == 1) { + KillTimer(hwnd, timerID); + timerID = 0; + szFilter.Empty(); + } + break; + case WM_LBUTTONDOWN: LVHITTESTINFO hi; hi.pt.x = LOWORD(lParam); hi.pt.y = HIWORD(lParam); @@ -291,6 +304,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); + timerID = 0; { HWND hwndList = GetDlgItem(hwndDlg, IDC_PLUGLIST); mir_subclassWindow(hwndList, PluginListWndProc); -- cgit v1.2.3