1 #import "PreferencesController.h"
2 #import "MainController.h"
3 #import "StatusWindow.h"
4 #import "StatusWindowController.h"
5 #import "CustomMenuTableView.h"
7 #import <ITKit/ITHotKeyCenter.h>
8 #import <ITKit/ITKeyCombo.h>
9 #import <ITKit/ITKeyComboPanel.h>
10 #import <ITKit/ITWindowPositioning.h>
11 #import <ITKit/ITKeyBroadcaster.h>
13 #import <ITKit/ITCutWindowEffect.h>
14 #import <ITKit/ITDissolveWindowEffect.h>
15 #import <ITKit/ITSlideHorizontallyWindowEffect.h>
16 #import <ITKit/ITSlideVerticallyWindowEffect.h>
17 #import <ITKit/ITPivotWindowEffect.h>
20 #define SENDER_STATE (([sender state] == NSOnState) ? YES : NO)
22 /*************************************************************************/
24 #pragma mark PRIVATE INTERFACE
25 /*************************************************************************/
27 @interface PreferencesController (Private)
29 - (void)setupCustomizationTables;
30 - (void)setupMenuItems;
32 - (IBAction)changeMenus:(id)sender;
33 - (void)setLaunchesAtLogin:(BOOL)flag;
37 @implementation PreferencesController
40 /*************************************************************************/
42 #pragma mark STATIC VARIABLES
43 /*************************************************************************/
45 static PreferencesController *prefs = nil;
48 /*************************************************************************/
50 #pragma mark INITIALIZATION METHODS
51 /*************************************************************************/
53 + (PreferencesController *)sharedPrefs;
56 prefs = [[self alloc] init];
63 if ( (self = [super init]) ) {
64 ITDebugLog(@"Preferences initialized.");
65 df = [[NSUserDefaults standardUserDefaults] retain];
66 hotKeysArray = [[NSArray alloc] initWithObjects:@"PlayPause",
80 hotKeyNamesArray = [[NSArray alloc] initWithObjects:@"Play/Pause",
93 hotKeysDictionary = [[NSMutableDictionary alloc] init];
100 /*************************************************************************/
102 #pragma mark ACCESSOR METHODS
103 /*************************************************************************/
110 - (void)setController:(id)object
112 [controller autorelease];
113 controller = [object retain];
117 /*************************************************************************/
119 #pragma mark INSTANCE METHODS
120 /*************************************************************************/
122 - (IBAction)showPrefsWindow:(id)sender
124 ITDebugLog(@"Showing preferences window.");
125 if (! window) { // If window does not exist yet, then the nib hasn't been loaded.
126 ITDebugLog(@"Window doesn't exist, initial setup.");
127 [self setupWindow]; // Load in the nib, and perform any initial setup.
128 [self setupCustomizationTables]; // Setup the DnD manu config tables.
129 [self setupMenuItems]; // Setup the arrays of menu items
130 [self setupUI]; // Sets up additional UI
131 [window setDelegate:self];
132 [menuTableView reloadData];
133 [hotKeysTableView setDoubleAction:@selector(hotKeysTableViewDoubleClicked:)];
135 //Change the launch player checkbox to the proper name
136 [launchPlayerAtLaunchCheckbox setTitle:[NSString stringWithFormat:@"Launch %@ when MenuTunes launches", [[controller currentRemote] playerSimpleName]]]; //This isn't localized...
140 [NSApp activateIgnoringOtherApps:YES];
141 [window performSelector:@selector(makeKeyAndOrderFront:) withObject:self afterDelay:0.0];
144 - (IBAction)changeGeneralSetting:(id)sender
146 ITDebugLog(@"Changing general setting of tag %i.", [sender tag]);
147 if ( [sender tag] == 1010) {
148 [self setLaunchesAtLogin:SENDER_STATE];
149 } else if ( [sender tag] == 1020) {
150 [df setBool:SENDER_STATE forKey:@"LaunchPlayerWithMT"];
151 } else if ( [sender tag] == 1030) {
152 [df setInteger:[sender intValue] forKey:@"SongsInAdvance"];
154 } else if ( [sender tag] == 1040) {
155 // This will not be executed. Song info always shows the title of the song.
156 // [df setBool:SENDER_STATE forKey:@"showName"];
157 } else if ( [sender tag] == 1050) {
158 [df setBool:SENDER_STATE forKey:@"showArtist"];
159 } else if ( [sender tag] == 1060) {
160 [df setBool:SENDER_STATE forKey:@"showAlbum"];
161 } else if ( [sender tag] == 1070) {
162 [df setBool:SENDER_STATE forKey:@"showTime"];
163 } else if ( [sender tag] == 1080) {
164 [df setBool:SENDER_STATE forKey:@"showTrackNumber"];
165 } else if ( [sender tag] == 1090) {
166 [df setBool:SENDER_STATE forKey:@"showTrackRating"];
171 - (IBAction)changeStatusWindowSetting:(id)sender
173 StatusWindow *sw = [StatusWindow sharedWindow];
174 ITDebugLog(@"Changing status window setting of tag %i", [sender tag]);
175 if ( [sender tag] == 2010) {
176 [df setInteger:[sender selectedRow] forKey:@"statusWindowVerticalPosition"];
177 [df setInteger:[sender selectedColumn] forKey:@"statusWindowHorizontalPosition"];
178 // update the window's position here
179 } else if ( [sender tag] == 2020) {
180 // update screen selection
181 } else if ( [sender tag] == 2030) {
182 int effectTag = [[sender selectedItem] tag];
183 float time = ([df floatForKey:@"statusWindowAppearanceSpeed"] ? [df floatForKey:@"statusWindowAppearanceSpeed"] : 0.8);
184 [df setInteger:effectTag forKey:@"statusWindowAppearanceEffect"];
186 if ( effectTag == 2100 ) {
187 [sw setEntryEffect:[[[ITCutWindowEffect alloc] initWithWindow:sw] autorelease]];
188 } else if ( effectTag == 2101 ) {
189 [sw setEntryEffect:[[[ITDissolveWindowEffect alloc] initWithWindow:sw] autorelease]];
190 } else if ( effectTag == 2102 ) {
191 [sw setEntryEffect:[[[ITSlideVerticallyWindowEffect alloc] initWithWindow:sw] autorelease]];
192 } else if ( effectTag == 2103 ) {
193 [sw setEntryEffect:[[[ITSlideHorizontallyWindowEffect alloc] initWithWindow:sw] autorelease]];
194 } else if ( effectTag == 2104 ) {
196 [sw setEntryEffect:[[[ITPivotWindowEffect alloc] initWithWindow:sw] autorelease]];
199 [[sw entryEffect] setEffectTime:time];
201 } else if ( [sender tag] == 2040) {
202 int effectTag = [[sender selectedItem] tag];
203 float time = ([df floatForKey:@"statusWindowVanishSpeed"] ? [df floatForKey:@"statusWindowVanishSpeed"] : 0.8);
205 [df setInteger:[[sender selectedItem] tag] forKey:@"statusWindowVanishEffect"];
207 if ( effectTag == 2100 ) {
208 [sw setExitEffect:[[[ITCutWindowEffect alloc] initWithWindow:sw] autorelease]];
209 } else if ( effectTag == 2101 ) {
210 [sw setExitEffect:[[[ITDissolveWindowEffect alloc] initWithWindow:sw] autorelease]];
211 } else if ( effectTag == 2102 ) {
212 [sw setExitEffect:[[[ITSlideVerticallyWindowEffect alloc] initWithWindow:sw] autorelease]];
213 } else if ( effectTag == 2103 ) {
214 [sw setExitEffect:[[[ITSlideHorizontallyWindowEffect alloc] initWithWindow:sw] autorelease]];
215 } else if ( effectTag == 2104 ) {
216 [sw setExitEffect:[[[ITPivotWindowEffect alloc] initWithWindow:sw] autorelease]];
219 [[sw exitEffect] setEffectTime:time];
221 } else if ( [sender tag] == 2050) {
222 float newTime = (-([sender floatValue]));
223 [df setFloat:newTime forKey:@"statusWindowAppearanceSpeed"];
224 [[sw entryEffect] setEffectTime:newTime];
225 } else if ( [sender tag] == 2060) {
226 float newTime = (-([sender floatValue]));
227 [df setFloat:newTime forKey:@"statusWindowVanishSpeed"];
228 [[sw exitEffect] setEffectTime:newTime];
229 } else if ( [sender tag] == 2070) {
230 [df setFloat:[sender floatValue] forKey:@"statusWindowVanishDelay"];
231 [sw setExitDelay:[sender floatValue]];
232 } else if ( [sender tag] == 2080) {
233 [df setBool:SENDER_STATE forKey:@"showSongInfoOnChange"];
238 - (void)registerDefaults
241 NSMutableDictionary *loginWindow;
242 NSMutableArray *loginArray;
243 NSEnumerator *loginEnum;
245 ITDebugLog(@"Registering defaults.");
246 [df setObject:[NSArray arrayWithObjects:
258 nil] forKey:@"menu"];
260 [df setInteger:5 forKey:@"SongsInAdvance"];
261 // [df setBool:YES forKey:@"showName"]; // Song info will always show song title.
262 [df setBool:YES forKey:@"showArtist"];
263 [df setBool:NO forKey:@"showAlbum"];
264 [df setBool:NO forKey:@"showTime"];
266 [df setInteger:2100 forKey:@"statusWindowAppearanceEffect"];
267 [df setInteger:2101 forKey:@"statusWindowVanishEffect"];
268 [df setFloat:0.8 forKey:@"statusWindowAppearanceSpeed"];
269 [df setFloat:0.8 forKey:@"statusWindowVanishSpeed"];
270 [df setFloat:4.0 forKey:@"statusWindowVanishDelay"];
271 [df setBool:YES forKey:@"showSongInfoOnChange"];
275 loginWindow = [[df persistentDomainForName:@"loginwindow"] mutableCopy];
276 loginArray = [loginWindow objectForKey:@"AutoLaunchedApplicationDictionary"];
277 loginEnum = [loginArray objectEnumerator];
279 while ( (anItem = [loginEnum nextObject]) ) {
280 if ( [[[anItem objectForKey:@"Path"] lastPathComponent] isEqualToString:[[[NSBundle mainBundle] bundlePath] lastPathComponent]] ) {
284 [loginWindow release];
287 [[StatusWindowController sharedController] showSetupQueryWindow];
293 [[StatusWindow sharedWindow] setLocked:NO];
294 [[StatusWindow sharedWindow] vanish:self];
295 [[StatusWindow sharedWindow] setIgnoresMouseEvents:YES];
297 [self setLaunchesAtLogin:YES];
300 - (void)autoLaunchCancel
302 [[StatusWindow sharedWindow] setLocked:NO];
303 [[StatusWindow sharedWindow] vanish:self];
304 [[StatusWindow sharedWindow] setIgnoresMouseEvents:YES];
307 - (void)deletePressedInTableView:(NSTableView *)tableView
309 if (tableView == menuTableView) {
310 int selRow = [tableView selectedRow];
311 ITDebugLog(@"Delete pressed in menu table view.");
313 NSString *object = [myItems objectAtIndex:selRow];
315 if ([object isEqualToString:@"preferences"]) {
320 if (![object isEqualToString:@"separator"])
321 [availableItems addObject:object];
322 ITDebugLog(@"Removing object named %@", object);
323 [myItems removeObjectAtIndex:selRow];
324 [menuTableView reloadData];
325 [allTableView reloadData];
327 [self changeMenus:self];
331 /*************************************************************************/
333 #pragma mark HOTKEY SUPPORT METHODS
334 /*************************************************************************/
336 - (IBAction)clearHotKey:(id)sender
338 [hotKeysDictionary setObject:[ITKeyCombo clearKeyCombo] forKey:[hotKeysArray objectAtIndex:[hotKeysTableView selectedRow]]];
339 [df setObject:[[ITKeyCombo clearKeyCombo] plistRepresentation] forKey:[hotKeysArray objectAtIndex:[hotKeysTableView selectedRow]]];
340 [controller setupHotKeys];
341 [hotKeysTableView reloadData];
344 - (IBAction)editHotKey:(id)sender
346 ITKeyComboPanel *panel = [ITKeyComboPanel sharedPanel];
347 NSString *keyComboKey = [hotKeysArray objectAtIndex:[hotKeysTableView selectedRow]];
348 ITKeyCombo *keyCombo;
350 ITDebugLog(@"Setting key combo on hot key %@.", keyComboKey);
351 [controller clearHotKeys];
352 [panel setKeyCombo:[hotKeysDictionary objectForKey:[hotKeysArray objectAtIndex:[hotKeysTableView selectedRow]]]];
353 [panel setKeyBindingName:[hotKeyNamesArray objectAtIndex:[hotKeysTableView selectedRow]]];
354 if ([panel runModal] == NSOKButton) {
355 NSEnumerator *keyEnumerator = [[hotKeysDictionary allKeys] objectEnumerator];
357 keyCombo = [panel keyCombo];
359 //Check for duplicate key combo
360 while ( (nextKey = [keyEnumerator nextObject]) ) {
361 if ([[hotKeysDictionary objectForKey:nextKey] isEqual:keyCombo] &&
362 ![keyCombo isEqual:[ITKeyCombo clearKeyCombo]]) {
363 [hotKeysDictionary setObject:[ITKeyCombo clearKeyCombo]
365 [df setObject:[[ITKeyCombo clearKeyCombo] plistRepresentation]
370 [hotKeysDictionary setObject:keyCombo forKey:keyComboKey];
371 [df setObject:[keyCombo plistRepresentation] forKey:keyComboKey];
372 [controller setupHotKeys];
373 [hotKeysTableView reloadData];
374 ITDebugLog(@"Set combo %@ on hot key %@.", keyCombo, keyComboKey);
376 ITDebugLog(@"Hot key setting on hot key %@ cancelled.", keyComboKey);
380 - (void)hotKeysTableViewDoubleClicked:(id)sender
382 if ([sender clickedRow] > -1) {
383 [self editHotKey:sender];
387 /*************************************************************************/
389 #pragma mark PRIVATE METHOD IMPLEMENTATIONS
390 /*************************************************************************/
394 ITDebugLog(@"Loading Preferences.nib.");
395 if (![NSBundle loadNibNamed:@"Preferences" owner:self]) {
396 ITDebugLog(@"Failed to load Preferences.nib.");
402 - (void)setupCustomizationTables
404 NSImageCell *imgCell = [[[NSImageCell alloc] initImageCell:nil] autorelease];
405 ITDebugLog(@"Setting up table views.");
406 // Set the table view cells up
407 [imgCell setImageScaling:NSScaleNone];
408 [[menuTableView tableColumnWithIdentifier:@"submenu"] setDataCell:imgCell];
409 [[allTableView tableColumnWithIdentifier:@"submenu"] setDataCell:imgCell];
411 // Register for drag and drop
412 [menuTableView registerForDraggedTypes:[NSArray arrayWithObjects:
413 @"MenuTableViewPboardType",
414 @"AllTableViewPboardType",
416 [allTableView registerForDraggedTypes:[NSArray arrayWithObjects:
417 @"MenuTableViewPboardType",
418 @"AllTableViewPboardType",
422 - (void)setupMenuItems
424 NSEnumerator *itemEnum;
426 ITDebugLog(@"Setting up table view arrays.");
427 // Set the list of items you can have.
428 availableItems = [[NSMutableArray alloc] initWithObjects:
444 // Get our preferred menu
445 myItems = [[df arrayForKey:@"menu"] mutableCopy];
447 // Delete items in the availableItems array that are already part of the menu
448 itemEnum = [myItems objectEnumerator];
449 while ( (anItem = [itemEnum nextObject]) ) {
450 if (![anItem isEqualToString:@"separator"]) {
451 [availableItems removeObject:anItem];
455 // Items that show should a submenu image
456 submenuItems = [[NSArray alloc] initWithObjects:
466 NSMutableDictionary *loginwindow;
467 NSMutableArray *loginarray;
468 NSEnumerator *loginEnum, *keyArrayEnum;
471 ITDebugLog(@"Setting up preferences UI.");
472 // Fill in the number of songs in advance to show field
473 [songsInAdvance setIntValue:[df integerForKey:@"SongsInAdvance"]];
475 // Fill hot key array
476 keyArrayEnum = [hotKeysArray objectEnumerator];
478 while ( (anItem = [keyArrayEnum nextObject]) ) {
479 if ([df objectForKey:anItem]) {
480 ITDebugLog(@"Setting up \"%@\" hot key.", anItem);
481 [hotKeysDictionary setObject:[ITKeyCombo keyComboWithPlistRepresentation:[df objectForKey:anItem]] forKey:anItem];
483 [hotKeysDictionary setObject:[ITKeyCombo clearKeyCombo] forKey:anItem];
487 ITDebugLog(@"Setting up track info checkboxes.");
488 // Check current track info buttons
489 [albumCheckbox setState:[df boolForKey:@"showAlbum"] ? NSOnState : NSOffState];
490 [nameCheckbox setState:NSOnState]; // Song info will ALWAYS show song title.
491 [nameCheckbox setEnabled:NO]; // Song info will ALWAYS show song title.
492 [artistCheckbox setState:[df boolForKey:@"showArtist"] ? NSOnState : NSOffState];
493 [trackTimeCheckbox setState:[df boolForKey:@"showTime"] ? NSOnState : NSOffState];
494 [trackNumberCheckbox setState:[df boolForKey:@"showTrackNumber"] ? NSOnState : NSOffState];
495 [ratingCheckbox setState:[df boolForKey:@"showTrackRating"] ? NSOnState : NSOffState];
497 // Set the launch at login checkbox state
498 ITDebugLog(@"Setting launch at login state.");
500 loginwindow = [[df persistentDomainForName:@"loginwindow"] mutableCopy];
501 loginarray = [loginwindow objectForKey:@"AutoLaunchedApplicationDictionary"];
503 loginEnum = [loginarray objectEnumerator];
504 while ( (anItem = [loginEnum nextObject]) ) {
505 if ([[[anItem objectForKey:@"Path"] lastPathComponent] isEqualToString:[[[NSBundle mainBundle] bundlePath] lastPathComponent]]) {
506 [launchAtLoginCheckbox setState:NSOnState];
510 // Set the launch player checkbox state
511 ITDebugLog(@"Setting launch player with MenuTunes state.");
512 [launchPlayerAtLaunchCheckbox setState:[df boolForKey:@"LaunchPlayerWithMT"] ? NSOnState : NSOffState];
514 // Setup the positioning controls
516 // Setup effects controls
517 [appearanceEffectPopup selectItem:[appearanceEffectPopup itemAtIndex:[appearanceEffectPopup indexOfItemWithTag:[df integerForKey:@"statusWindowAppearanceEffect"]]]];
518 [vanishEffectPopup selectItem:[vanishEffectPopup itemAtIndex:[vanishEffectPopup indexOfItemWithTag:[df integerForKey:@"statusWindowVanishEffect"]]]];
519 [appearanceSpeedSlider setFloatValue:-([df floatForKey:@"statusWindowAppearanceSpeed"])];
520 [vanishSpeedSlider setFloatValue:-([df floatForKey:@"statusWindowVanishSpeed"])];
521 [vanishDelaySlider setFloatValue:[df floatForKey:@"statusWindowVanishDelay"]];
522 [showOnChangeCheckbox setState:([df boolForKey:@"showSongInfoOnChange"] ? NSOnState : NSOffState)];
525 - (IBAction)changeMenus:(id)sender
527 ITDebugLog(@"Synchronizing menus");
528 [df setObject:myItems forKey:@"menu"];
532 - (void)setLaunchesAtLogin:(BOOL)flag
534 NSMutableDictionary *loginwindow;
535 NSMutableArray *loginarray;
536 ITDebugLog(@"Setting launches at login: %i", flag);
538 loginwindow = [[df persistentDomainForName:@"loginwindow"] mutableCopy];
539 loginarray = [loginwindow objectForKey:@"AutoLaunchedApplicationDictionary"];
542 NSDictionary *itemDict = [NSDictionary dictionaryWithObjectsAndKeys:
543 [[NSBundle mainBundle] bundlePath], @"Path",
544 [NSNumber numberWithInt:0], @"Hide", nil];
545 [loginarray addObject:itemDict];
548 for (i = 0; i < [loginarray count]; i++) {
549 NSDictionary *tempDict = [loginarray objectAtIndex:i];
550 if ([[[tempDict objectForKey:@"Path"] lastPathComponent] isEqualToString:[[[NSBundle mainBundle] bundlePath] lastPathComponent]]) {
551 [loginarray removeObjectAtIndex:i];
556 [df setPersistentDomain:loginwindow forName:@"loginwindow"];
558 [loginwindow release];
559 ITDebugLog(@"Finished setting launches at login.");
563 /*************************************************************************/
565 #pragma mark NSWindow DELEGATE METHODS
566 /*************************************************************************/
568 - (void)windowWillClose:(NSNotification *)note
570 [(MainController *)controller closePreferences];
574 /*************************************************************************/
576 #pragma mark NSTableView DATASOURCE METHODS
577 /*************************************************************************/
579 - (int)numberOfRowsInTableView:(NSTableView *)aTableView
581 if (aTableView == menuTableView) {
582 return [myItems count];
583 } else if (aTableView == allTableView) {
584 return [availableItems count];
586 return [hotKeysArray count];
590 - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
592 if (aTableView == menuTableView) {
593 NSString *object = [myItems objectAtIndex:rowIndex];
594 if ([[aTableColumn identifier] isEqualToString:@"name"]) {
595 if ([object isEqualToString:@"showPlayer"]) {
596 return [NSString stringWithFormat:@"%@ %@", NSLocalizedString(@"show", @"Show"), [[controller currentRemote] playerSimpleName]];
598 return NSLocalizedString(object, @"ERROR");
600 if ([submenuItems containsObject:object])
602 return [NSImage imageNamed:@"submenu"];
607 } else if (aTableView == allTableView) {
608 NSString *object = [availableItems objectAtIndex:rowIndex];
609 if ([[aTableColumn identifier] isEqualToString:@"name"]) {
610 if ([object isEqualToString:@"showPlayer"]) {
611 return [NSString stringWithFormat:@"%@ %@", NSLocalizedString(@"show", @"Show"), [[controller currentRemote] playerSimpleName]];
613 return NSLocalizedString(object, @"ERROR");
615 if ([submenuItems containsObject:object]) {
616 return [NSImage imageNamed:@"submenu"];
622 if ([[aTableColumn identifier] isEqualToString:@"name"]) {
623 return [hotKeyNamesArray objectAtIndex:rowIndex];
625 return [[hotKeysDictionary objectForKey:[hotKeysArray objectAtIndex:rowIndex]] description];
630 - (BOOL)tableView:(NSTableView *)tableView writeRows:(NSArray*)rows toPasteboard:(NSPasteboard*)pboard
632 if (tableView == menuTableView) {
633 [pboard declareTypes:[NSArray arrayWithObjects:@"MenuTableViewPboardType", nil] owner:self];
634 [pboard setString:[[rows objectAtIndex:0] stringValue] forType:@"MenuTableViewPboardType"];
638 if (tableView == allTableView) {
639 [pboard declareTypes:[NSArray arrayWithObjects:@"AllTableViewPboardType", nil] owner:self];
640 [pboard setString:[[rows objectAtIndex:0] stringValue] forType:@"AllTableViewPboardType"];
646 - (BOOL)tableView:(NSTableView*)tableView acceptDrop:(id <NSDraggingInfo>)info row:(int)row dropOperation:(NSTableViewDropOperation)operation
650 NSString *dragData, *temp;
652 pb = [info draggingPasteboard];
654 if ([[pb types] containsObject:@"MenuTableViewPboardType"]) {
655 dragData = [pb stringForType:@"MenuTableViewPboardType"];
656 dragRow = [dragData intValue];
657 temp = [myItems objectAtIndex:dragRow];
659 if (tableView == menuTableView) {
660 [myItems insertObject:temp atIndex:row];
662 [myItems removeObjectAtIndex:dragRow];
664 [myItems removeObjectAtIndex:dragRow + 1];
666 } else if (tableView == allTableView) {
667 if (![temp isEqualToString:@"separator"]) {
668 [availableItems addObject:temp];
670 [myItems removeObjectAtIndex:dragRow];
672 } else if ([[pb types] containsObject:@"AllTableViewPboardType"]) {
673 dragData = [pb stringForType:@"AllTableViewPboardType"];
674 dragRow = [dragData intValue];
675 temp = [availableItems objectAtIndex:dragRow];
677 [myItems insertObject:temp atIndex:row];
679 if (![temp isEqualToString:@"separator"]) {
680 [availableItems removeObjectAtIndex:dragRow];
684 [menuTableView reloadData];
685 [allTableView reloadData];
686 [self changeMenus:self];
690 - (NSDragOperation)tableView:(NSTableView*)tableView validateDrop:(id <NSDraggingInfo>)info proposedRow:(int)row proposedDropOperation:(NSTableViewDropOperation)operation
692 if (tableView == allTableView) {
693 if ([[[info draggingPasteboard] types] containsObject:@"AllTableViewPboardType"]) {
694 return NSDragOperationNone;
697 if ([[[info draggingPasteboard] types] containsObject:@"MenuTableViewPboardType"]) {
698 NSString *item = [myItems objectAtIndex:[[[info draggingPasteboard] stringForType:@"MenuTableViewPboardType"] intValue]];
699 if ([item isEqualToString:@"preferences"] || [item isEqualToString:@"quit"]) {
700 return NSDragOperationNone;
704 [tableView setDropRow:-1 dropOperation:NSTableViewDropOn];
705 return NSDragOperationGeneric;
708 if (operation == NSTableViewDropOn || row == -1)
710 return NSDragOperationNone;
712 return NSDragOperationGeneric;
716 /*************************************************************************/
718 #pragma mark DEALLOCATION METHODS
719 /*************************************************************************/
723 [hotKeysArray release];
724 [hotKeysDictionary release];
725 [menuTableView setDataSource:nil];
726 [allTableView setDataSource:nil];
727 [controller release];
728 [availableItems release];
729 [submenuItems release];