Skip to content

Commit ce33534

Browse files
committed
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
1 parent 2627c5f commit ce33534

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

Source/SPFieldEditorController.m

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@
4040

4141
#import <SPMySQL/SPMySQL.h>
4242

43+
#if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_7
44+
@interface NSTextView (LionPlus)
45+
- (void)setUsesFindBar:(BOOL)value;
46+
- (BOOL)usesFindBar;
47+
@end
48+
#endif
49+
4350
typedef enum {
4451
TextSegment = 0,
4552
ImageSegment,
@@ -93,9 +100,18 @@ - (id)init
93100
// Allow the user to enter cmd+return to close the edit sheet in addition to fn+return
94101
[editSheetOkButton setKeyEquivalentModifierMask:NSCommandKeyMask];
95102

96-
// Permit the field edit sheet to become main if necessary; this allows fields within the sheet to
97-
// support full interactivity, for example use of the NSFindPanel inside NSTextViews.
98-
[editSheet setIsSheetWhichCanBecomeMain:YES];
103+
if([editTextView respondsToSelector:@selector(setUsesFindBar:)])
104+
// 10.7+
105+
// Stealing the main window from the actual main window will cause
106+
// a UI bug with the tab bar and the find panel was really the only
107+
// thing that had an issue with not working with sheets.
108+
// The find bar works fine without hackery.
109+
[editTextView setUsesFindBar:YES];
110+
else {
111+
// Permit the field edit sheet to become main if necessary; this allows fields within the sheet to
112+
// support full interactivity, for example use of the NSFindPanel inside NSTextViews.
113+
[editSheet setIsSheetWhichCanBecomeMain:YES];
114+
}
99115

100116
allowUndo = NO;
101117
selectionChanged = NO;

0 commit comments

Comments
 (0)