From da6a200540de80afaad9b28290739969ba42a965 Mon Sep 17 00:00:00 2001 From: John Peterson Date: Thu, 27 Aug 2009 10:10:07 +0000 Subject: [PATCH] GUI: Dock logwindow git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4075 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Core/DebuggerWX/Src/BreakpointWindow.cpp | 9 - Source/Core/DebuggerWX/Src/CodeWindow.cpp | 58 ++----- Source/Core/DebuggerWX/Src/CodeWindow.h | 39 ++--- Source/Core/DebuggerWX/Src/CodeWindowSJP.cpp | 153 ++++------------- Source/Core/DolphinWX/Src/Frame.cpp | 159 ++++++++++-------- Source/Core/DolphinWX/Src/Frame.h | 34 ++-- Source/Core/DolphinWX/Src/FrameTools.cpp | 142 ++++++++++++---- Source/Core/DolphinWX/Src/Globals.h | 3 +- Source/Core/DolphinWX/Src/LogWindow.cpp | 4 +- 9 files changed, 279 insertions(+), 322 deletions(-) diff --git a/Source/Core/DebuggerWX/Src/BreakpointWindow.cpp b/Source/Core/DebuggerWX/Src/BreakpointWindow.cpp index 5b8f27c0cc..0528e861a6 100644 --- a/Source/Core/DebuggerWX/Src/BreakpointWindow.cpp +++ b/Source/Core/DebuggerWX/Src/BreakpointWindow.cpp @@ -46,15 +46,6 @@ BEGIN_EVENT_TABLE(CBreakPointWindow, wxFrame) EVT_LIST_ITEM_ACTIVATED(ID_BPS, CBreakPointWindow::OnActivated) END_EVENT_TABLE() - -#define wxGetBitmapFromMemory(name) _wxGetBitmapFromMemory(name, sizeof(name)) -inline wxBitmap _wxGetBitmapFromMemory(const unsigned char* data, int length) -{ - wxMemoryInputStream is(data, length); - return(wxBitmap(wxImage(is, wxBITMAP_TYPE_ANY, -1), -1)); -} - - CBreakPointWindow::CBreakPointWindow(CCodeWindow* _pCodeWindow, wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style) : wxFrame(parent, id, title, position, size, style) , m_BreakPointListView(NULL) diff --git a/Source/Core/DebuggerWX/Src/CodeWindow.cpp b/Source/Core/DebuggerWX/Src/CodeWindow.cpp index 2c67e98b92..a741de8640 100644 --- a/Source/Core/DebuggerWX/Src/CodeWindow.cpp +++ b/Source/Core/DebuggerWX/Src/CodeWindow.cpp @@ -76,13 +76,14 @@ class CPluginManager; static const long TOOLBAR_STYLE = wxTB_FLAT | wxTB_DOCKABLE | wxTB_TEXT; - +/* #define wxGetBitmapFromMemory(name) _wxGetBitmapFromMemory(name, sizeof(name)) inline wxBitmap _wxGetBitmapFromMemory(const unsigned char* data, int length) { wxMemoryInputStream is(data, length); return(wxBitmap(wxImage(is, wxBITMAP_TYPE_ANY, -1), -1)); } +*/ BEGIN_EVENT_TABLE(CCodeWindow, wxPanel) @@ -158,22 +159,20 @@ END_EVENT_TABLE() // Class, input event handler and host message handler -CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, wxWindow* parent, - wxWindowID id) - : wxPanel(parent, id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxNO_BORDER, wxT("Dolphin-Debugger")) - +CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, CFrame *ParentObject, wxWindow* Parent, + wxWindowID Id) + : wxPanel(Parent, Id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxNO_BORDER, wxT("Dolphin-Debugger")) + , Parent(ParentObject) /* Remember to initialize potential new controls with NULL there, otherwise m_dialog = true and things may crash */ , m_RegisterWindow(NULL) , m_BreakpointWindow(NULL) , m_MemoryWindow(NULL) , m_JitWindow(NULL) - , m_ToolBarDebug(NULL), m_NB0(NULL), m_NB1(NULL) { // Load ini settings this->Load(); - aNormalFile = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16)); InitBitmaps(); CreateGUIControls(_LocalCoreStartupParameter); @@ -187,7 +186,6 @@ CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter wxKeyEventHandler(CCodeWindow::OnKeyDown), (wxObject*)0, this); } - CCodeWindow::~CCodeWindow() { @@ -196,48 +194,24 @@ CCodeWindow::~CCodeWindow() ///////////////////////////////////////////////////////////////////////////////////////////////////// // Redirect old wxFrame calls -// ------------ -wxFrame *CCodeWindow::GetParentFrame() -{ - wxFrame *Parent = wxDynamicCast(GetParent()->GetParent(), wxFrame); - return Parent; -} +// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ wxMenuBar *CCodeWindow::GetMenuBar() { - if (GetParentFrame()) return GetParentFrame()->GetMenuBar(); + return Parent->GetMenuBar(); } wxAuiToolBar *CCodeWindow::GetToolBar() { - if (GetParentFrame()) return m_ToolBarDebug; -} -bool CCodeWindow::IsActive() -{ - if (GetParentFrame()) return GetParentFrame()->IsActive(); -} -void CCodeWindow::UpdateToolbar(wxAuiToolBar * _ToolBar2) -{ - m_ToolBarDebug = _ToolBar2; -} -void CCodeWindow::UpdateNotebook(int _i, wxAuiNotebook * _NB) -{ - if (_i == 0) - m_NB0 = _NB; - else - m_NB1 = _NB; + return Parent->m_ToolBarDebug; } ///////////////////////////////////////////////////////////////////////////////////////////////////// void CCodeWindow::OnKeyDown(wxKeyEvent& event) { - if ((event.GetKeyCode() == WXK_SPACE) && IsActive()) - { + if ((event.GetKeyCode() == WXK_SPACE) && Parent->IsActive()) SingleCPUStep(); - } else - { event.Skip(); - } } void CCodeWindow::OnHostMessage(wxCommandEvent& event) @@ -688,7 +662,7 @@ void CCodeWindow::OnCodeStep(wxCommandEvent& event) UpdateButtonStates(); // Update all toolbars in the aui manager - UpdateManager(); + Parent->UpdateGUI(); } @@ -899,13 +873,6 @@ void CCodeWindow::UpdateButtonStates() if (ToolBar) ToolBar->Realize(); } -// Update manager -void CCodeWindow::UpdateManager() -{ - // Caution: This can cause an endless loop if this event comes back to this function - wxCommandEvent evnt(wxEVT_HOST_COMMAND, IDM_UPDATEGUI); - wxPostEvent(GetParentFrame(), evnt); -} void CCodeWindow::RecreateToolbar(wxAuiToolBar * toolBar) { @@ -926,10 +893,7 @@ void CCodeWindow::RecreateToolbar(wxAuiToolBar * toolBar) } - - // Show Tool Tip for menu items - void CCodeWindow::DoTip(wxString text) { // Create a blank tooltip to clear the eventual old one diff --git a/Source/Core/DebuggerWX/Src/CodeWindow.h b/Source/Core/DebuggerWX/Src/CodeWindow.h index a41abdbbaa..a97ec6d6ce 100644 --- a/Source/Core/DebuggerWX/Src/CodeWindow.h +++ b/Source/Core/DebuggerWX/Src/CodeWindow.h @@ -30,7 +30,9 @@ // GUI global #include "../../DolphinWX/Src/Globals.h" +#include "../../DolphinWX/Src/Frame.h" +class CFrame; class CRegisterWindow; class CBreakPointWindow; class CMemoryWindow; @@ -42,7 +44,7 @@ class CCodeWindow { public: - CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, wxWindow* parent, + CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, CFrame *, wxWindow* parent, wxWindowID id = wxID_ANY); /* CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, wxWindow* parent, @@ -57,20 +59,14 @@ class CCodeWindow void Load(); void Save(); - // Function redirection and parent interaction - wxFrame *GetParentFrame(); + // Parent interaction + CFrame *Parent; wxMenuBar * GetMenuBar(); - wxAuiToolBar * GetToolBar(), * m_ToolBarDebug; - wxAuiNotebook *m_NB0, *m_NB1; - bool IsActive(); - void UpdateToolbar(wxAuiToolBar *); - void UpdateNotebook(int, wxAuiNotebook *); - wxBitmap aNormalFile; + wxAuiToolBar * GetToolBar(); #ifdef _WIN32 wxWindow * GetWxWindow(wxString); #endif - wxWindow * GetNootebookPage(wxString); - void DoToggleWindow(int,bool); + wxWindow * GetNootebookPage(wxString); wxBitmap m_Bitmaps[ToolbarDebugBitmapMax]; bool UseInterpreter(); @@ -89,6 +85,15 @@ class CCodeWindow void UpdateButtonStates(); void OpenPages(); void UpdateManager(); + + void OnToggleWindow(wxCommandEvent& event); + void OnToggleRegisterWindow(bool,wxAuiNotebook*); + void OnToggleBreakPointWindow(bool,wxAuiNotebook*); + void OnToggleMemoryWindow(bool,wxAuiNotebook*); + void OnToggleJitWindow(bool,wxAuiNotebook*); + void OnToggleSoundWindow(bool,wxAuiNotebook*); + void OnToggleVideoWindow(bool,wxAuiNotebook*); + void OnChangeFont(wxCommandEvent& event); // Sub dialogs wxMenuBar* pMenuBar; @@ -127,17 +132,7 @@ class CCodeWindow void OnCodeViewChange(wxCommandEvent &event); void SingleCPUStep(); - void OnAddrBoxChange(wxCommandEvent& event); - - void OnToggleWindow(wxCommandEvent& event); - void OnToggleRegisterWindow(bool,wxAuiNotebook*); - void OnToggleBreakPointWindow(bool,wxAuiNotebook*); - void OnToggleMemoryWindow(bool,wxAuiNotebook*); - void OnToggleJitWindow(bool,wxAuiNotebook*); - void OnToggleSoundWindow(bool,wxAuiNotebook*); - void OnToggleVideoWindow(bool,wxAuiNotebook*); - void OnChangeFont(wxCommandEvent& event); - + void OnAddrBoxChange(wxCommandEvent& event); void OnHostMessage(wxCommandEvent& event); void OnSymbolsMenu(wxCommandEvent& event); void OnJitMenu(wxCommandEvent& event); diff --git a/Source/Core/DebuggerWX/Src/CodeWindowSJP.cpp b/Source/Core/DebuggerWX/Src/CodeWindowSJP.cpp index aef19b8ddf..db7dff1635 100644 --- a/Source/Core/DebuggerWX/Src/CodeWindowSJP.cpp +++ b/Source/Core/DebuggerWX/Src/CodeWindowSJP.cpp @@ -327,15 +327,15 @@ void CCodeWindow::OnChangeFont(wxCommandEvent& event) // ÂŻÂŻÂŻÂŻÂŻÂŻÂŻÂŻÂŻÂŻÂŻÂŻÂŻÂŻÂŻÂŻ wxWindow * CCodeWindow::GetNootebookPage(wxString Name) { - if (!m_NB0 || !m_NB1) return NULL; + if (!Parent->m_NB0 || !Parent->m_NB1) return NULL; - for(u32 i = 0; i <= m_NB0->GetPageCount(); i++) + for(u32 i = 0; i <= Parent->m_NB0->GetPageCount(); i++) { - if (m_NB0->GetPageText(i).IsSameAs(Name)) return m_NB0->GetPage(i); + if (Parent->m_NB0->GetPageText(i).IsSameAs(Name)) return Parent->m_NB0->GetPage(i); } - for(u32 i = 0; i <= m_NB1->GetPageCount(); i++) + for(u32 i = 0; i <= Parent->m_NB1->GetPageCount(); i++) { - if (m_NB1->GetPageText(i).IsSameAs(Name)) return m_NB1->GetPage(i); + if (Parent->m_NB1->GetPageText(i).IsSameAs(Name)) return Parent->m_NB1->GetPage(i); } return NULL; } @@ -350,13 +350,13 @@ wxWindow * CCodeWindow::GetWxWindow(wxString Name) Win->AdoptAttributesFromHWND(); return Win; } - else if (GetParent()->GetParent()->FindWindowByName(Name)) + else if (Parent->FindWindowByName(Name)) { - return GetParent()->GetParent()->FindWindowByName(Name); + return Parent->FindWindowByName(Name); } - else if (GetParent()->GetParent()->FindWindowByLabel(Name)) + else if (Parent->FindWindowByLabel(Name)) { - return GetParent()->GetParent()->FindWindowByLabel(Name); + return Parent->FindWindowByLabel(Name); } else if (GetNootebookPage(Name)) { @@ -368,82 +368,39 @@ wxWindow * CCodeWindow::GetWxWindow(wxString Name) #endif void CCodeWindow::OpenPages() { - if (bRegisterWindow) OnToggleRegisterWindow(true, m_NB0); - if (bBreakpointWindow) OnToggleBreakPointWindow(true, m_NB1); - if (bMemoryWindow) OnToggleMemoryWindow(true, m_NB0); - if (bJitWindow) OnToggleJitWindow(true, m_NB0); - if (bSoundWindow) OnToggleSoundWindow(true, m_NB1); - if (bVideoWindow) OnToggleVideoWindow(true, m_NB1); + if (bRegisterWindow) Parent->DoToggleWindow(IDM_REGISTERWINDOW, true); + if (bBreakpointWindow) Parent->DoToggleWindow(IDM_BREAKPOINTWINDOW, true); + if (bMemoryWindow) Parent->DoToggleWindow(IDM_MEMORYWINDOW, true); + if (bJitWindow) Parent->DoToggleWindow(IDM_JITWINDOW, true); + if (bSoundWindow) Parent->DoToggleWindow(IDM_SOUNDWINDOW, true); + if (bVideoWindow) Parent->DoToggleWindow(IDM_VIDEOWINDOW, true); } void CCodeWindow::OnToggleWindow(wxCommandEvent& event) { - 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; - case IDM_MEMORYWINDOW: OnToggleMemoryWindow(Show, m_NB0); break; - case IDM_JITWINDOW: OnToggleJitWindow(Show, m_NB0); break; - case IDM_SOUNDWINDOW: OnToggleSoundWindow(Show, m_NB1); break; - case IDM_VIDEOWINDOW: OnToggleVideoWindow(Show, m_NB1); break; - } + Parent->DoToggleWindow(event.GetId(), GetMenuBar()->IsChecked(event.GetId())); } void CCodeWindow::OnToggleRegisterWindow(bool Show, wxAuiNotebook * _NB) { if (Show) { if (m_RegisterWindow && _NB->GetPageIndex(m_RegisterWindow) != wxNOT_FOUND) return; - if (!m_RegisterWindow) m_RegisterWindow = new CRegisterWindow(GetParent()->GetParent()); - _NB->AddPage(m_RegisterWindow, wxT("Registers"), true, aNormalFile ); + if (!m_RegisterWindow) m_RegisterWindow = new CRegisterWindow(Parent); + _NB->AddPage(m_RegisterWindow, wxT("Registers"), true, Parent->aNormalFile ); } else // hide - { - // If m_dialog is NULL, then possibly the system - // didn't report the checked menu item status correctly. - // It should be true just after the menu item was selected, - // if there was no modeless dialog yet. - wxASSERT(m_RegisterWindow != NULL); - //if (m_RegisterWindow) m_RegisterWindow->Hide(); - if (m_RegisterWindow) - { - if (m_NB0->GetPageIndex(m_RegisterWindow) != wxNOT_FOUND) - m_NB0->RemovePage(m_NB0->GetPageIndex(m_RegisterWindow)); - else - m_NB1->RemovePage(m_NB1->GetPageIndex(m_RegisterWindow)); - m_RegisterWindow->Hide(); - } - } + Parent->DoRemovePage (m_RegisterWindow); } - void CCodeWindow::OnToggleBreakPointWindow(bool Show, wxAuiNotebook * _NB) { if (Show) { if (m_BreakpointWindow && _NB->GetPageIndex(m_BreakpointWindow) != wxNOT_FOUND) return; - if (!m_BreakpointWindow) m_BreakpointWindow = new CBreakPointWindow(this, GetParent()->GetParent()); - _NB->AddPage(m_BreakpointWindow, wxT("Breakpoints"), true, aNormalFile ); + if (!m_BreakpointWindow) m_BreakpointWindow = new CBreakPointWindow(this, Parent); + _NB->AddPage(m_BreakpointWindow, wxT("Breakpoints"), true, Parent->aNormalFile ); } else // hide - { - // If m_dialog is NULL, then possibly the system - // didn't report the checked menu item status correctly. - // It should be true just after the menu item was selected, - // if there was no modeless dialog yet. - wxASSERT(m_BreakpointWindow != NULL); - - if (m_BreakpointWindow) - { - if (m_NB0->GetPageIndex(m_BreakpointWindow) != wxNOT_FOUND) - m_NB0->RemovePage(m_NB0->GetPageIndex(m_BreakpointWindow)); - else - m_NB1->RemovePage(m_NB1->GetPageIndex(m_BreakpointWindow)); - m_BreakpointWindow->Hide(); - } - } + Parent->DoRemovePage(m_BreakpointWindow); } void CCodeWindow::OnToggleJitWindow(bool Show, wxAuiNotebook * _NB) @@ -451,26 +408,11 @@ void CCodeWindow::OnToggleJitWindow(bool Show, wxAuiNotebook * _NB) if (Show) { if (m_JitWindow && _NB->GetPageIndex(m_JitWindow) != wxNOT_FOUND) return; - if (!m_JitWindow) m_JitWindow = new CJitWindow(GetParent()->GetParent()); - _NB->AddPage(m_JitWindow, wxT("JIT"), true, aNormalFile ); + if (!m_JitWindow) m_JitWindow = new CJitWindow(Parent); + _NB->AddPage(m_JitWindow, wxT("JIT"), true, Parent->aNormalFile ); } else // hide - { - // If m_dialog is NULL, then possibly the system - // didn't report the checked menu item status correctly. - // It should be true just after the menu item was selected, - // if there was no modeless dialog yet. - wxASSERT(m_JitWindow != NULL); - - if (m_JitWindow) - { - if (m_NB0->GetPageIndex(m_JitWindow) != wxNOT_FOUND) - m_NB0->RemovePage(m_NB0->GetPageIndex(m_JitWindow)); - else - m_NB1->RemovePage(m_NB1->GetPageIndex(m_JitWindow)); - m_JitWindow->Hide(); - } - } + Parent->DoRemovePage(m_JitWindow); } @@ -479,26 +421,11 @@ void CCodeWindow::OnToggleMemoryWindow(bool Show, wxAuiNotebook * _NB) if (Show) { if (m_MemoryWindow && _NB->GetPageIndex(m_MemoryWindow) != wxNOT_FOUND) return; - if (!m_MemoryWindow) m_MemoryWindow = new CMemoryWindow(GetParent()->GetParent()); - _NB->AddPage(m_MemoryWindow, wxT("Memory"), true, aNormalFile ); + if (!m_MemoryWindow) m_MemoryWindow = new CMemoryWindow(Parent); + _NB->AddPage(m_MemoryWindow, wxT("Memory"), true, Parent->aNormalFile ); } else // hide - { - // If m_dialog is NULL, then possibly the system - // didn't report the checked menu item status correctly. - // It should be true just after the menu item was selected, - // if there was no modeless dialog yet. - wxASSERT(m_MemoryWindow != NULL); - - if (m_MemoryWindow) - { - if (m_NB0->GetPageIndex(m_MemoryWindow) != wxNOT_FOUND) - m_NB0->RemovePage(m_NB0->GetPageIndex(m_MemoryWindow)); - else - m_NB1->RemovePage(m_NB1->GetPageIndex(m_MemoryWindow)); - m_MemoryWindow->Hide(); - } - } + Parent->DoRemovePage(m_MemoryWindow); } //Toggle Sound Debugging Window @@ -516,7 +443,7 @@ void CCodeWindow::OnToggleSoundWindow(bool Show, wxAuiNotebook * _NB) #endif //Console->Log(LogTypes::LNOTICE, StringFromFormat("OpenDebug\n").c_str()); CPluginManager::GetInstance().OpenDebug( - GetParent()->GetParent()->GetHandle(), + Parent->GetHandle(), //GetHandle(), SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(), PLUGIN_TYPE_DSP, true // DSP, show @@ -528,7 +455,7 @@ void CCodeWindow::OnToggleSoundWindow(bool Show, wxAuiNotebook * _NB) if (Win) { //Console->Log(LogTypes::LNOTICE, StringFromFormat("AddPage\n").c_str()); - _NB->AddPage(Win, wxT("Sound"), true, aNormalFile ); + _NB->AddPage(Win, wxT("Sound"), true, Parent->aNormalFile ); } #endif } @@ -536,13 +463,7 @@ void CCodeWindow::OnToggleSoundWindow(bool Show, wxAuiNotebook * _NB) { #ifdef _WIN32 wxWindow *Win = GetWxWindow(wxT("Sound")); - if (Win) - { - if (m_NB0->GetPageIndex(Win) != wxNOT_FOUND) - m_NB0->RemovePage(m_NB0->GetPageIndex(Win)); - else - m_NB1->RemovePage(m_NB1->GetPageIndex(Win)); - } + Parent->DoRemovePage (Win, false); #endif // Close the sound dll that has an open debugger CPluginManager::GetInstance().OpenDebug( @@ -568,7 +489,7 @@ void CCodeWindow::OnToggleVideoWindow(bool Show, wxAuiNotebook * _NB) #endif // Show and/or create the window CPluginManager::GetInstance().OpenDebug( - GetHandle(), + Parent->GetHandle(), SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str(), PLUGIN_TYPE_VIDEO, true // Video, show ); @@ -576,20 +497,14 @@ void CCodeWindow::OnToggleVideoWindow(bool Show, wxAuiNotebook * _NB) } Win = GetWxWindow(wxT("Video")); - if (Win) _NB->AddPage(Win, wxT("Video"), true, aNormalFile ); + if (Win) _NB->AddPage(Win, wxT("Video"), true, Parent->aNormalFile ); #endif } else // hide { #ifdef _WIN32 wxWindow *Win = GetWxWindow(wxT("Video")); - if (Win) - { - if (m_NB0->GetPageIndex(Win) != wxNOT_FOUND) - m_NB0->RemovePage(m_NB0->GetPageIndex(Win)); - else - m_NB1->RemovePage(m_NB1->GetPageIndex(Win)); - } + Parent->DoRemovePage (Win, false); #endif // Close the video dll that has an open debugger CPluginManager::GetInstance().OpenDebug( diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index 7d834db053..356b8fbf0b 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -263,8 +263,8 @@ EVT_MENU(IDM_TOGGLE_DUALCORE, CFrame::OnToggleDualCore) EVT_MENU(IDM_TOGGLE_SKIPIDLE, CFrame::OnToggleSkipIdle) EVT_MENU(IDM_TOGGLE_TOOLBAR, CFrame::OnToggleToolbar) EVT_MENU(IDM_TOGGLE_STATUSBAR, CFrame::OnToggleStatusbar) -EVT_MENU(IDM_TOGGLE_LOGWINDOW, CFrame::OnToggleLogWindow) -EVT_MENU(IDM_TOGGLE_CONSOLE, CFrame::OnToggleConsole) +EVT_MENU(IDM_LOGWINDOW, CFrame::OnToggleLogWindow) +EVT_MENU(IDM_CONSOLE, CFrame::OnToggleConsole) EVT_MENU(IDM_LISTDRIVES, CFrame::GameListChanged) EVT_MENU(IDM_LISTWII, CFrame::GameListChanged) @@ -319,7 +319,8 @@ CFrame::CFrame(bool showLogWindow, bool _UseDebugger, long style) : wxFrame(parent, id, title, pos, size, style) - , UseDebugger(_UseDebugger) + , UseDebugger(_UseDebugger), m_LogWindow(NULL) + , m_NB0(NULL), m_NB1(NULL), m_NB2(NULL) , m_pStatusBar(NULL), bRenderToMain(true), HaveLeds(false) , HaveSpeakers(false), m_Panel(NULL), m_ToolBar(NULL), m_ToolBarDebug(NULL) , m_bLogWindow(showLogWindow || SConfig::GetInstance().m_InterfaceLogWindow) @@ -333,7 +334,7 @@ CFrame::CFrame(bool showLogWindow, if (UseDebugger) this->Maximize(true); // Debugger class if (UseDebugger) - g_pCodeWindow = new CCodeWindow(SConfig::GetInstance().m_LocalCoreStartupParameter, this); + g_pCodeWindow = new CCodeWindow(SConfig::GetInstance().m_LocalCoreStartupParameter, this, this); // Create timer #if wxUSE_TIMER @@ -341,7 +342,7 @@ CFrame::CFrame(bool showLogWindow, m_timer.Start( floor((double)(1000 / TimesPerSecond)) ); #endif - // Create toolbar bitmaps + // Create toolbar bitmaps InitBitmaps(); // Give it an icon @@ -357,29 +358,25 @@ CFrame::CFrame(bool showLogWindow, // Give it a menu bar CreateMenu(); - // Give it a console - ConsoleListener *console = LogManager::GetInstance()->getConsoleListener(); - if (SConfig::GetInstance().m_InterfaceConsole) - console->Open(); - // ------------------------------------------------------------------------- // Panels // ŻŻŻŻŻŻŻŻŻŻŻŻŻ m_Panel = new CPanel(this, IDM_MPANEL); //wxPanel * m_Panel2 = new wxPanel(this, wxID_ANY); + static int Style = wxAUI_NB_TOP | wxAUI_NB_TAB_MOVE | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_CLOSE_ON_ACTIVE_TAB | wxAUI_NB_TAB_EXTERNAL_MOVE | wxNO_BORDER; + wxBitmap aNormalFile = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16)); + if (UseDebugger) { - wxBitmap aNormalFile = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16)); - - static int Style = wxAUI_NB_TOP | wxAUI_NB_TAB_MOVE | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_CLOSE_ON_ACTIVE_TAB | wxAUI_NB_TAB_EXTERNAL_MOVE | wxNO_BORDER; m_NB0 = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, Style); m_NB1 = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, Style); m_NB2 = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, Style); m_NB0->AddPage(g_pCodeWindow, wxT("Code"), false, aNormalFile); - - g_pCodeWindow->UpdateNotebook(0, m_NB0); - g_pCodeWindow->UpdateNotebook(1, m_NB1); + } + else + { + m_NB0 = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, Style); } // ------------------------------------------------------------------------- @@ -394,7 +391,17 @@ CFrame::CFrame(bool showLogWindow, m_Mgr = new wxAuiManager(); m_Mgr->SetManagedWindow(this); - // Window perspectives + + // Normal perspectives + /* + ---------- + | Pane 0 | + ---------- + ------------------- + | Pane 0 | Pane 1 | + ------------------- + */ + // Debug perspectives /* ------------------- | Pane 0 | | @@ -419,22 +426,20 @@ CFrame::CFrame(bool showLogWindow, else { m_Mgr->AddPane(m_Panel, wxAuiPaneInfo().Name(wxT("Pane0")).Caption(wxT("Pane0")).Hide()); + m_Mgr->AddPane(m_NB0, wxAuiPaneInfo().Name(wxT("Pane1")).Caption(wxT("Pane1")).Hide()); } - - // Open log window - m_LogWindow = new CLogWindow(this); - if (m_bLogWindow) m_LogWindow->Show(); // Create toolbar RecreateToolbar(); if (!SConfig::GetInstance().m_InterfaceToolbar) DoToggleToolbar(false); - if (UseDebugger) g_pCodeWindow->UpdateToolbar(m_ToolBarDebug); - // Position the panes + // Show titles to position the panes + /* m_Mgr->GetPane(wxT("Pane0")).CaptionVisible(true); m_Mgr->GetPane(wxT("Pane1")).CaptionVisible(true); m_Mgr->GetPane(wxT("Pane2")).CaptionVisible(true); m_Mgr->GetPane(wxT("Pane3")).CaptionVisible(true); + */ if (UseDebugger) { @@ -442,15 +447,15 @@ CFrame::CFrame(bool showLogWindow, m_Mgr->GetPane(wxT("Pane0")).CenterPane().PaneBorder(false); AuiFullscreen = m_Mgr->SavePerspective(); - m_Mgr->GetPane(wxT("Pane0")).Show().PaneBorder(true).Layer(0).Center().Position(0); - m_Mgr->GetPane(wxT("Pane1")).Show().PaneBorder(true).Layer(0).Center().Position(1); - m_Mgr->GetPane(wxT("Pane2")).Show().PaneBorder(true).Layer(0).Right(); + m_Mgr->GetPane(wxT("Pane0")).Show().PaneBorder(true).CaptionVisible(false).Layer(0).Center().Position(0); + m_Mgr->GetPane(wxT("Pane1")).Show().PaneBorder(true).CaptionVisible(false).Layer(0).Center().Position(1); + m_Mgr->GetPane(wxT("Pane2")).Show().PaneBorder(true).CaptionVisible(false).Layer(0).Right(); AuiPerspective.Add(m_Mgr->SavePerspective()); m_Mgr->GetPane(wxT("Pane0")).Left(); m_Mgr->GetPane(wxT("Pane1")).Left(); m_Mgr->GetPane(wxT("Pane2")).Center(); - m_Mgr->GetPane(wxT("Pane3")).Show().Right(); + m_Mgr->GetPane(wxT("Pane3")).Show().PaneBorder(true).CaptionVisible(false).Right(); AuiPerspective.Add(m_Mgr->SavePerspective()); // Load perspective @@ -465,8 +470,9 @@ CFrame::CFrame(bool showLogWindow, } else { - m_Mgr->GetPane(wxT("Pane0")).Layer(0).CenterPane().PaneBorder(false); + m_Mgr->GetPane(wxT("Pane0")).Show().PaneBorder(false).CaptionVisible(false).Layer(0).Center(); AuiFullscreen = m_Mgr->SavePerspective(); + m_Mgr->GetPane(wxT("Pane1")).Hide().PaneBorder(false).CaptionVisible(false).Layer(0).Right(); } // Show window @@ -477,6 +483,13 @@ CFrame::CFrame(bool showLogWindow, // Open notebook pages if (UseDebugger) g_pCodeWindow->OpenPages(); + if (m_bLogWindow) ToggleLogWindow(true, UseDebugger ? m_NB1 : m_NB0); + if (!UseDebugger) SetSimplePaneSize(); + + // Give it a console + ConsoleListener *console = LogManager::GetInstance()->getConsoleListener(); + if (SConfig::GetInstance().m_InterfaceConsole) + console->Open(); //if we are ever going back to optional iso caching: //m_GameListCtrl->Update(SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableIsoCache); @@ -552,7 +565,6 @@ void CFrame::OnClose(wxCloseEvent& event) UpdateGUI(); } } - void CFrame::OnAllowNotebookDnD(wxAuiNotebookEvent& event) { event.Skip(); @@ -560,21 +572,6 @@ void CFrame::OnAllowNotebookDnD(wxAuiNotebookEvent& event) // If we drag away the last one the tab bar goes away and we can't add any panes to it if (Ctrl->GetPageCount() > 1) event.Allow(); } -void CFrame::OnNotebookPageClose(wxAuiNotebookEvent& event) -{ - // 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->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) { @@ -591,50 +588,64 @@ void CFrame::DoFullscreen(bool _F) m_Mgr->LoadPerspective(AuiCurrent, true); } } - -void CFrame::DoLoadPerspective(int i) +void CFrame::SetSimplePaneSize() { - //Save(); + wxArrayInt i, j; + i.Add(0); j.Add(50); + i.Add(1); j.Add(50); + SetPaneSize(i, j); +} +void CFrame::SetPaneSize(wxArrayInt Pane, wxArrayInt Size) +{ + int iClientSize = this->GetSize().GetX(); - m_Mgr->LoadPerspective(AuiPerspective[i], true); + for (int i = 0; i < Pane.size(); i++) + { + // Check limits + if (Size[i] > 95) Size[i] = 95; if (Size[i] < 5) Size[i] = 5; + // Produce pixel width from percentage width + Size[i] = iClientSize * (float)(Size[i]/100.0); + // Update size + m_Mgr->GetPane(wxString::Format(wxT("Pane%i"), Pane[i])).BestSize(Size[i], -1).MinSize(Size[i], -1).MaxSize(Size[i], -1); + } + m_Mgr->Update(); + for (int i = 0; i < Pane.size(); i++) + { + // Remove the size limits + m_Mgr->GetPane(wxString::Format(wxT("Pane%i"), Pane[i])).MinSize(-1, -1).MaxSize(-1, -1); + } +} +void CFrame::DoLoadPerspective(int Perspective) +{ + Save(); - int _iLeftWidth, _iMidWidth, _iRightWidth, iClientSize = this->GetSize().GetX(); + m_Mgr->LoadPerspective(AuiPerspective[Perspective], true); - // Check limits - if (iLeftWidth[0] > 95) iLeftWidth[0] = 95; if (iLeftWidth[0] < 5) iLeftWidth[0] = 5; - if (iLeftWidth[1] > 95) iLeftWidth[1] = 95; if (iLeftWidth[1] < 5) iLeftWidth[1] = 5; - if (iMidWidth[1] > 95) iMidWidth[1] = 95; if (iMidWidth[1] < 5) iMidWidth[1] = 5; + int _iRightWidth, iClientSize = this->GetSize().GetX(); + wxArrayInt i, j; // Set the size - if (i == 0) + if (Perspective == 0) { - _iLeftWidth = iClientSize * (float)(iLeftWidth[0]/100.0); - _iRightWidth = iClientSize - _iLeftWidth; - - m_Mgr->GetPane(wxT("Pane0")).BestSize(_iLeftWidth, -1).MinSize(_iLeftWidth, -1).MaxSize(_iLeftWidth, -1); + _iRightWidth = 100 - iLeftWidth[0]; + i.Add(0); j.Add(iLeftWidth[0]); + i.Add(2); j.Add(_iRightWidth); //m_Mgr->GetPane(wxT("Pane1")).BestSize(_iLeftWidth, -1).MinSize(_iLeftWidth, -1).MaxSize(_iLeftWidth, -1); - m_Mgr->GetPane(wxT("Pane2")).BestSize(_iRightWidth, -1).MinSize(_iRightWidth, -1).MaxSize(_iRightWidth, -1); + //m_Mgr->GetPane(wxT("Pane2")).BestSize(_iRightWidth, -1).MinSize(_iRightWidth, -1).MaxSize(_iRightWidth, -1); } else { - _iLeftWidth = iClientSize * (float)(iLeftWidth[1]/100.0); - _iMidWidth = iClientSize * (float)(iMidWidth[1]/100.0); - _iRightWidth = iClientSize - _iLeftWidth - _iMidWidth; + _iRightWidth = 100 - iLeftWidth[1] - iMidWidth[1]; + i.Add(0); j.Add(iLeftWidth[1]); + i.Add(2); j.Add(iMidWidth[1]); + i.Add(3); j.Add(_iRightWidth); - m_Mgr->GetPane(wxT("Pane0")).BestSize(_iLeftWidth, -1).MinSize(_iLeftWidth, -1).MaxSize(_iLeftWidth, -1); + //m_Mgr->GetPane(wxT("Pane0")).BestSize(_iLeftWidth, -1).MinSize(_iLeftWidth, -1).MaxSize(_iLeftWidth, -1); //m_Mgr->GetPane(wxT("Pane1")).BestSize(_iLeftWidth, -1).MinSize(_iLeftWidth, -1).MaxSize(_iLeftWidth, -1); - m_Mgr->GetPane(wxT("Pane2")).BestSize(_iMidWidth, -1).MinSize(_iMidWidth, -1).MaxSize(_iMidWidth, -1); - m_Mgr->GetPane(wxT("Pane3")).BestSize(_iRightWidth, -1).MinSize(_iRightWidth, -1).MaxSize(_iRightWidth, -1); + //m_Mgr->GetPane(wxT("Pane2")).BestSize(_iMidWidth, -1).MinSize(_iMidWidth, -1).MaxSize(_iMidWidth, -1); + //m_Mgr->GetPane(wxT("Pane3")).BestSize(_iRightWidth, -1).MinSize(_iRightWidth, -1).MaxSize(_iRightWidth, -1); } - - m_Mgr->Update(); - - // Remove the size limits - m_Mgr->GetPane(wxT("Pane0")).MinSize(-1, -1).MaxSize(-1, -1); - m_Mgr->GetPane(wxT("Pane1")).MinSize(-1, -1).MaxSize(-1, -1); - m_Mgr->GetPane(wxT("Pane2")).MinSize(-1, -1).MaxSize(-1, -1); - m_Mgr->GetPane(wxT("Pane3")).MinSize(-1, -1).MaxSize(-1, -1); - + SetPaneSize(i, j); } void CFrame::Save() { diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index a496e76ff5..ab38bb0507 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -68,13 +68,14 @@ class CFrame : public wxFrame // These have to be public wxStatusBar* m_pStatusBar; + CCodeWindow* g_pCodeWindow; + wxBitmap aNormalFile; void InitBitmaps(); void DoStop(); bool bRenderToMain; void UpdateGUI(); - void ToggleLogWindow(bool check); - void ToggleConsole(bool check); - CCodeWindow* g_pCodeWindow; + void ToggleLogWindow(bool, wxAuiNotebook * _NB = NULL); + void ToggleConsole(bool, wxAuiNotebook * _NB = NULL); void PostEvent(wxCommandEvent& event); void PostMenuEvent(wxMenuEvent& event); void PostUpdateUIEvent(wxUpdateUIEvent& event); @@ -96,17 +97,6 @@ class CFrame : public wxFrame u8 g_Speakers[3]; u8 g_Speakers_[3]; // --------------- - private: - - bool UseDebugger; - wxBoxSizer* sizerPanel; - wxBoxSizer* sizerFrame; - CGameListCtrl* m_GameListCtrl; - wxPanel* m_Panel; - wxToolBarToolBase* m_ToolPlay; - bool m_bLogWindow; - CLogWindow* m_LogWindow; - // AUI wxAuiManager *m_Mgr; wxAuiToolBar *m_ToolBar, *m_ToolBarDebug, *m_ToolBarAui; @@ -117,9 +107,25 @@ class CFrame : public wxFrame wxArrayString AuiPerspective; void OnNotebookPageClose(wxAuiNotebookEvent& event); void OnAllowNotebookDnD(wxAuiNotebookEvent& event); + void DoToggleWindow(int,bool); + void DoRemovePage(wxWindow *, bool Hide = true); void DoLoadPerspective(int); + void HidePane(); + void SetSimplePaneSize(); + void SetPaneSize(wxArrayInt,wxArrayInt); void Save(); + private: + + bool UseDebugger; + wxBoxSizer* sizerPanel; + wxBoxSizer* sizerFrame; + CGameListCtrl* m_GameListCtrl; + wxPanel* m_Panel; + wxToolBarToolBase* m_ToolPlay; + bool m_bLogWindow; + CLogWindow* m_LogWindow; + char **drives; enum EToolbar diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index ad7583900b..15688a3b1b 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -89,14 +89,10 @@ extern "C" { #include "../resources/KDE.h" }; -// Constants -static const long TOOLBAR_STYLE = wxTB_FLAT | wxTB_DOCKABLE | wxTB_TEXT; - // Other Windows wxCheatsWindow* CheatsWindow; wxInfoWindow* InfoWindow; - ///////////////////////////////////////////////////////////////////////////////////////////////////////// // Create menu items // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ @@ -204,10 +200,10 @@ void CFrame::CreateMenu() viewMenu->Check(IDM_TOGGLE_TOOLBAR, SConfig::GetInstance().m_InterfaceToolbar); viewMenu->AppendCheckItem(IDM_TOGGLE_STATUSBAR, _T("Show &Statusbar")); viewMenu->Check(IDM_TOGGLE_STATUSBAR, SConfig::GetInstance().m_InterfaceStatusbar); - viewMenu->AppendCheckItem(IDM_TOGGLE_LOGWINDOW, _T("Show &Logwindow")); - viewMenu->Check(IDM_TOGGLE_LOGWINDOW, m_bLogWindow); - viewMenu->AppendCheckItem(IDM_TOGGLE_CONSOLE, _T("Show &Console")); - viewMenu->Check(IDM_TOGGLE_CONSOLE, SConfig::GetInstance().m_InterfaceConsole); + viewMenu->AppendCheckItem(IDM_LOGWINDOW, _T("Show &Logwindow")); + viewMenu->Check(IDM_LOGWINDOW, m_bLogWindow); + viewMenu->AppendCheckItem(IDM_CONSOLE, _T("Show &Console")); + viewMenu->Check(IDM_CONSOLE, SConfig::GetInstance().m_InterfaceConsole); viewMenu->AppendSeparator(); viewMenu->AppendCheckItem(IDM_LISTWII, _T("Show Wii")); @@ -327,7 +323,7 @@ void CFrame::RecreateToolbar() /* wxToolBarBase* ToolBar = GetToolBar(); - long style = ToolBar ? ToolBar->GetWindowStyle() : TOOLBAR_STYLE; + long style = ToolBar ? ToolBar->GetWindowStyle() : wxTB_FLAT | wxTB_DOCKABLE | wxTB_TEXT; delete ToolBar; SetToolBar(NULL); @@ -437,8 +433,9 @@ void CFrame::InitBitmaps() } // Update in case the bitmap has been updated - if (GetToolBar() != NULL) - RecreateToolbar(); + //if (GetToolBar() != NULL) RecreateToolbar(); + + aNormalFile = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16)); } ///////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -861,15 +858,59 @@ void CFrame::OnFrameSkip(wxCommandEvent& event) ///////////////////////////////////////////////////////////////////////////////////////////////////////// -// GUI +// Notebooks // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -void CFrame::OnResize(wxSizeEvent& event) +void CFrame::OnNotebookPageClose(wxAuiNotebookEvent& event) { - // fit frame content, not needed right now - //FitInside(); + // Override event + event.Veto(); - DoMoveIcons(); // In FrameWiimote.cpp - event.Skip(); + wxAuiNotebook* Ctrl = (wxAuiNotebook*)event.GetEventObject(); + + if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Log"))) { GetMenuBar()->FindItem(IDM_LOGWINDOW)->Check(false); DoToggleWindow(IDM_LOGWINDOW, false); } + if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Registers"))) { GetMenuBar()->FindItem(IDM_REGISTERWINDOW)->Check(false); DoToggleWindow(IDM_REGISTERWINDOW, false); } + if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Breakpoints"))) { GetMenuBar()->FindItem(IDM_BREAKPOINTWINDOW)->Check(false); DoToggleWindow(IDM_BREAKPOINTWINDOW, false); } + if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("JIT"))) { GetMenuBar()->FindItem(IDM_JITWINDOW)->Check(false); DoToggleWindow(IDM_JITWINDOW, false); } + if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Memory"))) { GetMenuBar()->FindItem(IDM_MEMORYWINDOW)->Check(false); DoToggleWindow(IDM_MEMORYWINDOW, false); } + if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Sound"))) { GetMenuBar()->FindItem(IDM_SOUNDWINDOW)->Check(false); DoToggleWindow(IDM_SOUNDWINDOW, false); } + if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Video"))) { GetMenuBar()->FindItem(IDM_VIDEOWINDOW)->Check(false); DoToggleWindow(IDM_VIDEOWINDOW, false); } +} + +void CFrame::HidePane() +{ + if (m_NB0->GetPageCount() == 0) + m_Mgr->GetPane(wxT("Pane1")).Hide(); + else + m_Mgr->GetPane(wxT("Pane1")).Show(); + m_Mgr->Update(); + + SetSimplePaneSize(); +} + +void CFrame::DoRemovePage(wxWindow * Win, bool Hide) +{ + // If m_dialog is NULL, then possibly the system + // didn't report the checked menu item status correctly. + // It should be true just after the menu item was selected, + // if there was no modeless dialog yet. + wxASSERT(Win != NULL); + + if (Win) + { + if (m_NB0) + { + if (m_NB0->GetPageIndex(Win) != wxNOT_FOUND) m_NB0->RemovePage(m_NB0->GetPageIndex(Win)); + } + if (m_NB1) + { + if (m_NB1->GetPageIndex(Win) != wxNOT_FOUND) m_NB1->RemovePage(m_NB1->GetPageIndex(Win)); + } + if (m_NB2) + { + if (m_NB2->GetPageIndex(Win) != wxNOT_FOUND) m_NB2->RemovePage(m_NB2->GetPageIndex(Win)); + } + if (Hide) Win->Hide(); + } } // Enable and disable the toolbar @@ -906,41 +947,76 @@ void CFrame::OnToggleStatusbar(wxCommandEvent& event) this->SendSizeEvent(); } +void CFrame::DoToggleWindow(int Id, bool Show) +{ + switch (Id) + { + case IDM_LOGWINDOW: ToggleLogWindow(Show, UseDebugger ? m_NB1 : m_NB0); break; + case IDM_REGISTERWINDOW: g_pCodeWindow->OnToggleRegisterWindow(Show, m_NB1); break; + case IDM_BREAKPOINTWINDOW: g_pCodeWindow->OnToggleBreakPointWindow(Show, m_NB0); break; + case IDM_MEMORYWINDOW: g_pCodeWindow->OnToggleMemoryWindow(Show, m_NB1); break; + case IDM_JITWINDOW: g_pCodeWindow->OnToggleJitWindow(Show, m_NB1); break; + case IDM_SOUNDWINDOW: g_pCodeWindow->OnToggleSoundWindow(Show, m_NB0); break; + case IDM_VIDEOWINDOW: g_pCodeWindow->OnToggleVideoWindow(Show, m_NB0); break; + } +} // Enable and disable the log window void CFrame::OnToggleLogWindow(wxCommandEvent& event) { - ToggleLogWindow(event.IsChecked()); + DoToggleWindow(event.GetId(), event.IsChecked()); } - -void CFrame::ToggleLogWindow(bool check) +void CFrame::ToggleLogWindow(bool Show, wxAuiNotebook * _NB) { - SConfig::GetInstance().m_InterfaceLogWindow = check; - if (SConfig::GetInstance().m_InterfaceLogWindow) - m_LogWindow->Show(); + SConfig::GetInstance().m_InterfaceLogWindow = Show; + if (Show) + { + if (!_NB) return; + + if (m_LogWindow && _NB->GetPageIndex(m_LogWindow) != wxNOT_FOUND) return; + if (!m_LogWindow) m_LogWindow = new CLogWindow(this); + _NB->AddPage(m_LogWindow, wxT("Log"), true, aNormalFile); + } else - m_LogWindow->Hide(); + { + DoRemovePage(m_LogWindow); + } + + // Hide pane + if (!UseDebugger) HidePane(); // Make sure the check is updated (if wxw isn't calling this func) - GetMenuBar()->FindItem(IDM_TOGGLE_LOGWINDOW)->Check(check); + //GetMenuBar()->FindItem(IDM_LOGWINDOW)->Check(Show); } - // Enable and disable the console void CFrame::OnToggleConsole(wxCommandEvent& event) { ToggleConsole(event.IsChecked()); } - -void CFrame::ToggleConsole(bool check) +void CFrame::ToggleConsole(bool Show, wxAuiNotebook * _NB) { - ConsoleListener *console = LogManager::GetInstance()->getConsoleListener(); - SConfig::GetInstance().m_InterfaceConsole = check; + ConsoleListener *Console = LogManager::GetInstance()->getConsoleListener(); + SConfig::GetInstance().m_InterfaceConsole = Show; if (SConfig::GetInstance().m_InterfaceConsole) - console->Open(); + Console->Open(); else - console->Close(); + Console->Close(); // Make sure the check is updated (if wxw isn't calling this func) - GetMenuBar()->FindItem(IDM_TOGGLE_CONSOLE)->Check(check); + GetMenuBar()->FindItem(IDM_CONSOLE)->Check(Show); +} +///////////////////////////////////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////////////////////////////////// +// GUI +// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ +void CFrame::OnResize(wxSizeEvent& event) +{ + // fit frame content, not needed right now + //FitInside(); + + DoMoveIcons(); // In FrameWiimote.cpp + event.Skip(); } // Update the enabled/disabled status diff --git a/Source/Core/DolphinWX/Src/Globals.h b/Source/Core/DolphinWX/Src/Globals.h index b8af406fb6..398d43da4c 100644 --- a/Source/Core/DolphinWX/Src/Globals.h +++ b/Source/Core/DolphinWX/Src/Globals.h @@ -133,6 +133,7 @@ enum // Views IDM_FONTPICKER, IDM_LOGWINDOW, + IDM_CONSOLE, IDM_REGISTERWINDOW, IDM_BREAKPOINTWINDOW, IDM_MEMORYWINDOW, @@ -183,8 +184,6 @@ enum IDM_TOGGLE_SKIPIDLE, IDM_TOGGLE_TOOLBAR, IDM_TOGGLE_STATUSBAR, - IDM_TOGGLE_LOGWINDOW, - IDM_TOGGLE_CONSOLE, IDM_NOTIFYMAPLOADED, IDM_OPENCONTAININGFOLDER, IDM_OPENSAVEFOLDER, diff --git a/Source/Core/DolphinWX/Src/LogWindow.cpp b/Source/Core/DolphinWX/Src/LogWindow.cpp index 8011ee5523..e61a4bd53d 100644 --- a/Source/Core/DolphinWX/Src/LogWindow.cpp +++ b/Source/Core/DolphinWX/Src/LogWindow.cpp @@ -43,9 +43,9 @@ BEGIN_EVENT_TABLE(CLogWindow, wxDialog) END_EVENT_TABLE() CLogWindow::CLogWindow(wxWindow* parent) - : wxDialog(parent, wxID_ANY, wxT("Log/Console"), + : wxDialog(parent, wxID_ANY, wxT("Log"), wxPoint(100, 700), wxSize(800, 270), - wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) + wxNO_BORDER) , m_logSection(1) { m_logManager = LogManager::GetInstance();