From 0d08f115043188ac3d4c76c39c31508ddc61c3f9 Mon Sep 17 00:00:00 2001 From: "v.audacity" Date: Tue, 14 Feb 2012 00:18:29 +0000 Subject: [PATCH] Fix bug 187. --- src/Project.cpp | 8 ++++++++ src/TrackPanel.cpp | 10 ++++++++++ src/TrackPanel.h | 2 ++ 3 files changed, 20 insertions(+) diff --git a/src/Project.cpp b/src/Project.cpp index f82f360db..c838ff3e8 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -1650,6 +1650,14 @@ bool AudacityProject::HandleKeyDown(wxKeyEvent & event) if (event.GetKeyCode() == WXK_CONTROL) mTrackPanel->HandleControlKey(true); + // Allow PageUp and PageDown keys to + //scroll the Track Panel left and right + if (event.GetKeyCode() == WXK_PAGEUP) + mTrackPanel->HandlePageUpKey(); + + if (event.GetKeyCode() == WXK_PAGEDOWN) + mTrackPanel->HandlePageDownKey(); + // If a window has captured the keyboard, then allow it // first dibs at the event. If it does an event.Skip(false) // then allow the event to process as normal, bypassing the diff --git a/src/TrackPanel.cpp b/src/TrackPanel.cpp index 9a49da9bf..5ebd21138 100644 --- a/src/TrackPanel.cpp +++ b/src/TrackPanel.cpp @@ -1375,6 +1375,16 @@ void TrackPanel::HandleControlKey(bool down) HandleCursorForLastMouseEvent(); } +void TrackPanel::HandlePageUpKey() +{ + mListener->TP_ScrollWindow(mViewInfo->h + mViewInfo->screen); +} + +void TrackPanel::HandlePageDownKey() +{ + mListener->TP_ScrollWindow(mViewInfo->h - mViewInfo->screen); +} + void TrackPanel::HandleCursorForLastMouseEvent() { HandleCursor(mLastMouseEvent); diff --git a/src/TrackPanel.h b/src/TrackPanel.h index 5ef4046ca..00d39aa66 100644 --- a/src/TrackPanel.h +++ b/src/TrackPanel.h @@ -225,6 +225,8 @@ class AUDACITY_DLL_API TrackPanel:public wxPanel { virtual void HandleShiftKey(bool down); virtual void HandleControlKey(bool down); + virtual void HandlePageUpKey(); + virtual void HandlePageDownKey(); virtual AudacityProject * GetProject() const; virtual void OnPrevTrack(bool shift = false);