NSFont.
[regBenefits setEditable:NO];
[regBenefits setSelectable:NO];
[regBenefits setDrawsBackground:NO];
- [regBenefits setFont:[NSFont fontWithName:@"Lucida Grande" size:11]];
+ [regBenefits setFont:[NSFont fontWithName:@"LucidaGrande" size:11]];
[[box contentView] addSubview:regBenefits];
enterInfo = [[NSTextField alloc] initWithFrame:NSMakeRect(20, 148, 345, 17)];
if ([[self currentRemote] playerStateUniqueIdentifier] == nil) {
if ([statusItem isEnabled]) {
[statusItem setToolTip:@"iTunes not responding."];
- [self clearHotKeys];
+ [[ITHotKeyCenter sharedCenter] setEnabled:NO];
}
[statusItem setEnabled:NO];
return;
} else if (![statusItem isEnabled]) {
[statusItem setEnabled:YES];
[statusItem setToolTip:_toolTip];
- [self setupHotKeys];
+ [[ITHotKeyCenter sharedCenter] setEnabled:YES];
return;
}
timerUpdating = YES;
[statusItem setEnabled:NO];
-
+
NS_DURING
latestPlaylistClass = [[self currentRemote] currentPlaylistClass];
- [menuController rebuildSubmenus];
-
- if ( [df boolForKey:@"showSongInfoOnChange"] ) {
- [self performSelector:@selector(showCurrentTrackInfo) withObject:nil afterDelay:0.0];
- }
-
- [self setLatestSongIdentifier:[[self currentRemote] playerStateUniqueIdentifier]];
-
- //Create the tooltip for the status item
- if ( [df boolForKey:@"showToolTip"] ) {
- NSString *artist = [[self currentRemote] currentSongArtist];
- NSString *title = [[self currentRemote] currentSongTitle];
- ITDebugLog(@"Creating status item tooltip.");
- if (artist) {
- _toolTip = [NSString stringWithFormat:@"%@ - %@", artist, title];
- } else if (title) {
- _toolTip = title;
- } else {
- _toolTip = @"No Song Playing";
- }
- [statusItem setToolTip:_toolTip];
- } else {
- [statusItem setToolTip:nil];
- }
+
+ if ([menuController rebuildSubmenus]) {
+ if ( [df boolForKey:@"showSongInfoOnChange"] ) {
+ [self performSelector:@selector(showCurrentTrackInfo) withObject:nil afterDelay:0.0];
+ }
+
+ [self setLatestSongIdentifier:[[self currentRemote] playerStateUniqueIdentifier]];
+ //Create the tooltip for the status item
+ if ( [df boolForKey:@"showToolTip"] ) {
+ NSString *artist = [[self currentRemote] currentSongArtist];
+ NSString *title = [[self currentRemote] currentSongTitle];
+ ITDebugLog(@"Creating status item tooltip.");
+ if (artist) {
+ _toolTip = [NSString stringWithFormat:@"%@ - %@", artist, title];
+ } else if (title) {
+ _toolTip = title;
+ } else {
+ _toolTip = @"No Song Playing";
+ }
+ [statusItem setToolTip:_toolTip];
+ } else {
+ [statusItem setToolTip:nil];
+ }
+ }
NS_HANDLER
[self networkError:localException];
NS_ENDHANDLER
-
timerUpdating = NO;
[statusItem setEnabled:YES];
}
-
+
if ([networkController isConnectedToServer]) {
[statusItem setMenu:([[self currentRemote] playerRunningState] == ITMTRemotePlayerRunning) ? [menuController menu] : [menuController menuForNoPlayer]];
}
if ( ([[self currentRemote] playerStateUniqueIdentifier] == nil) && playerRunningState == ITMTRemotePlayerRunning ) {
if ([statusItem isEnabled]) {
[statusItem setToolTip:@"iTunes not responding."];
- [self clearHotKeys];
+ [[ITHotKeyCenter sharedCenter] setEnabled:NO];
}
[statusItem setEnabled:NO];
return;
} else if (![statusItem isEnabled]) {
[statusItem setEnabled:YES];
[statusItem setToolTip:_toolTip];
- [self setupHotKeys];
+ [[ITHotKeyCenter sharedCenter] setEnabled:YES];
return;
}
[self setupHotKeys];
//playerRunningState = ITMTRemotePlayerRunning;
playerRunningState = [[self currentRemote] playerRunningState];
-
+
[refreshTimer invalidate];
refreshTimer = [[NSTimer scheduledTimerWithTimeInterval:([networkController isConnectedToServer] ? 10.0 : 0.5)
target:self
NSMenu *_ratingMenu, *_upcomingSongsMenu, *_eqMenu, *_playlistsMenu, *_artistsMenu, *_albumsMenu; //Submenus
int _currentPlaylist, _currentTrack;
- BOOL _playingRadio;
+ BOOL _playingRadio, _continue;
}
- (NSMenu *)menu;
- (NSMenu *)menuForNoPlayer;
-- (void)rebuildSubmenus;
+- (BOOL)rebuildSubmenus;
// - (NSArray *)menuLayout;
// - (void)setMenuLayout:(NSArray *)newLayoutArray;
return [menu autorelease];
}
-- (void)rebuildSubmenus
+- (BOOL)rebuildSubmenus
{
NSArray *menu = [[NSUserDefaults standardUserDefaults] arrayForKey:@"menu"];
ITDebugLog(@"Rebuilding all of the submenus.");
[[MainController sharedController] networkError:localException];
NS_ENDHANDLER
ITDebugLog(@"Releasing old submenus.");
+ _continue = YES;
ITDebugLog(@" - Rating menu");
[_ratingMenu release];
+ _ratingMenu = nil;
ITDebugLog(@" - Upcoming songs menu");
[_upcomingSongsMenu release];
+ _upcomingSongsMenu = nil;
ITDebugLog(@" - Playlists menu");
[_playlistsMenu release];
+ _playlistsMenu = nil;
ITDebugLog(@" - EQ menu");
[_eqMenu release];
+ _eqMenu = nil;
ITDebugLog(@"Beginning Rebuild of \"Song Rating\" submenu.");
_ratingMenu = [self ratingMenu];
ITDebugLog(@"Beginning Rebuild of \"Upcoming Songs\" submenu.");
_upcomingSongsMenu = [self upcomingSongsMenu];
- ITDebugLog(@"Beginning Rebuild of \"Playlists\" submenu.");
- _playlistsMenu = [self playlistsMenu];
- ITDebugLog(@"Beginning Rebuild of \"EQ Presets\" submenu.");
- _eqMenu = [self eqMenu];
+ if (_continue) {
+ ITDebugLog(@"Beginning Rebuild of \"Playlists\" submenu.");
+ _playlistsMenu = [self playlistsMenu];
+ }
+ if (_continue) {
+ ITDebugLog(@"Beginning Rebuild of \"EQ Presets\" submenu.");
+ _eqMenu = [self eqMenu];
+ }
- if ([menu containsObject:@"artists"]) {
+ if (_continue && [menu containsObject:@"artists"]) {
ITDebugLog(@"Releasing artists menu");
[_artistsMenu release];
ITDebugLog(@"Beginning Rebuild of \"Artists\" submenu.");
_artistsMenu = [self artistsMenu];
}
- if ([menu containsObject:@"albums"]) {
+ if (_continue && [menu containsObject:@"albums"]) {
ITDebugLog(@"Releasing albums menu");
[_albumsMenu release];
ITDebugLog(@"Beginning Rebuild of \"Albums\" submenu.");
_albumsMenu = [self albumsMenu];
}
ITDebugLog(@"Done rebuilding all of the submenus.");
+ return _continue;
}
- (NSMenu *)ratingMenu
[[MainController sharedController] networkError:localException];
NS_ENDHANDLER
+ if (numSongs == -1) {
+ [upcomingSongsMenu release];
+ return nil;
+ }
+ NS_DURING
ITDebugLog(@"Building \"Upcoming Songs\" menu.");
if (_currentPlaylist && !_playingRadio) {
if (numSongs > 0) {
}
}
ITDebugLog(@"Done Building \"Upcoming Songs\" menu.");
- return upcomingSongsMenu;
+ NS_VALUERETURN(upcomingSongsMenu, NSMenu *);
+ NS_HANDLER
+ [upcomingSongsMenu release];
+ _continue = NO;
+ NS_VALUERETURN(nil, NSMenu *);
+ NS_ENDHANDLER
}
/*- (NSMenu *)playlistsMenu
NS_HANDLER
[[MainController sharedController] networkError:localException];
NS_ENDHANDLER
+
+ if (!playlists) {
+ [playlistsMenu release];
+ return nil;
+ }
+
+ NS_DURING
ITDebugLog(@"Building \"Playlists\" menu.");
{
NSArray *curPlaylist = [playlists objectAtIndex:0];
}
}
ITDebugLog(@"Checking the current source.");
+ NS_DURING
if ( (source == ITMTRemoteSharedLibrarySource) || (source == ITMTRemoteiPodSource) || (source == ITMTRemoteGenericDeviceSource) || (source == ITMTRemoteCDSource) ) {
tempItem = [playlistsMenu itemAtIndex:[playlistsMenu numberOfItems] + [indices indexOfObject:[NSNumber numberWithInt:[[[MainController sharedController] currentRemote] currentSourceIndex]]] - [indices count]];
[tempItem setState:NSOnState];
} else if (source == ITMTRemoteLibrarySource && _currentPlaylist) {
[[playlistsMenu itemAtIndex:_currentPlaylist - 1] setState:NSOnState];
}
+ NS_HANDLER
+ NS_ENDHANDLER
[indices release];
tempItem = [playlistsMenu addItemWithTitle:NSLocalizedString(@"refresh", @"Refresh") action:@selector(rebuildSubmenus) keyEquivalent:@""];
[tempItem setTarget:self];
[tempItem setImage:[NSImage imageNamed:@"ChasingArrow"]];
ITDebugLog(@"Done Building \"Playlists\" menu");
- return playlistsMenu;
+ NS_VALUERETURN(playlistsMenu, NSMenu *);
+ NS_HANDLER
+ [playlistsMenu release];
+ _continue = NO;
+ NS_VALUERETURN(nil, NSMenu *);
+ NS_ENDHANDLER
}
- (NSMenu *)eqMenu
buildRules = (
);
buildSettings = {
+ COPY_PHASE_STRIP = YES;
FRAMEWORK_SEARCH_PATHS = "../ITFoundation/build ../ITKit/build";
GCC_ENABLE_TRIGRAPHS = NO;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
divisor = MINI_DIVISOR;
}
- font = [NSFont fontWithName:@"Lucida Grande Bold" size:(baseFontSize / divisor)];
+ font = [NSFont fontWithName:@"LucidaGrande-Bold" size:(baseFontSize / divisor)];
attr = [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName];
// Iterate over each line to get text width and height
divisor = MINI_DIVISOR;
}
- font = [NSFont fontWithName:@"Lucida Grande Bold" size:( size / divisor )];
+ font = [NSFont fontWithName:@"LucidaGrande-Bold" size:( size / divisor )];
attr = [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName];
charSize = [character sizeWithAttributes:attr];
cellHeight = ( charSize.height + 4.0 ); // Add 4.0 for shadow
divisor = MINI_DIVISOR;
}
- font = [NSFont fontWithName:@"Lucida Grande Bold" size:(baseFontSize / divisor)];
+ font = [NSFont fontWithName:@"LucidaGrande-Bold" size:(baseFontSize / divisor)];
attr = [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName];
- buttonFont = [NSFont fontWithName:@"Lucida Grande Bold" size:(14 / divisor)];
+ buttonFont = [NSFont fontWithName:@"LucidaGrande-Bold" size:(14 / divisor)];
buttonAttr = [NSDictionary dictionaryWithObjectsAndKeys:
buttonFont , NSFontAttributeName,
textColor , NSForegroundColorAttributeName,
ITDebugLog(@"Getting playlists.");
if (numSources == 0) {
+ [allSources release];
ITDebugLog(@"No sources.");
return nil;
}
makePlaylistWithTerm:ofType: method.
*/
int temp1;
+ NSAppleEventDescriptor *result;
ITDebugLog(@"Getting number of songs in playlist at index %i", index);
- temp1 = (int)[ITSendAEWithString([NSString stringWithFormat:@"kocl:type('cTrk'), '----':obj { form:'indx', want:type('cPly'), seld:long(%lu), from:obj { form:'prop', want:type('prop'), seld:type('ctnr'), from:obj { form:'prop', want:type('prop'), seld:type('pPla'), from:'null'() } } }", index], 'core', 'cnte', &savedPSN) int32Value];
+ result = ITSendAEWithString([NSString stringWithFormat:@"kocl:type('cTrk'), '----':obj { form:'indx', want:type('cPly'), seld:long(%lu), from:obj { form:'prop', want:type('prop'), seld:type('ctnr'), from:obj { form:'prop', want:type('prop'), seld:type('pPla'), from:'null'() } } }", index], 'core', 'cnte', &savedPSN);
+ temp1 = (result == nil) ? -1 : (int)[result int32Value];
ITDebugLog(@"Getting number of songs in playlist at index %i done", index);
return temp1;
}