From be9387d30d2357b5e583473a7f8d6775f4a77574 Mon Sep 17 00:00:00 2001 From: vspader Date: Thu, 7 Feb 2008 23:57:21 +0000 Subject: [PATCH] Added patch from Andre Reffhaug for ctrl+left/right seeking. --- Application/PlaybackController.h | 2 ++ Application/PlaybackController.m | 34 ++++++++++++++++++++++++++++++++ Playlist/PlaylistView.m | 8 ++++++++ 3 files changed, 44 insertions(+) diff --git a/Application/PlaybackController.h b/Application/PlaybackController.h index 2b20d3a77..a3bba54b2 100644 --- a/Application/PlaybackController.h +++ b/Application/PlaybackController.h @@ -56,6 +56,8 @@ - (IBAction)next:(id)sender; - (IBAction)prev:(id)sender; - (IBAction)seek:(id)sender; +- (IBAction)seekForward:(id)sender; +- (IBAction)seekBackward:(id)sender; - (void)initDefaults; diff --git a/Application/PlaybackController.m b/Application/PlaybackController.m index ad03ad6eb..9ab7ecf9a 100644 --- a/Application/PlaybackController.m +++ b/Application/PlaybackController.m @@ -194,6 +194,40 @@ [self updateTimeField:time]; } +- (IBAction)seekForward:(id)sender +{ + double time; + time = [audioPlayer amountPlayed]; + + if ((time + 10) > (int)[positionSlider maxValue]) + { + [self next:self]; + } + else + { + [audioPlayer seekToTime:time + 10]; + [self updateTimeField:time + 10]; + } +} + +- (IBAction)seekBackward:(id)sender +{ + double time; + time = [audioPlayer amountPlayed]; + + if ((time - 10) < 0) + { + [audioPlayer seekToTime:0]; + [self updateTimeField:0]; + } + else + { + [audioPlayer seekToTime:time - 10]; + [self updateTimeField:time - 10]; + } +} + + - (void)changePlayButtonImage:(NSString *)name { NSImage *img = [NSImage imageNamed:name]; diff --git a/Playlist/PlaylistView.m b/Playlist/PlaylistView.m index 84726583b..985286cbd 100644 --- a/Playlist/PlaylistView.m +++ b/Playlist/PlaylistView.m @@ -197,6 +197,14 @@ else if (modifiers == 0 && c == 0x1b) { //Escape [playlistController clearFilterPredicate:self]; } + else if (modifiers == NSControlKeyMask && c == 0xf703) // right arrow + { + [playbackController seekForward:self]; + } + else if (modifiers == NSControlKeyMask && c == 0xf702) // left arrow + { + [playbackController seekBackward:self]; + } else { [super keyDown:e];