aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks
diff options
context:
space:
mode:
authorStuart Connolly <stuart02@gmail.com>2017-03-26 23:01:20 +0100
committerStuart Connolly <stuart02@gmail.com>2017-03-26 23:01:20 +0100
commit044789b21056562bacd81fa6aafd76c091f00d69 (patch)
tree04d99f6da35b7002696626cdddb558f62538f892 /Frameworks
parent2aad505ec144b83123296c9bc4bad7c0e43753ef (diff)
downloadsequelpro-044789b21056562bacd81fa6aafd76c091f00d69.tar.gz
sequelpro-044789b21056562bacd81fa6aafd76c091f00d69.tar.bz2
sequelpro-044789b21056562bacd81fa6aafd76c091f00d69.zip
Update tab view drawing to match the style used by 10.12's automatic tabs and remove unused tab styles.
Issues still to address: - Add tab button does not darken when moused over - The tab overflow button is being clipped and the image is not high res
Diffstat (limited to 'Frameworks')
-rw-r--r--Frameworks/PSMTabBar/PSMRolloverButton.h6
-rw-r--r--Frameworks/PSMTabBar/PSMRolloverButton.m82
-rw-r--r--Frameworks/PSMTabBar/PSMTabBarCell.m5
-rw-r--r--Frameworks/PSMTabBar/PSMTabBarControl.h19
-rw-r--r--Frameworks/PSMTabBar/PSMTabBarControl.m27
-rw-r--r--Frameworks/PSMTabBar/PSMTabBarController.m2
-rw-r--r--Frameworks/PSMTabBar/PSMTabDragView.m2
-rw-r--r--Frameworks/PSMTabBar/PSMTabStyle.h7
-rw-r--r--Frameworks/PSMTabBar/Styles/PSMAdiumTabStyle.h39
-rw-r--r--Frameworks/PSMTabBar/Styles/PSMAdiumTabStyle.m1050
-rw-r--r--Frameworks/PSMTabBar/Styles/PSMAquaTabStyle.h38
-rw-r--r--Frameworks/PSMTabBar/Styles/PSMAquaTabStyle.m573
-rw-r--r--Frameworks/PSMTabBar/Styles/PSMCardTabStyle.h32
-rw-r--r--Frameworks/PSMTabBar/Styles/PSMCardTabStyle.m643
-rw-r--r--Frameworks/PSMTabBar/Styles/PSMMetalTabStyle.h34
-rw-r--r--Frameworks/PSMTabBar/Styles/PSMMetalTabStyle.m654
-rw-r--r--Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.h5
-rw-r--r--Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m208
-rw-r--r--Frameworks/PSMTabBar/Styles/PSMUnifiedTabStyle.h30
-rw-r--r--Frameworks/PSMTabBar/Styles/PSMUnifiedTabStyle.m598
20 files changed, 182 insertions, 3872 deletions
diff --git a/Frameworks/PSMTabBar/PSMRolloverButton.h b/Frameworks/PSMTabBar/PSMRolloverButton.h
index 9f339a50..5a2ac368 100644
--- a/Frameworks/PSMTabBar/PSMRolloverButton.h
+++ b/Frameworks/PSMTabBar/PSMRolloverButton.h
@@ -24,11 +24,11 @@
- (nullable NSImage *)rolloverImage;
// tracking rect for mouse events
-- (void)rolloverFrameDidChange:(nonnull NSNotification *)inNotification;
+- (void)rolloverFrameDidChange:(nonnull NSNotification *)notification;
- (void)addTrackingRect;
- (void)removeTrackingRect;
-- (void)mouseEntered:(nullable NSEvent *)theEvent;
-- (void)mouseExited:(nullable NSEvent *)theEvent;
+- (void)mouseEntered:(nullable NSEvent *)event;
+- (void)mouseExited:(nullable NSEvent *)event;
@end
diff --git a/Frameworks/PSMTabBar/PSMRolloverButton.m b/Frameworks/PSMTabBar/PSMRolloverButton.m
index 4ded63b7..730caec0 100644
--- a/Frameworks/PSMTabBar/PSMRolloverButton.m
+++ b/Frameworks/PSMTabBar/PSMRolloverButton.m
@@ -20,6 +20,7 @@
selector:@selector(rolloverFrameDidChange:)
name:NSViewFrameDidChangeNotification
object:self];
+
[self setPostsFrameChangedNotifications:YES];
[self resetCursorRects];
@@ -28,17 +29,6 @@
_usualImage = nil;
}
-- (void)dealloc
-{
- [[NSNotificationCenter defaultCenter] removeObserver:self];
-
- [self removeTrackingRect];
- [_rolloverImage release];
- [_usualImage release];
-
- [super dealloc];
-}
-
// the regular image
- (void)setUsualImage:(NSImage *)newImage
{
@@ -66,7 +56,7 @@
return _rolloverImage;
}
-//Remove old tracking rects when we change superviews
+// Remove old tracking rects when we change superviews
- (void)viewWillMoveToSuperview:(NSView *)newSuperview
{
[self removeTrackingRect];
@@ -95,7 +85,7 @@
[self resetCursorRects];
}
-- (void)rolloverFrameDidChange:(NSNotification *)inNotification
+- (void)rolloverFrameDidChange:(NSNotification *)notification
{
[self resetCursorRects];
}
@@ -104,15 +94,18 @@
{
// assign a tracking rect to watch for mouse enter/exit
NSRect trackRect = [self bounds];
- NSPoint localPoint = [self convertPoint:[[self window] convertScreenToBase:[NSEvent mouseLocation]]
- fromView:nil];
- BOOL mouseInside = NSPointInRect(localPoint, trackRect);
+ NSPoint localPoint = [self convertPoint:[[self window] convertScreenToBase:[NSEvent mouseLocation]] fromView:nil];
+
+ BOOL mouseInside = NSPointInRect(localPoint, trackRect);
_myTrackingRectTag = [self addTrackingRect:trackRect owner:self userData:nil assumeInside:mouseInside];
- if (mouseInside)
+
+ if (mouseInside) {
[self mouseEntered:nil];
- else
+ }
+ else {
[self mouseExited:nil];
+ }
}
- (void)removeTrackingRect
@@ -120,24 +113,27 @@
if (_myTrackingRectTag != -1) {
[self removeTrackingRect:_myTrackingRectTag];
}
+
_myTrackingRectTag = -1;
}
// override for rollover effect
-- (void)mouseEntered:(nullable NSEvent *)theEvent
+- (void)mouseEntered:(nullable NSEvent *)event
{
// set rollover image
[self setImage:_rolloverImage];
- [super mouseEntered:theEvent];
+ [super mouseEntered:event];
}
-- (void)mouseExited:(nullable NSEvent *)theEvent
+- (void)mouseExited:(nullable NSEvent *)event
{
// restore usual image
[self setImage:_usualImage];
- [super mouseExited:theEvent];
+ [self setHighlighted:NO];
+
+ [super mouseExited:event];
}
- (void)resetCursorRects
@@ -162,26 +158,42 @@
#pragma mark -
#pragma mark Archiving
-- (void)encodeWithCoder:(NSCoder *)aCoder {
- [super encodeWithCoder:aCoder];
- if ([aCoder allowsKeyedCoding]) {
- [aCoder encodeObject:_rolloverImage forKey:@"rolloverImage"];
- [aCoder encodeObject:_usualImage forKey:@"usualImage"];
- [aCoder encodeInteger:_myTrackingRectTag forKey:@"myTrackingRectTag"];
+- (void)encodeWithCoder:(NSCoder *)coder
+{
+ [super encodeWithCoder:coder];
+
+ if ([coder allowsKeyedCoding]) {
+ [coder encodeObject:_rolloverImage forKey:@"rolloverImage"];
+ [coder encodeObject:_usualImage forKey:@"usualImage"];
+ [coder encodeInteger:_myTrackingRectTag forKey:@"myTrackingRectTag"];
}
}
-- (id)initWithCoder:(NSCoder *)aDecoder {
- self = [super initWithCoder:aDecoder];
- if (self) {
- if ([aDecoder allowsKeyedCoding]) {
- _rolloverImage = [[aDecoder decodeObjectForKey:@"rolloverImage"] retain];
- _usualImage = [[aDecoder decodeObjectForKey:@"usualImage"] retain];
- _myTrackingRectTag = [aDecoder decodeIntegerForKey:@"myTrackingRectTag"];
+- (id)initWithCoder:(NSCoder *)decoder
+{
+ if ((self = [super initWithCoder:decoder])) {
+ if ([decoder allowsKeyedCoding]) {
+ _rolloverImage = [[decoder decodeObjectForKey:@"rolloverImage"] retain];
+ _usualImage = [[decoder decodeObjectForKey:@"usualImage"] retain];
+ _myTrackingRectTag = [decoder decodeIntegerForKey:@"myTrackingRectTag"];
}
}
+
return self;
}
+#pragma mark -
+
+- (void)dealloc
+{
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
+
+ [self removeTrackingRect];
+
+ [_rolloverImage release];
+ [_usualImage release];
+
+ [super dealloc];
+}
@end
diff --git a/Frameworks/PSMTabBar/PSMTabBarCell.m b/Frameworks/PSMTabBar/PSMTabBarCell.m
index 80fe4ec0..fb869f47 100644
--- a/Frameworks/PSMTabBar/PSMTabBarCell.m
+++ b/Frameworks/PSMTabBar/PSMTabBarCell.m
@@ -432,8 +432,11 @@
[image lockFocusFlipped:YES];
#endif
[self setFrame:tabDrawFrame];
- [(id <PSMTabStyle>)[(PSMTabBarControl *)_customControlView style] drawTabCell:self];
+
+ [(id <PSMTabStyle>)[(PSMTabBarControl *)_customControlView style] drawTabCellForDragImage:self];
+
[self setFrame:oldFrame];
+
[image unlockFocus];
// Add the indicator if appropriate
diff --git a/Frameworks/PSMTabBar/PSMTabBarControl.h b/Frameworks/PSMTabBar/PSMTabBarControl.h
index ad9de748..dee4ed8a 100644
--- a/Frameworks/PSMTabBar/PSMTabBarControl.h
+++ b/Frameworks/PSMTabBar/PSMTabBarControl.h
@@ -15,13 +15,16 @@
#define PSMTabDragDidEndNotification @"PSMTabDragDidEndNotification"
#define PSMTabDragDidBeginNotification @"PSMTabDragDidBeginNotification"
-#define kPSMTabBarControlHeight 34
+#define kPSMTabBarControlHeight 25
#define kPSMTabBarControlDefaultHeightCollapsed 0 // can be changed with a property
+
// internal cell border
#define MARGIN_X 6
-#define MARGIN_Y 5
+#define MARGIN_Y 6
+
// padding between objects
#define kPSMTabBarCellPadding 4
+
// fixed size objects
#define kPSMMinimumTitleWidth 30
#define kPSMTabBarIndicatorWidth 16.0f
@@ -48,13 +51,13 @@ typedef enum {
} PSMTabBarTearOffStyle;
enum {
- PSMTab_SelectedMask = 1 << 1,
- PSMTab_LeftIsSelectedMask = 1 << 2,
- PSMTab_RightIsSelectedMask = 1 << 3,
+ 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_PositionMiddleMask = 1 << 5,
+ PSMTab_PositionRightMask = 1 << 6,
+ PSMTab_PositionSingleMask = 1 << 7
};
@interface PSMTabBarControl : NSControl {
diff --git a/Frameworks/PSMTabBar/PSMTabBarControl.m b/Frameworks/PSMTabBar/PSMTabBarControl.m
index 18b5a296..3e3c1e30 100644
--- a/Frameworks/PSMTabBar/PSMTabBarControl.m
+++ b/Frameworks/PSMTabBar/PSMTabBarControl.m
@@ -11,11 +11,6 @@
#import "PSMOverflowPopUpButton.h"
#import "PSMRolloverButton.h"
#import "PSMTabStyle.h"
-#import "PSMMetalTabStyle.h"
-#import "PSMAquaTabStyle.h"
-#import "PSMUnifiedTabStyle.h"
-#import "PSMCardTabStyle.h"
-#import "PSMAdiumTabStyle.h"
#import "PSMSequelProTabStyle.h"
#import "PSMTabDragAssistant.h"
#import "PSMTabBarController.h"
@@ -161,6 +156,7 @@
// new tab button
NSRect addTabButtonRect = NSMakeRect([self frame].size.width - [style rightMarginForTabBarControl] + 1, 3.0f, 16.0f, 16.0f);
_addTabButton = [[PSMRolloverButton alloc] initWithFrame:addTabButtonRect];
+
if (_addTabButton) {
NSImage *newButtonImage = [style addTabButtonImage];
if (newButtonImage) {
@@ -369,31 +365,16 @@
- (void)setStyleNamed:(NSString *)name
{
id <PSMTabStyle> newStyle;
-
-/* if ([name isEqualToString:@"Aqua"]) {
- newStyle = [[PSMAquaTabStyle alloc] init];
-
- } else if ([name isEqualToString:@"Unified"]) {
- newStyle = [[PSMUnifiedTabStyle alloc] init];
-
- } else if ([name isEqualToString:@"Adium"]) {
- newStyle = [[PSMAdiumTabStyle alloc] init];
-
- } else if ([name isEqualToString:@"Card"]) {
- newStyle = [[PSMCardTabStyle alloc] init];
-
- } else if ([name isEqualToString:@"Metal"]) {
- newStyle = [[PSMMetalTabStyle alloc] init];
- } else */
if ([name isEqualToString:@"SequelPro"]) {
newStyle = [[PSMSequelProTabStyle alloc] init];
-
- } else {
+ }
+ else {
newStyle = [[PSMSequelProTabStyle alloc] init];
}
[self setStyle:newStyle];
+
[newStyle release];
}
diff --git a/Frameworks/PSMTabBar/PSMTabBarController.m b/Frameworks/PSMTabBar/PSMTabBarController.m
index eddf4174..53f11c63 100644
--- a/Frameworks/PSMTabBar/PSMTabBarController.m
+++ b/Frameworks/PSMTabBar/PSMTabBarController.m
@@ -214,7 +214,7 @@
_addButtonRect.size = [[_control addTabButton] frame].size;
if ([_control orientation] == PSMTabBarHorizontalOrientation) {
_addButtonRect.origin.y = MARGIN_Y;
- _addButtonRect.origin.x += [[cellWidths valueForKeyPath:@"@sum.floatValue"] floatValue] + MARGIN_X;
+ _addButtonRect.origin.x += [[cellWidths valueForKeyPath:@"@sum.floatValue"] floatValue] + MARGIN_X;
} else {
_addButtonRect.origin.x = 0;
_addButtonRect.origin.y = [[cellWidths lastObject] floatValue];
diff --git a/Frameworks/PSMTabBar/PSMTabDragView.m b/Frameworks/PSMTabBar/PSMTabDragView.m
index 5be56b10..aa066d86 100644
--- a/Frameworks/PSMTabBar/PSMTabDragView.m
+++ b/Frameworks/PSMTabBar/PSMTabDragView.m
@@ -34,7 +34,9 @@
srcRect.size = [_image size];
[_image drawInRect:[self bounds] fromRect:srcRect operation:NSCompositeSourceOver fraction:primaryAlpha];
+
srcRect.size = [_alternateImage size];
+
[_alternateImage drawInRect:[self bounds] fromRect:srcRect operation:NSCompositeSourceOver fraction:alternateAlpha];
}
diff --git a/Frameworks/PSMTabBar/PSMTabStyle.h b/Frameworks/PSMTabBar/PSMTabStyle.h
index 23c826fa..0688c8a9 100644
--- a/Frameworks/PSMTabBar/PSMTabStyle.h
+++ b/Frameworks/PSMTabBar/PSMTabStyle.h
@@ -7,8 +7,10 @@
//
/*
-Protocol to be observed by all style delegate objects. These objects handle the drawing responsibilities for PSMTabBarCell; once the control has been assigned a style, the background and cells draw consistent with that style. Design pattern and implementation by David Smith, Seth Willits, and Chris Forsythe, all touch up and errors by John P. :-)
-*/
+ * Protocol to be observed by all style delegate objects.
+ * These objects handle the drawing responsibilities for PSMTabBarCell; once the control has been assigned a style, the background and cells draw consistent with that style.
+ * Design pattern and implementation by David Smith, Seth Willits, and Chris Forsythe, all touch up and errors by John P. :-)
+ */
#import "PSMTabBarCell.h"
#import "PSMTabBarControl.h"
@@ -45,6 +47,7 @@ Protocol to be observed by all style delegate objects. These objects handle the
// drawing
- (void)drawTabCell:(PSMTabBarCell *)cell;
+- (void)drawTabCellForDragImage:(PSMTabBarCell *)cell;
- (void)drawBackgroundInRect:(NSRect)rect;
- (void)drawTabBar:(PSMTabBarControl *)bar inRect:(NSRect)rect;
diff --git a/Frameworks/PSMTabBar/Styles/PSMAdiumTabStyle.h b/Frameworks/PSMTabBar/Styles/PSMAdiumTabStyle.h
deleted file mode 100644
index fac9a427..00000000
--- a/Frameworks/PSMTabBar/Styles/PSMAdiumTabStyle.h
+++ /dev/null
@@ -1,39 +0,0 @@
-//
-// PSMAdiumTabStyle.h
-// PSMTabBarControl
-//
-// Created by Kent Sutherland on 5/26/06.
-// Copyright 2006 Kent Sutherland. All rights reserved.
-//
-
-#import <Cocoa/Cocoa.h>
-#import "PSMTabStyle.h"
-
-@interface PSMAdiumTabStyle : NSObject <PSMTabStyle>
-{
- NSImage *_closeButton, *_closeButtonDown, *_closeButtonOver;
- NSImage *_closeDirtyButton, *_closeDirtyButtonDown, *_closeDirtyButtonOver;
- NSImage *_addTabButtonImage, *_addTabButtonPressedImage, *_addTabButtonRolloverImage;
- NSImage *_gradientImage;
-
- NSDictionary *_objectCountStringAttributes;
-
- PSMTabBarOrientation orientation;
- PSMTabBarControl *tabBar;
-
- BOOL _drawsUnified, _drawsRight;
-}
-
-- (void)loadImages;
-
-- (BOOL)drawsUnified;
-- (void)setDrawsUnified:(BOOL)value;
-- (BOOL)drawsRight;
-- (void)setDrawsRight:(BOOL)value;
-
-- (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlView;
-
-- (void)encodeWithCoder:(NSCoder *)aCoder;
-- (id)initWithCoder:(NSCoder *)aDecoder;
-
-@end
diff --git a/Frameworks/PSMTabBar/Styles/PSMAdiumTabStyle.m b/Frameworks/PSMTabBar/Styles/PSMAdiumTabStyle.m
deleted file mode 100644
index be14707d..00000000
--- a/Frameworks/PSMTabBar/Styles/PSMAdiumTabStyle.m
+++ /dev/null
@@ -1,1050 +0,0 @@
-//
-// PSMAdiumTabStyle.m
-// PSMTabBarControl
-//
-// Created by Kent Sutherland on 5/26/06.
-// Copyright 2006 Kent Sutherland. All rights reserved.
-//
-
-#import "PSMAdiumTabStyle.h"
-#import "PSMTabBarCell.h"
-#import "PSMTabBarControl.h"
-#import "NSBezierPath_AMShading.h"
-
-#define Adium_CellPadding 2
-#define Adium_MARGIN_X 4
-#define kPSMAdiumCounterPadding 3.0
-#define kPSMAdiumObjectCounterRadius 7.0
-#define kPSMAdiumCounterMinWidth 20
-
-#define kPSMTabBarControlSourceListHeight 28
-
-#define kPSMTabBarLargeImageHeight kPSMTabBarControlSourceListHeight - 4
-#define kPSMTabBarLargeImageWidth kPSMTabBarLargeImageHeight
-
-@implementation PSMAdiumTabStyle
-
-- (NSString *)name
-{
- return @"Adium";
-}
-
-#pragma mark -
-#pragma mark Creation/Destruction
-
-- (id)init
-{
- if ( (self = [super init]) ) {
- [self loadImages];
- _drawsUnified = NO;
- _drawsRight = NO;
-
- _objectCountStringAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:[[NSFontManager sharedFontManager] convertFont:[NSFont fontWithName:@"Helvetica" size:11.0] toHaveTrait:NSBoldFontMask], NSFontAttributeName,
- [[NSColor whiteColor] colorWithAlphaComponent:0.85], NSForegroundColorAttributeName,
- nil, nil];
- }
- return self;
-}
-
-- (void)loadImages
-{
- _closeButton = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabClose_Front"]];
- _closeButtonDown = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabClose_Front_Pressed"]];
- _closeButtonOver = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabClose_Front_Rollover"]];
-
- _closeDirtyButton = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabCloseDirty_Front"]];
- _closeDirtyButtonDown = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabCloseDirty_Front_Pressed"]];
- _closeDirtyButtonOver = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabCloseDirty_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"]];
-
- _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];
-
- [_objectCountStringAttributes release];
-
- [super dealloc];
-}
-
-#pragma mark -
-#pragma mark Drawing Style Accessors
-
-- (BOOL)drawsUnified
-{
- return _drawsUnified;
-}
-
-- (void)setDrawsUnified:(BOOL)value
-{
- _drawsUnified = value;
-}
-
-- (BOOL)drawsRight
-{
- return _drawsRight;
-}
-
-- (void)setDrawsRight:(BOOL)value
-{
- _drawsRight = value;
-}
-
-#pragma mark -
-#pragma mark Control Specific
-
-- (CGFloat)leftMarginForTabBarControl
-{
- return 3.0f;
-}
-
-- (CGFloat)rightMarginForTabBarControl
-{
- return 24.0f;
-}
-
-- (CGFloat)topMarginForTabBarControl
-{
- return 10.0f;
-}
-
-- (void)setOrientation:(PSMTabBarOrientation)value
-{
- orientation = value;
-}
-
-#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)dragRectForTabCell:(PSMTabBarCell *)cell orientation:(PSMTabBarOrientation)tabOrientation
-{
- NSRect dragRect = [cell frame];
-
- if ([cell tabState] & PSMTab_SelectedMask) {
- if (tabOrientation == PSMTabBarHorizontalOrientation) {
- dragRect.size.width++;
- dragRect.size.height -= 2.0;
- }
- }
-
- return dragRect;
-}
-
-- (BOOL)closeButtonIsEnabledForCell:(PSMTabBarCell *)cell
-{
- return ([cell hasCloseButton] && ![cell isCloseButtonSuppressed]);
-
-}
-- (NSRect)closeButtonRectForTabCell:(PSMTabBarCell *)cell withFrame:(NSRect)cellFrame
-{
- if ([self closeButtonIsEnabledForCell:cell] == NO) {
- return NSZeroRect;
- }
-
- NSRect result;
- result.size = [_closeButton size];
-
- switch (orientation) {
- case PSMTabBarHorizontalOrientation:
- {
- result.origin.x = cellFrame.origin.x + Adium_MARGIN_X;
- result.origin.y = cellFrame.origin.y + MARGIN_Y + 2.0;
- if ([cell state] == NSOnState) {
- result.origin.y -= 1;
- }
- break;
- }
-
- case PSMTabBarVerticalOrientation:
- {
- result.origin.x = NSMaxX(cellFrame) - (Adium_MARGIN_X*2) - NSWidth(result);
- result.origin.y = NSMinY(cellFrame) + (NSHeight(cellFrame) / 2) - (result.size.height / 2) + 1;
- break;
- }
- }
-
- return result;
-}
-
-- (NSRect)iconRectForTabCell:(PSMTabBarCell *)cell
-{
- if ([cell hasIcon] == NO) {
- return NSZeroRect;
- }
-
- NSRect cellFrame = [cell frame];
- NSImage *icon = [[[cell representedObject] identifier] icon];
- NSSize iconSize = [icon size];
-
- NSRect result;
- result.size = iconSize;
-
- switch (orientation)
- {
- case PSMTabBarHorizontalOrientation:
- result.origin.x = cellFrame.origin.x + Adium_MARGIN_X;
- result.origin.y = cellFrame.origin.y + MARGIN_Y;
- break;
-
- case PSMTabBarVerticalOrientation:
- result.origin.x = NSMaxX(cellFrame) - (Adium_MARGIN_X * 2) - NSWidth(result);
- result.origin.y = NSMinY(cellFrame) + (NSHeight(cellFrame) / 2) - (NSHeight(result) / 2) + 1;
- break;
- }
-
- // For horizontal tabs, center in available space (in case icon image is smaller than kPSMTabBarIconWidth)
- if (orientation == PSMTabBarHorizontalOrientation) {
- if (iconSize.width < kPSMTabBarIconWidth)
- result.origin.x += (kPSMTabBarIconWidth - iconSize.width) / 2.0;
- if (iconSize.height < kPSMTabBarIconWidth)
- result.origin.y += (kPSMTabBarIconWidth - iconSize.height) / 2.0;
- }
-
- 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 - Adium_MARGIN_X - kPSMTabBarIndicatorWidth;
- result.origin.y = cellFrame.origin.y + MARGIN_Y;
-
- if ([cell state] == NSOnState) {
- result.origin.y -= 1;
- }
-
- return result;
-}
-
-- (NSSize)sizeForObjectCounterRectForTabCell:(PSMTabBarCell *)cell
-{
- NSSize size;
- CGFloat countWidth = [[self attributedObjectCountValueForTabCell:cell] size].width;
-
- countWidth += (2 * kPSMAdiumObjectCounterRadius - 6.0 + kPSMAdiumCounterPadding);
-
- if (countWidth < kPSMAdiumCounterMinWidth) {
- countWidth = kPSMAdiumCounterMinWidth;
- }
-
- size = NSMakeSize(countWidth, 2 * kPSMAdiumObjectCounterRadius); // temp
-
- return size;
-}
-
-- (NSRect)objectCounterRectForTabCell:(PSMTabBarCell *)cell
-{
- NSRect cellFrame;
- NSRect result;
-
- if ([cell count] == 0) {
- return NSZeroRect;
- }
-
- cellFrame = [cell frame];
- result.size = [self sizeForObjectCounterRectForTabCell:cell];
- result.origin.x = NSMaxX(cellFrame) - Adium_MARGIN_X - result.size.width;
- result.origin.y = cellFrame.origin.y + MARGIN_Y + 1.0;
-
- if (![[cell indicator] isHidden]) {
- result.origin.x -= kPSMTabBarIndicatorWidth + Adium_CellPadding;
- }
-
- return result;
-}
-
-- (CGFloat)minimumWidthOfTabCell:(PSMTabBarCell *)cell
-{
- CGFloat resultWidth = 0.0;
-
- // left margin
- resultWidth = Adium_MARGIN_X;
-
- // close button?
- if ([self closeButtonIsEnabledForCell:cell]) {
- resultWidth += MAX([_closeButton size].width, NSWidth([self iconRectForTabCell:cell])) + Adium_CellPadding;
- }
-
- // icon?
- /*if ([cell hasIcon]) {
- resultWidth += kPSMTabBarIconWidth + Adium_CellPadding;
- }*/
-
- // the label
- resultWidth += kPSMMinimumTitleWidth;
-
- // object counter?
- if (([cell count] > 0) && (orientation == PSMTabBarHorizontalOrientation)) {
- resultWidth += NSWidth([self objectCounterRectForTabCell:cell]) + Adium_CellPadding;
- }
-
- // indicator?
- if ([[cell indicator] isHidden] == NO) {
- resultWidth += Adium_CellPadding + kPSMTabBarIndicatorWidth;
- }
-
- // right margin
- resultWidth += Adium_MARGIN_X;
-
- return ceil(resultWidth);
-}
-
-- (CGFloat)desiredWidthOfTabCell:(PSMTabBarCell *)cell
-{
- CGFloat resultWidth = 0.0;
-
- // left margin
- resultWidth = Adium_MARGIN_X;
-
- // close button?
- if ([self closeButtonIsEnabledForCell:cell]) {
- resultWidth += MAX([_closeButton size].width, NSWidth([self iconRectForTabCell:cell])) + Adium_CellPadding;
- }
-
- // icon?
- /*if ([cell hasIcon]) {
- resultWidth += kPSMTabBarIconWidth + Adium_CellPadding;
- }*/
-
- // the label
- resultWidth += [[cell attributedStringValue] size].width + Adium_CellPadding;
-
- // object counter?
- if (([cell count] > 0) && (orientation == PSMTabBarHorizontalOrientation)){
- resultWidth += [self objectCounterRectForTabCell:cell].size.width + Adium_CellPadding;
- }
-
- // indicator?
- if ([[cell indicator] isHidden] == NO) {
- resultWidth += Adium_CellPadding + kPSMTabBarIndicatorWidth;
- }
-
- // right margin
- resultWidth += Adium_MARGIN_X;
-
- return ceil(resultWidth);
-}
-
-- (CGFloat)tabCellHeight
-{
- return ((orientation == PSMTabBarHorizontalOrientation) ? kPSMTabBarControlHeight : kPSMTabBarControlSourceListHeight);
-}
-
-#pragma mark -
-#pragma mark Cell Values
-
-- (NSAttributedString *)attributedObjectCountValueForTabCell:(PSMTabBarCell *)cell
-{
- NSString *contents = [NSString stringWithFormat:@"%lu", (unsigned long)[cell count]];
- return [[[NSMutableAttributedString alloc] initWithString:contents attributes:_objectCountStringAttributes] autorelease];
-}
-
-- (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 systemFontOfSize:11.0] range:range];
- [attrStr addAttribute:NSForegroundColorAttributeName value:[NSColor controlTextColor] range:range];
-
- // Paragraph Style for Truncating Long Text
- static NSMutableParagraphStyle *TruncatingTailParagraphStyle = nil;
- if (!TruncatingTailParagraphStyle) {
- TruncatingTailParagraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
- [TruncatingTailParagraphStyle setLineBreakMode:NSLineBreakByTruncatingTail];
- }
- [attrStr addAttribute:NSParagraphStyleAttributeName value:TruncatingTailParagraphStyle range:range];
-
- return attrStr;
-}
-
-#pragma mark -
-#pragma mark Cell Drawing
-
-- (CGFloat)heightOfAttributedString:(NSAttributedString *)inAttributedString withWidth:(CGFloat)width
-{
- static NSMutableDictionary *cache;
- if (!cache)
- cache = [[NSMutableDictionary alloc] init];
- if ([cache count] > 100) //100 items should be trivial in terms of memory overhead, but sufficient
- [cache removeAllObjects];
- NSNumber *cachedHeight = [cache objectForKey:inAttributedString];
- if (cachedHeight)
- return [cachedHeight doubleValue];
- else {
- NSTextStorage *textStorage = [[NSTextStorage alloc] initWithAttributedString:inAttributedString];
- NSTextContainer *textContainer = [[NSTextContainer alloc] initWithContainerSize:NSMakeSize(width, 1e7)];
- NSLayoutManager *layoutManager = [[NSLayoutManager alloc] init];
-
- //Configure
- [textContainer setLineFragmentPadding:0.0];
- [layoutManager addTextContainer:textContainer];
- [textStorage addLayoutManager:layoutManager];
-
- //Force the layout manager to layout its text
- (void)[layoutManager glyphRangeForTextContainer:textContainer];
-
- CGFloat height = [layoutManager usedRectForTextContainer:textContainer].size.height;
-
- [textStorage release];
- [textContainer release];
- [layoutManager release];
-
- [cache setObject:[NSNumber numberWithDouble:height] forKey:inAttributedString];
-
- return height;
- }
-}
-
-- (void)drawObjectCounterInCell:(PSMTabBarCell *)cell withRect:(NSRect)myRect
-{
- myRect.size.width -= kPSMAdiumCounterPadding;
- myRect.origin.x += kPSMAdiumCounterPadding;
-
- [[cell countColor] ?: [NSColor colorWithCalibratedWhite:0.3 alpha:0.6] set];
- NSBezierPath *path = [NSBezierPath bezierPath];
- [path setLineWidth:1.0];
-
- if ([cell state] == NSOnState) {
- myRect.origin.y -= 1.0;
- }
-
- [path moveToPoint:NSMakePoint(NSMinX(myRect) + kPSMAdiumObjectCounterRadius, NSMinY(myRect))];
- [path lineToPoint:NSMakePoint(NSMaxX(myRect) - kPSMAdiumObjectCounterRadius, NSMinY(myRect))];
- [path appendBezierPathWithArcWithCenter:NSMakePoint(NSMaxX(myRect) - kPSMAdiumObjectCounterRadius, NSMinY(myRect) + kPSMAdiumObjectCounterRadius)
- radius:kPSMAdiumObjectCounterRadius
- startAngle:270.0
- endAngle:90.0];
- [path lineToPoint:NSMakePoint(NSMinX(myRect) + kPSMAdiumObjectCounterRadius, NSMaxY(myRect))];
- [path appendBezierPathWithArcWithCenter:NSMakePoint(NSMinX(myRect) + kPSMAdiumObjectCounterRadius, NSMinY(myRect) + kPSMAdiumObjectCounterRadius)
- radius:kPSMAdiumObjectCounterRadius
- 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];
-}
-
-- (NSBezierPath *)bezierPathWithRoundedRect:(NSRect)rect radius:(CGFloat)radius
-{
- NSBezierPath *path = [NSBezierPath bezierPath];
- NSPoint topLeft, topRight, bottomLeft, bottomRight;
-
- topLeft = NSMakePoint(rect.origin.x, rect.origin.y);
- topRight = NSMakePoint(rect.origin.x + rect.size.width, rect.origin.y);
- bottomLeft = NSMakePoint(rect.origin.x, rect.origin.y + rect.size.height);
- bottomRight = NSMakePoint(rect.origin.x + rect.size.width, rect.origin.y + rect.size.height);
-
- [path appendBezierPathWithArcWithCenter:NSMakePoint(topLeft.x + radius, topLeft.y + radius)
- radius:radius
- startAngle:180
- endAngle:270
- clockwise:NO];
- [path lineToPoint:NSMakePoint(topRight.x - radius, topRight.y)];
-
- [path appendBezierPathWithArcWithCenter:NSMakePoint(topRight.x - radius, topRight.y + radius)
- radius:radius
- startAngle:270
- endAngle:0
- clockwise:NO];
- [path lineToPoint:NSMakePoint(bottomRight.x, bottomRight.y - radius)];
-
- [path appendBezierPathWithArcWithCenter:NSMakePoint(bottomRight.x - radius, bottomRight.y - radius)
- radius:radius
- startAngle:0
- endAngle:90
- clockwise:NO];
- [path lineToPoint:NSMakePoint(bottomLeft.x + radius, bottomLeft.y)];
-
- [path appendBezierPathWithArcWithCenter:NSMakePoint(bottomLeft.x + radius, bottomLeft.y - radius)
- radius:radius
- startAngle:90
- endAngle:180
- clockwise:NO];
- [path lineToPoint:NSMakePoint(topLeft.x, topLeft.y + radius)];
-
- return path;
-}
-
-- (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlView
-{
- NSRect cellFrame = [cell frame];
-
- if ((orientation == PSMTabBarVerticalOrientation) &&
- [cell hasLargeImage]) {
- NSImage *image = [[[cell representedObject] identifier] largeImage];
- cellFrame.origin.x += Adium_MARGIN_X;
-
- NSRect imageDrawingRect = NSMakeRect(cellFrame.origin.x,
- cellFrame.origin.y - ((kPSMTabBarControlSourceListHeight - kPSMTabBarLargeImageHeight) / 2),
- kPSMTabBarLargeImageWidth, kPSMTabBarLargeImageHeight);
-
- [NSGraphicsContext saveGraphicsState];
- //Use a transform to draw an arbitrary image in our flipped view
- NSAffineTransform *transform = [NSAffineTransform transform];
- [transform translateXBy:imageDrawingRect.origin.x yBy:(imageDrawingRect.origin.y + imageDrawingRect.size.height)];
- [transform scaleXBy:1.0 yBy:-1.0];
- [transform concat];
-
- imageDrawingRect.origin = NSMakePoint(0,0);
-
- //Create Rounding.
- CGFloat userIconRoundingRadius = (kPSMTabBarLargeImageWidth / 4.0);
- if (userIconRoundingRadius > 3) userIconRoundingRadius = 3;
- NSBezierPath *clipPath = [self bezierPathWithRoundedRect:imageDrawingRect radius:userIconRoundingRadius];
- [clipPath addClip];
-
- [image drawInRect:imageDrawingRect
- fromRect:NSMakeRect(0, 0, [image size].width, [image size].height)
- operation:NSCompositeSourceOver
- fraction:1.0];
-
- [NSGraphicsContext restoreGraphicsState];
-
- cellFrame.origin.x += imageDrawingRect.size.width;
- cellFrame.size.width -= imageDrawingRect.size.width;
- }
-
- // label rect
- NSRect labelRect;
- labelRect.origin.x = cellFrame.origin.x + Adium_MARGIN_X;
- labelRect.size.width = cellFrame.size.width - (labelRect.origin.x - cellFrame.origin.x) - Adium_CellPadding;
- labelRect.size.height = cellFrame.size.height;
- switch (orientation)
- {
- case PSMTabBarHorizontalOrientation:
- labelRect.origin.y = cellFrame.origin.y + MARGIN_Y + 1.0;
- break;
- case PSMTabBarVerticalOrientation:
- labelRect.origin.y = cellFrame.origin.y;
- break;
- }
-
- if ([self closeButtonIsEnabledForCell:cell]) {
- /* The close button and the icon (if present) are drawn combined, changing on-hover */
- NSRect closeButtonRect = [cell closeButtonRectForFrame:cellFrame];
- NSRect iconRect = [self iconRectForTabCell:cell];
- NSRect drawingRect;
- NSImage *closeButtonOrIcon = nil;
-
- if ([cell hasIcon]) {
- /* If the cell has an icon and a close button, determine which rect should be used and use it consistently
- * This only matters for horizontal tabs; vertical tabs look fine without making this adjustment.
- */
- if (NSWidth(iconRect) > NSWidth(closeButtonRect)) {
- closeButtonRect.origin.x = NSMinX(iconRect) + NSWidth(iconRect)/2 - NSWidth(closeButtonRect)/2;
- }
- }
-
- if ([cell closeButtonPressed]) {
- closeButtonOrIcon = ([cell isEdited] ? _closeDirtyButtonDown : _closeButtonDown);
- drawingRect = closeButtonRect;
-
- } else if ([cell closeButtonOver]) {
- closeButtonOrIcon = ([cell isEdited] ? _closeDirtyButtonOver : _closeButtonOver);
- drawingRect = closeButtonRect;
-
- } else if ((orientation == PSMTabBarVerticalOrientation) &&
- ([cell count] > 0)) {
- /* In vertical tabs, the count indicator supercedes the icon */
- NSSize counterSize = [self sizeForObjectCounterRectForTabCell:cell];
- if (counterSize.width > NSWidth(closeButtonRect)) {
- closeButtonRect.origin.x -= (counterSize.width - NSWidth(closeButtonRect));
- closeButtonRect.size.width = counterSize.width;
- }
-
- closeButtonRect.origin.y = cellFrame.origin.y + ((NSHeight(cellFrame) - counterSize.height) / 2);
- closeButtonRect.size.height = counterSize.height;
-
- drawingRect = closeButtonRect;
- [self drawObjectCounterInCell:cell withRect:drawingRect];
- /* closeButtonOrIcon == nil */
-
- } else if ([cell hasIcon]) {
- closeButtonOrIcon = [[[cell representedObject] identifier] icon];
- drawingRect = iconRect;
-
- } else {
- closeButtonOrIcon = ([cell isEdited] ? _closeDirtyButton : _closeButton);
- drawingRect = closeButtonRect;
- }
-
- [closeButtonOrIcon drawInRect:drawingRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0f respectFlipped:YES hints:nil];
-
- // scoot label over
- switch (orientation)
- {
- case PSMTabBarHorizontalOrientation:
- {
- CGFloat oldOrigin = labelRect.origin.x;
- if (NSWidth(iconRect) > NSWidth(closeButtonRect)) {
- labelRect.origin.x = (NSMaxX(iconRect) + (Adium_CellPadding * 2));
- } else {
- labelRect.origin.x = (NSMaxX(closeButtonRect) + (Adium_CellPadding * 2));
- }
- labelRect.size.width -= (NSMinX(labelRect) - oldOrigin);
- break;
- }
- case PSMTabBarVerticalOrientation:
- {
- //Generate the remaining label rect directly from the location of the close button, allowing for padding
- if (NSWidth(iconRect) > NSWidth(closeButtonRect)) {
- labelRect.size.width = NSMinX(iconRect) - Adium_CellPadding - NSMinX(labelRect);
- } else {
- labelRect.size.width = NSMinX(closeButtonRect) - Adium_CellPadding - NSMinX(labelRect);
- }
-
- break;
- }
- }
-
- } else if ([cell hasIcon]) {
- /* The close button is disabled; the cell has an icon */
- NSRect iconRect = [self iconRectForTabCell:cell];
- NSImage *icon = [[[cell representedObject] identifier] icon];
-
- [icon drawInRect:iconRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0f respectFlipped:YES hints:nil];
-
- // scoot label over by the size of the standard close button
- switch (orientation)
- {
- case PSMTabBarHorizontalOrientation:
- labelRect.origin.x += (NSWidth(iconRect) + Adium_CellPadding);
- labelRect.size.width -= (NSWidth(iconRect) + Adium_CellPadding);
- break;
- case PSMTabBarVerticalOrientation:
- labelRect.size.width -= (NSWidth(iconRect) + Adium_CellPadding);
- break;
- }
- }
-
- if ([cell state] == NSOnState) {
- labelRect.origin.y -= 1;
- }
-
- if (![[cell indicator] isHidden]) {
- labelRect.size.width -= (kPSMTabBarIndicatorWidth + Adium_CellPadding);
- }
-
- // object counter
- //The object counter takes up space horizontally...
- if (([cell count] > 0) &&
- (orientation == PSMTabBarHorizontalOrientation)) {
- NSRect counterRect = [self objectCounterRectForTabCell:cell];
-
- [self drawObjectCounterInCell:cell withRect:counterRect];
- labelRect.size.width -= NSWidth(counterRect) + Adium_CellPadding;
- }
-
- // draw label
- NSAttributedString *attributedString = [cell attributedStringValue];
- if (orientation == PSMTabBarVerticalOrientation) {
- //Calculate the centered rect
- CGFloat stringHeight = [self heightOfAttributedString:attributedString withWidth:NSWidth(labelRect)];
- if (stringHeight < labelRect.size.height) {
- labelRect.origin.y += (NSHeight(labelRect) - stringHeight) / 2.0;
- }
- }
-
- [attributedString drawInRect:labelRect];
-}
-
-- (void)drawTabCell:(PSMTabBarCell *)cell
-{
- NSRect cellFrame = [cell frame];
- NSColor *lineColor = nil;
- NSBezierPath *bezier = [NSBezierPath bezierPath];
- lineColor = [NSColor grayColor];
-
- [bezier setLineWidth:1.0];
-
- //disable antialiasing of bezier paths
- [NSGraphicsContext saveGraphicsState];
- [[NSGraphicsContext currentContext] setShouldAntialias:NO];
-
- NSShadow *shadow = [[NSShadow alloc] init];
- [shadow setShadowOffset:NSMakeSize(-2, -2)];
- [shadow setShadowBlurRadius:2];
- [shadow setShadowColor:[NSColor colorWithCalibratedWhite:0.6 alpha:1.0]];
-
- if ([cell state] == NSOnState) {
- // selected tab
- if (orientation == PSMTabBarHorizontalOrientation) {
- NSRect aRect = NSMakeRect(cellFrame.origin.x, cellFrame.origin.y, NSWidth(cellFrame), cellFrame.size.height - 2.5);
-
- // background
- if (_drawsUnified) {
- if ([[[tabBar tabView] window] isKeyWindow]) {
- NSBezierPath *path = [NSBezierPath bezierPathWithRect:aRect];
- [path linearGradientFillWithStartColor:[NSColor colorWithCalibratedWhite:0.835 alpha:1.0]
- endColor:[NSColor colorWithCalibratedWhite:0.843 alpha:1.0]];
- } else {
- [[NSColor windowBackgroundColor] set];
- NSRectFill(aRect);
- }
- } else {
- [_gradientImage drawInRect:NSMakeRect(NSMinX(aRect), NSMinY(aRect), NSWidth(aRect), NSHeight(aRect)) fromRect:NSMakeRect(0, 0, [_gradientImage size].width, [_gradientImage size].height) operation:NSCompositeSourceOver fraction:1.0];
- }
-
- // frame
- [lineColor set];
- [bezier setLineWidth:1.0];
- [bezier moveToPoint:NSMakePoint(aRect.origin.x, aRect.origin.y)];
- [bezier lineToPoint:NSMakePoint(aRect.origin.x, aRect.origin.y + aRect.size.height)];
-
- [shadow setShadowOffset:NSMakeSize(-2, -2)];
- [shadow set];
- [bezier stroke];
-
- bezier = [NSBezierPath bezierPath];
- [bezier setLineWidth:1.0];
- [bezier moveToPoint:NSMakePoint(NSMinX(aRect), NSMaxY(aRect))];
- [bezier lineToPoint:NSMakePoint(NSMaxX(aRect), NSMaxY(aRect))];
- [bezier lineToPoint:NSMakePoint(NSMaxX(aRect), NSMinY(aRect))];
-
- if ([[cell customControlView] 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)];
- }
-
- [shadow setShadowOffset:NSMakeSize(2, -2)];
- [shadow set];
- [bezier stroke];
- } else {
- NSRect aRect;
-
- if (_drawsRight) {
- aRect = NSMakeRect(cellFrame.origin.x - 1, cellFrame.origin.y, cellFrame.size.width - 3, cellFrame.size.height);
- } else {
- aRect = NSMakeRect(cellFrame.origin.x + 2, cellFrame.origin.y, cellFrame.size.width - 2, cellFrame.size.height);
- }
-
- // background
- if (_drawsUnified) {
- if ([[[tabBar tabView] window] isKeyWindow]) {
- NSBezierPath *path = [NSBezierPath bezierPathWithRect:aRect];
- [path linearGradientFillWithStartColor:[NSColor colorWithCalibratedWhite:0.835 alpha:1.0]
- endColor:[NSColor colorWithCalibratedWhite:0.843 alpha:1.0]];
- } else {
- [[NSColor windowBackgroundColor] set];
- NSRectFill(aRect);
- }
- } else {
- NSBezierPath *path = [NSBezierPath bezierPathWithRect:aRect];
- if (_drawsRight) {
- [path linearVerticalGradientFillWithStartColor:[NSColor colorWithCalibratedWhite:0.92 alpha:1.0]
- endColor:[NSColor colorWithCalibratedWhite:0.98 alpha:1.0]];
- } else {
- [path linearVerticalGradientFillWithStartColor:[NSColor colorWithCalibratedWhite:0.98 alpha:1.0]
- endColor:[NSColor colorWithCalibratedWhite:0.92 alpha:1.0]];
- }
- }
-
- // frame
- //top line
- [lineColor set];
- [bezier setLineWidth:1.0];
- [bezier moveToPoint:NSMakePoint(NSMinX(aRect), NSMinY(aRect))];
- [bezier lineToPoint:NSMakePoint(NSMaxX(aRect), NSMinY(aRect))];
- [bezier stroke];
-
- //outer edge and bottom lines
- bezier = [NSBezierPath bezierPath];
- [bezier setLineWidth:1.0];
- if (_drawsRight) {
- //Right
- [bezier moveToPoint:NSMakePoint(NSMaxX(aRect), NSMinY(aRect))];
- [bezier lineToPoint:NSMakePoint(NSMaxX(aRect), NSMaxY(aRect))];
- //Bottom
- [bezier lineToPoint:NSMakePoint(NSMinX(aRect), NSMaxY(aRect))];
- } else {
- //Left
- [bezier moveToPoint:NSMakePoint(NSMinX(aRect), NSMinY(aRect))];
- [bezier lineToPoint:NSMakePoint(NSMinX(aRect), NSMaxY(aRect))];
- //Bottom
- [bezier lineToPoint:NSMakePoint(NSMaxX(aRect), NSMaxY(aRect))];
- }
- [shadow setShadowOffset:NSMakeSize((_drawsRight ? 2 : -2), -2)];
- [shadow set];
- [bezier stroke];
- }
- } else {
- // unselected tab
- NSRect aRect = NSMakeRect(cellFrame.origin.x, cellFrame.origin.y, cellFrame.size.width, cellFrame.size.height);
-
- // rollover
- if ([cell isHighlighted]) {
- [[NSColor colorWithCalibratedWhite:0.0 alpha:0.1] set];
- NSRectFillUsingOperation(aRect, NSCompositeSourceAtop);
- }
-
- // frame
- [lineColor set];
-
- if (orientation == PSMTabBarHorizontalOrientation) {
- [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)) {
- //draw the tab divider
- [bezier lineToPoint:NSMakePoint(aRect.origin.x + aRect.size.width, aRect.origin.y + aRect.size.height)];
- }
- [bezier stroke];
-
- } else {
- //No outline for vertical
- }
- }
-
- [NSGraphicsContext restoreGraphicsState];
- [shadow release];
-
- [self drawInteriorWithTabCell:cell inView:[cell customControlView]];
-}
-
-- (void)drawBackgroundInRect:(NSRect)rect
-{
- //Draw for our whole bounds; it'll be automatically clipped to fit the appropriate drawing area
- rect = [tabBar bounds];
-
- switch (orientation) {
- case PSMTabBarHorizontalOrientation:
- if (_drawsUnified && [[[tabBar tabView] window] isKeyWindow]) {
- if ([[[tabBar tabView] window] isKeyWindow]) {
- NSBezierPath *backgroundPath = [NSBezierPath bezierPathWithRect:rect];
- [backgroundPath linearGradientFillWithStartColor:[NSColor colorWithCalibratedWhite:0.835 alpha:1.0]
- endColor:[NSColor colorWithCalibratedWhite:0.843 alpha:1.0]];
- } else {
- [[NSColor windowBackgroundColor] set];
- NSRectFill(rect);
- }
- } else {
- [[NSColor colorWithCalibratedWhite:0.85 alpha:0.6] set];
- [NSBezierPath fillRect:rect];
- }
- break;
-
- case PSMTabBarVerticalOrientation:
- //This is the Mail.app source list background color... which differs from the iTunes one.
- [[NSColor colorWithCalibratedRed:.9059
- green:.9294
- blue:.9647
- alpha:1.0] set];
- NSRectFill(rect);
- break;
- }
-
- //Draw the border and shadow around the tab bar itself
- [NSGraphicsContext saveGraphicsState];
- [[NSGraphicsContext currentContext] setShouldAntialias:NO];
-
- NSShadow *shadow = [[NSShadow alloc] init];
- [shadow setShadowBlurRadius:2];
- [shadow setShadowColor:[NSColor colorWithCalibratedWhite:0.6 alpha:1.0]];
-
- [[NSColor grayColor] set];
-
- NSBezierPath *path = [NSBezierPath bezierPath];
- [path setLineWidth:1.0];
-
- switch (orientation) {
- case PSMTabBarHorizontalOrientation:
- {
- rect.origin.y++;
- [path moveToPoint:NSMakePoint(rect.origin.x, rect.origin.y)];
- [path lineToPoint:NSMakePoint(rect.origin.x + rect.size.width, rect.origin.y)];
- [shadow setShadowOffset:NSMakeSize(2, -2)];
-
- [shadow set];
- [path stroke];
-
- break;
- }
-
- case PSMTabBarVerticalOrientation:
- {
- NSPoint startPoint, endPoint;
- NSSize shadowOffset;
-
- //Draw vertical shadow
- if (_drawsRight) {
- startPoint = NSMakePoint(NSMinX(rect), NSMinY(rect));
- endPoint = NSMakePoint(NSMinX(rect), NSMaxY(rect));
- shadowOffset = NSMakeSize(2, -2);
- } else {
- startPoint = NSMakePoint(NSMaxX(rect) - 1, NSMinY(rect));
- endPoint = NSMakePoint(NSMaxX(rect) - 1, NSMaxY(rect));
- shadowOffset = NSMakeSize(-2, -2);
- }
-
- [path moveToPoint:startPoint];
- [path lineToPoint:endPoint];
- [shadow setShadowOffset:shadowOffset];
-
- [shadow set];
- [path stroke];
-
- [path removeAllPoints];
-
- //Draw top horizontal shadow
- startPoint = NSMakePoint(NSMinX(rect), NSMinY(rect));
- endPoint = NSMakePoint(NSMaxX(rect), NSMinY(rect));
- shadowOffset = NSMakeSize(0, -1);
-
- [path moveToPoint:startPoint];
- [path lineToPoint:endPoint];
- [shadow setShadowOffset:shadowOffset];
-
- [shadow set];
- [path stroke];
-
- break;
- }
- }
-
- [shadow release];
- [NSGraphicsContext restoreGraphicsState];
-}
-
-- (void)drawTabBar:(PSMTabBarControl *)bar inRect:(NSRect)rect
-{
- if (orientation != [bar orientation]) {
- orientation = [bar orientation];
- }
-
- if (tabBar != bar) {
- [tabBar release];
- tabBar = [bar retain];
- }
-
- [self drawBackgroundInRect:rect];
-
- // 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];
- NSMutableParagraphStyle *centeredParagraphStyle = nil;
-
- if (!centeredParagraphStyle) {
- centeredParagraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
- [centeredParagraphStyle setAlignment:NSCenterTextAlignment];
- }
-
- [attrStr addAttribute:NSParagraphStyleAttributeName value:centeredParagraphStyle range:range];
- [centeredParagraphStyle release];
- [attrStr drawInRect:labelRect];
- return;
- }
-
- // draw cells
- NSEnumerator *e = [[bar cells] objectEnumerator];
- PSMTabBarCell *cell;
- while ( (cell = [e nextObject]) ) {
- if ([bar isAnimating] || (![cell isInOverflowMenu] && NSIntersectsRect([cell frame], rect))) {
- [cell drawWithFrame:[cell frame] inView:bar];
- }
- }
-}
-
-#pragma mark -
-#pragma mark Archiving
-
-- (void)encodeWithCoder:(NSCoder *)aCoder
-{
- if ([aCoder allowsKeyedCoding]) {
- [aCoder encodeObject:_closeButton forKey:@"closeButton"];
- [aCoder encodeObject:_closeButtonDown forKey:@"closeButtonDown"];
- [aCoder encodeObject:_closeButtonOver forKey:@"closeButtonOver"];
- [aCoder encodeObject:_closeDirtyButton forKey:@"closeDirtyButton"];
- [aCoder encodeObject:_closeDirtyButtonDown forKey:@"closeDirtyButtonDown"];
- [aCoder encodeObject:_closeDirtyButtonOver forKey:@"closeDirtyButtonOver"];
- [aCoder encodeObject:_addTabButtonImage forKey:@"addTabButtonImage"];
- [aCoder encodeObject:_addTabButtonPressedImage forKey:@"addTabButtonPressedImage"];
- [aCoder encodeObject:_addTabButtonRolloverImage forKey:@"addTabButtonRolloverImage"];
- [aCoder encodeBool:_drawsUnified forKey:@"drawsUnified"];
- [aCoder encodeBool:_drawsRight forKey:@"drawsRight"];
- }
-}
-
-- (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];
- _drawsUnified = [aDecoder decodeBoolForKey:@"drawsUnified"];
- _drawsRight = [aDecoder decodeBoolForKey:@"drawsRight"];
- }
- }
- return self;
-}
-
-@end
diff --git a/Frameworks/PSMTabBar/Styles/PSMAquaTabStyle.h b/Frameworks/PSMTabBar/Styles/PSMAquaTabStyle.h
deleted file mode 100644
index d3448e41..00000000
--- a/Frameworks/PSMTabBar/Styles/PSMAquaTabStyle.h
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// PSMAquaTabStyle.h
-// PSMTabBarControl
-//
-// Created by John Pannell on 2/17/06.
-// Copyright 2006 Positive Spin Media. All rights reserved.
-//
-
-#import <Cocoa/Cocoa.h>
-#import "PSMTabStyle.h"
-
-@interface PSMAquaTabStyle : NSObject <PSMTabStyle> {
- NSImage *aquaTabBg;
- NSImage *aquaTabBgDown;
- NSImage *aquaTabBgDownGraphite;
- NSImage *aquaTabBgDownNonKey;
- NSImage *aquaDividerDown;
- NSImage *aquaDivider;
- NSImage *aquaCloseButton;
- NSImage *aquaCloseButtonDown;
- NSImage *aquaCloseButtonOver;
- NSImage *aquaCloseDirtyButton;
- NSImage *aquaCloseDirtyButtonDown;
- NSImage *aquaCloseDirtyButtonOver;
- NSImage *_addTabButtonImage;
- NSImage *_addTabButtonPressedImage;
- NSImage *_addTabButtonRolloverImage;
-
- NSDictionary *_objectCountStringAttributes;
- PSMTabBarControl *tabBar;
-}
-
-- (void)loadImages;
-- (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlView;
-
-- (void)encodeWithCoder:(NSCoder *)aCoder;
-- (id)initWithCoder:(NSCoder *)aDecoder;
-@end
diff --git a/Frameworks/PSMTabBar/Styles/PSMAquaTabStyle.m b/Frameworks/PSMTabBar/Styles/PSMAquaTabStyle.m
deleted file mode 100644
index a96724c0..00000000
--- a/Frameworks/PSMTabBar/Styles/PSMAquaTabStyle.m
+++ /dev/null
@@ -1,573 +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];
-
- _objectCountStringAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:[[NSFontManager sharedFontManager] convertFont:[NSFont fontWithName:@"Helvetica" size:11.0] toHaveTrait:NSBoldFontMask], NSFontAttributeName,
- [[NSColor whiteColor] colorWithAlphaComponent:0.85], NSForegroundColorAttributeName,
- nil, nil];
- }
- 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"]];
-
- aquaCloseDirtyButton = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabCloseDirty_Front"]];
- aquaCloseDirtyButtonDown = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabCloseDirty_Front_Pressed"]];
- aquaCloseDirtyButtonOver = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabCloseDirty_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];
- [aquaCloseDirtyButton release];
- [aquaCloseDirtyButtonDown release];
- [aquaCloseDirtyButtonOver release];
- [_addTabButtonImage release];
- [_addTabButtonPressedImage release];
- [_addTabButtonRolloverImage release];
-
- [_objectCountStringAttributes release];
-
- [super dealloc];
-}
-
-#pragma mark -
-#pragma mark Control Specifics
-
-- (CGFloat)leftMarginForTabBarControl
-{
- return 0.0f;
-}
-
-- (CGFloat)rightMarginForTabBarControl
-{
- return 24.0f;
-}
-
-- (CGFloat)topMarginForTabBarControl
-{
- return 0.0f;
-}
-
-- (void)setOrientation:(PSMTabBarOrientation)value
-{
-
-}
-
-#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)dragRectForTabCell:(PSMTabBarCell *)cell orientation:(PSMTabBarOrientation)orientation
-{
- return [cell frame];
-}
-
-- (NSRect)closeButtonRectForTabCell:(PSMTabBarCell *)cell withFrame:(NSRect)cellFrame
-{
- 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;
- }
-
- CGFloat 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;
-}
-
-- (CGFloat)minimumWidthOfTabCell:(PSMTabBarCell *)cell
-{
- CGFloat 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);
-}
-
-- (CGFloat)desiredWidthOfTabCell:(PSMTabBarCell *)cell
-{
- CGFloat 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);
-}
-
-- (CGFloat)tabCellHeight
-{
- return kPSMTabBarControlHeight;
-}
-
-#pragma mark -
-#pragma mark Cell Values
-
-- (NSAttributedString *)attributedObjectCountValueForTabCell:(PSMTabBarCell *)cell
-{
- NSString *contents = [NSString stringWithFormat:@"%lu", (unsigned long)[cell count]];
- return [[[NSMutableAttributedString alloc] initWithString:contents attributes:_objectCountStringAttributes] autorelease];
-}
-
-- (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
- static NSMutableParagraphStyle *TruncatingTailParagraphStyle = nil;
- if (!TruncatingTailParagraphStyle) {
- TruncatingTailParagraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
- [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 customControlView] 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 compositeToPoint:NSMakePoint(cellFrame.origin.x + cellFrame.size.width - 1.0, cellFrame.origin.y + cellFrame.size.height) operation:NSCompositeSourceOver];
-
- 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 compositeToPoint:NSMakePoint(cellFrame.origin.x + cellFrame.size.width - 1.0, cellFrame.origin.y + cellFrame.size.height) operation:NSCompositeSourceOver];
- }
-
- [self drawInteriorWithTabCell:cell inView:[cell customControlView]];
-}
-
-- (void)drawBackgroundInRect:(NSRect)rect
-{
- if (rect.size.height <= 22.0) {
- //Draw for our whole bounds; it'll be automatically clipped to fit the appropriate drawing area
- rect = [tabBar bounds];
-
- [aquaTabBg drawInRect:rect fromRect:NSMakeRect(0.0, 0.0, 1.0, 22.0) operation:NSCompositeSourceOver fraction:1.0];
- }
-}
-
-- (void)drawTabBar:(PSMTabBarControl *)bar inRect:(NSRect)rect
-{
- if (tabBar != bar) {
- tabBar = bar;
- }
-
- [self drawBackgroundInRect:rect];
-
- // 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];
- NSMutableParagraphStyle *centeredParagraphStyle = nil;
- if (!centeredParagraphStyle) {
- centeredParagraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
- [centeredParagraphStyle setAlignment:NSCenterTextAlignment];
- }
- [attrStr addAttribute:NSParagraphStyleAttributeName value:centeredParagraphStyle range:range];
- [centeredParagraphStyle release];
- [attrStr drawInRect:labelRect];
- return;
- }
-
- // Draw cells
- NSEnumerator *e = [[bar cells] objectEnumerator];
- PSMTabBarCell *cell;
- while ( (cell = [e nextObject]) ) {
- if ([bar isAnimating] || (![cell isInOverflowMenu] && NSIntersectsRect([cell frame], rect))) {
- [cell drawWithFrame:[cell frame] inView:bar];
- }
- }
-}
-
-- (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlView
-{
- NSRect cellFrame = [cell frame];
- CGFloat 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 = [cell isEdited] ? aquaCloseDirtyButton : aquaCloseButton;
-
- if ([cell closeButtonOver]) closeButton = [cell isEdited] ? aquaCloseDirtyButtonOver : aquaCloseButtonOver;
- if ([cell closeButtonPressed]) closeButton = [cell isEdited] ? aquaCloseDirtyButtonDown : aquaCloseButtonDown;
-
- closeButtonSize = [closeButton size];
-
- [closeButton drawInRect:closeButtonRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0f respectFlipped:YES hints:nil];
-
- // scoot label over
- labelPosition += closeButtonSize.width + kPSMTabBarCellPadding;
- }
-
- // icon
- if ([cell hasIcon]) {
- NSRect iconRect = [self iconRectForTabCell:cell];
- NSImage *icon = [[[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.0f respectFlipped:YES hints:nil];
-
- // scoot label over
- labelPosition += iconRect.size.width + kPSMTabBarCellPadding;
- }
-
- // 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);
- }
-
- // object counter
- if ([cell count] > 0) {
- [[cell countColor] ?: [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];
-
- labelRect.size.width -= myRect.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:aquaCloseDirtyButton forKey:@"aquaCloseDirtyButton"];
- [aCoder encodeObject:aquaCloseDirtyButtonDown forKey:@"aquaCloseDirtyButtonDown"];
- [aCoder encodeObject:aquaCloseDirtyButtonOver forKey:@"aquaCloseDirtyButtonOver"];
- [aCoder encodeObject:_addTabButtonImage forKey:@"addTabButtonImage"];
- [aCoder encodeObject:_addTabButtonPressedImage forKey:@"addTabButtonPressedImage"];
- [aCoder encodeObject:_addTabButtonRolloverImage forKey:@"addTabButtonRolloverImage"];
- }
- */
-}
-
-- (id)initWithCoder:(NSCoder *)aDecoder {
-
- self = [self init];
- 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];
-
- }
-*/
- }
- return self;
-}
-
-@end
diff --git a/Frameworks/PSMTabBar/Styles/PSMCardTabStyle.h b/Frameworks/PSMTabBar/Styles/PSMCardTabStyle.h
deleted file mode 100644
index b04f83d1..00000000
--- a/Frameworks/PSMTabBar/Styles/PSMCardTabStyle.h
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-// PSMCardTabStyle.h
-// Fichiers
-//
-// Created by Michael Monscheuer on 05.11.09.
-// Copyright 2009 WriteFlow KG, Wien. All rights reserved.
-//
-
-#import <Cocoa/Cocoa.h>
-#import "PSMTabStyle.h"
-
-@interface PSMCardTabStyle : NSObject <PSMTabStyle>
-{
- NSImage *unifiedCloseButton;
- NSImage *unifiedCloseButtonDown;
- NSImage *unifiedCloseButtonOver;
- NSImage *unifiedCloseDirtyButton;
- NSImage *unifiedCloseDirtyButtonDown;
- NSImage *unifiedCloseDirtyButtonOver;
- NSImage *_addTabButtonImage;
- NSImage *_addTabButtonPressedImage;
- NSImage *_addTabButtonRolloverImage;
-
- NSDictionary *_objectCountStringAttributes;
-
- CGFloat leftMargin;
- PSMTabBarControl *tabBar;
-}
-
-- (void)setLeftMarginForTabBarControl:(CGFloat)margin;
-
-@end
diff --git a/Frameworks/PSMTabBar/Styles/PSMCardTabStyle.m b/Frameworks/PSMTabBar/Styles/PSMCardTabStyle.m
deleted file mode 100644
index d81458f1..00000000
--- a/Frameworks/PSMTabBar/Styles/PSMCardTabStyle.m
+++ /dev/null
@@ -1,643 +0,0 @@
-//
-// PSMCardTabStyle.m
-// Fichiers
-//
-// Created by Michael Monscheuer on 05.11.09.
-// Copyright 2009 WriteFlow KG, Wien. All rights reserved.
-//
-
-#import "PSMCardTabStyle.h"
-#import "PSMTabBarCell.h"
-#import "PSMTabBarControl.h"
-#import "NSBezierPath_AMShading.h"
-
-#define kPSMUnifiedObjectCounterRadius 7.0
-#define kPSMUnifiedCounterMinWidth 20
-
-@interface PSMCardTabStyle (Private)
-- (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlView;
-@end
-
-@implementation PSMCardTabStyle
-
-- (NSString *)name
-{
- return @"Card";
-}
-
-#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"]];
-
- unifiedCloseDirtyButton = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabCloseDirty_Front"]];
- unifiedCloseDirtyButtonDown = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabCloseDirty_Front_Pressed"]];
- unifiedCloseDirtyButtonOver = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabCloseDirty_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"]];
-
- _objectCountStringAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:[[NSFontManager sharedFontManager] convertFont:[NSFont fontWithName:@"Helvetica" size:11.0] toHaveTrait:NSBoldFontMask], NSFontAttributeName,
- [[NSColor whiteColor] colorWithAlphaComponent:0.85], NSForegroundColorAttributeName,
- nil, nil];
-
- leftMargin = 5.0;
- }
- return self;
-}
-
-- (void)dealloc
-{
- [unifiedCloseButton release];
- [unifiedCloseButtonDown release];
- [unifiedCloseButtonOver release];
- [unifiedCloseDirtyButton release];
- [unifiedCloseDirtyButtonDown release];
- [unifiedCloseDirtyButtonOver release];
- [_addTabButtonImage release];
- [_addTabButtonPressedImage release];
- [_addTabButtonRolloverImage release];
-
- [_objectCountStringAttributes release];
-
- [super dealloc];
-}
-
-#pragma mark -
-#pragma mark Control Specific
-
-- (void)setLeftMarginForTabBarControl:(CGFloat)margin
-{
- leftMargin = margin;
-}
-
-- (CGFloat)leftMarginForTabBarControl
-{
- return leftMargin;
-}
-
-- (CGFloat)rightMarginForTabBarControl
-{
- return 5.0f;
-// return 24.0f;
-}
-
-- (CGFloat)topMarginForTabBarControl
-{
- return 10.0f;
-}
-
-- (void)setOrientation:(PSMTabBarOrientation)value
-{
-
-}
-
-#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)dragRectForTabCell:(PSMTabBarCell *)cell orientation:(PSMTabBarOrientation)orientation
-{
- NSRect dragRect = [cell frame];
- dragRect.size.width++;
- return dragRect;
-}
-
-- (NSRect)closeButtonRectForTabCell:(PSMTabBarCell *)cell withFrame:(NSRect)cellFrame
-{
- if ([cell hasCloseButton] == NO || [cell isCloseButtonSuppressed]) {
- 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;
- }
-
- CGFloat 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;
-}
-
-
-- (CGFloat)minimumWidthOfTabCell:(PSMTabBarCell *)cell
-{
- CGFloat 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);
-}
-
-- (CGFloat)desiredWidthOfTabCell:(PSMTabBarCell *)cell
-{
- CGFloat 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);
-}
-
-- (CGFloat)tabCellHeight
-{
- return kPSMTabBarControlHeight;
-}
-
-#pragma mark -
-#pragma mark Cell Values
-
-- (NSAttributedString *)attributedObjectCountValueForTabCell:(PSMTabBarCell *)cell
-{
- NSString *contents = [NSString stringWithFormat:@"%lu", (unsigned long)[cell count]];
- return [[[NSMutableAttributedString alloc] initWithString:contents attributes:_objectCountStringAttributes] autorelease];
-}
-
-- (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
- static NSMutableParagraphStyle *TruncatingTailParagraphStyle = nil;
- if (!TruncatingTailParagraphStyle) {
- TruncatingTailParagraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
- [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];
- BOOL showsBaselineSeparator = NO;
-/*
- NSToolbar *toolbar = [[[cell controlView] window] toolbar];
- BOOL showsBaselineSeparator = (toolbar && [toolbar respondsToSelector:@selector(showsBaselineSeparator)] && [toolbar showsBaselineSeparator]);
-*/
- if (!showsBaselineSeparator) {
- cellFrame.origin.y += 3.0;
- cellFrame.size.height -= 3.0;
- }
-
-
- NSColor * lineColor = nil;
- NSBezierPath* bezier = [NSBezierPath bezierPath];
- lineColor = [NSColor colorWithCalibratedWhite:0.576 alpha:1.0];
-
- if (!showsBaselineSeparator || [cell state] == NSOnState)
- {
-// // selected tab
-// NSRect aRect = NSMakeRect(cellFrame.origin.x+0.5, cellFrame.origin.y-0.5, cellFrame.size.width, cellFrame.size.height);
- // selected tab
- NSRect aRect = NSMakeRect(cellFrame.origin.x+.5, cellFrame.origin.y+0.5, cellFrame.size.width-1.0, cellFrame.size.height-1.0);
-
- // frame
- CGFloat radius = MIN(6.0, 0.5f * MIN(NSWidth(aRect), NSHeight(aRect)))-0.5;
-// NSRect rect = NSInsetRect(aRect, radius, radius);
-
- [bezier moveToPoint: NSMakePoint(NSMinX(aRect),NSMaxY(aRect))];
- [bezier appendBezierPathWithArcFromPoint:NSMakePoint(NSMinX(aRect),NSMinY(aRect)) toPoint:NSMakePoint(NSMidX(aRect),NSMinY(aRect)) radius:radius];
- [bezier appendBezierPathWithArcFromPoint:NSMakePoint(NSMaxX(aRect),NSMinY(aRect)) toPoint:NSMakePoint(NSMaxX(aRect),NSMaxY(aRect)) radius:radius];
- [bezier lineToPoint: NSMakePoint(NSMaxX(aRect),NSMaxY(aRect))];
-
-/*
- [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];
- if ([NSApp isActive]) {
- if ([cell state] == NSOnState) {
- [bezier linearGradientFillWithStartColor:[NSColor colorWithCalibratedWhite:0.99 alpha:1.0]
- endColor:[NSColor colorWithCalibratedWhite:0.941 alpha:1.0]];
- } else if ([cell isHighlighted]) {
- [bezier linearGradientFillWithStartColor:[NSColor colorWithCalibratedWhite:0.80 alpha:1.0]
- endColor:[NSColor colorWithCalibratedWhite:0.80 alpha:1.0]];
- } else {
- [bezier linearGradientFillWithStartColor:[NSColor colorWithCalibratedWhite:0.835 alpha:1.0]
- endColor:[NSColor colorWithCalibratedWhite:0.843 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, NSCompositeSourceAtop);
- }
-
- // 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 redColor] 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 redColor] 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 customControlView]];
-}
-
-
-- (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlView
-{
- NSRect cellFrame = [cell frame];
-
- BOOL showsBaselineSeparator = NO;
-/*
- NSToolbar *toolbar = [[[cell customControlView] window] toolbar];
- BOOL showsBaselineSeparator = (toolbar && [toolbar respondsToSelector:@selector(showsBaselineSeparator)] && [toolbar showsBaselineSeparator]);
-*/
- if (!showsBaselineSeparator) {
- cellFrame.origin.y += 3.0;
- cellFrame.size.height -= 3.0;
- }
-
- CGFloat 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 = [cell isEdited] ? unifiedCloseDirtyButton : unifiedCloseButton;
-
- if ([cell closeButtonOver]) closeButton = [cell isEdited] ? unifiedCloseDirtyButtonOver : unifiedCloseButtonOver;
- if ([cell closeButtonPressed]) closeButton = [cell isEdited] ? unifiedCloseDirtyButtonDown : unifiedCloseButtonDown;
-
- closeButtonSize = [closeButton size];
-
- [closeButton drawInRect:closeButtonRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0f respectFlipped:YES hints:nil];
-
- // scoot label over
- labelPosition += closeButtonSize.width + kPSMTabBarCellPadding;
- }
-
- // icon
- if ([cell hasIcon]) {
- NSRect iconRect = [self iconRectForTabCell:cell];
- NSImage *icon = [[[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.0f respectFlipped:YES hints:nil];
-
- // scoot label over
- labelPosition += iconRect.size.width + kPSMTabBarCellPadding;
- }
-
- // 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 + 1;
- labelRect.size.height = s.height;
-
- if (![[cell indicator] isHidden]) {
- labelRect.size.width -= (kPSMTabBarIndicatorWidth + kPSMTabBarCellPadding);
- }
-
- // object counter
- if ([cell count] > 0) {
- [[cell countColor] ?: [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];
-
- labelRect.size.width -= myRect.size.width + kPSMTabBarCellPadding;
- }
-
- // label
- [[cell attributedStringValue] drawInRect:labelRect];
-}
-
-- (void)drawBackgroundInRect:(NSRect)rect
-{
- //Draw for our whole bounds; it'll be automatically clipped to fit the appropriate drawing area
- rect = [tabBar bounds];
-
- NSRect gradientRect = rect;
- gradientRect.size.height -= 1.0;
-
- NSBezierPath *path = [NSBezierPath bezierPathWithRect:gradientRect];
- [path linearGradientFillWithStartColor:[NSColor colorWithCalibratedWhite:0.835 alpha:1.0]
- endColor:[NSColor colorWithCalibratedWhite:0.843 alpha:1.0]];
- [[NSColor colorWithCalibratedWhite:0.576 alpha:1.0] set];
-
-
- if (![[[tabBar tabView] window] isKeyWindow]) {
- [[NSColor windowBackgroundColor] set];
- NSRectFill(gradientRect);
- }
-}
-
-- (void)drawTabBar:(PSMTabBarControl *)bar inRect:(NSRect)rect
-{
- [NSGraphicsContext saveGraphicsState];
-
- // draw button separator
- for(PSMTabBarCell *cell in [bar cells])
- {
- if([cell state] == NSOnState)
- {
- [[NSColor colorWithCalibratedWhite:0.576 alpha:1.0] set];
-
- [NSBezierPath strokeLineFromPoint:NSMakePoint(rect.origin.x,NSMaxY(rect)-0.5)
- toPoint:NSMakePoint(NSMinX([cell frame]),NSMaxY(rect)-0.5)];
- [NSBezierPath strokeLineFromPoint:NSMakePoint(NSMaxX([cell frame]),NSMaxY(rect)-0.5)
- toPoint:NSMakePoint(NSMaxX(rect),NSMaxY(rect)-0.5)];
- }
- }
-
- tabBar = bar;
- [self drawBackgroundInRect:rect];
-
- // 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];
- NSMutableParagraphStyle *centeredParagraphStyle = nil;
- if (!centeredParagraphStyle) {
- centeredParagraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
- [centeredParagraphStyle setAlignment:NSCenterTextAlignment];
- }
- [attrStr addAttribute:NSParagraphStyleAttributeName value:centeredParagraphStyle range:range];
- [centeredParagraphStyle release];
- [attrStr drawInRect:labelRect];
-
- goto EXIT;
- }
-
- // draw cells
- NSEnumerator *e = [[bar cells] objectEnumerator];
- PSMTabBarCell *cell;
- while ( (cell = [e nextObject]) ) {
- if ([bar isAnimating] || (![cell isInOverflowMenu] && NSIntersectsRect([cell frame], rect))) {
- [cell drawWithFrame:[cell frame] inView:bar];
- }
- }
-
-EXIT:
- [NSGraphicsContext restoreGraphicsState];
-
-}
-
-#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:unifiedCloseDirtyButton forKey:@"unifiedCloseDirtyButton"];
- [aCoder encodeObject:unifiedCloseDirtyButtonDown forKey:@"unifiedCloseDirtyButtonDown"];
- [aCoder encodeObject:unifiedCloseDirtyButtonOver forKey:@"unifiedCloseDirtyButtonOver"];
- [aCoder encodeObject:_addTabButtonImage forKey:@"addTabButtonImage"];
- [aCoder encodeObject:_addTabButtonPressedImage forKey:@"addTabButtonPressedImage"];
- [aCoder encodeObject:_addTabButtonRolloverImage forKey:@"addTabButtonRolloverImage"];
- }
-*/
-}
-
-- (id)initWithCoder:(NSCoder *)aDecoder
-{
- self = [self init];
- if (self) {
- /*
- if ([aDecoder allowsKeyedCoding]) {
- unifiedCloseButton = [[aDecoder decodeObjectForKey:@"unifiedCloseButton"] retain];
- unifiedCloseButtonDown = [[aDecoder decodeObjectForKey:@"unifiedCloseButtonDown"] retain];
- unifiedCloseButtonOver = [[aDecoder decodeObjectForKey:@"unifiedCloseButtonOver"] retain];
- unifiedCloseDirtyButton = [[aDecoder decodeObjectForKey:@"unifiedCloseDirtyButton"] retain];
- unifiedCloseDirtyButtonDown = [[aDecoder decodeObjectForKey:@"unifiedCloseDirtyButtonDown"] retain];
- unifiedCloseDirtyButtonOver = [[aDecoder decodeObjectForKey:@"unifiedCloseDirtyButtonOver"] retain];
- _addTabButtonImage = [[aDecoder decodeObjectForKey:@"addTabButtonImage"] retain];
- _addTabButtonPressedImage = [[aDecoder decodeObjectForKey:@"addTabButtonPressedImage"] retain];
- _addTabButtonRolloverImage = [[aDecoder decodeObjectForKey:@"addTabButtonRolloverImage"] retain];
- }
- */
- }
- return self;
-}
-
-@end
diff --git a/Frameworks/PSMTabBar/Styles/PSMMetalTabStyle.h b/Frameworks/PSMTabBar/Styles/PSMMetalTabStyle.h
deleted file mode 100644
index 22cb7bc8..00000000
--- a/Frameworks/PSMTabBar/Styles/PSMMetalTabStyle.h
+++ /dev/null
@@ -1,34 +0,0 @@
-//
-// PSMMetalTabStyle.h
-// PSMTabBarControl
-//
-// Created by John Pannell on 2/17/06.
-// Copyright 2006 Positive Spin Media. All rights reserved.
-//
-
-#import <Cocoa/Cocoa.h>
-#import "PSMTabStyle.h"
-
-@interface PSMMetalTabStyle : NSObject <PSMTabStyle> {
- NSImage *metalCloseButton;
- NSImage *metalCloseButtonDown;
- NSImage *metalCloseButtonOver;
- NSImage *metalCloseDirtyButton;
- NSImage *metalCloseDirtyButtonDown;
- NSImage *metalCloseDirtyButtonOver;
- NSImage *_addTabButtonImage;
- NSImage *_addTabButtonPressedImage;
- NSImage *_addTabButtonRolloverImage;
-
- NSDictionary *_objectCountStringAttributes;
-
- PSMTabBarOrientation orientation;
- PSMTabBarControl *tabBar;
-}
-
-- (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlView;
-
-- (void)encodeWithCoder:(NSCoder *)aCoder;
-- (id)initWithCoder:(NSCoder *)aDecoder;
-
-@end
diff --git a/Frameworks/PSMTabBar/Styles/PSMMetalTabStyle.m b/Frameworks/PSMTabBar/Styles/PSMMetalTabStyle.m
deleted file mode 100644
index cdce6507..00000000
--- a/Frameworks/PSMTabBar/Styles/PSMMetalTabStyle.m
+++ /dev/null
@@ -1,654 +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
-
-@implementation PSMMetalTabStyle
-
-- (NSString *)name
-{
- return @"Metal";
-}
-
-#pragma mark -
-#pragma mark Creation/Destruction
-
-- (id) init
-{
- if ( (self = [super init]) ) {
- metalCloseButton = [[NSImage alloc] initByReferencingFile:[[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"]];
-
- metalCloseDirtyButton = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"TabClose_Dirty"]];
- metalCloseDirtyButtonDown = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"TabClose_Dirty_Pressed"]];
- metalCloseDirtyButtonOver = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"TabClose_Dirty_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"]];
-
- _objectCountStringAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:[[NSFontManager sharedFontManager] convertFont:[NSFont fontWithName:@"Helvetica" size:11.0] toHaveTrait:NSBoldFontMask], NSFontAttributeName,
- [[NSColor whiteColor] colorWithAlphaComponent:0.85], NSForegroundColorAttributeName,
- nil, nil];
- }
- return self;
-}
-
-- (void)dealloc
-{
- [metalCloseButton release];
- [metalCloseButtonDown release];
- [metalCloseButtonOver release];
- [metalCloseDirtyButton release];
- [metalCloseDirtyButtonDown release];
- [metalCloseDirtyButtonOver release];
- [_addTabButtonImage release];
- [_addTabButtonPressedImage release];
- [_addTabButtonRolloverImage release];
-
- [_objectCountStringAttributes release];
-
- [super dealloc];
-}
-
-#pragma mark -
-#pragma mark Control Specific
-
-- (CGFloat)leftMarginForTabBarControl
-{
- return 10.0f;
-}
-
-- (CGFloat)rightMarginForTabBarControl
-{
- return 24.0f;
-}
-
-- (CGFloat)topMarginForTabBarControl
-{
- return 10.0f;
-}
-
-- (void)setOrientation:(PSMTabBarOrientation)value
-{
- orientation = value;
-}
-
-#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)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 dragRect;
-}
-
-- (NSRect)closeButtonRectForTabCell:(PSMTabBarCell *)cell withFrame:(NSRect)cellFrame
-{
- 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;
- }
-
- CGFloat 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;
-}
-
-
-- (CGFloat)minimumWidthOfTabCell:(PSMTabBarCell *)cell
-{
- CGFloat 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);
-}
-
-- (CGFloat)desiredWidthOfTabCell:(PSMTabBarCell *)cell
-{
- CGFloat 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);
-}
-
-- (CGFloat)tabCellHeight
-{
- return kPSMTabBarControlHeight;
-}
-
-#pragma mark -
-#pragma mark Cell Values
-
-- (NSAttributedString *)attributedObjectCountValueForTabCell:(PSMTabBarCell *)cell
-{
- NSString *contents = [NSString stringWithFormat:@"%lu", (unsigned long)[cell count]];
- return [[[NSMutableAttributedString alloc] initWithString:contents attributes:_objectCountStringAttributes] autorelease];
-}
-
-- (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];
- CGFloat 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
- static NSMutableParagraphStyle *TruncatingTailParagraphStyle = nil;
- if (!TruncatingTailParagraphStyle) {
- TruncatingTailParagraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
- [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];
- NSColor *lineColor = nil;
- NSBezierPath *bezier = [NSBezierPath bezierPath];
- lineColor = [NSColor darkGrayColor];
-
- //disable antialiasing of bezier paths
- [NSGraphicsContext saveGraphicsState];
- [[NSGraphicsContext currentContext] setShouldAntialias:NO];
-
- if ([cell state] == NSOnState) {
- // selected tab
- if (orientation == PSMTabBarHorizontalOrientation) {
- NSRect aRect = NSMakeRect(cellFrame.origin.x, cellFrame.origin.y, cellFrame.size.width, cellFrame.size.height-2.5);
-
- // background
- aRect.origin.x += 1.0;
- aRect.size.width--;
- aRect.size.height -= 0.5;
- NSDrawWindowBackground(aRect);
- aRect.size.width++;
- aRect.size.height += 0.5;
-
- // frame
- aRect.origin.x -= 0.5;
- [lineColor set];
- [bezier setLineWidth:1.0];
- [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-2.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 customControlView] 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)];
- }
- } else {
- NSRect aRect = NSMakeRect(cellFrame.origin.x + 2, cellFrame.origin.y, cellFrame.size.width - 2, cellFrame.size.height);
-
- // background
- aRect.origin.x++;
- aRect.size.height--;
- NSDrawWindowBackground(aRect);
- aRect.origin.x--;
- aRect.size.height++;
-
- // frame
- [lineColor set];
- [bezier setLineWidth:1.0];
- [bezier moveToPoint:NSMakePoint(aRect.origin.x + aRect.size.width, aRect.origin.y)];
- [bezier lineToPoint:NSMakePoint(aRect.origin.x + 2, aRect.origin.y)];
- [bezier lineToPoint:NSMakePoint(aRect.origin.x + 0.5, aRect.origin.y + 2)];
- [bezier lineToPoint:NSMakePoint(aRect.origin.x + 0.5, aRect.origin.y + aRect.size.height - 3)];
- [bezier lineToPoint:NSMakePoint(aRect.origin.x + 3, aRect.origin.y + aRect.size.height)];
- [bezier lineToPoint:NSMakePoint(aRect.origin.x + aRect.size.width, aRect.origin.y + aRect.size.height)];
- }
-
- [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, NSCompositeSourceAtop);
- }
-
- [lineColor set];
-
- if (orientation == PSMTabBarHorizontalOrientation) {
- aRect.origin.x -= 1;
- aRect.size.width += 1;
-
- // frame
- [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)];
- }
- } else {
- if (!([cell tabState] & PSMTab_LeftIsSelectedMask)) {
- [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 moveToPoint: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 stroke];
- }
-
- [NSGraphicsContext restoreGraphicsState];
-
- [self drawInteriorWithTabCell:cell inView:[cell customControlView]];
-}
-
-
-- (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlView
-{
- NSRect cellFrame = [cell frame];
- CGFloat 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 = [cell isEdited] ? metalCloseDirtyButton : metalCloseButton;
- if ([cell closeButtonOver]) closeButton = [cell isEdited] ? metalCloseDirtyButtonOver : metalCloseButtonOver;
- if ([cell closeButtonPressed]) closeButton = [cell isEdited] ? metalCloseDirtyButtonDown : metalCloseButtonDown;
-
- closeButtonSize = [closeButton size];
-
- [closeButton drawInRect:closeButtonRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0f respectFlipped:YES hints:nil];
-
- // scoot label over
- labelPosition += closeButtonSize.width + kPSMTabBarCellPadding;
- }
-
- // icon
- if ([cell hasIcon]) {
- NSRect iconRect = [self iconRectForTabCell:cell];
- NSImage *icon = [[[cell representedObject] identifier] icon];
-
- if ([controlView isFlipped]) {
- iconRect.origin.y += iconRect.size.height;
- }
-
- // 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.0f respectFlipped:YES hints:nil];
-
- // scoot label over
- labelPosition += iconRect.size.width + kPSMTabBarCellPadding;
- }
-
- // 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);
- }
-
- // object counter
- if ([cell count] > 0) {
- [[cell countColor] ?: [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];
-
- // shrink label width to make room for object counter
- labelRect.size.width -= myRect.size.width + kPSMTabBarCellPadding;
- }
-
- // draw label
- [[cell attributedStringValue] drawInRect:labelRect];
-}
-
-- (void)drawBackgroundInRect:(NSRect)rect
-{
- //Draw for our whole bounds; it'll be automatically clipped to fit the appropriate drawing area
- rect = [tabBar bounds];
-
- if (orientation == PSMTabBarVerticalOrientation && [tabBar frame].size.width < 2) {
- return;
- }
-
- [NSGraphicsContext saveGraphicsState];
- [[NSGraphicsContext currentContext] setShouldAntialias:NO];
-
- [[NSColor colorWithCalibratedWhite:0.0 alpha:0.2] set];
- NSRectFillUsingOperation(rect, NSCompositeSourceAtop);
- [[NSColor darkGrayColor] set];
-
- if (orientation == PSMTabBarHorizontalOrientation) {
- [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)];
- } 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];
-}
-
-- (void)drawTabBar:(PSMTabBarControl *)bar inRect:(NSRect)rect
-{
- if (orientation != [bar orientation]) {
- orientation = [bar orientation];
- }
-
- if (tabBar != bar) {
- tabBar = bar;
- }
-
- [self drawBackgroundInRect:rect];
-
- // 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];
- NSMutableParagraphStyle *centeredParagraphStyle = nil;
- if (!centeredParagraphStyle) {
- centeredParagraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
- [centeredParagraphStyle setAlignment:NSCenterTextAlignment];
- }
- [attrStr addAttribute:NSParagraphStyleAttributeName value:centeredParagraphStyle range:range];
- [centeredParagraphStyle release];
- [attrStr drawInRect:labelRect];
- return;
- }
-
- // draw cells
- NSEnumerator *e = [[bar cells] objectEnumerator];
- PSMTabBarCell *cell;
- while ( (cell = [e nextObject]) ) {
- if ([bar isAnimating] || (![cell isInOverflowMenu] && NSIntersectsRect([cell frame], rect))) {
- [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:metalCloseDirtyButton forKey:@"metalCloseDirtyButton"];
- [aCoder encodeObject:metalCloseDirtyButtonDown forKey:@"metalCloseDirtyButtonDown"];
- [aCoder encodeObject:metalCloseDirtyButtonOver forKey:@"metalCloseDirtyButtonOver"];
- [aCoder encodeObject:_addTabButtonImage forKey:@"addTabButtonImage"];
- [aCoder encodeObject:_addTabButtonPressedImage forKey:@"addTabButtonPressedImage"];
- [aCoder encodeObject:_addTabButtonRolloverImage forKey:@"addTabButtonRolloverImage"];
- }
-*/
-}
-
-- (id)initWithCoder:(NSCoder *)aDecoder
-{
- self = [self init];
- if (self) {
-
-/*
- if ([aDecoder allowsKeyedCoding]) {
- metalCloseButton = [[aDecoder decodeObjectForKey:@"metalCloseButton"] retain];
- metalCloseButtonDown = [[aDecoder decodeObjectForKey:@"metalCloseButtonDown"] retain];
- metalCloseButtonOver = [[aDecoder decodeObjectForKey:@"metalCloseButtonOver"] retain];
- metalCloseDirtyButton = [[aDecoder decodeObjectForKey:@"metalCloseDirtyButton"] retain];
- metalCloseDirtyButtonDown = [[aDecoder decodeObjectForKey:@"metalCloseDirtyButtonDown"] retain];
- metalCloseDirtyButtonOver = [[aDecoder decodeObjectForKey:@"metalCloseDirtyButtonOver"] retain];
- _addTabButtonImage = [[aDecoder decodeObjectForKey:@"addTabButtonImage"] retain];
- _addTabButtonPressedImage = [[aDecoder decodeObjectForKey:@"addTabButtonPressedImage"] retain];
- _addTabButtonRolloverImage = [[aDecoder decodeObjectForKey:@"addTabButtonRolloverImage"] retain];
- }
-*/
- }
- return self;
-}
-
-@end
diff --git a/Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.h b/Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.h
index d6f541a5..2e82845e 100644
--- a/Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.h
+++ b/Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.h
@@ -25,7 +25,8 @@
#import <Cocoa/Cocoa.h>
#import "PSMTabStyle.h"
-@interface PSMSequelProTabStyle : NSObject <PSMTabStyle> {
+@interface PSMSequelProTabStyle : NSObject <PSMTabStyle>
+{
BOOL systemVersionIsAtLeast10_7_0;
BOOL systemVersionIsAtLeast10_10_0;
@@ -45,7 +46,7 @@
PSMTabBarControl *tabBar;
}
-- (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlView;
+- (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView *)controlView;
- (void)encodeWithCoder:(NSCoder *)aCoder;
- (id)initWithCoder:(NSCoder *)aDecoder;
diff --git a/Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m b/Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m
index 4329032b..30501bb8 100644
--- a/Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m
+++ b/Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m
@@ -1,6 +1,4 @@
//
-// $Id: PSMSequelProTabStyle.m 2317 2010-06-15 10:19:41Z avenjamin $
-//
// PSMSequelProTabStyle.m
// sequel-pro
//
@@ -31,10 +29,9 @@
#define kPSMSequelProObjectCounterRadius 7.0f
#define kPSMSequelProCounterMinWidth 20
#define kPSMSequelProTabCornerRadius 0
-#define MARGIN_X 6
#ifndef __MAC_10_10
-#define __MAC_10_10 101000
+#define __MAC_10_10 101000
#endif
#if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_10
@@ -46,12 +43,20 @@ typedef struct {
} NSOperatingSystemVersion;
@interface NSProcessInfo ()
+
- (NSOperatingSystemVersion)operatingSystemVersion;
- (BOOL)isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion)version;
-@end
+@end
#endif
+@interface PSMSequelProTabStyle ()
+
+- (NSColor *)_lineColorForTabCellDrawing;
+- (void)_drawTabCell:(PSMTabBarCell *)cell withBackgroundColor:(NSColor *)backgroundColor lineColor:(NSColor *)lineColor;
+
+@end
+
@implementation PSMSequelProTabStyle
- (NSString *)name
@@ -69,9 +74,11 @@ typedef struct {
// This code actually belongs in it's own class, but since both PSMTabBar.framework
// and SP itself would need it, the loader will complain about a duplicate class implementation.
NSProcessInfo *procInfo = [NSProcessInfo processInfo];
- if([procInfo respondsToSelector:@selector(isOperatingSystemAtLeastVersion:)]) {
+
+ if ([procInfo respondsToSelector:@selector(isOperatingSystemAtLeastVersion:)]) {
NSOperatingSystemVersion os10_7_0 = {10,7,0};
NSOperatingSystemVersion os10_10_0 = {10,10,0};
+
systemVersionIsAtLeast10_7_0 = [procInfo isOperatingSystemAtLeastVersion:os10_7_0];
systemVersionIsAtLeast10_10_0 = [procInfo isOperatingSystemAtLeastVersion:os10_10_0];
}
@@ -85,21 +92,23 @@ typedef struct {
systemVersionIsAtLeast10_10_0 = (versionMajor > 10 || (versionMajor == 10 && versionMinor >= 10));
}
- sequelProCloseButton = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"SequelProTabClose"]];
- sequelProCloseButtonDown = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"SequelProTabClose_Pressed"]];
- sequelProCloseButtonOver = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"SequelProTabClose_Rollover"]];
+ NSBundle *bundle = [PSMTabBarControl bundle];
+
+ sequelProCloseButton = [[NSImage alloc] initByReferencingFile:[bundle pathForImageResource:@"SequelProTabClose"]];
+ sequelProCloseButtonDown = [[NSImage alloc] initByReferencingFile:[bundle pathForImageResource:@"SequelProTabClose_Pressed"]];
+ sequelProCloseButtonOver = [[NSImage alloc] initByReferencingFile:[bundle pathForImageResource:@"SequelProTabClose_Rollover"]];
- sequelProCloseDirtyButton = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"SequelProTabDirty"]];
- sequelProCloseDirtyButtonDown = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"SequelProTabDirty_Pressed"]];
- sequelProCloseDirtyButtonOver = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"SequelProTabDirty_Rollover"]];
+ sequelProCloseDirtyButton = [[NSImage alloc] initByReferencingFile:[bundle pathForImageResource:@"SequelProTabDirty"]];
+ sequelProCloseDirtyButtonDown = [[NSImage alloc] initByReferencingFile:[bundle pathForImageResource:@"SequelProTabDirty_Pressed"]];
+ sequelProCloseDirtyButtonOver = [[NSImage alloc] initByReferencingFile:[bundle pathForImageResource:@"SequelProTabDirty_Rollover"]];
- _addTabButtonImage = [[NSImage alloc] initByReferencingFile:[[NSBundle mainBundle] pathForImageResource:@"button_add"]];
- _addTabButtonPressedImage = [[NSImage alloc] initByReferencingFile:[[NSBundle mainBundle] pathForImageResource:@"button_add"]];
- _addTabButtonRolloverImage = [[NSImage alloc] initByReferencingFile:[[NSBundle mainBundle] pathForImageResource:@"button_add"]];
+ _addTabButtonImage = [[NSImage alloc] initByReferencingFile:[bundle pathForImageResource:@"AddTabButton"]];
+ _addTabButtonPressedImage = [[NSImage alloc] initByReferencingFile:[bundle pathForImageResource:@"AddTabButton"]];
+ _addTabButtonRolloverImage = [[NSImage alloc] initByReferencingFile:[bundle pathForImageResource:@"AddTabButton"]];
- _objectCountStringAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:[[NSFontManager sharedFontManager] convertFont:[NSFont fontWithName:@"Helvetica" size:11.0f] toHaveTrait:NSBoldFontMask], NSFontAttributeName,
- [[NSColor whiteColor] colorWithAlphaComponent:0.85f], NSForegroundColorAttributeName,
- nil, nil];
+ _objectCountStringAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
+ [[NSFontManager sharedFontManager] convertFont:[NSFont fontWithName:@"Helvetica" size:11.0f] toHaveTrait:NSBoldFontMask], NSFontAttributeName,
+ [[NSColor whiteColor] colorWithAlphaComponent:0.85f], NSForegroundColorAttributeName, nil, nil];
}
return self;
}
@@ -371,7 +380,6 @@ typedef struct {
[textShadow setShadowColor:[NSColor colorWithCalibratedWhite:1.0f alpha:shadowAlpha]];
[textShadow setShadowOffset:NSMakeSize(0, -1)];
[textShadow setShadowBlurRadius:1.0f];
-// [attrStr addAttribute:NSShadowAttributeName value:textShadow range:range];
// Paragraph Style for Truncating Long Text
static NSMutableParagraphStyle *TruncatingTailParagraphStyle = nil;
@@ -433,23 +441,22 @@ typedef struct {
}
}
-
// Step 2
- (void)drawBackgroundInRect:(NSRect)rect
{
- //Draw for our whole bounds; it'll be automatically clipped to fit the appropriate drawing area
+ // Draw for our whole bounds; it'll be automatically clipped to fit the appropriate drawing area
rect = [tabBar bounds];
- // find active cell
+ // Find active cell
PSMTabBarCell *selectedCell = nil;
+
for (PSMTabBarCell *aCell in [tabBar cells]) {
if (aCell.tabState & PSMTab_SelectedMask) {
selectedCell = aCell;
break;
}
}
-
-
+
[NSGraphicsContext saveGraphicsState];
[[NSGraphicsContext currentContext] setShouldAntialias:NO];
@@ -465,22 +472,14 @@ typedef struct {
shadowAlpha = 0.3f;
}
- // fill in background of tab bar
+ // Fill in background of tab bar
[[NSColor colorWithCalibratedWhite:backgroundCalibratedWhite alpha:1.0f] set];
- NSRectFill(NSMakeRect(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height - 10));
-
-
- // fill active tab strip
- [[self fillColorForCell:selectedCell] set];
- NSRectFill(NSMakeRect(rect.origin.x, rect.origin.y + rect.size.height - 9, rect.size.width, 8));
+ NSRectFill(NSMakeRect(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height));
// Draw horizontal line across the top edge
[[NSColor colorWithCalibratedWhite:lineCalibratedWhite alpha:1.0f] set];
[NSBezierPath strokeLineFromPoint:NSMakePoint(rect.origin.x, rect.origin.y + 0.5f) toPoint:NSMakePoint(rect.origin.x + rect.size.width, rect.origin.y + 0.5f)];
- // Draw horizontal line across the baseline for each tab
- [NSBezierPath strokeLineFromPoint:NSMakePoint(rect.origin.x, rect.origin.y + rect.size.height - 9.5f) toPoint:NSMakePoint(rect.origin.x + rect.size.width, rect.origin.y + rect.size.height - 9.5f)];
-
// Draw horizontal line across the bottom edge
[NSBezierPath strokeLineFromPoint:NSMakePoint(rect.origin.x, rect.origin.y + rect.size.height - 0.5f) toPoint:NSMakePoint(rect.origin.x + rect.size.width, rect.origin.y + rect.size.height - 0.5f)];
@@ -490,51 +489,27 @@ typedef struct {
// Step 3
- (void)drawTabCell:(PSMTabBarCell *)cell
{
- // don't draw cells when collapsed
- if (tabBar.isTabBarHidden) {
- return;
- }
-
- NSRect cellFrame = cell.frame;
- NSColor *lineColor = nil;
+ // Don't draw cells when collapsed
+ if ([tabBar isTabBarHidden]) return;
+
+ NSColor *lineColor = [self _lineColorForTabCellDrawing];
NSColor *fillColor = [self fillColorForCell:cell];
- // Set up colours
- if (([[tabBar window] isMainWindow] || [[[tabBar window] attachedSheet] isMainWindow]) && [NSApp isActive]) {
- lineColor = [NSColor grayColor];
-
- } else {
- lineColor = [NSColor colorWithCalibratedWhite:0.49f alpha:1.0f];
-
- }
-
- // setup fill rect
- NSRect fillRect = NSMakeRect(cellFrame.origin.x, cellFrame.origin.y + 1, cellFrame.size.width, cellFrame.size.height - 10);
-
+ [self _drawTabCell:cell withBackgroundColor:fillColor lineColor:lineColor];
- // draw
- [NSGraphicsContext saveGraphicsState];
+ [self drawInteriorWithTabCell:cell inView:[cell customControlView]];
+}
- [fillColor set];
- NSRectFill(fillRect);
-
- // stroke left edge
- [lineColor setStroke];
- NSPoint point1 = NSMakePoint(fillRect.origin.x + fillRect.size.width - 0.5, fillRect.origin.y);
- NSPoint point2 = NSMakePoint(fillRect.origin.x + fillRect.size.width - 0.5, fillRect.origin.y + fillRect.size.height);
- [NSBezierPath strokeLineFromPoint:point1 toPoint:point2];
-
- // stroke bottom edge unless active cell
- if (cell.state != NSOnState) {
- point1 = NSMakePoint(fillRect.origin.x, fillRect.origin.y + fillRect.size.height - 0.5);
- point2 = NSMakePoint(fillRect.origin.x + fillRect.size.width, fillRect.origin.y + fillRect.size.height - 0.5);
- [NSBezierPath strokeLineFromPoint:point1 toPoint:point2];
- }
+/**
+ * Same as above, but doesn't draw the left hand (right had of the actual tab) border for the tab drag image.
+ */
+- (void)drawTabCellForDragImage:(PSMTabBarCell *)cell
+{
+ NSColor *fillColor = [self fillColorForCell:cell];
- [NSGraphicsContext restoreGraphicsState];
-
- [self drawInteriorWithTabCell:cell inView:[cell customControlView]];
+ [self _drawTabCell:cell withBackgroundColor:fillColor lineColor:nil];
+ [self drawInteriorWithTabCell:cell inView:[cell customControlView]];
}
// Step 4
@@ -547,13 +522,21 @@ typedef struct {
if ([cell hasCloseButton] && ![cell isCloseButtonSuppressed] && [cell isHighlighted]) {
NSRect closeButtonRect = [cell closeButtonRectForFrame:cellFrame];
- NSImage * closeButton = nil;
+ NSImage *closeButton = nil;
closeButton = [cell isEdited] ? sequelProCloseDirtyButton : sequelProCloseButton;
if ([cell closeButtonOver]) closeButton = [cell isEdited] ? sequelProCloseDirtyButtonOver : sequelProCloseButtonOver;
if ([cell closeButtonPressed]) closeButton = [cell isEdited] ? sequelProCloseDirtyButtonDown : sequelProCloseButtonDown;
+ // Slightly darken background tabs on mouse over
+ if ([cell state] == NSOffState) {
+ NSColor *lineColor = [self _lineColorForTabCellDrawing];
+ NSColor *fillColor = [[self fillColorForCell:cell] shadowWithLevel:0.03f];
+
+ [self _drawTabCell:cell withBackgroundColor:fillColor lineColor:lineColor];
+ }
+
[closeButton drawInRect:closeButtonRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0f respectFlipped:YES hints:nil];
}
@@ -677,42 +660,55 @@ typedef struct {
- (void)encodeWithCoder:(NSCoder *)aCoder
{
- //[super encodeWithCoder:aCoder];
-/*
- if ([aCoder allowsKeyedCoding]) {
- [aCoder encodeObject:sequelProCloseButton forKey:@"sequelProCloseButton"];
- [aCoder encodeObject:sequelProCloseButtonDown forKey:@"sequelProCloseButtonDown"];
- [aCoder encodeObject:sequelProCloseButtonOver forKey:@"sequelProCloseButtonOver"];
- [aCoder encodeObject:sequelProCloseDirtyButton forKey:@"sequelProCloseDirtyButton"];
- [aCoder encodeObject:sequelProCloseDirtyButtonDown forKey:@"sequelProCloseDirtyButtonDown"];
- [aCoder encodeObject:sequelProCloseDirtyButtonOver forKey:@"sequelProCloseDirtyButtonOver"];
- [aCoder encodeObject:_addTabButtonImage forKey:@"addTabButtonImage"];
- [aCoder encodeObject:_addTabButtonPressedImage forKey:@"addTabButtonPressedImage"];
- [aCoder encodeObject:_addTabButtonRolloverImage forKey:@"addTabButtonRolloverImage"];
- }
-*/
}
- (id)initWithCoder:(NSCoder *)aDecoder
{
- self = [self init];
- if (self) {
-
-/*
- if ([aDecoder allowsKeyedCoding]) {
- sequelProCloseButton = [[aDecoder decodeObjectForKey:@"sequelProCloseButton"] retain];
- sequelProCloseButtonDown = [[aDecoder decodeObjectForKey:@"sequelProCloseButtonDown"] retain];
- sequelProCloseButtonOver = [[aDecoder decodeObjectForKey:@"sequelProCloseButtonOver"] retain];
- sequelProCloseDirtyButton = [[aDecoder decodeObjectForKey:@"sequelProCloseDirtyButton"] retain];
- sequelProCloseDirtyButtonDown = [[aDecoder decodeObjectForKey:@"sequelProCloseDirtyButtonDown"] retain];
- sequelProCloseDirtyButtonOver = [[aDecoder decodeObjectForKey:@"sequelProCloseDirtyButtonOver"] retain];
- _addTabButtonImage = [[aDecoder decodeObjectForKey:@"addTabButtonImage"] retain];
- _addTabButtonPressedImage = [[aDecoder decodeObjectForKey:@"addTabButtonPressedImage"] retain];
- _addTabButtonRolloverImage = [[aDecoder decodeObjectForKey:@"addTabButtonRolloverImage"] retain];
- }
-*/
- }
- return self;
+ return [self init];
+}
+
+#pragma mark -
+#pragma mark Private API
+
+- (void)_drawTabCell:(PSMTabBarCell *)cell withBackgroundColor:(NSColor *)backgroundColor lineColor:(NSColor *)lineColor
+{
+ NSRect cellFrame = [cell frame];
+
+ // Setup fill rect
+ NSRect fillRect = NSMakeRect(cellFrame.origin.x, cellFrame.origin.y + 1, cellFrame.size.width, cellFrame.size.height - 1.5);
+
+ // Draw
+ [NSGraphicsContext saveGraphicsState];
+
+ [backgroundColor set];
+ NSRectFill(fillRect);
+
+ if (lineColor) {
+
+ // Stroke left edge
+ [lineColor setStroke];
+
+ NSPoint point1 = NSMakePoint(fillRect.origin.x + fillRect.size.width - 0.5, fillRect.origin.y);
+ NSPoint point2 = NSMakePoint(fillRect.origin.x + fillRect.size.width - 0.5, fillRect.origin.y + fillRect.size.height);
+
+ [NSBezierPath strokeLineFromPoint:point1 toPoint:point2];
+ }
+
+ [NSGraphicsContext restoreGraphicsState];
+}
+
+- (NSColor *)_lineColorForTabCellDrawing
+{
+ NSColor *lineColor = nil;
+
+ if (([[tabBar window] isMainWindow] || [[[tabBar window] attachedSheet] isMainWindow]) && [NSApp isActive]) {
+ lineColor = [NSColor grayColor];
+ }
+ else {
+ lineColor = [NSColor colorWithCalibratedWhite:0.49f alpha:1.0f];
+ }
+
+ return lineColor;
}
@end
diff --git a/Frameworks/PSMTabBar/Styles/PSMUnifiedTabStyle.h b/Frameworks/PSMTabBar/Styles/PSMUnifiedTabStyle.h
deleted file mode 100644
index d44bbcdc..00000000
--- a/Frameworks/PSMTabBar/Styles/PSMUnifiedTabStyle.h
+++ /dev/null
@@ -1,30 +0,0 @@
-//
-// PSMUnifiedTabStyle.h
-// --------------------
-//
-// Created by Keith Blount on 30/04/2006.
-// Copyright 2006 __MyCompanyName__. All rights reserved.
-//
-
-#import <Cocoa/Cocoa.h>
-#import "PSMTabStyle.h"
-
-@interface PSMUnifiedTabStyle : NSObject <PSMTabStyle>
-{
- NSImage *unifiedCloseButton;
- NSImage *unifiedCloseButtonDown;
- NSImage *unifiedCloseButtonOver;
- NSImage *unifiedCloseDirtyButton;
- NSImage *unifiedCloseDirtyButtonDown;
- NSImage *unifiedCloseDirtyButtonOver;
- NSImage *_addTabButtonImage;
- NSImage *_addTabButtonPressedImage;
- NSImage *_addTabButtonRolloverImage;
-
- NSDictionary *_objectCountStringAttributes;
-
- CGFloat leftMargin;
- PSMTabBarControl *tabBar;
-}
-- (void)setLeftMarginForTabBarControl:(CGFloat)margin;
-@end
diff --git a/Frameworks/PSMTabBar/Styles/PSMUnifiedTabStyle.m b/Frameworks/PSMTabBar/Styles/PSMUnifiedTabStyle.m
deleted file mode 100644
index 882c1741..00000000
--- a/Frameworks/PSMTabBar/Styles/PSMUnifiedTabStyle.m
+++ /dev/null
@@ -1,598 +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"]];
-
- unifiedCloseDirtyButton = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabCloseDirty_Front"]];
- unifiedCloseDirtyButtonDown = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabCloseDirty_Front_Pressed"]];
- unifiedCloseDirtyButtonOver = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabCloseDirty_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"]];
-
- _objectCountStringAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:[[NSFontManager sharedFontManager] convertFont:[NSFont fontWithName:@"Helvetica" size:11.0] toHaveTrait:NSBoldFontMask], NSFontAttributeName,
- [[NSColor whiteColor] colorWithAlphaComponent:0.85], NSForegroundColorAttributeName,
- nil, nil];
-
- leftMargin = 5.0;
- }
- return self;
-}
-
-- (void)dealloc
-{
- [unifiedCloseButton release];
- [unifiedCloseButtonDown release];
- [unifiedCloseButtonOver release];
- [unifiedCloseDirtyButton release];
- [unifiedCloseDirtyButtonDown release];
- [unifiedCloseDirtyButtonOver release];
- [_addTabButtonImage release];
- [_addTabButtonPressedImage release];
- [_addTabButtonRolloverImage release];
-
- [_objectCountStringAttributes release];
-
- [super dealloc];
-}
-
-#pragma mark -
-#pragma mark Control Specific
-
-- (void)setLeftMarginForTabBarControl:(CGFloat)margin
-{
- leftMargin = margin;
-}
-
-- (CGFloat)leftMarginForTabBarControl
-{
- return leftMargin;
-}
-
-- (CGFloat)rightMarginForTabBarControl
-{
- return 24.0f;
-}
-
-- (CGFloat)topMarginForTabBarControl
-{
- return 10.0f;
-}
-
-- (void)setOrientation:(PSMTabBarOrientation)value
-{
-
-}
-
-#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)dragRectForTabCell:(PSMTabBarCell *)cell orientation:(PSMTabBarOrientation)orientation
-{
- NSRect dragRect = [cell frame];
- dragRect.size.width++;
- return dragRect;
-}
-
-- (NSRect)closeButtonRectForTabCell:(PSMTabBarCell *)cell withFrame:(NSRect)cellFrame
-{
- 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;
- }
-
- CGFloat 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;
-}
-
-
-- (CGFloat)minimumWidthOfTabCell:(PSMTabBarCell *)cell
-{
- CGFloat 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);
-}
-
-- (CGFloat)desiredWidthOfTabCell:(PSMTabBarCell *)cell
-{
- CGFloat 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);
-}
-
-- (CGFloat)tabCellHeight
-{
- return kPSMTabBarControlHeight;
-}
-
-#pragma mark -
-#pragma mark Cell Values
-
-- (NSAttributedString *)attributedObjectCountValueForTabCell:(PSMTabBarCell *)cell
-{
- NSString *contents = [NSString stringWithFormat:@"%lu", (unsigned long)[cell count]];
- return [[[NSMutableAttributedString alloc] initWithString:contents attributes:_objectCountStringAttributes] autorelease];
-}
-
-- (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
- static NSMutableParagraphStyle *TruncatingTailParagraphStyle = nil;
- if (!TruncatingTailParagraphStyle) {
- TruncatingTailParagraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
- [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];
-
- NSToolbar *toolbar = [[[cell customControlView] window] toolbar];
- BOOL showsBaselineSeparator = (toolbar && [toolbar respondsToSelector:@selector(showsBaselineSeparator)] && [toolbar showsBaselineSeparator]);
- if (!showsBaselineSeparator) {
- cellFrame.origin.y += 1.0;
- cellFrame.size.height -= 1.0;
- }
-
- NSColor * lineColor = nil;
- NSBezierPath* bezier = [NSBezierPath bezierPath];
- lineColor = [NSColor colorWithCalibratedWhite:0.576 alpha:1.0];
-
- if (!showsBaselineSeparator || [cell state] == NSOnState)
- {
- // selected tab
- NSRect aRect = NSMakeRect(cellFrame.origin.x+0.5, cellFrame.origin.y-0.5, cellFrame.size.width, cellFrame.size.height);
-
- // frame
- CGFloat 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];
- if ([NSApp isActive]) {
- if ([cell state] == NSOnState) {
- [bezier linearGradientFillWithStartColor:[NSColor colorWithCalibratedWhite:0.99 alpha:1.0]
- endColor:[NSColor colorWithCalibratedWhite:0.941 alpha:1.0]];
- } else if ([cell isHighlighted]) {
- [bezier linearGradientFillWithStartColor:[NSColor colorWithCalibratedWhite:0.80 alpha:1.0]
- endColor:[NSColor colorWithCalibratedWhite:0.80 alpha:1.0]];
- } else {
- [bezier linearGradientFillWithStartColor:[NSColor colorWithCalibratedWhite:0.835 alpha:1.0]
- endColor:[NSColor colorWithCalibratedWhite:0.843 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, NSCompositeSourceAtop);
- }
-
- // 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 customControlView]];
-}
-
-
-- (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlView
-{
- NSRect cellFrame = [cell frame];
- CGFloat 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 = [cell isEdited] ? unifiedCloseDirtyButton : unifiedCloseButton;
-
- if ([cell closeButtonOver]) closeButton = [cell isEdited] ? unifiedCloseDirtyButtonOver : unifiedCloseButtonOver;
- if ([cell closeButtonPressed]) closeButton = [cell isEdited] ? unifiedCloseDirtyButtonDown : unifiedCloseButtonDown;
-
- closeButtonSize = [closeButton size];
-
- [closeButton drawInRect:closeButtonRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0f respectFlipped:YES hints:nil];
-
- // scoot label over
- labelPosition += closeButtonSize.width + kPSMTabBarCellPadding;
- }
-
- // icon
- if ([cell hasIcon]) {
- NSRect iconRect = [self iconRectForTabCell:cell];
- NSImage *icon = [[[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.0f respectFlipped:YES hints:nil];
-
- // scoot label over
- labelPosition += iconRect.size.width + kPSMTabBarCellPadding;
- }
-
- // 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);
- }
-
- // object counter
- if ([cell count] > 0) {
- [[cell countColor] ?: [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];
-
- labelRect.size.width -= myRect.size.width + kPSMTabBarCellPadding;
- }
-
- // label
- [[cell attributedStringValue] drawInRect:labelRect];
-}
-
-- (void)drawBackgroundInRect:(NSRect)rect
-{
- //Draw for our whole bounds; it'll be automatically clipped to fit the appropriate drawing area
- rect = [tabBar bounds];
-
- NSRect gradientRect = rect;
- gradientRect.size.height -= 1.0;
-
- NSBezierPath *path = [NSBezierPath bezierPathWithRect:gradientRect];
- [path linearGradientFillWithStartColor:[NSColor colorWithCalibratedWhite:0.835 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)];
-
- if (![[[tabBar tabView] window] isKeyWindow]) {
- [[NSColor windowBackgroundColor] set];
- NSRectFill(gradientRect);
- }
-}
-
-- (void)drawTabBar:(PSMTabBarControl *)bar inRect:(NSRect)rect
-{
- tabBar = bar;
- [self drawBackgroundInRect:rect];
-
- // 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];
- NSMutableParagraphStyle *centeredParagraphStyle = nil;
- if (!centeredParagraphStyle) {
- centeredParagraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
- [centeredParagraphStyle setAlignment:NSCenterTextAlignment];
- }
- [attrStr addAttribute:NSParagraphStyleAttributeName value:centeredParagraphStyle range:range];
- [centeredParagraphStyle release];
- [attrStr drawInRect:labelRect];
- return;
- }
-
- // draw cells
- NSEnumerator *e = [[bar cells] objectEnumerator];
- PSMTabBarCell *cell;
- while ( (cell = [e nextObject]) ) {
- if ([bar isAnimating] || (![cell isInOverflowMenu] && NSIntersectsRect([cell frame], rect))) {
- [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:unifiedCloseDirtyButton forKey:@"unifiedCloseDirtyButton"];
- [aCoder encodeObject:unifiedCloseDirtyButtonDown forKey:@"unifiedCloseDirtyButtonDown"];
- [aCoder encodeObject:unifiedCloseDirtyButtonOver forKey:@"unifiedCloseDirtyButtonOver"];
- [aCoder encodeObject:_addTabButtonImage forKey:@"addTabButtonImage"];
- [aCoder encodeObject:_addTabButtonPressedImage forKey:@"addTabButtonPressedImage"];
- [aCoder encodeObject:_addTabButtonRolloverImage forKey:@"addTabButtonRolloverImage"];
- }
-*/
-}
-
-- (id)initWithCoder:(NSCoder *)aDecoder
-{
- self = [self init];
- if (self) {
- /*
- if ([aDecoder allowsKeyedCoding]) {
- unifiedCloseButton = [[aDecoder decodeObjectForKey:@"unifiedCloseButton"] retain];
- unifiedCloseButtonDown = [[aDecoder decodeObjectForKey:@"unifiedCloseButtonDown"] retain];
- unifiedCloseButtonOver = [[aDecoder decodeObjectForKey:@"unifiedCloseButtonOver"] retain];
- unifiedCloseDirtyButton = [[aDecoder decodeObjectForKey:@"unifiedCloseDirtyButton"] retain];
- unifiedCloseDirtyButtonDown = [[aDecoder decodeObjectForKey:@"unifiedCloseDirtyButtonDown"] retain];
- unifiedCloseDirtyButtonOver = [[aDecoder decodeObjectForKey:@"unifiedCloseDirtyButtonOver"] retain];
- _addTabButtonImage = [[aDecoder decodeObjectForKey:@"addTabButtonImage"] retain];
- _addTabButtonPressedImage = [[aDecoder decodeObjectForKey:@"addTabButtonPressedImage"] retain];
- _addTabButtonRolloverImage = [[aDecoder decodeObjectForKey:@"addTabButtonRolloverImage"] retain];
- }
- */
- }
- return self;
-}
-
-@end