Adding new controller into CVS under the name NewMainController. However, building...
[MenuTunes.git] / OldMainController.m
index b290b3a..dab1899 100755 (executable)
         [notRunningMenu addItemWithTitle:[NSString stringWithFormat:@"Open %@", [currentRemote playerSimpleName]] action:@selector(showPlayer:) keyEquivalent:@""];
         [notRunningMenu addItem:[NSMenuItem separatorItem]];
         [notRunningMenu addItemWithTitle:@"Preferences..." action:@selector(showPreferences:) keyEquivalent:@""];
         [notRunningMenu addItemWithTitle:[NSString stringWithFormat:@"Open %@", [currentRemote playerSimpleName]] action:@selector(showPlayer:) keyEquivalent:@""];
         [notRunningMenu addItem:[NSMenuItem separatorItem]];
         [notRunningMenu addItemWithTitle:@"Preferences..." action:@selector(showPreferences:) keyEquivalent:@""];
-        [notRunningMenu addItemWithTitle:@"Quit" action:@selector(quitMenuTunes:) keyEquivalent:@""];
+        [[notRunningMenu addItemWithTitle:@"Quit" action:@selector(terminate:) keyEquivalent:@""] setTarget:NSApp];
         [statusItem setMenu:[notRunningMenu autorelease]];
         
         [currentRemote halt];
         [statusItem setMenu:[notRunningMenu autorelease]];
         
         [currentRemote halt];
             eqItem = [menu addItemWithTitle:@"EQ Presets"
                     action:nil
                     keyEquivalent:@""];
             eqItem = [menu addItemWithTitle:@"EQ Presets"
                     action:nil
                     keyEquivalent:@""];
-        } else if ([item isEqualToString:@"PreferencesÉ"]) {
-            [menu addItemWithTitle:@"PreferencesÉ"
+        } else if ([item isEqualToString:@"Preferences"]) {
+            [menu addItemWithTitle:@"Preferences"
                     action:@selector(showPreferences:)
                     keyEquivalent:@""];
         } else if ([item isEqualToString:@"Quit"]) {
                     action:@selector(showPreferences:)
                     keyEquivalent:@""];
         } else if ([item isEqualToString:@"Quit"]) {
-            [menu addItemWithTitle:@"Quit"
-                    action:@selector(quitMenuTunes:)
-                    keyEquivalent:@""];
+            [[menu addItemWithTitle:@"Quit"
+                    action:@selector(terminate:)
+                    keyEquivalent:@""] setTarget:NSApp];
         } else if ([item isEqualToString:@"Current Track Info"]) {
             trackInfoIndex = [menu numberOfItems];
             [menu addItemWithTitle:@"No Song"
         } else if ([item isEqualToString:@"Current Track Info"]) {
             trackInfoIndex = [menu numberOfItems];
             [menu addItemWithTitle:@"No Song"
         //
         //
         // If we want to show the new track floater, do it here!
         //
         //
         // If we want to show the new track floater, do it here!
-        //[self showCurrentTrackInfo];
+        //[self showCurrentTrackInfoStatusWindow];
         //
         //
         [self rebuildMenu];
         //
         //
         [self rebuildMenu];
 
 //
 //
 
 //
 //
-- (void)quitMenuTunes:(id)sender
-{
-    [NSApp terminate:self];
-}
 
 - (void)showPlayer:(id)sender
 {
 
 - (void)showPlayer:(id)sender
 {
     [[HotKeyCenter sharedCenter] removeHotKey:@"PlayPause"];
     [[HotKeyCenter sharedCenter] removeHotKey:@"NextTrack"];
     [[HotKeyCenter sharedCenter] removeHotKey:@"PrevTrack"];
     [[HotKeyCenter sharedCenter] removeHotKey:@"PlayPause"];
     [[HotKeyCenter sharedCenter] removeHotKey:@"NextTrack"];
     [[HotKeyCenter sharedCenter] removeHotKey:@"PrevTrack"];
+    [[HotKeyCenter sharedCenter] removeHotKey:@"ToggleVisualizer"];
     [[HotKeyCenter sharedCenter] removeHotKey:@"TrackInfo"];
     [[HotKeyCenter sharedCenter] removeHotKey:@"UpcomingSongs"];
     [[HotKeyCenter sharedCenter] removeHotKey:@"ToggleLoop"];
     [[HotKeyCenter sharedCenter] removeHotKey:@"TrackInfo"];
     [[HotKeyCenter sharedCenter] removeHotKey:@"UpcomingSongs"];
     [[HotKeyCenter sharedCenter] removeHotKey:@"ToggleLoop"];
                 target:self action:@selector(prevSong:)];
     }
     
                 target:self action:@selector(prevSong:)];
     }
     
+    if ([defaults objectForKey:@"ToggleVisualizer"] != nil) {
+        [[HotKeyCenter sharedCenter] addHotKey:@"ToggleVisualizer"
+                combo:[defaults keyComboForKey:@"ToggleVisualizer"]
+                target:self action:@selector(toggleVisualizer)];
+    }
+    
     if ([defaults objectForKey:@"TrackInfo"] != nil) {
         [[HotKeyCenter sharedCenter] addHotKey:@"TrackInfo"
                 combo:[defaults keyComboForKey:@"TrackInfo"]
     if ([defaults objectForKey:@"TrackInfo"] != nil) {
         [[HotKeyCenter sharedCenter] addHotKey:@"TrackInfo"
                 combo:[defaults keyComboForKey:@"TrackInfo"]
-                target:self action:@selector(showCurrentTrackInfo)];
+                target:self action:@selector(showCurrentTrackInfoStatusWindow)];
     }
     
     if ([defaults objectForKey:@"UpcomingSongs"] != nil) {
         [[HotKeyCenter sharedCenter] addHotKey:@"UpcomingSongs"
                combo:[defaults keyComboForKey:@"UpcomingSongs"]
     }
     
     if ([defaults objectForKey:@"UpcomingSongs"] != nil) {
         [[HotKeyCenter sharedCenter] addHotKey:@"UpcomingSongs"
                combo:[defaults keyComboForKey:@"UpcomingSongs"]
-               target:self action:@selector(showUpcomingSongs)];
+               target:self action:@selector(showUpcomingSongsStatusWindow)];
     }
     
     if ([defaults objectForKey:@"ToggleLoop"] != nil) {
     }
     
     if ([defaults objectForKey:@"ToggleLoop"] != nil) {
 //
 //
 
 //
 //
 
-- (void)showCurrentTrackInfo
+- (void)showCurrentTrackInfoStatusWindow
 {
     NSString *trackName = [currentRemote currentSongTitle];
     if (!statusWindow && [trackName length]) {
 {
     NSString *trackName = [currentRemote currentSongTitle];
     if (!statusWindow && [trackName length]) {
     }
 }
 
     }
 }
 
-- (void)showUpcomingSongs
+- (void)showUpcomingSongsStatusWindow
 {
     int curPlaylist = [currentRemote currentPlaylistIndex];
     if (!statusWindow) {
 {
     int curPlaylist = [currentRemote currentPlaylistIndex];
     if (!statusWindow) {
 {
 }
 
 {
 }
 
+- (void)toggleVisualizer
+{
+    NSLog(@"Visualizer On/Off");
+}
+
 - (void)fadeAndCloseStatusWindow
 {
     [statusWindow orderOut:self];
 - (void)fadeAndCloseStatusWindow
 {
     [statusWindow orderOut:self];
         //Space -- ARGH!
         case 49:
         {
         //Space -- ARGH!
         case 49:
         {
-            // Haven't tested this, though it should work.
-            //Doesn't work :(
-            unichar buffer;
-            [[NSString stringWithString:@"Space"] getCharacters:&buffer];
-            charcode = buffer;
             /*MenuRef menuRef = _NSGetCarbonMenu([item menu]);
             /*MenuRef menuRef = _NSGetCarbonMenu([item menu]);
-            NSLog(@"%@", menuRef);
-            SetMenuItemCommandKey(menuRef, 0, NO, 49);
-            SetMenuItemModifiers(menuRef, 0, kMenuNoCommandModifier);
-            SetMenuItemKeyGlyph(menuRef, 0, kMenuBlankGlyph);
-            charcode = 'b';*/
+            SetMenuItemCommandKey(menuRef, 1, NO, 49);
+            SetMenuItemModifiers(menuRef, 1, kMenuNoCommandModifier);
+            SetMenuItemKeyGlyph(menuRef, 1, kMenuBlankGlyph);*/
+            charcode = 'b';
             
         }
         break;
             
         }
         break;