Delete key now deletes the item in the preferences table view. We can set
authorKent Sutherland <ksuther@ithinksw.com>
Fri, 19 Sep 2003 01:21:40 +0000 (01:21 +0000)
committerKent Sutherland <ksuther@ithinksw.com>
Fri, 19 Sep 2003 01:21:40 +0000 (01:21 +0000)
up other key commands in the views now too, if needed.

English.lproj/Preferences.nib/classes.nib
English.lproj/Preferences.nib/keyedobjects.nib
PreferencesController.h
PreferencesController.m

index 2c165fa..cfab793 100755 (executable)
@@ -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; 
index 59710a3..249f103 100755 (executable)
Binary files a/English.lproj/Preferences.nib/keyedobjects.nib and b/English.lproj/Preferences.nib/keyedobjects.nib differ
index 1f0094d..0afa851 100755 (executable)
@@ -14,7 +14,7 @@
 
 #import <Cocoa/Cocoa.h>
 
-@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
index 2f1eb9c..c8ac15b 100755 (executable)
@@ -1,6 +1,7 @@
 #import "PreferencesController.h"
 #import "MainController.h"
 #import "StatusWindow.h"
+#import "MyTableView.h"
 
 #import <ITKit/ITHotKeyCenter.h>
 #import <ITKit/ITKeyCombo.h>
@@ -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];