Volume Window s3x. Auto-displayed song info is disabled right now. Will thread...
[MenuTunes.git] / StatusWindowController.m
1 //
2 //  StatusWindowController.m
3 //  MenuTunes
4 //
5 //  Created by Matthew L. Judy on Thu Apr 17 2003.
6 //  Copyright (c) 2003 NibFile.com. All rights reserved.
7 //
8
9 #import "StatusWindowController.h"
10 #import "StatusWindow.h"
11
12 #import <ITKit/ITWindowEffect.h>
13 #import <ITKit/ITCutWindowEffect.h>
14 #import <ITKit/ITDissolveWindowEffect.h>
15 #import <ITKit/ITSlideHorizontallyWindowEffect.h>
16 #import <ITKit/ITSlideVerticallyWindowEffect.h>
17 #import <ITKit/ITPivotWindowEffect.h>
18
19 @implementation StatusWindowController
20
21
22 - (id)init
23 {
24     if ( ( self = [super init] ) ) {
25     
26         float exitDelay;
27         int entryTag;
28         int exitTag;
29         float entrySpeed;
30         float exitSpeed;
31         
32         ITWindowEffect *entryEffect;
33         ITWindowEffect *exitEffect;
34
35         _window = [[StatusWindow sharedWindow] retain];
36         df = [[NSUserDefaults standardUserDefaults] retain];
37
38         exitDelay  = [df floatForKey:@"statusWindowVanishDelay"];
39         entryTag   = [df integerForKey:@"statusWindowAppearanceEffect"];
40         exitTag    = [df integerForKey:@"statusWindowVanishEffect"];
41         entrySpeed = [df floatForKey:@"statusWindowAppearanceSpeed"];
42         exitSpeed  = [df floatForKey:@"statusWindowVanishSpeed"];
43
44         [_window setExitMode:ITTransientStatusWindowExitAfterDelay];
45         [_window setExitDelay:(exitDelay ? exitDelay : 4.0)];
46
47         if ( entryTag == 2101 ) {
48             entryEffect = [[[ITDissolveWindowEffect alloc] initWithWindow:_window] autorelease];
49         } else if ( entryTag == 2102 ) {
50             entryEffect = [[[ITSlideVerticallyWindowEffect alloc] initWithWindow:_window] autorelease];
51         } else if ( entryTag == 2103 ) {
52             entryEffect = [[[ITSlideHorizontallyWindowEffect alloc] initWithWindow:_window] autorelease];
53         } else if ( entryTag == 2104 ) {
54             entryEffect = [[[ITPivotWindowEffect alloc] initWithWindow:_window] autorelease];
55         } else {
56             entryEffect = [[[ITCutWindowEffect alloc] initWithWindow:_window] autorelease];
57         }
58
59         [_window setEntryEffect:entryEffect];
60
61         if ( exitTag == 2100 ) {
62             exitEffect = [[[ITCutWindowEffect alloc] initWithWindow:_window] autorelease];
63         } else if ( exitTag == 2102 ) {
64             exitEffect = [[[ITSlideVerticallyWindowEffect alloc] initWithWindow:_window] autorelease];
65         } else if ( exitTag == 2103 ) {
66             exitEffect = [[[ITSlideHorizontallyWindowEffect alloc] initWithWindow:_window] autorelease];
67         } else if ( exitTag == 2104 ) {
68             exitEffect = [[[ITPivotWindowEffect alloc] initWithWindow:_window] autorelease];
69         } else {
70             exitEffect = [[[ITDissolveWindowEffect alloc] initWithWindow:_window] autorelease];
71         }
72
73         [_window setExitEffect:exitEffect];
74
75         [[_window entryEffect] setEffectTime:(entrySpeed ? entrySpeed : 0.8)];
76         [[_window exitEffect]  setEffectTime:(exitSpeed  ? exitSpeed  : 0.8)];
77     }
78     
79     return self;
80 }
81
82 - (void)dealloc
83 {
84     [_window release];
85     [super dealloc];
86 }
87
88 - (void)showSongWindowWithTitle:            (NSString *)title
89                           album:            (NSString *)album
90                          artist:            (NSString *)artist
91                            time:            (NSString *)time  // FLOW: Should probably be NSDate or something.
92                     trackNumber:                   (int)trackNumber
93                      trackTotal:                   (int)trackTotal
94                          rating:                   (int)rating
95                          source:(ITMTRemotePlayerSource)source
96 {
97     [_window setImage:[NSImage imageNamed:@"Library"]];
98     [_window setText:title];
99     [_window appear:self];
100 }
101
102 - (void)showUpcomingSongsWithTitles:(NSArray *)titleStrings
103 {
104
105 }
106
107 - (void)showVolumeWindowWithLevel:(float)level
108 {
109     [_window setImage:[NSImage imageNamed:@"Volume"]];
110     [_window setVolume:level];
111     [_window appear:self];
112 }
113
114 - (void)showRatingWindowWithLevel:(int)level
115 {
116
117 }
118
119 - (void)showShuffleWindowWithMode:(MTStatusWindowShuffleMode)mode
120 {
121
122 }
123
124 - (void)showLoopWindowWithMode:(MTStatusWindowLoopMode)mode
125 {
126
127 }
128
129 @end