Skip to content

Commit

Permalink
boincmgr: add CTRL+Shift+TAB shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
winkies committed Jan 12, 2021
1 parent 0737682 commit cbd87af
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 13 deletions.
39 changes: 29 additions & 10 deletions clientgui/AdvancedFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ BEGIN_EVENT_TABLE (CAdvancedFrame, CBOINCBaseFrame)
EVT_TIMER(ID_FRAMERENDERTIMER, CAdvancedFrame::OnFrameRender)
EVT_NOTEBOOK_PAGE_CHANGED(ID_FRAMENOTEBOOK, CAdvancedFrame::OnNotebookSelectionChanged)
EVT_MENU(ID_SELECTALL, CAdvancedFrame::OnSelectAll)
EVT_MENU(ID_NEXT_PAGE, CAdvancedFrame::OnNextPage)
EVT_MENU(ID_NEXTPAGE, CAdvancedFrame::OnNextPage)
EVT_MENU(ID_PREVPAGE, CAdvancedFrame::OnPrevPage)
EVT_SIZE(CAdvancedFrame::OnSize)
EVT_MOVE(CAdvancedFrame::OnMove)
#ifdef __WXMAC__
Expand Down Expand Up @@ -755,14 +756,16 @@ bool CAdvancedFrame::CreateMenus() {
}

m_Shortcuts[0].Set(wxACCEL_CTRL, (int)'A', ID_SELECTALL);
m_Shortcuts[1].Set(wxACCEL_CTRL, WXK_TAB, ID_NEXT_PAGE);
m_Shortcuts[1].Set(wxACCEL_CTRL, WXK_TAB, ID_NEXTPAGE);
m_Shortcuts[2].Set(wxACCEL_CTRL|wxACCEL_SHIFT, WXK_TAB, ID_PREVPAGE);


#ifdef __WXMAC__
// Set HELP key as keyboard shortcut
m_Shortcuts[2].Set(wxACCEL_NORMAL, WXK_HELP, ID_HELPBOINCMANAGER);
m_Shortcuts[3].Set(wxACCEL_NORMAL, WXK_HELP, ID_HELPBOINCMANAGER);
#endif

m_pAccelTable = new wxAcceleratorTable(3, m_Shortcuts);
m_pAccelTable = new wxAcceleratorTable(4, m_Shortcuts);
SetAcceleratorTable(*m_pAccelTable);

wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::CreateMenu - Function End"));
Expand Down Expand Up @@ -1981,19 +1984,35 @@ void CAdvancedFrame::OnSelectAll(wxCommandEvent& WXUNUSED(event)) {
}


void CAdvancedFrame::OnNextPage( wxCommandEvent& event) {
void CAdvancedFrame::OnNextPage(wxCommandEvent& WXUNUSED(event)) {
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnNextPage - Function Begin"));

wxWindow* pwndNotebookPage = m_pNotebook->GetPage(m_pNotebook->GetSelection());

if (pwndNotebookPage != NULL) {
m_pNotebook->AdvanceSelection();
}

wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnNextPage - Function End"));
}


void CAdvancedFrame::OnPrevPage(wxCommandEvent& WXUNUSED(event)) {
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnPrevPage - Function Begin"));

wxWindow* pwndNotebookPage = NULL;
int selection = event.GetSelection();
int currentPage = m_pNotebook->GetSelection();
int pageCount = m_pNotebook->GetPageCount();
int selection = currentPage;

pwndNotebookPage = m_pNotebook->GetPage(selection);
if (currentPage == 0) selection = pageCount;

if ( pwndNotebookPage != NULL ) {
m_pNotebook->AdvanceSelection(true);
pwndNotebookPage = m_pNotebook->GetPage(currentPage);
if (pwndNotebookPage != NULL) {
m_pNotebook->SetSelection(selection - 1);
}

wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnNextPage - Function End"));
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnPrevPage - Function End"));
}


Expand Down
5 changes: 3 additions & 2 deletions clientgui/AdvancedFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ class CAdvancedFrame : public CBOINCBaseFrame
void OnActivitySelection( wxCommandEvent& event );
void OnGPUSelection( wxCommandEvent& event );
void OnNetworkSelection( wxCommandEvent& event );
void OnNextPage( wxCommandEvent &event);
void OnNextPage( wxCommandEvent &event );
void OnPrevPage( wxCommandEvent &event );

void OnSelectAll( wxCommandEvent& event );

Expand Down Expand Up @@ -113,7 +114,7 @@ class CAdvancedFrame : public CBOINCBaseFrame
protected:
virtual int _GetCurrentViewPage();

wxAcceleratorEntry m_Shortcuts[3]; // For keyboard shortcut
wxAcceleratorEntry m_Shortcuts[4]; // For keyboard shortcut
wxAcceleratorTable* m_pAccelTable;

private:
Expand Down
3 changes: 2 additions & 1 deletion clientgui/Events.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@

// Shortcuts
#define ID_SELECTALL 9800
#define ID_NEXT_PAGE 9801
#define ID_NEXTPAGE 9801
#define ID_PREVPAGE 9802

//
// Simple GUI
Expand Down

0 comments on commit cbd87af

Please sign in to comment.