From d79860c10b82a4ead3923e0a4c891c1d238812e7 Mon Sep 17 00:00:00 2001 From: winkies Date: Sat, 3 Oct 2020 16:31:02 +0200 Subject: [PATCH] boincmgr: add CTRL+TAB shortcut --- clientgui/AdvancedFrame.cpp | 29 ++++++++++++++++++++++++----- clientgui/AdvancedFrame.h | 3 ++- clientgui/Events.h | 4 ++++ 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/clientgui/AdvancedFrame.cpp b/clientgui/AdvancedFrame.cpp index 6227a2ffdbf..0d4dfb6e5aa 100644 --- a/clientgui/AdvancedFrame.cpp +++ b/clientgui/AdvancedFrame.cpp @@ -204,6 +204,7 @@ BEGIN_EVENT_TABLE (CAdvancedFrame, CBOINCBaseFrame) EVT_TIMER(ID_REFRESHSTATETIMER, CAdvancedFrame::OnRefreshState) EVT_TIMER(ID_FRAMERENDERTIMER, CAdvancedFrame::OnFrameRender) EVT_NOTEBOOK_PAGE_CHANGED(ID_FRAMENOTEBOOK, CAdvancedFrame::OnNotebookSelectionChanged) + EVT_MENU(ID_NEXT_PAGE, CAdvancedFrame::OnNextPage) EVT_SIZE(CAdvancedFrame::OnSize) EVT_MOVE(CAdvancedFrame::OnMove) #ifdef __WXMAC__ @@ -751,14 +752,17 @@ bool CAdvancedFrame::CreateMenus() { if (m_pOldMenubar) { delete m_pOldMenubar; } - + + m_Shortcuts[1].Set(wxACCEL_CTRL, WXK_TAB, ID_NEXT_PAGE); + #ifdef __WXMAC__ // Set HELP key as keyboard shortcut - m_Shortcuts[0].Set(wxACCEL_NORMAL, WXK_HELP, ID_HELPBOINCMANAGER); - m_pAccelTable = new wxAcceleratorTable(1, m_Shortcuts); - SetAcceleratorTable(*m_pAccelTable); + m_Shortcuts[2].Set(wxACCEL_NORMAL, WXK_HELP, ID_HELPBOINCMANAGER); #endif + m_pAccelTable = new wxAcceleratorTable(3, m_Shortcuts); + SetAcceleratorTable(*m_pAccelTable); + wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::CreateMenu - Function End")); return true; } @@ -1954,13 +1958,28 @@ void CAdvancedFrame::OnNotebookSelectionChanged(wxNotebookEvent& event) { pView = wxDynamicCast(pwndNotebookPage, CBOINCBaseView); wxASSERT(pView); - + pView->RefreshTaskPane(); event.Skip(); wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnNotebookSelectionChanged - Function End")); } +void CAdvancedFrame::OnNextPage( wxCommandEvent& event) { + wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnNextPage - Function Begin")); + + wxWindow* pwndNotebookPage = NULL; + int selection = event.GetSelection(); + + pwndNotebookPage = m_pNotebook->GetPage(selection); + + if ( pwndNotebookPage != NULL ) { + m_pNotebook->AdvanceSelection(true); + } + + wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnNextPage - Function End")); +} + void CAdvancedFrame::UpdateActivityModeControls( CC_STATUS& status ) { wxMenuBar* pMenuBar = GetMenuBar(); wxASSERT(pMenuBar); diff --git a/clientgui/AdvancedFrame.h b/clientgui/AdvancedFrame.h index 0be874df189..34b881b7bac 100644 --- a/clientgui/AdvancedFrame.h +++ b/clientgui/AdvancedFrame.h @@ -65,6 +65,7 @@ class CAdvancedFrame : public CBOINCBaseFrame void OnActivitySelection( wxCommandEvent& event ); void OnGPUSelection( wxCommandEvent& event ); void OnNetworkSelection( wxCommandEvent& event ); + void OnNextPage( wxCommandEvent &event); void OnMenuOpening( wxMenuEvent &event); void OnOptions( wxCommandEvent& event ); @@ -110,7 +111,7 @@ class CAdvancedFrame : public CBOINCBaseFrame protected: virtual int _GetCurrentViewPage(); - wxAcceleratorEntry m_Shortcuts[1]; // For HELP keyboard shortcut + wxAcceleratorEntry m_Shortcuts[3]; // For keyboard shortcut wxAcceleratorTable* m_pAccelTable; private: diff --git a/clientgui/Events.h b/clientgui/Events.h index 0fa6ddd22b5..de520e0faa2 100644 --- a/clientgui/Events.h +++ b/clientgui/Events.h @@ -152,6 +152,10 @@ #define ID_TASK_NEWS_BOINC 9700 #define ID_TASK_NEWS_BOINCWEBSITE 9701 + +// Shortcuts +#define ID_NEXT_PAGE 9801 + // // Simple GUI //