mirror of https://github.com/PCSX2/pcsx2.git
onepad: use modal dialog instead of frame
Avoid various pitfall such as #1387 v2: * use stack object
This commit is contained in:
parent
1e3c46a6bb
commit
53a70d9018
|
@ -20,7 +20,7 @@
|
||||||
#include "GamepadConfiguration.h"
|
#include "GamepadConfiguration.h"
|
||||||
|
|
||||||
// Construtor of GamepadConfiguration
|
// Construtor of GamepadConfiguration
|
||||||
GamepadConfiguration::GamepadConfiguration(int pad, wxWindow *parent) : wxFrame(
|
GamepadConfiguration::GamepadConfiguration(int pad, wxWindow *parent) : wxDialog(
|
||||||
parent, // Parent
|
parent, // Parent
|
||||||
wxID_ANY, // ID
|
wxID_ANY, // ID
|
||||||
_T("Gamepad configuration"), // Title
|
_T("Gamepad configuration"), // Title
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
#include "onepad.h"
|
#include "onepad.h"
|
||||||
|
|
||||||
class GamepadConfiguration : public wxFrame
|
class GamepadConfiguration : public wxDialog
|
||||||
{
|
{
|
||||||
wxPanel* m_pan_gamepad_config;
|
wxPanel* m_pan_gamepad_config;
|
||||||
wxCheckBox *m_cb_rumble, *m_cb_hack_sixaxis_usb, *m_cb_hack_sixaxis_pressure;
|
wxCheckBox *m_cb_rumble, *m_cb_hack_sixaxis_usb, *m_cb_hack_sixaxis_pressure;
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "JoystickConfiguration.h"
|
#include "JoystickConfiguration.h"
|
||||||
|
|
||||||
// Construtor of JoystickConfiguration
|
// Construtor of JoystickConfiguration
|
||||||
JoystickConfiguration::JoystickConfiguration(int pad, bool left, wxWindow *parent) : wxFrame(
|
JoystickConfiguration::JoystickConfiguration(int pad, bool left, wxWindow *parent) : wxDialog(
|
||||||
parent, // Parent
|
parent, // Parent
|
||||||
wxID_ANY, // ID
|
wxID_ANY, // ID
|
||||||
_T("Gamepad configuration"), // Title
|
_T("Gamepad configuration"), // Title
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
#include "onepad.h"
|
#include "onepad.h"
|
||||||
|
|
||||||
class JoystickConfiguration : public wxFrame
|
class JoystickConfiguration : public wxDialog
|
||||||
{
|
{
|
||||||
wxPanel* m_pan_joystick_config;
|
wxPanel* m_pan_joystick_config;
|
||||||
wxCheckBox *m_cb_reverse_Lx, *m_cb_reverse_Ly, *m_cb_reverse_Rx, *m_cb_reverse_Ry,
|
wxCheckBox *m_cb_reverse_Lx, *m_cb_reverse_Ly, *m_cb_reverse_Rx, *m_cb_reverse_Ry,
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "dialog.h"
|
#include "dialog.h"
|
||||||
|
|
||||||
// Construtor of Dialog
|
// Construtor of Dialog
|
||||||
Dialog::Dialog() : wxFrame( NULL, // Parent
|
Dialog::Dialog() : wxDialog( NULL, // Parent
|
||||||
wxID_ANY, // ID
|
wxID_ANY, // ID
|
||||||
_T("OnePad configuration"), // Title
|
_T("OnePad configuration"), // Title
|
||||||
wxDefaultPosition, // Position
|
wxDefaultPosition, // Position
|
||||||
|
@ -320,21 +320,24 @@ void Dialog::OnButtonClicked(wxCommandEvent &event)
|
||||||
}
|
}
|
||||||
else if(bt_id == Gamepad_config) // If the button ID is equals to the Gamepad_config button ID
|
else if(bt_id == Gamepad_config) // If the button ID is equals to the Gamepad_config button ID
|
||||||
{
|
{
|
||||||
m_frm_gamepad_config = new GamepadConfiguration(gamepad_id, this);
|
GamepadConfiguration gamepad_config(gamepad_id, this);
|
||||||
m_frm_gamepad_config->InitGamepadConfiguration();
|
|
||||||
m_frm_gamepad_config->Show(true);
|
gamepad_config.InitGamepadConfiguration();
|
||||||
|
gamepad_config.ShowModal();
|
||||||
}
|
}
|
||||||
else if(bt_id == JoyL_config) // If the button ID is equals to the JoyL_config button ID
|
else if(bt_id == JoyL_config) // If the button ID is equals to the JoyL_config button ID
|
||||||
{
|
{
|
||||||
m_frm_joystick_config = new JoystickConfiguration(gamepad_id, true, this);
|
JoystickConfiguration joystick_config(gamepad_id, true, this);
|
||||||
m_frm_joystick_config->InitJoystickConfiguration();
|
|
||||||
m_frm_joystick_config->Show(true);
|
joystick_config.InitJoystickConfiguration();
|
||||||
|
joystick_config.ShowModal();
|
||||||
}
|
}
|
||||||
else if(bt_id == JoyR_config) // If the button ID is equals to the JoyR_config button ID
|
else if(bt_id == JoyR_config) // If the button ID is equals to the JoyR_config button ID
|
||||||
{
|
{
|
||||||
m_frm_joystick_config = new JoystickConfiguration(gamepad_id, false, this);
|
JoystickConfiguration joystick_config(gamepad_id, false, this);
|
||||||
m_frm_joystick_config->InitJoystickConfiguration();
|
|
||||||
m_frm_joystick_config->Show(true);
|
joystick_config.InitJoystickConfiguration();
|
||||||
|
joystick_config.ShowModal();
|
||||||
}
|
}
|
||||||
else if(bt_id == Set_all) // If the button ID is equals to the Set_all button ID
|
else if(bt_id == Set_all) // If the button ID is equals to the Set_all button ID
|
||||||
{
|
{
|
||||||
|
@ -696,7 +699,8 @@ void Dialog::repopulate()
|
||||||
// Main
|
// Main
|
||||||
void DisplayDialog()
|
void DisplayDialog()
|
||||||
{
|
{
|
||||||
Dialog* dialog = new Dialog();
|
Dialog dialog;
|
||||||
dialog->InitDialog();
|
|
||||||
dialog->Show(true);
|
dialog.InitDialog();
|
||||||
|
dialog.ShowModal();
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ enum gui_buttons {
|
||||||
#define DEFAULT_WIDTH 1000
|
#define DEFAULT_WIDTH 1000
|
||||||
#define DEFAULT_HEIGHT 740
|
#define DEFAULT_HEIGHT 740
|
||||||
|
|
||||||
class Dialog : public wxFrame
|
class Dialog : public wxDialog
|
||||||
{
|
{
|
||||||
// Panels
|
// Panels
|
||||||
opPanel* m_pan_tabs[GAMEPAD_NUMBER]; // Gamepad Tabs box
|
opPanel* m_pan_tabs[GAMEPAD_NUMBER]; // Gamepad Tabs box
|
||||||
|
@ -80,10 +80,6 @@ class Dialog : public wxFrame
|
||||||
// Map the key pressed with the feedback image id
|
// Map the key pressed with the feedback image id
|
||||||
std::map<u32,int> m_map_images[GAMEPAD_NUMBER];
|
std::map<u32,int> m_map_images[GAMEPAD_NUMBER];
|
||||||
|
|
||||||
// Frame
|
|
||||||
GamepadConfiguration* m_frm_gamepad_config; // Gamepad Configuration frame
|
|
||||||
JoystickConfiguration* m_frm_joystick_config; // Joystick Configuration frame
|
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
void config_key(int, int);
|
void config_key(int, int);
|
||||||
void clear_key(int, int);
|
void clear_key(int, int);
|
||||||
|
|
Loading…
Reference in New Issue