The cursor position is now correctly maintained in the HeaderView as well.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6631 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2004-02-18 12:26:18 +00:00
parent 6a2a85f498
commit b797c2778b
3 changed files with 26 additions and 0 deletions

View File

@ -416,6 +416,13 @@ DataView::SetSelection(int32 start, int32 end, view_focus focus)
return; return;
} }
// notify our listeners
if (fStart != start) {
BMessage update;
update.AddInt64("position", start);
SendNotices(kDataViewCursorPosition, &update);
}
// remove old selection // remove old selection
// ToDo: this could be drastically improved if only the changed // ToDo: this could be drastically improved if only the changed
// parts are drawn! Of course, this would only work for the // parts are drawn! Of course, this would only work for the

View File

@ -14,6 +14,7 @@
class DataEditor; class DataEditor;
static const uint32 kMsgBaseType = 'base'; static const uint32 kMsgBaseType = 'base';
static const uint32 kDataViewCursorPosition = 'curs';
enum base_type { enum base_type {
kHexBase, kHexBase,

View File

@ -530,6 +530,23 @@ void
HeaderView::MessageReceived(BMessage *message) HeaderView::MessageReceived(BMessage *message)
{ {
switch (message->what) { 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: case kMsgSliderUpdate:
{ {
off_t position = fPositionSlider->Position(); off_t position = fPositionSlider->Position();
@ -642,6 +659,7 @@ void
ProbeView::AttachedToWindow() ProbeView::AttachedToWindow()
{ {
fEditor.StartWatching(this); fEditor.StartWatching(this);
fDataView->StartWatching(fHeaderView, kDataViewCursorPosition);
// Add menu to window // Add menu to window