diff --git a/src/MacVim/MMFullScreenWindow.m b/src/MacVim/MMFullScreenWindow.m index ee6205de23..bafb751648 100644 --- a/src/MacVim/MMFullScreenWindow.m +++ b/src/MacVim/MMFullScreenWindow.m @@ -30,7 +30,7 @@ #import "MMWindowController.h" #import "Miscellaneous.h" #import -#import +#import "PSMTabBarControl/source/PSMTabBarControl.h" // These have to be the same as in option.h #define FUOPT_MAXVERT 0x001 diff --git a/src/MacVim/MMVimView.m b/src/MacVim/MMVimView.m index a4125ced60..7e4e49ddd8 100644 --- a/src/MacVim/MMVimView.m +++ b/src/MacVim/MMVimView.m @@ -24,7 +24,7 @@ #import "MMVimController.h" #import "MMVimView.h" #import "MMWindowController.h" -#import +#import "PSMTabBarControl/source/PSMTabBarControl.h" @@ -50,7 +50,7 @@ - (void)setRange:(NSRange)newRange; @end -@interface MMVimView (Private) +@interface MMVimView (Private) - (BOOL)bottomScrollbarVisible; - (BOOL)leftScrollbarVisible; - (BOOL)rightScrollbarVisible; @@ -581,7 +581,9 @@ - (BOOL)tabBarControl:(PSMTabBarControl *)theTabBarControl } } - +- (void)tabView:(NSTabView *)tabView updateStateForTabViewItem:(NSTabViewItem *)tabViewItem +{ +} // -- NSView customization --------------------------------------------------- diff --git a/src/MacVim/MMWindowController.m b/src/MacVim/MMWindowController.m index c54409e699..ece5df5d55 100644 --- a/src/MacVim/MMWindowController.m +++ b/src/MacVim/MMWindowController.m @@ -71,7 +71,7 @@ #import "MMWindow.h" #import "MMWindowController.h" #import "Miscellaneous.h" -#import +#import "PSMTabBarControl/source/PSMTabBarControl.h" // These have to be the same as in option.h diff --git a/src/MacVim/MacVim.xcodeproj/project.pbxproj b/src/MacVim/MacVim.xcodeproj/project.pbxproj index 5bfac7810b..e55a6068b6 100644 --- a/src/MacVim/MacVim.xcodeproj/project.pbxproj +++ b/src/MacVim/MacVim.xcodeproj/project.pbxproj @@ -22,7 +22,6 @@ 1D384A0E100D671700D3C22F /* KeyBinding.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1D384A0D100D671700D3C22F /* KeyBinding.plist */; }; 1D44972211FCA9B400B0630F /* MMCoreTextView+ToolTip.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D44972111FCA9B400B0630F /* MMCoreTextView+ToolTip.m */; }; 1D493D580C5247BF00AB718C /* Vim in Copy Executables */ = {isa = PBXBuildFile; fileRef = 1D493D570C5247BF00AB718C /* Vim */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - 1D493DBA0C52534300AB718C /* PSMTabBarControl.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 1D493DB90C52533B00AB718C /* PSMTabBarControl.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 1D60088B0E96A0B2003763F0 /* MMFindReplaceController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D60088A0E96A0B2003763F0 /* MMFindReplaceController.m */; }; 1D80591F0E1185EA001699D1 /* Miscellaneous.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D80591D0E1185EA001699D1 /* Miscellaneous.m */; }; 1D80FBD40CBBD3B700102A1C /* MMFullScreenWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D80FBD00CBBD3B700102A1C /* MMFullScreenWindow.m */; }; @@ -63,11 +62,41 @@ 1DE8CC620C5E2AAD003F56E3 /* Actions.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1DE8CC610C5E2AAD003F56E3 /* Actions.plist */; }; 1DE9B9500D341AB8008FEDD4 /* MMWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DE9B94E0D341AB8008FEDD4 /* MMWindow.m */; }; 1DED78600C6DE43D0079945F /* vimrc in Copy Vim Runtime Files */ = {isa = PBXBuildFile; fileRef = 1DED785F0C6DE43D0079945F /* vimrc */; }; - 1DFE25A50C527BC4003000F7 /* PSMTabBarControl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D493DB90C52533B00AB718C /* PSMTabBarControl.framework */; }; + 52818B031C1C08CE00F59085 /* QLStephen.qlgenerator in Copy QuickLookPlugin */ = {isa = PBXBuildFile; fileRef = 52818AFF1C1C075300F59085 /* QLStephen.qlgenerator */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 52A364731C4A5789005757EC /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52A364721C4A5789005757EC /* Sparkle.framework */; }; 52A364761C4A57C1005757EC /* Sparkle.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 52A364721C4A5789005757EC /* Sparkle.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 52B7ED9B1C4A4D6900AFFF15 /* dsa_pub.pem in Resources */ = {isa = PBXBuildFile; fileRef = 52B7ED9A1C4A4D6900AFFF15 /* dsa_pub.pem */; }; - 52818B031C1C08CE00F59085 /* QLStephen.qlgenerator in Copy QuickLookPlugin */ = {isa = PBXBuildFile; fileRef = 52818AFF1C1C075300F59085 /* QLStephen.qlgenerator */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 52E08F881DA0C41A00CD9335 /* overflowImage.png in Resources */ = {isa = PBXBuildFile; fileRef = 52E08F5E1DA0C41A00CD9335 /* overflowImage.png */; }; + 52E08F891DA0C41A00CD9335 /* overflowImage@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 52E08F5F1DA0C41A00CD9335 /* overflowImage@2x.png */; }; + 52E08F8A1DA0C41A00CD9335 /* overflowImagePressed.png in Resources */ = {isa = PBXBuildFile; fileRef = 52E08F601DA0C41A00CD9335 /* overflowImagePressed.png */; }; + 52E08F8B1DA0C41A00CD9335 /* overflowImagePressed@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 52E08F611DA0C41A00CD9335 /* overflowImagePressed@2x.png */; }; + 52E08F8C1DA0C41A00CD9335 /* TabClose_Font_Pressed.psd in Resources */ = {isa = PBXBuildFile; fileRef = 52E08F621DA0C41A00CD9335 /* TabClose_Font_Pressed.psd */; }; + 52E08F8D1DA0C41A00CD9335 /* TabClose_Font_Pressed@2x.psd in Resources */ = {isa = PBXBuildFile; fileRef = 52E08F631DA0C41A00CD9335 /* TabClose_Font_Pressed@2x.psd */; }; + 52E08F8E1DA0C41A00CD9335 /* TabClose_Front.png in Resources */ = {isa = PBXBuildFile; fileRef = 52E08F641DA0C41A00CD9335 /* TabClose_Front.png */; }; + 52E08F8F1DA0C41A00CD9335 /* TabClose_Front@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 52E08F651DA0C41A00CD9335 /* TabClose_Front@2x.png */; }; + 52E08F901DA0C41A00CD9335 /* TabClose_Front_Pressed.png in Resources */ = {isa = PBXBuildFile; fileRef = 52E08F661DA0C41A00CD9335 /* TabClose_Front_Pressed.png */; }; + 52E08F911DA0C41A00CD9335 /* TabClose_Front_Pressed@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 52E08F671DA0C41A00CD9335 /* TabClose_Front_Pressed@2x.png */; }; + 52E08F921DA0C41A00CD9335 /* TabClose_Front_Rollover.png in Resources */ = {isa = PBXBuildFile; fileRef = 52E08F681DA0C41A00CD9335 /* TabClose_Front_Rollover.png */; }; + 52E08F931DA0C41A00CD9335 /* TabClose_Front_Rollover@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 52E08F691DA0C41A00CD9335 /* TabClose_Front_Rollover@2x.png */; }; + 52E08F941DA0C41A00CD9335 /* TabNewMetal.png in Resources */ = {isa = PBXBuildFile; fileRef = 52E08F6A1DA0C41A00CD9335 /* TabNewMetal.png */; }; + 52E08F951DA0C41A00CD9335 /* TabNewMetalPressed.png in Resources */ = {isa = PBXBuildFile; fileRef = 52E08F6B1DA0C41A00CD9335 /* TabNewMetalPressed.png */; }; + 52E08F961DA0C41A00CD9335 /* TabNewMetalRollover.png in Resources */ = {isa = PBXBuildFile; fileRef = 52E08F6C1DA0C41A00CD9335 /* TabNewMetalRollover.png */; }; + 52E08F971DA0C41A00CD9335 /* Warning.png in Resources */ = {isa = PBXBuildFile; fileRef = 52E08F6D1DA0C41A00CD9335 /* Warning.png */; }; + 52E08F981DA0C41A00CD9335 /* NSWindow+PSM.m in Sources */ = {isa = PBXBuildFile; fileRef = 52E08F701DA0C41A00CD9335 /* NSWindow+PSM.m */; }; + 52E08F991DA0C41A00CD9335 /* PSMDarkHighContrastTabStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 52E08F721DA0C41A00CD9335 /* PSMDarkHighContrastTabStyle.m */; }; + 52E08F9A1DA0C41A00CD9335 /* PSMDarkTabStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 52E08F741DA0C41A00CD9335 /* PSMDarkTabStyle.m */; }; + 52E08F9B1DA0C41A00CD9335 /* PSMLightHighContrastTabStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 52E08F761DA0C41A00CD9335 /* PSMLightHighContrastTabStyle.m */; }; + 52E08F9C1DA0C41A00CD9335 /* PSMOverflowPopUpButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 52E08F781DA0C41A00CD9335 /* PSMOverflowPopUpButton.m */; }; + 52E08F9D1DA0C41A00CD9335 /* PSMProgressIndicator.m in Sources */ = {isa = PBXBuildFile; fileRef = 52E08F7A1DA0C41A00CD9335 /* PSMProgressIndicator.m */; }; + 52E08F9E1DA0C41A00CD9335 /* PSMRolloverButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 52E08F7C1DA0C41A00CD9335 /* PSMRolloverButton.m */; }; + 52E08F9F1DA0C41A00CD9335 /* PSMTabBarCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 52E08F7E1DA0C41A00CD9335 /* PSMTabBarCell.m */; }; + 52E08FA01DA0C41A00CD9335 /* PSMTabBarControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 52E08F801DA0C41A00CD9335 /* PSMTabBarControl.m */; }; + 52E08FA11DA0C41A00CD9335 /* PSMTabDragAssistant.m in Sources */ = {isa = PBXBuildFile; fileRef = 52E08F821DA0C41A00CD9335 /* PSMTabDragAssistant.m */; }; + 52E08FA21DA0C41A00CD9335 /* PSMTabDragWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 52E08F841DA0C41A00CD9335 /* PSMTabDragWindow.m */; }; + 52E08FA31DA0C41A00CD9335 /* PSMYosemiteTabStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 52E08F871DA0C41A00CD9335 /* PSMYosemiteTabStyle.m */; }; + 52E08FA71DA0C4AE00CD9335 /* AMIndeterminateProgressIndicator.m in Sources */ = {isa = PBXBuildFile; fileRef = 52E08FA61DA0C4AE00CD9335 /* AMIndeterminateProgressIndicator.m */; }; + 52E08FAA1DA0C77100CD9335 /* NSImage+iTerm.m in Sources */ = {isa = PBXBuildFile; fileRef = 52E08FA81DA0C77100CD9335 /* NSImage+iTerm.m */; }; + 52E08FAC1DA0C85F00CD9335 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52E08FAB1DA0C85F00CD9335 /* QuartzCore.framework */; }; 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 29B97318FDCFA39411CA2CEA /* MainMenu.nib */; }; 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; @@ -75,20 +104,6 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - 1D493DB80C52533B00AB718C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 1D493DB30C52533B00AB718C /* PSMTabBarControl.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 53DF68FD067E5B5A0090B5B0; - remoteInfo = PSMTabBarControlFramework; - }; - 1D493DCC0C5254A400AB718C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 1D493DB30C52533B00AB718C /* PSMTabBarControl.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 53DF68FC067E5B5A0090B5B0; - remoteInfo = PSMTabBarControlFramework; - }; 52818AFE1C1C075300F59085 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 52818AFA1C1C075300F59085 /* QuickLookStephen.xcodeproj */; @@ -124,7 +139,6 @@ dstSubfolderSpec = 10; files = ( 52A364761C4A57C1005757EC /* Sparkle.framework in Copy Frameworks */, - 1D493DBA0C52534300AB718C /* PSMTabBarControl.framework in Copy Frameworks */, ); name = "Copy Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -182,7 +196,6 @@ 1D384A0D100D671700D3C22F /* KeyBinding.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = KeyBinding.plist; sourceTree = ""; }; 1D44972111FCA9B400B0630F /* MMCoreTextView+ToolTip.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MMCoreTextView+ToolTip.m"; sourceTree = ""; }; 1D493D570C5247BF00AB718C /* Vim */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; name = Vim; path = ../Vim; sourceTree = SOURCE_ROOT; }; - 1D493DB30C52533B00AB718C /* PSMTabBarControl.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = PSMTabBarControl.xcodeproj; path = PSMTabBarControl/PSMTabBarControl.xcodeproj; sourceTree = ""; }; 1D6008820E96886D003763F0 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/FindAndReplace.nib; sourceTree = ""; }; 1D6008890E96A0B2003763F0 /* MMFindReplaceController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMFindReplaceController.h; sourceTree = ""; }; 1D60088A0E96A0B2003763F0 /* MMFindReplaceController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMFindReplaceController.m; sourceTree = ""; }; @@ -239,6 +252,52 @@ 52818AFA1C1C075300F59085 /* QuickLookStephen.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = QuickLookStephen.xcodeproj; path = qlstephen/QuickLookStephen.xcodeproj; sourceTree = ""; }; 52A364721C4A5789005757EC /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Sparkle.framework; sourceTree = ""; }; 52B7ED9A1C4A4D6900AFFF15 /* dsa_pub.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = dsa_pub.pem; sourceTree = ""; }; + 52E08F5E1DA0C41A00CD9335 /* overflowImage.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = overflowImage.png; sourceTree = ""; }; + 52E08F5F1DA0C41A00CD9335 /* overflowImage@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "overflowImage@2x.png"; sourceTree = ""; }; + 52E08F601DA0C41A00CD9335 /* overflowImagePressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = overflowImagePressed.png; sourceTree = ""; }; + 52E08F611DA0C41A00CD9335 /* overflowImagePressed@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "overflowImagePressed@2x.png"; sourceTree = ""; }; + 52E08F621DA0C41A00CD9335 /* TabClose_Font_Pressed.psd */ = {isa = PBXFileReference; lastKnownFileType = file; path = TabClose_Font_Pressed.psd; sourceTree = ""; }; + 52E08F631DA0C41A00CD9335 /* TabClose_Font_Pressed@2x.psd */ = {isa = PBXFileReference; lastKnownFileType = file; path = "TabClose_Font_Pressed@2x.psd"; sourceTree = ""; }; + 52E08F641DA0C41A00CD9335 /* TabClose_Front.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = TabClose_Front.png; sourceTree = ""; }; + 52E08F651DA0C41A00CD9335 /* TabClose_Front@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "TabClose_Front@2x.png"; sourceTree = ""; }; + 52E08F661DA0C41A00CD9335 /* TabClose_Front_Pressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = TabClose_Front_Pressed.png; sourceTree = ""; }; + 52E08F671DA0C41A00CD9335 /* TabClose_Front_Pressed@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "TabClose_Front_Pressed@2x.png"; sourceTree = ""; }; + 52E08F681DA0C41A00CD9335 /* TabClose_Front_Rollover.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = TabClose_Front_Rollover.png; sourceTree = ""; }; + 52E08F691DA0C41A00CD9335 /* TabClose_Front_Rollover@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "TabClose_Front_Rollover@2x.png"; sourceTree = ""; }; + 52E08F6A1DA0C41A00CD9335 /* TabNewMetal.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = TabNewMetal.png; sourceTree = ""; }; + 52E08F6B1DA0C41A00CD9335 /* TabNewMetalPressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = TabNewMetalPressed.png; sourceTree = ""; }; + 52E08F6C1DA0C41A00CD9335 /* TabNewMetalRollover.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = TabNewMetalRollover.png; sourceTree = ""; }; + 52E08F6D1DA0C41A00CD9335 /* Warning.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Warning.png; sourceTree = ""; }; + 52E08F6F1DA0C41A00CD9335 /* NSWindow+PSM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSWindow+PSM.h"; sourceTree = ""; }; + 52E08F701DA0C41A00CD9335 /* NSWindow+PSM.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSWindow+PSM.m"; sourceTree = ""; }; + 52E08F711DA0C41A00CD9335 /* PSMDarkHighContrastTabStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSMDarkHighContrastTabStyle.h; sourceTree = ""; }; + 52E08F721DA0C41A00CD9335 /* PSMDarkHighContrastTabStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSMDarkHighContrastTabStyle.m; sourceTree = ""; }; + 52E08F731DA0C41A00CD9335 /* PSMDarkTabStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSMDarkTabStyle.h; sourceTree = ""; }; + 52E08F741DA0C41A00CD9335 /* PSMDarkTabStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSMDarkTabStyle.m; sourceTree = ""; }; + 52E08F751DA0C41A00CD9335 /* PSMLightHighContrastTabStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSMLightHighContrastTabStyle.h; sourceTree = ""; }; + 52E08F761DA0C41A00CD9335 /* PSMLightHighContrastTabStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSMLightHighContrastTabStyle.m; sourceTree = ""; }; + 52E08F771DA0C41A00CD9335 /* PSMOverflowPopUpButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSMOverflowPopUpButton.h; sourceTree = ""; }; + 52E08F781DA0C41A00CD9335 /* PSMOverflowPopUpButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSMOverflowPopUpButton.m; sourceTree = ""; }; + 52E08F791DA0C41A00CD9335 /* PSMProgressIndicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSMProgressIndicator.h; sourceTree = ""; }; + 52E08F7A1DA0C41A00CD9335 /* PSMProgressIndicator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSMProgressIndicator.m; sourceTree = ""; }; + 52E08F7B1DA0C41A00CD9335 /* PSMRolloverButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSMRolloverButton.h; sourceTree = ""; }; + 52E08F7C1DA0C41A00CD9335 /* PSMRolloverButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSMRolloverButton.m; sourceTree = ""; }; + 52E08F7D1DA0C41A00CD9335 /* PSMTabBarCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSMTabBarCell.h; sourceTree = ""; }; + 52E08F7E1DA0C41A00CD9335 /* PSMTabBarCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSMTabBarCell.m; sourceTree = ""; }; + 52E08F7F1DA0C41A00CD9335 /* PSMTabBarControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSMTabBarControl.h; sourceTree = ""; }; + 52E08F801DA0C41A00CD9335 /* PSMTabBarControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSMTabBarControl.m; sourceTree = ""; }; + 52E08F811DA0C41A00CD9335 /* PSMTabDragAssistant.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSMTabDragAssistant.h; sourceTree = ""; }; + 52E08F821DA0C41A00CD9335 /* PSMTabDragAssistant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSMTabDragAssistant.m; sourceTree = ""; }; + 52E08F831DA0C41A00CD9335 /* PSMTabDragWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSMTabDragWindow.h; sourceTree = ""; }; + 52E08F841DA0C41A00CD9335 /* PSMTabDragWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSMTabDragWindow.m; sourceTree = ""; }; + 52E08F851DA0C41A00CD9335 /* PSMTabStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSMTabStyle.h; sourceTree = ""; }; + 52E08F861DA0C41A00CD9335 /* PSMYosemiteTabStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSMYosemiteTabStyle.h; sourceTree = ""; }; + 52E08F871DA0C41A00CD9335 /* PSMYosemiteTabStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSMYosemiteTabStyle.m; sourceTree = ""; }; + 52E08FA51DA0C4AE00CD9335 /* AMIndeterminateProgressIndicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AMIndeterminateProgressIndicator.h; sourceTree = ""; }; + 52E08FA61DA0C4AE00CD9335 /* AMIndeterminateProgressIndicator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AMIndeterminateProgressIndicator.m; sourceTree = ""; }; + 52E08FA81DA0C77100CD9335 /* NSImage+iTerm.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSImage+iTerm.m"; sourceTree = ""; }; + 52E08FA91DA0C77100CD9335 /* NSImage+iTerm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSImage+iTerm.h"; sourceTree = ""; }; + 52E08FAB1DA0C85F00CD9335 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = ../../../../../../../System/Library/Frameworks/QuartzCore.framework; sourceTree = ""; }; 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; 8D1107320486CEB800E47090 /* MacVim.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MacVim.app; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ @@ -248,7 +307,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 1DFE25A50C527BC4003000F7 /* PSMTabBarControl.framework in Frameworks */, + 52E08FAC1DA0C85F00CD9335 /* QuartzCore.framework in Frameworks */, 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, 1D8B5A53104AF9FF002E59D5 /* Carbon.framework in Frameworks */, 52A364731C4A5789005757EC /* Sparkle.framework in Frameworks */, @@ -315,6 +374,7 @@ children = ( 29B97324FDCFA39411CA2CEA /* AppKit.framework */, 29B97325FDCFA39411CA2CEA /* Foundation.framework */, + 52E08FAB1DA0C85F00CD9335 /* QuartzCore.framework */, ); name = "Other Frameworks"; sourceTree = ""; @@ -342,14 +402,6 @@ name = Executables; sourceTree = ""; }; - 1D493DB40C52533B00AB718C /* Products */ = { - isa = PBXGroup; - children = ( - 1D493DB90C52533B00AB718C /* PSMTabBarControl.framework */, - ); - name = Products; - sourceTree = ""; - }; 1DE602460C587F760055263D /* Vim Resources */ = { isa = PBXGroup; children = ( @@ -429,9 +481,9 @@ 29B97323FDCFA39411CA2CEA /* Frameworks */ = { isa = PBXGroup; children = ( + 52E08F5C1DA0BEB900CD9335 /* PSMTabBarControl */, 52A364721C4A5789005757EC /* Sparkle.framework */, 1D8B5A52104AF9FF002E59D5 /* Carbon.framework */, - 1D493DB30C52533B00AB718C /* PSMTabBarControl.xcodeproj */, 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, ); @@ -454,6 +506,85 @@ name = Products; sourceTree = ""; }; + 52E08F5C1DA0BEB900CD9335 /* PSMTabBarControl */ = { + isa = PBXGroup; + children = ( + 52E08F5D1DA0C41A00CD9335 /* images */, + 52E08F6E1DA0C41A00CD9335 /* source */, + 52E08FA41DA0C4AE00CD9335 /* AMIndeterminateProgressIndicator */, + ); + name = PSMTabBarControl; + sourceTree = ""; + }; + 52E08F5D1DA0C41A00CD9335 /* images */ = { + isa = PBXGroup; + children = ( + 52E08F5E1DA0C41A00CD9335 /* overflowImage.png */, + 52E08F5F1DA0C41A00CD9335 /* overflowImage@2x.png */, + 52E08F601DA0C41A00CD9335 /* overflowImagePressed.png */, + 52E08F611DA0C41A00CD9335 /* overflowImagePressed@2x.png */, + 52E08F621DA0C41A00CD9335 /* TabClose_Font_Pressed.psd */, + 52E08F631DA0C41A00CD9335 /* TabClose_Font_Pressed@2x.psd */, + 52E08F641DA0C41A00CD9335 /* TabClose_Front.png */, + 52E08F651DA0C41A00CD9335 /* TabClose_Front@2x.png */, + 52E08F661DA0C41A00CD9335 /* TabClose_Front_Pressed.png */, + 52E08F671DA0C41A00CD9335 /* TabClose_Front_Pressed@2x.png */, + 52E08F681DA0C41A00CD9335 /* TabClose_Front_Rollover.png */, + 52E08F691DA0C41A00CD9335 /* TabClose_Front_Rollover@2x.png */, + 52E08F6A1DA0C41A00CD9335 /* TabNewMetal.png */, + 52E08F6B1DA0C41A00CD9335 /* TabNewMetalPressed.png */, + 52E08F6C1DA0C41A00CD9335 /* TabNewMetalRollover.png */, + 52E08F6D1DA0C41A00CD9335 /* Warning.png */, + ); + name = images; + path = PSMTabBarControl/images; + sourceTree = ""; + }; + 52E08F6E1DA0C41A00CD9335 /* source */ = { + isa = PBXGroup; + children = ( + 52E08F6F1DA0C41A00CD9335 /* NSWindow+PSM.h */, + 52E08F701DA0C41A00CD9335 /* NSWindow+PSM.m */, + 52E08F711DA0C41A00CD9335 /* PSMDarkHighContrastTabStyle.h */, + 52E08F721DA0C41A00CD9335 /* PSMDarkHighContrastTabStyle.m */, + 52E08F731DA0C41A00CD9335 /* PSMDarkTabStyle.h */, + 52E08F741DA0C41A00CD9335 /* PSMDarkTabStyle.m */, + 52E08F751DA0C41A00CD9335 /* PSMLightHighContrastTabStyle.h */, + 52E08F761DA0C41A00CD9335 /* PSMLightHighContrastTabStyle.m */, + 52E08F771DA0C41A00CD9335 /* PSMOverflowPopUpButton.h */, + 52E08F781DA0C41A00CD9335 /* PSMOverflowPopUpButton.m */, + 52E08F791DA0C41A00CD9335 /* PSMProgressIndicator.h */, + 52E08F7A1DA0C41A00CD9335 /* PSMProgressIndicator.m */, + 52E08F7B1DA0C41A00CD9335 /* PSMRolloverButton.h */, + 52E08F7C1DA0C41A00CD9335 /* PSMRolloverButton.m */, + 52E08F7D1DA0C41A00CD9335 /* PSMTabBarCell.h */, + 52E08F7E1DA0C41A00CD9335 /* PSMTabBarCell.m */, + 52E08F7F1DA0C41A00CD9335 /* PSMTabBarControl.h */, + 52E08F801DA0C41A00CD9335 /* PSMTabBarControl.m */, + 52E08F811DA0C41A00CD9335 /* PSMTabDragAssistant.h */, + 52E08F821DA0C41A00CD9335 /* PSMTabDragAssistant.m */, + 52E08F831DA0C41A00CD9335 /* PSMTabDragWindow.h */, + 52E08F841DA0C41A00CD9335 /* PSMTabDragWindow.m */, + 52E08F851DA0C41A00CD9335 /* PSMTabStyle.h */, + 52E08F861DA0C41A00CD9335 /* PSMYosemiteTabStyle.h */, + 52E08F871DA0C41A00CD9335 /* PSMYosemiteTabStyle.m */, + ); + name = source; + path = PSMTabBarControl/source; + sourceTree = ""; + }; + 52E08FA41DA0C4AE00CD9335 /* AMIndeterminateProgressIndicator */ = { + isa = PBXGroup; + children = ( + 52E08FA81DA0C77100CD9335 /* NSImage+iTerm.m */, + 52E08FA91DA0C77100CD9335 /* NSImage+iTerm.h */, + 52E08FA51DA0C4AE00CD9335 /* AMIndeterminateProgressIndicator.h */, + 52E08FA61DA0C4AE00CD9335 /* AMIndeterminateProgressIndicator.m */, + ); + name = AMIndeterminateProgressIndicator; + path = PSMTabBarControl/AMIndeterminateProgressIndicator; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -473,7 +604,6 @@ buildRules = ( ); dependencies = ( - 1D493DCD0C5254A400AB718C /* PBXTargetDependency */, 52818B011C1C084100F59085 /* PBXTargetDependency */, ); name = MacVim; @@ -504,10 +634,6 @@ mainGroup = 29B97314FDCFA39411CA2CEA /* MacVim */; projectDirPath = ""; projectReferences = ( - { - ProductGroup = 1D493DB40C52533B00AB718C /* Products */; - ProjectRef = 1D493DB30C52533B00AB718C /* PSMTabBarControl.xcodeproj */; - }, { ProductGroup = 52818AFB1C1C075300F59085 /* Products */; ProjectRef = 52818AFA1C1C075300F59085 /* QuickLookStephen.xcodeproj */; @@ -521,13 +647,6 @@ /* End PBXProject section */ /* Begin PBXReferenceProxy section */ - 1D493DB90C52533B00AB718C /* PSMTabBarControl.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = PSMTabBarControl.framework; - remoteRef = 1D493DB80C52533B00AB718C /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; 52818AFF1C1C075300F59085 /* QLStephen.qlgenerator */ = { isa = PBXReferenceProxy; fileType = wrapper.cfbundle; @@ -544,7 +663,12 @@ files = ( 52B7ED9B1C4A4D6900AFFF15 /* dsa_pub.pem in Resources */, 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */, + 52E08F931DA0C41A00CD9335 /* TabClose_Front_Rollover@2x.png in Resources */, + 52E08F951DA0C41A00CD9335 /* TabNewMetalPressed.png in Resources */, + 52E08F8E1DA0C41A00CD9335 /* TabClose_Front.png in Resources */, + 52E08F901DA0C41A00CD9335 /* TabClose_Front_Pressed.png in Resources */, 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, + 52E08F961DA0C41A00CD9335 /* TabNewMetalRollover.png in Resources */, 1D0E051C0BA5F83800B6049E /* Colors.plist in Resources */, 1DD04DEC0C529C5E006CDC2B /* Credits.rtf in Resources */, 1DE8CC620C5E2AAD003F56E3 /* Actions.plist in Resources */, @@ -554,29 +678,40 @@ 1DD3D51E0D82D4C9006E4320 /* ibeam.png in Resources */, 1D22374B0E45DF4800E6FFFF /* Advanced.png in Resources */, 1DCD00BF0E50B2B700460166 /* Attention.png in Resources */, + 52E08F8D1DA0C41A00CD9335 /* TabClose_Font_Pressed@2x.psd in Resources */, 1DCD00C00E50B2B700460166 /* Copy.png in Resources */, 1DCD00C10E50B2B700460166 /* Cut.png in Resources */, 1DCD00C20E50B2B700460166 /* FindHelp.png in Resources */, + 52E08F881DA0C41A00CD9335 /* overflowImage.png in Resources */, 1DCD00C30E50B2B700460166 /* FindNext.png in Resources */, 1DCD00C40E50B2B700460166 /* FindPrev.png in Resources */, 1DCD00C50E50B2B700460166 /* Help.png in Resources */, 1DCD00C60E50B2B700460166 /* LoadSesn.png in Resources */, + 52E08F911DA0C41A00CD9335 /* TabClose_Front_Pressed@2x.png in Resources */, + 52E08F8A1DA0C41A00CD9335 /* overflowImagePressed.png in Resources */, 1DCD00C70E50B2B700460166 /* Make.png in Resources */, 1DCD00C80E50B2B700460166 /* Open.png in Resources */, 1DCD00C90E50B2B700460166 /* Paste.png in Resources */, 1DCD00CA0E50B2B700460166 /* Print.png in Resources */, 1DCD00CB0E50B2B700460166 /* Redo.png in Resources */, + 52E08F8B1DA0C41A00CD9335 /* overflowImagePressed@2x.png in Resources */, 1DCD00CC0E50B2B700460166 /* Replace.png in Resources */, 1DCD00CD0E50B2B700460166 /* RunCtags.png in Resources */, 1DCD00CE0E50B2B700460166 /* RunScript.png in Resources */, 1DCD00CF0E50B2B700460166 /* Save.png in Resources */, 1DCD00D00E50B2B700460166 /* SaveAll.png in Resources */, 1DCD00D10E50B2B700460166 /* SaveSesn.png in Resources */, + 52E08F941DA0C41A00CD9335 /* TabNewMetal.png in Resources */, + 52E08F891DA0C41A00CD9335 /* overflowImage@2x.png in Resources */, 1DCD00D20E50B2B700460166 /* TagJump.png in Resources */, 1DCD00D30E50B2B700460166 /* Undo.png in Resources */, + 52E08F971DA0C41A00CD9335 /* Warning.png in Resources */, + 52E08F8F1DA0C41A00CD9335 /* TabClose_Front@2x.png in Resources */, 1D8BEA74104992290069B072 /* FindAndReplace.nib in Resources */, 1D9C60520EF79C0C0034AD44 /* MacVim.icns in Resources */, + 52E08F8C1DA0C41A00CD9335 /* TabClose_Font_Pressed.psd in Resources */, 1D384A0E100D671700D3C22F /* KeyBinding.plist in Resources */, + 52E08F921DA0C41A00CD9335 /* TabClose_Front_Rollover.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -605,14 +740,24 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 52E08F9D1DA0C41A00CD9335 /* PSMProgressIndicator.m in Sources */, + 52E08F9A1DA0C41A00CD9335 /* PSMDarkTabStyle.m in Sources */, + 52E08FA11DA0C41A00CD9335 /* PSMTabDragAssistant.m in Sources */, 8D11072D0486CEB800E47090 /* main.m in Sources */, 1D1474980C56703C0038FA2B /* MacVim.m in Sources */, + 52E08F9F1DA0C41A00CD9335 /* PSMTabBarCell.m in Sources */, 1D1474A00C5673AE0038FA2B /* MMAppController.m in Sources */, + 52E08FA31DA0C41A00CD9335 /* PSMYosemiteTabStyle.m in Sources */, + 52E08F991DA0C41A00CD9335 /* PSMDarkHighContrastTabStyle.m in Sources */, 1D1474AA0C5677450038FA2B /* MMTextStorage.m in Sources */, 1D1474B00C5678370038FA2B /* MMTextView.m in Sources */, + 52E08FA21DA0C41A00CD9335 /* PSMTabDragWindow.m in Sources */, + 52E08F981DA0C41A00CD9335 /* NSWindow+PSM.m in Sources */, 1D1474B60C56796D0038FA2B /* MMVimController.m in Sources */, 1D1474BC0C567A910038FA2B /* MMWindowController.m in Sources */, + 52E08F9B1DA0C41A00CD9335 /* PSMLightHighContrastTabStyle.m in Sources */, 1D09AB420C6A4D520045497E /* MMTypesetter.m in Sources */, + 52E08F9E1DA0C41A00CD9335 /* PSMRolloverButton.m in Sources */, 1DD66ECE0C803D3600EBDAB3 /* MMApplication.m in Sources */, 1D80FBD40CBBD3B700102A1C /* MMFullScreenWindow.m in Sources */, 1D80FBD60CBBD3B700102A1C /* MMVimView.m in Sources */, @@ -620,21 +765,20 @@ 1DE3F8EB0D50F84600052B9E /* MMPreferenceController.m in Sources */, 0395A8330D71ED7800881434 /* DBPrefsWindowController.m in Sources */, 1D80591F0E1185EA001699D1 /* Miscellaneous.m in Sources */, + 52E08FA01DA0C41A00CD9335 /* PSMTabBarControl.m in Sources */, 1D145C7F0E5227CE00691AA0 /* MMTextViewHelper.m in Sources */, + 52E08FAA1DA0C77100CD9335 /* NSImage+iTerm.m in Sources */, 1D60088B0E96A0B2003763F0 /* MMFindReplaceController.m in Sources */, 1DE63FFB0E71820F00959BDB /* MMCoreTextView.m in Sources */, 1D44972211FCA9B400B0630F /* MMCoreTextView+ToolTip.m in Sources */, + 52E08FA71DA0C4AE00CD9335 /* AMIndeterminateProgressIndicator.m in Sources */, + 52E08F9C1DA0C41A00CD9335 /* PSMOverflowPopUpButton.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - 1D493DCD0C5254A400AB718C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = PSMTabBarControlFramework; - targetProxy = 1D493DCC0C5254A400AB718C /* PBXContainerItemProxy */; - }; 52818B011C1C084100F59085 /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = QuickLookStephen; diff --git a/src/MacVim/PSMTabBarControl/AMIndeterminateProgressIndicator/AMIndeterminateProgressIndicator.h b/src/MacVim/PSMTabBarControl/AMIndeterminateProgressIndicator/AMIndeterminateProgressIndicator.h new file mode 100644 index 0000000000..541abccbda --- /dev/null +++ b/src/MacVim/PSMTabBarControl/AMIndeterminateProgressIndicator/AMIndeterminateProgressIndicator.h @@ -0,0 +1,19 @@ +// +// AMIndeterminateProgressIndicator.h +// +// Created by Andreas on 23.01.07. +// Copyright 2007 Andreas Mayer. All rights reserved. +// + +#import + + +@interface AMIndeterminateProgressIndicator : NSView + +@property(nonatomic, retain) NSColor *color; + +- (void)startAnimation:(id)sender; +- (void)stopAnimation:(id)sender; + + +@end diff --git a/src/MacVim/PSMTabBarControl/AMIndeterminateProgressIndicator/AMIndeterminateProgressIndicator.m b/src/MacVim/PSMTabBarControl/AMIndeterminateProgressIndicator/AMIndeterminateProgressIndicator.m new file mode 100644 index 0000000000..449439722c --- /dev/null +++ b/src/MacVim/PSMTabBarControl/AMIndeterminateProgressIndicator/AMIndeterminateProgressIndicator.m @@ -0,0 +1,164 @@ +// +// AMIndeterminateProgressIndicator.m +// +// Created by Andreas on 23.01.07. +// Copyright 2007 Andreas Mayer. All rights reserved. +// +// Updated to use a layer animation by George Nachman on 3/10/2016. + +#import "AMIndeterminateProgressIndicator.h" +#import "NSImage+iTerm.h" +#import + +static CGFloat DegreesToRadians(double radians) { + return radians / 180.0 * M_PI; +} + +@interface AMIndeterminateProgressIndicator() +@property(nonatomic, retain) CAKeyframeAnimation *animation; +@end + +@implementation AMIndeterminateProgressIndicator { + NSSize _animationSize; +} + +- (id)initWithFrame:(NSRect)frameRect { + self = [super initWithFrame:frameRect]; + if (self) { + self.wantsLayer = YES; + [self setColor:[NSColor blackColor]]; + } + return self; +} + +- (void)dealloc { + [_animation release]; + [_color release]; + [super dealloc]; +} + +- (void)setColor:(NSColor *)value { + if (_color != value) { + [_color autorelease]; + _color = [value retain]; + assert([_color alphaComponent] > 0.999); + } +} + +- (NSSize)physicalSize { + NSSize size = self.frame.size; + CGFloat scale = self.layer.contentsScale; + size.width *= scale; + size.height *= scale; + return size; +} + +- (void)startAnimation:(id)sender { + if (!self.animation || !NSEqualSizes(_animationSize, self.physicalSize)) { + _animationSize = self.physicalSize; + self.animation = [CAKeyframeAnimation animationWithKeyPath:@"contents"]; + self.animation.calculationMode = kCAAnimationDiscrete; + self.animation.duration = 0.5; + self.animation.values = self.images; + self.animation.repeatCount = INFINITY; + } + [self.layer removeAllAnimations]; + [self.layer addAnimation:_animation forKey:@"contents"]; +} + +- (void)stopAnimation:(id)sender { + [self.layer removeAllAnimations]; +} + +// Returns an array of CGImageRefs for each frame of the animation. +- (NSArray *)images { + NSMutableArray *frames = [NSMutableArray array]; + NSSize size = self.physicalSize; + + for (NSInteger step = 0; step < self.numberOfSteps; step++) { + NSImage *image = [[[NSImage alloc] initWithSize:size] autorelease]; + [image lockFocus]; + [self drawStep:step]; + [image unlockFocus]; + + NSBitmapImageRep *rep = image.bitmapImageRep; + NSData *data = [rep representationUsingType:NSPNGFileType + properties:@{ NSImageInterlaced: @NO, + NSImageCompressionFactor: @1 }]; + CGDataProviderRef provider = CGDataProviderCreateWithCFData((CFDataRef)data); + CGImageRef cgImage = CGImageCreateWithPNGDataProvider(provider, + NULL, + true, + kCGRenderingIntentDefault); + CFRelease(provider); + + [frames addObject:(id)cgImage]; + CFRelease(cgImage); + } + return frames; +} + +- (NSInteger)numberOfSteps { + return 12; +} + +- (void)drawStrokeFromPoint:(NSPoint)firstPoint + toPoint:(NSPoint)secondPoint + strokeWidth:(CGFloat)strokeWidth { + NSLineCapStyle previousLineCapStyle = [NSBezierPath defaultLineCapStyle]; + CGFloat previousLineWidth = [NSBezierPath defaultLineWidth]; + + [NSBezierPath setDefaultLineCapStyle:NSRoundLineCapStyle]; + [NSBezierPath setDefaultLineWidth:strokeWidth]; + + [NSBezierPath strokeLineFromPoint:firstPoint toPoint:secondPoint]; + + // Restore previous defaults + [NSBezierPath setDefaultLineCapStyle:previousLineCapStyle]; + [NSBezierPath setDefaultLineWidth:previousLineWidth]; +} + +- (void)drawStep:(NSInteger)step { + CGRect frame = self.frame; + + // Scale frame by the layer's contentsScale so we fill it properly. + CGFloat scale = self.layer.contentsScale; + frame.size.width *= scale; + frame.size.height *= scale; + frame.origin.x *= scale; + frame.origin.y *= scale; + + float size = MIN(frame.size.width, frame.size.height); + NSPoint center = NSMakePoint(NSMidX(frame), NSMidY(frame)); + + CGFloat outerRadius; + CGFloat innerRadius; + const CGFloat strokeWidth = size * 0.09; + if (size >= 32.0 * scale) { + outerRadius = size * 0.38; + innerRadius = size * 0.23; + } else { + outerRadius = size * 0.48; + innerRadius = size * 0.27; + } + + NSPoint innerPoint; + NSPoint outerPoint; + CGFloat anglePerStep = 360 / self.numberOfSteps; + CGFloat initialAngle = DegreesToRadians(270 - (step * anglePerStep)); + + for (NSInteger i = 0; i < self.numberOfSteps; i++) { + CGFloat currentAngle = initialAngle - DegreesToRadians(anglePerStep) * i; + [[_color colorWithAlphaComponent:1.0 - sqrt(i) * 0.25] set]; + + outerPoint = NSMakePoint(center.x + cos(currentAngle) * outerRadius, + center.y + sin(currentAngle) * outerRadius); + + innerPoint = NSMakePoint(center.x + cos(currentAngle) * innerRadius, + center.y + sin(currentAngle) * innerRadius); + + [self drawStrokeFromPoint:innerPoint toPoint:outerPoint strokeWidth:strokeWidth]; + } +} + +@end diff --git a/src/MacVim/PSMTabBarControl/AMIndeterminateProgressIndicator/NSImage+iTerm.h b/src/MacVim/PSMTabBarControl/AMIndeterminateProgressIndicator/NSImage+iTerm.h new file mode 100644 index 0000000000..b43d610254 --- /dev/null +++ b/src/MacVim/PSMTabBarControl/AMIndeterminateProgressIndicator/NSImage+iTerm.h @@ -0,0 +1,15 @@ +// +// NSImage+iTerm.h +// iTerm +// +// Created by George Nachman on 7/20/14. +// +// + +#import + +@interface NSImage (iTerm) + +- (NSBitmapImageRep *)bitmapImageRep; + +@end diff --git a/src/MacVim/PSMTabBarControl/AMIndeterminateProgressIndicator/NSImage+iTerm.m b/src/MacVim/PSMTabBarControl/AMIndeterminateProgressIndicator/NSImage+iTerm.m new file mode 100644 index 0000000000..35f0e52fcc --- /dev/null +++ b/src/MacVim/PSMTabBarControl/AMIndeterminateProgressIndicator/NSImage+iTerm.m @@ -0,0 +1,45 @@ +// +// NSImage+iTerm.m +// iTerm +// +// Created by George Nachman on 7/20/14. +// +// + +#import "NSImage+iTerm.h" + +@implementation NSImage (iTerm) + +- (NSBitmapImageRep *)bitmapImageRep { + int width = [self size].width; + int height = [self size].height; + + if (width < 1 || height < 1) { + return nil; + } + + NSBitmapImageRep *rep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL + pixelsWide:width + pixelsHigh:height + bitsPerSample:8 + samplesPerPixel:4 + hasAlpha:YES + isPlanar:NO + colorSpaceName:NSDeviceRGBColorSpace + bytesPerRow:width * 4 + bitsPerPixel:32]; + + NSGraphicsContext *ctx = [NSGraphicsContext graphicsContextWithBitmapImageRep: rep]; + [NSGraphicsContext saveGraphicsState]; + [NSGraphicsContext setCurrentContext:ctx]; + [self drawAtPoint:NSZeroPoint + fromRect:NSZeroRect + operation:NSCompositeCopy + fraction:1.0]; + [ctx flushGraphics]; + [NSGraphicsContext restoreGraphicsState]; + + return [rep autorelease]; +} + +@end diff --git a/src/MacVim/PSMTabBarControl/English.lproj/InfoPlist.strings b/src/MacVim/PSMTabBarControl/English.lproj/InfoPlist.strings deleted file mode 100644 index 0bf04f0d2c..0000000000 Binary files a/src/MacVim/PSMTabBarControl/English.lproj/InfoPlist.strings and /dev/null differ diff --git a/src/MacVim/PSMTabBarControl/English.lproj/MainMenu.nib/classes.nib b/src/MacVim/PSMTabBarControl/English.lproj/MainMenu.nib/classes.nib deleted file mode 100644 index 2e3f46075b..0000000000 --- a/src/MacVim/PSMTabBarControl/English.lproj/MainMenu.nib/classes.nib +++ /dev/null @@ -1,24 +0,0 @@ -{ - IBClasses = ( - { - ACTIONS = {newWindow = id; }; - CLASS = AppController; - LANGUAGE = ObjC; - SUPERCLASS = NSObject; - }, - {CLASS = FakeModel; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, - { - ACTIONS = {addNewTab = id; closeTab = id; }; - CLASS = FirstResponder; - LANGUAGE = ObjC; - SUPERCLASS = NSObject; - }, - { - CLASS = PSMTabBarControl; - LANGUAGE = ObjC; - OUTLETS = {delegate = id; partnerView = id; style = id; tabView = NSTabView; }; - SUPERCLASS = NSControl; - } - ); - IBVersion = 1; -} \ No newline at end of file diff --git a/src/MacVim/PSMTabBarControl/English.lproj/MainMenu.nib/info.nib b/src/MacVim/PSMTabBarControl/English.lproj/MainMenu.nib/info.nib deleted file mode 100644 index c7f7c64d43..0000000000 --- a/src/MacVim/PSMTabBarControl/English.lproj/MainMenu.nib/info.nib +++ /dev/null @@ -1,21 +0,0 @@ - - - - - IBDocumentLocation - 135 107 356 240 0 0 1680 1028 - IBEditorPositions - - 29 - 130 357 371 44 0 0 1680 1028 - - IBFramework Version - 443.0 - IBOpenObjects - - 29 - - IBSystem Version - 8H14 - - diff --git a/src/MacVim/PSMTabBarControl/English.lproj/MainMenu.nib/keyedobjects.nib b/src/MacVim/PSMTabBarControl/English.lproj/MainMenu.nib/keyedobjects.nib deleted file mode 100644 index 3481421857..0000000000 Binary files a/src/MacVim/PSMTabBarControl/English.lproj/MainMenu.nib/keyedobjects.nib and /dev/null differ diff --git a/src/MacVim/PSMTabBarControl/English.lproj/MainMenu.nib/objects.nib b/src/MacVim/PSMTabBarControl/English.lproj/MainMenu.nib/objects.nib deleted file mode 100644 index bda1534dc4..0000000000 Binary files a/src/MacVim/PSMTabBarControl/English.lproj/MainMenu.nib/objects.nib and /dev/null differ diff --git a/src/MacVim/PSMTabBarControl/English.lproj/PSMTabBarControlInspector.nib/classes.nib b/src/MacVim/PSMTabBarControl/English.lproj/PSMTabBarControlInspector.nib/classes.nib deleted file mode 100644 index 659b73a0ee..0000000000 --- a/src/MacVim/PSMTabBarControl/English.lproj/PSMTabBarControlInspector.nib/classes.nib +++ /dev/null @@ -1,22 +0,0 @@ -{ - IBClasses = ( - {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, - { - CLASS = PSMTabBarControlInspector; - LANGUAGE = ObjC; - OUTLETS = { - "_allowsDragBetweenWindows" = NSButton; - "_canCloseOnlyTab" = NSButton; - "_cellMaxWidth" = NSTextField; - "_cellMinWidth" = NSTextField; - "_cellOptimumWidth" = NSTextField; - "_hideForSingleTab" = NSButton; - "_showAddTab" = NSButton; - "_sizeToFit" = NSButton; - "_stylePopUp" = NSPopUpButton; - }; - SUPERCLASS = IBInspector; - } - ); - IBVersion = 1; -} \ No newline at end of file diff --git a/src/MacVim/PSMTabBarControl/English.lproj/PSMTabBarControlInspector.nib/info.nib b/src/MacVim/PSMTabBarControl/English.lproj/PSMTabBarControlInspector.nib/info.nib deleted file mode 100644 index bf503dd361..0000000000 --- a/src/MacVim/PSMTabBarControl/English.lproj/PSMTabBarControlInspector.nib/info.nib +++ /dev/null @@ -1,16 +0,0 @@ - - - - - IBDocumentLocation - 83 72 356 240 0 0 1680 1028 - IBFramework Version - 446.1 - IBOpenObjects - - 3 - - IBSystem Version - 8I127 - - diff --git a/src/MacVim/PSMTabBarControl/English.lproj/PSMTabBarControlInspector.nib/keyedobjects.nib b/src/MacVim/PSMTabBarControl/English.lproj/PSMTabBarControlInspector.nib/keyedobjects.nib deleted file mode 100644 index 2def97d1d3..0000000000 Binary files a/src/MacVim/PSMTabBarControl/English.lproj/PSMTabBarControlInspector.nib/keyedobjects.nib and /dev/null differ diff --git a/src/MacVim/PSMTabBarControl/English.lproj/PSMTabBarControlInspector.nib/objects.nib b/src/MacVim/PSMTabBarControl/English.lproj/PSMTabBarControlInspector.nib/objects.nib deleted file mode 100644 index 9a89923a6c..0000000000 Binary files a/src/MacVim/PSMTabBarControl/English.lproj/PSMTabBarControlInspector.nib/objects.nib and /dev/null differ diff --git a/src/MacVim/PSMTabBarControl/English.lproj/PSMTabBarControlPalette.nib/classes.nib b/src/MacVim/PSMTabBarControl/English.lproj/PSMTabBarControlPalette.nib/classes.nib deleted file mode 100644 index 4752228596..0000000000 --- a/src/MacVim/PSMTabBarControl/English.lproj/PSMTabBarControlPalette.nib/classes.nib +++ /dev/null @@ -1,28 +0,0 @@ -{ - IBClasses = ( - {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, - {CLASS = PSMAquaTabStyle; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, - {CLASS = PSMMetalTabStyle; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, - {CLASS = PSMOverflowPopUpButton; LANGUAGE = ObjC; SUPERCLASS = NSPopUpButton; }, - { - CLASS = PSMProgressIndicator; - LANGUAGE = ObjC; - SUPERCLASS = NSProgressIndicator; - }, - {CLASS = PSMRolloverButton; LANGUAGE = ObjC; SUPERCLASS = NSButton; }, - {CLASS = PSMTabBarCell; LANGUAGE = ObjC; SUPERCLASS = NSActionCell; }, - { - CLASS = PSMTabBarControl; - LANGUAGE = ObjC; - OUTLETS = {delegate = id; partnerView = id; style = id; tabView = NSTabView; }; - SUPERCLASS = NSControl; - }, - { - CLASS = PSMTabBarControlPalette; - LANGUAGE = ObjC; - OUTLETS = {repImage = NSImageView; }; - SUPERCLASS = IBPalette; - } - ); - IBVersion = 1; -} \ No newline at end of file diff --git a/src/MacVim/PSMTabBarControl/English.lproj/PSMTabBarControlPalette.nib/info.nib b/src/MacVim/PSMTabBarControl/English.lproj/PSMTabBarControlPalette.nib/info.nib deleted file mode 100644 index 866500bb2a..0000000000 --- a/src/MacVim/PSMTabBarControl/English.lproj/PSMTabBarControlPalette.nib/info.nib +++ /dev/null @@ -1,16 +0,0 @@ - - - - - IBDocumentLocation - 83 142 356 240 0 0 1680 1028 - IBFramework Version - 443.0 - IBOpenObjects - - 2 - - IBSystem Version - 8H14 - - diff --git a/src/MacVim/PSMTabBarControl/English.lproj/PSMTabBarControlPalette.nib/keyedobjects.nib b/src/MacVim/PSMTabBarControl/English.lproj/PSMTabBarControlPalette.nib/keyedobjects.nib deleted file mode 100644 index 635e6d8d17..0000000000 Binary files a/src/MacVim/PSMTabBarControl/English.lproj/PSMTabBarControlPalette.nib/keyedobjects.nib and /dev/null differ diff --git a/src/MacVim/PSMTabBarControl/English.lproj/PSMTabBarControlPalette.nib/objects.nib b/src/MacVim/PSMTabBarControl/English.lproj/PSMTabBarControlPalette.nib/objects.nib deleted file mode 100644 index c0988d7f17..0000000000 Binary files a/src/MacVim/PSMTabBarControl/English.lproj/PSMTabBarControlPalette.nib/objects.nib and /dev/null differ diff --git a/src/MacVim/PSMTabBarControl/English.lproj/Window.nib/classes.nib b/src/MacVim/PSMTabBarControl/English.lproj/Window.nib/classes.nib deleted file mode 100644 index 92723a5894..0000000000 --- a/src/MacVim/PSMTabBarControl/English.lproj/Window.nib/classes.nib +++ /dev/null @@ -1,38 +0,0 @@ -{ - IBClasses = ( - {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, - { - ACTIONS = { - addNewTab = id; - closeTab = id; - configAddTabButton = id; - configCanCloseOnlyTab = id; - configHideForSingleTab = id; - configStyle = id; - configTabMaxWidth = id; - configTabMinWidth = id; - configTabOptimumWidth = id; - configTabSizeToFit = id; - isProcessingAction = id; - setIconNamed = id; - setObjectCount = id; - setTabLabel = id; - stopProcessing = id; - toggleToolbar = id; - }; - CLASS = WindowController; - LANGUAGE = ObjC; - OUTLETS = { - drawer = NSDrawer; - iconButton = NSPopUpButton; - isProcessingButton = NSButton; - objectCounterField = NSTextField; - tabBar = PSMTabBarControl; - tabField = NSTextField; - tabView = NSTabView; - }; - SUPERCLASS = NSWindowController; - } - ); - IBVersion = 1; -} \ No newline at end of file diff --git a/src/MacVim/PSMTabBarControl/English.lproj/Window.nib/info.nib b/src/MacVim/PSMTabBarControl/English.lproj/Window.nib/info.nib deleted file mode 100644 index 38889a9c1f..0000000000 --- a/src/MacVim/PSMTabBarControl/English.lproj/Window.nib/info.nib +++ /dev/null @@ -1,25 +0,0 @@ - - - - - IBDocumentLocation - 35 49 356 240 0 0 1024 746 - IBEditorPositions - - 18 - 271 466 481 64 0 0 1024 746 - 20 - 400 254 224 482 0 0 1024 746 - - IBFramework Version - 446.1 - IBOpenObjects - - 18 - 20 - 5 - - IBSystem Version - 8J135 - - diff --git a/src/MacVim/PSMTabBarControl/English.lproj/Window.nib/keyedobjects.nib b/src/MacVim/PSMTabBarControl/English.lproj/Window.nib/keyedobjects.nib deleted file mode 100644 index d5228b2338..0000000000 Binary files a/src/MacVim/PSMTabBarControl/English.lproj/Window.nib/keyedobjects.nib and /dev/null differ diff --git a/src/MacVim/PSMTabBarControl/Info.plist b/src/MacVim/PSMTabBarControl/Info.plist deleted file mode 100644 index 1f2810bd63..0000000000 --- a/src/MacVim/PSMTabBarControl/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - PSMTabBarControl - CFBundleIconFile - - CFBundleIdentifier - com.positivespinmedia.PSMTabBarControl - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - BNDL - CFBundleSignature - PSM1 - CFBundleVersion - 1.1 - - diff --git a/src/MacVim/PSMTabBarControl/PSMTabBarControl.ibclassdescription b/src/MacVim/PSMTabBarControl/PSMTabBarControl.ibclassdescription deleted file mode 100755 index 89959b3847..0000000000 --- a/src/MacVim/PSMTabBarControl/PSMTabBarControl.ibclassdescription +++ /dev/null @@ -1,7 +0,0 @@ -{ - PSMTabBarControl = { - SuperClass = NSControl; - Attributes = { - }; - }; -} \ No newline at end of file diff --git a/src/MacVim/PSMTabBarControl/PSMTabBarControl.xcodeproj/project.pbxproj b/src/MacVim/PSMTabBarControl/PSMTabBarControl.xcodeproj/project.pbxproj deleted file mode 100644 index 4879607e7f..0000000000 --- a/src/MacVim/PSMTabBarControl/PSMTabBarControl.xcodeproj/project.pbxproj +++ /dev/null @@ -1,719 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXAggregateTarget section */ - 53DF6901067E5B8E0090B5B0 /* All */ = { - isa = PBXAggregateTarget; - buildConfigurationList = C056398708A954F8003078D8 /* Build configuration list for PBXAggregateTarget "All" */; - buildPhases = ( - ); - dependencies = ( - 53DF6905067E5B930090B5B0 /* PBXTargetDependency */, - ); - name = All; - productName = All; - }; -/* End PBXAggregateTarget section */ - -/* Begin PBXBuildFile section */ - 13F8B89007B43554008AE28D /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD92D38A0106425D02CA0E72 /* Cocoa.framework */; }; - 523897F415BDA9AC00498A53 /* TabClose_Front_Pressed@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 523897EE15BDA9AC00498A53 /* TabClose_Front_Pressed@2x.png */; }; - 523897F515BDA9AC00498A53 /* TabClose_Front_Rollover@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 523897EF15BDA9AC00498A53 /* TabClose_Front_Rollover@2x.png */; }; - 523897F615BDA9AC00498A53 /* TabClose_Front@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 523897F015BDA9AC00498A53 /* TabClose_Front@2x.png */; }; - 523897F715BDA9AC00498A53 /* TabNewMetal@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 523897F115BDA9AC00498A53 /* TabNewMetal@2x.png */; }; - 523897F815BDA9AC00498A53 /* TabNewMetalPressed@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 523897F215BDA9AC00498A53 /* TabNewMetalPressed@2x.png */; }; - 523897F915BDA9AC00498A53 /* TabNewMetalRollover@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 523897F315BDA9AC00498A53 /* TabNewMetalRollover@2x.png */; }; - 52A57C0F15BBA230003EC59C /* TabClose_Front.png in Resources */ = {isa = PBXBuildFile; fileRef = 52A57C0C15BBA230003EC59C /* TabClose_Front.png */; }; - 52A57C1015BBA230003EC59C /* TabClose_Front_Pressed.png in Resources */ = {isa = PBXBuildFile; fileRef = 52A57C0D15BBA230003EC59C /* TabClose_Front_Pressed.png */; }; - 52A57C1115BBA230003EC59C /* TabClose_Front_Rollover.png in Resources */ = {isa = PBXBuildFile; fileRef = 52A57C0E15BBA230003EC59C /* TabClose_Front_Rollover.png */; }; - 52C0B9B415BDB7A9000C268F /* overflowImage@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 52C0B9B215BDB7A9000C268F /* overflowImage@2x.png */; }; - 52C0B9B515BDB7A9000C268F /* overflowImagePressed@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 52C0B9B315BDB7A9000C268F /* overflowImagePressed@2x.png */; }; - 52C268D015BDB72B0012FECA /* overflowImage.png in Resources */ = {isa = PBXBuildFile; fileRef = 52C268CE15BDB72B0012FECA /* overflowImage.png */; }; - 52C268D115BDB72B0012FECA /* overflowImagePressed.png in Resources */ = {isa = PBXBuildFile; fileRef = 52C268CF15BDB72B0012FECA /* overflowImagePressed.png */; }; - 52FAFCCF1C30F4B500C6E613 /* TabNewYosemite.png in Resources */ = {isa = PBXBuildFile; fileRef = 52FAFCCD1C30F4B500C6E613 /* TabNewYosemite.png */; }; - 52FAFCD01C30F4B500C6E613 /* TabNewYosemite@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 52FAFCCE1C30F4B500C6E613 /* TabNewYosemite@2x.png */; }; - 52FAFCD31C30F4DF00C6E613 /* PSMYosemiteTabStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 52FAFCD11C30F4DF00C6E613 /* PSMYosemiteTabStyle.h */; }; - 52FAFCD41C30F4DF00C6E613 /* PSMYosemiteTabStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 52FAFCD21C30F4DF00C6E613 /* PSMYosemiteTabStyle.m */; }; - 546DEAF1067F63070098DCC4 /* PSMTabBarControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 0259C576FE90428111CA0C5A /* PSMTabBarControl.m */; }; - 546DEAF2067F630E0098DCC4 /* PSMTabBarControl.h in Headers */ = {isa = PBXBuildFile; fileRef = 0259C57AFE90428111CA0C5A /* PSMTabBarControl.h */; settings = {ATTRIBUTES = (Public, ); }; }; - A2082A9009EAEB34009AC8BE /* PSMTabDragAssistant.h in Headers */ = {isa = PBXBuildFile; fileRef = A2082A8D09EAEB33009AC8BE /* PSMTabDragAssistant.h */; }; - A2082A9109EAEB34009AC8BE /* PSMTabDragAssistant.m in Sources */ = {isa = PBXBuildFile; fileRef = A2082A8E09EAEB33009AC8BE /* PSMTabDragAssistant.m */; }; - A2129BB209AEB58F00724E6C /* PSMProgressIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = A2129BAF09AEB58F00724E6C /* PSMProgressIndicator.h */; }; - A2129BB309AEB58F00724E6C /* PSMProgressIndicator.m in Sources */ = {isa = PBXBuildFile; fileRef = A2129BB009AEB58F00724E6C /* PSMProgressIndicator.m */; }; - A251BE850959A1B90058BC7F /* PSMOverflowPopUpButton.h in Headers */ = {isa = PBXBuildFile; fileRef = A251BE810959A1B90058BC7F /* PSMOverflowPopUpButton.h */; }; - A251BE860959A1B90058BC7F /* PSMOverflowPopUpButton.m in Sources */ = {isa = PBXBuildFile; fileRef = A251BE820959A1B90058BC7F /* PSMOverflowPopUpButton.m */; }; - A251BE870959A1B90058BC7F /* PSMTabBarCell.h in Headers */ = {isa = PBXBuildFile; fileRef = A251BE830959A1B90058BC7F /* PSMTabBarCell.h */; }; - A251BE880959A1B90058BC7F /* PSMTabBarCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A251BE840959A1B90058BC7F /* PSMTabBarCell.m */; }; - A268E80409A9822A00E082AA /* AquaTabNew.png in Resources */ = {isa = PBXBuildFile; fileRef = A268E7F809A9822900E082AA /* AquaTabNew.png */; }; - A268E80509A9822A00E082AA /* AquaTabNewPressed.png in Resources */ = {isa = PBXBuildFile; fileRef = A268E7F909A9822900E082AA /* AquaTabNewPressed.png */; }; - A268E80609A9822A00E082AA /* AquaTabNewRollover.png in Resources */ = {isa = PBXBuildFile; fileRef = A268E7FA09A9822900E082AA /* AquaTabNewRollover.png */; }; - A268E80709A9822A00E082AA /* TabNewMetal.png in Resources */ = {isa = PBXBuildFile; fileRef = A268E7FB09A9822900E082AA /* TabNewMetal.png */; }; - A268E80809A9822A00E082AA /* TabNewMetalPressed.png in Resources */ = {isa = PBXBuildFile; fileRef = A268E7FC09A9822900E082AA /* TabNewMetalPressed.png */; }; - A268E80909A9822A00E082AA /* TabNewMetalRollover.png in Resources */ = {isa = PBXBuildFile; fileRef = A268E7FD09A9822900E082AA /* TabNewMetalRollover.png */; }; - A268EA6209A9831800E082AA /* PSMRolloverButton.h in Headers */ = {isa = PBXBuildFile; fileRef = A268EA5F09A9831800E082AA /* PSMRolloverButton.h */; }; - A268EA6309A9831800E082AA /* PSMRolloverButton.m in Sources */ = {isa = PBXBuildFile; fileRef = A268EA6009A9831800E082AA /* PSMRolloverButton.m */; }; - A27E47850A28EE76007BA395 /* TabIcon.tif in Resources */ = {isa = PBXBuildFile; fileRef = A20822F00959F6AA00C5F5A4 /* TabIcon.tif */; }; - A27E47880A28EE7C007BA395 /* TabControlRep.tif in Resources */ = {isa = PBXBuildFile; fileRef = A20822EF0959F6AA00C5F5A4 /* TabControlRep.tif */; }; - A2C0D99509AF870000ED379C /* pi.png in Resources */ = {isa = PBXBuildFile; fileRef = A2C0D99309AF870000ED379C /* pi.png */; }; - A2D32EDC09A634C900EC8662 /* PSMTabStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = A2D32EDA09A634C900EC8662 /* PSMTabStyle.h */; }; - A2D32EF709A63BF700EC8662 /* AquaTabClose_Front_Pressed.tif in Resources */ = {isa = PBXBuildFile; fileRef = A2D32EF009A63BF700EC8662 /* AquaTabClose_Front_Pressed.tif */; }; - A2D32EF809A63BF700EC8662 /* AquaTabClose_Front_Rollover.tif in Resources */ = {isa = PBXBuildFile; fileRef = A2D32EF109A63BF700EC8662 /* AquaTabClose_Front_Rollover.tif */; }; - A2D32EF909A63BF700EC8662 /* AquaTabClose_Front.tif in Resources */ = {isa = PBXBuildFile; fileRef = A2D32EF209A63BF700EC8662 /* AquaTabClose_Front.tif */; }; - A2D32EFA09A63BF700EC8662 /* AquaTabsBackground.png in Resources */ = {isa = PBXBuildFile; fileRef = A2D32EF309A63BF700EC8662 /* AquaTabsBackground.png */; }; - A2D32EFB09A63BF700EC8662 /* AquaTabsDown.png in Resources */ = {isa = PBXBuildFile; fileRef = A2D32EF409A63BF700EC8662 /* AquaTabsDown.png */; }; - A2D32EFC09A63BF700EC8662 /* AquaTabsSeparator.png in Resources */ = {isa = PBXBuildFile; fileRef = A2D32EF509A63BF700EC8662 /* AquaTabsSeparator.png */; }; - A2D32EFD09A63BF700EC8662 /* AquaTabsSeparatorDown.png in Resources */ = {isa = PBXBuildFile; fileRef = A2D32EF609A63BF700EC8662 /* AquaTabsSeparatorDown.png */; }; - A2D32F0009A63D7A00EC8662 /* PSMMetalTabStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = A2D32EFE09A63D7A00EC8662 /* PSMMetalTabStyle.h */; }; - A2D32F0109A63D7A00EC8662 /* PSMMetalTabStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = A2D32EFF09A63D7A00EC8662 /* PSMMetalTabStyle.m */; }; - A2D3317C09A68B7500EC8662 /* AquaTabsDownGraphite.png in Resources */ = {isa = PBXBuildFile; fileRef = A2D3317A09A68B7500EC8662 /* AquaTabsDownGraphite.png */; }; - A2D3317D09A68B7500EC8662 /* AquaTabsDownNonKey.png in Resources */ = {isa = PBXBuildFile; fileRef = A2D3317B09A68B7500EC8662 /* AquaTabsDownNonKey.png */; }; - A2D98B0A0A2B432C0064C6F8 /* PSMUnifiedTabStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = A2D98B070A2B432C0064C6F8 /* PSMUnifiedTabStyle.h */; }; - A2D98B0B0A2B432C0064C6F8 /* PSMUnifiedTabStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = A2D98B080A2B432C0064C6F8 /* PSMUnifiedTabStyle.m */; }; - A2D98B120A2B43FA0064C6F8 /* NSBezierPath_AMShading.h in Headers */ = {isa = PBXBuildFile; fileRef = A2D98B0F0A2B43FA0064C6F8 /* NSBezierPath_AMShading.h */; }; - A2D98B130A2B43FA0064C6F8 /* NSBezierPath_AMShading.m in Sources */ = {isa = PBXBuildFile; fileRef = A2D98B100A2B43FA0064C6F8 /* NSBezierPath_AMShading.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 53DF6904067E5B930090B5B0 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 0259C573FE90428111CA0C5A /* Project object */; - proxyType = 1; - remoteGlobalIDString = 53DF68FC067E5B5A0090B5B0; - remoteInfo = PSMTabBarControlFramework; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 0259C576FE90428111CA0C5A /* PSMTabBarControl.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = PSMTabBarControl.m; path = source/PSMTabBarControl.m; sourceTree = ""; }; - 0259C577FE90428111CA0C5A /* PSMTabBarControlInspector.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = PSMTabBarControlInspector.m; path = source/PSMTabBarControlInspector.m; sourceTree = ""; }; - 0259C578FE90428111CA0C5A /* PSMTabBarControlPalette.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = PSMTabBarControlPalette.m; path = source/PSMTabBarControlPalette.m; sourceTree = ""; }; - 0259C57AFE90428111CA0C5A /* PSMTabBarControl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = PSMTabBarControl.h; path = source/PSMTabBarControl.h; sourceTree = ""; }; - 0259C57BFE90428111CA0C5A /* PSMTabBarControlInspector.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = PSMTabBarControlInspector.h; path = source/PSMTabBarControlInspector.h; sourceTree = ""; }; - 0259C57CFE90428111CA0C5A /* PSMTabBarControlPalette.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = PSMTabBarControlPalette.h; path = source/PSMTabBarControlPalette.h; sourceTree = ""; }; - 0259C57FFE90428111CA0C5A /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/PSMTabBarControlInspector.nib; sourceTree = ""; }; - 0259C581FE90428111CA0C5A /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/PSMTabBarControlPalette.nib; sourceTree = ""; }; - 0259C583FE90428111CA0C5A /* palette.table */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = palette.table; sourceTree = ""; }; - 13EB9DBD07DE0F1E00EB933A /* InterfaceBuilder.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = InterfaceBuilder.framework; path = /System/Library/Frameworks/InterfaceBuilder.framework; sourceTree = ""; }; - 13F8B88807B434F6008AE28D /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; - 13F8B88A07B434F6008AE28D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; - 32DBCF980370C29C00C91783 /* PSMTabBarControl_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PSMTabBarControl_Prefix.pch; path = source/PSMTabBarControl_Prefix.pch; sourceTree = ""; }; - 523897EE15BDA9AC00498A53 /* TabClose_Front_Pressed@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "TabClose_Front_Pressed@2x.png"; path = "images/TabClose_Front_Pressed@2x.png"; sourceTree = ""; }; - 523897EF15BDA9AC00498A53 /* TabClose_Front_Rollover@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "TabClose_Front_Rollover@2x.png"; path = "images/TabClose_Front_Rollover@2x.png"; sourceTree = ""; }; - 523897F015BDA9AC00498A53 /* TabClose_Front@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "TabClose_Front@2x.png"; path = "images/TabClose_Front@2x.png"; sourceTree = ""; }; - 523897F115BDA9AC00498A53 /* TabNewMetal@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "TabNewMetal@2x.png"; path = "images/TabNewMetal@2x.png"; sourceTree = ""; }; - 523897F215BDA9AC00498A53 /* TabNewMetalPressed@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "TabNewMetalPressed@2x.png"; path = "images/TabNewMetalPressed@2x.png"; sourceTree = ""; }; - 523897F315BDA9AC00498A53 /* TabNewMetalRollover@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "TabNewMetalRollover@2x.png"; path = "images/TabNewMetalRollover@2x.png"; sourceTree = ""; }; - 52A57C0C15BBA230003EC59C /* TabClose_Front.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = TabClose_Front.png; path = images/TabClose_Front.png; sourceTree = ""; }; - 52A57C0D15BBA230003EC59C /* TabClose_Front_Pressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = TabClose_Front_Pressed.png; path = images/TabClose_Front_Pressed.png; sourceTree = ""; }; - 52A57C0E15BBA230003EC59C /* TabClose_Front_Rollover.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = TabClose_Front_Rollover.png; path = images/TabClose_Front_Rollover.png; sourceTree = ""; }; - 52C0B9B215BDB7A9000C268F /* overflowImage@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "overflowImage@2x.png"; path = "images/overflowImage@2x.png"; sourceTree = ""; }; - 52C0B9B315BDB7A9000C268F /* overflowImagePressed@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "overflowImagePressed@2x.png"; path = "images/overflowImagePressed@2x.png"; sourceTree = ""; }; - 52C268CE15BDB72B0012FECA /* overflowImage.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = overflowImage.png; path = images/overflowImage.png; sourceTree = ""; }; - 52C268CF15BDB72B0012FECA /* overflowImagePressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = overflowImagePressed.png; path = images/overflowImagePressed.png; sourceTree = ""; }; - 52FAFCCD1C30F4B500C6E613 /* TabNewYosemite.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = TabNewYosemite.png; path = images/TabNewYosemite.png; sourceTree = ""; }; - 52FAFCCE1C30F4B500C6E613 /* TabNewYosemite@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "TabNewYosemite@2x.png"; path = "images/TabNewYosemite@2x.png"; sourceTree = ""; }; - 52FAFCD11C30F4DF00C6E613 /* PSMYosemiteTabStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PSMYosemiteTabStyle.h; path = source/PSMYosemiteTabStyle.h; sourceTree = ""; }; - 52FAFCD21C30F4DF00C6E613 /* PSMYosemiteTabStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PSMYosemiteTabStyle.m; path = source/PSMYosemiteTabStyle.m; sourceTree = ""; }; - 53DF68FD067E5B5A0090B5B0 /* PSMTabBarControl.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PSMTabBarControl.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 53DF68FE067E5B5A0090B5B0 /* PSMTabBarControlFramework-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "PSMTabBarControlFramework-Info.plist"; sourceTree = ""; }; - 54D33B2806778E3300C9C163 /* PSMTabBarControl.ibclassdescription */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PSMTabBarControl.ibclassdescription; sourceTree = ""; }; - 8D1AC9730486D14A00FE50C9 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; - 8D1AC97B0486D23100FE50C9 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; - A2072A2409ABD88600304BCB /* Folder.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = Folder.tif; path = images/Folder.tif; sourceTree = ""; }; - A2072A2509ABD88600304BCB /* Globe.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = Globe.tiff; path = images/Globe.tiff; sourceTree = ""; }; - A2072B5C09AC1FA500304BCB /* Warning.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Warning.png; path = images/Warning.png; sourceTree = ""; }; - A20822EF0959F6AA00C5F5A4 /* TabControlRep.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = TabControlRep.tif; path = images/TabControlRep.tif; sourceTree = ""; }; - A20822F00959F6AA00C5F5A4 /* TabIcon.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = TabIcon.tif; path = images/TabIcon.tif; sourceTree = ""; }; - A2082A8D09EAEB33009AC8BE /* PSMTabDragAssistant.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PSMTabDragAssistant.h; path = source/PSMTabDragAssistant.h; sourceTree = ""; }; - A2082A8E09EAEB33009AC8BE /* PSMTabDragAssistant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PSMTabDragAssistant.m; path = source/PSMTabDragAssistant.m; sourceTree = ""; wrapsLines = 0; }; - A2129BAF09AEB58F00724E6C /* PSMProgressIndicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PSMProgressIndicator.h; path = source/PSMProgressIndicator.h; sourceTree = ""; }; - A2129BB009AEB58F00724E6C /* PSMProgressIndicator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PSMProgressIndicator.m; path = source/PSMProgressIndicator.m; sourceTree = ""; }; - A246FB040A2BD6F9005BDF7B /* PSMTabBarControlDoc.html */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.html.documentation; name = PSMTabBarControlDoc.html; path = documentation/PSMTabBarControlDoc.html; sourceTree = ""; }; - A251BE810959A1B90058BC7F /* PSMOverflowPopUpButton.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 30; name = PSMOverflowPopUpButton.h; path = source/PSMOverflowPopUpButton.h; sourceTree = ""; }; - A251BE820959A1B90058BC7F /* PSMOverflowPopUpButton.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = PSMOverflowPopUpButton.m; path = source/PSMOverflowPopUpButton.m; sourceTree = ""; }; - A251BE830959A1B90058BC7F /* PSMTabBarCell.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = PSMTabBarCell.h; path = source/PSMTabBarCell.h; sourceTree = ""; }; - A251BE840959A1B90058BC7F /* PSMTabBarCell.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = PSMTabBarCell.m; path = source/PSMTabBarCell.m; sourceTree = ""; }; - A251BE890959A1EA0058BC7F /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = AppController.h; path = source/AppController.h; sourceTree = ""; }; - A251BE8A0959A1EA0058BC7F /* AppController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = AppController.m; path = source/AppController.m; sourceTree = ""; }; - A251BE8B0959A1EA0058BC7F /* FakeModel.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = FakeModel.h; path = source/FakeModel.h; sourceTree = ""; }; - A251BE8C0959A1EA0058BC7F /* FakeModel.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = FakeModel.m; path = source/FakeModel.m; sourceTree = ""; }; - A251BE8D0959A1EA0058BC7F /* main.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = main.m; path = source/main.m; sourceTree = ""; }; - A251BE8F0959A23A0058BC7F /* 32x32cancel.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = 32x32cancel.png; path = images/32x32cancel.png; sourceTree = ""; }; - A251BE9B0959A2530058BC7F /* ReadMe.rtfd */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; path = ReadMe.rtfd; sourceTree = ""; }; - A251BEA20959BB5B0058BC7F /* TabBarControlDemo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "TabBarControlDemo-Info.plist"; sourceTree = ""; }; - A251BEC30959BC0E0058BC7F /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/MainMenu.nib; sourceTree = ""; }; - A268E7F809A9822900E082AA /* AquaTabNew.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = AquaTabNew.png; path = images/AquaTabNew.png; sourceTree = ""; }; - A268E7F909A9822900E082AA /* AquaTabNewPressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = AquaTabNewPressed.png; path = images/AquaTabNewPressed.png; sourceTree = ""; }; - A268E7FA09A9822900E082AA /* AquaTabNewRollover.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = AquaTabNewRollover.png; path = images/AquaTabNewRollover.png; sourceTree = ""; }; - A268E7FB09A9822900E082AA /* TabNewMetal.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = TabNewMetal.png; path = images/TabNewMetal.png; sourceTree = ""; }; - A268E7FC09A9822900E082AA /* TabNewMetalPressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = TabNewMetalPressed.png; path = images/TabNewMetalPressed.png; sourceTree = ""; }; - A268E7FD09A9822900E082AA /* TabNewMetalRollover.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = TabNewMetalRollover.png; path = images/TabNewMetalRollover.png; sourceTree = ""; }; - A268EA5F09A9831800E082AA /* PSMRolloverButton.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = PSMRolloverButton.h; path = source/PSMRolloverButton.h; sourceTree = ""; }; - A268EA6009A9831800E082AA /* PSMRolloverButton.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = PSMRolloverButton.m; path = source/PSMRolloverButton.m; sourceTree = ""; }; - A269361009A778770006911E /* 32x32_log.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = 32x32_log.tiff; path = images/32x32_log.tiff; sourceTree = ""; }; - A2A711BA09E5AE1E00D0089B /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/Window.nib; sourceTree = ""; }; - A2A711BD09E5BF0500D0089B /* WindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WindowController.h; path = source/WindowController.h; sourceTree = ""; }; - A2A711BE09E5BF0500D0089B /* WindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WindowController.m; path = source/WindowController.m; sourceTree = ""; }; - A2C0D99309AF870000ED379C /* pi.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = pi.png; path = images/pi.png; sourceTree = ""; }; - A2D32EDA09A634C900EC8662 /* PSMTabStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PSMTabStyle.h; path = source/PSMTabStyle.h; sourceTree = ""; }; - A2D32EF009A63BF700EC8662 /* AquaTabClose_Front_Pressed.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = AquaTabClose_Front_Pressed.tif; path = images/AquaTabClose_Front_Pressed.tif; sourceTree = ""; }; - A2D32EF109A63BF700EC8662 /* AquaTabClose_Front_Rollover.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = AquaTabClose_Front_Rollover.tif; path = images/AquaTabClose_Front_Rollover.tif; sourceTree = ""; }; - A2D32EF209A63BF700EC8662 /* AquaTabClose_Front.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = AquaTabClose_Front.tif; path = images/AquaTabClose_Front.tif; sourceTree = ""; }; - A2D32EF309A63BF700EC8662 /* AquaTabsBackground.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = AquaTabsBackground.png; path = images/AquaTabsBackground.png; sourceTree = ""; }; - A2D32EF409A63BF700EC8662 /* AquaTabsDown.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = AquaTabsDown.png; path = images/AquaTabsDown.png; sourceTree = ""; }; - A2D32EF509A63BF700EC8662 /* AquaTabsSeparator.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = AquaTabsSeparator.png; path = images/AquaTabsSeparator.png; sourceTree = ""; }; - A2D32EF609A63BF700EC8662 /* AquaTabsSeparatorDown.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = AquaTabsSeparatorDown.png; path = images/AquaTabsSeparatorDown.png; sourceTree = ""; }; - A2D32EFE09A63D7A00EC8662 /* PSMMetalTabStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PSMMetalTabStyle.h; path = source/PSMMetalTabStyle.h; sourceTree = ""; }; - A2D32EFF09A63D7A00EC8662 /* PSMMetalTabStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PSMMetalTabStyle.m; path = source/PSMMetalTabStyle.m; sourceTree = ""; }; - A2D3317A09A68B7500EC8662 /* AquaTabsDownGraphite.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = AquaTabsDownGraphite.png; path = images/AquaTabsDownGraphite.png; sourceTree = ""; }; - A2D3317B09A68B7500EC8662 /* AquaTabsDownNonKey.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = AquaTabsDownNonKey.png; path = images/AquaTabsDownNonKey.png; sourceTree = ""; }; - A2D98B070A2B432C0064C6F8 /* PSMUnifiedTabStyle.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = PSMUnifiedTabStyle.h; path = source/PSMUnifiedTabStyle.h; sourceTree = ""; }; - A2D98B080A2B432C0064C6F8 /* PSMUnifiedTabStyle.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = PSMUnifiedTabStyle.m; path = source/PSMUnifiedTabStyle.m; sourceTree = ""; }; - A2D98B0F0A2B43FA0064C6F8 /* NSBezierPath_AMShading.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = NSBezierPath_AMShading.h; path = source/NSBezierPath_AMShading.h; sourceTree = ""; }; - A2D98B100A2B43FA0064C6F8 /* NSBezierPath_AMShading.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = NSBezierPath_AMShading.m; path = source/NSBezierPath_AMShading.m; sourceTree = ""; }; - DD92D38A0106425D02CA0E72 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 53DF68FB067E5B5A0090B5B0 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 13F8B89007B43554008AE28D /* Cocoa.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 0259C574FE90428111CA0C5A /* PSMTabBarControl */ = { - isa = PBXGroup; - children = ( - A251BE9B0959A2530058BC7F /* ReadMe.rtfd */, - A246FADE0A2BD446005BDF7B /* Documentation */, - 32DBCF9E0370C38000C91783 /* Palette */, - 54D33B2C06778E4400C9C163 /* Framework */, - A251BE590959A0550058BC7F /* Demo App */, - 0259C582FE90428111CA0C5A /* Resources */, - 1ED78706FE9D4A0611CA0C5A /* Products */, - 2E58F364FFB232C311CA0CBA /* Frameworks */, - ); - name = PSMTabBarControl; - sourceTree = ""; - }; - 0259C582FE90428111CA0C5A /* Resources */ = { - isa = PBXGroup; - children = ( - A251BEC20959BC0E0058BC7F /* MainMenu.nib */, - A251BE8E0959A21A0058BC7F /* Images */, - 8D1AC9730486D14A00FE50C9 /* Info.plist */, - 53DF68FE067E5B5A0090B5B0 /* PSMTabBarControlFramework-Info.plist */, - A251BEA20959BB5B0058BC7F /* TabBarControlDemo-Info.plist */, - 8D1AC97F0486D23B00FE50C9 /* InfoPlist.strings */, - A2A711B909E5AE1E00D0089B /* Window.nib */, - ); - name = Resources; - sourceTree = ""; - }; - 131E8FE8067F80F40006E0CE /* Resources */ = { - isa = PBXGroup; - children = ( - A20822EF0959F6AA00C5F5A4 /* TabControlRep.tif */, - A20822F00959F6AA00C5F5A4 /* TabIcon.tif */, - 0259C57EFE90428111CA0C5A /* PSMTabBarControlInspector.nib */, - 0259C580FE90428111CA0C5A /* PSMTabBarControlPalette.nib */, - ); - name = Resources; - sourceTree = ""; - }; - 13F8B6FD07B43410008AE28D /* Linked Frameworks */ = { - isa = PBXGroup; - children = ( - 13EB9DBD07DE0F1E00EB933A /* InterfaceBuilder.framework */, - DD92D38A0106425D02CA0E72 /* Cocoa.framework */, - ); - name = "Linked Frameworks"; - sourceTree = ""; - }; - 13F8B70407B43425008AE28D /* Other Frameworks */ = { - isa = PBXGroup; - children = ( - 13F8B88807B434F6008AE28D /* AppKit.framework */, - 13F8B88A07B434F6008AE28D /* Foundation.framework */, - ); - name = "Other Frameworks"; - sourceTree = ""; - }; - 1ED78706FE9D4A0611CA0C5A /* Products */ = { - isa = PBXGroup; - children = ( - 53DF68FD067E5B5A0090B5B0 /* PSMTabBarControl.framework */, - ); - name = Products; - sourceTree = ""; - }; - 2E58F364FFB232C311CA0CBA /* Frameworks */ = { - isa = PBXGroup; - children = ( - 13F8B6FD07B43410008AE28D /* Linked Frameworks */, - 13F8B70407B43425008AE28D /* Other Frameworks */, - ); - name = Frameworks; - sourceTree = ""; - }; - 32DBCF9E0370C38000C91783 /* Palette */ = { - isa = PBXGroup; - children = ( - 54D33B2406778DD400C9C163 /* Undo Support */, - 54D33B2506778DF000C9C163 /* Classes */, - 32DBCF9F0370C38200C91783 /* Other Sources */, - 131E8FE8067F80F40006E0CE /* Resources */, - 0259C583FE90428111CA0C5A /* palette.table */, - ); - name = Palette; - sourceTree = ""; - }; - 32DBCF9F0370C38200C91783 /* Other Sources */ = { - isa = PBXGroup; - children = ( - 32DBCF980370C29C00C91783 /* PSMTabBarControl_Prefix.pch */, - ); - name = "Other Sources"; - sourceTree = ""; - }; - 54D33B2406778DD400C9C163 /* Undo Support */ = { - isa = PBXGroup; - children = ( - 54D33B2806778E3300C9C163 /* PSMTabBarControl.ibclassdescription */, - ); - name = "Undo Support"; - sourceTree = ""; - }; - 54D33B2506778DF000C9C163 /* Classes */ = { - isa = PBXGroup; - children = ( - 0259C57BFE90428111CA0C5A /* PSMTabBarControlInspector.h */, - 0259C577FE90428111CA0C5A /* PSMTabBarControlInspector.m */, - 0259C57CFE90428111CA0C5A /* PSMTabBarControlPalette.h */, - 0259C578FE90428111CA0C5A /* PSMTabBarControlPalette.m */, - ); - name = Classes; - sourceTree = ""; - }; - 54D33B2C06778E4400C9C163 /* Framework */ = { - isa = PBXGroup; - children = ( - 0259C57AFE90428111CA0C5A /* PSMTabBarControl.h */, - 0259C576FE90428111CA0C5A /* PSMTabBarControl.m */, - A251BE830959A1B90058BC7F /* PSMTabBarCell.h */, - A251BE840959A1B90058BC7F /* PSMTabBarCell.m */, - A2D32EDA09A634C900EC8662 /* PSMTabStyle.h */, - A2D32EFE09A63D7A00EC8662 /* PSMMetalTabStyle.h */, - A2D32EFF09A63D7A00EC8662 /* PSMMetalTabStyle.m */, - A2D98B070A2B432C0064C6F8 /* PSMUnifiedTabStyle.h */, - A2D98B080A2B432C0064C6F8 /* PSMUnifiedTabStyle.m */, - 52FAFCD11C30F4DF00C6E613 /* PSMYosemiteTabStyle.h */, - 52FAFCD21C30F4DF00C6E613 /* PSMYosemiteTabStyle.m */, - A268EA5F09A9831800E082AA /* PSMRolloverButton.h */, - A268EA6009A9831800E082AA /* PSMRolloverButton.m */, - A251BE810959A1B90058BC7F /* PSMOverflowPopUpButton.h */, - A251BE820959A1B90058BC7F /* PSMOverflowPopUpButton.m */, - A2129BAF09AEB58F00724E6C /* PSMProgressIndicator.h */, - A2129BB009AEB58F00724E6C /* PSMProgressIndicator.m */, - A2082A8D09EAEB33009AC8BE /* PSMTabDragAssistant.h */, - A2082A8E09EAEB33009AC8BE /* PSMTabDragAssistant.m */, - A2D98B0F0A2B43FA0064C6F8 /* NSBezierPath_AMShading.h */, - A2D98B100A2B43FA0064C6F8 /* NSBezierPath_AMShading.m */, - ); - name = Framework; - sourceTree = ""; - }; - A246FADE0A2BD446005BDF7B /* Documentation */ = { - isa = PBXGroup; - children = ( - A246FB040A2BD6F9005BDF7B /* PSMTabBarControlDoc.html */, - ); - name = Documentation; - sourceTree = ""; - }; - A251BE590959A0550058BC7F /* Demo App */ = { - isa = PBXGroup; - children = ( - A251BE890959A1EA0058BC7F /* AppController.h */, - A251BE8A0959A1EA0058BC7F /* AppController.m */, - A2A711BD09E5BF0500D0089B /* WindowController.h */, - A2A711BE09E5BF0500D0089B /* WindowController.m */, - A251BE8B0959A1EA0058BC7F /* FakeModel.h */, - A251BE8C0959A1EA0058BC7F /* FakeModel.m */, - A251BE8D0959A1EA0058BC7F /* main.m */, - ); - name = "Demo App"; - sourceTree = ""; - }; - A251BE8E0959A21A0058BC7F /* Images */ = { - isa = PBXGroup; - children = ( - A2C0D99309AF870000ED379C /* pi.png */, - A2072B5C09AC1FA500304BCB /* Warning.png */, - A2072A2409ABD88600304BCB /* Folder.tif */, - A2072A2509ABD88600304BCB /* Globe.tiff */, - A268E7F809A9822900E082AA /* AquaTabNew.png */, - A268E7F909A9822900E082AA /* AquaTabNewPressed.png */, - A268E7FA09A9822900E082AA /* AquaTabNewRollover.png */, - A268E7FB09A9822900E082AA /* TabNewMetal.png */, - 523897F115BDA9AC00498A53 /* TabNewMetal@2x.png */, - A268E7FC09A9822900E082AA /* TabNewMetalPressed.png */, - 523897F215BDA9AC00498A53 /* TabNewMetalPressed@2x.png */, - A268E7FD09A9822900E082AA /* TabNewMetalRollover.png */, - 523897F315BDA9AC00498A53 /* TabNewMetalRollover@2x.png */, - A269361009A778770006911E /* 32x32_log.tiff */, - A2D3317A09A68B7500EC8662 /* AquaTabsDownGraphite.png */, - A2D3317B09A68B7500EC8662 /* AquaTabsDownNonKey.png */, - A2D32EF009A63BF700EC8662 /* AquaTabClose_Front_Pressed.tif */, - A2D32EF109A63BF700EC8662 /* AquaTabClose_Front_Rollover.tif */, - A2D32EF209A63BF700EC8662 /* AquaTabClose_Front.tif */, - A2D32EF309A63BF700EC8662 /* AquaTabsBackground.png */, - A2D32EF409A63BF700EC8662 /* AquaTabsDown.png */, - A2D32EF509A63BF700EC8662 /* AquaTabsSeparator.png */, - A2D32EF609A63BF700EC8662 /* AquaTabsSeparatorDown.png */, - A251BE8F0959A23A0058BC7F /* 32x32cancel.png */, - 52C268CE15BDB72B0012FECA /* overflowImage.png */, - 52C0B9B215BDB7A9000C268F /* overflowImage@2x.png */, - 52C268CF15BDB72B0012FECA /* overflowImagePressed.png */, - 52C0B9B315BDB7A9000C268F /* overflowImagePressed@2x.png */, - 52A57C0C15BBA230003EC59C /* TabClose_Front.png */, - 523897F015BDA9AC00498A53 /* TabClose_Front@2x.png */, - 52A57C0D15BBA230003EC59C /* TabClose_Front_Pressed.png */, - 523897EE15BDA9AC00498A53 /* TabClose_Front_Pressed@2x.png */, - 52A57C0E15BBA230003EC59C /* TabClose_Front_Rollover.png */, - 523897EF15BDA9AC00498A53 /* TabClose_Front_Rollover@2x.png */, - 52FAFCCD1C30F4B500C6E613 /* TabNewYosemite.png */, - 52FAFCCE1C30F4B500C6E613 /* TabNewYosemite@2x.png */, - ); - name = Images; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 53DF68F8067E5B5A0090B5B0 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 546DEAF2067F630E0098DCC4 /* PSMTabBarControl.h in Headers */, - A251BE850959A1B90058BC7F /* PSMOverflowPopUpButton.h in Headers */, - A251BE870959A1B90058BC7F /* PSMTabBarCell.h in Headers */, - 52FAFCD31C30F4DF00C6E613 /* PSMYosemiteTabStyle.h in Headers */, - A2D32EDC09A634C900EC8662 /* PSMTabStyle.h in Headers */, - A2D32F0009A63D7A00EC8662 /* PSMMetalTabStyle.h in Headers */, - A268EA6209A9831800E082AA /* PSMRolloverButton.h in Headers */, - A2129BB209AEB58F00724E6C /* PSMProgressIndicator.h in Headers */, - A2082A9009EAEB34009AC8BE /* PSMTabDragAssistant.h in Headers */, - A2D98B0A0A2B432C0064C6F8 /* PSMUnifiedTabStyle.h in Headers */, - A2D98B120A2B43FA0064C6F8 /* NSBezierPath_AMShading.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 53DF68FC067E5B5A0090B5B0 /* PSMTabBarControlFramework */ = { - isa = PBXNativeTarget; - buildConfigurationList = C056397F08A954F8003078D8 /* Build configuration list for PBXNativeTarget "PSMTabBarControlFramework" */; - buildPhases = ( - 53DF68F8067E5B5A0090B5B0 /* Headers */, - 53DF68F9067E5B5A0090B5B0 /* Resources */, - 53DF68FA067E5B5A0090B5B0 /* Sources */, - 53DF68FB067E5B5A0090B5B0 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = PSMTabBarControlFramework; - productName = PSMTabBarControlFramework; - productReference = 53DF68FD067E5B5A0090B5B0 /* PSMTabBarControl.framework */; - productType = "com.apple.product-type.framework"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 0259C573FE90428111CA0C5A /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0710; - }; - buildConfigurationList = C056398B08A954F8003078D8 /* Build configuration list for PBXProject "PSMTabBarControl" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 1; - knownRegions = ( - en, - ); - mainGroup = 0259C574FE90428111CA0C5A /* PSMTabBarControl */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 53DF68FC067E5B5A0090B5B0 /* PSMTabBarControlFramework */, - 53DF6901067E5B8E0090B5B0 /* All */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 53DF68F9067E5B5A0090B5B0 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - A2D32EF709A63BF700EC8662 /* AquaTabClose_Front_Pressed.tif in Resources */, - A2D32EF809A63BF700EC8662 /* AquaTabClose_Front_Rollover.tif in Resources */, - A2D32EF909A63BF700EC8662 /* AquaTabClose_Front.tif in Resources */, - A2D32EFA09A63BF700EC8662 /* AquaTabsBackground.png in Resources */, - A2D32EFB09A63BF700EC8662 /* AquaTabsDown.png in Resources */, - A2D32EFC09A63BF700EC8662 /* AquaTabsSeparator.png in Resources */, - A2D32EFD09A63BF700EC8662 /* AquaTabsSeparatorDown.png in Resources */, - A2D3317C09A68B7500EC8662 /* AquaTabsDownGraphite.png in Resources */, - A2D3317D09A68B7500EC8662 /* AquaTabsDownNonKey.png in Resources */, - A268E80409A9822A00E082AA /* AquaTabNew.png in Resources */, - A268E80509A9822A00E082AA /* AquaTabNewPressed.png in Resources */, - A268E80609A9822A00E082AA /* AquaTabNewRollover.png in Resources */, - A268E80709A9822A00E082AA /* TabNewMetal.png in Resources */, - A268E80809A9822A00E082AA /* TabNewMetalPressed.png in Resources */, - A268E80909A9822A00E082AA /* TabNewMetalRollover.png in Resources */, - A2C0D99509AF870000ED379C /* pi.png in Resources */, - A27E47850A28EE76007BA395 /* TabIcon.tif in Resources */, - A27E47880A28EE7C007BA395 /* TabControlRep.tif in Resources */, - 52A57C0F15BBA230003EC59C /* TabClose_Front.png in Resources */, - 52A57C1015BBA230003EC59C /* TabClose_Front_Pressed.png in Resources */, - 52A57C1115BBA230003EC59C /* TabClose_Front_Rollover.png in Resources */, - 52FAFCCF1C30F4B500C6E613 /* TabNewYosemite.png in Resources */, - 523897F415BDA9AC00498A53 /* TabClose_Front_Pressed@2x.png in Resources */, - 523897F515BDA9AC00498A53 /* TabClose_Front_Rollover@2x.png in Resources */, - 52FAFCD01C30F4B500C6E613 /* TabNewYosemite@2x.png in Resources */, - 523897F615BDA9AC00498A53 /* TabClose_Front@2x.png in Resources */, - 523897F715BDA9AC00498A53 /* TabNewMetal@2x.png in Resources */, - 523897F815BDA9AC00498A53 /* TabNewMetalPressed@2x.png in Resources */, - 523897F915BDA9AC00498A53 /* TabNewMetalRollover@2x.png in Resources */, - 52C268D015BDB72B0012FECA /* overflowImage.png in Resources */, - 52C268D115BDB72B0012FECA /* overflowImagePressed.png in Resources */, - 52C0B9B415BDB7A9000C268F /* overflowImage@2x.png in Resources */, - 52C0B9B515BDB7A9000C268F /* overflowImagePressed@2x.png in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 53DF68FA067E5B5A0090B5B0 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 546DEAF1067F63070098DCC4 /* PSMTabBarControl.m in Sources */, - A251BE860959A1B90058BC7F /* PSMOverflowPopUpButton.m in Sources */, - A251BE880959A1B90058BC7F /* PSMTabBarCell.m in Sources */, - A2D32F0109A63D7A00EC8662 /* PSMMetalTabStyle.m in Sources */, - A268EA6309A9831800E082AA /* PSMRolloverButton.m in Sources */, - A2129BB309AEB58F00724E6C /* PSMProgressIndicator.m in Sources */, - A2082A9109EAEB34009AC8BE /* PSMTabDragAssistant.m in Sources */, - 52FAFCD41C30F4DF00C6E613 /* PSMYosemiteTabStyle.m in Sources */, - A2D98B0B0A2B432C0064C6F8 /* PSMUnifiedTabStyle.m in Sources */, - A2D98B130A2B43FA0064C6F8 /* NSBezierPath_AMShading.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 53DF6905067E5B930090B5B0 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 53DF68FC067E5B5A0090B5B0 /* PSMTabBarControlFramework */; - targetProxy = 53DF6904067E5B930090B5B0 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - 0259C57EFE90428111CA0C5A /* PSMTabBarControlInspector.nib */ = { - isa = PBXVariantGroup; - children = ( - 0259C57FFE90428111CA0C5A /* English */, - ); - name = PSMTabBarControlInspector.nib; - sourceTree = ""; - }; - 0259C580FE90428111CA0C5A /* PSMTabBarControlPalette.nib */ = { - isa = PBXVariantGroup; - children = ( - 0259C581FE90428111CA0C5A /* English */, - ); - name = PSMTabBarControlPalette.nib; - sourceTree = ""; - }; - 8D1AC97F0486D23B00FE50C9 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - 8D1AC97B0486D23100FE50C9 /* English */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; - A251BEC20959BC0E0058BC7F /* MainMenu.nib */ = { - isa = PBXVariantGroup; - children = ( - A251BEC30959BC0E0058BC7F /* English */, - ); - name = MainMenu.nib; - sourceTree = ""; - }; - A2A711B909E5AE1E00D0089B /* Window.nib */ = { - isa = PBXVariantGroup; - children = ( - A2A711BA09E5AE1E00D0089B /* English */, - ); - name = Window.nib; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - C056398008A954F8003078D8 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - COMBINE_HIDPI_IMAGES = YES; - COPY_PHASE_STRIP = NO; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - FRAMEWORK_VERSION = A; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; - GCC_VERSION = ""; - INFOPLIST_FILE = "PSMTabBarControlFramework-Info.plist"; - INSTALL_PATH = "@executable_path/../Frameworks"; - ONLY_ACTIVE_ARCH = YES; - OTHER_LDFLAGS = ""; - PRODUCT_BUNDLE_IDENTIFIER = com.positivespinmedia.PSMTabBarControlFramework; - PRODUCT_NAME = PSMTabBarControl; - SYMROOT = ../build; - ZERO_LINK = NO; - }; - name = Debug; - }; - C056398108A954F8003078D8 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - FRAMEWORK_VERSION = A; - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - GCC_MODEL_TUNING = G5; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; - GCC_VERSION = ""; - INFOPLIST_FILE = "PSMTabBarControlFramework-Info.plist"; - INSTALL_PATH = "@executable_path/../Frameworks"; - ONLY_ACTIVE_ARCH = YES; - OTHER_LDFLAGS = ""; - PRODUCT_BUNDLE_IDENTIFIER = com.positivespinmedia.PSMTabBarControlFramework; - PRODUCT_NAME = PSMTabBarControl; - SYMROOT = ../build; - }; - name = Release; - }; - C056398808A954F8003078D8 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - PRODUCT_NAME = All; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); - ZERO_LINK = YES; - }; - name = Debug; - }; - C056398908A954F8003078D8 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - GCC_MODEL_TUNING = G5; - PRODUCT_NAME = All; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); - }; - name = Release; - }; - C056398C08A954F8003078D8 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ENABLE_TESTABILITY = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - ONLY_ACTIVE_ARCH = YES; - PREBINDING = NO; - SYMROOT = ../build; - }; - name = Debug; - }; - C056398D08A954F8003078D8 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - ONLY_ACTIVE_ARCH = YES; - PREBINDING = NO; - SYMROOT = ../build; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - C056397F08A954F8003078D8 /* Build configuration list for PBXNativeTarget "PSMTabBarControlFramework" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C056398008A954F8003078D8 /* Debug */, - C056398108A954F8003078D8 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - C056398708A954F8003078D8 /* Build configuration list for PBXAggregateTarget "All" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C056398808A954F8003078D8 /* Debug */, - C056398908A954F8003078D8 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - C056398B08A954F8003078D8 /* Build configuration list for PBXProject "PSMTabBarControl" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C056398C08A954F8003078D8 /* Debug */, - C056398D08A954F8003078D8 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 0259C573FE90428111CA0C5A /* Project object */; -} diff --git a/src/MacVim/PSMTabBarControl/PSMTabBarControlFramework-Info.plist b/src/MacVim/PSMTabBarControl/PSMTabBarControlFramework-Info.plist deleted file mode 100644 index 3e49e9a9d0..0000000000 --- a/src/MacVim/PSMTabBarControl/PSMTabBarControlFramework-Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - PSMTabBarControl - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - FMWK - CFBundleSignature - PSM1 - CFBundleVersion - 1.1 - NSPrincipalClass - PSMTabBarControl - - diff --git a/src/MacVim/PSMTabBarControl/PSMTabBarControl_Prefix.pch b/src/MacVim/PSMTabBarControl/PSMTabBarControl_Prefix.pch deleted file mode 100644 index 65df9ffedb..0000000000 --- a/src/MacVim/PSMTabBarControl/PSMTabBarControl_Prefix.pch +++ /dev/null @@ -1,8 +0,0 @@ -// -// Prefix header for all source files of the 'PSMTabBarControl' target in the 'PSMTabBarControl' project -// - -#ifdef __OBJC__ - #import - #import -#endif diff --git a/src/MacVim/PSMTabBarControl/ReadMe.rtfd/TXT.rtf b/src/MacVim/PSMTabBarControl/ReadMe.rtfd/TXT.rtf deleted file mode 100644 index acd9372a24..0000000000 --- a/src/MacVim/PSMTabBarControl/ReadMe.rtfd/TXT.rtf +++ /dev/null @@ -1,186 +0,0 @@ -{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf380 -{\fonttbl\f0\fswiss\fcharset77 Helvetica-Bold;\f1\fswiss\fcharset77 Helvetica;\f2\fswiss\fcharset77 Helvetica-Oblique; -\f3\fnil\fcharset77 Monaco;} -{\colortbl;\red255\green255\blue255;\red118\green15\blue80;\red0\green0\blue255;\red35\green110\blue37; -} -{\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc2\leveljcn2\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid0\'02\'05.;}{\levelnumbers\'01;}}{\listname ;}\listid1}} -{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}} -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\qc\pardirnatural - -\f0\b\fs24 \cf0 \ -PSMTabBarControl (and related classes)\ - -\f1\b0 developed by John Pannell, Positive Spin Media\ -\ -as seen in the super-cool app...\ -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\qc\pardirnatural -\cf0 {{\NeXTGraphic startpage.gif \width7200 \height2820 -}¬}\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\qc\pardirnatural -\cf0 \ -\ -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural -\cf0 This source code and all related materials are released under the BSD license, which is explained at the end of this document, along with some other legalese. I've made my best effort to make everything bug free, but please let me know of any bugs found or suggestions you have: johnp@positivespinmedia.com.\ -\ - -\f0\b Purpose -\f1\b0 \ -\ -PSMTabBarControl seeks to provide developers with a high-quality, easy to use GUI to manage an NSTabView (or subclasses) in a manner similar to Safari's tabbed browsing implementation. It attempts to add a few features as well. Here's what you get:\ -\ - -\f0\b The look: -\f1\b0 a control/cell architecture that draws the expected tab appearance below a toolbar or similar view. Included styles work consistently in Aqua, Metal, or customized metal variations by basing fills on the window's background color. Includes drawing of a close button, and rollover states for the close button and tab cell. Also provides pop-up button and menu when tabs overflow available space, and support for individual tab progress indicators, icons, and object counters. Tabs can be drawn sized to fit the string content of the label, or uniformly sized.\ -\ - -\f0\b The functionality: -\f1\b0 Close button removes tabs, click on a tab cell selects. Indicators start, stop, and hide if things are hooked up correctly.\ -\ - -\f0\b Extras: -\f1\b0 Supports multi-window drag-and-drop reordering of the tabs with aqua-licious animation.\ -\ - -\f0\b Files -\f1\b0 \ -\ -Your project will need the files in the "Framework" folder of the project. The actual framework packages these (and some images) up nicely for you, if desired. Please look over the "TabBarControlDemo" target of the source code project to see exactly what is needed to get everything to build. Building and playing with the demo is also a good way to get a feel for the features provided by these classes.\ -\ - -\f0\b Usage -\f1\b0 \ -\ -Simply drag a custom view object from the views palette in IB, read the PSMTabBarControl class into IB, and set the view's custom class to PSMTabBarControl. Then connect the control's tabview outlet to the tab view being controlled, and make the control the delegate of the tab view. You can also connect the control's "partner view" outlet to another view that will resize in response to the hide/show behavior of the control.\ -\ -Alternately, you can build the Palette subproject and add the built IB palette to Interface Builder. In this case, creating and configuring an instance is as easy and drag, drop, and a few clicks. A demo movie and the built palette are available in a separate download from my website: http://www.positivespinmedia.com/dev/PSMTabBarControl.html\ -\ - -\f2\i Please read the PSMTabBarControlDoc.html file in the documentation folder of this project. It provides an Apple-ish page describing the interface and usage of this object. -\f1\i0 \ -\ - -\f0\b Patterns of Use -\f1\b0 \ -\ -There are a few random notes I can think of for usage guidelines...\ -\ -- You may see a line between the toolbar and the control in your app; it is part of the toolbar. In Tiger, you can eliminate the appearance of this line:\ -\ -\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\tx10560\tx11520\tx12480\tx13440\tx14400\tx15360\tx16320\tx17280\tx18240\tx19200\tx20160\tx21120\tx22080\tx23040\tx24000\tx24960\tx25920\tx26880\tx27840\tx28800\tx29760\tx30720\tx31680\tx32640\tx33600\tx34560\tx35520\tx36480\tx37440\tx38400\tx39360\tx40320\tx41280\tx42240\tx43200\tx44160\tx45120\tx46080\tx47040\tx48000\tx48960\tx49920\tx50880\tx51840\tx52800\tx53760\tx54720\tx55680\tx56640\tx57600\tx58560\tx59520\tx60480\tx61440\tx62400\tx63360\tx64320\tx65280\tx66240\tx67200\tx68160\tx69120\tx70080\tx71040\tx72000\tx72960\tx73920\tx74880\tx75840\tx76800\tx77760\tx78720\tx79680\tx80640\tx81600\tx82560\tx83520\tx84480\tx85440\tx86400\tx87360\tx88320\tx89280\tx90240\tx91200\tx92160\tx93120\tx94080\tx95040\tx96000\ql\qnatural\pardirnatural - -\f3\fs20 \cf0 \CocoaLigature0 SInt32 MacVersion;\ -\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\tx10560\tx11520\tx12480\tx13440\tx14400\tx15360\tx16320\tx17280\tx18240\tx19200\tx20160\tx21120\tx22080\tx23040\tx24000\tx24960\tx25920\tx26880\tx27840\tx28800\tx29760\tx30720\tx31680\tx32640\tx33600\tx34560\tx35520\tx36480\tx37440\tx38400\tx39360\tx40320\tx41280\tx42240\tx43200\tx44160\tx45120\tx46080\tx47040\tx48000\tx48960\tx49920\tx50880\tx51840\tx52800\tx53760\tx54720\tx55680\tx56640\tx57600\tx58560\tx59520\tx60480\tx61440\tx62400\tx63360\tx64320\tx65280\tx66240\tx67200\tx68160\tx69120\tx70080\tx71040\tx72000\tx72960\tx73920\tx74880\tx75840\tx76800\tx77760\tx78720\tx79680\tx80640\tx81600\tx82560\tx83520\tx84480\tx85440\tx86400\tx87360\tx88320\tx89280\tx90240\tx91200\tx92160\tx93120\tx94080\tx95040\tx96000\ql\qnatural\pardirnatural -\cf2 if\cf0 (Gestalt(gestaltSystemVersion, &MacVersion) == noErr)\{\ - \cf2 if\cf0 (MacVersion >= \cf3 0x1040\cf0 )\{\ - \cf4 // this call is Tiger only\cf0 \ - [toolbar setShowsBaselineSeparator:\cf2 NO\cf0 ];\ - \}\ -\}\ -\ -\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\tx10560\tx11520\tx12480\tx13440\tx14400\tx15360\tx16320\tx17280\tx18240\tx19200\tx20160\tx21120\tx22080\tx23040\tx24000\tx24960\tx25920\tx26880\tx27840\tx28800\tx29760\tx30720\tx31680\tx32640\tx33600\tx34560\tx35520\tx36480\tx37440\tx38400\tx39360\tx40320\tx41280\tx42240\tx43200\tx44160\tx45120\tx46080\tx47040\tx48000\tx48960\tx49920\tx50880\tx51840\tx52800\tx53760\tx54720\tx55680\tx56640\tx57600\tx58560\tx59520\tx60480\tx61440\tx62400\tx63360\tx64320\tx65280\tx66240\tx67200\tx68160\tx69120\tx70080\tx71040\tx72000\tx72960\tx73920\tx74880\tx75840\tx76800\tx77760\tx78720\tx79680\tx80640\tx81600\tx82560\tx83520\tx84480\tx85440\tx86400\tx87360\tx88320\tx89280\tx90240\tx91200\tx92160\tx93120\tx94080\tx95040\tx96000\ql\qnatural\pardirnatural - -\f1\fs24 \cf0 - In general, there is no reason for your app objects to communicate (outside of configuration) with the PSMTabBarControl at all. Changes made to the NSTabView instance programmatically should be directed at the NSTabView instance itself, and the control will update to reflect the changes made.\ -\ -- Your app might want to receive tab view delegate notifications in order to perform some actions. No problem, simply make the desired object the delegate of the PSMTabBarControl instance... it passes along all tab view notifications. Note that it uses these notifications to make changes itself - read the source code to make sure you aren't tripping over something.\ -\ -- The control creates bindings between each cell's progress indicator and the represented NSTabViewItem's identifier object, if it can. In my app design, I set an instance of NSObjectController as the NSTabViewItem's identifier, and then bind to the "isProcessing" key of the controller's content object. All of this can be seen in the source of the demo app...\ -\ -- The control can be set to hide itself when there is only a single tab, and can also be told to hide/show on demand. It can animate to appear and disappear, and will resize something to compensate for the missing window real estate. By default, it will resize the window, but you can also connect the "partnerView" outlet in IB to specify another view to resize to take up the missing space. Note that this takes some attention to sizing springs and wires to get right, and complex views may need a container view to achieve the desired effect.\ -\ -- The control can be configured to draw an attractive "Add Tab" button at the end of the tab cells. Unfortunately, the button is all looks and no brains - it has no idea what your app wants to do when adding a tab. If you configure your app to show the add tab button, you need to hook up the add tab button to the proper target with the proper selector. Something like this will do nicely in your app controller's awakeFromNib:\ -\ -\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\tx10560\tx11520\tx12480\tx13440\tx14400\tx15360\tx16320\tx17280\tx18240\tx19200\tx20160\tx21120\tx22080\tx23040\tx24000\tx24960\tx25920\tx26880\tx27840\tx28800\tx29760\tx30720\tx31680\tx32640\tx33600\tx34560\tx35520\tx36480\tx37440\tx38400\tx39360\tx40320\tx41280\tx42240\tx43200\tx44160\tx45120\tx46080\tx47040\tx48000\tx48960\tx49920\tx50880\tx51840\tx52800\tx53760\tx54720\tx55680\tx56640\tx57600\tx58560\tx59520\tx60480\tx61440\tx62400\tx63360\tx64320\tx65280\tx66240\tx67200\tx68160\tx69120\tx70080\tx71040\tx72000\tx72960\tx73920\tx74880\tx75840\tx76800\tx77760\tx78720\tx79680\tx80640\tx81600\tx82560\tx83520\tx84480\tx85440\tx86400\tx87360\tx88320\tx89280\tx90240\tx91200\tx92160\tx93120\tx94080\tx95040\tx96000\ql\qnatural\pardirnatural - -\f3\fs20 \cf4 // hook up add tab button\cf0 \ -[[tabBar addTabButton] setTarget:\cf2 self\cf0 ];\ -[[tabBar addTabButton] setAction:\cf2 @selector\cf0 (addNewTab:)]; -\f1\fs24 \ -\ -- The tabs have some sizing options: You can specify the minimum width, maximum width, and optimum width, as well as spcifying if the tabs should size to fit their label or not. The sizing bahavior of the tabs is as follows: If "size to fit" is specified, then tabs will be generated to fit the label, but will never exceed the specified max or min widths. Once the end of the control is reached, the overflow menu will appear as tabs are added; the last tab will squeeze in if it can, or the remaining tabs will stretch to occupy the full control. If "size to fit" is not specified, then all successive tabs will appear at the optimum width. Once the end of the control is reached, adding new tabs will cause all tabs to shrink to accomodate, until the minumum width is reached, and then the overflow menu will be used; max width is ignored in this case. Hopefully that all makes sense :-)\ -\ -- PSMTabBarControl will load the existing tabs from the tabView outlet at startup. However, many of the advanced features (icon display, progress indicator, object count) rely on binding to a controller that is likely not set up in IB. Solution? Nuke the existing tabs in the NSTabView and add new ones, configured the way you like. The demo app does this in the awakeFromNib: method of the app controller.\ -\ -- As a design choice, I elected to keep a cell object around until its tab was closed, instead of "churning" cell objects in each update cycle. Each cell keeps its NSTabViewItem as its representedObject and maintains reference that way, rather than by any index. As a result of this, drag-and-drop reordering of tabs does not change the underlying NSTabView instance at all. All that to say: don't rely on numerical indices if communicating with both the control and the tab view - the indices may not correlate if the user moved some tabs around (and remember - you shouldn't need to communicate with the control anyway :-). The Shiira Project, from which I gained much insight and inspiration from for this UI element, elected to scrap and rebuild the array of cells each time through the update cycle, and rely on indices to correlate between cells and NSTabViewItems. I felt the representedObject route was cleaner, and preferred not to churn objects.\ -\ -\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\tx10560\tx11520\tx12480\tx13440\tx14400\tx15360\tx16320\tx17280\tx18240\tx19200\tx20160\tx21120\tx22080\tx23040\tx24000\tx24960\tx25920\tx26880\tx27840\tx28800\tx29760\tx30720\tx31680\tx32640\tx33600\tx34560\tx35520\tx36480\tx37440\tx38400\tx39360\tx40320\tx41280\tx42240\tx43200\tx44160\tx45120\tx46080\tx47040\tx48000\tx48960\tx49920\tx50880\tx51840\tx52800\tx53760\tx54720\tx55680\tx56640\tx57600\tx58560\tx59520\tx60480\tx61440\tx62400\tx63360\tx64320\tx65280\tx66240\tx67200\tx68160\tx69120\tx70080\tx71040\tx72000\tx72960\tx73920\tx74880\tx75840\tx76800\tx77760\tx78720\tx79680\tx80640\tx81600\tx82560\tx83520\tx84480\tx85440\tx86400\tx87360\tx88320\tx89280\tx90240\tx91200\tx92160\tx93120\tx94080\tx95040\tx96000\ql\qnatural\pardirnatural - -\f0\b \cf0 Improvements? -\f1\b0 \ -\ -Pipe up if you think of something you'd like to see; here's my current list:\ -\ -- "Pop-up" tabs - like pop-up folders in the finder, in case you want to drag to a destination in another tab.\ -- Support for the -\f3\fs22 \CocoaLigature1 NSUnifiedTitleAndToolbarWindowMask -\f1\fs24 \CocoaLigature0 "unified" window appearance. (Help! I really searched around to try to make this work... the color pattern of the title and toolbar seem to be top secret! The new "unified" style is an excellent replication of a unified look, but isn't "built from" the unified appearance like the metal is.)\ -- During multi-window drag, having a "drag window/image" that shows the represented view getting moved to the other window.\ -- During multi-window drag, support for dragging out solo tabs to consolidate in another window, removing the source window in the process.\ -- Support vertical as well as horizontal alignment.\ -\ - -\f0\b Version History -\f1\b0 \ -\ -Version 1.3 (May 29, 2006)\ -- new feature: Unified tab style, compliments of Keith Blount\ -- new feature: allow multi-window drag config option (again from Keith).\ -- fixed bug: Palette installation/usage instructions were wrong.\ -- enhancement: exposed the -\f3\fs20 representedTabViewItems -\f1\fs24 method, which can be used to retrieve the order of the tabs as displayed in the control, since the underlying NSTabView does not get reordered during drag and drop rearrangement.\ -\ -Version 1.2 (April 20, 2006)\ -- new feature: multi-window drag and drop support.\ -- bug fixed: zombie issue with tabView:didCloseTabViewItem\ -- bugs fixed: some drawing issues around the progress indicators in tabs, and the add tab button.\ -- enhancement: the hide/show animation has been improved with less "flickering" of progress indicators during the hide and show.\ -\ -Version 1.1.2 (April 5, 2006)\ -- fixed bug: tabs of non-integer width resulted in occasional anti-aliased drawing issues of dividers between tabs in the Metal style (Thanks, Kent).\ -- added feature: delegate can now respond to -tabView:shouldCloseTabViewItem: and -tabView:willCloseTabViewItem:, and -tabView:didCloseTabViewItem: messages, so your app can take care of any needed setup/cleanup for these actions.\ -- fixed bug: tab close buttons now show down state when pressed down.\ -\ -Version 1.1.1 (March 16, 2006)\ -- fixed bug: Palette inspector would not reflect state of previously instantiated control. This has been fixed (Thanks, Guillaume).\ -- enhancement: Overflow button now highlights when mouse down (Thanks, Kent).\ -- fixed bug: when set to not close a solo tab, the close button would be hidden for the tab, but could still be closed if you clicked the tab in the right location. This has been fixed (Thanks, malcom).\ -\ -Version 1.1 (March 10, 2006)\ -- Bound the "title" of the cell to the "label" of the source tabview item. Just in case you wanted to change the label on the tab during the running of your application.\ -- PSMTabBarCell factored to support new tab "styles", or appearances in drawing. Now supported are the existing "Metal" style and a new "Aqua" style. Many thanks to David Smith, Seth Willits, and Chris Forsythe for their contributions!\ -- Control can be configured to "Hide for single tab", so it doesn't appear unless there are more than a single tab view present. Features animated show/hide behavior (that can be called anytime, and is called automatically in the case that a single tab exists). The show/hide behavior can also be set up to resize either the window (default) or a selected "partner view" to compensate for the lost height of the tab bar.\ -- Control can be configured for "Can close only tab" behavior. If set to NO, no close button will appear on a lone tab.\ -- Cells can be set to "size to fit", or given uniform min/max/optimum sizes.\ -- Added support for display of an icon and an object count, if the proper app design pattern is followed.\ -- Sweet animated drag-and-drop drawing!\ -- A few drawing bugs surrounding the progress indicators in cells were squished.\ -- New documentation, in case you found this read me a little pithy.\ -\ -Version 1.0 (December 2005)\ -Initial release of safari-like tab implementation.\ -\ - -\f0\b The standard disavowal of this beautiful mess -\f1\b0 \ -\ -I should note that portions of this source code were inspired by the Shiira project's implementation of Safari-style tabs. While I made some different design decisions, the drawing and some other aspects are only slight modifications of their excellent work. As such, I note their copyright under their BSD licence:\ -\ -\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\tx10560\tx11520\tx12480\tx13440\tx14400\tx15360\tx16320\tx17280\tx18240\tx19200\tx20160\tx21120\tx22080\tx23040\tx24000\tx24960\tx25920\tx26880\tx27840\tx28800\tx29760\tx30720\tx31680\tx32640\tx33600\tx34560\tx35520\tx36480\tx37440\tx38400\tx39360\tx40320\tx41280\tx42240\tx43200\tx44160\tx45120\tx46080\tx47040\tx48000\tx48960\tx49920\tx50880\tx51840\tx52800\tx53760\tx54720\tx55680\tx56640\tx57600\tx58560\tx59520\tx60480\tx61440\tx62400\tx63360\tx64320\tx65280\tx66240\tx67200\tx68160\tx69120\tx70080\tx71040\tx72000\tx72960\tx73920\tx74880\tx75840\tx76800\tx77760\tx78720\tx79680\tx80640\tx81600\tx82560\tx83520\tx84480\tx85440\tx86400\tx87360\tx88320\tx89280\tx90240\tx91200\tx92160\tx93120\tx94080\tx95040\tx96000\ql\qnatural\pardirnatural - -\f3\fs20 \cf4 Portions of this software Copyright 2004 The Shiira Project. All rights reserved.\ -\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\tx10560\tx11520\tx12480\tx13440\tx14400\tx15360\tx16320\tx17280\tx18240\tx19200\tx20160\tx21120\tx22080\tx23040\tx24000\tx24960\tx25920\tx26880\tx27840\tx28800\tx29760\tx30720\tx31680\tx32640\tx33600\tx34560\tx35520\tx36480\tx37440\tx38400\tx39360\tx40320\tx41280\tx42240\tx43200\tx44160\tx45120\tx46080\tx47040\tx48000\tx48960\tx49920\tx50880\tx51840\tx52800\tx53760\tx54720\tx55680\tx56640\tx57600\tx58560\tx59520\tx60480\tx61440\tx62400\tx63360\tx64320\tx65280\tx66240\tx67200\tx68160\tx69120\tx70080\tx71040\tx72000\tx72960\tx73920\tx74880\tx75840\tx76800\tx77760\tx78720\tx79680\tx80640\tx81600\tx82560\tx83520\tx84480\tx85440\tx86400\tx87360\tx88320\tx89280\tx90240\tx91200\tx92160\tx93120\tx94080\tx95040\tx96000\ql\qnatural\pardirnatural - -\f1\fs24 \cf0 Check them out at: http://hmdt-web.net/shiira/\ -\ -This source code is provided under BSD license, the conditions of which are listed below. I hope you'll make note somewhere in your about window or ReadMe stating the sweet coding goodness of Positive Spin Media and link to the fascinating and informative website at www.positivespinmedia.com\ -\ -\pard\pardeftab720\sa320\ql\qnatural -\cf0 \CocoaLigature1 Copyright (c) 2005, Positive Spin Media\uc0\u8232 All rights reserved.\ -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\ -\pard\tx220\tx720\pardeftab720\li720\fi-720\ql\qnatural -\ls1\ilvl0\cf0 {\listtext \'a5 }Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\ -{\listtext \'a5 }Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\ -{\listtext \'a5 }Neither the name of Positive Spin Media nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\ - \ -\pard\pardeftab720\sa320\ql\qnatural -\cf0 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\CocoaLigature0 \ -} \ No newline at end of file diff --git a/src/MacVim/PSMTabBarControl/ReadMe.rtfd/startpage.gif b/src/MacVim/PSMTabBarControl/ReadMe.rtfd/startpage.gif deleted file mode 100644 index 8707a77ab0..0000000000 Binary files a/src/MacVim/PSMTabBarControl/ReadMe.rtfd/startpage.gif and /dev/null differ diff --git a/src/MacVim/PSMTabBarControl/TabBarControlDemo-Info.plist b/src/MacVim/PSMTabBarControl/TabBarControlDemo-Info.plist deleted file mode 100644 index 673218b406..0000000000 --- a/src/MacVim/PSMTabBarControl/TabBarControlDemo-Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - com.positivespinmedia.TabBarControlDemo - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - APPL - CFBundleSignature - ???? - CFBundleVersion - 1.1 - NSMainNibFile - MainMenu - NSPrincipalClass - NSApplication - - diff --git a/src/MacVim/PSMTabBarControl/documentation/PSMTabBarControlDoc.html b/src/MacVim/PSMTabBarControl/documentation/PSMTabBarControlDoc.html deleted file mode 100644 index fa8b99009a..0000000000 --- a/src/MacVim/PSMTabBarControl/documentation/PSMTabBarControlDoc.html +++ /dev/null @@ -1,301 +0,0 @@ - - - - - PSMTabBarControl - Safari-style Tabs (Objective-C) - - - - - - - - -

PSMTabBarControl

- - - -
Inherits from
Conforms to
Declared in
PSMTabBarControl.h
-

Class Description

- -

PSMTabBarControl provides a user interface for the management of tabbed views that has an appearance similar to Apple's Safari web browser.

-

Internally, PSMTabBarControl uses a custom cell class and supporting style objects to implement its user interface.

-

Currently, this object supports "Aqua" and "Metal" tab styles to present an appearance consistent with the rest of your application. Numerous configuration options exist to customize behavior, as outlined below. PSMTabBarControl instances require a few specific connections with other application objects to perform properly at runtime:

-
    -
  • The control's "tabView" outlet must be connected to the desired NSTabView instance in Interface Builder, or set programmatically with the setTabView: method.
  • -
  • The "delegate" outlet of the NSTabView being controlled must be connected to the instance of PSMTabBarControl, either programmatically or in IB.
  • -
  • Optionally, you may connect the control's "partnerView" outlet to a view that will be resized to compensate when PSMTabBarControl changes size due to hide/show behavior. If no connection is made, PSMTabBarControl will resize the window in response to hide/show messages.
  • -
-

A PSMTabBarControl instance should occupy the width of the window, and should be precisely 22 pixels in height. It should be resizable in width, but not height. It can be placed at the top or botton of the window (or anywhere in between, if desired).

-

Outside of configuring it, your application should have little interaction with this class. The presented tabs will change in conjunction with changes your application makes in the NSTabView being controlled.

- -

A Usage Pattern

- -

PSMTabBarControl becomes even more powerful if your application design matches an expected pattern: the control attempts to bind a number of tab attributes to the NSTabViewItem's identifier object if possible. These visible attributes include a progress indicator, an icon, and an object counter. Additionally, the control binds each tab's title to the label of the represented NSTabViewItem.

- -

Taking advantage of these features requires no glue code on your part, but it does require providing a particular object graph. Here's the basics...

- -
  • For each tab that is created, your application should have a model object that keeps the state of model attributes: isProcessing (a BOOL), objectCount (an int), and icon (an NSImage). You can pick and choose any number of these to support, or none, at your option. -
  • Your application should create an NSObjectController to control your model (the model object is the "content" of the NSObjectController instance). -
  • When you create new tabs (via the NSTabView interface), you should set the object controller instance to be the identifier object of the newly created NSTabViewItem object.
- -

The demo application included with this project illustrates a very quick way to accomplish these goals. If this pattern is followed, PSMTabBarControl will take care of the rest.

- - -

Methods by Task

-

Setting needed connections

-
– setTabView:

Specifies the instance of NSTabView to be controlled.

- -
– tabView

Returns the instance of NSTabView being controlled.

- -

Setting optional connections

-
– setPartnerView:

Specifies a view that will resize to compensate for control size changes in response to hide and show messages.

- -
– partnerView

Returns the instance of a view that will resize to compensate for control size changes in response to hide and show messages.

- -
– setDelegate:

Specifies an object that will receive delegate messages as passed through from the NSTabView instance.

- -
– delegate:

Returns the specified delegate object.

- -

Control configuration

-
– canCloseOnlyTab

Returns YES if the user is allowed to close a tab when it is the only tab left, NO otherwise.

- -
– setCanCloseOnlyTab:

Controls whether the receiver will present a close button for a single tab in a tab bar.

- -
– styleName

Returns the name of the current drawing style. "Aqua", "Metal", and "Unified" are the currently supported options.

- -
– setStyleNamed:

Specifies the style in which the tabs and control are drawn. "Aqua", "Metal", and "Unified" are the currently supported options.

- -
– hideForSingleTab

Returns YES if the control will hide if there is only one tab left, NO otherwise.

- -
– setHideForSingleTab:

Controls whether the receiver will hide when the user closes all but a single tab in a tab bar.

- -
– showAddTabButton

Returns YES if the control will display a small "add tab" button at the rightmost end of the tabs, NO otherwise.

- -
– setShowAddTabButton:

Controls whether the receiver will will display a small "add tab" button at the rightmost end of the tabs.

- -
– cellMinWidth

Returns the minimum width (in pixels) that a tab will be allowed to occupy.

- -
– setCellMinWidth:

Specifies the maximum width (in pixels) that a tab will be allowed to occupy.

- -
– cellMaxWidth

Returns the maximum width (in pixels) that a tab will be allowed to occupy.

- -
– setCellMaxWidth:

Specifies the maximum width (in pixels) that a tab will be allowed to occupy.

- -
– cellOptimumWidth

Returns the default width (in pixels) that a tab will be allowed to occupy when tabs are drawn with uniform size.

- -
– setCellMaxWidth:

Specifies the default width (in pixels) that a tab will be allowed to occupy when tabs are drawn with uniform size.

- -
– sizeCellsToFit

Returns YES if the control will make the tabs sized to fit the content of the tab, NO otherwise.

- -
– setSizeCellsToFit:

Controls whether the receiver will make the tabs sized to fit the content of the tab.

- -
– allowsDragBetweenWindows

Returns YES if the control allows a user to drag a tab to another instance of this control, NO otherwise.

- -
– setAllowsDragBetweenWindows:

Controls whether the receiver will allow a user to drag a tab to another instance of this control.

- -

Internal UI components

-
– addTabButton

Returns an instance of an NSButton subclass that is used to present the "add tab" button. If "showAddTabButton" is YES, developers must use this method to access the button and specify a target and action for the button.

- -
– overflowPopUpButton

Returns an instance of an NSPopUpButton subclass that is used to present the overflow menu (which shows when there are more tabs than can fit across the control).

- -
– representedTabViewItems

Returns an array of the NSTabViewItems represented by the tabs in the control. Useful if you want to archive the order of the tabs between runs of your program.

- -

Visibility

-
– hideTabBar:animate:

If desired, obejcts can tell the tab bar to hide (reduce in size to a single pixel line spanning the window) or show, and optionally whether to animate this effect or not.

- -

Instance Methods

- -

addTabButton

-

Returns an instance of an NSButton subclass that is used to present the "add tab" button. If "showAddTabButton" is YES, developers must use this method to access the button and specify a target and action for the button.

- (PSMRolloverButton *)addTabButton;

-
Discussion

If you have configured the control to show the add tab button, you must use this method to access the button and set the target and action for it. Example:

[[tabBar addTabButton] setTarget:self];
-[[tabBar addTabButton] setAction:@selector(addNewTab:)];

-
See Also
- -

allowsDragBetweenWindows

-

Returns YES if the control allows a user to drag a tab to another instance of this control, NO otherwise.

- (BOOL)allowsDragBetweenWindows

-
Discussion

The default is YES.

-
See Also
- -

canCloseOnlyTab

-

Returns YES if the receiver has been configured to allow users to close a single remaining tab.

- (BOOL)canCloseOnlyTab

-
Discussion

The default is NO.

-
See Also
- -

cellMaxWidth

-

Returns the maximum width (in pixels) that a tab will be allowed to occupy.

- (int)cellMaxWidth

-
Discussion

The cellMaxWidth value applies to both uniformly sized tabs, and tabs that are sized to fit. No tab will be drawn wider than the specified value.

-
See Also
- -

cellMinWidth

-

Returns the minimum width (in pixels) that a tab will be allowed to occupy.

- (int)cellMinWidth

-
Discussion

The cellMinWidth value applies only to uniformly sized tabs. No tab will be drawn smaller than the specified value. Size-to-fit tabs ignore this value, and are made just small enough to fit their content.

-
See Also
- -

cellOptimumWidth

-

Returns the width (in pixels) that a tab will be made to occupy if the tabs are uniformly sized.

- (int)cellOptimumWidth

-
Discussion

The cellOptimumWidth value applies only to uniformly sized tabs. All tabs will be drawn at the specified value. Size-to-fit tabs ignore this value, and are made just small enough to fit their content.

-
See Also
- -

delegate

-

Returns the object that will be sent passed-through NSTabView delegate messages.

- (id)delegate

-
See Also
- -

hideForSingleTab

-

Returns YES if the receiver has been configured to hide if there is a single remaining tab.

- (BOOL)hideForSingleTab

-
Discussion

The default is NO.

-
See Also
- -

hideTabBar:animate:

-

If desired, obejcts can tell the tab bar to hide (reduce in size to a single pixel line spanning the window) or show, and optionally whether to animate this effect or not.

- (void)hideTabBar:(BOOL)hide animate:(BOOL)animate

-
Discussion

If hide is YES the control will shrink to a single pixel line spanning the window; otherwise the control will expand to its normal appearance. If animate is YES, the shrinking and expanding will happen in a visible animation; otherwise the transition will be instant. There is no effect if the control is already in the specified state.

- -

overflowPopUpButton

-

Returns an instance of an NSPopUpButton subclass that is used to present the overflow menu.

- (PSMOverflowPopUpButton *)overflowPopUpButton;

-
Discussion

This method could be used to modify the button or menu if desired.

- -

partnerView

-

Returns the object that will be resized to compensate for the changing size of the control during hide/show behavior.

- (id)partnerView

-
Discussion

If a partnerView has not been specified, the window will be resized during hide/show.

-
See Also
- -

representedTabViewItems

-

Returns an array of NSTabViewItems, ordered according to the display order of the tabs in the control.

- (NSMutableArray *)representedTabViewItems;

-
Discussion

This method could be used archive the order of the tabs between application runs. When the user reorders tabs via drag and drop, the represented NSTabView does not change order.

- -

setAllowsDragBetweenWindows

-

If set to YES, the receiver is configured to allow users to drag a tab to an instance of PSMTabBarControl in another window.

- (void)setAllowsDragBetweenWindows:(BOOL)value

-
Discussion

The default is YES.

-
See Also
- -

setCanCloseOnlyTab:

-

If set to YES, the receiver is configured to allow users to close a single remaining tab.

- (void)setCanCloseOnlyTab:(BOOL)value

-
Discussion

The default is NO.

-
See Also
- -

setCellMaxWidth:

-

Specifies the maximum width (in pixels) that a tab will be allowed to occupy.

- (void)setCellMaxWidth:(int)value

-
Discussion

No tab will be drawn any wider than the specified value.

-
See Also
- -

setCellMinWidth:

-

Specifies the minimum width (in pixels) that a tab will be allowed to occupy.

- (void)setCellMinWidth:(int)value

-
Discussion

No tab will be drawn any smaller than the specified value. This value is ignored when drawing in size-to-fit; tabs are made just small enough to fit their content.

-
See Also
- -

setCellOptimumWidth:

-

Specifies the width (in pixels) that a tab will occupy when tabs are uniformly sized.

- (void)setCellOptimumWidth:(int)value

-
Discussion

This value is ignored when drawing in size-to-fit; tabs are made just small enough to fit their content.

-
See Also
- -

setDelegate:

-

Specifies an object that will receive delegate messages as passed through from the NSTabView instance.

- (void)setDelegate:(id)object

-
See Also
- -

setHideForSingleTab:

-

If set to YES, the receiver is configured to hide when there is a single remaining tab.

- (void)setHideForSingleTab:(BOOL)value

-
Discussion

The default is NO.

-
See Also
- -

setPartnerView:

-

Specifies a view that will resize to compensate for control size changes in response to hide and show messages.

- (void)setPartnerView:(id)view

-
Discussion

if nil, the control will resize the window in response to hide/show messages.

-
See Also
- -

setStyleNamed:

-

Specifies the style in which the tabs and control are drawn.

- (void)setStyleNamed:(NSString *)name

-
Discussion

"Aqua" and "Metal" are the currently supported options.

-
See Also
- -

setShowAddTabButton:

-

Controls whether the receiver will will display a small "add tab" button at the rightmost end of the tabs.

- (void)setShowAddTabButton:(BOOL)value

-
Discussion

Default is NO.

-
See Also
- -

setSizeCellsToFit:

-

Controls whether the receiver will make the tabs sized to fit the content of the tab.

- (void)setSizeCellsToFit:(BOOL)value

-
Discussion

Default is NO.

-
See Also
- -

setTabView:

-

Specifies the instance of NSTabView to be controlled.

- (void)setTabView:(NSTabView *)view

-
Discussion

This class will not function properly without this outlet being set.

-
See Also
- -

sizeCellsToFit

-

Returns YES if the control will make the tabs sized to fit the content of the tab, NO otherwise.

-

Discussion

The default is NO.

-
See Also
- -

styleName:

-

Returns the name of the current drawing style.

- (NSString *)styleName

-
Discussion

"Aqua" and "Metal" are the currently supported options.

-
See Also
- -

tabView:

-

Returns the instance of NSTabView being controlled.

- (NSTabView *)tabView

-
Discussion

This class will not function properly if this object is nil.

-
See Also
- -

Delegate Methods

- -

You application controller can keep track of activity from the tab view and the user via the following delegate methods.

- -

tabView:shouldCloseTabViewItem:

-

Sent when a user clicks the close button on a tab.

- (BOOL)tabView:(NSTabView *)tabView shouldCloseTabViewItem:(NSTabViewItem *)tabViewItem

-
Discussion

If you return NO, the tab will not be closed. Please make sure to alert the user as to why with a sheet or dialog.

- -

tabView:willCloseTabViewItem:

-

Sent when tab is about to be closed.

- (void)tabView:(NSTabView *)tabView willCloseTabViewItem:(NSTabViewItem *)tabViewItem

-
Discussion

This presents you with an opportunity to clean up the application objects/events/sessions represented by the tab.

- -

tabView:didCloseTabViewItem:

-

Sent after a tab has been closed.

- (void)tabView:(NSTabView *)tabView didCloseTabViewItem:(NSTabViewItem *)tabViewItem

-
Discussion

This presents you with an opportunity to clean up the application objects/events/sessions represented by the tab. Don't go trying to modify the tabViewItem - it is about to be released, and has already been removed from the tabView!

- -

tabView:didSelectTabViewItem:

-

Informs the delegate that tabView has selected tabViewItem.

- (void)tabView:(NSTabView *)tabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem

- -

tabView:shouldSelectTabViewItem:

-

Invoked just before tabViewItem in tabView is selected.

- (BOOL)tabView:(NSTabView *)tabView shouldSelectTabViewItem:(NSTabViewItem *)tabViewItem

-
Discussion

The delegate can return NO to prevent selection of specific tabs.

- -

tabView:willSelectTabViewItem:

-

Informs the delegate that tabView is about to select tabViewItem.

- (void)tabView:(NSTabView *)tabView willSelectTabViewItem:(NSTabViewItem *)tabViewItem

- -

tabViewDidChangeNumberOfTabViewItems:

-

Informs the delegate that the number of tab view items in tabView has changed.

- (void)tabViewDidChangeNumberOfTabViewItems:(NSTabView *)tabView

- - - - - - \ No newline at end of file diff --git a/src/MacVim/PSMTabBarControl/documentation/frameset_styles.css b/src/MacVim/PSMTabBarControl/documentation/frameset_styles.css deleted file mode 100644 index 298e192a89..0000000000 --- a/src/MacVim/PSMTabBarControl/documentation/frameset_styles.css +++ /dev/null @@ -1,943 +0,0 @@ -/* link classes */ -A:link { COLOR: #0000FF; TEXT-DECORATION: none; } -A:link:hover { COLOR: #FF6600; TEXT-DECORATION: underline; } -A:active { COLOR: #FF6600; TEXT-DECORATION: underline; } - -/* apple.com site does not explicitly define visited link properties, but we do here */ -A:visited { COLOR: #0000AA; TEXT-DECORATION: none; } -A:visited:hover { COLOR: #FF6600; TEXT-DECORATION: underline; } - -/* used to convert otherCodeCharacters to code, thus saving character space in HTML for smaller file sizes */ -tt { - FONT-SIZE: 11px; FONT-FAMILY: monaco, courier, monospace; } - -/* redefine preformated text and code blocks */ -PRE { - FONT-SIZE: 11px; FONT-FAMILY: monaco, courier, monospace; margin-top: 5px; margin-bottom: 10px;} -CODE { - FONT-SIZE: 11px; FONT-FAMILY: monaco, courier, monospace; } - - -/* JavaScript toc frame */ -.jtoc_closed { background-color: #e9e9e9; } -.jtoc_open { background-color: #FFFFFF; padding-bottom: 10px; } -.jtoc_open_top_line {border-top: 1px solid #CCC; background-color: #fff; padding-bottom: 10px;} -.jtoc_open_bottom_line {border-bottom: 1px solid #CCC; background-color: #fff; padding-bottom: 10px;} -.jtoc_open_both_lines {border-bottom: 1px solid #CCC; border-top: 1px solid #CCC; background-color: #fff; padding-bottom: 10px;} - -/* frameset: toc frame */ -.toc_contents_text { - font-family: lucida grande, geneva, helvetica, arial, sans-serif; font-size: 12px; font-weight: bold; padding-top: 4px 0; - color: #0000FF; -} -.toc_contents_text_open { - font-family: lucida grande, geneva, helvetica, arial, sans-serif; font-size: 12px; - background: #FFFFFF; color: #0000FF; -} -.low_level_text { - font-family: lucida grande, geneva, helvetica, arial, sans-serif; font-size: 11px; padding: 4px 5px 4px 5px - color: #0000FF; -} - -#toc_contents_title { - font-family: lucida grande, geneva, helvetica, arial, sans-serif; font-size: 16px; color: #FFFFFF; font-weight: bold; -} -.toc_contents_heading { - font-family: lucida grande, geneva, helvetica, arial, sans-serif; font-size: 12px; font-weight: bold; -} - -/* Special TOC heading for Help books only */ -.toc_contents_help_heading { - font-family: lucida grande, geneva, helvetica, arial, sans-serif; font-size: 14px; color: #330099; font-weight: bold; -} - -/* frameset: toc frame styles WEB AS. used for any document that uses the disclosure model for TOC like conceptural and procedural C documents*/ -#toc { - padding: 0 0 0 0; -} - -#toc p.download { - padding: 5px 10px; - margin: 0; - font-weight: normal; font-size: 11px; -} - -#toc_PDFbottomborder { - padding-top: 5px; - border-bottom: 1px solid #CCC; -} - - -#toc h2 { - margin: 0; - padding: 10px; - font-size: 15px; font-weight: bold; - border-bottom: 0px solid; -} - -#toc h3 { - margin: 6px 5px 0 10px; - font-size: 13px; font-weight: bold; color: black; -} - -#toc h4 { - font-size: 11px; font-weight: bold; color: black; - margin: -5px 0px 0 14px; -} - -#toc_staticbox { - padding: 0 0 0 0; - border: 1px solid #919699; - background: #e9e9e9; -} - -#toc ul { - list-style: none outside; - margin-left: 20px; margin-bottom: -2px; - padding: 0px; -} - -#toc ul ul{ - list-style: none outside; - margin-left: 10px; margin-bottom: -2px; - padding: 0px; -} - -#toc li a { - margin-left: 5px; - display: block; - padding: 0px 5px 0px 5px; -} - -#toc li a.location { - font-weight: bold; color: #000; - text-decoration: none; -} - -#toc li{ - font-weight: normal; font-size: 11px; - padding: 0px 5px 0px 0px; - list-style-type: none; background: url(../Images/bullet.gif) no-repeat 0px .5em; - } - -#toc li li a { - margin-left: 0px; -} - - -#toc ul ul li { - background: url(../Images/dash.gif) no-repeat 0px .6em; -} - -#toc ul ul ul li { - background: url(../Images/sm_bullet.gif) no-repeat 0px .5em; -} - -#toc li.open { - border-top: 1px solid #CCC; border-bottom: 1px solid #CCC; background-color: #fff; -} - -#toc .open ul { - background-color: #fff; -} - -li img { - margin-left: 0px; -} -/*#toc li.open { background: #FFF;}*/ - - -/* frameset: toc frame styles WEB AS. used for any document that uses the static model for TOC topics documents*/ - -#topicstoc { - padding: 0px 0px 0px; -} - - -#topicstoc p.download { - border-bottom: 1px solid #CCC; - padding: 5px 10px; - margin: 0px; - font-weight: normal; font-size: 11px; -} - -#topicstoc h2 { - margin: 0; - padding: 10px; - font-size: 15px; font-weight: bold; - border-bottom: 0px solid; -} - -#topicstoc h3 { - margin: 6px 5px 0 10px; - font-size: 13px; font-weight: bold; color: black; -} - -#topicstoc h4 { - font-size: 11px; font-weight: bold; color: black; - margin: 2px 0px 0px 14px; -} - -#topicstoc ul { - list-style: none outside; - margin-left: 13px; margin-bottom: -2px; - padding: 0px; -} - - -#topicstoc ul ul{ - list-style: none outside; - margin-left: 10px; margin-bottom: -2px; - padding: 0px; -} - -#topicstoc li{ - font-weight: normal; font-size: 12px; - padding: 0px 5px 2px 10px; - list-style-type: none; background: url(../Images/bullet.gif) no-repeat 0px .5em; -} - -#topicstoc li.intro { - font-weight: normal; - padding: 0px 0px; - list-style-type: none; background: none; -} - -#topicstoc li a { - display: block; - padding: 0px 5px 0px 0px; -} - -#topicstoc li a.location { - font-weight: bold; color: #000; - text-decoration: none; -} - -#topicstoc li.intro a { - margin-left: -5px; - display: block; -} - - -img.toplevel { float: left; } - - - -/* frameset: content frame */ -BODY { - margin-top: 0; - color: #000; - font: 12px lucida grande, geneva, helvetica, arial, sans-serif; - } - -/* frameset: H1,H2,H3,H4,H5,Head for code voice */ - -h1 { - margin-top: 1em; - margin-bottom: 25px; - font: bold 30px lucida grande, geneva, helvetica, arial, sans-serif; - color: #000; - } -h2 { - margin-top: 2.5em; - font-size: 24px; - color: #000; - padding-bottom: 2px; border-bottom: 1px solid black; - } -h3 { - margin-top: 2em; - margin-bottom: .5em; - font-size: 19px; - color: #000; - } -h3.tight { - margin-top: 3em; - margin-bottom: -.25em; - font-size: 19px; - color: #000; - } -h4 { - margin-top: 2em; - margin-bottom: .5em; - font-size: 15px; - color: #000; - } -h5 { - margin: 20 0 0 0; - padding: 0; - font-size: 13px; - color: #000; - } -.mach4{ - margin-top: 40; - margin-bottom: 0; - padding-top: 0; - font: bold 16px lucida grande, geneva, helvetica, arial, sans-serif; - color: #000; - } -.mach5{ - margin: 30 0 -9 0; - font: bold 13px lucida grande, geneva, helvetica, arial, sans-serif; - color: #000; - } -h5.tight{ - margin: 1.5em 0 2px 0; - font: bold 13px lucida grande, geneva, helvetica, arial, sans-serif; - color: #000; - } - - -.code_head{ - FONT-SIZE: 18px; FONT-FAMILY: monaco, courier, monospace; font-weight: bold; -} -p { - margin-top: 0px; margin-bottom: 10px; font: 12px lucida grande, geneva, helvetica, arial, sans-serif; - } -p.spaceabove { - margin-top: 13px; margin-bottom: 10px; font: 12px lucida grande, geneva, helvetica, arial, sans-serif; - } -p.spaceabovemethod { - font: 11px monaco, courier, monospace; margin-top: 13px; margin-bottom: 10px; -} -h3.tight + p { - margin-top: 13px; margin-bottom: 10px; font: 12px lucida grande, geneva, helvetica, arial, sans-serif; - } -h3.tight + p.spaceabovemethod { - font: 11px monaco, courier, monospace; margin-top: 13px; margin-bottom: 10px; -} -.content_text{ - margin-top: 0px; margin-bottom: 10px; font: 12px lucida grande, geneva, helvetica, arial, sans-serif; -} -p.blockquote{ - padding-left: 50pt; - padding-right: 50pt; - } -ul.availability { - list-style-type: none; - margin: 0 0 -10px 0; - } -.availability li { - margin: 2px 0 0 -6px; - } - -/* frameset: content frame bold style for text*/ -b{ - font-family: lucida grande, geneva, helvetica, arial, sans-serif; font-size: 12px; font-weight: bold; -} - -/* Used for text that is sligtly larger than bold text like lables and captions*/ -.content_text_label{ - font-family: lucida grande, geneva, helvetica, arial, sans-serif; font-size: 12px; -} - -/* frameset: content frame italic style for text*/ -i{ - font-family: lucida grande, geneva, helvetica, arial, sans-serif; font-size: 12px; font-style: italic; -} - -/* Used for reference heads in ProcedualC and AppleScript Language*/ -.content_ref_head{ - font-family: lucida grande, geneva, helvetica, arial, sans-serif; - font-size: 16px; font-weight: bold; margin-top: 50px; padding-bottom: 4px; border-bottom: 1px solid black - } - -.content_ref_head_code{ - font-family: monaco, courier, monospace; - font-size: 16px; font-weight: bold; margin-top: 50px; padding-bottom: 4px; border-bottom: 1px solid black - } - -/* frameset: page title */ -.page_title{ - font-family: lucida grande, geneva, helvetica, arial, sans-serif; - font-size: 34px; - font-weight: bold; - color: #000000; - padding-top: 10px; - } - -/* frameset: Unordered List */ - -ul.spaceabove { - list-style: square outside; - margin: 0 0 0 30px; - padding: 7 0 12px 6px; - } - -ul { - list-style: square outside; - margin: 0 0 0 30px; - padding: 0 0 12px 6px; - } - -li { - margin-top: 7px; - } - - -li p { - margin-top: 8px; - } - -ul ul { - list-style: circle outside; - margin: 6 0 0 30px; - padding: 0 0 12px 6px; - } -ul.3head { - list-style: square outside; - margin: 0 0 0 20px; - padding: 0 0 0px 0px; - } - - -/* alternate mappings for 2nd level bulleted list that are still in testing phase*/ -.nested li { - list-style-image: url(../Images/openbullet.gif); - list-style-position: outside; - } - -ul.nested { - list-style: none; - margin: 6 0 0 30px; - } - -ol { - list-style-type: decimal; - list-style-position: outside; - margin: 0 0 0 30px; - padding: 0 0 12px 6px; - } - -ol ol { - list-style-type: lower-alpha; - list-style-position: outside; - margin: 7 0 0 30px; - padding: 0 0 12px 10px; - } - -ul.simple-spaceabove { - list-style-type: none; - margin: 5 0 0 20px; - } -.simple-spaceabove li { - margin-top: 1px; - } - -ul.simple { - list-style-type: none; - margin: 0 0 0 30px; - } -.simple li { - margin-top: -1px; - } - -dl.table-display { - clear: both; - width: auto; - margin: 0; - padding: 0px; - } - -.table-display dt { - width: 8em; - float: left; - margin: 0 0 0 0; - padding: .1em; - } - -/* commented backslash hack for mac-ie5 \*/ -dt { clear: both; } - - -.table-display dd { - float: left; - width: 80%; - margin: 0 0 0 0; - padding: .1em; - display: block; - } - -.clear { - clear: both; - } -dl.termdef { - margin-top: 0px; - margin-bottom: 10px; } -.termdef dt { - margin-top: 0px; } -.termdef dd { - margin-left: 15px; - margin-top: 1px; - margin-bottom: 6px; } -.termdef p{ - margin-left: 15px; - margin-top: -1px; - margin-bottom: 6px; } -h3.tight + dl.termdef { - margin-top: 13px; - margin-bottom: 10px; } - -/* frameset: list items */ -/* Everything in a list item is wrapped in an element now. */ -/* First para in a list item should be inline, others should be block. */ -li>p { display: inline } -li>p+p { display: block } - - -/* frameset: Index styles for docs */ -/* frameset: Index styles for alpah listing */ -.index_alpa{ - font-size: 18px; padding-bottom: 5px; margin: 25px 0 15px; border-bottom: 1px solid #91969C; } - -/* frameset: Index styles for singal and page range entries */ -.libindex{ -font-size: 12px; padding: 0 3px; background-color: #FFFFFF; margin: 0 3px; } - - - -/* frameset: mini navigation style (Hide/Show TOC & next/prev) */ -.mini_nav_text { - font-family: lucida grande, geneva, helvetica, arial, sans-serif; - font-size: 9px; - font-weight: normal; -} - -.breadcrumb { - font-family: lucida grande, geneva, helvetica, arial, sans-serif; - font-size: 10px; - font-weight: normal; - margin-left: 10px; - margin-top: 8px; -} - -/* ADC header/footer mappings for Getting Started */ -/* header */ -#adcnavheader td { - font: 10px lucida grande, geneva, helvetica, arial, sans-serif; - } - -#adcnavheader input { - margin: 0 3px 0 0; - padding: 0; - } - -#adcnavheader .textpadding { - padding-top: 2px; - vertical-align: middle; - } - -#adcnavheader .searchbutton { - border: 0; - } - -#adcnavheader h6 { - margin: 0; - padding: 0; - font: normal 12px lucida grande, geneva, helvetica, arial, sans-serif; - color: #000; -} - -#adcnavheader form { - margin: 0; -} - - -/* footer */ -#footer td, #footer p { - font-size: 10px; - } - - -/* Getting Started styles */ - -/* font definitions */ - -/* keep ".gettingstarted pre, code" above ".gettingstarted h1" below otherwise, -the main h1 tag above will be used instead of".gettingstarted h1" */ -.gettingstarted pre, code { - font: 11px Monaco, Courier, monospace; - } - -/* Added this style since the ADC template was trying to do this with a graphic (Note: their h2 -attached to the image tag is only used by search engines; their h2 does not function if the -graphic is missing).--DA */ -.gettingstarted h2 { - margin: 0; - margin-bottom: 15px; - padding: 0px; - font: bold 32px 'Lucida Grande', Geneva, Verdana, Arial, Helvetica, sans-serif; - color: #000; - } - -.gettingstarted h3 { - margin: 0 0 5px 0; - padding: 0px; - font: bold 16px 'Lucida Grande', Geneva, Verdana, Arial, Helvetica, sans-serif; - color: #000; - } - -.gettingstarted p + .gettingstarted h3 { - margin-top: 20px; - } - -.gettingstarted ol + .gettingstarted h3 { - margin-top: 20px; - } - -.gettingstarted ul + .gettingstarted h3 { - margin-top: 20px; - } - -.gettingstarted h4 { - margin: 0px; - padding: 0px; - font: bold 12px 'Lucida Grande', Geneva, Verdana, Arial, Helvetica, sans-serif; - color: #000; - } - -.gettingstarted h4 + .gettingstarted table { - margin-top: 10px; - } - -.gettingstarted p { - margin-top: 0; - margin-bottom: 10px; - padding: 0; - font: 12px 'Lucida Grande', Geneva, Verdana, Arial, Helvetica, sans-serif; - color: #000; - } - -.gettingstarted th { - font-weight: bold; - text-align: left; - } - - -/* list definitions */ -.gettingstarted ul { - font: 12px 'Lucida Grande', Geneva, Verdana, Arial, Helvetica, sans-serif; - padding-left: 10px; - margin-top: 0; - margin-left: 10px; - margin-bottom: 10px; - list-style-type: none; - } - -.gettingstarted li { - margin-top: 3px; - } - - -.gettingstarted ul li { - list-style: square outside; - margin: 0 0 0 30px; - padding: 0 0 4px 0; - } - -.gettingstarted ul ul { - margin-left: 20px; - } - -.gettingstarted ol { - font: 12px 'Lucida Grande', Geneva, Verdana, Arial, Helvetica, sans-serif; - margin-top: 0; - margin-left: 1.5em; - margin-bottom: 10px; - padding-left: 1.5em; - } - -.gettingstarted ul.inline, .gettingstarted ol.inline, .gettingstarted p.inline { - margin-top: -7px; - } - -/* table styles */ -caption.tablecaption { - margin-bottom: 5px; - text-align: left; -} -.sourcecodebox { - border: 1px solid #c7cfd5; - background: #f1f5f9; - margin: 20px 0; - } - -div.tableholder { - margin-top: 20px; - margin-bottom: 20px; - } - -p.tableholder { - margin-bottom: 7px; - font: 12px lucida grande, geneva, helvetica, arial, sans-serif; - } - -.graybox { - border-top: 1px solid #919699; - border-left: 1px solid #919699; - } - -.graybox th { - padding: 4px 8px 4px 8px; - background: #E2E2E2; - font-size: 12px; - border-bottom: 1px solid #919699; - border-right: 1px solid #919699; - } -.graybox th p { - font-weight: bold; - margin-bottom: 0px; - } - -.graybox td { - padding: 8px; - font-size: 12px; - text-align: left; - vertical-align: top; - border-bottom: 1px solid #919699; - border-right: 1px solid #919699; - } -.graybox td p { - margin-bottom: 0px; - } -.graybox td p + p { - margin-top: 5px; - } -.graybox td p + p + p { - margin-top: 5px; - } - - -/* footnote definitions */ -.footnote h4, .footnote p { - color: #76797C; - font-size: 11px; - } - -.gettingstarted .footnote { - font-size: 11px; - color: #76797C; - } - - -.notebox { - border: 1px solid #a1a5a9; - background-color: #f7f7f7; - margin: 20px 0; - padding: 0px 8px 1px 9px; - text-align: left; - } -.notebox p { - font: 12px lucida grande, geneva, helvetica, arial, sans-serif; - margin-top: 7px; - margin-bottom: 0px; - } -.importantbox { - border: 1px solid #111; - background-color: #e8e8e8; - margin: 20px 0; - padding: 0px 8px 1px 9px; - text-align: left; - } -.importantbox p { - font: 12px lucida grande, geneva, helvetica, arial, sans-serif; - margin-top: 7px; - margin-bottom: 0px; - } -.warningbox { - border: 1px solid #000; - background-color: #fff; - margin: 20px 0; - padding: 8px; - text-align: left; - } -.warningicon { - background-color: transparent; - padding-right: 10px; - float: left; - } -.warningbox p { - border-style: none; - font: 12px lucida grande, geneva, helvetica, arial, sans-serif; - margin: -8px 0 -8px 30px; - } -div.codesample { - margin: 20px 0; - } -.codesample pre { - font-size: 11px; - font-family: monaco, courier, monospace; - margin: -1px 4px -3px 6px; - white-space: pre; - } -.codesample span { - margin-right: 8px; - float: right; - } -p.codesample { - margin-top: 20px; margin-bottom: -15px; font: 12px lucida grande, geneva, helvetica, arial, sans-serif; - } - - -/* Controller Layer Bindings styles */ - -.class_binding_block { - } - -.binding_category_block { - margin-left: 1em - } - -.binding_category_name { - font-size: 24px; font-family: lucida grande, geneva, helvetica, arial, sans-serif; font-weight: bold; line-height: 35px; padding-bottom: 1px; border-top: 2px solid black - } - -.binding_block { - margin-left: 2em - } - -.binding_name { - font-size: 18px; font-family: monaco, courier, monospace; font-weight: 400; margin-top: 10px; margin-bottom: 12px; border-bottom: 1px solid #69f - } - -.bindings_tablehead { font-size: 14px; font-family: lucida grande, geneva, helvetica, arial, sans-serif; font-weight: bold; position: relative; top: -5px; margin-left: -20px - } - -.placeholder_options_block { - margin-left: 2em - } - -.availabilityList { - border: none; - margin-top: 5px; - margin-bottom: 0px; - font-size: 12px; - text-align: left; - } - -.availabilityItem { - margin-top: -15px; - margin-bottom: 15px; - padding-left: 78px; - } - - -.metadata_attributes_name { - font-size: 24px; font-family: lucida grande, geneva, helvetica, arial, sans-serif; font-weight: bold; padding-top: 5px; margin-bottom: -10px; border-top: 2px solid black - } - -.metadata_attribute_name { - font-size: 18px; font-family: monaco, courier, monospace; font-weight: 400; margin-top: 10px; padding-bottom: 2px; - } - - -/* Spec Sheet Info Box */ -/* Used in AppKit Obj-C, Appkit Java, Foundation Obj-C, and Foundation Java References */ - -.spec_sheet_info_box { margin-left: 1em } - -/* This builds a table */ -.specbox { - border-top: 1px solid #919699; - border-left: 1px solid #919699; - border-right: 1px solid #919699; - margin-bottom: 10px; - } - -.specbox td { - padding: 8px; - font-size: 12px; - text-align: left; - vertical-align: top; - border-bottom: 1px solid #919699; - } - -/* This alternates colors in up to six table rows (light blue for odd, white for even)*/ - -.specbox tr { - background: #F0F5F9; -} - -.specbox tr + tr { - background: #FFFFFF; -} - -.specbox tr + tr + tr { - background: #F0F5F9; -} - -.specbox tr + tr + tr + tr { - background: #FFFFFF; -} - -.specbox tr + tr + tr +tr + tr { - background: #F0F5F9; -} - -.specbox tr + tr + tr + tr + tr + tr { - background: #FFFFFF; -} - -/* informal protocol subtitling */ - -.protocol_subtitle { - margin-top: -25px; - margin-bottom: 25px; - font-size: 13px; -} - -/* HeaderDoc headings */ - -.hd_tocAccess { - margin-left: 16px; - margin-top: 3px; - display: block; - font-weight: bold; -} -.hd_tocAccessSpace { - display: block; - font-size: 8px; -} - -.hd_tocGroup { - margin-left: 8px; - margin-top: 5px; - display: block; - font-style: italic; -} -.hd_tocGroupSpace { - display: block; - font-size: 8px; -} - -/* "Collection page" mappings */ - -.forums { margin-bottom: 5px;} -.forums b, -.forums a:link, -.forums a:visited { color: #017; font-family: lucida grande, geneva, helvetica, arial, sans-serif; font-size: 11px; font-weight: bold; line-height: 13px;} -.forums a:hover { color: #00F; text-decoration: underline; font-weight: bold;} -.collection { margin-bottom: 5px;} -.collection h3, -.collection a:link, -.collection a:visited { font-size: 13px; color: #76797C; padding-bottom: 2px; border-bottom: 1px dotted #a1a5a9; margin-bottom: 0px; margin-right: 3px;} -.collection a:hover { color: #00F; text-decoration: underline; font-weight: bold;} - -.collection_title { width: 100%; - background-color: #7E91A4; - padding: 15px; - padding-right: 15px; - padding-bottom: 2px; - padding-left: 15px; - } - -.collection_title a:link, -.collection_title a:visited { color: #E8F3FD; } - -h1.collections { - margin-top: 0px; - margin-bottom: 25px; - font: bold 30px lucida grande, geneva, helvetica, arial, sans-serif; - color: #ffffff; - text-align: center; } - - \ No newline at end of file diff --git a/src/MacVim/PSMTabBarControl/images/32x32_log.tiff b/src/MacVim/PSMTabBarControl/images/32x32_log.tiff deleted file mode 100644 index 86cdfb5111..0000000000 Binary files a/src/MacVim/PSMTabBarControl/images/32x32_log.tiff and /dev/null differ diff --git a/src/MacVim/PSMTabBarControl/images/32x32cancel.png b/src/MacVim/PSMTabBarControl/images/32x32cancel.png deleted file mode 100644 index 9646722bbf..0000000000 Binary files a/src/MacVim/PSMTabBarControl/images/32x32cancel.png and /dev/null differ diff --git a/src/MacVim/PSMTabBarControl/images/AquaTabClose_Front.tif b/src/MacVim/PSMTabBarControl/images/AquaTabClose_Front.tif deleted file mode 100644 index a221ac7467..0000000000 Binary files a/src/MacVim/PSMTabBarControl/images/AquaTabClose_Front.tif and /dev/null differ diff --git a/src/MacVim/PSMTabBarControl/images/AquaTabClose_Front_Pressed.tif b/src/MacVim/PSMTabBarControl/images/AquaTabClose_Front_Pressed.tif deleted file mode 100644 index 104799dd60..0000000000 Binary files a/src/MacVim/PSMTabBarControl/images/AquaTabClose_Front_Pressed.tif and /dev/null differ diff --git a/src/MacVim/PSMTabBarControl/images/AquaTabClose_Front_Rollover.tif b/src/MacVim/PSMTabBarControl/images/AquaTabClose_Front_Rollover.tif deleted file mode 100644 index cd86fa5c21..0000000000 Binary files a/src/MacVim/PSMTabBarControl/images/AquaTabClose_Front_Rollover.tif and /dev/null differ diff --git a/src/MacVim/PSMTabBarControl/images/AquaTabNew.png b/src/MacVim/PSMTabBarControl/images/AquaTabNew.png deleted file mode 100644 index 843b3c386d..0000000000 Binary files a/src/MacVim/PSMTabBarControl/images/AquaTabNew.png and /dev/null differ diff --git a/src/MacVim/PSMTabBarControl/images/AquaTabNewPressed.png b/src/MacVim/PSMTabBarControl/images/AquaTabNewPressed.png deleted file mode 100644 index 469438d234..0000000000 Binary files a/src/MacVim/PSMTabBarControl/images/AquaTabNewPressed.png and /dev/null differ diff --git a/src/MacVim/PSMTabBarControl/images/AquaTabNewRollover.png b/src/MacVim/PSMTabBarControl/images/AquaTabNewRollover.png deleted file mode 100644 index f728511795..0000000000 Binary files a/src/MacVim/PSMTabBarControl/images/AquaTabNewRollover.png and /dev/null differ diff --git a/src/MacVim/PSMTabBarControl/images/AquaTabsBackground.png b/src/MacVim/PSMTabBarControl/images/AquaTabsBackground.png deleted file mode 100644 index 456ca6172d..0000000000 Binary files a/src/MacVim/PSMTabBarControl/images/AquaTabsBackground.png and /dev/null differ diff --git a/src/MacVim/PSMTabBarControl/images/AquaTabsDown.png b/src/MacVim/PSMTabBarControl/images/AquaTabsDown.png deleted file mode 100644 index 2db28ae1f4..0000000000 Binary files a/src/MacVim/PSMTabBarControl/images/AquaTabsDown.png and /dev/null differ diff --git a/src/MacVim/PSMTabBarControl/images/AquaTabsDownGraphite.png b/src/MacVim/PSMTabBarControl/images/AquaTabsDownGraphite.png deleted file mode 100644 index 787520e9fd..0000000000 Binary files a/src/MacVim/PSMTabBarControl/images/AquaTabsDownGraphite.png and /dev/null differ diff --git a/src/MacVim/PSMTabBarControl/images/AquaTabsDownNonKey.png b/src/MacVim/PSMTabBarControl/images/AquaTabsDownNonKey.png deleted file mode 100644 index 34a57ff639..0000000000 Binary files a/src/MacVim/PSMTabBarControl/images/AquaTabsDownNonKey.png and /dev/null differ diff --git a/src/MacVim/PSMTabBarControl/images/AquaTabsSeparator.png b/src/MacVim/PSMTabBarControl/images/AquaTabsSeparator.png deleted file mode 100644 index f7cc1d0f99..0000000000 Binary files a/src/MacVim/PSMTabBarControl/images/AquaTabsSeparator.png and /dev/null differ diff --git a/src/MacVim/PSMTabBarControl/images/AquaTabsSeparatorDown.png b/src/MacVim/PSMTabBarControl/images/AquaTabsSeparatorDown.png deleted file mode 100644 index 79dbf2a199..0000000000 Binary files a/src/MacVim/PSMTabBarControl/images/AquaTabsSeparatorDown.png and /dev/null differ diff --git a/src/MacVim/PSMTabBarControl/images/Folder.tif b/src/MacVim/PSMTabBarControl/images/Folder.tif deleted file mode 100644 index 4d4cc0bbce..0000000000 Binary files a/src/MacVim/PSMTabBarControl/images/Folder.tif and /dev/null differ diff --git a/src/MacVim/PSMTabBarControl/images/Globe.tiff b/src/MacVim/PSMTabBarControl/images/Globe.tiff deleted file mode 100644 index 3c893505eb..0000000000 Binary files a/src/MacVim/PSMTabBarControl/images/Globe.tiff and /dev/null differ diff --git a/src/MacVim/PSMTabBarControl/images/TabClose_Font_Pressed.psd b/src/MacVim/PSMTabBarControl/images/TabClose_Font_Pressed.psd new file mode 100644 index 0000000000..774f6b3d36 Binary files /dev/null and b/src/MacVim/PSMTabBarControl/images/TabClose_Font_Pressed.psd differ diff --git a/src/MacVim/PSMTabBarControl/images/TabClose_Font_Pressed@2x.psd b/src/MacVim/PSMTabBarControl/images/TabClose_Font_Pressed@2x.psd new file mode 100644 index 0000000000..a0114648c5 Binary files /dev/null and b/src/MacVim/PSMTabBarControl/images/TabClose_Font_Pressed@2x.psd differ diff --git a/src/MacVim/PSMTabBarControl/images/TabClose_Front.png b/src/MacVim/PSMTabBarControl/images/TabClose_Front.png index 5277930420..69635041c4 100644 Binary files a/src/MacVim/PSMTabBarControl/images/TabClose_Front.png and b/src/MacVim/PSMTabBarControl/images/TabClose_Front.png differ diff --git a/src/MacVim/PSMTabBarControl/images/TabClose_Front@2x.png b/src/MacVim/PSMTabBarControl/images/TabClose_Front@2x.png index 3dd8be0353..fe42629554 100644 Binary files a/src/MacVim/PSMTabBarControl/images/TabClose_Front@2x.png and b/src/MacVim/PSMTabBarControl/images/TabClose_Front@2x.png differ diff --git a/src/MacVim/PSMTabBarControl/images/TabClose_Front_Pressed.png b/src/MacVim/PSMTabBarControl/images/TabClose_Front_Pressed.png index 3c2328b9a1..068c5d7c3f 100644 Binary files a/src/MacVim/PSMTabBarControl/images/TabClose_Front_Pressed.png and b/src/MacVim/PSMTabBarControl/images/TabClose_Front_Pressed.png differ diff --git a/src/MacVim/PSMTabBarControl/images/TabClose_Front_Pressed@2x.png b/src/MacVim/PSMTabBarControl/images/TabClose_Front_Pressed@2x.png index e4d539f719..6c3f8ad0e7 100644 Binary files a/src/MacVim/PSMTabBarControl/images/TabClose_Front_Pressed@2x.png and b/src/MacVim/PSMTabBarControl/images/TabClose_Front_Pressed@2x.png differ diff --git a/src/MacVim/PSMTabBarControl/images/TabClose_Front_Rollover.png b/src/MacVim/PSMTabBarControl/images/TabClose_Front_Rollover.png index ca59735574..69635041c4 100644 Binary files a/src/MacVim/PSMTabBarControl/images/TabClose_Front_Rollover.png and b/src/MacVim/PSMTabBarControl/images/TabClose_Front_Rollover.png differ diff --git a/src/MacVim/PSMTabBarControl/images/TabClose_Front_Rollover@2x.png b/src/MacVim/PSMTabBarControl/images/TabClose_Front_Rollover@2x.png index 342855eaa6..fe42629554 100644 Binary files a/src/MacVim/PSMTabBarControl/images/TabClose_Front_Rollover@2x.png and b/src/MacVim/PSMTabBarControl/images/TabClose_Front_Rollover@2x.png differ diff --git a/src/MacVim/PSMTabBarControl/images/TabControlRep.tif b/src/MacVim/PSMTabBarControl/images/TabControlRep.tif deleted file mode 100644 index 6ad0f4042a..0000000000 Binary files a/src/MacVim/PSMTabBarControl/images/TabControlRep.tif and /dev/null differ diff --git a/src/MacVim/PSMTabBarControl/images/TabIcon.tif b/src/MacVim/PSMTabBarControl/images/TabIcon.tif deleted file mode 100644 index 55e08f117e..0000000000 Binary files a/src/MacVim/PSMTabBarControl/images/TabIcon.tif and /dev/null differ diff --git a/src/MacVim/PSMTabBarControl/images/TabNewMetal@2x.png b/src/MacVim/PSMTabBarControl/images/TabNewMetal@2x.png deleted file mode 100644 index aab821b3cc..0000000000 Binary files a/src/MacVim/PSMTabBarControl/images/TabNewMetal@2x.png and /dev/null differ diff --git a/src/MacVim/PSMTabBarControl/images/TabNewMetalPressed@2x.png b/src/MacVim/PSMTabBarControl/images/TabNewMetalPressed@2x.png deleted file mode 100644 index f652e91723..0000000000 Binary files a/src/MacVim/PSMTabBarControl/images/TabNewMetalPressed@2x.png and /dev/null differ diff --git a/src/MacVim/PSMTabBarControl/images/TabNewMetalRollover@2x.png b/src/MacVim/PSMTabBarControl/images/TabNewMetalRollover@2x.png deleted file mode 100644 index 1afa4ad7be..0000000000 Binary files a/src/MacVim/PSMTabBarControl/images/TabNewMetalRollover@2x.png and /dev/null differ diff --git a/src/MacVim/PSMTabBarControl/images/TabNewYosemite.png b/src/MacVim/PSMTabBarControl/images/TabNewYosemite.png deleted file mode 100644 index a85cf21369..0000000000 Binary files a/src/MacVim/PSMTabBarControl/images/TabNewYosemite.png and /dev/null differ diff --git a/src/MacVim/PSMTabBarControl/images/TabNewYosemite@2x.png b/src/MacVim/PSMTabBarControl/images/TabNewYosemite@2x.png deleted file mode 100644 index 9f2b024011..0000000000 Binary files a/src/MacVim/PSMTabBarControl/images/TabNewYosemite@2x.png and /dev/null differ diff --git a/src/MacVim/PSMTabBarControl/images/overflowImage.png b/src/MacVim/PSMTabBarControl/images/overflowImage.png index 6078cca731..bd94173c60 100644 Binary files a/src/MacVim/PSMTabBarControl/images/overflowImage.png and b/src/MacVim/PSMTabBarControl/images/overflowImage.png differ diff --git a/src/MacVim/PSMTabBarControl/images/overflowImage@2x.png b/src/MacVim/PSMTabBarControl/images/overflowImage@2x.png index c92c1740c8..b4db31588b 100644 Binary files a/src/MacVim/PSMTabBarControl/images/overflowImage@2x.png and b/src/MacVim/PSMTabBarControl/images/overflowImage@2x.png differ diff --git a/src/MacVim/PSMTabBarControl/images/overflowImagePressed.png b/src/MacVim/PSMTabBarControl/images/overflowImagePressed.png index 56bcd8b7e1..003479cea6 100644 Binary files a/src/MacVim/PSMTabBarControl/images/overflowImagePressed.png and b/src/MacVim/PSMTabBarControl/images/overflowImagePressed.png differ diff --git a/src/MacVim/PSMTabBarControl/images/overflowImagePressed@2x.png b/src/MacVim/PSMTabBarControl/images/overflowImagePressed@2x.png index 341b1d77cc..ddce231b76 100644 Binary files a/src/MacVim/PSMTabBarControl/images/overflowImagePressed@2x.png and b/src/MacVim/PSMTabBarControl/images/overflowImagePressed@2x.png differ diff --git a/src/MacVim/PSMTabBarControl/images/pi.png b/src/MacVim/PSMTabBarControl/images/pi.png deleted file mode 100644 index e3ff079452..0000000000 Binary files a/src/MacVim/PSMTabBarControl/images/pi.png and /dev/null differ diff --git a/src/MacVim/PSMTabBarControl/palette.table b/src/MacVim/PSMTabBarControl/palette.table deleted file mode 100644 index e3053e3d08..0000000000 --- a/src/MacVim/PSMTabBarControl/palette.table +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - Class PSMTabBarControlPalette - - - NibFile PSMTabBarControlPalette - - - Icon TabIcon.tif - - - ToolTips PSMTabBarControl - - - ExportClasses - - PSMTabBarControl - PSMTabBarCell - PSMAquaTabStyle - PSMMetalTabStyle - PSMRolloverButton - PSMProgressIndcator - PSMOverflowPopUpButton - - - - ExportImages - - TabControlRep.tif - TabIcon.tif - - - - ExportSounds - - - - - diff --git a/src/MacVim/PSMTabBarControl/source/AppController.h b/src/MacVim/PSMTabBarControl/source/AppController.h deleted file mode 100644 index 532e91da64..0000000000 --- a/src/MacVim/PSMTabBarControl/source/AppController.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// AppController.h -// PSMTabBarControl -// -// Created by John Pannell on 12/19/05. -// Copyright 2005 Positive Spin Media. All rights reserved. -// - -#import - -@interface AppController : NSObject { - -} - -- (IBAction)newWindow:(id)sender; - -@end diff --git a/src/MacVim/PSMTabBarControl/source/AppController.m b/src/MacVim/PSMTabBarControl/source/AppController.m deleted file mode 100644 index 16dfd30c44..0000000000 --- a/src/MacVim/PSMTabBarControl/source/AppController.m +++ /dev/null @@ -1,30 +0,0 @@ -// -// AppController.m -// TabBarControl -// -// Created by John Pannell on 12/19/05. -// Copyright 2005 Positive Spin Media. All rights reserved. -// - -#import "AppController.h" -#import "WindowController.h" - -@implementation AppController - -- (void)awakeFromNib -{ - [self newWindow:self]; - [self newWindow:self]; - NSRect frontFrame = [[NSApp keyWindow] frame]; - frontFrame.origin.x += 400; - [[NSApp keyWindow] setFrame:frontFrame display:YES]; -} - -- (IBAction)newWindow:(id)sender -{ - // put up a window - WindowController *newWindow = [[WindowController alloc] initWithWindowNibName:@"Window"]; - [newWindow showWindow:self]; -} - -@end diff --git a/src/MacVim/PSMTabBarControl/source/FakeModel.h b/src/MacVim/PSMTabBarControl/source/FakeModel.h deleted file mode 100644 index aeece3f530..0000000000 --- a/src/MacVim/PSMTabBarControl/source/FakeModel.h +++ /dev/null @@ -1,34 +0,0 @@ -// -// FakeModel.h -// TabBarControl -// -// Created by John Pannell on 12/19/05. -// Copyright 2005 Positive Spin Media. All rights reserved. -// - -#import - - -@interface FakeModel : NSObject { - BOOL _isProcessing; - NSImage *_icon; - NSString *_iconName; - NSObjectController *controller; - int _objectCount; -} - -// creation/destruction -- (id)init; - -// accessors -- (BOOL)isProcessing; -- (void)setIsProcessing:(BOOL)value; -- (NSImage *)icon; -- (void)setIcon:(NSImage *)icon; -- (NSString *)iconName; -- (void)setIconName:(NSString *)iconName; -- (int)objectCount; -- (void)setObjectCount:(int)value; -- (NSObjectController *)controller; - -@end diff --git a/src/MacVim/PSMTabBarControl/source/FakeModel.m b/src/MacVim/PSMTabBarControl/source/FakeModel.m deleted file mode 100644 index dee72ec085..0000000000 --- a/src/MacVim/PSMTabBarControl/source/FakeModel.m +++ /dev/null @@ -1,77 +0,0 @@ -// -// FakeModel.m -// TabBarControl -// -// Created by John Pannell on 12/19/05. -// Copyright 2005 Positive Spin Media. All rights reserved. -// - -#import "FakeModel.h" - - -@implementation FakeModel - -- (id)init -{ - if(self == [super init]){ - _isProcessing = YES; - _icon = nil; - _iconName = nil; - _objectCount = 2; - controller = [[NSObjectController alloc] initWithContent:self]; - } - return self; -} - - -// accessors -- (BOOL)isProcessing -{ - return _isProcessing; -} - -- (void)setIsProcessing:(BOOL)value -{ - _isProcessing = value; -} - -- (NSImage *)icon -{ - return _icon; -} - -- (void)setIcon:(NSImage *)icon -{ - [icon retain]; - [_icon release]; - _icon = icon; -} - -- (NSString *)iconName -{ - return _iconName; -} - -- (void)setIconName:(NSString *)iconName -{ - [iconName retain]; - [_iconName release]; - _iconName = iconName; -} - -- (int)objectCount -{ - return _objectCount; -} - -- (void)setObjectCount:(int)value -{ - _objectCount = value; -} - -- (NSObjectController *)controller -{ - return controller; -} - -@end diff --git a/src/MacVim/PSMTabBarControl/source/NSBezierPath_AMShading.h b/src/MacVim/PSMTabBarControl/source/NSBezierPath_AMShading.h deleted file mode 100644 index 9c6c335fbe..0000000000 --- a/src/MacVim/PSMTabBarControl/source/NSBezierPath_AMShading.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// NSBezierPath_AMShading.h -// ------------------------ -// -// Created by Andreas on 2005-06-01. -// Copyright 2005 Andreas Mayer. All rights reserved. -// -// based on http://www.cocoadev.com/index.pl?GradientFill - - -#import - - -@interface NSBezierPath (AMShading) - -- (void)customHorizontalFillWithCallbacks:(CGFunctionCallbacks)functionCallbacks firstColor:(NSColor *)firstColor secondColor:(NSColor *)secondColor; - -- (void)linearGradientFillWithStartColor:(NSColor *)startColor endColor:(NSColor *)endColor; - -- (void)bilinearGradientFillWithOuterColor:(NSColor *)outerColor innerColor:(NSColor *)innerColor; - - -@end diff --git a/src/MacVim/PSMTabBarControl/source/NSBezierPath_AMShading.m b/src/MacVim/PSMTabBarControl/source/NSBezierPath_AMShading.m deleted file mode 100644 index ed80e76beb..0000000000 --- a/src/MacVim/PSMTabBarControl/source/NSBezierPath_AMShading.m +++ /dev/null @@ -1,178 +0,0 @@ -// -// NSBezierPath_AMShading.m -// ------------------------ -// -// Created by Andreas on 2005-06-01. -// Copyright 2005 Andreas Mayer. All rights reserved. -// - -#import "NSBezierPath_AMShading.h" - -// CGFloat was introduced in OS X 10.5 -#ifndef CGFLOAT_DEFINED - typedef float CGFloat; -# define CGFLOAT_MIN FLT_MIN -# define CGFLOAT_MAX FLT_MAX -# define CGFLOAT_IS_DOUBLE 0 -# define CGFLOAT_DEFINED 1 -#endif - - -@implementation NSBezierPath (AMShading) - -static void linearShadedColor(void *info, const CGFloat *in, CGFloat *out) -{ - CGFloat *colors = info; - *out++ = colors[0] + *in * colors[8]; - *out++ = colors[1] + *in * colors[9]; - *out++ = colors[2] + *in * colors[10]; - *out++ = colors[3] + *in * colors[11]; -} - -static void bilinearShadedColor(void *info, const CGFloat *in, CGFloat *out) -{ - CGFloat *colors = info; - CGFloat factor = (*in)*2.0; - if (*in > 0.5) { - factor = 2-factor; - } - *out++ = colors[0] + factor * colors[8]; - *out++ = colors[1] + factor * colors[9]; - *out++ = colors[2] + factor * colors[10]; - *out++ = colors[3] + factor * colors[11]; -} - -- (void)linearGradientFillWithStartColor:(NSColor *)startColor endColor:(NSColor *)endColor -{ - /* - CGColorSpaceRef colorspace; - CGShadingRef shading; - CGPoint startPoint = {0, 0}; - CGPoint endPoint = {0, 0}; - CGFunctionRef function; - CGFloat colors[12]; // pointer to color values - - // get my context - CGContextRef currentContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; - - NSColor *deviceDependentStartColor = [startColor colorUsingColorSpaceName:NSDeviceRGBColorSpace]; - NSColor *deviceDependentEndColor = [endColor colorUsingColorSpaceName:NSDeviceRGBColorSpace]; - - // set up colors for gradient - colors[0] = [deviceDependentStartColor redComponent]; - colors[1] = [deviceDependentStartColor greenComponent]; - colors[2] = [deviceDependentStartColor blueComponent]; - colors[3] = [deviceDependentStartColor alphaComponent]; - - colors[4] = [deviceDependentEndColor redComponent]; - colors[5] = [deviceDependentEndColor greenComponent]; - colors[6] = [deviceDependentEndColor blueComponent]; - colors[7] = [deviceDependentEndColor alphaComponent]; - - // difference between start and end color for each color components - colors[8] = (colors[4]-colors[0]); - colors[9] = (colors[5]-colors[1]); - colors[10] = (colors[6]-colors[2]); - colors[11] = (colors[7]-colors[3]); - - // draw gradient - colorspace = CGColorSpaceCreateDeviceRGB(); - - size_t components = 1 + CGColorSpaceGetNumberOfComponents(colorspace); - static const CGFloat domain[2] = {0.0, 1.0}; - static const CGFloat range[10] = {0, 1, 0, 1, 0, 1, 0, 1, 0, 1}; - static const CGFunctionCallbacks callbacks = {0, &shadedColor, NULL}; - - // Create a CGFunctionRef that describes a function taking 1 input and kChannelsPerColor outputs. - function = CGFunctionCreate(colors, 1, domain, components, range, &callbacks); - - startPoint.x=0; - startPoint.y=[self bounds].origin.y; - endPoint.x=0; - endPoint.y=NSMaxY([self bounds]); - - shading = CGShadingCreateAxial(colorspace, startPoint, endPoint, function, NO, NO); - - CGContextSaveGState(currentContext); - [self addClip]; - CGContextDrawShading(currentContext, shading); - CGContextRestoreGState(currentContext); - - CGShadingRelease(shading); - CGFunctionRelease(function); - CGColorSpaceRelease(colorspace); - */ - - static const CGFunctionCallbacks callbacks = {0, &linearShadedColor, NULL}; - - [self customHorizontalFillWithCallbacks:callbacks firstColor:startColor secondColor:endColor]; -}; - -- (void)bilinearGradientFillWithOuterColor:(NSColor *)outerColor innerColor:(NSColor *)innerColor -{ - static const CGFunctionCallbacks callbacks = {0, &bilinearShadedColor, NULL}; - - [self customHorizontalFillWithCallbacks:callbacks firstColor:innerColor secondColor:outerColor]; -} - -- (void)customHorizontalFillWithCallbacks:(CGFunctionCallbacks)functionCallbacks firstColor:(NSColor *)firstColor secondColor:(NSColor *)secondColor -{ - CGColorSpaceRef colorspace; - CGShadingRef shading; - CGPoint startPoint = {0, 0}; - CGPoint endPoint = {0, 0}; - CGFunctionRef function; - CGFloat colors[12]; // pointer to color values - - // get my context - CGContextRef currentContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; - - NSColor *deviceDependentFirstColor = [firstColor colorUsingColorSpaceName:NSDeviceRGBColorSpace]; - NSColor *deviceDependentSecondColor = [secondColor colorUsingColorSpaceName:NSDeviceRGBColorSpace]; - - // set up colors for gradient - colors[0] = [deviceDependentFirstColor redComponent]; - colors[1] = [deviceDependentFirstColor greenComponent]; - colors[2] = [deviceDependentFirstColor blueComponent]; - colors[3] = [deviceDependentFirstColor alphaComponent]; - - colors[4] = [deviceDependentSecondColor redComponent]; - colors[5] = [deviceDependentSecondColor greenComponent]; - colors[6] = [deviceDependentSecondColor blueComponent]; - colors[7] = [deviceDependentSecondColor alphaComponent]; - - // difference between start and end color for each color components - colors[8] = (colors[4]-colors[0]); - colors[9] = (colors[5]-colors[1]); - colors[10] = (colors[6]-colors[2]); - colors[11] = (colors[7]-colors[3]); - - // draw gradient - colorspace = CGColorSpaceCreateDeviceRGB(); - size_t components = 1 + CGColorSpaceGetNumberOfComponents(colorspace); - static const CGFloat domain[2] = {0.0, 1.0}; - static const CGFloat range[10] = {0, 1, 0, 1, 0, 1, 0, 1, 0, 1}; - //static const CGFunctionCallbacks callbacks = {0, &bilinearShadedColor, NULL}; - - // Create a CGFunctionRef that describes a function taking 1 input and kChannelsPerColor outputs. - function = CGFunctionCreate(colors, 1, domain, components, range, &functionCallbacks); - - startPoint.x=0; - startPoint.y=[self bounds].origin.y; - endPoint.x=0; - endPoint.y=NSMaxY([self bounds]); - - shading = CGShadingCreateAxial(colorspace, startPoint, endPoint, function, NO, NO); - - CGContextSaveGState(currentContext); - [self addClip]; - CGContextDrawShading(currentContext, shading); - CGContextRestoreGState(currentContext); - - CGShadingRelease(shading); - CGFunctionRelease(function); - CGColorSpaceRelease(colorspace); -} - - -@end diff --git a/src/MacVim/PSMTabBarControl/source/NSWindow+PSM.h b/src/MacVim/PSMTabBarControl/source/NSWindow+PSM.h new file mode 100644 index 0000000000..723884f11c --- /dev/null +++ b/src/MacVim/PSMTabBarControl/source/NSWindow+PSM.h @@ -0,0 +1,6 @@ +#import + +@interface NSWindow (PSM) +- (NSPoint)pointFromScreenCoords:(NSPoint)point; +- (NSPoint)pointToScreenCoords:(NSPoint)point; +@end diff --git a/src/MacVim/PSMTabBarControl/source/NSWindow+PSM.m b/src/MacVim/PSMTabBarControl/source/NSWindow+PSM.m new file mode 100644 index 0000000000..fd59b59159 --- /dev/null +++ b/src/MacVim/PSMTabBarControl/source/NSWindow+PSM.m @@ -0,0 +1,16 @@ +#import "NSWindow+PSM.h" + +@implementation NSWindow (PSM) + +- (NSPoint)pointFromScreenCoords:(NSPoint)point { + NSRect rectInWindowCoords = [self convertRectFromScreen:NSMakeRect(point.x, point.y, 0, 0)]; + return rectInWindowCoords.origin; +} + +- (NSPoint)pointToScreenCoords:(NSPoint)point { + NSRect rectInWindowCoords = NSMakeRect(point.x, point.y, 0, 0); + return [self convertRectToScreen:rectInWindowCoords].origin; +} + +@end + diff --git a/src/MacVim/PSMTabBarControl/source/PSMDarkHighContrastTabStyle.h b/src/MacVim/PSMTabBarControl/source/PSMDarkHighContrastTabStyle.h new file mode 100644 index 0000000000..d52f592c24 --- /dev/null +++ b/src/MacVim/PSMTabBarControl/source/PSMDarkHighContrastTabStyle.h @@ -0,0 +1,15 @@ +// +// PSMDarkHighContrastTabStyle.h +// iTerm2 +// +// Created by George Nachman on 3/25/16. +// +// + +#import +#import "PSMTabStyle.h" +#import "PSMDarkTabStyle.h" + +@interface PSMDarkHighContrastTabStyle : PSMDarkTabStyle + +@end diff --git a/src/MacVim/PSMTabBarControl/source/PSMDarkHighContrastTabStyle.m b/src/MacVim/PSMTabBarControl/source/PSMDarkHighContrastTabStyle.m new file mode 100644 index 0000000000..270471f85c --- /dev/null +++ b/src/MacVim/PSMTabBarControl/source/PSMDarkHighContrastTabStyle.m @@ -0,0 +1,38 @@ +// +// PSMDarkHighContrastTabStyle.m +// iTerm2 +// +// Created by George Nachman on 3/25/16. +// +// + +#import "PSMDarkHighContrastTabStyle.h" + +@implementation PSMDarkHighContrastTabStyle + + +- (NSString *)name { + return @"Dark High Contrast"; +} + +- (NSColor *)textColorDefaultSelected:(BOOL)selected { + return [NSColor whiteColor]; +} + +- (NSColor *)accessoryTextColor { + return [NSColor whiteColor]; +} + +- (NSColor *)backgroundColorSelected:(BOOL)selected highlightAmount:(CGFloat)highlightAmount { + CGFloat value = selected ? 0.20 : 0.03; + if (!selected) { + value += highlightAmount * 0.05; + } + return [NSColor colorWithCalibratedWhite:value alpha:1.00]; +} + +- (CGFloat)fontSize { + return 12.0; +} + +@end diff --git a/src/MacVim/PSMTabBarControl/source/PSMDarkTabStyle.h b/src/MacVim/PSMTabBarControl/source/PSMDarkTabStyle.h new file mode 100644 index 0000000000..cb912bbf58 --- /dev/null +++ b/src/MacVim/PSMTabBarControl/source/PSMDarkTabStyle.h @@ -0,0 +1,14 @@ +// +// PSMDarkTabStyle.h +// iTerm +// +// Created by Brian Mock on 10/28/14. +// +// + +#import +#import "PSMTabStyle.h" +#import "PSMYosemiteTabStyle.h" + +@interface PSMDarkTabStyle : PSMYosemiteTabStyle +@end diff --git a/src/MacVim/PSMTabBarControl/source/PSMDarkTabStyle.m b/src/MacVim/PSMTabBarControl/source/PSMDarkTabStyle.m new file mode 100644 index 0000000000..115aeda8e3 --- /dev/null +++ b/src/MacVim/PSMTabBarControl/source/PSMDarkTabStyle.m @@ -0,0 +1,64 @@ +// +// PSMDarkTabStyle.m +// iTerm +// +// Created by Brian Mock on 10/28/14. +// +// + +#import "PSMDarkTabStyle.h" +#import "PSMTabBarCell.h" +#import "PSMTabBarControl.h" + +@implementation PSMDarkTabStyle + +- (NSString *)name { + return @"Dark"; +} + +- (NSColor *)tabBarColor { + return [NSColor colorWithCalibratedWhite:0.12 alpha:1.00]; +} + +- (NSColor *)textColorDefaultSelected:(BOOL)selected { + const CGFloat lightness = selected ? 0.80 : 0.60; + return [NSColor colorWithCalibratedWhite:lightness alpha:1.00]; +} + +- (NSColor *)topLineColorSelected:(BOOL)selected { + return [NSColor colorWithCalibratedWhite:0.10 alpha:1.00]; +} + +- (NSColor *)bottomLineColorSelected:(BOOL)selected { + return [NSColor colorWithCalibratedWhite:0.00 alpha:1.00]; +} + +- (NSColor *)verticalLineColor { + return [NSColor colorWithCalibratedWhite:0.08 alpha:1.00]; +} + +- (NSColor *)backgroundColorSelected:(BOOL)selected highlightAmount:(CGFloat)highlightAmount { + CGFloat value = selected ? 0.25 : 0.13; + if (!selected) { + value += highlightAmount * 0.05; + } + return [NSColor colorWithCalibratedWhite:value alpha:1.00]; +} + +- (BOOL)useLightControls { + return YES; +} + +- (NSColor *)accessoryFillColor { + return [NSColor colorWithCalibratedWhite:0.27 alpha:1.00]; +} + +- (NSColor *)accessoryStrokeColor { + return [NSColor colorWithCalibratedWhite:0.12 alpha:1.00]; +} + +- (NSColor *)accessoryTextColor { + return [self textColorDefaultSelected:YES]; +} + +@end diff --git a/src/MacVim/PSMTabBarControl/source/PSMLightHighContrastTabStyle.h b/src/MacVim/PSMTabBarControl/source/PSMLightHighContrastTabStyle.h new file mode 100644 index 0000000000..dd6f3bfe3d --- /dev/null +++ b/src/MacVim/PSMTabBarControl/source/PSMLightHighContrastTabStyle.h @@ -0,0 +1,15 @@ +// +// PSMLightHighContrastTabStyle.h +// iTerm2 +// +// Created by George Nachman on 3/25/16. +// +// + +#import +#import "PSMTabStyle.h" +#import "PSMYosemiteTabStyle.h" + +@interface PSMLightHighContrastTabStyle : PSMYosemiteTabStyle + +@end diff --git a/src/MacVim/PSMTabBarControl/source/PSMLightHighContrastTabStyle.m b/src/MacVim/PSMTabBarControl/source/PSMLightHighContrastTabStyle.m new file mode 100644 index 0000000000..2b6941f296 --- /dev/null +++ b/src/MacVim/PSMTabBarControl/source/PSMLightHighContrastTabStyle.m @@ -0,0 +1,70 @@ +// +// PSMLightHighContrastTabStyle.m +// iTerm2 +// +// Created by George Nachman on 3/25/16. +// +// + +#import "PSMLightHighContrastTabStyle.h" +#import "PSMTabBarCell.h" +#import "PSMTabBarControl.h" + +@implementation PSMLightHighContrastTabStyle + +- (NSString *)name { + return @"Light High Contrast"; +} + +- (NSColor *)textColorDefaultSelected:(BOOL)selected { + return [NSColor blackColor]; +} + +- (NSColor *)accessoryTextColor { + return [NSColor blackColor]; +} + +- (NSColor *)backgroundColorSelected:(BOOL)selected highlightAmount:(CGFloat)highlightAmount { + if (selected) { + if (self.tabBar.window.backgroundColor) { + return self.tabBar.window.backgroundColor; + } else { + return [NSColor windowBackgroundColor]; + } + } else { + if ([self isYosemiteOrLater]) { + CGFloat value = 180 / 255.0 - highlightAmount * 0.1; + return [NSColor colorWithSRGBRed:value green:value blue:value alpha:1]; + } else { + // 10.9 and earlier needs a darker color to look good + CGFloat value = 0.6 - highlightAmount * 0.1; + return [NSColor colorWithSRGBRed:value green:value blue:value alpha:1]; + } + } +} + +- (NSColor *)verticalLineColor { + return [NSColor colorWithWhite:140.0 / 255.0 alpha:1]; +} + +- (NSColor *)topLineColorSelected:(BOOL)selected { + if (selected) { + return [super topLineColorSelected:selected]; + } else { + return [self verticalLineColor]; + } +} + +- (NSColor *)bottomLineColorSelected:(BOOL)selected { + return [self verticalLineColor]; +} + +- (NSColor *)tabBarColor { + return [NSColor colorWithCalibratedWhite:0 alpha:0.3]; +} + +- (CGFloat)fontSize { + return 12.0; +} + +@end diff --git a/src/MacVim/PSMTabBarControl/source/PSMMetalTabStyle.h b/src/MacVim/PSMTabBarControl/source/PSMMetalTabStyle.h deleted file mode 100644 index 20bf7e0bfd..0000000000 --- a/src/MacVim/PSMTabBarControl/source/PSMMetalTabStyle.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// PSMMetalTabStyle.h -// PSMTabBarControl -// -// Created by John Pannell on 2/17/06. -// Copyright 2006 Positive Spin Media. All rights reserved. -// - -#import -#import "PSMTabStyle.h" - -@interface PSMMetalTabStyle : NSObject { - NSImage *metalCloseButton; - NSImage *metalCloseButtonDown; - NSImage *metalCloseButtonOver; - NSImage *_addTabButtonImage; - NSImage *_addTabButtonPressedImage; - NSImage *_addTabButtonRolloverImage; - NSMutableParagraphStyle *truncatingTailParagraphStyle; - NSMutableParagraphStyle *centeredParagraphStyle; -} - -- (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlView; - -- (void)encodeWithCoder:(NSCoder *)aCoder; -- (id)initWithCoder:(NSCoder *)aDecoder; - -@end diff --git a/src/MacVim/PSMTabBarControl/source/PSMMetalTabStyle.m b/src/MacVim/PSMTabBarControl/source/PSMMetalTabStyle.m deleted file mode 100644 index fc1c5fae89..0000000000 --- a/src/MacVim/PSMTabBarControl/source/PSMMetalTabStyle.m +++ /dev/null @@ -1,531 +0,0 @@ -// -// PSMMetalTabStyle.m -// PSMTabBarControl -// -// Created by John Pannell on 2/17/06. -// Copyright 2006 Positive Spin Media. All rights reserved. -// - -#import "PSMMetalTabStyle.h" -#import "PSMTabBarCell.h" -#import "PSMTabBarControl.h" - -#define kPSMMetalObjectCounterRadius 7.0 -#define kPSMMetalCounterMinWidth 20 - -// NSDrawWindowBackground() is broken for borderless windows, see -// http://lists.apple.com/archives/cocoa-dev/2006/Feb/msg00130.html -void MyNSDrawWindowBackground(NSRect rect) -{ - [[NSColor controlColor] set]; - NSRectFill( rect ); -} - -@implementation PSMMetalTabStyle - -- (NSString *)name -{ - return @"Metal"; -} - -#pragma mark - -#pragma mark Creation/Destruction - -- (id) init -{ - //NSLog(@"PSMMetalTabStyle init"); - - if((self = [super init])) - { - - metalCloseButton = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"TabClose_Front"]]; - //NSLog(@"metalCloseButton=%@ path=%@", metalCloseButton, - // [[PSMTabBarControl bundle] pathForImageResource:@"TabClose_Front"]); - metalCloseButtonDown = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"TabClose_Front_Pressed"]]; - metalCloseButtonOver = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"TabClose_Front_Rollover"]]; - - _addTabButtonImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"TabNewMetal"]]; - _addTabButtonPressedImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"TabNewMetalPressed"]]; - _addTabButtonRolloverImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"TabNewMetalRollover"]]; - } - return self; -} - -- (void)dealloc -{ - [metalCloseButton release]; - [metalCloseButtonDown release]; - [metalCloseButtonOver release]; - [_addTabButtonImage release]; - [_addTabButtonPressedImage release]; - [_addTabButtonRolloverImage release]; - - [truncatingTailParagraphStyle release]; - [centeredParagraphStyle release]; - - [super dealloc]; -} - -#pragma mark - -#pragma mark Control Specific - -- (float)leftMarginForTabBarControl -{ - return 10.0f; -} - -- (float)rightMarginForTabBarControl -{ - return 24.0f; -} - -#pragma mark - -#pragma mark Add Tab Button - -- (NSImage *)addTabButtonImage -{ - return _addTabButtonImage; -} - -- (NSImage *)addTabButtonPressedImage -{ - return _addTabButtonPressedImage; -} - -- (NSImage *)addTabButtonRolloverImage -{ - return _addTabButtonRolloverImage; -} - -#pragma mark - -#pragma mark Cell Specific - -- (NSRect) closeButtonRectForTabCell:(PSMTabBarCell *)cell -{ - NSRect cellFrame = [cell frame]; - - if ([cell hasCloseButton] == NO) { - return NSZeroRect; - } - - NSRect result; - result.size = [metalCloseButton size]; - result.origin.x = cellFrame.origin.x + MARGIN_X; - result.origin.y = cellFrame.origin.y + MARGIN_Y + 2.0; - - if([cell state] == NSOnState){ - result.origin.y -= 1; - } - - return result; -} - -- (NSRect)iconRectForTabCell:(PSMTabBarCell *)cell -{ - NSRect cellFrame = [cell frame]; - - if ([cell hasIcon] == NO) { - return NSZeroRect; - } - - NSRect result; - result.size = NSMakeSize(kPSMTabBarIconWidth, kPSMTabBarIconWidth); - result.origin.x = cellFrame.origin.x + MARGIN_X; - result.origin.y = cellFrame.origin.y + MARGIN_Y; - - if([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) - result.origin.x += [metalCloseButton size].width + kPSMTabBarCellPadding; - - if([cell state] == NSOnState){ - result.origin.y += 1; - } - - return result; -} - -- (NSRect)indicatorRectForTabCell:(PSMTabBarCell *)cell -{ - NSRect cellFrame = [cell frame]; - - if ([[cell indicator] isHidden]) { - return NSZeroRect; - } - - NSRect result; - result.size = NSMakeSize(kPSMTabBarIndicatorWidth, kPSMTabBarIndicatorWidth); - result.origin.x = cellFrame.origin.x + cellFrame.size.width - MARGIN_X - kPSMTabBarIndicatorWidth; - result.origin.y = cellFrame.origin.y + MARGIN_Y; - - if([cell state] == NSOnState){ - result.origin.y -= 1; - } - - return result; -} - -- (NSRect)objectCounterRectForTabCell:(PSMTabBarCell *)cell -{ - NSRect cellFrame = [cell frame]; - - if ([cell count] == 0) { - return NSZeroRect; - } - - float countWidth = [[self attributedObjectCountValueForTabCell:cell] size].width; - countWidth += (2 * kPSMMetalObjectCounterRadius - 6.0); - if(countWidth < kPSMMetalCounterMinWidth) - countWidth = kPSMMetalCounterMinWidth; - - NSRect result; - result.size = NSMakeSize(countWidth, 2 * kPSMMetalObjectCounterRadius); // temp - result.origin.x = cellFrame.origin.x + cellFrame.size.width - MARGIN_X - result.size.width; - result.origin.y = cellFrame.origin.y + MARGIN_Y + 1.0; - - if(![[cell indicator] isHidden]) - result.origin.x -= kPSMTabBarIndicatorWidth + kPSMTabBarCellPadding; - - return result; -} - - -- (float)minimumWidthOfTabCell:(PSMTabBarCell *)cell -{ - float resultWidth = 0.0; - - // left margin - resultWidth = MARGIN_X; - - // close button? - if([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) - resultWidth += [metalCloseButton size].width + kPSMTabBarCellPadding; - - // icon? - if([cell hasIcon]) - resultWidth += kPSMTabBarIconWidth + kPSMTabBarCellPadding; - - // the label - resultWidth += kPSMMinimumTitleWidth; - - // object counter? - if([cell count] > 0) - resultWidth += [self objectCounterRectForTabCell:cell].size.width + kPSMTabBarCellPadding; - - // indicator? - if ([[cell indicator] isHidden] == NO) - resultWidth += kPSMTabBarCellPadding + kPSMTabBarIndicatorWidth; - - // right margin - resultWidth += MARGIN_X; - - return ceil(resultWidth); -} - -- (float)desiredWidthOfTabCell:(PSMTabBarCell *)cell -{ - float resultWidth = 0.0; - - // left margin - resultWidth = MARGIN_X; - - // close button? - if ([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) - resultWidth += [metalCloseButton size].width + kPSMTabBarCellPadding; - - // icon? - if([cell hasIcon]) - resultWidth += kPSMTabBarIconWidth + kPSMTabBarCellPadding; - - // the label - resultWidth += [[cell attributedStringValue] size].width; - - // object counter? - if([cell count] > 0) - resultWidth += [self objectCounterRectForTabCell:cell].size.width + kPSMTabBarCellPadding; - - // indicator? - if ([[cell indicator] isHidden] == NO) - resultWidth += kPSMTabBarCellPadding + kPSMTabBarIndicatorWidth; - - // right margin - resultWidth += MARGIN_X; - - return ceil(resultWidth); -} - -#pragma mark - -#pragma mark Cell Values - -- (NSAttributedString *)attributedObjectCountValueForTabCell:(PSMTabBarCell *)cell -{ - NSMutableAttributedString *attrStr; - NSFontManager *fm = [NSFontManager sharedFontManager]; - NSNumberFormatter *nf = [[[NSNumberFormatter alloc] init] autorelease]; - [nf setLocalizesFormat:YES]; - [nf setFormat:@"0"]; - [nf setHasThousandSeparators:YES]; - NSString *contents = [nf stringFromNumber:[NSNumber numberWithInt:[cell count]]]; - attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease]; - NSRange range = NSMakeRange(0, [contents length]); - - // Add font attribute - [attrStr addAttribute:NSFontAttributeName value:[fm convertFont:[NSFont fontWithName:@"Helvetica" size:11.0] toHaveTrait:NSBoldFontMask] range:range]; - [attrStr addAttribute:NSForegroundColorAttributeName value:[[NSColor whiteColor] colorWithAlphaComponent:0.85] range:range]; - - return attrStr; -} - -- (NSAttributedString *)attributedStringValueForTabCell:(PSMTabBarCell *)cell -{ - NSMutableAttributedString *attrStr; - NSString *contents = [cell stringValue]; - attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease]; - NSRange range = NSMakeRange(0, [contents length]); - - // Add font attribute - [attrStr addAttribute:NSFontAttributeName value:[NSFont boldSystemFontOfSize:11.0] range:range]; - [attrStr addAttribute:NSForegroundColorAttributeName value:[[NSColor textColor] colorWithAlphaComponent:0.75] range:range]; - - // Add shadow attribute - NSShadow* shadow; - shadow = [[[NSShadow alloc] init] autorelease]; - float shadowAlpha; - if(([cell state] == NSOnState) || [cell isHighlighted]){ - shadowAlpha = 0.8; - } else { - shadowAlpha = 0.5; - } - [shadow setShadowColor:[NSColor colorWithCalibratedWhite:1.0 alpha:shadowAlpha]]; - [shadow setShadowOffset:NSMakeSize(0, -1)]; - [shadow setShadowBlurRadius:1.0]; - [attrStr addAttribute:NSShadowAttributeName value:shadow range:range]; - - // Paragraph Style for Truncating Long Text - if (!truncatingTailParagraphStyle) { - truncatingTailParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain]; - [truncatingTailParagraphStyle setLineBreakMode:NSLineBreakByTruncatingTail]; - [truncatingTailParagraphStyle setAlignment:NSTextAlignmentCenter]; - } - [attrStr addAttribute:NSParagraphStyleAttributeName value:truncatingTailParagraphStyle range:range]; - - return attrStr; -} - -#pragma mark - -#pragma mark ---- drawing ---- - -- (void)drawTabCell:(PSMTabBarCell *)cell -{ - NSRect cellFrame = [cell frame]; - NSColor * lineColor = nil; - NSBezierPath* bezier = [NSBezierPath bezierPath]; - lineColor = [NSColor darkGrayColor]; - - if ([cell state] == NSOnState) { - // selected tab - NSRect aRect = NSMakeRect(cellFrame.origin.x, cellFrame.origin.y, cellFrame.size.width, cellFrame.size.height-2.5); - aRect.size.height -= 0.5; - - // background - MyNSDrawWindowBackground(aRect); - - aRect.size.height+=0.5; - - // frame - aRect.origin.x += 0.5; - [lineColor set]; - [bezier moveToPoint:NSMakePoint(aRect.origin.x, aRect.origin.y)]; - [bezier lineToPoint:NSMakePoint(aRect.origin.x, aRect.origin.y+aRect.size.height-1.5)]; - [bezier lineToPoint:NSMakePoint(aRect.origin.x+1.5, aRect.origin.y+aRect.size.height)]; - [bezier lineToPoint:NSMakePoint(aRect.origin.x+aRect.size.width-1.5, aRect.origin.y+aRect.size.height)]; - [bezier lineToPoint:NSMakePoint(aRect.origin.x+aRect.size.width, aRect.origin.y+aRect.size.height-1.5)]; - [bezier lineToPoint:NSMakePoint(aRect.origin.x+aRect.size.width, aRect.origin.y)]; - if([[cell controlView] frame].size.height < 2){ - // special case of hidden control; need line across top of cell - [bezier moveToPoint:NSMakePoint(aRect.origin.x, aRect.origin.y+0.5)]; - [bezier lineToPoint:NSMakePoint(aRect.origin.x+aRect.size.width, aRect.origin.y+0.5)]; - } - [bezier stroke]; - } else { - - // unselected tab - NSRect aRect = NSMakeRect(cellFrame.origin.x, cellFrame.origin.y, cellFrame.size.width, cellFrame.size.height); - aRect.origin.y += 0.5; - aRect.origin.x += 1.5; - aRect.size.width -= 1; - - // rollover - if ([cell isHighlighted]) { - [[NSColor colorWithCalibratedWhite:0.0 alpha:0.1] set]; - NSRectFillUsingOperation(aRect, NSCompositingOperationSourceAtop); - } - - aRect.origin.x -= 1; - aRect.size.width += 1; - - // frame - [lineColor set]; - [bezier moveToPoint:NSMakePoint(aRect.origin.x, aRect.origin.y)]; - [bezier lineToPoint:NSMakePoint(aRect.origin.x + aRect.size.width, aRect.origin.y)]; - if(!([cell tabState] & PSMTab_RightIsSelectedMask)){ - [bezier lineToPoint:NSMakePoint(aRect.origin.x + aRect.size.width, aRect.origin.y + aRect.size.height)]; - } - [bezier stroke]; - } - - [self drawInteriorWithTabCell:cell inView:[cell controlView]]; -} - - - -- (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlView -{ - NSRect cellFrame = [cell frame]; - float labelPosition = cellFrame.origin.x + MARGIN_X; - - // close button - if ([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) { - NSSize closeButtonSize = NSZeroSize; - NSRect closeButtonRect = [cell closeButtonRectForFrame:cellFrame]; - NSImage * closeButton = nil; - - closeButton = metalCloseButton; - if ([cell closeButtonOver]) closeButton = metalCloseButtonOver; - if ([cell closeButtonPressed]) closeButton = metalCloseButtonDown; - - closeButtonSize = [closeButton size]; - [closeButton drawInRect:closeButtonRect fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1.0 respectFlipped:YES hints:nil]; - - // scoot label over - labelPosition += closeButtonSize.width + kPSMTabBarCellPadding; - } - -#if 0 // MacVim: disable this code. It is unused and calling 'content' on the represented object's identifier seems dangerous at best. - // icon - if([cell hasIcon]){ - NSRect iconRect = [self iconRectForTabCell:cell]; - NSImage *icon = [[[[cell representedObject] identifier] content] icon]; - if ([controlView isFlipped]) { - iconRect.origin.y = cellFrame.size.height - iconRect.origin.y; - } - [icon compositeToPoint:iconRect.origin operation:NSCompositeSourceOver fraction:1.0]; - - // scoot label over - labelPosition += iconRect.size.width + kPSMTabBarCellPadding; - } -#endif - - // object counter - if([cell count] > 0){ - [[NSColor colorWithCalibratedWhite:0.3 alpha:0.6] set]; - NSBezierPath *path = [NSBezierPath bezierPath]; - NSRect myRect = [self objectCounterRectForTabCell:cell]; - if([cell state] == NSOnState) - myRect.origin.y -= 1.0; - [path moveToPoint:NSMakePoint(myRect.origin.x + kPSMMetalObjectCounterRadius, myRect.origin.y)]; - [path lineToPoint:NSMakePoint(myRect.origin.x + myRect.size.width - kPSMMetalObjectCounterRadius, myRect.origin.y)]; - [path appendBezierPathWithArcWithCenter:NSMakePoint(myRect.origin.x + myRect.size.width - kPSMMetalObjectCounterRadius, myRect.origin.y + kPSMMetalObjectCounterRadius) radius:kPSMMetalObjectCounterRadius startAngle:270.0 endAngle:90.0]; - [path lineToPoint:NSMakePoint(myRect.origin.x + kPSMMetalObjectCounterRadius, myRect.origin.y + myRect.size.height)]; - [path appendBezierPathWithArcWithCenter:NSMakePoint(myRect.origin.x + kPSMMetalObjectCounterRadius, myRect.origin.y + kPSMMetalObjectCounterRadius) radius:kPSMMetalObjectCounterRadius startAngle:90.0 endAngle:270.0]; - [path fill]; - - // draw attributed string centered in area - NSRect counterStringRect; - NSAttributedString *counterString = [self attributedObjectCountValueForTabCell:cell]; - counterStringRect.size = [counterString size]; - counterStringRect.origin.x = myRect.origin.x + ((myRect.size.width - counterStringRect.size.width) / 2.0) + 0.25; - counterStringRect.origin.y = myRect.origin.y + ((myRect.size.height - counterStringRect.size.height) / 2.0) + 0.5; - [counterString drawInRect:counterStringRect]; - } - - // label rect - NSRect labelRect; - labelRect.origin.x = labelPosition; - labelRect.size.width = cellFrame.size.width - (labelRect.origin.x - cellFrame.origin.x) - kPSMTabBarCellPadding; - labelRect.size.height = cellFrame.size.height; - labelRect.origin.y = cellFrame.origin.y + MARGIN_Y + 1.0; - - if([cell state] == NSOnState){ - labelRect.origin.y -= 1; - } - - if(![[cell indicator] isHidden]) - labelRect.size.width -= (kPSMTabBarIndicatorWidth + kPSMTabBarCellPadding); - - if([cell count] > 0) - labelRect.size.width -= ([self objectCounterRectForTabCell:cell].size.width + kPSMTabBarCellPadding); - - // label - [[cell attributedStringValue] drawInRect:labelRect]; -} - -- (void)drawTabBar:(PSMTabBarControl *)bar inRect:(NSRect)rect -{ - MyNSDrawWindowBackground(rect); - [[NSColor colorWithCalibratedWhite:0.0 alpha:0.2] set]; - NSRectFillUsingOperation(rect, NSCompositingOperationSourceAtop); - [[NSColor darkGrayColor] set]; - [NSBezierPath strokeLineFromPoint:NSMakePoint(rect.origin.x,rect.origin.y+0.5) toPoint:NSMakePoint(rect.origin.x+rect.size.width,rect.origin.y+0.5)]; - [NSBezierPath strokeLineFromPoint:NSMakePoint(rect.origin.x,rect.origin.y+rect.size.height-0.5) toPoint:NSMakePoint(rect.origin.x+rect.size.width,rect.origin.y+rect.size.height-0.5)]; - - // no tab view == not connected - if(![bar tabView]){ - NSRect labelRect = rect; - labelRect.size.height -= 4.0; - labelRect.origin.y += 4.0; - NSMutableAttributedString *attrStr; - NSString *contents = @"PSMTabBarControl"; - attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease]; - NSRange range = NSMakeRange(0, [contents length]); - [attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0] range:range]; - if (!centeredParagraphStyle) { - centeredParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain]; - [centeredParagraphStyle setAlignment:NSTextAlignmentCenter]; - } - [attrStr addAttribute:NSParagraphStyleAttributeName value:centeredParagraphStyle range:range]; - [attrStr drawInRect:labelRect]; - return; - } - - // draw cells - NSEnumerator *e = [[bar cells] objectEnumerator]; - PSMTabBarCell *cell; - while(cell = [e nextObject]){ - if(![cell isInOverflowMenu]){ - [cell drawWithFrame:[cell frame] inView:bar]; - } - } -} - -#pragma mark - -#pragma mark Archiving - -- (void)encodeWithCoder:(NSCoder *)aCoder -{ - //[super encodeWithCoder:aCoder]; - if ([aCoder allowsKeyedCoding]) { - [aCoder encodeObject:metalCloseButton forKey:@"metalCloseButton"]; - [aCoder encodeObject:metalCloseButtonDown forKey:@"metalCloseButtonDown"]; - [aCoder encodeObject:metalCloseButtonOver forKey:@"metalCloseButtonOver"]; - [aCoder encodeObject:_addTabButtonImage forKey:@"addTabButtonImage"]; - [aCoder encodeObject:_addTabButtonPressedImage forKey:@"addTabButtonPressedImage"]; - [aCoder encodeObject:_addTabButtonRolloverImage forKey:@"addTabButtonRolloverImage"]; - } -} - -- (id)initWithCoder:(NSCoder *)aDecoder -{ - // self = [super initWithCoder:aDecoder]; - //if (self) { - if ([aDecoder allowsKeyedCoding]) { - metalCloseButton = [[aDecoder decodeObjectForKey:@"metalCloseButton"] retain]; - metalCloseButtonDown = [[aDecoder decodeObjectForKey:@"metalCloseButtonDown"] retain]; - metalCloseButtonOver = [[aDecoder decodeObjectForKey:@"metalCloseButtonOver"] retain]; - _addTabButtonImage = [[aDecoder decodeObjectForKey:@"addTabButtonImage"] retain]; - _addTabButtonPressedImage = [[aDecoder decodeObjectForKey:@"addTabButtonPressedImage"] retain]; - _addTabButtonRolloverImage = [[aDecoder decodeObjectForKey:@"addTabButtonRolloverImage"] retain]; - } - //} - return self; -} - -@end diff --git a/src/MacVim/PSMTabBarControl/source/PSMOverflowPopUpButton.h b/src/MacVim/PSMTabBarControl/source/PSMOverflowPopUpButton.h index 1ee16bdcb2..c7585c6069 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMOverflowPopUpButton.h +++ b/src/MacVim/PSMTabBarControl/source/PSMOverflowPopUpButton.h @@ -13,8 +13,15 @@ NSImage *_PSMTabBarOverflowPopUpImage; NSImage *_PSMTabBarOverflowDownPopUpImage; BOOL _down; + BOOL _animatingAlternateImage; + NSTimer *_animationTimer; + float _animationValue; } +//alternate image display +- (BOOL)animatingAlternateImage; +- (void)setAnimatingAlternateImage:(BOOL)flag; + // archiving - (void)encodeWithCoder:(NSCoder *)aCoder; - (id)initWithCoder:(NSCoder *)aDecoder; diff --git a/src/MacVim/PSMTabBarControl/source/PSMOverflowPopUpButton.m b/src/MacVim/PSMTabBarControl/source/PSMOverflowPopUpButton.m index 2b36b745e2..609962551a 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMOverflowPopUpButton.m +++ b/src/MacVim/PSMTabBarControl/source/PSMOverflowPopUpButton.m @@ -9,18 +9,22 @@ #import "PSMOverflowPopUpButton.h" #import "PSMTabBarControl.h" +#define TIMER_INTERVAL 1.0 / 10.0 +#define ANIMATION_STEP 0.05f + @implementation PSMOverflowPopUpButton - (id)initWithFrame:(NSRect)frameRect pullsDown:(BOOL)flag { - self=[super initWithFrame:frameRect pullsDown:YES]; - if (self) { + self = [super initWithFrame:frameRect pullsDown:YES]; + if (self) { [self setBezelStyle:NSRegularSquareBezelStyle]; [self setBordered:NO]; [self setTitle:@""]; [self setPreferredEdge:NSMaxXEdge]; _PSMTabBarOverflowPopUpImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"overflowImage"]]; _PSMTabBarOverflowDownPopUpImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"overflowImagePressed"]]; + _animatingAlternateImage = NO; } return self; } @@ -40,14 +44,27 @@ - (void)drawRect:(NSRect)rect } NSImage *image = (_down) ? _PSMTabBarOverflowDownPopUpImage : _PSMTabBarOverflowPopUpImage; - NSSize imageSize = [image size]; - NSRect bounds = [self bounds]; - NSPoint drawPoint = NSMakePoint(NSMidX(bounds) - (imageSize.width * 0.5f), - NSMidY(bounds) - (imageSize.height * 0.5f)); + NSSize imageSize = [image size]; + NSRect bounds = [self bounds]; + + NSPoint drawPoint = NSMakePoint(NSMidX(bounds) - (imageSize.width * 0.5f), NSMidY(bounds) - (imageSize.height * 0.5f)); + [image drawAtPoint:drawPoint fromRect:NSZeroRect - operation:NSCompositingOperationSourceOver - fraction:1.0f]; + operation:NSCompositeSourceOver + fraction:_animatingAlternateImage ? 0.7f : 1.0f]; + + if (_animatingAlternateImage) { + NSImage *alternateImage = [self alternateImage]; + NSSize altImageSize = [alternateImage size]; + drawPoint = NSMakePoint(NSMidX(bounds) - (altImageSize.width * 0.5f), + NSMidY(bounds) - (altImageSize.height * 0.5f)); + + [[self alternateImage] drawAtPoint:drawPoint + fromRect:NSZeroRect + operation:NSCompositeSourceOver + fraction:sin(_animationValue * M_PI)]; + } } - (void)mouseDown:(NSEvent *)event @@ -58,6 +75,19 @@ - (void)mouseDown:(NSEvent *)event [super mouseDown:event]; } +- (void)setHidden:(BOOL)value +{ + if (!value && _animatingAlternateImage) { + _animationValue = ANIMATION_STEP; + _animationTimer = [NSTimer scheduledTimerWithTimeInterval:TIMER_INTERVAL target:self selector:@selector(animateStep:) userInfo:nil repeats:YES]; + [[NSRunLoop currentRunLoop] addTimer:_animationTimer forMode:NSEventTrackingRunLoopMode]; + } else { + [_animationTimer invalidate], _animationTimer = nil; + } + + [super setHidden:value]; +} + - (void)notificationReceived:(NSNotification *)notification { _down = NO; @@ -65,6 +95,38 @@ - (void)notificationReceived:(NSNotification *)notification [[NSNotificationCenter defaultCenter] removeObserver:self]; } +- (void)setAnimatingAlternateImage:(BOOL)flag +{ + _animatingAlternateImage = flag; + [self setNeedsDisplay:YES]; + + if (![self isHidden] && !_animationTimer) { + if (flag) { + _animationValue = ANIMATION_STEP; + _animationTimer = [NSTimer scheduledTimerWithTimeInterval:TIMER_INTERVAL target:self selector:@selector(animateStep:) userInfo:nil repeats:YES]; + [[NSRunLoop currentRunLoop] addTimer:_animationTimer forMode:NSEventTrackingRunLoopMode]; + } else { + [_animationTimer invalidate], _animationTimer = nil; + } + } +} + +- (BOOL)animatingAlternateImage +{ + return _animatingAlternateImage; +} + +- (void)animateStep:(NSTimer *)timer +{ + _animationValue += ANIMATION_STEP; + + if (_animationValue >= 1) { + _animationValue = ANIMATION_STEP; + } + + [self setNeedsDisplay:YES]; +} + #pragma mark - #pragma mark Archiving @@ -73,15 +135,16 @@ - (void)encodeWithCoder:(NSCoder *)aCoder { if ([aCoder allowsKeyedCoding]) { [aCoder encodeObject:_PSMTabBarOverflowPopUpImage forKey:@"PSMTabBarOverflowPopUpImage"]; [aCoder encodeObject:_PSMTabBarOverflowDownPopUpImage forKey:@"PSMTabBarOverflowDownPopUpImage"]; + [aCoder encodeBool:_animatingAlternateImage forKey:@"PSMTabBarOverflowAnimatingAlternateImage"]; } } - (id)initWithCoder:(NSCoder *)aDecoder { - self = [super initWithCoder:aDecoder]; - if (self) { + if ( (self = [super initWithCoder:aDecoder]) ) { if ([aDecoder allowsKeyedCoding]) { _PSMTabBarOverflowPopUpImage = [[aDecoder decodeObjectForKey:@"PSMTabBarOverflowPopUpImage"] retain]; _PSMTabBarOverflowDownPopUpImage = [[aDecoder decodeObjectForKey:@"PSMTabBarOverflowDownPopUpImage"] retain]; + [self setAnimatingAlternateImage:[aDecoder decodeBoolForKey:@"PSMTabBarOverflowAnimatingAlternateImage"]]; } } return self; diff --git a/src/MacVim/PSMTabBarControl/source/PSMProgressIndicator.h b/src/MacVim/PSMTabBarControl/source/PSMProgressIndicator.h index 8f56bd73ae..bebd1a1dd7 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMProgressIndicator.h +++ b/src/MacVim/PSMTabBarControl/source/PSMProgressIndicator.h @@ -7,17 +7,19 @@ // #import -#import "PSMTabBarControl.h" - - -@interface PSMProgressIndicator : NSProgressIndicator { - -} +@protocol PSMProgressIndicatorDelegate +- (void)progressIndicatorNeedsUpdate; @end -@interface PSMTabBarControl (LayoutPlease) +// This is a wrapper around an NSProgressIndicator. The main difference between this and +// NSProgressIndicator is that setting the |light| property changes the appearance of the progress +// indicator so it looks good against a dark background. +@interface PSMProgressIndicator : NSView -- (void)update; +// Should the progress indicator render in a "light" style, suitable for use over a dark background? +@property(nonatomic, assign) BOOL light; +@property(nonatomic, assign) id delegate; +@property(nonatomic, assign) BOOL animate; -@end \ No newline at end of file +@end diff --git a/src/MacVim/PSMTabBarControl/source/PSMProgressIndicator.m b/src/MacVim/PSMTabBarControl/source/PSMProgressIndicator.m index d3046d518a..37009981fb 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMProgressIndicator.m +++ b/src/MacVim/PSMTabBarControl/source/PSMProgressIndicator.m @@ -7,14 +7,97 @@ // #import "PSMProgressIndicator.h" +#import "AMIndeterminateProgressIndicator.h" +#import -@implementation PSMProgressIndicator +@protocol PSMMinimalProgressIndicatorInterface -// overrides to make tab bar control re-layout things if status changes -- (void)setHidden:(BOOL)flag -{ +- (void)startAnimation:(id)sender; +- (void)stopAnimation:(id)sender; +- (void)setHidden:(BOOL)hide; +- (BOOL)isHidden; + +@end + +@implementation PSMProgressIndicator { + AMIndeterminateProgressIndicator *_lightIndicator; + AMIndeterminateProgressIndicator *_darkIndicator; + BOOL _light; +} + +- (id)initWithFrame:(NSRect)frameRect { + self = [super initWithFrame:frameRect]; + if (self) { + _darkIndicator = [[AMIndeterminateProgressIndicator alloc] initWithFrame:self.bounds]; + _darkIndicator.color = [NSColor colorWithCalibratedWhite:0 alpha:1]; + [self addSubview:_darkIndicator]; + + _lightIndicator = [[AMIndeterminateProgressIndicator alloc] initWithFrame:self.bounds]; + _lightIndicator.color = [NSColor colorWithCalibratedWhite:0.8 alpha:1]; + [self addSubview:_lightIndicator]; + _lightIndicator.hidden = YES; + } + return self; +} + +- (void)dealloc { + [_darkIndicator release]; + [_lightIndicator release]; + [super dealloc]; +} + +- (void)setHidden:(BOOL)flag { [super setHidden:flag]; - [(PSMTabBarControl *)[self superview] update]; + [_delegate progressIndicatorNeedsUpdate]; + if (_animate && flag) { + [self stopAnimation:nil]; + } +} + +- (id)currentIndicator { + if (self.light) { + return (id)_lightIndicator; + } else { + return (id)_darkIndicator; + } +} + +- (void)startAnimation:(id)sender { + self.animate = YES; + [self.currentIndicator startAnimation:sender]; +} + +- (void)stopAnimation:(id)sender { + self.animate = NO; + [self.currentIndicator stopAnimation:sender]; +} + +- (void)setLight:(BOOL)light { + if (light == _light) { + return; + } + + BOOL shouldHide = self.currentIndicator.isHidden; + [self.currentIndicator setHidden:YES]; + [self.currentIndicator stopAnimation:nil]; + + _light = light; + + [self.currentIndicator setHidden:shouldHide]; + if (!shouldHide && _animate) { + [self.currentIndicator startAnimation:nil]; + } +} + +- (void)setAnimate:(BOOL)animate { + if (animate != _animate) { + _animate = animate; + if (animate && !self.isHidden) { + [self startAnimation:nil]; + } else { + [self stopAnimation:nil]; + } + } } @end diff --git a/src/MacVim/PSMTabBarControl/source/PSMRolloverButton.h b/src/MacVim/PSMTabBarControl/source/PSMRolloverButton.h index d78b47c272..8f33628c63 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMRolloverButton.h +++ b/src/MacVim/PSMTabBarControl/source/PSMRolloverButton.h @@ -26,4 +26,4 @@ // tracking rect for mouse events - (void)addTrackingRect; - (void)removeTrackingRect; -@end \ No newline at end of file +@end diff --git a/src/MacVim/PSMTabBarControl/source/PSMRolloverButton.m b/src/MacVim/PSMTabBarControl/source/PSMRolloverButton.m index 10fed285a0..56099b1043 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMRolloverButton.m +++ b/src/MacVim/PSMTabBarControl/source/PSMRolloverButton.m @@ -12,9 +12,8 @@ @implementation PSMRolloverButton - (void)dealloc { - [_usualImage release]; [_rolloverImage release]; - + [_usualImage release]; [super dealloc]; } @@ -52,11 +51,14 @@ - (void)addTrackingRect - (void)removeTrackingRect { - [self removeTrackingRect:_myTrackingRectTag]; + if (_myTrackingRectTag) { + [self removeTrackingRect:_myTrackingRectTag]; + } + _myTrackingRectTag = 0; } // override for rollover effect -- (void)mouseEntered:(NSEvent *)theEvent; +- (void)mouseEntered:(NSEvent *)theEvent { // set rollover image [self setImage:_rolloverImage]; @@ -64,7 +66,7 @@ - (void)mouseEntered:(NSEvent *)theEvent; [[self superview] setNeedsDisplay:YES]; // eliminates a drawing artifact } -- (void)mouseExited:(NSEvent *)theEvent; +- (void)mouseExited:(NSEvent *)theEvent { // restore usual image [self setImage:_usualImage]; diff --git a/src/MacVim/PSMTabBarControl/source/PSMTabBarCell.h b/src/MacVim/PSMTabBarControl/source/PSMTabBarCell.h index d51163196f..343ad38869 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMTabBarCell.h +++ b/src/MacVim/PSMTabBarControl/source/PSMTabBarCell.h @@ -8,98 +8,68 @@ #import #import "PSMTabBarControl.h" +#import "PSMProgressIndicator.h" @class PSMTabBarControl; -@class PSMProgressIndicator; +@protocol PSMTabStyle; -@interface PSMTabBarCell : NSActionCell { - // sizing - NSRect _frame; - NSSize _stringSize; - int _currentStep; - BOOL _isPlaceholder; - - // state - int _tabState; - NSTrackingRectTag _closeButtonTrackingTag; // left side tracking, if dragging - NSTrackingRectTag _cellTrackingTag; // right side tracking, if dragging - BOOL _closeButtonOver; - BOOL _closeButtonPressed; - PSMProgressIndicator *_indicator; - BOOL _isInOverflowMenu; - BOOL _hasCloseButton; - BOOL _isCloseButtonSuppressed; - BOOL _hasIcon; - int _count; - NSString *_toolTip; -} +@protocol PSMTabBarControlProtocol +- (void)tabClick:(id)sender; +- (id)style; +- (void)update:(BOOL)animate; +- (BOOL)automaticallyAnimates; +- (PSMTabBarOrientation)orientation; +- (id)delegate; +- (NSTabView *)tabView; +@end + +@interface PSMTabBarCell : NSActionCell +// Is this the last cell? Only valid while drawing. +@property(nonatomic, assign) BOOL isLast; +@property(nonatomic, assign) BOOL isCloseButtonSuppressed; +@property(nonatomic, readonly) BOOL closeButtonVisible; +@property(nonatomic, assign) int tabState; +@property(nonatomic, assign) NSRect frame; +@property(nonatomic, assign) NSTrackingRectTag cellTrackingTag; // right side tracking, if dragging +@property(nonatomic, assign) NSTrackingRectTag closeButtonTrackingTag; // left side tracking, if dragging +@property(nonatomic, assign) BOOL isInOverflowMenu; +@property(nonatomic, assign) BOOL closeButtonPressed; +@property(nonatomic, assign) BOOL closeButtonOver; +@property(nonatomic, assign) BOOL hasCloseButton; +@property(nonatomic, assign) BOOL hasIcon; +@property(nonatomic, assign) int count; +@property(nonatomic, assign) BOOL isPlaceholder; +@property(nonatomic, assign) int currentStep; +@property(nonatomic, copy) NSString *modifierString; +@property(nonatomic, retain) NSColor *tabColor; +@property(nonatomic, readonly) PSMProgressIndicator *indicator; +@property(nonatomic, readonly) NSAttributedString *attributedStringValue; +@property(nonatomic, readonly) NSSize stringSize; +@property(nonatomic, readonly) float width; +@property(nonatomic, readonly) float minimumWidthOfCell; +@property(nonatomic, readonly) float desiredWidthOfCell; +@property(nonatomic, readonly) id style; +@property(nonatomic, assign) NSLineBreakMode truncationStyle; // How to truncate title. // creation/destruction - (id)initWithControlView:(PSMTabBarControl *)controlView; - (id)initPlaceholderWithFrame:(NSRect)frame expanded:(BOOL)value inControlView:(PSMTabBarControl *)controlView; -- (void)dealloc; // accessors -- (id)controlView; -- (void)setControlView:(id)view; -- (NSTrackingRectTag)closeButtonTrackingTag; -- (void)setCloseButtonTrackingTag:(NSTrackingRectTag)tag; -- (NSTrackingRectTag)cellTrackingTag; -- (void)setCellTrackingTag:(NSTrackingRectTag)tag; -- (float)width; -- (NSRect)frame; -- (void)setFrame:(NSRect)rect; - (void)setStringValue:(NSString *)aString; -- (NSSize)stringSize; -- (NSAttributedString *)attributedStringValue; -- (int)tabState; -- (void)setTabState:(int)state; -- (NSProgressIndicator *)indicator; -- (BOOL)isInOverflowMenu; -- (void)setIsInOverflowMenu:(BOOL)value; -- (BOOL)closeButtonPressed; -- (void)setCloseButtonPressed:(BOOL)value; -- (BOOL)closeButtonOver; -- (void)setCloseButtonOver:(BOOL)value; -- (BOOL)hasCloseButton; -- (void)setHasCloseButton:(BOOL)set; -- (void)setCloseButtonSuppressed:(BOOL)suppress; -- (BOOL)isCloseButtonSuppressed; -- (BOOL)hasIcon; -- (void)setHasIcon:(BOOL)value; -- (int)count; -- (void)setCount:(int)value; -- (BOOL)isPlaceholder; -- (void)setIsPlaceholder:(BOOL)value; -- (int)currentStep; -- (void)setCurrentStep:(int)value; -- (NSString *)toolTip; -- (void)setToolTip:(NSString *)tip; // component attributes - (NSRect)indicatorRectForFrame:(NSRect)cellFrame; - (NSRect)closeButtonRectForFrame:(NSRect)cellFrame; -- (float)minimumWidthOfCell; -- (float)desiredWidthOfCell; // drawing - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView; -// tracking the mouse -- (void)mouseEntered:(NSEvent *)theEvent; -- (void)mouseExited:(NSEvent *)theEvent; - // drag support -- (NSImage*)dragImageForRect:(NSRect)cellFrame; - -// archiving -- (void)encodeWithCoder:(NSCoder *)aCoder; -- (id)initWithCoder:(NSCoder *)aDecoder; - -@end - -@interface PSMTabBarControl (CellAccessors) +- (NSImage *)dragImage; -- (id)psmTabStyle; +// iTerm additions +- (void)updateForStyle; +- (void)updateHighlight; @end diff --git a/src/MacVim/PSMTabBarControl/source/PSMTabBarCell.m b/src/MacVim/PSMTabBarControl/source/PSMTabBarCell.m index 65b3b25052..ce45bd33ab 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMTabBarCell.m +++ b/src/MacVim/PSMTabBarControl/source/PSMTabBarCell.m @@ -12,39 +12,103 @@ #import "PSMProgressIndicator.h" #import "PSMTabDragAssistant.h" +// A timer that does not keep a strong reference to its target. The target +// should invoke -invalidate from its -dealloc method and release the timer to +// avoid getting called posthumously. +@interface PSMWeakTimer : NSObject +@property(nonatomic, assign) id target; +@property(nonatomic, assign) SEL selector; + +- (instancetype)initWithTimeInterval:(NSTimeInterval)timeInterval + target:(id)target + selector:(SEL)selector + repeats:(BOOL)repeats; +- (void)invalidate; -@implementation PSMTabBarCell +@end + +@implementation PSMWeakTimer { + NSTimer *_timer; + BOOL _repeats; +} -#pragma mark - -#pragma mark Creation/Destruction -- (id)initWithControlView:(PSMTabBarControl *)controlView -{ +- (instancetype)initWithTimeInterval:(NSTimeInterval)timeInterval + target:(id)target + selector:(SEL)selector + repeats:(BOOL)repeats { self = [super init]; - if(self){ - _controlView = controlView; - _closeButtonTrackingTag = 0; - _cellTrackingTag = 0; - _closeButtonOver = NO; - _closeButtonPressed = NO; - _indicator = [[PSMProgressIndicator alloc] initWithFrame:NSMakeRect(0.0,0.0,kPSMTabBarIndicatorWidth,kPSMTabBarIndicatorWidth)]; - [_indicator setStyle:NSProgressIndicatorSpinningStyle]; + if (self) { + _target = target; + _selector = selector; + _repeats = repeats; + _timer = [NSTimer scheduledTimerWithTimeInterval:timeInterval + target:self + selector:@selector(timerDidFire:) + userInfo:nil + repeats:repeats]; + } + return self; +} + +- (void)invalidate { + [_timer invalidate]; + _timer = nil; +} + +- (void)timerDidFire:(NSTimer *)timer { + [_target performSelector:_selector withObject:timer]; + if (!_repeats) { + _timer = nil; + } +} + +@end + +@interface PSMTabBarCell() +@end + +@implementation PSMTabBarCell { + NSSize _stringSize; + PSMProgressIndicator *_indicator; + NSTimeInterval _highlightChangeTime; + PSMWeakTimer *_delayedStringValueTimer; // For bug 3957 + BOOL _hasIcon; + BOOL _highlighted; +} + +#pragma mark - Creation/Destruction + +- (id)initWithControlView:(PSMTabBarControl *)controlView { + if ((self = [super init])) { + [self setControlView:controlView]; + _indicator = [[PSMProgressIndicator alloc] initWithFrame:NSMakeRect(0, + 0, + kPSMTabBarIndicatorWidth, + kPSMTabBarIndicatorWidth)]; + _indicator.delegate = self; [_indicator setAutoresizingMask:NSViewMinYMargin]; + _indicator.light = controlView.style.useLightControls; _hasCloseButton = YES; - _isCloseButtonSuppressed = NO; - _count = 0; - _isPlaceholder = NO; + _modifierString = [@"" copy]; + _truncationStyle = NSLineBreakByTruncatingTail; } return self; } -- (id)initPlaceholderWithFrame:(NSRect)frame expanded:(BOOL)value inControlView:(PSMTabBarControl *)controlView -{ +- (id)initPlaceholderWithFrame:(NSRect)frame + expanded:(BOOL)value + inControlView:(PSMTabBarControl *)controlView { self = [super init]; - if(self){ - _controlView = controlView; + if (self) { + [self setControlView:controlView]; _isPlaceholder = YES; - if(!value) - frame.size.width = 0.0; + if (!value) { + if ([controlView orientation] == PSMTabBarHorizontalOrientation) { + frame.size.width = 0; + } else { + frame.size.height = 0; + } + } [self setFrame:frame]; _closeButtonTrackingTag = 0; _cellTrackingTag = 0; @@ -52,315 +116,230 @@ - (id)initPlaceholderWithFrame:(NSRect)frame expanded:(BOOL)value inControlView: _closeButtonPressed = NO; _indicator = nil; _hasCloseButton = YES; - _isCloseButtonSuppressed = NO; _count = 0; - - if(value){ + _tabColor = nil; + _modifierString = [@"" copy]; + _truncationStyle = NSLineBreakByTruncatingTail; + if (value) { [self setCurrentStep:(kPSMTabDragAnimationSteps - 1)]; } else { [self setCurrentStep:0]; } - } - return self; } -- (void)dealloc -{ +- (void)dealloc { + [_delayedStringValueTimer invalidate]; + [_delayedStringValueTimer release]; + + [_modifierString release]; + _indicator.delegate = nil; [_indicator release]; - [_toolTip release]; + if (_tabColor) { + [_tabColor release]; + } [super dealloc]; } -#pragma mark - -#pragma mark Accessors - -- (id)controlView -{ - return _controlView; -} - -- (void)setControlView:(id)view -{ - // no retain release pattern, as this simply switches a tab to another view. - _controlView = view; +// we don't want this to be the first responder in the chain +- (BOOL)acceptsFirstResponder { + return NO; } -- (NSTrackingRectTag)closeButtonTrackingTag -{ - return _closeButtonTrackingTag; -} - -- (void)setCloseButtonTrackingTag:(NSTrackingRectTag)tag -{ - _closeButtonTrackingTag = tag; -} +#pragma mark - Accessors -- (NSTrackingRectTag)cellTrackingTag -{ - return _cellTrackingTag; +- (BOOL)closeButtonVisible { + return !_isCloseButtonSuppressed || [self highlightAmount] > 0; } -- (void)setCellTrackingTag:(NSTrackingRectTag)tag -{ - _cellTrackingTag = tag; +- (NSView *)psmTabControlView { + return (NSView *)[self controlView]; } -- (float)width -{ +- (float)width { return _frame.size.width; } -- (NSRect)frame -{ - return _frame; -} - -- (void)setFrame:(NSRect)rect -{ - _frame = rect; +- (void)setStringValue:(NSString *)aString { + [super setStringValue:aString]; + + if (!_delayedStringValueTimer) { + static const NSTimeInterval kStringValueSettingDelay = 0.1; + _delayedStringValueTimer = + [[PSMWeakTimer alloc] initWithTimeInterval:kStringValueSettingDelay + target:self + selector:@selector(updateStringValue:) + repeats:NO]; + } } -- (void)setStringValue:(NSString *)aString -{ - [super setStringValue:aString]; +- (void)updateStringValue:(NSTimer *)timer { + [_delayedStringValueTimer release]; + _delayedStringValueTimer = nil; _stringSize = [[self attributedStringValue] size]; // need to redisplay now - binding observation was too quick. - [_controlView update]; + [[self psmTabControlView] update:[[self psmTabControlView] automaticallyAnimates]]; } -- (NSSize)stringSize -{ +- (NSSize)stringSize { return _stringSize; } -- (NSAttributedString *)attributedStringValue -{ - return [[_controlView psmTabStyle] attributedStringValueForTabCell:self]; -} - -- (int)tabState -{ - return _tabState; -} - -- (void)setTabState:(int)state -{ - _tabState = state; +- (NSAttributedString *)attributedStringValue { + id control = [self psmTabControlView]; + id tabStyle = [control style]; + return [tabStyle attributedStringValueForTabCell:self]; } -- (NSProgressIndicator *)indicator -{ +- (PSMProgressIndicator *)indicator { return _indicator; } -- (BOOL)isInOverflowMenu -{ - return _isInOverflowMenu; -} - -- (void)setIsInOverflowMenu:(BOOL)value -{ - _isInOverflowMenu = value; -} - -- (BOOL)closeButtonPressed -{ - return _closeButtonPressed; -} - -- (void)setCloseButtonPressed:(BOOL)value -{ - _closeButtonPressed = value; -} - -- (BOOL)closeButtonOver -{ - return _closeButtonOver; -} - -- (void)setCloseButtonOver:(BOOL)value -{ - _closeButtonOver = value; +- (void)setHasIcon:(BOOL)value { + _hasIcon = value; + [[self psmTabControlView] update:[[self psmTabControlView] automaticallyAnimates]]; // binding notice is too fast } -- (BOOL)hasCloseButton -{ - return _hasCloseButton; +- (BOOL)hasIcon { + BOOL hasIndicator = [self indicator] && !self.indicator.isHidden; + return _hasIcon && !hasIndicator; } -- (void)setHasCloseButton:(BOOL)set; -{ - _hasCloseButton = set; +- (void)setCount:(int)value { + _count = value; + [[self psmTabControlView] update:[[self psmTabControlView] automaticallyAnimates]]; // binding notice is too fast } -- (void)setCloseButtonSuppressed:(BOOL)suppress; -{ - _isCloseButtonSuppressed = suppress; -} +- (void)setCurrentStep:(int)value { + if (value < 0) { + value = 0; + } -- (BOOL)isCloseButtonSuppressed; -{ - return _isCloseButtonSuppressed; -} + if (value > (kPSMTabDragAnimationSteps - 1)) { + value = (kPSMTabDragAnimationSteps - 1); + } -- (BOOL)hasIcon -{ - return _hasIcon; + _currentStep = value; } -- (void)setHasIcon:(BOOL)value -{ - _hasIcon = value; - [_controlView update]; // binding notice is too fast -} +#pragma mark - Bindings -- (int)count -{ - return _count; +- (void)observeValueForKeyPath:(NSString *)keyPath + ofObject:(id)object + change:(NSDictionary *)change + context:(void *)context { + // the progress indicator, label, icon, or count has changed - redraw the control view + [[self psmTabControlView] update:[[self psmTabControlView] automaticallyAnimates]]; } -- (void)setCount:(int)value -{ - _count = value; - [_controlView update]; // binding notice is too fast -} +#pragma mark - Component Attributes -- (BOOL)isPlaceholder -{ - return _isPlaceholder; +- (NSRect)indicatorRectForFrame:(NSRect)cellFrame { + return [[[self psmTabControlView] style] indicatorRectForTabCell:self]; } -- (void)setIsPlaceholder:(BOOL)value; -{ - _isPlaceholder = value; +- (NSRect)closeButtonRectForFrame:(NSRect)cellFrame { + return [[[self psmTabControlView] style] closeButtonRectForTabCell:self]; } -- (int)currentStep -{ - return _currentStep; +- (float)minimumWidthOfCell { + return [[[self psmTabControlView] style] minimumWidthOfTabCell:self]; } -- (void)setCurrentStep:(int)value -{ - if(value < 0) - value = 0; - - if(value > (kPSMTabDragAnimationSteps - 1)) - value = (kPSMTabDragAnimationSteps - 1); - - _currentStep = value; +- (float)desiredWidthOfCell { + return [[[self psmTabControlView] style] desiredWidthOfTabCell:self]; } -- (NSString *)toolTip -{ - return _toolTip; -} +#pragma mark - Drawing -- (void)setToolTip:(NSString *)tip -{ - if (tip != _toolTip) { - [_toolTip release]; - _toolTip = [tip copy]; +- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView { + if (_isPlaceholder){ + [[NSColor colorWithCalibratedWhite:0 alpha:0.2] set]; + NSRectFillUsingOperation(cellFrame, NSCompositeSourceAtop); + return; } -} - -#pragma mark - -#pragma mark Component Attributes - -- (NSRect)indicatorRectForFrame:(NSRect)cellFrame -{ - return [[_controlView psmTabStyle] indicatorRectForTabCell:self]; -} -- (NSRect)closeButtonRectForFrame:(NSRect)cellFrame -{ - return [[_controlView psmTabStyle] closeButtonRectForTabCell:self]; + [[[self psmTabControlView] style] drawTabCell:self highlightAmount:[self highlightAmount]]; } -- (float)minimumWidthOfCell -{ - return [[_controlView psmTabStyle] minimumWidthOfTabCell:self]; -} - -- (float)desiredWidthOfCell -{ - return [[_controlView psmTabStyle] desiredWidthOfTabCell:self]; -} - -#pragma mark - -#pragma mark Drawing - -- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView -{ - if(_isPlaceholder){ - [[NSColor colorWithCalibratedWhite:0.0 alpha:0.2] set]; - NSRectFillUsingOperation(cellFrame, NSCompositingOperationSourceAtop); - return; +- (CGFloat)highlightAmount { + NSTimeInterval timeSinceChange = [NSDate timeIntervalSinceReferenceDate] - _highlightChangeTime; + CGFloat amount = self.highlighted ? 1 : 0; + if (timeSinceChange < [self highlightAnimationDuration]) { + CGFloat alpha = timeSinceChange / [self highlightAnimationDuration]; + return amount * alpha + (1 - amount) * (1 - alpha); + } else { + return amount; } - - [[_controlView psmTabStyle] drawTabCell:self]; } -#pragma mark - #pragma mark Tracking -- (void)mouseEntered:(NSEvent *)theEvent -{ +- (void)mouseEntered:(NSEvent *)theEvent { // check for which tag - if([theEvent trackingNumber] == _closeButtonTrackingTag){ + if ([theEvent trackingNumber] == _closeButtonTrackingTag) { _closeButtonOver = YES; } - if([theEvent trackingNumber] == _cellTrackingTag){ + if ([theEvent trackingNumber] == _cellTrackingTag) { [self setHighlighted:YES]; + [[self psmTabControlView] setNeedsDisplay:NO]; } - [_controlView setNeedsDisplay]; + + //tell the control we only need to redraw the affected tab + [[self psmTabControlView] setNeedsDisplayInRect:NSInsetRect([self frame], -2, -2)]; } -- (void)mouseExited:(NSEvent *)theEvent -{ +- (void)mouseExited:(NSEvent *)theEvent { // check for which tag - if([theEvent trackingNumber] == _closeButtonTrackingTag){ + if ([theEvent trackingNumber] == _closeButtonTrackingTag) { _closeButtonOver = NO; } - if([theEvent trackingNumber] == _cellTrackingTag){ + + if ([theEvent trackingNumber] == _cellTrackingTag) { [self setHighlighted:NO]; + [[self psmTabControlView] setNeedsDisplay:NO]; } - [_controlView setNeedsDisplay]; + + //tell the control we only need to redraw the affected tab + [[self psmTabControlView] setNeedsDisplayInRect:NSInsetRect([self frame], -2, -2)]; } -#pragma mark - -#pragma mark Drag Support +#pragma mark - Drag Support + +- (NSImage *)dragImage { + NSRect cellFrame = + [[[self psmTabControlView] style] dragRectForTabCell:self + orientation:[[self psmTabControlView] orientation]]; -- (NSImage*)dragImageForRect:(NSRect)cellFrame -{ - if(([self state] == NSOnState) && ([[_controlView styleName] isEqualToString:@"Metal"])) - cellFrame.size.width += 1.0; - [_controlView lockFocus]; + [[self psmTabControlView] lockFocus]; NSBitmapImageRep *rep = [[[NSBitmapImageRep alloc] initWithFocusedViewRect:cellFrame] autorelease]; - [_controlView unlockFocus]; + [[self psmTabControlView] unlockFocus]; NSImage *image = [[[NSImage alloc] initWithSize:[rep size]] autorelease]; [image addRepresentation:rep]; NSImage *returnImage = [[[NSImage alloc] initWithSize:[rep size]] autorelease]; [returnImage lockFocus]; - [image drawAtPoint:NSMakePoint(0.0, 0.0) fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:0.7]; + [image drawAtPoint:NSZeroPoint + fromRect:NSZeroRect + operation:NSCompositeSourceOver + fraction:1.0]; [returnImage unlockFocus]; - if(![[self indicator] isHidden]){ - NSImage *pi = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"pi"]]; + if (![[self indicator] isHidden]) { + // TODO: This image is missing! + NSImage *piImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"pi"]]; [returnImage lockFocus]; - NSPoint indicatorPoint = NSMakePoint([self frame].size.width - MARGIN_X - kPSMTabBarIndicatorWidth, MARGIN_Y); - if(([self state] == NSOnState) && ([[_controlView styleName] isEqualToString:@"Metal"])) - indicatorPoint.y += 1.0; - [pi drawAtPoint:indicatorPoint fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:0.7]; + NSPoint indicatorPoint = self.indicator.frame.origin; + [piImage drawAtPoint:indicatorPoint + fromRect:NSZeroRect + operation:NSCompositeSourceOver + fraction:1.0]; [returnImage unlockFocus]; - [pi release]; + [piImage release]; } return returnImage; } -#pragma mark - -#pragma mark Archiving +#pragma mark - NSCoding - (void)encodeWithCoder:(NSCoder *)aCoder { [super encodeWithCoder:aCoder]; @@ -408,4 +387,146 @@ - (id)initWithCoder:(NSCoder *)aDecoder { return self; } +#pragma mark - Accessibility + +- (BOOL)accessibilityIsIgnored { + return NO; +} + +- (NSArray*)accessibilityAttributeNames { + static NSArray *attributes; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + NSSet *set = [NSSet setWithArray:[super accessibilityAttributeNames]]; + set = [set setByAddingObjectsFromArray:@[ NSAccessibilityTitleAttribute, + NSAccessibilityValueAttribute ]]; + attributes = [[set allObjects] retain]; + }); + return attributes; +} + + +- (id)accessibilityAttributeValue:(NSString *)attribute { + id attributeValue = nil; + + if ([attribute isEqualToString: NSAccessibilityRoleAttribute]) { + attributeValue = NSAccessibilityRadioButtonRole; + } else if ([attribute isEqualToString: NSAccessibilityHelpAttribute]) { + id controlViewDelegate = [[self psmTabControlView] delegate]; + if ([controlViewDelegate respondsToSelector:@selector(accessibilityStringForTabView:objectCount:)]) { + attributeValue = [NSString stringWithFormat:@"%@, %i %@", + [self stringValue], [self count], + [controlViewDelegate accessibilityStringForTabView:[[self psmTabControlView] tabView] objectCount:[self count]]]; + } else { + attributeValue = [self stringValue]; + } + } else if ([attribute isEqualToString:NSAccessibilityPositionAttribute] || + [attribute isEqualToString:NSAccessibilitySizeAttribute]) { + NSRect rect = [self frame]; + rect = [[self controlView] convertRect:rect toView:nil]; + rect = [[[self controlView] window] convertRectToScreen:rect]; + if ([attribute isEqualToString:NSAccessibilityPositionAttribute]) { + attributeValue = [NSValue valueWithPoint:rect.origin]; + } else { + attributeValue = [NSValue valueWithSize:rect.size]; + } + } else if ([attribute isEqualToString:NSAccessibilityTitleAttribute]) { + attributeValue = [self stringValue]; + } else if ([attribute isEqualToString: NSAccessibilityValueAttribute]) { + attributeValue = [NSNumber numberWithBool:([self tabState] == 2)]; + } else { + attributeValue = [super accessibilityAttributeValue:attribute]; + } + + return attributeValue; +} + +- (NSArray *)accessibilityActionNames { + return @[ NSAccessibilityPressAction ]; +} + +- (NSString *)accessibilityActionDescription:(NSString *)action { + return NSAccessibilityActionDescription(action); +} + +- (void)accessibilityPerformAction:(NSString *)action { + if ([action isEqualToString:NSAccessibilityPressAction]) { + // this tab was selected + [[self psmTabControlView] performSelector:@selector(tabClick:) + withObject:self]; + } +} + +- (id)accessibilityHitTest:(NSPoint)point { + return NSAccessibilityUnignoredAncestor(self); +} + +- (id)accessibilityFocusedUIElement:(NSPoint)point { + return NSAccessibilityUnignoredAncestor(self); +} + +#pragma mark - iTerm2 Additions + +- (void)updateForStyle { + _indicator.light = [self psmTabControlView].style.useLightControls; +} + +- (void)updateHighlight { + if (self.isHighlighted) { + NSPoint mouseLocationInScreenCoords = [NSEvent mouseLocation]; + NSRect rectInScreenCoords; + rectInScreenCoords.origin = mouseLocationInScreenCoords; + rectInScreenCoords.size = NSZeroSize; + NSPoint mouseLocationInWindowCoords = [self.controlView.window convertRectFromScreen:rectInScreenCoords].origin; + NSPoint mouseLocationInViewCoords = [self.controlView convertPoint:mouseLocationInWindowCoords + fromView:nil]; + if (!NSPointInRect(mouseLocationInViewCoords, self.frame)) { + self.highlighted = NO; + } + } +} + +- (BOOL)isHighlighted { + return _highlighted; +} + +- (void)setHighlighted:(BOOL)highlighted { + // Don't call -[super setHighlighted:] because it redraws the whole control. + BOOL wasHighlighted = self.isHighlighted; + _highlighted = highlighted; + if (highlighted != wasHighlighted) { + if ([self highlightAnimationDuration] > 0) { + _highlightChangeTime = [NSDate timeIntervalSinceReferenceDate]; + [NSTimer scheduledTimerWithTimeInterval:1 / 60.0 + target:self + selector:@selector(redrawHighlight:) + userInfo:self.controlView + repeats:YES]; + } else { + [self.controlView setNeedsDisplayInRect:self.frame]; + } + } +} + +- (CGFloat)highlightAnimationDuration { + if ([(PSMTabBarControl *)_controlView orientation] == PSMTabBarHorizontalOrientation) { + return 0.2; + } else { + return 0; + } +} + +- (void)redrawHighlight:(NSTimer *)timer { + [self.controlView setNeedsDisplayInRect:self.frame]; + if ([NSDate timeIntervalSinceReferenceDate] - _highlightChangeTime > [self highlightAnimationDuration]) { + [timer invalidate]; + } +} + +#pragma mark - PSMProgressIndicatorDelegate + +- (void)progressIndicatorNeedsUpdate { + return [_controlView progressIndicatorNeedsUpdate]; +} + @end diff --git a/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.h b/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.h index 4b320f4c8d..9f7873548a 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.h +++ b/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.h @@ -6,150 +6,220 @@ // Copyright 2005 Positive Spin Media. All rights reserved. // -/* - This view provides a control interface to manage a regular NSTabView. It looks and works like the tabbed browsing interface of many popular browsers. - */ - #import +#import "PSMProgressIndicator.h" + +extern NSString *const kPSMModifierChangedNotification; +extern NSString *const kPSMTabModifierKey; // Key for user info dict in modifier changed notification + +extern NSString *const PSMTabDragDidEndNotification; +extern NSString *const PSMTabDragDidBeginNotification; + +extern const CGFloat kPSMTabBarControlHeight; -#if !defined(MAC_OS_X_VERSION_10_12) || \ - MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12 -# define NSCompositingOperationSourceOver NSCompositeSourceOver -# define NSCompositingOperationSourceAtop NSCompositeSourceAtop -# define NSTextAlignmentCenter NSCenterTextAlignment -#endif -#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_10 -# define kPSMTabBarControlHeight 25 -#else -# define kPSMTabBarControlHeight 22 -#endif // internal cell border -#define MARGIN_X 6 -#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_10 -# define MARGIN_Y 5 -#else -# define MARGIN_Y 3 -#endif +extern const CGFloat kSPMTabBarCellInternalXMargin; + // padding between objects -#define kPSMTabBarCellPadding 4 +extern const CGFloat kPSMTabBarCellPadding; +extern const CGFloat kPSMTabBarCellIconPadding; // fixed size objects -#define kPSMMinimumTitleWidth 30 -#define kPSMTabBarIndicatorWidth 16.0 -#define kPSMTabBarIconWidth 16.0 -#define kPSMHideAnimationSteps 2.0 +extern const CGFloat kPSMMinimumTitleWidth; +extern const CGFloat kPSMTabBarIndicatorWidth; +extern const CGFloat kPSMTabBarIconWidth; +extern const CGFloat kPSMHideAnimationSteps; + +// Value used in _currentStep to indicate that resizing operation is not in progress +extern const NSInteger kPSMIsNotBeingResized; + +// Value used in _currentStep when a resizing operation has just been started +extern const NSInteger kPSMStartResizeAnimation; @class PSMOverflowPopUpButton; @class PSMRolloverButton; @class PSMTabBarCell; +@class PSMTabBarControl; @protocol PSMTabStyle; +// Tab views controlled by the tab bar may expect this protocol to be conformed to by their delegate. +@protocol PSMTabViewDelegate +- (void)tabView:(NSTabView *)tabView willRemoveTabViewItem:(NSTabViewItem *)tabViewItem; +- (void)tabView:(NSTabView *)tabView willAddTabViewItem:(NSTabViewItem *)tabViewItem; +- (void)tabView:(NSTabView *)tabView willInsertTabViewItem:(NSTabViewItem *)tabViewItem atIndex:(int)index; +- (void)tabView:(NSTabView *)tabView doubleClickTabViewItem:(NSTabViewItem *)tabViewItem; +- (NSDragOperation)tabView:(NSTabView *)tabView draggingEnteredTabBarForSender:(id)sender; +- (BOOL)tabView:(NSTabView *)tabView shouldAcceptDragFromSender:(id)sender; +- (NSTabViewItem *)tabView:(NSTabView *)tabView unknownObjectWasDropped:(id )sender; +@end + +// These methods are KVO-observed. +@protocol PSMTabBarControlRepresentedObjectIdentifierProtocol +@optional +- (BOOL)isProcessing; +- (void)setIsProcessing:(BOOL)processing; +- (NSImage *)icon; +- (void)setIcon:(NSImage *)icon; +- (int)objectCount; +- (void)setObjectCount:(int)objectCount; +@end + +@protocol PSMTabBarControlDelegate +// Set object count, icon, etc. +- (void)tabView:(NSTabView *)tabView updateStateForTabViewItem:(NSTabViewItem *)tabViewItem; +@optional +- (NSDragOperation)tabView:(NSTabView *)aTabView + draggingEnteredTabBarForSender:(id)tabView; +- (BOOL)tabView:(NSTabView *)tabView shouldAcceptDragFromSender:(id)sender; + +//Standard NSTabView methods +- (BOOL)tabView:(NSTabView *)aTabView shouldCloseTabViewItem:(NSTabViewItem *)tabViewItem; +- (void)tabView:(NSTabView *)aTabView didCloseTabViewItem:(NSTabViewItem *)tabViewItem; + +//"Spring-loaded" tabs methods +- (NSArray *)allowedDraggedTypesForTabView:(NSTabView *)aTabView; +- (void)tabView:(NSTabView *)aTabView acceptedDraggingInfo:(id )draggingInfo onTabViewItem:(NSTabViewItem *)tabViewItem; + +//Contextual menu method +- (NSMenu *)tabView:(NSTabView *)aTabView menuForTabViewItem:(NSTabViewItem *)tabViewItem; + +//Drag and drop methods +- (BOOL)tabView:(NSTabView *)aTabView shouldDragTabViewItem:(NSTabViewItem *)tabViewItem fromTabBar:(PSMTabBarControl *)tabBarControl; +- (BOOL)tabView:(NSTabView *)aTabView shouldDropTabViewItem:(NSTabViewItem *)tabViewItem inTabBar:(PSMTabBarControl *)tabBarControl; +- (void)tabView:(NSTabView*)aTabView willDropTabViewItem:(NSTabViewItem *)tabViewItem inTabBar:(PSMTabBarControl *)tabBarControl; +- (void)tabView:(NSTabView*)aTabView didDropTabViewItem:(NSTabViewItem *)tabViewItem inTabBar:(PSMTabBarControl *)tabBarControl; + +//Tear-off tabs methods +- (NSImage *)tabView:(NSTabView *)aTabView imageForTabViewItem:(NSTabViewItem *)tabViewItem offset:(NSSize *)offset styleMask:(unsigned int *)styleMask; +- (PSMTabBarControl *)tabView:(NSTabView *)aTabView newTabBarForDraggedTabViewItem:(NSTabViewItem *)tabViewItem atPoint:(NSPoint)point; +- (void)tabView:(NSTabView *)aTabView closeWindowForLastTabViewItem:(NSTabViewItem *)tabViewItem; + +//Overflow menu validation +- (BOOL)tabView:(NSTabView *)aTabView validateOverflowMenuItem:(NSMenuItem *)menuItem forTabViewItem:(NSTabViewItem *)tabViewItem; + +//tab bar hiding methods +- (void)tabView:(NSTabView *)aTabView tabBarDidHide:(PSMTabBarControl *)tabBarControl; +- (void)tabView:(NSTabView *)aTabView tabBarDidUnhide:(PSMTabBarControl *)tabBarControl; + +//tooltips +- (NSString *)tabView:(NSTabView *)aTabView toolTipForTabViewItem:(NSTabViewItem *)tabViewItem; + +//accessibility +- (NSString *)accessibilityStringForTabView:(NSTabView *)aTabView objectCount:(int)objectCount; + +- (void)tabView:(NSTabView *)tabView willRemoveTabViewItem:(NSTabViewItem *)tabViewItem; +- (void)tabView:(NSTabView *)tabView willAddTabViewItem:(NSTabViewItem *)tabViewItem; +- (void)tabView:(NSTabView *)tabView willInsertTabViewItem:(NSTabViewItem *)tabViewItem atIndex:(int) index; +- (void)tabViewDidChangeNumberOfTabViewItems:(NSTabView *)tabView; + +// iTerm add-on +- (void)setTabColor:(NSColor *)aColor forTabViewItem:(NSTabViewItem *) tabViewItem; +- (NSColor*)tabColorForTabViewItem:(NSTabViewItem*)tabViewItem; +- (void)tabView:(NSTabView *)tabView doubleClickTabViewItem:(NSTabViewItem *)tabViewItem; +- (void)tabViewDoubleClickTabBar:(NSTabView *)tabView; +- (void)setModifier:(int)mask; +- (void)fillPath:(NSBezierPath*)path; +- (void)closeTab:(id)identifier; +- (NSTabViewItem *)tabView:(NSTabView *)tabView unknownObjectWasDropped:(id )sender; + +@end + +typedef enum { + PSMTabBarHorizontalOrientation, + PSMTabBarVerticalOrientation +} PSMTabBarOrientation; + enum { - PSMTab_SelectedMask = 1 << 1, - PSMTab_LeftIsSelectedMask = 1 << 2, - PSMTab_RightIsSelectedMask = 1 << 3, - PSMTab_PositionLeftMask = 1 << 4, - PSMTab_PositionMiddleMask = 1 << 5, - PSMTab_PositionRightMask = 1 << 6, - PSMTab_PositionSingleMask = 1 << 7 + PSMTab_SelectedMask = 1 << 1, + PSMTab_LeftIsSelectedMask = 1 << 2, + PSMTab_RightIsSelectedMask = 1 << 3, + PSMTab_PositionLeftMask = 1 << 4, + PSMTab_PositionMiddleMask = 1 << 5, + PSMTab_PositionRightMask = 1 << 6, + PSMTab_PositionSingleMask = 1 << 7 }; -@interface PSMTabBarControl : NSControl -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= 1060) - // 10.6 has turned delegate messages into formal protocols - -#endif -{ - - // control basics - NSMutableArray *_cells; // the cells that draw the tabs - IBOutlet NSTabView *tabView; // the tab view being navigated - PSMOverflowPopUpButton *_overflowPopUpButton; // for too many tabs - PSMRolloverButton *_addTabButton; - - // drawing style - id style; - BOOL _canCloseOnlyTab; - BOOL _hideForSingleTab; - BOOL _showAddTabButton; - BOOL _sizeCellsToFit; - - // cell width - int _cellMinWidth; - int _cellMaxWidth; - int _cellOptimumWidth; - - // animation for hide/show - int _currentStep; - BOOL _isHidden; - BOOL _hideIndicators; - IBOutlet id partnerView; // gets resized when hide/show - BOOL _awakenedFromNib; - - // drag and drop - NSEvent *_lastMouseDownEvent; // keep this for dragging reference - BOOL _allowsDragBetweenWindows; - BOOL _delegateHandlingDrag; - NSDragOperation _delegateInitialDragOperation; - - // MVC help - IBOutlet id delegate; -} +enum { + PSMTab_TopTab = 0, + PSMTab_BottomTab = 1, + PSMTab_LeftTab = 2, +}; -// control characteristics -+ (NSBundle *)bundle; +// This view provides a control interface to manage a regular NSTabView. It looks and works like +// the tabbed browsing interface of many popular browsers. +@interface PSMTabBarControl : NSControl< + NSDraggingSource, + PSMProgressIndicatorDelegate, + PSMTabViewDelegate> // control configuration -- (BOOL)canCloseOnlyTab; -- (void)setCanCloseOnlyTab:(BOOL)value; -- (NSString *)styleName; -- (void)setStyleNamed:(NSString *)name; -- (BOOL)hideForSingleTab; -- (void)setHideForSingleTab:(BOOL)value; -- (BOOL)showAddTabButton; -- (void)setShowAddTabButton:(BOOL)value; -- (int)cellMinWidth; -- (void)setCellMinWidth:(int)value; -- (int)cellMaxWidth; -- (void)setCellMaxWidth:(int)value; -- (int)cellOptimumWidth; -- (void)setCellOptimumWidth:(int)value; -- (BOOL)sizeCellsToFit; -- (void)setSizeCellsToFit:(BOOL)value; -- (BOOL)allowsDragBetweenWindows; -- (void)setAllowsDragBetweenWindows:(BOOL)flag; +@property(nonatomic, assign) BOOL disableTabClose; +@property(nonatomic, assign) PSMTabBarOrientation orientation; +@property(nonatomic, retain) id style; +@property(nonatomic, assign) BOOL hideForSingleTab; +@property(nonatomic, assign) BOOL showAddTabButton; +@property(nonatomic, assign) int cellMinWidth; +@property(nonatomic, assign) int cellMaxWidth; +@property(nonatomic, assign) int cellOptimumWidth; +@property(nonatomic, assign) BOOL sizeCellsToFit; +@property(nonatomic, assign) BOOL stretchCellsToFit; +@property(nonatomic, assign) BOOL useOverflowMenu; +@property(nonatomic, assign) BOOL allowsBackgroundTabClosing; +@property(nonatomic, assign) BOOL allowsResizing; +@property(nonatomic, assign) BOOL selectsTabsOnMouseDown; +@property(nonatomic, assign) BOOL automaticallyAnimates; +@property(nonatomic, assign) int tabLocation; + +// If off (the default) always ellipsize the ends of tab titles that don't fit. +// Of on, ellipsize the start if more tabs share a prefix than a suffix. +@property(nonatomic, assign) BOOL smartTruncation; + +@property(nonatomic, retain) IBOutlet NSTabView *tabView; +@property(nonatomic, assign) id delegate; +@property(nonatomic, retain) id partnerView; +@property(nonatomic, readonly) PSMOverflowPopUpButton *overflowPopUpButton; -// tool tips -- (void)setToolTip:(NSString *)value forTabViewItem:(NSTabViewItem *)tvi; +// control characteristics ++ (NSBundle *)bundle; -// accessors -- (NSTabView *)tabView; -- (void)setTabView:(NSTabView *)view; -- (id)delegate; -- (void)setDelegate:(id)object; -- (id)partnerView; -- (void)setPartnerView:(id)view; +- (void)changeIdentifier:(id)newIdentifier atIndex:(int)theIndex; +- (void)moveTabAtIndex:(NSInteger)i1 toIndex:(NSInteger)i2; // the buttons - (PSMRolloverButton *)addTabButton; -- (PSMOverflowPopUpButton *)overflowPopUpButton; + +// tab information - (NSMutableArray *)representedTabViewItems; +- (int)numberOfVisibleTabs; // special effects - (void)hideTabBar:(BOOL)hide animate:(BOOL)animate; +- (BOOL)isTabBarHidden; -@end +// internal bindings methods also used by the tab drag assistant +- (void)bindPropertiesForCell:(PSMTabBarCell *)cell andTabViewItem:(NSTabViewItem *)item; +- (void)removeTabForCell:(PSMTabBarCell *)cell; +// iTerm add-ons +- (void)setTabColor:(NSColor *)aColor forTabViewItem:(NSTabViewItem *) tabViewItem; +- (NSColor*)tabColorForTabViewItem:(NSTabViewItem*)tabViewItem; +- (void)setModifier:(int)mask; +- (NSString*)_modifierString; +- (void)fillPath:(NSBezierPath*)path; +- (NSTabViewItem *)tabView:(NSTabView *)tabView unknownObjectWasDropped:(id )sender; + +- (NSColor *)accessoryTextColor; + +- (void)initializeStateForCell:(PSMTabBarCell *)cell; + +- (void)setIsProcessing:(BOOL)isProcessing forTabWithIdentifier:(id)identifier; +- (void)setIcon:(NSImage *)icon forTabWithIdentifier:(id)identifier; +- (void)setObjectCount:(NSInteger)objectCount forTabWithIdentifier:(id)identifier; + +- (void)setTabsHaveCloseButtons:(BOOL)tabsHaveCloseButtons; + +- (void)setStyleNamed:(NSString *)styleName; +- (NSString *)styleName; +- (void)setAllowsDragBetweenWindows:(BOOL)flag; +- (void)setToolTip:(NSString *)value forTabViewItem:(NSTabViewItem *)tvi; -@interface NSObject (TabBarControlDelegateMethods) -- (BOOL)tabView:(NSTabView *)aTabView shouldCloseTabViewItem:(NSTabViewItem *)tabViewItem; -- (void)tabView:(NSTabView *)aTabView willCloseTabViewItem:(NSTabViewItem *)tabViewItem; -- (void)tabView:(NSTabView *)aTabView didCloseTabViewItem:(NSTabViewItem *)tabViewItem; -- (void)tabView:(NSTabView *)aTabView didDragTabViewItem:(NSTabViewItem *)tabViewItem toIndex:(int)idx; - -- (NSDragOperation)tabBarControl:(PSMTabBarControl *)theTabBarControl draggingEntered:(id )sender forTabAtIndex:(NSUInteger)tabIndex; -- (NSDragOperation)tabBarControl:(PSMTabBarControl *)theTabBarControl draggingUpdated:(id )sender forTabAtIndex:(NSUInteger)tabIndex; -- (void)tabBarControl:(PSMTabBarControl *)theTabBarControl draggingExited:(id )sender forTabAtIndex:(NSUInteger)tabIndex; -- (BOOL)tabBarControl:(PSMTabBarControl *)theTabBarControl prepareForDragOperation:(id )sender forTabAtIndex:(NSUInteger)tabIndex; -- (BOOL)tabBarControl:(PSMTabBarControl *)theTabBarControl performDragOperation:(id )sender forTabAtIndex:(NSUInteger)tabIndex; -- (void)tabBarControl:(PSMTabBarControl *)theTabBarControl concludeDragOperation:(id )sender forTabAtIndex:(NSUInteger)tabIndex; @end diff --git a/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.m b/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.m index 8a04234814..84b87a7bff 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.m +++ b/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.m @@ -11,80 +11,85 @@ #import "PSMOverflowPopUpButton.h" #import "PSMRolloverButton.h" #import "PSMTabStyle.h" -#import "PSMMetalTabStyle.h" -#import "PSMUnifiedTabStyle.h" #import "PSMYosemiteTabStyle.h" #import "PSMTabDragAssistant.h" +#import "NSWindow+PSM.h" + +NSString *const kPSMModifierChangedNotification = @"kPSMModifierChangedNotification"; +NSString *const kPSMTabModifierKey = @"TabModifier"; +NSString *const PSMTabDragDidEndNotification = @"PSMTabDragDidEndNotification"; +NSString *const PSMTabDragDidBeginNotification = @"PSMTabDragDidBeginNotification"; +const CGFloat kPSMTabBarControlHeight = 24; +const CGFloat kSPMTabBarCellInternalXMargin = 6; + +const CGFloat kPSMTabBarCellPadding = 4; +const CGFloat kPSMTabBarCellIconPadding = 0; +// fixed size objects +const CGFloat kPSMMinimumTitleWidth = 30; +const CGFloat kPSMTabBarIndicatorWidth = 16.0; +const CGFloat kPSMTabBarIconWidth = 16.0; +const CGFloat kPSMHideAnimationSteps = 2.0; + +// Value used in _currentStep to indicate that resizing operation is not in progress +const NSInteger kPSMIsNotBeingResized = -1; + +// Value used in _currentStep when a resizing operation has just been started +const NSInteger kPSMStartResizeAnimation = 0; + +@interface PSMTabBarControl () +@end -@interface PSMTabBarControl (Private) -// characteristics -- (float)availableCellWidth; -- (NSRect)genericCellRect; - - // constructor/destructor -- (void)initAddedProperties; -- (void)dealloc; - - // accessors -- (NSEvent *)lastMouseDownEvent; -- (void)setLastMouseDownEvent:(NSEvent *)event; - - // contents -- (void)addTabViewItem:(NSTabViewItem *)item; -- (void)removeTabForCell:(PSMTabBarCell *)cell; - - // draw -- (void)update; - - // actions -- (void)overflowMenuAction:(id)sender; -- (void)closeTabClick:(id)sender; -- (void)tabClick:(id)sender; -- (void)tabNothing:(id)sender; -- (void)frameDidChange:(NSNotification *)notification; -- (void)windowDidMove:(NSNotification *)aNotification; -- (void)windowStatusDidChange:(NSNotification *)notification; - - // NSTabView delegate -- (void)tabView:(NSTabView *)tabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem; -- (BOOL)tabView:(NSTabView *)tabView shouldSelectTabViewItem:(NSTabViewItem *)tabViewItem; -- (void)tabView:(NSTabView *)tabView willSelectTabViewItem:(NSTabViewItem *)tabViewItem; -- (void)tabViewDidChangeNumberOfTabViewItems:(NSTabView *)tabView; - - // archiving -- (void)encodeWithCoder:(NSCoder *)aCoder; -- (id)initWithCoder:(NSCoder *)aDecoder; - - // convenience -- (id)cellForPoint:(NSPoint)point cellFrame:(NSRectPointer)outFrame; -- (NSUInteger)indexOfCellAtPoint:(NSPoint)point; -- (NSUInteger)indexOfCellAtPoint:(NSPoint)point cellFrame:(NSRectPointer)outFrame; -- (PSMTabBarCell *)lastVisibleTab; -- (int)numberOfVisibleTabs; +@implementation PSMTabBarControl { + // control basics + NSMutableArray *_cells; // the cells that draw the tabs + PSMOverflowPopUpButton *_overflowPopUpButton; // for too many tabs + PSMRolloverButton *_addTabButton; -@end + // drawing style + int _resizeAreaCompensation; + NSTimer *_animationTimer; + float _animationDelta; + + // vertical tab resizing + BOOL _resizing; + + // animation for hide/show + int _currentStep; + BOOL _isHidden; + BOOL _hideIndicators; + IBOutlet id partnerView; // gets resized when hide/show + BOOL _awakenedFromNib; + int _tabBarWidth; + + // drag and drop + NSEvent *_lastMouseDownEvent; // keep this for dragging reference + NSEvent *_lastMiddleMouseDownEvent; + BOOL _didDrag; + BOOL _closeClicked; + + // iTerm2 additions + int _modifier; + BOOL _hasCloseButton; +} -@implementation PSMTabBarControl #pragma mark - #pragma mark Characteristics -+ (NSBundle *)bundle; -{ + ++ (NSBundle *)bundle { static NSBundle *bundle = nil; if (!bundle) bundle = [NSBundle bundleForClass:[PSMTabBarControl class]]; return bundle; } -- (float)availableCellWidth -{ +- (float)availableCellWidth { float width = [self frame].size.width; - width = width - [style leftMarginForTabBarControl] - [style rightMarginForTabBarControl]; + width = width - [_style leftMarginForTabBarControl] - [_style rightMarginForTabBarControl] - _resizeAreaCompensation; return width; } -- (NSRect)genericCellRect -{ - NSRect aRect=[self frame]; - aRect.origin.x = [style leftMarginForTabBarControl]; +- (NSRect)genericCellRect { + NSRect aRect = [self frame]; + aRect.origin.x = [_style leftMarginForTabBarControl]; aRect.origin.y = 0.0; aRect.size.width = [self availableCellWidth]; aRect.size.height = kPSMTabBarControlHeight; @@ -94,107 +99,118 @@ - (NSRect)genericCellRect #pragma mark - #pragma mark Constructor/destructor -- (void)initAddedProperties -{ - _cells = [[NSMutableArray alloc] initWithCapacity:10]; - - // default config - _allowsDragBetweenWindows = YES; - _delegateHandlingDrag = NO; - _canCloseOnlyTab = NO; - _showAddTabButton = NO; - _hideForSingleTab = NO; - _sizeCellsToFit = NO; - _isHidden = NO; - _hideIndicators = NO; - _awakenedFromNib = NO; - _cellMinWidth = 100; - _cellMaxWidth = 280; - _cellOptimumWidth = 130; - style = [[PSMMetalTabStyle alloc] init]; - - // the overflow button/menu - NSRect overflowButtonRect = NSMakeRect([self frame].size.width - [style rightMarginForTabBarControl] + 1, 0, [style rightMarginForTabBarControl] - 1, [self frame].size.height); - _overflowPopUpButton = [[PSMOverflowPopUpButton alloc] initWithFrame:overflowButtonRect pullsDown:YES]; - if(_overflowPopUpButton){ - // configure - [_overflowPopUpButton setAutoresizingMask:NSViewNotSizable|NSViewMinXMargin]; - } - - // new tab button - NSRect addTabButtonRect = NSMakeRect([self frame].size.width - [style rightMarginForTabBarControl] + 1, 3.0, 16.0, 16.0); - _addTabButton = [[PSMRolloverButton alloc] initWithFrame:addTabButtonRect]; - if(_addTabButton){ - NSImage *newButtonImage = [style addTabButtonImage]; - if(newButtonImage) - [_addTabButton setUsualImage:newButtonImage]; - newButtonImage = [style addTabButtonPressedImage]; - if(newButtonImage) - [_addTabButton setAlternateImage:newButtonImage]; - newButtonImage = [style addTabButtonRolloverImage]; - if(newButtonImage) - [_addTabButton setRolloverImage:newButtonImage]; - [_addTabButton setTitle:@""]; - [_addTabButton setImagePosition:NSImageOnly]; - [_addTabButton setButtonType:NSMomentaryChangeButton]; - [_addTabButton setBordered:NO]; - [_addTabButton setBezelStyle:NSShadowlessSquareBezelStyle]; - if(_showAddTabButton){ - [_addTabButton setHidden:NO]; - } else { - [_addTabButton setHidden:YES]; - } - [_addTabButton setNeedsDisplay:YES]; - } -} - - (id)initWithFrame:(NSRect)frame { self = [super initWithFrame:frame]; if (self) { // Initialization - [self initAddedProperties]; - [self registerForDraggedTypes:[NSArray arrayWithObjects: @"PSMTabBarControlItemPBType", nil]]; + _cells = [[NSMutableArray alloc] initWithCapacity:10]; + _animationTimer = nil; + + // default config + _currentStep = kPSMIsNotBeingResized; + _orientation = PSMTabBarHorizontalOrientation; + _useOverflowMenu = YES; + _allowsBackgroundTabClosing = YES; + _allowsResizing = YES; + _cellMinWidth = 100; + _cellMaxWidth = 280; + _cellOptimumWidth = 130; + _hasCloseButton = YES; + _tabLocation = PSMTab_TopTab; + _style = [[PSMYosemiteTabStyle alloc] init]; + + // the overflow button/menu + NSRect overflowButtonRect = NSMakeRect([self frame].size.width - [_style rightMarginForTabBarControl] + 1, 0, [_style rightMarginForTabBarControl] - 1, [self frame].size.height); + _overflowPopUpButton = [[PSMOverflowPopUpButton alloc] initWithFrame:overflowButtonRect pullsDown:YES]; + if (_overflowPopUpButton){ + // configure + [_overflowPopUpButton setAutoresizingMask:NSViewNotSizable|NSViewMinXMargin]; + [[_overflowPopUpButton cell] accessibilitySetOverrideValue:NSLocalizedStringFromTableInBundle(@"More tabs", @"iTerm", [NSBundle bundleForClass:[self class]], @"VoiceOver label for the button displaying menu of additional overflown tabs on click") forAttribute:NSAccessibilityDescriptionAttribute]; + } + + // new tab button + NSRect addTabButtonRect = NSMakeRect([self frame].size.width - [_style rightMarginForTabBarControl] + 1, 3.0, 16.0, 16.0); + _addTabButton = [[PSMRolloverButton alloc] initWithFrame:addTabButtonRect]; + if (_addTabButton){ + NSImage *newButtonImage = [_style addTabButtonImage]; + if (newButtonImage) + [_addTabButton setUsualImage:newButtonImage]; + newButtonImage = [_style addTabButtonPressedImage]; + if (newButtonImage) + [_addTabButton setAlternateImage:newButtonImage]; + newButtonImage = [_style addTabButtonRolloverImage]; + if (newButtonImage) + [_addTabButton setRolloverImage:newButtonImage]; + [_addTabButton setTitle:@""]; + [_addTabButton setImagePosition:NSImageOnly]; + [_addTabButton setButtonType:NSMomentaryChangeButton]; + [_addTabButton setBordered:NO]; + [_addTabButton setBezelStyle:NSShadowlessSquareBezelStyle]; + if (_showAddTabButton){ + [_addTabButton setHidden:NO]; + } else { + [_addTabButton setHidden:YES]; + } + [_addTabButton setNeedsDisplay:YES]; + } + + [self registerForDraggedTypes:[NSArray arrayWithObjects:@"com.iterm2.psm.controlitem", nil]]; + + // resize + [self setPostsFrameChangedNotifications:YES]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(frameDidChange:) name:NSViewFrameDidChangeNotification object:self]; + + // window status + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowStatusDidChange:) name:NSWindowDidBecomeKeyNotification object:[self window]]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowStatusDidChange:) name:NSWindowDidResignKeyNotification object:[self window]]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidMove:) name:NSWindowDidMoveNotification object:[self window]]; + + // modifier for changing tabs changed (iTerm2 addon) + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(modifierChanged:) + name:kPSMModifierChangedNotification + object:nil]; } [self setTarget:self]; return self; } -- (void)dealloc -{ +- (void)dealloc { + [[NSNotificationCenter defaultCenter] removeObserver:self]; + + // Remove bindings. + NSArray *temp = [[_cells copy] autorelease]; + for (PSMTabBarCell *cell in temp) { + [cell retain]; + [self removeTabForCell:cell]; + cell.controlView = nil; + [cell release]; + } + [_overflowPopUpButton release]; [_cells release]; - [tabView release]; + [_tabView release]; [_addTabButton release]; [partnerView release]; [_lastMouseDownEvent release]; - [style release]; - [delegate release]; - + [_lastMiddleMouseDownEvent release]; + [_style release]; + [self unregisterDraggedTypes]; - + [super dealloc]; } - (void)awakeFromNib { // build cells from existing tab view items - NSArray *existingItems = [tabView tabViewItems]; - NSEnumerator *e = [existingItems objectEnumerator]; - NSTabViewItem *item; - while(item = [e nextObject]){ - if(![[self representedTabViewItems] containsObject:item]) + NSArray *existingItems = [_tabView tabViewItems]; + for (NSTabViewItem *item in existingItems) { + if (![[self representedTabViewItems] containsObject:item]) { [self addTabViewItem:item]; + } } - - // resize - [self setPostsFrameChangedNotifications:YES]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(frameDidChange:) name:NSViewFrameDidChangeNotification object:self]; - - // window status - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowStatusDidChange:) name:NSWindowDidBecomeKeyNotification object:[self window]]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowStatusDidChange:) name:NSWindowDidResignKeyNotification object:[self window]]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidMove:) name:NSWindowDidMoveNotification object:[self window]]; } @@ -218,394 +234,438 @@ - (void)setLastMouseDownEvent:(NSEvent *)event _lastMouseDownEvent = event; } -- (id)delegate +- (NSEvent *)lastMiddleMouseDownEvent { - return delegate; + return _lastMiddleMouseDownEvent; } -- (void)setDelegate:(id)object +- (void)setLastMiddleMouseDownEvent:(NSEvent *)event { - [object retain]; - [delegate release]; - delegate = object; + [event retain]; + [_lastMiddleMouseDownEvent release]; + _lastMiddleMouseDownEvent = event; } -- (NSTabView *)tabView -{ - return tabView; -} +- (void)setDelegate:(id)object { + _delegate = object; -- (void)setTabView:(NSTabView *)view -{ - [view retain]; - [tabView release]; - tabView = view; -} + NSMutableArray *types = [NSMutableArray arrayWithObject:@"com.iterm2.psm.controlitem"]; -- (id)psmTabStyle -{ - return style; + //Update the allowed drag types + if ([[self delegate] respondsToSelector:@selector(allowedDraggedTypesForTabView:)]) { + [types addObjectsFromArray:[[self delegate] allowedDraggedTypesForTabView:_tabView]]; + } + [self unregisterDraggedTypes]; + [self registerForDraggedTypes:types]; } -- (NSString *)styleName -{ - return [style name]; +- (NSString *)styleName { + return [_style name]; } -- (void)setStyleNamed:(NSString *)name -{ - [style release]; - if([name isEqualToString:@"Unified"]){ - style = [[PSMUnifiedTabStyle alloc] init]; - } else if([name isEqualToString:@"Yosemite"]){ - style = [[PSMYosemiteTabStyle alloc] init]; - } else { - style = [[PSMMetalTabStyle alloc] init]; - } - +- (void)setStyle:(id )newStyle { + [_style autorelease]; + _style = [newStyle retain]; + // restyle add tab button - if(_addTabButton){ - NSImage *newButtonImage = [style addTabButtonImage]; - if(newButtonImage) + if (_addTabButton){ + NSImage *newButtonImage = [_style addTabButtonImage]; + if (newButtonImage) { [_addTabButton setUsualImage:newButtonImage]; - newButtonImage = [style addTabButtonPressedImage]; - if(newButtonImage) + } + newButtonImage = [_style addTabButtonPressedImage]; + if (newButtonImage) { [_addTabButton setAlternateImage:newButtonImage]; - newButtonImage = [style addTabButtonRolloverImage]; - if(newButtonImage) + } + newButtonImage = [_style addTabButtonRolloverImage]; + if (newButtonImage) { [_addTabButton setRolloverImage:newButtonImage]; + } } - - [self update]; -} -- (BOOL)canCloseOnlyTab -{ - return _canCloseOnlyTab; + [self update:_automaticallyAnimates]; } -- (void)setCanCloseOnlyTab:(BOOL)value -{ - _canCloseOnlyTab = value; - if ([_cells count] == 1) { - [self update]; - } -} +- (void)setOrientation:(PSMTabBarOrientation)value { + PSMTabBarOrientation lastOrientation = _orientation; + _orientation = value; -- (BOOL)allowsDragBetweenWindows -{ - return _allowsDragBetweenWindows; -} + if (_tabBarWidth < 10) { + _tabBarWidth = 120; + } -- (void)setAllowsDragBetweenWindows:(BOOL)flag -{ - _allowsDragBetweenWindows = flag; + if (lastOrientation != _orientation) { + [self update]; + } } -- (BOOL)hideForSingleTab -{ - return _hideForSingleTab; +- (void)setDisableTabClose:(BOOL)value { + _disableTabClose = value; + [self update:_automaticallyAnimates]; } -- (void)setHideForSingleTab:(BOOL)value -{ +- (void)setHideForSingleTab:(BOOL)value { _hideForSingleTab = value; [self update]; } -- (BOOL)showAddTabButton -{ - return _showAddTabButton; -} - -- (void)setShowAddTabButton:(BOOL)value -{ +- (void)setShowAddTabButton:(BOOL)value { _showAddTabButton = value; [self update]; } -- (int)cellMinWidth -{ - return _cellMinWidth; -} - -- (void)setCellMinWidth:(int)value -{ +- (void)setCellMinWidth:(int)value { _cellMinWidth = value; - [self update]; + [self update:_automaticallyAnimates]; } -- (int)cellMaxWidth -{ - return _cellMaxWidth; -} - -- (void)setCellMaxWidth:(int)value -{ +- (void)setCellMaxWidth:(int)value { _cellMaxWidth = value; - [self update]; + [self update:_automaticallyAnimates]; } -- (int)cellOptimumWidth -{ - return _cellOptimumWidth; +- (void)setCellOptimumWidth:(int)value { + _cellOptimumWidth = value; + [self update:_automaticallyAnimates]; } -- (void)setCellOptimumWidth:(int)value -{ - _cellOptimumWidth = value; - [self update]; +- (void)setSizeCellsToFit:(BOOL)value { + _sizeCellsToFit = value; + [self update:_automaticallyAnimates]; } -- (BOOL)sizeCellsToFit -{ - return _sizeCellsToFit; +- (void)setStretchCellsToFit:(BOOL)value { + _stretchCellsToFit = value; + [self update:_automaticallyAnimates]; } -- (void)setSizeCellsToFit:(BOOL)value -{ - _sizeCellsToFit = value; +- (void)setUseOverflowMenu:(BOOL)value { + _useOverflowMenu = value; [self update]; } -- (PSMRolloverButton *)addTabButton -{ +- (PSMRolloverButton *)addTabButton { return _addTabButton; } -- (PSMOverflowPopUpButton *)overflowPopUpButton -{ - return _overflowPopUpButton; -} - -#pragma mark - -#pragma mark Tool tips +- (void)setTabLocation:(int)value { + _tabLocation = value; + switch (value) { + case PSMTab_TopTab: + case PSMTab_BottomTab: + [self setOrientation:PSMTabBarHorizontalOrientation]; + break; -- (void)setToolTip:(NSString *)value forTabViewItem:(NSTabViewItem *)tvi -{ - int i, cellCount = [_cells count]; - for (i = 0; i < cellCount; i++) { - PSMTabBarCell *cell = [_cells objectAtIndex:i]; - if ([cell representedObject] == tvi) - [cell setToolTip:value]; + case PSMTab_LeftTab: + [self setOrientation:PSMTabBarVerticalOrientation]; + break; } +} +- (void)setAllowsBackgroundTabClosing:(BOOL)value { + _allowsBackgroundTabClosing = value; [self update]; } - #pragma mark - #pragma mark Functionality -- (void)addTabViewItem:(NSTabViewItem *)item -{ + +- (NSLineBreakMode)truncationStyle { + if (_cells.count <= 1 || !self.smartTruncation) { + return NSLineBreakByTruncatingTail; + } + NSCountedSet *prefixCounts = [[[NSCountedSet alloc] init] autorelease]; + NSCountedSet *suffixCounts = [[[NSCountedSet alloc] init] autorelease]; + NSMutableSet *uniqueTitles = [NSMutableSet set]; + static NSInteger const kPrefixOrSuffixLength = 5; + for (PSMTabBarCell *cell in _cells) { + NSString *title = [cell title]; + if (title.length < kPrefixOrSuffixLength) { + continue; + } + [uniqueTitles addObject:title]; + NSString *prefix = [title substringToIndex:kPrefixOrSuffixLength]; + NSString *suffix = [title substringFromIndex:(NSInteger)title.length - kPrefixOrSuffixLength]; + + [prefixCounts addObject:prefix]; + [suffixCounts addObject:suffix]; + } + if (uniqueTitles.count == 0) { + return NSLineBreakByTruncatingTail; + } + + if (prefixCounts.count >= suffixCounts.count) { + return NSLineBreakByTruncatingTail; + } else { + return NSLineBreakByTruncatingHead; + } +} + +- (void)addTabViewItem:(NSTabViewItem *)item atIndex:(NSUInteger)i { // create cell PSMTabBarCell *cell = [[PSMTabBarCell alloc] initWithControlView:self]; + cell.truncationStyle = [self truncationStyle]; [cell setRepresentedObject:item]; - // bind the indicator to the represented object's status (if it exists) - [[cell indicator] setHidden:YES]; - if([item identifier] != nil){ - if([[item identifier] respondsToSelector:@selector(content)]){ - if([[[[cell representedObject] identifier] performSelector:@selector(content)] respondsToSelector:@selector(isProcessing)]){ - NSMutableDictionary *bindingOptions = [NSMutableDictionary dictionary]; - [bindingOptions setObject:NSNegateBooleanTransformerName forKey:@"NSValueTransformerName"]; - [[cell indicator] bind:@"animate" toObject:[item identifier] withKeyPath:@"selection.isProcessing" options:nil]; - [[cell indicator] bind:@"hidden" toObject:[item identifier] withKeyPath:@"selection.isProcessing" options:bindingOptions]; - [[item identifier] addObserver:self forKeyPath:@"selection.isProcessing" options:0 context:nil]; - } - } - } - - // bind for the existence of an icon - [cell setHasIcon:NO]; - if([item identifier] != nil){ - if([[item identifier] respondsToSelector:@selector(content)]){ - if([[[[cell representedObject] identifier] performSelector:@selector(content)] respondsToSelector:@selector(icon)]){ - NSMutableDictionary *bindingOptions = [NSMutableDictionary dictionary]; - [bindingOptions setObject:NSIsNotNilTransformerName forKey:@"NSValueTransformerName"]; - [cell bind:@"hasIcon" toObject:[item identifier] withKeyPath:@"selection.icon" options:bindingOptions]; - [[item identifier] addObserver:self forKeyPath:@"selection.icon" options:0 context:nil]; - } - } - } - - // bind for the existence of a counter - [cell setCount:0]; - if([item identifier] != nil){ - if([[item identifier] respondsToSelector:@selector(content)]){ - if([[[[cell representedObject] identifier] performSelector:@selector(content)] respondsToSelector:@selector(objectCount)]){ - [cell bind:@"count" toObject:[item identifier] withKeyPath:@"selection.objectCount" options:nil]; - [[item identifier] addObserver:self forKeyPath:@"selection.objectCount" options:0 context:nil]; - } - } - } - - // bind my string value to the label on the represented tab - [cell bind:@"title" toObject:item withKeyPath:@"label" options:nil]; - + [cell setModifierString:[self _modifierString]]; + // add to collection - [_cells addObject:cell]; + [_cells insertObject:cell atIndex:i]; + + // bind it up + [self initializeStateForCell:cell]; + [self bindPropertiesForCell:cell andTabViewItem:item]; [cell release]; - if([_cells count] == [tabView numberOfTabViewItems]){ - [self update]; // don't update unless all are accounted for! - } } -- (void)removeTabForCell:(PSMTabBarCell *)cell -{ +- (void)addTabViewItem:(NSTabViewItem *)item { + [self addTabViewItem:item atIndex:[_cells count]]; +} + +- (void)removeTabForCell:(PSMTabBarCell *)cell { // unbind - [[cell indicator] unbind:@"animate"]; - [[cell indicator] unbind:@"hidden"]; - [cell unbind:@"hasIcon"]; [cell unbind:@"title"]; - [cell unbind:@"count"]; - + // remove indicator - if([[self subviews] containsObject:[cell indicator]]){ + if ([[self subviews] containsObject:[cell indicator]]) { + [[cell indicator] setDelegate:nil]; [[cell indicator] removeFromSuperview]; } // remove tracking [[NSNotificationCenter defaultCenter] removeObserver:cell]; - if([cell closeButtonTrackingTag] != 0){ + + if ([cell closeButtonTrackingTag] != 0) { [self removeTrackingRect:[cell closeButtonTrackingTag]]; + [cell setCloseButtonTrackingTag:0]; } - if([cell cellTrackingTag] != 0){ + if ([cell cellTrackingTag] != 0) { [self removeTrackingRect:[cell cellTrackingTag]]; + [cell setCellTrackingTag:0]; } + [self removeAllToolTips]; // pull from collection [_cells removeObject:cell]; - - [self update]; -} - -- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context -{ - // the progress indicator, label, icon, or count has changed - must redraw - [self update]; } #pragma mark - #pragma mark Hide/Show -- (void)hideTabBar:(BOOL)hide animate:(BOOL)animate -{ - if(!_awakenedFromNib) - return; - if(_isHidden && hide) +- (void)hideTabBar:(BOOL)hide animate:(BOOL)animate { + if (!_awakenedFromNib || (_isHidden && hide) || (!_isHidden && !hide) || (_currentStep != kPSMIsNotBeingResized)) { return; - if(!_isHidden && !hide) - return; - + } + [[self subviews] makeObjectsPerformSelector:@selector(removeFromSuperview)]; _hideIndicators = YES; - - NSTimer *animationTimer; + _isHidden = hide; _currentStep = 0; - if(!animate) + if (!animate) _currentStep = (int)kPSMHideAnimationSteps; - - float partnerOriginalHeight, partnerOriginalY, myOriginalHeight, myOriginalY, partnerTargetHeight, partnerTargetY, myTargetHeight, myTargetY; - - // current (original) values - myOriginalHeight = [self frame].size.height; - myOriginalY = [self frame].origin.y; - if(partnerView){ - partnerOriginalHeight = [partnerView frame].size.height; - partnerOriginalY = [partnerView frame].origin.y; - } else { - partnerOriginalHeight = [[self window] frame].size.height; - partnerOriginalY = [[self window] frame].origin.y; - } - + + float partnerOriginalSize, partnerOriginalOrigin, myOriginalSize, myOriginalOrigin, partnerTargetSize, partnerTargetOrigin, myTargetSize, myTargetOrigin; + // target values for partner - if(partnerView){ - // above or below me? - if((myOriginalY - 22) > partnerOriginalY){ - // partner is below me - if(_isHidden){ - // I'm shrinking - myTargetY = myOriginalY + 21; - myTargetHeight = myOriginalHeight - 21; - partnerTargetY = partnerOriginalY; - partnerTargetHeight = partnerOriginalHeight + 21; + if ([self orientation] == PSMTabBarHorizontalOrientation) { + // current (original) values + myOriginalSize = [self frame].size.height; + myOriginalOrigin = [self frame].origin.y; + if (partnerView) { + partnerOriginalSize = [partnerView frame].size.height; + partnerOriginalOrigin = [partnerView frame].origin.y; + } else { + partnerOriginalSize = [[self window] frame].size.height; + partnerOriginalOrigin = [[self window] frame].origin.y; + } + + if (partnerView) { + // above or below me? + if ((myOriginalOrigin - 22) > partnerOriginalOrigin) { + // partner is below me + if (_isHidden) { + // I'm shrinking + myTargetOrigin = myOriginalOrigin + 21; + myTargetSize = myOriginalSize - 21; + partnerTargetOrigin = partnerOriginalOrigin; + partnerTargetSize = partnerOriginalSize + 21; + } else { + // I'm growing + myTargetOrigin = myOriginalOrigin - 21; + myTargetSize = myOriginalSize + 21; + partnerTargetOrigin = partnerOriginalOrigin; + partnerTargetSize = partnerOriginalSize - 21; + } } else { - // I'm growing - myTargetY = myOriginalY - 21; - myTargetHeight = myOriginalHeight + 21; - partnerTargetY = partnerOriginalY; - partnerTargetHeight = partnerOriginalHeight - 21; + // partner is above me + if (_isHidden) { + // I'm shrinking + myTargetOrigin = myOriginalOrigin; + myTargetSize = myOriginalSize - 21; + partnerTargetOrigin = partnerOriginalOrigin - 21; + partnerTargetSize = partnerOriginalSize + 21; + } else { + // I'm growing + myTargetOrigin = myOriginalOrigin; + myTargetSize = myOriginalSize + 21; + partnerTargetOrigin = partnerOriginalOrigin + 21; + partnerTargetSize = partnerOriginalSize - 21; + } } } else { - // partner is above me - if(_isHidden){ + // for window movement + if (_isHidden) { // I'm shrinking - myTargetY = myOriginalY; - myTargetHeight = myOriginalHeight - 21; - partnerTargetY = partnerOriginalY - 21; - partnerTargetHeight = partnerOriginalHeight + 21; + myTargetOrigin = myOriginalOrigin; + myTargetSize = myOriginalSize - 21; + partnerTargetOrigin = partnerOriginalOrigin + 21; + partnerTargetSize = partnerOriginalSize - 21; } else { // I'm growing - myTargetY = myOriginalY; - myTargetHeight = myOriginalHeight + 21; - partnerTargetY = partnerOriginalY + 21; - partnerTargetHeight = partnerOriginalHeight - 21; + myTargetOrigin = myOriginalOrigin; + myTargetSize = myOriginalSize + 21; + partnerTargetOrigin = partnerOriginalOrigin - 21; + partnerTargetSize = partnerOriginalSize + 21; } } } else { - // for window movement - if(_isHidden){ - // I'm shrinking - myTargetY = myOriginalY; - myTargetHeight = myOriginalHeight - 21; - partnerTargetY = partnerOriginalY + 21; - partnerTargetHeight = partnerOriginalHeight - 21; + // current (original) values + myOriginalSize = [self frame].size.width; + myOriginalOrigin = [self frame].origin.x; + if (partnerView) { + partnerOriginalSize = [partnerView frame].size.width; + partnerOriginalOrigin = [partnerView frame].origin.x; } else { - // I'm growing - myTargetY = myOriginalY; - myTargetHeight = myOriginalHeight + 21; - partnerTargetY = partnerOriginalY - 21; - partnerTargetHeight = partnerOriginalHeight + 21; + partnerOriginalSize = [[self window] frame].size.width; + partnerOriginalOrigin = [[self window] frame].origin.x; + } + + if (partnerView) { + //to the left or right? + if (myOriginalOrigin < partnerOriginalOrigin + partnerOriginalSize) { + // partner is to the left + if (_isHidden) { + // I'm shrinking + myTargetOrigin = myOriginalOrigin; + myTargetSize = 1; + partnerTargetOrigin = partnerOriginalOrigin - myOriginalSize + 1; + partnerTargetSize = partnerOriginalSize + myOriginalSize - 1; + _tabBarWidth = myOriginalSize; + } else { + // I'm growing + myTargetOrigin = myOriginalOrigin; + myTargetSize = myOriginalSize + _tabBarWidth; + partnerTargetOrigin = partnerOriginalOrigin + _tabBarWidth; + partnerTargetSize = partnerOriginalSize - _tabBarWidth; + } + } else { + // partner is to the right + if (_isHidden) { + // I'm shrinking + myTargetOrigin = myOriginalOrigin + myOriginalSize; + myTargetSize = 1; + partnerTargetOrigin = partnerOriginalOrigin; + partnerTargetSize = partnerOriginalSize + myOriginalSize; + _tabBarWidth = myOriginalSize; + } else { + // I'm growing + myTargetOrigin = myOriginalOrigin - _tabBarWidth; + myTargetSize = myOriginalSize + _tabBarWidth; + partnerTargetOrigin = partnerOriginalOrigin; + partnerTargetSize = partnerOriginalSize - _tabBarWidth; + } + } + } else { + // for window movement + if (_isHidden) { + // I'm shrinking + myTargetOrigin = myOriginalOrigin; + myTargetSize = 1; + partnerTargetOrigin = partnerOriginalOrigin + myOriginalSize - 1; + partnerTargetSize = partnerOriginalSize - myOriginalSize + 1; + _tabBarWidth = myOriginalSize; + } else { + // I'm growing + myTargetOrigin = myOriginalOrigin; + myTargetSize = _tabBarWidth; + partnerTargetOrigin = partnerOriginalOrigin - _tabBarWidth + 1; + partnerTargetSize = partnerOriginalSize + _tabBarWidth - 1; + } } } - NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:myOriginalY], @"myOriginalY", [NSNumber numberWithFloat:partnerOriginalY], @"partnerOriginalY", [NSNumber numberWithFloat:myOriginalHeight], @"myOriginalHeight", [NSNumber numberWithFloat:partnerOriginalHeight], @"partnerOriginalHeight", [NSNumber numberWithFloat:myTargetY], @"myTargetY", [NSNumber numberWithFloat:partnerTargetY], @"partnerTargetY", [NSNumber numberWithFloat:myTargetHeight], @"myTargetHeight", [NSNumber numberWithFloat:partnerTargetHeight], @"partnerTargetHeight", nil]; - animationTimer = [NSTimer scheduledTimerWithTimeInterval:(1.0/20.0) target:self selector:@selector(animateShowHide:) userInfo:userInfo repeats:YES]; + NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:myOriginalOrigin], @"myOriginalOrigin", [NSNumber numberWithFloat:partnerOriginalOrigin], @"partnerOriginalOrigin", [NSNumber numberWithFloat:myOriginalSize], @"myOriginalSize", [NSNumber numberWithFloat:partnerOriginalSize], @"partnerOriginalSize", [NSNumber numberWithFloat:myTargetOrigin], @"myTargetOrigin", [NSNumber numberWithFloat:partnerTargetOrigin], @"partnerTargetOrigin", [NSNumber numberWithFloat:myTargetSize], @"myTargetSize", [NSNumber numberWithFloat:partnerTargetSize], @"partnerTargetSize", nil]; + [NSTimer scheduledTimerWithTimeInterval:(1.0/20.0) target:self selector:@selector(animateShowHide:) userInfo:userInfo repeats:YES]; } - (void)animateShowHide:(NSTimer *)timer { // moves the frame of the tab bar and window (or partner view) linearly to hide or show the tab bar NSRect myFrame = [self frame]; - float myCurrentY = ([[[timer userInfo] objectForKey:@"myOriginalY"] floatValue] + (([[[timer userInfo] objectForKey:@"myTargetY"] floatValue] - [[[timer userInfo] objectForKey:@"myOriginalY"] floatValue]) * (_currentStep/kPSMHideAnimationSteps))); - float myCurrentHeight = ([[[timer userInfo] objectForKey:@"myOriginalHeight"] floatValue] + (([[[timer userInfo] objectForKey:@"myTargetHeight"] floatValue] - [[[timer userInfo] objectForKey:@"myOriginalHeight"] floatValue]) * (_currentStep/kPSMHideAnimationSteps))); - float partnerCurrentY = ([[[timer userInfo] objectForKey:@"partnerOriginalY"] floatValue] + (([[[timer userInfo] objectForKey:@"partnerTargetY"] floatValue] - [[[timer userInfo] objectForKey:@"partnerOriginalY"] floatValue]) * (_currentStep/kPSMHideAnimationSteps))); - float partnerCurrentHeight = ([[[timer userInfo] objectForKey:@"partnerOriginalHeight"] floatValue] + (([[[timer userInfo] objectForKey:@"partnerTargetHeight"] floatValue] - [[[timer userInfo] objectForKey:@"partnerOriginalHeight"] floatValue]) * (_currentStep/kPSMHideAnimationSteps))); - - NSRect myNewFrame = NSMakeRect(myFrame.origin.x, myCurrentY, myFrame.size.width, myCurrentHeight); - - if(partnerView){ + NSDictionary *userInfo = [timer userInfo]; + float myCurrentOrigin = ([[userInfo objectForKey:@"myOriginalOrigin"] floatValue] + (([[userInfo objectForKey:@"myTargetOrigin"] floatValue] - [[userInfo objectForKey:@"myOriginalOrigin"] floatValue]) * (_currentStep/kPSMHideAnimationSteps))); + float myCurrentSize = ([[userInfo objectForKey:@"myOriginalSize"] floatValue] + (([[userInfo objectForKey:@"myTargetSize"] floatValue] - [[userInfo objectForKey:@"myOriginalSize"] floatValue]) * (_currentStep/kPSMHideAnimationSteps))); + float partnerCurrentOrigin = ([[userInfo objectForKey:@"partnerOriginalOrigin"] floatValue] + (([[userInfo objectForKey:@"partnerTargetOrigin"] floatValue] - [[userInfo objectForKey:@"partnerOriginalOrigin"] floatValue]) * (_currentStep/kPSMHideAnimationSteps))); + float partnerCurrentSize = ([[userInfo objectForKey:@"partnerOriginalSize"] floatValue] + (([[userInfo objectForKey:@"partnerTargetSize"] floatValue] - [[userInfo objectForKey:@"partnerOriginalSize"] floatValue]) * (_currentStep/kPSMHideAnimationSteps))); + + NSRect myNewFrame; + if ([self orientation] == PSMTabBarHorizontalOrientation) { + myNewFrame = NSMakeRect(myFrame.origin.x, myCurrentOrigin, myFrame.size.width, myCurrentSize); + } else { + myNewFrame = NSMakeRect(myCurrentOrigin, myFrame.origin.y, myCurrentSize, myFrame.size.height); + } + + if (partnerView) { // resize self and view - [partnerView setFrame:NSMakeRect([partnerView frame].origin.x, partnerCurrentY, [partnerView frame].size.width, partnerCurrentHeight)]; + NSRect resizeRect; + if ([self orientation] == PSMTabBarHorizontalOrientation) { + resizeRect = NSMakeRect([partnerView frame].origin.x, partnerCurrentOrigin, [partnerView frame].size.width, partnerCurrentSize); + } else { + resizeRect = NSMakeRect(partnerCurrentOrigin, [partnerView frame].origin.y, partnerCurrentSize, [partnerView frame].size.height); + } + [partnerView setFrame:resizeRect]; [partnerView setNeedsDisplay:YES]; [self setFrame:myNewFrame]; } else { // resize self and window - [[self window] setFrame:NSMakeRect([[self window] frame].origin.x, partnerCurrentY, [[self window] frame].size.width, partnerCurrentHeight) display:YES]; + NSRect resizeRect; + if ([self orientation] == PSMTabBarHorizontalOrientation) { + resizeRect = NSMakeRect([[self window] frame].origin.x, partnerCurrentOrigin, [[self window] frame].size.width, partnerCurrentSize); + } else { + resizeRect = NSMakeRect(partnerCurrentOrigin, [[self window] frame].origin.y, partnerCurrentSize, [[self window] frame].size.height); + } + [[self window] setFrame:resizeRect display:YES]; [self setFrame:myNewFrame]; } - + // next _currentStep++; - if(_currentStep == kPSMHideAnimationSteps + 1){ - [timer invalidate]; + if (_currentStep == kPSMHideAnimationSteps + 1) { + _currentStep = kPSMIsNotBeingResized; [self viewDidEndLiveResize]; _hideIndicators = NO; [self update]; + + // send the delegate messages + if (_isHidden) { + if ([[self delegate] respondsToSelector:@selector(tabView:tabBarDidHide:)]) { + [[self delegate] tabView:[self tabView] tabBarDidHide:self]; + } + } else { + if ([[self delegate] respondsToSelector:@selector(tabView:tabBarDidUnhide:)]) { + [[self delegate] tabView:[self tabView] tabBarDidUnhide:self]; + } + } + + [timer invalidate]; } [[self window] display]; } +- (BOOL)isTabBarHidden +{ + return _isHidden; +} + - (id)partnerView { return partnerView; @@ -626,262 +686,477 @@ - (BOOL)isFlipped return YES; } -- (void)drawRect:(NSRect)rect +- (void)drawRect:(NSRect)rect +{ + for (PSMTabBarCell *cell in [self cells]) { + [cell setIsLast:NO]; + } + [[[self cells] lastObject] setIsLast:YES]; + [_style drawTabBar:self inRect:rect horizontal:(_orientation == PSMTabBarHorizontalOrientation)]; +} + +- (void)moveTabAtIndex:(NSInteger)sourceIndex toIndex:(NSInteger)destIndex { - [style drawTabBar:self inRect:rect]; -} + NSTabViewItem *theItem = [_tabView tabViewItemAtIndex:sourceIndex]; + BOOL reselect = ([_tabView selectedTabViewItem] == theItem); + + id tempDelegate = [_tabView delegate]; + [_tabView setDelegate:nil]; + [theItem retain]; + [_tabView removeTabViewItem:theItem]; + [_tabView insertTabViewItem:theItem atIndex:destIndex]; + [theItem release]; + + id cell = [_cells objectAtIndex:sourceIndex]; + [cell retain]; + [_cells removeObjectAtIndex:sourceIndex]; + [_cells insertObject:cell atIndex:destIndex]; + [cell release]; + + [_tabView setDelegate:tempDelegate]; + + if (reselect) { + [_tabView selectTabViewItem:theItem]; + } + + [self update:YES]; +} - (void)update { - // abandon hope, all ye who enter here :-) - // this method handles all of the cell layout, and is called when something changes to require the refresh. This method is not called during drag and drop; see the PSMTabDragAssistant's calculateDragAnimationForTabBar: method, which does layout in that case. - - // make sure all of our tabs are accounted for before updating - if ([tabView numberOfTabViewItems] != [_cells count]) { + [self update:NO]; +} + +- (void)update:(BOOL)animate { + // This method handles all of the cell layout, and is called when something changes to require + // the refresh. This method is not called during drag and drop. See the PSMTabDragAssistant's + // calculateDragAnimationForTabBar: method, which does layout in that case. + + // Make sure all of our tabs are accounted for before updating. + if ([_tabView numberOfTabViewItems] != [_cells count]) { return; } - // hide/show? (these return if already in desired state) - if((_hideForSingleTab) && ([_cells count] <= 1)){ + // Hide or show? These do nothing if already in the desired state. + if ((_hideForSingleTab) && ([_cells count] <= 1)) { [self hideTabBar:YES animate:YES]; } else { [self hideTabBar:NO animate:YES]; } + [self _removeCellTrackingRects]; + + NSLineBreakMode truncationStyle = [self truncationStyle]; + + // Update cells' settings in case they changed. + for (PSMTabBarCell *cell in _cells) { + cell.truncationStyle = truncationStyle; + cell.hasCloseButton = _hasCloseButton; + [cell updateForStyle]; + cell.isCloseButtonSuppressed = [self disableTabClose]; + // Remove highlight if cursor is no longer in cell. Could happen if + // cell moves because of added/removed tab. Tracking rects aren't smart + // enough to handle this. + [cell updateHighlight]; + } + + // Calculate number of cells to fit in the control and cell widths. + const NSInteger cellCount = [_cells count]; + if ([self orientation] == PSMTabBarHorizontalOrientation) { + if ((animate || _animationTimer != nil) && cellCount > 0) { + // Animate only on horizontal tab bars. + if (_animationTimer) { + [_animationTimer invalidate]; + } + + _animationDelta = 0.0f; + _animationTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 / 30.0 + target:self + selector:@selector(_animateCells:) + userInfo:[self cellWidthsForHorizontalArrangement] + repeats:YES]; + return; + } else { + [self finishUpdate:[self cellWidthsForHorizontalArrangement]]; + } + } else { + // Vertical orientation + CGFloat currentOrigin = [[self style] topMarginForTabBarControl]; + NSRect cellRect = [self genericCellRect]; + NSMutableArray *newOrigins = [NSMutableArray arrayWithCapacity:cellCount]; + + for (int i = 0; i < cellCount; ++i) { + // Lay out vertical tabs. + if (currentOrigin + cellRect.size.height <= [self frame].size.height) { + [newOrigins addObject:[NSNumber numberWithFloat:currentOrigin]]; + currentOrigin += cellRect.size.height; + } else { + // Out of room, the remaining tabs go into overflow. + if ([newOrigins count] > 0 && [self frame].size.height - currentOrigin < 17) { + [newOrigins removeLastObject]; + } + break; + } + } + [self finishUpdate:newOrigins]; + } + + [self setNeedsDisplay]; +} + +// Tab widths may vary. Calculate the widths and see if this will work. Only allow sizes to +// vary if all tabs fit in the allotted space. +- (NSArray *)variableCellWidths { + const CGFloat availableWidth = [self availableCellWidth]; + CGFloat totalDesiredWidth = 0.0; + NSMutableArray *desiredWidths = [NSMutableArray array]; + for (PSMTabBarCell *cell in _cells) { + const CGFloat width = MAX(_cellMinWidth, MIN([cell desiredWidthOfCell], _cellMaxWidth)); + [desiredWidths addObject:@(width)]; + totalDesiredWidth += width; + if (totalDesiredWidth > availableWidth) { + // Stop this expensive calculation as soon as it fails. + break; + } + } + + // If all cells get their "desired" width, do they fit? + if (totalDesiredWidth <= availableWidth) { + return desiredWidths; + } else { + return nil; + } +} + +- (BOOL)shouldUseOptimalWidth { + const CGFloat availableWidth = [self availableCellWidth]; + // If all cells are the client-specified optimum size, do they fit? + BOOL canFitAllCellsOptimally = (self.cellOptimumWidth * _cells.count <= availableWidth); + return !self.stretchCellsToFit && canFitAllCellsOptimally; +} + +- (NSArray *)cellWidthsForHorizontalArrangement { + const NSUInteger cellCount = _cells.count; + const CGFloat availableWidth = [self availableCellWidth]; + + if (self.sizeCellsToFit) { + NSArray *widths = [self variableCellWidths]; + if (widths) { + return widths; + } + } + + NSMutableArray *newWidths = [NSMutableArray array]; + if ([self shouldUseOptimalWidth]) { + // Use the client-specified size, even if that leaves unused space on the right. + for (int i = 0; i < cellCount; i++) { + [newWidths addObject:@(_cellOptimumWidth)]; + } + } else { + // Divide up the space evenly, but don't allow cells to be smaller than the minimum + // width. + CGFloat widthRemaining = availableWidth; + // If all cells are the smallest allowed size, do they fit? + const BOOL canFitAllCellsMinimally = (self.cellMinWidth * cellCount <= availableWidth); + NSInteger numberOfVisibleCells = canFitAllCellsMinimally ? cellCount : (availableWidth / _cellMinWidth); + for (int i = 0; i < numberOfVisibleCells; i++) { + CGFloat width = floor(widthRemaining / (numberOfVisibleCells - i)); + [newWidths addObject:@(width)]; + widthRemaining -= width; + } + } + return newWidths; +} + +- (void)_removeCellTrackingRects +{ // size all cells appropriately and create tracking rects // nuke old tracking rects int i, cellCount = [_cells count]; - for(i = 0; i < cellCount; i++){ + for (i = 0; i < cellCount; i++) { id cell = [_cells objectAtIndex:i]; [[NSNotificationCenter defaultCenter] removeObserver:cell]; - if([cell closeButtonTrackingTag] != 0){ + if ([cell closeButtonTrackingTag] != 0) { [self removeTrackingRect:[cell closeButtonTrackingTag]]; + [cell setCloseButtonTrackingTag:0]; } - if([cell cellTrackingTag] != 0){ + + if ([cell cellTrackingTag] != 0) { [self removeTrackingRect:[cell cellTrackingTag]]; + [cell setCellTrackingTag:0]; } } - // nuke old tool tips + //remove all tooltip rects [self removeAllToolTips]; +} - // calculate number of cells to fit in control and cell widths - float availableWidth = [self availableCellWidth]; - NSMutableArray *newWidths = [NSMutableArray arrayWithCapacity:cellCount]; - int numberOfVisibleCells = 1; - float totalOccupiedWidth = 0.0; - NSMenu *overflowMenu = nil; - for(i = 0; i < cellCount; i++){ - PSMTabBarCell *cell = [_cells objectAtIndex:i]; - float width; - - // supress close button? - if (cellCount == 1 && [self canCloseOnlyTab] == NO) { - [cell setCloseButtonSuppressed:YES]; - } else { - [cell setCloseButtonSuppressed:NO]; - } - - // Determine cell width - if(_sizeCellsToFit){ - width = [cell desiredWidthOfCell]; - if (width > _cellMaxWidth) { - width = _cellMaxWidth; - } - } else { - width = _cellOptimumWidth; - } - - // too much? - totalOccupiedWidth += width; - if (totalOccupiedWidth >= availableWidth) { - numberOfVisibleCells = i; - if(_sizeCellsToFit){ - int neededWidth = width - (totalOccupiedWidth - availableWidth); - // can I squeeze it in without violating min cell width? - int widthIfAllMin = (numberOfVisibleCells + 1) * _cellMinWidth; - - if ((width + widthIfAllMin) <= availableWidth) { - // squeeze - distribute needed sacrifice among all cells - int q; - for(q = (i - 1); q >= 0; q--){ - int desiredReduction = (int)neededWidth/(q+1); - if(([[newWidths objectAtIndex:q] floatValue] - desiredReduction) < _cellMinWidth){ - int actualReduction = (int)[[newWidths objectAtIndex:q] floatValue] - _cellMinWidth; - [newWidths replaceObjectAtIndex:q withObject:[NSNumber numberWithFloat:_cellMinWidth]]; - neededWidth -= actualReduction; - } else { - int newCellWidth = (int)[[newWidths objectAtIndex:q] floatValue] - desiredReduction; - [newWidths replaceObjectAtIndex:q withObject:[NSNumber numberWithFloat:newCellWidth]]; - neededWidth -= desiredReduction; - } - } - // one cell left! - int thisWidth = width - neededWidth; - [newWidths addObject:[NSNumber numberWithFloat:thisWidth]]; - numberOfVisibleCells++; - } else { - // stretch - distribute leftover room among cells - int leftoverWidth = availableWidth - totalOccupiedWidth + width; - int q; - for(q = (i - 1); q >= 0; q--){ - int desiredAddition = (int)leftoverWidth/(q+1); - int newCellWidth = (int)[[newWidths objectAtIndex:q] floatValue] + desiredAddition; - [newWidths replaceObjectAtIndex:q withObject:[NSNumber numberWithFloat:newCellWidth]]; - leftoverWidth -= desiredAddition; - } - } - break; // done assigning widths; remaining cells go in overflow menu - } else { - int revisedWidth = availableWidth/(i + 1); - if(revisedWidth >= _cellMinWidth){ - int q; - totalOccupiedWidth = 0; - for(q = 0; q < [newWidths count]; q++){ - [newWidths replaceObjectAtIndex:q withObject:[NSNumber numberWithFloat:revisedWidth]]; - totalOccupiedWidth += revisedWidth; - } - // just squeezed this one in... - [newWidths addObject:[NSNumber numberWithFloat:revisedWidth]]; - totalOccupiedWidth += revisedWidth; - numberOfVisibleCells++; - } else { - // couldn't fit that last one... - break; +- (void)_animateCells:(NSTimer *)timer { + NSArray *targetWidths = [timer userInfo]; + int i, numberOfVisibleCells = [targetWidths count]; + float totalChange = 0.0f; + BOOL updated = NO; + + if ([_cells count] > 0) { + //compare our target widths with the current widths and move towards the target + for (i = 0; i < [_cells count]; i++) { + PSMTabBarCell *currentCell = [_cells objectAtIndex:i]; + NSRect cellFrame = [currentCell frame]; + cellFrame.origin.x += totalChange; + + if (i < numberOfVisibleCells) { + float target = [[targetWidths objectAtIndex:i] floatValue]; + + if (fabs(cellFrame.size.width - target) < _animationDelta) { + cellFrame.size.width = target; + totalChange += cellFrame.size.width - target; + [currentCell setFrame:cellFrame]; + } else if (cellFrame.size.width > target) { + cellFrame.size.width -= _animationDelta; + totalChange -= _animationDelta; + updated = YES; + } else if (cellFrame.size.width < target) { + cellFrame.size.width += _animationDelta; + totalChange += _animationDelta; + [currentCell setFrame:cellFrame]; + updated = YES; } } + + [currentCell setFrame:cellFrame]; + } + + _animationDelta += 3.0f; + } + + if (!updated) { + [self finishUpdate:targetWidths]; + [timer invalidate]; + _animationTimer = nil; + } + + [self setNeedsDisplay]; +} + +- (void)finishUpdate:(NSArray *)newValues { + // Set up overflow menu. + NSMenu *overflowMenu = [self _setupCells:newValues]; + + if (overflowMenu) { + [self _setupOverflowMenu:overflowMenu]; + } + + [_overflowPopUpButton setHidden:(overflowMenu == nil)]; + + // Set up add tab button. + if (!overflowMenu && _showAddTabButton) { + NSRect cellRect = [self genericCellRect]; + cellRect.size = [_addTabButton frame].size; + + if ([self orientation] == PSMTabBarHorizontalOrientation) { + cellRect.origin.y = 0; + cellRect.origin.x += [[newValues valueForKeyPath:@"@sum.floatValue"] floatValue] + 2; } else { - numberOfVisibleCells = cellCount; - [newWidths addObject:[NSNumber numberWithFloat:width]]; + cellRect.origin.x = 0; + cellRect.origin.y = [[newValues lastObject] floatValue]; } + + [self _setupAddTabButton:cellRect]; + } else { + [_addTabButton setHidden:YES]; } +} - // Set up cells with frames and rects +- (NSMenu *)_setupCells:(NSArray *)newValues { NSRect cellRect = [self genericCellRect]; - for(i = 0; i < cellCount; i++){ + int i, cellCount = [_cells count], numberOfVisibleCells = [newValues count]; + NSMenu *overflowMenu = nil; + + // Set up cells with frames and rects + for (i = 0; i < cellCount; i++) { PSMTabBarCell *cell = [_cells objectAtIndex:i]; - NSTabViewItem *tvi = [cell representedObject]; int tabState = 0; if (i < numberOfVisibleCells) { // set cell frame - cellRect.size.width = [[newWidths objectAtIndex:i] floatValue]; + if ([self orientation] == PSMTabBarHorizontalOrientation) { + cellRect.size.width = [[newValues objectAtIndex:i] floatValue]; + } else { + cellRect.size.width = [self frame].size.width; + cellRect.origin.y = [[newValues objectAtIndex:i] floatValue]; + cellRect.origin.x = 0; + } [cell setFrame:cellRect]; + NSTrackingRectTag tag; - + // close button tracking rect - if ([cell hasCloseButton]) { - tag = [self addTrackingRect:[cell closeButtonRectForFrame:cellRect] owner:cell userData:nil assumeInside:NO]; - [cell setCloseButtonTrackingTag:tag]; + if ([cell hasCloseButton] && + ([[cell representedObject] isEqualTo:[_tabView selectedTabViewItem]] || + [self allowsBackgroundTabClosing])) { + NSPoint mousePoint = + [self convertPoint:[[self window] pointFromScreenCoords:[NSEvent mouseLocation]] + fromView:nil]; + NSRect closeRect = [cell closeButtonRectForFrame:cellRect]; + + // Add the tracking rect for the close button highlight. + if ([cell closeButtonTrackingTag]) { + [self removeTrackingRect:[cell closeButtonTrackingTag]]; + } + tag = [self addTrackingRect:closeRect owner:cell userData:nil assumeInside:NO]; + [cell setCloseButtonTrackingTag:tag]; + + // highlight the close button if the currently selected tab has the mouse over it + // this will happen if the user clicks a close button in a tab and all the tabs are + // rearranged + if ([[cell representedObject] isEqualTo:[_tabView selectedTabViewItem]] && + [[NSApp currentEvent] type] != NSLeftMouseDown && + NSMouseInRect(mousePoint, closeRect, [self isFlipped])) { + [cell setCloseButtonOver:YES]; + } + } else { + [cell setCloseButtonOver:NO]; + } + + // Add entire-tab tracking rect. + if ([cell cellTrackingTag]) { + [self removeTrackingRect:[cell cellTrackingTag]]; } - - // entire tab tracking rect tag = [self addTrackingRect:cellRect owner:cell userData:nil assumeInside:NO]; [cell setCellTrackingTag:tag]; [cell setEnabled:YES]; - // add tool tip - NSString *tt = [cell toolTip]; - if (tt && [tt length] > 0) - [self addToolTipRect:cellRect owner:tt userData:NULL]; + //add the tooltip tracking rect + [self addToolTipRect:cellRect owner:self userData:nil]; // selected? set tab states... - if([tvi isEqualTo:[tabView selectedTabViewItem]]){ + if ([[cell representedObject] isEqualTo:[_tabView selectedTabViewItem]]) { [cell setState:NSOnState]; tabState |= PSMTab_SelectedMask; // previous cell - if(i > 0){ + if (i > 0) { [[_cells objectAtIndex:i-1] setTabState:([(PSMTabBarCell *)[_cells objectAtIndex:i-1] tabState] | PSMTab_RightIsSelectedMask)]; } // next cell - see below } else { [cell setState:NSOffState]; // see if prev cell was selected - if(i > 0){ - if([[_cells objectAtIndex:i-1] state] == NSOnState){ + if (i > 0) { + if ([[_cells objectAtIndex:i-1] state] == NSOnState){ tabState |= PSMTab_LeftIsSelectedMask; } } } // more tab states - if(cellCount == 1){ + if (cellCount == 1) { tabState |= PSMTab_PositionLeftMask | PSMTab_PositionRightMask | PSMTab_PositionSingleMask; - } else if(i == 0){ + } else if (i == 0) { tabState |= PSMTab_PositionLeftMask; - } else if(i-1 == cellCount){ + } else if (i-1 == cellCount) { tabState |= PSMTab_PositionRightMask; } [cell setTabState:tabState]; [cell setIsInOverflowMenu:NO]; - + // indicator - if(![[cell indicator] isHidden] && !_hideIndicators){ + if (![[cell indicator] isHidden] && !_hideIndicators) { [[cell indicator] setFrame:[cell indicatorRectForFrame:cellRect]]; - if(![[self subviews] containsObject:[cell indicator]]){ + if (![[self subviews] containsObject:[cell indicator]]) { [self addSubview:[cell indicator]]; - [[cell indicator] startAnimation:self]; + [[cell indicator] setAnimate:YES]; } } - + // next... - cellRect.origin.x += [[newWidths objectAtIndex:i] floatValue]; - + cellRect.origin.x += [[newValues objectAtIndex:i] floatValue]; + } else { // set up menu items NSMenuItem *menuItem; - if(overflowMenu == nil){ + if (overflowMenu == nil) { overflowMenu = [[[NSMenu alloc] initWithTitle:@"TITLE"] autorelease]; [overflowMenu insertItemWithTitle:@"FIRST" action:nil keyEquivalent:@"" atIndex:0]; // Because the overflowPupUpButton is a pull down menu } - menuItem = [[[NSMenuItem alloc] initWithTitle:[[cell attributedStringValue] string] action:@selector(overflowMenuAction:) keyEquivalent:@""] autorelease]; + menuItem = [[NSMenuItem alloc] initWithTitle:[[cell attributedStringValue] string] action:@selector(overflowMenuAction:) keyEquivalent:@""]; [menuItem setTarget:self]; - [menuItem setRepresentedObject:tvi]; + [menuItem setRepresentedObject:[cell representedObject]]; [cell setIsInOverflowMenu:YES]; [[cell indicator] removeFromSuperview]; - if ([tvi isEqualTo:[tabView selectedTabViewItem]]) + if ([[cell representedObject] isEqualTo:[_tabView selectedTabViewItem]]) { [menuItem setState:NSOnState]; - if([cell hasIcon]) - [menuItem setImage:[[[tvi identifier] content] icon]]; - if([cell count] > 0) - [menuItem setTitle:[[menuItem title] stringByAppendingFormat:@" (%d)",[cell count]]]; + } + + if ([cell hasIcon]) { + [menuItem setImage:[(id)[[cell representedObject] identifier] icon]]; + } + + if ([cell count] > 0) { + [menuItem setTitle:[[menuItem title] stringByAppendingFormat:@" (%d)", [cell count]]]; + } + [overflowMenu addItem:menuItem]; + [menuItem release]; } } - - // Overflow menu - cellRect.origin.y = 0; + return overflowMenu; +} + +- (void)_setupOverflowMenu:(NSMenu *)overflowMenu +{ + NSRect cellRect; + int i; + cellRect.size.height = kPSMTabBarControlHeight; - cellRect.size.width = [style rightMarginForTabBarControl]; + cellRect.size.width = [_style rightMarginForTabBarControl]; + if ([self orientation] == PSMTabBarHorizontalOrientation) { + cellRect.origin.y = 0; + cellRect.origin.x = [self frame].size.width - [_style rightMarginForTabBarControl] + (_resizeAreaCompensation ? -_resizeAreaCompensation : 1); + } else { + cellRect.origin.x = 0; + cellRect.origin.y = [self frame].size.height - kPSMTabBarControlHeight; + cellRect.size.width = [self frame].size.width; + } + + if (![[self subviews] containsObject:_overflowPopUpButton]) { + [self addSubview:_overflowPopUpButton]; + } + [_overflowPopUpButton setFrame:cellRect]; + if (overflowMenu) { - cellRect.origin.x = [self frame].size.width - [style rightMarginForTabBarControl] + 1; - if(![[self subviews] containsObject:_overflowPopUpButton]){ - [self addSubview:_overflowPopUpButton]; + // Have a candidate for new overflow menu. Does it contain the same information as the current one? + // If they're equal, we don't want to update the menu since this happens several times per second + // while the user is visiting the menu. But reading it is fine. + BOOL equal = YES; + equal = [_overflowPopUpButton menu] && [[_overflowPopUpButton menu] numberOfItems ] == [overflowMenu numberOfItems]; + for (i = 0; equal && i < [overflowMenu numberOfItems]; i++) { + NSMenuItem *currentItem = [[_overflowPopUpButton menu] itemAtIndex:i]; + NSMenuItem *newItem = [overflowMenu itemAtIndex:i]; + if (([newItem state] != [currentItem state]) || + ([[newItem title] compare:[currentItem title]] != NSOrderedSame) || + ([newItem image] != [currentItem image])) { + equal = NO; + } + } + + if (!equal) { + [_overflowPopUpButton setMenu:overflowMenu]; } - [_overflowPopUpButton setFrame:cellRect]; - [_overflowPopUpButton setMenu:overflowMenu]; - if ([_overflowPopUpButton isHidden]) [_overflowPopUpButton setHidden:NO]; - } else { - if (![_overflowPopUpButton isHidden]) [_overflowPopUpButton setHidden:YES]; } - - // add tab button - if(!overflowMenu && _showAddTabButton){ - if(![[self subviews] containsObject:_addTabButton]) - [self addSubview:_addTabButton]; - if([_addTabButton isHidden] && _showAddTabButton) - [_addTabButton setHidden:NO]; - cellRect.size = [_addTabButton frame].size; - cellRect.origin.y = MARGIN_Y; - cellRect.origin.x += 2; - [_addTabButton setImage:[style addTabButtonImage]]; - [_addTabButton setFrame:cellRect]; - [_addTabButton setNeedsDisplay:YES]; - } else { - [_addTabButton setHidden:YES]; - [_addTabButton setNeedsDisplay:YES]; +} + +- (void)_setupAddTabButton:(NSRect)frame +{ + if (![[self subviews] containsObject:_addTabButton]) { + [self addSubview:_addTabButton]; } - - [self setNeedsDisplay:YES]; + + if ([_addTabButton isHidden] && _showAddTabButton) { + [_addTabButton setHidden:NO]; + } + + [_addTabButton setImage:[_style addTabButtonImage]]; + [_addTabButton setFrame:frame]; + [_addTabButton setNeedsDisplay:YES]; } #pragma mark - @@ -897,89 +1172,194 @@ - (BOOL)acceptsFirstMouse:(NSEvent *)theEvent return YES; } +- (void)otherMouseDown:(NSEvent *)theEvent { + if ([theEvent buttonNumber] == 2) { + [self setLastMiddleMouseDownEvent:theEvent]; + } +} + - (void)mouseDown:(NSEvent *)theEvent { + _didDrag = NO; + // keep for dragging [self setLastMouseDownEvent:theEvent]; // what cell? NSPoint mousePt = [self convertPoint:[theEvent locationInWindow] fromView:nil]; + NSRect frame = [self frame]; + + if ([self orientation] == PSMTabBarVerticalOrientation && [self allowsResizing] && partnerView && (mousePt.x > frame.size.width - 3)) { + _resizing = YES; + } + NSRect cellFrame; PSMTabBarCell *cell = [self cellForPoint:mousePt cellFrame:&cellFrame]; - if(cell){ -#if 0 - NSRect iconRect = [cell closeButtonRectForFrame:cellFrame]; - if(NSMouseInRect(mousePt, iconRect,[self isFlipped])){ + if (cell) { + BOOL overClose = NSMouseInRect(mousePt, [cell closeButtonRectForFrame:cellFrame], [self isFlipped]); + if (overClose && + cell.closeButtonVisible && + ([self allowsBackgroundTabClosing] || [[cell representedObject] isEqualTo:[_tabView selectedTabViewItem]])) { + [cell setCloseButtonOver:NO]; [cell setCloseButtonPressed:YES]; + _closeClicked = YES; } else { [cell setCloseButtonPressed:NO]; + if ([theEvent clickCount] == 2) { + [self performSelector:@selector(tabDoubleClick:) withObject:cell]; + } + else { + if (_selectsTabsOnMouseDown) { + [self performSelector:@selector(tabClick:) withObject:cell]; + } + } } - [self setNeedsDisplay:YES]; -#else - // HACK! Let the tabs react on the mouse down instead of mouse up - NSRect iconRect = [cell closeButtonRectForFrame:cellFrame]; - if((NSMouseInRect(mousePt, iconRect,[self isFlipped]))){ - //[self performSelector:@selector(closeTabClick:) withObject:cell]; - [self closeTabClick:cell]; - } else if(NSMouseInRect(mousePt, cellFrame,[self isFlipped])){ - //[self performSelector:@selector(tabClick:) withObject:cell]; - [self tabClick:cell]; - } else { - //[self performSelector:@selector(tabNothing:) withObject:cell]; - [self tabNothing:cell]; + [self setNeedsDisplay]; + } + else { + if ([theEvent clickCount] == 2) { + [self performSelector:@selector(tabBarDoubleClick)]; } -#endif } } - (void)mouseDragged:(NSEvent *)theEvent { - if([self lastMouseDownEvent] == nil){ + if ([self lastMouseDownEvent] == nil) { return; } - - if ([_cells count] < 2) { + + NSPoint currentPoint = [self convertPoint:[theEvent locationInWindow] fromView:nil]; + + if (_resizing) { + NSRect frame = [self frame]; + float resizeAmount = [theEvent deltaX]; + if ((currentPoint.x > frame.size.width && resizeAmount > 0) || (currentPoint.x < frame.size.width && resizeAmount < 0)) { + [[NSCursor resizeLeftRightCursor] push]; + + NSRect partnerFrame = [partnerView frame]; + + //do some bounds checking + if ((frame.size.width + resizeAmount > [self cellMinWidth]) && (frame.size.width + resizeAmount < [self cellMaxWidth])) { + frame.size.width += resizeAmount; + partnerFrame.size.width -= resizeAmount; + partnerFrame.origin.x += resizeAmount; + + [self setFrame:frame]; + [partnerView setFrame:partnerFrame]; + [[self superview] setNeedsDisplay:YES]; + } + } return; } - + NSRect cellFrame; NSPoint trackingStartPoint = [self convertPoint:[[self lastMouseDownEvent] locationInWindow] fromView:nil]; PSMTabBarCell *cell = [self cellForPoint:trackingStartPoint cellFrame:&cellFrame]; - if (!cell) - return; - - NSPoint currentPoint = [self convertPoint:[theEvent locationInWindow] fromView:nil]; - float dx = fabs(currentPoint.x - trackingStartPoint.x); - float dy = fabs(currentPoint.y - trackingStartPoint.y); - float distance = sqrt(dx * dx + dy * dy); - if (distance < 10) - return; - - if(![[PSMTabDragAssistant sharedDragAssistant] isDragging]) { - [[PSMTabDragAssistant sharedDragAssistant] startDraggingCell:cell fromTabBar:self withMouseDownEvent:[self lastMouseDownEvent]]; + if (cell) { + //check to see if the close button was the target in the clicked cell + //highlight/unhighlight the close button as necessary + NSRect iconRect = [cell closeButtonRectForFrame:cellFrame]; + + if (_closeClicked && NSMouseInRect(trackingStartPoint, iconRect, [self isFlipped]) && + ([self allowsBackgroundTabClosing] || [[cell representedObject] isEqualTo:[_tabView selectedTabViewItem]])) { + [cell setCloseButtonPressed:NSMouseInRect(currentPoint, iconRect, [self isFlipped])]; + [self setNeedsDisplay]; + return; + } + + float dx = fabs(currentPoint.x - trackingStartPoint.x); + float dy = fabs(currentPoint.y - trackingStartPoint.y); + float distance = sqrt(dx * dx + dy * dy); + + if (distance >= 10 && !_didDrag && ![[PSMTabDragAssistant sharedDragAssistant] isDragging] && + [[self delegate] respondsToSelector:@selector(tabView:shouldDragTabViewItem:fromTabBar:)] && + [[self delegate] tabView:_tabView shouldDragTabViewItem:[cell representedObject] fromTabBar:self]) { + _didDrag = YES; + [[PSMTabDragAssistant sharedDragAssistant] startDraggingCell:cell fromTabBar:self withMouseDownEvent:[self lastMouseDownEvent]]; + } + } +} + +- (void)otherMouseUp:(NSEvent *)theEvent +{ + // Middle click closes a tab, even if the click is not on the close button. + if ([theEvent buttonNumber] == 2 && !_resizing) { + NSPoint mousePt = [self convertPoint:[theEvent locationInWindow] fromView:nil]; + NSRect cellFrame; + PSMTabBarCell *cell = [self cellForPoint:mousePt cellFrame:&cellFrame]; + NSRect mouseDownCellFrame; + PSMTabBarCell *mouseDownCell = [self cellForPoint:[self convertPoint:[[self lastMiddleMouseDownEvent] locationInWindow] fromView:nil] + cellFrame:&mouseDownCellFrame]; + if (cell && cell == mouseDownCell) { + [self closeTabClick:cell]; + } } } - (void)mouseUp:(NSEvent *)theEvent { -#if 0 // HACK! Tabs react on mouse down instead of mouse up - // what cell? - NSPoint mousePt = [self convertPoint:[theEvent locationInWindow] fromView:nil]; - NSRect cellFrame, mouseDownCellFrame; - PSMTabBarCell *cell = [self cellForPoint:mousePt cellFrame:&cellFrame]; - PSMTabBarCell *mouseDownCell = [self cellForPoint:[self convertPoint:[[self lastMouseDownEvent] locationInWindow] fromView:nil] cellFrame:&mouseDownCellFrame]; - if(cell){ - NSRect iconRect = [mouseDownCell closeButtonRectForFrame:mouseDownCellFrame]; - if((NSMouseInRect(mousePt, iconRect,[self isFlipped])) && [mouseDownCell closeButtonPressed]){ - [self performSelector:@selector(closeTabClick:) withObject:cell]; - } else if(NSMouseInRect(mousePt, mouseDownCellFrame,[self isFlipped])){ - [mouseDownCell setCloseButtonPressed:NO]; - [self performSelector:@selector(tabClick:) withObject:cell]; - } else { - [mouseDownCell setCloseButtonPressed:NO]; - [self performSelector:@selector(tabNothing:) withObject:cell]; + if (_resizing) { + _resizing = NO; + [[NSCursor arrowCursor] set]; + } else { + // what cell? + NSPoint mousePt = [self convertPoint:[theEvent locationInWindow] fromView:nil]; + NSRect cellFrame, mouseDownCellFrame; + PSMTabBarCell *cell = [self cellForPoint:mousePt cellFrame:&cellFrame]; + PSMTabBarCell *mouseDownCell = [self cellForPoint:[self convertPoint:[[self lastMouseDownEvent] locationInWindow] fromView:nil] cellFrame:&mouseDownCellFrame]; + if (cell) { + NSPoint trackingStartPoint = [self convertPoint:[[self lastMouseDownEvent] locationInWindow] fromView:nil]; + NSRect iconRect = [mouseDownCell closeButtonRectForFrame:mouseDownCellFrame]; + + if ((NSMouseInRect(mousePt, iconRect,[self isFlipped])) && + cell.closeButtonVisible && + [mouseDownCell closeButtonPressed]) { + [self performSelector:@selector(closeTabClick:) withObject:cell]; + } else if (NSMouseInRect(mousePt, + mouseDownCellFrame, + [self isFlipped]) && + (!NSMouseInRect(trackingStartPoint, + [cell closeButtonRectForFrame:cellFrame], + [self isFlipped]) || + [self disableTabClose] || + ![self allowsBackgroundTabClosing])) { + [mouseDownCell setCloseButtonPressed:NO]; + [self performSelector:@selector(tabClick:) withObject:cell]; + } else { + [mouseDownCell setCloseButtonPressed:NO]; + [self performSelector:@selector(tabNothing:) withObject:cell]; + } + } + + _closeClicked = NO; + } +} + +- (NSMenu *)menuForEvent:(NSEvent *)event +{ + NSMenu *menu = nil; + NSTabViewItem *item = [[self cellForPoint:[self convertPoint:[event locationInWindow] fromView:nil] cellFrame:nil] representedObject]; + + if (item && [[self delegate] respondsToSelector:@selector(tabView:menuForTabViewItem:)]) { + menu = [[self delegate] tabView:_tabView menuForTabViewItem:item]; + } + else if (!item) { + // when the "LSUIElement hack" (issue #954) is enabled, the menu bar is inaccessible, + // so show it as a context menu when right-clicking empty tabBar region + if ([[[NSBundle mainBundle] infoDictionary] objectForKey:@"LSUIElement"]) { + menu = [NSApp mainMenu]; } } -#endif + return menu; +} + +- (void)resetCursorRects +{ + [super resetCursorRects]; + if ([self orientation] == PSMTabBarVerticalOrientation) { + NSRect frame = [self frame]; + [self addCursorRect:NSMakeRect(frame.size.width - 2, 0, 2, frame.size.height) cursor:[NSCursor resizeLeftRightCursor]]; + } } #pragma mark - @@ -1001,340 +1381,409 @@ - (BOOL)ignoreModifierKeysWhileDragging return YES; } -- (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation +- (void)draggedImage:(NSImage *)anImage beganAt:(NSPoint)screenPoint +{ + [[PSMTabDragAssistant sharedDragAssistant] draggingBeganAt:screenPoint]; +} + +- (void)draggedImage:(NSImage *)image movedTo:(NSPoint)screenPoint { - [[PSMTabDragAssistant sharedDragAssistant] draggedImageEndedAt:aPoint operation:operation]; + [[PSMTabDragAssistant sharedDragAssistant] draggingMovedTo:screenPoint]; } // NSDraggingDestination - (NSDragOperation)draggingEntered:(id )sender { - NSPoint point = [self convertPoint:[sender draggingLocation] fromView:nil]; - _delegateHandlingDrag = NO; - if([[[sender draggingPasteboard] types] indexOfObject:@"PSMTabBarControlItemPBType"] != NSNotFound) { - - if ([sender draggingSource] != self && ![self allowsDragBetweenWindows]) - return NSDragOperationNone; - - [[PSMTabDragAssistant sharedDragAssistant] draggingEnteredTabBar:self atPoint:point]; + if ([[[sender draggingPasteboard] types] indexOfObject:@"com.iterm2.psm.controlitem"] != NSNotFound) { + if ([[self delegate] respondsToSelector:@selector(tabView:shouldDropTabViewItem:inTabBar:)] && + ![[self delegate] tabView:[[sender draggingSource] tabView] + shouldDropTabViewItem:[[[PSMTabDragAssistant sharedDragAssistant] draggedCell] representedObject] + inTabBar:self]) { + return NSDragOperationNone; + } + + [[PSMTabDragAssistant sharedDragAssistant] draggingEnteredTabBar:self atPoint:[self convertPoint:[sender draggingLocation] fromView:nil]]; return NSDragOperationMove; - } else if (delegate && [delegate respondsToSelector:@selector(tabBarControl:draggingEntered:forTabAtIndex:)]) { - NSDragOperation op = [delegate tabBarControl:self draggingEntered:sender forTabAtIndex:[self indexOfCellAtPoint:point]]; - _delegateHandlingDrag = (op != NSDragOperationNone); - _delegateInitialDragOperation = op; + } else if ([[self delegate] respondsToSelector:@selector(tabView:draggingEnteredTabBarForSender:)]) { + NSDragOperation op = [[self delegate] tabView:_tabView draggingEnteredTabBarForSender:sender]; + if (op != NSDragOperationNone) { + [[PSMTabDragAssistant sharedDragAssistant] startAnimationWithOrientation:_orientation width:_cellOptimumWidth]; + [[PSMTabDragAssistant sharedDragAssistant] draggingEnteredTabBar:self atPoint:[self convertPoint:[sender draggingLocation] fromView:nil]]; + } return op; + } else { + return NSDragOperationNone; } - - return NSDragOperationNone; } - (NSDragOperation)draggingUpdated:(id )sender { - NSPoint point = [self convertPoint:[sender draggingLocation] fromView:nil]; - if ([[[sender draggingPasteboard] types] indexOfObject:@"PSMTabBarControlItemPBType"] != NSNotFound) { - - if ([sender draggingSource] != self && ![self allowsDragBetweenWindows]) - return NSDragOperationNone; - - [[PSMTabDragAssistant sharedDragAssistant] draggingUpdatedInTabBar:self atPoint:point]; + PSMTabBarCell *cell = [self cellForPoint:[self convertPoint:[sender draggingLocation] fromView:nil] cellFrame:nil]; + + if ([[[sender draggingPasteboard] types] indexOfObject:@"com.iterm2.psm.controlitem"] != NSNotFound) { + + if ([[self delegate] respondsToSelector:@selector(tabView:shouldDropTabViewItem:inTabBar:)] && + ![[self delegate] tabView:[[sender draggingSource] tabView] + shouldDropTabViewItem:[[[PSMTabDragAssistant sharedDragAssistant] draggedCell] representedObject] + inTabBar:self]) { + return NSDragOperationNone; + } + + [[PSMTabDragAssistant sharedDragAssistant] draggingUpdatedInTabBar:self atPoint:[self convertPoint:[sender draggingLocation] fromView:nil]]; + return NSDragOperationMove; + } else if ([[self delegate] respondsToSelector:@selector(tabView:shouldAcceptDragFromSender:)] && + [[self delegate] tabView:_tabView shouldAcceptDragFromSender:sender]) { + [[PSMTabDragAssistant sharedDragAssistant] draggingUpdatedInTabBar:self atPoint:[self convertPoint:[sender draggingLocation] fromView:nil]]; return NSDragOperationMove; - } else if (_delegateHandlingDrag) { - if ([delegate respondsToSelector:@selector(tabBarControl:draggingUpdated:forTabAtIndex:)]) - return [delegate tabBarControl:self draggingUpdated:sender forTabAtIndex:[self indexOfCellAtPoint:point]]; - else - return _delegateInitialDragOperation; + } else if (cell) { + //something that was accepted by the delegate was dragged on + [_tabView selectTabViewItem:[cell representedObject]]; + return NSDragOperationCopy; } - + return NSDragOperationNone; } - (void)draggingExited:(id )sender { - if (!_delegateHandlingDrag) { - [[PSMTabDragAssistant sharedDragAssistant] draggingExitedTabBar:self]; - } else if ([delegate respondsToSelector:@selector(tabBarControl:draggingExited:forTabAtIndex:)]) { - NSPoint point = [self convertPoint:[sender draggingLocation] fromView:nil]; - [delegate tabBarControl:self draggingExited:sender forTabAtIndex:[self indexOfCellAtPoint:point]]; - } + [[PSMTabDragAssistant sharedDragAssistant] draggingExitedTabBar:self]; } - (BOOL)prepareForDragOperation:(id )sender { - if (_delegateHandlingDrag && [delegate respondsToSelector:@selector(tabBarControl:prepareForDragOperation:forTabAtIndex:)]) { - NSPoint point = [self convertPoint:[sender draggingLocation] fromView:nil]; - return [delegate tabBarControl:self prepareForDragOperation:sender forTabAtIndex:[self indexOfCellAtPoint:point]]; + // validate the drag operation only if there's a valid tab bar to drop into + BOOL badType = [[[sender draggingPasteboard] types] indexOfObject:@"com.iterm2.psm.controlitem"] == NSNotFound; + if (badType && [[self delegate] respondsToSelector:@selector(tabView:shouldAcceptDragFromSender:)] && + ![[self delegate] tabView:_tabView shouldAcceptDragFromSender:sender]) { + badType = YES; } - - return YES; + return badType || + [[PSMTabDragAssistant sharedDragAssistant] destinationTabBar] != nil; +} + +- (BOOL)_delegateAcceptsSender:(id )sender +{ + return [[self delegate] respondsToSelector:@selector(tabView:shouldAcceptDragFromSender:)] && + [[self delegate] tabView:_tabView shouldAcceptDragFromSender:sender]; } - (BOOL)performDragOperation:(id )sender { - if (!_delegateHandlingDrag) { -#if 1 - // HACK! Used below. - NSTabViewItem *tvi = [[[PSMTabDragAssistant sharedDragAssistant] draggedCell] representedObject]; -#endif - - [[PSMTabDragAssistant sharedDragAssistant] performDragOperation]; - -#if 1 - // HACK! Notify the delegate that a tab was dragged to a new position. - if (delegate && [delegate respondsToSelector:@selector(tabView:didDragTabViewItem:toIndex:)]) { - NSUInteger idx = [[self representedTabViewItems] indexOfObject:tvi]; - if (NSNotFound != idx) { - [delegate tabView:[self tabView] didDragTabViewItem:tvi toIndex:idx]; - } - } -#endif - } else { - if ([delegate respondsToSelector:@selector(tabBarControl:performDragOperation:forTabAtIndex:)]) { - NSPoint point = [self convertPoint:[sender draggingLocation] fromView:nil]; - return [delegate tabBarControl:self performDragOperation:sender forTabAtIndex:[self indexOfCellAtPoint:point]]; - } else { - return NO; - } + if ([[[sender draggingPasteboard] types] indexOfObject:@"com.iterm2.psm.controlitem"] != NSNotFound || + [self _delegateAcceptsSender:sender]) { + [[PSMTabDragAssistant sharedDragAssistant] performDragOperation:sender]; + } else if ([[self delegate] respondsToSelector:@selector(tabView:acceptedDraggingInfo:onTabViewItem:)]) { + //forward the drop to the delegate + [[self delegate] tabView:_tabView acceptedDraggingInfo:sender onTabViewItem:[[self cellForPoint:[self convertPoint:[sender draggingLocation] fromView:nil] cellFrame:nil] representedObject]]; } - return YES; } -- (void)concludeDragOperation:(id )sender +- (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation { - if (_delegateHandlingDrag && [delegate respondsToSelector:@selector(tabBarControl:concludeDragOperation:forTabAtIndex:)]) { - NSPoint point = [self convertPoint:[sender draggingLocation] fromView:nil]; - [delegate tabBarControl:self concludeDragOperation:sender forTabAtIndex:[self indexOfCellAtPoint:point]]; + if (operation != NSDragOperationNone) { + [self removeTabForCell:[[PSMTabDragAssistant sharedDragAssistant] draggedCell]]; + [[PSMTabDragAssistant sharedDragAssistant] finishDrag]; + } else { + [[PSMTabDragAssistant sharedDragAssistant] draggedImageEndedAt:aPoint operation:operation]; } } +- (void)concludeDragOperation:(id )sender +{ + +} + #pragma mark - #pragma mark Actions -- (void)overflowMenuAction:(id)sender -{ - [tabView selectTabViewItem:[sender representedObject]]; +- (void)overflowMenuAction:(id)sender { + [_tabView selectTabViewItem:[sender representedObject]]; [self update]; } - (void)closeTabClick:(id)sender { - [sender retain]; - if(([_cells count] == 1) && (![self canCloseOnlyTab])) - return; - - if(([self delegate]) && ([[self delegate] respondsToSelector:@selector(tabView:shouldCloseTabViewItem:)])){ - if(![[self delegate] tabView:tabView shouldCloseTabViewItem:[sender representedObject]]){ + NSTabViewItem *item = [sender representedObject]; + [[sender retain] autorelease]; + [[item retain] autorelease]; + + if ([[self delegate] respondsToSelector:@selector(tabView:shouldCloseTabViewItem:)]){ + if (![[self delegate] tabView:_tabView shouldCloseTabViewItem:item]){ // fix mouse downed close button [sender setCloseButtonPressed:NO]; return; } } - - if(([self delegate]) && ([[self delegate] respondsToSelector:@selector(tabView:willCloseTabViewItem:)])){ - [[self delegate] tabView:tabView willCloseTabViewItem:[sender representedObject]]; - } - - [[sender representedObject] retain]; - [tabView removeTabViewItem:[sender representedObject]]; - - if(([self delegate]) && ([[self delegate] respondsToSelector:@selector(tabView:didCloseTabViewItem:)])){ - [[self delegate] tabView:tabView didCloseTabViewItem:[sender representedObject]]; + + if ([[self delegate] respondsToSelector:@selector(closeTab:)]) { + [[self delegate] closeTab:[item identifier]]; } - [[sender representedObject] release]; - [sender release]; } -- (void)tabClick:(id)sender -{ - [tabView selectTabViewItem:[sender representedObject]]; +- (void)tabClick:(id)sender { + [_tabView selectTabViewItem:[sender representedObject]]; [self update]; } -- (void)tabNothing:(id)sender -{ +- (void)tabDoubleClick:(id)sender { + if ([[self delegate] respondsToSelector:@selector(tabView:doubleClickTabViewItem:)]) { + [[self delegate] tabView:[self tabView] doubleClickTabViewItem:[sender representedObject]]; + } +} + +- (void)tabBarDoubleClick { + if ([[self delegate] respondsToSelector:@selector(tabViewDoubleClickTabBar:)]) { + [[self delegate] tabViewDoubleClickTabBar:[self tabView]]; + } +} + +- (void)tabNothing:(id)sender { [self update]; // takes care of highlighting based on state } -- (void)frameDidChange:(NSNotification *)notification -{ +- (void)frameDidChange:(NSNotification *)notification { + //figure out if the new frame puts the control in the way of the resize widget + NSRect resizeWidgetFrame = [[[self window] contentView] frame]; + resizeWidgetFrame.origin.x += resizeWidgetFrame.size.width - 22; + resizeWidgetFrame.size.width = 22; + resizeWidgetFrame.size.height = 22; + + if ([[self window] showsResizeIndicator] && NSIntersectsRect([self frame], resizeWidgetFrame)) { + //the resize widgets are larger on metal windows + _resizeAreaCompensation = [[self window] styleMask] & NSTexturedBackgroundWindowMask ? 20 : 8; + } else { + _resizeAreaCompensation = 0; + } + [self update]; // trying to address the drawing artifacts for the progress indicators - hackery follows // this one fixes the "blanking" effect when the control hides and shows itself - NSEnumerator *e = [_cells objectEnumerator]; - PSMTabBarCell *cell; - while(cell = [e nextObject]){ - [[cell indicator] stopAnimation:self]; - [[cell indicator] startAnimation:self]; + for (PSMTabBarCell *cell in _cells) { + [[cell indicator] setAnimate:NO]; + [[cell indicator] setAnimate:YES]; } - [self setNeedsDisplay:YES]; + [self setNeedsDisplay]; } -- (void)viewWillStartLiveResize -{ - NSEnumerator *e = [_cells objectEnumerator]; - PSMTabBarCell *cell; - while(cell = [e nextObject]){ - [[cell indicator] stopAnimation:self]; +- (void)viewWillStartLiveResize { + for (PSMTabBarCell *cell in _cells) { + [[cell indicator] setAnimate:NO]; } - [self setNeedsDisplay:YES]; + [self setNeedsDisplay]; } --(void)viewDidEndLiveResize -{ - NSEnumerator *e = [_cells objectEnumerator]; - PSMTabBarCell *cell; - while(cell = [e nextObject]){ - [[cell indicator] startAnimation:self]; +-(void)viewDidEndLiveResize { + for (PSMTabBarCell *cell in _cells) { + [[cell indicator] setAnimate:YES]; } - [self setNeedsDisplay:YES]; + [self setNeedsDisplay]; } -- (void)windowDidMove:(NSNotification *)aNotification -{ - [self setNeedsDisplay:YES]; +- (void)windowDidMove:(NSNotification *)aNotification { + [self setNeedsDisplay]; } -- (void)windowStatusDidChange:(NSNotification *)notification -{ +- (void)windowStatusDidChange:(NSNotification *)notification { // hide? must readjust things if I'm not supposed to be showing // this block of code only runs when the app launches - if(_hideForSingleTab && ([_cells count] <= 1) && !_awakenedFromNib){ + if ([self hideForSingleTab] && ([_cells count] <= 1) && !_awakenedFromNib) { // must adjust frames now before display NSRect myFrame = [self frame]; - if(partnerView){ - NSRect partnerFrame = [partnerView frame]; - // above or below me? - if(([self frame].origin.y - 22) > [partnerView frame].origin.y){ - // partner is below me - [self setFrame:NSMakeRect(myFrame.origin.x, myFrame.origin.y + 21, myFrame.size.width, myFrame.size.height - 21)]; - [partnerView setFrame:NSMakeRect(partnerFrame.origin.x, partnerFrame.origin.y, partnerFrame.size.width, partnerFrame.size.height + 21)]; + if ([self orientation] == PSMTabBarHorizontalOrientation) { + if (partnerView) { + NSRect partnerFrame = [partnerView frame]; + // above or below me? + if (myFrame.origin.y - 22 > [partnerView frame].origin.y) { + // partner is below me + [self setFrame:NSMakeRect(myFrame.origin.x, myFrame.origin.y + 21, myFrame.size.width, myFrame.size.height - 21)]; + [partnerView setFrame:NSMakeRect(partnerFrame.origin.x, partnerFrame.origin.y, partnerFrame.size.width, partnerFrame.size.height + 21)]; + } else { + // partner is above me + [self setFrame:NSMakeRect(myFrame.origin.x, myFrame.origin.y, myFrame.size.width, myFrame.size.height - 21)]; + [partnerView setFrame:NSMakeRect(partnerFrame.origin.x, partnerFrame.origin.y - 21, partnerFrame.size.width, partnerFrame.size.height + 21)]; + } + [partnerView setNeedsDisplay:YES]; + [self setNeedsDisplay]; } else { - // partner is above me + // for window movement + NSRect windowFrame = [[self window] frame]; + [[self window] setFrame:NSMakeRect(windowFrame.origin.x, windowFrame.origin.y + 21, windowFrame.size.width, windowFrame.size.height - 21) display:YES]; [self setFrame:NSMakeRect(myFrame.origin.x, myFrame.origin.y, myFrame.size.width, myFrame.size.height - 21)]; - [partnerView setFrame:NSMakeRect(partnerFrame.origin.x, partnerFrame.origin.y - 21, partnerFrame.size.width, partnerFrame.size.height + 21)]; } - [partnerView setNeedsDisplay:YES]; - [self setNeedsDisplay:YES]; } else { - // for window movement - NSRect windowFrame = [[self window] frame]; - [[self window] setFrame:NSMakeRect(windowFrame.origin.x, windowFrame.origin.y + 21, windowFrame.size.width, windowFrame.size.height - 21) display:YES]; - [self setFrame:NSMakeRect(myFrame.origin.x, myFrame.origin.y, myFrame.size.width, myFrame.size.height - 21)]; + if (partnerView) { + NSRect partnerFrame = [partnerView frame]; + //to the left or right? + if (myFrame.origin.x < [partnerView frame].origin.x){ + // partner is to the left + [self setFrame:NSMakeRect(myFrame.origin.x, myFrame.origin.y, 1, myFrame.size.height)]; + [partnerView setFrame:NSMakeRect(partnerFrame.origin.x - myFrame.size.width + 1, partnerFrame.origin.y, partnerFrame.size.width + myFrame.size.width - 1, partnerFrame.size.height)]; + } else { + // partner to the right + [self setFrame:NSMakeRect(myFrame.origin.x + myFrame.size.width, myFrame.origin.y, 1, myFrame.size.height)]; + [partnerView setFrame:NSMakeRect(partnerFrame.origin.x, partnerFrame.origin.y, partnerFrame.size.width + myFrame.size.width, partnerFrame.size.height)]; + } + _tabBarWidth = myFrame.size.width; + [partnerView setNeedsDisplay:YES]; + [self setNeedsDisplay]; + } else { + // for window movement + NSRect windowFrame = [[self window] frame]; + [[self window] setFrame:NSMakeRect(windowFrame.origin.x + myFrame.size.width - 1, windowFrame.origin.y, windowFrame.size.width - myFrame.size.width + 1, windowFrame.size.height) display:YES]; + [self setFrame:NSMakeRect(myFrame.origin.x, myFrame.origin.y, 1, myFrame.size.height)]; + } } + _isHidden = YES; - [self setNeedsDisplay:YES]; - //[[self window] display]; + + if ([[self delegate] respondsToSelector:@selector(tabView:tabBarDidHide:)]) { + [[self delegate] tabView:[self tabView] tabBarDidHide:self]; + } } + + [self setNeedsDisplay]; _awakenedFromNib = YES; [self update]; } +#pragma mark - +#pragma mark Menu Validation + +- (BOOL)validateMenuItem:(NSMenuItem *)sender { + return [[self delegate] respondsToSelector:@selector(tabView:validateOverflowMenuItem:forTabViewItem:)] ? + [[self delegate] tabView:[self tabView] validateOverflowMenuItem:sender forTabViewItem:[sender representedObject]] : YES; +} + #pragma mark - #pragma mark NSTabView Delegate -- (void)tabView:(NSTabView *)aTabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem -{ - // here's a weird one - this message is sent before the "tabViewDidChangeNumberOfTabViewItems" +- (void)tabView:(NSTabView *)aTabView willAddTabViewItem:(NSTabViewItem *)tabViewItem { + if ([[self delegate] respondsToSelector:@selector(tabView:willAddTabViewItem:)]){ + [[self delegate] tabView:aTabView willAddTabViewItem:tabViewItem]; + } +} + +- (void)tabView:(NSTabView *)aTabView willInsertTabViewItem:(NSTabViewItem *)tabViewItem atIndex:(int)anIndex { + if ([[self delegate] respondsToSelector:@selector(tabView:willInsertTabViewItem:atIndex:)]) { + [[self delegate] tabView:aTabView willInsertTabViewItem:tabViewItem atIndex:anIndex]; + } +} + +- (void)tabView:(NSTabView *)aTabView willRemoveTabViewItem:(NSTabViewItem *)tabViewItem { + if ([[self delegate] respondsToSelector:@selector(tabView:willRemoveTabViewItem:)]) { + [[self delegate] tabView:aTabView willRemoveTabViewItem:tabViewItem]; + } +} + + +- (void)tabView:(NSTabView *)aTabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem { + // here's a weird one - this message is sent before the "aDidChangeNumberOfTabViewItems" // message, thus I can end up updating when there are no cells, if no tabs were (yet) present - if([_cells count] > 0){ + if ([_cells count] > 0) { [self update]; } - if([self delegate]){ - if([[self delegate] respondsToSelector:@selector(tabView:didSelectTabViewItem:)]){ - [[self delegate] performSelector:@selector(tabView:didSelectTabViewItem:) withObject:aTabView withObject:tabViewItem]; - } + if ([[self delegate] respondsToSelector:@selector(tabView:didSelectTabViewItem:)]) { + [[self delegate] tabView:aTabView didSelectTabViewItem:tabViewItem]; } + + NSAccessibilityPostNotification(self, NSAccessibilityValueChangedNotification); } - -- (BOOL)tabView:(NSTabView *)aTabView shouldSelectTabViewItem:(NSTabViewItem *)tabViewItem -{ - if([self delegate]){ - if([[self delegate] respondsToSelector:@selector(tabView:shouldSelectTabViewItem:)]){ - // This is an ugly hack. tabView:shouldSelectTabViewItem: returns - // a BOOL and performSelector: assumes that it returns an id. - return nil != [[self delegate] performSelector:@selector(tabView:shouldSelectTabViewItem:) withObject:aTabView withObject:tabViewItem]; - } else { - return YES; - } + +- (void)tabView:(NSTabView *)tabView doubleClickTabViewItem:(NSTabViewItem *)tabViewItem { +} + +- (BOOL)tabView:(NSTabView *)aTabView shouldSelectTabViewItem:(NSTabViewItem *)tabViewItem { + if ([[self delegate] respondsToSelector:@selector(tabView:shouldSelectTabViewItem:)]) { + return (BOOL)[[self delegate] tabView:aTabView shouldSelectTabViewItem:tabViewItem]; } else { return YES; } } -- (void)tabView:(NSTabView *)aTabView willSelectTabViewItem:(NSTabViewItem *)tabViewItem -{ - if([self delegate]){ - if([[self delegate] respondsToSelector:@selector(tabView:willSelectTabViewItem:)]){ - [[self delegate] performSelector:@selector(tabView:willSelectTabViewItem:) withObject:aTabView withObject:tabViewItem]; - } + +- (void)tabView:(NSTabView *)aTabView willSelectTabViewItem:(NSTabViewItem *)tabViewItem { + if ([[self delegate] respondsToSelector:@selector(tabView:willSelectTabViewItem:)]) { + [[self delegate] tabView:aTabView willSelectTabViewItem:tabViewItem]; } } -- (void)tabViewDidChangeNumberOfTabViewItems:(NSTabView *)aTabView -{ - NSArray *tabItems = [tabView tabViewItems]; +- (void)tabViewDidChangeNumberOfTabViewItems:(NSTabView *)aTabView { + NSArray *tabItems = [_tabView tabViewItems]; // go through cells, remove any whose representedObjects are not in [tabView tabViewItems] - NSEnumerator *e = [_cells objectEnumerator]; - PSMTabBarCell *cell; - while(cell = [e nextObject]){ - if(![tabItems containsObject:[cell representedObject]]){ - [self removeTabForCell:cell]; + NSMutableArray *cellsToRemove = [NSMutableArray array]; + for (PSMTabBarCell *cell in _cells) { + if (![tabItems containsObject:[cell representedObject]]) { + [cellsToRemove addObject:cell]; } } - + for (PSMTabBarCell *cell in cellsToRemove) { + if ([[self delegate] respondsToSelector:@selector(tabView:didCloseTabViewItem:)]) { + [[self delegate] tabView:aTabView didCloseTabViewItem:[cell representedObject]]; + } + + [self removeTabForCell:cell]; + } + // go through tab view items, add cell for any not present NSMutableArray *cellItems = [self representedTabViewItems]; - NSEnumerator *ex = [tabItems objectEnumerator]; - NSTabViewItem *item; - while(item = [ex nextObject]){ - if(![cellItems containsObject:item]){ - [self addTabViewItem:item]; + int i = 0; + for (NSTabViewItem *item in tabItems) { + if (![cellItems containsObject:item]) { + [self addTabViewItem:item atIndex:i]; } + i++; } -#if 0 - // HACK! Make sure '_cells' is ordered the same as 'tabItems'. - NSMutableArray *temp = [[NSMutableArray alloc] initWithArray:_cells]; - e = [_cells objectEnumerator]; - int count = [temp count]; - while ((cell = [e nextObject])) { - int idx = [tabItems indexOfObject:[cell representedObject]]; - if (NSNotFound != idx && idx < count) { - [temp replaceObjectAtIndex:idx withObject:cell]; - } + // pass along for other delegate responses + if ([[self delegate] respondsToSelector:@selector(tabViewDidChangeNumberOfTabViewItems:)]) { + [[self delegate] tabViewDidChangeNumberOfTabViewItems:aTabView]; } +} - [_cells release]; - _cells = temp; +- (NSDragOperation)tabView:(NSTabView *)tabView draggingEnteredTabBarForSender:(id)tagViewItem { + return NSDragOperationNone; +} - if ([_cells count] == [tabView numberOfTabViewItems]) { - [self update]; // don't update unless all are accounted for! - } -#endif - - // pass along for other delegate responses - if([self delegate]){ - if([[self delegate] respondsToSelector:@selector(tabViewDidChangeNumberOfTabViewItems:)]){ - [[self delegate] performSelector:@selector(tabViewDidChangeNumberOfTabViewItems:) withObject:aTabView]; - } +- (BOOL)tabView:(NSTabView *)tabView shouldAcceptDragFromSender:(id)tagViewItem { + return NO; +} + +- (NSTabViewItem *)tabView:(NSTabView *)tabView unknownObjectWasDropped:(id )sender { + return nil; +} + +#pragma mark - +#pragma mark Tooltips + +- (NSString *)view:(NSView *)view stringForToolTip:(NSToolTipTag)tag point:(NSPoint)point userData:(void *)userData +{ + if ([[self delegate] respondsToSelector:@selector(tabView:toolTipForTabViewItem:)]) { + return [[self delegate] tabView:[self tabView] toolTipForTabViewItem:[[self cellForPoint:point cellFrame:nil] representedObject]]; } + return nil; } #pragma mark - #pragma mark Archiving -- (void)encodeWithCoder:(NSCoder *)aCoder +- (void)encodeWithCoder:(NSCoder *)aCoder { [super encodeWithCoder:aCoder]; if ([aCoder allowsKeyedCoding]) { [aCoder encodeObject:_cells forKey:@"PSMcells"]; - [aCoder encodeObject:tabView forKey:@"PSMtabView"]; + [aCoder encodeObject:_tabView forKey:@"PSMtabView"]; [aCoder encodeObject:_overflowPopUpButton forKey:@"PSMoverflowPopUpButton"]; [aCoder encodeObject:_addTabButton forKey:@"PSMaddTabButton"]; - [aCoder encodeObject:style forKey:@"PSMstyle"]; - [aCoder encodeBool:_canCloseOnlyTab forKey:@"PSMcanCloseOnlyTab"]; + [aCoder encodeObject:_style forKey:@"PSMstyle"]; + [aCoder encodeInt:_orientation forKey:@"PSMorientation"]; + [aCoder encodeBool:_disableTabClose forKey:@"PSMdisableTabClose"]; [aCoder encodeBool:_hideForSingleTab forKey:@"PSMhideForSingleTab"]; + [aCoder encodeBool:_allowsBackgroundTabClosing forKey:@"PSMallowsBackgroundTabClosing"]; + [aCoder encodeBool:_allowsResizing forKey:@"PSMallowsResizing"]; + [aCoder encodeBool:_selectsTabsOnMouseDown forKey:@"PSMselectsTabsOnMouseDown"]; [aCoder encodeBool:_showAddTabButton forKey:@"PSMshowAddTabButton"]; [aCoder encodeBool:_sizeCellsToFit forKey:@"PSMsizeCellsToFit"]; + [aCoder encodeBool:_stretchCellsToFit forKey:@"PSMstretchCellsToFit"]; [aCoder encodeInt:_cellMinWidth forKey:@"PSMcellMinWidth"]; [aCoder encodeInt:_cellMaxWidth forKey:@"PSMcellMaxWidth"]; [aCoder encodeInt:_cellOptimumWidth forKey:@"PSMcellOptimumWidth"]; @@ -1344,25 +1793,33 @@ - (void)encodeWithCoder:(NSCoder *)aCoder [aCoder encodeObject:partnerView forKey:@"PSMpartnerView"]; [aCoder encodeBool:_awakenedFromNib forKey:@"PSMawakenedFromNib"]; [aCoder encodeObject:_lastMouseDownEvent forKey:@"PSMlastMouseDownEvent"]; - [aCoder encodeObject:delegate forKey:@"PSMdelegate"]; - + [aCoder encodeObject:_lastMiddleMouseDownEvent forKey:@"PSMlastMiddleMouseDownEvent"]; + [aCoder encodeObject:_delegate forKey:@"PSMdelegate"]; + [aCoder encodeBool:_useOverflowMenu forKey:@"PSMuseOverflowMenu"]; + [aCoder encodeBool:_automaticallyAnimates forKey:@"PSMautomaticallyAnimates"]; + } } -- (id)initWithCoder:(NSCoder *)aDecoder +- (id)initWithCoder:(NSCoder *)aDecoder { self = [super initWithCoder:aDecoder]; if (self) { if ([aDecoder allowsKeyedCoding]) { _cells = [[aDecoder decodeObjectForKey:@"PSMcells"] retain]; - tabView = [[aDecoder decodeObjectForKey:@"PSMtabView"] retain]; + _tabView = [[aDecoder decodeObjectForKey:@"PSMtabView"] retain]; _overflowPopUpButton = [[aDecoder decodeObjectForKey:@"PSMoverflowPopUpButton"] retain]; _addTabButton = [[aDecoder decodeObjectForKey:@"PSMaddTabButton"] retain]; - style = [[aDecoder decodeObjectForKey:@"PSMstyle"] retain]; - _canCloseOnlyTab = [aDecoder decodeBoolForKey:@"PSMcanCloseOnlyTab"]; + _style = [[aDecoder decodeObjectForKey:@"PSMstyle"] retain]; + _orientation = [aDecoder decodeIntForKey:@"PSMorientation"]; + _disableTabClose = [aDecoder decodeBoolForKey:@"PSMdisableTabClose"]; _hideForSingleTab = [aDecoder decodeBoolForKey:@"PSMhideForSingleTab"]; + _allowsBackgroundTabClosing = [aDecoder decodeBoolForKey:@"PSMallowsBackgroundTabClosing"]; + _allowsResizing = [aDecoder decodeBoolForKey:@"PSMallowsResizing"]; + _selectsTabsOnMouseDown = [aDecoder decodeBoolForKey:@"PSMselectsTabsOnMouseDown"]; _showAddTabButton = [aDecoder decodeBoolForKey:@"PSMshowAddTabButton"]; _sizeCellsToFit = [aDecoder decodeBoolForKey:@"PSMsizeCellsToFit"]; + _stretchCellsToFit = [aDecoder decodeBoolForKey:@"PSMstretchCellsToFit"]; _cellMinWidth = [aDecoder decodeIntForKey:@"PSMcellMinWidth"]; _cellMaxWidth = [aDecoder decodeIntForKey:@"PSMcellMaxWidth"]; _cellOptimumWidth = [aDecoder decodeIntForKey:@"PSMcellOptimumWidth"]; @@ -1372,7 +1829,10 @@ - (id)initWithCoder:(NSCoder *)aDecoder partnerView = [[aDecoder decodeObjectForKey:@"PSMpartnerView"] retain]; _awakenedFromNib = [aDecoder decodeBoolForKey:@"PSMawakenedFromNib"]; _lastMouseDownEvent = [[aDecoder decodeObjectForKey:@"PSMlastMouseDownEvent"] retain]; - delegate = [[aDecoder decodeObjectForKey:@"PSMdelegate"] retain]; + _lastMiddleMouseDownEvent = [[aDecoder decodeObjectForKey:@"PSMlastMiddleMouseDownEvent"] retain]; + _useOverflowMenu = [aDecoder decodeBoolForKey:@"PSMuseOverflowMenu"]; + _automaticallyAnimates = [aDecoder decodeBoolForKey:@"PSMautomaticallyAnimates"]; + _delegate = [[aDecoder decodeObjectForKey:@"PSMdelegate"] retain]; } } return self; @@ -1381,81 +1841,107 @@ - (id)initWithCoder:(NSCoder *)aDecoder #pragma mark - #pragma mark IB Palette -- (NSSize)minimumFrameSizeFromKnobPosition:(int)position -{ +- (NSSize)minimumFrameSizeFromKnobPosition:(int)position { return NSMakeSize(100.0, 22.0); } -- (NSSize)maximumFrameSizeFromKnobPosition:(int)knobPosition -{ +- (NSSize)maximumFrameSizeFromKnobPosition:(int)knobPosition { return NSMakeSize(10000.0, 22.0); } -- (void)placeView:(NSRect)newFrame -{ +- (void)placeView:(NSRect)newFrame { // this is called any time the view is resized in IB [self setFrame:newFrame]; [self update]; } +- (void)changeIdentifier:(id)newIdentifier atIndex:(int)theIndex { + NSTabViewItem *tabViewItem = [_tabView tabViewItemAtIndex:theIndex]; + assert(tabViewItem); + for (PSMTabBarCell *cell in _cells) { + if ([cell representedObject] == tabViewItem) { + [tabViewItem setIdentifier:newIdentifier]; + return; + } + } + assert(false); +} + #pragma mark - #pragma mark Convenience -- (NSMutableArray *)representedTabViewItems -{ - NSMutableArray *temp = [NSMutableArray arrayWithCapacity:[_cells count]]; - NSEnumerator *e = [_cells objectEnumerator]; - PSMTabBarCell *cell; - while(cell = [e nextObject]){ - [temp addObject:[cell representedObject]]; +- (PSMTabBarCell *)cellWithIdentifier:(id)identifier { + for (PSMTabBarCell *cell in _cells) { + if ([cell.representedObject identifier] == identifier) { + return cell; + } } - return temp; + return nil; } -- (id)cellForPoint:(NSPoint)point cellFrame:(NSRectPointer)outFrame -{ - NSUInteger i = [self indexOfCellAtPoint:point cellFrame:outFrame]; - if (i == NSNotFound) - return nil; - PSMTabBarCell *cell = [_cells objectAtIndex:i]; - return cell; +- (void)setIsProcessing:(BOOL)isProcessing forTabWithIdentifier:(id)identifier { + PSMTabBarCell *cell = [self cellWithIdentifier:identifier]; + cell.indicator.hidden = !isProcessing; + cell.indicator.animate = isProcessing; } -- (NSUInteger)indexOfCellAtPoint:(NSPoint)point -{ - return [self indexOfCellAtPoint:point cellFrame:NULL]; +- (void)setIcon:(NSImage *)icon forTabWithIdentifier:(id)identifier { + PSMTabBarCell *cell = [self cellWithIdentifier:identifier]; + cell.hasIcon = (icon != nil); +} + +- (void)setObjectCount:(NSInteger)objectCount forTabWithIdentifier:(id)identifier { + PSMTabBarCell *cell = [self cellWithIdentifier:identifier]; + cell.count = objectCount; +} + +- (void)initializeStateForCell:(PSMTabBarCell *)cell { + [[cell indicator] setHidden:YES]; + [cell setHasIcon:NO]; + [cell setCount:0]; +} + +- (void)bindPropertiesForCell:(PSMTabBarCell *)cell andTabViewItem:(NSTabViewItem *)item { + // bind my string value to the label on the represented tab + [cell bind:@"title" toObject:item withKeyPath:@"label" options:nil]; + [_delegate tabView:_tabView updateStateForTabViewItem:item]; +} + +- (NSMutableArray *)representedTabViewItems { + NSMutableArray *temp = [NSMutableArray arrayWithCapacity:[_cells count]]; + for (PSMTabBarCell *cell in _cells) { + if ([cell representedObject]) { + [temp addObject:[cell representedObject]]; + } + } + return temp; } -- (NSUInteger)indexOfCellAtPoint:(NSPoint)point cellFrame:(NSRectPointer)outFrame +- (id)cellForPoint:(NSPoint)point cellFrame:(NSRectPointer)outFrame { - NSRect aRect = [self genericCellRect]; - - if(!NSPointInRect(point,aRect)){ - return NSNotFound; + if ([self orientation] == PSMTabBarHorizontalOrientation && !NSPointInRect(point, [self genericCellRect])) { + return nil; } - - NSUInteger i, cnt = [_cells count]; - for(i = 0; i < cnt; i++){ + + int i, cnt = [_cells count]; + for (i = 0; i < cnt; i++) { PSMTabBarCell *cell = [_cells objectAtIndex:i]; - float width = [cell width]; - aRect.size.width = width; - - if(NSPointInRect(point, aRect)){ - if(outFrame){ - *outFrame = aRect; + + if (NSPointInRect(point, [cell frame])) { + if (outFrame) { + *outFrame = [cell frame]; } - return i; + return cell; } - aRect.origin.x += width; } - return NSNotFound; + return nil; } - (PSMTabBarCell *)lastVisibleTab { int i, cellCount = [_cells count]; for(i = 0; i < cellCount; i++){ - if([[_cells objectAtIndex:i] isInOverflowMenu]) + if ([[_cells objectAtIndex:i] isInOverflowMenu]) return [_cells objectAtIndex:(i-1)]; } return [_cells objectAtIndex:(cellCount - 1)]; @@ -1465,11 +1951,183 @@ - (int)numberOfVisibleTabs { int i, cellCount = [_cells count]; for(i = 0; i < cellCount; i++){ - if([[_cells objectAtIndex:i] isInOverflowMenu]) - return i+1; + if ([[_cells objectAtIndex:i] isInOverflowMenu]) { + return i; + } } return cellCount; } - + +#pragma mark - +#pragma mark Accessibility + +-(BOOL)accessibilityIsIgnored { + return NO; +} + +- (NSArray*)accessibilityAttributeNames +{ + static NSArray *attributes = nil; + if (!attributes) { + NSSet *set = [NSSet setWithArray:[super accessibilityAttributeNames]]; + set = [set setByAddingObjectsFromArray:[NSArray arrayWithObjects: + NSAccessibilityTabsAttribute, + NSAccessibilityValueAttribute, + nil]]; + attributes = [[set allObjects] retain]; + } + return attributes; +} + +- (id)accessibilityAttributeValue:(NSString *)attribute { + id attributeValue = nil; + if ([attribute isEqualToString: NSAccessibilityRoleAttribute]) { + attributeValue = NSAccessibilityTabGroupRole; + } else if ([attribute isEqualToString: NSAccessibilityChildrenAttribute]) { + NSMutableArray *children = [NSMutableArray arrayWithArray:[_cells objectsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [self numberOfVisibleTabs])]]]; + if (![_overflowPopUpButton isHidden]) { + [children addObject:_overflowPopUpButton]; + } + if (![_addTabButton isHidden]) { + [children addObject:_addTabButton]; + } + attributeValue = NSAccessibilityUnignoredChildren(children); + } else if ([attribute isEqualToString: NSAccessibilityTabsAttribute]) { + attributeValue = NSAccessibilityUnignoredChildren(_cells); + } else if ([attribute isEqualToString:NSAccessibilityValueAttribute]) { + NSTabViewItem *tabViewItem = [_tabView selectedTabViewItem]; + for (NSActionCell *cell in _cells) { + if ([cell representedObject] == tabViewItem) + attributeValue = cell; + } + if (!attributeValue) + { + NSLog(@"WARNING: seems no tab cell is currently selected"); + } + } else { + attributeValue = [super accessibilityAttributeValue:attribute]; + } + return attributeValue; +} + +- (id)accessibilityHitTest:(NSPoint)point { + id hitTestResult = self; + + for (PSMTabBarCell *cell in _cells) { + if ([cell isHighlighted]) { + hitTestResult = [cell accessibilityHitTest:point]; + break; + } + } + + return hitTestResult; +} + +#pragma mark - iTerm Add On + +- (void)setTabColor:(NSColor *)aColor forTabViewItem:(NSTabViewItem *)tabViewItem { + BOOL updated = NO; + + for (PSMTabBarCell *cell in _cells) { + if ([cell representedObject] == tabViewItem) { + if ([cell tabColor] != aColor) { + updated = YES; + [cell setTabColor: aColor]; + } + } + } + + if (updated) { + [self update: NO]; + } +} + +- (NSColor*)tabColorForTabViewItem:(NSTabViewItem*)tabViewItem { + for (PSMTabBarCell *cell in _cells) { + if ([cell representedObject] == tabViewItem) { + return [cell tabColor]; + } + } + return nil; +} + +- (void)modifierChanged:(NSNotification *)aNotification { + int mask = ([[[aNotification userInfo] objectForKey:kPSMTabModifierKey] intValue]); + [self setModifier:mask]; +} + +- (NSString*)_modifierString { + NSString *str = @""; + if (_modifier & NSCommandKeyMask) { + str = [NSString stringWithFormat:@"⌘%@", str]; + } + if (_modifier & NSShiftKeyMask) { + str = [NSString stringWithFormat:@"⇧%@", str]; + } + if (_modifier & NSAlternateKeyMask) { + str = [NSString stringWithFormat:@"⌥%@", str]; + } + if (_modifier & NSControlKeyMask) { + str = [NSString stringWithFormat:@"^%@", str]; + } + return str; +} + +- (void)setModifier:(int)mask { + _modifier = mask; + NSString *str = [self _modifierString]; + + for (PSMTabBarCell *cell in _cells) { + [cell setModifierString:str]; + } + [self setNeedsDisplay]; +} + +- (void)fillPath:(NSBezierPath*)path { + [_style fillPath:path]; +} + +- (NSColor *)accessoryTextColor { + return [_style accessoryTextColor] ?: [NSColor blackColor]; +} + +- (void)setTabsHaveCloseButtons:(BOOL)tabsHaveCloseButtons { + _hasCloseButton = tabsHaveCloseButtons; + + for (PSMTabBarCell *cell in _cells) { + [cell setHasCloseButton:tabsHaveCloseButtons]; + } +} + +#pragma mark - NSDraggingSource + +- (NSDragOperation)draggingSession:(NSDraggingSession *)session sourceOperationMaskForDraggingContext:(NSDraggingContext)context { + switch (context) { + case NSDraggingContextWithinApplication: + return NSDragOperationEvery; + + case NSDraggingContextOutsideApplication: + default: + return NSDragOperationNone; + } +} + +#pragma mark - PSMProgressIndicatorDelegate + +- (void)progressIndicatorNeedsUpdate { + [self update]; +} + +- (void)setStyleNamed:(NSString *)styleName +{ +} + +- (void)setAllowsDragBetweenWindows:(BOOL)flag +{ +} + +- (void)setToolTip:(NSString *)value forTabViewItem:(NSTabViewItem *)tvi +{ +} @end diff --git a/src/MacVim/PSMTabBarControl/source/PSMTabBarControlInspector.h b/src/MacVim/PSMTabBarControl/source/PSMTabBarControlInspector.h deleted file mode 100644 index ba5d684b90..0000000000 --- a/src/MacVim/PSMTabBarControl/source/PSMTabBarControlInspector.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// PSMTabBarControlInspector.h -// PSMTabBarControl -// -// Created by John Pannell on 12/21/05. -// Copyright Positive Spin Media 2005. All rights reserved. -// - -#import - -@interface PSMTabBarControlInspector : IBInspector -{ - IBOutlet NSPopUpButton *_stylePopUp; - IBOutlet NSButton *_canCloseOnlyTab; - IBOutlet NSButton *_hideForSingleTab; - IBOutlet NSButton *_showAddTab; - IBOutlet NSTextField *_cellMinWidth; - IBOutlet NSTextField *_cellMaxWidth; - IBOutlet NSTextField *_cellOptimumWidth; - IBOutlet NSButton *_sizeToFit; - IBOutlet NSButton *_allowsDragBetweenWindows; -} -@end diff --git a/src/MacVim/PSMTabBarControl/source/PSMTabBarControlInspector.m b/src/MacVim/PSMTabBarControl/source/PSMTabBarControlInspector.m deleted file mode 100644 index d9c5b91c4f..0000000000 --- a/src/MacVim/PSMTabBarControl/source/PSMTabBarControlInspector.m +++ /dev/null @@ -1,99 +0,0 @@ -// -// PSMTabBarControlInspector.m -// PSMTabBarControl -// -// Created by John Pannell on 12/21/05. -// Copyright Positive Spin Media 2005 . All rights reserved. -// - -#import "PSMTabBarControlInspector.h" -#import "PSMTabBarControl.h" - -#define kPSMStyleTag 0 -#define kPSMCanCloseOnlyTabTag 1 -#define kPSMHideForSingleTabTag 2 -#define kPSMShowAddTabTag 3 -#define kPSMMinWidthTag 4 -#define kPSMMaxWidthTag 5 -#define kPSMOptimumWidthTag 6 -#define kPSMSizeToFitTag 7 -#define kPSMAllowsDragBetweenWindows 8 - -@implementation PSMTabBarControlInspector - -- (id)init -{ - self = [super init]; - [NSBundle loadNibNamed:@"PSMTabBarControlInspector" owner:self]; - return self; -} - -- (void)ok:(id)sender -{ - if([sender tag] == kPSMStyleTag){ - [[self object] setStyleNamed:[sender titleOfSelectedItem]]; - - } else if([sender tag] == kPSMCanCloseOnlyTabTag){ - [[self object] setCanCloseOnlyTab:[sender state]]; - - } else if([sender tag] == kPSMHideForSingleTabTag){ - [[self object] setHideForSingleTab:[sender state]]; - - } else if([sender tag] == kPSMShowAddTabTag){ - [[self object] setShowAddTabButton:[sender state]]; - - } else if([sender tag] == kPSMMinWidthTag){ - if([[self object] cellOptimumWidth] < [sender intValue]){ - [[self object] setCellMinWidth:[[self object] cellOptimumWidth]]; - [sender setIntValue:[[self object] cellOptimumWidth]]; - } else { - [[self object] setCellMinWidth:[sender intValue]]; - } - - } else if([sender tag] == kPSMMaxWidthTag){ - if([[self object] cellOptimumWidth] > [sender intValue]){ - [[self object] setCellMaxWidth:[[self object] cellOptimumWidth]]; - [sender setIntValue:[[self object] cellOptimumWidth]]; - } else { - [[self object] setCellMaxWidth:[sender intValue]]; - } - - } else if([sender tag] == kPSMOptimumWidthTag){ - if([[self object] cellMaxWidth] < [sender intValue]){ - [[self object] setCellOptimumWidth:[[self object] cellMaxWidth]]; - [sender setIntValue:[[self object] cellMaxWidth]]; - } else if([[self object] cellMinWidth] > [sender intValue]){ - [[self object] setCellOptimumWidth:[[self object] cellMinWidth]]; - [sender setIntValue:[[self object] cellMinWidth]]; - } else { - [[self object] setCellOptimumWidth:[sender intValue]]; - } - - } else if([sender tag] == kPSMSizeToFitTag){ - [[self object] setSizeCellsToFit:[sender state]]; - - } else if([sender tag] == kPSMAllowsDragBetweenWindows){ - [[self object] setAllowsDragBetweenWindows:[sender state]]; - - } - - - [super ok:sender]; -} - -- (void)revert:(id)sender -{ - [_stylePopUp selectItemWithTitle:[[self object] styleName]]; - [_canCloseOnlyTab setState:[[self object] canCloseOnlyTab]]; - [_hideForSingleTab setState:[[self object] hideForSingleTab]]; - [_showAddTab setState:[[self object] showAddTabButton]]; - [_cellMinWidth setIntValue:[[self object] cellMinWidth]]; - [_cellMaxWidth setIntValue:[[self object] cellMaxWidth]]; - [_cellOptimumWidth setIntValue:[[self object] cellOptimumWidth]]; - [_sizeToFit setState:[[self object] sizeCellsToFit]]; - [_allowsDragBetweenWindows setState:[[self object] allowsDragBetweenWindows]]; - - [super revert:sender]; -} - -@end diff --git a/src/MacVim/PSMTabBarControl/source/PSMTabBarControlPalette.h b/src/MacVim/PSMTabBarControl/source/PSMTabBarControlPalette.h deleted file mode 100644 index 0feb9ad9d0..0000000000 --- a/src/MacVim/PSMTabBarControl/source/PSMTabBarControlPalette.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// PSMTabBarControlPalette.h -// PSMTabBarControl -// -// Created by John Pannell on 12/21/05. -// Copyright Positive Spin Media 2005 . All rights reserved. -// - -#import -#import "PSMTabBarControl.h" - -@interface PSMTabBarControlPalette : IBPalette -{ - IBOutlet NSImageView *repImage; - PSMTabBarControl *_customControl; -} -@end - -@interface PSMTabBarControl (PSMTabBarControlPaletteInspector) -- (NSString *)inspectorClassName; -@end diff --git a/src/MacVim/PSMTabBarControl/source/PSMTabBarControlPalette.m b/src/MacVim/PSMTabBarControl/source/PSMTabBarControlPalette.m deleted file mode 100644 index bb5851aa18..0000000000 --- a/src/MacVim/PSMTabBarControl/source/PSMTabBarControlPalette.m +++ /dev/null @@ -1,35 +0,0 @@ -// -// PSMTabBarControlPalette.m -// PSMTabBarControl -// -// Created by John Pannell on 12/21/05. -// Copyright Positive Spin Media 2005 . All rights reserved. -// - -#import "PSMTabBarControlPalette.h" - -@implementation PSMTabBarControlPalette - -- (void)finishInstantiate -{ - // associate representative image with actual control - _customControl = [[PSMTabBarControl alloc] initWithFrame:NSMakeRect(0,0,180,22)]; - [self associateObject:_customControl ofType:IBViewPboardType withView:repImage]; -} - -- (void)dealloc -{ - [_customControl release]; - [super dealloc]; -} - -@end - -@implementation PSMTabBarControl (PSMTabBarControlPaletteInspector) - -- (NSString *)inspectorClassName -{ - return @"PSMTabBarControlInspector"; -} - -@end diff --git a/src/MacVim/PSMTabBarControl/source/PSMTabBarControl_Prefix.pch b/src/MacVim/PSMTabBarControl/source/PSMTabBarControl_Prefix.pch deleted file mode 100644 index 65df9ffedb..0000000000 --- a/src/MacVim/PSMTabBarControl/source/PSMTabBarControl_Prefix.pch +++ /dev/null @@ -1,8 +0,0 @@ -// -// Prefix header for all source files of the 'PSMTabBarControl' target in the 'PSMTabBarControl' project -// - -#ifdef __OBJC__ - #import - #import -#endif diff --git a/src/MacVim/PSMTabBarControl/source/PSMTabDragAssistant.h b/src/MacVim/PSMTabBarControl/source/PSMTabDragAssistant.h index 8c756c7233..21ace052ab 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMTabDragAssistant.h +++ b/src/MacVim/PSMTabBarControl/source/PSMTabDragAssistant.h @@ -16,16 +16,23 @@ @class PSMTabDragWindow; #define kPSMTabDragAnimationSteps 8 +#define kPSMTabDragWindowAlpha 0.75 #define PI 3.1417 -@interface PSMTabDragAssistant : NSObject { +@interface PSMTabDragAssistant : NSObject +{ PSMTabBarControl *_sourceTabBar; PSMTabBarControl *_destinationTabBar; NSMutableSet *_participatingTabBars; PSMTabBarCell *_draggedCell; int _draggedCellIndex; // for snap back BOOL _isDragging; - + + // Support for dragging into new windows + PSMTabDragWindow *_dragTabWindow, *_dragViewWindow; + NSSize _dragWindowOffset; + NSTimer *_fadeTimer; + // Animation NSTimer *_animationTimer; NSMutableArray *_sineCurveWidths; @@ -53,14 +60,18 @@ - (void)setTargetCell:(PSMTabBarCell *)cell; // Functionality +- (void)startAnimationWithOrientation:(PSMTabBarOrientation)orientation width:(CGFloat)width; - (void)startDraggingCell:(PSMTabBarCell *)cell fromTabBar:(PSMTabBarControl *)control withMouseDownEvent:(NSEvent *)event; - (void)draggingEnteredTabBar:(PSMTabBarControl *)control atPoint:(NSPoint)mouseLoc; - (void)draggingUpdatedInTabBar:(PSMTabBarControl *)control atPoint:(NSPoint)mouseLoc; - (void)draggingExitedTabBar:(PSMTabBarControl *)control; -- (void)performDragOperation; +- (void)performDragOperation:(id)sender; - (void)draggedImageEndedAt:(NSPoint)aPoint operation:(NSDragOperation)operation; - (void)finishDrag; +- (void)draggingBeganAt:(NSPoint)aPoint; +- (void)draggingMovedTo:(NSPoint)aPoint; + // Animation - (void)animateDrag:(NSTimer *)timer; - (void)calculateDragAnimationForTabBar:(PSMTabBarControl *)control; @@ -74,7 +85,7 @@ @interface PSMTabBarControl (DragAccessors) -- (id)psmTabStyle; +- (id)style; - (NSMutableArray *)cells; - (void)setControlView:(id)view; - (id)cellForPoint:(NSPoint)point cellFrame:(NSRectPointer)outFrame; diff --git a/src/MacVim/PSMTabBarControl/source/PSMTabDragAssistant.m b/src/MacVim/PSMTabBarControl/source/PSMTabDragAssistant.m index 9adee1c281..d32da69606 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMTabDragAssistant.m +++ b/src/MacVim/PSMTabBarControl/source/PSMTabDragAssistant.m @@ -9,7 +9,7 @@ #import "PSMTabDragAssistant.h" #import "PSMTabBarCell.h" #import "PSMTabStyle.h" - +#import "PSMTabDragWindow.h" @implementation PSMTabDragAssistant @@ -23,13 +23,13 @@ + (PSMTabDragAssistant *)sharedDragAssistant if (!sharedDragAssistant){ sharedDragAssistant = [[PSMTabDragAssistant alloc] init]; } - + return sharedDragAssistant; } - (id)init { - if(self = [super init]){ + if ( (self = [super init]) ) { _sourceTabBar = nil; _destinationTabBar = nil; _participatingTabBars = [[NSMutableSet alloc] init]; @@ -39,7 +39,7 @@ - (id)init _targetCell = nil; _isDragging = NO; } - + return self; } @@ -82,13 +82,11 @@ - (void)setDestinationTabBar:(PSMTabBarControl *)tabBar _destinationTabBar = tabBar; } -- (PSMTabBarCell *)draggedCell -{ +- (PSMTabBarCell *)draggedCell { return _draggedCell; } -- (void)setDraggedCell:(PSMTabBarCell *)cell -{ +- (void)setDraggedCell:(PSMTabBarCell *)cell { [cell retain]; [_draggedCell release]; _draggedCell = cell; @@ -139,33 +137,50 @@ - (void)setTargetCell:(PSMTabBarCell *)cell #pragma mark - #pragma mark Functionality -- (void)startDraggingCell:(PSMTabBarCell *)cell fromTabBar:(PSMTabBarControl *)control withMouseDownEvent:(NSEvent *)event +- (void)addSineCurveWidthsWithOrientation:(PSMTabBarOrientation)orientation size:(NSSize)size +{ + float cellStepSize = (orientation == PSMTabBarHorizontalOrientation) ? (size.width + 6) : (size.height + 1); + for (int i = 0; i < kPSMTabDragAnimationSteps - 1; i++) { + int thisWidth = (int)(cellStepSize - ((cellStepSize/2.0) + ((sin((PI/2.0) + ((float)i/(float)kPSMTabDragAnimationSteps)*PI) * cellStepSize) / 2.0))); + [_sineCurveWidths addObject:[NSNumber numberWithInt:thisWidth]]; + } + [_sineCurveWidths addObject:[NSNumber numberWithInt:(orientation == PSMTabBarHorizontalOrientation) ? size.width : size.height]]; +} + +- (void)startAnimation { + _animationTimer = [NSTimer scheduledTimerWithTimeInterval:(1.0/30.0) target:self selector:@selector(animateDrag:) userInfo:nil repeats:YES]; +} + +- (void)startAnimationWithOrientation:(PSMTabBarOrientation)orientation width:(CGFloat)width +{ + if ([_sineCurveWidths count] == 0) { + [self addSineCurveWidthsWithOrientation:orientation size:NSMakeSize(width, kPSMTabBarControlHeight)]; + } + [self startAnimation]; +} + +- (void)startDraggingCell:(PSMTabBarCell *)cell + fromTabBar:(PSMTabBarControl *)control + withMouseDownEvent:(NSEvent *)event { [self setIsDragging:YES]; [self setSourceTabBar:control]; [self setDestinationTabBar:control]; [_participatingTabBars addObject:control]; [self setDraggedCell:cell]; [self setDraggedCellIndex:[[control cells] indexOfObject:cell]]; - + NSRect cellFrame = [cell frame]; // list of widths for animation - int i; - float cellWidth = cellFrame.size.width; - for(i = 0; i < kPSMTabDragAnimationSteps; i++){ - int thisWidth; - thisWidth = (int)(cellWidth - ((cellWidth/2.0) + ((sin((PI/2.0) + ((float)i/(float)kPSMTabDragAnimationSteps)*PI) * cellWidth) / 2.0))); - [_sineCurveWidths addObject:[NSNumber numberWithInt:thisWidth]]; - } - + [self addSineCurveWidthsWithOrientation:[control orientation] size:cellFrame.size]; + // hide UI buttons [[control overflowPopUpButton] setHidden:YES]; [[control addTabButton] setHidden:YES]; - + [[NSCursor closedHandCursor] set]; - - NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard]; - NSImage *dragImage = [cell dragImageForRect:cellFrame]; + + NSImage *dragImage = [cell dragImage]; [[cell indicator] removeFromSuperview]; [self distributePlaceholdersInTabBar:control withDraggedCell:cell]; @@ -173,23 +188,66 @@ - (void)startDraggingCell:(PSMTabBarCell *)cell fromTabBar:(PSMTabBarControl *)c cellFrame.origin.y += cellFrame.size.height; } [cell setHighlighted:NO]; - NSSize offset = NSZeroSize; - [pboard declareTypes:[NSArray arrayWithObjects:@"PSMTabBarControlItemPBType", nil] owner: nil]; - [pboard setString:[[NSNumber numberWithInt:[[control cells] indexOfObject:cell]] stringValue] forType:@"PSMTabBarControlItemPBType"]; - _animationTimer = [NSTimer scheduledTimerWithTimeInterval:(1.0/30.0) target:self selector:@selector(animateDrag:) userInfo:nil repeats:YES]; - [control dragImage:dragImage at:cellFrame.origin offset:offset event:event pasteboard:pboard source:control slideBack:YES]; + [self startAnimation]; + + [[NSNotificationCenter defaultCenter] postNotificationName:PSMTabDragDidBeginNotification object:nil]; + + // Retain the control in case the drag operation causes the control to be released + [control retain]; + + NSPasteboardItem *pbItem = [[[NSPasteboardItem alloc] init] autorelease]; + [pbItem setString:[@([[control cells] indexOfObject:cell]) stringValue] + forType:@"com.iterm2.psm.controlitem"]; + + NSImage *imageToDrag; + NSRect draggingRect; + + _dragTabWindow = [[PSMTabDragWindow dragWindowWithTabBarCell:cell image:dragImage styleMask:NSBorderlessWindowMask] retain]; + [_dragTabWindow setAlphaValue:kPSMTabDragWindowAlpha]; + [_dragTabWindow orderFront:nil]; + + cellFrame.origin.y -= cellFrame.size.height; + + imageToDrag = [[[NSImage alloc] initWithSize:NSMakeSize(1, 1)] autorelease]; + draggingRect = NSMakeRect(cellFrame.origin.x, + cellFrame.origin.y, + 1, + 1); + + NSDraggingItem *dragItem = [[[NSDraggingItem alloc] initWithPasteboardWriter:pbItem] autorelease]; + [dragItem setDraggingFrame:draggingRect contents:imageToDrag]; + NSDraggingSession *draggingSession = [control beginDraggingSessionWithItems:@[ dragItem ] + event:event + source:control]; + draggingSession.animatesToStartingPositionsOnCancelOrFail = YES; + draggingSession.draggingFormation = NSDraggingFormationNone; + + [control release]; } - (void)draggingEnteredTabBar:(PSMTabBarControl *)control atPoint:(NSPoint)mouseLoc { + if (!_animationTimer) { + [self startAnimation]; + } [self setDestinationTabBar:control]; [self setCurrentMouseLoc:mouseLoc]; // hide UI buttons [[control overflowPopUpButton] setHidden:YES]; [[control addTabButton] setHidden:YES]; - if(![[[control cells] objectAtIndex:0] isPlaceholder]) + if([[control cells] count] == 0 || ![[[control cells] objectAtIndex:0] isPlaceholder]) [self distributePlaceholdersInTabBar:control]; [_participatingTabBars addObject:control]; + + //tell the drag window to display only the header if there is one + if (_dragViewWindow) { + if (_fadeTimer) { + [_fadeTimer invalidate]; + } + + [_dragTabWindow orderFront:nil]; + _fadeTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 / 30.0 target:self selector:@selector(fadeOutDragWindow:) userInfo:nil repeats:YES]; + } } - (void)draggingUpdatedInTabBar:(PSMTabBarControl *)control atPoint:(NSPoint)mouseLoc @@ -199,59 +257,325 @@ - (void)draggingUpdatedInTabBar:(PSMTabBarControl *)control atPoint:(NSPoint)mou [self setCurrentMouseLoc:mouseLoc]; } -- (void)draggingExitedTabBar:(PSMTabBarControl *)control -{ +- (void)draggingExitedTabBar:(PSMTabBarControl *)control { [self setDestinationTabBar:nil]; [self setCurrentMouseLoc:NSMakePoint(-1.0, -1.0)]; + + if (_fadeTimer) { + [_fadeTimer invalidate]; + _fadeTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 / 30.0 + target:self + selector:@selector(fadeInDragWindow:) + userInfo:nil + repeats:YES]; + } else if (_dragTabWindow) { + // create a new floating drag window + if (!_dragViewWindow) { + NSImage *viewImage = nil; + unsigned int styleMask = NSBorderlessWindowMask; + + if ([control delegate] && + [[control delegate] respondsToSelector:@selector(tabView:imageForTabViewItem:offset:styleMask:)]) { + // get a custom image representation of the view to drag from the delegate + NSImage *tabImage = [[_dragTabWindow contentView] image]; + NSPoint drawPoint; + _dragWindowOffset = NSZeroSize; + viewImage = [[control delegate] tabView:[control tabView] + imageForTabViewItem:[[self draggedCell] representedObject] + offset:&_dragWindowOffset + styleMask:&styleMask]; + + [viewImage lockFocus]; + + // draw the tab into the returned window, that way we don't have two windows being + // dragged (this assumes the tab will be on the window) + drawPoint = NSMakePoint(_dragWindowOffset.width, + [viewImage size].height - _dragWindowOffset.height); + + if ([control orientation] == PSMTabBarHorizontalOrientation) { + drawPoint.y += kPSMTabBarControlHeight - [tabImage size].height; + _dragWindowOffset.height -= kPSMTabBarControlHeight - [tabImage size].height; + } else { + drawPoint.x += [control frame].size.width - [tabImage size].width; + } + + [tabImage drawAtPoint:drawPoint + fromRect:NSZeroRect + operation:NSCompositeSourceOver + fraction:1]; + + [viewImage unlockFocus]; + } else { + // the delegate doesn't give a custom image, so use an image of the view + NSView *tabView = [[[self draggedCell] representedObject] view]; + viewImage = [[[NSImage alloc] initWithSize:[tabView frame].size] autorelease]; + [viewImage lockFocus]; + [tabView drawRect:[tabView bounds]]; + [viewImage unlockFocus]; + } + + if (styleMask | NSBorderlessWindowMask) { + _dragWindowOffset.height += 22; + } + + _dragViewWindow = [[PSMTabDragWindow dragWindowWithTabBarCell:[self draggedCell] + image:viewImage + styleMask:styleMask] retain]; + [_dragViewWindow setAlphaValue:0.0]; + } + + NSPoint windowOrigin = [_dragTabWindow frame].origin; + windowOrigin.x -= _dragWindowOffset.width; + windowOrigin.y += _dragWindowOffset.height; + [_dragViewWindow setFrameTopLeftPoint:windowOrigin]; + [_dragViewWindow orderWindow:NSWindowBelow relativeTo:[_dragTabWindow windowNumber]]; + + // set the window's alpha mask to zero if the last tab is being dragged + // don't fade out the old window if the delegate doesn't respond to the new tab bar method, just to be safe + if ([[[self sourceTabBar] tabView] numberOfTabViewItems] == 1 && + [self sourceTabBar] == control && + [[[self sourceTabBar] delegate] respondsToSelector:@selector(tabView:newTabBarForDraggedTabViewItem:atPoint:)]) { + + [[[self sourceTabBar] window] setAlphaValue:0.0]; + // Move the window out of the way so it doesn't block drop targets under it. + [[[self sourceTabBar] window] setFrameOrigin:NSMakePoint(-1000000, -1000000)]; + [_dragViewWindow setAlphaValue:kPSMTabDragWindowAlpha]; + } else { + _fadeTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 / 30.0 + target:self + selector:@selector(fadeInDragWindow:) + userInfo:nil + repeats:YES]; + } + } } -- (void)performDragOperation -{ -#if 1 +- (void)performDragOperation:(id)sender { // move cell - [[[self destinationTabBar] cells] replaceObjectAtIndex:[[[self destinationTabBar] cells] indexOfObject:[self targetCell]] withObject:[self draggedCell]]; - [[self draggedCell] setControlView:[self destinationTabBar]]; - // move actual NSTabViewItem - if([self sourceTabBar] != [self destinationTabBar]){ - [[[self sourceTabBar] tabView] removeTabViewItem:[[self draggedCell] representedObject]]; - [[[self destinationTabBar] tabView] addTabViewItem:[[self draggedCell] representedObject]]; + int destinationIndex = [[[self destinationTabBar] cells] indexOfObject:[self targetCell]]; + + //there is the slight possibility of the targetCell now being set properly, so avoid errors + if (destinationIndex >= [[[self destinationTabBar] cells] count]) { + destinationIndex = [[[self destinationTabBar] cells] count] - 1; } - [self finishDrag]; -#else - unsigned idx = [[[self destinationTabBar] cells] indexOfObject:[self targetCell]]; - - // move cell - [[[self destinationTabBar] cells] replaceObjectAtIndex:idx withObject:[self draggedCell]]; - [[self draggedCell] setControlView:[self destinationTabBar]]; - // move actual NSTabViewItem - if([self sourceTabBar] != [self destinationTabBar]){ - [[[self sourceTabBar] tabView] removeTabViewItem:[[self draggedCell] representedObject]]; - idx = [[[self destinationTabBar] cells] indexOfObject:[self draggedCell]]; - NSLog(@"Inserting at index %d", idx); - [[[self destinationTabBar] tabView] insertTabViewItem:[[self draggedCell] representedObject] atIndex:idx]; + + if (![self draggedCell]) { + // Find the index of where the dragged object was just dropped. + int i; + int insertIndex = 0; + NSArray *cells = [[self destinationTabBar] cells]; + PSMTabBarCell *before = nil; + if (destinationIndex > 0) { + before = [cells objectAtIndex:destinationIndex - 1]; + } + PSMTabBarCell *after = nil; + if (destinationIndex < [cells count] - 1) { + after = [cells objectAtIndex:destinationIndex + 1]; + } + + NSTabViewItem *newTabViewItem = [[[self destinationTabBar] delegate] tabView:[[self destinationTabBar] tabView] unknownObjectWasDropped:sender]; + cells = [[self destinationTabBar] cells]; + if (!after) { + insertIndex = [cells count]; + } else if (!before) { + insertIndex = 0; + } else { + for (i = 0; i < [cells count]; i++) { + if ([cells objectAtIndex:i] == before) { + insertIndex = i + 1; + break; + } else if ([cells objectAtIndex:i] == after) { + insertIndex = i; + break; + } + } + } + + // If newTabViewItem is nil then simply cancel the drop. + if (newTabViewItem) { + [[[self destinationTabBar] tabView] insertTabViewItem:newTabViewItem atIndex:insertIndex]; + [[[self destinationTabBar] tabView] indexOfTabViewItem:newTabViewItem]; + // I'm not sure why, but calling -bindPropertiesForCell:andTabViewItem: + // here causes there to be an extra binding. It seems to have its + // bindings set when it's added to the control. Other paths through this + // function do explicitly set the bindings. + + // Select the newly moved item in the destination tab view. + [[[self destinationTabBar] tabView] selectTabViewItem:newTabViewItem]; + } + } else { + [[[self destinationTabBar] cells] replaceObjectAtIndex:destinationIndex withObject:[self draggedCell]]; + [[self draggedCell] setControlView:[self destinationTabBar]]; + + // move actual NSTabViewItem + if ([self sourceTabBar] != [self destinationTabBar]) { + //remove the tracking rects and bindings registered on the old tab + [[self sourceTabBar] removeTrackingRect:[[self draggedCell] closeButtonTrackingTag]]; + [[self sourceTabBar] removeTrackingRect:[[self draggedCell] cellTrackingTag]]; + [[self sourceTabBar] removeTabForCell:[self draggedCell]]; + + int i, insertIndex; + NSArray *cells = [[self destinationTabBar] cells]; + + //find the index of where the dragged cell was just dropped + for (i = 0, insertIndex = 0; (i < [cells count]) && ([cells objectAtIndex:i] != [self draggedCell]); i++, insertIndex++) { + if ([[cells objectAtIndex:i] isPlaceholder]) { + insertIndex--; + } + } + + if ([[[self sourceTabBar] delegate] respondsToSelector:@selector(tabView:willDropTabViewItem:inTabBar:)]) { + [[[self sourceTabBar] delegate] tabView:[[self sourceTabBar] tabView] + willDropTabViewItem:[[self draggedCell] representedObject] + inTabBar:[self destinationTabBar]]; + } + + [[[self sourceTabBar] tabView] removeTabViewItem:[[self draggedCell] representedObject]]; + [[[self destinationTabBar] tabView] insertTabViewItem:[[self draggedCell] representedObject] atIndex:insertIndex]; + + //rebind the cell to the new control + [[self destinationTabBar] initializeStateForCell:[self draggedCell]]; + [[self destinationTabBar] bindPropertiesForCell:[self draggedCell] andTabViewItem:[[self draggedCell] representedObject]]; + + //select the newly moved item in the destination tab view + [[[self destinationTabBar] tabView] selectTabViewItem:[[self draggedCell] representedObject]]; + } else { + //have to do this before checking the index of a cell otherwise placeholders will be counted + [self removeAllPlaceholdersFromTabBar:[self sourceTabBar]]; + + //rearrange the tab view items + NSTabView *tabView = [[self sourceTabBar] tabView]; + NSTabViewItem *item = [[self draggedCell] representedObject]; + BOOL reselect = ([tabView selectedTabViewItem] == item); + int theIndex; + NSArray *cells = [[self sourceTabBar] cells]; + + //find the index of where the dragged cell was just dropped + for (theIndex = 0; theIndex < [cells count] && [cells objectAtIndex:theIndex] != [self draggedCell]; theIndex++); + + if ([[[self sourceTabBar] cells] indexOfObject:[self draggedCell]] != _draggedCellIndex && + [[[self sourceTabBar] delegate] respondsToSelector:@selector(tabView:willDropTabViewItem:inTabBar:)]) { + + [[[self sourceTabBar] delegate] tabView:[[self sourceTabBar] tabView] + willDropTabViewItem:[[self draggedCell] representedObject] + inTabBar:[self destinationTabBar]]; + } + //temporarily disable the delegate in order to move the tab to a different index + id tempDelegate = [tabView delegate]; + [tabView setDelegate:nil]; + [item retain]; + [tabView removeTabViewItem:item]; + [tabView insertTabViewItem:item atIndex:theIndex]; + [item release]; + if (reselect) { + [tabView selectTabViewItem:item]; + } + [tabView setDelegate:tempDelegate]; + } + + if (([self sourceTabBar] != [self destinationTabBar] || + [[[self sourceTabBar] cells] indexOfObject:[self draggedCell]] != _draggedCellIndex) && + [[[self sourceTabBar] delegate] respondsToSelector:@selector(tabView:didDropTabViewItem:inTabBar:)]) { + + [[[self sourceTabBar] delegate] tabView:[[self sourceTabBar] tabView] + didDropTabViewItem:[[self draggedCell] representedObject] + inTabBar:[self destinationTabBar]]; + } } + + [[NSNotificationCenter defaultCenter] postNotificationName:PSMTabDragDidEndNotification object:nil]; + [self finishDrag]; -#endif } -- (void)draggedImageEndedAt:(NSPoint)aPoint operation:(NSDragOperation)operation -{ - if([self isDragging]){ // means there was not a successful drop (performDragOperation) - // put cell back - [[[self sourceTabBar] cells] insertObject:[self draggedCell] atIndex:[self draggedCellIndex]]; +- (void)draggedImageEndedAt:(NSPoint)aPoint operation:(NSDragOperation)operation { + if ([self isDragging]){ // means there was not a successful drop (performDragOperation) + id sourceDelegate = [[self sourceTabBar] delegate]; + + //split off the dragged tab into a new window + if ([self destinationTabBar] == nil && + [sourceDelegate respondsToSelector:@selector(tabView:shouldDropTabViewItem:inTabBar:)] && + [sourceDelegate tabView:[[self sourceTabBar] tabView] + shouldDropTabViewItem:[[self draggedCell] representedObject] + inTabBar:nil] && + [sourceDelegate respondsToSelector:@selector(tabView:newTabBarForDraggedTabViewItem:atPoint:)]) { + + PSMTabBarControl *control = [sourceDelegate tabView:[[self sourceTabBar] tabView] + newTabBarForDraggedTabViewItem:[[self draggedCell] representedObject] + atPoint:aPoint]; + + if (control) { + if ([sourceDelegate respondsToSelector:@selector(tabView:willDropTabViewItem:inTabBar:)]) { + [sourceDelegate tabView:[[self sourceTabBar] tabView] + willDropTabViewItem:[[self draggedCell] representedObject] + inTabBar:control]; + } + //add the dragged tab to the new window + [[control cells] insertObject:[self draggedCell] atIndex:0]; + + //remove the tracking rects and bindings registered on the old tab + [[self sourceTabBar] removeTrackingRect:[[self draggedCell] closeButtonTrackingTag]]; + [[self sourceTabBar] removeTrackingRect:[[self draggedCell] cellTrackingTag]]; + [[self sourceTabBar] removeTabForCell:[self draggedCell]]; + + //rebind the cell to the new control + [control initializeStateForCell:[self draggedCell]]; + [control bindPropertiesForCell:[self draggedCell] andTabViewItem:[[self draggedCell] representedObject]]; + + [[self draggedCell] setControlView:control]; + + [[[self sourceTabBar] tabView] removeTabViewItem:[[self draggedCell] representedObject]]; + + [[control tabView] addTabViewItem:[[self draggedCell] representedObject]]; + [[control window] makeKeyAndOrderFront:nil]; + + if ([sourceDelegate respondsToSelector:@selector(tabView:didDropTabViewItem:inTabBar:)]) { + [sourceDelegate tabView:[[self sourceTabBar] tabView] + didDropTabViewItem:[[self draggedCell] representedObject] + inTabBar:control]; + } + } else { + NSLog(@"Delegate returned no control to add to."); + [[[self sourceTabBar] cells] insertObject:[self draggedCell] atIndex:[self draggedCellIndex]]; + [[[self sourceTabBar] window] setAlphaValue:1]; // Make the window visible again. + } + + } else { + // put cell back + [[[self sourceTabBar] cells] insertObject:[self draggedCell] atIndex:[self draggedCellIndex]]; + } + + [[NSNotificationCenter defaultCenter] postNotificationName:PSMTabDragDidEndNotification object:nil]; + [self finishDrag]; } } - (void)finishDrag { + if ([[[self sourceTabBar] tabView] numberOfTabViewItems] == 0 && [[[self sourceTabBar] delegate] respondsToSelector:@selector(tabView:closeWindowForLastTabViewItem:)]) { + [[[self sourceTabBar] delegate] tabView:[[self sourceTabBar] tabView] closeWindowForLastTabViewItem:[[self draggedCell] representedObject]]; + } + + if (_dragTabWindow) { + [_dragTabWindow orderOut:nil]; + [_dragTabWindow release]; + _dragTabWindow = nil; + } + + if (_dragViewWindow) { + [_dragViewWindow orderOut:nil]; + [_dragViewWindow release]; + _dragViewWindow = nil; + } + [self setIsDragging:NO]; [self removeAllPlaceholdersFromTabBar:[self sourceTabBar]]; [self setSourceTabBar:nil]; [self setDestinationTabBar:nil]; NSEnumerator *e = [_participatingTabBars objectEnumerator]; PSMTabBarControl *tabBar; - while(tabBar = [e nextObject]){ + while ( (tabBar = [e nextObject]) ) { [self removeAllPlaceholdersFromTabBar:tabBar]; } [_participatingTabBars removeAllObjects]; @@ -262,16 +586,77 @@ - (void)finishDrag [self setTargetCell:nil]; } +- (void)draggingBeganAt:(NSPoint)aPoint +{ + if (_dragTabWindow) { + [_dragTabWindow setFrameTopLeftPoint:aPoint]; + + if ([[[self sourceTabBar] tabView] numberOfTabViewItems] == 1) { + [self draggingExitedTabBar:[self sourceTabBar]]; + [_dragTabWindow setAlphaValue:0.0]; + } + } +} + +- (void)draggingMovedTo:(NSPoint)aPoint +{ + if (_dragTabWindow) { + [_dragTabWindow setFrameTopLeftPoint:aPoint]; + + if (_dragViewWindow) { + //move the view representation with the tab + //the relative position of the dragged view window will be different + //depending on the position of the tab bar relative to the controlled tab view + + aPoint.y -= [_dragTabWindow frame].size.height; + aPoint.x -= _dragWindowOffset.width; + aPoint.y += _dragWindowOffset.height; + [_dragViewWindow setFrameTopLeftPoint:aPoint]; + } + } +} + +- (void)fadeInDragWindow:(NSTimer *)timer +{ + float value = [_dragViewWindow alphaValue]; + if (value >= kPSMTabDragWindowAlpha || _dragTabWindow == nil) { + [timer invalidate]; + _fadeTimer = nil; + } else { + [_dragTabWindow setAlphaValue:[_dragTabWindow alphaValue] - 0.15]; + [_dragViewWindow setAlphaValue:value + 0.15]; + } +} + +- (void)fadeOutDragWindow:(NSTimer *)timer +{ + float value = [_dragViewWindow alphaValue]; + if (value <= 0.0) { + [_dragViewWindow setAlphaValue:0.0]; + [_dragTabWindow setAlphaValue:kPSMTabDragWindowAlpha]; + + [timer invalidate]; + _fadeTimer = nil; + } else { + if ([_dragTabWindow alphaValue] < kPSMTabDragWindowAlpha) { + [_dragTabWindow setAlphaValue:[_dragTabWindow alphaValue] + 0.15]; + } + [_dragViewWindow setAlphaValue:value - 0.15]; + } +} + #pragma mark - #pragma mark Animation - (void)animateDrag:(NSTimer *)timer { - NSEnumerator *e = [_participatingTabBars objectEnumerator]; - PSMTabBarControl *tabBar; - while(tabBar = [e nextObject]){ - [self calculateDragAnimationForTabBar:tabBar]; - [[NSRunLoop currentRunLoop] performSelector:@selector(display) target:tabBar argument:nil order:1 modes:[NSArray arrayWithObjects:@"NSEventTrackingRunLoopMode", @"NSDefaultRunLoopMode", nil]]; + NSArray* objects = [_participatingTabBars allObjects]; + for (int i = 0; i < [objects count]; ++i) { + PSMTabBarControl* tabBar = [objects objectAtIndex:i]; + if ([_participatingTabBars containsObject:tabBar]) { + [self calculateDragAnimationForTabBar:tabBar]; + [[NSRunLoop currentRunLoop] performSelector:@selector(display) target:tabBar argument:nil order:1 modes:[NSArray arrayWithObjects:@"NSEventTrackingRunLoopMode", @"NSDefaultRunLoopMode", nil]]; + } } } @@ -280,47 +665,50 @@ - (void)calculateDragAnimationForTabBar:(PSMTabBarControl *)control BOOL removeFlag = YES; NSMutableArray *cells = [control cells]; int i, cellCount = [cells count]; - float xPos = [[control psmTabStyle] leftMarginForTabBarControl]; - + float position = [control orientation] == PSMTabBarHorizontalOrientation ? [[control style] leftMarginForTabBarControl] : [[control style] topMarginForTabBarControl]; + // identify target cell // mouse at beginning of tabs NSPoint mouseLoc = [self currentMouseLoc]; - if([self destinationTabBar] == control){ + if ([self destinationTabBar] == control) { removeFlag = NO; - if(mouseLoc.x < [[control psmTabStyle] leftMarginForTabBarControl]){ + if (mouseLoc.x < [[control style] leftMarginForTabBarControl]) { [self setTargetCell:[cells objectAtIndex:0]]; - goto layout; - } - - NSRect overCellRect; - PSMTabBarCell *overCell = [control cellForPoint:mouseLoc cellFrame:&overCellRect]; - if(overCell){ - // mouse among cells - placeholder - if([overCell isPlaceholder]){ - [self setTargetCell:overCell]; - goto layout; - } - - // non-placeholders - if(mouseLoc.x < (overCellRect.origin.x + (overCellRect.size.width / 2.0))){ - // mouse on left side of cell - [self setTargetCell:[cells objectAtIndex:([cells indexOfObject:overCell] - 1)]]; - goto layout; + } else { + NSRect overCellRect; + PSMTabBarCell *overCell = [control cellForPoint:mouseLoc cellFrame:&overCellRect]; + if(overCell){ + // mouse among cells - placeholder + if ([overCell isPlaceholder]) { + [self setTargetCell:overCell]; + } else if ([control orientation] == PSMTabBarHorizontalOrientation) { + // non-placeholders - horizontal orientation + if (mouseLoc.x < (overCellRect.origin.x + (overCellRect.size.width / 2.0))) { + // mouse on left side of cell + [self setTargetCell:[cells objectAtIndex:([cells indexOfObject:overCell] - 1)]]; + } else { + // mouse on right side of cell + [self setTargetCell:[cells objectAtIndex:([cells indexOfObject:overCell] + 1)]]; + } + } else { + // non-placeholders - vertical orientation + if (mouseLoc.y < (overCellRect.origin.y + (overCellRect.size.height / 2.0))) { + // mouse on top of cell + [self setTargetCell:[cells objectAtIndex:([cells indexOfObject:overCell] - 1)]]; + } else { + // mouse on bottom of cell + [self setTargetCell:[cells objectAtIndex:([cells indexOfObject:overCell] + 1)]]; + } + } } else { - // mouse on right side of cell - [self setTargetCell:[cells objectAtIndex:([cells indexOfObject:overCell] + 1)]]; - goto layout; + // out at end - must find proper cell (could be more in overflow menu) + [self setTargetCell:[control lastVisibleTab]]; } - } else { - // out at end - must find proper cell (could be more in overflow menu) - [self setTargetCell:[control lastVisibleTab]]; - goto layout; } } else { [self setTargetCell:nil]; } - -layout: + for(i = 0; i < cellCount; i++){ PSMTabBarCell *cell = [cells objectAtIndex:i]; NSRect newRect = [cell frame]; @@ -334,16 +722,27 @@ - (void)calculateDragAnimationForTabBar:(PSMTabBarControl *)control removeFlag = NO; } } - newRect.size.width = [[_sineCurveWidths objectAtIndex:[cell currentStep]] intValue]; + + if ([control orientation] == PSMTabBarHorizontalOrientation) { + newRect.size.width = [[_sineCurveWidths objectAtIndex:[cell currentStep]] intValue]; + } else { + newRect.size.height = [[_sineCurveWidths objectAtIndex:[cell currentStep]] intValue]; + } } } else { break; } - newRect.origin.x = xPos; + + if ([control orientation] == PSMTabBarHorizontalOrientation) { + newRect.origin.x = position; + position += newRect.size.width; + } else { + newRect.origin.y = position; + position += newRect.size.height; + } [cell setFrame:newRect]; if([cell indicator]) - [[cell indicator] setFrame:[[control psmTabStyle] indicatorRectForTabCell:cell]]; - xPos += newRect.size.width; + [[cell indicator] setFrame:[[control style] indicatorRectForTabCell:cell]]; } if(removeFlag){ [_participatingTabBars removeObject:control]; @@ -361,6 +760,7 @@ - (void)distributePlaceholdersInTabBar:(PSMTabBarControl *)control withDraggedCe // replace dragged cell with a placeholder, and clean up surrounding cells int cellIndex = [[control cells] indexOfObject:cell]; PSMTabBarCell *pc = [[[PSMTabBarCell alloc] initPlaceholderWithFrame:[[self draggedCell] frame] expanded:YES inControlView:control] autorelease]; + pc.truncationStyle = cell.truncationStyle; [[control cells] replaceObjectAtIndex:cellIndex withObject:pc]; [[control cells] removeObjectAtIndex:(cellIndex + 1)]; [[control cells] removeObjectAtIndex:(cellIndex - 1)]; @@ -370,17 +770,28 @@ - (void)distributePlaceholdersInTabBar:(PSMTabBarControl *)control withDraggedCe - (void)distributePlaceholdersInTabBar:(PSMTabBarControl *)control { int i, numVisibleTabs = [control numberOfVisibleTabs]; - for(i = 0; i < numVisibleTabs; i++){ - PSMTabBarCell *pc = [[[PSMTabBarCell alloc] initPlaceholderWithFrame:[[self draggedCell] frame] expanded:NO inControlView:control] autorelease]; + PSMTabBarCell *draggedCell = [self draggedCell]; + NSRect draggedCellFrame; + NSLineBreakMode truncationStyle; + if (draggedCell) { + draggedCellFrame = [draggedCell frame]; + truncationStyle = draggedCell.truncationStyle; + } else { + draggedCellFrame = [[[control cells] objectAtIndex:0] frame]; + truncationStyle = [[[control cells] objectAtIndex:0] truncationStyle]; + } + for(i = 0; i < numVisibleTabs; i++) { + PSMTabBarCell *pc = [[[PSMTabBarCell alloc] initPlaceholderWithFrame:draggedCellFrame expanded:NO inControlView:control] autorelease]; + pc.truncationStyle = truncationStyle; [[control cells] insertObject:pc atIndex:(2 * i)]; } - if(numVisibleTabs > 0){ - PSMTabBarCell *pc = [[[PSMTabBarCell alloc] initPlaceholderWithFrame:[[self draggedCell] frame] expanded:NO inControlView:control] autorelease]; - if([[control cells] count] > (2 * numVisibleTabs)){ - [[control cells] insertObject:pc atIndex:(2 * numVisibleTabs)]; - } else { - [[control cells] addObject:pc]; - } + + PSMTabBarCell *pc = [[[PSMTabBarCell alloc] initPlaceholderWithFrame:draggedCellFrame expanded:NO inControlView:control] autorelease]; + pc.truncationStyle = truncationStyle; + if ([[control cells] count] > (2 * numVisibleTabs)) { + [[control cells] insertObject:pc atIndex:(2 * numVisibleTabs)]; + } else { + [[control cells] addObject:pc]; } } @@ -435,5 +846,4 @@ - (id)initWithCoder:(NSCoder *)aDecoder { return self; } - @end diff --git a/src/MacVim/PSMTabBarControl/source/PSMTabDragWindow.h b/src/MacVim/PSMTabBarControl/source/PSMTabDragWindow.h new file mode 100644 index 0000000000..59e60b17e0 --- /dev/null +++ b/src/MacVim/PSMTabBarControl/source/PSMTabDragWindow.h @@ -0,0 +1,21 @@ +// +// PSMTabDragWindow.h +// PSMTabBarControl +// +// Created by Kent Sutherland on 6/1/06. +// Copyright 2006 Kent Sutherland. All rights reserved. +// + +#import + +@class PSMTabBarCell; + +@interface PSMTabDragWindow : NSWindow { + PSMTabBarCell *_cell; + NSImageView *_imageView; +} ++ (PSMTabDragWindow *)dragWindowWithTabBarCell:(PSMTabBarCell *)cell image:(NSImage *)image styleMask:(unsigned int)styleMask; + +- (id)initWithTabBarCell:(PSMTabBarCell *)cell image:(NSImage *)image styleMask:(unsigned int)styleMask; +- (NSImage *)image; +@end diff --git a/src/MacVim/PSMTabBarControl/source/PSMTabDragWindow.m b/src/MacVim/PSMTabBarControl/source/PSMTabDragWindow.m new file mode 100644 index 0000000000..1f47b12f75 --- /dev/null +++ b/src/MacVim/PSMTabBarControl/source/PSMTabDragWindow.m @@ -0,0 +1,58 @@ +// +// PSMTabDragWindow.m +// PSMTabBarControl +// +// Created by Kent Sutherland on 6/1/06. +// Copyright 2006 Kent Sutherland. All rights reserved. +// + +#import "PSMTabDragWindow.h" +#import "PSMTabBarCell.h" + +@implementation PSMTabDragWindow + ++ (PSMTabDragWindow *)dragWindowWithTabBarCell:(PSMTabBarCell *)cell image:(NSImage *)image styleMask:(unsigned int)styleMask +{ + return [[[PSMTabDragWindow alloc] initWithTabBarCell:cell image:image styleMask:styleMask] autorelease]; +} + +- (id)initWithTabBarCell:(PSMTabBarCell *)cell image:(NSImage *)image styleMask:(unsigned int)styleMask +{ + if ( (self = [super initWithContentRect:NSMakeRect(0, 0, 0, 0) styleMask:styleMask backing:NSBackingStoreBuffered defer:NO]) ) { + _cell = [cell retain]; + _imageView = [[[NSImageView alloc] initWithFrame:NSMakeRect(0, 0, 0, 0)] autorelease]; + [self setContentView:_imageView]; + [self setLevel:NSStatusWindowLevel]; + [self setIgnoresMouseEvents:YES]; + [self setOpaque:NO]; + + [_imageView setImage:image]; + + //Set the size of the window to be the exact size of the drag image + NSSize imageSize = [image size]; + NSRect windowFrame = [self frame]; + + windowFrame.origin.y += windowFrame.size.height - imageSize.height; + windowFrame.size = imageSize; + + if (styleMask | NSBorderlessWindowMask) { + windowFrame.size.height += 22; + } + + [self setFrame:windowFrame display:YES]; + } + return self; +} + +- (void)dealloc +{ + [_cell release]; + [super dealloc]; +} + +- (NSImage *)image +{ + return [[self contentView] image]; +} + +@end diff --git a/src/MacVim/PSMTabBarControl/source/PSMTabStyle.h b/src/MacVim/PSMTabBarControl/source/PSMTabStyle.h index eedf7b7712..b792e6321e 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMTabStyle.h +++ b/src/MacVim/PSMTabBarControl/source/PSMTabStyle.h @@ -21,6 +21,7 @@ Protocol to be observed by all style delegate objects. These objects handle the // control specific parameters - (float)leftMarginForTabBarControl; - (float)rightMarginForTabBarControl; +- (float)topMarginForTabBarControl; // add tab button - (NSImage *)addTabButtonImage; @@ -28,6 +29,7 @@ Protocol to be observed by all style delegate objects. These objects handle the - (NSImage *)addTabButtonRolloverImage; // cell specific parameters +- (NSRect)dragRectForTabCell:(PSMTabBarCell *)cell orientation:(PSMTabBarOrientation)orientation; - (NSRect)closeButtonRectForTabCell:(PSMTabBarCell *)cell; - (NSRect)iconRectForTabCell:(PSMTabBarCell *)cell; - (NSRect)indicatorRectForTabCell:(PSMTabBarCell *)cell; @@ -40,8 +42,17 @@ Protocol to be observed by all style delegate objects. These objects handle the - (NSAttributedString *)attributedStringValueForTabCell:(PSMTabBarCell *)cell; // drawing -- (void)drawTabCell:(PSMTabBarCell *)cell; -- (void)drawTabBar:(PSMTabBarControl *)bar inRect:(NSRect)rect; +- (void)drawTabCell:(PSMTabBarCell *)cell highlightAmount:(CGFloat)highlightAmount; +- (void)drawBackgroundInRect:(NSRect)rect color:(NSColor*)color horizontal:(BOOL)horizontal; +- (void)drawTabBar:(PSMTabBarControl *)bar inRect:(NSRect)rect horizontal:(BOOL)horizontal; + +- (NSColor *)accessoryFillColor; +- (NSColor *)accessoryStrokeColor; +- (void)fillPath:(NSBezierPath*)path; +- (NSColor *)accessoryTextColor; + +// Should light-tinted controls be used? +- (BOOL)useLightControls; @end @@ -49,4 +60,4 @@ Protocol to be observed by all style delegate objects. These objects handle the - (NSMutableArray *)cells; -@end \ No newline at end of file +@end diff --git a/src/MacVim/PSMTabBarControl/source/PSMUnifiedTabStyle.h b/src/MacVim/PSMTabBarControl/source/PSMUnifiedTabStyle.h deleted file mode 100644 index 871f713c52..0000000000 --- a/src/MacVim/PSMTabBarControl/source/PSMUnifiedTabStyle.h +++ /dev/null @@ -1,26 +0,0 @@ -// -// PSMUnifiedTabStyle.h -// -------------------- -// -// Created by Keith Blount on 30/04/2006. -// Copyright 2006 __MyCompanyName__. All rights reserved. -// - -#import -#import "PSMTabStyle.h" - -@interface PSMUnifiedTabStyle : NSObject -{ - NSImage *unifiedCloseButton; - NSImage *unifiedCloseButtonDown; - NSImage *unifiedCloseButtonOver; - NSImage *_addTabButtonImage; - NSImage *_addTabButtonPressedImage; - NSImage *_addTabButtonRolloverImage; - NSMutableParagraphStyle *truncatingTailParagraphStyle; - NSMutableParagraphStyle *centeredParagraphStyle; - - float leftMargin; -} -- (void)setLeftMarginForTabBarControl:(float)margin; -@end diff --git a/src/MacVim/PSMTabBarControl/source/PSMUnifiedTabStyle.m b/src/MacVim/PSMTabBarControl/source/PSMUnifiedTabStyle.m deleted file mode 100644 index 56a60d3fab..0000000000 --- a/src/MacVim/PSMTabBarControl/source/PSMUnifiedTabStyle.m +++ /dev/null @@ -1,525 +0,0 @@ -// -// PSMUnifiedTabStyle.m -// -------------------- -// -// Created by Keith Blount on 30/04/2006. -// Copyright 2006 __MyCompanyName__. All rights reserved. -// - -#import "PSMUnifiedTabStyle.h" -#import "PSMTabBarCell.h" -#import "PSMTabBarControl.h" -#import "NSBezierPath_AMShading.h" - -#define kPSMUnifiedObjectCounterRadius 7.0 -#define kPSMUnifiedCounterMinWidth 20 - -@interface PSMUnifiedTabStyle (Private) -- (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlView; -@end - -@implementation PSMUnifiedTabStyle - -- (NSString *)name -{ - return @"Unified"; -} - -#pragma mark - -#pragma mark Creation/Destruction - -- (id) init -{ - if((self = [super init])) - { - unifiedCloseButton = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabClose_Front"]]; - unifiedCloseButtonDown = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabClose_Front_Pressed"]]; - unifiedCloseButtonOver = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabClose_Front_Rollover"]]; - - _addTabButtonImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabNew"]]; - _addTabButtonPressedImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabNewPressed"]]; - _addTabButtonRolloverImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabNewRollover"]]; - - leftMargin = 5.0; - } - return self; -} - -- (void)dealloc -{ - [unifiedCloseButton release]; - [unifiedCloseButtonDown release]; - [unifiedCloseButtonOver release]; - [_addTabButtonImage release]; - [_addTabButtonPressedImage release]; - [_addTabButtonRolloverImage release]; - [truncatingTailParagraphStyle release]; - [centeredParagraphStyle release]; - - [super dealloc]; -} - -#pragma mark - -#pragma mark Control Specific - -- (void)setLeftMarginForTabBarControl:(float)margin -{ - leftMargin = margin; -} - -- (float)leftMarginForTabBarControl -{ - return leftMargin; -} - -- (float)rightMarginForTabBarControl -{ - return 24.0f; -} - -#pragma mark - -#pragma mark Add Tab Button - -- (NSImage *)addTabButtonImage -{ - return _addTabButtonImage; -} - -- (NSImage *)addTabButtonPressedImage -{ - return _addTabButtonPressedImage; -} - -- (NSImage *)addTabButtonRolloverImage -{ - return _addTabButtonRolloverImage; -} - -#pragma mark - -#pragma mark Cell Specific - -- (NSRect) closeButtonRectForTabCell:(PSMTabBarCell *)cell -{ - NSRect cellFrame = [cell frame]; - - if ([cell hasCloseButton] == NO) { - return NSZeroRect; - } - - NSRect result; - result.size = [unifiedCloseButton size]; - result.origin.x = cellFrame.origin.x + MARGIN_X; - result.origin.y = cellFrame.origin.y + MARGIN_Y + 1.0; - - return result; -} - -- (NSRect)iconRectForTabCell:(PSMTabBarCell *)cell -{ - NSRect cellFrame = [cell frame]; - - if ([cell hasIcon] == NO) { - return NSZeroRect; - } - - NSRect result; - result.size = NSMakeSize(kPSMTabBarIconWidth, kPSMTabBarIconWidth); - result.origin.x = cellFrame.origin.x + MARGIN_X; - result.origin.y = cellFrame.origin.y + MARGIN_Y + 1.0; - - if([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) - result.origin.x += [unifiedCloseButton size].width + kPSMTabBarCellPadding; - - return result; -} - -- (NSRect)indicatorRectForTabCell:(PSMTabBarCell *)cell -{ - NSRect cellFrame = [cell frame]; - - if ([[cell indicator] isHidden]) { - return NSZeroRect; - } - - NSRect result; - result.size = NSMakeSize(kPSMTabBarIndicatorWidth, kPSMTabBarIndicatorWidth); - result.origin.x = cellFrame.origin.x + cellFrame.size.width - MARGIN_X - kPSMTabBarIndicatorWidth; - result.origin.y = cellFrame.origin.y + MARGIN_Y - 1.0; - - return result; -} - -- (NSRect)objectCounterRectForTabCell:(PSMTabBarCell *)cell -{ - NSRect cellFrame = [cell frame]; - - if ([cell count] == 0) { - return NSZeroRect; - } - - float countWidth = [[self attributedObjectCountValueForTabCell:cell] size].width; - countWidth += (2 * kPSMUnifiedObjectCounterRadius - 6.0); - if(countWidth < kPSMUnifiedCounterMinWidth) - countWidth = kPSMUnifiedCounterMinWidth; - - NSRect result; - result.size = NSMakeSize(countWidth, 2 * kPSMUnifiedObjectCounterRadius); // temp - result.origin.x = cellFrame.origin.x + cellFrame.size.width - MARGIN_X - result.size.width; - result.origin.y = cellFrame.origin.y + MARGIN_Y + 1.0; - - if(![[cell indicator] isHidden]) - result.origin.x -= kPSMTabBarIndicatorWidth + kPSMTabBarCellPadding; - - return result; -} - - -- (float)minimumWidthOfTabCell:(PSMTabBarCell *)cell -{ - float resultWidth = 0.0; - - // left margin - resultWidth = MARGIN_X; - - // close button? - if([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) - resultWidth += [unifiedCloseButton size].width + kPSMTabBarCellPadding; - - // icon? - if([cell hasIcon]) - resultWidth += kPSMTabBarIconWidth + kPSMTabBarCellPadding; - - // the label - resultWidth += kPSMMinimumTitleWidth; - - // object counter? - if([cell count] > 0) - resultWidth += [self objectCounterRectForTabCell:cell].size.width + kPSMTabBarCellPadding; - - // indicator? - if ([[cell indicator] isHidden] == NO) - resultWidth += kPSMTabBarCellPadding + kPSMTabBarIndicatorWidth; - - // right margin - resultWidth += MARGIN_X; - - return ceil(resultWidth); -} - -- (float)desiredWidthOfTabCell:(PSMTabBarCell *)cell -{ - float resultWidth = 0.0; - - // left margin - resultWidth = MARGIN_X; - - // close button? - if ([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) - resultWidth += [unifiedCloseButton size].width + kPSMTabBarCellPadding; - - // icon? - if([cell hasIcon]) - resultWidth += kPSMTabBarIconWidth + kPSMTabBarCellPadding; - - // the label - resultWidth += [[cell attributedStringValue] size].width; - - // object counter? - if([cell count] > 0) - resultWidth += [self objectCounterRectForTabCell:cell].size.width + kPSMTabBarCellPadding; - - // indicator? - if ([[cell indicator] isHidden] == NO) - resultWidth += kPSMTabBarCellPadding + kPSMTabBarIndicatorWidth; - - // right margin - resultWidth += MARGIN_X; - - return ceil(resultWidth); -} - -#pragma mark - -#pragma mark Cell Values - -- (NSAttributedString *)attributedObjectCountValueForTabCell:(PSMTabBarCell *)cell -{ - NSMutableAttributedString *attrStr; - NSFontManager *fm = [NSFontManager sharedFontManager]; - NSNumberFormatter *nf = [[[NSNumberFormatter alloc] init] autorelease]; - [nf setLocalizesFormat:YES]; - [nf setFormat:@"0"]; - [nf setHasThousandSeparators:YES]; - NSString *contents = [nf stringFromNumber:[NSNumber numberWithInt:[cell count]]]; - attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease]; - NSRange range = NSMakeRange(0, [contents length]); - - // Add font attribute - [attrStr addAttribute:NSFontAttributeName value:[fm convertFont:[NSFont fontWithName:@"Helvetica" size:11.0] toHaveTrait:NSBoldFontMask] range:range]; - [attrStr addAttribute:NSForegroundColorAttributeName value:[[NSColor whiteColor] colorWithAlphaComponent:0.85] range:range]; - - return attrStr; -} - -- (NSAttributedString *)attributedStringValueForTabCell:(PSMTabBarCell *)cell -{ - NSMutableAttributedString *attrStr; - NSString * contents = [cell stringValue]; - attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease]; - NSRange range = NSMakeRange(0, [contents length]); - - [attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0] range:range]; - - // Paragraph Style for Truncating Long Text - if (!truncatingTailParagraphStyle) { - truncatingTailParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain]; - [truncatingTailParagraphStyle setLineBreakMode:NSLineBreakByTruncatingTail]; - } - [attrStr addAttribute:NSParagraphStyleAttributeName value:truncatingTailParagraphStyle range:range]; - - return attrStr; -} - -#pragma mark - -#pragma mark ---- drawing ---- - -- (void)drawTabCell:(PSMTabBarCell *)cell -{ - NSRect cellFrame = [cell frame]; - NSColor * lineColor = nil; - NSBezierPath* bezier = [NSBezierPath bezierPath]; - lineColor = [NSColor colorWithCalibratedWhite:0.576 alpha:1.0]; - - if ([cell state] == NSOnState) - { - // selected tab - NSRect aRect = NSMakeRect(cellFrame.origin.x+0.5, cellFrame.origin.y-0.5, cellFrame.size.width-1.0, cellFrame.size.height); - aRect.size.height -= 0.5; - - aRect.size.height+=0.5; - - // frame - float radius = MIN(6.0, 0.5f * MIN(NSWidth(aRect), NSHeight(aRect))); - NSRect rect = NSInsetRect(aRect, radius, radius); - - [bezier appendBezierPathWithArcWithCenter:NSMakePoint(NSMinX(rect), NSMinY(rect)) radius:radius startAngle:180.0 endAngle:270.0]; - - [bezier appendBezierPathWithArcWithCenter:NSMakePoint(NSMaxX(rect), NSMinY(rect)) radius:radius startAngle:270.0 endAngle:360.0]; - - NSPoint cornerPoint = NSMakePoint(NSMaxX(aRect), NSMaxY(aRect)); - [bezier appendBezierPathWithPoints:&cornerPoint count:1]; - - cornerPoint = NSMakePoint(NSMinX(aRect), NSMaxY(aRect)); - [bezier appendBezierPathWithPoints:&cornerPoint count:1]; - - [bezier closePath]; - - //[[NSColor windowBackgroundColor] set]; - //[bezier fill]; - [bezier linearGradientFillWithStartColor:[NSColor colorWithCalibratedWhite:0.99 alpha:1.0] - endColor:[NSColor colorWithCalibratedWhite:0.941 alpha:1.0]]; - - [lineColor set]; - [bezier stroke]; - } - else - { - // unselected tab - NSRect aRect = NSMakeRect(cellFrame.origin.x, cellFrame.origin.y, cellFrame.size.width, cellFrame.size.height); - aRect.origin.y += 0.5; - aRect.origin.x += 1.5; - aRect.size.width -= 1; - - aRect.origin.x -= 1; - aRect.size.width += 1; - - // rollover - if ([cell isHighlighted]) - { - [[NSColor colorWithCalibratedWhite:0.0 alpha:0.1] set]; - NSRectFillUsingOperation(aRect, NSCompositingOperationSourceAtop); - } - - // frame - - [lineColor set]; - [bezier moveToPoint:NSMakePoint(aRect.origin.x + aRect.size.width, aRect.origin.y-0.5)]; - if(!([cell tabState] & PSMTab_RightIsSelectedMask)){ - [bezier lineToPoint:NSMakePoint(NSMaxX(aRect), NSMaxY(aRect))]; - } - - [bezier stroke]; - - // Create a thin lighter line next to the dividing line for a bezel effect - if(!([cell tabState] & PSMTab_RightIsSelectedMask)){ - [[[NSColor whiteColor] colorWithAlphaComponent:0.5] set]; - [NSBezierPath strokeLineFromPoint:NSMakePoint(NSMaxX(aRect)+1.0, aRect.origin.y-0.5) - toPoint:NSMakePoint(NSMaxX(aRect)+1.0, NSMaxY(aRect)-2.5)]; - } - - // If this is the leftmost tab, we want to draw a line on the left, too - if ([cell tabState] & PSMTab_PositionLeftMask) - { - [lineColor set]; - [NSBezierPath strokeLineFromPoint:NSMakePoint(aRect.origin.x,aRect.origin.y-0.5) - toPoint:NSMakePoint(aRect.origin.x,NSMaxY(aRect)-2.5)]; - [[[NSColor whiteColor] colorWithAlphaComponent:0.5] set]; - [NSBezierPath strokeLineFromPoint:NSMakePoint(aRect.origin.x+1.0,aRect.origin.y-0.5) - toPoint:NSMakePoint(aRect.origin.x+1.0,NSMaxY(aRect)-2.5)]; - } - } - - [self drawInteriorWithTabCell:cell inView:[cell controlView]]; -} - - - -- (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlView -{ - NSRect cellFrame = [cell frame]; - float labelPosition = cellFrame.origin.x + MARGIN_X; - - // close button - if ([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) { - NSSize closeButtonSize = NSZeroSize; - NSRect closeButtonRect = [cell closeButtonRectForFrame:cellFrame]; - NSImage * closeButton = nil; - - closeButton = unifiedCloseButton; - if ([cell closeButtonOver]) closeButton = unifiedCloseButtonOver; - if ([cell closeButtonPressed]) closeButton = unifiedCloseButtonDown; - - closeButtonSize = [closeButton size]; - [closeButton drawInRect:closeButtonRect fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1.0 respectFlipped:YES hints:nil]; - - // scoot label over - labelPosition += closeButtonSize.width + kPSMTabBarCellPadding; - } - -#if 0 // MacVim: disable this code. It is unused and calling 'content' on the represented object's identifier seems dangerous at best. - // icon - if([cell hasIcon]){ - NSRect iconRect = [self iconRectForTabCell:cell]; - NSImage *icon = [[[[cell representedObject] identifier] content] icon]; - if ([controlView isFlipped]) { - iconRect.origin.y = cellFrame.size.height - iconRect.origin.y; - } - [icon compositeToPoint:iconRect.origin operation:NSCompositeSourceOver fraction:1.0]; - - // scoot label over - labelPosition += iconRect.size.width + kPSMTabBarCellPadding; - } -#endif - - // object counter - if([cell count] > 0){ - [[NSColor colorWithCalibratedWhite:0.3 alpha:0.6] set]; - NSBezierPath *path = [NSBezierPath bezierPath]; - NSRect myRect = [self objectCounterRectForTabCell:cell]; - myRect.origin.y -= 1.0; - [path moveToPoint:NSMakePoint(myRect.origin.x + kPSMUnifiedObjectCounterRadius, myRect.origin.y)]; - [path lineToPoint:NSMakePoint(myRect.origin.x + myRect.size.width - kPSMUnifiedObjectCounterRadius, myRect.origin.y)]; - [path appendBezierPathWithArcWithCenter:NSMakePoint(myRect.origin.x + myRect.size.width - kPSMUnifiedObjectCounterRadius, myRect.origin.y + kPSMUnifiedObjectCounterRadius) radius:kPSMUnifiedObjectCounterRadius startAngle:270.0 endAngle:90.0]; - [path lineToPoint:NSMakePoint(myRect.origin.x + kPSMUnifiedObjectCounterRadius, myRect.origin.y + myRect.size.height)]; - [path appendBezierPathWithArcWithCenter:NSMakePoint(myRect.origin.x + kPSMUnifiedObjectCounterRadius, myRect.origin.y + kPSMUnifiedObjectCounterRadius) radius:kPSMUnifiedObjectCounterRadius startAngle:90.0 endAngle:270.0]; - [path fill]; - - // draw attributed string centered in area - NSRect counterStringRect; - NSAttributedString *counterString = [self attributedObjectCountValueForTabCell:cell]; - counterStringRect.size = [counterString size]; - counterStringRect.origin.x = myRect.origin.x + ((myRect.size.width - counterStringRect.size.width) / 2.0) + 0.25; - counterStringRect.origin.y = myRect.origin.y + ((myRect.size.height - counterStringRect.size.height) / 2.0) + 0.5; - [counterString drawInRect:counterStringRect]; - } - - // label rect - NSRect labelRect; - labelRect.origin.x = labelPosition; - labelRect.size.width = cellFrame.size.width - (labelRect.origin.x - cellFrame.origin.x) - kPSMTabBarCellPadding; - NSSize s = [[cell attributedStringValue] size]; - labelRect.origin.y = cellFrame.origin.y + (cellFrame.size.height-s.height)/2.0 - 1.0; - labelRect.size.height = s.height; - - if(![[cell indicator] isHidden]) - labelRect.size.width -= (kPSMTabBarIndicatorWidth + kPSMTabBarCellPadding); - - if([cell count] > 0) - labelRect.size.width -= ([self objectCounterRectForTabCell:cell].size.width + kPSMTabBarCellPadding); - - // label - [[cell attributedStringValue] drawInRect:labelRect]; -} - -- (void)drawTabBar:(PSMTabBarControl *)bar inRect:(NSRect)rect -{ - NSRect gradientRect = rect; - gradientRect.size.height -= 1.0; - NSBezierPath *path = [NSBezierPath bezierPathWithRect:gradientRect]; - [path linearGradientFillWithStartColor:[NSColor colorWithCalibratedWhite:0.918 alpha:1.0] - endColor:[NSColor colorWithCalibratedWhite:0.843 alpha:1.0]]; - [[NSColor colorWithCalibratedWhite:0.576 alpha:1.0] set]; - [NSBezierPath strokeLineFromPoint:NSMakePoint(rect.origin.x,NSMaxY(rect)-0.5) - toPoint:NSMakePoint(NSMaxX(rect),NSMaxY(rect)-0.5)]; - - // no tab view == not connected - if(![bar tabView]){ - NSRect labelRect = rect; - labelRect.size.height -= 4.0; - labelRect.origin.y += 4.0; - NSMutableAttributedString *attrStr; - NSString *contents = @"PSMTabBarControl"; - attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease]; - NSRange range = NSMakeRange(0, [contents length]); - [attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0] range:range]; - if (!centeredParagraphStyle) { - centeredParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain]; - [centeredParagraphStyle setAlignment:NSTextAlignmentCenter]; - } - [attrStr addAttribute:NSParagraphStyleAttributeName value:centeredParagraphStyle range:range]; - [attrStr drawInRect:labelRect]; - return; - } - - // draw cells - NSEnumerator *e = [[bar cells] objectEnumerator]; - PSMTabBarCell *cell; - while(cell = [e nextObject]){ - if(![cell isInOverflowMenu]){ - [cell drawWithFrame:[cell frame] inView:bar]; - } - } -} - -#pragma mark - -#pragma mark Archiving - -- (void)encodeWithCoder:(NSCoder *)aCoder -{ - //[super encodeWithCoder:aCoder]; - if ([aCoder allowsKeyedCoding]) { - [aCoder encodeObject:unifiedCloseButton forKey:@"unifiedCloseButton"]; - [aCoder encodeObject:unifiedCloseButtonDown forKey:@"unifiedCloseButtonDown"]; - [aCoder encodeObject:unifiedCloseButtonOver forKey:@"unifiedCloseButtonOver"]; - [aCoder encodeObject:_addTabButtonImage forKey:@"addTabButtonImage"]; - [aCoder encodeObject:_addTabButtonPressedImage forKey:@"addTabButtonPressedImage"]; - [aCoder encodeObject:_addTabButtonRolloverImage forKey:@"addTabButtonRolloverImage"]; - } -} - -- (id)initWithCoder:(NSCoder *)aDecoder -{ - // self = [super initWithCoder:aDecoder]; - //if (self) { - if ([aDecoder allowsKeyedCoding]) { - unifiedCloseButton = [[aDecoder decodeObjectForKey:@"unifiedCloseButton"] retain]; - unifiedCloseButtonDown = [[aDecoder decodeObjectForKey:@"unifiedCloseButtonDown"] retain]; - unifiedCloseButtonOver = [[aDecoder decodeObjectForKey:@"unifiedCloseButtonOver"] retain]; - _addTabButtonImage = [[aDecoder decodeObjectForKey:@"addTabButtonImage"] retain]; - _addTabButtonPressedImage = [[aDecoder decodeObjectForKey:@"addTabButtonPressedImage"] retain]; - _addTabButtonRolloverImage = [[aDecoder decodeObjectForKey:@"addTabButtonRolloverImage"] retain]; - } - //} - return self; -} - -@end diff --git a/src/MacVim/PSMTabBarControl/source/PSMYosemiteTabStyle.h b/src/MacVim/PSMTabBarControl/source/PSMYosemiteTabStyle.h index 2f3581132f..3a6018e1d1 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMYosemiteTabStyle.h +++ b/src/MacVim/PSMTabBarControl/source/PSMYosemiteTabStyle.h @@ -2,27 +2,21 @@ // PSMYosemiteTabStyle.h // PSMTabBarControl // -// Created by Christoffer Winterkvist on 25/08/14. -// +// Created by John Pannell on 2/17/06. +// Copyright 2006 Positive Spin Media. All rights reserved. // #import #import "PSMTabStyle.h" +#import "PSMTabBarControl.h" + +@interface PSMYosemiteTabStyle : NSObject -@interface PSMYosemiteTabStyle : NSObject { - NSImage *closeButton; - NSImage *closeButtonDown; - NSImage *closeButtonOver; - NSImage *_addTabButtonImage; - NSImage *_addTabButtonPressedImage; - NSImage *_addTabButtonRolloverImage; - NSMutableParagraphStyle *truncatingTailParagraphStyle; - NSMutableParagraphStyle *centeredParagraphStyle; -} +@property(nonatomic, readonly) PSMTabBarControl *tabBar; +@property(nonatomic, readonly) BOOL isYosemiteOrLater; -- (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlView; +#pragma mark - For subclasses -- (void)encodeWithCoder:(NSCoder *)aCoder; -- (id)initWithCoder:(NSCoder *)aDecoder; +- (NSColor *)topLineColorSelected:(BOOL)selected; @end diff --git a/src/MacVim/PSMTabBarControl/source/PSMYosemiteTabStyle.m b/src/MacVim/PSMTabBarControl/source/PSMYosemiteTabStyle.m index f51cceed44..d7adedbefc 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMYosemiteTabStyle.m +++ b/src/MacVim/PSMTabBarControl/source/PSMYosemiteTabStyle.m @@ -2,117 +2,184 @@ // PSMYosemiteTabStyle.m // PSMTabBarControl // -// Created by Christoffer Winterkvist on 25/08/14. -// +// Created by John Pannell on 2/17/06. +// Copyright 2006 Positive Spin Media. All rights reserved. // #import "PSMYosemiteTabStyle.h" +#import "PSMTabBarCell.h" +#import "PSMTabBarControl.h" +#import #define kPSMMetalObjectCounterRadius 7.0 #define kPSMMetalCounterMinWidth 20 -void YosemiteNSDrawWindowBackground(NSRect rect, NSColor *color) -{ - [color set]; - NSRectFill( rect ); +@interface NSAttributedString(PSM) +- (NSAttributedString *)attributedStringWithTextAlignment:(NSTextAlignment)textAlignment; +@end + +@implementation NSAttributedString(PSM) + +- (NSAttributedString *)attributedStringWithTextAlignment:(NSTextAlignment)textAlignment { + if (self.length == 0) { + return self; + } + NSDictionary *immutableAttributes = [self attributesAtIndex:0 effectiveRange:nil]; + if (!immutableAttributes) { + return self; + } + + NSMutableDictionary *attributes = [[immutableAttributes mutableCopy] autorelease]; + NSMutableParagraphStyle *paragraphStyle = [[attributes[NSParagraphStyleAttributeName] mutableCopy] autorelease]; + if (!paragraphStyle) { + paragraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease]; + } + paragraphStyle.alignment = textAlignment; + NSMutableAttributedString *temp = [[self mutableCopy] autorelease]; + attributes[NSParagraphStyleAttributeName] = paragraphStyle; + [temp setAttributes:attributes range:NSMakeRange(0, temp.length)]; + return temp; } -@implementation PSMYosemiteTabStyle +@end -- (void)dealloc -{ - [closeButton release]; - [closeButtonDown release]; - [closeButtonOver release]; - [_addTabButtonImage release]; - [_addTabButtonPressedImage release]; - [_addTabButtonRolloverImage release]; +@interface PSMTabBarCell(PSMYosemiteTabStyle) - [truncatingTailParagraphStyle release]; - [centeredParagraphStyle release]; +@property(nonatomic) NSAttributedString *previousAttributedString; +@property(nonatomic) CGFloat previousWidthOfAttributedString; - [super dealloc]; +@end + +@implementation PSMTabBarCell(PSMYosemiteTabStyle) + +- (NSMutableDictionary *)psm_yosemiteAssociatedDictionary { + NSMutableDictionary *dictionary = objc_getAssociatedObject(self, _cmd); + if (!dictionary) { + dictionary = [NSMutableDictionary dictionary]; + objc_setAssociatedObject(self, _cmd, dictionary, OBJC_ASSOCIATION_RETAIN); + } + return dictionary; } -#pragma mark - -#pragma mark Initializers +- (NSAttributedString *)previousAttributedString { + return self.psm_yosemiteAssociatedDictionary[@"attributedString"]; +} -- (id)init -{ - self = [super init]; - if (!self) return nil; +- (void)setPreviousAttributedString:(NSAttributedString *)previousAttributedString { + self.psm_yosemiteAssociatedDictionary[@"attributedString"] = [[previousAttributedString copy] autorelease]; +} - closeButton = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"TabClose_Front"]]; - //NSLog(@"closeButton=%@ path=%@", metalCloseButton, - // [[PSMTabBarControl bundle] pathForImageResource:@"TabClose_Front"]); - closeButtonDown = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"TabClose_Front_Pressed"]]; - closeButtonOver = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"TabClose_Front_Rollover"]]; +- (CGFloat)previousWidthOfAttributedString { + return [self.psm_yosemiteAssociatedDictionary[@"attributedStringWidth"] doubleValue]; +} - _addTabButtonImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"TabNewMetal"]]; - _addTabButtonPressedImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"TabNewMetalPressed"]]; - _addTabButtonRolloverImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"TabNewMetalRollover"]]; +- (void)setPreviousWidthOfAttributedString:(CGFloat)previousWidthOfAttributedString { + self.psm_yosemiteAssociatedDictionary[@"attributedStringWidth"] = @(previousWidthOfAttributedString); +} - return self; +@end + +@implementation PSMYosemiteTabStyle { + NSImage *_closeButton; + NSImage *_closeButtonDown; + NSImage *_closeButtonOver; + NSImage *_addTabButtonImage; + NSImage *_addTabButtonPressedImage; + NSImage *_addTabButtonRolloverImage; + + NSDictionary *_objectCountStringAttributes; + + PSMTabBarOrientation _orientation; + PSMTabBarControl *_tabBar; } -- (NSString *)name -{ +- (NSString *)name { return @"Yosemite"; } #pragma mark - -#pragma mark Control Specific +#pragma mark Creation/Destruction + +- (id)init { + if ((self = [super init])) { + // Load close buttons + _closeButton = [[NSImage imageNamed:@"TabClose_Front"] retain]; + _closeButtonDown = [[NSImage imageNamed:@"TabClose_Front_Pressed"] retain]; + _closeButtonOver = [[NSImage imageNamed:@"TabClose_Front_Rollover"] retain]; + + // Load "new tab" buttons + _addTabButtonImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"TabNewMetal"]]; + _addTabButtonPressedImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"TabNewMetalPressed"]]; + _addTabButtonRolloverImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"TabNewMetalRollover"]]; + } + return self; +} -- (float)leftMarginForTabBarControl -{ - return -1.0f; +- (void)dealloc { + [_closeButton release]; + [_closeButtonDown release]; + [_closeButtonOver release]; + [_addTabButtonImage release]; + [_addTabButtonPressedImage release]; + [_addTabButtonRolloverImage release]; + + [super dealloc]; } -- (float)rightMarginForTabBarControl -{ +#pragma mark - Control Specific + +- (float)leftMarginForTabBarControl { + return 0.0f; +} + +- (float)rightMarginForTabBarControl { + // Leaves space for overflow control. return 24.0f; } -#pragma mark - -#pragma mark Add Tab Button +// For vertical orientation +- (float)topMarginForTabBarControl { + return 0.0f; +} -- (NSImage *)addTabButtonImage -{ +#pragma mark - Add Tab Button + +- (NSImage *)addTabButtonImage { return _addTabButtonImage; } -- (NSImage *)addTabButtonPressedImage -{ +- (NSImage *)addTabButtonPressedImage { return _addTabButtonPressedImage; } -- (NSImage *)addTabButtonRolloverImage -{ +- (NSImage *)addTabButtonRolloverImage { return _addTabButtonRolloverImage; } -- (NSColor *)backgroundColor:(BOOL)isKeyWindow -{ - NSColor *backgroundColor; - if (isKeyWindow) { - backgroundColor = [NSColor colorWithCalibratedHue:0.000 saturation:0.000 brightness:0.875 alpha:1]; - } else { - backgroundColor = [NSColor colorWithCalibratedHue:0.000 saturation:0.000 brightness:0.957 alpha:1]; +#pragma mark - Cell Specific + +- (NSRect)dragRectForTabCell:(PSMTabBarCell *)cell + orientation:(PSMTabBarOrientation)tabOrientation { + NSRect dragRect = [cell frame]; + dragRect.size.width++; + + if ([cell tabState] & PSMTab_SelectedMask) { + if (tabOrientation == PSMTabBarHorizontalOrientation) { + dragRect.size.height -= 2.0; + } else { + dragRect.size.height += 1.0; + dragRect.origin.y -= 1.0; + dragRect.origin.x += 2.0; + dragRect.size.width -= 3.0; + } + } else if (tabOrientation == PSMTabBarVerticalOrientation) { + dragRect.origin.x--; } - return backgroundColor; + return dragRect; } -- (NSColor *)borderColor -{ - return [NSColor colorWithCalibratedHue:0.000 saturation:0.000 brightness:0.678 alpha:1]; -} - -#pragma mark - -#pragma mark Cell Specific - -- (NSRect) closeButtonRectForTabCell:(PSMTabBarCell *)cell -{ +- (NSRect)closeButtonRectForTabCell:(PSMTabBarCell *)cell { NSRect cellFrame = [cell frame]; if ([cell hasCloseButton] == NO) { @@ -120,58 +187,58 @@ - (NSRect) closeButtonRectForTabCell:(PSMTabBarCell *)cell } NSRect result; - result.size = [closeButton size]; - result.origin.x = cellFrame.origin.x + MARGIN_X; - result.origin.y = cellFrame.origin.y + MARGIN_Y + 2.0; + result.size = [_closeButton size]; + result.origin.x = cellFrame.origin.x + kSPMTabBarCellInternalXMargin; + result.origin.y = cellFrame.origin.y + floor((cellFrame.size.height - result.size.height) / 2.0); return result; } -- (NSRect)iconRectForTabCell:(PSMTabBarCell *)cell -{ +- (NSRect)iconRectForTabCell:(PSMTabBarCell *)cell { NSRect cellFrame = [cell frame]; if ([cell hasIcon] == NO) { return NSZeroRect; } + CGFloat minX; + if ([cell count]) { + NSRect objectCounterRect = [self objectCounterRectForTabCell:cell]; + minX = NSMinX(objectCounterRect); + } else if (![[cell indicator] isHidden]) { + minX = NSMinX([self indicatorRectForTabCell:cell]) - kSPMTabBarCellInternalXMargin; + } else { + minX = NSMaxX(cellFrame) - kSPMTabBarCellInternalXMargin; + } NSRect result; result.size = NSMakeSize(kPSMTabBarIconWidth, kPSMTabBarIconWidth); - result.origin.x = cellFrame.origin.x + MARGIN_X; - result.origin.y = cellFrame.origin.y + MARGIN_Y; - - if([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) - result.origin.x += [closeButton size].width + kPSMTabBarCellPadding; - - if([cell state] == NSOnState){ - result.origin.y += 1; - } + result.origin.x = minX - kPSMTabBarCellIconPadding - kPSMTabBarIconWidth; + result.origin.y = cellFrame.origin.y + floor((cellFrame.size.height - result.size.height) / 2.0); return result; } -- (NSRect)indicatorRectForTabCell:(PSMTabBarCell *)cell -{ +- (NSRect)indicatorRectForTabCell:(PSMTabBarCell *)cell { NSRect cellFrame = [cell frame]; - if ([[cell indicator] isHidden]) { - return NSZeroRect; + CGFloat minX; + if ([cell count]) { + // Indicator to the left of the tab number + NSRect objectCounterRect = [self objectCounterRectForTabCell:cell]; + minX = NSMinX(objectCounterRect); + } else { + // Indicator on the right edge of the tab. + minX = NSMaxX(cellFrame) - kSPMTabBarCellInternalXMargin; } - NSRect result; result.size = NSMakeSize(kPSMTabBarIndicatorWidth, kPSMTabBarIndicatorWidth); - result.origin.x = cellFrame.origin.x + cellFrame.size.width - MARGIN_X - kPSMTabBarIndicatorWidth; - result.origin.y = cellFrame.origin.y + MARGIN_Y; - - if([cell state] == NSOnState){ - result.origin.y -= 1; - } + result.origin.x = minX - kPSMTabBarCellIconPadding - kPSMTabBarIndicatorWidth; + result.origin.y = cellFrame.origin.y + floor((cellFrame.size.height - result.size.height) / 2.0); return result; } -- (NSRect)objectCounterRectForTabCell:(PSMTabBarCell *)cell -{ +- (NSRect)objectCounterRectForTabCell:(PSMTabBarCell *)cell { NSRect cellFrame = [cell frame]; if ([cell count] == 0) { @@ -180,318 +247,579 @@ - (NSRect)objectCounterRectForTabCell:(PSMTabBarCell *)cell float countWidth = [[self attributedObjectCountValueForTabCell:cell] size].width; countWidth += (2 * kPSMMetalObjectCounterRadius - 6.0); - if(countWidth < kPSMMetalCounterMinWidth) + if (countWidth < kPSMMetalCounterMinWidth) { countWidth = kPSMMetalCounterMinWidth; + } NSRect result; result.size = NSMakeSize(countWidth, 2 * kPSMMetalObjectCounterRadius); // temp - result.origin.x = cellFrame.origin.x + cellFrame.size.width - MARGIN_X - result.size.width; - result.origin.y = cellFrame.origin.y + MARGIN_Y + 1.0; - - if(![[cell indicator] isHidden]) - result.origin.x -= kPSMTabBarIndicatorWidth + kPSMTabBarCellPadding; + result.origin.x = cellFrame.origin.x + cellFrame.size.width - kSPMTabBarCellInternalXMargin - result.size.width; + result.origin.y = cellFrame.origin.y + floor((cellFrame.size.height - result.size.height) / 2.0); return result; } - -- (float)minimumWidthOfTabCell:(PSMTabBarCell *)cell -{ - float resultWidth = 0.0; +- (CGFloat)widthOfLeftMatterInCell:(PSMTabBarCell *)cell { + CGFloat resultWidth = 0.0; // left margin - resultWidth = MARGIN_X; + resultWidth = kSPMTabBarCellInternalXMargin; // close button? - if([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) - resultWidth += [closeButton size].width + kPSMTabBarCellPadding; + resultWidth += [_closeButton size].width + kPSMTabBarCellPadding; // icon? - if([cell hasIcon]) - resultWidth += kPSMTabBarIconWidth + kPSMTabBarCellPadding; - - // the label - resultWidth += kPSMMinimumTitleWidth; + if ([cell hasIcon]) { + resultWidth += kPSMTabBarIconWidth + kPSMTabBarCellIconPadding; + } + return resultWidth; +} +- (CGFloat)widthOfRightMatterInCell:(PSMTabBarCell *)cell { + CGFloat resultWidth = 0; // object counter? - if([cell count] > 0) + if ([cell count] > 0) { resultWidth += [self objectCounterRectForTabCell:cell].size.width + kPSMTabBarCellPadding; + } else { + resultWidth += [_closeButton size].width + kPSMTabBarCellPadding; + } // indicator? - if ([[cell indicator] isHidden] == NO) + if ([[cell indicator] isHidden] == NO) { resultWidth += kPSMTabBarCellPadding + kPSMTabBarIndicatorWidth; + } // right margin - resultWidth += MARGIN_X; - - return ceil(resultWidth); + resultWidth += kSPMTabBarCellInternalXMargin; + return resultWidth; } -- (float)desiredWidthOfTabCell:(PSMTabBarCell *)cell -{ - float resultWidth = 0.0; - - // left margin - resultWidth = MARGIN_X; - - // close button? - if ([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) - resultWidth += [closeButton size].width + kPSMTabBarCellPadding; - - // icon? - if([cell hasIcon]) - resultWidth += kPSMTabBarIconWidth + kPSMTabBarCellPadding; - - // the label - resultWidth += [[cell attributedStringValue] size].width; - - // object counter? - if([cell count] > 0) - resultWidth += [self objectCounterRectForTabCell:cell].size.width + kPSMTabBarCellPadding; - - // indicator? - if ([[cell indicator] isHidden] == NO) - resultWidth += kPSMTabBarCellPadding + kPSMTabBarIndicatorWidth; +- (float)minimumWidthOfTabCell:(PSMTabBarCell *)cell { + return ceil([self widthOfLeftMatterInCell:cell] + + kPSMMinimumTitleWidth + + [self widthOfRightMatterInCell:cell]); +} - // right margin - resultWidth += MARGIN_X; +- (CGFloat)widthOfAttributedStringInCell:(PSMTabBarCell *)cell { + NSAttributedString *attributedString = [cell attributedStringValue]; + if (![cell.previousAttributedString isEqualToAttributedString:attributedString]) { + cell.previousAttributedString = attributedString; + CGFloat width = [attributedString size].width; + cell.previousWidthOfAttributedString = width; + return width; + } else { + return cell.previousWidthOfAttributedString; + } +} - return ceil(resultWidth); +- (float)desiredWidthOfTabCell:(PSMTabBarCell *)cell { + return ceil([self widthOfLeftMatterInCell:cell] + + [self widthOfAttributedStringInCell:cell] + + [self widthOfRightMatterInCell:cell]); } -#pragma mark - -#pragma mark Cell Values +#pragma mark - Cell Values -- (NSAttributedString *)attributedObjectCountValueForTabCell:(PSMTabBarCell *)cell -{ - NSMutableAttributedString *attrStr; - NSFontManager *fm = [NSFontManager sharedFontManager]; +- (NSAttributedString *)attributedObjectCountValueForTabCell:(PSMTabBarCell *)cell { NSNumberFormatter *nf = [[[NSNumberFormatter alloc] init] autorelease]; [nf setLocalizesFormat:YES]; [nf setFormat:@"0"]; [nf setHasThousandSeparators:YES]; NSString *contents = [nf stringFromNumber:[NSNumber numberWithInt:[cell count]]]; - attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease]; - NSRange range = NSMakeRange(0, [contents length]); + if ([cell count] < 9) { + contents = [NSString stringWithFormat:@"%@%@", [cell modifierString], contents]; + } else if ([cell isLast]) { + contents = [NSString stringWithFormat:@"%@9", [cell modifierString]]; + } else { + contents = @""; + } + NSDictionary *attributes = + @{ NSFontAttributeName: [NSFont systemFontOfSize:self.fontSize], + NSForegroundColorAttributeName: [self textColorForCell:cell] }; + return [[[NSMutableAttributedString alloc] initWithString:contents + attributes:attributes] + autorelease]; +} - // Add font attribute - [attrStr addAttribute:NSFontAttributeName value:[fm convertFont:[NSFont fontWithName:@"Helvetica" size:11.0] toHaveTrait:NSBoldFontMask] range:range]; - [attrStr addAttribute:NSForegroundColorAttributeName value:[[NSColor whiteColor] colorWithAlphaComponent:0.85] range:range]; +- (NSColor *)textColorDefaultSelected:(BOOL)selected { + if (selected) { + return [NSColor blackColor]; + } else if ([self isYosemiteOrLater]) { + return [NSColor colorWithSRGBRed:101/255.0 green:100/255.0 blue:101/255.0 alpha:1]; + } else { + return [NSColor colorWithSRGBRed:80/255.0 green:100/255.0 blue:101/255.0 alpha:1]; + } +} - return attrStr; +- (NSColor *)textColorForCell:(PSMTabBarCell *)cell { + NSColor *textColor; + if (cell.state == NSOnState) { + if (!cell.tabColor) { + return [self textColorDefaultSelected:YES]; + } else if ([cell.tabColor brightnessComponent] > 0.2) { + textColor = [NSColor blackColor]; + } else { + // dark tab + textColor = [NSColor whiteColor]; + } + } else { + textColor = [self textColorDefaultSelected:NO]; + } + return textColor; } -- (NSAttributedString *)attributedStringValueForTabCell:(PSMTabBarCell *)cell -{ - NSMutableAttributedString *attrStr; - NSString *contents = [cell stringValue]; - attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease]; - NSRange range = NSMakeRange(0, [contents length]); +- (NSAttributedString *)attributedStringValueForTabCell:(PSMTabBarCell *)cell { + // Paragraph Style for Truncating Long Text + NSMutableParagraphStyle *truncatingTailParagraphStyle = + [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease]; + [truncatingTailParagraphStyle setLineBreakMode:[cell truncationStyle]]; + if (_orientation == PSMTabBarHorizontalOrientation) { + [truncatingTailParagraphStyle setAlignment:NSCenterTextAlignment]; + } else { + [truncatingTailParagraphStyle setAlignment:NSLeftTextAlignment]; + } - // Add font attribute - [attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0] range:range]; + NSDictionary *attributes = @{ NSFontAttributeName: [NSFont systemFontOfSize:self.fontSize], + NSForegroundColorAttributeName: [self textColorForCell:cell], + NSParagraphStyleAttributeName: truncatingTailParagraphStyle }; + return [[[NSAttributedString alloc] initWithString:[cell stringValue] + attributes:attributes] autorelease]; +} + +- (CGFloat)fontSize { + return 11.0; +} - PSMTabBarControl *bar = (PSMTabBarControl *)cell.controlView; - BOOL isKeyWindow = [bar.window isKeyWindow]; +#pragma mark - Drawing - CGFloat textAlpha; - if ([cell state] == NSOnState) { - textAlpha = (isKeyWindow) ? 1.0f : 0.5f; +- (NSColor *)topLineColorSelected:(BOOL)selected { + if (_tabBar.window.isKeyWindow && [NSApp isActive]) { + if (selected) { + return [NSColor colorWithSRGBRed:189/255.0 green:189/255.0 blue:189/255.0 alpha:1]; + } else { + return [NSColor colorWithSRGBRed:160/255.0 green:160/255.0 blue:160/255.0 alpha:1]; + } } else { - textAlpha = (isKeyWindow) ? 0.5f : 0.25f; + return [NSColor colorWithSRGBRed:219/255.0 green:219/255.0 blue:219/255.0 alpha:1]; } - NSColor *textColor = [[NSColor textColor] colorWithAlphaComponent:textAlpha]; - - [attrStr addAttribute:NSForegroundColorAttributeName value:textColor range:range]; +} - // Paragraph Style for Truncating Long Text - if (!truncatingTailParagraphStyle) { - truncatingTailParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain]; - [truncatingTailParagraphStyle setLineBreakMode:NSLineBreakByTruncatingHead]; - [truncatingTailParagraphStyle setAlignment:NSTextAlignmentCenter]; +- (NSColor *)verticalLineColor { + if (_tabBar.window.isKeyWindow && [NSApp isActive]) { + return [NSColor colorWithSRGBRed:160/255.0 green:160/255.0 blue:160/255.0 alpha:1]; + } else { + return [NSColor colorWithSRGBRed:219/255.0 green:219/255.0 blue:219/255.0 alpha:1]; } - [attrStr addAttribute:NSParagraphStyleAttributeName value:truncatingTailParagraphStyle range:range]; - - return attrStr; } -#pragma mark - -#pragma mark ---- drawing ---- +- (NSColor *)bottomLineColorSelected:(BOOL)selected { + if (_tabBar.window.isKeyWindow && [NSApp isActive]) { + return [NSColor colorWithSRGBRed:160/255.0 green:160/255.0 blue:160/255.0 alpha:1]; + } else { + return [NSColor colorWithSRGBRed:210/255.0 green:210/255.0 blue:210/255.0 alpha:1]; + } +} -- (void)drawTabCell:(PSMTabBarCell *)cell -{ - NSRect cellFrame = [cell frame]; - NSColor * lineColor = nil; - NSBezierPath* bezier = [NSBezierPath bezierPath]; - lineColor = [self borderColor]; - - if ([cell state] == NSOnState) { - // selected tab - NSRect aRect = NSMakeRect(cellFrame.origin.x, cellFrame.origin.y, cellFrame.size.width, cellFrame.size.height); - - PSMTabBarControl *bar = (PSMTabBarControl *)cell.controlView; - BOOL isKeyWindow = [bar.window isKeyWindow]; - - // background - YosemiteNSDrawWindowBackground(aRect, [self backgroundColor:isKeyWindow]); - - aRect.size.height -= 1.0f; - aRect.origin.y += 0.5f; - // frame - [lineColor set]; - [bezier moveToPoint:NSMakePoint(aRect.origin.x, aRect.origin.y)]; - [bezier lineToPoint:NSMakePoint(aRect.origin.x, aRect.origin.y+aRect.size.height)]; - [bezier lineToPoint:NSMakePoint(aRect.origin.x+aRect.size.width, aRect.origin.y+aRect.size.height)]; - [bezier lineToPoint:NSMakePoint(aRect.origin.x+aRect.size.width, aRect.origin.y)]; - [bezier lineToPoint:NSMakePoint(aRect.origin.x, aRect.origin.y)]; - [bezier stroke]; +- (NSColor *)backgroundColorSelected:(BOOL)selected highlightAmount:(CGFloat)highlightAmount { + if (selected) { + if (_tabBar.window.backgroundColor) { + return _tabBar.window.backgroundColor; + } else { + return [NSColor windowBackgroundColor]; + } } else { + if ([self isYosemiteOrLater]) { + CGFloat value; + if (_tabBar.window.isKeyWindow && [NSApp isActive]) { + value = 190/255.0 - highlightAmount * 0.048; + } else { + // Make inactive windows' background color lighter + value = 236/255.0 - highlightAmount * 0.048; + } + return [NSColor colorWithSRGBRed:value green:value blue:value alpha:1]; + } else { + // 10.9 and earlier needs a darker color to look good + CGFloat value = 0.6 - highlightAmount * 0.048; + return [NSColor colorWithSRGBRed:value green:value blue:value alpha:1]; + } + } +} - // unselected tab - NSRect aRect = NSMakeRect(cellFrame.origin.x, cellFrame.origin.y, cellFrame.size.width, cellFrame.size.height); +- (BOOL)isYosemiteOrLater { + return NSClassFromString(@"NSVisualEffectView") != nil; +} - aRect.origin.x += 0.5; +- (void)drawHorizontalLineInFrame:(NSRect)rect y:(CGFloat)y { + NSRectFill(NSMakeRect(NSMinX(rect), y, rect.size.width + 1, 1)); +} - [[NSColor colorWithCalibratedWhite:0.0 alpha:0.1] set]; - NSRectFillUsingOperation(aRect, NSCompositingOperationSourceAtop); +- (void)drawVerticalLineInFrame:(NSRect)rect x:(CGFloat)x { + NSRectFill(NSMakeRect(x, NSMinY(rect) + 1, 1, rect.size.height - 2)); +} - // frame - [lineColor set]; - [bezier moveToPoint:NSMakePoint(aRect.origin.x, aRect.origin.y)]; - [bezier lineToPoint:NSMakePoint(aRect.origin.x + aRect.size.width, aRect.origin.y)]; - if(!([cell tabState] & PSMTab_RightIsSelectedMask)){ - [bezier lineToPoint:NSMakePoint(aRect.origin.x + aRect.size.width, aRect.origin.y + aRect.size.height)]; +- (void)drawCellBackgroundAndFrameHorizontallyOriented:(BOOL)horizontal + inRect:(NSRect)cellFrame + selected:(BOOL)selected + withTabColor:(NSColor *)tabColor + isLast:(BOOL)isLast + highlightAmount:(CGFloat)highlightAmount { + [[self backgroundColorSelected:selected highlightAmount:highlightAmount] set]; + NSRectFill(cellFrame); + + if (tabColor) { + // Alpha the non-key window's tab colors a bit to make it clearer which window is key. + CGFloat alpha = [_tabBar.window isKeyWindow] ? 0.8 : 0.6; + + // Alpha the inactive tab's colors a bit to make it clear which tab is active. + if (selected) { + [[tabColor colorWithAlphaComponent:alpha] set]; + NSRectFillUsingOperation(cellFrame, NSCompositeSourceOver); + } else { + NSColor *startingColor = [tabColor colorWithAlphaComponent:alpha - 0.2]; + NSColor *endingColor = [tabColor colorWithAlphaComponent:0]; + NSGradient *gradient = [[[NSGradient alloc] initWithStartingColor:startingColor endingColor:endingColor] autorelease]; + [gradient drawInRect:cellFrame angle:-90]; } - [bezier stroke]; } - [self drawInteriorWithTabCell:cell inView:[cell controlView]]; + if (horizontal) { + BOOL isLeftmostTab = NSMinX(cellFrame) == 0; + if (!isLeftmostTab) { + // Left line + [[self verticalLineColor] set]; + [self drawVerticalLineInFrame:cellFrame x:NSMinX(cellFrame)]; + } + // Right line + CGFloat adjustment = 0; + [[self verticalLineColor] set]; + [self drawVerticalLineInFrame:cellFrame x:NSMaxX(cellFrame) + adjustment]; + + // Top line + [[self topLineColorSelected:selected] set]; + if (isLast) { + NSRect rect = cellFrame; + rect.size.width -= 1; + [self drawHorizontalLineInFrame:rect y:NSMinY(cellFrame)]; + } else { + [self drawHorizontalLineInFrame:cellFrame y:NSMinY(cellFrame)]; + } + + // Bottom line + [[self bottomLineColorSelected:selected] set]; + [self drawHorizontalLineInFrame:cellFrame y:NSMaxY(cellFrame) - 1]; + + } else { + // Bottom line + [[self verticalLineColor] set]; + cellFrame.origin.x += 1; + cellFrame.size.width -= 3; + [self drawHorizontalLineInFrame:cellFrame y:NSMaxY(cellFrame) - 1]; + cellFrame.origin.x -= 1; + cellFrame.size.width += 3; + + cellFrame.size.width -= 1; + cellFrame.origin.y -= 1; + cellFrame.size.height += 2; + + // Left line + [[self topLineColorSelected:selected] set]; + [self drawVerticalLineInFrame:cellFrame x:NSMinX(cellFrame)]; + + // Right line + [[self bottomLineColorSelected:selected] set]; + [self drawVerticalLineInFrame:cellFrame x:NSMaxX(cellFrame)]; + } } +- (void)drawTabCell:(PSMTabBarCell *)cell highlightAmount:(CGFloat)highlightAmount { + // TODO: Test hidden control, whose height is less than 2. Maybe it happens while dragging? + [self drawCellBackgroundAndFrameHorizontallyOriented:(_orientation == PSMTabBarHorizontalOrientation) + inRect:cell.frame + selected:([cell state] == NSOnState) + withTabColor:[cell tabColor] + isLast:cell == _tabBar.cells.lastObject + highlightAmount:highlightAmount]; + [self drawInteriorWithTabCell:cell inView:[cell controlView] highlightAmount:highlightAmount]; +} -- (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlView -{ + +- (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell + inView:(NSView*)controlView + highlightAmount:(CGFloat)highlightAmount { NSRect cellFrame = [cell frame]; - float labelPosition = cellFrame.origin.x + MARGIN_X; + float labelPosition = cellFrame.origin.x + kSPMTabBarCellInternalXMargin; // close button - if ([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) { - NSSize closeButtonSize = NSZeroSize; - NSRect closeButtonRect = [cell closeButtonRectForFrame:cellFrame]; - NSImage *button = nil; + NSSize closeButtonSize = NSZeroSize; + NSRect closeButtonRect = [cell closeButtonRectForFrame:cellFrame]; + NSImage *closeButton = nil; - if ([cell closeButtonOver]) button = closeButtonOver; - if ([cell closeButtonPressed]) button = closeButtonDown; + closeButton = _closeButton; + if ([cell closeButtonOver]) { + closeButton = _closeButtonOver; + } + if ([cell closeButtonPressed]) { + closeButton = _closeButtonDown; + } - closeButtonSize = [button size]; - [button drawInRect:closeButtonRect fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1.0 respectFlipped:YES hints:nil]; + CGFloat reservedSpace = 0; + closeButtonSize = [closeButton size]; + if ([cell hasCloseButton]) { + if (cell.isCloseButtonSuppressed && _orientation == PSMTabBarHorizontalOrientation) { + // Do not use this much space on the left for the label, but the label is centered as + // though it is not reserved if it's not too long. + // + // Center + // V + // [(reserved) short-label ] + // [(reserved)long-------------label ] + reservedSpace = closeButtonSize.width + kPSMTabBarCellPadding; + } else { + labelPosition += closeButtonSize.width + kPSMTabBarCellPadding; + } + } + + // Draw close button + if ([cell hasCloseButton] && [cell closeButtonVisible]) { + CGFloat fraction; + if (cell.isCloseButtonSuppressed) { + fraction = highlightAmount; + } else { + fraction = 1; + } + [closeButton drawAtPoint:closeButtonRect.origin + fromRect:NSZeroRect + operation:NSCompositeSourceOver + fraction:fraction]; + + } + + + // icon + NSRect iconRect = NSZeroRect; + if ([cell hasIcon]) { + iconRect = [self iconRectForTabCell:cell]; + NSImage *icon = [(id)[[cell representedObject] identifier] icon]; + + // center in available space (in case icon image is smaller than kPSMTabBarIconWidth) + if ([icon size].width < kPSMTabBarIconWidth) { + iconRect.origin.x += (kPSMTabBarIconWidth - [icon size].width)/2.0; + } + if ([icon size].height < kPSMTabBarIconWidth) { + iconRect.origin.y -= (kPSMTabBarIconWidth - [icon size].height)/2.0; + } + + [icon drawInRect:iconRect + fromRect:NSZeroRect + operation:NSCompositeSourceOver + fraction:1.0 + respectFlipped:YES + hints:nil]; } // object counter - if([cell count] > 0){ - [[NSColor colorWithCalibratedWhite:0.3 alpha:0.6] set]; - NSBezierPath *path = [NSBezierPath bezierPath]; + if ([cell count] > 0) { NSRect myRect = [self objectCounterRectForTabCell:cell]; - [path moveToPoint:NSMakePoint(myRect.origin.x + kPSMMetalObjectCounterRadius, myRect.origin.y)]; - [path lineToPoint:NSMakePoint(myRect.origin.x + myRect.size.width - kPSMMetalObjectCounterRadius, myRect.origin.y)]; - [path appendBezierPathWithArcWithCenter:NSMakePoint(myRect.origin.x + myRect.size.width - kPSMMetalObjectCounterRadius, myRect.origin.y + kPSMMetalObjectCounterRadius) radius:kPSMMetalObjectCounterRadius startAngle:270.0 endAngle:90.0]; - [path lineToPoint:NSMakePoint(myRect.origin.x + kPSMMetalObjectCounterRadius, myRect.origin.y + myRect.size.height)]; - [path appendBezierPathWithArcWithCenter:NSMakePoint(myRect.origin.x + kPSMMetalObjectCounterRadius, myRect.origin.y + kPSMMetalObjectCounterRadius) radius:kPSMMetalObjectCounterRadius startAngle:90.0 endAngle:270.0]; - [path fill]; - // draw attributed string centered in area NSRect counterStringRect; NSAttributedString *counterString = [self attributedObjectCountValueForTabCell:cell]; counterStringRect.size = [counterString size]; - counterStringRect.origin.x = myRect.origin.x + ((myRect.size.width - counterStringRect.size.width) / 2.0) + 0.25; - counterStringRect.origin.y = myRect.origin.y + ((myRect.size.height - counterStringRect.size.height) / 2.0) + 0.5; + counterStringRect.origin.x = myRect.origin.x + floor((myRect.size.width - counterStringRect.size.width) / 2.0); + counterStringRect.origin.y = myRect.origin.y + floor((myRect.size.height - counterStringRect.size.height) / 2.0); [counterString drawInRect:counterStringRect]; } // label rect - NSRect labelRect; - labelRect.origin.x = labelPosition; - labelRect.size.width = cellFrame.size.width - (labelRect.origin.x - cellFrame.origin.x) - kPSMTabBarCellPadding; - labelRect.size.height = cellFrame.size.height; - labelRect.origin.y = cellFrame.origin.y + MARGIN_Y + 1.0; + NSAttributedString *attributedString = [cell attributedStringValue]; + if (attributedString.length > 0) { + NSRect labelRect; + labelRect.origin.x = labelPosition; + labelRect.size.width = cellFrame.size.width - (labelRect.origin.x - cellFrame.origin.x) - kPSMTabBarCellPadding; + if ([cell hasIcon]) { + // Reduce size of label if there is an icon or activity indicator + labelRect.size.width -= iconRect.size.width + kPSMTabBarCellIconPadding; + } else if (![[cell indicator] isHidden]) { + labelRect.size.width -= cell.indicator.frame.size.width + kPSMTabBarCellIconPadding; + } + labelRect.size.height = cellFrame.size.height; - if(![[cell indicator] isHidden]) - labelRect.size.width -= (kPSMTabBarIndicatorWidth + kPSMTabBarCellPadding); + if ([cell count] > 0) { + labelRect.size.width -= ([self objectCounterRectForTabCell:cell].size.width + kPSMTabBarCellPadding); + } + + NSSize boundingSize = [attributedString boundingRectWithSize:labelRect.size options:0].size; + labelRect.origin.y = cellFrame.origin.y + floor((cellFrame.size.height - boundingSize.height) / 2.0); + labelRect.size.height = boundingSize.height; + + if (_orientation == PSMTabBarHorizontalOrientation) { + CGFloat effectiveLeftMargin = (labelRect.size.width - boundingSize.width) / 2; + if (effectiveLeftMargin < reservedSpace) { + attributedString = [attributedString attributedStringWithTextAlignment:NSLeftTextAlignment]; - if([cell count] > 0) - labelRect.size.width -= ([self objectCounterRectForTabCell:cell].size.width + kPSMTabBarCellPadding); + labelRect.origin.x += reservedSpace; + labelRect.size.width -= reservedSpace; + } + } - // label - [[cell attributedStringValue] drawInRect:labelRect]; + [attributedString drawInRect:labelRect]; + } } -- (void)drawTabBar:(PSMTabBarControl *)bar inRect:(NSRect)rect -{ - BOOL isKeyWindow = [bar.window isKeyWindow]; - YosemiteNSDrawWindowBackground(rect, [self backgroundColor:isKeyWindow]); +- (NSColor *)tabBarColor { + if (_tabBar.window.isKeyWindow && [NSApp isActive]) { + return [NSColor colorWithCalibratedWhite:0.0 alpha:0.2]; + } else { + return [NSColor colorWithCalibratedWhite:236 / 255.0 alpha:1]; + } +} + +- (void)drawBackgroundInRect:(NSRect)rect + color:(NSColor*)backgroundColor + horizontal:(BOOL)horizontal { + if (_orientation == PSMTabBarVerticalOrientation && [_tabBar frame].size.width < 2) { + return; + } - [[NSColor colorWithCalibratedWhite:0.0 alpha:0.0] set]; - NSRectFillUsingOperation(rect, NSCompositingOperationSourceAtop); - [[self borderColor] set]; - [NSBezierPath strokeLineFromPoint:NSMakePoint(rect.origin.x,rect.origin.y+0.5) toPoint:NSMakePoint(rect.origin.x+rect.size.width,rect.origin.y+0.5)]; - [NSBezierPath strokeLineFromPoint:NSMakePoint(rect.origin.x,rect.origin.y+rect.size.height-0.5) toPoint:NSMakePoint(rect.origin.x+rect.size.width,rect.origin.y+rect.size.height-0.5)]; + [NSGraphicsContext saveGraphicsState]; + [[NSGraphicsContext currentContext] setShouldAntialias:NO]; + + [backgroundColor set]; + NSRectFillUsingOperation(rect, NSCompositeSourceAtop); + + [[self bottomLineColorSelected:NO] set]; + if (_orientation == PSMTabBarHorizontalOrientation) { + [NSBezierPath strokeLineFromPoint:NSMakePoint(rect.origin.x, + rect.origin.y + rect.size.height - 0.5) + toPoint:NSMakePoint(rect.origin.x + rect.size.width, + rect.origin.y + rect.size.height - 0.5)]; + + [[self topLineColorSelected:NO] set]; + // this looks ok with tabs on top but doesn't appear w/ tabs on bottom for some reason + [NSBezierPath strokeLineFromPoint:NSMakePoint(rect.origin.x, + rect.origin.y - 0.5) + toPoint:NSMakePoint(rect.origin.x + rect.size.width, + rect.origin.y - 0.5)]; + } else { + [NSBezierPath strokeLineFromPoint:NSMakePoint(rect.origin.x, + rect.origin.y + 0.5) + toPoint:NSMakePoint(rect.origin.x, + rect.origin.y + rect.size.height + 0.5)]; + + [NSBezierPath strokeLineFromPoint:NSMakePoint(rect.origin.x + rect.size.width, + rect.origin.y + 0.5) + toPoint:NSMakePoint(rect.origin.x + rect.size.width, + rect.origin.y + rect.size.height + 0.5)]; + } + + [NSGraphicsContext restoreGraphicsState]; +} + +- (NSColor *)accessoryFillColor { + return [NSColor windowBackgroundColor]; +} + +- (NSColor *)accessoryStrokeColor { + return [NSColor darkGrayColor]; +} + +- (NSColor *)accessoryTextColor { + return [NSColor blackColor]; +} + +- (void)fillPath:(NSBezierPath*)path { + [[self accessoryFillColor] set]; + [path fill]; + [[NSColor colorWithCalibratedWhite:0.0 alpha:0.2] set]; + [path fill]; + [[self accessoryStrokeColor] set]; + [path stroke]; +} + +- (BOOL)useLightControls { + return NO; +} + +- (void)drawTabBar:(PSMTabBarControl *)bar + inRect:(NSRect)rect + horizontal:(BOOL)horizontal { + if (_orientation != [bar orientation]) { + _orientation = [bar orientation]; + } + + if (_tabBar != bar) { + _tabBar = bar; + } + + [self drawBackgroundInRect:rect color:[self tabBarColor] horizontal:horizontal]; + [[self topLineColorSelected:NO] set]; + [self drawHorizontalLineInFrame:rect y:NSMinY(rect)]; // no tab view == not connected - if(![bar tabView]){ + if (![bar tabView]){ NSRect labelRect = rect; labelRect.size.height -= 4.0; labelRect.origin.y += 4.0; - NSMutableAttributedString *attrStr; NSString *contents = @"PSMTabBarControl"; - attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease]; + NSMutableAttributedString *attrStr = + [[[NSMutableAttributedString alloc] initWithString:contents] autorelease]; NSRange range = NSMakeRange(0, [contents length]); - [attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0] range:range]; - if (!centeredParagraphStyle) { - centeredParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain]; - [centeredParagraphStyle setAlignment:NSTextAlignmentCenter]; - } - [attrStr addAttribute:NSParagraphStyleAttributeName value:centeredParagraphStyle range:range]; + [attrStr addAttribute:NSFontAttributeName + value:[NSFont systemFontOfSize:self.fontSize] + range:range]; + NSMutableParagraphStyle *centeredParagraphStyle = + [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease]; + [centeredParagraphStyle setAlignment:NSCenterTextAlignment]; + [attrStr addAttribute:NSParagraphStyleAttributeName + value:centeredParagraphStyle + range:range]; [attrStr drawInRect:labelRect]; return; } // draw cells - NSEnumerator *e = [[bar cells] objectEnumerator]; - PSMTabBarCell *cell; - while(cell = [e nextObject]){ - if(![cell isInOverflowMenu]){ - [cell drawWithFrame:[cell frame] inView:bar]; + for (int i = 0; i < 2; i++) { + NSInteger stateToDraw = (i == 0 ? NSOnState : NSOffState); + for (PSMTabBarCell *cell in [bar cells]) { + if (![cell isInOverflowMenu] && NSIntersectsRect([cell frame], rect)) { + if (cell.state == stateToDraw) { + [cell drawWithFrame:[cell frame] inView:bar]; + if (stateToDraw == NSOnState) { + // Can quit early since only one can be selected + break; + } + } + } } } } -#pragma mark - -#pragma mark Archiving +#pragma mark - Archiving - (void)encodeWithCoder:(NSCoder *)aCoder { if ([aCoder allowsKeyedCoding]) { - [aCoder encodeObject:closeButton forKey:@"metalCloseButton"]; - [aCoder encodeObject:closeButtonDown forKey:@"metalCloseButtonDown"]; - [aCoder encodeObject:closeButtonOver forKey:@"metalCloseButtonOver"]; + [aCoder encodeObject:_closeButton forKey:@"metalCloseButton"]; + [aCoder encodeObject:_closeButtonDown forKey:@"metalCloseButtonDown"]; + [aCoder encodeObject:_closeButtonOver forKey:@"metalCloseButtonOver"]; [aCoder encodeObject:_addTabButtonImage forKey:@"addTabButtonImage"]; [aCoder encodeObject:_addTabButtonPressedImage forKey:@"addTabButtonPressedImage"]; [aCoder encodeObject:_addTabButtonRolloverImage forKey:@"addTabButtonRolloverImage"]; } } -- (id)initWithCoder:(NSCoder *)aDecoder -{ - if ([aDecoder allowsKeyedCoding]) { - closeButton = [[aDecoder decodeObjectForKey:@"metalCloseButton"] retain]; - closeButtonDown = [[aDecoder decodeObjectForKey:@"metalCloseButtonDown"] retain]; - closeButtonOver = [[aDecoder decodeObjectForKey:@"metalCloseButtonOver"] retain]; - _addTabButtonImage = [[aDecoder decodeObjectForKey:@"addTabButtonImage"] retain]; - _addTabButtonPressedImage = [[aDecoder decodeObjectForKey:@"addTabButtonPressedImage"] retain]; - _addTabButtonRolloverImage = [[aDecoder decodeObjectForKey:@"addTabButtonRolloverImage"] retain]; +- (id)initWithCoder:(NSCoder *)aDecoder { + self = [super init]; + if (self) { + if ([aDecoder allowsKeyedCoding]) { + _closeButton = [[aDecoder decodeObjectForKey:@"metalCloseButton"] retain]; + _closeButtonDown = [[aDecoder decodeObjectForKey:@"metalCloseButtonDown"] retain]; + _closeButtonOver = [[aDecoder decodeObjectForKey:@"metalCloseButtonOver"] retain]; + _addTabButtonImage = [[aDecoder decodeObjectForKey:@"addTabButtonImage"] retain]; + _addTabButtonPressedImage = [[aDecoder decodeObjectForKey:@"addTabButtonPressedImage"] retain]; + _addTabButtonRolloverImage = [[aDecoder decodeObjectForKey:@"addTabButtonRolloverImage"] retain]; + } } - return self; } diff --git a/src/MacVim/PSMTabBarControl/source/WindowController.h b/src/MacVim/PSMTabBarControl/source/WindowController.h deleted file mode 100644 index ae655b8bea..0000000000 --- a/src/MacVim/PSMTabBarControl/source/WindowController.h +++ /dev/null @@ -1,58 +0,0 @@ -// -// WindowController.h -// PSMTabBarControl -// -// Created by John Pannell on 4/6/06. -// Copyright 2006 Positive Spin Media. All rights reserved. -// - -#import -@class PSMTabBarControl; - -@interface WindowController : NSWindowController { - IBOutlet NSTabView *tabView; - IBOutlet NSTextField *tabField; - IBOutlet NSDrawer *drawer; - - IBOutlet PSMTabBarControl *tabBar; - - IBOutlet NSButton *isProcessingButton; - IBOutlet NSTextField *objectCounterField; - IBOutlet NSPopUpButton *iconButton; -} - -// UI -- (IBAction)addNewTab:(id)sender; -- (IBAction)closeTab:(id)sender; -- (IBAction)stopProcessing:(id)sender; -- (IBAction)setIconNamed:(id)sender; -- (IBAction)setObjectCount:(id)sender; -- (IBAction)setTabLabel:(id)sender; - -// Actions -- (IBAction)isProcessingAction:(id)sender; - -// tab bar config -- (void)configStyle:(id)sender; -- (void)configCanCloseOnlyTab:(id)sender; -- (void)configHideForSingleTab:(id)sender; -- (void)configAddTabButton:(id)sender; -- (void)configTabMinWidth:(id)sender; -- (void)configTabMaxWidth:(id)sender; -- (void)configTabOptimumWidth:(id)sender; -- (void)configTabSizeToFit:(id)sender; - -// delegate -- (void)tabView:(NSTabView *)aTabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem; -- (BOOL)tabView:(NSTabView *)aTabView shouldCloseTabViewItem:(NSTabViewItem *)tabViewItem; -- (void)tabView:(NSTabView *)aTabView willCloseTabViewItem:(NSTabViewItem *)tabViewItem; -- (void)tabView:(NSTabView *)aTabView didCloseTabViewItem:(NSTabViewItem *)tabViewItem; - -// toolbar -- (NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag; -- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar*)toolbar; -- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar*)toolbar; -- (IBAction)toggleToolbar:(id)sender; -- (BOOL)validateToolbarItem:(NSToolbarItem *)theItem; - -@end diff --git a/src/MacVim/PSMTabBarControl/source/WindowController.m b/src/MacVim/PSMTabBarControl/source/WindowController.m deleted file mode 100644 index 07414dbdcf..0000000000 --- a/src/MacVim/PSMTabBarControl/source/WindowController.m +++ /dev/null @@ -1,280 +0,0 @@ -// -// WindowController.m -// PSMTabBarControl -// -// Created by John Pannell on 4/6/06. -// Copyright 2006 Positive Spin Media. All rights reserved. -// - -#import "WindowController.h" -#import "FakeModel.h" -#import "PSMTabBarControl.h" - -@implementation WindowController - -- (void)awakeFromNib -{ - // toolbar - NSToolbar *toolbar = [[NSToolbar alloc] initWithIdentifier:@"DemoToolbar"]; - [toolbar setDelegate:self]; - [toolbar setAllowsUserCustomization:YES]; - [toolbar setAutosavesConfiguration:YES]; - /*SInt32 MacVersion; - if (Gestalt(gestaltSystemVersion, &MacVersion) == noErr){ - if (MacVersion >= 0x1040){ - // this call is Tiger only - [toolbar setShowsBaselineSeparator:NO]; - } - }*/ - [[self window] setToolbar:toolbar]; - - // hook up add tab button - [[tabBar addTabButton] setTarget:self]; - [[tabBar addTabButton] setAction:@selector(addNewTab:)]; - - // remove any tabs present in the nib - NSArray *existingItems = [tabView tabViewItems]; - NSEnumerator *e = [existingItems objectEnumerator]; - NSTabViewItem *item; - while(item = [e nextObject]){ - [tabView removeTabViewItem:item]; - } - - [self addNewTab:self]; - [self addNewTab:self]; - [self addNewTab:self]; - [[tabView tabViewItemAtIndex:0] setLabel:@"Tab"]; - [[tabView tabViewItemAtIndex:1] setLabel:@"Bar"]; - [[tabView tabViewItemAtIndex:2] setLabel:@"Control"]; - - // open drawer - //[drawer toggle:self]; -} - -- (IBAction)addNewTab:(id)sender -{ - FakeModel *newModel = [[FakeModel alloc] init]; - NSTabViewItem *newItem = [[[NSTabViewItem alloc] initWithIdentifier:[newModel controller]] autorelease]; - [newItem setLabel:@"Untitled"]; - [tabView addTabViewItem:newItem]; - [tabView selectTabViewItem:newItem]; // this is optional, but expected behavior - [newModel release]; -} - -- (IBAction)closeTab:(id)sender -{ - [tabView removeTabViewItem:[tabView selectedTabViewItem]]; -} - -- (void)stopProcessing:(id)sender -{ - [[[tabView selectedTabViewItem] identifier] setValue:[NSNumber numberWithBool:NO] forKeyPath:@"selection.isProcessing"]; -} - -- (void)setIconNamed:(id)sender -{ - NSString *iconName = [sender titleOfSelectedItem]; - if([iconName isEqualToString:@"None"]){ - [[[tabView selectedTabViewItem] identifier] setValue:nil forKeyPath:@"selection.icon"]; - [[[tabView selectedTabViewItem] identifier] setValue:@"None" forKeyPath:@"selection.iconName"]; - } else { - NSImage *newIcon = [NSImage imageNamed:iconName]; - [[[tabView selectedTabViewItem] identifier] setValue:newIcon forKeyPath:@"selection.icon"]; - [[[tabView selectedTabViewItem] identifier] setValue:iconName forKeyPath:@"selection.iconName"]; - } -} - -- (void)setObjectCount:(id)sender -{ - [[[tabView selectedTabViewItem] identifier] setValue:[NSNumber numberWithInt:[sender intValue]] forKeyPath:@"selection.objectCount"]; -} - -- (IBAction)isProcessingAction:(id)sender -{ - [[[tabView selectedTabViewItem] identifier] setValue:[NSNumber numberWithBool:[sender state]] forKeyPath:@"selection.isProcessing"]; -} - -- (IBAction)setTabLabel:(id)sender -{ - [[tabView selectedTabViewItem] setLabel:[sender stringValue]]; -} - -- (BOOL)validateMenuItem:(id )menuItem -{ - if([menuItem action] == @selector(closeTab:)){ - if(![tabBar canCloseOnlyTab] && ([tabView numberOfTabViewItems] <= 1)){ - return NO; - } - } - return YES; -} - -#pragma mark - -#pragma mark ---- tab bar config ---- - -- (void)configStyle:(id)sender -{ - [tabBar setStyleNamed:[sender titleOfSelectedItem]]; -} - -- (void)configCanCloseOnlyTab:(id)sender -{ - [tabBar setCanCloseOnlyTab:[sender state]]; -} - -- (void)configHideForSingleTab:(id)sender -{ - [tabBar setHideForSingleTab:[sender state]]; -} - -- (void)configAddTabButton:(id)sender -{ - [tabBar setShowAddTabButton:[sender state]]; -} - -- (void)configTabMinWidth:(id)sender -{ - if([tabBar cellOptimumWidth] < [sender intValue]){ - [tabBar setCellMinWidth:[tabBar cellOptimumWidth]]; - [sender setIntValue:[tabBar cellOptimumWidth]]; - return; - } - - [tabBar setCellMinWidth:[sender intValue]]; -} - -- (void)configTabMaxWidth:(id)sender -{ - if([tabBar cellOptimumWidth] > [sender intValue]){ - [tabBar setCellMaxWidth:[tabBar cellOptimumWidth]]; - [sender setIntValue:[tabBar cellOptimumWidth]]; - return; - } - - [tabBar setCellMaxWidth:[sender intValue]]; -} - -- (void)configTabOptimumWidth:(id)sender -{ - if([tabBar cellMaxWidth] < [sender intValue]){ - [tabBar setCellOptimumWidth:[tabBar cellMaxWidth]]; - [sender setIntValue:[tabBar cellMaxWidth]]; - return; - } - - if([tabBar cellMinWidth] > [sender intValue]){ - [tabBar setCellOptimumWidth:[tabBar cellMinWidth]]; - [sender setIntValue:[tabBar cellMinWidth]]; - return; - } - - [tabBar setCellOptimumWidth:[sender intValue]]; -} - -- (void)configTabSizeToFit:(id)sender -{ - [tabBar setSizeCellsToFit:[sender state]]; -} - -#pragma mark - -#pragma mark ---- delegate ---- - -- (void)tabView:(NSTabView *)aTabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem -{ - // need to update bound values to match the selected tab - if([[tabViewItem identifier] respondsToSelector:@selector(content)]){ - if([[[tabViewItem identifier] content] respondsToSelector:@selector(objectCount)]){ - [objectCounterField setIntValue:[[[tabViewItem identifier] content] objectCount]]; - } - } - if([[tabViewItem identifier] respondsToSelector:@selector(content)]){ - if([[[tabViewItem identifier] content] respondsToSelector:@selector(isProcessing)]){ - [isProcessingButton setState:[[[tabViewItem identifier] content] isProcessing]]; - } - } - if([[tabViewItem identifier] respondsToSelector:@selector(content)]){ - if([[[tabViewItem identifier] content] respondsToSelector:@selector(iconName)]){ - NSString *newName = [[[tabViewItem identifier] content] iconName]; - if(newName){ - [iconButton selectItem:[[iconButton menu] itemWithTitle:newName]]; - } else { - [iconButton selectItem:[[iconButton menu] itemWithTitle:@"None"]]; - } - } - } -} - -- (BOOL)tabView:(NSTabView *)aTabView shouldCloseTabViewItem:(NSTabViewItem *)tabViewItem -{ - if([[tabViewItem label] isEqualToString:@"Drake"]){ - NSAlert *drakeAlert = [NSAlert alertWithMessageText:@"No Way!" defaultButton:@"OK" alternateButton:nil otherButton:nil informativeTextWithFormat:@"I refuse to close a tab named \"Drake\""]; - [drakeAlert beginSheetModalForWindow:[NSApp keyWindow] modalDelegate:nil didEndSelector:nil contextInfo:nil]; - return NO; - } - return YES; -} - -- (void)tabView:(NSTabView *)aTabView willCloseTabViewItem:(NSTabViewItem *)tabViewItem -{ - NSLog(@"willCloseTabViewItem: %@", [tabViewItem label]); -} - -- (void)tabView:(NSTabView *)aTabView didCloseTabViewItem:(NSTabViewItem *)tabViewItem -{ - NSLog(@"didCloseTabViewItem: %@", [tabViewItem label]); -} - -#pragma mark - -#pragma mark ---- toolbar ---- - -- (NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag -{ - NSToolbarItem *item = [[NSToolbarItem alloc] initWithItemIdentifier:itemIdentifier]; - - if([itemIdentifier isEqualToString:@"TabField"]){ - [item setPaletteLabel:@"Tab Label"]; - [item setLabel:@"Tab Label"]; - [item setView:tabField]; - [item setMinSize:NSMakeSize(100, [tabField frame].size.height)]; - [item setMaxSize:NSMakeSize(500, [tabField frame].size.height)]; - - } else if([itemIdentifier isEqualToString:@"DrawerItem"]){ - [item setPaletteLabel:@"Configuration"]; - [item setLabel:@"Configuration"]; - [item setToolTip:@"Configuration"]; - [item setImage:[NSImage imageNamed:@"32x32_log"]]; - [item setTarget:drawer]; - [item setAction:@selector(toggle:)]; - - } - - return [item autorelease]; -} - -- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar*)toolbar -{ - return [NSArray arrayWithObjects:@"TabField", - NSToolbarFlexibleSpaceItemIdentifier, - @"DrawerItem", - nil]; -} - -- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar*)toolbar -{ - return [NSArray arrayWithObjects:@"TabField", - NSToolbarFlexibleSpaceItemIdentifier, - @"DrawerItem", - nil]; -} - -- (IBAction)toggleToolbar:(id)sender -{ - [[[self window] toolbar] setVisible:![[[self window] toolbar] isVisible]]; -} - -- (BOOL)validateToolbarItem:(NSToolbarItem *)theItem -{ - return YES; -} - -@end diff --git a/src/MacVim/PSMTabBarControl/source/main.m b/src/MacVim/PSMTabBarControl/source/main.m deleted file mode 100644 index bcdabbe7b0..0000000000 --- a/src/MacVim/PSMTabBarControl/source/main.m +++ /dev/null @@ -1,14 +0,0 @@ -// -// main.m -// TabBarControl -// -// Created by John Pannell on 12/18/05. -// Copyright Positive Spin Media 2005. All rights reserved. -// - -#import - -int main(int argc, char *argv[]) -{ - return NSApplicationMain(argc, (const char **) argv); -} diff --git a/src/MacVim/PSMTabBarControl/version.plist b/src/MacVim/PSMTabBarControl/version.plist deleted file mode 100644 index df8c3dc7d1..0000000000 --- a/src/MacVim/PSMTabBarControl/version.plist +++ /dev/null @@ -1,16 +0,0 @@ - - - - - BuildVersion - 92 - CFBundleVersion - 1.0 - ProductBuildVersion - 7K571 - ProjectName - NibPBTemplates - SourceVersion - 1200000 - -