diff options
author | Max <post@wickenrode.com> | 2015-06-19 17:18:14 +0200 |
---|---|---|
committer | Max <post@wickenrode.com> | 2015-06-19 17:18:14 +0200 |
commit | ce3353422006e927be3005123223c20d8e09b539 (patch) | |
tree | 1396cd43645956111e5d170347ab259966da8fae | |
parent | 2627c5f491759276ca8bbd708c405556772021c6 (diff) | |
download | sequelpro-ce3353422006e927be3005123223c20d8e09b539.tar.gz sequelpro-ce3353422006e927be3005123223c20d8e09b539.tar.bz2 sequelpro-ce3353422006e927be3005123223c20d8e09b539.zip |
Use find bar in field editor on 10.7+
This will IMHO obliberate the need for the field editor to become a main window and avoid the UI clash from #2148
-rw-r--r-- | Source/SPFieldEditorController.m | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m index fbba1a4b..9ffe395f 100644 --- a/Source/SPFieldEditorController.m +++ b/Source/SPFieldEditorController.m @@ -40,6 +40,13 @@ #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, @@ -93,9 +100,18 @@ typedef enum { // Allow the user to enter cmd+return to close the edit sheet in addition to fn+return [editSheetOkButton setKeyEquivalentModifierMask:NSCommandKeyMask]; - // Permit the field edit sheet to become main if necessary; this allows fields within the sheet to - // support full interactivity, for example use of the NSFindPanel inside NSTextViews. - [editSheet setIsSheetWhichCanBecomeMain:YES]; + if([editTextView respondsToSelector:@selector(setUsesFindBar:)]) + // 10.7+ + // Stealing the main window from the actual main window will cause + // a UI bug with the tab bar and the find panel was really the only + // thing that had an issue with not working with sheets. + // The find bar works fine without hackery. + [editTextView setUsesFindBar:YES]; + else { + // Permit the field edit sheet to become main if necessary; this allows fields within the sheet to + // support full interactivity, for example use of the NSFindPanel inside NSTextViews. + [editSheet setIsSheetWhichCanBecomeMain:YES]; + } allowUndo = NO; selectionChanged = NO; |