Change Wiimote padconfig and recording wxframes to modal dialogs. (Works better for linux)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3688 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
LPFaint99 2009-07-06 00:27:32 +00:00
parent 8fe9db180c
commit 23f3e327e2
6 changed files with 21 additions and 42 deletions

View File

@ -67,33 +67,21 @@ WiimoteBasicConfigDialog::WiimoteBasicConfigDialog(wxWindow *parent, wxWindowID
UpdateGUI();
}
WiimoteBasicConfigDialog::~WiimoteBasicConfigDialog(){}
void WiimoteBasicConfigDialog::OnClose(wxCloseEvent& event)
{
g_FrameOpen = false;
g_Config.Save();
if ((m_PadConfigFrame && m_PadConfigFrame->IsShown()) || (m_RecordingConfigFrame && m_RecordingConfigFrame->IsShown()))
if (m_PadConfigFrame)
{
Closing = false;
Hide();
m_PadConfigFrame->EndModal(wxID_CLOSE);
m_PadConfigFrame = NULL;
}
else
if (m_RecordingConfigFrame)
{
Closing = true;
if (m_PadConfigFrame)
{
m_PadConfigFrame->Close();
m_PadConfigFrame = NULL;
}
if (m_RecordingConfigFrame)
{
m_RecordingConfigFrame->Close();
m_RecordingConfigFrame = NULL;
}
if (!g_EmulatorRunning) Shutdown();
m_RecordingConfigFrame->EndModal(wxID_CLOSE);
m_RecordingConfigFrame = NULL;
}
if (!g_EmulatorRunning) Shutdown();
// This will let the Close() function close and remove the wxDialog
event.Skip();
}
@ -135,14 +123,14 @@ void WiimoteBasicConfigDialog::ButtonClick(wxCommandEvent& event)
if (!m_PadConfigFrame)
m_PadConfigFrame = new WiimotePadConfigDialog(this);
if (!m_PadConfigFrame->IsShown())
m_PadConfigFrame->Show();
m_PadConfigFrame->ShowModal();
break;
case ID_BUTTONRECORDING:
if (!m_RecordingConfigFrame)
m_RecordingConfigFrame = new WiimoteRecordingConfigDialog(this);
if (!m_RecordingConfigFrame->IsShown())
m_RecordingConfigFrame->Show();
m_RecordingConfigFrame->ShowModal();
break;
}
}
@ -297,7 +285,7 @@ void WiimoteBasicConfigDialog::CreateGUIControls()
m_ButtonMapping = new wxButton(this, ID_BUTTONMAPPING, wxT("Button Mapping"));
m_Recording = new wxButton(this, ID_BUTTONRECORDING, wxT("Recording"));
m_Apply = new wxButton(this, ID_APPLY, wxT("Apply"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Apply = new wxButton(this, ID_APPLY, wxT("Apply"));
m_Close = new wxButton(this, ID_CLOSE, wxT("Close"));
m_Close->SetToolTip(wxT("Apply and Close"));
@ -374,9 +362,7 @@ void WiimoteBasicConfigDialog::DoUseReal()
}
}
// ===================================================
/* Generate connect/disconnect status event */
// ----------------
// Generate connect/disconnect status event
void WiimoteBasicConfigDialog::DoExtensionConnectedDisconnected(int Extension)
{
// There is no need for this if no game is running

View File

@ -40,7 +40,7 @@ class WiimoteBasicConfigDialog : public wxDialog
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE | wxWANTS_CHARS);
virtual ~WiimoteBasicConfigDialog();
virtual ~WiimoteBasicConfigDialog(){;}
// General open, close and event functions
void ButtonClick(wxCommandEvent& event);

View File

@ -35,7 +35,7 @@ enum TriggerType
CTL_TRIGGER_XINPUT
};
BEGIN_EVENT_TABLE(WiimotePadConfigDialog,wxFrame)
BEGIN_EVENT_TABLE(WiimotePadConfigDialog,wxDialog)
EVT_CLOSE(WiimotePadConfigDialog::OnClose)
EVT_BUTTON(ID_CLOSE, WiimotePadConfigDialog::CloseClick)
EVT_BUTTON(ID_APPLY, WiimotePadConfigDialog::CloseClick)
@ -92,7 +92,7 @@ END_EVENT_TABLE()
WiimotePadConfigDialog::WiimotePadConfigDialog(wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint &position, const wxSize& size, long style)
: wxFrame(parent, id, title, position, size, style)
: wxDialog(parent, id, title, position, size, style)
{
#if wxUSE_TIMER
m_ButtonMappingTimer = new wxTimer(this, IDTM_BUTTON);
@ -194,9 +194,7 @@ void WiimotePadConfigDialog::OnClose(wxCloseEvent& event)
if(m_UpdatePad)
m_UpdatePad->Stop();
g_Config.Save();
Hide();
if(!m_BasicConfigFrame->Closing)
m_BasicConfigFrame->Close();
event.Skip();
}
void WiimotePadConfigDialog::CloseClick(wxCommandEvent& event)
@ -1024,7 +1022,7 @@ void WiimotePadConfigDialog::CreatePadGUIControls()
m_Apply = new wxButton(this, ID_APPLY, wxT("Apply"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Apply = new wxButton(this, ID_APPLY, wxT("Apply"));
m_Close = new wxButton(this, ID_CLOSE, wxT("Close"));
m_Close->SetToolTip(wxT("Apply and Close"));

View File

@ -31,7 +31,7 @@
#include <wx/panel.h>
#include <wx/gbsizer.h>
class WiimotePadConfigDialog : public wxFrame
class WiimotePadConfigDialog : public wxDialog
{
public:
WiimotePadConfigDialog(wxWindow *parent,

View File

@ -30,7 +30,7 @@
#include "EmuSubroutines.h" // for WmRequestStatus
#include "EmuDefinitions.h" // for joyinfo
BEGIN_EVENT_TABLE(WiimoteRecordingConfigDialog,wxFrame)//wxDialog)
BEGIN_EVENT_TABLE(WiimoteRecordingConfigDialog,wxDialog)
EVT_CLOSE(WiimoteRecordingConfigDialog::OnClose)
EVT_BUTTON(ID_CLOSE, WiimoteRecordingConfigDialog::CloseClick)
EVT_BUTTON(ID_APPLY, WiimoteRecordingConfigDialog::CloseClick)
@ -71,7 +71,7 @@ END_EVENT_TABLE()
WiimoteRecordingConfigDialog::WiimoteRecordingConfigDialog(wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint &position, const wxSize& size, long style)
: wxFrame
: wxDialog
(parent, id, title, position, size, style)
{
#if wxUSE_TIMER
@ -94,10 +94,7 @@ void WiimoteRecordingConfigDialog::OnClose(wxCloseEvent& event)
g_FrameOpen = false;
SaveFile();
g_Config.Save();
Hide();
if(!m_BasicConfigFrame->Closing)
m_BasicConfigFrame->Close();
event.Skip();
}
@ -106,8 +103,6 @@ void WiimoteRecordingConfigDialog::CloseClick(wxCommandEvent& event)
switch(event.GetId())
{
case ID_CLOSE:
g_Config.Save();
SaveFile();
Close();
break;
case ID_APPLY:

View File

@ -29,7 +29,7 @@
#include <wx/checkbox.h>
#include <wx/panel.h>
class WiimoteRecordingConfigDialog : public wxFrame
class WiimoteRecordingConfigDialog : public wxDialog
{
public:
WiimoteRecordingConfigDialog(wxWindow *parent,