From 84e6070e613cb3f4e8603daead49889bf625311d Mon Sep 17 00:00:00 2001 From: ayuanx Date: Wed, 16 Dec 2009 19:12:07 +0000 Subject: [PATCH] This time when you click "Cancel" in Wiimote dialog, all changes are really discarded. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4700 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Plugin_Wiimote/Src/ConfigBasicDlg.cpp | 31 +++++++++++++------ .../Plugin_Wiimote/Src/ConfigPadDlg.cpp | 6 ++-- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.cpp b/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.cpp index 79a08559d6..200f09cae1 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.cpp @@ -68,6 +68,8 @@ WiimoteBasicConfigDialog::WiimoteBasicConfigDialog(wxWindow *parent, wxWindowID void WiimoteBasicConfigDialog::OnClose(wxCloseEvent& event) { + // necessary as this dialog is only showed/hided + UpdateGUI(); g_FrameOpen = false; EndModal(wxID_CLOSE); } @@ -124,7 +126,6 @@ void WiimoteBasicConfigDialog::ButtonClick(wxCommandEvent& event) } } - // Execute a delayed function void WiimoteBasicConfigDialog::UpdateOnce(wxTimerEvent& event) { @@ -455,20 +456,30 @@ void WiimoteBasicConfigDialog::UpdateIRCalibration() void WiimoteBasicConfigDialog::UpdateGUI(int Slot) { - // Update the Wiimote IR pointer calibration - UpdateIRCalibration(); - - /* We only allow a change of extension if we are not currently using the real Wiimote, if it's in use the status will be updated - from the data scanning functions in main.cpp */ - bool AllowExtensionChange = !(g_RealWiiMotePresent && g_Config.bConnectRealWiimote && g_Config.bUseRealWiimote && g_EmulatorRunning); - extensionChoice[Page]->SetSelection(g_Config.iExtensionConnected); - extensionChoice[Page]->Enable(AllowExtensionChange); - /* I have disabled this option during a running game because it's enough to be able to switch between using and not using then. To also use the connect option during a running game would mean that the wiimote must be sent the current reporting mode and the channel ID after it has been initialized. Functions for that are basically already in place so these two options could possibly be simplified to one option. */ + m_ConnectRealWiimote[Page]->SetValue(g_Config.bConnectRealWiimote); m_ConnectRealWiimote[Page]->Enable(!g_EmulatorRunning); + + m_UseRealWiimote[Page]->SetValue(g_Config.bUseRealWiimote); m_UseRealWiimote[Page]->Enable((m_bEnableUseRealWiimote && g_RealWiiMotePresent && g_Config.bConnectRealWiimote) || (!g_EmulatorRunning && g_Config.bConnectRealWiimote)); + + m_InputActive[Page]->SetValue(g_Config.bInputActive); + m_SidewaysWiimote[Page]->SetValue(g_Config.bSideways); + m_UprightWiimote[Page]->SetValue(g_Config.bUpright); + m_WiiMotionPlusConnected[Page]->SetValue(g_Config.bMotionPlusConnected); + + /* We only allow a change of extension if we are not currently using the real Wiimote, if it's in use the status will be updated + from the data scanning functions in main.cpp */ + bool AllowExtensionChange = !(g_RealWiiMotePresent && g_Config.bConnectRealWiimote && g_Config.bUseRealWiimote && g_EmulatorRunning); + + extensionChoice[Page]->SetSelection(g_Config.iExtensionConnected); + extensionChoice[Page]->Enable(AllowExtensionChange); + + // Update the Wiimote IR pointer calibration + UpdateIRCalibration(); } + diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.cpp b/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.cpp index 0ebbd0c027..b4c1f349d1 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.cpp @@ -260,7 +260,7 @@ void WiimotePadConfigDialog::DoSave(bool ChangePad, int Slot) for(int i = 0; i < 1; i++) // Only got 1 wiimote yet SaveButtonMapping(i, true); // Save the settings for the current pad - g_Config.Save(Slot); +// g_Config.Save(Slot); // Now we can update the ID WiiMoteEmu::PadMapping[Page].ID = m_Joyname[Page]->GetSelection(); } @@ -269,7 +269,7 @@ void WiimotePadConfigDialog::DoSave(bool ChangePad, int Slot) // Update PadMapping[] from the GUI controls for(int i = 0; i < 1; i++) // Only got 1 wiimote yet SaveButtonMapping(i); - g_Config.Save(Slot); +// g_Config.Save(Slot); } // Then change it back to "" @@ -987,7 +987,7 @@ void WiimotePadConfigDialog::GeneralSettingsChanged(wxCommandEvent& event) SaveButtonMappingAll(Page); break; } - g_Config.Save(); +// g_Config.Save(); UpdateGUI(); }