From bec5a8031e3aca694a085d6290153bab7d6509d2 Mon Sep 17 00:00:00 2001 From: John Peterson Date: Tue, 25 Aug 2009 07:49:23 +0000 Subject: [PATCH] GUI: Fixed show/hide toolbar git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4058 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/DolphinWX/Src/Frame.cpp | 16 ++++-- Source/Core/DolphinWX/Src/Frame.h | 3 +- Source/Core/DolphinWX/Src/FrameTools.cpp | 63 ++++++++++++++---------- 3 files changed, 52 insertions(+), 30 deletions(-) diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index 1f75158129..b3d4554b78 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -396,10 +396,11 @@ CFrame::CFrame(bool showLogWindow, // Open log window m_LogWindow = new CLogWindow(this); if (m_bLogWindow) m_LogWindow->Show(); - + // Create toolbar RecreateToolbar(); - if (!SConfig::GetInstance().m_InterfaceToolbar) TheToolBar->Hide(); + if (!SConfig::GetInstance().m_InterfaceToolbar) + { m_Mgr->GetPane(wxT("TBMain")).Hide(); if (UseDebugger) m_Mgr->GetPane(wxT("TBDebug")).Hide(); } AuiMode1 = m_Mgr->SavePerspective(); // Save perspectives @@ -492,16 +493,23 @@ void CFrame::DoFullscreen(bool _F) { ShowFullScreen(_F); if (_F) + { + // Save the current mode before going to fullscreen + AuiCurrent = m_Mgr->SavePerspective(); m_Mgr->LoadPerspective(AuiFullscreen, true); + } else - m_Mgr->LoadPerspective(AuiMode1, true); + { + // Restore saved perspective + m_Mgr->LoadPerspective(AuiCurrent, true); + } } ///////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////// // Host messages -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻ +// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ #ifdef _WIN32 WXLRESULT CFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) { diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index 5c89c3636c..131087f7ab 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -102,7 +102,7 @@ class CFrame : public wxFrame wxBoxSizer* sizerFrame; CGameListCtrl* m_GameListCtrl; wxPanel* m_Panel; - wxToolBar* TheToolBar; + wxToolBar* m_ToolBar; wxToolBarToolBase* m_ToolPlay; bool m_bLogWindow; CLogWindow* m_LogWindow; @@ -113,6 +113,7 @@ class CFrame : public wxFrame wxString AuiFullscreen; wxString AuiMode1; wxString AuiMode2; + wxString AuiCurrent; char **drives; diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index fea5662ba5..7695cb46a1 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -97,7 +97,9 @@ wxCheatsWindow* CheatsWindow; wxInfoWindow* InfoWindow; +///////////////////////////////////////////////////////////////////////////////////////////////////////// // Create menu items +// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ void CFrame::CreateMenu() { if (GetMenuBar()) @@ -243,9 +245,12 @@ void CFrame::CreateMenu() // Associate the menu bar with the frame SetMenuBar(menuBar); } +///////////////////////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////////////////////// // Create toolbar items +// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ void CFrame::PopulateToolbar(wxAuiToolBar* toolBar) { int w = m_Bitmaps[Toolbar_FileOpen].GetWidth(), @@ -280,34 +285,29 @@ void CFrame::PopulateToolbar(wxAuiToolBar* toolBar) // Delete and recreate the toolbar void CFrame::RecreateToolbar() { - // Delete toolbar - wxToolBarBase* toolBar = GetToolBar(); - delete toolBar; - SetToolBar(NULL); - - wxAuiToolBar* TheToolBar = new wxAuiToolBar(this, ID_TOOLBAR, wxDefaultPosition, wxDefaultSize, + wxAuiToolBar* m_ToolBar = new wxAuiToolBar(this, ID_TOOLBAR, wxDefaultPosition, wxDefaultSize, wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW | wxAUI_TB_TEXT); - PopulateToolbar(TheToolBar); + PopulateToolbar(m_ToolBar); UpdateGUI(); - m_Mgr->AddPane(TheToolBar, wxAuiPaneInfo(). + m_Mgr->AddPane(m_ToolBar, wxAuiPaneInfo(). Name(wxT("TBMain")).Caption(wxT("TBMain")). ToolbarPane().Top(). - LeftDockable(false).RightDockable(false)); + LeftDockable(false).RightDockable(false).Floatable(false)); if (UseDebugger) { - wxAuiToolBar* TheToolBar2 = new wxAuiToolBar(this, ID_TOOLBAR2, wxDefaultPosition, wxDefaultSize, + wxAuiToolBar* m_ToolBar2 = new wxAuiToolBar(this, ID_TOOLBAR2, wxDefaultPosition, wxDefaultSize, wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW | wxAUI_TB_TEXT); - g_pCodeWindow->PopulateToolbar(TheToolBar2); + g_pCodeWindow->PopulateToolbar(m_ToolBar2); - m_Mgr->AddPane(TheToolBar2, wxAuiPaneInfo(). + m_Mgr->AddPane(m_ToolBar2, wxAuiPaneInfo(). Name(wxT("TBDebug")).Caption(wxT("TBDebug")). ToolbarPane().Top(). - LeftDockable(false).RightDockable(false)); + LeftDockable(false).RightDockable(false).Floatable(false)); } /* @@ -317,10 +317,10 @@ void CFrame::RecreateToolbar() SetToolBar(NULL); style &= ~(wxTB_HORIZONTAL | wxTB_VERTICAL | wxTB_BOTTOM | wxTB_RIGHT | wxTB_HORZ_LAYOUT | wxTB_TOP); - TheToolBar = CreateToolBar(style, ID_TOOLBAR); + m_ToolBar = CreateToolBar(style, ID_TOOLBAR); - PopulateToolbar(TheToolBar); - SetToolBar(TheToolBar); + PopulateToolbar(m_ToolBar); + SetToolBar(m_ToolBar); UpdateGUI(); */ } @@ -425,8 +425,13 @@ void CFrame::InitBitmaps() if (GetToolBar() != NULL) RecreateToolbar(); } +///////////////////////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////////////////////// +// Menu items +// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ + // Start the game or change the disc void CFrame::BootGame() { @@ -696,7 +701,12 @@ void CFrame::OnHelp(wxCommandEvent& event) break; } } +///////////////////////////////////////////////////////////////////////////////////////////////////////// + +///////////////////////////////////////////////////////////////////////////////////////////////////////// +// Miscellaneous menu +// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ // NetPlay stuff void CFrame::OnNetPlay(wxCommandEvent& WXUNUSED (event)) { @@ -705,8 +715,6 @@ void CFrame::OnNetPlay(wxCommandEvent& WXUNUSED (event)) #endif } - -// Miscellaneous menu void CFrame::OnMemcard(wxCommandEvent& WXUNUSED (event)) { CMemcardManager MemcardManager(this); @@ -821,7 +829,12 @@ void CFrame::OnFrameSkip(wxCommandEvent& event) Frame::SetFrameSkipping((unsigned int)amount); } +///////////////////////////////////////////////////////////////////////////////////////////////////////// + +///////////////////////////////////////////////////////////////////////////////////////////////////////// +// GUI +// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ void CFrame::OnResize(wxSizeEvent& event) { // fit frame content, not needed right now @@ -834,19 +847,18 @@ void CFrame::OnResize(wxSizeEvent& event) // Enable and disable the toolbar void CFrame::OnToggleToolbar(wxCommandEvent& event) { - wxToolBarBase* toolBar = GetToolBar(); SConfig::GetInstance().m_InterfaceToolbar = event.IsChecked(); - if (SConfig::GetInstance().m_InterfaceToolbar == true) + + if (event.IsChecked()) { - CFrame::RecreateToolbar(); + m_Mgr->GetPane(wxT("TBMain")).Show(); if (UseDebugger) m_Mgr->GetPane(wxT("TBDebug")).Show(); + m_Mgr->Update(); } else { - delete toolBar; - SetToolBar(NULL); + m_Mgr->GetPane(wxT("TBMain")).Hide(); if (UseDebugger) m_Mgr->GetPane(wxT("TBDebug")).Hide(); + m_Mgr->Update(); } - - this->SendSizeEvent(); } // Enable and disable the status bar @@ -1030,3 +1042,4 @@ void CFrame::GameListChanged(wxCommandEvent& event) m_GameListCtrl->Update(); } } +///////////////////////////////////////////////////////////////////////////////////////////////////////// \ No newline at end of file