mirror of https://github.com/PCSX2/pcsx2.git
Fix display of memory breakpoint enable status and add context menu to breakpoint list
This commit is contained in:
parent
30a5e31b66
commit
b37f6e9df1
|
@ -25,6 +25,7 @@ DEFINE_LOCAL_EVENT_TYPE( debEVT_MAPLOADED )
|
|||
DEFINE_LOCAL_EVENT_TYPE( debEVT_STEPOVER )
|
||||
DEFINE_LOCAL_EVENT_TYPE( debEVT_STEPINTO )
|
||||
DEFINE_LOCAL_EVENT_TYPE( debEVT_UPDATE )
|
||||
DEFINE_LOCAL_EVENT_TYPE( debEVT_BREAKPOINTWINDOW )
|
||||
|
||||
bool parseExpression(const char* exp, DebugInterface* cpu, u64& dest)
|
||||
{
|
||||
|
|
|
@ -26,5 +26,6 @@ DECLARE_LOCAL_EVENT_TYPE( debEVT_MAPLOADED, wxNewEventType() )
|
|||
DECLARE_LOCAL_EVENT_TYPE( debEVT_STEPOVER, wxNewEventType() )
|
||||
DECLARE_LOCAL_EVENT_TYPE( debEVT_STEPINTO, wxNewEventType() )
|
||||
DECLARE_LOCAL_EVENT_TYPE( debEVT_UPDATE, wxNewEventType() )
|
||||
DECLARE_LOCAL_EVENT_TYPE( debEVT_BREAKPOINTWINDOW, wxNewEventType() )
|
||||
|
||||
bool executeExpressionWindow(wxWindow* parent, DebugInterface* cpu, u64& dest, const wxString& defaultValue = wxEmptyString);
|
||||
|
|
|
@ -47,10 +47,21 @@ void resizeListViewColumns(wxListCtrl* list, GenericListViewColumn* columns, int
|
|||
BEGIN_EVENT_TABLE(BreakpointList, wxWindow)
|
||||
EVT_SIZE(BreakpointList::sizeEvent)
|
||||
EVT_KEY_DOWN(BreakpointList::keydownEvent)
|
||||
EVT_RIGHT_DOWN(BreakpointList::mouseEvent)
|
||||
EVT_RIGHT_UP(BreakpointList::mouseEvent)
|
||||
EVT_LIST_ITEM_RIGHT_CLICK(wxID_ANY,BreakpointList::listEvent)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
enum { BPL_TYPE, BPL_OFFSET, BPL_SIZELABEL, BPL_OPCODE, BPL_CONDITION, BPL_HITS, BPL_ENABLED, BPL_COLUMNCOUNT };
|
||||
|
||||
enum BreakpointListMenuIdentifiers
|
||||
{
|
||||
ID_BREAKPOINTLIST_ENABLE = 1,
|
||||
ID_BREAKPOINTLIST_EDIT,
|
||||
ID_BREAKPOINTLIST_ADDNEW,
|
||||
};
|
||||
|
||||
|
||||
GenericListViewColumn breakpointColumns[BPL_COLUMNCOUNT] = {
|
||||
{ L"Type", 0.12f },
|
||||
{ L"Offset", 0.12f },
|
||||
|
@ -189,7 +200,7 @@ wxString BreakpointList::OnGetItemText(long item, long col) const
|
|||
case BPL_ENABLED:
|
||||
{
|
||||
if (isMemory) {
|
||||
dest.Write(L"%s",displayedMemChecks_[index].cond & MEMCHECK_BREAK ? "true" : "false");
|
||||
dest.Write(L"%s",displayedMemChecks_[index].result & MEMCHECK_BREAK ? "true" : "false");
|
||||
} else {
|
||||
dest.Write(L"%s",displayedBreakPoints_[index].enabled ? "true" : "false");
|
||||
}
|
||||
|
@ -352,3 +363,70 @@ void BreakpointList::postEvent(wxEventType type, int value)
|
|||
event.SetInt(value);
|
||||
wxPostEvent(this,event);
|
||||
}
|
||||
|
||||
void BreakpointList::onPopupClick(wxCommandEvent& evt)
|
||||
{
|
||||
int index = GetFirstSelected();
|
||||
switch (evt.GetId())
|
||||
{
|
||||
case ID_BREAKPOINTLIST_ENABLE:
|
||||
toggleEnabled(index);
|
||||
break;
|
||||
case ID_BREAKPOINTLIST_EDIT:
|
||||
editBreakpoint(index);
|
||||
break;
|
||||
case ID_BREAKPOINTLIST_ADDNEW:
|
||||
postEvent(debEVT_BREAKPOINTWINDOW,0);
|
||||
break;
|
||||
default:
|
||||
wxMessageBox( L"Unimplemented.", L"Unimplemented.", wxICON_INFORMATION);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void BreakpointList::showMenu(wxPoint& pos)
|
||||
{
|
||||
bool isMemory;
|
||||
int index = getBreakpointIndex(GetFirstSelected(),isMemory);
|
||||
|
||||
wxMenu menu;
|
||||
if (index != -1)
|
||||
{
|
||||
menu.AppendCheckItem(ID_BREAKPOINTLIST_ENABLE, L"Enable");
|
||||
menu.Append(ID_BREAKPOINTLIST_EDIT, L"Edit");
|
||||
menu.AppendSeparator();
|
||||
|
||||
// check if the breakpoint is enabled
|
||||
bool enabled;
|
||||
if (isMemory)
|
||||
enabled = (displayedMemChecks_[index].result & MEMCHECK_BREAK) != 0;
|
||||
else
|
||||
enabled = displayedBreakPoints_[index].enabled;
|
||||
|
||||
menu.Check(ID_BREAKPOINTLIST_ENABLE,enabled);
|
||||
}
|
||||
|
||||
menu.Append(ID_BREAKPOINTLIST_ADDNEW, L"Add new");
|
||||
|
||||
menu.Connect(wxEVT_COMMAND_MENU_SELECTED, (wxObjectEventFunction)&BreakpointList::onPopupClick, NULL, this);
|
||||
PopupMenu(&menu,pos);
|
||||
}
|
||||
|
||||
void BreakpointList::mouseEvent(wxMouseEvent& evt)
|
||||
{
|
||||
wxEventType type = evt.GetEventType();
|
||||
|
||||
if (type == wxEVT_RIGHT_DOWN)
|
||||
{
|
||||
clickPos = evt.GetPosition();
|
||||
evt.Skip();
|
||||
} else if (type == wxEVT_RIGHT_UP)
|
||||
{
|
||||
showMenu(evt.GetPosition());
|
||||
}
|
||||
}
|
||||
|
||||
void BreakpointList::listEvent(wxListEvent& evt)
|
||||
{
|
||||
showMenu(clickPos);
|
||||
}
|
|
@ -35,9 +35,12 @@ public:
|
|||
DECLARE_EVENT_TABLE()
|
||||
protected:
|
||||
wxString OnGetItemText(long item, long col) const;
|
||||
void onPopupClick(wxCommandEvent& evt);
|
||||
|
||||
void sizeEvent(wxSizeEvent& evt);
|
||||
void keydownEvent(wxKeyEvent& evt);
|
||||
void mouseEvent(wxMouseEvent& evt);
|
||||
void listEvent(wxListEvent& evt);
|
||||
private:
|
||||
int getBreakpointIndex(int itemIndex, bool& isMemory) const;
|
||||
int getTotalBreakpointCount();
|
||||
|
@ -46,9 +49,11 @@ private:
|
|||
void gotoBreakpointAddress(int itemIndex);
|
||||
void removeBreakpoint(int itemIndex);
|
||||
void postEvent(wxEventType type, int value);
|
||||
void showMenu(wxPoint& pos);
|
||||
|
||||
std::vector<BreakPoint> displayedBreakPoints_;
|
||||
std::vector<MemCheck> displayedMemChecks_;
|
||||
DebugInterface* cpu;
|
||||
CtrlDisassemblyView* disasm;
|
||||
wxPoint clickPos;
|
||||
};
|
||||
|
|
|
@ -35,6 +35,7 @@ BEGIN_EVENT_TABLE(DisassemblyDialog, wxFrame)
|
|||
EVT_COMMAND( wxID_ANY, debEVT_STEPOVER, DisassemblyDialog::onDebuggerEvent )
|
||||
EVT_COMMAND( wxID_ANY, debEVT_STEPINTO, DisassemblyDialog::onDebuggerEvent )
|
||||
EVT_COMMAND( wxID_ANY, debEVT_UPDATE, DisassemblyDialog::onDebuggerEvent )
|
||||
EVT_COMMAND( wxID_ANY, debEVT_BREAKPOINTWINDOW, DisassemblyDialog::onDebuggerEvent )
|
||||
EVT_CLOSE( DisassemblyDialog::onClose )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
@ -414,6 +415,10 @@ void DisassemblyDialog::onDebuggerEvent(wxCommandEvent& evt)
|
|||
} else if (type == debEVT_UPDATE)
|
||||
{
|
||||
update();
|
||||
} else if (type == debEVT_BREAKPOINTWINDOW)
|
||||
{
|
||||
wxCommandEvent evt;
|
||||
onBreakpointClick(evt);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue