aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPWindowController.m
diff options
context:
space:
mode:
authorAbhi Beckert <abhi@Twist-of-Lemon-2.local>2015-05-16 08:06:06 +1000
committerAbhi Beckert <abhi@Twist-of-Lemon-2.local>2015-05-16 08:06:06 +1000
commit57a6f6c73bdaa202164645370d37fcbe5d14a092 (patch)
treedd30aa6156064f1d4c0e10ea87059625470fc2f9 /Source/SPWindowController.m
parentb5e972f4504043dfb9c358e272e93fb59ae2127f (diff)
parent0f0c43eb74408b6a65a42e2c6fd46f4142ef8e3f (diff)
downloadsequelpro-57a6f6c73bdaa202164645370d37fcbe5d14a092.tar.gz
sequelpro-57a6f6c73bdaa202164645370d37fcbe5d14a092.tar.bz2
sequelpro-57a6f6c73bdaa202164645370d37fcbe5d14a092.zip
Merge remote-tracking branch 'sequelpro/master'
Diffstat (limited to 'Source/SPWindowController.m')
-rw-r--r--Source/SPWindowController.m19
1 files changed, 11 insertions, 8 deletions
diff --git a/Source/SPWindowController.m b/Source/SPWindowController.m
index f90b423d..db94f5ce 100644
--- a/Source/SPWindowController.m
+++ b/Source/SPWindowController.m
@@ -63,11 +63,8 @@ enum {
- (void)awakeFromNib
{
- systemVersion = 0;
selectedTableDocument = nil;
- Gestalt(gestaltSystemVersion, &systemVersion);
-
[[self window] setCollectionBehavior:[[self window] collectionBehavior] | NSWindowCollectionBehaviorFullScreenPrimary];
// Add a line to the window to hide the line below the title bar when the toolbar is collapsed
@@ -83,13 +80,19 @@ enum {
[self _setUpTabBar];
// Retrieve references to the 'Close Window' and 'Close Tab' menus. These are updated as window focus changes.
- closeWindowMenuItem = [[[[NSApp mainMenu] itemWithTag:SPMainMenuFile] submenu] itemWithTag:1003];
- closeTabMenuItem = [[[[NSApp mainMenu] itemWithTag:SPMainMenuFile] submenu] itemWithTag:1103];
+ closeWindowMenuItem = [[[[NSApp mainMenu] itemWithTag:SPMainMenuFile] submenu] itemWithTag:SPMainMenuFileClose];
+ closeTabMenuItem = [[[[NSApp mainMenu] itemWithTag:SPMainMenuFile] submenu] itemWithTag:SPMainMenuFileCloseTab];
// Register for drag start and stop notifications - used to show/hide tab bars
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(tabDragStarted:) name:PSMTabDragDidBeginNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(tabDragStopped:) name:PSMTabDragDidEndNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_updateLineHidingViewState) name:SPWindowToolbarDidToggleNotification object:nil];
+
+ // Because we are a document-based app we automatically adopt window restoration on 10.7+.
+ // However that causes a race condition with our own window setup code.
+ // Remove this when we actually support restoration.
+ if([[self window] respondsToSelector:@selector(setRestorable:)])
+ [[self window] setRestorable:NO];
}
#pragma mark -
@@ -511,10 +514,10 @@ enum {
{
// Set the background colour to match the titlebar window state
if ((([[self window] isMainWindow] || [[[self window] attachedSheet] isMainWindow]) && [NSApp isActive])) {
- [titleBarLineHidingView setBackgroundColor:[NSColor colorWithCalibratedWhite:(systemVersion >= 0x1070) ? 0.66f : 0.63f alpha:1.0]];
+ [titleBarLineHidingView setBackgroundColor:[NSColor colorWithCalibratedWhite:(isOSVersionAtLeast10_7_0) ? 0.66f : 0.63f alpha:1.0]];
}
else {
- [titleBarLineHidingView setBackgroundColor:[NSColor colorWithCalibratedWhite:(systemVersion >= 0x1070) ? 0.87f : 0.84f alpha:1.0]];
+ [titleBarLineHidingView setBackgroundColor:[NSColor colorWithCalibratedWhite:(isOSVersionAtLeast10_7_0) ? 0.87f : 0.84f alpha:1.0]];
}
// If the window is fullscreen or the toolbar is showing, hide the view; otherwise show it
@@ -537,7 +540,7 @@ enum {
// Tear down the animations on the tab bar to stop redraws
[tabBar destroyAnimations];
- [managedDatabaseConnections release];
+ SPClear(managedDatabaseConnections);
[super dealloc];
}