diff --git a/Source/Core/Core/HotkeyManager.cpp b/Source/Core/Core/HotkeyManager.cpp index 41d914bb06..425f504bc3 100644 --- a/Source/Core/Core/HotkeyManager.cpp +++ b/Source/Core/Core/HotkeyManager.cpp @@ -14,7 +14,6 @@ #include "InputCommon/ControllerEmu/Control/Input.h" #include "InputCommon/ControllerEmu/ControlGroup/Buttons.h" #include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h" -#include "InputCommon/ControllerEmu/Setting/BackgroundInputSetting.h" #include "InputCommon/ControllerEmu/Setting/BooleanSetting.h" #include "InputCommon/GCPadStatus.h" @@ -228,11 +227,6 @@ ControllerEmu::ControlGroup* GetHotkeyGroup(HotkeyGroup group) return static_cast(s_config.GetController(0))->GetHotkeyGroup(group); } -ControllerEmu::ControlGroup* GetOptionsGroup() -{ - return static_cast(s_config.GetController(0))->GetOptionsGroup(); -} - void Shutdown() { s_config.ClearControllers(); @@ -272,12 +266,6 @@ HotkeyManager::HotkeyManager() m_keys[group]->controls.emplace_back(new ControllerEmu::Input(hotkey_labels[key])); } } - - groups.emplace_back(m_options = new ControllerEmu::ControlGroup(_trans("Options"))); - m_options->boolean_settings.emplace_back( - std::make_unique(_trans("Background Input"))); - m_options->boolean_settings.emplace_back(std::make_unique( - _trans("Iterative Input"), false, ControllerEmu::SettingType::VIRTUAL)); } HotkeyManager::~HotkeyManager() @@ -309,11 +297,6 @@ ControllerEmu::ControlGroup* HotkeyManager::GetHotkeyGroup(HotkeyGroup group) co return m_hotkey_groups[group]; } -ControllerEmu::ControlGroup* HotkeyManager::GetOptionsGroup() const -{ - return m_options; -} - int HotkeyManager::FindGroupByID(int id) const { const auto i = std::find_if(groups_info.begin(), groups_info.end(), diff --git a/Source/Core/Core/HotkeyManager.h b/Source/Core/Core/HotkeyManager.h index 443a3c0406..10dbb9ccf4 100644 --- a/Source/Core/Core/HotkeyManager.h +++ b/Source/Core/Core/HotkeyManager.h @@ -199,7 +199,6 @@ public: void GetInput(HotkeyStatus* const hk); std::string GetName() const override; ControllerEmu::ControlGroup* GetHotkeyGroup(HotkeyGroup group) const; - ControllerEmu::ControlGroup* GetOptionsGroup() const; int FindGroupByID(int id) const; int GetIndexForGroup(int group, int id) const; void LoadDefaults(const ControllerInterface& ciface) override; @@ -207,7 +206,6 @@ public: private: ControllerEmu::Buttons* m_keys[NUM_HOTKEY_GROUPS]; std::array m_hotkey_groups; - ControllerEmu::ControlGroup* m_options; }; namespace HotkeyManagerEmu @@ -218,7 +216,6 @@ void LoadConfig(); InputConfig* GetConfig(); ControllerEmu::ControlGroup* GetHotkeyGroup(HotkeyGroup group); -ControllerEmu::ControlGroup* GetOptionsGroup(); void GetStatus(); bool IsEnabled(); void Enable(bool enable_toggle); diff --git a/Source/Core/DolphinWX/Input/HotkeyInputConfigDiag.cpp b/Source/Core/DolphinWX/Input/HotkeyInputConfigDiag.cpp index b931dbadb1..4f0643672b 100644 --- a/Source/Core/DolphinWX/Input/HotkeyInputConfigDiag.cpp +++ b/Source/Core/DolphinWX/Input/HotkeyInputConfigDiag.cpp @@ -2,10 +2,12 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include #include #include #include +#include "Core/ConfigManager.h" #include "Core/HotkeyManager.h" #include "DolphinWX/Input/HotkeyInputConfigDiag.h" @@ -24,7 +26,7 @@ HotkeyInputConfigDialog::HotkeyInputConfigDialog(wxWindow* parent, InputConfig& UpdateGUI(); } -wxBoxSizer* HotkeyInputConfigDialog::CreateMainSizer() +wxSizer* HotkeyInputConfigDialog::CreateMainSizer() { const int space5 = FromDIP(5); auto* const main_sizer = new wxBoxSizer(wxVERTICAL); @@ -41,24 +43,54 @@ wxBoxSizer* HotkeyInputConfigDialog::CreateMainSizer() return main_sizer; } -wxBoxSizer* HotkeyInputConfigDialog::CreateDeviceRelatedSizer() +void HotkeyInputConfigDialog::OnBackgroundInputChanged(wxCommandEvent& event) +{ + SConfig::GetInstance().m_BackgroundInput = event.IsChecked(); +} + +void HotkeyInputConfigDialog::OnIterativeInputChanged(wxCommandEvent& event) +{ + m_iterate = event.IsChecked(); +} + +wxSizer* HotkeyInputConfigDialog::CreateOptionsSizer() +{ + const int space3 = FromDIP(3); + + auto background_input_checkbox = new wxCheckBox(this, wxID_ANY, _("Background Input")); + background_input_checkbox->SetValue(SConfig::GetInstance().m_BackgroundInput); + background_input_checkbox->Bind(wxEVT_CHECKBOX, + &HotkeyInputConfigDialog::OnBackgroundInputChanged, this); + + auto iterative_input_checkbox = new wxCheckBox(this, wxID_ANY, _("Iterative Input")); + iterative_input_checkbox->SetValue(m_iterate); + iterative_input_checkbox->Bind(wxEVT_CHECKBOX, &HotkeyInputConfigDialog::OnIterativeInputChanged, + this); + + auto sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Options")); + sizer->AddSpacer(space3); + sizer->Add(background_input_checkbox, 0, wxLEFT | wxRIGHT, space3); + sizer->AddSpacer(space3); + sizer->Add(iterative_input_checkbox, 0, wxLEFT | wxRIGHT, space3); + sizer->AddSpacer(space3); + return sizer; +} + +wxSizer* HotkeyInputConfigDialog::CreateDeviceRelatedSizer() { const int space5 = FromDIP(5); auto* const enclosing_sizer = new wxBoxSizer(wxHORIZONTAL); - auto* const reset_sizer = CreaterResetGroupBox(wxVERTICAL); - auto* const options_group_box = - new ControlGroupBox(HotkeyManagerEmu::GetOptionsGroup(), this, this); enclosing_sizer->AddSpacer(space5); enclosing_sizer->Add(CreateDeviceProfileSizer(), 3, wxEXPAND); - enclosing_sizer->Add(reset_sizer, 0, wxEXPAND); - enclosing_sizer->Add(options_group_box, 1, wxEXPAND); + enclosing_sizer->Add(CreaterResetGroupBox(wxVERTICAL), 0, wxEXPAND); + enclosing_sizer->Add(CreateOptionsSizer(), 1, wxEXPAND); enclosing_sizer->AddSpacer(space5); return enclosing_sizer; } -wxBoxSizer* HotkeyInputConfigDialog::CreateDeviceProfileSizer() +wxSizer* HotkeyInputConfigDialog::CreateDeviceProfileSizer() { auto* const device_chooser = CreateDeviceChooserGroupBox(); auto* const profile_chooser = CreateProfileChooserGroupBox(); diff --git a/Source/Core/DolphinWX/Input/HotkeyInputConfigDiag.h b/Source/Core/DolphinWX/Input/HotkeyInputConfigDiag.h index d078f2a5c4..fa62a4f166 100644 --- a/Source/Core/DolphinWX/Input/HotkeyInputConfigDiag.h +++ b/Source/Core/DolphinWX/Input/HotkeyInputConfigDiag.h @@ -17,9 +17,10 @@ public: bool using_debugger, int port_num = 0); private: - wxBoxSizer* CreateMainSizer(); - wxBoxSizer* CreateDeviceRelatedSizer(); - wxBoxSizer* CreateDeviceProfileSizer(); + wxSizer* CreateMainSizer(); + wxSizer* CreateDeviceRelatedSizer(); + wxSizer* CreateDeviceProfileSizer(); + wxSizer* CreateOptionsSizer(); void InitializeNotebook(); wxPanel* CreateGeneralPanel(); @@ -31,6 +32,9 @@ private: wxPanel* CreateSaveAndLoadStatePanel(); wxPanel* CreateOtherStateManagementPanel(); + void OnBackgroundInputChanged(wxCommandEvent& event); + void OnIterativeInputChanged(wxCommandEvent& event); + wxNotebook* m_notebook; bool m_using_debugger; };