All kindza shisnit.
[MenuTunes.git] / PreferencesController.m
index b827375..5999bdf 100755 (executable)
@@ -1,6 +1,7 @@
 #import "PreferencesController.h"
 #import "MainController.h"
 #import "StatusWindow.h"
+#import "StatusWindowController.h"
 #import "CustomMenuTableView.h"
 
 #import <ITKit/ITHotKeyCenter.h>
@@ -105,9 +106,10 @@ static PreferencesController *prefs = nil;
         //Change the launch player checkbox to the proper name
         [launchPlayerAtLaunchCheckbox setTitle:[NSString stringWithFormat:@"Launch %@ when MenuTunes launches", [[controller currentRemote] playerSimpleName]]]; //This isn't localized...
     }
-    [window setLevel:NSStatusWindowLevel];
+
     [window center];
-    [window makeKeyAndOrderFront:self];
+    [NSApp activateIgnoringOtherApps:YES];
+    [window performSelector:@selector(makeKeyAndOrderFront:) withObject:self afterDelay:0.0];
 }
 
 - (IBAction)changeGeneralSetting:(id)sender
@@ -270,22 +272,17 @@ static PreferencesController *prefs = nil;
     id anItem;
     ITDebugLog(@"Registering defaults.");
     [df setObject:[NSArray arrayWithObjects:
+        @"trackInfo",
+        @"separator",
         @"playPause",
         @"prevTrack",
         @"nextTrack",
-        @"fastForward",
-        @"rewind",
-        @"showPlayer",
         @"separator",
-        @"songRating",
-        @"eqPresets",
         @"playlists",
         @"upcomingSongs",
         @"separator",
         @"preferences",
         @"quit",
-        @"separator",
-        @"trackInfo",
         nil] forKey:@"menu"];
 
     [df setInteger:5 forKey:@"SongsInAdvance"];
@@ -294,6 +291,13 @@ static PreferencesController *prefs = nil;
     [df setBool:NO forKey:@"showAlbum"];
     [df setBool:NO forKey:@"showTime"];
 
+    [df setInteger:2100 forKey:@"statusWindowAppearanceEffect"];
+    [df setInteger:2101 forKey:@"statusWindowVanishEffect"];
+    [df setFloat:0.8 forKey:@"statusWindowAppearanceSpeed"];
+    [df setFloat:0.8 forKey:@"statusWindowVanishSpeed"];
+    [df setFloat:4.0 forKey:@"statusWindowVanishDelay"];
+    [df setBool:YES forKey:@"showSongInfoOnChange"];
+
     [df synchronize];
     
     loginWindow = [[df persistentDomainForName:@"loginwindow"] mutableCopy];
@@ -308,12 +312,26 @@ static PreferencesController *prefs = nil;
     [loginWindow release];
     
     if (!found) {
-        if (NSRunInformationalAlertPanel(NSLocalizedString(@"autolaunch", @"Auto-launch MenuTunes"), NSLocalizedString(@"autolaunch_msg", @"Would you like MenuTunes to automatically launch at login?"), @"Yes", @"No", nil) == NSOKButton) {
-            [self setLaunchesAtLogin:YES];
-        }
+        [[StatusWindowController sharedController] showSetupQueryWindow];
     }
 }
 
+- (void)autoLaunchOK
+{
+    [[StatusWindow sharedWindow] setLocked:NO];
+    [[StatusWindow sharedWindow] vanish:self];
+    [[StatusWindow sharedWindow] setIgnoresMouseEvents:YES];
+    
+    [self setLaunchesAtLogin:YES];
+}
+
+- (void)autoLaunchCancel
+{
+    [[StatusWindow sharedWindow] setLocked:NO];
+    [[StatusWindow sharedWindow] vanish:self];
+    [[StatusWindow sharedWindow] setIgnoresMouseEvents:YES];
+}
+
 - (IBAction)cancelHotKey:(id)sender
 {
     ITDebugLog(@"Hot key canceled.");
@@ -707,6 +725,16 @@ static PreferencesController *prefs = nil;
             [launchAtLoginCheckbox setState:NSOnState];
         }
     }
+    
+    // Setup the positioning controls
+    
+    // Setup effects controls
+    [appearanceEffectPopup selectItem:[appearanceEffectPopup itemAtIndex:[appearanceEffectPopup indexOfItemWithTag:[df integerForKey:@"statusWindowAppearanceEffect"]]]];
+    [vanishEffectPopup     selectItem:[vanishEffectPopup     itemAtIndex:[vanishEffectPopup     indexOfItemWithTag:[df integerForKey:@"statusWindowVanishEffect"]]]];
+    [appearanceSpeedSlider setFloatValue:-([df floatForKey:@"statusWindowAppearanceSpeed"])];
+    [vanishSpeedSlider     setFloatValue:-([df floatForKey:@"statusWindowVanishSpeed"])];
+    [vanishDelaySlider     setFloatValue:[df floatForKey:@"statusWindowVanishDelay"]];
+    [showOnChangeCheckbox  setState:([df boolForKey:@"showSongInfoOnChange"] ? NSOnState : NSOffState)];
 }
 
 - (IBAction)changeMenus:(id)sender
@@ -875,7 +903,7 @@ static PreferencesController *prefs = nil;
         
         if ([[[info draggingPasteboard] types] containsObject:@"MenuTableViewPboardType"]) {
             NSString *item = [myItems objectAtIndex:[[[info draggingPasteboard] stringForType:@"MenuTableViewPboardType"] intValue]];
-            if ([item isEqualToString:@"preferences"]) {
+            if ([item isEqualToString:@"preferences"] || [item isEqualToString:@"quit"]) {
                 return NSDragOperationNone;
             }
         }