X-Git-Url: http://git.ithinksw.org/MenuTunes.git/blobdiff_plain/67c27db4fde8f76cff3e419768d8d7a047f4eb50..03b8705191a7570ac7460b3393a4e8f1f49c908c:/MainController.m?ds=sidebyside diff --git a/MainController.m b/MainController.m index 05ef785..eadc1b6 100755 --- a/MainController.m +++ b/MainController.m @@ -10,6 +10,30 @@ #import "StatusWindowController.h" #import "StatusItemHack.h" +@interface NSImage (WeeAdditions) +- (NSImage *)imageScaledSmoothlyToSize:(NSSize)scaledSize; +@end + +@implementation NSImage (WeeAdditions) + +- (NSImage *)imageScaledSmoothlyToSize:(NSSize)scaledSize +{ + NSImage *newImage; + NSImageRep *rep = [self bestRepresentationForDevice:nil]; + + newImage = [[NSImage alloc] initWithSize:scaledSize]; + [newImage lockFocus]; + { + [[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationHigh]; + [[NSGraphicsContext currentContext] setShouldAntialias:YES]; + [rep drawInRect:NSMakeRect(3, 3, scaledSize.width - 6, scaledSize.height - 6)]; + } + [newImage unlockFocus]; + return [newImage autorelease]; +} + +@end + @interface MainController(Private) - (ITMTRemote *)loadRemote; - (void)timerUpdate; @@ -444,8 +468,8 @@ static MainController *sharedController; { ITDebugLog(@"Selecting playlist %i", index); NS_DURING - //[[self currentRemote] switchToPlaylistAtIndex:(index % 1000) ofSourceAtIndex:(index / 1000)]; - [[self currentRemote] switchToPlaylistAtIndex:index]; + [[self currentRemote] switchToPlaylistAtIndex:(index % 1000) ofSourceAtIndex:(index / 1000)]; + //[[self currentRemote] switchToPlaylistAtIndex:index]; NS_HANDLER [self networkError:localException]; NS_ENDHANDLER @@ -498,7 +522,12 @@ static MainController *sharedController; } else { ITDebugLog(@"Launching player."); NS_DURING - if (![[NSWorkspace sharedWorkspace] launchApplication:[[self currentRemote] playerFullName]]) { + NSString *path; + if ( (path = [df stringForKey:@"CustomPlayerPath"]) ) { + } else { + path = [[self currentRemote] playerFullName]; + } + if (![[NSWorkspace sharedWorkspace] launchApplication:path]) { ITDebugLog(@"Error Launching Player"); } NS_HANDLER @@ -785,6 +814,7 @@ static MainController *sharedController; if ( [df boolForKey:@"showAlbumArtwork"] ) { NS_DURING art = [[self currentRemote] currentSongAlbumArt]; + art = [[[[NSImage alloc] initWithData:[art TIFFRepresentation]] autorelease] imageScaledSmoothlyToSize:NSMakeSize(110,110)]; NS_HANDLER [self networkError:localException]; NS_ENDHANDLER @@ -793,7 +823,6 @@ static MainController *sharedController; } else { title = NSLocalizedString(@"noSongPlaying", @"No song is playing."); } - [statusWindowController showSongInfoWindowWithSource:source title:title album:album