Merge pull request #4461 from aldelaro5/hotkey-config-redo

Redo every input configuration dialog
This commit is contained in:
Mat M
2016-11-29 07:39:28 -05:00
committed by GitHub
53 changed files with 1724 additions and 331 deletions

View File

@ -40,6 +40,17 @@ set(GUI_SRCS
NetPlay/NetPlaySetupFrame.cpp
NetPlay/NetWindow.cpp
NetPlay/PadMapDialog.cpp
Input/InputConfigDiag.cpp
Input/InputConfigDiagBitmaps.cpp
Input/HotkeyInputConfigDiag.cpp
Input/GCPadInputConfigDiag.cpp
Input/GCKeyboardInputConfigDiag.cpp
Input/WiimoteInputConfigDiag.cpp
Input/NunchukInputConfigDiag.cpp
Input/ClassicInputConfigDiag.cpp
Input/GuitarInputConfigDiag.cpp
Input/DrumsInputConfigDiag.cpp
Input/TurntableInputConfigDiag.cpp
DolphinSlider.cpp
FifoPlayerDlg.cpp
Frame.cpp
@ -48,8 +59,6 @@ set(GUI_SRCS
GameListCtrl.cpp
ISOFile.cpp
ISOProperties.cpp
InputConfigDiag.cpp
InputConfigDiagBitmaps.cpp
LogConfigWindow.cpp
LogWindow.cpp
Main.cpp

View File

@ -24,7 +24,7 @@
#include "Core/HotkeyManager.h"
#include "DolphinWX/Config/InterfaceConfigPane.h"
#include "DolphinWX/Frame.h"
#include "DolphinWX/InputConfigDiag.h"
#include "DolphinWX/Input/InputConfigDiag.h"
#include "DolphinWX/WxUtils.h"
#if defined(HAVE_XRANDR) && HAVE_XRANDR

View File

@ -33,7 +33,10 @@
#include "DolphinWX/Config/GCAdapterConfigDiag.h"
#include "DolphinWX/ControllerConfigDiag.h"
#include "DolphinWX/DolphinSlider.h"
#include "DolphinWX/InputConfigDiag.h"
#include "DolphinWX/Input/GCKeyboardInputConfigDiag.h"
#include "DolphinWX/Input/GCPadInputConfigDiag.h"
#include "DolphinWX/Input/InputConfigDiag.h"
#include "DolphinWX/Input/WiimoteInputConfigDiag.h"
#include "DolphinWX/WxUtils.h"
#include "InputCommon/GCAdapter.h"
@ -447,20 +450,24 @@ void ControllerConfigDiag::OnGameCubeConfigButton(wxCommandEvent& event)
if (SConfig::GetInstance().m_SIDevice[port_num] == SIDEVICE_GC_KEYBOARD)
{
InputConfigDialog config_diag(this, *key_plugin, _("GameCube Keyboard Configuration"),
port_num);
GCKeyboardInputConfigDialog config_diag(
this, *key_plugin,
wxString::Format("GameCube Keyboard Configuration Port %i", port_num + 1), port_num);
config_diag.ShowModal();
}
else if (SConfig::GetInstance().m_SIDevice[port_num] == SIDEVICE_WIIU_ADAPTER)
{
GCAdapterConfigDiag config_diag(this, _("Wii U GameCube Controller Adapter Configuration"),
port_num);
GCAdapterConfigDiag config_diag(
this,
wxString::Format("Wii U GameCube Controller Adapter Configuration Port %i", port_num + 1),
port_num);
config_diag.ShowModal();
}
else
{
InputConfigDialog config_diag(this, *pad_plugin, _("GameCube Controller Configuration"),
port_num);
GCPadInputConfigDialog config_diag(
this, *pad_plugin,
wxString::Format("GameCube Controller Configuration Port %i", port_num + 1), port_num);
config_diag.ShowModal();
}
@ -494,9 +501,12 @@ void ControllerConfigDiag::OnWiimoteConfigButton(wxCommandEvent& ev)
HotkeyManagerEmu::Enable(false);
InputConfigDialog m_ConfigFrame(this, *wiimote_plugin,
_("Dolphin Emulated Wii Remote Configuration"),
m_wiimote_index_from_config_id[ev.GetId()]);
const int port_num = m_wiimote_index_from_config_id[ev.GetId()];
WiimoteInputConfigDialog m_ConfigFrame(
this, *wiimote_plugin,
wxString::Format("Dolphin Emulated Wii Remote Configuration Port %i", port_num + 1),
port_num);
m_ConfigFrame.ShowModal();
HotkeyManagerEmu::Enable(true);

View File

@ -100,8 +100,17 @@
<ClCompile Include="FrameAui.cpp" />
<ClCompile Include="FrameTools.cpp" />
<ClCompile Include="GameListCtrl.cpp" />
<ClCompile Include="InputConfigDiag.cpp" />
<ClCompile Include="InputConfigDiagBitmaps.cpp" />
<ClCompile Include="Input\InputConfigDiag.cpp" />
<ClCompile Include="Input\InputConfigDiagBitmaps.cpp" />
<ClCompile Include="Input\HotkeyInputConfigDiag.cpp" />
<ClCompile Include="Input\GCPadInputConfigDiag.cpp" />
<ClCompile Include="Input\GCKeyboardInputConfigDiag.cpp" />
<ClCompile Include="Input\WiimoteInputConfigDiag.cpp" />
<ClCompile Include="Input\NunchukInputConfigDiag.cpp" />
<ClCompile Include="Input\ClassicInputConfigDiag.cpp" />
<ClCompile Include="Input\GuitarInputConfigDiag.cpp" />
<ClCompile Include="Input\DrumsInputConfigDiag.cpp" />
<ClCompile Include="Input\TurntableInputConfigDiag.cpp" />
<ClCompile Include="ISOFile.cpp" />
<ClCompile Include="ISOProperties.cpp" />
<ClCompile Include="LogConfigWindow.cpp" />
@ -170,7 +179,16 @@
<ClInclude Include="Frame.h" />
<ClInclude Include="GameListCtrl.h" />
<ClInclude Include="Globals.h" />
<ClInclude Include="InputConfigDiag.h" />
<ClInclude Include="Input\InputConfigDiag.h" />
<ClInclude Include="Input\HotkeyInputConfigDiag.h" />
<ClInclude Include="Input\GCPadInputConfigDiag.h" />
<ClInclude Include="Input\GCKeyboardInputConfigDiag.h" />
<ClInclude Include="Input\WiimoteInputConfigDiag.h" />
<ClInclude Include="Input\NunchukInputConfigDiag.h" />
<ClInclude Include="Input\ClassicInputConfigDiag.h" />
<ClInclude Include="Input\GuitarInputConfigDiag.h" />
<ClInclude Include="Input\DrumsInputConfigDiag.h" />
<ClInclude Include="Input\TurntableInputConfigDiag.h" />
<ClInclude Include="ISOFile.h" />
<ClInclude Include="ISOProperties.h" />
<ClInclude Include="LogConfigWindow.h" />

View File

@ -104,10 +104,37 @@
<ClCompile Include="NetPlay\NetWindow.cpp">
<Filter>GUI\NetPlay</Filter>
</ClCompile>
<ClCompile Include="InputConfigDiag.cpp">
<ClCompile Include="Input\InputConfigDiag.cpp">
<Filter>GUI\InputConfig</Filter>
</ClCompile>
<ClCompile Include="InputConfigDiagBitmaps.cpp">
<ClCompile Include="Input\InputConfigDiagBitmaps.cpp">
<Filter>GUI\InputConfig</Filter>
</ClCompile>
<ClCompile Include="Input\HotkeyInputConfigDiag.cpp">
<Filter>GUI\InputConfig</Filter>
</ClCompile>
<ClCompile Include="Input\GCPadInputConfigDiag.cpp">
<Filter>GUI\InputConfig</Filter>
</ClCompile>
<ClCompile Include="Input\GCKeyboardInputConfigDiag.cpp">
<Filter>GUI\InputConfig</Filter>
</ClCompile>
<ClCompile Include="Input\WiimoteInputConfigDiag.cpp">
<Filter>GUI\InputConfig</Filter>
</ClCompile>
<ClCompile Include="Input\NunchukInputConfigDiag.cpp">
<Filter>GUI\InputConfig</Filter>
</ClCompile>
<ClCompile Include="Input\ClassicInputConfigDiag.cpp">
<Filter>GUI\InputConfig</Filter>
</ClCompile>
<ClCompile Include="Input\GuitarInputConfigDiag.cpp">
<Filter>GUI\InputConfig</Filter>
</ClCompile>
<ClCompile Include="Input\DrumsInputConfigDiag.cpp">
<Filter>GUI\InputConfig</Filter>
</ClCompile>
<ClCompile Include="Input\TurntableInputConfigDiag.cpp">
<Filter>GUI\InputConfig</Filter>
</ClCompile>
<ClCompile Include="Debugger\DebuggerPanel.cpp">
@ -290,7 +317,34 @@
<ClInclude Include="NetPlay\NetWindow.h">
<Filter>GUI\NetPlay</Filter>
</ClInclude>
<ClInclude Include="InputConfigDiag.h">
<ClInclude Include="Input\InputConfigDiag.h">
<Filter>GUI\InputConfig</Filter>
</ClInclude>
<ClInclude Include="Input\HotkeyInputConfigDiag.h">
<Filter>GUI\InputConfig</Filter>
</ClInclude>
<ClInclude Include="Input\GCPadInputConfigDiag.h">
<Filter>GUI\InputConfig</Filter>
</ClInclude>
<ClInclude Include="Input\GCKeyboardInputConfigDiag.h">
<Filter>GUI\InputConfig</Filter>
</ClInclude>
<ClInclude Include="Input\WiimoteInputConfigDiag.h">
<Filter>GUI\InputConfig</Filter>
</ClInclude>
<ClInclude Include="Input\NunchukInputConfigDiag.h">
<Filter>GUI\InputConfig</Filter>
</ClInclude>
<ClInclude Include="Input\ClassicInputConfigDiag.h">
<Filter>GUI\InputConfig</Filter>
</ClInclude>
<ClInclude Include="Input\GuitarInputConfigDiag.h">
<Filter>GUI\InputConfig</Filter>
</ClInclude>
<ClInclude Include="Input\DrumsInputConfigDiag.h">
<Filter>GUI\InputConfig</Filter>
</ClInclude>
<ClInclude Include="Input\TurntableInputConfigDiag.h">
<Filter>GUI\InputConfig</Filter>
</ClInclude>
<ClInclude Include="Debugger\DebuggerPanel.h">

View File

@ -65,7 +65,8 @@
#include "DolphinWX/GameListCtrl.h"
#include "DolphinWX/Globals.h"
#include "DolphinWX/ISOFile.h"
#include "DolphinWX/InputConfigDiag.h"
#include "DolphinWX/Input/HotkeyInputConfigDiag.h"
#include "DolphinWX/Input/InputConfigDiag.h"
#include "DolphinWX/LogWindow.h"
#include "DolphinWX/MainMenuBar.h"
#include "DolphinWX/MainToolBar.h"
@ -997,7 +998,7 @@ void CFrame::OnConfigHotkey(wxCommandEvent& WXUNUSED(event))
HotkeyManagerEmu::Enable(false);
InputConfigDialog m_ConfigFrame(this, *hotkey_plugin, _("Dolphin Hotkeys"));
HotkeyInputConfigDialog m_ConfigFrame(this, *hotkey_plugin, _("Dolphin Hotkeys"));
m_ConfigFrame.ShowModal();
// Update references in case controllers were refreshed

View File

@ -0,0 +1,50 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "DolphinWX/Input/ClassicInputConfigDiag.h"
#include "Core/HW/Wiimote.h"
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
ClassicInputConfigDialog::ClassicInputConfigDialog(wxWindow* const parent, InputConfig& config,
const wxString& name, const int port_num)
: InputConfigDialog(parent, config, name, port_num)
{
const int space5 = FromDIP(5);
auto* const group_box_buttons = new ControlGroupBox(
Wiimote::GetClassicGroup(port_num, WiimoteEmu::ClassicGroup::Buttons), this, this);
auto* const group_box_dpad = new ControlGroupBox(
Wiimote::GetClassicGroup(port_num, WiimoteEmu::ClassicGroup::DPad), this, this);
auto* const group_box_left_stick = new ControlGroupBox(
Wiimote::GetClassicGroup(port_num, WiimoteEmu::ClassicGroup::LeftStick), this, this);
auto* const group_box_right_stick = new ControlGroupBox(
Wiimote::GetClassicGroup(port_num, WiimoteEmu::ClassicGroup::RightStick), this, this);
auto* const group_box_triggers = new ControlGroupBox(
Wiimote::GetClassicGroup(port_num, WiimoteEmu::ClassicGroup::Triggers), this, this);
auto* const controls_sizer = new wxBoxSizer(wxHORIZONTAL);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_buttons, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_dpad, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_left_stick, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_right_stick, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_triggers, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
auto* const szr_main = new wxBoxSizer(wxVERTICAL);
szr_main->AddSpacer(space5);
szr_main->Add(controls_sizer, 1, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
szr_main->Add(CreateButtonSizer(wxCLOSE | wxNO_DEFAULT), 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
SetSizerAndFit(szr_main);
Center();
UpdateGUI();
}

View File

@ -0,0 +1,14 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include "DolphinWX/Input/InputConfigDiag.h"
class ClassicInputConfigDialog final : public InputConfigDialog
{
public:
ClassicInputConfigDialog(wxWindow* parent, InputConfig& config, const wxString& name,
int port_num = 0);
};

View File

@ -0,0 +1,46 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "DolphinWX/Input/DrumsInputConfigDiag.h"
#include "Core/HW/Wiimote.h"
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
DrumsInputConfigDialog::DrumsInputConfigDialog(wxWindow* const parent, InputConfig& config,
const wxString& name, const int port_num)
: InputConfigDialog(parent, config, name, port_num)
{
const int space5 = FromDIP(5);
auto* const group_box_buttons = new ControlGroupBox(
Wiimote::GetDrumsGroup(port_num, WiimoteEmu::DrumsGroup::Buttons), this, this);
auto* const group_box_pads = new ControlGroupBox(
Wiimote::GetDrumsGroup(port_num, WiimoteEmu::DrumsGroup::Pads), this, this);
auto* const buttons_pads_sizer = new wxBoxSizer(wxVERTICAL);
buttons_pads_sizer->Add(group_box_buttons);
buttons_pads_sizer->AddSpacer(space5);
buttons_pads_sizer->Add(group_box_pads);
auto* const group_box_stick = new ControlGroupBox(
Wiimote::GetDrumsGroup(port_num, WiimoteEmu::DrumsGroup::Stick), this, this);
auto* const controls_sizer = new wxBoxSizer(wxHORIZONTAL);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(buttons_pads_sizer, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_stick, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
auto* const szr_main = new wxBoxSizer(wxVERTICAL);
szr_main->AddSpacer(space5);
szr_main->Add(controls_sizer, 1, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
szr_main->Add(CreateButtonSizer(wxCLOSE | wxNO_DEFAULT), 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
SetSizerAndFit(szr_main);
Center();
UpdateGUI();
}

View File

@ -0,0 +1,14 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include "DolphinWX/Input/InputConfigDiag.h"
class DrumsInputConfigDialog final : public InputConfigDialog
{
public:
DrumsInputConfigDialog(wxWindow* parent, InputConfig& config, const wxString& name,
int port_num = 0);
};

View File

@ -0,0 +1,83 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "DolphinWX/Input/GCKeyboardInputConfigDiag.h"
#include "Core/HW/GCKeyboard.h"
#include "Core/HW/GCKeyboardEmu.h"
enum class KeyboardGroup;
GCKeyboardInputConfigDialog::GCKeyboardInputConfigDialog(wxWindow* const parent,
InputConfig& config, const wxString& name,
const int port_num)
: InputConfigDialog(parent, config, name, port_num)
{
const int space5 = FromDIP(5);
auto* const device_chooser = CreateDeviceChooserGroupBox();
auto* const reset_sizer = CreaterResetGroupBox(wxHORIZONTAL);
auto* const profile_chooser = CreateProfileChooserGroupBox();
auto* const group_box_keys0x =
new ControlGroupBox(Keyboard::GetGroup(port_num, KeyboardGroup::Kb0x), this, this);
auto* const group_box_keys1x =
new ControlGroupBox(Keyboard::GetGroup(port_num, KeyboardGroup::Kb1x), this, this);
auto* const group_box_keys2x =
new ControlGroupBox(Keyboard::GetGroup(port_num, KeyboardGroup::Kb2x), this, this);
auto* const group_box_keys3x =
new ControlGroupBox(Keyboard::GetGroup(port_num, KeyboardGroup::Kb3x), this, this);
auto* const group_box_keys4x =
new ControlGroupBox(Keyboard::GetGroup(port_num, KeyboardGroup::Kb4x), this, this);
auto* const group_box_keys5x =
new ControlGroupBox(Keyboard::GetGroup(port_num, KeyboardGroup::Kb5x), this, this);
auto* const group_box_options =
new ControlGroupBox(Keyboard::GetGroup(port_num, KeyboardGroup::Options), this, this);
auto* const key5x_options_sizer = new wxBoxSizer(wxVERTICAL);
key5x_options_sizer->Add(group_box_keys5x);
key5x_options_sizer->AddSpacer(space5);
key5x_options_sizer->Add(group_box_options);
auto* const controls_sizer = new wxBoxSizer(wxHORIZONTAL);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_keys0x, 0, wxEXPAND | wxTOP, space5);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_keys1x, 0, wxEXPAND | wxTOP, space5);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_keys2x, 0, wxEXPAND | wxTOP, space5);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_keys3x, 0, wxEXPAND | wxTOP, space5);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_keys4x, 0, wxEXPAND | wxTOP, space5);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(key5x_options_sizer, 0, wxEXPAND | wxTOP, space5);
controls_sizer->AddSpacer(space5);
auto* const dio = new wxBoxSizer(wxHORIZONTAL);
dio->AddSpacer(space5);
dio->Add(device_chooser, 3, wxEXPAND);
dio->AddSpacer(space5);
dio->Add(reset_sizer, 1, wxEXPAND);
dio->AddSpacer(space5);
dio->Add(profile_chooser, 3, wxEXPAND);
dio->AddSpacer(space5);
auto* const szr_main = new wxBoxSizer(wxVERTICAL);
szr_main->AddSpacer(space5);
szr_main->Add(dio);
szr_main->AddSpacer(space5);
szr_main->Add(controls_sizer, 1, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
szr_main->Add(CreateButtonSizer(wxCLOSE | wxNO_DEFAULT), 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
SetSizerAndFit(szr_main);
Center();
UpdateDeviceComboBox();
UpdateProfileComboBox();
UpdateGUI();
}

View File

@ -0,0 +1,14 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include "DolphinWX/Input/InputConfigDiag.h"
class GCKeyboardInputConfigDialog final : public InputConfigDialog
{
public:
GCKeyboardInputConfigDialog(wxWindow* parent, InputConfig& config, const wxString& name,
int port_num = 0);
};

View File

@ -0,0 +1,83 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "DolphinWX/Input/GCPadInputConfigDiag.h"
#include "Core/HW/GCPad.h"
#include "Core/HW/GCPadEmu.h"
GCPadInputConfigDialog::GCPadInputConfigDialog(wxWindow* const parent, InputConfig& config,
const wxString& name, const int port_num)
: InputConfigDialog(parent, config, name, port_num)
{
const int space5 = FromDIP(5);
auto* const device_chooser = CreateDeviceChooserGroupBox();
auto* const reset_sizer = CreaterResetGroupBox(wxHORIZONTAL);
auto* const profile_chooser = CreateProfileChooserGroupBox();
auto* const group_box_buttons =
new ControlGroupBox(Pad::GetGroup(port_num, PadGroup::Buttons), this, this);
auto* const group_box_main_stick =
new ControlGroupBox(Pad::GetGroup(port_num, PadGroup::MainStick), this, this);
auto* const group_box_c_stick =
new ControlGroupBox(Pad::GetGroup(port_num, PadGroup::CStick), this, this);
auto* const group_box_dpad =
new ControlGroupBox(Pad::GetGroup(port_num, PadGroup::DPad), this, this);
auto* const group_box_triggers =
new ControlGroupBox(Pad::GetGroup(port_num, PadGroup::Triggers), this, this);
auto* const group_box_rumble =
new ControlGroupBox(Pad::GetGroup(port_num, PadGroup::Rumble), this, this);
auto* const group_box_options =
new ControlGroupBox(Pad::GetGroup(port_num, PadGroup::Options), this, this);
auto* const triggers_rumble_sizer = new wxBoxSizer(wxVERTICAL);
triggers_rumble_sizer->Add(group_box_triggers, 0, wxEXPAND);
triggers_rumble_sizer->AddSpacer(space5);
triggers_rumble_sizer->Add(group_box_rumble, 0, wxEXPAND);
auto* const dpad_options_sizer = new wxBoxSizer(wxVERTICAL);
dpad_options_sizer->Add(group_box_dpad, 0, wxEXPAND);
dpad_options_sizer->AddSpacer(space5);
dpad_options_sizer->Add(group_box_options, 0, wxEXPAND);
auto* const controls_sizer = new wxBoxSizer(wxHORIZONTAL);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_buttons, 0, wxEXPAND | wxTOP, space5);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_main_stick, 0, wxEXPAND | wxTOP, space5);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_c_stick, 0, wxEXPAND | wxTOP, space5);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(triggers_rumble_sizer, 0, wxEXPAND | wxTOP, space5);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(dpad_options_sizer, 0, wxEXPAND | wxTOP, space5);
controls_sizer->AddSpacer(space5);
auto* const dio = new wxBoxSizer(wxHORIZONTAL);
dio->AddSpacer(space5);
dio->Add(device_chooser, 2, wxEXPAND);
dio->AddSpacer(space5);
dio->Add(reset_sizer, 1, wxEXPAND);
dio->AddSpacer(space5);
dio->Add(profile_chooser, 2, wxEXPAND);
dio->AddSpacer(space5);
auto* const szr_main = new wxBoxSizer(wxVERTICAL);
szr_main->AddSpacer(space5);
szr_main->Add(dio);
szr_main->AddSpacer(space5);
szr_main->Add(controls_sizer, 1, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
szr_main->Add(CreateButtonSizer(wxCLOSE | wxNO_DEFAULT), 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
SetSizerAndFit(szr_main);
Center();
UpdateDeviceComboBox();
UpdateProfileComboBox();
UpdateGUI();
}

View File

@ -0,0 +1,14 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include "DolphinWX/Input/InputConfigDiag.h"
class GCPadInputConfigDialog final : public InputConfigDialog
{
public:
GCPadInputConfigDialog(wxWindow* parent, InputConfig& config, const wxString& name,
int port_num = 0);
};

View File

@ -0,0 +1,58 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "DolphinWX/Input/GuitarInputConfigDiag.h"
#include "Core/HW/Wiimote.h"
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
GuitarInputConfigDialog::GuitarInputConfigDialog(wxWindow* const parent, InputConfig& config,
const wxString& name, const int port_num)
: InputConfigDialog(parent, config, name, port_num)
{
const int space5 = FromDIP(5);
auto* const group_box_buttons = new ControlGroupBox(
Wiimote::GetGuitarGroup(port_num, WiimoteEmu::GuitarGroup::Buttons), this, this);
auto* const group_left_strum = new ControlGroupBox(
Wiimote::GetGuitarGroup(port_num, WiimoteEmu::GuitarGroup::Strum), this, this);
auto* const buttons_strum_sizer = new wxBoxSizer(wxVERTICAL);
buttons_strum_sizer->Add(group_box_buttons, 0, wxEXPAND);
buttons_strum_sizer->AddSpacer(space5);
buttons_strum_sizer->Add(group_left_strum, 0, wxEXPAND);
auto* const group_box_frets = new ControlGroupBox(
Wiimote::GetGuitarGroup(port_num, WiimoteEmu::GuitarGroup::Frets), this, this);
ControlGroupBox* group_box_whammy = new ControlGroupBox(
Wiimote::GetGuitarGroup(port_num, WiimoteEmu::GuitarGroup::Whammy), this, this);
auto* const frets_whammy_sizer = new wxBoxSizer(wxVERTICAL);
frets_whammy_sizer->Add(group_box_frets, 0, wxEXPAND);
frets_whammy_sizer->AddSpacer(space5);
frets_whammy_sizer->Add(group_box_whammy, 0, wxEXPAND);
auto* const group_box_stick = new ControlGroupBox(
Wiimote::GetGuitarGroup(port_num, WiimoteEmu::GuitarGroup::Stick), this, this);
auto* const controls_sizer = new wxBoxSizer(wxHORIZONTAL);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(buttons_strum_sizer, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(frets_whammy_sizer, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_stick, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
auto* const szr_main = new wxBoxSizer(wxVERTICAL);
szr_main->AddSpacer(space5);
szr_main->Add(controls_sizer, 1, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
szr_main->Add(CreateButtonSizer(wxCLOSE | wxNO_DEFAULT), 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
SetSizerAndFit(szr_main);
Center();
UpdateGUI();
}

View File

@ -0,0 +1,14 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include "DolphinWX/Input/InputConfigDiag.h"
class GuitarInputConfigDialog final : public InputConfigDialog
{
public:
GuitarInputConfigDialog(wxWindow* parent, InputConfig& config, const wxString& name,
int port_num = 0);
};

View File

@ -0,0 +1,204 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <wx/notebook.h>
#include <wx/panel.h>
#include <wx/sizer.h>
#include "Core/HotkeyManager.h"
#include "DolphinWX/Input/HotkeyInputConfigDiag.h"
enum HotkeyGroup : int;
HotkeyInputConfigDialog::HotkeyInputConfigDialog(wxWindow* const parent, InputConfig& config,
const wxString& name, const int port_num)
: InputConfigDialog(parent, config, name, port_num)
{
const int space5 = FromDIP(5);
auto* const device_chooser = CreateDeviceChooserGroupBox();
auto* const reset_sizer = CreaterResetGroupBox(wxVERTICAL);
auto* const profile_chooser = CreateProfileChooserGroupBox();
auto* const notebook = new wxNotebook(this, wxID_ANY);
// General
auto* const tab_general = new wxPanel(notebook);
auto* const group_box_general =
new ControlGroupBox(HotkeyManagerEmu::GetHotkeyGroup(HKGP_GENERAL), tab_general, this);
auto* const group_box_volume =
new ControlGroupBox(HotkeyManagerEmu::GetHotkeyGroup(HKGP_VOLUME), tab_general, this);
auto* const group_box_speed =
new ControlGroupBox(HotkeyManagerEmu::GetHotkeyGroup(HKGP_SPEED), tab_general, this);
auto* const szr_volume_speed = new wxBoxSizer(wxVERTICAL);
szr_volume_speed->AddSpacer(space5);
szr_volume_speed->Add(group_box_volume, 0, wxEXPAND);
szr_volume_speed->AddSpacer(space5);
szr_volume_speed->Add(group_box_speed, 0, wxEXPAND);
auto* const szr_general = new wxBoxSizer(wxHORIZONTAL);
szr_general->Add(group_box_general, 0, wxEXPAND | wxTOP, space5);
szr_general->AddSpacer(space5);
szr_general->Add(szr_volume_speed, 0, wxEXPAND);
tab_general->SetSizerAndFit(szr_general);
notebook->AddPage(tab_general, "General");
// TAS Tools
auto* const tab_tas = new wxPanel(notebook);
auto* const group_box_frame_advance =
new ControlGroupBox(HotkeyManagerEmu::GetHotkeyGroup(HKGP_FRANE_ADVANCE), tab_tas, this);
auto* const group_box_movie =
new ControlGroupBox(HotkeyManagerEmu::GetHotkeyGroup(HKGP_MOVIE), tab_tas, this);
auto* const szr_tas = new wxBoxSizer(wxHORIZONTAL);
szr_tas->AddSpacer(space5);
szr_tas->Add(group_box_frame_advance, 0, wxEXPAND | wxTOP, space5);
szr_tas->AddSpacer(space5);
szr_tas->Add(group_box_movie, 0, wxEXPAND | wxTOP, space5);
tab_tas->SetSizerAndFit(szr_tas);
notebook->AddPage(tab_tas, "TAS Tools");
// WII and Wii Remote
auto* const tab_wii = new wxPanel(notebook);
auto* const group_box_wii =
new ControlGroupBox(HotkeyManagerEmu::GetHotkeyGroup(HKGP_WII), tab_wii, this);
auto* const szr_wii = new wxBoxSizer(wxHORIZONTAL);
szr_wii->AddSpacer(space5);
szr_wii->Add(group_box_wii, 0, wxEXPAND | wxTOP, space5);
szr_wii->AddSpacer(space5);
tab_wii->SetSizerAndFit(szr_wii);
notebook->AddPage(tab_wii, "Wii and Wii Remote");
// Graphics
auto* const tab_graphics = new wxPanel(notebook);
auto* const group_box_graphics_toggles = new ControlGroupBox(
HotkeyManagerEmu::GetHotkeyGroup(HKGP_GRAPHICS_TOGGLES), tab_graphics, this);
auto* const group_box_ir =
new ControlGroupBox(HotkeyManagerEmu::GetHotkeyGroup(HKGP_IR), tab_graphics, this);
auto* const szr_toggle_ir = new wxBoxSizer(wxVERTICAL);
szr_toggle_ir->Add(group_box_graphics_toggles, 0, wxEXPAND);
szr_toggle_ir->AddSpacer(space5);
szr_toggle_ir->Add(group_box_ir, 0, wxEXPAND);
auto* const group_box_freelook =
new ControlGroupBox(HotkeyManagerEmu::GetHotkeyGroup(HKGP_FREELOOK), tab_graphics, this);
auto* const szr_graphics_toggles = new wxBoxSizer(wxHORIZONTAL);
szr_graphics_toggles->AddSpacer(space5);
szr_graphics_toggles->Add(szr_toggle_ir, 0, wxEXPAND | wxTOP, space5);
szr_graphics_toggles->AddSpacer(space5);
szr_graphics_toggles->Add(group_box_freelook, 0, wxEXPAND | wxTOP, space5);
szr_graphics_toggles->AddSpacer(space5);
tab_graphics->SetSizerAndFit(szr_graphics_toggles);
notebook->AddPage(tab_graphics, "Graphics");
// 3D
auto* const tab_3D = new wxPanel(notebook);
auto* const group_box_3D_toggles =
new ControlGroupBox(HotkeyManagerEmu::GetHotkeyGroup(HKGP_3D_TOGGLE), tab_3D, this);
auto* const group_box_3D_depth =
new ControlGroupBox(HotkeyManagerEmu::GetHotkeyGroup(HKGP_3D_DEPTH), tab_3D, this);
auto* const szr_3D = new wxBoxSizer(wxHORIZONTAL);
szr_3D->AddSpacer(space5);
szr_3D->Add(group_box_3D_toggles, 0, wxEXPAND | wxTOP, space5);
szr_3D->AddSpacer(space5);
szr_3D->Add(group_box_3D_depth, 0, wxEXPAND | wxTOP, space5);
szr_3D->AddSpacer(space5);
tab_3D->SetSizerAndFit(szr_3D);
notebook->AddPage(tab_3D, "3D");
// Save and Load State
auto* const tab_save_load_state = new wxPanel(notebook);
auto* const group_box_load_state = new ControlGroupBox(
HotkeyManagerEmu::GetHotkeyGroup(HKGP_LOAD_STATE), tab_save_load_state, this);
auto* const group_box_save_state = new ControlGroupBox(
HotkeyManagerEmu::GetHotkeyGroup(HKGP_SAVE_STATE), tab_save_load_state, this);
auto* const szr_save_load_state = new wxBoxSizer(wxHORIZONTAL);
szr_save_load_state->AddSpacer(space5);
szr_save_load_state->Add(group_box_load_state, 0, wxEXPAND | wxTOP, space5);
szr_save_load_state->AddSpacer(space5);
szr_save_load_state->Add(group_box_save_state, 0, wxEXPAND | wxTOP, space5);
szr_save_load_state->AddSpacer(space5);
tab_save_load_state->SetSizerAndFit(szr_save_load_state);
notebook->AddPage(tab_save_load_state, "Save and Load State");
// Other State Managament
auto* const tab_other_state = new wxPanel(notebook);
auto* const group_box_select_state = new ControlGroupBox(
HotkeyManagerEmu::GetHotkeyGroup(HKGP_SELECT_STATE), tab_other_state, this);
auto* const group_box_load_last_state = new ControlGroupBox(
HotkeyManagerEmu::GetHotkeyGroup(HKGP_LOAD_LAST_STATE), tab_other_state, this);
auto* const group_box_state_misc =
new ControlGroupBox(HotkeyManagerEmu::GetHotkeyGroup(HKGP_STATE_MISC), tab_other_state, this);
auto* const szr_other_state = new wxBoxSizer(wxHORIZONTAL);
szr_other_state->AddSpacer(space5);
szr_other_state->Add(group_box_select_state, 0, wxEXPAND | wxTOP, space5);
szr_other_state->AddSpacer(space5);
szr_other_state->Add(group_box_load_last_state, 0, wxEXPAND | wxTOP, space5);
szr_other_state->AddSpacer(space5);
szr_other_state->Add(group_box_state_misc, 0, wxEXPAND | wxTOP, space5);
szr_other_state->AddSpacer(space5);
tab_other_state->SetSizerAndFit(szr_other_state);
notebook->AddPage(tab_other_state, "Other State Management");
notebook->SetSelection(0);
auto* const device_profile_sizer = new wxBoxSizer(wxVERTICAL);
device_profile_sizer->Add(device_chooser, 1, wxEXPAND);
device_profile_sizer->Add(profile_chooser, 1, wxEXPAND);
auto* const group_box_options =
new ControlGroupBox(HotkeyManagerEmu::GetOptionsGroup(), this, this);
auto* const dio = new wxBoxSizer(wxHORIZONTAL);
dio->AddSpacer(space5);
dio->Add(device_profile_sizer, 3, wxEXPAND);
dio->Add(reset_sizer, 0, wxEXPAND);
dio->Add(group_box_options, 1, wxEXPAND);
dio->AddSpacer(space5);
auto* const szr_main = new wxBoxSizer(wxVERTICAL);
szr_main->AddSpacer(space5);
szr_main->Add(dio);
szr_main->AddSpacer(space5);
szr_main->Add(notebook, 1, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
szr_main->Add(CreateButtonSizer(wxCLOSE | wxNO_DEFAULT), 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
SetSizerAndFit(szr_main);
Center();
UpdateDeviceComboBox();
UpdateProfileComboBox();
UpdateGUI();
}

View File

@ -0,0 +1,14 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include "DolphinWX/Input/InputConfigDiag.h"
class HotkeyInputConfigDialog final : public InputConfigDialog
{
public:
HotkeyInputConfigDialog(wxWindow* parent, InputConfig& config, const wxString& name,
int port_num = 0);
};

View File

@ -42,9 +42,15 @@
#include "Core/HW/GCKeyboard.h"
#include "Core/HW/GCPad.h"
#include "Core/HW/Wiimote.h"
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
#include "Core/HotkeyManager.h"
#include "DolphinWX/DolphinSlider.h"
#include "DolphinWX/InputConfigDiag.h"
#include "DolphinWX/Input/ClassicInputConfigDiag.h"
#include "DolphinWX/Input/DrumsInputConfigDiag.h"
#include "DolphinWX/Input/GuitarInputConfigDiag.h"
#include "DolphinWX/Input/InputConfigDiag.h"
#include "DolphinWX/Input/NunchukInputConfigDiag.h"
#include "DolphinWX/Input/TurntableInputConfigDiag.h"
#include "DolphinWX/WxUtils.h"
#include "InputCommon/ControllerEmu.h"
#include "InputCommon/ControllerInterface/ControllerInterface.h"
@ -54,32 +60,47 @@
using namespace ciface::ExpressionParser;
void GamepadPage::ConfigExtension(wxCommandEvent& event)
void InputConfigDialog::ConfigExtension(wxCommandEvent& event)
{
ControllerEmu::Extension* const ex = ((ExtensionButton*)event.GetEventObject())->extension;
int extension_type = ex->switch_extension;
// show config diag, if "none" isn't selected
if (ex->switch_extension)
switch (extension_type)
{
wxDialog dlg(this, wxID_ANY,
wxGetTranslation(StrToWxStr(ex->attachments[ex->switch_extension]->GetName())));
wxBoxSizer* const main_szr = new wxBoxSizer(wxVERTICAL);
const std::size_t orig_size = control_groups.size();
ControlGroupsSizer* const szr = new ControlGroupsSizer(
ex->attachments[ex->switch_extension].get(), &dlg, this, &control_groups);
const int space5 = FromDIP(5);
main_szr->Add(szr, 0, wxLEFT, space5);
main_szr->Add(dlg.CreateButtonSizer(wxOK), 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
main_szr->AddSpacer(space5);
dlg.SetSizerAndFit(main_szr);
dlg.Center();
case WiimoteEmu::EXT_NUNCHUK:
{
NunchukInputConfigDialog dlg(this, m_config, _("Nunchuk Configuration"), m_port_num);
dlg.ShowModal();
// remove the new groups that were just added, now that the window closed
control_groups.resize(orig_size);
}
break;
case WiimoteEmu::EXT_CLASSIC:
{
ClassicInputConfigDialog dlg(this, m_config, _("Classic Controller Configuration"), m_port_num);
dlg.ShowModal();
}
break;
case WiimoteEmu::EXT_GUITAR:
{
GuitarInputConfigDialog dlg(this, m_config, _("Guitar Configuration"), m_port_num);
dlg.ShowModal();
}
break;
case WiimoteEmu::EXT_DRUMS:
{
DrumsInputConfigDialog dlg(this, m_config, _("Drums Configuration"), m_port_num);
dlg.ShowModal();
}
break;
case WiimoteEmu::EXT_TURNTABLE:
{
TurntableInputConfigDialog dlg(this, m_config, _("Turntable Configuration"), m_port_num);
dlg.ShowModal();
}
break;
default:
break;
}
}
@ -150,13 +171,13 @@ void PadSettingSpin::UpdateValue()
setting->SetValue(ControlState(((wxSpinCtrl*)wxcontrol)->GetValue()) / 100);
}
ControlDialog::ControlDialog(GamepadPage* const parent, InputConfig& config,
ControlDialog::ControlDialog(InputConfigDialog* const parent, InputConfig& config,
ControllerInterface::ControlReference* const ref)
: wxDialog(parent, wxID_ANY, _("Configure Control"), wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
control_reference(ref), m_config(config), m_parent(parent)
{
m_devq = m_parent->controller->default_device;
m_devq = m_parent->GetController()->default_device;
const int space5 = FromDIP(5);
// GetStrings() sounds slow :/
@ -229,19 +250,13 @@ void InputConfigDialog::UpdateProfileComboBox()
strs.push_back(StrToWxStr(base));
}
for (GamepadPage* page : m_padpages)
{
page->profile_cbox->Clear();
page->profile_cbox->Append(strs);
}
profile_cbox->Clear();
profile_cbox->Append(strs);
}
void InputConfigDialog::UpdateControlReferences()
{
for (GamepadPage* page : m_padpages)
{
page->controller->UpdateReferences(g_controller_interface);
}
controller->UpdateReferences(g_controller_interface);
}
void InputConfigDialog::OnClose(wxCloseEvent& event)
@ -315,9 +330,10 @@ void ControlDialog::UpdateGUI()
}
};
void GamepadPage::UpdateGUI()
void InputConfigDialog::UpdateGUI()
{
device_cbox->SetValue(StrToWxStr(controller->default_device.ToString()));
if (device_cbox != nullptr)
device_cbox->SetValue(StrToWxStr(controller->default_device.ToString()));
for (ControlGroupBox* cgBox : control_groups)
{
@ -333,7 +349,7 @@ void GamepadPage::UpdateGUI()
}
}
void GamepadPage::ClearAll(wxCommandEvent&)
void InputConfigDialog::ClearAll(wxCommandEvent&)
{
// just load an empty ini section to clear everything :P
IniFile::Section section;
@ -347,7 +363,7 @@ void GamepadPage::ClearAll(wxCommandEvent&)
UpdateGUI();
}
void GamepadPage::LoadDefaults(wxCommandEvent&)
void InputConfigDialog::LoadDefaults(wxCommandEvent&)
{
controller->LoadDefaults(g_controller_interface);
@ -361,7 +377,8 @@ bool ControlDialog::Validate()
control_reference->expression = WxStrToStr(textctrl->GetValue());
auto lock = ControllerEmu::GetStateLock();
g_controller_interface.UpdateReference(control_reference, m_parent->controller->default_device);
g_controller_interface.UpdateReference(control_reference,
m_parent->GetController()->default_device);
UpdateGUI();
@ -369,7 +386,7 @@ bool ControlDialog::Validate()
control_reference->parse_error == EXPRESSION_PARSE_NO_DEVICE);
}
void GamepadPage::SetDevice(wxCommandEvent&)
void InputConfigDialog::SetDevice(wxCommandEvent&)
{
controller->default_device.FromString(WxStrToStr(device_cbox->GetValue()));
@ -399,7 +416,8 @@ void ControlDialog::ClearControl(wxCommandEvent&)
control_reference->expression.clear();
auto lock = ControllerEmu::GetStateLock();
g_controller_interface.UpdateReference(control_reference, m_parent->controller->default_device);
g_controller_interface.UpdateReference(control_reference,
m_parent->GetController()->default_device);
UpdateGUI();
}
@ -441,7 +459,7 @@ bool ControlDialog::GetExpressionForSelectedControl(wxString& expr)
return false;
wxString control_name = control_lbox->GetString(num);
GetExpressionForControl(expr, control_name, &m_devq, &m_parent->controller->default_device);
GetExpressionForControl(expr, control_name, &m_devq, &m_parent->GetController()->default_device);
return true;
}
@ -457,7 +475,8 @@ void ControlDialog::SetSelectedControl(wxCommandEvent&)
control_reference->expression = textctrl->GetValue();
auto lock = ControllerEmu::GetStateLock();
g_controller_interface.UpdateReference(control_reference, m_parent->controller->default_device);
g_controller_interface.UpdateReference(control_reference,
m_parent->GetController()->default_device);
UpdateGUI();
}
@ -492,13 +511,14 @@ void ControlDialog::AppendControl(wxCommandEvent& event)
control_reference->expression = textctrl->GetValue();
auto lock = ControllerEmu::GetStateLock();
g_controller_interface.UpdateReference(control_reference, m_parent->controller->default_device);
g_controller_interface.UpdateReference(control_reference,
m_parent->GetController()->default_device);
UpdateGUI();
}
void GamepadPage::EnablePadSetting(const std::string& group_name, const std::string& name,
const bool enabled)
void InputConfigDialog::EnablePadSetting(const std::string& group_name, const std::string& name,
const bool enabled)
{
const auto box_iterator =
std::find_if(control_groups.begin(), control_groups.end(), [&group_name](const auto& box) {
@ -517,8 +537,8 @@ void GamepadPage::EnablePadSetting(const std::string& group_name, const std::str
(*it)->wxcontrol->Enable(enabled);
}
void GamepadPage::EnableControlButton(const std::string& group_name, const std::string& name,
const bool enabled)
void InputConfigDialog::EnableControlButton(const std::string& group_name, const std::string& name,
const bool enabled)
{
const auto box_iterator =
std::find_if(control_groups.begin(), control_groups.end(), [&group_name](const auto& box) {
@ -553,14 +573,14 @@ void ControlDialog::OnRangeThumbtrack(wxScrollEvent& event)
m_range_spinner->SetValue(event.GetPosition());
}
void GamepadPage::AdjustSetting(wxCommandEvent& event)
void InputConfigDialog::AdjustSetting(wxCommandEvent& event)
{
const auto* const control = static_cast<wxControl*>(event.GetEventObject());
auto* const pad_setting = static_cast<PadSetting*>(control->GetClientData());
pad_setting->UpdateValue();
}
void GamepadPage::AdjustBooleanSetting(wxCommandEvent& event)
void InputConfigDialog::AdjustBooleanSetting(wxCommandEvent& event)
{
const auto* const control = static_cast<wxControl*>(event.GetEventObject());
auto* const pad_setting = static_cast<PadSettingCheckBox*>(control->GetClientData());
@ -578,7 +598,7 @@ void GamepadPage::AdjustBooleanSetting(wxCommandEvent& event)
}
}
void GamepadPage::ConfigControl(wxEvent& event)
void InputConfigDialog::ConfigControl(wxEvent& event)
{
m_control_dialog = new ControlDialog(this, m_config,
((ControlButton*)event.GetEventObject())->control_reference);
@ -589,7 +609,7 @@ void GamepadPage::ConfigControl(wxEvent& event)
UpdateGUI();
}
void GamepadPage::ClearControl(wxEvent& event)
void InputConfigDialog::ClearControl(wxEvent& event)
{
ControlButton* const btn = (ControlButton*)event.GetEventObject();
btn->control_reference->expression.clear();
@ -630,7 +650,7 @@ void ControlDialog::DetectControl(wxCommandEvent& event)
}
}
void GamepadPage::DetectControl(wxCommandEvent& event)
void InputConfigDialog::DetectControl(wxCommandEvent& event)
{
auto* btn = static_cast<ControlButton*>(event.GetEventObject());
if (DetectButton(btn) && m_iterate)
@ -649,7 +669,7 @@ void GamepadPage::DetectControl(wxCommandEvent& event)
}
}
bool GamepadPage::DetectButton(ControlButton* button)
bool InputConfigDialog::DetectButton(ControlButton* button)
{
bool success = false;
// find device :/
@ -687,7 +707,7 @@ bool GamepadPage::DetectButton(ControlButton* button)
return success;
}
wxStaticBoxSizer* ControlDialog::CreateControlChooser(GamepadPage* const parent)
wxStaticBoxSizer* ControlDialog::CreateControlChooser(InputConfigDialog* const parent)
{
wxStaticBoxSizer* const main_szr = new wxStaticBoxSizer(
wxVERTICAL, this, control_reference->is_input ? _("Input") : _("Output"));
@ -785,7 +805,7 @@ wxStaticBoxSizer* ControlDialog::CreateControlChooser(GamepadPage* const parent)
return main_szr;
}
void GamepadPage::GetProfilePath(std::string& path)
void InputConfigDialog::GetProfilePath(std::string& path)
{
const wxString& name = profile_cbox->GetValue();
if (!name.empty())
@ -801,10 +821,15 @@ void GamepadPage::GetProfilePath(std::string& path)
}
}
void GamepadPage::LoadProfile(wxCommandEvent&)
ControllerEmu* InputConfigDialog::GetController() const
{
return controller;
}
void InputConfigDialog::LoadProfile(wxCommandEvent&)
{
std::string fname;
GamepadPage::GetProfilePath(fname);
InputConfigDialog::GetProfilePath(fname);
if (!File::Exists(fname))
return;
@ -818,10 +843,10 @@ void GamepadPage::LoadProfile(wxCommandEvent&)
UpdateGUI();
}
void GamepadPage::SaveProfile(wxCommandEvent&)
void InputConfigDialog::SaveProfile(wxCommandEvent&)
{
std::string fname;
GamepadPage::GetProfilePath(fname);
InputConfigDialog::GetProfilePath(fname);
File::CreateFullPath(fname);
if (!fname.empty())
@ -830,7 +855,7 @@ void GamepadPage::SaveProfile(wxCommandEvent&)
controller->SaveConfig(inifile.GetOrCreateSection("Profile"));
inifile.Save(fname);
m_config_dialog->UpdateProfileComboBox();
UpdateProfileComboBox();
}
else
{
@ -838,10 +863,10 @@ void GamepadPage::SaveProfile(wxCommandEvent&)
}
}
void GamepadPage::DeleteProfile(wxCommandEvent&)
void InputConfigDialog::DeleteProfile(wxCommandEvent&)
{
std::string fname;
GamepadPage::GetProfilePath(fname);
InputConfigDialog::GetProfilePath(fname);
const char* const fnamecstr = fname.c_str();
@ -850,24 +875,21 @@ void GamepadPage::DeleteProfile(wxCommandEvent&)
{
File::Delete(fnamecstr);
m_config_dialog->UpdateProfileComboBox();
UpdateProfileComboBox();
}
}
void InputConfigDialog::UpdateDeviceComboBox()
{
for (GamepadPage* page : m_padpages)
{
page->device_cbox->Clear();
device_cbox->Clear();
for (const std::string& device_string : g_controller_interface.GetAllDeviceStrings())
page->device_cbox->Append(StrToWxStr(device_string));
for (const std::string& device_string : g_controller_interface.GetAllDeviceStrings())
device_cbox->Append(StrToWxStr(device_string));
page->device_cbox->SetValue(StrToWxStr(page->controller->default_device.ToString()));
}
device_cbox->SetValue(StrToWxStr(controller->default_device.ToString()));
}
void GamepadPage::RefreshDevices(wxCommandEvent&)
void InputConfigDialog::RefreshDevices(wxCommandEvent&)
{
bool was_unpaused = Core::PauseAndLock(true);
@ -875,10 +897,10 @@ void GamepadPage::RefreshDevices(wxCommandEvent&)
g_controller_interface.Reinitialize();
// update all control references
m_config_dialog->UpdateControlReferences();
UpdateControlReferences();
// update device cbox
m_config_dialog->UpdateDeviceComboBox();
UpdateDeviceComboBox();
Wiimote::LoadConfig();
Keyboard::LoadConfig();
@ -897,8 +919,9 @@ ControlGroupBox::~ControlGroupBox()
}
ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWindow* const parent,
GamepadPage* const eventsink)
: wxBoxSizer(wxVERTICAL), control_group(group), static_bitmap(nullptr), m_scale(1)
InputConfigDialog* eventsink)
: wxStaticBoxSizer(wxVERTICAL, parent, wxGetTranslation(StrToWxStr(group->ui_name))),
control_group(group), static_bitmap(nullptr), m_scale(1)
{
static constexpr std::array<const char* const, 2> exclude_buttons{{"Mic", "Modifier"}};
static constexpr std::array<const char* const, 7> exclude_groups{
@ -929,16 +952,16 @@ ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWin
{
control_button->SetToolTip(
_("Left-click to detect input.\nMiddle-click to clear.\nRight-click for more options."));
control_button->Bind(wxEVT_BUTTON, &GamepadPage::DetectControl, eventsink);
control_button->Bind(wxEVT_BUTTON, &InputConfigDialog::DetectControl, eventsink);
}
else
{
control_button->SetToolTip(_("Left/Right-click for more options.\nMiddle-click to clear."));
control_button->Bind(wxEVT_BUTTON, &GamepadPage::ConfigControl, eventsink);
control_button->Bind(wxEVT_BUTTON, &InputConfigDialog::ConfigControl, eventsink);
}
control_button->Bind(wxEVT_MIDDLE_DOWN, &GamepadPage::ClearControl, eventsink);
control_button->Bind(wxEVT_RIGHT_UP, &GamepadPage::ConfigControl, eventsink);
control_button->Bind(wxEVT_MIDDLE_DOWN, &InputConfigDialog::ClearControl, eventsink);
control_button->Bind(wxEVT_RIGHT_UP, &InputConfigDialog::ConfigControl, eventsink);
control_grid->Add(label, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT);
control_grid->Add(control_button, 0, wxALIGN_CENTER_VERTICAL);
@ -968,7 +991,7 @@ ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWin
for (auto& groupSetting : group->numeric_settings)
{
PadSettingSpin* setting = new PadSettingSpin(parent, groupSetting.get());
setting->wxcontrol->Bind(wxEVT_SPINCTRL, &GamepadPage::AdjustSetting, eventsink);
setting->wxcontrol->Bind(wxEVT_SPINCTRL, &InputConfigDialog::AdjustSetting, eventsink);
options.push_back(setting);
szr->Add(
new wxStaticText(parent, wxID_ANY, wxGetTranslation(StrToWxStr(groupSetting->m_name))));
@ -977,7 +1000,8 @@ ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWin
for (auto& groupSetting : group->boolean_settings)
{
auto* checkbox = new PadSettingCheckBox(parent, groupSetting.get());
checkbox->wxcontrol->Bind(wxEVT_CHECKBOX, &GamepadPage::AdjustBooleanSetting, eventsink);
checkbox->wxcontrol->Bind(wxEVT_CHECKBOX, &InputConfigDialog::AdjustBooleanSetting,
eventsink);
options.push_back(checkbox);
Add(checkbox->wxcontrol, 0, wxALL | wxLEFT, space3);
}
@ -1010,7 +1034,7 @@ ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWin
wxBITMAP_TYPE_BMP);
auto* const threshold_cbox = new PadSettingSpin(parent, group->numeric_settings[0].get());
threshold_cbox->wxcontrol->Bind(wxEVT_SPINCTRL, &GamepadPage::AdjustSetting, eventsink);
threshold_cbox->wxcontrol->Bind(wxEVT_SPINCTRL, &InputConfigDialog::AdjustSetting, eventsink);
threshold_cbox->wxcontrol->SetToolTip(
_("Adjust the analog control pressure required to activate buttons."));
@ -1057,7 +1081,7 @@ ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWin
for (auto& groupSetting : group->numeric_settings)
{
PadSettingSpin* setting = new PadSettingSpin(parent, groupSetting.get());
setting->wxcontrol->Bind(wxEVT_SPINCTRL, &GamepadPage::AdjustSetting, eventsink);
setting->wxcontrol->Bind(wxEVT_SPINCTRL, &InputConfigDialog::AdjustSetting, eventsink);
options.push_back(setting);
wxBoxSizer* const szr = new wxBoxSizer(wxHORIZONTAL);
szr->Add(
@ -1081,8 +1105,8 @@ ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWin
options.push_back(attachments);
attachments->wxcontrol->Bind(wxEVT_CHOICE, &GamepadPage::AdjustSetting, eventsink);
configure_btn->Bind(wxEVT_BUTTON, &GamepadPage::ConfigExtension, eventsink);
attachments->wxcontrol->Bind(wxEVT_CHOICE, &InputConfigDialog::AdjustSetting, eventsink);
configure_btn->Bind(wxEVT_BUTTON, &InputConfigDialog::ConfigExtension, eventsink);
AddSpacer(space3);
Add(attachments->wxcontrol, 0, wxEXPAND | wxLEFT | wxRIGHT, space3);
@ -1096,7 +1120,8 @@ ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWin
for (auto& groupSetting : group->boolean_settings)
{
PadSettingCheckBox* setting_cbox = new PadSettingCheckBox(parent, groupSetting.get());
setting_cbox->wxcontrol->Bind(wxEVT_CHECKBOX, &GamepadPage::AdjustBooleanSetting, eventsink);
setting_cbox->wxcontrol->Bind(wxEVT_CHECKBOX, &InputConfigDialog::AdjustBooleanSetting,
eventsink);
if (groupSetting->m_name == "Iterative Input")
groupSetting->SetValue(false);
options.push_back(setting_cbox);
@ -1106,7 +1131,7 @@ ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWin
for (auto& groupSetting : group->numeric_settings)
{
PadSettingSpin* setting = new PadSettingSpin(parent, groupSetting.get());
setting->wxcontrol->Bind(wxEVT_SPINCTRL, &GamepadPage::AdjustSetting, eventsink);
setting->wxcontrol->Bind(wxEVT_SPINCTRL, &InputConfigDialog::AdjustSetting, eventsink);
options.push_back(setting);
wxBoxSizer* const szr = new wxBoxSizer(wxHORIZONTAL);
szr->Add(
@ -1114,70 +1139,18 @@ ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWin
wxALIGN_CENTER_VERTICAL, space3);
szr->Add(setting->wxcontrol, 0, wxLEFT, space3);
AddSpacer(space3);
Add(szr, 0, wxLEFT | wxRIGHT, space3);
Add(szr, 0, wxLEFT | wxRIGHT | wxALIGN_RIGHT, space3);
}
break;
}
}
AddSpacer(space3);
eventsink->control_groups.push_back(this);
}
ControlGroupsSizer::ControlGroupsSizer(ControllerEmu* const controller, wxWindow* const parent,
GamepadPage* const eventsink,
std::vector<ControlGroupBox*>* groups)
: wxBoxSizer(wxHORIZONTAL)
wxBoxSizer* InputConfigDialog::CreateDeviceChooserGroupBox()
{
const int space5 = parent->FromDIP(5);
size_t col_size = 0;
wxBoxSizer* stacked_groups = nullptr;
for (auto& group : controller->groups)
{
wxStaticBoxSizer* control_group =
new wxStaticBoxSizer(wxVERTICAL, parent, wxGetTranslation(StrToWxStr(group->ui_name)));
ControlGroupBox* control_group_box =
new ControlGroupBox(group.get(), control_group->GetStaticBox(), eventsink);
control_group->Add(control_group_box, 0, wxEXPAND);
const size_t grp_size =
group->controls.size() + group->numeric_settings.size() + group->boolean_settings.size();
col_size += grp_size;
if (col_size > 8 || nullptr == stacked_groups)
{
if (stacked_groups)
{
Add(stacked_groups, 0, wxBOTTOM, space5);
AddSpacer(space5);
}
stacked_groups = new wxBoxSizer(wxVERTICAL);
stacked_groups->Add(control_group, 0, wxEXPAND);
col_size = grp_size;
}
else
{
stacked_groups->Add(control_group, 0, wxEXPAND);
}
if (groups)
groups->push_back(control_group_box);
}
if (stacked_groups)
Add(stacked_groups, 0, wxBOTTOM, space5);
}
GamepadPage::GamepadPage(wxWindow* parent, InputConfig& config, const int pad_num,
InputConfigDialog* const config_dialog)
: wxPanel(parent, wxID_ANY), controller(config.GetController(pad_num)),
m_config_dialog(config_dialog), m_config(config)
{
wxBoxSizer* control_group_sizer = new ControlGroupsSizer(controller, this, this, &control_groups);
const int space3 = FromDIP(3);
const int space5 = FromDIP(5);
// device chooser
wxStaticBoxSizer* const device_sbox = new wxStaticBoxSizer(wxVERTICAL, this, _("Device"));
device_cbox = new wxComboBox(device_sbox->GetStaticBox(), wxID_ANY, "");
@ -1186,9 +1159,9 @@ GamepadPage::GamepadPage(wxWindow* parent, InputConfig& config, const int pad_nu
wxButton* refresh_button = new wxButton(device_sbox->GetStaticBox(), wxID_ANY, _("Refresh"),
wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
device_cbox->Bind(wxEVT_COMBOBOX, &GamepadPage::SetDevice, this);
device_cbox->Bind(wxEVT_TEXT_ENTER, &GamepadPage::SetDevice, this);
refresh_button->Bind(wxEVT_BUTTON, &GamepadPage::RefreshDevices, this);
device_cbox->Bind(wxEVT_COMBOBOX, &InputConfigDialog::SetDevice, this);
device_cbox->Bind(wxEVT_TEXT_ENTER, &InputConfigDialog::SetDevice, this);
refresh_button->Bind(wxEVT_BUTTON, &InputConfigDialog::RefreshDevices, this);
wxBoxSizer* const device_sbox_in = new wxBoxSizer(wxHORIZONTAL);
device_sbox_in->Add(WxUtils::GiveMinSizeDIP(device_cbox, wxSize(64, -1)), 1,
@ -1196,25 +1169,32 @@ GamepadPage::GamepadPage(wxWindow* parent, InputConfig& config, const int pad_nu
device_sbox_in->Add(refresh_button, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, space3);
device_sbox->Add(device_sbox_in, 1, wxEXPAND | wxLEFT | wxRIGHT, space3);
device_sbox->AddSpacer(space3);
return device_sbox;
}
// Clear / Reset buttons
wxStaticBoxSizer* const clear_sbox = new wxStaticBoxSizer(wxVERTICAL, this, _("Reset"));
wxBoxSizer* InputConfigDialog::CreaterResetGroupBox(wxOrientation orientation)
{
const int space3 = FromDIP(3);
wxStaticBoxSizer* const clear_sbox = new wxStaticBoxSizer(orientation, this, _("Reset"));
wxButton* const default_button = new wxButton(clear_sbox->GetStaticBox(), wxID_ANY, _("Default"),
wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
wxButton* const clearall_button = new wxButton(clear_sbox->GetStaticBox(), wxID_ANY, _("Clear"),
wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
wxBoxSizer* clear_sbox_in = new wxBoxSizer(wxHORIZONTAL);
clear_sbox_in->Add(default_button, 1, wxALIGN_CENTER_VERTICAL);
clear_sbox_in->Add(clearall_button, 1, wxALIGN_CENTER_VERTICAL);
clear_sbox->Add(clear_sbox_in, 1, wxEXPAND | wxLEFT | wxRIGHT, space3);
clear_sbox->AddSpacer(space3);
wxBoxSizer* clear_sbox_in = new wxBoxSizer(orientation);
clear_sbox_in->Add(default_button, 1, wxEXPAND);
clear_sbox_in->Add(clearall_button, 1, wxEXPAND);
clear_sbox->Add(clear_sbox_in, 1, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, space3);
clearall_button->Bind(wxEVT_BUTTON, &GamepadPage::ClearAll, this);
default_button->Bind(wxEVT_BUTTON, &GamepadPage::LoadDefaults, this);
clearall_button->Bind(wxEVT_BUTTON, &InputConfigDialog::ClearAll, this);
default_button->Bind(wxEVT_BUTTON, &InputConfigDialog::LoadDefaults, this);
return clear_sbox;
}
// Profile selector
wxBoxSizer* InputConfigDialog::CreateProfileChooserGroupBox()
{
const int space3 = FromDIP(3);
wxStaticBoxSizer* profile_sbox = new wxStaticBoxSizer(wxVERTICAL, this, _("Profile"));
profile_cbox = new wxComboBox(profile_sbox->GetStaticBox(), wxID_ANY, "");
@ -1225,9 +1205,9 @@ GamepadPage::GamepadPage(wxWindow* parent, InputConfig& config, const int pad_nu
wxButton* const pdelete_btn = new wxButton(profile_sbox->GetStaticBox(), wxID_ANY, _("Delete"),
wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
pload_btn->Bind(wxEVT_BUTTON, &GamepadPage::LoadProfile, this);
psave_btn->Bind(wxEVT_BUTTON, &GamepadPage::SaveProfile, this);
pdelete_btn->Bind(wxEVT_BUTTON, &GamepadPage::DeleteProfile, this);
pload_btn->Bind(wxEVT_BUTTON, &InputConfigDialog::LoadProfile, this);
psave_btn->Bind(wxEVT_BUTTON, &InputConfigDialog::SaveProfile, this);
pdelete_btn->Bind(wxEVT_BUTTON, &InputConfigDialog::DeleteProfile, this);
wxBoxSizer* profile_sbox_in = new wxBoxSizer(wxHORIZONTAL);
profile_sbox_in->Add(WxUtils::GiveMinSizeDIP(profile_cbox, wxSize(64, -1)), 1,
@ -1238,55 +1218,19 @@ GamepadPage::GamepadPage(wxWindow* parent, InputConfig& config, const int pad_nu
profile_sbox_in->Add(pdelete_btn, 0, wxALIGN_CENTER_VERTICAL);
profile_sbox->Add(profile_sbox_in, 1, wxEXPAND | wxLEFT | wxRIGHT, space3);
profile_sbox->AddSpacer(space3);
wxBoxSizer* const dio = new wxBoxSizer(wxHORIZONTAL);
dio->Add(device_sbox, 1, wxEXPAND);
dio->Add(clear_sbox, 0, wxEXPAND | wxLEFT, space5);
dio->Add(profile_sbox, 1, wxEXPAND | wxLEFT, space5);
wxBoxSizer* const mapping = new wxBoxSizer(wxVERTICAL);
mapping->AddSpacer(space5);
mapping->Add(dio, 1, wxEXPAND | wxLEFT | wxRIGHT, space5);
mapping->AddSpacer(space5);
mapping->Add(control_group_sizer, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
UpdateGUI();
SetSizerAndFit(mapping); // needed
Layout();
};
return profile_sbox;
}
InputConfigDialog::InputConfigDialog(wxWindow* const parent, InputConfig& config,
const wxString& name, const int tab_num)
: wxDialog(parent, wxID_ANY, name), m_config(config)
const wxString& name, const int port_num)
: wxDialog(parent, wxID_ANY, name), controller(config.GetController(port_num)),
m_config(config), m_port_num(port_num)
{
m_pad_notebook = new wxNotebook(this, wxID_ANY);
GamepadPage* gp = new GamepadPage(m_pad_notebook, m_config, tab_num, this);
m_padpages.push_back(gp);
m_pad_notebook->AddPage(gp, wxString::Format("%s [%u]",
wxGetTranslation(StrToWxStr(m_config.GetGUIName())),
1 + tab_num));
m_pad_notebook->SetSelection(0);
UpdateDeviceComboBox();
UpdateProfileComboBox();
Bind(wxEVT_CLOSE_WINDOW, &InputConfigDialog::OnClose, this);
Bind(wxEVT_BUTTON, &InputConfigDialog::OnCloseButton, this, wxID_CLOSE);
wxBoxSizer* const szr = new wxBoxSizer(wxVERTICAL);
const int space5 = FromDIP(5);
szr->AddSpacer(space5);
szr->Add(m_pad_notebook, 1, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr->AddSpacer(space5);
szr->Add(CreateButtonSizer(wxCLOSE | wxNO_DEFAULT), 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr->AddSpacer(space5);
SetLayoutAdaptationMode(wxDIALOG_ADAPTATION_MODE_ENABLED);
SetLayoutAdaptationLevel(wxDIALOG_ADAPTATION_STANDARD_SIZER);
SetSizerAndFit(szr);
Center();
// live preview update timer
m_update_timer.SetOwner(this);

View File

@ -31,7 +31,6 @@ class DolphinSlider;
class InputConfig;
class wxComboBox;
class wxListBox;
class wxNotebook;
class wxStaticBitmap;
class wxStaticText;
class wxTextCtrl;
@ -100,12 +99,12 @@ private:
bool m_block = false;
};
class GamepadPage;
class InputConfigDialog;
class ControlDialog : public wxDialog
{
public:
ControlDialog(GamepadPage* const parent, InputConfig& config,
ControlDialog(InputConfigDialog* const parent, InputConfig& config,
ControllerInterface::ControlReference* const ref);
bool Validate() override;
@ -116,7 +115,7 @@ public:
InputConfig& m_config;
private:
wxStaticBoxSizer* CreateControlChooser(GamepadPage* const parent);
wxStaticBoxSizer* CreateControlChooser(InputConfigDialog* parent);
void UpdateGUI();
void UpdateListContents();
@ -134,7 +133,7 @@ private:
bool GetExpressionForSelectedControl(wxString& expr);
GamepadPage* const m_parent;
InputConfigDialog* m_parent;
wxComboBox* device_cbox;
wxTextCtrl* textctrl;
wxListBox* control_lbox;
@ -172,11 +171,11 @@ protected:
int m_configured_width = wxDefaultCoord;
};
class ControlGroupBox : public wxBoxSizer
class ControlGroupBox : public wxStaticBoxSizer
{
public:
ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWindow* const parent,
GamepadPage* const eventsink);
InputConfigDialog* eventsink);
~ControlGroupBox();
bool HasBitmapHeading() const
@ -193,24 +192,21 @@ public:
double m_scale;
};
class ControlGroupsSizer : public wxBoxSizer
class InputConfigDialog : public wxDialog
{
public:
ControlGroupsSizer(ControllerEmu* const controller, wxWindow* const parent,
GamepadPage* const eventsink,
std::vector<ControlGroupBox*>* const groups = nullptr);
};
InputConfigDialog(wxWindow* const parent, InputConfig& config, const wxString& name,
const int port_num = 0);
virtual ~InputConfigDialog() = default;
class InputConfigDialog;
void OnClose(wxCloseEvent& event);
void OnCloseButton(wxCommandEvent& event);
class GamepadPage : public wxPanel
{
friend class InputConfigDialog;
friend class ControlDialog;
void UpdateDeviceComboBox();
void UpdateProfileComboBox();
public:
GamepadPage(wxWindow* parent, InputConfig& config, const int pad_num,
InputConfigDialog* const config_dialog);
void UpdateControlReferences();
void UpdateBitmaps(wxTimerEvent&);
void UpdateGUI();
@ -238,44 +234,29 @@ public:
void AdjustBooleanSetting(wxCommandEvent& event);
void GetProfilePath(std::string& path);
ControllerEmu* GetController() const;
wxComboBox* profile_cbox;
wxComboBox* device_cbox;
wxComboBox* profile_cbox = nullptr;
wxComboBox* device_cbox = nullptr;
std::vector<ControlGroupBox*> control_groups;
std::vector<ControlButton*> control_buttons;
protected:
wxBoxSizer* CreateDeviceChooserGroupBox();
wxBoxSizer* CreaterResetGroupBox(wxOrientation orientation);
wxBoxSizer* CreateProfileChooserGroupBox();
ControllerEmu* const controller;
wxTimer m_update_timer;
private:
ControlDialog* m_control_dialog;
InputConfigDialog* const m_config_dialog;
InputConfig& m_config;
int m_port_num;
ControlDialog* m_control_dialog;
InputEventFilter m_event_filter;
bool DetectButton(ControlButton* button);
bool m_iterate = false;
};
class InputConfigDialog : public wxDialog
{
public:
InputConfigDialog(wxWindow* const parent, InputConfig& config, const wxString& name,
const int tab_num = 0);
void OnClose(wxCloseEvent& event);
void OnCloseButton(wxCommandEvent& event);
void UpdateDeviceComboBox();
void UpdateProfileComboBox();
void UpdateControlReferences();
void UpdateBitmaps(wxTimerEvent&);
private:
wxNotebook* m_pad_notebook;
std::vector<GamepadPage*> m_padpages;
InputConfig& m_config;
wxTimer m_update_timer;
};

View File

@ -19,7 +19,7 @@
#include <wx/settings.h>
#include <wx/statbmp.h>
#include "DolphinWX/InputConfigDiag.h"
#include "DolphinWX/Input/InputConfigDiag.h"
#include "DolphinWX/WxUtils.h"
#include "InputCommon/ControllerEmu.h"
@ -487,12 +487,9 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
g_controller_interface.UpdateInput();
GamepadPage* const current_page =
static_cast<GamepadPage*>(m_pad_notebook->GetPage(m_pad_notebook->GetSelection()));
wxMemoryDC dc;
auto lock = ControllerEmu::GetStateLock();
for (ControlGroupBox* g : current_page->control_groups)
for (ControlGroupBox* g : control_groups)
{
// Only if this control group has a bitmap
if (!g->static_bitmap)

View File

@ -0,0 +1,54 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "DolphinWX/Input/NunchukInputConfigDiag.h"
#include "Core/HW/Wiimote.h"
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
NunchukInputConfigDialog::NunchukInputConfigDialog(wxWindow* const parent, InputConfig& config,
const wxString& name, const int port_num)
: InputConfigDialog(parent, config, name, port_num)
{
const int space5 = FromDIP(5);
auto* const group_box_buttons = new ControlGroupBox(
Wiimote::GetNunchukGroup(port_num, WiimoteEmu::NunchukGroup::Buttons), this, this);
auto* const group_box_shake = new ControlGroupBox(
Wiimote::GetNunchukGroup(port_num, WiimoteEmu::NunchukGroup::Shake), this, this);
auto* const buttons_shake = new wxBoxSizer(wxVERTICAL);
buttons_shake->Add(group_box_buttons, 0, wxEXPAND);
buttons_shake->AddSpacer(space5);
buttons_shake->Add(group_box_shake, 0, wxEXPAND);
auto* const group_box_stick = new ControlGroupBox(
Wiimote::GetNunchukGroup(port_num, WiimoteEmu::NunchukGroup::Stick), this, this);
auto* const group_box_tilt = new ControlGroupBox(
Wiimote::GetNunchukGroup(port_num, WiimoteEmu::NunchukGroup::Tilt), this, this);
auto* const group_box_swing = new ControlGroupBox(
Wiimote::GetNunchukGroup(port_num, WiimoteEmu::NunchukGroup::Swing), this, this);
auto* const controls_sizer = new wxBoxSizer(wxHORIZONTAL);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(buttons_shake, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_stick, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_tilt, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_swing, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
auto* const szr_main = new wxBoxSizer(wxVERTICAL);
szr_main->AddSpacer(space5);
szr_main->Add(controls_sizer, 1, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
szr_main->Add(CreateButtonSizer(wxCLOSE | wxNO_DEFAULT), 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
SetSizerAndFit(szr_main);
Center();
UpdateGUI();
}

View File

@ -0,0 +1,14 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include "DolphinWX/Input/InputConfigDiag.h"
class NunchukInputConfigDialog final : public InputConfigDialog
{
public:
NunchukInputConfigDialog(wxWindow* parent, InputConfig& config, const wxString& name,
int port_num = 0);
};

View File

@ -0,0 +1,62 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "DolphinWX/Input/TurntableInputConfigDiag.h"
#include "Core/HW/Wiimote.h"
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
TurntableInputConfigDialog::TurntableInputConfigDialog(wxWindow* const parent, InputConfig& config,
const wxString& name, const int port_num)
: InputConfigDialog(parent, config, name, port_num)
{
const int space5 = FromDIP(5);
auto* const group_box_stick = new ControlGroupBox(
Wiimote::GetTurntableGroup(port_num, WiimoteEmu::TurntableGroup::Stick), this, this);
auto* const group_box_effect_dial = new ControlGroupBox(
Wiimote::GetTurntableGroup(port_num, WiimoteEmu::TurntableGroup::EffectDial), this, this);
auto* const stick_effect_sizer = new wxBoxSizer(wxVERTICAL);
stick_effect_sizer->Add(group_box_stick, 0, wxEXPAND);
stick_effect_sizer->AddSpacer(space5);
stick_effect_sizer->Add(group_box_effect_dial, 0, wxEXPAND);
auto* const group_box_left_table = new ControlGroupBox(
Wiimote::GetTurntableGroup(port_num, WiimoteEmu::TurntableGroup::LeftTable), this, this);
auto* const group_box_right_table = new ControlGroupBox(
Wiimote::GetTurntableGroup(port_num, WiimoteEmu::TurntableGroup::RightTable), this, this);
auto* const group_box_crossfade = new ControlGroupBox(
Wiimote::GetTurntableGroup(port_num, WiimoteEmu::TurntableGroup::Crossfade), this, this);
auto* const tables_crossfade_sizer = new wxBoxSizer(wxVERTICAL);
tables_crossfade_sizer->Add(group_box_right_table, 0, wxEXPAND);
tables_crossfade_sizer->AddSpacer(space5);
tables_crossfade_sizer->Add(group_box_left_table, 0, wxEXPAND);
tables_crossfade_sizer->AddSpacer(space5);
tables_crossfade_sizer->Add(group_box_crossfade, 0, wxEXPAND);
auto* const group_box_buttons = new ControlGroupBox(
Wiimote::GetTurntableGroup(port_num, WiimoteEmu::TurntableGroup::Buttons), this, this);
auto* const controls_sizer = new wxBoxSizer(wxHORIZONTAL);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(group_box_buttons, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(stick_effect_sizer, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
controls_sizer->Add(tables_crossfade_sizer, 0, wxEXPAND);
controls_sizer->AddSpacer(space5);
auto* const szr_main = new wxBoxSizer(wxVERTICAL);
szr_main->AddSpacer(space5);
szr_main->Add(controls_sizer, 1, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
szr_main->Add(CreateButtonSizer(wxCLOSE | wxNO_DEFAULT), 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
SetSizerAndFit(szr_main);
Center();
UpdateGUI();
}

View File

@ -0,0 +1,14 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include "DolphinWX/Input/InputConfigDiag.h"
class TurntableInputConfigDialog final : public InputConfigDialog
{
public:
TurntableInputConfigDialog(wxWindow* parent, InputConfig& config, const wxString& name,
int port_num = 0);
};

View File

@ -0,0 +1,129 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <wx/notebook.h>
#include <wx/panel.h>
#include "DolphinWX/Input/WiimoteInputConfigDiag.h"
#include "Core/HW/Wiimote.h"
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
WiimoteInputConfigDialog::WiimoteInputConfigDialog(wxWindow* const parent, InputConfig& config,
const wxString& name, const int port_num)
: InputConfigDialog(parent, config, name, port_num)
{
const int space5 = FromDIP(5);
auto* const device_chooser = CreateDeviceChooserGroupBox();
auto* const reset_sizer = CreaterResetGroupBox(wxVERTICAL);
auto* const profile_chooser = CreateProfileChooserGroupBox();
auto* const notebook = new wxNotebook(this, wxID_ANY);
// General and Options
auto* const tab_general = new wxPanel(notebook);
auto* const group_box_buttons = new ControlGroupBox(
Wiimote::GetWiimoteGroup(port_num, WiimoteEmu::WiimoteGroup::Buttons), tab_general, this);
auto* const group_box_dpad = new ControlGroupBox(
Wiimote::GetWiimoteGroup(port_num, WiimoteEmu::WiimoteGroup::DPad), tab_general, this);
auto* const group_box_rumble = new ControlGroupBox(
Wiimote::GetWiimoteGroup(port_num, WiimoteEmu::WiimoteGroup::Rumble), tab_general, this);
auto* const group_box_extension = new ControlGroupBox(
Wiimote::GetWiimoteGroup(port_num, WiimoteEmu::WiimoteGroup::Extension), tab_general, this);
auto* const group_box_options = new ControlGroupBox(
Wiimote::GetWiimoteGroup(port_num, WiimoteEmu::WiimoteGroup::Options), tab_general, this);
auto* const group_box_hotkeys = new ControlGroupBox(
Wiimote::GetWiimoteGroup(port_num, WiimoteEmu::WiimoteGroup::Hotkeys), tab_general, this);
auto* const dpad_extension_rumble_sizer = new wxBoxSizer(wxVERTICAL);
dpad_extension_rumble_sizer->Add(group_box_dpad, 0, wxEXPAND);
dpad_extension_rumble_sizer->AddSpacer(space5);
dpad_extension_rumble_sizer->Add(group_box_extension, 0, wxEXPAND);
dpad_extension_rumble_sizer->AddSpacer(space5);
dpad_extension_rumble_sizer->Add(group_box_rumble, 0, wxEXPAND);
auto* const options_hotkeys_sizer = new wxBoxSizer(wxVERTICAL);
options_hotkeys_sizer->Add(group_box_options, 0, wxEXPAND);
options_hotkeys_sizer->AddSpacer(space5);
options_hotkeys_sizer->Add(group_box_hotkeys, 0, wxEXPAND);
auto* const general_options_sizer = new wxBoxSizer(wxHORIZONTAL);
general_options_sizer->AddSpacer(space5);
general_options_sizer->Add(group_box_buttons, 0, wxEXPAND | wxTOP, space5);
general_options_sizer->AddSpacer(space5);
general_options_sizer->Add(dpad_extension_rumble_sizer, 0, wxEXPAND | wxTOP, space5);
general_options_sizer->AddSpacer(space5);
general_options_sizer->Add(options_hotkeys_sizer, 0, wxEXPAND | wxTOP, space5);
general_options_sizer->AddSpacer(space5);
tab_general->SetSizerAndFit(general_options_sizer);
notebook->AddPage(tab_general, "General and Options");
// Motion Controls and IR
auto* const tab_motion_controls_ir = new wxPanel(notebook);
auto* const group_box_shake =
new ControlGroupBox(Wiimote::GetWiimoteGroup(port_num, WiimoteEmu::WiimoteGroup::Shake),
tab_motion_controls_ir, this);
auto* const group_box_ir =
new ControlGroupBox(Wiimote::GetWiimoteGroup(port_num, WiimoteEmu::WiimoteGroup::IR),
tab_motion_controls_ir, this);
auto* const group_box_tilt =
new ControlGroupBox(Wiimote::GetWiimoteGroup(port_num, WiimoteEmu::WiimoteGroup::Tilt),
tab_motion_controls_ir, this);
auto* const group_box_swing =
new ControlGroupBox(Wiimote::GetWiimoteGroup(port_num, WiimoteEmu::WiimoteGroup::Swing),
tab_motion_controls_ir, this);
auto* const swing_shake_sizer = new wxBoxSizer(wxVERTICAL);
swing_shake_sizer->Add(group_box_swing, 0, wxEXPAND);
swing_shake_sizer->AddSpacer(space5);
swing_shake_sizer->Add(group_box_shake, 0, wxEXPAND);
auto* const motion_controls_ir_sizer = new wxBoxSizer(wxHORIZONTAL);
motion_controls_ir_sizer->AddSpacer(space5);
motion_controls_ir_sizer->Add(group_box_ir, 0, wxEXPAND | wxTOP, space5);
motion_controls_ir_sizer->AddSpacer(space5);
motion_controls_ir_sizer->Add(group_box_tilt, 0, wxEXPAND | wxTOP, space5);
motion_controls_ir_sizer->AddSpacer(space5);
motion_controls_ir_sizer->Add(swing_shake_sizer, 0, wxEXPAND | wxTOP, space5);
motion_controls_ir_sizer->AddSpacer(space5);
tab_motion_controls_ir->SetSizerAndFit(motion_controls_ir_sizer);
notebook->AddPage(tab_motion_controls_ir, "Motion Controls and IR");
notebook->SetSelection(0);
auto* const device_profile_sizer = new wxBoxSizer(wxVERTICAL);
device_profile_sizer->Add(device_chooser, 1, wxEXPAND);
device_profile_sizer->Add(profile_chooser, 1, wxEXPAND);
auto* const dio = new wxBoxSizer(wxHORIZONTAL);
dio->AddSpacer(space5);
dio->Add(device_profile_sizer, 5, wxEXPAND);
dio->AddSpacer(space5);
dio->Add(reset_sizer, 1, wxEXPAND);
dio->AddSpacer(space5);
auto* const szr_main = new wxBoxSizer(wxVERTICAL);
szr_main->AddSpacer(space5);
szr_main->Add(dio);
szr_main->AddSpacer(space5);
szr_main->Add(notebook, 1, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
szr_main->Add(CreateButtonSizer(wxCLOSE | wxNO_DEFAULT), 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
szr_main->AddSpacer(space5);
SetSizerAndFit(szr_main);
Center();
UpdateDeviceComboBox();
UpdateProfileComboBox();
UpdateGUI();
}

View File

@ -0,0 +1,14 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include "DolphinWX/Input/InputConfigDiag.h"
class WiimoteInputConfigDialog final : public InputConfigDialog
{
public:
WiimoteInputConfigDialog(wxWindow* parent, InputConfig& config, const wxString& name,
int port_num = 0);
};