Better file drawer and type-ahead selection.
parent
70ba5f7c30
commit
0a9bf9f3cd
|
@ -6,6 +6,8 @@
|
||||||
#import "PlaylistView.h"
|
#import "PlaylistView.h"
|
||||||
|
|
||||||
#import "FileTreeController.h"
|
#import "FileTreeController.h"
|
||||||
|
#import "FileOutlineView.h"
|
||||||
|
|
||||||
#import "NDHotKeyEvent.h"
|
#import "NDHotKeyEvent.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,6 +31,7 @@
|
||||||
IBOutlet NSDrawer *fileDrawer;
|
IBOutlet NSDrawer *fileDrawer;
|
||||||
|
|
||||||
IBOutlet FileTreeController *fileTreeController;
|
IBOutlet FileTreeController *fileTreeController;
|
||||||
|
IBOutlet FileOutlineView *fileOutlineView;
|
||||||
|
|
||||||
IBOutlet PlaylistView *playlistView;
|
IBOutlet PlaylistView *playlistView;
|
||||||
|
|
||||||
|
|
|
@ -224,24 +224,32 @@
|
||||||
- (IBAction)toggleFileDrawer:(id)sender
|
- (IBAction)toggleFileDrawer:(id)sender
|
||||||
{
|
{
|
||||||
[mainWindow makeKeyAndOrderFront:self];
|
[mainWindow makeKeyAndOrderFront:self];
|
||||||
|
NSLog(@"TOGGLING...");
|
||||||
[fileDrawer toggle:self];
|
[fileDrawer toggle:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)drawerDidOpen:(NSNotification *)notification
|
- (void)drawerDidOpen:(NSNotification *)notification
|
||||||
{
|
{
|
||||||
if ([notification object] == infoDrawer)
|
if ([notification object] == infoDrawer) {
|
||||||
[infoButton setState:NSOnState];
|
[infoButton setState:NSOnState];
|
||||||
else if ([notification object] == fileDrawer)
|
}
|
||||||
|
else if ([notification object] == fileDrawer) {
|
||||||
[fileButton setState:NSOnState];
|
[fileButton setState:NSOnState];
|
||||||
|
|
||||||
|
[mainWindow makeFirstResponder: fileOutlineView];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)drawerDidClose:(NSNotification *)notification
|
- (void)drawerDidClose:(NSNotification *)notification
|
||||||
{
|
{
|
||||||
if ([notification object] == infoDrawer)
|
if ([notification object] == infoDrawer) {
|
||||||
[infoButton setState:NSOffState];
|
[infoButton setState:NSOffState];
|
||||||
else if ([notification object] == fileDrawer)
|
}
|
||||||
|
else if ([notification object] == fileDrawer) {
|
||||||
[fileButton setState:NSOffState];
|
[fileButton setState:NSOffState];
|
||||||
|
|
||||||
|
[mainWindow makeFirstResponder: playlistView];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)donate:(id)sender
|
- (IBAction)donate:(id)sender
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
addButton = NSButton;
|
addButton = NSButton;
|
||||||
fileButton = NSButton;
|
fileButton = NSButton;
|
||||||
fileDrawer = NSDrawer;
|
fileDrawer = NSDrawer;
|
||||||
|
fileOutlineView = FileOutlineView;
|
||||||
fileTreeController = FileTreeController;
|
fileTreeController = FileTreeController;
|
||||||
infoButton = NSButton;
|
infoButton = NSButton;
|
||||||
infoDrawer = NSDrawer;
|
infoDrawer = NSDrawer;
|
||||||
|
@ -74,7 +75,12 @@
|
||||||
};
|
};
|
||||||
SUPERCLASS = NSObject;
|
SUPERCLASS = NSObject;
|
||||||
},
|
},
|
||||||
{CLASS = FileOutlineView; LANGUAGE = ObjC; SUPERCLASS = NSOutlineView; },
|
{
|
||||||
|
CLASS = FileOutlineView;
|
||||||
|
LANGUAGE = ObjC;
|
||||||
|
OUTLETS = {fileDrawer = NSDrawer; };
|
||||||
|
SUPERCLASS = NSOutlineView;
|
||||||
|
},
|
||||||
{
|
{
|
||||||
CLASS = FileTreeController;
|
CLASS = FileTreeController;
|
||||||
LANGUAGE = ObjC;
|
LANGUAGE = ObjC;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>IBDocumentLocation</key>
|
<key>IBDocumentLocation</key>
|
||||||
<string>61 -9 639 388 0 0 1024 746 </string>
|
<string>52 273 639 388 0 0 1024 746 </string>
|
||||||
<key>IBEditorPositions</key>
|
<key>IBEditorPositions</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>1063</key>
|
<key>1063</key>
|
||||||
|
@ -32,11 +32,10 @@
|
||||||
<integer>4</integer>
|
<integer>4</integer>
|
||||||
<key>IBOpenObjects</key>
|
<key>IBOpenObjects</key>
|
||||||
<array>
|
<array>
|
||||||
<integer>513</integer>
|
|
||||||
<integer>463</integer>
|
|
||||||
<integer>1156</integer>
|
<integer>1156</integer>
|
||||||
<integer>29</integer>
|
|
||||||
<integer>21</integer>
|
<integer>21</integer>
|
||||||
|
<integer>29</integer>
|
||||||
|
<integer>513</integer>
|
||||||
</array>
|
</array>
|
||||||
<key>IBSystem Version</key>
|
<key>IBSystem Version</key>
|
||||||
<string>8L127</string>
|
<string>8L127</string>
|
||||||
|
|
Binary file not shown.
|
@ -86,7 +86,7 @@
|
||||||
if (subpaths == nil)
|
if (subpaths == nil)
|
||||||
{
|
{
|
||||||
subpaths = [[NSMutableArray alloc] init];
|
subpaths = [[NSMutableArray alloc] init];
|
||||||
NSArray *contents = [[NSFileManager defaultManager] directoryContentsAtPath:path];
|
NSArray *contents = [[[NSFileManager defaultManager] directoryContentsAtPath:path] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
|
||||||
|
|
||||||
[self processContents: contents];
|
[self processContents: contents];
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
|
|
||||||
@interface FileOutlineView : NSOutlineView {
|
@interface FileOutlineView : NSOutlineView {
|
||||||
|
IBOutlet NSDrawer *fileDrawer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -32,6 +32,17 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (BOOL)acceptsFirstResponder
|
||||||
|
{
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)resignFirstResponder
|
||||||
|
{
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//Navigate outline view with the keyboard, send select actions to delegate
|
//Navigate outline view with the keyboard, send select actions to delegate
|
||||||
- (void)keyDown:(NSEvent *)theEvent
|
- (void)keyDown:(NSEvent *)theEvent
|
||||||
{
|
{
|
||||||
|
@ -43,7 +54,19 @@
|
||||||
//Get the pressed character
|
//Get the pressed character
|
||||||
if ([charString length] == 1) pressedChar = [charString characterAtIndex:0];
|
if ([charString length] == 1) pressedChar = [charString characterAtIndex:0];
|
||||||
|
|
||||||
if ((pressedChar == '\031') && // backtab
|
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
|
||||||
|
[[self delegate] addSelectedToPlaylist];
|
||||||
|
|
||||||
|
[fileDrawer close];
|
||||||
|
} else if (pressedChar == NSLeftArrowFunctionKey || pressedChar == NSRightArrowFunctionKey) { //left or right
|
||||||
|
[super keyDown:theEvent];
|
||||||
|
|
||||||
|
[self kfResetSearch];
|
||||||
|
} else if ((pressedChar == '\031') && // backtab
|
||||||
([self respondsToSelector:@selector(findPrevious:)])) {
|
([self respondsToSelector:@selector(findPrevious:)])) {
|
||||||
/* KFTypeSelectTableView supports findPrevious; backtab is added to AIOutlineView as a find previous action
|
/* KFTypeSelectTableView supports findPrevious; backtab is added to AIOutlineView as a find previous action
|
||||||
* if KFTypeSelectTableView is being used via posing */
|
* if KFTypeSelectTableView is being used via posing */
|
||||||
|
@ -63,5 +86,4 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -144,6 +144,31 @@
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Required Protocol Bullshit (RPB) This is neccessary so it can be used as a datasource for drag/drop things.
|
||||||
|
|
||||||
|
- (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item
|
||||||
|
{
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item
|
||||||
|
{
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (int)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item
|
||||||
|
{
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
//End of RPB
|
||||||
|
|
||||||
|
|
||||||
//For type-select
|
//For type-select
|
||||||
|
|
||||||
- (void)configureTypeSelectTableView:(KFTypeSelectTableView *)tableView
|
- (void)configureTypeSelectTableView:(KFTypeSelectTableView *)tableView
|
||||||
|
@ -167,4 +192,19 @@
|
||||||
|
|
||||||
//End type-select
|
//End type-select
|
||||||
|
|
||||||
|
- (void)addSelectedToPlaylist {
|
||||||
|
NSMutableArray *paths = [[NSMutableArray alloc] init];
|
||||||
|
NSArray *nodes = [self selectedObjects];
|
||||||
|
NSEnumerator *e = [nodes objectEnumerator];
|
||||||
|
|
||||||
|
id n;
|
||||||
|
while (n = [e nextObject]) {
|
||||||
|
[paths addObject:[n path]];
|
||||||
|
}
|
||||||
|
|
||||||
|
[playlistController addPaths:paths sort:YES];
|
||||||
|
[paths release];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -66,6 +66,7 @@
|
||||||
{
|
{
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)resignFirstResponder
|
- (BOOL)resignFirstResponder
|
||||||
{
|
{
|
||||||
return YES;
|
return YES;
|
||||||
|
|
Loading…
Reference in New Issue