From 06fb0c292a8bfa392f6dced5ae0da6d1f34c8a9a Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Fri, 30 Jul 2010 03:51:49 +0000 Subject: [PATCH] Removed the hackery that was being done with the plugin configuration dialogs on windows. That was unnecessary and ugly. The HWND type is dead for non windows. Also cleaned up the gui a little. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5999 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Src/Plugin.cpp | 2 +- Source/Core/Common/Src/Plugin.h | 6 +- Source/Core/Core/Src/Core.cpp | 4 +- Source/Core/Core/Src/PluginManager.cpp | 6 +- Source/Core/DolphinWX/Src/ConfigMain.cpp | 14 ++- Source/Core/DolphinWX/Src/Frame.cpp | 67 +++-------- Source/Core/DolphinWX/Src/Frame.h | 109 ++++++++---------- Source/Core/DolphinWX/Src/FrameTools.cpp | 77 ++++++------- Source/Core/DolphinWX/Src/Globals.h | 1 + Source/PluginSpecs/PluginSpecs.h | 6 +- Source/PluginSpecs/pluginspecs_wiimote.h | 2 +- Source/Plugins/Plugin_DSP_HLE/Src/main.cpp | 36 +----- Source/Plugins/Plugin_DSP_LLE/Src/main.cpp | 35 +----- Source/Plugins/Plugin_VideoDX11/Src/main.cpp | 13 +-- Source/Plugins/Plugin_VideoDX9/Src/main.cpp | 23 +--- Source/Plugins/Plugin_VideoOGL/Src/main.cpp | 34 +----- .../Plugins/Plugin_VideoSoftware/Src/main.cpp | 2 +- Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp | 4 +- Source/Plugins/Plugin_Wiimote/Src/main.cpp | 36 +----- .../Plugin_Wiimote/Src/wiimote_real.cpp | 4 +- .../Plugin_WiimoteNew/Src/WiimoteNew.cpp | 41 +------ 21 files changed, 144 insertions(+), 378 deletions(-) diff --git a/Source/Core/Common/Src/Plugin.cpp b/Source/Core/Common/Src/Plugin.cpp index e9871fdc96..271b044ac3 100644 --- a/Source/Core/Common/Src/Plugin.cpp +++ b/Source/Core/Common/Src/Plugin.cpp @@ -93,7 +93,7 @@ bool CPlugin::GetInfo(PLUGIN_INFO& _pluginInfo) } // Config: Open the Config window -void CPlugin::Config(HWND _hwnd) +void CPlugin::Config(void *_hwnd) { if (m_DllConfig != NULL) m_DllConfig(_hwnd); diff --git a/Source/Core/Common/Src/Plugin.h b/Source/Core/Common/Src/Plugin.h index a557c15dd8..2642bcdb2a 100644 --- a/Source/Core/Common/Src/Plugin.h +++ b/Source/Core/Common/Src/Plugin.h @@ -25,7 +25,7 @@ namespace Common { typedef void (__cdecl * TGetDllInfo)(PLUGIN_INFO*); - typedef void (__cdecl * TDllConfig)(HWND); + typedef void (__cdecl * TDllConfig)(void *); typedef void* (__cdecl * TDllDebugger)(void *, bool); typedef void (__cdecl * TSetDllGlobals)(PLUGIN_GLOBALS*); typedef void (__cdecl * TInitialize)(void *); @@ -47,8 +47,8 @@ public: void SetGlobals(PLUGIN_GLOBALS* _PluginGlobals); void *LoadSymbol(const char *sym); - void Config(HWND _hwnd); - void About(HWND _hwnd); + void Config(void *_hwnd); + void About(void *_hwnd); void *Debug(void *Parent, bool Show); void DoState(unsigned char **ptr, int mode); void EmuStateChange(PLUGIN_EMUSTATE newState); diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp index 7eb420a584..2c3fba85b6 100644 --- a/Source/Core/Core/Src/Core.cpp +++ b/Source/Core/Core/Src/Core.cpp @@ -101,7 +101,7 @@ void Stop(); bool g_bStopping = false; bool g_bHwInit = false; bool g_bRealWiimote = false; -HWND g_pWindowHandle = NULL; +void *g_pWindowHandle = NULL; Common::Thread* g_EmuThread = NULL; @@ -367,7 +367,7 @@ THREAD_RETURN EmuThread(void *pArg) Plugins.GetVideo()->Initialize(&VideoInitialize); // Call the dll // Under linux, this is an X11 Window, not a HWND! - g_pWindowHandle = (HWND)VideoInitialize.pWindowHandle; + g_pWindowHandle = VideoInitialize.pWindowHandle; Callback_PeekMessages = VideoInitialize.pPeekMessages; g_pUpdateFPSDisplay = VideoInitialize.pUpdateFPSDisplay; diff --git a/Source/Core/Core/Src/PluginManager.cpp b/Source/Core/Core/Src/PluginManager.cpp index 0dbf7a9f19..3192ae25fa 100644 --- a/Source/Core/Core/Src/PluginManager.cpp +++ b/Source/Core/Core/Src/PluginManager.cpp @@ -420,15 +420,15 @@ void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename, PLUGIN_TY { case PLUGIN_TYPE_VIDEO: if (GetVideo() != NULL) - GetVideo()->Config((HWND)_Parent); + GetVideo()->Config(_Parent); break; case PLUGIN_TYPE_DSP: if (GetDSP() != NULL) - GetDSP()->Config((HWND)_Parent); + GetDSP()->Config(_Parent); break; case PLUGIN_TYPE_WIIMOTE: if (GetWiimote() != NULL) - GetWiimote()->Config((HWND)_Parent); + GetWiimote()->Config(_Parent); break; default: PanicAlert("Type %d config not supported in plugin %s", Type, _rFilename); diff --git a/Source/Core/DolphinWX/Src/ConfigMain.cpp b/Source/Core/DolphinWX/Src/ConfigMain.cpp index e0c5862dbc..4080c19142 100644 --- a/Source/Core/DolphinWX/Src/ConfigMain.cpp +++ b/Source/Core/DolphinWX/Src/ConfigMain.cpp @@ -1181,7 +1181,19 @@ void CConfigMain::CallConfig(wxChoice* _pChoice) { const CPluginInfo* pInfo = static_cast(_pChoice->GetClientData(Index)); if (pInfo != NULL) - CPluginManager::GetInstance().OpenConfig((HWND) this->GetHandle(), pInfo->GetFilename().c_str(), pInfo->GetPluginInfo().Type); + { + #ifdef _WIN32 + // Make sure only one dialog can be opened at a time in Windows, + // but is unnecessary and looks bad in linux. + Disable(); + #endif + CPluginManager::GetInstance().OpenConfig(this, + pInfo->GetFilename().c_str(), pInfo->GetPluginInfo().Type); + #ifdef _WIN32 + Enable(); + Raise(); + #endif + } } } diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index a42a4afe41..c26cbee1d9 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -306,9 +306,6 @@ EVT_SIZE(CFrame::OnResize) EVT_MOVE(CFrame::OnMove) EVT_LIST_ITEM_ACTIVATED(LIST_CTRL, CFrame::OnGameListCtrl_ItemActivated) EVT_HOST_COMMAND(wxID_ANY, CFrame::OnHostMessage) -#if wxUSE_TIMER -EVT_TIMER(wxID_ANY, CFrame::OnTimer) -#endif EVT_AUI_PANE_CLOSE(CFrame::OnPaneClose) EVT_AUINOTEBOOK_PAGE_CLOSE(wxID_ANY, CFrame::OnNotebookPageClose) @@ -338,14 +335,11 @@ CFrame::CFrame(wxFrame* parent, , g_pCodeWindow(NULL) , bRenderToMain(false), bNoWiimoteMsg(false) , m_ToolBar(NULL), m_ToolBarDebug(NULL), m_ToolBarAui(NULL) - , m_pStatusBar(NULL), m_GameListCtrl(NULL), m_Panel(NULL) + , m_GameListCtrl(NULL), m_Panel(NULL) , m_RenderFrame(NULL), m_RenderParent(NULL) , m_LogWindow(NULL), UseDebugger(_UseDebugger) , m_bBatchMode(_BatchMode), m_bEdit(false), m_bTabSplit(false), m_bNoDocking(false) - , m_bControlsCreated(false), m_bGameLoading(false), m_StopDlg(NULL) - #if wxUSE_TIMER - , m_timer(this) - #endif + , m_bGameLoading(false) { for (int i = 0; i <= IDM_CODEWINDOW - IDM_LOGWINDOW; i++) bFloatWindow[i] = false; @@ -367,15 +361,8 @@ CFrame::CFrame(wxFrame* parent, g_pCodeWindow = new CCodeWindow(SConfig::GetInstance().m_LocalCoreStartupParameter, this, IDM_CODEWINDOW); LoadIniPerspectives(); g_pCodeWindow->Load(); - g_pCodeWindow->Hide(); } - // Create timer - #if wxUSE_TIMER - const int TimesPerSecond = 10; // We don't need more than this - m_timer.Start(1000 / TimesPerSecond); - #endif - // Create toolbar bitmaps InitBitmaps(); @@ -385,9 +372,9 @@ CFrame::CFrame(wxFrame* parent, SetIcon(IconTemp); // Give it a status bar - m_pStatusBar = CreateStatusBar(2, wxST_SIZEGRIP, ID_STATUSBAR); + SetStatusBar(CreateStatusBar(2, wxST_SIZEGRIP, ID_STATUSBAR)); if (!SConfig::GetInstance().m_InterfaceStatusbar) - m_pStatusBar->Hide(); + GetStatusBar()->Hide(); // Give it a menu bar CreateMenu(); @@ -413,26 +400,19 @@ CFrame::CFrame(wxFrame* parent, if (g_pCodeWindow) { - m_Mgr->AddPane(m_Panel, wxAuiPaneInfo().Name(wxT("Pane 0")).Caption(wxT("Pane 0")).Show()); - } - else - { - m_Mgr->AddPane(m_Panel, wxAuiPaneInfo().Name(wxT("Pane 0")).Caption(wxT("Pane 0")).Hide()); - m_Mgr->AddPane(CreateEmptyNotebook(), wxAuiPaneInfo().Name(wxT("Pane 1")).Caption(wxT("Logging")).Hide()); - } - - // Setup perspectives - if (g_pCodeWindow) - { - m_Mgr->GetPane(wxT("Pane 0")).CenterPane().PaneBorder(false); + m_Mgr->AddPane(m_Panel, wxAuiPaneInfo() + .Name(wxT("Pane 0")).Caption(wxT("Pane 0")) + .CenterPane().PaneBorder(false).Show()); AuiFullscreen = m_Mgr->SavePerspective(); - m_Mgr->GetPane(wxT("Pane 0")).CenterPane().PaneBorder(true); } else { - m_Mgr->GetPane(wxT("Pane 0")).Show().PaneBorder(false).CaptionVisible(false).Layer(0).Center(); - m_Mgr->GetPane(wxT("Pane 1")).Hide().PaneBorder(false).CaptionVisible(true).Layer(0) - .FloatingSize(wxSize(600, 350)).CloseButton(false); + m_Mgr->AddPane(m_Panel, wxAuiPaneInfo() + .Name(wxT("Pane 0")).Caption(wxT("Pane 0")).PaneBorder(false) + .CaptionVisible(false).Layer(0).Center().Show()); + m_Mgr->AddPane(CreateEmptyNotebook(), wxAuiPaneInfo() + .Name(wxT("Pane 1")).Caption(wxT("Logging")).CaptionVisible(true) + .Layer(0).FloatingSize(wxSize(600, 350)).CloseButton(true).Hide()); AuiFullscreen = m_Mgr->SavePerspective(); } @@ -482,7 +462,6 @@ CFrame::CFrame(wxFrame* parent, // ---------- // Update controls - m_bControlsCreated = true; UpdateGUI(); // If we are rerecording create the status bar now instead of later when a game starts @@ -495,14 +474,7 @@ CFrame::CFrame(wxFrame* parent, // Destructor CFrame::~CFrame() { - m_bControlsCreated = false; - drives.clear(); - /* The statbar sample has this so I add this to, but I guess timer will be deleted after - this anyway */ - #if wxUSE_TIMER - if (m_timer.IsRunning()) m_timer.Stop(); - #endif #if defined(HAVE_XRANDR) && HAVE_XRANDR delete m_XRRConfig; @@ -641,15 +613,6 @@ WXLRESULT CFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) } #endif -#if wxUSE_TIMER -void CFrame::OnTimer(wxTimerEvent& WXUNUSED(event)) -{ - // Process events. Primarily to update the statusbar text. - if (wxGetApp().Pending()) - wxGetApp().ProcessPendingEvents(); -} -#endif - void CFrame::OnHostMessage(wxCommandEvent& event) { switch (event.GetId()) @@ -659,9 +622,9 @@ void CFrame::OnHostMessage(wxCommandEvent& event) break; case IDM_UPDATESTATUSBAR: - if (m_pStatusBar != NULL) + if (GetStatusBar() != NULL) { - m_pStatusBar->SetStatusText(event.GetString(), event.GetInt()); + GetStatusBar()->SetStatusText(event.GetString(), event.GetInt()); } break; diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index 6c6389d462..8a41936fc9 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -143,38 +143,9 @@ class CFrame : public CRenderFrame wxAuiToolBar *m_ToolBar, *m_ToolBarDebug, *m_ToolBarAui; bool bFloatWindow[IDM_CODEWINDOW - IDM_LOGWINDOW + 1]; - // Utility - wxWindow * GetNotebookPageFromId(wxWindowID Id); - wxAuiNotebook * GetNotebookFromId(u32 NBId); - int GetNotebookCount(); - wxString GetMenuLabel(int Id); - - // Perspectives - void AddRemoveBlankPage(); - void OnNotebookPageClose(wxAuiNotebookEvent& event); - void OnAllowNotebookDnD(wxAuiNotebookEvent& event); - void OnNotebookPageChanged(wxAuiNotebookEvent& event); - void OnFloatWindow(wxCommandEvent& event); - void ToggleFloatWindow(int Id); - void OnTab(wxAuiNotebookEvent& event); - int GetNotebookAffiliation(wxWindowID Id); - void ClosePages(); - void CloseAllNotebooks(); + // Perspectives (Should find a way to make all of this private) void DoAddPage(wxWindow *Win, int i, bool Float); void DoRemovePage(wxWindow *, bool bHide = true); - void TogglePane(); - void SetPaneSize(); - void ResetToolbarStyle(); - void TogglePaneStyle(bool On, int EventId); - void ToggleNotebookStyle(bool On, long Style); - void ResizeConsole(); - // Float window - void DoUnfloatPage(int Id); - void OnFloatingPageClosed(wxCloseEvent& event); - void OnFloatingPageSize(wxSizeEvent& event); - void DoFloatNotebookPage(wxWindowID Id); - wxFrame * CreateParentFrame(wxWindowID Id = wxID_ANY, const wxString& title = wxT(""), wxWindow * = NULL); - // User perspectives. Should find a way to make these private. struct SPerspectives { std::string Name; @@ -182,39 +153,20 @@ class CFrame : public CRenderFrame std::vector Width, Height; }; std::vector Perspectives; - wxString AuiFullscreen, AuiCurrent; - wxArrayString AuiPerspective; u32 ActivePerspective; - void AddPane(); - void UpdateCurrentPerspective(); - void SaveIniPerspectives(); - void LoadIniPerspectives(); - void OnPaneClose(wxAuiManagerEvent& evt); - void ReloadPanes(); - void DoLoadPerspective(); - void OnDropDownToolbarSelect(wxCommandEvent& event); - void OnDropDownSettingsToolbar(wxAuiToolBarEvent& event); - void OnDropDownToolbarItem(wxAuiToolBarEvent& event); - void OnSelectPerspective(wxCommandEvent& event); private: - wxStatusBar* m_pStatusBar; - wxBoxSizer* sizerFrame; CGameListCtrl* m_GameListCtrl; wxPanel* m_Panel; CRenderFrame* m_RenderFrame; wxPanel* m_RenderParent; - wxToolBarToolBase* m_ToolPlay; CLogWindow* m_LogWindow; bool UseDebugger; bool m_bBatchMode; bool m_bEdit; bool m_bTabSplit; bool m_bNoDocking; - bool m_bControlsCreated; bool m_bGameLoading; - char newDiscpath[2048]; - wxMessageDialog *m_StopDlg; std::vector drives; @@ -253,8 +205,52 @@ class CFrame : public CRenderFrame void PopulateToolbarAui(wxAuiToolBar* toolBar); void RecreateToolbar(); void CreateMenu(); + + // Utility + wxString GetMenuLabel(int Id); + wxWindow * GetNotebookPageFromId(wxWindowID Id); + wxAuiNotebook * GetNotebookFromId(u32 NBId); + int GetNotebookCount(); wxAuiNotebook *CreateEmptyNotebook(); + // Perspectives + void AddRemoveBlankPage(); + void OnNotebookPageClose(wxAuiNotebookEvent& event); + void OnAllowNotebookDnD(wxAuiNotebookEvent& event); + void OnNotebookPageChanged(wxAuiNotebookEvent& event); + void OnFloatWindow(wxCommandEvent& event); + void ToggleFloatWindow(int Id); + void OnTab(wxAuiNotebookEvent& event); + int GetNotebookAffiliation(wxWindowID Id); + void ClosePages(); + void CloseAllNotebooks(); + void TogglePane(); + void SetPaneSize(); + void ResetToolbarStyle(); + void TogglePaneStyle(bool On, int EventId); + void ToggleNotebookStyle(bool On, long Style); + void ResizeConsole(); + // Float window + void DoUnfloatPage(int Id); + void OnFloatingPageClosed(wxCloseEvent& event); + void OnFloatingPageSize(wxSizeEvent& event); + void DoFloatNotebookPage(wxWindowID Id); + wxFrame * CreateParentFrame(wxWindowID Id = wxID_ANY, + const wxString& title = wxT(""), + wxWindow * = NULL); + wxString AuiFullscreen, AuiCurrent; + void AddPane(); + void UpdateCurrentPerspective(); + void SaveIniPerspectives(); + void LoadIniPerspectives(); + void OnPaneClose(wxAuiManagerEvent& evt); + void ReloadPanes(); + void DoLoadPerspective(); + void OnDropDownToolbarSelect(wxCommandEvent& event); + void OnDropDownSettingsToolbar(wxAuiToolBarEvent& event); + void OnDropDownToolbarItem(wxAuiToolBarEvent& event); + void OnSelectPerspective(wxCommandEvent& event); + #ifdef _WIN32 // Override window proc for tricks like screensaver disabling WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); @@ -329,21 +325,6 @@ class CFrame : public CRenderFrame bool RendererIsFullscreen(); void StartGame(const std::string& filename); - // MenuBar - // File - Drive - wxMenuItem* m_pSubMenuDrive; - - // Emulation - wxMenuItem* m_pSubMenuLoad; - wxMenuItem* m_pSubMenuSave; - wxMenuItem* m_pSubMenuFrameSkipping; - -#if wxUSE_TIMER - // Used to process command events - void OnTimer(wxTimerEvent& WXUNUSED(event)); - wxTimer m_timer; -#endif - // Event table DECLARE_EVENT_TABLE(); }; diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 09ebe141f1..cbb7a55118 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -107,7 +107,7 @@ void CFrame::CreateMenu() fileMenu->Append(wxID_OPEN, _T("&Open...\tCtrl+O")); wxMenu *externalDrive = new wxMenu; - m_pSubMenuDrive = fileMenu->AppendSubMenu(externalDrive, _T("&Boot from DVD Drive...")); + fileMenu->Append(IDM_DRIVES, _T("&Boot from DVD Drive..."), externalDrive); drives = cdio_get_devices(); // Windows Limitation of 24 character drives @@ -139,7 +139,7 @@ void CFrame::CreateMenu() emulationMenu->Append(IDM_FRAMESTEP, _T("&Frame Stepping"), wxEmptyString, wxITEM_CHECK); wxMenu *skippingMenu = new wxMenu; - m_pSubMenuFrameSkipping = emulationMenu->AppendSubMenu(skippingMenu, _T("Frame S&kipping")); + emulationMenu->AppendSubMenu(skippingMenu, _T("Frame S&kipping")); for(int i = 0; i < 10; i++) skippingMenu->Append(IDM_FRAMESKIP0 + i, wxString::Format(_T("%i"), i), wxEmptyString, wxITEM_RADIO); @@ -148,8 +148,8 @@ void CFrame::CreateMenu() emulationMenu->AppendSeparator(); wxMenu *saveMenu = new wxMenu; wxMenu *loadMenu = new wxMenu; - m_pSubMenuLoad = emulationMenu->AppendSubMenu(loadMenu, _T("&Load State")); - m_pSubMenuSave = emulationMenu->AppendSubMenu(saveMenu, _T("Sa&ve State")); + fileMenu->Append(IDM_LOADSTATE, _T("&Load State"), loadMenu); + fileMenu->Append(IDM_SAVESTATE, _T("&Load State"), saveMenu); saveMenu->Append(IDM_SAVESTATEFILE, _T("Save State...")); loadMenu->Append(IDM_UNDOSAVESTATE, _T("Last Overwritten State\tShift+F12")); @@ -311,16 +311,11 @@ wxString CFrame::GetMenuLabel(int Id) Label = _T("&Stop\t"); break; case HK_WIIMOTE1_CONNECT: - Label = _T("Connect Wiimote 1\t"); - break; case HK_WIIMOTE2_CONNECT: - Label = _T("Connect Wiimote 2\t"); - break; case HK_WIIMOTE3_CONNECT: - Label = _T("Connect Wiimote 3\t"); - break; case HK_WIIMOTE4_CONNECT: - Label = _T("Connect Wiimote 4\t"); + Label = wxString::Format(_T("Connect Wiimote %i\t"), + Id - HK_WIIMOTE1_CONNECT + 1); break; } @@ -604,6 +599,7 @@ void CFrame::DoOpen(bool Boot) } else { + char newDiscpath[2048]; strncpy(newDiscpath, path.mb_str(), strlen(path.mb_str())+1); DVDInterface::ChangeDisc(newDiscpath); } @@ -879,11 +875,7 @@ void CFrame::DoStop() // Ask for confirmation in case the user accidentally clicked Stop / Escape if (SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop) { - // Suppress duplicate dialog boxes - if (m_StopDlg) - return; - - m_StopDlg = new wxMessageDialog( + wxMessageDialog *m_StopDlg = new wxMessageDialog( this, wxT("Do you want to stop the current emulation?"), wxT("Please confirm..."), @@ -892,8 +884,7 @@ void CFrame::DoStop() int Ret = m_StopDlg->ShowModal(); m_StopDlg->Destroy(); - m_StopDlg = NULL; - if (Ret == wxID_NO) + if (Ret != wxID_YES) return; } @@ -933,10 +924,10 @@ void CFrame::DoStop() UpdateGUI(); // Clean framerate indications from the status bar. - m_pStatusBar->SetStatusText(wxT(" "), 0); + GetStatusBar()->SetStatusText(wxT(" "), 0); // Clear wiimote connection status from the status bar. - m_pStatusBar->SetStatusText(wxT(" "), 1); + GetStatusBar()->SetStatusText(wxT(" "), 1); // If batch mode was specified on the command-line, exit now. if (m_bBatchMode) @@ -965,7 +956,7 @@ void CFrame::OnConfigMain(wxCommandEvent& WXUNUSED (event)) void CFrame::OnPluginGFX(wxCommandEvent& WXUNUSED (event)) { CPluginManager::GetInstance().OpenConfig( - GetHandle(), + this, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str(), PLUGIN_TYPE_VIDEO ); @@ -974,7 +965,7 @@ void CFrame::OnPluginGFX(wxCommandEvent& WXUNUSED (event)) void CFrame::OnPluginDSP(wxCommandEvent& WXUNUSED (event)) { CPluginManager::GetInstance().OpenConfig( - GetHandle(), + this, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(), PLUGIN_TYPE_DSP ); @@ -1007,7 +998,7 @@ void CFrame::OnPluginPAD(wxCommandEvent& WXUNUSED (event)) void CFrame::OnPluginWiimote(wxCommandEvent& WXUNUSED (event)) { CPluginManager::GetInstance().OpenConfig( - GetHandle(), + this, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin.c_str(), PLUGIN_TYPE_WIIMOTE ); @@ -1231,9 +1222,6 @@ void CFrame::OnFrameSkip(wxCommandEvent& event) // Update the enabled/disabled status void CFrame::UpdateGUI() { - if (!m_bControlsCreated) - return; - // Save status bool Initialized = Core::isRunning(); bool Running = Core::GetState() == Core::CORE_RUN; @@ -1252,7 +1240,7 @@ void CFrame::UpdateGUI() // File GetMenuBar()->FindItem(wxID_OPEN)->Enable(!Initialized); - m_pSubMenuDrive->Enable(!Initialized); + GetMenuBar()->FindItem(IDM_DRIVES)->Enable(!Initialized); GetMenuBar()->FindItem(wxID_REFRESH)->Enable(!Initialized); GetMenuBar()->FindItem(IDM_BROWSE)->Enable(!Initialized); @@ -1274,24 +1262,33 @@ void CFrame::UpdateGUI() GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE3)->SetItemLabel(GetMenuLabel(HK_WIIMOTE3_CONNECT)); GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE4)->SetItemLabel(GetMenuLabel(HK_WIIMOTE4_CONNECT)); - m_pSubMenuLoad->Enable(Initialized); - m_pSubMenuSave->Enable(Initialized); + GetMenuBar()->FindItem(IDM_LOADSTATE)->Enable(Initialized); + GetMenuBar()->FindItem(IDM_SAVESTATE)->Enable(Initialized); // Misc GetMenuBar()->FindItem(IDM_CHANGEDISC)->Enable(Initialized); - if (DiscIO::CNANDContentManager::Access().GetNANDLoader(std::string(File::GetUserPath(D_WIIMENU_IDX))).IsValid()) + if (DiscIO::CNANDContentManager::Access().GetNANDLoader + (std::string(File::GetUserPath(D_WIIMENU_IDX))).IsValid()) GetMenuBar()->FindItem(IDM_LOAD_WII_MENU)->Enable(!Initialized); - GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE1)->Enable(Initialized && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii); - GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE2)->Enable(Initialized && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii); - GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE3)->Enable(Initialized && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii); - GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE4)->Enable(Initialized && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii); + GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE1)-> + Enable(Initialized && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii); + GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE2)-> + Enable(Initialized && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii); + GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE3)-> + Enable(Initialized && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii); + GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE4)-> + Enable(Initialized && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii); if (Initialized && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii) { - GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE1)->Check(GetUsbPointer()->AccessWiiMote(0x0100)->IsConnected() == 3); - GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE2)->Check(GetUsbPointer()->AccessWiiMote(0x0101)->IsConnected() == 3); - GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE3)->Check(GetUsbPointer()->AccessWiiMote(0x0102)->IsConnected() == 3); - GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE4)->Check(GetUsbPointer()->AccessWiiMote(0x0103)->IsConnected() == 3); + GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE1)->Check(GetUsbPointer()-> + AccessWiiMote(0x0100)->IsConnected() == 3); + GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE2)->Check(GetUsbPointer()-> + AccessWiiMote(0x0101)->IsConnected() == 3); + GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE3)->Check(GetUsbPointer()-> + AccessWiiMote(0x0102)->IsConnected() == 3); + GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE4)->Check(GetUsbPointer()-> + AccessWiiMote(0x0103)->IsConnected() == 3); } if (Running) @@ -1475,9 +1472,9 @@ void CFrame::OnToggleStatusbar(wxCommandEvent& event) { SConfig::GetInstance().m_InterfaceStatusbar = event.IsChecked(); if (SConfig::GetInstance().m_InterfaceStatusbar == true) - m_pStatusBar->Show(); + GetStatusBar()->Show(); else - m_pStatusBar->Hide(); + GetStatusBar()->Hide(); this->SendSizeEvent(); } diff --git a/Source/Core/DolphinWX/Src/Globals.h b/Source/Core/DolphinWX/Src/Globals.h index a445027cc2..64f6a99887 100644 --- a/Source/Core/DolphinWX/Src/Globals.h +++ b/Source/Core/DolphinWX/Src/Globals.h @@ -85,6 +85,7 @@ enum IDM_FRAMESTEP, IDM_SCREENSHOT, IDM_BROWSE, + IDM_DRIVES, IDM_DRIVE1, IDM_DRIVE24 = IDM_DRIVE1 + 23,//248, diff --git a/Source/PluginSpecs/PluginSpecs.h b/Source/PluginSpecs/PluginSpecs.h index 0f24f54066..2e7d15f106 100644 --- a/Source/PluginSpecs/PluginSpecs.h +++ b/Source/PluginSpecs/PluginSpecs.h @@ -42,10 +42,6 @@ enum PLUGIN_COMM #define TRUE 1 #define FALSE 0 #endif - - // simulate something that looks like win32 - // long term, kill these - #define HWND void* #endif #if defined(__cplusplus) @@ -116,7 +112,7 @@ EXPORT void CALL GetDllInfo(PLUGIN_INFO* _pPluginInfo); // input: A handle to the window that calls this function // output: none // -EXPORT void CALL DllConfig(HWND _hParent); +EXPORT void CALL DllConfig(void *_hParent); // ___________________________________________________________________________ // Function: DllDebugger diff --git a/Source/PluginSpecs/pluginspecs_wiimote.h b/Source/PluginSpecs/pluginspecs_wiimote.h index 0d6711e11c..12b33ca0b2 100644 --- a/Source/PluginSpecs/pluginspecs_wiimote.h +++ b/Source/PluginSpecs/pluginspecs_wiimote.h @@ -18,7 +18,7 @@ typedef bool (*TRendererHasFocus)(void); // This data is passed from the core on initialization. typedef struct { - HWND hWnd; + void *hWnd; u32 ISOId; TLogv pLog; TWiimoteInterruptChannel pWiimoteInterruptChannel; diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp index e2c0300347..4482c2370b 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp @@ -103,22 +103,6 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle } #endif -#if defined(HAVE_WX) && HAVE_WX -wxWindow* GetParentedWxWindow(HWND Parent) -{ -#ifdef _WIN32 - wxSetInstance((HINSTANCE)g_hInstance); - wxWindow *win = new wxWindow(); - win->SetHWND((WXHWND)Parent); - win->AdoptAttributesFromHWND(); - return win; -#else - return new wxWindow(); -#endif -} -#endif - - void *DllDebugger(void *_hParent, bool Show) { return NULL; @@ -145,14 +129,13 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) LogManager::SetInstance((LogManager*)globals->logManager); } -void DllConfig(HWND _hParent) +void DllConfig(void *_hParent) { #if defined(HAVE_WX) && HAVE_WX // Load config settings g_Config.Load(); - wxWindow *frame = GetParentedWxWindow(_hParent); - m_ConfigFrame = new DSPConfigDialogHLE(frame); + m_ConfigFrame = new DSPConfigDialogHLE((wxWindow *)_hParent); // add backends std::vector backends = AudioCommon::GetSoundBackends(); @@ -163,23 +146,8 @@ void DllConfig(HWND _hParent) m_ConfigFrame->AddBackend((*iter).c_str()); } - // Only allow one open at a time -#ifdef _WIN32 - frame->Disable(); m_ConfigFrame->ShowModal(); - frame->Enable(); -#else - m_ConfigFrame->ShowModal(); -#endif - -#ifdef _WIN32 - frame->SetFocus(); - frame->SetHWND(NULL); -#endif - m_ConfigFrame->Destroy(); - m_ConfigFrame = NULL; - frame->Destroy(); #endif } diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/main.cpp b/Source/Plugins/Plugin_DSP_LLE/Src/main.cpp index 3ae3312826..4e67168eab 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/main.cpp +++ b/Source/Plugins/Plugin_DSP_LLE/Src/main.cpp @@ -95,22 +95,6 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle } #endif -#if defined(HAVE_WX) && HAVE_WX -wxWindow* GetParentedWxWindow(HWND Parent) -{ -#ifdef _WIN32 - wxSetInstance((HINSTANCE)g_hInstance); -#endif - wxWindow *win = new wxWindow(); -#ifdef _WIN32 - win->SetHWND((WXHWND)Parent); - win->AdoptAttributesFromHWND(); -#endif - return win; -} -#endif - - void GetDllInfo(PLUGIN_INFO* _PluginInfo) { _PluginInfo->Version = 0x0100; @@ -133,11 +117,10 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) LogManager::SetInstance((LogManager *)globals->logManager); } -void DllConfig(HWND _hParent) +void DllConfig(void *_hParent) { #if defined(HAVE_WX) && HAVE_WX - wxWindow *frame = GetParentedWxWindow(_hParent); - m_ConfigFrame = new DSPConfigDialogLLE(frame); + m_ConfigFrame = new DSPConfigDialogLLE((wxWindow *)_hParent); // add backends std::vector backends = AudioCommon::GetSoundBackends(); @@ -148,23 +131,9 @@ void DllConfig(HWND _hParent) m_ConfigFrame->AddBackend((*iter).c_str()); } - // Only allow one open at a time -#ifdef _WIN32 - frame->Disable(); m_ConfigFrame->ShowModal(); - frame->Enable(); -#else - m_ConfigFrame->ShowModal(); -#endif - -#ifdef _WIN32 - frame->SetFocus(); - frame->SetHWND(NULL); -#endif m_ConfigFrame->Destroy(); - m_ConfigFrame = NULL; - frame->Destroy(); #endif } diff --git a/Source/Plugins/Plugin_VideoDX11/Src/main.cpp b/Source/Plugins/Plugin_VideoDX11/Src/main.cpp index 864f0b977c..f76dcdf85b 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/main.cpp @@ -96,15 +96,6 @@ bool IsD3D() // This is used for the functions right below here which use wxwidgets #if defined(HAVE_WX) && HAVE_WX WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); - -wxWindow* GetParentedWxWindow(HWND Parent) -{ - wxSetInstance((HINSTANCE)g_hInstance); - wxWindow* win = new wxWindow(); - win->SetHWND((WXHWND)Parent); - win->AdoptAttributesFromHWND(); - return win; -} #endif void *DllDebugger(void *_hParent, bool Show) @@ -186,9 +177,9 @@ void DllAbout(HWND _hParent) MessageBoxA(NULL, "DllAbout not implemented, how did you come here? Anyway, report this to the devs.", "Error!", MB_OK); } -void DllConfig(HWND _hParent) +void DllConfig(void *_hParent) { - DlgSettings_Show(g_hInstance, _hParent); + DlgSettings_Show(g_hInstance, (HWND)((wxWindow *)_hParent)->GetHandle()); } void Initialize(void* init) diff --git a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp index ec573fa3a7..94d01611c4 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp @@ -85,15 +85,6 @@ bool IsD3D() // This is used for the functions right below here which use wxwidgets #if defined(HAVE_WX) && HAVE_WX WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); - -wxWindow* GetParentedWxWindow(HWND Parent) -{ - wxSetInstance((HINSTANCE)g_hInstance); - wxWindow *win = new wxWindow(); - win->SetHWND((WXHWND)Parent); - win->AdoptAttributesFromHWND(); - return win; -} #endif void *DllDebugger(void *_hParent, bool Show) @@ -187,7 +178,7 @@ void DllAbout(HWND _hParent) //DialogBox(g_hInstance,(LPCTSTR)IDD_ABOUT,_hParent,(DLGPROC)AboutProc); } -void DllConfig(HWND _hParent) +void DllConfig(void *_hParent) { // If not initialized, only init D3D so we can enumerate resolutions. if (!s_PluginInitialized) @@ -196,21 +187,11 @@ void DllConfig(HWND _hParent) g_Config.GameIniLoad(globals->game_ini); UpdateActiveConfig(); #if defined(HAVE_WX) && HAVE_WX - wxWindow *frame = GetParentedWxWindow(_hParent); - m_ConfigFrame = new GFXConfigDialogDX(frame); + m_ConfigFrame = new GFXConfigDialogDX((wxWindow *)_hParent); - // Prevent user to show more than 1 config window at same time - frame->Disable(); m_ConfigFrame->CreateGUIControls(); m_ConfigFrame->ShowModal(); - frame->Enable(); - - frame->SetFocus(); - frame->SetHWND(NULL); - m_ConfigFrame->Destroy(); - m_ConfigFrame = NULL; - frame->Destroy(); #endif if (!s_PluginInitialized) D3D::Shutdown(); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp index e66685cddc..e3e9952823 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp @@ -136,19 +136,6 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); extern HINSTANCE g_hInstance; #endif - -wxWindow* GetParentedWxWindow(HWND Parent) -{ -#ifdef _WIN32 - wxSetInstance((HINSTANCE)g_hInstance); -#endif - wxWindow *win = new wxWindow(); -#ifdef _WIN32 - win->SetHWND((WXHWND)Parent); - win->AdoptAttributesFromHWND(); -#endif - return win; -} #endif void *DllDebugger(void *_hParent, bool Show) @@ -160,35 +147,18 @@ void *DllDebugger(void *_hParent, bool Show) #endif } -void DllConfig(HWND _hParent) +void DllConfig(void *_hParent) { g_Config.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_opengl.ini").c_str()); g_Config.GameIniLoad(globals->game_ini); g_Config.UpdateProjectionHack(); UpdateActiveConfig(); #if defined(HAVE_WX) && HAVE_WX - wxWindow *frame = GetParentedWxWindow(_hParent); - m_ConfigFrame = new GFXConfigDialogOGL(frame); + m_ConfigFrame = new GFXConfigDialogOGL((wxWindow *)_hParent); - // Prevent user to show more than 1 config window at same time -#ifdef _WIN32 - frame->Disable(); m_ConfigFrame->CreateGUIControls(); m_ConfigFrame->ShowModal(); - frame->Enable(); -#else - m_ConfigFrame->CreateGUIControls(); - m_ConfigFrame->ShowModal(); -#endif - -#ifdef _WIN32 - frame->SetFocus(); - frame->SetHWND(NULL); -#endif - m_ConfigFrame->Destroy(); - m_ConfigFrame = NULL; - frame->Destroy(); #endif } diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/main.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/main.cpp index 67e7c99aec..9a6d84bab3 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/main.cpp @@ -66,7 +66,7 @@ void *DllDebugger(void *_hParent, bool Show) return NULL; } -void DllConfig(HWND _hParent) +void DllConfig(void *_hParent) { } diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp index aed99e318f..7e33b9835e 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp @@ -213,11 +213,11 @@ void GetMousePos(float& x, float& y) // Get the cursor position for the entire screen GetCursorPos(&point); // Get the cursor position relative to the upper left corner of the rendering window - ScreenToClient(g_WiimoteInitialize.hWnd, &point); + ScreenToClient((HWND)g_WiimoteInitialize.hWnd, &point); // Get the size of the rendering window. (In my case Rect.top and Rect.left was zero.) RECT Rect; - GetClientRect(g_WiimoteInitialize.hWnd, &Rect); + GetClientRect((HWND)g_WiimoteInitialize.hWnd, &Rect); // Width and height is the size of the rendering window float WinWidth = (float)(Rect.right - Rect.left); float WinHeight = (float)(Rect.bottom - Rect.top); diff --git a/Source/Plugins/Plugin_Wiimote/Src/main.cpp b/Source/Plugins/Plugin_Wiimote/Src/main.cpp index 88f7b098b7..0a9dbfd02c 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/main.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/main.cpp @@ -115,21 +115,6 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle } #endif -#if defined(HAVE_WX) && HAVE_WX -wxWindow* GetParentedWxWindow(HWND Parent) -{ -#ifdef _WIN32 - wxSetInstance((HINSTANCE)g_hInstance); -#endif - wxWindow *win = new wxWindow(); -#ifdef _WIN32 - win->SetHWND((WXHWND)Parent); - win->AdoptAttributesFromHWND(); -#endif - return win; -} -#endif - // Exports void GetDllInfo(PLUGIN_INFO* _PluginInfo) { @@ -157,7 +142,7 @@ void *DllDebugger(void *_hParent, bool Show) return NULL; } -void DllConfig(HWND _hParent) +void DllConfig(void *_hParent) { #ifdef _WIN32 if (WiiMoteReal::g_AutoPairUpInvisibleWindow == NULL) @@ -177,24 +162,9 @@ void DllConfig(HWND _hParent) #if defined(HAVE_WX) && HAVE_WX - wxWindow *frame = GetParentedWxWindow(_hParent); - m_BasicConfigFrame = new WiimoteBasicConfigDialog(frame); -#ifdef _WIN32 - frame->Disable(); + m_BasicConfigFrame = new WiimoteBasicConfigDialog((wxWindow *)_hParent); m_BasicConfigFrame->ShowModal(); - frame->Enable(); -#else - m_BasicConfigFrame->ShowModal(); -#endif - -#ifdef _WIN32 - frame->SetFocus(); - frame->SetHWND(NULL); -#endif - m_BasicConfigFrame->Destroy(); - m_BasicConfigFrame = NULL; - frame->Destroy(); #endif } @@ -347,7 +317,7 @@ void Wiimote_ControlChannel(int _number, u16 _channelID, const void* _pData, u32 WiiMoteEmu::g_ReportingAuto[_number] = false; WARN_LOG(WIIMOTE, "Wiimote: #%i Disconnected", _number); #ifdef _WIN32 - PostMessage(g_WiimoteInitialize.hWnd, WM_USER, WIIMOTE_DISCONNECT, _number); + PostMessage((HWND)g_WiimoteInitialize.hWnd, WM_USER, WIIMOTE_DISCONNECT, _number); #endif return; } diff --git a/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp b/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp index 47586836aa..703bd61c2c 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp @@ -794,7 +794,7 @@ THREAD_RETURN RunInvisibleMessageWindow_ThreadFunc(void* arg) void ToggleEmulatorState(bool stop) { - PostMessage(GetParent(g_WiimoteInitialize.hWnd), WM_USER, WM_USER_PAUSE, 0); + PostMessage(GetParent((HWND)g_WiimoteInitialize.hWnd), WM_USER, WM_USER_PAUSE, 0); if (stop) { while (g_EmulatorState != PLUGIN_EMUSTATE_PLAY) Sleep(50); } @@ -832,7 +832,7 @@ int PairUpRefreshWiimote(bool addwiimote) Allocate(); ToggleEmulatorState(false); if (addwiimote) - PostMessage(GetParent(g_WiimoteInitialize.hWnd), WM_USER, WM_USER_KEYDOWN, (3 + connectslot)); + PostMessage(GetParent((HWND)g_WiimoteInitialize.hWnd), WM_USER, WM_USER_KEYDOWN, (3 + connectslot)); } return 0; diff --git a/Source/Plugins/Plugin_WiimoteNew/Src/WiimoteNew.cpp b/Source/Plugins/Plugin_WiimoteNew/Src/WiimoteNew.cpp index d3e80217c8..d3e68f8a15 100644 --- a/Source/Plugins/Plugin_WiimoteNew/Src/WiimoteNew.cpp +++ b/Source/Plugins/Plugin_WiimoteNew/Src/WiimoteNew.cpp @@ -53,23 +53,6 @@ WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); HINSTANCE g_hInstance; #endif -// copied from GCPad -#if defined(HAVE_WX) && HAVE_WX -wxWindow* GetParentedWxWindow(HWND Parent) -{ -#ifdef _WIN32 - wxSetInstance((HINSTANCE)g_hInstance); -#endif - wxWindow *win = new wxWindow(); -#ifdef _WIN32 - win->SetHWND((WXHWND)Parent); - win->AdoptAttributesFromHWND(); -#endif - return win; -} -#endif -// / - #ifdef _WIN32 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved ) { @@ -271,7 +254,7 @@ void GetDllInfo(PLUGIN_INFO* _pPluginInfo) // input: A handle to the window that calls this function // output: none // -void DllConfig(HWND _hParent) +void DllConfig(void *_hParent) { #if defined(HAVE_WX) && HAVE_WX const bool was_init = g_plugin.controller_interface.IsInit(); @@ -279,34 +262,18 @@ void DllConfig(HWND _hParent) if (false == was_init) { #if defined(HAVE_X11) && HAVE_X11 - Window win = GDK_WINDOW_XID(GTK_WIDGET(_hParent)->window); + Window win = GDK_WINDOW_XID(GTK_WIDGET(((wxWindow *)_hParent)->GetHandle())->window); InitPlugin((void *)win); #else - InitPlugin(_hParent); + InitPlugin(((wxWindow *)_hParent)->GetHandle()); #endif } - wxWindow *frame = GetParentedWxWindow(_hParent); - WiimoteConfigDiag* const m_ConfigFrame = new WiimoteConfigDiag(frame, g_plugin); - //InputConfigDialog* const m_ConfigFrame = new InputConfigDialog(frame, g_plugin, PLUGIN_FULL_NAME); + WiimoteConfigDiag* const m_ConfigFrame = new WiimoteConfigDiag((wxWindow *)_hParent, g_plugin); -#ifdef _WIN32 - frame->Disable(); m_ConfigFrame->ShowModal(); - frame->Enable(); -#else - m_ConfigFrame->ShowModal(); -#endif - -#ifdef _WIN32 - wxMilliSleep(50); // hooray for hacks - frame->SetFocus(); - frame->SetHWND(NULL); -#endif m_ConfigFrame->Destroy(); - frame->Destroy(); - // / if (false == was_init) DeInitPlugin();