diff options
Diffstat (limited to 'Frameworks/PSMTabBar')
-rw-r--r-- | Frameworks/PSMTabBar/PSMRolloverButton.m | 4 | ||||
-rw-r--r-- | Frameworks/PSMTabBar/PSMTabBarControl.h | 2 | ||||
-rw-r--r-- | Frameworks/PSMTabBar/PSMTabBarControl.m | 103 | ||||
-rw-r--r-- | Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m | 21 |
4 files changed, 58 insertions, 72 deletions
diff --git a/Frameworks/PSMTabBar/PSMRolloverButton.m b/Frameworks/PSMTabBar/PSMRolloverButton.m index 988abbb2..eebbd68e 100644 --- a/Frameworks/PSMTabBar/PSMRolloverButton.m +++ b/Frameworks/PSMTabBar/PSMRolloverButton.m @@ -24,6 +24,8 @@ [self resetCursorRects]; _myTrackingRectTag = -1; + _rolloverImage = nil; + _usualImage = nil; } - (void)dealloc @@ -31,6 +33,8 @@ [[NSNotificationCenter defaultCenter] removeObserver:self]; [self removeTrackingRect]; + [_rolloverImage release]; + [_usualImage release]; [super dealloc]; } diff --git a/Frameworks/PSMTabBar/PSMTabBarControl.h b/Frameworks/PSMTabBar/PSMTabBarControl.h index 481bb3b8..d2cbc534 100644 --- a/Frameworks/PSMTabBar/PSMTabBarControl.h +++ b/Frameworks/PSMTabBar/PSMTabBarControl.h @@ -16,6 +16,7 @@ #define PSMTabDragDidBeginNotification @"PSMTabDragDidBeginNotification" #define kPSMTabBarControlHeight 22 +#define kPSMTabBarControlHeightCollapsed 1 // internal cell border #define MARGIN_X 6 #define MARGIN_Y 3 @@ -205,6 +206,7 @@ enum { - (void)hideTabBar:(BOOL)hide animate:(BOOL)animate; - (BOOL)isTabBarHidden; - (BOOL)isAnimating; +- (void)destroyAnimations; // internal bindings methods also used by the tab drag assistant - (void)bindPropertiesForCell:(PSMTabBarCell *)cell andTabViewItem:(NSTabViewItem *)item; diff --git a/Frameworks/PSMTabBar/PSMTabBarControl.m b/Frameworks/PSMTabBar/PSMTabBarControl.m index a38c50b0..2a92a2b1 100644 --- a/Frameworks/PSMTabBar/PSMTabBarControl.m +++ b/Frameworks/PSMTabBar/PSMTabBarControl.m @@ -202,17 +202,8 @@ - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; - - //stop any animations that may be running - [_animationTimer invalidate]; - [_animationTimer release]; _animationTimer = nil; - - [_showHideAnimationTimer invalidate]; - [_showHideAnimationTimer release]; _showHideAnimationTimer = nil; - //Also unwind the spring, if it's wound. - [_springTimer invalidate]; - [_springTimer release]; _springTimer = nil; + [self destroyAnimations]; //unbind all the items to prevent crashing //not sure if this is necessary or not @@ -796,7 +787,7 @@ - (void)hideTabBar:(BOOL)hide animate:(BOOL)animate { - if (!_awakenedFromNib || (_isHidden && hide) || (!_isHidden && !hide) || (_currentStep != kPSMIsNotBeingResized)) { + if (!_awakenedFromNib || (_isHidden && hide) || (!_isHidden && !hide)) { return; } @@ -830,55 +821,35 @@ partnerOriginalSize = [[self window] frame].size.height; partnerOriginalOrigin = [[self window] frame].origin.y; } - + + // Determine the target sizes + if (_isHidden) { + myTargetSize = kPSMTabBarControlHeightCollapsed; + } else { + myTargetSize = kPSMTabBarControlHeight; + } + if (partnerView) { + partnerTargetSize = partnerOriginalSize + myOriginalSize - myTargetSize; + // above or below me? - if ((myOriginalOrigin - 22) > partnerOriginalOrigin) { - // partner is below me - if (_isHidden) { - // I'm shrinking - myTargetOrigin = myOriginalOrigin + 21; - myTargetSize = myOriginalSize - 21; - partnerTargetOrigin = partnerOriginalOrigin; - partnerTargetSize = partnerOriginalSize + 21; - } else { - // I'm growing - myTargetOrigin = myOriginalOrigin - 21; - myTargetSize = myOriginalSize + 21; - partnerTargetOrigin = partnerOriginalOrigin; - partnerTargetSize = partnerOriginalSize - 21; - } + if ((myOriginalOrigin - kPSMTabBarControlHeight) > partnerOriginalOrigin) { + + // partner is below me, keeps its origin + partnerTargetOrigin = partnerOriginalOrigin; + myTargetOrigin = myOriginalOrigin + myOriginalSize - myTargetSize; } else { - // partner is above me - if (_isHidden) { - // I'm shrinking - myTargetOrigin = myOriginalOrigin; - myTargetSize = myOriginalSize - 21; - partnerTargetOrigin = partnerOriginalOrigin - 21; - partnerTargetSize = partnerOriginalSize + 21; - } else { - // I'm growing - myTargetOrigin = myOriginalOrigin; - myTargetSize = myOriginalSize + 21; - partnerTargetOrigin = partnerOriginalOrigin + 21; - partnerTargetSize = partnerOriginalSize - 21; - } + + // partner is above me, I keep my origin + myTargetOrigin = myOriginalOrigin; + partnerTargetOrigin = partnerOriginalOrigin + myOriginalSize - myTargetSize; } } else { + // for window movement - if (_isHidden) { - // I'm shrinking - myTargetOrigin = myOriginalOrigin; - myTargetSize = myOriginalSize - 21; - partnerTargetOrigin = partnerOriginalOrigin + 21; - partnerTargetSize = partnerOriginalSize - 21; - } else { - // I'm growing - myTargetOrigin = myOriginalOrigin; - myTargetSize = myOriginalSize + 21; - partnerTargetOrigin = partnerOriginalOrigin - 21; - partnerTargetSize = partnerOriginalSize + 21; - } + myTargetOrigin = myOriginalOrigin; + partnerTargetOrigin = partnerOriginalOrigin + myOriginalSize - myTargetSize; + partnerTargetSize = partnerOriginalSize - myOriginalSize + myTargetSize; } } else /* vertical */ { // current (original) values @@ -1046,6 +1017,21 @@ partnerView = view; } +- (void)destroyAnimations +{ + // Stop any animations that may be running + + [_animationTimer invalidate]; + [_animationTimer release]; _animationTimer = nil; + + [_showHideAnimationTimer invalidate]; + [_showHideAnimationTimer release]; _showHideAnimationTimer = nil; + + // Also unwind the spring, if it's wound. + [_springTimer invalidate]; + [_springTimer release]; _springTimer = nil; +} + #pragma mark - #pragma mark Drawing @@ -1368,7 +1354,7 @@ - (void)mouseDragged:(NSEvent *)theEvent { - if ([self lastMouseDownEvent] == nil) { + if (![self lastMouseDownEvent]) { return; } @@ -1426,6 +1412,10 @@ - (void)mouseUp:(NSEvent *)theEvent { + if (![self lastMouseDownEvent]) { + return; + } + if (_resizing) { _resizing = NO; [[NSCursor arrowCursor] set]; @@ -1474,6 +1464,9 @@ _closeClicked = NO; } + + // Clear the last mouse down event to prevent drag issues + [self setLastMouseDownEvent:nil]; } - (NSMenu *)menuForEvent:(NSEvent *)event diff --git a/Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m b/Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m index 05c4ada2..b0a96ccd 100644 --- a/Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m +++ b/Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m @@ -364,7 +364,7 @@ } [self drawBackgroundInRect:rect]; - + // no tab view == not connected if (![bar tabView]) { NSRect labelRect = rect; @@ -530,7 +530,7 @@ 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]) { + if ([tabBar isTabBarHidden] && [tabBar frame].size.height == kPSMTabBarControlHeightCollapsed) { aRect.origin.y++; aRect.size.height--; } @@ -655,21 +655,10 @@ { NSRect cellFrame = [cell frame]; CGFloat insetLabelWidth = 0; - BOOL tabBarIsRightOfSelectedTab = NO; - - // Determine if the selected tab is right of this tab - for (PSMTabBarCell *aCell in [tabBar cells]) { - if (aCell == cell) break; - if ([aCell state] == NSOnState) { - tabBarIsRightOfSelectedTab = YES; - break; - } - } - + // close button if ([cell hasCloseButton] && ![cell isCloseButtonSuppressed] && [cell isHighlighted]) { - NSSize closeButtonSize = NSZeroSize; NSRect closeButtonRect = [cell closeButtonRectForFrame:cellFrame]; NSImage * closeButton = nil; @@ -677,9 +666,7 @@ if ([cell closeButtonOver]) closeButton = [cell isEdited] ? sequelProCloseDirtyButtonOver : sequelProCloseButtonOver; if ([cell closeButtonPressed]) closeButton = [cell isEdited] ? sequelProCloseDirtyButtonDown : sequelProCloseButtonDown; - - closeButtonSize = [closeButton size]; - + if ([controlView isFlipped]) { closeButtonRect.origin.y += closeButtonRect.size.height; } |