Better file drawer and type-ahead selection.
parent
70ba5f7c30
commit
0a9bf9f3cd
|
@ -6,6 +6,8 @@
|
|||
#import "PlaylistView.h"
|
||||
|
||||
#import "FileTreeController.h"
|
||||
#import "FileOutlineView.h"
|
||||
|
||||
#import "NDHotKeyEvent.h"
|
||||
|
||||
|
||||
|
@ -29,6 +31,7 @@
|
|||
IBOutlet NSDrawer *fileDrawer;
|
||||
|
||||
IBOutlet FileTreeController *fileTreeController;
|
||||
IBOutlet FileOutlineView *fileOutlineView;
|
||||
|
||||
IBOutlet PlaylistView *playlistView;
|
||||
|
||||
|
|
|
@ -224,24 +224,32 @@
|
|||
- (IBAction)toggleFileDrawer:(id)sender
|
||||
{
|
||||
[mainWindow makeKeyAndOrderFront:self];
|
||||
|
||||
NSLog(@"TOGGLING...");
|
||||
[fileDrawer toggle:self];
|
||||
}
|
||||
|
||||
- (void)drawerDidOpen:(NSNotification *)notification
|
||||
{
|
||||
if ([notification object] == infoDrawer)
|
||||
if ([notification object] == infoDrawer) {
|
||||
[infoButton setState:NSOnState];
|
||||
else if ([notification object] == fileDrawer)
|
||||
}
|
||||
else if ([notification object] == fileDrawer) {
|
||||
[fileButton setState:NSOnState];
|
||||
|
||||
[mainWindow makeFirstResponder: fileOutlineView];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)drawerDidClose:(NSNotification *)notification
|
||||
{
|
||||
if ([notification object] == infoDrawer)
|
||||
if ([notification object] == infoDrawer) {
|
||||
[infoButton setState:NSOffState];
|
||||
else if ([notification object] == fileDrawer)
|
||||
}
|
||||
else if ([notification object] == fileDrawer) {
|
||||
[fileButton setState:NSOffState];
|
||||
|
||||
[mainWindow makeFirstResponder: playlistView];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)donate:(id)sender
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
addButton = NSButton;
|
||||
fileButton = NSButton;
|
||||
fileDrawer = NSDrawer;
|
||||
fileOutlineView = FileOutlineView;
|
||||
fileTreeController = FileTreeController;
|
||||
infoButton = NSButton;
|
||||
infoDrawer = NSDrawer;
|
||||
|
@ -74,7 +75,12 @@
|
|||
};
|
||||
SUPERCLASS = NSObject;
|
||||
},
|
||||
{CLASS = FileOutlineView; LANGUAGE = ObjC; SUPERCLASS = NSOutlineView; },
|
||||
{
|
||||
CLASS = FileOutlineView;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {fileDrawer = NSDrawer; };
|
||||
SUPERCLASS = NSOutlineView;
|
||||
},
|
||||
{
|
||||
CLASS = FileTreeController;
|
||||
LANGUAGE = ObjC;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<plist version="1.0">
|
||||
<dict>
|
||||
<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>
|
||||
<dict>
|
||||
<key>1063</key>
|
||||
|
@ -32,11 +32,10 @@
|
|||
<integer>4</integer>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>513</integer>
|
||||
<integer>463</integer>
|
||||
<integer>1156</integer>
|
||||
<integer>29</integer>
|
||||
<integer>21</integer>
|
||||
<integer>29</integer>
|
||||
<integer>513</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>8L127</string>
|
||||
|
|
Binary file not shown.
|
@ -86,7 +86,7 @@
|
|||
if (subpaths == nil)
|
||||
{
|
||||
subpaths = [[NSMutableArray alloc] init];
|
||||
NSArray *contents = [[NSFileManager defaultManager] directoryContentsAtPath:path];
|
||||
NSArray *contents = [[[NSFileManager defaultManager] directoryContentsAtPath:path] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
|
||||
|
||||
[self processContents: contents];
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
|
||||
@interface FileOutlineView : NSOutlineView {
|
||||
|
||||
IBOutlet NSDrawer *fileDrawer;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -32,6 +32,17 @@
|
|||
}
|
||||
|
||||
|
||||
- (BOOL)acceptsFirstResponder
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)resignFirstResponder
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
//Navigate outline view with the keyboard, send select actions to delegate
|
||||
- (void)keyDown:(NSEvent *)theEvent
|
||||
{
|
||||
|
@ -43,7 +54,19 @@
|
|||
//Get the pressed character
|
||||
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:)])) {
|
||||
/* KFTypeSelectTableView supports findPrevious; backtab is added to AIOutlineView as a find previous action
|
||||
* if KFTypeSelectTableView is being used via posing */
|
||||
|
@ -63,5 +86,4 @@
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
|
|
@ -144,6 +144,31 @@
|
|||
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
|
||||
|
||||
- (void)configureTypeSelectTableView:(KFTypeSelectTableView *)tableView
|
||||
|
@ -167,4 +192,19 @@
|
|||
|
||||
//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
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)resignFirstResponder
|
||||
{
|
||||
return YES;
|
||||
|
|
Loading…
Reference in New Issue