diff --git a/Source/Core/DolphinWX/Src/ConfigMain.cpp b/Source/Core/DolphinWX/Src/ConfigMain.cpp index 32a3b1e3df..4df0353569 100644 --- a/Source/Core/DolphinWX/Src/ConfigMain.cpp +++ b/Source/Core/DolphinWX/Src/ConfigMain.cpp @@ -213,7 +213,7 @@ void CConfigMain::SetSelectedTab(int tab) switch (tab) { case ID_AUDIOPAGE: - this->Notebook->SetSelection(2); + Notebook->SetSelection(2); break; } } @@ -947,6 +947,7 @@ void CConfigMain::CreateGUIControls() Fit(); Center(); + Notebook->SetSelection(0); } void CConfigMain::OnClose(wxCloseEvent& WXUNUSED (event)) diff --git a/Source/Core/DolphinWX/Src/HotkeyDlg.cpp b/Source/Core/DolphinWX/Src/HotkeyDlg.cpp index 98473dd106..b5d5cf73c6 100644 --- a/Source/Core/DolphinWX/Src/HotkeyDlg.cpp +++ b/Source/Core/DolphinWX/Src/HotkeyDlg.cpp @@ -303,5 +303,6 @@ void HotkeyConfigDialog::CreateHotkeyGUIControls(void) SetSizer(sMainSizer); Layout(); Fit(); + Notebook->SetSelection(0); } diff --git a/Source/Core/DolphinWX/Src/InputConfigDiag.cpp b/Source/Core/DolphinWX/Src/InputConfigDiag.cpp index fb34febe69..ed9d3fd86d 100644 --- a/Source/Core/DolphinWX/Src/InputConfigDiag.cpp +++ b/Source/Core/DolphinWX/Src/InputConfigDiag.cpp @@ -191,6 +191,11 @@ void InputConfigDialog::UpdateControlReferences() (*i)->controller->UpdateReferences(g_controller_interface); } +void InputConfigDialog::ClickCancel(wxCommandEvent&) +{ + Close(); +} + void InputConfigDialog::ClickSave(wxCommandEvent&) { m_plugin.SaveConfig(); @@ -974,13 +979,15 @@ InputConfigDialog::InputConfigDialog(wxWindow* const parent, InputPlugin& plugin UpdateDeviceComboBox(); UpdateProfileComboBox(); - wxButton* const close_button = new wxButton(this, -1, _("Save")); - _connect_macro_(close_button, InputConfigDialog::ClickSave, wxEVT_COMMAND_BUTTON_CLICKED, this); + wxButton* const close_button = new wxButton(this, wxID_OK, _("Save")); _connect_macro_(close_button, InputConfigDialog::ClickSave, wxEVT_COMMAND_BUTTON_CLICKED, this); + wxButton* const cancel_button = new wxButton(this, wxID_CANCEL, _("Cancel")); + _connect_macro_(cancel_button, InputConfigDialog::ClickCancel, wxEVT_COMMAND_BUTTON_CLICKED, this); wxBoxSizer* btns = new wxBoxSizer(wxHORIZONTAL); //btns->Add(new wxStaticText(this, -1, wxString::FromAscii(ver.c_str())), 0, wxLEFT|wxTOP, 5); btns->AddStretchSpacer(); + btns->Add(cancel_button, 0, 0, 0); btns->Add(close_button, 0, 0, 0); wxBoxSizer* const szr = new wxBoxSizer(wxVERTICAL); diff --git a/Source/Core/DolphinWX/Src/InputConfigDiag.h b/Source/Core/DolphinWX/Src/InputConfigDiag.h index 54f828b952..46101947f8 100644 --- a/Source/Core/DolphinWX/Src/InputConfigDiag.h +++ b/Source/Core/DolphinWX/Src/InputConfigDiag.h @@ -235,6 +235,7 @@ public: bool Destroy(); + void ClickCancel(wxCommandEvent& event); void ClickSave(wxCommandEvent& event); void UpdateDeviceComboBox(); diff --git a/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp b/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp index ca6dfcf4e0..daeafabd4e 100644 --- a/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp +++ b/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp @@ -461,7 +461,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con page_advanced->SetSizerAndFit(szr_advanced); } - wxButton* const btn_close = new wxButton(this, -1, _("Close"), wxDefaultPosition); + wxButton* const btn_close = new wxButton(this, wxID_OK, _("Close"), wxDefaultPosition); _connect_macro_(btn_close, VideoConfigDiag::Event_ClickClose, wxEVT_COMMAND_BUTTON_CLICKED, this); Connect(wxID_ANY, wxEVT_CLOSE_WINDOW, wxCloseEventHandler(VideoConfigDiag::Event_Close), (wxObject*)0, this); @@ -470,6 +470,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con szr_main->Add(notebook, 1, wxEXPAND | wxALL, 5); szr_main->Add(btn_close, 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM, 5); + notebook->SetSelection(0); SetSizerAndFit(szr_main); Center(); diff --git a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp index 9907d83d9e..7fc4e4756c 100644 --- a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp +++ b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp @@ -67,7 +67,7 @@ WiimoteConfigPage::WiimoteConfigPage(wxWindow* const parent, const int index) WiimoteConfigDiag::WiimoteConfigDiag(wxWindow* const parent, InputPlugin& plugin) : wxDialog(parent, -1, _("Dolphin Wiimote Configuration"), wxDefaultPosition, wxDefaultSize) - , m_plugin(plugin), m_save(false) + , m_plugin(plugin) { m_pad_notebook = new wxNotebook(this, -1, wxDefaultPosition, wxDefaultSize, wxNB_DEFAULT); for (unsigned int i = 0; i < 4; ++i) @@ -75,15 +75,20 @@ WiimoteConfigDiag::WiimoteConfigDiag(wxWindow* const parent, InputPlugin& plugin WiimoteConfigPage* const wpage = new WiimoteConfigPage(m_pad_notebook, i); m_pad_notebook->AddPage(wpage, wxString(_("Wiimote ")) + wxChar('1'+i)); } + m_pad_notebook->SetSelection(0); - wxButton* const ok_button = new wxButton(this, -1, _("OK"), wxDefaultPosition); + wxButton* const ok_button = new wxButton(this, wxID_OK, _("OK"), wxDefaultPosition); _connect_macro_(ok_button, WiimoteConfigDiag::Save, wxEVT_COMMAND_BUTTON_CLICKED, this); + wxButton* const cancel_button = new wxButton(this, wxID_CANCEL, _("Cancel"), wxDefaultPosition); + _connect_macro_(cancel_button, WiimoteConfigDiag::Cancel, wxEVT_COMMAND_BUTTON_CLICKED, this); - Connect(wxID_ANY, wxEVT_CLOSE_WINDOW, wxCloseEventHandler(WiimoteConfigDiag::OnClose), (wxObject*)0, this); + wxBoxSizer* const button_sizer = new wxBoxSizer(wxHORIZONTAL); + button_sizer->Add(cancel_button, 0, wxALIGN_RIGHT | wxRIGHT, 5); + button_sizer->Add(ok_button, 0, wxALIGN_RIGHT); wxBoxSizer* const main_sizer = new wxBoxSizer(wxVERTICAL); main_sizer->Add(m_pad_notebook, 1, wxEXPAND | wxALL, 5); - main_sizer->Add(ok_button, 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM, 5); + main_sizer->Add(button_sizer, 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM, 5); SetSizerAndFit(main_sizer); @@ -174,15 +179,13 @@ void WiimoteConfigDiag::Save(wxCommandEvent&) inifile.Save(ini_filename); - m_save = true; - Close(); } -void WiimoteConfigDiag::OnClose(wxCloseEvent& event) +void WiimoteConfigDiag::Cancel(wxCommandEvent&) { - if (!m_save) - for (size_t p = 0; p < m_pad_notebook->GetPageCount(); ++p) - ((WiimoteConfigPage*)m_pad_notebook->GetPage(p))->RevertSource(); - event.Skip(); + for (size_t p = 0; p < m_pad_notebook->GetPageCount(); ++p) + ((WiimoteConfigPage*)m_pad_notebook->GetPage(p))->RevertSource(); + + Close(); } diff --git a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.h b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.h index 1f151865e7..ead1bf8059 100644 --- a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.h +++ b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.h @@ -46,11 +46,10 @@ public: void UpdateGUI(); private: - void OnClose(wxCloseEvent& event); + void Cancel(wxCommandEvent& event); InputPlugin& m_plugin; wxNotebook* m_pad_notebook; - bool m_save; };