Implement scrolling to the target address.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42213 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
98a61309e7
commit
0215c110a5
@ -73,6 +73,23 @@ MemoryView::SetTargetAddress(TeamMemoryBlock* block, target_addr_t address)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
MemoryView::ScrollToSelection()
|
||||
{
|
||||
if (fTargetBlock != NULL) {
|
||||
target_addr_t offset = fTargetAddress - fTargetBlock->BaseAddress();
|
||||
int32 lineNumber = 0;
|
||||
if (fHexBlocksPerLine > 0)
|
||||
lineNumber = offset / (fHexBlocksPerLine * (1 << (fHexMode - 1)));
|
||||
else if (fTextCharsPerLine > 0)
|
||||
lineNumber = offset / fTextCharsPerLine;
|
||||
float y = lineNumber * fLineHeight;
|
||||
if (!Bounds().Contains(BPoint(0.0, y)))
|
||||
ScrollTo(0.0, y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
MemoryView::TargetedByScrollView(BScrollView* scrollView)
|
||||
{
|
||||
@ -231,6 +248,7 @@ MemoryView::MessageReceived(BMessage* message)
|
||||
case MSG_TARGET_ADDRESS_CHANGED:
|
||||
{
|
||||
_RecalcScrollBars();
|
||||
ScrollToSelection();
|
||||
Invalidate();
|
||||
break;
|
||||
}
|
||||
|
@ -45,9 +45,7 @@ public:
|
||||
|
||||
void SetTargetAddress(TeamMemoryBlock* block,
|
||||
target_addr_t address);
|
||||
|
||||
void TargetAddressChanged(target_addr_t address);
|
||||
|
||||
void ScrollToSelection();
|
||||
|
||||
virtual void TargetedByScrollView(BScrollView* scrollView);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user