diff options
| author | skidau <skidau@gmail.com> | 2014-10-24 22:24:17 +1100 |
|---|---|---|
| committer | skidau <skidau@gmail.com> | 2014-10-26 14:56:03 +1100 |
| commit | b73130af77e4a978e7837a0e40431af768d2f34c (patch) | |
| tree | bad60bcb561053069388dec1f582105c3a378f47 /Source/Core/DolphinWX/Debugger/WatchWindow.cpp | |
| parent | b34e220086a79a0e6f1824d2f7c94894a90d2998 (diff) | |
Added Load/Save function for the Watch window.
Made the floating windows toolbars dockable.
Scaled down the breakpoint toolbar icons to 16x16.
Diffstat (limited to 'Source/Core/DolphinWX/Debugger/WatchWindow.cpp')
| -rw-r--r-- | Source/Core/DolphinWX/Debugger/WatchWindow.cpp | 89 |
1 files changed, 84 insertions, 5 deletions
diff --git a/Source/Core/DolphinWX/Debugger/WatchWindow.cpp b/Source/Core/DolphinWX/Debugger/WatchWindow.cpp index 7ac1630625..dc25d32d4b 100644 --- a/Source/Core/DolphinWX/Debugger/WatchWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/WatchWindow.cpp @@ -3,6 +3,8 @@ // Refer to the license.txt file included. #include <cstddef> + +#include <wx/bitmap.h> #include <wx/defs.h> #include <wx/event.h> #include <wx/gdicmn.h> @@ -10,10 +12,19 @@ #include <wx/sizer.h> #include <wx/string.h> #include <wx/windowid.h> +#include <wx/aui/auibar.h> +#include "Common/FileUtil.h" +#include "Common/IniFile.h" +#include "Core/PowerPC/PowerPC.h" +#include "DolphinWX/WxUtils.h" #include "DolphinWX/Debugger/WatchView.h" #include "DolphinWX/Debugger/WatchWindow.h" +extern "C" { +#include "DolphinWX/resources/toolbar_debugger_delete.c" +} + class wxWindow; BEGIN_EVENT_TABLE(CWatchWindow, wxPanel) @@ -21,6 +32,40 @@ EVT_GRID_CELL_RIGHT_CLICK(CWatchView::OnMouseDownR) EVT_MENU(-1, CWatchView::OnPopupMenu) END_EVENT_TABLE() +class CWatchToolbar : public wxAuiToolBar +{ +public: +CWatchToolbar(CWatchWindow* parent, const wxWindowID id) + : wxAuiToolBar(parent, id, wxDefaultPosition, wxDefaultSize, + wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_TEXT) +{ + SetToolBitmapSize(wxSize(16, 16)); + + m_Bitmaps[Toolbar_File] = wxBitmap(wxGetBitmapFromMemory(toolbar_delete_png).ConvertToImage().Rescale(16, 16)); + + AddTool(ID_LOAD, _("Load"), m_Bitmaps[Toolbar_File]); + Bind(wxEVT_TOOL, &CWatchWindow::LoadAll, parent, ID_LOAD); + + AddTool(ID_SAVE, _("Save"), m_Bitmaps[Toolbar_File]); + Bind(wxEVT_TOOL, &CWatchWindow::Event_SaveAll, parent, ID_SAVE); +} + +private: + + enum + { + Toolbar_File, + Num_Bitmaps + }; + + enum + { + ID_LOAD, + ID_SAVE + }; + + wxBitmap m_Bitmaps[Num_Bitmaps]; +}; CWatchWindow::CWatchWindow(wxWindow* parent, wxWindowID id, const wxPoint& position, const wxSize& size, @@ -28,17 +73,18 @@ CWatchWindow::CWatchWindow(wxWindow* parent, wxWindowID id, : wxPanel(parent, id, position, size, style, name) , m_GPRGridView(nullptr) { - CreateGUIControls(); -} + m_mgr.SetManagedWindow(this); + m_mgr.SetFlags(wxAUI_MGR_DEFAULT | wxAUI_MGR_LIVE_RESIZE); -void CWatchWindow::CreateGUIControls() -{ wxBoxSizer *sGrid = new wxBoxSizer(wxVERTICAL); m_GPRGridView = new CWatchView(this, ID_GPR); sGrid->Add(m_GPRGridView, 1, wxGROW); SetSizer(sGrid); - NotifyUpdate(); + m_mgr.AddPane(new CWatchToolbar(this, wxID_ANY), wxAuiPaneInfo().ToolbarPane().Top(). + LeftDockable(true).RightDockable(true).BottomDockable(false).Floatable(false)); + m_mgr.AddPane(m_GPRGridView, wxAuiPaneInfo().CenterPane()); + m_mgr.Update(); } void CWatchWindow::NotifyUpdate() @@ -46,3 +92,36 @@ void CWatchWindow::NotifyUpdate() if (m_GPRGridView != nullptr) m_GPRGridView->Update(); } + +void CWatchWindow::Event_SaveAll(wxCommandEvent& WXUNUSED(event)) +{ + SaveAll(); +} + +void CWatchWindow::SaveAll() +{ + IniFile ini; + if (ini.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX))) + { + ini.SetLines("Watches", PowerPC::watches.GetStrings()); + ini.Save(File::GetUserPath(F_DEBUGGERCONFIG_IDX)); + } +} + +void CWatchWindow::LoadAll(wxCommandEvent& WXUNUSED(event)) +{ + IniFile ini; + Watches::TWatchesStr watches; + + if (!ini.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX))) + { + return; + } + + if (ini.GetLines("Watches", &watches, false)) + { + PowerPC::watches.AddFromStrings(watches); + } + + NotifyUpdate(); +} |
