diff options
24 files changed, 215 insertions, 695 deletions
diff --git a/Artwork/Tab Bar.sketch b/Artwork/Tab Bar.sketch Binary files differnew file mode 100644 index 00000000..11e4c1de --- /dev/null +++ b/Artwork/Tab Bar.sketch diff --git a/Frameworks/PSMTabBar/Images/AddTabButton.png b/Frameworks/PSMTabBar/Images/AddTabButton.png Binary files differindex 3818b106..ee762312 100644 --- a/Frameworks/PSMTabBar/Images/AddTabButton.png +++ b/Frameworks/PSMTabBar/Images/AddTabButton.png diff --git a/Frameworks/PSMTabBar/Images/AddTabButtonPushed.png b/Frameworks/PSMTabBar/Images/AddTabButtonPushed.png Binary files differindex d78febb1..633d0d51 100644 --- a/Frameworks/PSMTabBar/Images/AddTabButtonPushed.png +++ b/Frameworks/PSMTabBar/Images/AddTabButtonPushed.png diff --git a/Frameworks/PSMTabBar/Images/AddTabButtonRollover.png b/Frameworks/PSMTabBar/Images/AddTabButtonRollover.png Binary files differindex ced6a993..633d0d51 100644 --- a/Frameworks/PSMTabBar/Images/AddTabButtonRollover.png +++ b/Frameworks/PSMTabBar/Images/AddTabButtonRollover.png diff --git a/Frameworks/PSMTabBar/Images/SequelProTabClose.png b/Frameworks/PSMTabBar/Images/SequelProTabClose.png Binary files differindex 1b68f75f..355fffcb 100644 --- a/Frameworks/PSMTabBar/Images/SequelProTabClose.png +++ b/Frameworks/PSMTabBar/Images/SequelProTabClose.png diff --git a/Frameworks/PSMTabBar/Images/SequelProTabClose@2x.png b/Frameworks/PSMTabBar/Images/SequelProTabClose@2x.png Binary files differindex da429832..7e5d610f 100644 --- a/Frameworks/PSMTabBar/Images/SequelProTabClose@2x.png +++ b/Frameworks/PSMTabBar/Images/SequelProTabClose@2x.png diff --git a/Frameworks/PSMTabBar/Images/SequelProTabClose_Pressed.png b/Frameworks/PSMTabBar/Images/SequelProTabClose_Pressed.png Binary files differindex 520cfb0b..0303b744 100644 --- a/Frameworks/PSMTabBar/Images/SequelProTabClose_Pressed.png +++ b/Frameworks/PSMTabBar/Images/SequelProTabClose_Pressed.png diff --git a/Frameworks/PSMTabBar/Images/SequelProTabClose_Pressed@2x.png b/Frameworks/PSMTabBar/Images/SequelProTabClose_Pressed@2x.png Binary files differindex a81b9b4b..e9f4e553 100644 --- a/Frameworks/PSMTabBar/Images/SequelProTabClose_Pressed@2x.png +++ b/Frameworks/PSMTabBar/Images/SequelProTabClose_Pressed@2x.png diff --git a/Frameworks/PSMTabBar/Images/SequelProTabClose_Rollover.png b/Frameworks/PSMTabBar/Images/SequelProTabClose_Rollover.png Binary files differindex 9ee43e19..0303b744 100644 --- a/Frameworks/PSMTabBar/Images/SequelProTabClose_Rollover.png +++ b/Frameworks/PSMTabBar/Images/SequelProTabClose_Rollover.png diff --git a/Frameworks/PSMTabBar/Images/SequelProTabClose_Rollover@2x.png b/Frameworks/PSMTabBar/Images/SequelProTabClose_Rollover@2x.png Binary files differindex dcc764d5..e9f4e553 100644 --- a/Frameworks/PSMTabBar/Images/SequelProTabClose_Rollover@2x.png +++ b/Frameworks/PSMTabBar/Images/SequelProTabClose_Rollover@2x.png diff --git a/Frameworks/PSMTabBar/Images/SequelProTabDirty.png b/Frameworks/PSMTabBar/Images/SequelProTabDirty.png Binary files differindex e5269d34..e5d3c850 100644 --- a/Frameworks/PSMTabBar/Images/SequelProTabDirty.png +++ b/Frameworks/PSMTabBar/Images/SequelProTabDirty.png diff --git a/Frameworks/PSMTabBar/Images/SequelProTabDirty@2x.png b/Frameworks/PSMTabBar/Images/SequelProTabDirty@2x.png Binary files differindex 0b2c0796..c06b5955 100644 --- a/Frameworks/PSMTabBar/Images/SequelProTabDirty@2x.png +++ b/Frameworks/PSMTabBar/Images/SequelProTabDirty@2x.png diff --git a/Frameworks/PSMTabBar/Images/SequelProTabDirty_Pressed.png b/Frameworks/PSMTabBar/Images/SequelProTabDirty_Pressed.png Binary files differindex ed074ef9..d0befe12 100644 --- a/Frameworks/PSMTabBar/Images/SequelProTabDirty_Pressed.png +++ b/Frameworks/PSMTabBar/Images/SequelProTabDirty_Pressed.png diff --git a/Frameworks/PSMTabBar/Images/SequelProTabDirty_Pressed@2x.png b/Frameworks/PSMTabBar/Images/SequelProTabDirty_Pressed@2x.png Binary files differindex 14e5b566..06d74af2 100644 --- a/Frameworks/PSMTabBar/Images/SequelProTabDirty_Pressed@2x.png +++ b/Frameworks/PSMTabBar/Images/SequelProTabDirty_Pressed@2x.png diff --git a/Frameworks/PSMTabBar/Images/SequelProTabDirty_Rollover.png b/Frameworks/PSMTabBar/Images/SequelProTabDirty_Rollover.png Binary files differindex 7966b7e9..d0befe12 100644 --- a/Frameworks/PSMTabBar/Images/SequelProTabDirty_Rollover.png +++ b/Frameworks/PSMTabBar/Images/SequelProTabDirty_Rollover.png diff --git a/Frameworks/PSMTabBar/Images/SequelProTabDirty_Rollover@2x.png b/Frameworks/PSMTabBar/Images/SequelProTabDirty_Rollover@2x.png Binary files differindex bff7efac..06d74af2 100644 --- a/Frameworks/PSMTabBar/Images/SequelProTabDirty_Rollover@2x.png +++ b/Frameworks/PSMTabBar/Images/SequelProTabDirty_Rollover@2x.png diff --git a/Frameworks/PSMTabBar/PSMTabBarControl.h b/Frameworks/PSMTabBar/PSMTabBarControl.h index 9aebddad..ad9de748 100644 --- a/Frameworks/PSMTabBar/PSMTabBarControl.h +++ b/Frameworks/PSMTabBar/PSMTabBarControl.h @@ -15,11 +15,11 @@ #define PSMTabDragDidEndNotification @"PSMTabDragDidEndNotification" #define PSMTabDragDidBeginNotification @"PSMTabDragDidBeginNotification" -#define kPSMTabBarControlHeight 22 -#define kPSMTabBarControlHeightCollapsed 1 +#define kPSMTabBarControlHeight 34 +#define kPSMTabBarControlDefaultHeightCollapsed 0 // can be changed with a property // internal cell border #define MARGIN_X 6 -#define MARGIN_Y 3 +#define MARGIN_Y 5 // padding between objects #define kPSMTabBarCellPadding 4 // fixed size objects @@ -185,6 +185,7 @@ enum { - (void)setUsesSafariStyleDragging:(BOOL)value; - (PSMTabBarTearOffStyle)tearOffStyle; - (void)setTearOffStyle:(PSMTabBarTearOffStyle)tearOffStyle; +@property CGFloat heightCollapsed; // accessors - (NSTabView *)tabView; diff --git a/Frameworks/PSMTabBar/PSMTabBarControl.m b/Frameworks/PSMTabBar/PSMTabBarControl.m index 7c1b059c..9b38d6d1 100644 --- a/Frameworks/PSMTabBar/PSMTabBarControl.m +++ b/Frameworks/PSMTabBar/PSMTabBarControl.m @@ -145,6 +145,9 @@ _cellMaxWidth = 280; _cellOptimumWidth = 130; _tearOffStyle = PSMTabBarTearOffAlphaWindow; + + self.heightCollapsed = kPSMTabBarControlDefaultHeightCollapsed; + style = [[PSMSequelProTabStyle alloc] init]; // the overflow button/menu @@ -795,7 +798,7 @@ - (void)hideTabBar:(BOOL)hide animate:(BOOL)animate { - if (!_awakenedFromNib || (_isHidden && hide) || (!_isHidden && !hide)) { + if (!_awakenedFromNib/* || (_isHidden && hide) || (!_isHidden && !hide)*/) { return; } @@ -832,7 +835,7 @@ // Determine the target sizes if (_isHidden) { - myTargetSize = kPSMTabBarControlHeightCollapsed; + myTargetSize = self.heightCollapsed; } else { myTargetSize = kPSMTabBarControlHeight; } @@ -1069,7 +1072,7 @@ // hide/show? (these return if already in desired state) if ( (_hideForSingleTab) && ([_cells count] <= 1) ) { [self hideTabBar:YES animate:YES]; - return; +// return; } else { [self hideTabBar:NO animate:YES]; } @@ -1763,22 +1766,22 @@ if (partnerView) { NSRect partnerFrame = [partnerView frame]; // above or below me? - if (myFrame.origin.y - 22 > [partnerView frame].origin.y) { + if (myFrame.origin.y - kPSMTabBarControlHeight > [partnerView frame].origin.y) { // partner is below me - [self setFrame:NSMakeRect(myFrame.origin.x, myFrame.origin.y + 21, myFrame.size.width, myFrame.size.height - 21)]; - [partnerView setFrame:NSMakeRect(partnerFrame.origin.x, partnerFrame.origin.y, partnerFrame.size.width, partnerFrame.size.height + 21)]; + [self setFrame:NSMakeRect(myFrame.origin.x, myFrame.origin.y + (kPSMTabBarControlHeight - 1), myFrame.size.width, myFrame.size.height - (kPSMTabBarControlHeight - 1))]; + [partnerView setFrame:NSMakeRect(partnerFrame.origin.x, partnerFrame.origin.y, partnerFrame.size.width, partnerFrame.size.height + (kPSMTabBarControlHeight - 1))]; } else { // partner is above me - [self setFrame:NSMakeRect(myFrame.origin.x, myFrame.origin.y, myFrame.size.width, myFrame.size.height - 21)]; - [partnerView setFrame:NSMakeRect(partnerFrame.origin.x, partnerFrame.origin.y - 21, partnerFrame.size.width, partnerFrame.size.height + 21)]; + [self setFrame:NSMakeRect(myFrame.origin.x, myFrame.origin.y, myFrame.size.width, myFrame.size.height - (kPSMTabBarControlHeight - 1))]; + [partnerView setFrame:NSMakeRect(partnerFrame.origin.x, partnerFrame.origin.y - (kPSMTabBarControlHeight - 1), partnerFrame.size.width, partnerFrame.size.height + (kPSMTabBarControlHeight - 1))]; } [partnerView setNeedsDisplay:YES]; [self setNeedsDisplay:YES]; } else { // for window movement NSRect windowFrame = [[self window] frame]; - [[self window] setFrame:NSMakeRect(windowFrame.origin.x, windowFrame.origin.y + 21, windowFrame.size.width, windowFrame.size.height - 21) display:YES]; - [self setFrame:NSMakeRect(myFrame.origin.x, myFrame.origin.y, myFrame.size.width, myFrame.size.height - 21)]; + [[self window] setFrame:NSMakeRect(windowFrame.origin.x, windowFrame.origin.y + (kPSMTabBarControlHeight - 1), windowFrame.size.width, windowFrame.size.height - (kPSMTabBarControlHeight - 1)) display:YES]; + [self setFrame:NSMakeRect(myFrame.origin.x, myFrame.origin.y, myFrame.size.width, myFrame.size.height - (kPSMTabBarControlHeight - 1))]; } } else { if (partnerView) { diff --git a/Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m b/Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m index 5bc8aa3b..619ad953 100644 --- a/Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m +++ b/Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m @@ -30,7 +30,7 @@ #define kPSMSequelProObjectCounterRadius 7.0f #define kPSMSequelProCounterMinWidth 20 -#define kPSMSequelProTabCornerRadius 4.5f +#define kPSMSequelProTabCornerRadius 0 #define MARGIN_X 6 #ifndef __MAC_10_10 @@ -126,12 +126,12 @@ typedef struct { - (CGFloat)leftMarginForTabBarControl { - return 5.0f; + return 0.0f; } - (CGFloat)rightMarginForTabBarControl { - return 24.0f; + return 10.0f; // enough to fit plus button } - (CGFloat)topMarginForTabBarControl @@ -356,7 +356,7 @@ typedef struct { NSRange range = NSMakeRange(0, [contents length]); // Add font attribute - [attrStr addAttribute:NSFontAttributeName value:[NSFont boldSystemFontOfSize:11.0f] range:range]; + [attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0f] range:range]; [attrStr addAttribute:NSForegroundColorAttributeName value:[[NSColor textColor] colorWithAlphaComponent:0.75f] range:range]; // Add shadow attribute @@ -371,8 +371,8 @@ 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]; - +// [attrStr addAttribute:NSShadowAttributeName value:textShadow range:range]; + // Paragraph Style for Truncating Long Text static NSMutableParagraphStyle *TruncatingTailParagraphStyle = nil; if (!TruncatingTailParagraphStyle) { @@ -440,77 +440,49 @@ typedef struct { //Draw for our whole bounds; it'll be automatically clipped to fit the appropriate drawing area rect = [tabBar bounds]; + // 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]; - float backgroundCalibratedWhite = 0.495f; - if (systemVersionIsAtLeast10_7_0) backgroundCalibratedWhite = 0.55f; - if (systemVersionIsAtLeast10_10_0) backgroundCalibratedWhite = 0.68f; + float backgroundCalibratedWhite = 0.73f; - float lineCalibratedWhite = [[NSColor darkGrayColor] whiteComponent]; + float lineCalibratedWhite = [[NSColor grayColor] whiteComponent]; float shadowAlpha = 0.4f; // When the window is in the background, tone down the colours if ((![[tabBar window] isMainWindow] && ![[[tabBar window] attachedSheet] isMainWindow]) || ![NSApp isActive]) { - backgroundCalibratedWhite = 0.73f; - if (systemVersionIsAtLeast10_7_0) backgroundCalibratedWhite = 0.79f; - if (systemVersionIsAtLeast10_10_0) backgroundCalibratedWhite = 0.86f; + backgroundCalibratedWhite = 0.86f; lineCalibratedWhite = 0.49f; shadowAlpha = 0.3f; } - + // fill in background of tab bar [[NSColor colorWithCalibratedWhite:backgroundCalibratedWhite alpha:1.0f] set]; - NSRectFillUsingOperation(rect, NSCompositeSourceAtop); + NSRectFill(NSMakeRect(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height - 10)); - //draw tab bar cells background color - NSColor *fillColor; - NSUInteger currentIndex = -1; - for (PSMTabBarCell *aCell in [tabBar cells]) { - currentIndex++; - //ignore tabs without color - if(![aCell backgroundColor]) - continue; - // Set up colours - if (([[tabBar window] isMainWindow] || [[[tabBar window] attachedSheet] isMainWindow]) && [NSApp isActive]) { - //active window, background cell - fillColor = [[aCell backgroundColor] shadowWithLevel:0.15]; - } else { - //background window, background cell - NSColor *dark = [[aCell backgroundColor] shadowWithLevel:0.15]; - fillColor = [NSColor colorWithCalibratedHue:[dark hueComponent] saturation:[dark saturationComponent] brightness:([dark brightnessComponent] * 1.28) alpha:1.0f]; - } - [fillColor set]; - NSRect frame = [aCell frame]; - //the leftmost cell has no left border when inactive so we need to expand it's area to the left window edge - if(currentIndex == 0 && [aCell state] == NSOffState) { - frame = NSMakeRect(0.0, frame.origin.y, frame.size.width + kPSMSequelProTabCornerRadius + 0.5f, frame.size.height); - } - NSRectFillUsingOperation(frame, NSCompositeSourceAtop); - } + + // fill active tab strip + [[self fillColorForCell:selectedCell] set]; + NSRectFill(NSMakeRect(rect.origin.x, rect.origin.y + rect.size.height - 9, rect.size.width, 8)); - // Draw horizontal line across bottom edge, with a slight bottom glow + // Draw horizontal line across the top edge [[NSColor colorWithCalibratedWhite:lineCalibratedWhite alpha:1.0f] set]; - [NSGraphicsContext saveGraphicsState]; - NSShadow *lineGlow = [[NSShadow alloc] init]; - [lineGlow setShadowBlurRadius:1]; - [lineGlow setShadowColor:[NSColor colorWithCalibratedWhite:1.0f alpha:0.2f]]; - [lineGlow setShadowOffset:NSMakeSize(0,1)]; - [lineGlow set]; - [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)]; - [lineGlow release]; - [NSGraphicsContext restoreGraphicsState]; - - // Add a shadow before drawing the top edge - [NSGraphicsContext saveGraphicsState]; - NSShadow *edgeShadow = [[NSShadow alloc] init]; - [edgeShadow setShadowBlurRadius:4]; - [edgeShadow setShadowColor:[NSColor colorWithCalibratedWhite:0.0f alpha:shadowAlpha]]; - [edgeShadow setShadowOffset:NSMakeSize(0,0)]; - [edgeShadow 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)]; - [edgeShadow release]; - [NSGraphicsContext restoreGraphicsState]; + + // 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)]; [NSGraphicsContext restoreGraphicsState]; } @@ -518,234 +490,47 @@ typedef struct { // Step 3 - (void)drawTabCell:(PSMTabBarCell *)cell { - NSRect cellFrame = [cell frame]; - NSColor *lineColor = nil; - NSColor *fillColor = nil; - NSColor *shadowColor = nil; - NSBezierPath *outlineBezier = [NSBezierPath bezierPath]; - NSBezierPath *fillBezier = [NSBezierPath bezierPath]; - NSPoint topLeftArcCenter, bottomLeftArcCenter, topRightArcCenter, bottomRightArcCenter; - BOOL drawRightEdge = YES; - BOOL drawLeftEdge = YES; - - // For cells in the off state, determine whether to draw the edges. - if ([cell state] == NSOffState) { - NSUInteger selectedCellIndex = NSUIntegerMax; - NSUInteger drawingCellIndex = NSUIntegerMax; - NSUInteger firstOverflowedCellIndex = NSUIntegerMax; - - NSUInteger currentIndex = 0; - for (PSMTabBarCell *aCell in [tabBar cells]) { - if (aCell == cell) drawingCellIndex = currentIndex; - if ([aCell state] == NSOnState || ([aCell isPlaceholder] && [aCell currentStep] > 1)) { - selectedCellIndex = currentIndex; - } - if ([aCell isInOverflowMenu]) { - firstOverflowedCellIndex = currentIndex; - break; - } - currentIndex++; - } - - // Draw the left edge if the cell is to the left of the active tab, or if the preceding cell is - // being dragged, and not for the very first cell. - if ((!drawingCellIndex || (drawingCellIndex == 1 && [[[tabBar cells] objectAtIndex:0] isPlaceholder])) - || (drawingCellIndex > selectedCellIndex - && (drawingCellIndex != selectedCellIndex + 1 || ![[[tabBar cells] objectAtIndex:selectedCellIndex] isPlaceholder]))) - { - drawLeftEdge = NO; - } - - // Draw the right edge for tabs to the right, the last tab in the bar, and where the following - // cell is being dragged. - if (drawingCellIndex < selectedCellIndex - && drawingCellIndex != firstOverflowedCellIndex - 1 - && (drawingCellIndex >= selectedCellIndex + 1 || ![[[tabBar cells] objectAtIndex:selectedCellIndex] isPlaceholder])) - { - drawRightEdge = NO; - } + // don't draw cells when collapsed + if (tabBar.isTabBarHidden) { + return; } + + NSRect cellFrame = cell.frame; + NSColor *lineColor = nil; + NSColor *fillColor = [self fillColorForCell:cell]; // Set up colours if (([[tabBar window] isMainWindow] || [[[tabBar window] attachedSheet] isMainWindow]) && [NSApp isActive]) { - lineColor = [NSColor darkGrayColor]; - if ([cell state] == NSOnState) { //active window, active cell - float tabWhiteComponent = 0.59f; - if (systemVersionIsAtLeast10_7_0) tabWhiteComponent = 0.63f; // 160/255 - if (systemVersionIsAtLeast10_10_0) tabWhiteComponent = 0.795f; // 202/255 - - if (![[[tabBar window] toolbar] isVisible]) tabWhiteComponent += 0.02f; - - fillColor = [cell backgroundColor] ? [cell backgroundColor] : [NSColor colorWithCalibratedWhite:tabWhiteComponent alpha:1.0f]; - shadowColor = [NSColor colorWithCalibratedWhite:0.0f alpha:0.7f]; - } else { //active window, background cell - float tabWhiteComponent = 0.495f; - if (systemVersionIsAtLeast10_7_0) tabWhiteComponent = 0.55f; - if (systemVersionIsAtLeast10_10_0) tabWhiteComponent = 0.68f; // 173/255 - fillColor = [NSColor colorWithCalibratedWhite:tabWhiteComponent alpha:1.0f]; - - if([cell backgroundColor]) - //should be a slightly darker variant of the color - fillColor = [[cell backgroundColor] shadowWithLevel:0.15]; - shadowColor = [NSColor colorWithCalibratedWhite:0.0f alpha:1.0f]; - } + lineColor = [NSColor grayColor]; + } else { lineColor = [NSColor colorWithCalibratedWhite:0.49f alpha:1.0f]; - if ([cell state] == NSOnState) { //background window, active cell - float tabWhiteComponent = 0.81f; - if (systemVersionIsAtLeast10_7_0) tabWhiteComponent = 0.85f; - if (systemVersionIsAtLeast10_10_0) tabWhiteComponent = 0.957f; // 244/255 - - if (![[[tabBar window] toolbar] isVisible]) tabWhiteComponent += 0.01f; - - //create a slightly desaturated variant (gray can't be desaturated so we instead make it brighter) - fillColor = [cell backgroundColor] ? [NSColor colorWithCalibratedHue:[[cell backgroundColor] hueComponent] saturation:[[cell backgroundColor] saturationComponent] brightness:([[cell backgroundColor] brightnessComponent] * 1.28 ) alpha:1.0f] : [NSColor colorWithCalibratedWhite:tabWhiteComponent alpha:1.0f]; - shadowColor = [NSColor colorWithCalibratedWhite:0.0f alpha:0.4f]; - } else { //background window, background cell - float tabWhiteComponent = 0.73f; - if(systemVersionIsAtLeast10_7_0) tabWhiteComponent = 0.79f; - if(systemVersionIsAtLeast10_10_0) tabWhiteComponent = 0.86f; // 219/255 - fillColor = [NSColor colorWithCalibratedWhite:tabWhiteComponent alpha:1.0f]; - - //make it dark first, then desaturate - if([cell backgroundColor]) { - NSColor *dark = [[cell backgroundColor] shadowWithLevel:0.15]; - fillColor = [NSColor colorWithCalibratedHue:[dark hueComponent] saturation:[dark saturationComponent] brightness:([dark brightnessComponent] * 1.28) alpha:1.0f]; - } - shadowColor = [NSColor colorWithCalibratedWhite:0.0f alpha:0.7f]; - } + } - [NSGraphicsContext saveGraphicsState]; + // setup fill rect + NSRect fillRect = NSMakeRect(cellFrame.origin.x, cellFrame.origin.y + 1, cellFrame.size.width, cellFrame.size.height - 10); - NSRect aRect = NSMakeRect(cellFrame.origin.x, cellFrame.origin.y, cellFrame.size.width, cellFrame.size.height); - - // If the tab bar is hidden, don't draw the top pixel - if ([tabBar isTabBarHidden] && [tabBar frame].size.height == kPSMTabBarControlHeightCollapsed) { - aRect.origin.y++; - aRect.size.height--; - } - - // Set up the corner bezier paths arc centers - topLeftArcCenter = NSMakePoint(aRect.origin.x - kPSMSequelProTabCornerRadius + 0.5f, aRect.origin.y + kPSMSequelProTabCornerRadius); - topRightArcCenter = NSMakePoint(aRect.origin.x + aRect.size.width + kPSMSequelProTabCornerRadius + 0.5f, aRect.origin.y + kPSMSequelProTabCornerRadius); - bottomLeftArcCenter = NSMakePoint(aRect.origin.x + kPSMSequelProTabCornerRadius + 0.5f, aRect.origin.y + aRect.size.height - kPSMSequelProTabCornerRadius -0.5f); - bottomRightArcCenter = NSMakePoint(aRect.origin.x + aRect.size.width - kPSMSequelProTabCornerRadius + 0.5f, aRect.origin.y + aRect.size.height - kPSMSequelProTabCornerRadius -0.5f); - - // Construct the outline path - if (drawLeftEdge) { - [outlineBezier appendBezierPathWithArcWithCenter:topLeftArcCenter radius:kPSMSequelProTabCornerRadius startAngle:270 endAngle:360 clockwise:NO]; - [outlineBezier appendBezierPathWithArcWithCenter:bottomLeftArcCenter radius:kPSMSequelProTabCornerRadius startAngle:180 endAngle:90 clockwise:YES]; - } - if (drawRightEdge) { - [outlineBezier appendBezierPathWithArcWithCenter:bottomRightArcCenter radius:kPSMSequelProTabCornerRadius startAngle:90 endAngle:0 clockwise:YES]; - [outlineBezier appendBezierPathWithArcWithCenter:topRightArcCenter radius:kPSMSequelProTabCornerRadius startAngle:180 endAngle:270 clockwise:NO]; - } - - // Set up a fill bezier based on the outline path - [fillBezier appendBezierPath:outlineBezier]; - - // If one edge is missing, apply a local fill to the other edge - if (drawRightEdge && !drawLeftEdge) { - [fillBezier lineToPoint:NSMakePoint(aRect.origin.x + aRect.size.width - kPSMSequelProTabCornerRadius + 0.5f, aRect.origin.y)]; - [fillBezier lineToPoint:NSMakePoint(aRect.origin.x + aRect.size.width - kPSMSequelProTabCornerRadius + 0.5f, aRect.origin.y + aRect.size.height)]; - } else if (!drawRightEdge && drawLeftEdge) { - [fillBezier lineToPoint:NSMakePoint(aRect.origin.x + 0.5f + kPSMSequelProTabCornerRadius, aRect.origin.y)]; - } - - // Set the tab outer shadow and draw the shadow + + // draw [NSGraphicsContext saveGraphicsState]; - NSShadow *cellShadow = [[NSShadow alloc] init]; - [cellShadow setShadowBlurRadius:4]; - [cellShadow setShadowColor:shadowColor]; - [cellShadow setShadowOffset:NSMakeSize(0, 0)]; - [cellShadow set]; - [outlineBezier stroke]; - [cellShadow release]; - [NSGraphicsContext restoreGraphicsState]; - // Fill the tab with a solid colour [fillColor set]; - [fillBezier fill]; + NSRectFill(fillRect); - //if we use a non-standard color draw a little highlight along the top edge - if([cell backgroundColor] && [cell state] == NSOnState) { - NSColor *highlightColor = [[cell backgroundColor] highlightWithLevel:0.5f]; - [highlightColor set]; - - NSBezierPath *highlightBezier = [NSBezierPath bezierPath]; - [highlightBezier moveToPoint:NSMakePoint(aRect.origin.x - kPSMSequelProTabCornerRadius+2.5f, aRect.origin.y+0.5f)]; - [highlightBezier lineToPoint:NSMakePoint(aRect.origin.x+aRect.size.width+kPSMSequelProTabCornerRadius-1.0f, aRect.origin.y+0.5f)]; - [highlightBezier setLineWidth:1.0f]; - [highlightBezier stroke]; + // 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]; } - // Re-stroke without shadow over the fill. - [lineColor set]; - [outlineBezier stroke]; - - // Add a bottom line to the active tab, with a slight inner glow - if ([cell state] == NSOnState) { - outlineBezier = [NSBezierPath bezierPath]; - if (drawLeftEdge) { - [outlineBezier appendBezierPathWithArcWithCenter:bottomLeftArcCenter radius:kPSMSequelProTabCornerRadius startAngle:145 endAngle:90 clockwise:YES]; - } else { - [outlineBezier moveToPoint:NSMakePoint(aRect.origin.x, aRect.origin.y + aRect.size.height - 0.5f)]; - } - if (drawRightEdge) { - [outlineBezier appendBezierPathWithArcWithCenter:bottomRightArcCenter radius:kPSMSequelProTabCornerRadius startAngle:90 endAngle:35 clockwise:YES]; - } else { - [outlineBezier lineToPoint:NSMakePoint(aRect.origin.x + aRect.size.width, aRect.origin.y + aRect.size.height - 0.5f)]; - } - cellShadow = [[NSShadow alloc] init]; - [cellShadow setShadowBlurRadius:1]; - [cellShadow setShadowColor:[NSColor colorWithCalibratedWhite:1.0f alpha:0.4f]]; - [cellShadow setShadowOffset:NSMakeSize(0, 1)]; - [cellShadow set]; - [outlineBezier stroke]; - [cellShadow release]; - - // Add the shadow over the tops of background tabs - } else if (drawLeftEdge || drawRightEdge) { - - // Set up a CGContext so that drawing can be clipped (to prevent shadow issues) - CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; - CGContextSaveGState(context); - NSPoint topLeft, topRight; - CGFloat drawAlpha = (([[tabBar window] isMainWindow] || [[[tabBar window] attachedSheet] isMainWindow]) && [NSApp isActive])? 1.0f : 0.7f; - outlineBezier = [NSBezierPath bezierPath]; - - // Calculate the endpoints of the line - if (drawLeftEdge) { - topLeft = NSMakePoint(aRect.origin.x + 0.5f - kPSMSequelProTabCornerRadius + 2, aRect.origin.y + 0.5f); - } else { - topLeft = NSMakePoint(aRect.origin.x + aRect.size.width - kPSMSequelProTabCornerRadius + 0.5f, aRect.origin.y + 0.5f); - } - if (drawRightEdge) { - topRight = NSMakePoint(aRect.origin.x + aRect.size.width + kPSMSequelProTabCornerRadius + 0.5f - 2, aRect.origin.y + 0.5f); - } else { - topRight = NSMakePoint(aRect.origin.x + 0.5f + kPSMSequelProTabCornerRadius, aRect.origin.y + 0.5f); - } - - // Set up the line and clipping point - CGContextClipToRect(context, CGRectMake(topLeft.x, topLeft.y, topRight.x-topLeft.x, aRect.size.height)); - [[NSColor colorWithCalibratedWhite:0.2f alpha:drawAlpha] set]; - [outlineBezier moveToPoint:topLeft]; - [outlineBezier lineToPoint:topRight]; - - // Set up the shadow - cellShadow = [[NSShadow alloc] init]; - [cellShadow setShadowBlurRadius:4]; - [cellShadow setShadowColor:[NSColor colorWithCalibratedWhite:0.2f alpha:drawAlpha]]; - [cellShadow setShadowOffset:NSMakeSize(0,0)]; - [cellShadow set]; - - // Draw, and then restore the previous graphics state - [outlineBezier stroke]; - [cellShadow release]; - CGContextRestoreGState(context); - } - [NSGraphicsContext restoreGraphicsState]; [self drawInteriorWithTabCell:cell inView:[cell customControlView]]; @@ -801,18 +586,11 @@ typedef struct { labelRect.size.height = cellFrame.size.height; labelRect.origin.y = cellFrame.origin.y + MARGIN_Y; - if ([cell state] == NSOnState) { - //labelRect.origin.y -= 1; - } - // object counter if ([cell count] > 0) { [[cell countColor] ?: [NSColor colorWithCalibratedWhite:0.3f alpha:0.6f] 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 + kPSMSequelProObjectCounterRadius, myRect.origin.y)]; [path lineToPoint:NSMakePoint(myRect.origin.x + myRect.size.width - kPSMSequelProObjectCounterRadius, myRect.origin.y)]; [path appendBezierPathWithArcWithCenter:NSMakePoint(myRect.origin.x + myRect.size.width - kPSMSequelProObjectCounterRadius, myRect.origin.y + kPSMSequelProObjectCounterRadius) radius:kPSMSequelProObjectCounterRadius startAngle:270.0f endAngle:90.0f]; @@ -831,11 +609,68 @@ typedef struct { // shrink label width to make room for object counter labelRect.size.width -= myRect.size.width + kPSMTabBarCellPadding; } - - // draw label - [[cell attributedStringValue] drawInRect:labelRect]; + + // determine text colour + NSAttributedString *labelString = cell.attributedStringValue; + if (cell.state != NSOnState) { + NSMutableAttributedString *newLabelString = labelString.mutableCopy; + + [newLabelString addAttribute:NSForegroundColorAttributeName value:[NSColor darkGrayColor] range:NSMakeRange(0, newLabelString.length)]; + + labelString = newLabelString.copy; + } + + // draw label + [labelString drawInRect:labelRect]; +} + +- (NSColor *)fillColorForCell:(PSMTabBarCell *)cell +{ + NSColor *fillColor = nil; + + // Set up colours + if (([[tabBar window] isMainWindow] || [[[tabBar window] attachedSheet] isMainWindow]) && [NSApp isActive]) { + if ([cell state] == NSOnState) { //active window, active cell + float tabWhiteComponent = 0.795f; + + if (!tabBar.window.toolbar.isVisible) tabWhiteComponent += 0.02f; + + fillColor = [cell backgroundColor] ? [cell backgroundColor] : [NSColor colorWithCalibratedWhite:tabWhiteComponent alpha:1.0f]; + } else { //active window, background cell + float tabWhiteComponent = 0.68f; + fillColor = [NSColor colorWithCalibratedWhite:tabWhiteComponent alpha:1.0f]; + + if([cell backgroundColor]) { + //should be a slightly darker variant of the color + fillColor = [[cell backgroundColor] shadowWithLevel:0.15]; + } + } + } else { + if ([cell state] == NSOnState) { //background window, active cell + float tabWhiteComponent = 0.957f; + if (!tabBar.window.toolbar.isVisible) tabWhiteComponent += 0.01f; + + //create a slightly desaturated variant (gray can't be desaturated so we instead make it brighter) + if (cell.backgroundColor) { + fillColor = [NSColor colorWithCalibratedHue:cell.backgroundColor.hueComponent saturation:cell.backgroundColor.saturationComponent brightness:(cell.backgroundColor.brightnessComponent * 1.28) alpha:1.0f]; + } else { + fillColor = [NSColor colorWithCalibratedWhite:tabWhiteComponent alpha:1.0f]; + } + + } else { //background window, background cell + float tabWhiteComponent = 0.86f; + fillColor = [NSColor colorWithCalibratedWhite:tabWhiteComponent alpha:1.0f]; + + //make it dark first, then desaturate + if (cell.backgroundColor) { + NSColor *dark = [[cell backgroundColor] shadowWithLevel:0.15]; + fillColor = [NSColor colorWithCalibratedHue:dark.hueComponent saturation:dark.saturationComponent brightness:(dark.brightnessComponent * 1.28) alpha:1.0f]; + } + } + } + + return fillColor; } - #pragma mark - #pragma mark Archiving diff --git a/Interfaces/English.lproj/MainWindow.xib b/Interfaces/English.lproj/MainWindow.xib index 6bd632c8..ed58bf1a 100644 --- a/Interfaces/English.lproj/MainWindow.xib +++ b/Interfaces/English.lproj/MainWindow.xib @@ -1,392 +1,49 @@ -<?xml version="1.0" encoding="UTF-8"?> -<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00"> - <data> - <int key="IBDocument.SystemTarget">1060</int> - <string key="IBDocument.SystemVersion">13F34</string> - <string key="IBDocument.InterfaceBuilderVersion">6254</string> - <string key="IBDocument.AppKitVersion">1265.21</string> - <string key="IBDocument.HIToolboxVersion">698.00</string> - <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> - <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="NS.object.0">6254</string> - </object> - <array key="IBDocument.IntegratedClassDependencies"> - <string>NSCustomObject</string> - <string>NSCustomView</string> - <string>NSTabView</string> - <string>NSView</string> - <string>NSWindowTemplate</string> - </array> - <array key="IBDocument.PluginDependencies"> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - </array> - <object class="NSMutableDictionary" key="IBDocument.Metadata"> - <string key="NS.key.0">PluginDependencyRecalculationVersion</string> - <integer value="1" key="NS.object.0"/> - </object> - <array class="NSMutableArray" key="IBDocument.RootObjects" id="1000"> - <object class="NSCustomObject" id="1001"> - <string key="NSClassName">SPWindowController</string> - </object> - <object class="NSCustomObject" id="1003"> - <string key="NSClassName">FirstResponder</string> - </object> - <object class="NSCustomObject" id="1004"> - <string key="NSClassName">NSApplication</string> - </object> - <object class="NSWindowTemplate" id="1005"> - <int key="NSWindowStyleMask">15</int> - <int key="NSWindowBacking">2</int> - <string key="NSWindowRect">{{238, 168}, {948, 555}}</string> - <int key="NSWTFlags">544735232</int> - <string key="NSWindowTitle">Window</string> - <string key="NSWindowClass">SPWindow</string> - <nil key="NSViewClass"/> - <nil key="NSUserInterfaceItemIdentifier"/> - <string key="NSWindowContentMinSize">{800, 400}</string> - <object class="NSView" key="NSWindowView" id="1006"> - <reference key="NSNextResponder"/> - <int key="NSvFlags">256</int> - <array class="NSMutableArray" key="NSSubviews"> - <object class="NSCustomView" id="1010102095"> - <reference key="NSNextResponder" ref="1006"/> - <int key="NSvFlags">266</int> - <string key="NSFrame">{{0, 533}, {948, 22}}</string> - <reference key="NSSuperview" ref="1006"/> - <reference key="NSWindow"/> - <string key="NSClassName">PSMTabBarControl</string> - </object> - <object class="NSTabView" id="372524807"> - <reference key="NSNextResponder" ref="1006"/> - <int key="NSvFlags">274</int> - <string key="NSFrameSize">{948, 533}</string> - <reference key="NSSuperview" ref="1006"/> - <reference key="NSWindow"/> - <array class="NSMutableArray" key="NSTabViewItems"/> - <object class="NSFont" key="NSFont"> - <bool key="IBIsSystemFont">YES</bool> - <double key="NSSize">13</double> - <int key="NSfFlags">1044</int> - </object> - <int key="NSTvFlags">6</int> - <bool key="NSAllowTruncatedLabels">YES</bool> - </object> - </array> - <string key="NSFrameSize">{948, 555}</string> - <reference key="NSSuperview"/> - <reference key="NSWindow"/> - </object> - <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string> - <string key="NSMinSize">{705, 422}</string> - <string key="NSMaxSize">{10000000000000, 10000000000000}</string> - <bool key="NSWindowIsRestorable">YES</bool> - </object> - </array> - <object class="IBObjectContainer" key="IBDocument.Objects"> - <bool key="usesAutoincrementingIDs">NO</bool> - <array key="connectionRecords"> - <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> - <string key="label">tabBar</string> - <reference key="source" ref="1001"/> - <reference key="destination" ref="1010102095"/> - </object> - <string key="id">13</string> - </object> - <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> - <string key="label">tabView</string> - <reference key="source" ref="1001"/> - <reference key="destination" ref="372524807"/> - </object> - <string key="id">14</string> - </object> - <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> - <string key="label">window</string> - <reference key="source" ref="1001"/> - <reference key="destination" ref="1005"/> - </object> - <string key="id">15</string> - </object> - <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> - <string key="label">tabView</string> - <reference key="source" ref="1010102095"/> - <reference key="destination" ref="372524807"/> - </object> - <string key="id">9</string> - </object> - <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> - <string key="label">partnerView</string> - <reference key="source" ref="1010102095"/> - <reference key="destination" ref="372524807"/> - </object> - <string key="id">10</string> - </object> - <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> - <string key="label">delegate</string> - <reference key="source" ref="1010102095"/> - <reference key="destination" ref="1001"/> - </object> - <string key="id">12</string> - </object> - <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> - <string key="label">delegate</string> - <reference key="source" ref="372524807"/> - <reference key="destination" ref="1010102095"/> - </object> - <string key="id">16</string> - </object> - </array> - <object class="IBMutableOrderedSet" key="objectRecords"> - <array key="orderedObjects"> - <object class="IBObjectRecord"> - <string key="id">0</string> - <array key="object" id="0"/> - <reference key="children" ref="1000"/> - <nil key="parent"/> - </object> - <object class="IBObjectRecord"> - <string key="id">-2</string> - <reference key="object" ref="1001"/> - <reference key="parent" ref="0"/> - <string key="objectName">File's Owner</string> - </object> - <object class="IBObjectRecord"> - <string key="id">-1</string> - <reference key="object" ref="1003"/> - <reference key="parent" ref="0"/> - <string key="objectName">First Responder</string> - </object> - <object class="IBObjectRecord"> - <string key="id">-3</string> - <reference key="object" ref="1004"/> - <reference key="parent" ref="0"/> - <string key="objectName">Application</string> - </object> - <object class="IBObjectRecord"> - <string key="id">1</string> - <reference key="object" ref="1005"/> - <array class="NSMutableArray" key="children"> - <reference ref="1006"/> - </array> - <reference key="parent" ref="0"/> - </object> - <object class="IBObjectRecord"> - <string key="id">2</string> - <reference key="object" ref="1006"/> - <array class="NSMutableArray" key="children"> - <reference ref="1010102095"/> - <reference ref="372524807"/> - </array> - <reference key="parent" ref="1005"/> - </object> - <object class="IBObjectRecord"> - <string key="id">3</string> - <reference key="object" ref="1010102095"/> - <reference key="parent" ref="1006"/> - </object> - <object class="IBObjectRecord"> - <string key="id">4</string> - <reference key="object" ref="372524807"/> - <array class="NSMutableArray" key="children"/> - <reference key="parent" ref="1006"/> - </object> - </array> - </object> - <dictionary class="NSMutableDictionary" key="flattenedProperties"> - <string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="-3.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="1.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="1.IBWindowTemplateEditedContentRect">{{54, 246}, {948, 555}}</string> - <boolean value="NO" key="1.NSWindowTemplate.visibleAtLaunch"/> - <string key="2.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="3.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="4.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> - </dictionary> - <dictionary class="NSMutableDictionary" key="unlocalizedProperties"/> - <nil key="activeLocalization"/> - <dictionary class="NSMutableDictionary" key="localizations"/> - <nil key="sourceID"/> - </object> - <object class="IBClassDescriber" key="IBDocument.Classes"> - <array class="NSMutableArray" key="referencedPartialClassDescriptions"> - <object class="IBPartialClassDescription"> - <string key="className">PSMTabBarControl</string> - <string key="superclassName">NSControl</string> - <dictionary class="NSMutableDictionary" key="outlets"> - <string key="delegate">id</string> - <string key="partnerView">id</string> - <string key="tabView">NSTabView</string> - </dictionary> - <dictionary class="NSMutableDictionary" key="toOneOutletInfosByName"> - <object class="IBToOneOutletInfo" key="delegate"> - <string key="name">delegate</string> - <string key="candidateClassName">id</string> - </object> - <object class="IBToOneOutletInfo" key="partnerView"> - <string key="name">partnerView</string> - <string key="candidateClassName">id</string> - </object> - <object class="IBToOneOutletInfo" key="tabView"> - <string key="name">tabView</string> - <string key="candidateClassName">NSTabView</string> - </object> - </dictionary> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBProjectSource</string> - <string key="minorKey">../Frameworks/PSMTabBar/PSMTabBarControl.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">SPWindow</string> - <string key="superclassName">NSWindow</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBProjectSource</string> - <string key="minorKey">../Source/SPWindow.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">SPWindowController</string> - <string key="superclassName">NSWindowController</string> - <dictionary class="NSMutableDictionary" key="actions"> - <string key="addNewConnection:">id</string> - <string key="closeTab:">id</string> - <string key="moveSelectedTabInNewWindow:">id</string> - <string key="selectNextDocumentTab:">id</string> - <string key="selectPreviousDocumentTab:">id</string> - <string key="toggleTabBarShown:">id</string> - </dictionary> - <dictionary class="NSMutableDictionary" key="actionInfosByName"> - <object class="IBActionInfo" key="addNewConnection:"> - <string key="name">addNewConnection:</string> - <string key="candidateClassName">id</string> - </object> - <object class="IBActionInfo" key="closeTab:"> - <string key="name">closeTab:</string> - <string key="candidateClassName">id</string> - </object> - <object class="IBActionInfo" key="moveSelectedTabInNewWindow:"> - <string key="name">moveSelectedTabInNewWindow:</string> - <string key="candidateClassName">id</string> - </object> - <object class="IBActionInfo" key="selectNextDocumentTab:"> - <string key="name">selectNextDocumentTab:</string> - <string key="candidateClassName">id</string> - </object> - <object class="IBActionInfo" key="selectPreviousDocumentTab:"> - <string key="name">selectPreviousDocumentTab:</string> - <string key="candidateClassName">id</string> - </object> - <object class="IBActionInfo" key="toggleTabBarShown:"> - <string key="name">toggleTabBarShown:</string> - <string key="candidateClassName">id</string> - </object> - </dictionary> - <dictionary class="NSMutableDictionary" key="outlets"> - <string key="tabBar">PSMTabBarControl</string> - <string key="tabView">NSTabView</string> - </dictionary> - <dictionary class="NSMutableDictionary" key="toOneOutletInfosByName"> - <object class="IBToOneOutletInfo" key="tabBar"> - <string key="name">tabBar</string> - <string key="candidateClassName">PSMTabBarControl</string> - </object> - <object class="IBToOneOutletInfo" key="tabView"> - <string key="name">tabView</string> - <string key="candidateClassName">NSTabView</string> - </object> - </dictionary> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBProjectSource</string> - <string key="minorKey">../Source/SPWindowController.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">SPWindowController</string> - <dictionary class="NSMutableDictionary" key="actions"> - <string key="addNewConnection:">id</string> - <string key="closeTab:">id</string> - <string key="moveSelectedTabInNewWindow:">id</string> - <string key="selectNextDocumentTab:">id</string> - <string key="selectPreviousDocumentTab:">id</string> - <string key="toggleTabBarShown:">id</string> - </dictionary> - <dictionary class="NSMutableDictionary" key="actionInfosByName"> - <object class="IBActionInfo" key="addNewConnection:"> - <string key="name">addNewConnection:</string> - <string key="candidateClassName">id</string> - </object> - <object class="IBActionInfo" key="closeTab:"> - <string key="name">closeTab:</string> - <string key="candidateClassName">id</string> - </object> - <object class="IBActionInfo" key="moveSelectedTabInNewWindow:"> - <string key="name">moveSelectedTabInNewWindow:</string> - <string key="candidateClassName">id</string> - </object> - <object class="IBActionInfo" key="selectNextDocumentTab:"> - <string key="name">selectNextDocumentTab:</string> - <string key="candidateClassName">id</string> - </object> - <object class="IBActionInfo" key="selectPreviousDocumentTab:"> - <string key="name">selectPreviousDocumentTab:</string> - <string key="candidateClassName">id</string> - </object> - <object class="IBActionInfo" key="toggleTabBarShown:"> - <string key="name">toggleTabBarShown:</string> - <string key="candidateClassName">id</string> - </object> - </dictionary> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBProjectSource</string> - <string key="minorKey">../Source/SPWindowController.m</string> - </object> - </object> - </array> - <array class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+"> - <object class="IBPartialClassDescription"> - <string key="className">PSMTabBarControl</string> - <string key="superclassName">NSControl</string> - <dictionary class="NSMutableDictionary" key="outlets"> - <string key="delegate">id</string> - <string key="partnerView">id</string> - <string key="tabView">NSTabView</string> - </dictionary> - <dictionary class="NSMutableDictionary" key="toOneOutletInfosByName"> - <object class="IBToOneOutletInfo" key="delegate"> - <string key="name">delegate</string> - <string key="candidateClassName">id</string> - </object> - <object class="IBToOneOutletInfo" key="partnerView"> - <string key="name">partnerView</string> - <string key="candidateClassName">id</string> - </object> - <object class="IBToOneOutletInfo" key="tabView"> - <string key="name">tabView</string> - <string key="candidateClassName">NSTabView</string> - </object> - </dictionary> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBFrameworkSource</string> - <string key="minorKey">PSMTabBar.framework/Headers/PSMTabBarControl.h</string> - </object> - </object> - </array> - </object> - <int key="IBDocument.localizationMode">0</int> - <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string> - <bool key="IBDocument.previouslyAttemptedUpgradeToXcode5">YES</bool> - <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies"> - <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string> - <integer value="4600" key="NS.object.0"/> - </object> - <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool> - <int key="IBDocument.defaultPropertyAccessControl">3</int> - </data> -</archive> +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> + <dependencies> + <deployment identifier="macosx"/> + <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9532"/> + </dependencies> + <objects> + <customObject id="-2" userLabel="File's Owner" customClass="SPWindowController"> + <connections> + <outlet property="tabBar" destination="3" id="13"/> + <outlet property="tabView" destination="4" id="14"/> + <outlet property="window" destination="1" id="15"/> + </connections> + </customObject> + <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> + <customObject id="-3" userLabel="Application" customClass="NSObject"/> + <window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" visibleAtLaunch="NO" animationBehavior="default" id="1" customClass="SPWindow"> + <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/> + <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/> + <rect key="contentRect" x="238" y="168" width="948" height="555"/> + <rect key="screenRect" x="0.0" y="0.0" width="1440" height="878"/> + <value key="minSize" type="size" width="800" height="400"/> + <view key="contentView" id="2"> + <rect key="frame" x="0.0" y="0.0" width="948" height="555"/> + <autoresizingMask key="autoresizingMask"/> + <subviews> + <customView id="3" customClass="PSMTabBarControl"> + <rect key="frame" x="0.0" y="521" width="948" height="34"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> + <connections> + <outlet property="delegate" destination="-2" id="12"/> + <outlet property="partnerView" destination="4" id="10"/> + <outlet property="tabView" destination="4" id="9"/> + </connections> + </customView> + <tabView drawsBackground="NO" type="noTabsNoBorder" id="4"> + <rect key="frame" x="0.0" y="0.0" width="948" height="521"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <font key="font" metaFont="system"/> + <tabViewItems/> + <connections> + <outlet property="delegate" destination="3" id="16"/> + </connections> + </tabView> + </subviews> + </view> + </window> + </objects> +</document> diff --git a/Source/SPDatabaseDocument.h b/Source/SPDatabaseDocument.h index e36b4a58..62aa11d7 100644 --- a/Source/SPDatabaseDocument.h +++ b/Source/SPDatabaseDocument.h @@ -522,9 +522,10 @@ - (void)restoreSession; #endif +- (SPConnectionController*)connectionController; + #ifdef SP_CODA /* method decls */ - (SPConnectionController*)createConnectionController; -- (SPConnectionController*)connectionController; - (void)connect; - (void)setTableSourceInstance:(SPTableStructure*)source; - (void)setTableContentInstance:(SPTableContent*)content; diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index 21f774e5..ab7f2a5d 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -3886,6 +3886,8 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0; // Set the titles [parentTabViewItem setLabel:tabTitle]; [parentTabViewItem setColor:tabColor]; + [parentWindowController updateTabBar]; + if ([parentWindowController selectedTableDocument] == self) { [parentWindow setTitle:windowTitle]; } @@ -5163,14 +5165,13 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0; #endif } - -#ifdef SP_CODA - - (SPConnectionController*)connectionController { return connectionController; } +#ifdef SP_CODA + - (void)databaseDocumentConnectionFailed:(id)sender { if ( delegate && [delegate respondsToSelector:@selector(databaseDocumentConnectionFailed:)] ) diff --git a/Source/SPWindowController.h b/Source/SPWindowController.h index 528c1c84..8700019c 100644 --- a/Source/SPWindowController.h +++ b/Source/SPWindowController.h @@ -71,5 +71,6 @@ - (NSArray *)documents; - (void)selectTabAtIndex:(NSInteger)index; - (void)setHideForSingleTab:(BOOL)hide; +- (void)updateTabBar; @end diff --git a/Source/SPWindowController.m b/Source/SPWindowController.m index 963919d0..d9214ada 100644 --- a/Source/SPWindowController.m +++ b/Source/SPWindowController.m @@ -34,6 +34,7 @@ #import "SPDatabaseViewController.h" #import "SPAppController.h" #import "PSMTabDragAssistant.h" +#import "SPConnectionController.h" #import <PSMTabBar/PSMTabBarControl.h> #import <PSMTabBar/PSMTabStyle.h> @@ -181,6 +182,7 @@ enum { // If there are multiple tabs, close the front tab. if ([tabView numberOfTabViewItems] > 1) { [tabView removeTabViewItem:[tabView selectedTabViewItem]]; + } else { [[self window] performClose:self]; @@ -359,6 +361,23 @@ enum { } #pragma mark - +#pragma mark Tab Bar +- (void)updateTabBar +{ + BOOL collapse = NO; + + if (selectedTableDocument.getConnection) { + if (selectedTableDocument.connectionController.colorIndex != -1) { + collapse = YES; + } + } + + tabBar.heightCollapsed = collapse ? 8 : 1; + + [tabBar update]; +} + +#pragma mark - #pragma mark First responder forwarding to active tab /** @@ -453,8 +472,8 @@ enum { [tabBar setShowAddTabButton:YES]; [tabBar setSizeCellsToFit:NO]; [tabBar setCellMinWidth:100]; - [tabBar setCellMaxWidth:250]; - [tabBar setCellOptimumWidth:250]; + [tabBar setCellMaxWidth:25000]; + [tabBar setCellOptimumWidth:25000]; [tabBar setSelectsTabsOnMouseDown:YES]; [tabBar setCreatesTabOnDoubleClick:YES]; [tabBar setTearOffStyle:PSMTabBarTearOffAlphaWindow]; @@ -552,6 +571,8 @@ enum { [nc addObserver:self selector:@selector(_selectedTableDocumentDeallocd:) name:SPDocumentWillCloseNotification object:newDoc]; selectedTableDocument = newDoc; } + + [self updateTabBar]; } - (void)_selectedTableDocumentDeallocd:(NSNotification *)notification |