Added Load/Save function for the Watch window.
Made the floating windows toolbars dockable. Scaled down the breakpoint toolbar icons to 16x16.
This commit is contained in:
parent
b34e220086
commit
b73130af77
|
@ -234,7 +234,7 @@ Watches::TWatchesStr Watches::GetStrings() const
|
|||
for (const TWatch& bp : m_Watches)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << std::hex << bp.iAddress << " " << (bp.bOn ? "n" : "");
|
||||
ss << std::hex << bp.iAddress << " " << bp.name;
|
||||
bps.push_back(ss.str());
|
||||
}
|
||||
|
||||
|
@ -249,7 +249,7 @@ void Watches::AddFromStrings(const TWatchesStr& bpstrs)
|
|||
std::stringstream ss;
|
||||
ss << std::hex << bpstr;
|
||||
ss >> bp.iAddress;
|
||||
bp.bOn = bpstr.find("n") != bpstr.npos;
|
||||
ss >> bp.name;
|
||||
Add(bp);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,9 +45,9 @@ public:
|
|||
{
|
||||
SetToolBitmapSize(wxSize(24, 24));
|
||||
|
||||
m_Bitmaps[Toolbar_Delete] = wxBitmap(wxGetBitmapFromMemory(toolbar_delete_png).ConvertToImage().Rescale(24, 24));
|
||||
m_Bitmaps[Toolbar_Add_BP] = wxBitmap(wxGetBitmapFromMemory(toolbar_add_breakpoint_png).ConvertToImage().Rescale(24, 24));
|
||||
m_Bitmaps[Toolbar_Add_MC] = wxBitmap(wxGetBitmapFromMemory(toolbar_add_memcheck_png).ConvertToImage().Rescale(24, 24));
|
||||
m_Bitmaps[Toolbar_Delete] = wxBitmap(wxGetBitmapFromMemory(toolbar_delete_png).ConvertToImage().Rescale(16, 16));
|
||||
m_Bitmaps[Toolbar_Add_BP] = wxBitmap(wxGetBitmapFromMemory(toolbar_add_breakpoint_png).ConvertToImage().Rescale(16, 16));
|
||||
m_Bitmaps[Toolbar_Add_MC] = wxBitmap(wxGetBitmapFromMemory(toolbar_add_memcheck_png).ConvertToImage().Rescale(16, 16));
|
||||
|
||||
AddTool(ID_DELETE, _("Delete"), m_Bitmaps[Toolbar_Delete]);
|
||||
Bind(wxEVT_TOOL, &CBreakPointWindow::OnDelete, parent, ID_DELETE);
|
||||
|
@ -112,7 +112,7 @@ CBreakPointWindow::CBreakPointWindow(CCodeWindow* _pCodeWindow, wxWindow* parent
|
|||
m_BreakPointListView = new CBreakPointView(this, wxID_ANY);
|
||||
|
||||
m_mgr.AddPane(new CBreakPointBar(this, wxID_ANY), wxAuiPaneInfo().ToolbarPane().Top().
|
||||
LeftDockable(false).RightDockable(false).BottomDockable(false).Floatable(false));
|
||||
LeftDockable(true).RightDockable(true).BottomDockable(false).Floatable(false));
|
||||
m_mgr.AddPane(m_BreakPointListView, wxAuiPaneInfo().CenterPane());
|
||||
m_mgr.Update();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <wx/string.h>
|
||||
#include <wx/translation.h>
|
||||
#include <wx/windowid.h>
|
||||
#include <wx/aui/framemanager.h>
|
||||
|
||||
class CWatchView;
|
||||
class wxWindow;
|
||||
|
@ -27,11 +28,15 @@ public:
|
|||
const wxString& name = _("Watch"));
|
||||
|
||||
void NotifyUpdate();
|
||||
|
||||
void Event_SaveAll(wxCommandEvent& WXUNUSED(event));
|
||||
void SaveAll();
|
||||
void LoadAll(wxCommandEvent& WXUNUSED(event));
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
wxAuiManager m_mgr;
|
||||
|
||||
enum
|
||||
{
|
||||
ID_GPR = 1002
|
||||
|
|
Loading…
Reference in New Issue