From ce4b73388a6a690fb216eebe3911c8cde3d66779 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 25 Feb 2015 00:06:45 -0500 Subject: [PATCH] DolphinWX: Relocate the address search into the code window It's only function is in this pane. Leaving it on the main application toolbar not only looks gross, but subverts what a user might think it applies to. --- Source/Core/DolphinWX/Debugger/CodeWindow.cpp | 20 ++++++++++++------- Source/Core/DolphinWX/Debugger/CodeWindow.h | 6 ++++-- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Source/Core/DolphinWX/Debugger/CodeWindow.cpp b/Source/Core/DolphinWX/Debugger/CodeWindow.cpp index 2b23f85ef9..8c7bbb4927 100644 --- a/Source/Core/DolphinWX/Debugger/CodeWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/CodeWindow.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -90,8 +91,19 @@ CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter callers = new wxListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, nullptr, wxLB_SORT); callers->Bind(wxEVT_LISTBOX, &CCodeWindow::OnCallersListChange, this); + m_aui_toolbar = new wxAuiToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_TB_HORIZONTAL | wxAUI_TB_PLAIN_BACKGROUND); + + wxTextCtrl* const address_textctrl = new wxTextCtrl(m_aui_toolbar, IDM_ADDRBOX); + address_textctrl->Bind(wxEVT_TEXT, &CCodeWindow::OnAddrBoxChange, this); + + m_aui_toolbar->AddControl(new wxStaticText(m_aui_toolbar, wxID_ANY, _("Address Search:"))); + m_aui_toolbar->AddSpacer(5); + m_aui_toolbar->AddControl(address_textctrl); + m_aui_toolbar->Realize(); + m_aui_manager.SetManagedWindow(this); m_aui_manager.SetFlags(wxAUI_MGR_DEFAULT | wxAUI_MGR_LIVE_RESIZE); + m_aui_manager.AddPane(m_aui_toolbar, wxAuiPaneInfo().ToolbarPane().Top().Floatable(false)); m_aui_manager.AddPane(callstack, wxAuiPaneInfo().MinSize(150, 100).Left().CloseButton(false).Floatable(false).Caption(_("Callstack"))); m_aui_manager.AddPane(symbols, wxAuiPaneInfo().MinSize(150, 100).Left().CloseButton(false).Floatable(false).Caption(_("Symbols"))); m_aui_manager.AddPane(calls, wxAuiPaneInfo().MinSize(150, 100).Left().CloseButton(false).Floatable(false).Caption(_("Function calls"))); @@ -108,7 +120,6 @@ CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter // Toolbar Bind(wxEVT_MENU, &CCodeWindow::OnCodeStep, this, IDM_STEP, IDM_GOTOPC); - Bind(wxEVT_TEXT, &CCodeWindow::OnAddrBoxChange, this, IDM_ADDRBOX); // Other Bind(wxEVT_HOST_COMMAND, &CCodeWindow::OnHostMessage, this); @@ -224,10 +235,7 @@ void CCodeWindow::OnCodeViewChange(wxCommandEvent &event) void CCodeWindow::OnAddrBoxChange(wxCommandEvent& event) { - if (!GetToolBar()) - return; - - wxTextCtrl* pAddrCtrl = (wxTextCtrl*)GetToolBar()->FindControl(IDM_ADDRBOX); + wxTextCtrl* pAddrCtrl = (wxTextCtrl*)m_aui_toolbar->FindControl(IDM_ADDRBOX); // Trim leading and trailing whitespace. wxString txt = pAddrCtrl->GetValue().Trim().Trim(false); @@ -676,8 +684,6 @@ void CCodeWindow::PopulateToolbar(wxToolBar* toolBar) toolBar->AddSeparator(); WxUtils::AddToolbarButton(toolBar, IDM_GOTOPC, _("Show PC"), m_Bitmaps[Toolbar_GotoPC], _("Go to the current instruction")); WxUtils::AddToolbarButton(toolBar, IDM_SETPC, _("Set PC"), m_Bitmaps[Toolbar_SetPC], _("Set the current instruction")); - toolBar->AddSeparator(); - toolBar->AddControl(new wxTextCtrl(toolBar, IDM_ADDRBOX, "")); } // Update GUI diff --git a/Source/Core/DolphinWX/Debugger/CodeWindow.h b/Source/Core/DolphinWX/Debugger/CodeWindow.h index cda981adb1..0b5d52e0aa 100644 --- a/Source/Core/DolphinWX/Debugger/CodeWindow.h +++ b/Source/Core/DolphinWX/Debugger/CodeWindow.h @@ -29,10 +29,11 @@ class DSPDebuggerLLE; class GFXDebuggerPanel; struct SCoreStartupParameter; -class wxToolBar; +class wxAuiToolBar; class wxListBox; class wxMenu; class wxMenuBar; +class wxToolBar; class CCodeWindow : public wxPanel { @@ -136,5 +137,6 @@ private: wxListBox* calls; Common::Event sync_event; - wxAuiManager m_aui_manager; + wxAuiManager m_aui_manager; + wxAuiToolBar* m_aui_toolbar; };