Incremental checkin. Updating the StatusWindow and WtatusWindowController objects...
[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)showSongInfoWindowWithSource:(ITMTRemotePlayerSource)source
89                                title:            (NSString *)title
90                                album:            (NSString *)album
91                               artist:            (NSString *)artist
92                                 time:            (NSString *)time  // FLOW: Should probably be NSDate or something.
93                          trackNumber:                   (int)trackNumber
94                           trackTotal:                       (int)trackTotal
95                               rating:                   (int)rating
96 {
97     [_window setImage:[NSImage imageNamed:@"Library"]];
98     [_window buildTextWindowWithString:title];
99     [_window appear:self];
100 }
101
102 - (void)showUpcomingSongsWindowWithTitles:(NSArray *)titleStrings
103 {
104
105 }
106
107 - (void)showVolumeWindowWithLevel:(float)level
108 {
109     [_window setImage:[NSImage imageNamed:@"Volume"]];
110     [_window buildMeterWindowWithCharacter:[NSString stringWithUTF8String:"▊"]
111                                      count:10
112                                     active:( ceil(level * 100) / 10 )];
113     [_window appear:self];
114 }
115
116 - (void)showRatingWindowWithRating:(int)rating
117 {
118
119 }
120
121 - (void)showShuffleWindow:(BOOL)shuffle
122 {
123
124 }
125
126 - (void)showRepeatWindowWithMode:(StatusWindowRepeatMode)mode
127 {
128
129 }
130
131 - (void)showSetupQueryWindow
132 {
133
134 }
135
136
137 @end