Added missing shortcuts as reported by Oscar.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6853 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
bf26236cc2
commit
f7d4bc0920
@ -110,6 +110,7 @@ class HeaderView : public BView, public BInvoker {
|
|||||||
virtual ~HeaderView();
|
virtual ~HeaderView();
|
||||||
|
|
||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
|
virtual void DetachedFromWindow();
|
||||||
virtual void Draw(BRect updateRect);
|
virtual void Draw(BRect updateRect);
|
||||||
virtual void GetPreferredSize(float *_width, float *_height);
|
virtual void GetPreferredSize(float *_width, float *_height);
|
||||||
virtual void MessageReceived(BMessage *message);
|
virtual void MessageReceived(BMessage *message);
|
||||||
@ -581,6 +582,26 @@ HeaderView::AttachedToWindow()
|
|||||||
fStopButton->SetTarget(Parent());
|
fStopButton->SetTarget(Parent());
|
||||||
fPositionControl->SetTarget(this);
|
fPositionControl->SetTarget(this);
|
||||||
fPositionSlider->SetTarget(this);
|
fPositionSlider->SetTarget(this);
|
||||||
|
|
||||||
|
BMessage *message;
|
||||||
|
Window()->AddShortcut(B_HOME, B_COMMAND_KEY, message = new BMessage(kMsgPositionUpdate), this);
|
||||||
|
message->AddInt64("block", 0);
|
||||||
|
Window()->AddShortcut(B_END, B_COMMAND_KEY, message = new BMessage(kMsgPositionUpdate), this);
|
||||||
|
message->AddInt64("block", -1);
|
||||||
|
Window()->AddShortcut(B_PAGE_UP, B_COMMAND_KEY, message = new BMessage(kMsgPositionUpdate), this);
|
||||||
|
message->AddInt32("delta", -1);
|
||||||
|
Window()->AddShortcut(B_PAGE_DOWN, B_COMMAND_KEY, message = new BMessage(kMsgPositionUpdate), this);
|
||||||
|
message->AddInt32("delta", 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
HeaderView::DetachedFromWindow()
|
||||||
|
{
|
||||||
|
Window()->RemoveShortcut(B_HOME, B_COMMAND_KEY);
|
||||||
|
Window()->RemoveShortcut(B_END, B_COMMAND_KEY);
|
||||||
|
Window()->RemoveShortcut(B_PAGE_UP, B_COMMAND_KEY);
|
||||||
|
Window()->RemoveShortcut(B_PAGE_DOWN, B_COMMAND_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -779,9 +800,11 @@ HeaderView::MessageReceived(BMessage *message)
|
|||||||
int32 delta;
|
int32 delta;
|
||||||
if (message->FindInt64("position", &position) == B_OK)
|
if (message->FindInt64("position", &position) == B_OK)
|
||||||
fPosition = position;
|
fPosition = position;
|
||||||
else if (message->FindInt64("block", &position) == B_OK)
|
else if (message->FindInt64("block", &position) == B_OK) {
|
||||||
|
if (position < 0)
|
||||||
|
position += (fFileSize - 1) / fBlockSize + 1;
|
||||||
fPosition = position * fBlockSize;
|
fPosition = position * fBlockSize;
|
||||||
else if (message->FindInt32("delta", &delta) == B_OK)
|
} else if (message->FindInt32("delta", &delta) == B_OK)
|
||||||
fPosition += delta * off_t(fBlockSize);
|
fPosition += delta * off_t(fBlockSize);
|
||||||
else
|
else
|
||||||
fPosition = strtoll(fPositionControl->Text(), NULL, 0) * fBlockSize;
|
fPosition = strtoll(fPositionControl->Text(), NULL, 0) * fBlockSize;
|
||||||
|
Loading…
Reference in New Issue
Block a user