diff --git a/src/MacVim/PSMTabBarControl/PSMTabBarControl.xcodeproj/project.pbxproj b/src/MacVim/PSMTabBarControl/PSMTabBarControl.xcodeproj/project.pbxproj index cc503a2624..2346afea21 100644 --- a/src/MacVim/PSMTabBarControl/PSMTabBarControl.xcodeproj/project.pbxproj +++ b/src/MacVim/PSMTabBarControl/PSMTabBarControl.xcodeproj/project.pbxproj @@ -57,8 +57,6 @@ 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 */; }; - A2D32EE809A6399300EC8662 /* PSMAquaTabStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = A2D32EE609A6399300EC8662 /* PSMAquaTabStyle.h */; }; - A2D32EE909A6399300EC8662 /* PSMAquaTabStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = A2D32EE709A6399300EC8662 /* PSMAquaTabStyle.m */; }; 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 */; }; @@ -155,8 +153,6 @@ 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 = ""; }; - A2D32EE609A6399300EC8662 /* PSMAquaTabStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PSMAquaTabStyle.h; path = source/PSMAquaTabStyle.h; sourceTree = ""; }; - A2D32EE709A6399300EC8662 /* PSMAquaTabStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PSMAquaTabStyle.m; path = source/PSMAquaTabStyle.m; 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 = ""; }; @@ -309,8 +305,6 @@ A251BE830959A1B90058BC7F /* PSMTabBarCell.h */, A251BE840959A1B90058BC7F /* PSMTabBarCell.m */, A2D32EDA09A634C900EC8662 /* PSMTabStyle.h */, - A2D32EE609A6399300EC8662 /* PSMAquaTabStyle.h */, - A2D32EE709A6399300EC8662 /* PSMAquaTabStyle.m */, A2D32EFE09A63D7A00EC8662 /* PSMMetalTabStyle.h */, A2D32EFF09A63D7A00EC8662 /* PSMMetalTabStyle.m */, A2D98B070A2B432C0064C6F8 /* PSMUnifiedTabStyle.h */, @@ -403,7 +397,6 @@ A251BE850959A1B90058BC7F /* PSMOverflowPopUpButton.h in Headers */, A251BE870959A1B90058BC7F /* PSMTabBarCell.h in Headers */, A2D32EDC09A634C900EC8662 /* PSMTabStyle.h in Headers */, - A2D32EE809A6399300EC8662 /* PSMAquaTabStyle.h in Headers */, A2D32F0009A63D7A00EC8662 /* PSMMetalTabStyle.h in Headers */, A268EA6209A9831800E082AA /* PSMRolloverButton.h in Headers */, A2129BB209AEB58F00724E6C /* PSMProgressIndicator.h in Headers */, @@ -505,7 +498,6 @@ 546DEAF1067F63070098DCC4 /* PSMTabBarControl.m in Sources */, A251BE860959A1B90058BC7F /* PSMOverflowPopUpButton.m in Sources */, A251BE880959A1B90058BC7F /* PSMTabBarCell.m in Sources */, - A2D32EE909A6399300EC8662 /* PSMAquaTabStyle.m in Sources */, A2D32F0109A63D7A00EC8662 /* PSMMetalTabStyle.m in Sources */, A268EA6309A9831800E082AA /* PSMRolloverButton.m in Sources */, A2129BB309AEB58F00724E6C /* PSMProgressIndicator.m in Sources */, diff --git a/src/MacVim/PSMTabBarControl/source/PSMAquaTabStyle.h b/src/MacVim/PSMTabBarControl/source/PSMAquaTabStyle.h deleted file mode 100644 index e8229570ec..0000000000 --- a/src/MacVim/PSMTabBarControl/source/PSMAquaTabStyle.h +++ /dev/null @@ -1,34 +0,0 @@ -// -// PSMAquaTabStyle.h -// PSMTabBarControl -// -// Created by John Pannell on 2/17/06. -// Copyright 2006 Positive Spin Media. All rights reserved. -// - -#import -#import "PSMTabStyle.h" - -@interface PSMAquaTabStyle : NSObject { - NSImage *aquaTabBg; - NSImage *aquaTabBgDown; - NSImage *aquaTabBgDownGraphite; - NSImage *aquaTabBgDownNonKey; - NSImage *aquaDividerDown; - NSImage *aquaDivider; - NSImage *aquaCloseButton; - NSImage *aquaCloseButtonDown; - NSImage *aquaCloseButtonOver; - NSImage *_addTabButtonImage; - NSImage *_addTabButtonPressedImage; - NSImage *_addTabButtonRolloverImage; - NSMutableParagraphStyle *truncatingTailParagraphStyle; - NSMutableParagraphStyle *centeredParagraphStyle; -} - -- (void)loadImages; -- (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlView; - -- (void)encodeWithCoder:(NSCoder *)aCoder; -- (id)initWithCoder:(NSCoder *)aDecoder; -@end diff --git a/src/MacVim/PSMTabBarControl/source/PSMAquaTabStyle.m b/src/MacVim/PSMTabBarControl/source/PSMAquaTabStyle.m deleted file mode 100644 index 158f79b9cb..0000000000 --- a/src/MacVim/PSMTabBarControl/source/PSMAquaTabStyle.m +++ /dev/null @@ -1,513 +0,0 @@ -// -// PSMAquaTabStyle.m -// PSMTabBarControl -// -// Created by John Pannell on 2/17/06. -// Copyright 2006 Positive Spin Media. All rights reserved. -// - -#import "PSMAquaTabStyle.h" -#import "PSMTabBarCell.h" -#import "PSMTabBarControl.h" - -#define kPSMAquaObjectCounterRadius 7.0 -#define kPSMAquaCounterMinWidth 20 - -@implementation PSMAquaTabStyle - -- (NSString *)name -{ - return @"Aqua"; -} - -#pragma mark - -#pragma mark Creation/Destruction - -- (id) init -{ - if((self = [super init])) - { - [self loadImages]; - } - return self; -} - -- (void) loadImages -{ - // Aqua Tabs Images - aquaTabBg = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabsBackground"]]; - [aquaTabBg setFlipped:YES]; - - aquaTabBgDown = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabsDown"]]; - [aquaTabBgDown setFlipped:YES]; - - aquaTabBgDownGraphite = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabsDownGraphite"]]; - [aquaTabBgDown setFlipped:YES]; - - aquaTabBgDownNonKey = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabsDownNonKey"]]; - [aquaTabBgDown setFlipped:YES]; - - aquaDividerDown = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabsSeparatorDown"]]; - [aquaDivider setFlipped:NO]; - - aquaDivider = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabsSeparator"]]; - [aquaDivider setFlipped:NO]; - - aquaCloseButton = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabClose_Front"]]; - aquaCloseButtonDown = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabClose_Front_Pressed"]]; - aquaCloseButtonOver = [[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"]]; -} - -- (void)dealloc -{ - [aquaTabBg release]; - [aquaTabBgDown release]; - [aquaDividerDown release]; - [aquaDivider release]; - [aquaCloseButton release]; - [aquaCloseButtonDown release]; - [aquaCloseButtonOver release]; - [_addTabButtonImage release]; - [_addTabButtonPressedImage release]; - [_addTabButtonRolloverImage release]; - - [truncatingTailParagraphStyle release]; - [centeredParagraphStyle release]; - - [super dealloc]; -} - -#pragma mark - -#pragma mark Control Specifics - -- (float)leftMarginForTabBarControl -{ - return 0.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 Specifics - -- (NSRect)closeButtonRectForTabCell:(PSMTabBarCell *)cell -{ - NSRect cellFrame = [cell frame]; - - if ([cell hasCloseButton] == NO) { - return NSZeroRect; - } - - NSRect result; - result.size = [aquaCloseButton size]; - result.origin.x = cellFrame.origin.x + MARGIN_X; - result.origin.y = cellFrame.origin.y + MARGIN_Y + 2.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; - - if([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) - result.origin.x += [aquaCloseButton 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; - - 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 * kPSMAquaObjectCounterRadius - 6.0); - if(countWidth < kPSMAquaCounterMinWidth) - countWidth = kPSMAquaCounterMinWidth; - - NSRect result; - result.size = NSMakeSize(countWidth, 2 * kPSMAquaObjectCounterRadius); // 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 += [aquaCloseButton 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 += [aquaCloseButton 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]; - [truncatingTailParagraphStyle setAlignment:NSCenterTextAlignment]; - } - [attrStr addAttribute:NSParagraphStyleAttributeName value:truncatingTailParagraphStyle range:range]; - - return attrStr; -} - -#pragma mark - -#pragma mark Drawing - -- (void)drawTabCell:(PSMTabBarCell *)cell; -{ - NSRect cellFrame = [cell frame]; - - // Selected Tab - if ([cell state] == NSOnState) { - NSRect aRect = NSMakeRect(cellFrame.origin.x, cellFrame.origin.y, cellFrame.size.width, cellFrame.size.height-2.5); - aRect.size.height -= 0.5; - - // proper tint - NSControlTint currentTint; - if ([cell controlTint] == NSDefaultControlTint) - currentTint = [NSColor currentControlTint]; - else - currentTint = [cell controlTint]; - - if (![[[cell controlView] window] isKeyWindow]) - currentTint = NSClearControlTint; - - NSImage *bgImage; - switch(currentTint){ - case NSGraphiteControlTint: - bgImage = aquaTabBgDownGraphite; - break; - case NSClearControlTint: - bgImage = aquaTabBgDownNonKey; - break; - case NSBlueControlTint: - default: - bgImage = aquaTabBgDown; - break; - } - - [bgImage drawInRect:cellFrame fromRect:NSMakeRect(0.0, 0.0, 1.0, 22.0) operation:NSCompositeSourceOver fraction:1.0]; - [aquaDivider drawAtPoint:NSMakePoint(cellFrame.origin.x + cellFrame.size.width - 1.0, cellFrame.origin.y + cellFrame.size.height) fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0]; - - aRect.size.height+=0.5; - - } 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, NSCompositeSourceAtop); - } - - [aquaDivider drawAtPoint:NSMakePoint(cellFrame.origin.x + cellFrame.size.width - 1.0, cellFrame.origin.y + cellFrame.size.height) fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0]; - } - - [self drawInteriorWithTabCell:cell inView:[cell controlView]]; -} - -- (void)drawTabBar:(PSMTabBarControl *)bar inRect:(NSRect)rect -{ - [aquaTabBg drawInRect:rect fromRect:NSMakeRect(0.0, 0.0, 1.0, 22.0) operation:NSCompositeSourceOver fraction:1.0]; - - // 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: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]; - } - } -} - -- (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 = aquaCloseButton; - if([cell closeButtonOver]) closeButton = aquaCloseButtonOver; - if([cell closeButtonPressed]) closeButton = aquaCloseButtonDown; - - closeButtonSize = [closeButton size]; - [closeButton setFlipped:YES]; - [closeButton drawAtPoint:closeButtonRect.origin fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0]; - - // 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.45] set]; - NSBezierPath *path = [NSBezierPath bezierPath]; - NSRect myRect = [self objectCounterRectForTabCell:cell]; - [path moveToPoint:NSMakePoint(myRect.origin.x + kPSMAquaObjectCounterRadius, myRect.origin.y)]; - [path lineToPoint:NSMakePoint(myRect.origin.x + myRect.size.width - kPSMAquaObjectCounterRadius, myRect.origin.y)]; - [path appendBezierPathWithArcWithCenter:NSMakePoint(myRect.origin.x + myRect.size.width - kPSMAquaObjectCounterRadius, myRect.origin.y + kPSMAquaObjectCounterRadius) radius:kPSMAquaObjectCounterRadius startAngle:270.0 endAngle:90.0]; - [path lineToPoint:NSMakePoint(myRect.origin.x + kPSMAquaObjectCounterRadius, myRect.origin.y + myRect.size.height)]; - [path appendBezierPathWithArcWithCenter:NSMakePoint(myRect.origin.x + kPSMAquaObjectCounterRadius, myRect.origin.y + kPSMAquaObjectCounterRadius) radius:kPSMAquaObjectCounterRadius 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 indicator] isHidden]) - labelRect.size.width -= (kPSMTabBarIndicatorWidth + kPSMTabBarCellPadding); - - if([cell count] > 0) - labelRect.size.width -= ([self objectCounterRectForTabCell:cell].size.width + kPSMTabBarCellPadding); - - // Draw Label - [[cell attributedStringValue] drawInRect:labelRect]; -} - -#pragma mark - -#pragma mark Archiving - -- (void)encodeWithCoder:(NSCoder *)aCoder { - //[super encodeWithCoder:aCoder]; - if ([aCoder allowsKeyedCoding]) { - [aCoder encodeObject:aquaTabBg forKey:@"aquaTabBg"]; - [aCoder encodeObject:aquaTabBgDown forKey:@"aquaTabBgDown"]; - [aCoder encodeObject:aquaTabBgDownGraphite forKey:@"aquaTabBgDownGraphite"]; - [aCoder encodeObject:aquaTabBgDownNonKey forKey:@"aquaTabBgDownNonKey"]; - [aCoder encodeObject:aquaDividerDown forKey:@"aquaDividerDown"]; - [aCoder encodeObject:aquaDivider forKey:@"aquaDivider"]; - [aCoder encodeObject:aquaCloseButton forKey:@"aquaCloseButton"]; - [aCoder encodeObject:aquaCloseButtonDown forKey:@"aquaCloseButtonDown"]; - [aCoder encodeObject:aquaCloseButtonOver forKey:@"aquaCloseButtonOver"]; - [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]) { - aquaTabBg = [[aDecoder decodeObjectForKey:@"aquaTabBg"] retain]; - aquaTabBgDown = [[aDecoder decodeObjectForKey:@"aquaTabBgDown"] retain]; - aquaTabBgDownGraphite = [[aDecoder decodeObjectForKey:@"aquaTabBgDownGraphite"] retain]; - aquaTabBgDownNonKey = [[aDecoder decodeObjectForKey:@"aquaTabBgDownNonKey"] retain]; - aquaDividerDown = [[aDecoder decodeObjectForKey:@"aquaDividerDown"] retain]; - aquaDivider = [[aDecoder decodeObjectForKey:@"aquaDivider"] retain]; - aquaCloseButton = [[aDecoder decodeObjectForKey:@"aquaCloseButton"] retain]; - aquaCloseButtonDown = [[aDecoder decodeObjectForKey:@"aquaCloseButtonDown"] retain]; - aquaCloseButtonOver = [[aDecoder decodeObjectForKey:@"aquaCloseButtonOver"] 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/PSMMetalTabStyle.m b/src/MacVim/PSMTabBarControl/source/PSMMetalTabStyle.m index 53fa26b567..bb760f653c 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMMetalTabStyle.m +++ b/src/MacVim/PSMTabBarControl/source/PSMMetalTabStyle.m @@ -393,8 +393,12 @@ void MyNSDrawWindowBackground(NSRect rect) if ([cell closeButtonPressed]) closeButton = metalCloseButtonDown; closeButtonSize = [closeButton size]; +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6 + [closeButton drawInRect:closeButtonRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0 respectFlipped:YES hints:nil]; +#else [closeButton setFlipped:YES]; [closeButton drawAtPoint:closeButtonRect.origin fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0]; +#endif // scoot label over labelPosition += closeButtonSize.width + kPSMTabBarCellPadding; diff --git a/src/MacVim/PSMTabBarControl/source/PSMOverflowPopUpButton.m b/src/MacVim/PSMTabBarControl/source/PSMOverflowPopUpButton.m index 5e8265f91a..21727eafa3 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMOverflowPopUpButton.m +++ b/src/MacVim/PSMTabBarControl/source/PSMOverflowPopUpButton.m @@ -43,8 +43,12 @@ NSSize imageSize = [image size]; rect.origin.x = NSMidX(rect) - (imageSize.width * 0.5); rect.origin.y = NSMidY(rect) - (imageSize.height * 0.5); +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6 + [image drawInRect:rect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0 respectFlipped:YES hints:nil]; +#else [image setFlipped:YES]; [image drawAtPoint:rect.origin fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0]; +#endif } - (void)mouseDown:(NSEvent *)event diff --git a/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.m b/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.m index 05ed3b4700..d0ec3817df 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.m +++ b/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.m @@ -12,7 +12,6 @@ #import "PSMRolloverButton.h" #import "PSMTabStyle.h" #import "PSMMetalTabStyle.h" -#import "PSMAquaTabStyle.h" #import "PSMUnifiedTabStyle.h" #import "PSMTabDragAssistant.h" @@ -255,10 +254,7 @@ - (void)setStyleNamed:(NSString *)name { [style release]; - if([name isEqualToString:@"Aqua"]){ - style = [[PSMAquaTabStyle alloc] init]; - } - else if ([name isEqualToString:@"Unified"]){ + if ([name isEqualToString:@"Unified"]){ style = [[PSMUnifiedTabStyle alloc] init]; } else { diff --git a/src/MacVim/PSMTabBarControl/source/PSMUnifiedTabStyle.m b/src/MacVim/PSMTabBarControl/source/PSMUnifiedTabStyle.m index c16264f40e..19f82f2d00 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMUnifiedTabStyle.m +++ b/src/MacVim/PSMTabBarControl/source/PSMUnifiedTabStyle.m @@ -389,8 +389,12 @@ if ([cell closeButtonPressed]) closeButton = unifiedCloseButtonDown; closeButtonSize = [closeButton size]; +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6 + [closeButton drawInRect:closeButtonRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0 respectFlipped:YES hints:nil]; +#else [closeButton setFlipped:YES]; [closeButton drawAtPoint:closeButtonRect.origin fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0]; +#endif // scoot label over labelPosition += closeButtonSize.width + kPSMTabBarCellPadding;