X-Git-Url: http://git.ithinksw.org/MenuTunes.git/blobdiff_plain/b936ca5ffb6320a3febce6a7d0c2875b072ac6bc..c92930f48a560adbc8f80ef106a3128cf9c176bf:/StatusWindowController.m diff --git a/StatusWindowController.m b/StatusWindowController.m index c22e2a5..43fdd46 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 @@ -28,9 +104,11 @@ } -- (void)showVolumeWindowWithLevel:(int)level +- (void)showVolumeWindowWithLevel:(float)level { - + [_window setImage:[NSImage imageNamed:@"Volume"]]; + [_window setVolume:level]; + [_window appear:self]; } - (void)showRatingWindowWithLevel:(int)level