#import "PreferencesController.h"
#import "MainController.h"
+#import "StatusWindow.h"
+
#import <ITKit/ITHotKeyCenter.h>
#import <ITKit/ITKeyCombo.h>
#import <ITKit/ITWindowPositioning.h>
#import <ITKit/ITKeyBroadcaster.h>
+#import <ITKit/ITCutWindowEffect.h>
+#import <ITKit/ITDissolveWindowEffect.h>
+#import <ITKit/ITSlideHorizontallyWindowEffect.h>
+#import <ITKit/ITSlideVerticallyWindowEffect.h>
+#import <ITKit/ITPivotWindowEffect.h>
+
+
#define SENDER_STATE (([sender state] == NSOnState) ? YES : NO)
/*************************************************************************/
[launchPlayerAtLaunchCheckbox setTitle:[NSString stringWithFormat:@"Launch %@ when MenuTunes launches", [[controller currentRemote] playerSimpleName]]]; //This isn't localized...
}
- [window setLevel:NSStatusWindowLevel];
+// [window setLevel:NSStatusWindowLevel];
[window center];
- [window makeKeyAndOrderFront:self];
[NSApp activateIgnoringOtherApps:YES];
+ [window makeKeyAndOrderFront:self];
}
- (IBAction)changeGeneralSetting:(id)sender
} else if ( [sender tag] == 1090) {
[df setBool:SENDER_STATE forKey:@"showTrackRating"];
}
+
[df synchronize];
}
- (IBAction)changeStatusWindowSetting:(id)sender
{
+ StatusWindow *sw = [StatusWindow sharedWindow];
+
if ( [sender tag] == 2010) {
[df setInteger:[sender selectedRow] forKey:@"statusWindowVerticalPosition"];
[df setInteger:[sender selectedColumn] forKey:@"statusWindowHorizontalPosition"];
} else if ( [sender tag] == 2020) {
// update screen selection
} else if ( [sender tag] == 2030) {
- // Update appearance effect
+ int effectTag = [[sender selectedItem] tag];
+ float time = ([df floatForKey:@"statusWindowAppearanceSpeed"] ? [df floatForKey:@"statusWindowAppearanceSpeed"] : 0.8);
+ [df setInteger:effectTag forKey:@"statusWindowAppearanceEffect"];
+
+ if ( effectTag == 2100 ) {
+ [sw setEntryEffect:[[[ITCutWindowEffect alloc] initWithWindow:sw] autorelease]];
+ } else if ( effectTag == 2101 ) {
+ [sw setEntryEffect:[[[ITDissolveWindowEffect alloc] initWithWindow:sw] autorelease]];
+ } else if ( effectTag == 2102 ) {
+ [sw setEntryEffect:[[[ITSlideVerticallyWindowEffect alloc] initWithWindow:sw] autorelease]];
+ } else if ( effectTag == 2103 ) {
+ [sw setEntryEffect:[[[ITSlideHorizontallyWindowEffect alloc] initWithWindow:sw] autorelease]];
+ } else if ( effectTag == 2104 ) {
+ NSLog(@"dflhgldf");
+ [sw setEntryEffect:[[[ITPivotWindowEffect alloc] initWithWindow:sw] autorelease]];
+ }
+
+ [[sw entryEffect] setEffectTime:time];
+
} else if ( [sender tag] == 2040) {
- // Update Vanish Effect
+ int effectTag = [[sender selectedItem] tag];
+ float time = ([df floatForKey:@"statusWindowVanishSpeed"] ? [df floatForKey:@"statusWindowVanishSpeed"] : 0.8);
+
+ [df setInteger:[[sender selectedItem] tag] forKey:@"statusWindowVanishEffect"];
+
+ if ( effectTag == 2100 ) {
+ [sw setExitEffect:[[[ITCutWindowEffect alloc] initWithWindow:sw] autorelease]];
+ } else if ( effectTag == 2101 ) {
+ [sw setExitEffect:[[[ITDissolveWindowEffect alloc] initWithWindow:sw] autorelease]];
+ } else if ( effectTag == 2102 ) {
+ [sw setExitEffect:[[[ITSlideVerticallyWindowEffect alloc] initWithWindow:sw] autorelease]];
+ } else if ( effectTag == 2103 ) {
+ [sw setExitEffect:[[[ITSlideHorizontallyWindowEffect alloc] initWithWindow:sw] autorelease]];
+ } else if ( effectTag == 2104 ) {
+ [sw setExitEffect:[[[ITPivotWindowEffect alloc] initWithWindow:sw] autorelease]];
+ }
+
+ [[sw exitEffect] setEffectTime:time];
+
} else if ( [sender tag] == 2050) {
- // Update appearance speed
+ float newTime = (-([sender floatValue]));
+ [df setFloat:newTime forKey:@"statusWindowAppearanceSpeed"];
+ [[sw entryEffect] setEffectTime:newTime];
} else if ( [sender tag] == 2060) {
- // Update vanish speed
+ float newTime = (-([sender floatValue]));
+ [df setFloat:newTime forKey:@"statusWindowVanishSpeed"];
+ [[sw exitEffect] setEffectTime:newTime];
} else if ( [sender tag] == 2070) {
- // Update vanish delay
+ [df setFloat:[sender floatValue] forKey:@"statusWindowVanishDelay"];
+ [sw setExitDelay:[sender floatValue]];
} else if ( [sender tag] == 2080) {
- // Update "Song Info window when song changes" setting.
[df setBool:SENDER_STATE forKey:@"showSongInfoOnChange"];
}
+
+ [df synchronize];
}
- (IBAction)changeHotKey:(id)sender
@"rewind",
@"showPlayer",
@"separator",
+ @"quit",
nil];
// Get our preferred menu
[artistCheckbox setState:[df boolForKey:@"showArtist"] ? NSOnState : NSOffState];
[trackTimeCheckbox setState:[df boolForKey:@"showTime"] ? NSOnState : NSOffState];
[trackNumberCheckbox setState:[df boolForKey:@"showTrackNumber"] ? NSOnState : NSOffState];
+ [ratingCheckbox setState:[df boolForKey:@"showTrackRating"] ? NSOnState : NSOffState];
// Set the launch at login checkbox state
[df synchronize];
- (void)setLaunchesAtLogin:(BOOL)flag
{
- if ( flag ) {
- NSMutableDictionary *loginwindow;
- NSMutableArray *loginarray;
- ComponentInstance temp = OpenDefaultComponent(kOSAComponentType, kAppleScriptSubtype);
- int i;
- BOOL skip = NO;
-
- [df synchronize];
- loginwindow = [[df persistentDomainForName:@"loginwindow"] mutableCopy];
- loginarray = [loginwindow objectForKey:@"AutoLaunchedApplicationDictionary"];
-
- for (i = 0; i < [loginarray count]; i++) {
- NSDictionary *tempDict = [loginarray objectAtIndex:i];
- if ([[[tempDict objectForKey:@"Path"] lastPathComponent] isEqualToString:[[[NSBundle mainBundle] bundlePath] lastPathComponent]]) {
- skip = YES;
- }
- }
-
- if (!skip) {
- AEDesc scriptDesc, resultDesc;
- NSString *script = [NSString stringWithFormat:@"tell application \"System Events\"\nmake new login item at end of login items with properties {path:\"%@\", kind:\"APPLICATION\"}\nend tell", [[NSBundle mainBundle] bundlePath]];
-
- AECreateDesc(typeChar, [script cString], [script cStringLength],
- &scriptDesc);
-
- OSADoScript(temp, &scriptDesc, kOSANullScript, typeChar, kOSAModeCanInteract, &resultDesc);
-
- AEDisposeDesc(&scriptDesc);
- AEDisposeDesc(&resultDesc);
- CloseComponent(temp);
- }
-
+ NSMutableDictionary *loginwindow;
+ NSMutableArray *loginarray;
+
+ [df synchronize];
+ loginwindow = [[df persistentDomainForName:@"loginwindow"] mutableCopy];
+ loginarray = [loginwindow objectForKey:@"AutoLaunchedApplicationDictionary"];
+
+ if (flag) {
+ NSDictionary *itemDict = [NSDictionary dictionaryWithObjectsAndKeys:
+ [[NSBundle mainBundle] bundlePath], @"Path",
+ [NSNumber numberWithInt:0], @"Hide", nil];
+ [loginarray addObject:itemDict];
} else {
- NSMutableDictionary *loginwindow;
- NSMutableArray *loginarray;
int i;
-
- [df synchronize];
- loginwindow = [[df persistentDomainForName:@"loginwindow"] mutableCopy];
- loginarray = [loginwindow objectForKey:@"AutoLaunchedApplicationDictionary"];
-
for (i = 0; i < [loginarray count]; i++) {
NSDictionary *tempDict = [loginarray objectAtIndex:i];
if ([[[tempDict objectForKey:@"Path"] lastPathComponent] isEqualToString:[[[NSBundle mainBundle] bundlePath] lastPathComponent]]) {
[loginarray removeObjectAtIndex:i];
- [df setPersistentDomain:loginwindow forName:@"loginwindow"];
- [df synchronize];
break;
}
}
}
+ [df setPersistentDomain:loginwindow forName:@"loginwindow"];
+ [df synchronize];
+ [loginwindow release];
}
if ([[[info draggingPasteboard] types] containsObject:@"MenuTableViewPboardType"]) {
NSString *item = [myItems objectAtIndex:[[[info draggingPasteboard] stringForType:@"MenuTableViewPboardType"] intValue]];
- if ([item isEqualToString:@"Preferences"] || [item isEqualToString:@"Quit"]) {
+ if ([item isEqualToString:@"preferences"]) {
return NSDragOperationNone;
}
}