Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
93530aa
Converted project to ARC
Jun 18, 2013
14559bd
Updated to modern Objective-C
Jun 18, 2013
de8a013
Updated demo project
Jun 18, 2013
db2ec00
Added Codesign
lvandal Jun 18, 2013
0b3f49f
AdiumTabStyle: adjust the icon in vertical tabs when the indicator is…
Jul 5, 2013
fac9c3a
AdiumTabStyle: scale the large image to fit the forced width.
Jul 5, 2013
1d5f0a8
AdiumTabStyle: fix the title overlapping the icon.
Jul 5, 2013
cfef5ae
Prevent creating invisible windows. If a single-tab window's tab is d…
Oct 27, 2013
681929b
Clear highlighted cells when dragging starts.
Oct 27, 2013
1a99eca
Removed codesign so that I can build the framework
neoneye Dec 28, 2013
6df122c
My first attempt at making a cocoa pod out of PSMTabBarControl.
neoneye Dec 28, 2013
70877c3
Added xcodeproj line. My last commit didn’t work. Nothing got built w…
neoneye Dec 28, 2013
eab6d18
Experimenting getting “pod install” to fetch this cocoa pod. No luck …
neoneye Dec 28, 2013
4c1ce97
Yay. I have figured out how to link Newton Commander with the PSMTabB…
neoneye Dec 28, 2013
7102190
Minor clean up of change log and read me. Bumped version to 1.0.2
neoneye Dec 28, 2013
11a758c
Moved demo project into the Projects folder
neoneye Dec 31, 2013
2321009
Incremented version number too much. Undo
neoneye Dec 31, 2013
7e608f9
Validated xcodeproj with Xcode5.0.2
neoneye Jan 2, 2014
65c2f2d
Eliminated warning about “Gestalt” being deprecated
neoneye Jan 2, 2014
cc10899
Fixed typo in respondToSelector. Now it’s the same selector that it c…
neoneye Jan 2, 2014
f322d1e
Eliminated warnings about undeclared selectors, by moving the interna…
neoneye Jan 2, 2014
74ce40d
Added PSMTabViewItemIdentifier protocol in order to eliminate 4 respo…
neoneye Jan 3, 2014
365c91e
Moved demo app image into the demo app folder
neoneye Jan 3, 2014
39dd9eb
Incremented version to 1.0.4. Updated changelog
neoneye Jan 3, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Xcode
.DS_Store
build/
*/build/*
*.pbxuser
!default.pbxuser
*.mode1v3
Expand All @@ -9,10 +9,12 @@ build/
!default.mode2v3
*.perspectivev3
!default.perspectivev3
*.xcworkspace
!default.xcworkspace
xcuserdata
profile
*.moved-aside
DerivedData
.idea/
*.hmap

#CocoaPods
Pods
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# PSMTabBarControl CHANGELOG

## 1.0.4

Eliminated all warnings.

## 1.0.3

Moved demo app into the 'Project' folder.

## 1.0.2

Made a cocoapod with PSMTabBarControl that compiles with Xcode 5 and uses ARC.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@implementation NSString (AITruncation)

+ (id)ellipsis {
return [NSString stringWithUTF8String:"\xE2\x80\xA6"];
return @"\xE2\x80\xA6";
}

- (NSString *)stringWithEllipsisByTruncatingToLength:(NSUInteger)length {
Expand All @@ -23,7 +23,7 @@ - (NSString *)stringWithEllipsisByTruncatingToLength:(NSUInteger)length {
returnString = [[self substringToIndex:length - 1] stringByAppendingString:[NSString ellipsis]];
} else {
//We don't need to truncate, so don't append an ellipsis
returnString = [[self copy] autorelease];
returnString = [self copy];
}

return returnString;
Expand Down
File renamed without changes.
90 changes: 38 additions & 52 deletions Source/PSMAdiumTabStyle.m → Classes/PSMAdiumTabStyle.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,6 @@ - (void)loadImages {
_gradientImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AdiumGradient"]];
}

- (void)dealloc {
[_closeButton release];
[_closeButtonDown release];
[_closeButtonOver release];

[_closeDirtyButton release];
[_closeDirtyButtonDown release];
[_closeDirtyButtonOver release];

[_addTabButtonImage release];
[_addTabButtonPressedImage release];
[_addTabButtonRolloverImage release];

[_gradientImage release];

[super dealloc];
}

#pragma mark -
#pragma mark Drawing Style Accessors
Expand Down Expand Up @@ -178,7 +161,7 @@ - (NSImage *)closeButtonImageOfType:(PSMCloseButtonImageType)type forTabCell:(PS
- (NSAttributedString *)attributedStringValueForTabCell:(PSMTabBarCell *)cell {
NSMutableAttributedString *attrStr;
NSString *contents = [cell title];
attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease];
attrStr = [[NSMutableAttributedString alloc] initWithString:contents];
NSRange range = NSMakeRange(0, [contents length]);

[attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0] range:range];
Expand All @@ -187,7 +170,7 @@ - (NSAttributedString *)attributedStringValueForTabCell:(PSMTabBarCell *)cell {
// Paragraph Style for Truncating Long Text
static NSMutableParagraphStyle *truncatingTailParagraphStyle = nil;
if(!truncatingTailParagraphStyle) {
truncatingTailParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain];
truncatingTailParagraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
[truncatingTailParagraphStyle setLineBreakMode:NSLineBreakByTruncatingTail];
}
[attrStr addAttribute:NSParagraphStyleAttributeName value:truncatingTailParagraphStyle range:range];
Expand Down Expand Up @@ -318,7 +301,13 @@ - (NSRect)iconRectForBounds:(NSRect)theRect ofTabCell:(PSMTabBarCell *)cell {
if (orientation == PSMTabBarHorizontalOrientation) {
result = NSMakeRect(drawingRect.origin.x, drawingRect.origin.y, scaledIconSize.width, scaledIconSize.height);
} else {
result = NSMakeRect(NSMaxX(drawingRect)-scaledIconSize.width, drawingRect.origin.y, scaledIconSize.width, scaledIconSize.height);
NSRect constrainedDrawingRect = drawingRect;

NSRect indicatorRect = [cell indicatorRectForBounds:theRect];
if (!NSEqualRects(indicatorRect, NSZeroRect))
constrainedDrawingRect.size.width -= NSWidth(indicatorRect) + kPSMTabBarCellPadding;

result = NSMakeRect(NSMaxX(constrainedDrawingRect)-scaledIconSize.width, drawingRect.origin.y, scaledIconSize.width, scaledIconSize.height);
}

// center in available space (in case icon image is smaller than kPSMTabBarIconWidth)
Expand All @@ -337,6 +326,11 @@ - (NSRect)iconRectForBounds:(NSRect)theRect ofTabCell:(PSMTabBarCell *)cell {

- (NSRect)titleRectForBounds:(NSRect)theRect ofTabCell:(PSMTabBarCell *)cell {

//Don't bother calculating anything if we don't have a string
NSAttributedString *attrString = [cell attributedStringValue];
if ([attrString length] == 0)
return NSZeroRect;

PSMTabBarControl *tabBarControl = [cell controlView];
PSMTabBarOrientation orientation = [tabBarControl orientation];

Expand All @@ -355,37 +349,35 @@ - (NSRect)titleRectForBounds:(NSRect)theRect ofTabCell:(PSMTabBarCell *)cell {
constrainedDrawingRect.size.width -= kPSMAdiumImageWidth + kPSMTabBarCellPadding;
}

NSRect closeButtonRect = [cell closeButtonRectForBounds:theRect];
NSRect counterBadgeRect = [cell objectCounterRectForBounds:theRect];
NSRect iconRect = [cell iconRectForBounds:theRect];
CGFloat maxIconOrClose = MAX(NSWidth(closeButtonRect),NSWidth(iconRect));
if (orientation == PSMTabBarHorizontalOrientation) {

NSRect closeButtonRect = [cell closeButtonRectForBounds:theRect];
NSRect iconRect = [cell iconRectForBounds:theRect];

if (!NSEqualRects(closeButtonRect, NSZeroRect) || !NSEqualRects(iconRect, NSZeroRect)) {
constrainedDrawingRect.origin.x += MAX(NSWidth(closeButtonRect),NSWidth(iconRect)) + kPSMTabBarCellPadding;
constrainedDrawingRect.size.width -= MAX(NSWidth(closeButtonRect),NSWidth(iconRect)) + kPSMTabBarCellPadding;
constrainedDrawingRect.origin.x += maxIconOrClose + kPSMTabBarCellPadding;
constrainedDrawingRect.size.width -= maxIconOrClose + kPSMTabBarCellPadding;
}

NSRect counterBadgeRect = [cell objectCounterRectForBounds:theRect];
if (!NSEqualRects(counterBadgeRect, NSZeroRect)) {
constrainedDrawingRect.size.width -= NSWidth(counterBadgeRect) + kPSMTabBarCellPadding;
}
} else {

NSRect closeButtonRect = [cell closeButtonRectForBounds:theRect];
NSRect counterBadgeRect = [cell objectCounterRectForBounds:theRect];

if (!NSEqualRects(closeButtonRect, NSZeroRect) || !NSEqualRects(counterBadgeRect, NSZeroRect)) {
constrainedDrawingRect.size.width -= MAX(NSWidth(closeButtonRect),NSWidth(counterBadgeRect)) + kPSMTabBarCellPadding;
}
constrainedDrawingRect.size.width -= MAX(maxIconOrClose,NSWidth(counterBadgeRect)) + kPSMTabBarCellPadding;
}
}

//Don't show a title if there's only enough space for a character
if (constrainedDrawingRect.size.width <= 2)
return NSZeroRect;

NSAttributedString *attrString = [cell attributedStringValue];
if ([attrString length] == 0)
return NSZeroRect;
//Make sure there's enough padding between the icon/close button and the text
if (NSMaxX(constrainedDrawingRect)-MAX(NSMinX(iconRect), NSMinX(closeButtonRect)) <= 2)
constrainedDrawingRect.size.width--;

NSSize stringSize = [attrString size];

NSRect result = NSMakeRect(constrainedDrawingRect.origin.x, drawingRect.origin.y+ceil((drawingRect.size.height-stringSize.height)/2), constrainedDrawingRect.size.width, stringSize.height);
Expand Down Expand Up @@ -451,7 +443,7 @@ -(NSRect)largeImageRectForBounds:(NSRect)theRect ofTabCell:(PSMTabBarCell *)cell
if (!image)
return NSZeroRect;

NSSize scaledImageSize = [cell scaleImageWithSize:[image size] toFitInSize:NSMakeSize(constrainedDrawingRect.size.width, constrainedDrawingRect.size.height) scalingType:NSImageScaleProportionallyUpOrDown];
NSSize scaledImageSize = [cell scaleImageWithSize:[image size] toFitInSize:NSMakeSize(MIN(constrainedDrawingRect.size.width, kPSMAdiumImageWidth), constrainedDrawingRect.size.height) scalingType:NSImageScaleProportionallyUpOrDown];

NSRect result = NSMakeRect(constrainedDrawingRect.origin.x,
constrainedDrawingRect.origin.y - ((constrainedDrawingRect.size.height - scaledImageSize.height) / 2),
Expand All @@ -461,7 +453,7 @@ -(NSRect)largeImageRectForBounds:(NSRect)theRect ofTabCell:(PSMTabBarCell *)cell
result.origin.x += (kPSMTabBarCellPadding + kPSMAdiumImageWidth - scaledImageSize.width) / 2.0;
}
if(scaledImageSize.height < constrainedDrawingRect.size.height) {
result.origin.y += (constrainedDrawingRect.size.height - scaledImageSize.height) / 2.0;
result.origin.y += (constrainedDrawingRect.size.height - scaledImageSize.height);
}

return result;
Expand All @@ -483,7 +475,6 @@ - (void)drawBezelOfTabBarControl:(PSMTabBarControl *)tabBarControl inRect:(NSRec
if([tabBarControl isWindowActive]) {
NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithCalibratedWhite:0.835 alpha:1.0] endingColor:[NSColor colorWithCalibratedWhite:0.843 alpha:1.0]];
[gradient drawInRect:rect angle:90.0];
[gradient release];
} else {
[[NSColor windowBackgroundColor] set];
NSRectFill(rect);
Expand Down Expand Up @@ -577,7 +568,6 @@ - (void)drawBezelOfTabBarControl:(PSMTabBarControl *)tabBarControl inRect:(NSRec
}
}

[shadow release];
[NSGraphicsContext restoreGraphicsState];
}

Expand Down Expand Up @@ -612,7 +602,6 @@ - (void)drawBezelOfTabCell:(PSMTabBarCell *)cell withFrame:(NSRect)frame inTabBa

NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithCalibratedWhite:0.835 alpha:1.0] endingColor:[NSColor colorWithCalibratedWhite:0.843 alpha:1.0]];
[gradient drawInRect:aRect angle:90.0];
[gradient release];
} else {
[[NSColor windowBackgroundColor] set];
NSRectFill(aRect);
Expand Down Expand Up @@ -661,7 +650,6 @@ - (void)drawBezelOfTabCell:(PSMTabBarCell *)cell withFrame:(NSRect)frame inTabBa

NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithCalibratedWhite:0.835 alpha:1.0] endingColor:[NSColor colorWithCalibratedWhite:0.843 alpha:1.0]];
[gradient drawInRect:aRect angle:90.0];
[gradient release];
} else {
[[NSColor windowBackgroundColor] set];
NSRectFill(aRect);
Expand All @@ -676,7 +664,6 @@ - (void)drawBezelOfTabCell:(PSMTabBarCell *)cell withFrame:(NSRect)frame inTabBa
}

[gradient drawInRect:aRect angle:0.0];
[gradient release];
}

// frame
Expand Down Expand Up @@ -734,7 +721,6 @@ - (void)drawBezelOfTabCell:(PSMTabBarCell *)cell withFrame:(NSRect)frame inTabBa
}

[NSGraphicsContext restoreGraphicsState];
[shadow release];
}

- (void)drawIconOfTabCell:(PSMTabBarCell *)cell withFrame:(NSRect)frame inTabBarControl:(PSMTabBarControl *)tabBarControl {
Expand Down Expand Up @@ -794,15 +780,15 @@ - (void)encodeWithCoder:(NSCoder *)aCoder {
- (id)initWithCoder:(NSCoder *)aDecoder {
if((self = [super init])) {
if([aDecoder allowsKeyedCoding]) {
_closeButton = [[aDecoder decodeObjectForKey:@"closeButton"] retain];
_closeButtonDown = [[aDecoder decodeObjectForKey:@"closeButtonDown"] retain];
_closeButtonOver = [[aDecoder decodeObjectForKey:@"closeButtonOver"] retain];
_closeDirtyButton = [[aDecoder decodeObjectForKey:@"closeDirtyButton"] retain];
_closeDirtyButtonDown = [[aDecoder decodeObjectForKey:@"closeDirtyButtonDown"] retain];
_closeDirtyButtonOver = [[aDecoder decodeObjectForKey:@"closeDirtyButtonOver"] retain];
_addTabButtonImage = [[aDecoder decodeObjectForKey:@"addTabButtonImage"] retain];
_addTabButtonPressedImage = [[aDecoder decodeObjectForKey:@"addTabButtonPressedImage"] retain];
_addTabButtonRolloverImage = [[aDecoder decodeObjectForKey:@"addTabButtonRolloverImage"] retain];
_closeButton = [aDecoder decodeObjectForKey:@"closeButton"];
_closeButtonDown = [aDecoder decodeObjectForKey:@"closeButtonDown"];
_closeButtonOver = [aDecoder decodeObjectForKey:@"closeButtonOver"];
_closeDirtyButton = [aDecoder decodeObjectForKey:@"closeDirtyButton"];
_closeDirtyButtonDown = [aDecoder decodeObjectForKey:@"closeDirtyButtonDown"];
_closeDirtyButtonOver = [aDecoder decodeObjectForKey:@"closeDirtyButtonOver"];
_addTabButtonImage = [aDecoder decodeObjectForKey:@"addTabButtonImage"];
_addTabButtonPressedImage = [aDecoder decodeObjectForKey:@"addTabButtonPressedImage"];
_addTabButtonRolloverImage = [aDecoder decodeObjectForKey:@"addTabButtonRolloverImage"];
_drawsUnified = [aDecoder decodeBoolForKey:@"drawsUnified"];
_drawsRight = [aDecoder decodeBoolForKey:@"drawsRight"];
}
Expand Down
File renamed without changes.
47 changes: 15 additions & 32 deletions Source/PSMAquaTabStyle.m → Classes/PSMAquaTabStyle.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,6 @@ - (void) loadImages {
_addTabButtonRolloverImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabNewRollover"]];
}

- (void)dealloc {
[aquaTabBg release];
[aquaTabBgDown release];
[aquaDividerDown release];
[aquaDivider release];
[aquaCloseButton release];
[aquaCloseButtonDown release];
[aquaCloseButtonOver release];
[aquaCloseDirtyButton release];
[aquaCloseDirtyButtonDown release];
[aquaCloseDirtyButtonOver release];
[_addTabButtonImage release];
[_addTabButtonPressedImage release];
[_addTabButtonRolloverImage release];

[super dealloc];
}

#pragma mark -
#pragma mark Control Specifics
Expand Down Expand Up @@ -236,21 +219,21 @@ - (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];
aquaCloseDirtyButton = [[aDecoder decodeObjectForKey:@"aquaCloseDirtyButton"] retain];
aquaCloseDirtyButtonDown = [[aDecoder decodeObjectForKey:@"aquaCloseDirtyButtonDown"] retain];
aquaCloseDirtyButtonOver = [[aDecoder decodeObjectForKey:@"aquaCloseDirtyButtonOver"] retain];
_addTabButtonImage = [[aDecoder decodeObjectForKey:@"addTabButtonImage"] retain];
_addTabButtonPressedImage = [[aDecoder decodeObjectForKey:@"addTabButtonPressedImage"] retain];
_addTabButtonRolloverImage = [[aDecoder decodeObjectForKey:@"addTabButtonRolloverImage"] retain];
aquaTabBg = [aDecoder decodeObjectForKey:@"aquaTabBg"];
aquaTabBgDown = [aDecoder decodeObjectForKey:@"aquaTabBgDown"];
aquaTabBgDownGraphite = [aDecoder decodeObjectForKey:@"aquaTabBgDownGraphite"];
aquaTabBgDownNonKey = [aDecoder decodeObjectForKey:@"aquaTabBgDownNonKey"];
aquaDividerDown = [aDecoder decodeObjectForKey:@"aquaDividerDown"];
aquaDivider = [aDecoder decodeObjectForKey:@"aquaDivider"];
aquaCloseButton = [aDecoder decodeObjectForKey:@"aquaCloseButton"];
aquaCloseButtonDown = [aDecoder decodeObjectForKey:@"aquaCloseButtonDown"];
aquaCloseButtonOver = [aDecoder decodeObjectForKey:@"aquaCloseButtonOver"];
aquaCloseDirtyButton = [aDecoder decodeObjectForKey:@"aquaCloseDirtyButton"];
aquaCloseDirtyButtonDown = [aDecoder decodeObjectForKey:@"aquaCloseDirtyButtonDown"];
aquaCloseDirtyButtonOver = [aDecoder decodeObjectForKey:@"aquaCloseDirtyButtonOver"];
_addTabButtonImage = [aDecoder decodeObjectForKey:@"addTabButtonImage"];
_addTabButtonPressedImage = [aDecoder decodeObjectForKey:@"addTabButtonPressedImage"];
_addTabButtonRolloverImage = [aDecoder decodeObjectForKey:@"addTabButtonRolloverImage"];
}
//}
return self;
Expand Down
File renamed without changes.
16 changes: 1 addition & 15 deletions Source/PSMCardTabStyle.m → Classes/PSMCardTabStyle.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,6 @@ - (id) init {
return self;
}

- (void)dealloc {
[cardCloseButton release];
[cardCloseButtonDown release];
[cardCloseButtonOver release];
[cardCloseDirtyButton release];
[cardCloseDirtyButtonDown release];
[cardCloseDirtyButtonOver release];
[_addTabButtonImage release];
[_addTabButtonPressedImage release];
[_addTabButtonRolloverImage release];

[super dealloc];
}

#pragma mark -
#pragma mark Control Specific
Expand Down Expand Up @@ -155,7 +142,6 @@ - (void)drawBezelOfTabBarControl:(PSMTabBarControl *)tabBarControl inRect:(NSRec
if (gradient) {
[gradient drawInRect:bounds angle:270];

[gradient release];
}
}

Expand Down Expand Up @@ -215,7 +201,7 @@ - (void)drawBezelOfTabCell:(PSMTabBarCell *)cell withFrame:(NSRect)frame inTabBa

if (gradient != nil) {
[gradient drawInBezierPath:bezier angle:90.0f];
[gradient release], gradient = nil;
gradient = nil;
}
} else {
[[NSColor windowBackgroundColor] set];
Expand Down
File renamed without changes.
Loading