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:
@@ -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
|
void
|
||||||
MemoryView::TargetedByScrollView(BScrollView* scrollView)
|
MemoryView::TargetedByScrollView(BScrollView* scrollView)
|
||||||
{
|
{
|
||||||
@@ -231,6 +248,7 @@ MemoryView::MessageReceived(BMessage* message)
|
|||||||
case MSG_TARGET_ADDRESS_CHANGED:
|
case MSG_TARGET_ADDRESS_CHANGED:
|
||||||
{
|
{
|
||||||
_RecalcScrollBars();
|
_RecalcScrollBars();
|
||||||
|
ScrollToSelection();
|
||||||
Invalidate();
|
Invalidate();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,9 +45,7 @@ public:
|
|||||||
|
|
||||||
void SetTargetAddress(TeamMemoryBlock* block,
|
void SetTargetAddress(TeamMemoryBlock* block,
|
||||||
target_addr_t address);
|
target_addr_t address);
|
||||||
|
void ScrollToSelection();
|
||||||
void TargetAddressChanged(target_addr_t address);
|
|
||||||
|
|
||||||
|
|
||||||
virtual void TargetedByScrollView(BScrollView* scrollView);
|
virtual void TargetedByScrollView(BScrollView* scrollView);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user