mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Add flexibility to InputConfigDialog
Removed the unecessary forced tabbed layout, removed the layout part of the constructor and remade some method in preparation for tabbed styled input dialog such as the new hotkey configuration one. It breaks every inputconfigDialog, but this will get fixed in the next commits. Also moved to a folder since there will be many more files created in the next commits so it gives better separation.
This commit is contained in:
@@ -40,6 +40,8 @@ set(GUI_SRCS
|
||||
NetPlay/NetPlaySetupFrame.cpp
|
||||
NetPlay/NetWindow.cpp
|
||||
NetPlay/PadMapDialog.cpp
|
||||
Input/InputConfigDiag.cpp
|
||||
Input/InputConfigDiagBitmaps.cpp
|
||||
DolphinSlider.cpp
|
||||
FifoPlayerDlg.cpp
|
||||
Frame.cpp
|
||||
@@ -48,8 +50,6 @@ set(GUI_SRCS
|
||||
GameListCtrl.cpp
|
||||
ISOFile.cpp
|
||||
ISOProperties.cpp
|
||||
InputConfigDiag.cpp
|
||||
InputConfigDiagBitmaps.cpp
|
||||
LogConfigWindow.cpp
|
||||
LogWindow.cpp
|
||||
Main.cpp
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "DolphinWX/Config/GCAdapterConfigDiag.h"
|
||||
#include "DolphinWX/ControllerConfigDiag.h"
|
||||
#include "DolphinWX/DolphinSlider.h"
|
||||
#include "DolphinWX/InputConfigDiag.h"
|
||||
#include "DolphinWX/Input/InputConfigDiag.h"
|
||||
#include "DolphinWX/WxUtils.h"
|
||||
#include "InputCommon/GCAdapter.h"
|
||||
|
||||
@@ -447,20 +447,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);
|
||||
InputConfigDialog 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);
|
||||
InputConfigDialog config_diag(
|
||||
this, *pad_plugin,
|
||||
wxString::Format("GameCube Controller Configuration Port %i", port_num + 1), port_num);
|
||||
config_diag.ShowModal();
|
||||
}
|
||||
|
||||
@@ -494,9 +498,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()]);
|
||||
int port_num = m_wiimote_index_from_config_id[ev.GetId()];
|
||||
|
||||
InputConfigDialog 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);
|
||||
|
||||
@@ -100,8 +100,8 @@
|
||||
<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="ISOFile.cpp" />
|
||||
<ClCompile Include="ISOProperties.cpp" />
|
||||
<ClCompile Include="LogConfigWindow.cpp" />
|
||||
@@ -170,7 +170,7 @@
|
||||
<ClInclude Include="Frame.h" />
|
||||
<ClInclude Include="GameListCtrl.h" />
|
||||
<ClInclude Include="Globals.h" />
|
||||
<ClInclude Include="InputConfigDiag.h" />
|
||||
<ClInclude Include="Input\InputConfigDiag.h" />
|
||||
<ClInclude Include="ISOFile.h" />
|
||||
<ClInclude Include="ISOProperties.h" />
|
||||
<ClInclude Include="LogConfigWindow.h" />
|
||||
|
||||
@@ -104,10 +104,10 @@
|
||||
<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="Debugger\DebuggerPanel.cpp">
|
||||
@@ -290,7 +290,7 @@
|
||||
<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="Debugger\DebuggerPanel.h">
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
#include "DolphinWX/GameListCtrl.h"
|
||||
#include "DolphinWX/Globals.h"
|
||||
#include "DolphinWX/ISOFile.h"
|
||||
#include "DolphinWX/InputConfigDiag.h"
|
||||
#include "DolphinWX/Input/InputConfigDiag.h"
|
||||
#include "DolphinWX/LogWindow.h"
|
||||
#include "DolphinWX/MainMenuBar.h"
|
||||
#include "DolphinWX/MainToolBar.h"
|
||||
|
||||
+109
-144
File diff suppressed because it is too large
Load Diff
+31
-43
@@ -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
|
||||
@@ -196,21 +195,25 @@ public:
|
||||
class ControlGroupsSizer : public wxBoxSizer
|
||||
{
|
||||
public:
|
||||
ControlGroupsSizer(ControllerEmu* const controller, wxWindow* const parent,
|
||||
GamepadPage* const eventsink,
|
||||
ControlGroupsSizer(ControllerEmu* const controller, InputConfigDialog* const parent,
|
||||
std::vector<ControlGroupBox*>* const groups = nullptr);
|
||||
};
|
||||
|
||||
class InputConfigDialog;
|
||||
|
||||
class GamepadPage : public wxPanel
|
||||
class InputConfigDialog : public wxDialog
|
||||
{
|
||||
friend class InputConfigDialog;
|
||||
friend class ControlDialog;
|
||||
|
||||
public:
|
||||
GamepadPage(wxWindow* parent, InputConfig& config, const int pad_num,
|
||||
InputConfigDialog* const config_dialog);
|
||||
InputConfigDialog(wxWindow* const parent, InputConfig& config, const wxString& name,
|
||||
const int port_num = 0);
|
||||
virtual ~InputConfigDialog() = default;
|
||||
|
||||
void OnClose(wxCloseEvent& event);
|
||||
void OnCloseButton(wxCommandEvent& event);
|
||||
|
||||
void UpdateDeviceComboBox();
|
||||
void UpdateProfileComboBox();
|
||||
|
||||
void UpdateControlReferences();
|
||||
void UpdateBitmaps(wxTimerEvent&);
|
||||
|
||||
void UpdateGUI();
|
||||
|
||||
@@ -238,44 +241,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;
|
||||
};
|
||||
+2
-5
@@ -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)
|
||||
@@ -193,8 +193,8 @@ ControllerEmu::Buttons::Buttons(const std::string& _name)
|
||||
numeric_settings.emplace_back(std::make_unique<NumericSetting>(_trans("Threshold"), 0.5));
|
||||
}
|
||||
|
||||
ControllerEmu::Buttons::Buttons(const std::string& _name, const std::string& _ui_name)
|
||||
: ControlGroup(_name, _ui_name, GROUP_TYPE_BUTTONS)
|
||||
ControllerEmu::Buttons::Buttons(const std::string& ini_name, const std::string& group_name)
|
||||
: ControlGroup(ini_name, group_name, GROUP_TYPE_BUTTONS)
|
||||
{
|
||||
numeric_settings.emplace_back(std::make_unique<NumericSetting>(_trans("Threshold"), 0.5));
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ public:
|
||||
{
|
||||
public:
|
||||
Buttons(const std::string& _name);
|
||||
Buttons(const std::string& _name, const std::string& _ui_name);
|
||||
Buttons(const std::string& ini_name, const std::string& group_name);
|
||||
|
||||
template <typename C>
|
||||
void GetState(C* const buttons, const C* bitmasks)
|
||||
|
||||
Reference in New Issue
Block a user