Skip to content

Commit

Permalink
keyboard navigation working in find all dialog
Browse files Browse the repository at this point in the history
some tweaks
  • Loading branch information
zodiacon committed Jun 1, 2022
1 parent d419d88 commit 082771d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
4 changes: 2 additions & 2 deletions RegExp/FindAllDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -18,7 +18,7 @@ LRESULT CFindAllDlg::OnCloseCmd(WORD, WORD wID, HWND, BOOL&) {
}

UpdateOptions();
DestroyWindow();
ShowWindow(SW_HIDE);
return 0;
}

Expand Down
18 changes: 13 additions & 5 deletions RegExp/MainFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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;
}

Expand Down
3 changes: 3 additions & 0 deletions RegExp/MainFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include "QuickFilterBar.h"
#include "NavigationManager.h"

class CFindAllDlg;

enum class NodeType {
None = 0,
Key = 1,
Expand Down Expand Up @@ -357,6 +359,7 @@ class CMainFrame :
CString m_QuickFilterText;
CString m_LastKey;
NavigationManager<HTREEITEM> m_Navigation;
CFindAllDlg* m_pFindAll{ nullptr };
bool m_ReadOnly{ true };
bool m_UpdateNoDelay{ false };
bool m_NewLocation{ false };
Expand Down
Binary file modified RegExp/RegExp.rc
Binary file not shown.

0 comments on commit 082771d

Please sign in to comment.