finish proper window handling, fix the modal state of the config dialogs, plus some minor cleanup/changes :p

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5129 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
luisr142004
2010-02-25 06:12:35 +00:00
parent 4915097d93
commit 816febd3b0
33 changed files with 422 additions and 454 deletions

View File

@ -29,8 +29,8 @@
BEGIN_EVENT_TABLE(WiimoteBasicConfigDialog,wxDialog)
EVT_CLOSE(WiimoteBasicConfigDialog::OnClose)
EVT_BUTTON(ID_OK, WiimoteBasicConfigDialog::ButtonClick)
EVT_BUTTON(ID_CANCEL, WiimoteBasicConfigDialog::ButtonClick)
EVT_BUTTON(wxID_OK, WiimoteBasicConfigDialog::ButtonClick)
EVT_BUTTON(wxID_CANCEL, WiimoteBasicConfigDialog::ButtonClick)
EVT_BUTTON(ID_BUTTONMAPPING, WiimoteBasicConfigDialog::ButtonClick)
EVT_BUTTON(ID_BUTTONRECORDING, WiimoteBasicConfigDialog::ButtonClick)
EVT_NOTEBOOK_PAGE_CHANGED(ID_NOTEBOOK, WiimoteBasicConfigDialog::NotebookPageChanged)
@ -81,12 +81,12 @@ void WiimoteBasicConfigDialog::ButtonClick(wxCommandEvent& event)
{
switch(event.GetId())
{
case ID_OK:
case wxID_OK:
WiiMoteReal::Allocate();
g_Config.Save();
Close();
break;
case ID_CANCEL:
case wxID_CANCEL:
g_Config.Load();
Close();
break;
@ -256,9 +256,9 @@ void WiimoteBasicConfigDialog::CreateGUIControls()
m_ButtonMapping = new wxButton(this, ID_BUTTONMAPPING, wxT("Button Mapping"));
m_Recording = new wxButton(this, ID_BUTTONRECORDING, wxT("Recording"));
m_OK = new wxButton(this, ID_OK, wxT("OK"));
m_OK = new wxButton(this, wxID_OK, wxT("OK"));
m_OK->SetToolTip(wxT("Save changes and close"));
m_Cancel = new wxButton(this, ID_CANCEL, wxT("Cancel"));
m_Cancel = new wxButton(this, wxID_CANCEL, wxT("Cancel"));
m_Cancel->SetToolTip(wxT("Discard changes and close"));
wxBoxSizer* sButtons = new wxBoxSizer(wxHORIZONTAL);

View File

@ -36,7 +36,7 @@ class WiimoteBasicConfigDialog : public wxDialog
{
public:
WiimoteBasicConfigDialog(wxWindow *parent,
wxWindowID id = 1,
wxWindowID id = wxID_ANY,
const wxString &title = wxT("Wii Remote Plugin Configuration"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
@ -107,8 +107,6 @@ class WiimoteBasicConfigDialog : public wxDialog
enum
{
ID_OK = 1000,
ID_CANCEL,
ID_BUTTONMAPPING,
ID_BUTTONRECORDING,
IDTM_SHUTDOWN,

View File

@ -26,8 +26,8 @@
BEGIN_EVENT_TABLE(WiimotePadConfigDialog,wxDialog)
EVT_CLOSE(WiimotePadConfigDialog::OnClose)
EVT_BUTTON(ID_CLOSE, WiimotePadConfigDialog::CloseClick)
// EVT_BUTTON(ID_APPLY, WiimotePadConfigDialog::CloseClick)
EVT_BUTTON(wxID_CLOSE, WiimotePadConfigDialog::CloseClick)
// EVT_BUTTON(wxID_APPLY, WiimotePadConfigDialog::CloseClick)
EVT_NOTEBOOK_PAGE_CHANGED(ID_NOTEBOOK, WiimotePadConfigDialog::NotebookPageChanged)
EVT_TIMER(IDTM_BUTTON, WiimotePadConfigDialog::OnButtonTimer)
@ -182,10 +182,10 @@ void WiimotePadConfigDialog::CloseClick(wxCommandEvent& event)
{
switch(event.GetId())
{
case ID_CLOSE:
case wxID_CLOSE:
Close();
break;
case ID_APPLY:
case wxID_APPLY:
break;
}
}
@ -922,8 +922,8 @@ void WiimotePadConfigDialog::CreatePadGUIControls()
m_Controller[i]->SetSizer(m_sMain[i]);
}
// m_Apply = new wxButton(this, ID_APPLY, wxT("Apply"));
m_Close = new wxButton(this, ID_CLOSE, wxT("Close"));
// m_Apply = new wxButton(this, wxID_APPLY, wxT("Apply"));
m_Close = new wxButton(this, wxID_CLOSE, wxT("Close"));
wxBoxSizer* sButtons = new wxBoxSizer(wxHORIZONTAL);
sButtons->AddStretchSpacer();

View File

@ -45,7 +45,7 @@ class WiimotePadConfigDialog : public wxDialog
{
public:
WiimotePadConfigDialog(wxWindow *parent,
wxWindowID id = 1,
wxWindowID id = wxID_ANY,
const wxString &title = wxT("Wii Remote Plugin Configuration"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
@ -120,9 +120,7 @@ class WiimotePadConfigDialog : public wxDialog
IDB_ANALOG_RIGHT_X, IDB_ANALOG_RIGHT_Y,
IDB_TRIGGER_L, IDB_TRIGGER_R,
ID_CLOSE = 1000,
ID_APPLY,
IDTM_BUTTON, // Timer
IDTM_BUTTON = 1000, // Timer
IDTM_UPDATE_PAD, // Timer
ID_NOTEBOOK,

View File

@ -339,8 +339,8 @@ void WiimoteRecordingConfigDialog::CreateGUIControlsRecording()
m_PageRecording->SetSizer(m_sRecordingMain);
m_Apply = new wxButton(this, ID_APPLY, wxT("Apply"));
m_Close = new wxButton(this, ID_CLOSE, wxT("Close"));
m_Apply = new wxButton(this, wxID_APPLY, wxT("Apply"));
m_Close = new wxButton(this, wxID_CLOSE, wxT("Close"));
m_Close->SetToolTip(wxT("Apply and Close"));
wxBoxSizer* sButtons = new wxBoxSizer(wxHORIZONTAL);

View File

@ -26,8 +26,8 @@
BEGIN_EVENT_TABLE(WiimoteRecordingConfigDialog,wxDialog)
EVT_CLOSE(WiimoteRecordingConfigDialog::OnClose)
EVT_BUTTON(ID_CLOSE, WiimoteRecordingConfigDialog::CloseClick)
EVT_BUTTON(ID_APPLY, WiimoteRecordingConfigDialog::CloseClick)
EVT_BUTTON(wxID_CLOSE, WiimoteRecordingConfigDialog::CloseClick)
EVT_BUTTON(wxID_APPLY, WiimoteRecordingConfigDialog::CloseClick)
EVT_CHOICE(IDC_RECORD + 1, WiimoteRecordingConfigDialog::RecordingChanged)
EVT_CHOICE(IDC_RECORD + 2, WiimoteRecordingConfigDialog::RecordingChanged)
@ -65,8 +65,7 @@ END_EVENT_TABLE()
WiimoteRecordingConfigDialog::WiimoteRecordingConfigDialog(wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint &position, const wxSize& size, long style)
: wxDialog
(parent, id, title, position, size, style)
: wxDialog(parent, id, title, position, size, style)
{
#if wxUSE_TIMER
m_TimeoutTimer = new wxTimer(this, IDTM_UPDATE);
@ -96,13 +95,13 @@ void WiimoteRecordingConfigDialog::CloseClick(wxCommandEvent& event)
{
switch(event.GetId())
{
case ID_CLOSE:
case wxID_CLOSE:
#if HAVE_WIIUSE
if (!WiiMoteReal::SafeClose())
#endif
Close();
break;
case ID_APPLY:
case wxID_APPLY:
SaveFile();
WiiMoteEmu::LoadRecordedMovements();
break;

View File

@ -34,7 +34,7 @@ class WiimoteRecordingConfigDialog : public wxDialog
{
public:
WiimoteRecordingConfigDialog(wxWindow *parent,
wxWindowID id = 1,
wxWindowID id = wxID_ANY,
const wxString &title = wxT("Wii Remote Plugin Configuration"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
@ -103,9 +103,7 @@ class WiimoteRecordingConfigDialog : public wxDialog
enum
{
ID_CLOSE = 1000,
ID_APPLY,
ID_RECORDINGPAGE,
ID_RECORDINGPAGE = 1000,
IDTM_UPDATE,
// Real

View File

@ -108,8 +108,6 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
wxUninitialize();
#endif
break;
default:
break;
}
g_hInstance = hinstDLL;
@ -138,12 +136,12 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo)
_PluginInfo->Version = 0x0100;
_PluginInfo->Type = PLUGIN_TYPE_WIIMOTE;
#ifdef DEBUGFAST
sprintf(_PluginInfo->Name, "Dolphin Wiimote Plugin (DebugFast)");
sprintf_s(_PluginInfo->Name, "Dolphin Wiimote Plugin (DebugFast)");
#else
#ifndef _DEBUG
sprintf(_PluginInfo->Name, "Dolphin Wiimote Plugin");
sprintf_s(_PluginInfo->Name, "Dolphin Wiimote Plugin");
#else
sprintf(_PluginInfo->Name, "Dolphin Wiimote Plugin (Debug)");
sprintf_s(_PluginInfo->Name, "Dolphin Wiimote Plugin (Debug)");
#endif
#endif
}
@ -168,18 +166,19 @@ void DllConfig(HWND _hParent)
}
#if defined(HAVE_WX) && HAVE_WX
if (!m_BasicConfigFrame)
{
wxWindow *frame = GetParentedWxWindow(_hParent);
m_BasicConfigFrame = new WiimoteBasicConfigDialog(frame);
m_BasicConfigFrame->ShowModal();
m_BasicConfigFrame->Destroy();
m_BasicConfigFrame = NULL;
wxWindow *frame = GetParentedWxWindow(_hParent);
m_BasicConfigFrame = new WiimoteBasicConfigDialog(frame);
frame->Disable();
m_BasicConfigFrame->ShowModal();
frame->Enable();
m_BasicConfigFrame->Destroy();
m_BasicConfigFrame = NULL;
#ifdef _WIN32
frame->SetHWND(NULL);
frame->SetHWND(NULL);
#endif
delete frame;
}
frame->Destroy();
#endif
}
@ -189,18 +188,11 @@ void Initialize(void *init)
g_EmulatorRunning = true;
g_WiimoteInitialize = *(SWiimoteInitialize *)init;
// Update the GUI if the configuration window is already open
#if defined(HAVE_WX) && HAVE_WX
if (m_BasicConfigFrame)
{
// Save the settings
g_Config.Save();
// Load the ISO Id
g_ISOId = g_WiimoteInitialize.ISOId;
// Load the settings
g_Config.Load();
m_BasicConfigFrame->UpdateGUI();
}
// Load the ISO Id
g_ISOId = g_WiimoteInitialize.ISOId;
// Load the settings
g_Config.Load();
#endif
#if defined(HAVE_X11) && HAVE_X11
WMdisplay = (Display*)g_WiimoteInitialize.hWnd;