From: Matthew Judy Date: Thu, 20 Nov 2003 07:11:21 +0000 (+0000) Subject: Adding background style in the General status window settings. X-Git-Tag: v1.2~32 X-Git-Url: http://git.ithinksw.org/MenuTunes.git/commitdiff_plain/0b83e13fdd374e0ac55397663cedb94bf8df197f Adding background style in the General status window settings. --- diff --git a/English.lproj/Preferences.nib/classes.nib b/English.lproj/Preferences.nib/classes.nib index 2e77833..da4ec7f 100755 --- a/English.lproj/Preferences.nib/classes.nib +++ b/English.lproj/Preferences.nib/classes.nib @@ -11,6 +11,7 @@ clearHotKey = id; editHotKey = id; showPrefsWindow = id; + showTestWindow = id; }; CLASS = PreferencesController; LANGUAGE = ObjC; @@ -20,6 +21,8 @@ appearanceEffectPopup = NSPopUpButton; appearanceSpeedSlider = NSSlider; artistCheckbox = NSButton; + backgroundColorWell = NSColorWell; + backgroundStylePopup = NSPopUpButton; clientPasswordTextField = NSTextField; hostTextField = NSTextField; hotKeysTableView = NSTableView; diff --git a/English.lproj/Preferences.nib/info.nib b/English.lproj/Preferences.nib/info.nib index 9a0e5d1..889762a 100755 --- a/English.lproj/Preferences.nib/info.nib +++ b/English.lproj/Preferences.nib/info.nib @@ -3,7 +3,7 @@ IBDocumentLocation - 6 66 356 240 0 0 1152 746 + 5 69 356 240 0 0 1056 770 IBEditorPositions 634 diff --git a/English.lproj/Preferences.nib/keyedobjects.nib b/English.lproj/Preferences.nib/keyedobjects.nib index f812308..fe7a69d 100755 Binary files a/English.lproj/Preferences.nib/keyedobjects.nib and b/English.lproj/Preferences.nib/keyedobjects.nib differ diff --git a/MainController.h b/MainController.h index e4eeea2..b03349d 100755 --- a/MainController.h +++ b/MainController.h @@ -65,6 +65,7 @@ - (void)selectEQPresetAtIndex:(int)index; - (void)showPlayer; - (void)showPreferences; +- (void)showTestWindow; - (void)quitMenuTunes; // diff --git a/MainController.m b/MainController.m index 1c7905b..bffb59c 100755 --- a/MainController.m +++ b/MainController.m @@ -244,7 +244,7 @@ static MainController *sharedController; - (BOOL)songIsPlaying { - NSString *identifier; + NSString *identifier = nil; NS_DURING identifier = [[self currentRemote] playerStateUniqueIdentifier]; NS_HANDLER @@ -255,7 +255,7 @@ static MainController *sharedController; - (BOOL)radioIsPlaying { - ITMTRemotePlayerPlaylistClass class; + ITMTRemotePlayerPlaylistClass class = nil; NS_DURING class = [[self currentRemote] currentPlaylistClass]; NS_HANDLER @@ -266,7 +266,7 @@ static MainController *sharedController; - (BOOL)songChanged { - NSString *identifier; + NSString *identifier = nil; NS_DURING identifier = [[self currentRemote] playerStateUniqueIdentifier]; NS_HANDLER @@ -476,6 +476,11 @@ static MainController *sharedController; [[PreferencesController sharedPrefs] showPrefsWindow:self]; } +- (void)showTestWindow +{ + [self showCurrentTrackInfo]; +} + - (void)quitMenuTunes { ITDebugLog(@"Quitting MenuTunes."); @@ -648,8 +653,8 @@ static MainController *sharedController; - (void)showCurrentTrackInfo { - ITMTRemotePlayerSource source; - NSString *title; + ITMTRemotePlayerSource source = 0; + NSString *title = nil; NSString *album = nil; NSString *artist = nil; NSString *time = nil; @@ -695,8 +700,8 @@ static MainController *sharedController; } if ( [df boolForKey:@"showTrackNumber"] ) { - int trackNo; - int trackCount; + int trackNo = 0; + int trackCount = 0; NS_DURING trackNo = [[self currentRemote] currentSongTrack]; @@ -712,7 +717,7 @@ static MainController *sharedController; } if ( [df boolForKey:@"showTrackRating"] ) { - float currentRating; + float currentRating = 0; NS_DURING currentRating = [[self currentRemote] currentSongRating]; @@ -740,7 +745,7 @@ static MainController *sharedController; - (void)showUpcomingSongs { - int numSongs; + int numSongs = 0; NS_DURING numSongs = [[self currentRemote] numberOfSongsInPlaylistAtIndex:[[self currentRemote] currentPlaylistIndex]]; NS_HANDLER diff --git a/PreferencesController.h b/PreferencesController.h index 97c5b92..9e71df2 100755 --- a/PreferencesController.h +++ b/PreferencesController.h @@ -23,6 +23,8 @@ IBOutlet NSPopUpButton *appearanceEffectPopup; IBOutlet NSSlider *appearanceSpeedSlider; IBOutlet NSButton *artistCheckbox; + IBOutlet NSPopUpButton *backgroundStylePopup; + IBOutlet NSColorWell *backgroundColorWell; IBOutlet NSTextField *clientPasswordTextField; IBOutlet NSTextField *hostTextField; IBOutlet NSTableView *hotKeysTableView; @@ -85,6 +87,7 @@ - (IBAction)clearHotKey:(id)sender; - (IBAction)editHotKey:(id)sender; - (IBAction)showPrefsWindow:(id)sender; +- (IBAction)showTestWindow:(id)sender; - (void)registerDefaults; - (void)deletePressedInTableView:(NSTableView *)tableView; diff --git a/PreferencesController.m b/PreferencesController.m index 01ca498..39c0c9f 100755 --- a/PreferencesController.m +++ b/PreferencesController.m @@ -16,6 +16,7 @@ #import #import +#import #import #import #import @@ -100,6 +101,7 @@ static PreferencesController *prefs = nil; controller = nil; [self setupWindow]; // Load in the nib, and perform any initial setup. + [[NSColorPanel sharedColorPanel] setShowsAlpha:YES]; } return self; } @@ -184,6 +186,11 @@ static PreferencesController *prefs = nil; [window performSelector:@selector(makeKeyAndOrderFront:) withObject:self afterDelay:0.0]; } +- (IBAction)showTestWindow:(id)sender +{ + [controller showTestWindow]; +} + - (IBAction)changeGeneralSetting:(id)sender { ITDebugLog(@"Changing general setting of tag %i.", [sender tag]); @@ -421,7 +428,28 @@ static PreferencesController *prefs = nil; [sw setExitDelay:[sender floatValue]]; } else if ( [sender tag] == 2080) { [df setBool:SENDER_STATE forKey:@"showSongInfoOnChange"]; + } else if ( [sender tag] == 2090) { + + int setting = [sender indexOfSelectedItem]; + + if ( setting == 0 ) { + [(ITTSWBackgroundView *)[sw contentView] setBackgroundMode:ITTSWBackgroundApple]; + [backgroundColorWell setEnabled:NO]; + } else if ( setting == 1 ) { + [(ITTSWBackgroundView *)[sw contentView] setBackgroundMode:ITTSWBackgroundReadable]; + [backgroundColorWell setEnabled:NO]; + } else if ( setting == 2 ) { + [(ITTSWBackgroundView *)[sw contentView] setBackgroundMode:ITTSWBackgroundColored]; + [backgroundColorWell setEnabled:YES]; + } + + [df setInteger:setting forKey:@"statusWindowBackgroundMode"]; + + } else if ( [sender tag] == 2091) { + [(ITTSWBackgroundView *)[sw contentView] setBackgroundColor:[sender color]]; + [df setObject:[NSArchiver archivedDataWithRootObject:[sender color]] forKey:@"statusWindowBackgroundColor"]; } + [df synchronize]; } @@ -668,6 +696,7 @@ static PreferencesController *prefs = nil; NSMutableArray *loginarray; NSEnumerator *loginEnum, *keyArrayEnum; NSString *serverName; + int selectedBGStyle; id anItem; ITDebugLog(@"Setting up preferences UI."); @@ -721,8 +750,21 @@ static PreferencesController *prefs = nil; [appearanceSpeedSlider setFloatValue:-([df floatForKey:@"statusWindowAppearanceSpeed"])]; [vanishSpeedSlider setFloatValue:-([df floatForKey:@"statusWindowVanishSpeed"])]; [vanishDelaySlider setFloatValue:[df floatForKey:@"statusWindowVanishDelay"]]; - [showOnChangeCheckbox setState:([df boolForKey:@"showSongInfoOnChange"] ? NSOnState : NSOffState)]; + + // Setup General Controls + selectedBGStyle = [df integerForKey:@"statusWindowBackgroundMode"]; + [backgroundStylePopup selectItem:[backgroundStylePopup itemAtIndex:[backgroundStylePopup indexOfItemWithTag:selectedBGStyle]]]; + + if ( selectedBGStyle == ITTSWBackgroundColored ) { + [backgroundColorWell setEnabled:YES]; + } else { + [backgroundColorWell setEnabled:NO]; + } + + [backgroundColorWell setColor:(NSColor *)[NSUnarchiver unarchiveObjectWithData:[df dataForKey:@"statusWindowBackgroundColor"]]]; + [showOnChangeCheckbox setState:([df boolForKey:@"showSongInfoOnChange"] ? NSOnState : NSOffState)]; + // Setup the sharing controls if ([df boolForKey:@"enableSharing"]) { [shareMenuTunesCheckbox setState:NSOnState]; @@ -851,7 +893,7 @@ static PreferencesController *prefs = nil; NSString *object = [myItems objectAtIndex:rowIndex]; if ([[aTableColumn identifier] isEqualToString:@"name"]) { if ([object isEqualToString:@"showPlayer"]) { - NSString *string; + NSString *string = nil; NS_DURING string = [NSString stringWithFormat:@"%@ %@", NSLocalizedString(@"show", @"Show"), [[controller currentRemote] playerSimpleName]]; NS_HANDLER @@ -872,7 +914,7 @@ static PreferencesController *prefs = nil; NSString *object = [availableItems objectAtIndex:rowIndex]; if ([[aTableColumn identifier] isEqualToString:@"name"]) { if ([object isEqualToString:@"showPlayer"]) { - NSString *string; + NSString *string = nil; NS_DURING string = [NSString stringWithFormat:@"%@ %@", NSLocalizedString(@"show", @"Show"), [[controller currentRemote] playerSimpleName]]; NS_HANDLER diff --git a/StatusWindowController.m b/StatusWindowController.m index a0ab68c..9e8ffff 100755 --- a/StatusWindowController.m +++ b/StatusWindowController.m @@ -3,6 +3,7 @@ #import "PreferencesController.h" #import "MainController.h" +#import #import #import #import @@ -85,6 +86,12 @@ static StatusWindowController *sharedController; [[_window entryEffect] setEffectTime:(entrySpeed ? entrySpeed : 0.8)]; [[_window exitEffect] setEffectTime:(exitSpeed ? exitSpeed : 0.8)]; + + [(ITTSWBackgroundView *)[_window contentView]setBackgroundMode: + (ITTSWBackgroundMode)[df integerForKey:@"statusWindowBackgroundMode"]]; + + [(ITTSWBackgroundView *)[_window contentView]setBackgroundColor: + (NSColor *)[NSUnarchiver unarchiveObjectWithData:[df dataForKey:@"statusWindowBackgroundColor"]]]; } return self;