From: Matthew Judy Date: Fri, 11 Apr 2003 11:24:58 +0000 (+0000) Subject: Resolving nib conflict, then adding new stuf in in next checkin X-Git-Tag: v1.0~146 X-Git-Url: http://git.ithinksw.org/MenuTunes.git/commitdiff_plain/e216390f7e2d67e1575743124dbba05f7c1b6094?hp=24a440dccb5f6edb1e324e1cba03f373f89d0c30 Resolving nib conflict, then adding new stuf in in next checkin --- diff --git a/English.lproj/Preferences.nib/classes.nib b/English.lproj/Preferences.nib/classes.nib index 0110c5a..10e4f8f 100755 --- a/English.lproj/Preferences.nib/classes.nib +++ b/English.lproj/Preferences.nib/classes.nib @@ -10,7 +10,11 @@ clearHotKey = id; okHotKey = id; save = id; - setNewHotKey = id; + setCurrentTrackInfo = id; + setNextTrack = id; + setPlayPause = id; + setPreviousTrack = id; + setUpcomingSongs = id; }; CLASS = PreferencesController; LANGUAGE = ObjC; @@ -26,16 +30,10 @@ nextTrackButton = NSButton; playPauseButton = NSButton; previousTrackButton = NSButton; - ratingDecrementButton = NSButton; - ratingIncrementButton = NSButton; songsInAdvance = NSTextField; - toggleLoopButton = NSButton; - toggleShuffleButton = NSButton; trackInfoButton = NSButton; trackTimeCheckbox = NSButton; upcomingSongsButton = NSButton; - volumeDecrementButton = NSButton; - volumeIncrementButton = NSButton; window = NSWindow; }; SUPERCLASS = NSObject; diff --git a/English.lproj/Preferences.nib/info.nib b/English.lproj/Preferences.nib/info.nib index 37f99bc..4a5a843 100755 --- a/English.lproj/Preferences.nib/info.nib +++ b/English.lproj/Preferences.nib/info.nib @@ -3,9 +3,9 @@ IBDocumentLocation - 45 2 356 240 0 0 1152 746 + 371 7 356 240 0 0 1056 770 IBFramework Version - 291.0 + 286.0 IBGroupedObjects 0 @@ -22,10 +22,9 @@ IBOpenObjects - 115 6 IBSystem Version - 6L29 + 6L28 diff --git a/English.lproj/Preferences.nib/keyedobjects.nib b/English.lproj/Preferences.nib/keyedobjects.nib index 5799d5f..654a442 100755 Binary files a/English.lproj/Preferences.nib/keyedobjects.nib and b/English.lproj/Preferences.nib/keyedobjects.nib differ diff --git a/PreferencesController.m b/PreferencesController.m index 3f3a8b3..101b8c7 100755 --- a/PreferencesController.m +++ b/PreferencesController.m @@ -1,6 +1,9 @@ #import "PreferencesController.h" #import "MainController.h" #import "HotKeyCenter.h" +#import + +#define SENDER_STATE (([sender state] == NSOnState) ? YES : NO) /*************************************************************************/ #pragma mark - @@ -12,6 +15,8 @@ - (void)setupCustomizationTables; - (void)setupMenuItems; - (void)setupUI; +- (IBAction)changeMenus:(id)sender; +- (void)setLaunchesAtLogin:(BOOL)flag; @end @@ -87,10 +92,54 @@ static PreferencesController *prefs = nil; [NSApp activateIgnoringOtherApps:YES]; } +- (IBAction)changeGeneralSetting:(id)sender +{ + if ( [sender tag] == 101) { + [self setLaunchesAtLogin:SENDER_STATE]; + } else if ( [sender tag] == 102) { + [df setBool:SENDER_STATE forKey:@"LaunchPlayerWithMT"]; + } else if ( [sender tag] == 103) { + [df setInteger:[sender intValue] forKey:@"SongsInAdvance"]; + } else if ( [sender tag] == 104) { + [df setBool:SENDER_STATE forKey:@"showAlbum"]; + } else if ( [sender tag] == 105) { + [df setBool:SENDER_STATE forKey:@"showName"]; + } else if ( [sender tag] == 106) { + [df setBool:SENDER_STATE forKey:@"showArtist"]; + } else if ( [sender tag] == 107) { + [df setBool:SENDER_STATE forKey:@"showTime"]; + } else if ( [sender tag] == 108) { + [df setBool:SENDER_STATE forKey:@"showTrackNumber"]; + } else if ( [sender tag] == 109) { + [df setBool:SENDER_STATE forKey:@"showTrackRating"]; + } +} + +- (IBAction)changeStatusWindowSetting:(id)sender +{ + if ( [sender tag] == 201) { + [df setInteger:[sender selectedRow] forKey:@"statusWindowVerticalPosition"]; + [df setInteger:[sender selectedColumn] forKey:@"statusWindowHorizontalPosition"]; + // update the window's position here + } else if ( [sender tag] == 202) { + // update screen selection + } else if ( [sender tag] == 203) { + // Update appearance effect + } else if ( [sender tag] == 204) { + // Update Vanish Effect + } else if ( [sender tag] == 205) { + // Update appearance speed + } else if ( [sender tag] == 206) { + // Update vanish speed + } else if ( [sender tag] == 207) { + // Update vanish delay + } else if ( [sender tag] == 208) { + // Update "Song Info window when song changes" setting. + } +} + - (IBAction)apply:(id)sender { - [df setObject:myItems forKey:@"menu"]; - //Set key combos [df setKeyCombo:playPauseCombo forKey:@"PlayPause"]; [df setKeyCombo:nextTrackCombo forKey:@"NextTrack"]; @@ -111,56 +160,6 @@ static PreferencesController *prefs = nil; [df setBool:[trackTimeCheckbox state] forKey:@"showTime"]; //Here we set whether we will launch at login by modifying loginwindow.plist - if ([launchAtLoginCheckbox state] == NSOnState) { - 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); - } - } 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; - } - } - } //Set songs in advance if ([songsInAdvance intValue]) { @@ -712,6 +711,68 @@ static PreferencesController *prefs = nil; } } +- (IBAction)changeMenus:(id)sender +{ + [df setObject:myItems forKey:@"menu"]; + [df synchronize]; + [controller rebuildMenu]; +} + +- (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); + } + + } 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; + } + } + } +} + /*************************************************************************/ #pragma mark - @@ -818,6 +879,7 @@ static PreferencesController *prefs = nil; [menuTableView reloadData]; [allTableView reloadData]; + [self changeMenus:self]; return YES; }