From: Kent Sutherland Date: Fri, 30 Jan 2004 02:15:32 +0000 (+0000) Subject: Tweaked the image position in the status window a bit. Added base of the X-Git-Tag: v1.3~53 X-Git-Url: http://git.ithinksw.org/MenuTunes.git/commitdiff_plain/0263903122cd22aefa9620a9497d5f58e332effb Tweaked the image position in the status window a bit. Added base of the scripts. --- diff --git a/English.lproj/Preferences.nib/classes.nib b/English.lproj/Preferences.nib/classes.nib index f19b4b9..56e143d 100755 --- a/English.lproj/Preferences.nib/classes.nib +++ b/English.lproj/Preferences.nib/classes.nib @@ -43,6 +43,7 @@ passwordTextField = NSTextField; positionMatrix = NSMatrix; ratingCheckbox = NSButton; + runScriptsCheckbox = NSButton; selectPlayerBox = NSBox; selectPlayerSheet = NSPanel; selectSharedPlayerButton = NSButton; @@ -51,6 +52,7 @@ sharingPanelOKButton = NSButton; sharingTableView = NSTableView; showOnChangeCheckbox = NSButton; + showScriptsButton = NSButton; songsInAdvance = NSTextField; trackNumberCheckbox = NSButton; trackTimeCheckbox = NSButton; diff --git a/English.lproj/Preferences.nib/info.nib b/English.lproj/Preferences.nib/info.nib index 9d098d2..21ef348 100755 --- a/English.lproj/Preferences.nib/info.nib +++ b/English.lproj/Preferences.nib/info.nib @@ -3,7 +3,7 @@ IBDocumentLocation - 43 33 356 240 0 0 1152 746 + 34 75 356 240 0 0 1152 746 IBEditorPositions 634 diff --git a/English.lproj/Preferences.nib/keyedobjects.nib b/English.lproj/Preferences.nib/keyedobjects.nib index a97e923..b133fd3 100755 Binary files a/English.lproj/Preferences.nib/keyedobjects.nib and b/English.lproj/Preferences.nib/keyedobjects.nib differ diff --git a/MainController.m b/MainController.m index f0ca0f8..307800f 100755 --- a/MainController.m +++ b/MainController.m @@ -92,10 +92,14 @@ static MainController *sharedController; [[PreferencesController sharedPrefs] registerDefaults]; } - [StatusItemHack install]; - statusItem = [[ITStatusItem alloc] - initWithStatusBar:[NSStatusBar systemStatusBar] - withLength:NSSquareStatusItemLength]; + if ([df boolForKey:@"ITMTNoStatusItem"]) { + statusItem = nil; + } else { + [StatusItemHack install]; + statusItem = [[ITStatusItem alloc] + initWithStatusBar:[NSStatusBar systemStatusBar] + withLength:NSSquareStatusItemLength]; + } bling = [[MTBlingController alloc] init]; [self blingTime]; diff --git a/PreferencesController.h b/PreferencesController.h index d409e8b..0730977 100755 --- a/PreferencesController.h +++ b/PreferencesController.h @@ -45,6 +45,7 @@ IBOutlet NSTextField *passwordTextField; IBOutlet NSMatrix *positionMatrix; IBOutlet NSButton *ratingCheckbox; + IBOutlet NSButton *runScriptsCheckbox; IBOutlet NSTextField *selectedPlayerTextField; IBOutlet NSBox *selectPlayerBox; IBOutlet NSPanel *selectPlayerSheet; @@ -53,6 +54,7 @@ IBOutlet NSButton *sharingPanelOKButton; IBOutlet NSTableView *sharingTableView; IBOutlet NSButton *showOnChangeCheckbox; + IBOutlet NSButton *showScriptsButton; IBOutlet NSTextField *songsInAdvance; IBOutlet NSButton *trackNumberCheckbox; IBOutlet NSButton *trackTimeCheckbox; diff --git a/PreferencesController.m b/PreferencesController.m index d731bd2..67cdd56 100755 --- a/PreferencesController.m +++ b/PreferencesController.m @@ -9,6 +9,8 @@ #import #import #import +#import +#import #import @@ -147,10 +149,10 @@ static PreferencesController *prefs = nil; [passwordPanelTitle setStringValue:@"Password Required"]; [passwordPanelMessage setStringValue:[NSString stringWithFormat:@"Please enter a password for access to the MenuTunes player named %@ at %@.", [[[NetworkController sharedController] networkObject] serverName], [[NetworkController sharedController] remoteHost]]]; [passwordPanel setLevel:NSStatusWindowLevel]; - [NSApp activateIgnoringOtherApps: YES]; - [window center]; - [window orderFrontRegardless]; - [window makeKeyWindow]; + [NSApp activateIgnoringOtherApps:YES]; + [passwordPanel center]; + [passwordPanel orderFrontRegardless]; + [passwordPanel makeKeyWindow]; if ([NSApp runModalForWindow:passwordPanel]) { return YES; } else { @@ -165,10 +167,10 @@ static PreferencesController *prefs = nil; [passwordPanelTitle setStringValue:@"Invalid Password"]; [passwordPanelMessage setStringValue:[NSString stringWithFormat:@"The password entered for access to the MenuTunes player named %@ at %@ is invalid. Please provide a new password.", [[[NetworkController sharedController] networkObject] serverName], [[NetworkController sharedController] remoteHost]]]; [passwordPanel setLevel:NSStatusWindowLevel]; - [NSApp activateIgnoringOtherApps: YES]; - [window center]; - [window orderFrontRegardless]; - [window makeKeyWindow]; + [NSApp activateIgnoringOtherApps:YES]; + [passwordPanel center]; + [passwordPanel orderFrontRegardless]; + [passwordPanel makeKeyWindow]; if ([NSApp runModalForWindow:passwordPanel]) { return YES; } else { @@ -197,11 +199,11 @@ static PreferencesController *prefs = nil; } [self resetRemotePlayerTextFields]; - [NSApp activateIgnoringOtherApps: YES]; + [launchAtLoginCheckbox becomeFirstResponder]; + [NSApp activateIgnoringOtherApps:YES]; [window center]; [window orderFrontRegardless]; [window makeKeyWindow]; - [window performSelector:@selector(makeKeyAndOrderFront:) withObject:self afterDelay:0.0]; } - (IBAction)showTestWindow:(id)sender @@ -234,6 +236,17 @@ static PreferencesController *prefs = nil; [df setBool:SENDER_STATE forKey:@"showTrackRating"]; } else if ( [sender tag] == 1100) { [df setBool:SENDER_STATE forKey:@"showAlbumArtwork"]; + } else if ( [sender tag] == 1110) { + [df setBool:SENDER_STATE forKey:@"runScripts"]; + if (SENDER_STATE) { + [runScriptsCheckbox setState:NSOnState]; + [showScriptsButton setEnabled:YES]; + } else { + [showScriptsButton setEnabled:NO]; + } + } else if ( [sender tag] == 1120) { + mkdir([[NSHomeDirectory() stringByAppendingPathComponent:@"Library/Application Support/MenuTunes/Scripts"] cString], 0744); + [[NSWorkspace sharedWorkspace] openFile:[NSHomeDirectory() stringByAppendingPathComponent:@"Library/Application Support/MenuTunes/Scripts"]]; } [df synchronize]; } @@ -783,6 +796,13 @@ static PreferencesController *prefs = nil; [ratingCheckbox setState:[df boolForKey:@"showTrackRating"] ? NSOnState : NSOffState]; [albumArtworkCheckbox setState:[df boolForKey:@"showAlbumArtwork"] ? NSOnState : NSOffState]; + if ([df boolForKey:@"runScripts"]) { + [runScriptsCheckbox setState:NSOnState]; + [showScriptsButton setEnabled:YES]; + } else { + [showScriptsButton setEnabled:NO]; + } + // Set the launch at login checkbox state ITDebugLog(@"Setting launch at login state."); [df synchronize]; diff --git a/StatusWindow.m b/StatusWindow.m index a456861..8e88f47 100755 --- a/StatusWindow.m +++ b/StatusWindow.m @@ -180,7 +180,7 @@ [[[self contentView] subviews] makeObjectsPerformSelector:@selector(removeFromSuperview)]; // Setup, position, fill, and add the image view to the content view. - imageRect = NSMakeRect( (SW_PAD / divisor), + imageRect = NSMakeRect( (SW_PAD / divisor) + 4, ((SW_PAD / divisor) + ((contentHeight - imageHeight) / 2)), imageWidth, imageHeight ); diff --git a/StatusWindowController.m b/StatusWindowController.m index 85d94df..3e7522e 100755 --- a/StatusWindowController.m +++ b/StatusWindowController.m @@ -116,10 +116,13 @@ static StatusWindowController *sharedController; if ( art != nil ) { image = art; NSSize size = [image size]; - if (size.width > 110) { - [image setScalesWhenResized:YES]; + [image setScalesWhenResized:YES]; + [image setSize:NSMakeSize(110, 110)]; + /*if (size.width > 110 && size.width > size.height) { [image setSize:NSMakeSize(110, (size.width / size.height) * 110)]; - } + } else if (size.height > 110 && size.height > size.width) { + [image setSize:NSMakeSize((size.height / size.width) * 110, 110)]; + }*/ } else if ( source == ITMTRemoteLibrarySource ) { image = [NSImage imageNamed:@"Library"]; } else if ( source == ITMTRemoteCDSource ) {