From b7f379768914e04f31e61e2026b287ae9a9acee2 Mon Sep 17 00:00:00 2001 From: archshift Date: Fri, 15 Aug 2014 22:33:58 -0700 Subject: [PATCH] Wx: further cleanup to toolbar creation process --- Source/Core/DolphinWX/Debugger/CodeWindow.cpp | 2 -- Source/Core/DolphinWX/FrameTools.cpp | 29 ++++++++----------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/Source/Core/DolphinWX/Debugger/CodeWindow.cpp b/Source/Core/DolphinWX/Debugger/CodeWindow.cpp index b67b836be6..8750dc7979 100644 --- a/Source/Core/DolphinWX/Debugger/CodeWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/CodeWindow.cpp @@ -626,8 +626,6 @@ void CCodeWindow::PopulateToolbar(wxToolBar* toolBar) WxUtils::AddToolbarButton(toolBar, IDM_SETPC, _("Set PC"), m_Bitmaps[Toolbar_SetPC], _("Set the current instruction")); toolBar->AddSeparator(); toolBar->AddControl(new wxTextCtrl(toolBar, IDM_ADDRBOX, "")); - - toolBar->Realize(); } // Update GUI diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp index 1857cdda35..530d450ba6 100644 --- a/Source/Core/DolphinWX/FrameTools.cpp +++ b/Source/Core/DolphinWX/FrameTools.cpp @@ -522,38 +522,33 @@ void CFrame::PopulateToolbar(wxToolBar* ToolBar) WxUtils::AddToolbarButton(ToolBar, IDM_CONFIG_DSP_EMULATOR, _("DSP"), m_Bitmaps[Toolbar_ConfigDSP], _("DSP settings")); WxUtils::AddToolbarButton(ToolBar, IDM_CONFIG_PAD_PLUGIN, _("GCPad"), m_Bitmaps[Toolbar_ConfigPAD], _("GameCube Pad settings")); WxUtils::AddToolbarButton(ToolBar, IDM_CONFIG_WIIMOTE_PLUGIN, _("Wiimote"), m_Bitmaps[Toolbar_Wiimote], _("Wiimote settings")); - - // after adding the buttons to the toolbar, must call Realize() to reflect - // the changes - ToolBar->Realize(); } // Delete and recreate the toolbar void CFrame::RecreateToolbar() { - if (m_ToolBar) + static const long TOOLBAR_STYLE = wxTB_DEFAULT_STYLE | wxTB_TEXT; + + if (m_ToolBar != nullptr) { - m_Mgr->DetachPane(m_ToolBar); m_ToolBar->Destroy(); m_ToolBar = nullptr; } - long TOOLBAR_STYLE = wxTB_DEFAULT_STYLE | wxTB_TEXT; + m_ToolBar = CreateToolBar(TOOLBAR_STYLE, wxID_ANY); - if (!m_ToolBar) + if (g_pCodeWindow) { - m_ToolBar = CreateToolBar(TOOLBAR_STYLE, wxID_ANY, "TBMain"); - - if (g_pCodeWindow) - { - g_pCodeWindow->PopulateToolbar(m_ToolBar); - m_ToolBar->AddSeparator(); - } - - PopulateToolbar(m_ToolBar); + g_pCodeWindow->PopulateToolbar(m_ToolBar); + m_ToolBar->AddSeparator(); } + PopulateToolbar(m_ToolBar); + // after adding the buttons to the toolbar, must call Realize() to reflect + // the changes + m_ToolBar->Realize(); + UpdateGUI(); }