From: Kent Sutherland Date: Fri, 19 Sep 2003 01:21:40 +0000 (+0000) Subject: Delete key now deletes the item in the preferences table view. We can set X-Git-Tag: v1.0~60 X-Git-Url: http://git.ithinksw.org/MenuTunes.git/commitdiff_plain/8d3dd2ae3b78305f66e06d48770ef24222b7a0ef Delete key now deletes the item in the preferences table view. We can set up other key commands in the views now too, if needed. --- diff --git a/English.lproj/Preferences.nib/classes.nib b/English.lproj/Preferences.nib/classes.nib index 2c165fa..cfab793 100755 --- a/English.lproj/Preferences.nib/classes.nib +++ b/English.lproj/Preferences.nib/classes.nib @@ -2,6 +2,7 @@ IBClasses = ( {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, {CLASS = ITKeyBroadcaster; LANGUAGE = ObjC; SUPERCLASS = NSButton; }, + {CLASS = MyTableView; LANGUAGE = ObjC; SUPERCLASS = NSTableView; }, { ACTIONS = { cancelHotKey = id; diff --git a/English.lproj/Preferences.nib/keyedobjects.nib b/English.lproj/Preferences.nib/keyedobjects.nib index 59710a3..249f103 100755 Binary files a/English.lproj/Preferences.nib/keyedobjects.nib and b/English.lproj/Preferences.nib/keyedobjects.nib differ diff --git a/PreferencesController.h b/PreferencesController.h index 1f0094d..0afa851 100755 --- a/PreferencesController.h +++ b/PreferencesController.h @@ -14,7 +14,7 @@ #import -@class MainController, ITKeyCombo; +@class MyTableView, MainController, ITKeyCombo; @interface PreferencesController : NSObject { @@ -25,7 +25,7 @@ IBOutlet NSPanel *keyComboPanel; IBOutlet NSButton *launchAtLoginCheckbox; IBOutlet NSButton *launchPlayerAtLaunchCheckbox; - IBOutlet NSTableView *menuTableView; + IBOutlet MyTableView *menuTableView; IBOutlet NSButton *nameCheckbox; IBOutlet NSButton *nextTrackButton; IBOutlet NSButton *playPauseButton; @@ -75,4 +75,7 @@ - (void)setCurrentHotKey:(NSString *)key; - (void)setKeyCombo:(ITKeyCombo *)newCombo; + +- (void)deletePressedInTableView:(NSTableView *)tableView; + @end diff --git a/PreferencesController.m b/PreferencesController.m index 2f1eb9c..c8ac15b 100755 --- a/PreferencesController.m +++ b/PreferencesController.m @@ -1,6 +1,7 @@ #import "PreferencesController.h" #import "MainController.h" #import "StatusWindow.h" +#import "MyTableView.h" #import #import @@ -102,9 +103,8 @@ static PreferencesController *prefs = nil; [launchPlayerAtLaunchCheckbox setTitle:[NSString stringWithFormat:@"Launch %@ when MenuTunes launches", [[controller currentRemote] playerSimpleName]]]; //This isn't localized... } -// [window setLevel:NSStatusWindowLevel]; + [window setLevel:NSStatusWindowLevel]; [window center]; - [NSApp activateIgnoringOtherApps:YES]; [window makeKeyAndOrderFront:self]; } @@ -423,6 +423,20 @@ static PreferencesController *prefs = nil; [self cancelHotKey:sender]; } +- (void)deletePressedInTableView:(NSTableView *)tableView +{ + if (tableView == menuTableView) { + int selRow = [tableView selectedRow]; + if (selRow != - 1) { + NSString *object = [myItems objectAtIndex:selRow]; + if (![object isEqualToString:@"separator"]) + [availableItems addObject:object]; + [myItems removeObjectAtIndex:selRow]; + [menuTableView reloadData]; + [allTableView reloadData]; + } + } +} /*************************************************************************/ @@ -497,6 +511,7 @@ static PreferencesController *prefs = nil; id anItem; // Set the list of items you can have. availableItems = [[NSMutableArray alloc] initWithObjects: + @"separator", @"trackInfo", @"upcomingSongs", @"playlists", @@ -508,7 +523,6 @@ static PreferencesController *prefs = nil; @"fastForward", @"rewind", @"showPlayer", - @"separator", @"quit", nil];