From b79346e3b133dc438ca32cdadfb12e94d081fc88 Mon Sep 17 00:00:00 2001 From: vspader Date: Sat, 7 Mar 2009 13:31:44 -0800 Subject: [PATCH] Fixed up file tree. --- Cog.xcodeproj/project.pbxproj | 60 ++--- English.lproj/FileTree.xib | 364 ++++++++++++++++++++++++++---- English.lproj/MainMenu.xib | 321 ++++++-------------------- FileTree/FileTreeController.h | 19 ++ FileTree/FileTreeController.m | 32 +++ FileTree/FileTreeViewController.h | 15 +- FileTree/FileTreeViewController.m | 27 +-- SideView/SideBarController.h | 34 --- SideView/SideBarController.m | 260 --------------------- SideView/SideView.h | 26 --- SideView/SideView.m | 42 ---- SideView/SideViewController.h | 28 --- SideView/SideViewController.m | 83 ------- SideView/SideWindowController.h | 17 -- SideView/SideWindowController.m | 53 ----- Utils/SideViewController.h | 27 +++ Utils/SideViewController.m | 211 +++++++++++++++++ 17 files changed, 704 insertions(+), 915 deletions(-) create mode 100644 FileTree/FileTreeController.h create mode 100644 FileTree/FileTreeController.m delete mode 100644 SideView/SideBarController.h delete mode 100644 SideView/SideBarController.m delete mode 100644 SideView/SideView.h delete mode 100644 SideView/SideView.m delete mode 100644 SideView/SideViewController.h delete mode 100644 SideView/SideViewController.m delete mode 100644 SideView/SideWindowController.h delete mode 100644 SideView/SideWindowController.m create mode 100644 Utils/SideViewController.h create mode 100644 Utils/SideViewController.m diff --git a/Cog.xcodeproj/project.pbxproj b/Cog.xcodeproj/project.pbxproj index 331c5a349..e268fa658 100644 --- a/Cog.xcodeproj/project.pbxproj +++ b/Cog.xcodeproj/project.pbxproj @@ -26,8 +26,6 @@ 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 */; }; - 1738589B0E0D92DD00488CD4 /* SideBarController.m in Sources */ = {isa = PBXBuildFile; fileRef = 173858950E0D92DD00488CD4 /* SideBarController.m */; }; - 1738589D0E0D92DD00488CD4 /* SideWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 173858990E0D92DD00488CD4 /* SideWindowController.m */; }; 173A43A10F3FD26500676A7B /* ToolTipWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 173A43A00F3FD26500676A7B /* ToolTipWindow.m */; }; 1752C36C0F59E00100F85F28 /* PlaybackButtons.m in Sources */ = {isa = PBXBuildFile; fileRef = 1752C36B0F59E00100F85F28 /* PlaybackButtons.m */; }; 1755E1F90BA0D2B600CA3560 /* PlaylistLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 1755E1F70BA0D2B600CA3560 /* PlaylistLoader.m */; }; @@ -60,6 +58,8 @@ 17818A990C0B27AC001C4916 /* shn.icns in Resources */ = {isa = PBXBuildFile; fileRef = 17818A920C0B27AC001C4916 /* shn.icns */; }; 17818A9A0C0B27AC001C4916 /* wav.icns in Resources */ = {isa = PBXBuildFile; fileRef = 17818A930C0B27AC001C4916 /* wav.icns */; }; 17818A9B0C0B27AC001C4916 /* wv.icns in Resources */ = {isa = PBXBuildFile; fileRef = 17818A940C0B27AC001C4916 /* wv.icns */; }; + 1784560F0F631E24007E8021 /* FileTreeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1784560E0F631E24007E8021 /* FileTreeViewController.m */; }; + 178456120F631E31007E8021 /* SideViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 178456110F631E31007E8021 /* SideViewController.m */; }; 178BAB990CD4E1B700B33D47 /* GCOneShotEffectTimer.m in Sources */ = {isa = PBXBuildFile; fileRef = 178BAB940CD4E1B700B33D47 /* GCOneShotEffectTimer.m */; }; 178BAB9A0CD4E1B700B33D47 /* GCWindowMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 178BAB960CD4E1B700B33D47 /* GCWindowMenu.m */; }; 178BAB9B0CD4E1B700B33D47 /* PopupButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 178BAB980CD4E1B700B33D47 /* PopupButton.m */; }; @@ -67,15 +67,13 @@ 1791005F0CB44D6D0070BC5C /* Cog.scriptTerminology in Resources */ = {isa = PBXBuildFile; fileRef = 1791005D0CB44D6D0070BC5C /* Cog.scriptTerminology */; }; 1791FF900CB43A2C0070BC5C /* MediaKeysApplication.m in Sources */ = {isa = PBXBuildFile; fileRef = 1791FF8E0CB43A2C0070BC5C /* MediaKeysApplication.m */; }; 179790E10C087AB7001D6996 /* OpenURLPanel.m in Sources */ = {isa = PBXBuildFile; fileRef = 179790DF0C087AB7001D6996 /* OpenURLPanel.m */; }; - 179D02EE0E0CB0B00064A77A /* SideView.m in Sources */ = {isa = PBXBuildFile; fileRef = 179D02EB0E0CB0B00064A77A /* SideView.m */; }; - 179D02EF0E0CB0B00064A77A /* SideViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 179D02ED0E0CB0B00064A77A /* SideViewController.m */; }; 179D031E0E0CB2500064A77A /* ContainedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 179D03090E0CB2500064A77A /* ContainedNode.m */; }; 179D031F0E0CB2500064A77A /* ContainerNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 179D030B0E0CB2500064A77A /* ContainerNode.m */; }; 179D03200E0CB2500064A77A /* DirectoryNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 179D030D0E0CB2500064A77A /* DirectoryNode.m */; }; 179D03210E0CB2500064A77A /* FileIconCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 179D030F0E0CB2500064A77A /* FileIconCell.m */; }; 179D03220E0CB2500064A77A /* FileNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 179D03110E0CB2500064A77A /* FileNode.m */; }; 179D03230E0CB2500064A77A /* FileTreeDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 179D03130E0CB2500064A77A /* FileTreeDataSource.m */; }; - 179D03240E0CB2500064A77A /* FileTreeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 179D03150E0CB2500064A77A /* FileTreeViewController.m */; }; + 179D03240E0CB2500064A77A /* FileTreeController.m in Sources */ = {isa = PBXBuildFile; fileRef = 179D03150E0CB2500064A77A /* FileTreeController.m */; }; 179D03260E0CB2500064A77A /* PathNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 179D03190E0CB2500064A77A /* PathNode.m */; }; 179D03270E0CB2500064A77A /* PathWatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 179D031B0E0CB2500064A77A /* PathWatcher.m */; }; 179D03280E0CB2500064A77A /* SmartFolderNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 179D031D0E0CB2500064A77A /* SmartFolderNode.m */; }; @@ -551,10 +549,6 @@ 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 = ""; }; - 173858940E0D92DD00488CD4 /* SideBarController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SideBarController.h; path = SideView/SideBarController.h; sourceTree = ""; }; - 173858950E0D92DD00488CD4 /* SideBarController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SideBarController.m; path = SideView/SideBarController.m; sourceTree = ""; }; - 173858980E0D92DD00488CD4 /* SideWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SideWindowController.h; path = SideView/SideWindowController.h; sourceTree = ""; }; - 173858990E0D92DD00488CD4 /* SideWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SideWindowController.m; path = SideView/SideWindowController.m; sourceTree = ""; }; 173A439F0F3FD26500676A7B /* ToolTipWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ToolTipWindow.h; path = ToolTip/ToolTipWindow.h; sourceTree = ""; }; 173A43A00F3FD26500676A7B /* ToolTipWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ToolTipWindow.m; path = ToolTip/ToolTipWindow.m; sourceTree = ""; }; 1752C36A0F59E00100F85F28 /* PlaybackButtons.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PlaybackButtons.h; path = Window/PlaybackButtons.h; sourceTree = ""; }; @@ -600,6 +594,10 @@ 17818A920C0B27AC001C4916 /* shn.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = shn.icns; sourceTree = ""; }; 17818A930C0B27AC001C4916 /* wav.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = wav.icns; sourceTree = ""; }; 17818A940C0B27AC001C4916 /* wv.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = wv.icns; sourceTree = ""; }; + 1784560D0F631E24007E8021 /* FileTreeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileTreeViewController.h; path = FileTree/FileTreeViewController.h; sourceTree = ""; }; + 1784560E0F631E24007E8021 /* FileTreeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FileTreeViewController.m; path = FileTree/FileTreeViewController.m; sourceTree = ""; }; + 178456100F631E31007E8021 /* SideViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SideViewController.h; sourceTree = ""; }; + 178456110F631E31007E8021 /* SideViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SideViewController.m; sourceTree = ""; }; 178BAB930CD4E1B700B33D47 /* GCOneShotEffectTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCOneShotEffectTimer.h; sourceTree = ""; }; 178BAB940CD4E1B700B33D47 /* GCOneShotEffectTimer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GCOneShotEffectTimer.m; sourceTree = ""; }; 178BAB950CD4E1B700B33D47 /* GCWindowMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCWindowMenu.h; sourceTree = ""; }; @@ -612,10 +610,6 @@ 1791FF8E0CB43A2C0070BC5C /* MediaKeysApplication.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MediaKeysApplication.m; sourceTree = ""; }; 179790DE0C087AB7001D6996 /* OpenURLPanel.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = OpenURLPanel.h; sourceTree = ""; }; 179790DF0C087AB7001D6996 /* OpenURLPanel.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = OpenURLPanel.m; sourceTree = ""; }; - 179D02EA0E0CB0B00064A77A /* SideView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SideView.h; path = SideView/SideView.h; sourceTree = ""; }; - 179D02EB0E0CB0B00064A77A /* SideView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SideView.m; path = SideView/SideView.m; sourceTree = ""; }; - 179D02EC0E0CB0B00064A77A /* SideViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SideViewController.h; path = SideView/SideViewController.h; sourceTree = ""; }; - 179D02ED0E0CB0B00064A77A /* SideViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SideViewController.m; path = SideView/SideViewController.m; sourceTree = ""; }; 179D03080E0CB2500064A77A /* ContainedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ContainedNode.h; path = FileTree/ContainedNode.h; sourceTree = ""; }; 179D03090E0CB2500064A77A /* ContainedNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ContainedNode.m; path = FileTree/ContainedNode.m; sourceTree = ""; }; 179D030A0E0CB2500064A77A /* ContainerNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ContainerNode.h; path = FileTree/ContainerNode.h; sourceTree = ""; }; @@ -628,8 +622,8 @@ 179D03110E0CB2500064A77A /* FileNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FileNode.m; path = FileTree/FileNode.m; sourceTree = ""; }; 179D03120E0CB2500064A77A /* FileTreeDataSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileTreeDataSource.h; path = FileTree/FileTreeDataSource.h; sourceTree = ""; }; 179D03130E0CB2500064A77A /* FileTreeDataSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FileTreeDataSource.m; path = FileTree/FileTreeDataSource.m; sourceTree = ""; }; - 179D03140E0CB2500064A77A /* FileTreeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileTreeViewController.h; path = FileTree/FileTreeViewController.h; sourceTree = ""; }; - 179D03150E0CB2500064A77A /* FileTreeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FileTreeViewController.m; path = FileTree/FileTreeViewController.m; sourceTree = ""; }; + 179D03140E0CB2500064A77A /* FileTreeController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileTreeController.h; path = FileTree/FileTreeController.h; sourceTree = ""; }; + 179D03150E0CB2500064A77A /* FileTreeController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FileTreeController.m; path = FileTree/FileTreeController.m; sourceTree = ""; }; 179D03180E0CB2500064A77A /* PathNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PathNode.h; path = FileTree/PathNode.h; sourceTree = ""; }; 179D03190E0CB2500064A77A /* PathNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PathNode.m; path = FileTree/PathNode.m; sourceTree = ""; }; 179D031A0E0CB2500064A77A /* PathWatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PathWatcher.h; path = FileTree/PathWatcher.h; sourceTree = ""; }; @@ -792,7 +786,6 @@ 17E0D5D20F520E75005B6FED /* Window */, 8E75752A09F31D5A0080F1EE /* Playlist */, 8E07AAEA0AAC90DC00A4B32F /* Preferences */, - 179DFCDF0E0C5A130064A77A /* SideView */, 17DDF6400E0CB6F100A2E4AD /* FileTree */, 8E75752309F31D5A0080F1EE /* Feedback */, 569C52C50D5F2BD500BDBDC9 /* Spotlight */, @@ -913,12 +906,14 @@ 177EC0110B8BC2CF0000BC8C /* Utils */ = { isa = PBXGroup; children = ( - 172A12A70F59AF8A0078EF0C /* NSString+CogSort.h */, - 172A12A80F59AF8A0078EF0C /* NSString+CogSort.m */, 177EC01A0B8BC2CF0000BC8C /* TrackingCell.h */, 177EC01B0B8BC2CF0000BC8C /* TrackingCell.m */, 177EC01C0B8BC2CF0000BC8C /* TrackingSlider.h */, 177EC01D0B8BC2CF0000BC8C /* TrackingSlider.m */, + 178456100F631E31007E8021 /* SideViewController.h */, + 178456110F631E31007E8021 /* SideViewController.m */, + 172A12A70F59AF8A0078EF0C /* NSString+CogSort.h */, + 172A12A80F59AF8A0078EF0C /* NSString+CogSort.m */, 8E9A30130BA792DC0091081B /* NSFileHandle+CreateFile.h */, 8E9A30140BA792DC0091081B /* NSFileHandle+CreateFile.m */, 07E18DF10D62B38400BB0E11 /* NSArray+ShuffleUtils.h */, @@ -976,21 +971,6 @@ path = OpenURLPanel; sourceTree = ""; }; - 179DFCDF0E0C5A130064A77A /* SideView */ = { - isa = PBXGroup; - children = ( - 173858940E0D92DD00488CD4 /* SideBarController.h */, - 173858950E0D92DD00488CD4 /* SideBarController.m */, - 173858980E0D92DD00488CD4 /* SideWindowController.h */, - 173858990E0D92DD00488CD4 /* SideWindowController.m */, - 179D02EC0E0CB0B00064A77A /* SideViewController.h */, - 179D02ED0E0CB0B00064A77A /* SideViewController.m */, - 179D02EA0E0CB0B00064A77A /* SideView.h */, - 179D02EB0E0CB0B00064A77A /* SideView.m */, - ); - name = SideView; - sourceTree = ""; - }; 17B619FF0B909ED400BC003F /* PlugIns */ = { isa = PBXGroup; children = ( @@ -1140,10 +1120,12 @@ 17DDF6400E0CB6F100A2E4AD /* FileTree */ = { isa = PBXGroup; children = ( + 1784560D0F631E24007E8021 /* FileTreeViewController.h */, + 1784560E0F631E24007E8021 /* FileTreeViewController.m */, + 179D03140E0CB2500064A77A /* FileTreeController.h */, + 179D03150E0CB2500064A77A /* FileTreeController.m */, 173855FD0E0CC81F00488CD4 /* FileTreeOutlineView.h */, 173855FE0E0CC81F00488CD4 /* FileTreeOutlineView.m */, - 179D03140E0CB2500064A77A /* FileTreeViewController.h */, - 179D03150E0CB2500064A77A /* FileTreeViewController.m */, 179D03120E0CB2500064A77A /* FileTreeDataSource.h */, 179D03130E0CB2500064A77A /* FileTreeDataSource.m */, 179D03080E0CB2500064A77A /* ContainedNode.h */, @@ -1868,21 +1850,17 @@ 17B7DD7D0D7CD10D00320E70 /* BlankZeroFormatter.m in Sources */, 17249F0F0D82E17700F33392 /* ToggleQueueTitleTransformer.m in Sources */, 17A140E90D88B954004852F9 /* FilePlaylistEntry.m in Sources */, - 179D02EE0E0CB0B00064A77A /* SideView.m in Sources */, - 179D02EF0E0CB0B00064A77A /* SideViewController.m in Sources */, 179D031E0E0CB2500064A77A /* ContainedNode.m in Sources */, 179D031F0E0CB2500064A77A /* ContainerNode.m in Sources */, 179D03200E0CB2500064A77A /* DirectoryNode.m in Sources */, 179D03210E0CB2500064A77A /* FileIconCell.m in Sources */, 179D03220E0CB2500064A77A /* FileNode.m in Sources */, 179D03230E0CB2500064A77A /* FileTreeDataSource.m in Sources */, - 179D03240E0CB2500064A77A /* FileTreeViewController.m in Sources */, + 179D03240E0CB2500064A77A /* FileTreeController.m in Sources */, 179D03260E0CB2500064A77A /* PathNode.m in Sources */, 179D03270E0CB2500064A77A /* PathWatcher.m in Sources */, 179D03280E0CB2500064A77A /* SmartFolderNode.m in Sources */, 173855FF0E0CC81F00488CD4 /* FileTreeOutlineView.m in Sources */, - 1738589B0E0D92DD00488CD4 /* SideBarController.m in Sources */, - 1738589D0E0D92DD00488CD4 /* SideWindowController.m in Sources */, 07D971E60ED1DAA800E7602E /* TagEditorController.m in Sources */, 173A43A10F3FD26500676A7B /* ToolTipWindow.m in Sources */, 17E0D5E90F520F02005B6FED /* DualWindow.m in Sources */, @@ -1900,6 +1878,8 @@ 1752C36C0F59E00100F85F28 /* PlaybackButtons.m in Sources */, 171EFE8C0F59FEAE000ADC42 /* DockIconController.m in Sources */, 17F6C8070F603701000D9DA9 /* PlaybackEventController.m in Sources */, + 1784560F0F631E24007E8021 /* FileTreeViewController.m in Sources */, + 178456120F631E31007E8021 /* SideViewController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/English.lproj/FileTree.xib b/English.lproj/FileTree.xib index 06fd9d78f..13789f488 100644 --- a/English.lproj/FileTree.xib +++ b/English.lproj/FileTree.xib @@ -1,11 +1,11 @@ - + 1050 - 9D34 - 667 - 949.33 - 352.00 + 9G55 + 677 + 949.43 + 353.00 YES @@ -14,10 +14,19 @@ YES com.apple.InterfaceBuilder.CocoaPlugin + + YES + + YES + + + YES + + YES - SideView + FileTreeViewController FirstResponder @@ -222,7 +231,7 @@ NSView - FileTreeViewController + FileTreeController @@ -244,14 +253,6 @@ 34 - - - view - - - - 72 - rowHeight: values.fontSize @@ -332,14 +333,6 @@ 95 - - - controller - - - - 96 - delegate @@ -348,21 +341,37 @@ 98 + + + view + + + + 103 + nextKeyView - + - 99 + 104 firstResponder - + - 102 + 105 + + + + controller + + + + 106 @@ -493,6 +502,7 @@ -1.IBPluginDependency -2.IBPluginDependency -3.IBPluginDependency + 27.IBPluginDependency 31.IBPluginDependency 55.IBEditorWindowLastContentRect 55.IBPluginDependency @@ -522,6 +532,7 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin {{554, 263}, {307, 399}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -565,11 +576,31 @@ - 102 + 106 YES + + DNDArrayController + NSArrayController + + tableView + NSTableView + + + IBProjectSource + Playlist/DNDArrayController.h + + + + EntriesController + NSObject + + IBProjectSource + Playlist/EntriesController.h + + FileIconCell ImageTextCell @@ -578,6 +609,31 @@ FileTree/FileIconCell.h + + FileTreeController + NSObject + + addToPlaylist: + id + + + YES + + YES + controller + outlineView + + + YES + SideViewController + NSOutlineView + + + + IBProjectSource + FileTree/FileTreeController.h + + FileTreeDataSource NSObject @@ -617,23 +673,10 @@ FileTreeViewController - NSObject - - addToPlaylist: - id - + SideViewController - YES - - YES - controller - outlineView - - - YES - SideView - NSOutlineView - + playlistLoader + PlaylistLoader IBProjectSource @@ -682,24 +725,249 @@ - SideView + PlaybackController NSObject + + YES + + YES + changeVolume: + eventSeekBackward: + eventSeekForward: + fade: + next: + pause: + pauseResume: + play: + playPauseResume: + prev: + resume: + seek: + skipToNextAlbum: + skipToPreviousAlbum: + stop: + volumeDown: + volumeUp: + + + YES + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + id + + + + YES + + YES + outputDevices + playlistController + playlistView + volumeSlider + + + YES + NSArrayController + PlaylistController + PlaylistView + NSSlider + + + + IBProjectSource + Application/PlaybackController.h + + + + PlaylistController + DNDArrayController + + YES + + YES + clear: + clearFilterPredicate: + emptyQueueList: + searchByAlbum: + searchByArtist: + showEntryInFinder: + stopAfterCurrent: + toggleQueued: + toggleRepeat: + toggleShuffle: + + + YES + id + id + id + id + id + id + id + id + id + id + + + + YES + + YES + entriesController + playbackController + playlistLoader + spotlightWindowController + + + YES + EntriesController + PlaybackController + PlaylistLoader + SpotlightWindowController + + + + IBProjectSource + Playlist/PlaylistController.h + + + + PlaylistLoader + NSObject + + playlistController + PlaylistController + + + IBProjectSource + Playlist/PlaylistLoader.h + + + + PlaylistView + NSTableView + + YES + + YES + scrollToCurrentEntry: + shufflePlaylist: + sortByPath: + toggleColumn: + + + YES + id + id + id + id + + + + YES + + YES + playbackController + playlistController + + + YES + PlaybackController + PlaylistController + + + + IBProjectSource + Playlist/PlaylistView.h + + + + SideViewController + NSViewController + + YES + + YES + toggleSideView: + toggleVertical: + + + YES + id + id + + YES YES firstResponder - view + mainView + splitView YES - NSResponder NSView + NSView + NSSplitView IBProjectSource - SideView/SideView.h + Utils/SideViewController.h + + + + SpotlightWindowController + NSWindowController + + YES + + YES + addToPlaylist: + toggleWindow: + + + YES + id + id + + + + YES + + YES + pathControl + playlistController + playlistLoader + searchField + + + YES + NSPathControl + NSArrayController + PlaylistLoader + NSSearchField + + + + IBProjectSource + Spotlight/SpotlightWindowController.h diff --git a/English.lproj/MainMenu.xib b/English.lproj/MainMenu.xib index ecf3c64be..9596e2ee4 100644 --- a/English.lproj/MainMenu.xib +++ b/English.lproj/MainMenu.xib @@ -9,8 +9,8 @@ YES - + YES @@ -2089,7 +2089,7 @@ OQA YES - Show Info Drawer + Show Info Inspector i 1048576 2147483647 @@ -2105,6 +2105,15 @@ OQA + + + Show File Tree + d + 1048576 + 2147483647 + + + YES @@ -2116,54 +2125,14 @@ OQA - - - Sidebar - - 2147483647 - - - submenuAction: - - Sidebar - - YES - - YES - - - - - Window - - 2147483647 - - - submenuAction: - - Window - - YES - - - - Toggle Sidebar Orientation + Toggle File Tree Orientation 2147483647 - - - Show/Hide Sidebar - d - 1048576 - 2147483647 - - - YES @@ -2174,25 +2143,6 @@ OQA - - - YES - YES - - - 2147483647 - - - - - - Hide Playlist - - 1048576 - 2147483647 - - - Customize Toolbar... @@ -3797,10 +3747,7 @@ OQA YES - SideBarController - - - SideWindowController + FileTreeViewController TagEditorController @@ -6433,22 +6380,6 @@ OQA 2121 - - - sideViewMenu - - - - 2174 - - - - sideViewMenu - - - - 2175 - toggleVertical: @@ -6457,22 +6388,6 @@ OQA 2176 - - - toggleSideBar: - - - - 2177 - - - - playlistLoader - - - - 2178 - playlistLoader @@ -6481,14 +6396,6 @@ OQA 2179 - - - playlistView - - - - 2180 - splitView @@ -6537,30 +6444,6 @@ OQA 2220 - - - playbackController - - - - 2221 - - - - mainToolbar - - - - 2230 - - - - miniToolbar - - - - 2231 - otherWindow @@ -6850,14 +6733,6 @@ OQA 2404 - - - playbackController - - - - 2406 - playlistLoader @@ -6926,6 +6801,22 @@ OQA 2415 + + + toggleSideView: + + + + 2419 + + + + mainView + + + + 2421 + @@ -8177,7 +8068,6 @@ OQA YES - @@ -8185,11 +8075,8 @@ OQA - - - - + @@ -8198,11 +8085,6 @@ OQA - - 1855 - - - 1856 @@ -8559,65 +8441,16 @@ OQA - - 2156 - - - YES - - - - - - 2157 - - - YES - - - 2160 - - 2165 - - - - - 2168 - - - - - 2169 - - - YES - - - - - - 2170 - - - YES - - - 2172 - - 2173 - - - 2187 @@ -9248,6 +9081,11 @@ OQA + + 2417 + + + @@ -9558,7 +9396,6 @@ OQA 1851.ImportedFromIB2 1853.IBPluginDependency 1854.IBPluginDependency - 1855.IBPluginDependency 1856.IBPluginDependency 1856.ImportedFromIB2 1857.IBPluginDependency @@ -9612,17 +9449,8 @@ OQA 21.windowTemplate.maxSize 2123.IBPluginDependency 2155.IBPluginDependency - 2156.IBPluginDependency - 2157.IBEditorWindowLastContentRect - 2157.IBPluginDependency 2160.IBPluginDependency - 2165.IBPluginDependency - 2168.IBPluginDependency - 2169.IBPluginDependency - 2170.IBEditorWindowLastContentRect - 2170.IBPluginDependency 2172.IBPluginDependency - 2173.IBPluginDependency 218.CustomClassName 218.IBPluginDependency 218.ImportedFromIB2 @@ -9712,6 +9540,7 @@ OQA 24.editorWindowContentRectSynchronizationRect 2403.IBPluginDependency 2405.IBPluginDependency + 2417.IBPluginDependency 268.IBEditorWindowLastContentRect 268.IBWindowTemplateEditedContentRect 268.ImportedFromIB2 @@ -10143,7 +9972,7 @@ OQA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{282, 543}, {252, 183}} + {{282, 552}, {252, 183}} com.apple.InterfaceBuilder.CocoaPlugin {{213, 653}, {252, 183}} @@ -10175,7 +10004,7 @@ OQA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{326, 483}, {277, 243}} + {{721, 674}, {285, 173}} com.apple.InterfaceBuilder.CocoaPlugin {{257, 573}, {237, 163}} com.apple.InterfaceBuilder.CocoaPlugin @@ -10183,7 +10012,6 @@ OQA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -10227,8 +10055,8 @@ OQA com.apple.InterfaceBuilder.CocoaPlugin - {{334, 92}, {691, 397}} - {{334, 92}, {691, 397}} + {{347, 94}, {691, 397}} + {{347, 94}, {691, 397}} {{25, 14}, {683, 396}} @@ -10237,15 +10065,6 @@ OQA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{603, 670}, {64, 6}} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{619, 900}, {64, 6}} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin PlaylistController com.apple.InterfaceBuilder.CocoaPlugin @@ -10330,12 +10149,13 @@ OQA com.apple.InterfaceBuilder.CocoaPlugin - {{511, 623}, {197, 103}} + {{511, 632}, {197, 103}} com.apple.InterfaceBuilder.CocoaPlugin {{442, 733}, {197, 103}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin {{314, 416}, {480, 376}} {{314, 416}, {480, 376}} @@ -10381,7 +10201,7 @@ OQA com.apple.InterfaceBuilder.CocoaPlugin - {{181, 735}, {462, 20}} + {{576, 847}, {462, 20}} com.apple.InterfaceBuilder.CocoaPlugin {{112, 736}, {462, 20}} @@ -10521,7 +10341,7 @@ OQA - 2415 + 2421 @@ -10764,6 +10584,18 @@ OQA + + FileTreeViewController + SideViewController + + playlistLoader + PlaylistLoader + + + IBProjectSource + FileTree/FileTreeViewController.h + + FirstResponder NSObject @@ -11137,13 +10969,13 @@ OQA - SideBarController - SideViewController + SideViewController + NSViewController YES YES - toggleSideBar: + toggleSideView: toggleVertical: @@ -11156,47 +10988,20 @@ OQA YES YES - playlistView + firstResponder + mainView splitView YES NSView + NSView NSSplitView IBProjectSource - SideView/SideBarController.h - - - - SideViewController - NSObject - - YES - - YES - playlistLoader - sideViewMenu - - - YES - PlaylistLoader - NSMenu - - - - IBProjectSource - SideView/SideViewController.h - - - - SideWindowController - SideViewController - - IBProjectSource - SideView/SideWindowController.h + Utils/SideViewController.h diff --git a/FileTree/FileTreeController.h b/FileTree/FileTreeController.h new file mode 100644 index 000000000..02f99c3c6 --- /dev/null +++ b/FileTree/FileTreeController.h @@ -0,0 +1,19 @@ +// +// FileTreeController.h +// Cog +// +// Created by Vincent Spader on 2/17/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import + +@class SideViewController; +@interface FileTreeController : NSObject { + IBOutlet SideViewController *controller; + IBOutlet NSOutlineView *outlineView; +} + +- (IBAction)addToPlaylist:(id)sender; + +@end diff --git a/FileTree/FileTreeController.m b/FileTree/FileTreeController.m new file mode 100644 index 000000000..e5cf05d06 --- /dev/null +++ b/FileTree/FileTreeController.m @@ -0,0 +1,32 @@ +// +// 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]; +} + + +@end diff --git a/FileTree/FileTreeViewController.h b/FileTree/FileTreeViewController.h index 19afabd2e..e0dce9eca 100644 --- a/FileTree/FileTreeViewController.h +++ b/FileTree/FileTreeViewController.h @@ -1,22 +1,17 @@ // -// FileTreeController.h +// SideBarController.h // Cog // -// Created by Vincent Spader on 2/17/08. +// Created by Vincent Spader on 6/21/08. // Copyright 2008 __MyCompanyName__. All rights reserved. // #import -#import "PlaylistLoader.h" +#import "SideViewController.h" @class PlaylistLoader; -@class SideView; - -@interface FileTreeViewController : NSObject { - IBOutlet SideView *controller; - IBOutlet NSOutlineView *outlineView; +@interface FileTreeViewController : SideViewController { + IBOutlet PlaylistLoader *playlistLoader; } -- (IBAction)addToPlaylist:(id)sender; - @end diff --git a/FileTree/FileTreeViewController.m b/FileTree/FileTreeViewController.m index e28774c1e..a47f5f267 100644 --- a/FileTree/FileTreeViewController.m +++ b/FileTree/FileTreeViewController.m @@ -1,31 +1,26 @@ // -// FileTreeController.m +// SplitViewController.m // Cog // -// Created by Vincent Spader on 2/17/08. +// Created by Vincent Spader on 6/20/08. // Copyright 2008 __MyCompanyName__. All rights reserved. // -#import "PlaylistController.h" #import "FileTreeViewController.h" - +#import "PlaylistLoader.h" @implementation FileTreeViewController -- (IBAction)addToPlaylist:(id)sender +- (id)init { - unsigned int index; - NSIndexSet *selectedIndexes = [outlineView selectedRowIndexes]; - NSMutableArray *urls = [[NSMutableArray alloc] init]; + return [super initWithNibName:@"FileTree" bundle:[NSBundle mainBundle]]; +} - for (index = [selectedIndexes firstIndex]; - index != NSNotFound; index = [selectedIndexes indexGreaterThanIndex: index]) - { - [urls addObject:[[outlineView itemAtRow:index] URL]]; - } - - [controller addToPlaylist:urls]; - [urls release]; + +- (void)addToPlaylist:(NSArray *)urls +{ + [playlistLoader willInsertURLs:urls origin:URLOriginExternal]; + [playlistLoader didInsertURLs:[playlistLoader addURLs:urls sort:YES] origin:URLOriginExternal]; } diff --git a/SideView/SideBarController.h b/SideView/SideBarController.h deleted file mode 100644 index 216e96fd4..000000000 --- a/SideView/SideBarController.h +++ /dev/null @@ -1,34 +0,0 @@ -// -// SideBarController.h -// Cog -// -// Created by Vincent Spader on 6/21/08. -// Copyright 2008 __MyCompanyName__. All rights reserved. -// - -#import - -#import "SideViewController.h" - -@class SideView; - -@interface SideBarController : SideViewController { - IBOutlet NSSplitView *splitView; - IBOutlet NSView *playlistView; - SideView *sideView; -} - -- (IBAction)toggleSideBar:(id)sender; -- (IBAction)toggleVertical:(id)sender; - -- (void)showSideBar; -- (void)hideSideBar; -- (BOOL)sideBarIsHidden; - -- (void)setDividerPosition:(float)position; -- (float)dividerPosition; - -- (SideView *)sideView; -- (void)setSideView:(SideView *)sideView; - -@end diff --git a/SideView/SideBarController.m b/SideView/SideBarController.m deleted file mode 100644 index 78fdd9920..000000000 --- a/SideView/SideBarController.m +++ /dev/null @@ -1,260 +0,0 @@ -// -// SplitViewController.m -// Cog -// -// Created by Vincent Spader on 6/20/08. -// Copyright 2008 __MyCompanyName__. All rights reserved. -// - -#import "SideBarController.h" - -#import "SideView.h" - -@implementation SideBarController - -+ (void)initialize -{ - NSMutableDictionary *userDefaultsValuesDict = [NSMutableDictionary dictionary]; - - [userDefaultsValuesDict setObject:[NSNumber numberWithBool:YES] forKey:@"sideBarVertical"]; - [userDefaultsValuesDict setObject:[NSNumber numberWithBool:NO] forKey:@"showSideBar"]; - [userDefaultsValuesDict setObject:[NSNumber numberWithFloat:100.0] forKey:@"sideBarDividerPosition"]; - [userDefaultsValuesDict setObject:@"File Tree" forKey:@"lastSideBar"]; - - [[NSUserDefaults standardUserDefaults] registerDefaults:userDefaultsValuesDict]; -} - - -- (id)init -{ - self = [super init]; - if (self) - { - [sideViewNibs setObject:@"FileTree" forKey:@"File Tree"]; - - sideView = nil; - } - - return self; -} - -- (void)dealloc -{ - [sideView release]; - - [super dealloc]; -} - -- (void)awakeFromNib -{ - [super awakeFromNib]; - - if ([[NSUserDefaults standardUserDefaults] boolForKey:@"showSideBar"]) - { - [self showSideBar]; - } - - if (![[NSUserDefaults standardUserDefaults] boolForKey:@"sideBarVertical"]) - { - [self toggleVertical:self]; - } -} - -- (void)selectSideViewWithTitle:(NSString *)title -{ - SideView *newSideView = [self sideViewForTitle:title]; - - [[NSUserDefaults standardUserDefaults] setObject:title forKey:@"lastSideBar"]; - - if (newSideView == [self sideView]) - { - [self toggleSideBar:self]; - } - else - { - [self setSideView: newSideView]; - [self showSideBar]; - } - - [splitView adjustSubviews]; -} - -- (IBAction)toggleSideBar:(id)sender -{ - //Show/hide current - if ([self sideBarIsHidden]) - { - [self showSideBar]; - } - else - { - [self hideSideBar]; - } - - [splitView adjustSubviews]; -} - -- (IBAction)toggleVertical:(id)sender -{ - [splitView setVertical:![splitView isVertical]]; - - if (![self sideBarIsHidden]) - { - [self setSideView:[self sideView]]; - [self showSideBar]; - } - - [splitView adjustSubviews]; - - [[NSUserDefaults standardUserDefaults] setBool:[splitView isVertical] forKey:@"sideBarVertical"]; -} - -- (SideView *)sideView -{ - if (sideView == nil) - { - [self setSideView:[self sideViewForTitle:[[NSUserDefaults standardUserDefaults] objectForKey:@"lastSideBar"]]]; - } - - return sideView; -} - -- (void)setSideView:(SideView *)newSideView -{ - [newSideView retain]; - sideView = newSideView; - [sideView release]; -} - -- (void)showSideBar -{ - if ([splitView isVertical]) { - [splitView setSubviews:[NSArray arrayWithObjects:[[self sideView] view], playlistView, nil]]; - } - else { - [splitView setSubviews:[NSArray arrayWithObjects:playlistView, [[self sideView] view], nil]]; - } - - [self setDividerPosition: [[NSUserDefaults standardUserDefaults] floatForKey:@"sideBarDividerPosition"]]; - - [[[sideView view] window] makeFirstResponder:[sideView firstResponder]]; - - [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"showSideBar"]; -} - -- (void)hideSideBar -{ - [splitView setSubviews:[NSArray arrayWithObject:playlistView]]; - [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"showSideBar"]; - - [[playlistView window] makeFirstResponder:playlistView]; -} - -- (BOOL)sideBarIsHidden -{ - return ([[splitView subviews] count] == 1); -} - -- (BOOL)splitView:(NSSplitView *)aSplitView canCollapseSubview:(NSView *)subview -{ - return (subview != playlistView); -} - - -- (BOOL)splitView:(NSSplitView *)aSplitView shouldCollapseSubview:(NSView *)subview forDoubleClickOnDividerAtIndex:(NSInteger)dividerIndex -{ - return (subview != playlistView); -} - -- (void)splitViewDidResizeSubviews:(NSNotification *)aNotification -{ - //Update default - if (![self sideBarIsHidden]) - { - [[NSUserDefaults standardUserDefaults] setFloat:[self dividerPosition] forKey:@"sideBarDividerPosition"]; - NSLog(@"DIVIDER POSITION: %f", [self dividerPosition]); - } -} - -- (void)splitView:(NSSplitView *)sender resizeSubviewsWithOldSize: (NSSize)oldSize -{ - if ([self sideBarIsHidden]) - { - [splitView adjustSubviews]; - } - else - { - CGFloat dividerThickness = [splitView dividerThickness]; - - NSRect sideRect = [[sideView view] frame]; - NSRect playlistRect = [playlistView frame]; - - NSRect newFrame = [splitView frame]; - - if ([splitView isVertical]) - { - NSLog(@"VERTICAL"); - sideRect.size.width = [[NSUserDefaults standardUserDefaults] floatForKey:@"sideBarDividerPosition"]; - sideRect.size.height = newFrame.size.height; - sideRect.origin = NSMakePoint(0, 0); - - playlistRect.size.width = newFrame.size.width - sideRect.size.width - dividerThickness; - playlistRect.size.height = newFrame.size.height; - playlistRect.origin.x = sideRect.size.width + dividerThickness; - } - else - { - NSLog(@"NOT VERTICAL"); - sideRect.size.height = [[NSUserDefaults standardUserDefaults] floatForKey:@"sideBarDividerPosition"]; - sideRect.size.width = newFrame.size.width; - - playlistRect.origin = NSMakePoint(0, 0); - playlistRect.size.width = newFrame.size.width; - playlistRect.size.height = newFrame.size.height - sideRect.size.height - dividerThickness; - - sideRect.origin.y = playlistRect.size.height + dividerThickness; - } - - - NSLog(@"SIDE: %f,%f %fx%f", sideRect.origin.x, sideRect.origin.y, sideRect.size.width, sideRect.size.height); - NSLog(@"Playlist: %f,%f %fx%f", playlistRect.origin.x, playlistRect.origin.y, playlistRect.size.width, playlistRect.size.height); - - [[sideView view] setFrame:sideRect]; - [playlistView setFrame:playlistRect]; - } -} - -- (float)dividerPosition -{ - if ([splitView isVertical]) - { - return [[sideView view] frame].size.width; - } - - return [[sideView view] frame].size.height; -} - -- (void)setDividerPosition:(float)position -{ - float actualPosition = position; - if (![splitView isVertical]) - { - actualPosition = ([splitView frame].size.height - position); - } - - [splitView adjustSubviews]; - [splitView setPosition:actualPosition ofDividerAtIndex:0]; - - [[NSUserDefaults standardUserDefaults] setFloat:position forKey:@"sideBarDividerPosition"]; - NSLog(@"SETTING POSITION: %f (%f) == %f?", actualPosition, position, [self dividerPosition]); - - NSRect sideRect = [[sideView view] frame]; - NSRect playlistRect = [playlistView frame]; - NSLog(@"SIDE: %f,%f %fx%f", sideRect.origin.x, sideRect.origin.y, sideRect.size.width, sideRect.size.height); - NSLog(@"Playlist: %f,%f %fx%f", playlistRect.origin.x, playlistRect.origin.y, playlistRect.size.width, playlistRect.size.height); -} - - - - -@end diff --git a/SideView/SideView.h b/SideView/SideView.h deleted file mode 100644 index 53283b217..000000000 --- a/SideView/SideView.h +++ /dev/null @@ -1,26 +0,0 @@ -// -// HelperController.h -// Cog -// -// Created by Vincent Spader on 6/20/08. -// Copyright 2008 __MyCompanyName__. All rights reserved. -// - -#import - -@class SideViewController; - -@interface SideView : NSObject { - IBOutlet NSView *view; - IBOutlet NSResponder *firstResponder; - - SideViewController *controller; -} - -- (id)initWithNibNamed:(NSString *)nibName controller:(SideViewController *)c; -- (NSView *)view; -- (NSResponder *)firstResponder; - -- (void) addToPlaylist:(NSArray *)urls; - -@end diff --git a/SideView/SideView.m b/SideView/SideView.m deleted file mode 100644 index 1054c7b4d..000000000 --- a/SideView/SideView.m +++ /dev/null @@ -1,42 +0,0 @@ -// -// HelperController.m -// Cog -// -// Created by Vincent Spader on 6/20/08. -// Copyright 2008 __MyCompanyName__. All rights reserved. -// - -#import "SideView.h" - - -@implementation SideView - -- (id)initWithNibNamed:(NSString *)nibName controller:(SideViewController *)c -{ - self = [super init]; - if (self) - { - controller = c; - - [NSBundle loadNibNamed:nibName owner:self]; - } - - return self; -} - -- (NSView *)view -{ - return view; -} - -- (NSResponder *)firstResponder -{ - return firstResponder; -} - -- (void) addToPlaylist:(NSArray *)urls -{ - [controller addToPlaylist:urls]; -} - -@end diff --git a/SideView/SideViewController.h b/SideView/SideViewController.h deleted file mode 100644 index a522ddc7d..000000000 --- a/SideView/SideViewController.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// SplitViewController.h -// Cog -// -// Created by Vincent Spader on 6/20/08. -// Copyright 2008 __MyCompanyName__. All rights reserved. -// - -#import - -@class SideView; -@class PlaylistLoader; - -@interface SideViewController : NSObject { - IBOutlet NSMenu *sideViewMenu; - IBOutlet PlaylistLoader *playlistLoader; - - NSMutableDictionary *sideViewNibs; - NSMutableDictionary *sideViews; -} - -- (SideView *)sideViewForTitle:(NSString *)title; -- (void)selectSideViewWithTitle:(NSString *)title; //To be overridden by subclass - -//Helper for adding files to the playlist -- (void) addToPlaylist:(NSArray *)urls; - -@end diff --git a/SideView/SideViewController.m b/SideView/SideViewController.m deleted file mode 100644 index ed6dcee23..000000000 --- a/SideView/SideViewController.m +++ /dev/null @@ -1,83 +0,0 @@ -// -// SplitViewController.m -// Cog -// -// Created by Vincent Spader on 6/20/08. -// Copyright 2008 __MyCompanyName__. All rights reserved. -// - -#import "SideViewController.h" - -#import "PlaylistLoader.h" -#import "SideView.h" - -@implementation SideViewController - -- (id)init -{ - self = [super init]; - if (self) - { - sideViewNibs = [[NSMutableDictionary alloc] init]; - sideViews = [[NSMutableDictionary alloc] init]; - } - - return self; -} - -- (void)dealloc -{ - [sideViews release]; - [sideViewNibs release]; - - [super dealloc]; -} - -- (void)awakeFromNib -{ - for (NSString *title in sideViewNibs) - { - //Create menu item - NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:title action:@selector(selectSideView:) keyEquivalent:@""]; - [item setTarget:self]; - [item setRepresentedObject:title]; - [sideViewMenu addItem:item]; - } -} - -- (SideView *)sideViewForTitle:(NSString *)title -{ - SideView *newSideView = [sideViews objectForKey:title]; - if (newSideView == nil) - { - NSString *nibName = [sideViewNibs objectForKey:title]; - newSideView = [[SideView alloc] initWithNibNamed:nibName controller:self]; - - [sideViews setObject:newSideView forKey:title]; - - [newSideView release]; - } - - return newSideView; -} - -- (IBAction)selectSideView:(id)sender -{ - NSString *title = [sender representedObject]; - - [self selectSideViewWithTitle:title]; -} - -- (void)selectSideViewWithTitle:(NSString *)title -{ - //To be overridden -} - -- (void) addToPlaylist:(NSArray *)urls -{ - [playlistLoader willInsertURLs:urls origin:URLOriginExternal]; - [playlistLoader didInsertURLs:[playlistLoader addURLs:urls sort:YES] origin:URLOriginExternal]; -} - - -@end diff --git a/SideView/SideWindowController.h b/SideView/SideWindowController.h deleted file mode 100644 index c84f4fff0..000000000 --- a/SideView/SideWindowController.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// SideWindowController.h -// Cog -// -// Created by Vincent Spader on 6/21/08. -// Copyright 2008 __MyCompanyName__. All rights reserved. -// - -#import - -#import "SideViewController.h" - -@interface SideWindowController : SideViewController { - NSMutableDictionary *windows; -} - -@end diff --git a/SideView/SideWindowController.m b/SideView/SideWindowController.m deleted file mode 100644 index 6084c9ba9..000000000 --- a/SideView/SideWindowController.m +++ /dev/null @@ -1,53 +0,0 @@ -// -// SideWindowController.m -// Cog -// -// Created by Vincent Spader on 6/21/08. -// Copyright 2008 __MyCompanyName__. All rights reserved. -// - -#import "SideWindowController.h" - - -@implementation SideWindowController - -- (id)init -{ - self = [super init]; - if (self) - { - [sideViewNibs setObject:@"FileTree" forKey:@"File Tree"]; - - windows = [[NSMutableDictionary alloc] init]; - } - - return self; -} - -- (void)dealloc -{ - [windows release]; - - [super dealloc]; -} - -- (void)selectSideViewWithTitle:(NSString *)title -{ - NSPanel *window = [windows objectForKey:title]; - if (window == nil) - { - SideView *newSideView = [self sideViewForTitle:title]; - - NSUInteger styleMask = (NSClosableWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask|NSTitledWindowMask|NSUtilityWindowMask); - - window = [[NSPanel alloc] initWithContentRect:[[newSideView view] frame] styleMask:styleMask backing:NSBackingStoreBuffered defer:NO]; - [window setContentView:[newSideView view]]; - - [windows setObject:window forKey:title]; - } - - [window makeKeyAndOrderFront:self]; -} - - -@end diff --git a/Utils/SideViewController.h b/Utils/SideViewController.h new file mode 100644 index 000000000..5f9f68a0e --- /dev/null +++ b/Utils/SideViewController.h @@ -0,0 +1,27 @@ +// +// SideBarController.h +// Cog +// +// Created by Vincent Spader on 6/21/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import + +@interface SideViewController : NSViewController { + IBOutlet NSSplitView *splitView; + IBOutlet NSView *mainView; + IBOutlet NSView *firstResponder; +} + +- (IBAction)toggleSideView:(id)sender; +- (IBAction)toggleVertical:(id)sender; + +- (void)showSideView; +- (void)hideSideView; +- (BOOL)sideViewIsHidden; + +- (void)setDividerPosition:(float)position; +- (float)dividerPosition; + +@end diff --git a/Utils/SideViewController.m b/Utils/SideViewController.m new file mode 100644 index 000000000..e68179d80 --- /dev/null +++ b/Utils/SideViewController.m @@ -0,0 +1,211 @@ +// +// SplitViewController.m +// Cog +// +// Created by Vincent Spader on 6/20/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import "SideViewController.h" + +@implementation SideViewController + +- (NSString *)showSideViewDefaultsKey +{ + return [NSString stringWithFormat:@"%@ShowSideView", [self nibName]]; +} + +- (NSString *)sideViewVerticalDefaultsKey +{ + return [NSString stringWithFormat:@"%@SideViewVertical", [self nibName]]; +} + +- (NSString *)sideViewDividerPositionDefaultsKey +{ + return [NSString stringWithFormat:@"%@SideViewDividerPosition", [self nibName]]; +} + +- (void)registerDefaults +{ + NSMutableDictionary *userDefaultsValuesDict = [NSMutableDictionary dictionary]; + + [userDefaultsValuesDict setObject:[NSNumber numberWithBool:YES] forKey:@"sideViewVertical"]; + [userDefaultsValuesDict setObject:[NSNumber numberWithBool:NO] forKey:@"showSideView"]; + [userDefaultsValuesDict setObject:[NSNumber numberWithFloat:100.0] forKey:@"sideViewDividerPosition"]; + + [[NSUserDefaults standardUserDefaults] registerDefaults:userDefaultsValuesDict]; +} + +- (id)initWithNibName:(NSString *)nib bundle:(NSBundle *)bundle +{ + self = [super initWithNibName:nib bundle:bundle]; + if (self) + { + [self registerDefaults]; + } + + return self; +} + + +- (void)awakeFromNib +{ + if ([[NSUserDefaults standardUserDefaults] boolForKey:[self showSideViewDefaultsKey]]) + { + [self showSideView]; + } + + if (![[NSUserDefaults standardUserDefaults] boolForKey:[self sideViewVerticalDefaultsKey]]) + { + [self toggleVertical:self]; + } +} + +- (IBAction)toggleSideView:(id)sender +{ + //Show/hide current + if ([self sideViewIsHidden]) + { + [self showSideView]; + } + else + { + [self hideSideView]; + } + + [splitView adjustSubviews]; +} + +- (IBAction)toggleVertical:(id)sender +{ + [splitView setVertical:![splitView isVertical]]; + + if (![self sideViewIsHidden]) + { + [self showSideView]; + } + + [splitView adjustSubviews]; + + [[NSUserDefaults standardUserDefaults] setBool:[splitView isVertical] forKey:[self sideViewVerticalDefaultsKey]]; +} + +- (void)showSideView +{ + if ([splitView isVertical]) { + [splitView setSubviews:[NSArray arrayWithObjects:[self view], mainView, nil]]; + } + else { + [splitView setSubviews:[NSArray arrayWithObjects:mainView, [self view], nil]]; + } + + [self setDividerPosition: [[NSUserDefaults standardUserDefaults] floatForKey:[self sideViewDividerPositionDefaultsKey]]]; + + [[[self view] window] makeFirstResponder:firstResponder]; + + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:[self showSideViewDefaultsKey]]; +} + +- (void)hideSideView +{ + [splitView setSubviews:[NSArray arrayWithObject:mainView]]; + [[NSUserDefaults standardUserDefaults] setBool:NO forKey:[self showSideViewDefaultsKey]]; + + [[mainView window] makeFirstResponder:mainView]; +} + +- (BOOL)sideViewIsHidden +{ + return ([[splitView subviews] count] == 1); +} + +- (BOOL)splitView:(NSSplitView *)aSplitView canCollapseSubview:(NSView *)subview +{ + return (subview != mainView); +} + + +- (BOOL)splitView:(NSSplitView *)aSplitView shouldCollapseSubview:(NSView *)subview forDoubleClickOnDividerAtIndex:(NSInteger)dividerIndex +{ + return (subview != mainView); +} + +- (void)splitViewDidResizeSubviews:(NSNotification *)aNotification +{ + //Update default + if (![self sideViewIsHidden]) + { + [[NSUserDefaults standardUserDefaults] setFloat:[self dividerPosition] forKey:[self sideViewDividerPositionDefaultsKey]]; + NSLog(@"DIVIDER POSITION: %f", [self dividerPosition]); + } +} + +- (void)splitView:(NSSplitView *)sender resizeSubviewsWithOldSize: (NSSize)oldSize +{ + if ([self sideViewIsHidden]) + { + [splitView adjustSubviews]; + } + else + { + CGFloat dividerThickness = [splitView dividerThickness]; + + NSRect sideRect = [[self view] frame]; + NSRect mainRect = [mainView frame]; + + NSRect newFrame = [splitView frame]; + + if ([splitView isVertical]) + { + sideRect.size.width = [[NSUserDefaults standardUserDefaults] floatForKey:[self sideViewDividerPositionDefaultsKey]]; + sideRect.size.height = newFrame.size.height; + sideRect.origin = NSMakePoint(0, 0); + + mainRect.size.width = newFrame.size.width - sideRect.size.width - dividerThickness; + mainRect.size.height = newFrame.size.height; + mainRect.origin.x = sideRect.size.width + dividerThickness; + } + else + { + sideRect.size.height = [[NSUserDefaults standardUserDefaults] floatForKey:[self sideViewDividerPositionDefaultsKey]]; + sideRect.size.width = newFrame.size.width; + + mainRect.origin = NSMakePoint(0, 0); + mainRect.size.width = newFrame.size.width; + mainRect.size.height = newFrame.size.height - sideRect.size.height - dividerThickness; + + sideRect.origin.y = mainRect.size.height + dividerThickness; + } + + + [[self view] setFrame:sideRect]; + [mainView setFrame:mainRect]; + } +} + +- (float)dividerPosition +{ + if ([splitView isVertical]) + { + return [[self view] frame].size.width; + } + + return [[self view] frame].size.height; +} + +- (void)setDividerPosition:(float)position +{ + float actualPosition = position; + if (![splitView isVertical]) + { + actualPosition = ([splitView frame].size.height - position); + } + + [splitView adjustSubviews]; + [splitView setPosition:actualPosition ofDividerAtIndex:0]; + + [[NSUserDefaults standardUserDefaults] setFloat:position forKey:[self sideViewDividerPositionDefaultsKey]]; +} + + +@end