mirror of
https://github.com/cemu-project/Cemu.git
synced 2026-03-26 12:08:29 -06:00
debugger: fix breakpoints window right-click being offset
This commit is contained in:
parent
ceb9771a5c
commit
3ee166101a
@ -32,7 +32,7 @@ BreakpointWindow::BreakpointWindow(DebuggerWindow2& parent, const wxPoint& main_
|
||||
|
||||
wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
m_breakpoints = new wxListView(this, wxID_ANY);
|
||||
m_breakpoints = new wxListView(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_SINGLE_SEL);
|
||||
m_breakpoints->EnableCheckBoxes(true);
|
||||
|
||||
wxListItem col0;
|
||||
@ -162,10 +162,12 @@ void BreakpointWindow::OnBreakpointToggled(wxListEvent& event)
|
||||
void BreakpointWindow::OnLeftDClick(wxMouseEvent& event)
|
||||
{
|
||||
const auto position = event.GetPosition();
|
||||
const sint32 index = (position.y / m_breakpoints->GetCharHeight()) - 2;
|
||||
if (index < 0 || index >= m_breakpoints->GetItemCount())
|
||||
int flags = 0;
|
||||
const long index = m_breakpoints->HitTest(position, flags);
|
||||
|
||||
if (index == wxNOT_FOUND)
|
||||
return;
|
||||
|
||||
|
||||
sint32 x = position.x;
|
||||
const auto enabled_width = m_breakpoints->GetColumnWidth(ColumnEnabled);
|
||||
if (x <= enabled_width)
|
||||
@ -173,7 +175,7 @@ void BreakpointWindow::OnLeftDClick(wxMouseEvent& event)
|
||||
|
||||
x -= enabled_width;
|
||||
const auto address_width = m_breakpoints->GetColumnWidth(ColumnAddress);
|
||||
if(x <= address_width)
|
||||
if (x <= address_width)
|
||||
{
|
||||
const auto item = m_breakpoints->GetItemText(index, ColumnAddress);
|
||||
const auto address = std::stoul(item.ToStdString(), nullptr, 16);
|
||||
@ -183,13 +185,13 @@ void BreakpointWindow::OnLeftDClick(wxMouseEvent& event)
|
||||
}
|
||||
|
||||
x -= address_width;
|
||||
const auto type_width = m_breakpoints->GetColumnWidth(ColumnType);
|
||||
const auto type_width = m_breakpoints->GetColumnWidth(ColumnType);
|
||||
if (x <= type_width)
|
||||
return;
|
||||
|
||||
x -= type_width;
|
||||
const auto comment_width = m_breakpoints->GetColumnWidth(ColumnComment);
|
||||
if(x <= comment_width)
|
||||
if (x <= comment_width)
|
||||
{
|
||||
if (index >= debuggerState.breakpoints.size())
|
||||
return;
|
||||
@ -213,9 +215,9 @@ void BreakpointWindow::OnLeftDClick(wxMouseEvent& event)
|
||||
|
||||
void BreakpointWindow::OnRightDown(wxMouseEvent& event)
|
||||
{
|
||||
const auto position = event.GetPosition();
|
||||
const sint32 index = (position.y / m_breakpoints->GetCharHeight()) - 2;
|
||||
if (index < 0 || index >= m_breakpoints->GetItemCount())
|
||||
int flags = 0;
|
||||
const long index = m_breakpoints->HitTest(event.GetPosition(), flags);
|
||||
if (index == wxNOT_FOUND || index < 0 || index >= m_breakpoints->GetItemCount())
|
||||
{
|
||||
wxMenu menu;
|
||||
menu.Append(MENU_ID_CREATE_CODE_BP_EXECUTION, _("Create execution breakpoint"));
|
||||
@ -244,19 +246,16 @@ void BreakpointWindow::OnContextMenuClickSelected(wxCommandEvent& evt)
|
||||
if (evt.GetId() == MENU_ID_DELETE_BP)
|
||||
{
|
||||
long sel = m_breakpoints->GetFirstSelected();
|
||||
if (sel != wxNOT_FOUND)
|
||||
{
|
||||
if (sel >= debuggerState.breakpoints.size())
|
||||
return;
|
||||
if (sel == wxNOT_FOUND || sel < 0 || sel >= m_breakpoints->GetItemCount())
|
||||
return;
|
||||
|
||||
auto it = debuggerState.breakpoints.begin();
|
||||
std::advance(it, sel);
|
||||
auto it = debuggerState.breakpoints.begin();
|
||||
std::advance(it, sel);
|
||||
|
||||
debugger_deleteBreakpoint(*it);
|
||||
debugger_deleteBreakpoint(*it);
|
||||
|
||||
wxCommandEvent evt(wxEVT_BREAKPOINT_CHANGE);
|
||||
wxPostEvent(this->m_parent, evt);
|
||||
}
|
||||
wxCommandEvent evt(wxEVT_BREAKPOINT_CHANGE);
|
||||
wxPostEvent(this->m_parent, evt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user