diff --git a/Source/Core/DebuggerWX/Src/CodeWindow.h b/Source/Core/DebuggerWX/Src/CodeWindow.h index ec984e4573..97481dc90d 100644 --- a/Source/Core/DebuggerWX/Src/CodeWindow.h +++ b/Source/Core/DebuggerWX/Src/CodeWindow.h @@ -61,6 +61,11 @@ class CCodeWindow void UpdateToolbar(wxAuiToolBar *); void UpdateNotebook(int, wxAuiNotebook *); wxBitmap page_bmp; + #ifdef _WIN32 + wxWindow * GetWxWindow(wxString); + #endif + wxWindow * GetNootebookPage(wxString); + void DoToggleWindow(int,bool); void Load_(IniFile &file); void Load(IniFile &file); @@ -131,7 +136,7 @@ class CCodeWindow void OnCodeViewChange(wxCommandEvent &event); void SingleCPUStep(); - void OnAddrBoxChange(wxCommandEvent& event); + void OnAddrBoxChange(wxCommandEvent& event); void OnToggleWindow(wxCommandEvent& event); void OnToggleRegisterWindow(bool,wxAuiNotebook*); diff --git a/Source/Core/DebuggerWX/Src/CodeWindowSJP.cpp b/Source/Core/DebuggerWX/Src/CodeWindowSJP.cpp index 13a194f802..e4d9729a11 100644 --- a/Source/Core/DebuggerWX/Src/CodeWindowSJP.cpp +++ b/Source/Core/DebuggerWX/Src/CodeWindowSJP.cpp @@ -325,11 +325,54 @@ void CCodeWindow::OnChangeFont(wxCommandEvent& event) ///////////////////////////////////////////////////////////////////////////////////////////////////////// // Toogle windows // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ +wxWindow * CCodeWindow::GetNootebookPage(wxString Name) +{ + if (!m_NB0 || !m_NB1) return NULL; + + for(int i = 0; i <= m_NB0->GetPageCount(); i++) + { + if (m_NB0->GetPageText(i).IsSameAs(Name)) return m_NB0->GetPage(i); + } + for(int i = 0; i <= m_NB1->GetPageCount(); i++) + { + if (m_NB1->GetPageText(i).IsSameAs(Name)) return m_NB1->GetPage(i); + } + return NULL; +} +#ifdef _WIN32 +wxWindow * CCodeWindow::GetWxWindow(wxString Name) +{ + HWND hWnd = ::FindWindow(NULL, Name.c_str()); + if (hWnd) + { + wxWindow * Win = new wxWindow(); + Win->SetHWND((WXHWND)hWnd); + Win->AdoptAttributesFromHWND(); + return Win; + } + else if (GetParent()->GetParent()->FindWindowByName(Name)) + { + return GetParent()->GetParent()->FindWindowByName(Name); + } + else if (GetParent()->GetParent()->FindWindowByLabel(Name)) + { + return GetParent()->GetParent()->FindWindowByLabel(Name); + } + else if (GetNootebookPage(Name)) + { + return GetNootebookPage(Name); + } + else + return NULL; +} +#endif void CCodeWindow::OnToggleWindow(wxCommandEvent& event) { - bool Show = GetMenuBar()->IsChecked(event.GetId()); - - switch (event.GetId()) + DoToggleWindow(event.GetId(), GetMenuBar()->IsChecked(event.GetId())); +} +void CCodeWindow::DoToggleWindow(int Id, bool Show) +{ + switch (Id) { case IDM_REGISTERWINDOW: OnToggleRegisterWindow(Show, m_NB0); break; case IDM_BREAKPOINTWINDOW: OnToggleBreakPointWindow(Show, m_NB1); break; @@ -337,9 +380,8 @@ void CCodeWindow::OnToggleWindow(wxCommandEvent& event) case IDM_JITWINDOW: OnToggleJitWindow(Show, m_NB0); break; case IDM_SOUNDWINDOW: OnToggleSoundWindow(Show, m_NB1); break; case IDM_VIDEOWINDOW: OnToggleVideoWindow(Show, m_NB1); break; - } + } } - void CCodeWindow::OnToggleRegisterWindow(bool Show, wxAuiNotebook * _NB) { if (Show) @@ -441,17 +483,40 @@ void CCodeWindow::OnToggleMemoryWindow(bool Show, wxAuiNotebook * _NB) //Toggle Sound Debugging Window void CCodeWindow::OnToggleSoundWindow(bool Show, wxAuiNotebook * _NB) { + //ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener(); + if (Show) { - // TODO: add some kind of if() check here to? - CPluginManager::GetInstance().OpenDebug( - GetHandle(), - SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(), - PLUGIN_TYPE_DSP, true // DSP, show - ); + #ifdef _WIN32 + wxWindow *Win = GetWxWindow(wxT("Sound")); + if (Win && _NB->GetPageIndex(Win) != wxNOT_FOUND) return; + + { + #endif + //Console->Log(LogTypes::LNOTICE, StringFromFormat("OpenDebug\n").c_str()); + CPluginManager::GetInstance().OpenDebug( + GetParent()->GetParent()->GetHandle(), + //GetHandle(), + SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(), + PLUGIN_TYPE_DSP, true // DSP, show + ); + #ifdef _WIN32 + } + + Win = GetWxWindow(wxT("Sound")); + if (Win) + { + //Console->Log(LogTypes::LNOTICE, StringFromFormat("AddPage\n").c_str()); + _NB->AddPage(Win, wxT("Sound"), true, page_bmp ); + } + #endif } else // hide { + #ifdef _WIN32 + wxWindow *Win = GetWxWindow(wxT("Sound")); + if (Win) _NB->RemovePage(_NB->GetPageIndex(Win)); + #endif // Close the sound dll that has an open debugger CPluginManager::GetInstance().OpenDebug( GetHandle(), @@ -461,7 +526,6 @@ void CCodeWindow::OnToggleSoundWindow(bool Show, wxAuiNotebook * _NB) } } - // Toggle Video Debugging Window void CCodeWindow::OnToggleVideoWindow(bool Show, wxAuiNotebook * _NB) { @@ -469,22 +533,31 @@ void CCodeWindow::OnToggleVideoWindow(bool Show, wxAuiNotebook * _NB) if (Show) { - // It works now, but I'll keep this message in case the problem reappears - /*if(Core::GetState() == Core::CORE_UNINITIALIZED) - { - wxMessageBox(_T("Warning, opening this window before a game is started \n\ -may cause a crash when a game is later started. Todo: figure out why and fix it."), wxT("OpenGL Debugging Window")); - }*/ + #ifdef _WIN32 + wxWindow *Win = GetWxWindow(wxT("Video")); + if (Win && _NB->GetPageIndex(Win) != wxNOT_FOUND) return; - // TODO: add some kind of if() check here to? - CPluginManager::GetInstance().OpenDebug( - GetHandle(), - SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str(), - PLUGIN_TYPE_VIDEO, true // Video, show - ); + { + #endif + // Show and/or create the window + CPluginManager::GetInstance().OpenDebug( + GetHandle(), + SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str(), + PLUGIN_TYPE_VIDEO, true // Video, show + ); + #ifdef _WIN32 + } + + Win = GetWxWindow(wxT("Video")); + if (Win) _NB->AddPage(Win, wxT("Video"), true, page_bmp ); + #endif } else // hide { + #ifdef _WIN32 + wxWindow *Win = GetWxWindow(wxT("Video")); + if (Win) _NB->RemovePage(_NB->GetPageIndex(Win)); + #endif // Close the video dll that has an open debugger CPluginManager::GetInstance().OpenDebug( GetHandle(), diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index d753460c57..faa98f41e1 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -521,13 +521,18 @@ void CFrame::OnAllowNotebookDnD(wxAuiNotebookEvent& event) } void CFrame::OnNotebookPageClose(wxAuiNotebookEvent& event) { - event.Skip(); + // Don't skip the event, override it + //event.Skip(); + event.Veto(); + wxAuiNotebook* Ctrl = (wxAuiNotebook*)event.GetEventObject(); - if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Registers"))) { GetMenuBar()->FindItem(IDM_REGISTERWINDOW)->Check(false); g_pCodeWindow->m_RegisterWindow = NULL; } - if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Breakpoints"))) { GetMenuBar()->FindItem(IDM_BREAKPOINTWINDOW)->Check(false); g_pCodeWindow->m_BreakpointWindow = NULL; } - if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("JIT"))) { GetMenuBar()->FindItem(IDM_JITWINDOW)->Check(false); g_pCodeWindow->m_JitWindow = NULL; } - if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Memory"))) { GetMenuBar()->FindItem(IDM_MEMORYWINDOW)->Check(false); g_pCodeWindow->m_MemoryWindow = NULL; } + if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Registers"))) { GetMenuBar()->FindItem(IDM_REGISTERWINDOW)->Check(false); g_pCodeWindow->DoToggleWindow(IDM_REGISTERWINDOW, false); } + if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Breakpoints"))) { GetMenuBar()->FindItem(IDM_BREAKPOINTWINDOW)->Check(false); g_pCodeWindow->DoToggleWindow(IDM_BREAKPOINTWINDOW, false); } + if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("JIT"))) { GetMenuBar()->FindItem(IDM_JITWINDOW)->Check(false); g_pCodeWindow->DoToggleWindow(IDM_JITWINDOW, false); } + if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Memory"))) { GetMenuBar()->FindItem(IDM_MEMORYWINDOW)->Check(false); g_pCodeWindow->DoToggleWindow(IDM_MEMORYWINDOW, false); } + if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Sound"))) { GetMenuBar()->FindItem(IDM_SOUNDWINDOW)->Check(false); g_pCodeWindow->DoToggleWindow(IDM_SOUNDWINDOW, false); } + if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Video"))) { GetMenuBar()->FindItem(IDM_VIDEOWINDOW)->Check(false); g_pCodeWindow->DoToggleWindow(IDM_VIDEOWINDOW, false); } } void CFrame::DoFullscreen(bool _F) diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.cpp index 832cfb96f9..138761756e 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.cpp @@ -225,13 +225,12 @@ void DSPDebuggerHLE::Load(IniFile& _IniFile) // ------------- void DSPDebuggerHLE::CreateGUIControls() { -SetTitle(wxT("Sound Debugging")); + //SetTitle(wxT("Sound")); // Basic settings - SetIcon(wxNullIcon); - SetSize(8, 8, 200, 100); // These will become the minimin sizes allowed by resizing - Center(); - + //SetIcon(wxNullIcon); + //SetSize(8, 8, 200, 100); // These will become the minimin sizes allowed by resizing + //Center(); // Declarations wxBoxSizer * m_MainSizer, * sMain, *_sMail, * sBlock; diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.h b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.h index dbecba70bc..c768b52aa0 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.h @@ -60,10 +60,10 @@ class DSPDebuggerHLE : public wxDialog public: DSPDebuggerHLE(wxWindow *parent, wxWindowID id = 1, - const wxString &title = wxT("Sound Debugger"), + const wxString &title = wxT("Sound"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE); + long style = wxNO_BORDER); virtual ~DSPDebuggerHLE(); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Debugger/Debugger.h b/Source/Plugins/Plugin_VideoOGL/Src/Debugger/Debugger.h index 7c9cd363bf..c5763de3a0 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Debugger/Debugger.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/Debugger/Debugger.h @@ -30,10 +30,10 @@ class GFXDebuggerOGL : public wxDialog public: GFXDebuggerOGL(wxWindow *parent, wxWindowID id = 1, - const wxString &title = wxT("OGL Debugguer"), + const wxString &title = wxT("Video"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE); + long style = wxNO_BORDER); virtual ~GFXDebuggerOGL(); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp index 3472971ba8..81f8fffd78 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp @@ -158,7 +158,7 @@ void DllDebugger(HWND _hParent, bool Show) m_DebuggerFrame = new GFXDebuggerOGL(GetParentedWxWindow(_hParent)); if (Show) - m_DebuggerFrame->ShowModal(); + m_DebuggerFrame->Show(); else m_DebuggerFrame->Hide(); }