2006-09-02 16:09:20 +00:00
|
|
|
//
|
|
|
|
// FileOutlineView.m
|
|
|
|
// BindTest
|
|
|
|
//
|
2006-09-04 18:46:18 +00:00
|
|
|
// Created by Vincent Spader on 8/20/06.
|
|
|
|
// Copyright 2006 Vincent Spader. All rights reserved.
|
2006-09-02 16:09:20 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
#import "FileOutlineView.h"
|
|
|
|
#import "FileIconCell.h"
|
2007-10-14 23:24:54 +00:00
|
|
|
#import "FileTreeDataSource.h"
|
|
|
|
|
2006-09-02 16:09:20 +00:00
|
|
|
@implementation FileOutlineView
|
|
|
|
|
|
|
|
- (void) awakeFromNib
|
|
|
|
{
|
|
|
|
NSEnumerator *e = [[self tableColumns] objectEnumerator];
|
|
|
|
id c;
|
|
|
|
while ((c = [e nextObject]))
|
|
|
|
{
|
|
|
|
id dataCell = [[FileIconCell alloc] init];
|
|
|
|
|
|
|
|
[dataCell setLineBreakMode:NSLineBreakByTruncatingTail];
|
|
|
|
[c setDataCell: dataCell];
|
2007-10-14 23:24:54 +00:00
|
|
|
NSLog(@"Setting data cell!");
|
2006-09-02 16:09:20 +00:00
|
|
|
}
|
|
|
|
}
|
2007-02-18 17:35:28 +00:00
|
|
|
|
|
|
|
|
2007-02-18 18:59:23 +00:00
|
|
|
- (BOOL)acceptsFirstResponder
|
|
|
|
{
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL)resignFirstResponder
|
|
|
|
{
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-02-18 17:35:28 +00:00
|
|
|
//Navigate outline view with the keyboard, send select actions to delegate
|
|
|
|
- (void)keyDown:(NSEvent *)theEvent
|
|
|
|
{
|
|
|
|
if (!([theEvent modifierFlags] & NSCommandKeyMask)) {
|
|
|
|
|
|
|
|
NSString *charString = [theEvent charactersIgnoringModifiers];
|
|
|
|
unichar pressedChar = 0;
|
2006-09-02 16:09:20 +00:00
|
|
|
|
2007-02-18 17:35:28 +00:00
|
|
|
//Get the pressed character
|
|
|
|
if ([charString length] == 1) pressedChar = [charString characterAtIndex:0];
|
|
|
|
|
2007-02-18 18:59:23 +00:00
|
|
|
if (pressedChar == NSDeleteFunctionKey || pressedChar == NSBackspaceCharacter || pressedChar == NSDeleteCharacter) { //Delete
|
|
|
|
//As Weird-al said....EAT IT JUST EAT IT!!!
|
|
|
|
[self kfResetSearch];
|
|
|
|
} else if (pressedChar == NSCarriageReturnCharacter || pressedChar == NSEnterCharacter) { //Enter or return
|
|
|
|
//Add songs to list
|
2007-10-14 23:24:54 +00:00
|
|
|
//[[self delegate] addSelectedToPlaylist];
|
2007-02-18 18:59:23 +00:00
|
|
|
|
2007-02-18 21:35:53 +00:00
|
|
|
[fileDrawer close];
|
|
|
|
} else if (pressedChar == 0x1b) {//Escape
|
2007-02-18 18:59:23 +00:00
|
|
|
[fileDrawer close];
|
|
|
|
} else if (pressedChar == NSLeftArrowFunctionKey || pressedChar == NSRightArrowFunctionKey) { //left or right
|
|
|
|
[super keyDown:theEvent];
|
|
|
|
|
|
|
|
[self kfResetSearch];
|
2007-02-18 17:35:28 +00:00
|
|
|
} else {
|
|
|
|
[super keyDown:theEvent];
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
[super keyDown:theEvent];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-02 16:09:20 +00:00
|
|
|
@end
|