Cog/FileTree/FileTreeController.m
mscott 11352ab6de Enhancements to File Tree (contextual menu, sort order, etc.).
Added File Tree contextual menu (Add to Playlist, Show in Finder, etc.).
File Tree and additions to play list now use Finder sort order.
File Tree Root can be set via its popup menu or drag and drop from File Tree.
Alias names are now shown in File Tree (aliases are still resolved).
Added option to skip reading of cue sheets when adding a folder to play list.
2009-08-16 11:49:34 -05:00

66 lines
1.5 KiB
Objective-C

//
// FileTreeController.m
// Cog
//
// Created by Vincent Spader on 2/17/08.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#import "PlaylistController.h"
#import "FileTreeController.h"
@implementation FileTreeController
- (IBAction)addToPlaylist:(id)sender
{
unsigned int index;
NSIndexSet *selectedIndexes = [outlineView selectedRowIndexes];
NSMutableArray *urls = [[NSMutableArray alloc] init];
for (index = [selectedIndexes firstIndex];
index != NSNotFound; index = [selectedIndexes indexGreaterThanIndex: index])
{
[urls addObject:[[outlineView itemAtRow:index] URL]];
}
[controller addToPlaylist:urls];
[urls release];
}
- (IBAction)setAsPlaylist:(id)sender
{
[controller clear:sender];
[self addToPlaylist:sender];
}
- (IBAction)playPauseResume:(NSObject *)id
{
[controller playPauseResume:id];
}
- (IBAction)showEntryInFinder:(id)sender
{
unsigned int index;
NSWorkspace* ws = [NSWorkspace sharedWorkspace];
NSIndexSet *selectedIndexes = [outlineView selectedRowIndexes];
for (index = [selectedIndexes firstIndex];
index != NSNotFound; index = [selectedIndexes indexGreaterThanIndex: index])
{
NSURL *url = [[outlineView itemAtRow:index] URL];
[ws selectFile:[url path] inFileViewerRootedAtPath:[url path]];
}
}
- (IBAction)setAsRoot:(id)sender
{
unsigned int index = [[outlineView selectedRowIndexes] firstIndex];
if (index != NSNotFound)
{
[dataSource changeURL:[[outlineView itemAtRow:index] URL]];
}
}
@end