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
commit b35bbdfb58
18 changed files with 77 additions and 103 deletions

View File

@ -10,7 +10,6 @@
#include "InputCommon/ControllerEmu/ControlGroup/Buttons.h"
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"
#include "InputCommon/ControllerEmu/ControllerEmu.h"
#include "InputCommon/ControllerEmu/Setting/BackgroundInputSetting.h"
#include "InputCommon/ControllerEmu/Setting/BooleanSetting.h"
#include "InputCommon/KeyboardStatus.h"
@ -81,8 +80,6 @@ GCKeyboard::GCKeyboard(const unsigned int index) : m_index(index)
// options
groups.emplace_back(m_options = new ControllerEmu::ControlGroup(_trans("Options")));
m_options->boolean_settings.emplace_back(
std::make_unique<ControllerEmu::BackgroundInputSetting>(_trans("Background Input")));
m_options->boolean_settings.emplace_back(std::make_unique<ControllerEmu::BooleanSetting>(
_trans("Iterative Input"), false, ControllerEmu::SettingType::VIRTUAL));
}

View File

@ -13,7 +13,6 @@
#include "InputCommon/ControllerEmu/ControlGroup/Buttons.h"
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"
#include "InputCommon/ControllerEmu/ControlGroup/MixedTriggers.h"
#include "InputCommon/ControllerEmu/Setting/BackgroundInputSetting.h"
#include "InputCommon/ControllerEmu/Setting/BooleanSetting.h"
#include "InputCommon/GCPadStatus.h"
@ -79,8 +78,6 @@ GCPad::GCPad(const unsigned int index) : m_index(index)
// options
groups.emplace_back(m_options = new ControllerEmu::ControlGroup(_trans("Options")));
m_options->boolean_settings.emplace_back(
std::make_unique<ControllerEmu::BackgroundInputSetting>(_trans("Background Input")));
m_options->boolean_settings.emplace_back(std::make_unique<ControllerEmu::BooleanSetting>(
_trans("Iterative Input"), false, ControllerEmu::SettingType::VIRTUAL));
}

View File

@ -36,7 +36,6 @@
#include "InputCommon/ControllerEmu/ControlGroup/Force.h"
#include "InputCommon/ControllerEmu/ControlGroup/ModifySettingsButton.h"
#include "InputCommon/ControllerEmu/ControlGroup/Tilt.h"
#include "InputCommon/ControllerEmu/Setting/BackgroundInputSetting.h"
#include "InputCommon/ControllerEmu/Setting/BooleanSetting.h"
#include "InputCommon/ControllerEmu/Setting/NumericSetting.h"
@ -296,8 +295,6 @@ Wiimote::Wiimote(const unsigned int index)
// options
groups.emplace_back(m_options = new ControllerEmu::ControlGroup(_trans("Options")));
m_options->boolean_settings.emplace_back(
std::make_unique<ControllerEmu::BackgroundInputSetting>(_trans("Background Input")));
m_options->boolean_settings.emplace_back(std::make_unique<ControllerEmu::BooleanSetting>(
"Sideways Wiimote", _trans("Sideways Wii Remote"), false));
m_options->boolean_settings.emplace_back(std::make_unique<ControllerEmu::BooleanSetting>(

View File

@ -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<HotkeyManager*>(s_config.GetController(0))->GetHotkeyGroup(group);
}
ControllerEmu::ControlGroup* GetOptionsGroup()
{
return static_cast<HotkeyManager*>(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<ControllerEmu::BackgroundInputSetting>(_trans("Background Input")));
m_options->boolean_settings.emplace_back(std::make_unique<ControllerEmu::BooleanSetting>(
_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(),

View File

@ -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<ControllerEmu::ControlGroup*, NUM_HOTKEY_GROUPS> 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);

View File

@ -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);

View File

@ -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;
};

View File

@ -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();

View File

@ -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;
};

View File

@ -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;
};

View File

@ -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"

View File

@ -14,7 +14,6 @@ set(SRCS InputConfig.cpp
ControllerEmu/ControlGroup/Slider.cpp
ControllerEmu/ControlGroup/Tilt.cpp
ControllerEmu/ControlGroup/Triggers.cpp
ControllerEmu/Setting/BackgroundInputSetting.cpp
ControllerEmu/Setting/BooleanSetting.cpp
ControllerEmu/Setting/NumericSetting.cpp
ControllerInterface/ControllerInterface.cpp

View File

@ -1,26 +0,0 @@
// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "InputCommon/ControllerEmu/Setting/BackgroundInputSetting.h"
#include "Core/ConfigManager.h"
#include "InputCommon/ControllerEmu/Setting/Setting.h"
namespace ControllerEmu
{
BackgroundInputSetting::BackgroundInputSetting(const std::string& setting_name)
: BooleanSetting(setting_name, false, SettingType::VIRTUAL)
{
}
bool BackgroundInputSetting::GetValue() const
{
return SConfig::GetInstance().m_BackgroundInput;
}
void BackgroundInputSetting::SetValue(bool value)
{
m_value = value;
SConfig::GetInstance().m_BackgroundInput = value;
}
} // namespace ControllerEmu

View File

@ -1,20 +0,0 @@
// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include "InputCommon/ControllerEmu/Setting/BooleanSetting.h"
namespace ControllerEmu
{
class BackgroundInputSetting : public BooleanSetting
{
public:
BackgroundInputSetting(const std::string& setting_name);
bool GetValue() const override;
void SetValue(bool value) override;
};
} // namespace ControllerEmu

View File

@ -19,8 +19,6 @@ BooleanSetting::BooleanSetting(const std::string& setting_name, const bool defau
{
}
BooleanSetting::~BooleanSetting() = default;
bool BooleanSetting::GetValue() const
{
return m_value;

View File

@ -18,10 +18,9 @@ public:
const bool default_value, const SettingType setting_type = SettingType::NORMAL);
BooleanSetting(const std::string& setting_name, const bool default_value,
const SettingType setting_type = SettingType::NORMAL);
virtual ~BooleanSetting();
virtual bool GetValue() const;
virtual void SetValue(bool value);
bool GetValue() const;
void SetValue(bool value);
const SettingType m_type;
const std::string m_name;
const std::string m_ui_name;

View File

@ -50,7 +50,6 @@
<ClCompile Include="ControllerEmu\ControlGroup\Slider.cpp" />
<ClCompile Include="ControllerEmu\ControlGroup\Tilt.cpp" />
<ClCompile Include="ControllerEmu\ControlGroup\Triggers.cpp" />
<ClCompile Include="ControllerEmu\Setting\BackgroundInputSetting.cpp" />
<ClCompile Include="ControllerEmu\Setting\BooleanSetting.cpp" />
<ClCompile Include="ControllerEmu\Setting\NumericSetting.cpp" />
<ClCompile Include="ControllerInterface\ControllerInterface.cpp" />
@ -88,7 +87,6 @@
<ClInclude Include="ControllerEmu\ControlGroup\Slider.h" />
<ClInclude Include="ControllerEmu\ControlGroup\Tilt.h" />
<ClInclude Include="ControllerEmu\ControlGroup\Triggers.h" />
<ClInclude Include="ControllerEmu\Setting\BackgroundInputSetting.h" />
<ClInclude Include="ControllerEmu\Setting\BooleanSetting.h" />
<ClInclude Include="ControllerEmu\Setting\NumericSetting.h" />
<ClInclude Include="ControllerEmu\Setting\Setting.h" />

View File

@ -74,9 +74,6 @@
<ClCompile Include="ControllerEmu\ControlGroup\Triggers.cpp">
<Filter>ControllerEmu\ControlGroup</Filter>
</ClCompile>
<ClCompile Include="ControllerEmu\Setting\BackgroundInputSetting.cpp">
<Filter>ControllerEmu\Setting</Filter>
</ClCompile>
<ClCompile Include="ControllerEmu\Setting\BooleanSetting.cpp">
<Filter>ControllerEmu\Setting</Filter>
</ClCompile>
@ -163,9 +160,6 @@
<ClInclude Include="ControllerEmu\ControlGroup\Triggers.h">
<Filter>ControllerEmu\ControlGroup</Filter>
</ClInclude>
<ClInclude Include="ControllerEmu\Setting\BackgroundInputSetting.h">
<Filter>ControllerEmu\Setting</Filter>
</ClInclude>
<ClInclude Include="ControllerEmu\Setting\BooleanSetting.h">
<Filter>ControllerEmu\Setting</Filter>
</ClInclude>