From: Matthew Judy Date: Fri, 12 Sep 2003 22:12:01 +0000 (+0000) Subject: STATUS WINDOWS NOW EXIST IN MENUTUNES. Some work left to do on them, then positioni... X-Git-Tag: v1.0~67 X-Git-Url: http://git.ithinksw.org/MenuTunes.git/commitdiff_plain/97a58d16b59657d99b396a9d7e3ef2eadb357fa8 STATUS WINDOWS NOW EXIST IN MENUTUNES. Some work left to do on them, then positioning, but they're in, and they're hot. --- diff --git a/English.lproj/Preferences.nib/info.nib b/English.lproj/Preferences.nib/info.nib index 4b7fcb4..2aff2c8 100755 --- a/English.lproj/Preferences.nib/info.nib +++ b/English.lproj/Preferences.nib/info.nib @@ -3,9 +3,9 @@ IBDocumentLocation - 4 45 356 240 0 0 1152 746 + 4 4 356 240 0 0 1056 770 IBFramework Version - 291.0 + 286.0 IBGroupedObjects 0 diff --git a/English.lproj/Preferences.nib/keyedobjects.nib b/English.lproj/Preferences.nib/keyedobjects.nib index 5d1895e..62f97d5 100755 Binary files a/English.lproj/Preferences.nib/keyedobjects.nib and b/English.lproj/Preferences.nib/keyedobjects.nib differ diff --git a/MainController.m b/MainController.m index f6838d9..681da56 100755 --- a/MainController.m +++ b/MainController.m @@ -177,7 +177,7 @@ static MainController *sharedController; [self setLatestSongIdentifier:[currentRemote playerStateUniqueIdentifier]]; latestPlaylistClass = [currentRemote currentPlaylistClass]; [menuController rebuildSubmenus]; - + if ( [df boolForKey:@"showSongInfoOnChange"] ) { [self showCurrentTrackInfo]; } @@ -424,12 +424,13 @@ static MainController *sharedController; NSString *title = [currentRemote currentSongTitle]; if ( title ) { - NSString *album = nil; - NSString *artist = nil; - NSString *time = nil; - int trackNumber = 0; - int trackTotal = 0; - int rating = 0; + NSString *album = nil; + NSString *artist = nil; + NSString *time = nil; + int trackNumber = 0; + int trackTotal = 0; + int rating = 0; + ITMTRemotePlayerSource source = [currentRemote currentSource]; if ( [df boolForKey:@"showAlbum"] ) { album = [currentRemote currentSongAlbum]; @@ -458,7 +459,8 @@ static MainController *sharedController; time:time trackNumber:trackNumber trackTotal:trackTotal - rating:rating]; + rating:rating + source:source]; } else { title = NSLocalizedString(@"noSongPlaying", @"No song is playing."); [statusWindowController showSongWindowWithTitle:title @@ -467,7 +469,8 @@ static MainController *sharedController; time:nil trackNumber:0 trackTotal:0 - rating:0]; + rating:0 + source:[currentRemote currentSource]]; } } diff --git a/PreferencesController.m b/PreferencesController.m index 9526d8f..1cc9355 100755 --- a/PreferencesController.m +++ b/PreferencesController.m @@ -1,10 +1,19 @@ #import "PreferencesController.h" #import "MainController.h" +#import "StatusWindow.h" + #import #import #import #import +#import +#import +#import +#import +#import + + #define SENDER_STATE (([sender state] == NSOnState) ? YES : NO) /*************************************************************************/ @@ -93,10 +102,10 @@ static PreferencesController *prefs = nil; [launchPlayerAtLaunchCheckbox setTitle:[NSString stringWithFormat:@"Launch %@ when MenuTunes launches", [[controller currentRemote] playerSimpleName]]]; //This isn't localized... } - [window setLevel:NSStatusWindowLevel]; +// [window setLevel:NSStatusWindowLevel]; [window center]; - [window makeKeyAndOrderFront:self]; [NSApp activateIgnoringOtherApps:YES]; + [window makeKeyAndOrderFront:self]; } - (IBAction)changeGeneralSetting:(id)sender @@ -122,11 +131,14 @@ static PreferencesController *prefs = nil; } else if ( [sender tag] == 1090) { [df setBool:SENDER_STATE forKey:@"showTrackRating"]; } + [df synchronize]; } - (IBAction)changeStatusWindowSetting:(id)sender { + StatusWindow *sw = [StatusWindow sharedWindow]; + if ( [sender tag] == 2010) { [df setInteger:[sender selectedRow] forKey:@"statusWindowVerticalPosition"]; [df setInteger:[sender selectedColumn] forKey:@"statusWindowHorizontalPosition"]; @@ -134,19 +146,61 @@ static PreferencesController *prefs = nil; } else if ( [sender tag] == 2020) { // update screen selection } else if ( [sender tag] == 2030) { - // Update appearance effect + int effectTag = [[sender selectedItem] tag]; + float time = ([df floatForKey:@"statusWindowAppearanceSpeed"] ? [df floatForKey:@"statusWindowAppearanceSpeed"] : 0.8); + [df setInteger:effectTag forKey:@"statusWindowAppearanceEffect"]; + + if ( effectTag == 2100 ) { + [sw setEntryEffect:[[[ITCutWindowEffect alloc] initWithWindow:sw] autorelease]]; + } else if ( effectTag == 2101 ) { + [sw setEntryEffect:[[[ITDissolveWindowEffect alloc] initWithWindow:sw] autorelease]]; + } else if ( effectTag == 2102 ) { + [sw setEntryEffect:[[[ITSlideVerticallyWindowEffect alloc] initWithWindow:sw] autorelease]]; + } else if ( effectTag == 2103 ) { + [sw setEntryEffect:[[[ITSlideHorizontallyWindowEffect alloc] initWithWindow:sw] autorelease]]; + } else if ( effectTag == 2104 ) { + NSLog(@"dflhgldf"); + [sw setEntryEffect:[[[ITPivotWindowEffect alloc] initWithWindow:sw] autorelease]]; + } + + [[sw entryEffect] setEffectTime:time]; + } else if ( [sender tag] == 2040) { - // Update Vanish Effect + int effectTag = [[sender selectedItem] tag]; + float time = ([df floatForKey:@"statusWindowVanishSpeed"] ? [df floatForKey:@"statusWindowVanishSpeed"] : 0.8); + + [df setInteger:[[sender selectedItem] tag] forKey:@"statusWindowVanishEffect"]; + + if ( effectTag == 2100 ) { + [sw setExitEffect:[[[ITCutWindowEffect alloc] initWithWindow:sw] autorelease]]; + } else if ( effectTag == 2101 ) { + [sw setExitEffect:[[[ITDissolveWindowEffect alloc] initWithWindow:sw] autorelease]]; + } else if ( effectTag == 2102 ) { + [sw setExitEffect:[[[ITSlideVerticallyWindowEffect alloc] initWithWindow:sw] autorelease]]; + } else if ( effectTag == 2103 ) { + [sw setExitEffect:[[[ITSlideHorizontallyWindowEffect alloc] initWithWindow:sw] autorelease]]; + } else if ( effectTag == 2104 ) { + [sw setExitEffect:[[[ITPivotWindowEffect alloc] initWithWindow:sw] autorelease]]; + } + + [[sw exitEffect] setEffectTime:time]; + } else if ( [sender tag] == 2050) { - // Update appearance speed + float newTime = (-([sender floatValue])); + [df setFloat:newTime forKey:@"statusWindowAppearanceSpeed"]; + [[sw entryEffect] setEffectTime:newTime]; } else if ( [sender tag] == 2060) { - // Update vanish speed + float newTime = (-([sender floatValue])); + [df setFloat:newTime forKey:@"statusWindowVanishSpeed"]; + [[sw exitEffect] setEffectTime:newTime]; } else if ( [sender tag] == 2070) { - // Update vanish delay + [df setFloat:[sender floatValue] forKey:@"statusWindowVanishDelay"]; + [sw setExitDelay:[sender floatValue]]; } else if ( [sender tag] == 2080) { - // Update "Song Info window when song changes" setting. [df setBool:SENDER_STATE forKey:@"showSongInfoOnChange"]; } + + [df synchronize]; } - (IBAction)changeHotKey:(id)sender diff --git a/StatusWindowController.h b/StatusWindowController.h index 9f474b5..804c090 100755 --- a/StatusWindowController.h +++ b/StatusWindowController.h @@ -13,6 +13,7 @@ #import +#import "ITMTRemote.h" @class StatusWindow; @@ -32,15 +33,17 @@ typedef enum { @interface StatusWindowController : NSObject { StatusWindow *_window; + NSUserDefaults *df; } -- (void)showSongWindowWithTitle:(NSString *)title - album:(NSString *)album - artist:(NSString *)artist - time:(NSString *)time // FLOW: Should probably be NSDate or something. - trackNumber: (int)trackNumber - trackTotal: (int)trackTotal - rating: (int)rating; +- (void)showSongWindowWithTitle: (NSString *)title + album: (NSString *)album + artist: (NSString *)artist + time: (NSString *)time // FLOW: Should probably be NSDate or something. + trackNumber: (int)trackNumber + trackTotal: (int)trackTotal + rating: (int)rating + source:(ITMTRemotePlayerSource)source; - (void)showUpcomingSongsWithTitles:(NSArray *)titleStrings; diff --git a/StatusWindowController.m b/StatusWindowController.m index c22e2a5..146c1a8 100755 --- a/StatusWindowController.m +++ b/StatusWindowController.m @@ -7,20 +7,96 @@ // #import "StatusWindowController.h" +#import "StatusWindow.h" +#import +#import +#import +#import +#import +#import @implementation StatusWindowController -- (void)showSongWindowWithTitle:(NSString *)title - album:(NSString *)album - artist:(NSString *)artist - time:(NSString *)time // FLOW: Should probably be NSDate or something. - trackNumber: (int)trackNumber - trackTotal: (int)trackTotal - rating: (int)rating +- (id)init { + if ( ( self = [super init] ) ) { + + float exitDelay; + int entryTag; + int exitTag; + float entrySpeed; + float exitSpeed; + + ITWindowEffect *entryEffect; + ITWindowEffect *exitEffect; + + _window = [[StatusWindow sharedWindow] retain]; + df = [[NSUserDefaults standardUserDefaults] retain]; + + exitDelay = [df floatForKey:@"statusWindowVanishDelay"]; + entryTag = [df integerForKey:@"statusWindowAppearanceEffect"]; + exitTag = [df integerForKey:@"statusWindowVanishEffect"]; + entrySpeed = [df floatForKey:@"statusWindowAppearanceSpeed"]; + exitSpeed = [df floatForKey:@"statusWindowVanishSpeed"]; + + [_window setExitMode:ITTransientStatusWindowExitAfterDelay]; + [_window setExitDelay:(exitDelay ? exitDelay : 4.0)]; + + if ( entryTag == 2101 ) { + entryEffect = [[[ITDissolveWindowEffect alloc] initWithWindow:_window] autorelease]; + } else if ( entryTag == 2102 ) { + entryEffect = [[[ITSlideVerticallyWindowEffect alloc] initWithWindow:_window] autorelease]; + } else if ( entryTag == 2103 ) { + entryEffect = [[[ITSlideHorizontallyWindowEffect alloc] initWithWindow:_window] autorelease]; + } else if ( entryTag == 2104 ) { + entryEffect = [[[ITPivotWindowEffect alloc] initWithWindow:_window] autorelease]; + } else { + entryEffect = [[[ITCutWindowEffect alloc] initWithWindow:_window] autorelease]; + } + + [_window setEntryEffect:entryEffect]; + + if ( exitTag == 2100 ) { + exitEffect = [[[ITCutWindowEffect alloc] initWithWindow:_window] autorelease]; + } else if ( exitTag == 2102 ) { + exitEffect = [[[ITSlideVerticallyWindowEffect alloc] initWithWindow:_window] autorelease]; + } else if ( exitTag == 2103 ) { + exitEffect = [[[ITSlideHorizontallyWindowEffect alloc] initWithWindow:_window] autorelease]; + } else if ( exitTag == 2104 ) { + exitEffect = [[[ITPivotWindowEffect alloc] initWithWindow:_window] autorelease]; + } else { + exitEffect = [[[ITDissolveWindowEffect alloc] initWithWindow:_window] autorelease]; + } + + [_window setExitEffect:exitEffect]; + + [[_window entryEffect] setEffectTime:(entrySpeed ? entrySpeed : 0.8)]; + [[_window exitEffect] setEffectTime:(exitSpeed ? exitSpeed : 0.8)]; + } + + return self; +} +- (void)dealloc +{ + [_window release]; + [super dealloc]; +} + +- (void)showSongWindowWithTitle: (NSString *)title + album: (NSString *)album + artist: (NSString *)artist + time: (NSString *)time // FLOW: Should probably be NSDate or something. + trackNumber: (int)trackNumber + trackTotal: (int)trackTotal + rating: (int)rating + source:(ITMTRemotePlayerSource)source +{ + [_window setImage:[NSImage imageNamed:@"Library"]]; + [_window setText:title]; + [_window appear:self]; } - (void)showUpcomingSongsWithTitles:(NSArray *)titleStrings