diff options
-rw-r--r-- | Source/SPAppController.m | 12 | ||||
-rw-r--r-- | Source/SPBundleEditorController.m | 3 | ||||
-rw-r--r-- | Source/SPBundleHTMLOutputController.m | 2 | ||||
-rw-r--r-- | Source/SPCategoryAdditions.h | 1 | ||||
-rw-r--r-- | Source/SPCompatibility.h | 151 | ||||
-rw-r--r-- | Source/SPConnectionController.m | 16 | ||||
-rw-r--r-- | Source/SPConstants.h | 26 | ||||
-rw-r--r-- | Source/SPDatabaseDocument.m | 12 | ||||
-rw-r--r-- | Source/SPEditorPreferencePane.m | 2 | ||||
-rw-r--r-- | Source/SPFieldEditorController.m | 7 | ||||
-rw-r--r-- | Source/SPFieldMapperController.m | 2 | ||||
-rw-r--r-- | Source/SPFunctions.m | 3 | ||||
-rw-r--r-- | Source/SPKeychain.m | 6 | ||||
-rw-r--r-- | Source/SPMenuAdditions.h | 36 | ||||
-rw-r--r-- | Source/SPMenuAdditions.m | 46 | ||||
-rw-r--r-- | Source/SPOSInfo.m | 21 | ||||
-rw-r--r-- | Source/SPTableContent.m | 12 | ||||
-rw-r--r-- | Source/SPTooltip.m | 6 | ||||
-rw-r--r-- | Source/SPWindow.m | 8 | ||||
-rw-r--r-- | Source/SPWindowController.m | 9 | ||||
-rw-r--r-- | Source/Sequel-Pro.pch | 4 | ||||
-rw-r--r-- | UnitTests/SPMenuAdditionsTests.m | 78 | ||||
-rw-r--r-- | sequel-pro.xcodeproj/project.pbxproj | 14 |
23 files changed, 179 insertions, 298 deletions
diff --git a/Source/SPAppController.m b/Source/SPAppController.m index c7412419..3028c0f6 100644 --- a/Source/SPAppController.m +++ b/Source/SPAppController.m @@ -50,6 +50,7 @@ #import "SPWindowManagement.h" #import "SPCopyTable.h" #import "SPSyntaxParser.h" +#import "SPOSInfo.h" #import <PSMTabBar/PSMTabBarControl.h> #import <Sparkle/Sparkle.h> @@ -825,7 +826,14 @@ // remove percent encoding NSMutableArray *decodedPathComponents = [NSMutableArray arrayWithCapacity:pathComponents.count]; for (NSString *component in pathComponents) { - [decodedPathComponents addObject:component.stringByRemovingPercentEncoding]; + NSString *decoded; + if([SPOSInfo isOSVersionAtLeastMajor:10 minor:9 patch:0]) { + decoded = [component stringByRemovingPercentEncoding]; + } + else { + decoded = [component stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; + } + [decodedPathComponents addObject:decoded]; } pathComponents = decodedPathComponents.copy; @@ -1599,7 +1607,7 @@ NSMenu *menu = [[[NSApp mainMenu] itemWithTag:SPMainMenuBundles] submenu]; // Clean menu - [menu compatibleRemoveAllItems]; + [menu removeAllItems]; // Set up the bundle search paths // First process all in Application Support folder installed ones then Default ones diff --git a/Source/SPBundleEditorController.m b/Source/SPBundleEditorController.m index e95c5d8c..ddac2b9e 100644 --- a/Source/SPBundleEditorController.m +++ b/Source/SPBundleEditorController.m @@ -29,7 +29,6 @@ // More info at <https://github.com/sequelpro/sequelpro> #import "SPBundleEditorController.h" -#import "SPMenuAdditions.h" #import "SPBundleCommandRunner.h" #import "SPOutlineView.h" #import "SPBundleCommandTextView.h" @@ -245,7 +244,7 @@ } NSMenuItem *anItem; - [inputGeneralScopePopUpMenu compatibleRemoveAllItems]; + [inputGeneralScopePopUpMenu removeAllItems]; anItem = [[NSMenuItem alloc] initWithTitle:SP_BUNDLEEDITOR_SCOPE_GENERAL_STRING action:@selector(scopeButtonChanged:) keyEquivalent:@""]; [anItem setTag:kGeneralScopeArrayIndex]; [inputGeneralScopePopUpMenu addItem:anItem]; diff --git a/Source/SPBundleHTMLOutputController.m b/Source/SPBundleHTMLOutputController.m index ecf16faa..6d9f70be 100644 --- a/Source/SPBundleHTMLOutputController.m +++ b/Source/SPBundleHTMLOutputController.m @@ -73,9 +73,7 @@ static NSString *SPSaveDocumentAction = @"SPSaveDocument"; [webView setDrawsBackground:YES]; [webView setEditable:NO]; [webView setShouldCloseWithWindow:YES]; -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 [webView setShouldUpdateWhileOffscreen:NO]; -#endif suppressExceptionAlerting = NO; } diff --git a/Source/SPCategoryAdditions.h b/Source/SPCategoryAdditions.h index 991cb60c..f2e08f53 100644 --- a/Source/SPCategoryAdditions.h +++ b/Source/SPCategoryAdditions.h @@ -42,7 +42,6 @@ #import "SPWindowAdditions.h" #import "SPDataAdditions.h" #import "SPDataBase64EncodingAdditions.h" -#import "SPMenuAdditions.h" #import "SPNotLoaded.h" #import "SPMainThreadTrampoline.h" #import "SPColorAdditions.h" diff --git a/Source/SPCompatibility.h b/Source/SPCompatibility.h new file mode 100644 index 00000000..0154bb2a --- /dev/null +++ b/Source/SPCompatibility.h @@ -0,0 +1,151 @@ +// +// SPCompatibility.h +// sequel-pro +// +// Created by Max Lohrmann on 31.03.17. +// Copyright (c) 2017 Max Lohrmann. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// +// More info at <https://github.com/sequelpro/sequelpro> + +/** + * This file contains declarations for backward compatibility to + * older XCode versions / SDKs. + * + * The current minimum required SDK is 10.8! + */ + +#ifndef SPCompatibility +#define SPCompatibility + +#pragma mark - 10.8 Mountain Lion + +#ifndef __MAC_10_8 +#define __MAC_10_8 1080 +#endif + +#if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_8 +#error You need to have at least SDK 10.8! +#endif + +#pragma mark - 10.9 Mavericks + +#ifndef __MAC_10_9 +#define __MAC_10_9 1090 +#endif + +#if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_9 + +@interface NSString (Mavericks) + +@property (readonly, copy) NSString *stringByRemovingPercentEncoding; + +@end + +#endif + +#pragma mark - 10.10 Yosemite + +#ifndef __MAC_10_10 +#define __MAC_10_10 101000 +#endif + +#if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_10 + +// This enum is available since 10.5 but only got a "name" in 10.10 +typedef NSUInteger NSCellHitResult; + +@compatibility_alias NSTitlebarAccessoryViewController NSViewController; + +@interface NSViewController (NSTitlebarAccessoryViewController) + +@property NSLayoutAttribute layoutAttribute; + +@end + +@interface NSWindow (Yosemite) + +- (NSArray *)titlebarAccessoryViewControllers; +- (void)removeTitlebarAccessoryViewControllerAtIndex:(NSInteger)index; +- (void)addTitlebarAccessoryViewController:(NSTitlebarAccessoryViewController *)controller; + +@end + +// This code is available since 10.8 but public only since 10.10 +typedef struct { + NSInteger majorVersion; + NSInteger minorVersion; + NSInteger patchVersion; +} NSOperatingSystemVersion; + +@interface NSProcessInfo () +- (NSOperatingSystemVersion)operatingSystemVersion; +- (BOOL)isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion)version; +@end + +#endif + +#pragma mark - 10.11 El Capitan + +#ifndef __MAC_10_11 +#define __MAC_10_11 101100 +#endif + +#if !__has_feature(objc_kindof) +#define __kindof +#endif + +#if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_11 + +// formal protocol since 10.11, NSObject category before +@protocol WebFrameLoadDelegate <NSObject> +@end + +@interface NSOpenPanel (ElCapitan) + +@property (getter=isAccessoryViewDisclosed) BOOL accessoryViewDisclosed; + +@end + +#endif + +#pragma mark - 10.12 Sierra + +#ifndef __MAC_10_12 +#define __MAC_10_12 101200 +#endif + +#if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_12 + +//those enums got renamed in 10.12, probably for consistency +#define NSAlertStyleInformational NSInformationalAlertStyle +#define NSAlertStyleWarning NSWarningAlertStyle +#define NSAlertStyleCritical NSCriticalAlertStyle + +@interface NSWindow (Sierra) ++ (void)setAllowsAutomaticWindowTabbing:(BOOL)arg; +@end + +#endif + +#endif diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m index f1968af6..1ccde091 100644 --- a/Source/SPConnectionController.m +++ b/Source/SPConnectionController.m @@ -63,22 +63,6 @@ static NSString *SPRemoveNode = @"RemoveNode"; static NSString *SPExportFavoritesFilename = @"SequelProFavorites.plist"; #endif -#if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_6 -@interface NSSavePanel (NSSavePanel_unpublishedUntilSnowLeopardAPI) - -- (void)setShowsHiddenFiles:(BOOL)flag; - -@end -#endif - -#if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_11 -@interface NSOpenPanel (NSOpenPanel_ElCaptian) - -@property (getter=isAccessoryViewDisclosed) BOOL accessoryViewDisclosed; - -@end -#endif - /** * This is a utility function to validate SSL key/certificate files * @param fileData The contents of the file diff --git a/Source/SPConstants.h b/Source/SPConstants.h index 71b0c49b..1419ec9a 100644 --- a/Source/SPConstants.h +++ b/Source/SPConstants.h @@ -665,32 +665,6 @@ typedef NS_ENUM(NSInteger,SPErrorCode) { // error codes in SPErrorDomain void _SPClear(id *addr); #define SPClear(x) _SPClear(&x) -// Backwards compatibility -#ifndef __MAC_10_7 - #define __MAC_10_7 1070 -#endif - -#ifndef __MAC_10_8 - #define __MAC_10_8 1080 -#endif - -#ifndef __MAC_10_10 - #define __MAC_10_10 101000 -#endif - -#ifndef __MAC_10_11 - #define __MAC_10_11 101100 -#endif - -#ifndef __MAC_10_12 - #define __MAC_10_12 101200 -#endif - -// This enum is available since 10.5 but only got a "name" in 10.10 -#if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_10 -typedef NSUInteger NSCellHitResult; -#endif - // Stolen from Stack Overflow: http://stackoverflow.com/questions/969130 #define SPLog(fmt, ...) NSLog((@"%s:%d: " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__) diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index b57b506f..d19b3f4c 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -29,13 +29,6 @@ // // More info at <https://github.com/sequelpro/sequelpro> -// 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" #import "SPConnectionHandler.h" @@ -3990,10 +3983,11 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0; if (newIsVisible == windowTitleStatusViewIsVisible) return; if (newIsVisible) { - if (NSClassFromString(@"NSTitlebarAccessoryViewController")) { // OS X 10.11 and later + Class controllerClass; + if ((controllerClass = NSClassFromString(@"NSTitlebarAccessoryViewController"))) { // OS X 10.11 and later [titleAccessoryView setFrame:NSMakeRect(0, 0, titleAccessoryView.frame.size.width, 120)]; // make it really tall, so that it's on the top right of the title/toolbar area, instead of the bottom right (AppKit will not prevent it from going behind the toolbar) - NSTitlebarAccessoryViewController *accessoryViewController = [[[NSTitlebarAccessoryViewController alloc] init] autorelease]; + NSTitlebarAccessoryViewController *accessoryViewController = [[[controllerClass alloc] init] autorelease]; accessoryViewController.view = titleAccessoryView; accessoryViewController.layoutAttribute = NSLayoutAttributeRight; [parentWindow addTitlebarAccessoryViewController:accessoryViewController]; diff --git a/Source/SPEditorPreferencePane.m b/Source/SPEditorPreferencePane.m index 0428984a..7fc810ea 100644 --- a/Source/SPEditorPreferencePane.m +++ b/Source/SPEditorPreferencePane.m @@ -351,7 +351,7 @@ static NSString *SPCustomColorSchemeNameLC = @"user-defined"; [defaultItem setTarget:self]; // Build theme selection submenu - [themeSelectionMenu compatibleRemoveAllItems]; + [themeSelectionMenu removeAllItems]; [themeSelectionMenu addItem:defaultItem]; [themeSelectionMenu addItem:[NSMenuItem separatorItem]]; diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m index 0298973d..b79355b5 100644 --- a/Source/SPFieldEditorController.m +++ b/Source/SPFieldEditorController.m @@ -41,13 +41,6 @@ #import <SPMySQL/SPMySQL.h> -#if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_7 -@interface NSTextView (LionPlus) -- (void)setUsesFindBar:(BOOL)value; -- (BOOL)usesFindBar; -@end -#endif - typedef enum { TextSegment = 0, ImageSegment, diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m index ca40d71a..ee80174a 100644 --- a/Source/SPFieldMapperController.m +++ b/Source/SPFieldMapperController.m @@ -2040,7 +2040,7 @@ static NSUInteger SPSourceColumnTypeInteger = 1; #endif // Re-init recent menu - [recentGlobalValueMenu compatibleRemoveAllItems]; + [recentGlobalValueMenu removeAllItems]; for(id item in recents) [recentGlobalValueMenu addItemWithTitle:item action:@selector(insertRecentGlobalValue:) keyEquivalent:@""]; diff --git a/Source/SPFunctions.m b/Source/SPFunctions.m index 93008059..461304e0 100644 --- a/Source/SPFunctions.m +++ b/Source/SPFunctions.m @@ -44,11 +44,10 @@ void SPMainQSync(void (^block)(void)) int SPBetterRandomBytes(uint8_t *buf, size_t count) { -#if MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_7 if([SPOSInfo isOSVersionAtLeastMajor:10 minor:7 patch:0]) { return SecRandomCopyBytes(kSecRandomDefault, count, buf); } -#endif + // Version for 10.6 // https://developer.apple.com/library/prerelease/mac/documentation/Security/Conceptual/cryptoservices/RandomNumberGenerationAPIs/RandomNumberGenerationAPIs.html#//apple_ref/doc/uid/TP40011172-CH12-SW1 FILE *fp = fopen("/dev/random", "r"); diff --git a/Source/SPKeychain.m b/Source/SPKeychain.m index 49e2de69..94b561c5 100644 --- a/Source/SPKeychain.m +++ b/Source/SPKeychain.m @@ -230,10 +230,8 @@ */ - (BOOL)passwordExistsForName:(NSString *)name account:(NSString *)account { -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 // "kSecClassGenericPassword" was introduced with the 10.7 SDK. // It won't work on 10.6 either (meaning this code never matches properly there). - // (That's why there are compile time and runtime checks here) if([SPOSInfo isOSVersionAtLeastMajor:10 minor:7 patch:0]) { NSMutableDictionary *query = [NSMutableDictionary dictionary]; @@ -248,7 +246,9 @@ return SecItemCopyMatching((CFDictionaryRef)query, (CFTypeRef *)&result) == errSecSuccess; } -#endif + + //Version for 10.6 + SecKeychainItemRef item; SecKeychainSearchRef search = NULL; NSInteger numberOfItemsFound = 0; diff --git a/Source/SPMenuAdditions.h b/Source/SPMenuAdditions.h deleted file mode 100644 index 6c1070b2..00000000 --- a/Source/SPMenuAdditions.h +++ /dev/null @@ -1,36 +0,0 @@ -// -// SPMenuAdditions.h -// sequel-pro -// -// Created by Rowan Beentje on November 27, 2010. -// Copyright (c) 2010 Rowan Beentje. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -// -// More info at <https://github.com/sequelpro/sequelpro> - -@interface NSMenu (SPMenuAdditions) - -// Add a 10.5-compatible removeAllItems -- (void)compatibleRemoveAllItems; - -@end diff --git a/Source/SPMenuAdditions.m b/Source/SPMenuAdditions.m deleted file mode 100644 index f4544808..00000000 --- a/Source/SPMenuAdditions.m +++ /dev/null @@ -1,46 +0,0 @@ -// -// SPMenuAdditions.m -// sequel-pro -// -// Created by Rowan Beentje on November 27, 2010. -// Copyright (c) 2010 Rowan Beentje. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -// -// More info at <https://github.com/sequelpro/sequelpro> - -#import "SPMenuAdditions.h" - -@implementation NSMenu (SPMenuAdditions) - -// Add a 10.5-compatible removeAllItems -- (void)compatibleRemoveAllItems -{ - if ([self respondsToSelector:@selector(removeAllItems)]) { - [(id)self removeAllItems]; - } - else { - while ([self numberOfItems]) [self removeItemAtIndex:0]; - } -} - -@end diff --git a/Source/SPOSInfo.m b/Source/SPOSInfo.m index b862e898..412b634a 100644 --- a/Source/SPOSInfo.m +++ b/Source/SPOSInfo.m @@ -29,26 +29,7 @@ // More info at <https://github.com/sequelpro/sequelpro> #import "SPOSInfo.h" - -// Needed because this class is also compiled with SequelProTunnelAssistant which can't access SPConstants.h -#ifndef __MAC_10_10 -#define __MAC_10_10 101000 -#endif - -#if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_10 -// This code is available since 10.8 but public only since 10.10 -typedef struct { - NSInteger majorVersion; - NSInteger minorVersion; - NSInteger patchVersion; -} NSOperatingSystemVersion; - -@interface NSProcessInfo () -- (NSOperatingSystemVersion)operatingSystemVersion; -- (BOOL)isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion)version; -@end - -#endif +#import "SPCompatibility.h" // Needed because this class is also compiled with SequelProTunnelAssistant int SPOSVersionCompare(SPOSVersion left, SPOSVersion right) { diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index 416b7cd8..0738fe96 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -243,20 +243,16 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper [nibLoader release]; -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_7 //let's see if we can use the NSPopover (10.7+) or have to make do with our legacy clone. //this is using reflection right now, as our SDK is 10.8 but our minimum supported version is 10.6 Class popOverClass = NSClassFromString(@"NSPopover"); - if(popOverClass) - { + if(popOverClass) { paginationPopover = [[popOverClass alloc] init]; [paginationPopover setDelegate:(SPTableContent<NSPopoverDelegate> *)self]; [paginationPopover setContentViewController:paginationViewController]; [paginationPopover setBehavior:NSPopoverBehaviorTransient]; } - else -#endif - { + else { [paginationBox setContentView:[paginationViewController view]]; // Add the pagination view to the content area @@ -1638,13 +1634,11 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper } #endif -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_7 - (void)popoverDidClose:(NSNotification *)notification { //not to hide the view, but to change the paginationButton [self setPaginationViewVisibility:NO]; } -#endif /** * Show or hide the pagination layer, also changing the first responder as appropriate. @@ -1672,7 +1666,6 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper } } -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_7 if(paginationPopover) { if(makeVisible) { [paginationPopover showRelativeToRect:[paginationButton bounds] ofView:paginationButton preferredEdge:NSMinYEdge]; @@ -1684,7 +1677,6 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper } return; } -#endif if (makeVisible) { if (paginationViewFrame.size.height == paginationViewHeight) return; diff --git a/Source/SPTooltip.m b/Source/SPTooltip.m index 54a997f6..ff68fdbe 100644 --- a/Source/SPTooltip.m +++ b/Source/SPTooltip.m @@ -83,12 +83,6 @@ static CGFloat slow_in_out (CGFloat t) @end -@interface WebView (LeopardOnly) - -- (void)setDrawsBackground:(BOOL)drawsBackground; - -@end - @implementation SPTooltip // ================== diff --git a/Source/SPWindow.m b/Source/SPWindow.m index 383b7fcd..18c4fae3 100644 --- a/Source/SPWindow.m +++ b/Source/SPWindow.m @@ -31,12 +31,6 @@ #import "SPWindow.h" #import "SPWindowController.h" -@interface NSWindow (LionPlusMethods) - -- (void)toggleFullScreen:(id)sender; - -@end - @implementation SPWindow @synthesize isSheetWhichCanBecomeMain; @@ -45,12 +39,10 @@ + (void)initialize { -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_12 // Disable automatic window tabbing on 10.12+ if ([NSWindow respondsToSelector:@selector(setAllowsAutomaticWindowTabbing:)]) { [NSWindow setAllowsAutomaticWindowTabbing:NO]; } -#endif } #pragma mark - diff --git a/Source/SPWindowController.m b/Source/SPWindowController.m index cddf6b09..7f3c687b 100644 --- a/Source/SPWindowController.m +++ b/Source/SPWindowController.m @@ -39,15 +39,6 @@ #import <PSMTabBar/PSMTabBarControl.h> #import <PSMTabBar/PSMTabStyle.h> -// 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, - NSFullScreenWindowMask = 1 << 14 -}; -#endif - @interface SPWindowController () - (void)_setUpTabBar; diff --git a/Source/Sequel-Pro.pch b/Source/Sequel-Pro.pch index f3b2fd16..dc6bbf9b 100644 --- a/Source/Sequel-Pro.pch +++ b/Source/Sequel-Pro.pch @@ -32,7 +32,9 @@ // Nearly every class uses constants #import "SPConstants.h" - + + #import "SPCompatibility.h" + // Make all our custom additions available #import "SPCategoryAdditions.h" #endif diff --git a/UnitTests/SPMenuAdditionsTests.m b/UnitTests/SPMenuAdditionsTests.m deleted file mode 100644 index 7e8b5ecc..00000000 --- a/UnitTests/SPMenuAdditionsTests.m +++ /dev/null @@ -1,78 +0,0 @@ -// -// SPMenuAdditionsTests.m -// sequel-pro -// -// Created by Stuart Connolly (stuconnolly.com) on March 20, 2011. -// Copyright (c) 2011 Stuart Connolly. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -// -// More info at <https://github.com/sequelpro/sequelpro> - -#import "SPMenuAdditions.h" - -#import <XCTest/XCTest.h> - -/** - * @class SPMenuAdditionsTests SPMenuAdditionsTests.h - * - * @author Stuart Connolly http://stuconnolly.com/ - * - * SPMenuAdditionsTests tests class. - */ -@interface SPMenuAdditionsTests : XCTestCase -{ - NSMenu *menu; -} - -@end - -static NSString *SPTestMenuItemTitle = @"Menu Item"; - -@implementation SPMenuAdditionsTests - -- (void)setUp -{ - NSUInteger num = 5; - - menu = [[NSMenu alloc] init]; - - for (NSUInteger i = 0; i < num; i++) - { - [menu addItemWithTitle:[NSString stringWithFormat:@"%@ %ld", SPTestMenuItemTitle, (unsigned long)i] action:NULL keyEquivalent:@""]; - } -} - -- (void)tearDown -{ - [menu release], menu = nil; -} - -- (void)testCompatibleRemoveAllItems -{ - [menu compatibleRemoveAllItems]; - - XCTAssertFalse([menu numberOfItems], @"The menu should have no menu items."); -} - -@end - diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj index d7194ef7..4866e18f 100644 --- a/sequel-pro.xcodeproj/project.pbxproj +++ b/sequel-pro.xcodeproj/project.pbxproj @@ -65,7 +65,6 @@ 174CE11E10AB80B5008F892B /* DatabaseProcessList.xib in Resources */ = {isa = PBXBuildFile; fileRef = 174CE11C10AB80B5008F892B /* DatabaseProcessList.xib */; }; 174CE14210AB9281008F892B /* SPProcessListController.m in Sources */ = {isa = PBXBuildFile; fileRef = 174CE14110AB9281008F892B /* SPProcessListController.m */; }; 175EC63512733B36009A7C0F /* SPExportControllerDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 175EC63412733B36009A7C0F /* SPExportControllerDelegate.m */; }; - 1760599F1336199D0098E162 /* SPMenuAdditionsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1760599E1336199D0098E162 /* SPMenuAdditionsTests.m */; }; 1761FD480EF03A6F00331368 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1761FD460EF03A6F00331368 /* MainMenu.xib */; }; 176E14D115570FE300FAF326 /* SPBundleCommandRunner.m in Sources */ = {isa = PBXBuildFile; fileRef = 176E14D015570FE300FAF326 /* SPBundleCommandRunner.m */; }; 177E792E0FCB54EC00E9E122 /* database-small.png in Resources */ = {isa = PBXBuildFile; fileRef = 177E792B0FCB54EC00E9E122 /* database-small.png */; }; @@ -133,7 +132,6 @@ 17D3DC201281816E002A163A /* SPDatabaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 17D3DC1F1281816E002A163A /* SPDatabaseViewController.m */; }; 17D5B49E1553059F00EF3BB3 /* SPViewCopy.m in Sources */ = {isa = PBXBuildFile; fileRef = 17D5B49D1553059F00EF3BB3 /* SPViewCopy.m */; }; 17DB5F441555CA300046834B /* SPMutableArrayAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 1798F19715501838004B0AB8 /* SPMutableArrayAdditions.m */; }; - 17DB5F4A1555CA810046834B /* SPMenuAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 58DC10D212A1B8DF00B76DA5 /* SPMenuAdditions.m */; }; 17DD52B7115071D0007D8950 /* SPPrintTemplate.html in Resources */ = {isa = PBXBuildFile; fileRef = 17DD52B6115071D0007D8950 /* SPPrintTemplate.html */; }; 17DD52C3115074B3007D8950 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 17DD52C1115074B3007D8950 /* InfoPlist.strings */; }; 17DD52C6115074CB007D8950 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 17DD52C4115074CB007D8950 /* Localizable.strings */; }; @@ -415,7 +413,6 @@ 58DA8863103E15B5000B98DF /* SPLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = 58DA8862103E15B5000B98DF /* SPLogger.m */; }; 58DC0D5F1293293400B76DA5 /* ShortcutRecorder.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 58DC0D5E1293293400B76DA5 /* ShortcutRecorder.framework */; }; 58DC0D7C12932AB200B76DA5 /* ShortcutRecorder.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 58DC0D5E1293293400B76DA5 /* ShortcutRecorder.framework */; }; - 58DC10D312A1B8DF00B76DA5 /* SPMenuAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 58DC10D212A1B8DF00B76DA5 /* SPMenuAdditions.m */; }; 58DF9F3315AB26C2003B4330 /* SPDateAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 58DF9F3215AB26C2003B4330 /* SPDateAdditions.m */; }; 58DF9F7315AB8509003B4330 /* SPSplitView.m in Sources */ = {isa = PBXBuildFile; fileRef = 58DF9F7215AB8509003B4330 /* SPSplitView.m */; }; 58DFC91615CB3501003B4330 /* BGHUDButtonCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 58DFC91515CB3501003B4330 /* BGHUDButtonCell.m */; }; @@ -747,7 +744,6 @@ 175EC63312733B36009A7C0F /* SPExportControllerDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPExportControllerDelegate.h; sourceTree = "<group>"; }; 175EC63412733B36009A7C0F /* SPExportControllerDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPExportControllerDelegate.m; sourceTree = "<group>"; }; 175EC64C12733CDF009A7C0F /* SPCategoryAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPCategoryAdditions.h; sourceTree = "<group>"; }; - 1760599E1336199D0098E162 /* SPMenuAdditionsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPMenuAdditionsTests.m; sourceTree = "<group>"; }; 1761FD470EF03A6F00331368 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = "<group>"; }; 1761FD9D0EF0488900331368 /* build-version.pl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = "build-version.pl"; sourceTree = "<group>"; }; 176E14CF15570FE300FAF326 /* SPBundleCommandRunner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPBundleCommandRunner.h; sourceTree = "<group>"; }; @@ -999,6 +995,7 @@ 50837F731E50DCD4004FAE8A /* SPJSONFormatterTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPJSONFormatterTests.m; sourceTree = "<group>"; }; 5089B0251BE714E300E226CD /* SPIdMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPIdMenu.h; sourceTree = "<group>"; }; 5089B0261BE714E300E226CD /* SPIdMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPIdMenu.m; sourceTree = "<group>"; }; + 50A77DA61E8EB903007466BC /* SPCompatibility.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SPCompatibility.h; sourceTree = "<group>"; }; 50A9F8AF19EAD4B90053E571 /* SPGotoDatabaseController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPGotoDatabaseController.h; sourceTree = "<group>"; }; 50A9F8B019EAD4B90053E571 /* SPGotoDatabaseController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPGotoDatabaseController.m; sourceTree = "<group>"; }; 50D3C34A1A75B8A800B5429C /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/GotoDatabaseDialog.xib; sourceTree = "<group>"; }; @@ -1219,8 +1216,6 @@ 58DA8861103E15B5000B98DF /* SPLogger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPLogger.h; sourceTree = "<group>"; }; 58DA8862103E15B5000B98DF /* SPLogger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPLogger.m; sourceTree = "<group>"; }; 58DC0D5E1293293400B76DA5 /* ShortcutRecorder.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ShortcutRecorder.framework; path = Frameworks/ShortcutRecorder.framework; sourceTree = "<group>"; }; - 58DC10D112A1B8DF00B76DA5 /* SPMenuAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPMenuAdditions.h; sourceTree = "<group>"; }; - 58DC10D212A1B8DF00B76DA5 /* SPMenuAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPMenuAdditions.m; sourceTree = "<group>"; }; 58DF9F3115AB26C2003B4330 /* SPDateAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPDateAdditions.h; sourceTree = "<group>"; }; 58DF9F3215AB26C2003B4330 /* SPDateAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPDateAdditions.m; sourceTree = "<group>"; }; 58DF9F7115AB8509003B4330 /* SPSplitView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPSplitView.h; sourceTree = "<group>"; }; @@ -2036,7 +2031,6 @@ isa = PBXGroup; children = ( 380F4EF40FC0B68F00B0BFD7 /* SPStringAdditionsTests.m */, - 1760599E1336199D0098E162 /* SPMenuAdditionsTests.m */, 1798F1C2155018D4004B0AB8 /* SPMutableArrayAdditionsTests.m */, 502D21F51BA50710000D4CE7 /* SPDataAdditionsTests.m */, ); @@ -2507,6 +2501,7 @@ 507FF1111BBCC57600104523 /* SPFunctions.m */, 5089B0251BE714E300E226CD /* SPIdMenu.h */, 5089B0261BE714E300E226CD /* SPIdMenu.m */, + 50A77DA61E8EB903007466BC /* SPCompatibility.h */, ); name = Utility; sourceTree = "<group>"; @@ -2716,8 +2711,6 @@ B52460D40F8EF92300171639 /* SPArrayAdditions.m */, 1789343A0F30C1DD0097539A /* SPStringAdditions.h */, 1789343B0F30C1DD0097539A /* SPStringAdditions.m */, - 58DC10D112A1B8DF00B76DA5 /* SPMenuAdditions.h */, - 58DC10D212A1B8DF00B76DA5 /* SPMenuAdditions.m */, 584D878915140FEB00F24774 /* SPObjectAdditions.h */, 584D878A15140FEB00F24774 /* SPObjectAdditions.m */, B52460D50F8EF92300171639 /* SPTextViewAdditions.h */, @@ -3240,10 +3233,8 @@ 50EA92641AB23EAD008D3C4F /* SPDatabaseCopy.m in Sources */, 50D3C35D1A77217800B5429C /* SPParserUtils.c in Sources */, 380F4EF50FC0B68F00B0BFD7 /* SPStringAdditionsTests.m in Sources */, - 1760599F1336199D0098E162 /* SPMenuAdditionsTests.m in Sources */, 1798F1C4155018E2004B0AB8 /* SPMutableArrayAdditionsTests.m in Sources */, 17DB5F441555CA300046834B /* SPMutableArrayAdditions.m in Sources */, - 17DB5F4A1555CA810046834B /* SPMenuAdditions.m in Sources */, 1717F9661557E0450065C036 /* SPStringAdditions.m in Sources */, 1717FA401558313A0065C036 /* RegexKitLite.m in Sources */, 50D3C35C1A771C4C00B5429C /* SPParserUtilsTest.m in Sources */, @@ -3467,7 +3458,6 @@ BC68BFC7128D4EAE004907D9 /* SPBundleEditorController.m in Sources */, BC1944D01297291800A236CD /* SPBundleCommandTextView.m in Sources */, BC77C5E4129AA69E009AD832 /* SPBundleHTMLOutputController.m in Sources */, - 58DC10D312A1B8DF00B76DA5 /* SPMenuAdditions.m in Sources */, BC5750D512A6233900911BA2 /* SPActivityTextFieldCell.m in Sources */, BC0ED3DA12A9196C00088461 /* SPChooseMenuItemDialog.m in Sources */, 583CA21512EC8B2200C9E763 /* SPWindow.m in Sources */, |