aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2010-07-03 14:33:24 +0000
committerrowanbeentje <rowan@beent.je>2010-07-03 14:33:24 +0000
commit32e3cbaf916d06f9375d4b19c4ae2b4492f7960a (patch)
tree468dfa985a6258aea70179498465112a93f6e4ac
parentf57748788a3d9054e5e6c88e8a187e15e5bd7b2d (diff)
downloadsequelpro-32e3cbaf916d06f9375d4b19c4ae2b4492f7960a.tar.gz
sequelpro-32e3cbaf916d06f9375d4b19c4ae2b4492f7960a.tar.bz2
sequelpro-32e3cbaf916d06f9375d4b19c4ae2b4492f7960a.zip
- Fix tab bars in windows with only one tab not disappearing after dragging a tab past/through them, by using PSMTabBar notifications instead of our own notifications; also fix PSMTabBar notification ordering.
- When a tab drag starts, reorder all windows in front of other applications
-rw-r--r--Frameworks/PSMTabBar/PSMTabDragAssistant.m8
-rw-r--r--Source/SPAppController.m16
-rw-r--r--Source/SPWindowController.m7
3 files changed, 21 insertions, 10 deletions
diff --git a/Frameworks/PSMTabBar/PSMTabDragAssistant.m b/Frameworks/PSMTabBar/PSMTabDragAssistant.m
index 29fa036c..7ebada1a 100644
--- a/Frameworks/PSMTabBar/PSMTabDragAssistant.m
+++ b/Frameworks/PSMTabBar/PSMTabDragAssistant.m
@@ -433,9 +433,9 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
[[[self sourceTabBar] delegate] tabView:[[self sourceTabBar] tabView] didDropTabViewItem:[[self draggedCell] representedObject] inTabBar:[self destinationTabBar]];
}
- [[NSNotificationCenter defaultCenter] postNotificationName:PSMTabDragDidEndNotification object:nil];
-
[self finishDrag];
+
+ [[NSNotificationCenter defaultCenter] postNotificationName:PSMTabDragDidEndNotification object:nil];
}
- (void)draggedImageEndedAt:(NSPoint)aPoint operation:(NSDragOperation)operation
@@ -510,9 +510,9 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
}
}
- [[NSNotificationCenter defaultCenter] postNotificationName:PSMTabDragDidEndNotification object:nil];
-
[self finishDrag];
+
+ [[NSNotificationCenter defaultCenter] postNotificationName:PSMTabDragDidEndNotification object:nil];
}
}
diff --git a/Source/SPAppController.m b/Source/SPAppController.m
index 2d719c95..c5c2ed2d 100644
--- a/Source/SPAppController.m
+++ b/Source/SPAppController.m
@@ -33,6 +33,7 @@
#import "SPConstants.h"
#import "SPWindowController.h"
+#import <PSMTabBar/PSMTabBarControl.h>
#import <Sparkle/Sparkle.h>
@implementation SPAppController
@@ -79,7 +80,10 @@
// Register SPAppController for AppleScript events
[[NSScriptExecutionContext sharedScriptExecutionContext] setTopLevelObject:self];
-
+
+ // Register for drag start notifications - used to bring all windows to front
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(tabDragStarted:) name:PSMTabDragDidBeginNotification object:nil];
+
isNewFavorite = NO;
}
@@ -500,6 +504,14 @@
return nil;
}
+/**
+ * When tab drags start, bring all the windows in front of other applications.
+ */
+- (void)tabDragStarted:(id)sender
+{
+ [NSApp arrangeInFront:self];
+}
+
#pragma mark -
#pragma mark IBAction methods
@@ -920,6 +932,8 @@
*/
- (void)dealloc
{
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
+
if(_spfSessionDocData) [_spfSessionDocData release], _spfSessionDocData = nil;
[prefsController release], prefsController = nil;
[aboutController release], aboutController = nil;
diff --git a/Source/SPWindowController.m b/Source/SPWindowController.m
index ed443ac4..7eb83765 100644
--- a/Source/SPWindowController.m
+++ b/Source/SPWindowController.m
@@ -73,8 +73,8 @@
closeTabMenuItem = [[[[NSApp mainMenu] itemWithTag:SPMainMenuFile] submenu] itemWithTag:1103];
// Register for drag start and stop notifications - used to show/hide tab bars
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(tabDragStarted:) name:@"SPTabDragStart" object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(tabDragStopped:) name:@"SPTabDragStop" object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(tabDragStarted:) name:PSMTabDragDidBeginNotification object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(tabDragStopped:) name:PSMTabDragDidEndNotification object:nil];
}
/**
@@ -375,7 +375,6 @@
*/
- (BOOL)tabView:(NSTabView *)aTabView shouldDragTabViewItem:(NSTabViewItem *)tabViewItem fromTabBar:(PSMTabBarControl *)tabBarControl
{
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SPTabDragStart" object:self];
return YES;
}
@@ -408,8 +407,6 @@
// Check the window and move it to front if it's key (eg for new window creation)
if ([[tabBarControl window] isKeyWindow]) [[tabBarControl window] orderFront:self];
-
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SPTabDragStop" object:self];
}
/**