aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/PSMTabBar/PSMTabBarController.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2010-06-30 23:44:55 +0000
committerrowanbeentje <rowan@beent.je>2010-06-30 23:44:55 +0000
commit219afc56c02b508fbb6d706dfed4e1a1ccc949d4 (patch)
treede4e473de2a5fd1063c671733a5f7552e6080ba0 /Frameworks/PSMTabBar/PSMTabBarController.m
parentba332e64c29622e0b69412cb2fea639182ac1d1c (diff)
downloadsequelpro-219afc56c02b508fbb6d706dfed4e1a1ccc949d4.tar.gz
sequelpro-219afc56c02b508fbb6d706dfed4e1a1ccc949d4.tar.bz2
sequelpro-219afc56c02b508fbb6d706dfed4e1a1ccc949d4.zip
Improve tab functionality, behaviour and interaction.
PSMTabBar general improvements: - Fix a phantom tab appearing in windows a tab was just dragged out of - Add support for a new control usersSafariStyleDragging property; this causes tabs being dragged inside a tab bar to snap to the tab bar, be drawn at full transparency (also no longer darkening the placeholder position), and alters tab ordering within the tab bar to be based on the tab position rather than the mouse position, for a more Mac-like reordering feel. - Add support for dragging items onto the menubar to cancel the drag - Alter the image of the dragged tab to use a tab drawn onto a transparent background instead of snapshotting a rectangle around the tab, improving drag appearance - Allow tabs to be dragged partially off screen and keep their position instead of snapping back fully onto the screen - Improve behaviour when dragging tabs out of and back into tab bars, or into new windows, resizing the tabs in the target tab bar to improve display and no longer intermittently showing close buttons while dragging - Pull windows to the front as tabs are dragged onto their tab bars - Abstract Custom Query Editor text snippet code, adding a delegate method so code could be moved to the SP window manager. Sequel Pro tab styling improvements: - Improve and clean up tab drawing code - Draw background tabs with shadows as appropriate - Improve logic for how background tab edges are drawn, handling edges cases better (active tab in overflow menu etc) and vastly improving drawing when a tab is being dragged (respect placeholder position when stacking tabs, draw edges on either side) Sequel Pro tab behaviour improvements: - Improve show/hide tab bar interaction - Improve window positioning after creating new windows via a drag - Alter tab dragging out of the tab bar to use an image based on the full window appearance - looks better, and fixes issues like the tab bar background not being drawn while dragging
Diffstat (limited to 'Frameworks/PSMTabBar/PSMTabBarController.m')
-rw-r--r--Frameworks/PSMTabBar/PSMTabBarController.m13
1 files changed, 9 insertions, 4 deletions
diff --git a/Frameworks/PSMTabBar/PSMTabBarController.m b/Frameworks/PSMTabBar/PSMTabBarController.m
index 76f3a91b..62e7a818 100644
--- a/Frameworks/PSMTabBar/PSMTabBarController.m
+++ b/Frameworks/PSMTabBar/PSMTabBarController.m
@@ -11,6 +11,7 @@
#import "PSMTabBarCell.h"
#import "PSMTabStyle.h"
#import "NSString_AITruncation.h"
+#import "PSMTabDragAssistant.h"
#define MAX_OVERFLOW_MENUITEM_TITLE_LENGTH 60
@@ -194,11 +195,13 @@
NSArray *cells = [_control cells];
NSInteger cellCount = [cells count];
- // make sure all of our tabs are accounted for before updating
- if ([[_control tabView] numberOfTabViewItems] != cellCount) {
+ // make sure all of our tabs are accounted for before updating,
+ // or only proceed if a drag is in progress (where counts may mismatch)
+ if ([[_control tabView] numberOfTabViewItems] != cellCount && ![[PSMTabDragAssistant sharedDragAssistant] isDragging]) {
return;
}
+ //
[_cellTrackingRects removeAllObjects];
[_closeButtonTrackingRects removeAllObjects];
[_cellFrames removeAllObjects];
@@ -211,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"] doubleValue] + 2;
+ _addButtonRect.origin.x += [[cellWidths valueForKeyPath:@"@sum.floatValue"] doubleValue] + MARGIN_X;
} else {
_addButtonRect.origin.x = 0;
_addButtonRect.origin.y = [[cellWidths lastObject] doubleValue];
@@ -326,8 +329,10 @@ static NSInteger potentialMinimumForArray(NSArray *array, NSInteger minimum)
width = [_control cellOptimumWidth];
}
- width = ceil(width);
+ //if ([currentCell isPlaceholder]) width = 1;
+ width = ceil(width);
+
//check to see if there is not enough space to place all tabs as preferred
if (totalOccupiedWidth + width >= availableWidth) {
//There's not enough space to add currentCell at its preferred width!