summaryrefslogtreecommitdiff
path: root/src/core/stduihist
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-06-04 22:12:02 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-06-04 22:12:02 +0300
commitdc27e48845901137450c303917a322a682104ca3 (patch)
tree5b4907c14fc9aa881d534bf1f5554fbe1aa20b7b /src/core/stduihist
parente8c67aa8819b0ca83726f8606d3ab2b4c7b64188 (diff)
StdUIHist:
- fixes #2907 (StdHistory: add Del hotkey); - fixes #2906 (User history dialog GUI)
Diffstat (limited to 'src/core/stduihist')
-rw-r--r--src/core/stduihist/src/history.cpp29
1 files changed, 27 insertions, 2 deletions
diff --git a/src/core/stduihist/src/history.cpp b/src/core/stduihist/src/history.cpp
index a67df5ffc0..f76bf5c6cb 100644
--- a/src/core/stduihist/src/history.cpp
+++ b/src/core/stduihist/src/history.cpp
@@ -35,6 +35,8 @@ static HGENMENU hContactMenu = nullptr;
/////////////////////////////////////////////////////////////////////////////////////////
// Find dialog window procedure
+static CMStringW g_savedSearch;
+
class CHistoryFindDlg : public CDlgBase
{
public:
@@ -44,10 +46,18 @@ public:
SetParent(hwndParent);
}
+ bool OnInitDialog() override
+ {
+ SetDlgItemText(m_hwnd, IDC_FINDWHAT, g_savedSearch);
+ return true;
+ }
+
bool OnApply() override
{
wchar_t str[128];
GetDlgItemText(m_hwnd, IDC_FINDWHAT, str, _countof(str));
+ g_savedSearch = str;
+
CharUpperW(str);
SendMessage(m_hwndParent, DM_FINDNEXT, 0, (LPARAM)str);
return true;
@@ -163,9 +173,24 @@ static int HistoryDlgResizer(HWND, LPARAM, UTILRESIZECONTROL *urc)
static LRESULT CALLBACK HotkeyProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- if (msg == WM_CHAR)
+ switch (msg) {
+ case WM_CHAR:
if (wParam == 0x06) // Ctrl+F
PostMessage(GetParent(hwndDlg), WM_COMMAND, IDC_FIND, 0);
+ break;
+
+ case WM_KEYDOWN:
+ if (wParam == VK_F3) {
+ wchar_t buf[200];
+ wcsncpy_s(buf, g_savedSearch, _countof(buf)-1);
+ CharUpperW(buf);
+ SendMessage(GetParent(hwndDlg), DM_FINDNEXT, 0, LPARAM(buf));
+ }
+ else if (wParam == VK_DELETE) {
+ PostMessage(GetParent(hwndDlg), WM_COMMAND, IDC_DELETEHISTORY, 0);
+ }
+ break;
+ }
return mir_callNextSubclass(hwndDlg, HotkeyProc, msg, wParam, lParam);
}
@@ -300,7 +325,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP
ptrW wszDescr(DbEvent_GetTextW(&dbei, CP_ACP));
if (wszDescr) {
- CharUpperBuff(wszDescr, (int)mir_wstrlen(wszDescr));
+ CharUpperW(wszDescr);
if (wcsstr(wszDescr, (const wchar_t *)lParam) != nullptr) {
SendDlgItemMessage(hwndDlg, IDC_LIST, LB_SETCURSEL, index, 0);
SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_LIST, LBN_SELCHANGE), 0);