From 082771df7afb620faa68b55bd76b92c2b244d976 Mon Sep 17 00:00:00 2001 From: Pavel Yosifovich Date: Wed, 1 Jun 2022 15:29:36 +0300 Subject: [PATCH] keyboard navigation working in find all dialog some tweaks --- RegExp/FindAllDlg.cpp | 4 ++-- RegExp/MainFrame.cpp | 18 +++++++++++++----- RegExp/MainFrame.h | 3 +++ RegExp/RegExp.rc | Bin 63148 -> 63228 bytes 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/RegExp/FindAllDlg.cpp b/RegExp/FindAllDlg.cpp index 5aaeb9d..1bf0dfd 100644 --- a/RegExp/FindAllDlg.cpp +++ b/RegExp/FindAllDlg.cpp @@ -9,7 +9,7 @@ CFindAllDlg::CFindAllDlg(IMainFrame* frame) : m_pFrame(frame) { LRESULT CFindAllDlg::OnCloseCmd(WORD, WORD wID, HWND, BOOL&) { if (m_Searcher.IsRunning()) { - if (AtlMessageBox(m_hWnd, L"Search is still working. Closing this window will cancel the search. Continue?", + if (AtlMessageBox(m_hWnd, L"Search is still working. Closing this window will cancel the search. Close anyway?", IDS_APP_TITLE, MB_OKCANCEL | MB_ICONWARNING | MB_DEFBUTTON2) == IDNO) return 0; @@ -18,7 +18,7 @@ LRESULT CFindAllDlg::OnCloseCmd(WORD, WORD wID, HWND, BOOL&) { } UpdateOptions(); - DestroyWindow(); + ShowWindow(SW_HIDE); return 0; } diff --git a/RegExp/MainFrame.cpp b/RegExp/MainFrame.cpp index b73650e..850e368 100644 --- a/RegExp/MainFrame.cpp +++ b/RegExp/MainFrame.cpp @@ -34,6 +34,9 @@ BOOL CMainFrame::PreTranslateMessage(MSG* pMsg) { if (m_FindDlg.IsWindowVisible() && ::GetActiveWindow() == m_FindDlg && m_FindDlg.IsDialogMessage(pMsg)) return TRUE; + if (m_pFindAll && m_pFindAll->IsDialogMessageW(pMsg)) + return TRUE; + auto hFocus = ::GetFocus(); WCHAR name[8]; if (hFocus == m_AddressBar || (::GetClassName(hFocus, name, _countof(name)) && ::_wcsicmp(name, L"EDIT") == 0)) @@ -1096,11 +1099,16 @@ LRESULT CMainFrame::OnKnownLocation(WORD, WORD id, HWND, BOOL&) { } LRESULT CMainFrame::OnFindAll(WORD, WORD, HWND, BOOL&) { - auto dlg = new CFindAllDlg(this); - dlg->Create(nullptr); - dlg->ShowWindow(SW_SHOW); - ::SetForegroundWindow(dlg->m_hWnd); - + if (!m_pFindAll) { + auto dlg = new CFindAllDlg(this); + dlg->Create(nullptr); + dlg->ShowWindow(SW_SHOW); + ::SetForegroundWindow(dlg->m_hWnd); + m_pFindAll = dlg; + } + else { + m_pFindAll->ShowWindow(SW_SHOW); + } return 0; } diff --git a/RegExp/MainFrame.h b/RegExp/MainFrame.h index c699387..dae4da3 100644 --- a/RegExp/MainFrame.h +++ b/RegExp/MainFrame.h @@ -17,6 +17,8 @@ #include "QuickFilterBar.h" #include "NavigationManager.h" +class CFindAllDlg; + enum class NodeType { None = 0, Key = 1, @@ -357,6 +359,7 @@ class CMainFrame : CString m_QuickFilterText; CString m_LastKey; NavigationManager m_Navigation; + CFindAllDlg* m_pFindAll{ nullptr }; bool m_ReadOnly{ true }; bool m_UpdateNoDelay{ false }; bool m_NewLocation{ false }; diff --git a/RegExp/RegExp.rc b/RegExp/RegExp.rc index 959a253abe7d9c4e6702231bfce41eb31e4c60cc..47a0c856c4ce9def071c3444316952eb11931487 100644 GIT binary patch delta 98 zcmZ4Umif+M*Hb3e-l>-0?RUYa9 delta 44 zcmV+{0Mq~c?E|ds1F#;0lN^~6lm2xGvvPyH0h7*+E|U<45VQDqssxiBiw3hYipp%{ CPZYEO