3 ¥ Radio mode makes things act oddly
4 ¥ Make preferences window pretty
6 - hot keys can't be set when NSBGOnly is on. The window is not key,
7 so the KeyBroadcaster does not pick up key combos
8 - going to need a different way of defining key combos
10 ¥ Apple Events! Apple Events! Apple Events!
11 ¥ Upcoming songs menu items are disabled after launching iTunes and playing
15 // #import "MenuTunesView.h"
16 #import "PreferencesController.h"
17 #import "HotKeyCenter.h"
18 #import "StatusWindowController.h"
20 @interface MenuTunes(Private)
21 - (void)registerDefaultsIfNeeded;
23 - (void)rebuildUpcomingSongsMenu;
24 - (void)rebuildPlaylistMenu;
25 - (void)rebuildEQPresetsMenu;
27 - (NSString *)runScriptAndReturnResult:(NSString *)script;
29 - (void)sendAEWithEventClass:(AEEventClass)eventClass andEventID:(AEEventID)eventID;
33 @implementation MenuTunes
35 /*************************************************************************/
37 #pragma mark INITIALIZATION METHODS
38 /*************************************************************************/
40 - (void)applicationDidFinishLaunching:(NSNotification *)note
42 asComponent = OpenDefaultComponent(kOSAComponentType, kAppleScriptSubtype);
44 [self registerDefaultsIfNeeded];
46 menu = [[NSMenu alloc] initWithTitle:@""];
47 iTunesPSN = [self iTunesPSN]; //Get PSN of iTunes if it's running
49 if (!((iTunesPSN.highLongOfPSN == kNoProcess) && (iTunesPSN.lowLongOfPSN == 0)))
52 refreshTimer = [NSTimer scheduledTimerWithTimeInterval:3.5
54 selector:@selector(timerUpdate)
60 menu = [[NSMenu alloc] initWithTitle:@""];
61 [[menu addItemWithTitle:@"Open iTunes" action:@selector(openiTunes:) keyEquivalent:@""] setTarget:self];
62 [[menu addItemWithTitle:@"Preferences" action:@selector(showPreferences:) keyEquivalent:@""] setTarget:self];
63 [[menu addItemWithTitle:@"Quit" action:@selector(quitMenuTunes:) keyEquivalent:@""] setTarget:self];
64 [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(iTunesLaunched:) name:NSWorkspaceDidLaunchApplicationNotification object:nil];
68 statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength];
69 [[[statusItem _button] cell] setType:0];
70 [statusItem setImage:[NSImage imageNamed:@"menu"]];
71 [[statusItem _button] setAlternateImage:[NSImage imageNamed:@"selected_image"]];
72 [statusItem setHighlightMode:YES];
73 [statusItem setMenu:menu];
75 // view = [[MenuTunesView alloc] initWithFrame:[[statusItem view] frame]];
76 // [statusItem setView:view];
80 /*************************************************************************/
82 #pragma mark INSTANCE METHODS
83 /*************************************************************************/
85 - (void)registerDefaultsIfNeeded
87 if (![[NSUserDefaults standardUserDefaults] objectForKey:@"menu"]) {
88 [[NSUserDefaults standardUserDefaults] setObject:
89 [NSArray arrayWithObjects:
102 @"Current Track Info",
103 nil] forKey:@"menu"];
107 //Recreate the status item menu
110 NSArray *myMenu = [[NSUserDefaults standardUserDefaults] arrayForKey:@"menu"];
114 didHaveAlbumName = ([[self runScriptAndReturnResult:@"return album of current track"] length] > 0);
116 while ([menu numberOfItems] > 0) {
117 [menu removeItemAtIndex:0];
120 playPauseMenuItem = nil;
121 upcomingSongsItem = nil;
123 [playlistMenu release];
129 for (i = 0; i < [myMenu count]; i++) {
130 NSString *item = [myMenu objectAtIndex:i];
131 if ([item isEqualToString:@"Play/Pause"]) {
132 playPauseMenuItem = [menu addItemWithTitle:@"Play"
133 action:@selector(playPause:)
135 [playPauseMenuItem setTarget:self];
136 } else if ([item isEqualToString:@"Next Track"]) {
137 [[menu addItemWithTitle:@"Next Track"
138 action:@selector(nextSong:)
139 keyEquivalent:@""] setTarget:self];
140 } else if ([item isEqualToString:@"Previous Track"]) {
141 [[menu addItemWithTitle:@"Previous Track"
142 action:@selector(prevSong:)
143 keyEquivalent:@""] setTarget:self];
144 } else if ([item isEqualToString:@"Fast Forward"]) {
145 [[menu addItemWithTitle:@"Fast Forward"
146 action:@selector(fastForward:)
147 keyEquivalent:@""] setTarget:self];
148 } else if ([item isEqualToString:@"Rewind"]) {
149 [[menu addItemWithTitle:@"Rewind"
150 action:@selector(rewind:)
151 keyEquivalent:@""] setTarget:self];
152 } else if ([item isEqualToString:@"Upcoming Songs"]) {
153 upcomingSongsItem = [menu addItemWithTitle:@"Upcoming Songs"
156 } else if ([item isEqualToString:@"Playlists"]) {
157 playlistItem = [menu addItemWithTitle:@"Playlists"
160 } else if ([item isEqualToString:@"EQ Presets"]) {
161 eqItem = [menu addItemWithTitle:@"EQ Presets"
164 } else if ([item isEqualToString:@"PreferencesÉ"]) {
165 [[menu addItemWithTitle:@"PreferencesÉ"
166 action:@selector(showPreferences:)
167 keyEquivalent:@""] setTarget:self];
168 } else if ([item isEqualToString:@"Quit"]) {
169 [[menu addItemWithTitle:@"Quit"
170 action:@selector(quitMenuTunes:)
171 keyEquivalent:@""] setTarget:self];
172 } else if ([item isEqualToString:@"Current Track Info"]) {
173 trackInfoIndex = [menu numberOfItems];
174 [menu addItemWithTitle:@"No Song"
177 } else if ([item isEqualToString:@"<separator>"]) {
178 [menu addItem:[NSMenuItem separatorItem]];
182 curTrackIndex = -1; //Force update of everything
183 [self timerUpdate]; //Updates dynamic info in the menu
189 //Updates the menu with current player state, song, and upcoming songs
192 NSString *curSongName, *curAlbumName;
193 NSMenuItem *menuItem;
195 if ((iTunesPSN.highLongOfPSN == kNoProcess) && (iTunesPSN.lowLongOfPSN == 0)) {
199 //Get the current track name and album.
200 curSongName = [self runScriptAndReturnResult:@"return name of current track"];
201 curAlbumName = [self runScriptAndReturnResult:@"return album of current track"];
203 if (upcomingSongsItem) {
204 [self rebuildUpcomingSongsMenu];
207 [self rebuildPlaylistMenu];
210 [self rebuildEQPresetsMenu];
213 if ([curSongName length] > 0) {
214 int index = [menu indexOfItemWithTitle:@"Now Playing"];
217 [menu removeItemAtIndex:index + 1];
219 if (didHaveAlbumName) {
220 [menu removeItemAtIndex:index + 1];
224 if ([curAlbumName length] > 0) {
225 menuItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@" %@", curAlbumName]
228 [menu insertItem:menuItem atIndex:trackInfoIndex + 1];
232 menuItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@" %@", curSongName]
235 [menu insertItem:menuItem atIndex:trackInfoIndex + 1];
239 menuItem = [[NSMenuItem alloc] initWithTitle:@"Now Playing" action:nil keyEquivalent:@""];
240 [menu removeItemAtIndex:[menu indexOfItemWithTitle:@"No Song"]];
241 [menu insertItem:menuItem atIndex:trackInfoIndex];
245 } else if ([menu indexOfItemWithTitle:@"No Song"] == -1) {
246 [menu removeItemAtIndex:trackInfoIndex];
247 [menu removeItemAtIndex:trackInfoIndex];
249 if (didHaveAlbumName) {
250 [menu removeItemAtIndex:trackInfoIndex];
253 menuItem = [[NSMenuItem alloc] initWithTitle:@"No Song" action:nil keyEquivalent:@""];
254 [menu insertItem:menuItem atIndex:trackInfoIndex];
258 didHaveAlbumName = (([curAlbumName length] > 0) ? YES : NO);
261 //Rebuild the upcoming songs submenu. Can be improved a lot.
262 - (void)rebuildUpcomingSongsMenu
264 int numSongs = [[self runScriptAndReturnResult:@"return number of tracks in current playlist"] intValue];
265 int numSongsInAdvance = [[NSUserDefaults standardUserDefaults] integerForKey:@"SongsInAdvance"];
268 int curTrack = [[self runScriptAndReturnResult:@"return index of current track"] intValue];
271 [upcomingSongsMenu release];
272 upcomingSongsMenu = [[NSMenu alloc] initWithTitle:@""];
274 for (i = curTrack + 1; i <= curTrack + numSongsInAdvance; i++) {
276 NSString *curSong = [self runScriptAndReturnResult:[NSString stringWithFormat:@"return name of track %i of current playlist", i]];
277 NSMenuItem *songItem;
278 songItem = [[NSMenuItem alloc] initWithTitle:curSong action:@selector(playTrack:) keyEquivalent:@""];
279 [songItem setTarget:self];
280 [songItem setRepresentedObject:[NSNumber numberWithInt:i]];
281 [upcomingSongsMenu addItem:songItem];
284 [upcomingSongsMenu addItemWithTitle:@"End of playlist." action:nil keyEquivalent:@""];
288 [upcomingSongsItem setSubmenu:upcomingSongsMenu];
289 [upcomingSongsItem setEnabled:YES];
293 - (void)rebuildPlaylistMenu
295 int numPlaylists = [[self runScriptAndReturnResult:@"return number of playlists"] intValue];
296 int i, curPlaylist = [[self runScriptAndReturnResult:@"return index of current playlist"] intValue];
298 if (playlistMenu && (numPlaylists == [playlistMenu numberOfItems]))
301 [playlistMenu release];
302 playlistMenu = [[NSMenu alloc] initWithTitle:@""];
304 for (i = 1; i <= numPlaylists; i++) {
305 NSString *playlistName = [self runScriptAndReturnResult:[NSString stringWithFormat:@"return name of playlist %i", i]];
306 NSMenuItem *tempItem;
307 tempItem = [[NSMenuItem alloc] initWithTitle:playlistName action:@selector(selectPlaylist:) keyEquivalent:@""];
308 [tempItem setTarget:self];
309 [tempItem setRepresentedObject:[NSNumber numberWithInt:i]];
310 [playlistMenu addItem:tempItem];
313 [playlistItem setSubmenu:playlistMenu];
316 [[playlistMenu itemAtIndex:curPlaylist - 1] setState:NSOnState];
320 //Build a menu with the list of all available EQ presets
321 - (void)rebuildEQPresetsMenu
323 int numSets = [[self runScriptAndReturnResult:@"return number of EQ presets"] intValue];
326 if (eqMenu && (numSets == [eqMenu numberOfItems]))
330 eqMenu = [[NSMenu alloc] initWithTitle:@""];
332 for (i = 1; i <= numSets; i++) {
333 NSString *setName = [self runScriptAndReturnResult:[NSString stringWithFormat:@"return name of EQ preset %i", i]];
334 NSMenuItem *tempItem;
335 tempItem = [[NSMenuItem alloc] initWithTitle:setName action:@selector(selectEQPreset:) keyEquivalent:@""];
336 [tempItem setTarget:self];
337 [tempItem setRepresentedObject:[NSNumber numberWithInt:i]];
338 [eqMenu addItem:tempItem];
341 [eqItem setSubmenu:eqMenu];
343 [[eqMenu itemAtIndex:[[self runScriptAndReturnResult:@"return index of current EQ preset"] intValue] - 1] setState:NSOnState];
348 [[HotKeyCenter sharedCenter] removeHotKey:@"PlayPause"];
349 [[HotKeyCenter sharedCenter] removeHotKey:@"NextTrack"];
350 [[HotKeyCenter sharedCenter] removeHotKey:@"PrevTrack"];
351 [[HotKeyCenter sharedCenter] removeHotKey:@"TrackInfo"];
352 [[HotKeyCenter sharedCenter] removeHotKey:@"UpcomingSongs"];
357 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
359 if ([defaults objectForKey:@"PlayPause"] != nil) {
360 [[HotKeyCenter sharedCenter] addHotKey:@"PlayPause"
361 combo:[defaults keyComboForKey:@"PlayPause"]
362 target:self action:@selector(playPause:)];
365 if ([defaults objectForKey:@"NextTrack"] != nil) {
366 [[HotKeyCenter sharedCenter] addHotKey:@"NextTrack"
367 combo:[defaults keyComboForKey:@"NextTrack"]
368 target:self action:@selector(nextSong:)];
371 if ([defaults objectForKey:@"PrevTrack"] != nil) {
372 [[HotKeyCenter sharedCenter] addHotKey:@"PrevTrack"
373 combo:[defaults keyComboForKey:@"PrevTrack"]
374 target:self action:@selector(prevSong:)];
377 if ([defaults objectForKey:@"TrackInfo"] != nil) {
378 [[HotKeyCenter sharedCenter] addHotKey:@"TrackInfo"
379 combo:[defaults keyComboForKey:@"TrackInfo"]
380 target:self action:@selector(showCurrentTrackInfo)];
383 if ([defaults objectForKey:@"UpcomingSongs"] != nil) {
384 [[HotKeyCenter sharedCenter] addHotKey:@"UpcomingSongs"
385 combo:[defaults keyComboForKey:@"UpcomingSongs"]
386 target:self action:@selector(showUpcomingSongs)];
390 //Runs an AppleScript and returns the result as an NSString after stripping quotes, if needed. It takes in script and automatically adds the tell iTunes and end tell statements.
391 - (NSString *)runScriptAndReturnResult:(NSString *)script
393 AEDesc scriptDesc, resultDesc;
398 script = [NSString stringWithFormat:@"tell application \"iTunes\"\n%@\nend tell", script];
400 AECreateDesc(typeChar, [script cString], [script cStringLength],
403 OSADoScript(asComponent, &scriptDesc, kOSANullScript, typeChar, kOSAModeCanInteract, &resultDesc);
405 length = AEGetDescDataSize(&resultDesc);
406 buffer = malloc(length);
408 AEGetDescData(&resultDesc, buffer, length);
409 AEDisposeDesc(&scriptDesc);
410 AEDisposeDesc(&resultDesc);
411 result = [NSString stringWithCString:buffer length:length];
412 if ( (! [result isEqualToString:@""]) &&
413 ([result characterAtIndex:0] == '\"') &&
414 ([result characterAtIndex:[result length] - 1] == '\"') ) {
415 result = [result substringWithRange:NSMakeRange(1, [result length] - 2)];
422 //Called when the timer fires.
427 if (GetProcessPID(&iTunesPSN, &pid) == noErr) {
428 int trackPlayingIndex = [[self runScriptAndReturnResult:@"return index of current track"] intValue];
430 if (trackPlayingIndex != curTrackIndex) {
432 curTrackIndex = trackPlayingIndex;
435 //Update Play/Pause menu item
436 if (playPauseMenuItem){
437 if ([[self runScriptAndReturnResult:@"return player state"] isEqualToString:@"playing"]) {
438 [playPauseMenuItem setTitle:@"Pause"];
440 [playPauseMenuItem setTitle:@"Play"];
445 menu = [[NSMenu alloc] initWithTitle:@""];
446 [[menu addItemWithTitle:@"Open iTunes" action:@selector(openiTunes:) keyEquivalent:@""] setTarget:self];
447 [[menu addItemWithTitle:@"Preferences" action:@selector(showPreferences:) keyEquivalent:@""] setTarget:self];
448 [[menu addItemWithTitle:@"Quit" action:@selector(quitMenuTunes:) keyEquivalent:@""] setTarget:self];
449 [statusItem setMenu:menu];
451 [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(iTunesLaunched:) name:NSWorkspaceDidLaunchApplicationNotification object:nil];
452 [refreshTimer invalidate];
458 - (void)iTunesLaunched:(NSNotification *)note
460 NSDictionary *info = [note userInfo];
462 iTunesPSN.highLongOfPSN = [[info objectForKey:@"NSApplicationProcessSerialNumberHigh"] longValue];
463 iTunesPSN.lowLongOfPSN = [[info objectForKey:@"NSApplicationProcessSerialNumberLow"] longValue];
466 refreshTimer = [NSTimer scheduledTimerWithTimeInterval:3.5 target:self selector:@selector(timerUpdate) userInfo:nil repeats:YES];
468 [self rebuildMenu]; //Rebuild the menu since no songs will be playing
469 [statusItem setMenu:menu]; //Set the menu back to the main one
470 [[[NSWorkspace sharedWorkspace] notificationCenter] removeObserver:self];
473 //Return the PSN of iTunes, if it's running
474 - (ProcessSerialNumber)iTunesPSN
476 ProcessSerialNumber procNum;
477 procNum.highLongOfPSN = kNoProcess;
478 procNum.lowLongOfPSN = 0;
480 while ( (GetNextProcess(&procNum) == noErr) ) {
481 CFStringRef procName;
482 if ( (CopyProcessName(&procNum, &procName) == noErr) ) {
483 if ([(NSString *)procName isEqualToString:@"iTunes"]) {
486 [(NSString *)procName release];
492 //Send an AppleEvent with a given event ID
493 - (void)sendAEWithEventClass:(AEEventClass)eventClass
494 andEventID:(AEEventID)eventID
496 OSType iTunesType = 'hook';
497 AppleEvent event, reply;
499 AEBuildAppleEvent(eventClass, eventID, typeApplSignature, &iTunesType, sizeof(iTunesType), kAutoGenerateReturnID, kAnyTransactionID, &event, nil, "");
501 AESend(&event, &reply, kAENoReply, kAENormalPriority, kAEDefaultTimeout, nil, nil);
502 AEDisposeDesc(&event);
503 AEDisposeDesc(&reply);
507 // Selectors - called from status item menu
510 - (void)playTrack:(id)sender
512 [self runScriptAndReturnResult:[NSString stringWithFormat:@"play track %i of current playlist", [[sender representedObject] intValue]]];
516 - (void)selectPlaylist:(id)sender
518 int playlist = [[sender representedObject] intValue];
519 [self runScriptAndReturnResult:[NSString stringWithFormat:@"play playlist %i", playlist]];
520 [[playlistMenu itemAtIndex:playlist - 1] setState:NSOnState];
524 - (void)selectEQPreset:(id)sender
526 int curSet = [[self runScriptAndReturnResult:@"return index of current EQ preset"] intValue];
527 int item = [[sender representedObject] intValue];
528 [self runScriptAndReturnResult:[NSString stringWithFormat:@"set current EQ preset to EQ preset %i", item]];
529 [self runScriptAndReturnResult:@"set EQ enabled to 1"];
530 [[eqMenu itemAtIndex:curSet - 1] setState:NSOffState];
531 [[eqMenu itemAtIndex:item - 1] setState:NSOnState];
534 - (void)playPause:(id)sender
536 NSString *state = [self runScriptAndReturnResult:@"return player state"];
537 if ([state isEqualToString:@"playing"]) {
538 [self sendAEWithEventClass:'hook' andEventID:'Paus'];
539 [playPauseMenuItem setTitle:@"Play"];
540 } else if ([state isEqualToString:@"fast forwarding"] || [state
541 isEqualToString:@"rewinding"]) {
542 [self sendAEWithEventClass:'hook' andEventID:'Paus'];
543 [self sendAEWithEventClass:'hook' andEventID:'Play'];
545 [self sendAEWithEventClass:'hook' andEventID:'Play'];
546 [playPauseMenuItem setTitle:@"Pause"];
550 - (void)nextSong:(id)sender
552 [self sendAEWithEventClass:'hook' andEventID:'Next'];
555 - (void)prevSong:(id)sender
557 [self sendAEWithEventClass:'hook' andEventID:'Prev'];
560 - (void)fastForward:(id)sender
562 [self sendAEWithEventClass:'hook' andEventID:'Fast'];
565 - (void)rewind:(id)sender
567 [self sendAEWithEventClass:'hook' andEventID:'Rwnd'];
570 - (void)quitMenuTunes:(id)sender
572 [NSApp terminate:self];
575 - (void)openiTunes:(id)sender
577 [[NSWorkspace sharedWorkspace] launchApplication:@"iTunes"];
580 - (void)showPreferences:(id)sender
582 if (!prefsController) {
583 prefsController = [[PreferencesController alloc] initWithMenuTunes:self];
589 - (void)closePreferences
591 if (!((iTunesPSN.highLongOfPSN == kNoProcess) && (iTunesPSN.lowLongOfPSN == 0))) {
594 [prefsController release];
595 prefsController = nil;
600 // Show Current Track Info And Show Upcoming Songs Floaters
604 - (void)showCurrentTrackInfo
606 NSString *trackName = [self runScriptAndReturnResult:@"return name of current track"];
607 if (!statusController && [trackName length]) {
608 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
609 NSString *stringToShow = @"";
612 if ([defaults boolForKey:@"showName"]) {
613 if ([defaults boolForKey:@"showArtist"]) {
614 NSString *trackArtist = [self runScriptAndReturnResult:@"return artist of current track"];
615 trackName = [NSString stringWithFormat:@"%@ - %@", trackArtist, trackName];
617 stringToShow = [stringToShow stringByAppendingString:trackName];
618 stringToShow = [stringToShow stringByAppendingString:@"\n"];
619 if ([trackName length] > 38) {
625 if ([defaults boolForKey:@"showAlbum"]) {
626 NSString *trackAlbum = [self runScriptAndReturnResult:@"return album of current track"];
627 if ([trackAlbum length]) {
628 stringToShow = [stringToShow stringByAppendingString:trackAlbum];
629 stringToShow = [stringToShow stringByAppendingString:@"\n"];
634 if ([defaults boolForKey:@"showTime"]) {
635 NSString *trackTime = [self runScriptAndReturnResult:@"return time of current track"];
636 if ([trackTime length]) {
637 stringToShow = [NSString stringWithFormat:@"%@Total Time: %@\n", stringToShow, trackTime];
643 int trackTimeLeft = [[self runScriptAndReturnResult:@"return (duration of current track) - player position"] intValue];
644 int minutes = trackTimeLeft / 60, seconds = trackTimeLeft % 60;
646 stringToShow = [stringToShow stringByAppendingString:
647 [NSString stringWithFormat:@"Time Remaining: %i:0%i", minutes, seconds]];
649 stringToShow = [stringToShow stringByAppendingString:
650 [NSString stringWithFormat:@"Time Remaining: %i:%i", minutes, seconds]];
654 statusController = [[StatusWindowController alloc] init];
655 [statusController setTrackInfo:stringToShow lines:lines];
656 [NSTimer scheduledTimerWithTimeInterval:3.0
658 selector:@selector(fadeAndCloseStatusWindow)
664 - (void)showUpcomingSongs
666 if (!statusController) {
667 int numSongs = [[self runScriptAndReturnResult:@"return number of tracks in current playlist"] intValue];
670 int numSongsInAdvance = [[NSUserDefaults standardUserDefaults] integerForKey:@"SongsInAdvance"];
671 int curTrack = [[self runScriptAndReturnResult:@"return index of current track"] intValue];
673 NSString *songs = @"";
675 statusController = [[StatusWindowController alloc] init];
676 for (i = curTrack + 1; i <= curTrack + numSongsInAdvance; i++) {
678 NSString *curSong = [self runScriptAndReturnResult:
679 [NSString stringWithFormat:@"return name of track %i of current playlist", i]];
680 songs = [songs stringByAppendingString:curSong];
681 songs = [songs stringByAppendingString:@"\n"];
684 [statusController setUpcomingSongs:songs numSongs:numSongsInAdvance];
685 [NSTimer scheduledTimerWithTimeInterval:3.0
687 selector:@selector(fadeAndCloseStatusWindow)
694 - (void)fadeAndCloseStatusWindow
696 [statusController fadeWindowOut];
697 [statusController release];
698 statusController = nil;
701 /*************************************************************************/
703 #pragma mark NSApplication DELEGATE METHODS
704 /*************************************************************************/
706 - (void)applicationWillTerminate:(NSNotification *)note
709 [[NSStatusBar systemStatusBar] removeStatusItem:statusItem];
713 /*************************************************************************/
715 #pragma mark DEALLOCATION METHODS
716 /*************************************************************************/
721 [refreshTimer invalidate];
724 CloseComponent(asComponent);
725 [statusItem release];