diff --git a/Source/Core/DolphinWX/Src/ConfigMain.cpp b/Source/Core/DolphinWX/Src/ConfigMain.cpp index 43701bb56a..32a3b1e3df 100644 --- a/Source/Core/DolphinWX/Src/ConfigMain.cpp +++ b/Source/Core/DolphinWX/Src/ConfigMain.cpp @@ -1062,12 +1062,11 @@ void CConfigMain::DisplaySettingsChanged(wxCommandEvent& event) break; case ID_HOTKEY_CONFIG: { - HotkeyConfigDialog *m_HotkeyDialog = new HotkeyConfigDialog(this); - m_HotkeyDialog->ShowModal(); - m_HotkeyDialog->Destroy(); - // Update the GUI in case menu accelerators were changed - main_frame->UpdateGUI(); + HotkeyConfigDialog m_HotkeyDialog(this); + m_HotkeyDialog.ShowModal(); } + // Update the GUI in case menu accelerators were changed + main_frame->UpdateGUI(); break; } } diff --git a/Source/Core/DolphinWX/Src/HotkeyDlg.cpp b/Source/Core/DolphinWX/Src/HotkeyDlg.cpp index 2cd290a3b7..98473dd106 100644 --- a/Source/Core/DolphinWX/Src/HotkeyDlg.cpp +++ b/Source/Core/DolphinWX/Src/HotkeyDlg.cpp @@ -22,10 +22,10 @@ BEGIN_EVENT_TABLE(HotkeyConfigDialog,wxDialog) EVT_CLOSE(HotkeyConfigDialog::OnClose) - EVT_BUTTON(ID_CLOSE, HotkeyConfigDialog::CloseClick) + EVT_BUTTON(wxID_OK, HotkeyConfigDialog::CloseClick) EVT_COMMAND_RANGE(0, NUM_HOTKEYS - 1, wxEVT_COMMAND_BUTTON_CLICKED, HotkeyConfigDialog::OnButtonClick) - EVT_TIMER(IDTM_BUTTON, HotkeyConfigDialog::OnButtonTimer) + EVT_TIMER(wxID_ANY, HotkeyConfigDialog::OnButtonTimer) END_EVENT_TABLE() HotkeyConfigDialog::HotkeyConfigDialog(wxWindow *parent, wxWindowID id, const wxString &title, @@ -35,7 +35,7 @@ HotkeyConfigDialog::HotkeyConfigDialog(wxWindow *parent, wxWindowID id, const wx CreateHotkeyGUIControls(); #if wxUSE_TIMER - m_ButtonMappingTimer = new wxTimer(this, IDTM_BUTTON); + m_ButtonMappingTimer = new wxTimer(this, wxID_ANY); g_Pressed = 0; g_Modkey = 0; ClickedButton = NULL; @@ -46,26 +46,19 @@ HotkeyConfigDialog::HotkeyConfigDialog(wxWindow *parent, wxWindowID id, const wx HotkeyConfigDialog::~HotkeyConfigDialog() { - if (m_ButtonMappingTimer) - delete m_ButtonMappingTimer; + delete m_ButtonMappingTimer; } -void HotkeyConfigDialog::OnClose(wxCloseEvent& WXUNUSED (event)) +void HotkeyConfigDialog::OnClose(wxCloseEvent& WXUNUSED(event)) { - if (m_ButtonMappingTimer) - m_ButtonMappingTimer->Stop(); + m_ButtonMappingTimer->Stop(); EndModal(wxID_CLOSE); } -void HotkeyConfigDialog::CloseClick(wxCommandEvent& event) +void HotkeyConfigDialog::CloseClick(wxCommandEvent& WXUNUSED(event)) { - switch(event.GetId()) - { - case ID_CLOSE: - Close(); - break; - } + Close(); } // Save keyboard key mapping @@ -300,10 +293,9 @@ void HotkeyConfigDialog::CreateHotkeyGUIControls(void) Page->SetSizer(sPage); } - m_Close = new wxButton(this, ID_CLOSE, _("Close")); wxBoxSizer* sButtons = new wxBoxSizer(wxHORIZONTAL); sButtons->AddStretchSpacer(); - sButtons->Add(m_Close, 0, (wxLEFT), 5); + sButtons->Add(new wxButton(this, wxID_OK, _("Close")), 0, (wxLEFT), 5); wxBoxSizer *sMainSizer = new wxBoxSizer(wxVERTICAL); sMainSizer->Add(Notebook, 0, wxEXPAND | wxALL, 5); diff --git a/Source/Core/DolphinWX/Src/HotkeyDlg.h b/Source/Core/DolphinWX/Src/HotkeyDlg.h index c07abc546d..bf74461146 100644 --- a/Source/Core/DolphinWX/Src/HotkeyDlg.h +++ b/Source/Core/DolphinWX/Src/HotkeyDlg.h @@ -44,29 +44,21 @@ class HotkeyConfigDialog : public wxDialog const wxString &title = _("Hotkey Configuration"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE | wxWANTS_CHARS); + long style = wxDEFAULT_DIALOG_STYLE); virtual ~HotkeyConfigDialog(); - wxTimer *m_ButtonMappingTimer; - private: DECLARE_EVENT_TABLE(); - enum - { - ID_CLOSE = 1000, - IDTM_BUTTON, // Timer - ID_APPLY - }; - wxString OldLabel; - wxButton *m_Close, *m_Apply, *ClickedButton, + wxButton *ClickedButton, *m_Button_Hotkeys[NUM_HOTKEYS]; - wxRadioButton *m_Radio_FSPause[5]; + + wxTimer *m_ButtonMappingTimer; void OnClose(wxCloseEvent& event); - void CloseClick(wxCommandEvent& event); + void CloseClick(wxCommandEvent& WXUNUSED(event)); void OnButtonTimer(wxTimerEvent& WXUNUSED(event)) { DoGetButtons(GetButtonWaitingID); } void OnButtonClick(wxCommandEvent& event); void OnKeyDown(wxKeyEvent& event); @@ -74,7 +66,6 @@ class HotkeyConfigDialog : public wxDialog void CreateHotkeyGUIControls(void); void SetButtonText(int id, const wxString &keystr, const wxString &modkeystr = wxString()); - wxString GetButtonText(int id); void DoGetButtons(int id); void EndGetButtons(void);