Added a "Delete watch" context menu to the Watch window.
Added a "View memory" command to the context menu.
This commit is contained in:
parent
290e1bed37
commit
b34e220086
|
@ -219,7 +219,7 @@ void TMemCheck::Action(DebugInterface *debug_interface, u32 iValue, u32 addr, bo
|
|||
}
|
||||
|
||||
|
||||
bool Watches::IsAddressWatch(u32 _iAddress)
|
||||
const bool Watches::IsAddressWatch(u32 _iAddress)
|
||||
{
|
||||
for (const TWatch& bp : m_Watches)
|
||||
if (bp.iAddress == _iAddress)
|
||||
|
|
|
@ -118,7 +118,7 @@ public:
|
|||
TWatchesStr GetStrings() const;
|
||||
void AddFromStrings(const TWatchesStr& bps);
|
||||
|
||||
bool IsAddressWatch(u32 _iAddress);
|
||||
const bool IsAddressWatch(u32 _iAddress);
|
||||
|
||||
// Add BreakPoint
|
||||
void Add(u32 em_address);
|
||||
|
|
|
@ -271,7 +271,7 @@ void CRegisterView::OnMouseDownR(wxGridEvent& event)
|
|||
int col = event.GetCol();
|
||||
|
||||
wxString strNewVal = GetValueByRowCol(row, col);
|
||||
TryParse("0x" + WxStrToStr(strNewVal), &addr);
|
||||
TryParse("0x" + WxStrToStr(strNewVal), &m_selectedAddress);
|
||||
|
||||
wxMenu* menu = new wxMenu;
|
||||
menu->Append(IDM_WATCHADDRESS, _("Add to &watch"));
|
||||
|
@ -289,14 +289,14 @@ void CRegisterView::OnPopupMenu(wxCommandEvent& event)
|
|||
switch (event.GetId())
|
||||
{
|
||||
case IDM_WATCHADDRESS:
|
||||
PowerPC::watches.Add(addr);
|
||||
PowerPC::watches.Add(m_selectedAddress);
|
||||
if (watch_window)
|
||||
watch_window->NotifyUpdate();
|
||||
Refresh();
|
||||
break;
|
||||
case IDM_VIEWMEMORY:
|
||||
if (memory_window)
|
||||
memory_window->JumpToAddress(addr);
|
||||
memory_window->JumpToAddress(m_selectedAddress);
|
||||
Refresh();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -75,5 +75,5 @@ public:
|
|||
void OnPopupMenu(wxCommandEvent& event);
|
||||
|
||||
private:
|
||||
u32 addr = 0;
|
||||
u32 m_selectedAddress = 0;
|
||||
};
|
||||
|
|
|
@ -6,18 +6,31 @@
|
|||
#include <wx/colour.h>
|
||||
#include <wx/defs.h>
|
||||
#include <wx/grid.h>
|
||||
#include <wx/menu.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/windowid.h>
|
||||
|
||||
#include "Common/GekkoDisassembler.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/PowerPC/PowerPC.h"
|
||||
#include "DolphinWX/Frame.h"
|
||||
#include "DolphinWX/WxUtils.h"
|
||||
#include "DolphinWX/Debugger/CodeWindow.h"
|
||||
#include "DolphinWX/Debugger/DebuggerUIUtil.h"
|
||||
#include "DolphinWX/Debugger/MemoryWindow.h"
|
||||
#include "DolphinWX/Debugger/RegisterView.h"
|
||||
#include "DolphinWX/Debugger/WatchView.h"
|
||||
#include "DolphinWX/Debugger/WatchWindow.h"
|
||||
|
||||
class wxWindow;
|
||||
|
||||
enum
|
||||
{
|
||||
IDM_DELETEWATCH,
|
||||
IDM_VIEWMEMORY,
|
||||
};
|
||||
|
||||
|
||||
static std::string GetWatchName(int count)
|
||||
{
|
||||
return PowerPC::watches.GetWatches().at(count - 1).name;
|
||||
|
@ -53,7 +66,7 @@ static void SetWatchValue(int count, u32 value)
|
|||
Memory::WriteUnchecked_U32(value, GetWatchAddr(count));
|
||||
}
|
||||
|
||||
wxString CWatchTable::GetValue(int row, int col)
|
||||
static wxString GetValueByRowCol(int row, int col)
|
||||
{
|
||||
if (row == 0)
|
||||
{
|
||||
|
@ -93,6 +106,11 @@ wxString CWatchTable::GetValue(int row, int col)
|
|||
return wxEmptyString;
|
||||
}
|
||||
|
||||
wxString CWatchTable::GetValue(int row, int col)
|
||||
{
|
||||
return GetValueByRowCol(row, col);
|
||||
}
|
||||
|
||||
void CWatchTable::SetValue(int row, int col, const wxString& strNewVal)
|
||||
{
|
||||
u32 newVal = 0;
|
||||
|
@ -210,3 +228,50 @@ void CWatchView::Update()
|
|||
((CWatchTable *)GetTable())->UpdateWatch();
|
||||
}
|
||||
}
|
||||
|
||||
void CWatchView::OnMouseDownR(wxGridEvent& event)
|
||||
{
|
||||
// popup menu
|
||||
int row = event.GetRow();
|
||||
int col = event.GetCol();
|
||||
|
||||
if (col == 1 || col == 2)
|
||||
{
|
||||
wxString strNewVal = GetValueByRowCol(row, col);
|
||||
TryParse("0x" + WxStrToStr(strNewVal), &m_selectedAddress);
|
||||
m_selectedRow = row;
|
||||
|
||||
wxMenu* menu = new wxMenu;
|
||||
menu->Append(IDM_DELETEWATCH, _("&Delete watch"));
|
||||
menu->Append(IDM_VIEWMEMORY, _("View &memory"));
|
||||
PopupMenu(menu);
|
||||
}
|
||||
}
|
||||
|
||||
void CWatchView::OnPopupMenu(wxCommandEvent& event)
|
||||
{
|
||||
CFrame* main_frame = (CFrame*)(GetParent()->GetParent());
|
||||
CCodeWindow* code_window = main_frame->g_pCodeWindow;
|
||||
CWatchWindow* watch_window = code_window->m_WatchWindow;
|
||||
CMemoryWindow* memory_window = code_window->m_MemoryWindow;
|
||||
|
||||
wxString strNewVal;
|
||||
|
||||
switch (event.GetId())
|
||||
{
|
||||
case IDM_DELETEWATCH:
|
||||
strNewVal = GetValueByRowCol(m_selectedRow, 1);
|
||||
TryParse("0x" + WxStrToStr(strNewVal), &m_selectedAddress);
|
||||
PowerPC::watches.Remove(m_selectedAddress);
|
||||
if (watch_window)
|
||||
watch_window->NotifyUpdate();
|
||||
Refresh();
|
||||
break;
|
||||
case IDM_VIEWMEMORY:
|
||||
if (memory_window)
|
||||
memory_window->JumpToAddress(m_selectedAddress);
|
||||
Refresh();
|
||||
break;
|
||||
}
|
||||
event.Skip();
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ class CWatchTable : public wxGridTableBase
|
|||
{
|
||||
enum
|
||||
{
|
||||
NUM_SPECIALS = 1,
|
||||
MAX_SPECIALS = 256,
|
||||
};
|
||||
|
||||
|
@ -47,4 +46,10 @@ class CWatchView : public wxGrid
|
|||
public:
|
||||
CWatchView(wxWindow* parent, wxWindowID id);
|
||||
void Update() override;
|
||||
void OnMouseDownR(wxGridEvent& event);
|
||||
void OnPopupMenu(wxCommandEvent& event);
|
||||
|
||||
private:
|
||||
u32 m_selectedAddress = 0;
|
||||
u32 m_selectedRow = 0;
|
||||
};
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
class wxWindow;
|
||||
|
||||
BEGIN_EVENT_TABLE(CWatchWindow, wxPanel)
|
||||
EVT_GRID_CELL_RIGHT_CLICK(CWatchView::OnMouseDownR)
|
||||
EVT_MENU(-1, CWatchView::OnPopupMenu)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue