GUI: Fixed show/hide toolbar

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4058 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson 2009-08-25 07:49:23 +00:00
parent 421d30b746
commit bec5a8031e
3 changed files with 52 additions and 30 deletions

View File

@ -396,10 +396,11 @@ CFrame::CFrame(bool showLogWindow,
// Open log window // Open log window
m_LogWindow = new CLogWindow(this); m_LogWindow = new CLogWindow(this);
if (m_bLogWindow) m_LogWindow->Show(); if (m_bLogWindow) m_LogWindow->Show();
// Create toolbar // Create toolbar
RecreateToolbar(); 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(); AuiMode1 = m_Mgr->SavePerspective();
// Save perspectives // Save perspectives
@ -492,16 +493,23 @@ void CFrame::DoFullscreen(bool _F)
{ {
ShowFullScreen(_F); ShowFullScreen(_F);
if (_F) if (_F)
{
// Save the current mode before going to fullscreen
AuiCurrent = m_Mgr->SavePerspective();
m_Mgr->LoadPerspective(AuiFullscreen, true); m_Mgr->LoadPerspective(AuiFullscreen, true);
}
else else
m_Mgr->LoadPerspective(AuiMode1, true); {
// Restore saved perspective
m_Mgr->LoadPerspective(AuiCurrent, true);
}
} }
///////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////
// Host messages // Host messages
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
#ifdef _WIN32 #ifdef _WIN32
WXLRESULT CFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) WXLRESULT CFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{ {

View File

@ -102,7 +102,7 @@ class CFrame : public wxFrame
wxBoxSizer* sizerFrame; wxBoxSizer* sizerFrame;
CGameListCtrl* m_GameListCtrl; CGameListCtrl* m_GameListCtrl;
wxPanel* m_Panel; wxPanel* m_Panel;
wxToolBar* TheToolBar; wxToolBar* m_ToolBar;
wxToolBarToolBase* m_ToolPlay; wxToolBarToolBase* m_ToolPlay;
bool m_bLogWindow; bool m_bLogWindow;
CLogWindow* m_LogWindow; CLogWindow* m_LogWindow;
@ -113,6 +113,7 @@ class CFrame : public wxFrame
wxString AuiFullscreen; wxString AuiFullscreen;
wxString AuiMode1; wxString AuiMode1;
wxString AuiMode2; wxString AuiMode2;
wxString AuiCurrent;
char **drives; char **drives;

View File

@ -97,7 +97,9 @@ wxCheatsWindow* CheatsWindow;
wxInfoWindow* InfoWindow; wxInfoWindow* InfoWindow;
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// Create menu items // Create menu items
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void CFrame::CreateMenu() void CFrame::CreateMenu()
{ {
if (GetMenuBar()) if (GetMenuBar())
@ -243,9 +245,12 @@ void CFrame::CreateMenu()
// Associate the menu bar with the frame // Associate the menu bar with the frame
SetMenuBar(menuBar); SetMenuBar(menuBar);
} }
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// Create toolbar items // Create toolbar items
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void CFrame::PopulateToolbar(wxAuiToolBar* toolBar) void CFrame::PopulateToolbar(wxAuiToolBar* toolBar)
{ {
int w = m_Bitmaps[Toolbar_FileOpen].GetWidth(), int w = m_Bitmaps[Toolbar_FileOpen].GetWidth(),
@ -280,34 +285,29 @@ void CFrame::PopulateToolbar(wxAuiToolBar* toolBar)
// Delete and recreate the toolbar // Delete and recreate the toolbar
void CFrame::RecreateToolbar() void CFrame::RecreateToolbar()
{ {
// Delete toolbar wxAuiToolBar* m_ToolBar = new wxAuiToolBar(this, ID_TOOLBAR, wxDefaultPosition, wxDefaultSize,
wxToolBarBase* toolBar = GetToolBar();
delete toolBar;
SetToolBar(NULL);
wxAuiToolBar* TheToolBar = new wxAuiToolBar(this, ID_TOOLBAR, wxDefaultPosition, wxDefaultSize,
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW | wxAUI_TB_TEXT); wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW | wxAUI_TB_TEXT);
PopulateToolbar(TheToolBar); PopulateToolbar(m_ToolBar);
UpdateGUI(); UpdateGUI();
m_Mgr->AddPane(TheToolBar, wxAuiPaneInfo(). m_Mgr->AddPane(m_ToolBar, wxAuiPaneInfo().
Name(wxT("TBMain")).Caption(wxT("TBMain")). Name(wxT("TBMain")).Caption(wxT("TBMain")).
ToolbarPane().Top(). ToolbarPane().Top().
LeftDockable(false).RightDockable(false)); LeftDockable(false).RightDockable(false).Floatable(false));
if (UseDebugger) 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); 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")). Name(wxT("TBDebug")).Caption(wxT("TBDebug")).
ToolbarPane().Top(). ToolbarPane().Top().
LeftDockable(false).RightDockable(false)); LeftDockable(false).RightDockable(false).Floatable(false));
} }
/* /*
@ -317,10 +317,10 @@ void CFrame::RecreateToolbar()
SetToolBar(NULL); SetToolBar(NULL);
style &= ~(wxTB_HORIZONTAL | wxTB_VERTICAL | wxTB_BOTTOM | wxTB_RIGHT | wxTB_HORZ_LAYOUT | wxTB_TOP); 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); PopulateToolbar(m_ToolBar);
SetToolBar(TheToolBar); SetToolBar(m_ToolBar);
UpdateGUI(); UpdateGUI();
*/ */
} }
@ -425,8 +425,13 @@ void CFrame::InitBitmaps()
if (GetToolBar() != NULL) if (GetToolBar() != NULL)
RecreateToolbar(); RecreateToolbar();
} }
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// Menu items
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
// Start the game or change the disc // Start the game or change the disc
void CFrame::BootGame() void CFrame::BootGame()
{ {
@ -696,7 +701,12 @@ void CFrame::OnHelp(wxCommandEvent& event)
break; break;
} }
} }
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// Miscellaneous menu
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
// NetPlay stuff // NetPlay stuff
void CFrame::OnNetPlay(wxCommandEvent& WXUNUSED (event)) void CFrame::OnNetPlay(wxCommandEvent& WXUNUSED (event))
{ {
@ -705,8 +715,6 @@ void CFrame::OnNetPlay(wxCommandEvent& WXUNUSED (event))
#endif #endif
} }
// Miscellaneous menu
void CFrame::OnMemcard(wxCommandEvent& WXUNUSED (event)) void CFrame::OnMemcard(wxCommandEvent& WXUNUSED (event))
{ {
CMemcardManager MemcardManager(this); CMemcardManager MemcardManager(this);
@ -821,7 +829,12 @@ void CFrame::OnFrameSkip(wxCommandEvent& event)
Frame::SetFrameSkipping((unsigned int)amount); Frame::SetFrameSkipping((unsigned int)amount);
} }
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// GUI
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void CFrame::OnResize(wxSizeEvent& event) void CFrame::OnResize(wxSizeEvent& event)
{ {
// fit frame content, not needed right now // fit frame content, not needed right now
@ -834,19 +847,18 @@ void CFrame::OnResize(wxSizeEvent& event)
// Enable and disable the toolbar // Enable and disable the toolbar
void CFrame::OnToggleToolbar(wxCommandEvent& event) void CFrame::OnToggleToolbar(wxCommandEvent& event)
{ {
wxToolBarBase* toolBar = GetToolBar();
SConfig::GetInstance().m_InterfaceToolbar = event.IsChecked(); 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 else
{ {
delete toolBar; m_Mgr->GetPane(wxT("TBMain")).Hide(); if (UseDebugger) m_Mgr->GetPane(wxT("TBDebug")).Hide();
SetToolBar(NULL); m_Mgr->Update();
} }
this->SendSizeEvent();
} }
// Enable and disable the status bar // Enable and disable the status bar
@ -1030,3 +1042,4 @@ void CFrame::GameListChanged(wxCommandEvent& event)
m_GameListCtrl->Update(); m_GameListCtrl->Update();
} }
} }
/////////////////////////////////////////////////////////////////////////////////////////////////////////