diff --git a/src/apps/diskprobe/DataView.cpp b/src/apps/diskprobe/DataView.cpp index 96c9100e00..030892ac22 100644 --- a/src/apps/diskprobe/DataView.cpp +++ b/src/apps/diskprobe/DataView.cpp @@ -416,6 +416,13 @@ DataView::SetSelection(int32 start, int32 end, view_focus focus) return; } + // notify our listeners + if (fStart != start) { + BMessage update; + update.AddInt64("position", start); + SendNotices(kDataViewCursorPosition, &update); + } + // remove old selection // ToDo: this could be drastically improved if only the changed // parts are drawn! Of course, this would only work for the diff --git a/src/apps/diskprobe/DataView.h b/src/apps/diskprobe/DataView.h index 171749b835..4c528e86f5 100644 --- a/src/apps/diskprobe/DataView.h +++ b/src/apps/diskprobe/DataView.h @@ -14,6 +14,7 @@ class DataEditor; static const uint32 kMsgBaseType = 'base'; +static const uint32 kDataViewCursorPosition = 'curs'; enum base_type { kHexBase, diff --git a/src/apps/diskprobe/ProbeView.cpp b/src/apps/diskprobe/ProbeView.cpp index ad16688b92..7174857bb9 100644 --- a/src/apps/diskprobe/ProbeView.cpp +++ b/src/apps/diskprobe/ProbeView.cpp @@ -530,6 +530,23 @@ void HeaderView::MessageReceived(BMessage *message) { switch (message->what) { + case B_OBSERVER_NOTICE_CHANGE: { + int32 what; + if (message->FindInt32(B_OBSERVE_WHAT_CHANGE, &what) != B_OK) + break; + + switch (what) { + case kDataViewCursorPosition: + off_t offset; + if (message->FindInt64("position", &offset) == B_OK) { + fOffset = offset; + UpdateOffsetViews(fPositionSlider->Position()); + } + break; + } + break; + } + case kMsgSliderUpdate: { off_t position = fPositionSlider->Position(); @@ -642,6 +659,7 @@ void ProbeView::AttachedToWindow() { fEditor.StartWatching(this); + fDataView->StartWatching(fHeaderView, kDataViewCursorPosition); // Add menu to window