Merge pull request #4856 from ligfx/backgroundinput

Move "Background Input" out of individual controller configurations
This commit is contained in:
Anthony
2017-03-19 22:31:30 -07:00
committed by GitHub
18 changed files with 77 additions and 103 deletions
@@ -60,6 +60,8 @@ ControllerConfigDiag::ControllerConfigDiag(wxWindow* const parent)
main_sizer->AddSpacer(space5);
main_sizer->Add(CreateWiimoteConfigSizer(), 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
main_sizer->AddSpacer(space5);
main_sizer->Add(CreateAdvancedSettingsSizer(), 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
main_sizer->AddSpacer(space5);
main_sizer->Add(CreateButtonSizer(wxCLOSE | wxNO_DEFAULT), 0, wxEXPAND | wxLEFT | wxRIGHT,
space5);
main_sizer->AddSpacer(space5);
@@ -220,6 +222,25 @@ wxSizer* ControllerConfigDiag::CreateGamecubeSizer()
return gamecube_static_sizer;
}
void ControllerConfigDiag::OnBackgroundInputChanged(wxCommandEvent& event)
{
SConfig::GetInstance().m_BackgroundInput = event.IsChecked();
}
wxSizer* ControllerConfigDiag::CreateAdvancedSettingsSizer()
{
const int space5 = FromDIP(5);
m_background_input_checkbox = new wxCheckBox(this, wxID_ANY, _("Background Input"));
m_background_input_checkbox->SetValue(SConfig::GetInstance().m_BackgroundInput);
m_background_input_checkbox->Bind(wxEVT_CHECKBOX, &ControllerConfigDiag::OnBackgroundInputChanged,
this);
auto* const box = new wxStaticBoxSizer(wxVERTICAL, this, _("Advanced Settings"));
box->Add(m_background_input_checkbox, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
return box;
}
wxSizer* ControllerConfigDiag::CreateWiimoteConfigSizer()
{
const int space5 = FromDIP(5);
@@ -30,6 +30,7 @@ private:
wxSizer* CreateWiimoteConfigSizer();
wxSizer* CreatePassthroughBTConfigSizer();
wxSizer* CreateEmulatedBTConfigSizer();
wxSizer* CreateAdvancedSettingsSizer();
void OnClose(wxCloseEvent& event);
void OnCloseButton(wxCommandEvent& event);
@@ -50,6 +51,8 @@ private:
void OnContinuousScanning(wxCommandEvent& event);
void OnEnableSpeaker(wxCommandEvent& event);
void OnBackgroundInputChanged(wxCommandEvent& event);
std::map<wxWindowID, unsigned int> m_gc_port_from_choice_id;
std::map<wxWindowID, unsigned int> m_gc_port_from_config_id;
std::array<wxButton*, 4> m_gc_port_configure_button;
@@ -74,4 +77,6 @@ private:
wxButton* m_refresh_wm_button;
wxStaticText* m_unsupported_bt_text;
wxCheckBox* m_enable_speaker_data;
wxCheckBox* m_background_input_checkbox;
};
@@ -2,10 +2,12 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <wx/checkbox.h>
#include <wx/notebook.h>
#include <wx/panel.h>
#include <wx/sizer.h>
#include "Core/ConfigManager.h"
#include "Core/HotkeyManager.h"
#include "DolphinWX/Input/HotkeyInputConfigDiag.h"
@@ -24,13 +26,13 @@ HotkeyInputConfigDialog::HotkeyInputConfigDialog(wxWindow* parent, InputConfig&
UpdateGUI();
}
wxBoxSizer* HotkeyInputConfigDialog::CreateMainSizer()
wxSizer* HotkeyInputConfigDialog::CreateMainSizer()
{
const int space5 = FromDIP(5);
auto* const main_sizer = new wxBoxSizer(wxVERTICAL);
main_sizer->AddSpacer(space5);
main_sizer->Add(CreateDeviceRelatedSizer());
main_sizer->Add(CreateDeviceRelatedSizer(), 0, wxEXPAND | wxLEFT | wxRIGHT);
main_sizer->AddSpacer(space5);
main_sizer->Add(m_notebook, 1, wxEXPAND | wxLEFT | wxRIGHT, space5);
main_sizer->AddSpacer(space5);
@@ -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();
@@ -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;
};
@@ -240,6 +240,7 @@ protected:
ControllerEmu::EmulatedController* const controller;
bool m_iterate = false;
wxTimer m_update_timer;
private:
@@ -249,5 +250,4 @@ private:
InputEventFilter m_event_filter;
bool DetectButton(ControlButton* button);
bool m_iterate = false;
};
@@ -10,7 +10,6 @@
#include "Core/HW/Wiimote.h"
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
#include "InputCommon/ControllerEmu/Setting/BackgroundInputSetting.h"
#include "InputCommon/ControllerEmu/Setting/BooleanSetting.h"
#include "InputCommon/ControllerEmu/Setting/NumericSetting.h"