Fix memory view scrolling, keep window start aligned to row size, and retain focus upon positioning it to the address accessed by an opcode

This commit is contained in:
Kingcom 2016-09-10 15:29:11 +02:00
parent 4ebe739b44
commit f2a0f9f61a
2 changed files with 10 additions and 6 deletions

View File

@ -612,11 +612,11 @@ void CtrlMemView::scrollCursor(int bytes)
if (curAddress < windowStart) if (curAddress < windowStart)
{ {
windowStart = (curAddress / rowSize) * curAddress; windowStart = (curAddress / rowSize) * rowSize;
} else if (curAddress >= windowEnd) } else if (curAddress >= windowEnd)
{ {
windowStart = curAddress - (visibleRows - 1)*rowSize; windowStart = curAddress - (visibleRows - 1)*rowSize;
windowStart = (windowStart / rowSize) * windowStart; windowStart = (windowStart / rowSize) * rowSize;
} }
updateStatusBarText(); updateStatusBarText();
@ -642,7 +642,12 @@ void CtrlMemView::gotoAddress(u32 addr, bool pushInHistory)
curAddress = addr; curAddress = addr;
selectedNibble = 0; selectedNibble = 0;
windowStart = curAddress;
int visibleRows = GetClientSize().y/rowHeight;
u32 windowEnd = windowStart+visibleRows*rowSize;
if (curAddress < windowStart || curAddress >= windowEnd)
windowStart = (curAddress / rowSize) * rowSize;
updateStatusBarText(); updateStatusBarText();
redraw(); redraw();

View File

@ -502,9 +502,8 @@ void DisassemblyDialog::onDebuggerEvent(wxCommandEvent& evt)
{ {
currentCpu->showMemoryView(); currentCpu->showMemoryView();
CtrlMemView *memview = currentCpu->getMemoryView(); currentCpu->getMemoryView()->gotoAddress(evt.GetInt(), true);
memview->gotoAddress(evt.GetInt(), true); currentCpu->getDisassembly()->SetFocus();
memview->SetFocus();
} }
} else if (type == debEVT_RUNTOPOS) } else if (type == debEVT_RUNTOPOS)
{ {