Skip to content

Commit

Permalink
Fix unknown method warnings with the NSApp delegate
Browse files Browse the repository at this point in the history
- Cast to our custom subclass which does have the methods.
  • Loading branch information
samiamwork committed Jun 23, 2018
1 parent 1ac03c0 commit 4fc9fc3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
50 changes: 25 additions & 25 deletions MMovieView.m
Original file line number Diff line number Diff line change
Expand Up @@ -203,50 +203,50 @@ - (void)keyDown:(NSEvent*)event
BOOL shiftPressed = ([event modifierFlags] & NSShiftKeyMask) ? TRUE : FALSE;
switch (key) {
case ' ' : // space: toggle play/pause
[[NSApp delegate] playAction:self];
[(AppController*)[NSApp delegate] playAction:self];
break;
case NSCarriageReturnCharacter : // return : toggle full-screen
case NSEnterCharacter : // enter (in keypad)
if (_movie) {
[[NSApp delegate] fullScreenAction:self];
[(AppController*)[NSApp delegate] fullScreenAction:self];
}
break;
case 27 : // escape
if ([[NSApp delegate] isFullScreen]) {
[[NSApp delegate] fullScreenAction:self];
if ([(AppController*)[NSApp delegate] isFullScreen]) {
[(AppController*)[NSApp delegate] fullScreenAction:self];
}
else if ([[NSApp delegate] isDesktopBackground]) {
[[NSApp delegate] desktopBackgroundAction:self];
else if ([(AppController*)[NSApp delegate] isDesktopBackground]) {
[(AppController*)[NSApp delegate] desktopBackgroundAction:self];
}
else if (_movie) {
[[NSApp delegate] closeMovie];
[(AppController*)[NSApp delegate] closeMovie];
[self showLogo];
}
else {
[[NSApp mainWindow] performClose:self];
}
break;

case 'n' : case 'N' : [[NSApp delegate] fullNavigationAction:self]; break;
case 'n' : case 'N' : [(AppController*)[NSApp delegate] fullNavigationAction:self]; break;

case '[' : case '{' : [[NSApp delegate] stepBackward]; break;
case ']' : case '}' : [[NSApp delegate] stepForward]; break;
case '[' : case '{' : [(AppController*)[NSApp delegate] stepBackward]; break;
case ']' : case '}' : [(AppController*)[NSApp delegate] stepForward]; break;

case 'c' : case 'C' : [[NSApp delegate] changePlayRate:+1]; break;
case 'x' : case 'X' : [[NSApp delegate] changePlayRate:-1]; break;
case 'z' : case 'Z' : [[NSApp delegate] changePlayRate: 0]; break;
case 'c' : case 'C' : [(AppController*)[NSApp delegate] changePlayRate:+1]; break;
case 'x' : case 'X' : [(AppController*)[NSApp delegate] changePlayRate:-1]; break;
case 'z' : case 'Z' : [(AppController*)[NSApp delegate] changePlayRate: 0]; break;

case 'v' : case 'V' : [[NSApp delegate] changeSubtitleVisible]; break;
case 's' : case 'S' : [[NSApp delegate] changeSubtitleLanguage:-1]; break;
case 'v' : case 'V' : [(AppController*)[NSApp delegate] changeSubtitleVisible]; break;
case 's' : case 'S' : [(AppController*)[NSApp delegate] changeSubtitleLanguage:-1]; break;

case 'l' : case 'L' : [[NSApp delegate] changeLetterBoxHeight]; break;
case 'p' : case 'P' : [[NSApp delegate] changeSubtitlePosition]; break;
case 'l' : case 'L' : [(AppController*)[NSApp delegate] changeLetterBoxHeight]; break;
case 'p' : case 'P' : [(AppController*)[NSApp delegate] changeSubtitlePosition]; break;

case ',' : case '<' : [[NSApp delegate] changeSubtitleSync:-1]; break;
case '.' : case '>' : [[NSApp delegate] changeSubtitleSync:+1]; break;
case '/' : case '?' : [[NSApp delegate] changeSubtitleSync: 0]; break;
case ',' : case '<' : [(AppController*)[NSApp delegate] changeSubtitleSync:-1]; break;
case '.' : case '>' : [(AppController*)[NSApp delegate] changeSubtitleSync:+1]; break;
case '/' : case '?' : [(AppController*)[NSApp delegate] changeSubtitleSync: 0]; break;

case 'm' : case 'M' : [[NSApp delegate] setMuted:![_movie muted]]; break;
case 'm' : case 'M' : [(AppController*)[NSApp delegate] setMuted:![_movie muted]]; break;

case 'i' : case 'I' : [self saveCurrentImage:shiftPressed]; break;
}
Expand All @@ -256,12 +256,12 @@ - (void)mouseDown:(NSEvent*)event
{
//TRACE(@"%s clickCount=%d", __PRETTY_FUNCTION__, [event clickCount]);
if (2 <= [event clickCount]) {
[[NSApp delegate] fullScreenAction:self];
[(AppController*)[NSApp delegate] fullScreenAction:self];
}
else {
int action = [self viewDragActionWithModifierFlags:[event modifierFlags]];
if (action == VIEW_DRAG_ACTION_MOVE_WINDOW) {
if (![[NSApp delegate] isFullScreen]) {
if (![(AppController*)[NSApp delegate] isFullScreen]) {
[[self window] mouseDown:event];
}
}
Expand All @@ -271,7 +271,7 @@ - (void)mouseDown:(NSEvent*)event
- (void)scrollWheel:(NSEvent*)event
{
//TRACE(@"%s", __PRETTY_FUNCTION__);
[[NSApp delegate] scrollWheelAction:event];
[(AppController*)[NSApp delegate] scrollWheelAction:event];
}

////////////////////////////////////////////////////////////////////////////////
Expand All @@ -288,7 +288,7 @@ - (void)windowMoved:(NSNotification*)aNotification
_displayID = displayID;
TRACE(@"main window moved: display changed");
[self updateLetterBoxHeight];
[[NSApp delegate] updateLetterBoxHeightMenuItems];
[(AppController*)[NSApp delegate] updateLetterBoxHeightMenuItems];
}
}

Expand Down
4 changes: 2 additions & 2 deletions MMovieView_Capture.m
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ - (NSString*)fileExtensionForCaptureFormat:(int)format

- (NSString*)capturePathAtDirectory:(NSString*)directory
{
NSString* name = [[[[NSApp delegate] movieURL] path] lastPathComponent];
NSString* name = [[[(AppController*)[NSApp delegate] movieURL] path] lastPathComponent];
NSString* ext = [self fileExtensionForCaptureFormat:_captureFormat];
directory = [[directory stringByExpandingTildeInPath]
stringByAppendingPathComponent:[name stringByDeletingPathExtension]];
Expand Down Expand Up @@ -180,7 +180,7 @@ - (void)mouseDragged:(NSEvent*)event
{
int action = [self viewDragActionWithModifierFlags:[event modifierFlags]];
if (action == VIEW_DRAG_ACTION_MOVE_WINDOW) {
if (![[NSApp delegate] isFullScreen]) {
if (![(AppController*)[NSApp delegate] isFullScreen]) {
[[self window] mouseDragged:event];
}
}
Expand Down

0 comments on commit 4fc9fc3

Please sign in to comment.