X-Git-Url: http://git.ithinksw.org/MenuTunes.git/blobdiff_plain/6e879de483fcc0349bb3720d1eb8ae74dc6d3803..7ef17aec99c92c9d0d3f9fc29e257e0035de1aa9:/StatusWindowController.m?ds=sidebyside diff --git a/StatusWindowController.m b/StatusWindowController.m index c6a2397..b57fa1e 100755 --- a/StatusWindowController.m +++ b/StatusWindowController.m @@ -12,18 +12,48 @@ return self; } -- (void)setUpcomingSongs:(NSString *)string numSongs:(int)songs +- (void)setUpcomingSongs:(NSString *)string { + int size = 0, i; + NSArray *lines = [string componentsSeparatedByString:@"\n"]; + + for (i = 0; i < [lines count]; i++) { + int temp = [[lines objectAtIndex:i] sizeWithAttributes:[NSDictionary dictionaryWithObject:[NSFont fontWithName:@"Lucida Grande" size:12] forKey:NSFontAttributeName]].width; + + if (temp > size) { + size = temp; + } + } + + if (size < 255) { + size = 255; + } + [statusField setStringValue:string]; - [statusWindow setFrame:NSMakeRect(0, 0, 300, 40 + (songs * 17)) display:NO]; + [statusWindow setFrame:NSMakeRect(0, 0, size + 45, 40 + ([lines count] * 15)) display:YES]; [statusWindow center]; [statusWindow makeKeyAndOrderFront:nil]; } -- (void)setTrackInfo:(NSString *)string lines:(int)lines +- (void)setTrackInfo:(NSString *)string { + int size = 0, i; + NSArray *lines = [string componentsSeparatedByString:@"\n"]; + + for (i = 0; i < [lines count]; i++) { + int temp = [[lines objectAtIndex:i] sizeWithAttributes:[NSDictionary dictionaryWithObject:[NSFont fontWithName:@"Lucida Grande" size:12] forKey:NSFontAttributeName]].width; + + if (temp > size) { + size = temp; + } + } + + if (size < 285) { + size = 285; + } + [statusField setStringValue:string]; - [statusWindow setFrame:NSMakeRect(0, 0, 316, 40 + (lines * 17)) display:NO]; + [statusWindow setFrame:NSMakeRect(0, 0, size + 45, 40 + ([lines count] * 16)) display:NO]; [statusWindow center]; [statusWindow makeKeyAndOrderFront:nil]; } @@ -37,7 +67,7 @@ { NSAutoreleasePool *p00l = [[NSAutoreleasePool alloc] init]; float i; - for (i = 1.0; i > 0; i -= .003) { + for (i = 0.6; i > 0; i -= .004) { [statusWindow setAlphaValue:i]; } [statusWindow close];