diff --git a/Source/Core/Common/Src/Plugin.cpp b/Source/Core/Common/Src/Plugin.cpp index c605a43d07..e9871fdc96 100644 --- a/Source/Core/Common/Src/Plugin.cpp +++ b/Source/Core/Common/Src/Plugin.cpp @@ -100,10 +100,9 @@ void CPlugin::Config(HWND _hwnd) } // Debug: Open the Debugging window -void CPlugin::Debug(void *Parent, bool Show) +void *CPlugin::Debug(void *Parent, bool Show) { - if (m_DllDebugger != NULL) - m_DllDebugger(Parent, Show); + return m_DllDebugger(Parent, Show); } void CPlugin::SetGlobals(PLUGIN_GLOBALS* _pluginGlobals) { diff --git a/Source/Core/Common/Src/Plugin.h b/Source/Core/Common/Src/Plugin.h index a71be619cc..a557c15dd8 100644 --- a/Source/Core/Common/Src/Plugin.h +++ b/Source/Core/Common/Src/Plugin.h @@ -26,7 +26,7 @@ namespace Common { typedef void (__cdecl * TGetDllInfo)(PLUGIN_INFO*); typedef void (__cdecl * TDllConfig)(HWND); - typedef void (__cdecl * TDllDebugger)(void *, bool); + typedef void* (__cdecl * TDllDebugger)(void *, bool); typedef void (__cdecl * TSetDllGlobals)(PLUGIN_GLOBALS*); typedef void (__cdecl * TInitialize)(void *); typedef void (__cdecl * TShutdown)(); @@ -49,7 +49,7 @@ public: void Config(HWND _hwnd); void About(HWND _hwnd); - void Debug(void *Parent, bool Show); + void *Debug(void *Parent, bool Show); void DoState(unsigned char **ptr, int mode); void EmuStateChange(PLUGIN_EMUSTATE newState); void Initialize(void *init); diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp index bacb630574..eaafc2a74e 100644 --- a/Source/Core/Core/Src/Core.cpp +++ b/Source/Core/Core/Src/Core.cpp @@ -212,11 +212,6 @@ void Stop() // - Hammertime! WARN_LOG(CONSOLE, "Stop [Main Thread]\t\t---- Shutting down ----"); - // This must be done a while before freeing the dll to not crash wx around - // MSWWindowProc and DefWindowProc, will investigate further - Host_Message(AUDIO_DESTROY); - Host_Message(VIDEO_DESTROY); - Host_SetWaitCursor(true); // hourglass! if (PowerPC::GetState() == PowerPC::CPU_POWERDOWN) return; diff --git a/Source/Core/Core/Src/PluginManager.cpp b/Source/Core/Core/Src/PluginManager.cpp index 068e77a47d..0dbf7a9f19 100644 --- a/Source/Core/Core/Src/PluginManager.cpp +++ b/Source/Core/Core/Src/PluginManager.cpp @@ -377,7 +377,6 @@ Common::PluginVideo *CPluginManager::GetVideo() // the plugins in turn void CPluginManager::FreeVideo() { - //Host_Message(VIDEO_DESTROY); WARN_LOG(CONSOLE, "%s", Core::StopMessage(false, "Will unload video DLL").c_str()); delete m_video; m_video = NULL; @@ -385,7 +384,6 @@ void CPluginManager::FreeVideo() void CPluginManager::FreeDSP() { - //Host_Message(AUDIO_DESTROY); WARN_LOG(CONSOLE, "%s", Core::StopMessage(false, "Will unload audio DLL").c_str()); delete m_dsp; m_dsp = NULL; @@ -438,23 +436,24 @@ void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename, PLUGIN_TY } // Open debugging window. Type = Video or DSP. Show = Show or hide window. -void CPluginManager::OpenDebug(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type, bool Show) +void *CPluginManager::OpenDebug(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type, bool Show) { if (! File::Exists((File::GetPluginsDirectory() + _rFilename).c_str())) { PanicAlert("Can't find plugin %s", _rFilename); - return; + return NULL; } switch(Type) { case PLUGIN_TYPE_VIDEO: - GetVideo()->Debug(_Parent, Show); + return GetVideo()->Debug(_Parent, Show); break; case PLUGIN_TYPE_DSP: - GetDSP()->Debug(_Parent, Show); + return GetDSP()->Debug(_Parent, Show); break; default: PanicAlert("Type %d debug not supported in plugin %s", Type, _rFilename); + return NULL; } } diff --git a/Source/Core/Core/Src/PluginManager.h b/Source/Core/Core/Src/PluginManager.h index 0f491e3777..d1a94655be 100644 --- a/Source/Core/Core/Src/PluginManager.h +++ b/Source/Core/Core/Src/PluginManager.h @@ -64,7 +64,7 @@ public: void ShutdownVideoPlugin(); void ScanForPlugins(); void OpenConfig(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type); - void OpenDebug(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type, bool Show); + void *OpenDebug(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type, bool Show); const CPluginInfos& GetPluginInfos() {return(m_PluginInfos);} PLUGIN_GLOBALS* GetGlobals(); diff --git a/Source/Core/DSPCore/Src/DSPCore.cpp b/Source/Core/DSPCore/Src/DSPCore.cpp index 5d2b5edae1..68731e7cca 100644 --- a/Source/Core/DSPCore/Src/DSPCore.cpp +++ b/Source/Core/DSPCore/Src/DSPCore.cpp @@ -36,7 +36,7 @@ SDSP g_dsp; DSPBreakpoints dsp_breakpoints; -DSPCoreState core_state = DSPCORE_RUNNING; +DSPCoreState core_state = DSPCORE_STOP; DSPEmitter *jit = NULL; Common::Event step_event; @@ -136,11 +136,15 @@ bool DSPCore_Init(const char *irom_filename, const char *coef_filename, step_event.Init(); + core_state = DSPCORE_RUNNING; + return true; } void DSPCore_Shutdown() { + core_state = DSPCORE_STOP; + if(jit) { delete jit; jit = NULL; diff --git a/Source/Core/DSPCore/Src/DSPCore.h b/Source/Core/DSPCore/Src/DSPCore.h index 3e807c3ee2..92cb8516bf 100644 --- a/Source/Core/DSPCore/Src/DSPCore.h +++ b/Source/Core/DSPCore/Src/DSPCore.h @@ -251,8 +251,9 @@ void CompileCurrent(); enum DSPCoreState { - DSPCORE_RUNNING = 0, - DSPCORE_STEPPING = 1, + DSPCORE_STOP = 0, + DSPCORE_RUNNING, + DSPCORE_STEPPING, }; int DSPCore_RunCycles(int cycles); diff --git a/Source/Core/DebuggerWX/Src/CodeWindow.h b/Source/Core/DebuggerWX/Src/CodeWindow.h index 5c19cb96d2..b1fea2b1b0 100644 --- a/Source/Core/DebuggerWX/Src/CodeWindow.h +++ b/Source/Core/DebuggerWX/Src/CodeWindow.h @@ -48,17 +48,9 @@ class CCodeWindow wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxTAB_TRAVERSAL | wxNO_BORDER, - const wxString& name = wxT("Dolphin-Debugger") + long style = wxTAB_TRAVERSAL, + const wxString& name = wxT("Code") ); - /* - CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, wxWindow* parent, - wxWindowID id = wxID_ANY, - const wxString& title = _T("Dolphin-Debugger"), - const wxPoint& pos = wxPoint(950, 100), - const wxSize& size = wxSize(400, 500), - long style = wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE); - */ ~CCodeWindow(); void Load(); @@ -122,13 +114,13 @@ class CCodeWindow bool bAutomaticStart; bool bBootToPause; int iLogWindow; int iConsoleWindow; - bool bCodeWindow; int iCodeWindow; bool bFloatCodeWindow; - bool bRegisterWindow; int iRegisterWindow; bool bFloatRegisterWindow; - bool bBreakpointWindow; int iBreakpointWindow; bool bFloatBreakpointWindow; - bool bMemoryWindow; int iMemoryWindow; bool bFloatMemoryWindow; - bool bJitWindow; int iJitWindow; bool bFloatJitWindow; - bool bSoundWindow; int iSoundWindow; bool bFloatSoundWindow; - bool bVideoWindow; int iVideoWindow; bool bFloatVideoWindow; + bool bCodeWindow; int iCodeWindow; + bool bRegisterWindow; int iRegisterWindow; + bool bBreakpointWindow; int iBreakpointWindow; + bool bMemoryWindow; int iMemoryWindow; + bool bJitWindow; int iJitWindow; + bool bSoundWindow; int iSoundWindow; + bool bVideoWindow; int iVideoWindow; private: diff --git a/Source/Core/DebuggerWX/Src/CodeWindowFunctions.cpp b/Source/Core/DebuggerWX/Src/CodeWindowFunctions.cpp index ed043e7cf5..2ccba91535 100644 --- a/Source/Core/DebuggerWX/Src/CodeWindowFunctions.cpp +++ b/Source/Core/DebuggerWX/Src/CodeWindowFunctions.cpp @@ -107,15 +107,15 @@ void CCodeWindow::Load() ini.Get(_Section.c_str(), "Sound", &iSoundWindow, 0); ini.Get(_Section.c_str(), "Video", &iVideoWindow, 0); // Get floating setting - ini.Get("Float", "Log", &Parent->bFloatLogWindow, false); - ini.Get("Float", "Console", &Parent->bFloatConsoleWindow, false); - ini.Get("Float", "Code", &bFloatCodeWindow, false); - ini.Get("Float", "Registers", &bFloatRegisterWindow, false); - ini.Get("Float", "Breakpoints", &bFloatBreakpointWindow, false); - ini.Get("Float", "Memory", &bFloatMemoryWindow, false); - ini.Get("Float", "JIT", &bFloatJitWindow, false); - ini.Get("Float", "Sound", &bFloatSoundWindow, false); - ini.Get("Float", "Video", &bFloatVideoWindow, false); + ini.Get("Float", "Log", &Parent->bFloatWindow[0], false); + ini.Get("Float", "Console", &Parent->bFloatWindow[1], false); + ini.Get("Float", "Code", &Parent->bFloatWindow[2], false); + ini.Get("Float", "Registers", &Parent->bFloatWindow[3], false); + ini.Get("Float", "Breakpoints", &Parent->bFloatWindow[4], false); + ini.Get("Float", "Memory", &Parent->bFloatWindow[5], false); + ini.Get("Float", "JIT", &Parent->bFloatWindow[6], false); + ini.Get("Float", "Sound", &Parent->bFloatWindow[7], false); + ini.Get("Float", "Video", &Parent->bFloatWindow[8], false); // Boot to pause or not ini.Get("ShowOnStart", "AutomaticStart", &bAutomaticStart, false); @@ -470,7 +470,8 @@ void CCodeWindow::OnToggleWindow(wxCommandEvent& event) void CCodeWindow::ToggleCodeWindow(bool bShow) { if (bShow) - Parent->DoAddPage(this, iCodeWindow, wxT("Code"), bFloatCodeWindow); + Parent->DoAddPage(this, iCodeWindow, + Parent->bFloatWindow[IDM_CODEWINDOW - IDM_LOGWINDOW]); else // hide Parent->DoRemovePage(this); } @@ -483,7 +484,7 @@ void CCodeWindow::ToggleRegisterWindow(bool bShow) if (!m_RegisterWindow) m_RegisterWindow = new CRegisterWindow(Parent, IDM_REGISTERWINDOW); Parent->DoAddPage(m_RegisterWindow, iRegisterWindow, - wxT("Registers"), bFloatRegisterWindow); + Parent->bFloatWindow[IDM_REGISTERWINDOW - IDM_LOGWINDOW]); } else // hide Parent->DoRemovePage(m_RegisterWindow); @@ -497,7 +498,7 @@ void CCodeWindow::ToggleBreakPointWindow(bool bShow) if (!m_BreakpointWindow) m_BreakpointWindow = new CBreakPointWindow(this, Parent, IDM_BREAKPOINTWINDOW); Parent->DoAddPage(m_BreakpointWindow, iBreakpointWindow, - wxT("Breakpoints"), bFloatBreakpointWindow); + Parent->bFloatWindow[IDM_BREAKPOINTWINDOW - IDM_LOGWINDOW]); } else // hide Parent->DoRemovePage(m_BreakpointWindow); @@ -510,7 +511,8 @@ void CCodeWindow::ToggleMemoryWindow(bool bShow) { if (!m_MemoryWindow) m_MemoryWindow = new CMemoryWindow(Parent, IDM_MEMORYWINDOW); - Parent->DoAddPage(m_MemoryWindow, iMemoryWindow, wxT("Memory"), bFloatMemoryWindow); + Parent->DoAddPage(m_MemoryWindow, iMemoryWindow, + Parent->bFloatWindow[IDM_MEMORYWINDOW - IDM_LOGWINDOW]); } else // hide Parent->DoRemovePage(m_MemoryWindow); @@ -523,7 +525,8 @@ void CCodeWindow::ToggleJitWindow(bool bShow) { if (!m_JitWindow) m_JitWindow = new CJitWindow(Parent, IDM_JITWINDOW); - Parent->DoAddPage(m_JitWindow, iJitWindow, wxT("JIT"), bFloatJitWindow); + Parent->DoAddPage(m_JitWindow, iJitWindow, + Parent->bFloatWindow[IDM_JITWINDOW - IDM_LOGWINDOW]); } else // hide Parent->DoRemovePage(m_JitWindow); @@ -537,50 +540,51 @@ void CCodeWindow::ToggleJitWindow(bool bShow) void CCodeWindow::ToggleDLLWindow(int Id, bool bShow) { std::string DLLName; - wxString Title; int PluginType, i; bool bFloat; + wxPanel *Win; switch(Id) { case IDM_SOUNDWINDOW: DLLName = SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(); PluginType = PLUGIN_TYPE_DSP; - Title = wxT("Sound"); i = iSoundWindow; - bFloat = bFloatSoundWindow; + bFloat = Parent->bFloatWindow[IDM_SOUNDWINDOW - IDM_LOGWINDOW]; break; case IDM_VIDEOWINDOW: DLLName = SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str(); PluginType = PLUGIN_TYPE_VIDEO; - Title = wxT("Video"); i = iVideoWindow; - bFloat = bFloatVideoWindow; + bFloat = Parent->bFloatWindow[IDM_VIDEOWINDOW - IDM_LOGWINDOW]; break; default: PanicAlert("CCodeWindow::ToggleDLLWindow called with invalid Id"); return; } - GetMenuBar()->FindItem(Id)->Check(bShow); - if (bShow) { // Show window - CPluginManager::GetInstance().OpenDebug(Parent, + Win = (wxPanel *)CPluginManager::GetInstance().OpenDebug(Parent, DLLName.c_str(), (PLUGIN_TYPE)PluginType, bShow); - wxWindow* Win = Parent->GetWxWindow(Title); if (Win) { + Win->Show(); Win->SetId(Id); - Parent->DoAddPage(Win, i, Title, bFloat); + Parent->DoAddPage(Win, i, bFloat); } } else { - Parent->DoRemovePageId(Id, false, false); - CPluginManager::GetInstance().OpenDebug(Parent, - DLLName.c_str(), (PLUGIN_TYPE)PluginType, bShow); + Win = (wxPanel *)FindWindowById(Id); + if (Win) + { + Parent->DoRemovePageId(Id, false, false); + Win->Close(); + Win->Destroy(); + } } + GetMenuBar()->FindItem(Id)->Check(bShow && !!Win); } diff --git a/Source/Core/DebuggerWX/Src/JitWindow.cpp b/Source/Core/DebuggerWX/Src/JitWindow.cpp index fc9cb29527..33e06cfa50 100644 --- a/Source/Core/DebuggerWX/Src/JitWindow.cpp +++ b/Source/Core/DebuggerWX/Src/JitWindow.cpp @@ -67,9 +67,9 @@ BEGIN_EVENT_TABLE(CJitWindow, wxPanel) END_EVENT_TABLE() -CJitWindow::CJitWindow(wxWindow* parent, wxWindowID id, - const wxString& title, const wxPoint& pos, const wxSize& size, long style) -: wxPanel(parent, id, pos, size, style) +CJitWindow::CJitWindow(wxWindow* parent, wxWindowID id, const wxPoint& pos, + const wxSize& size, long style, const wxString& name) +: wxPanel(parent, id, pos, size, style, name) { the_jit_window = this; wxBoxSizer* sizerBig = new wxBoxSizer(wxVERTICAL); diff --git a/Source/Core/DebuggerWX/Src/JitWindow.h b/Source/Core/DebuggerWX/Src/JitWindow.h index 8320f800e4..34b1494f80 100644 --- a/Source/Core/DebuggerWX/Src/JitWindow.h +++ b/Source/Core/DebuggerWX/Src/JitWindow.h @@ -46,10 +46,10 @@ class CJitWindow : public wxPanel public: CJitWindow(wxWindow* parent, wxWindowID id = wxID_ANY, - const wxString& title = _T("JIT block viewer"), - const wxPoint& pos = wxPoint(950, 100), - const wxSize& size = wxSize(400, 500), - long style = wxNO_BORDER); + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTAB_TRAVERSAL, + const wxString& title = _T("JIT block viewer")); ~CJitWindow(); static void ViewAddr(u32 em_address); diff --git a/Source/Core/DebuggerWX/Src/MemoryWindow.cpp b/Source/Core/DebuggerWX/Src/MemoryWindow.cpp index 61e0468fe0..c6375ade4e 100644 --- a/Source/Core/DebuggerWX/Src/MemoryWindow.cpp +++ b/Source/Core/DebuggerWX/Src/MemoryWindow.cpp @@ -71,8 +71,8 @@ EVT_CHECKBOX(IDM_HEX , CMemoryWindow::onHex) END_EVENT_TABLE() CMemoryWindow::CMemoryWindow(wxWindow* parent, wxWindowID id, - const wxString& title, const wxPoint& pos, const wxSize& size, long style) - : wxPanel(parent, id, pos, size, style) + const wxPoint& pos, const wxSize& size, long style, const wxString& name) + : wxPanel(parent, id, pos, size, style, name) { wxBoxSizer* sizerBig = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* sizerRight = new wxBoxSizer(wxVERTICAL); diff --git a/Source/Core/DebuggerWX/Src/MemoryWindow.h b/Source/Core/DebuggerWX/Src/MemoryWindow.h index 283d743e0d..4f013b8624 100644 --- a/Source/Core/DebuggerWX/Src/MemoryWindow.h +++ b/Source/Core/DebuggerWX/Src/MemoryWindow.h @@ -38,10 +38,10 @@ class CMemoryWindow CMemoryWindow(wxWindow* parent, wxWindowID id = wxID_ANY, - const wxString& title = _T("Dolphin-Memory"), - const wxPoint& pos = wxPoint(950, 100), - const wxSize& size = wxSize(400, 500), - long style = wxNO_BORDER); + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxNO_BORDER, + const wxString& name = _T("Memory")); ~CMemoryWindow(); wxCheckBox* chk8; diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index 9aa8cda704..97fae136fe 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -266,15 +266,7 @@ EVT_MENU(IDM_ADD_PERSPECTIVE, CFrame::OnDropDownToolbarSelect) EVT_MENU(IDM_TAB_SPLIT, CFrame::OnDropDownToolbarSelect) EVT_MENU(IDM_NO_DOCKING, CFrame::OnDropDownToolbarSelect) // Drop down float -EVT_MENU(IDM_FLOAT_LOGWINDOW, CFrame::OnFloatWindow) -EVT_MENU(IDM_FLOAT_CONSOLEWINDOW, CFrame::OnFloatWindow) -EVT_MENU(IDM_FLOAT_CODEWINDOW, CFrame::OnFloatWindow) -EVT_MENU(IDM_FLOAT_REGISTERWINDOW, CFrame::OnFloatWindow) -EVT_MENU(IDM_FLOAT_BREAKPOINTWINDOW, CFrame::OnFloatWindow) -EVT_MENU(IDM_FLOAT_MEMORYWINDOW, CFrame::OnFloatWindow) -EVT_MENU(IDM_FLOAT_JITWINDOW, CFrame::OnFloatWindow) -EVT_MENU(IDM_FLOAT_SOUNDWINDOW, CFrame::OnFloatWindow) -EVT_MENU(IDM_FLOAT_VIDEOWINDOW, CFrame::OnFloatWindow) +EVT_MENU_RANGE(IDM_FLOAT_LOGWINDOW, IDM_FLOAT_VIDEOWINDOW, CFrame::OnFloatWindow) EVT_MENU(IDM_NETPLAY, CFrame::OnNetPlay) EVT_MENU(IDM_BROWSE, CFrame::OnBrowse) @@ -350,7 +342,6 @@ CFrame::CFrame(wxFrame* parent, , m_MenuBar(NULL) , bRenderToMain(false), bNoWiimoteMsg(false) , m_ToolBar(NULL), m_ToolBarDebug(NULL), m_ToolBarAui(NULL) - , bFloatLogWindow(false), bFloatConsoleWindow(false) , m_pStatusBar(NULL), m_GameListCtrl(NULL), m_Panel(NULL) , m_RenderFrame(NULL), m_RenderParent(NULL) , m_LogWindow(NULL), UseDebugger(_UseDebugger) @@ -360,6 +351,9 @@ CFrame::CFrame(wxFrame* parent, , m_timer(this) #endif { + for (int i = 0; i <= IDM_VIDEOWINDOW - IDM_LOGWINDOW; i++) + bFloatWindow[i] = false; + if (ShowLogWindow) SConfig::GetInstance().m_InterfaceLogWindow = true; // Give it a console early to show potential messages from this onward @@ -443,7 +437,7 @@ CFrame::CFrame(wxFrame* parent, { IniFile ini; int winpos; ini.Load(File::GetUserPath(F_LOGGERCONFIG_IDX)); - ini.Get("LogWindow", "pos", &winpos, 2); + ini.Get("LogWindow", "pos", &winpos, wxAUI_DOCK_RIGHT); 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) @@ -701,14 +695,6 @@ void CFrame::OnHostMessage(wxCommandEvent& event) DoStop(); break; #endif - - case AUDIO_DESTROY: - if (g_pCodeWindow) - g_pCodeWindow->ToggleDLLWindow(IDM_SOUNDWINDOW, false); - break; - - case VIDEO_DESTROY: - break; } } @@ -917,12 +903,6 @@ wxFrame * CFrame::CreateParentFrame(wxWindowID Id, const wxString& Title, wxWind return Frame; } -wxPanel* CFrame::CreateEmptyPanel(wxWindowID Id) -{ - wxPanel* Panel = new wxPanel(this, Id); - return Panel; -} - wxAuiNotebook* CFrame::CreateEmptyNotebook() { wxAuiNotebook* NB = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, NOTEBOOK_STYLE); diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index 313bf2337e..f1bceee3a6 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -147,20 +147,11 @@ class CFrame : public CRenderFrame wxAuiToolBar *m_ToolBar, *m_ToolBarDebug, *m_ToolBarAui; long NOTEBOOK_STYLE, TOOLBAR_STYLE; int iLeftWidth[2], iMidWidth[2]; - bool bFloatLogWindow; - bool bFloatConsoleWindow; + bool bFloatWindow[IDM_VIDEOWINDOW - IDM_LOGWINDOW + 1]; // Utility - wxWindow * GetWxWindow(wxString); - #ifdef _WIN32 - wxWindow * GetWxWindowHwnd(HWND); - #endif - wxWindow * GetFloatingPage(int Id); - wxWindow * GetNootebookPage(wxString); - wxWindow * GetNootebookPageFromId(wxWindowID Id); + wxWindow * GetNotebookPageFromId(wxWindowID Id); wxAuiNotebook * GetNotebookFromId(u32); - wxWindowID WindowParentIdFromChildId(int Id); - wxString WindowNameFromId(int Id); int GetNotebookCount(); int Limit(int,int,int); int PercentageToPixels(int,int); @@ -175,12 +166,12 @@ class CFrame : public CRenderFrame void OnFloatWindow(wxCommandEvent& event); void ToggleFloatWindow(int Id); void OnTab(wxAuiNotebookEvent& event); - int GetNootebookAffiliation(wxString Name); + int GetNotebookAffiliation(wxWindowID Id); void ClosePages(); void ShowAllNotebooks(bool Window = false); void HideAllNotebooks(bool Window = false); void CloseAllNotebooks(); - void DoAddPage(wxWindow *, int, wxString, bool); + void DoAddPage(wxWindow *, int, bool); void DoRemovePage(wxWindow *, bool Hide = true); void DoRemovePageId(wxWindowID Id, bool bHide, bool bDestroy); void TogglePane(); @@ -276,7 +267,6 @@ class CFrame : public CRenderFrame void PopulateToolbarAui(wxAuiToolBar* toolBar); void RecreateToolbar(); void CreateMenu(); - wxPanel *CreateEmptyPanel(wxWindowID Id = wxID_ANY); wxAuiNotebook *CreateEmptyNotebook(); #ifdef _WIN32 diff --git a/Source/Core/DolphinWX/Src/FrameAui.cpp b/Source/Core/DolphinWX/Src/FrameAui.cpp index f02184b565..9bf072a13e 100644 --- a/Source/Core/DolphinWX/Src/FrameAui.cpp +++ b/Source/Core/DolphinWX/Src/FrameAui.cpp @@ -66,8 +66,6 @@ void CFrame::OnPaneClose(wxAuiManagerEvent& event) if ((nb->GetPageText(0).IsSameAs(wxT("Log")) || nb->GetPageText(0).IsSameAs(wxT("Console")))) { // Closing a pane containing the logwindow or a console closes both - GetMenuBar()->FindItem(IDM_CONSOLEWINDOW)->Check(false); - GetMenuBar()->FindItem(IDM_LOGWINDOW)->Check(false); SConfig::GetInstance().m_InterfaceConsole = false; SConfig::GetInstance().m_InterfaceLogWindow = false; ToggleConsole(false); @@ -101,7 +99,7 @@ void CFrame::ToggleLogWindow(bool bShow, int i) if (bShow) { if (!m_LogWindow) m_LogWindow = new CLogWindow(this, IDM_LOGWINDOW); - DoAddPage(m_LogWindow, i, wxT("Log"), bFloatLogWindow); + DoAddPage(m_LogWindow, i, bFloatWindow[0]); } else DoRemovePage(m_LogWindow, bShow); @@ -121,33 +119,30 @@ void CFrame::OnToggleConsole(wxCommandEvent& event) void CFrame::ToggleConsole(bool bShow, int i) { #ifdef _WIN32 - ConsoleListener *Console = LogManager::GetInstance()->getConsoleListener(); - GetMenuBar()->FindItem(IDM_CONSOLEWINDOW)->Check(bShow); if (bShow) { - if (i < 0 || i > GetNotebookCount()-1) i = 0; - - // If the window and its page already exist, there's a bug :p - if (GetNotebookFromId(i)->GetPageIndex(GetWxWindowHwnd(GetConsoleWindow())) != wxNOT_FOUND) - return; - // If the console doesn't exist, we create it if (!GetConsoleWindow()) + { + ConsoleListener *Console = LogManager::GetInstance()->getConsoleListener(); Console->Open(); + } else - ShowWindow(GetConsoleWindow(), SW_SHOW); // WIN32 + ShowWindow(GetConsoleWindow(), SW_SHOW); - // We retrieve our wxWindow to access our console + its parent (which is the page) - wxWindow *ConsoleWin = GetWxWindowHwnd(GetConsoleWindow()); + // Create the parent window if it doesn't exist wxPanel *ConsoleParent = (wxPanel*)FindWindowById(IDM_CONSOLEWINDOW); + if (!ConsoleParent) ConsoleParent = new wxPanel(this, IDM_CONSOLEWINDOW, + wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _("Console")); - // Create the parent window if it doesn't exist, and put the console in it - if (!ConsoleParent) ConsoleParent = CreateEmptyPanel(IDM_CONSOLEWINDOW); + wxWindow *ConsoleWin = new wxWindow(); + ConsoleWin->SetHWND((WXHWND)GetConsoleWindow()); + ConsoleWin->AdoptAttributesFromHWND(); ConsoleWin->Reparent(ConsoleParent); - DoAddPage(ConsoleParent, i, wxT("Console"), bFloatConsoleWindow); + DoAddPage(ConsoleParent, i, bFloatWindow[1]); } else // Hide { @@ -191,24 +186,24 @@ void CFrame::OnNotebookPageChanged(wxAuiNotebookEvent& event) AddRemoveBlankPage(); // Update the notebook affiliation - if(GetNootebookAffiliation(wxT("Log")) >= 0) - g_pCodeWindow->iLogWindow = GetNootebookAffiliation(wxT("Log")); - if(GetNootebookAffiliation(wxT("Console")) >= 0) - g_pCodeWindow->iConsoleWindow = GetNootebookAffiliation(wxT("Console")); - if(GetNootebookAffiliation(wxT("Code")) >= 0) - g_pCodeWindow->iCodeWindow = GetNootebookAffiliation(wxT("Code")); - if(GetNootebookAffiliation(wxT("Registers")) >= 0) - g_pCodeWindow->iRegisterWindow = GetNootebookAffiliation(wxT("Registers")); - if(GetNootebookAffiliation(wxT("Breakpoints")) >= 0) - g_pCodeWindow->iBreakpointWindow = GetNootebookAffiliation(wxT("Breakpoints")); - if(GetNootebookAffiliation(wxT("JIT")) >= 0) - g_pCodeWindow->iJitWindow = GetNootebookAffiliation(wxT("JIT")); - if(GetNootebookAffiliation(wxT("Memory")) >= 0) - g_pCodeWindow->iMemoryWindow = GetNootebookAffiliation(wxT("Memory")); - if(GetNootebookAffiliation(wxT("Sound")) >= 0) - g_pCodeWindow->iSoundWindow = GetNootebookAffiliation(wxT("Sound")); - if(GetNootebookAffiliation(wxT("Video")) >= 0) - g_pCodeWindow->iVideoWindow = GetNootebookAffiliation(wxT("Video")); + if(GetNotebookAffiliation(IDM_LOGWINDOW) >= 0) + g_pCodeWindow->iLogWindow = GetNotebookAffiliation(IDM_LOGWINDOW); + if(GetNotebookAffiliation(IDM_CONSOLEWINDOW) >= 0) + g_pCodeWindow->iConsoleWindow = GetNotebookAffiliation(IDM_CONSOLEWINDOW); + if(GetNotebookAffiliation(IDM_CODEWINDOW) >= 0) + g_pCodeWindow->iCodeWindow = GetNotebookAffiliation(IDM_CODEWINDOW); + if(GetNotebookAffiliation(IDM_REGISTERWINDOW) >= 0) + g_pCodeWindow->iRegisterWindow = GetNotebookAffiliation(IDM_REGISTERWINDOW); + if(GetNotebookAffiliation(IDM_BREAKPOINTWINDOW) >= 0) + g_pCodeWindow->iBreakpointWindow = GetNotebookAffiliation(IDM_BREAKPOINTWINDOW); + if(GetNotebookAffiliation(IDM_JITWINDOW) >= 0) + g_pCodeWindow->iJitWindow = GetNotebookAffiliation(IDM_JITWINDOW); + if(GetNotebookAffiliation(IDM_MEMORYWINDOW) >= 0) + g_pCodeWindow->iMemoryWindow = GetNotebookAffiliation(IDM_MEMORYWINDOW); + if(GetNotebookAffiliation(IDM_SOUNDWINDOW) >= 0) + g_pCodeWindow->iSoundWindow = GetNotebookAffiliation(IDM_SOUNDWINDOW); + if(GetNotebookAffiliation(IDM_VIDEOWINDOW) >= 0) + g_pCodeWindow->iVideoWindow = GetNotebookAffiliation(IDM_VIDEOWINDOW); } void CFrame::OnNotebookPageClose(wxAuiNotebookEvent& event) @@ -218,21 +213,21 @@ void CFrame::OnNotebookPageClose(wxAuiNotebookEvent& event) wxAuiNotebook* Ctrl = (wxAuiNotebook*)event.GetEventObject(); - if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Log"))) + if (Ctrl->GetPage(event.GetSelection())->GetId() == IDM_LOGWINDOW) ToggleLogWindow(false); - if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Console"))) + if (Ctrl->GetPage(event.GetSelection())->GetId() == IDM_CONSOLEWINDOW) ToggleConsole(false); - if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Registers"))) + if (Ctrl->GetPage(event.GetSelection())->GetId() == IDM_REGISTERWINDOW) g_pCodeWindow->ToggleRegisterWindow(false); - if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Breakpoints"))) + if (Ctrl->GetPage(event.GetSelection())->GetId() == IDM_BREAKPOINTWINDOW) g_pCodeWindow->ToggleBreakPointWindow(false); - if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("JIT"))) + if (Ctrl->GetPage(event.GetSelection())->GetId() == IDM_JITWINDOW) g_pCodeWindow->ToggleJitWindow(false); - if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Memory"))) + if (Ctrl->GetPage(event.GetSelection())->GetId() == IDM_MEMORYWINDOW) g_pCodeWindow->ToggleMemoryWindow(false); - if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Sound"))) + if (Ctrl->GetPage(event.GetSelection())->GetId() == IDM_SOUNDWINDOW) g_pCodeWindow->ToggleDLLWindow(IDM_SOUNDWINDOW, false); - if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Video"))) + if (Ctrl->GetPage(event.GetSelection())->GetId() == IDM_VIDEOWINDOW) g_pCodeWindow->ToggleDLLWindow(IDM_VIDEOWINDOW, false); } @@ -243,138 +238,17 @@ void CFrame::OnFloatWindow(wxCommandEvent& event) void CFrame::ToggleFloatWindow(int Id) { - switch(Id) + wxWindowID WinId = Id - IDM_FLOAT_LOGWINDOW + IDM_LOGWINDOW; + if (GetNotebookPageFromId(WinId)) { - case IDM_FLOAT_LOGWINDOW: - if (GetNootebookPageFromId(IDM_LOGWINDOW)) - { - DoFloatNotebookPage(IDM_LOGWINDOW); - bFloatLogWindow = true; - return; - } - break; - case IDM_FLOAT_CONSOLEWINDOW: - if (GetNootebookPageFromId(IDM_CONSOLEWINDOW)) - { - DoFloatNotebookPage(IDM_CONSOLEWINDOW); - bFloatConsoleWindow = true; - return; - } - break; + DoFloatNotebookPage(WinId); + bFloatWindow[WinId - IDM_LOGWINDOW] = true; } - switch(Id) + else { - case IDM_FLOAT_LOGWINDOW: - if (FindWindowById(IDM_LOGWINDOW)) - DoUnfloatPage(IDM_LOGWINDOW_PARENT); - bFloatLogWindow = false; - break; - case IDM_FLOAT_CONSOLEWINDOW: - if (FindWindowById(IDM_CONSOLEWINDOW)) - DoUnfloatPage(IDM_CONSOLEWINDOW_PARENT); - bFloatConsoleWindow = false; - break; - } - - if (!g_pCodeWindow) - return; - - switch(Id) - { - case IDM_FLOAT_CODEWINDOW: - if (GetNootebookPageFromId(IDM_CODEWINDOW)) - { - DoFloatNotebookPage(IDM_CODEWINDOW); - g_pCodeWindow->bFloatCodeWindow = true; - return; - } - break; - case IDM_FLOAT_REGISTERWINDOW: - if (GetNootebookPageFromId(IDM_REGISTERWINDOW)) - { - DoFloatNotebookPage(IDM_REGISTERWINDOW); - g_pCodeWindow->bFloatRegisterWindow = true; - return; - } - break; - case IDM_FLOAT_BREAKPOINTWINDOW: - if (GetNootebookPageFromId(IDM_BREAKPOINTWINDOW)) - { - DoFloatNotebookPage(IDM_BREAKPOINTWINDOW); - g_pCodeWindow->bFloatBreakpointWindow = true; - return; - } - break; - case IDM_FLOAT_MEMORYWINDOW: - if (GetNootebookPageFromId(IDM_MEMORYWINDOW)) - { - DoFloatNotebookPage(IDM_MEMORYWINDOW); - g_pCodeWindow->bFloatMemoryWindow = true; - return; - } - break; - case IDM_FLOAT_JITWINDOW: - if (GetNootebookPageFromId(IDM_JITWINDOW)) - { - DoFloatNotebookPage(IDM_JITWINDOW); - g_pCodeWindow->bFloatJitWindow = true; - return; - } - break; - case IDM_FLOAT_SOUNDWINDOW: - if (GetNootebookPageFromId(IDM_SOUNDWINDOW)) - { - DoFloatNotebookPage(IDM_SOUNDWINDOW); - g_pCodeWindow->bFloatSoundWindow = true; - return; - } - break; - case IDM_FLOAT_VIDEOWINDOW: - if (GetNootebookPageFromId(IDM_VIDEOWINDOW)) - { - DoFloatNotebookPage(IDM_VIDEOWINDOW); - g_pCodeWindow->bFloatVideoWindow = true; - return; - } - break; - } - switch(Id) - { - case IDM_FLOAT_CODEWINDOW: - if (FindWindowById(IDM_CODEWINDOW)) - DoUnfloatPage(IDM_CODEWINDOW_PARENT); - g_pCodeWindow->bFloatCodeWindow = false; - break; - case IDM_FLOAT_REGISTERWINDOW: - if (FindWindowById(IDM_REGISTERWINDOW)) - DoUnfloatPage(IDM_REGISTERWINDOW_PARENT); - g_pCodeWindow->bFloatRegisterWindow = false; - break; - case IDM_FLOAT_BREAKPOINTWINDOW: - if (FindWindowById(IDM_BREAKPOINTWINDOW)) - DoUnfloatPage(IDM_BREAKPOINTWINDOW_PARENT); - g_pCodeWindow->bFloatBreakpointWindow = false; - break; - case IDM_FLOAT_MEMORYWINDOW: - if (FindWindowById(IDM_MEMORYWINDOW)) - DoUnfloatPage(IDM_MEMORYWINDOW_PARENT); - g_pCodeWindow->bFloatMemoryWindow = false; - break; - case IDM_FLOAT_JITWINDOW: - if (FindWindowById(IDM_JITWINDOW)) - DoUnfloatPage(IDM_JITWINDOW_PARENT); - g_pCodeWindow->bFloatJitWindow = false; - break; - case IDM_FLOAT_SOUNDWINDOW: - if (FindWindowById(IDM_SOUNDWINDOW)) - DoUnfloatPage(IDM_SOUNDWINDOW_PARENT); - g_pCodeWindow->bFloatSoundWindow = false; - break; - case IDM_FLOAT_VIDEOWINDOW: - if (FindWindowById(IDM_VIDEOWINDOW)) - DoUnfloatPage(IDM_VIDEOWINDOW_PARENT); - g_pCodeWindow->bFloatVideoWindow = false; - break; + if (FindWindowById(WinId)) + DoUnfloatPage(WinId - IDM_LOGWINDOW + IDM_LOGWINDOW_PARENT); + bFloatWindow[WinId - IDM_LOGWINDOW] = false; } } @@ -391,43 +265,17 @@ void CFrame::OnTab(wxAuiNotebookEvent& event) MenuPopup->Append(Item); Item->Enable(false); MenuPopup->Append(new wxMenuItem(MenuPopup)); - Item = new wxMenuItem(MenuPopup, IDM_FLOAT_LOGWINDOW, - WindowNameFromId(IDM_LOGWINDOW), wxT(""), wxITEM_CHECK); - MenuPopup->Append(Item); - Item->Check(!!FindWindowById(IDM_LOGWINDOW_PARENT)); - Item = new wxMenuItem(MenuPopup, IDM_FLOAT_CONSOLEWINDOW, - WindowNameFromId(IDM_CONSOLEWINDOW), wxT(""), wxITEM_CHECK); - MenuPopup->Append(Item); - Item->Check(!!FindWindowById(IDM_CONSOLEWINDOW_PARENT)); - MenuPopup->Append(new wxMenuItem(MenuPopup)); - Item = new wxMenuItem(MenuPopup, IDM_FLOAT_CODEWINDOW, - WindowNameFromId(IDM_CODEWINDOW), wxT(""), wxITEM_CHECK); - MenuPopup->Append(Item); - Item->Check(!!FindWindowById(IDM_CODEWINDOW_PARENT)); - Item = new wxMenuItem(MenuPopup, IDM_FLOAT_REGISTERWINDOW, - WindowNameFromId(IDM_REGISTERWINDOW), wxT(""), wxITEM_CHECK); - MenuPopup->Append(Item); - Item->Check(!!FindWindowById(IDM_REGISTERWINDOW_PARENT)); - Item = new wxMenuItem(MenuPopup, IDM_FLOAT_BREAKPOINTWINDOW, - WindowNameFromId(IDM_BREAKPOINTWINDOW), wxT(""), wxITEM_CHECK); - MenuPopup->Append(Item); - Item->Check(!!FindWindowById(IDM_BREAKPOINTWINDOW_PARENT)); - Item = new wxMenuItem(MenuPopup, IDM_FLOAT_MEMORYWINDOW, - WindowNameFromId(IDM_MEMORYWINDOW), wxT(""), wxITEM_CHECK); - MenuPopup->Append(Item); - Item->Check(!!FindWindowById(IDM_MEMORYWINDOW_PARENT)); - Item = new wxMenuItem(MenuPopup, IDM_FLOAT_JITWINDOW, - WindowNameFromId(IDM_JITWINDOW), wxT(""), wxITEM_CHECK); - MenuPopup->Append(Item); - Item->Check(!!FindWindowById(IDM_JITWINDOW_PARENT)); - Item = new wxMenuItem(MenuPopup, IDM_FLOAT_SOUNDWINDOW, - WindowNameFromId(IDM_SOUNDWINDOW), wxT(""), wxITEM_CHECK); - MenuPopup->Append(Item); - Item->Check(!!FindWindowById(IDM_SOUNDWINDOW_PARENT)); - Item = new wxMenuItem(MenuPopup, IDM_FLOAT_VIDEOWINDOW, - WindowNameFromId(IDM_VIDEOWINDOW), wxT(""), wxITEM_CHECK); - MenuPopup->Append(Item); - Item->Check(!!FindWindowById(IDM_VIDEOWINDOW_PARENT)); + for (int i = IDM_LOGWINDOW; i <= IDM_VIDEOWINDOW; i++) + { + wxWindow *Win = FindWindowById(i); + if (Win) + { + Item = new wxMenuItem(MenuPopup, i + IDM_FLOAT_LOGWINDOW - IDM_LOGWINDOW, + Win->GetName(), wxT(""), wxITEM_CHECK); + MenuPopup->Append(Item); + Item->Check(!!FindWindowById(i + IDM_LOGWINDOW_PARENT - IDM_LOGWINDOW)); + } + } // Line up our menu with the cursor wxPoint Pt = ::wxGetMousePosition(); @@ -467,11 +315,11 @@ void CFrame::DoRemovePage(wxWindow * Win, bool _Hide) { if (!Win) return; - if (Win->GetId() > 0 && FindWindowById(WindowParentIdFromChildId(Win->GetId()))) + if (Win->GetId() > 0 && FindWindowById(Win->GetId() + IDM_LOGWINDOW_PARENT - IDM_LOGWINDOW)) { Win->Reparent(this); Win->Hide(); - FindWindowById(WindowParentIdFromChildId(Win->GetId()))->Destroy(); + FindWindowById(Win->GetId() + IDM_LOGWINDOW_PARENT - IDM_LOGWINDOW)->Destroy(); WARN_LOG(CONSOLE, "Floating window %i closed", Win->GetId()); } else @@ -496,7 +344,7 @@ void CFrame::DoRemovePageId(wxWindowID Id, bool bHide, bool bDestroy) if (!Win) return; - wxWindow *Parent = FindWindowById(WindowParentIdFromChildId(Id)); + wxWindow *Parent = FindWindowById(Id + IDM_LOGWINDOW_PARENT - IDM_LOGWINDOW); if (Parent) { @@ -526,16 +374,16 @@ void CFrame::DoRemovePageId(wxWindowID Id, bool bHide, bool bDestroy) } } -void CFrame::DoAddPage(wxWindow * Win, int i, wxString Name, bool Float) +void CFrame::DoAddPage(wxWindow * Win, int i, bool Float) { if (!Win) return; if (GetNotebookCount() == 0) return; if (i < 0 || i > GetNotebookCount()-1) i = 0; if (Win && GetNotebookFromId(i)->GetPageIndex(Win) != wxNOT_FOUND) return; if (!Float) - GetNotebookFromId(i)->AddPage(Win, Name, true, aNormalFile ); + GetNotebookFromId(i)->AddPage(Win, Win->GetName(), true, aNormalFile ); else - CreateParentFrame(WindowParentIdFromChildId(Win->GetId()), WindowNameFromId(Win->GetId()), Win); + CreateParentFrame(Win->GetId() + IDM_LOGWINDOW_PARENT - IDM_LOGWINDOW, Win->GetName(), Win); } void CFrame::DoUnfloatPage(int Id) @@ -545,7 +393,7 @@ void CFrame::DoUnfloatPage(int Id) wxWindow * Child = Win->GetWindowChildren().Item(0)->GetData(); Child->Reparent(this); - DoAddPage(Child, 0, Win->GetTitle(), false); + DoAddPage(Child, 0, false); Win->Destroy(); } @@ -562,7 +410,7 @@ void CFrame::OnFloatingPageSize(wxSizeEvent& event) void CFrame::DoFloatNotebookPage(wxWindowID Id) { - wxFrame * Win = (wxFrame*)this->FindWindowById(Id); + wxPanel * Win = (wxPanel*)this->FindWindowById(Id); if (!Win) return; for (int i = 0; i < GetNotebookCount(); i++) @@ -571,7 +419,7 @@ void CFrame::DoFloatNotebookPage(wxWindowID Id) { GetNotebookFromId(i)->RemovePage(GetNotebookFromId(i)->GetPageIndex(Win)); // Reparent to avoid destruction if the notebook is closed and destroyed - CreateParentFrame(WindowParentIdFromChildId(Win->GetId()), WindowNameFromId(Win->GetId()), Win); + CreateParentFrame(Win->GetId() + IDM_LOGWINDOW_PARENT - IDM_LOGWINDOW, Win->GetName(), Win); } } } @@ -1120,63 +968,7 @@ int CFrame::PixelsToPercentage(int Pixels, int Total) return Percentage; } -#ifdef _WIN32 -wxWindow * CFrame::GetWxWindowHwnd(HWND hWnd) -{ - wxWindow * Win = new wxWindow(); - Win->SetHWND((WXHWND)hWnd); - Win->AdoptAttributesFromHWND(); - return Win; -} -#endif - -wxWindow * CFrame::GetWxWindow(wxString Name) -{ - #ifdef _WIN32 - HWND hWnd = ::FindWindow(NULL, Name.c_str()); - if (hWnd) - { - wxWindow * Win = new wxWindow(); - Win->SetHWND((WXHWND)hWnd); - Win->AdoptAttributesFromHWND(); - return Win; - } - else - #endif - if (FindWindowByName(Name)) - return FindWindowByName(Name); - else if (FindWindowByLabel(Name)) - return FindWindowByLabel(Name); - else if (GetNootebookPage(Name)) - return GetNootebookPage(Name); - else - return NULL; -} - -wxWindow * CFrame::GetFloatingPage(int Id) -{ - if (this->FindWindowById(Id)) - return this->FindWindowById(Id); - else - return NULL; -} - -wxWindow * CFrame::GetNootebookPage(wxString Name) -{ - for (u32 i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++) - { - if (!m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook))) continue; - wxAuiNotebook * NB = (wxAuiNotebook*)m_Mgr->GetAllPanes().Item(i).window; - for(u32 j = 0; j < NB->GetPageCount(); j++) - { - - if (NB->GetPageText(j).IsSameAs(Name)) return NB->GetPage(j); - } - } - return NULL; -} - -wxWindow * CFrame::GetNootebookPageFromId(wxWindowID Id) +wxWindow * CFrame::GetNotebookPageFromId(wxWindowID Id) { for (u32 i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++) { @@ -1200,11 +992,11 @@ void CFrame::AddRemoveBlankPage() { if (NB->GetPageText(j).IsSameAs(wxT("<>")) && NB->GetPageCount() > 1) NB->DeletePage(j); } - if (NB->GetPageCount() == 0) NB->AddPage(CreateEmptyPanel(), wxT("<>"), true); + if (NB->GetPageCount() == 0) NB->AddPage(new wxPanel(this, wxID_ANY), wxT("<>"), true); } } -int CFrame::GetNootebookAffiliation(wxString Name) +int CFrame::GetNotebookAffiliation(wxWindowID Id) { for (u32 i = 0, j = 0; i < m_Mgr->GetAllPanes().GetCount(); i++) { @@ -1212,47 +1004,13 @@ int CFrame::GetNootebookAffiliation(wxString Name) wxAuiNotebook * NB = (wxAuiNotebook*)m_Mgr->GetAllPanes().Item(i).window; for(u32 k = 0; k < NB->GetPageCount(); k++) { - if (NB->GetPageText(k).IsSameAs(Name)) return j; + if (NB->GetPage(k)->GetId() == Id) return j; } j++; } return -1; } -wxWindowID CFrame::WindowParentIdFromChildId(int Id) -{ - switch(Id) - { - case IDM_LOGWINDOW: return IDM_LOGWINDOW_PARENT; - case IDM_CONSOLEWINDOW: return IDM_CONSOLEWINDOW_PARENT; - case IDM_CODEWINDOW: return IDM_CODEWINDOW_PARENT; - case IDM_REGISTERWINDOW: return IDM_REGISTERWINDOW_PARENT; - case IDM_BREAKPOINTWINDOW: return IDM_BREAKPOINTWINDOW_PARENT; - case IDM_MEMORYWINDOW: return IDM_MEMORYWINDOW_PARENT; - case IDM_JITWINDOW: return IDM_JITWINDOW_PARENT; - case IDM_SOUNDWINDOW: return IDM_SOUNDWINDOW_PARENT; - case IDM_VIDEOWINDOW: return IDM_VIDEOWINDOW_PARENT; - } - return NULL; -} - -wxString CFrame::WindowNameFromId(int Id) -{ - switch(Id) - { - case IDM_LOGWINDOW: return wxT("Log"); - case IDM_CONSOLEWINDOW: return wxT("Console"); - case IDM_CODEWINDOW: return wxT("Code"); - case IDM_REGISTERWINDOW: return wxT("Registers"); - case IDM_BREAKPOINTWINDOW: return wxT("Breakpoints"); - case IDM_MEMORYWINDOW: return wxT("Memory"); - case IDM_JITWINDOW: return wxT("JIT"); - case IDM_SOUNDWINDOW: return wxT("Sound"); - case IDM_VIDEOWINDOW: return wxT("Video"); - } - return wxT(""); -} - // Close all panes with notebooks void CFrame::CloseAllNotebooks() { diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 082e94ad59..24fe21797c 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -881,9 +881,16 @@ void CFrame::DoStop() Frame::EndRecordingInput(); if(Frame::IsPlayingInput()) Frame::EndPlayInput(); - + + // These windows cause segmentation faults if they are open when the emulator + // stops. It has something to do with the the wxAuiManager update. + if (g_pCodeWindow) + { + g_pCodeWindow->ToggleDLLWindow(IDM_SOUNDWINDOW, false); + g_pCodeWindow->ToggleDLLWindow(IDM_VIDEOWINDOW, false); + } + Core::Stop(); - UpdateGUI(); // Destroy the renderer frame when not rendering to main m_RenderFrame->Disconnect(wxID_ANY, wxEVT_SIZE, @@ -902,6 +909,8 @@ void CFrame::DoStop() m_RenderFrame->Destroy(); m_RenderParent = NULL; + UpdateGUI(); + // Clean framerate indications from the status bar. m_pStatusBar->SetStatusText(wxT(" "), 0); diff --git a/Source/Core/DolphinWX/Src/Globals.h b/Source/Core/DolphinWX/Src/Globals.h index 30e3cb1aae..de2e909a83 100644 --- a/Source/Core/DolphinWX/Src/Globals.h +++ b/Source/Core/DolphinWX/Src/Globals.h @@ -152,6 +152,28 @@ enum IDM_SOUNDWINDOW, IDM_VIDEOWINDOW, + // Float Window IDs + IDM_LOGWINDOW_PARENT, + IDM_CONSOLEWINDOW_PARENT, + IDM_CODEWINDOW_PARENT, + IDM_REGISTERWINDOW_PARENT, + IDM_BREAKPOINTWINDOW_PARENT, + IDM_MEMORYWINDOW_PARENT, + IDM_JITWINDOW_PARENT, + IDM_SOUNDWINDOW_PARENT, + IDM_VIDEOWINDOW_PARENT, + + // Float popup menu IDs + IDM_FLOAT_LOGWINDOW, + IDM_FLOAT_CONSOLEWINDOW, + IDM_FLOAT_CODEWINDOW, + IDM_FLOAT_REGISTERWINDOW, + IDM_FLOAT_BREAKPOINTWINDOW, + IDM_FLOAT_MEMORYWINDOW, + IDM_FLOAT_JITWINDOW, + IDM_FLOAT_SOUNDWINDOW, + IDM_FLOAT_VIDEOWINDOW, + // Symbols IDM_CLEARSYMBOLS, IDM_CLEANSYMBOLS, // not used @@ -185,16 +207,6 @@ enum IDM_GOTOPC, IDM_ADDRBOX, - IDM_FLOAT_LOGWINDOW, - IDM_FLOAT_CONSOLEWINDOW, - IDM_FLOAT_CODEWINDOW, - IDM_FLOAT_REGISTERWINDOW, - IDM_FLOAT_BREAKPOINTWINDOW, - IDM_FLOAT_MEMORYWINDOW, - IDM_FLOAT_JITWINDOW, - IDM_FLOAT_SOUNDWINDOW, - IDM_FLOAT_VIDEOWINDOW, - ID_TOOLBAR_AUI, IDM_SAVE_PERSPECTIVE, IDM_ADD_PERSPECTIVE, @@ -206,16 +218,6 @@ enum IDM_PERSPECTIVES_100 = IDM_PERSPECTIVES_0 + 100, // -------------------------------------------------------------- - IDM_LOGWINDOW_PARENT, // Window IDs - IDM_CONSOLEWINDOW_PARENT, - IDM_CODEWINDOW_PARENT, - IDM_REGISTERWINDOW_PARENT, - IDM_BREAKPOINTWINDOW_PARENT, - IDM_MEMORYWINDOW_PARENT, - IDM_JITWINDOW_PARENT, - IDM_SOUNDWINDOW_PARENT, - IDM_VIDEOWINDOW_PARENT, - IDM_TOGGLE_DUALCORE, // Other IDM_TOGGLE_SKIPIDLE, IDM_TOGGLE_TOOLBAR, diff --git a/Source/Core/DolphinWX/Src/LogWindow.cpp b/Source/Core/DolphinWX/Src/LogWindow.cpp index 99d42bbc86..884d29f92c 100644 --- a/Source/Core/DolphinWX/Src/LogWindow.cpp +++ b/Source/Core/DolphinWX/Src/LogWindow.cpp @@ -48,8 +48,9 @@ BEGIN_EVENT_TABLE(CLogWindow, wxPanel) EVT_TIMER(IDTM_UPDATELOG, CLogWindow::OnLogTimer) END_EVENT_TABLE() -CLogWindow::CLogWindow(CFrame *parent, wxWindowID id, const wxString &, const wxPoint &position, const wxSize& size, long style) - : wxPanel(parent, id, position, size, style) +CLogWindow::CLogWindow(CFrame *parent, wxWindowID id, const wxPoint& pos, + const wxSize& size, long style, const wxString& name) + : wxPanel(parent, id, pos, size, style, name) , Parent(parent) , m_LogAccess(true) , m_Log(NULL), m_cmdline(NULL), m_FontChoice(NULL) , m_LogSection(1) diff --git a/Source/Core/DolphinWX/Src/LogWindow.h b/Source/Core/DolphinWX/Src/LogWindow.h index cde2e80aab..06730be8b0 100644 --- a/Source/Core/DolphinWX/Src/LogWindow.h +++ b/Source/Core/DolphinWX/Src/LogWindow.h @@ -54,10 +54,11 @@ class CLogWindow : public wxPanel, LogListener public: CLogWindow(CFrame *parent, wxWindowID id = wxID_ANY, - const wxString& title = wxT("Log"), - const wxPoint& pos = wxPoint(100, 700), - const wxSize& size = wxSize(800, 270), - long style = wxNO_BORDER); + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTAB_TRAVERSAL, + const wxString& name = wxT("Log") + ); ~CLogWindow(); void NotifyUpdate(); diff --git a/Source/PluginSpecs/PluginSpecs.h b/Source/PluginSpecs/PluginSpecs.h index b726c02630..0f24f54066 100644 --- a/Source/PluginSpecs/PluginSpecs.h +++ b/Source/PluginSpecs/PluginSpecs.h @@ -24,8 +24,6 @@ enum PLUGIN_COMM WM_USER_CREATE, WM_USER_SETCURSOR, WM_USER_KEYDOWN, - VIDEO_DESTROY, // The video debugging window was destroyed - AUDIO_DESTROY, // The audio debugging window was destroyed WIIMOTE_DISCONNECT, // Disconnect Wiimote INPUT_FRAME_COUNTER // Wind back the frame counter for rerecording }; @@ -126,7 +124,7 @@ EXPORT void CALL DllConfig(HWND _hParent); // input: a handle to the window that calls this function // output: none // -EXPORT void CALL DllDebugger(void *_hParent, bool Show); +EXPORT void* CALL DllDebugger(void *_hParent, bool Show); // ___________________________________________________________________________ // Function: DllSetGlobals diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp index 3acf10971d..e2c0300347 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp @@ -119,8 +119,9 @@ wxWindow* GetParentedWxWindow(HWND Parent) #endif -void DllDebugger(void *_hParent, bool Show) +void *DllDebugger(void *_hParent, bool Show) { + return NULL; } diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/DSPDebugInterface.cpp b/Source/Plugins/Plugin_DSP_LLE/Src/DSPDebugInterface.cpp index 1a7798fdc7..e1b1147cd1 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/DSPDebugInterface.cpp +++ b/Source/Plugins/Plugin_DSP_LLE/Src/DSPDebugInterface.cpp @@ -32,6 +32,12 @@ void DSPDebugInterface::disasm(unsigned int address, char *dest, int max_size) void DSPDebugInterface::getRawMemoryString(int memory, unsigned int address, char *dest, int max_size) { + if (DSPCore_GetState() == DSPCORE_STOP) + { + dest[0] = 0; + return; + } + switch (memory) { case 0: // IMEM switch (address >> 12) { diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/Debugger/DSPDebugWindow.cpp b/Source/Plugins/Plugin_DSP_LLE/Src/Debugger/DSPDebugWindow.cpp index 33633c36c2..3366dbdee9 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/Debugger/DSPDebugWindow.cpp +++ b/Source/Plugins/Plugin_DSP_LLE/Src/Debugger/DSPDebugWindow.cpp @@ -43,7 +43,7 @@ END_EVENT_TABLE() DSPDebuggerLLE::DSPDebuggerLLE(wxWindow* parent) : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(700, 800), - wxTAB_TRAVERSAL, _("Sound")) + wxTAB_TRAVERSAL, _("DSP LLE Debugger")) , m_CachedStepCounter(-1) { // notify wxAUI which frame to use @@ -125,26 +125,29 @@ void DSPDebuggerLLE::OnClose(wxCloseEvent& event) void DSPDebuggerLLE::OnChangeState(wxCommandEvent& event) { + if (DSPCore_GetState() == DSPCORE_STOP) + return; + switch (event.GetId()) { - case ID_RUNTOOL: - if (DSPCore_GetState() == DSPCORE_RUNNING) - DSPCore_SetState(DSPCORE_STEPPING); - else - DSPCore_SetState(DSPCORE_RUNNING); - break; + case ID_RUNTOOL: + if (DSPCore_GetState() == DSPCORE_RUNNING) + DSPCore_SetState(DSPCORE_STEPPING); + else + DSPCore_SetState(DSPCORE_RUNNING); + break; - case ID_STEPTOOL: - if (DSPCore_GetState() == DSPCORE_STEPPING) - { - DSPCore_Step(); - Refresh(); - } - break; + case ID_STEPTOOL: + if (DSPCore_GetState() == DSPCORE_STEPPING) + { + DSPCore_Step(); + Refresh(); + } + break; - case ID_SHOWPCTOOL: - FocusOnPC(); - break; + case ID_SHOWPCTOOL: + FocusOnPC(); + break; } UpdateState(); diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/main.cpp b/Source/Plugins/Plugin_DSP_LLE/Src/main.cpp index df2272aed0..0a6c30024b 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/main.cpp +++ b/Source/Plugins/Plugin_DSP_LLE/Src/main.cpp @@ -202,24 +202,13 @@ void EmuStateChange(PLUGIN_EMUSTATE newState) DSP_ClearAudioBuffer((newState == PLUGIN_EMUSTATE_PLAY) ? false : true); } -void DllDebugger(void *_hParent, bool Show) +void *DllDebugger(void *_hParent, bool Show) { #if defined(HAVE_WX) && HAVE_WX - if (Show) - { - if (!m_DebuggerFrame) - m_DebuggerFrame = new DSPDebuggerLLE((wxWindow *)_hParent); - m_DebuggerFrame->Show(); - } - else - { - if (m_DebuggerFrame) - { - m_DebuggerFrame->Close(); - m_DebuggerFrame->Destroy(); - m_DebuggerFrame = NULL; - } - } + m_DebuggerFrame = new DSPDebuggerLLE((wxWindow *)_hParent); + return (void *)m_DebuggerFrame; +#else + return NULL; #endif } diff --git a/Source/Plugins/Plugin_VideoDX11/Src/main.cpp b/Source/Plugins/Plugin_VideoDX11/Src/main.cpp index 7f848e64b2..864f0b977c 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/main.cpp @@ -107,8 +107,9 @@ wxWindow* GetParentedWxWindow(HWND Parent) } #endif -void DllDebugger(void *_hParent, bool Show) +void *DllDebugger(void *_hParent, bool Show) { + return NULL; } #if defined(HAVE_WX) && HAVE_WX diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Debugger/Debugger.h b/Source/Plugins/Plugin_VideoDX9/Src/Debugger/Debugger.h index c5e3e50a5e..20f9cdfdcd 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Debugger/Debugger.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/Debugger/Debugger.h @@ -33,7 +33,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL, - const wxString &title = wxT("Video")); + const wxString &title = wxT("DX9 Debugger")); virtual ~GFXDebuggerDX9(); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp index ae9d0b6501..ec573fa3a7 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp @@ -28,7 +28,6 @@ GFXConfigDialogDX *m_ConfigFrame = NULL; #if defined(HAVE_WX) && HAVE_WX #include "Debugger/Debugger.h" -GFXDebuggerDX9 *m_DebuggerFrame = NULL; #endif // HAVE_WX #include "main.h" @@ -97,24 +96,12 @@ wxWindow* GetParentedWxWindow(HWND Parent) } #endif -void DllDebugger(void *_hParent, bool Show) +void *DllDebugger(void *_hParent, bool Show) { #if defined(HAVE_WX) && HAVE_WX - if (Show) - { - if (!m_DebuggerFrame) - m_DebuggerFrame = new GFXDebuggerDX9((wxWindow *)_hParent); - m_DebuggerFrame->Show(); - } - else - { - if (m_DebuggerFrame) - { - m_DebuggerFrame->Close(); - m_DebuggerFrame->Destroy(); - m_DebuggerFrame = NULL; - } - } + return new GFXDebuggerDX9((wxWindow *)_hParent); +#else + return NULL; #endif } diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Debugger/Debugger.h b/Source/Plugins/Plugin_VideoOGL/Src/Debugger/Debugger.h index 7f5652ebec..73e7019dfd 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Debugger/Debugger.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/Debugger/Debugger.h @@ -33,7 +33,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL, - const wxString &title = wxT("Video")); + const wxString &title = wxT("OpenGL Debugger")); virtual ~GFXDebuggerOGL(); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp index e5ce618f54..e66685cddc 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp @@ -64,7 +64,6 @@ Make AA apply instantly during gameplay if possible #include "GUI/ConfigDlg.h" GFXConfigDialogOGL *m_ConfigFrame = NULL; #include "Debugger/Debugger.h" -static GFXDebuggerOGL *m_DebuggerFrame = NULL; #endif // HAVE_WX #include "VideoConfig.h" @@ -152,24 +151,12 @@ wxWindow* GetParentedWxWindow(HWND Parent) } #endif -void DllDebugger(void *_hParent, bool Show) +void *DllDebugger(void *_hParent, bool Show) { #if defined(HAVE_WX) && HAVE_WX - if (Show) - { - if (!m_DebuggerFrame) - m_DebuggerFrame = new GFXDebuggerOGL((wxWindow *)_hParent); - m_DebuggerFrame->Show(); - } - else - { - if (m_DebuggerFrame) - { - m_DebuggerFrame->Close(); - m_DebuggerFrame->Destroy(); - m_DebuggerFrame = NULL; - } - } + return new GFXDebuggerOGL((wxWindow *)_hParent); +#else + return NULL; #endif } diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/main.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/main.cpp index cd6a75de35..67e7c99aec 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/main.cpp @@ -61,8 +61,9 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) LogManager::SetInstance((LogManager *)globals->logManager); } -void DllDebugger(void *_hParent, bool Show) +void *DllDebugger(void *_hParent, bool Show) { + return NULL; } void DllConfig(HWND _hParent) diff --git a/Source/Plugins/Plugin_Wiimote/Src/main.cpp b/Source/Plugins/Plugin_Wiimote/Src/main.cpp index ee28cf63d9..88f7b098b7 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/main.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/main.cpp @@ -152,7 +152,10 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) LogManager::SetInstance((LogManager *)globals->logManager); } -void DllDebugger(void *_hParent, bool Show) {} +void *DllDebugger(void *_hParent, bool Show) +{ + return NULL; +} void DllConfig(HWND _hParent) { diff --git a/Source/Plugins/Plugin_WiimoteNew/Src/WiimoteNew.cpp b/Source/Plugins/Plugin_WiimoteNew/Src/WiimoteNew.cpp index aec62f1df6..811add1536 100644 --- a/Source/Plugins/Plugin_WiimoteNew/Src/WiimoteNew.cpp +++ b/Source/Plugins/Plugin_WiimoteNew/Src/WiimoteNew.cpp @@ -320,9 +320,9 @@ void DllConfig(HWND _hParent) // input: a handle to the window that calls this function // output: none // -void DllDebugger(void *_hParent, bool Show) +void *DllDebugger(void *_hParent, bool Show) { - // wut? + return NULL; } // ___________________________________________________________________________