diff --git a/Cog.xcodeproj/project.pbxproj b/Cog.xcodeproj/project.pbxproj index d8ee4c28c..10cca8af7 100644 --- a/Cog.xcodeproj/project.pbxproj +++ b/Cog.xcodeproj/project.pbxproj @@ -20,6 +20,7 @@ 173428F50D5FB1C400E8D854 /* EntriesController.m in Sources */ = {isa = PBXBuildFile; fileRef = 173428F40D5FB1C400E8D854 /* EntriesController.m */; }; 17342A9A0D5FD20B00E8D854 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 17342A980D5FD20B00E8D854 /* MainMenu.xib */; }; 17342ABF0D5FD36400E8D854 /* OpenURLPanel.xib in Resources */ = {isa = PBXBuildFile; fileRef = 17342ABD0D5FD36400E8D854 /* OpenURLPanel.xib */; }; + 173855FF0E0CC81F00488CD4 /* FileTreeOutlineView.m in Sources */ = {isa = PBXBuildFile; fileRef = 173855FE0E0CC81F00488CD4 /* FileTreeOutlineView.m */; }; 1755E1F90BA0D2B600CA3560 /* PlaylistLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 1755E1F70BA0D2B600CA3560 /* PlaylistLoader.m */; }; 1766C6930B911DF1004A7AE4 /* AudioScrobbler.m in Sources */ = {isa = PBXBuildFile; fileRef = 1766C68F0B911DF1004A7AE4 /* AudioScrobbler.m */; }; 1766C6950B911DF1004A7AE4 /* AudioScrobblerClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 1766C6910B911DF1004A7AE4 /* AudioScrobblerClient.m */; }; @@ -503,6 +504,8 @@ 173428F40D5FB1C400E8D854 /* EntriesController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EntriesController.m; sourceTree = ""; }; 17342A990D5FD20B00E8D854 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = ""; }; 17342ABE0D5FD36400E8D854 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/OpenURLPanel.xib; sourceTree = ""; }; + 173855FD0E0CC81F00488CD4 /* FileTreeOutlineView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileTreeOutlineView.h; path = FileTree/FileTreeOutlineView.h; sourceTree = ""; }; + 173855FE0E0CC81F00488CD4 /* FileTreeOutlineView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FileTreeOutlineView.m; path = FileTree/FileTreeOutlineView.m; sourceTree = ""; }; 1755E1F60BA0D2B600CA3560 /* PlaylistLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PlaylistLoader.h; sourceTree = ""; }; 1755E1F70BA0D2B600CA3560 /* PlaylistLoader.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = PlaylistLoader.m; sourceTree = ""; }; 1766C68E0B911DF1004A7AE4 /* AudioScrobbler.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AudioScrobbler.h; sourceTree = ""; }; @@ -1052,6 +1055,8 @@ 17DDF6400E0CB6F100A2E4AD /* FileTree */ = { isa = PBXGroup; children = ( + 173855FD0E0CC81F00488CD4 /* FileTreeOutlineView.h */, + 173855FE0E0CC81F00488CD4 /* FileTreeOutlineView.m */, 179D03140E0CB2500064A77A /* FileTreeViewController.h */, 179D03150E0CB2500064A77A /* FileTreeViewController.m */, 179D03120E0CB2500064A77A /* FileTreeDataSource.h */, @@ -1752,6 +1757,7 @@ 179D03260E0CB2500064A77A /* PathNode.m in Sources */, 179D03270E0CB2500064A77A /* PathWatcher.m in Sources */, 179D03280E0CB2500064A77A /* SmartFolderNode.m in Sources */, + 173855FF0E0CC81F00488CD4 /* FileTreeOutlineView.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/English.lproj/FileTree.xib b/English.lproj/FileTree.xib index dfddd19c6..a56bac3e1 100644 --- a/English.lproj/FileTree.xib +++ b/English.lproj/FileTree.xib @@ -8,7 +8,7 @@ 352.00 YES - + YES @@ -340,6 +340,14 @@ 96 + + + delegate + + + + 98 + @@ -480,6 +488,7 @@ 67.ImportedFromIB2 68.IBPluginDependency 68.ImportedFromIB2 + 69.CustomClassName 69.IBPluginDependency 69.ImportedFromIB2 70.IBPluginDependency @@ -507,6 +516,7 @@ com.apple.InterfaceBuilder.CocoaPlugin + FileTreeOutlineView com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -539,7 +549,7 @@ - 96 + 98 @@ -581,6 +591,14 @@ + + FileTreeOutlineView + NSOutlineView + + IBProjectSource + FileTreeOutlineView.h + + FileTreeViewController NSObject diff --git a/FileTree/FileTreeOutlineView.h b/FileTree/FileTreeOutlineView.h new file mode 100644 index 000000000..bb7a56ade --- /dev/null +++ b/FileTree/FileTreeOutlineView.h @@ -0,0 +1,17 @@ +// +// FileTreeOutlineView.h +// Cog +// +// Created by Vincent Spader on 6/21/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import + + +@interface FileTreeOutlineView : NSOutlineView { +} + +- (void)keyDown:(NSEvent *)e; + +@end diff --git a/FileTree/FileTreeOutlineView.m b/FileTree/FileTreeOutlineView.m new file mode 100644 index 000000000..43be2fdcb --- /dev/null +++ b/FileTree/FileTreeOutlineView.m @@ -0,0 +1,43 @@ +// +// FileTreeOutlineView.m +// Cog +// +// Created by Vincent Spader on 6/21/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import "FileTreeOutlineView.h" +#import "FileTreeViewController.h" + +@implementation FileTreeOutlineView + +- (void)awakeFromNib +{ + [self setDoubleAction:@selector(addToPlaylist:)]; + [self setTarget:[self delegate]]; +} + +- (void)keyDown:(NSEvent *)e +{ + unsigned int modifiers = [e modifierFlags] & (NSCommandKeyMask | NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask); + NSString *characters = [e characters]; + unichar c; + + if ([characters length] == 1) + { + c = [characters characterAtIndex:0]; + + if (modifiers == 0 && (c == NSEnterCharacter || c == NSCarriageReturnCharacter)) + { + [[self delegate] addToPlaylist:self]; + + return; + } + } + + [super keyDown:e]; + + return; +} + +@end diff --git a/FileTree/FileTreeViewController.m b/FileTree/FileTreeViewController.m index fb38bc846..e28774c1e 100644 --- a/FileTree/FileTreeViewController.m +++ b/FileTree/FileTreeViewController.m @@ -12,12 +12,6 @@ @implementation FileTreeViewController -- (void)awakeFromNib -{ - [outlineView setDoubleAction:@selector(addToPlaylist:)]; - [outlineView setTarget:self]; -} - - (IBAction)addToPlaylist:(id)sender { unsigned int index;