Fixed up playlist context menu.

Removed album/artist name from menu thanks to Fiona Apple and some clever person who thought it would be funny to shove the entire album name into the tag.
CQTexperiment
vspader 2008-03-11 23:31:19 +00:00
parent e24ee695a6
commit 0da67249fc
2 changed files with 2057 additions and 3733 deletions

File diff suppressed because it is too large Load Diff

View File

@ -145,7 +145,7 @@
[[self window] makeFirstResponder:self];
NSPoint menuPoint = [self convertPoint:[event locationInWindow] fromView:nil];
NSInteger iRow = [self rowAtPoint:menuPoint];
NSMenu* tableViewMenu = [[self menu] copy];
NSMenu* tableViewMenu = [self menu];
/* Update the table selection before showing menu
Preserves the selection if the row under the mouse is selected (to allow for
@ -170,43 +170,8 @@
[[tableViewMenu itemAtIndex:i] setEnabled:NO];
}
}
else
{
// Add Spotlight search items
PlaylistEntry *song = [[playlistController arrangedObjects]objectAtIndex:iRow];
NSString *artist = [song artist];
NSString *album = [song album];
unsigned addedItems = 0; // Count the number of added items, used for separator
if(album)
{
NSMenuItem *albumMenuItem = [NSMenuItem alloc];
NSString *title = [NSString
stringWithFormat:@"Search for Songs from %@...", album];
[albumMenuItem initWithTitle:title
action:@selector(searchByAlbum:)
keyEquivalent:@""];
albumMenuItem.target = playlistController;
[tableViewMenu insertItem:albumMenuItem atIndex:[tableViewMenu numberOfItems]];
[albumMenuItem release];
addedItems++;
}
if(artist)
{
NSMenuItem *artistMenuItem = [NSMenuItem alloc];
NSString *title = [NSString
stringWithFormat:@"Search for Songs by %@...", artist];
[artistMenuItem initWithTitle:title
action:@selector(searchByArtist:)
keyEquivalent:@""];
artistMenuItem.target = playlistController;
[tableViewMenu insertItem:artistMenuItem atIndex:[tableViewMenu numberOfItems]];
[artistMenuItem release];
addedItems++;
}
}
return [tableViewMenu autorelease];
return tableViewMenu;
}
- (void)keyDown:(NSEvent *)e