Adding background style in the General status window settings.
authorMatthew Judy <mjudy@ithinksw.com>
Thu, 20 Nov 2003 07:11:21 +0000 (07:11 +0000)
committerMatthew Judy <mjudy@ithinksw.com>
Thu, 20 Nov 2003 07:11:21 +0000 (07:11 +0000)
English.lproj/Preferences.nib/classes.nib
English.lproj/Preferences.nib/info.nib
English.lproj/Preferences.nib/keyedobjects.nib
MainController.h
MainController.m
PreferencesController.h
PreferencesController.m
StatusWindowController.m

index 2e77833..da4ec7f 100755 (executable)
@@ -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; 
index 9a0e5d1..889762a 100755 (executable)
@@ -3,7 +3,7 @@
 <plist version="1.0">
 <dict>
        <key>IBDocumentLocation</key>
-       <string>6 66 356 240 0 0 1152 746 </string>
+       <string>5 69 356 240 0 0 1056 770 </string>
        <key>IBEditorPositions</key>
        <dict>
                <key>634</key>
index f812308..fe7a69d 100755 (executable)
Binary files a/English.lproj/Preferences.nib/keyedobjects.nib and b/English.lproj/Preferences.nib/keyedobjects.nib differ
index e4eeea2..b03349d 100755 (executable)
@@ -65,6 +65,7 @@
 - (void)selectEQPresetAtIndex:(int)index;
 - (void)showPlayer;
 - (void)showPreferences;
+- (void)showTestWindow;
 - (void)quitMenuTunes;
 
 //
index 1c7905b..bffb59c 100755 (executable)
@@ -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
index 97c5b92..9e71df2 100755 (executable)
@@ -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;
index 01ca498..39c0c9f 100755 (executable)
@@ -16,6 +16,7 @@
 #import <ITKit/ITWindowPositioning.h>
 #import <ITKit/ITKeyBroadcaster.h>
 
+#import <ITKit/ITTSWBackgroundView.h>
 #import <ITKit/ITCutWindowEffect.h>
 #import <ITKit/ITDissolveWindowEffect.h>
 #import <ITKit/ITSlideHorizontallyWindowEffect.h>
@@ -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
index a0ab68c..9e8ffff 100755 (executable)
@@ -3,6 +3,7 @@
 #import "PreferencesController.h"
 #import "MainController.h"
 
+#import <ITKit/ITTSWBackgroundView.h>
 #import <ITKit/ITWindowEffect.h>
 #import <ITKit/ITCutWindowEffect.h>
 #import <ITKit/ITDissolveWindowEffect.h>
@@ -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;