aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2011-08-16 00:07:03 +0000
committerrowanbeentje <rowan@beent.je>2011-08-16 00:07:03 +0000
commit22f2e47959158cf33704481353a65b6d3b242b88 (patch)
treefdccf10fefb43197065f028017e77cd83b51ab85 /Source
parentaee5bc25beb877fb6484031c087b4f93096394eb (diff)
downloadsequelpro-22f2e47959158cf33704481353a65b6d3b242b88.tar.gz
sequelpro-22f2e47959158cf33704481353a65b6d3b242b88.tar.bz2
sequelpro-22f2e47959158cf33704481353a65b6d3b242b88.zip
- Lion compatibility improvement: add support for fullscreen windows, on the main window only; hide SSH/SSL status when entering fullscreen mode, to prevent drawing issues
- Lion compatibility improvement: update tab colours under 10.7 to match system styles - Lion compatibility improvement: fix issues dragging tabs out of windows and into other tab bars - Lion compatibility improvement: fix QuickLook issues under 10.7, including windows which couldn't be closed, fullscreened, or crashes - Fix exceptions in the bundle controller when using tab switching keys - Lion compatibility improvement: use overlay scrollers where possible
Diffstat (limited to 'Source')
-rw-r--r--Source/SPDatabaseDocument.h2
-rw-r--r--Source/SPDatabaseDocument.m53
-rw-r--r--Source/SPFieldEditorController.m9
-rw-r--r--Source/SPWindow.m16
-rw-r--r--Source/SPWindowController.m26
5 files changed, 86 insertions, 20 deletions
diff --git a/Source/SPDatabaseDocument.h b/Source/SPDatabaseDocument.h
index f7474943..31c3d636 100644
--- a/Source/SPDatabaseDocument.h
+++ b/Source/SPDatabaseDocument.h
@@ -234,6 +234,7 @@ SPDatabaseData, SPTablesList, SPTableStructure, SPTableContent, SPTableData, SPS
BOOL isProcessing;
#ifndef SP_REFACTOR /* ivars */
NSString *processID;
+ BOOL windowTitleStatusViewIsVisible;
#endif
}
@@ -396,6 +397,7 @@ SPDatabaseData, SPTablesList, SPTableStructure, SPTableContent, SPTableData, SPS
- (void)setStatusIconToImageWithName:(NSString *)imagePath;
- (void)setTitlebarStatus:(NSString *)status;
- (void)clearStatusIcon;
+- (void)updateTitlebarStatusVisibilityForcingHide:(BOOL)forceHide;
// Toolbar methods
- (void)updateWindowTitle:(id)sender;
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index 237b8d85..d9e9b671 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -25,6 +25,13 @@
//
// More info at <http://code.google.com/p/sequel-pro/>
+// Forward-declare for 10.7 compatibility
+#if !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
+enum {
+ NSFullScreenWindowMask = 1 << 14
+};
+#endif
+
#import "SPDatabaseDocument.h"
#import "SPConnectionController.h"
@@ -194,6 +201,7 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
#ifndef SP_REFACTOR /* init ivars */
statusValues = nil;
printThread = nil;
+ windowTitleStatusViewIsVisible = NO;
nibObjectsToRelease = [[NSMutableArray alloc] init];
// As this object is not an NSWindowController subclass, top-level objects in loaded nibs aren't
@@ -335,6 +343,8 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
[taskProgressWindow setContentView:taskProgressLayer];
[contentViewSplitter setDelegate:self];
+
+ [self updateTitlebarStatusVisibilityForcingHide:NO];
#endif
}
@@ -3573,6 +3583,34 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
[titleImageView setImage:nil];
}
+/**
+ * Update the title bar status area visibility. The status area is visible if the tab is
+ * frontmost in the window, and if the window is not fullscreen.
+ */
+- (void)updateTitlebarStatusVisibilityForcingHide:(BOOL)forceHide
+{
+ BOOL newIsVisible = !forceHide;
+ if (newIsVisible && [parentWindow styleMask] & NSFullScreenWindowMask) newIsVisible = NO;
+ if (newIsVisible && [parentWindowController selectedTableDocument] != self) newIsVisible = NO;
+ if (newIsVisible == windowTitleStatusViewIsVisible) return;
+
+ if (newIsVisible) {
+ NSView *windowFrame = [[parentWindow contentView] superview];
+ NSRect av = [titleAccessoryView frame];
+ NSRect initialAccessoryViewFrame = NSMakeRect(
+ [windowFrame frame].size.width - av.size.width - 30,
+ [windowFrame frame].size.height - av.size.height,
+ av.size.width,
+ av.size.height);
+ [titleAccessoryView setFrame:initialAccessoryViewFrame];
+ [windowFrame addSubview:titleAccessoryView];
+ } else {
+ [titleAccessoryView removeFromSuperview];
+ }
+
+ windowTitleStatusViewIsVisible = newIsVisible;
+}
+
#pragma mark -
#pragma mark Toolbar Methods
@@ -3929,9 +3967,7 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
*/
- (void)willResignActiveTabInWindow
{
-
- // Remove the icon accessory view from the title bar
- [titleAccessoryView removeFromSuperview];
+ [self updateTitlebarStatusVisibilityForcingHide:YES];
// Remove the task progress window
[parentWindow removeChildWindow:taskProgressWindow];
@@ -3957,16 +3993,7 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
else
[parentWindow setRepresentedURL:nil];
- // Add the icon accessory view to the title bar
- NSView *windowFrame = [[parentWindow contentView] superview];
- NSRect av = [titleAccessoryView frame];
- NSRect initialAccessoryViewFrame = NSMakeRect(
- [windowFrame frame].size.width - av.size.width - 30,
- [windowFrame frame].size.height - av.size.height,
- av.size.width,
- av.size.height);
- [titleAccessoryView setFrame:initialAccessoryViewFrame];
- [windowFrame addSubview:titleAccessoryView];
+ [self updateTitlebarStatusVisibilityForcingHide:NO];
// Add the progress window to this window
[self centerTaskWindow];
diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m
index 3ad7e077..1207755e 100644
--- a/Source/SPFieldEditorController.m
+++ b/Source/SPFieldEditorController.m
@@ -54,10 +54,11 @@
- (id)init
{
#ifndef SP_REFACTOR
- if ((self = [super initWithWindowNibName:@"FieldEditorSheet"])) {
+ if ((self = [super initWithWindowNibName:@"FieldEditorSheet"]))
#else
- if ((self = [super initWithWindowNibName:@"SQLFieldEditorSheet"])) {
+ if ((self = [super initWithWindowNibName:@"SQLFieldEditorSheet"]))
#endif
+ {
// force the nib to be loaded
(void) [self window];
counter = 0;
@@ -161,6 +162,7 @@
#ifndef SP_REFACTOR
if ( qlTypes ) [qlTypes release];
#endif
+ if ( tmpFileName ) [tmpFileName release];
if ( tmpDirPath ) [tmpDirPath release];
if ( esUndoManager ) [esUndoManager release];
if ( contextInfo ) [contextInfo release];
@@ -786,7 +788,8 @@
// Create a temporary file name to store the data as file
// since QuickLook only works on files.
// Alternate the file name to suppress caching by using counter%2.
- tmpFileName = [NSString stringWithFormat:@"%@SequelProQuickLook%d.%@", tmpDirPath, counter%2, type];
+ if (tmpFileName) [tmpFileName release];
+ tmpFileName = [[NSString alloc] initWithFormat:@"%@SequelProQuickLook%d.%@", tmpDirPath, counter%2, type];
// if data are binary
if ( [sheetEditData isKindOfClass:[NSData class]] && !isText) {
diff --git a/Source/SPWindow.m b/Source/SPWindow.m
index 5a485ede..414d043a 100644
--- a/Source/SPWindow.m
+++ b/Source/SPWindow.m
@@ -78,13 +78,17 @@
case '}':
if (([theEvent modifierFlags] & NSDeviceIndependentModifierFlagsMask) == (NSCommandKeyMask | NSShiftKeyMask))
{
- return [[self windowController] selectNextDocumentTab:self];
+ if ([[self windowController] respondsToSelector:@selector(selectNextDocumentTab:)])
+ [[self windowController] selectNextDocumentTab:self];
+ return;
}
break;
case '{':
if (([theEvent modifierFlags] & NSDeviceIndependentModifierFlagsMask) == (NSCommandKeyMask | NSShiftKeyMask))
{
- return [[self windowController] selectPreviousDocumentTab:self];
+ if ([[self windowController] respondsToSelector:@selector(selectPreviousDocumentTab:)])
+ [[self windowController] selectPreviousDocumentTab:self];
+ return;
}
break;
@@ -92,13 +96,17 @@
case NSRightArrowFunctionKey:
if (([theEvent modifierFlags] & NSDeviceIndependentModifierFlagsMask) == (NSCommandKeyMask | NSAlternateKeyMask | NSNumericPadKeyMask | NSFunctionKeyMask))
{
- return [[self windowController] selectNextDocumentTab:self];
+ if ([[self windowController] respondsToSelector:@selector(selectNextDocumentTab:)])
+ [[self windowController] selectNextDocumentTab:self];
+ return;
}
break;
case NSLeftArrowFunctionKey:
if (([theEvent modifierFlags] & NSDeviceIndependentModifierFlagsMask) == (NSCommandKeyMask | NSAlternateKeyMask | NSNumericPadKeyMask | NSFunctionKeyMask))
{
- return [[self windowController] selectPreviousDocumentTab:self];
+ if ([[self windowController] respondsToSelector:@selector(selectPreviousDocumentTab:)])
+ [[self windowController] selectPreviousDocumentTab:self];
+ return;
}
break;
}
diff --git a/Source/SPWindowController.m b/Source/SPWindowController.m
index f4094ac3..2ef62941 100644
--- a/Source/SPWindowController.m
+++ b/Source/SPWindowController.m
@@ -22,6 +22,14 @@
//
// More info at <http://code.google.com/p/sequel-pro/>
+// Forward-declare for 10.7 compatibility
+#if !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
+enum {
+ NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7,
+ NSWindowCollectionBehaviorFullScreenAuxiliary = 1 << 8
+};
+#endif
+
#import "SPWindowController.h"
#import "SPDatabaseDocument.h"
#import "PSMTabDragAssistant.h"
@@ -46,6 +54,8 @@
{
selectedTableDocument = nil;
+ [[self window] setCollectionBehavior:[[self window] collectionBehavior] | NSWindowCollectionBehaviorFullScreenPrimary];
+
// Disable automatic cascading - this occurs before the size is set, so let the app
// controller apply cascading after frame autosaving.
[self setShouldCascadeWindows:NO];
@@ -701,6 +711,22 @@
}
}
+/**
+ * If the window is entering fullscreen, update the front tab's titlebar status view visibility.
+ */
+- (void)windowWillEnterFullScreen:(NSNotification *)notification
+{
+ [selectedTableDocument updateTitlebarStatusVisibilityForcingHide:YES];
+}
+
+/**
+ * If the window exits fullscreen, update the front tab's titlebar status view visibility.
+ */
+- (void)windowDidExitFullScreen:(NSNotification *)notification
+{
+ [selectedTableDocument updateTitlebarStatusVisibilityForcingHide:NO];
+}
+
#pragma mark -
#pragma mark First responder forwarding to active tab