diff --git a/Medianno/MADocWindow.h b/Medianno/MADocWindow.h index efc9958..709b9ba 100644 --- a/Medianno/MADocWindow.h +++ b/Medianno/MADocWindow.h @@ -22,4 +22,18 @@ - (void)addMedia:(NSArray *)urls; - (IBAction)addAnnotation:(id)sender; +- (IBAction)hugeSkipBackward:(id)sender; +- (IBAction)largeSkipBackward:(id)sender; +- (IBAction)smallSkipBackward:(id)sender; +- (IBAction)tinySkipBackward:(id)sender; +- (IBAction)hugeSkipForward:(id)sender; +- (IBAction)largeSkipForward:(id)sender; +- (IBAction)smallSkipForward:(id)sender; +- (IBAction)tinySkipForward:(id)sender; +- (IBAction)toggleMediaPlay:(id)sender; + +@end + +@interface MADocumentWindow : NSWindow + @end diff --git a/Medianno/MADocWindow.mm b/Medianno/MADocWindow.mm index 48020b9..eca150c 100644 --- a/Medianno/MADocWindow.mm +++ b/Medianno/MADocWindow.mm @@ -88,6 +88,7 @@ - (IBAction)addAnnotation:(id)sender { + [movieView pause:sender]; QTTime location = [[movieView movie] currentTime]; MAAnno * anno = [[self document] addAnnotationForMedia:[[mediaController selectedObjects] objectAtIndex:0] location:location]; [annotationController setSelectedObjects:[NSArray arrayWithObject:anno]]; @@ -96,6 +97,67 @@ withEvent:nil select:YES]; } +- (IBAction)toggleMediaPlay:(id)sender +{ + if ([[movieView movie] rate] > 0.0f) + [movieView pause:sender]; + else + [movieView play:sender]; +} + +#pragma mark Media navigation + +- (void)skipTimeInterval:(NSTimeInterval)timeInterval +{ + QTTime interval= QTMakeTimeWithTimeInterval(abs(timeInterval)); + QTTime current = [[movieView movie] currentTime]; + if (timeInterval > 0) + current = QTTimeIncrement(current, interval); + else + current = QTTimeDecrement(current, interval); + [[movieView movie] setCurrentTime:current]; +} + +- (IBAction)hugeSkipBackward:(id)sender +{ + [self skipTimeInterval:-15.0*60.0]; +} + +- (IBAction)largeSkipBackward:(id)sender +{ + [self skipTimeInterval:-5.0*60.0]; +} + +- (IBAction)smallSkipBackward:(id)sender +{ + [self skipTimeInterval:-60.0]; +} + +- (IBAction)tinySkipBackward:(id)sender +{ + [self skipTimeInterval:-10.0]; +} + +- (IBAction)tinySkipForward:(id)sender +{ + [self skipTimeInterval:10.0]; +} + +- (IBAction)smallSkipForward:(id)sender +{ + [self skipTimeInterval:60.0]; +} + +- (IBAction)largeSkipForward:(id)sender +{ + [self skipTimeInterval:5.0*60.0]; +} + +- (IBAction)hugeSkipForward:(id)sender +{ + [self skipTimeInterval:15.0*60.0]; +} + #pragma mark Tag token manipulation - (NSString *)tokenFieldCell:(NSTokenFieldCell *)tokenFieldCell displayStringForRepresentedObject:(id)representedObject @@ -131,3 +193,62 @@ } @end + +@implementation MADocumentWindow + +- (void)sendEvent:(NSEvent *)event +{ + + if ([event type] == NSKeyDown && [event modifierFlags] & NSNumericPadKeyMask) { + MADocWindow * controller = [self windowController]; + switch ([[event characters] characterAtIndex:0]) { + case '0': + case '5': + [controller toggleMediaPlay:self]; + return; + case '+': + case 3: + [controller addAnnotation:self]; + return; + case '9': + [controller hugeSkipBackward:self]; + return; + case '8': + [controller largeSkipBackward:self]; + return; + case '7': + [controller smallSkipBackward:self]; + return; + case '4': + [controller tinySkipBackward:self]; + return; + case '6': + [controller tinySkipForward:self]; + return; + case '1': + [controller smallSkipForward:self]; + return; + case '2': + [controller largeSkipForward:self]; + return; + case '3': + [controller hugeSkipForward:self]; + return; + default: + NSBeep(); + return; + } + } + + [super sendEvent:event]; +} + +- (void)keyDown:(NSEvent *)event +{ + if ([[event characters] isEqualToString:@" "]) + [[self windowController] toggleMediaPlay:self]; + else + [super keyDown:event]; +} + +@end diff --git a/Medianno/en.lproj/MADocument.xib b/Medianno/en.lproj/MADocument.xib index ab7c66c..58589ac 100644 --- a/Medianno/en.lproj/MADocument.xib +++ b/Medianno/en.lproj/MADocument.xib @@ -117,7 +117,7 @@ {{133, 235}, {1280, 809}} 1886912512 Window - NSWindow + MADocumentWindow View {94, 86} @@ -316,7 +316,7 @@ 1 15 0 - YES + NO 0 1 @@ -550,7 +550,7 @@ 1 15 0 - YES + NO 0 1 @@ -1469,11 +1469,29 @@ YES addAnnotation: addMediaFiles: + hugeSkipBackward: + hugeSkipForward: + largeSkipBackward: + largeSkipForward: + smallSkipBackward: + smallSkipForward: + tinySkipBackward: + tinySkipForward: + toggleMediaPlay: YES id id + id + id + id + id + id + id + id + id + id @@ -1482,6 +1500,15 @@ YES addAnnotation: addMediaFiles: + hugeSkipBackward: + hugeSkipForward: + largeSkipBackward: + largeSkipForward: + smallSkipBackward: + smallSkipForward: + tinySkipBackward: + tinySkipForward: + toggleMediaPlay: YES @@ -1493,6 +1520,42 @@ addMediaFiles: id + + hugeSkipBackward: + id + + + hugeSkipForward: + id + + + largeSkipBackward: + id + + + largeSkipForward: + id + + + smallSkipBackward: + id + + + smallSkipForward: + id + + + tinySkipBackward: + id + + + tinySkipForward: + id + + + toggleMediaPlay: + id + @@ -1567,6 +1630,14 @@ ./Classes/MADocWindow.h + + MADocumentWindow + NSWindow + + IBProjectSource + ./Classes/MADocumentWindow.h + + 0 diff --git a/Medianno/en.lproj/MainMenu.xib b/Medianno/en.lproj/MainMenu.xib index 73b2225..775d00b 100644 --- a/Medianno/en.lproj/MainMenu.xib +++ b/Medianno/en.lproj/MainMenu.xib @@ -761,14 +761,14 @@ - Annotate + Media 2147483647 submenuAction: - Annotate + Media YES @@ -780,6 +780,122 @@ + + + YES + YES + + + 2147483647 + + + + + + Play + IA + 524288 + 2147483647 + + + + + + Skip + + 2147483647 + + + submenuAction: + + Skip + + YES + + + Back 15m + 1 + 1048576 + 2147483647 + + + + + + Back 5m + 2 + 1048576 + 2147483647 + + + + + + Back 1m + 3 + 1048576 + 2147483647 + + + + + + Back 10s + 4 + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Forward 10s + 5 + 1048576 + 2147483647 + + + + + + Forward 1m + 6 + 1048576 + 2147483647 + + + + + + Forward 5m + 7 + 1048576 + 2147483647 + + + + + + Forward 15m + 8 + 1048576 + 2147483647 + + + + + + @@ -1273,6 +1389,78 @@ 542 + + + hugeSkipBackward: + + + + 546 + + + + toggleMediaPlay: + + + + 564 + + + + largeSkipBackward: + + + + 565 + + + + smallSkipBackward: + + + + 566 + + + + tinySkipBackward: + + + + 567 + + + + tinySkipForward: + + + + 568 + + + + smallSkipForward: + + + + 569 + + + + largeSkipForward: + + + + 570 + + + + hugeSkipForward: + + + + 571 + @@ -1923,6 +2111,9 @@ YES + + + @@ -1941,6 +2132,87 @@ + + 543 + + + YES + + + + + + 544 + + + YES + + + + + + + + + + + + + + 545 + + + + + 547 + + + + + 549 + + + + + 551 + + + + + 553 + + + + + 554 + + + + + 556 + + + + + 558 + + + + + 560 + + + + + 562 + + + + + 563 + + + @@ -2029,7 +2301,20 @@ 538.IBPluginDependency 540.IBPluginDependency 541.IBPluginDependency + 543.IBPluginDependency + 544.IBPluginDependency + 545.IBPluginDependency + 547.IBPluginDependency + 549.IBPluginDependency + 551.IBPluginDependency + 553.IBPluginDependency + 554.IBPluginDependency + 556.IBPluginDependency + 558.IBPluginDependency 56.IBPluginDependency + 560.IBPluginDependency + 562.IBPluginDependency + 563.IBPluginDependency 57.IBPluginDependency 58.IBPluginDependency 72.IBPluginDependency @@ -2142,6 +2427,19 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin @@ -2156,7 +2454,7 @@ - 542 + 571 @@ -2179,113 +2477,6 @@ - - MADocWindow - NSWindowController - - YES - - YES - addAnnotation: - addMediaFiles: - - - YES - id - id - - - - YES - - YES - addAnnotation: - addMediaFiles: - - - YES - - addAnnotation: - id - - - addMediaFiles: - id - - - - - YES - - YES - annotationController - annotationTable - mediaController - mediaTable - movieView - tokenColumn - tokenFieldProto - - - YES - NSArrayController - NSTableView - NSArrayController - NSTableView - QTMovieView - NSTableColumn - NSTokenField - - - - YES - - YES - annotationController - annotationTable - mediaController - mediaTable - movieView - tokenColumn - tokenFieldProto - - - YES - - annotationController - NSArrayController - - - annotationTable - NSTableView - - - mediaController - NSArrayController - - - mediaTable - NSTableView - - - movieView - QTMovieView - - - tokenColumn - NSTableColumn - - - tokenFieldProto - NSTokenField - - - - - IBProjectSource - ./Classes/MADocWindow.h - - 0