diff options
author | rowanbeentje <rowan@beent.je> | 2012-04-24 00:05:50 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2012-04-24 00:05:50 +0000 |
commit | 76d1d9d7fe2046bcf9281f95c5a7b541d49e6a0b (patch) | |
tree | a582f71ba9e26440db2b4aa28a24f0824796239e /Source/SPWindow.m | |
parent | 3b079c8d06ee5676190c9f11aec3b64f4631b048 (diff) | |
download | sequelpro-76d1d9d7fe2046bcf9281f95c5a7b541d49e6a0b.tar.gz sequelpro-76d1d9d7fe2046bcf9281f95c5a7b541d49e6a0b.tar.bz2 sequelpro-76d1d9d7fe2046bcf9281f95c5a7b541d49e6a0b.zip |
- Rework edit sheet find/replace handling; instead of altering the main window's firstResponder, which only worked under certain NSTextView focus conditions, allow the field edit sheet to become the main window. This fixes issues with the Find/Replace dialog not fully working correctly in the edit sheet.
Diffstat (limited to 'Source/SPWindow.m')
-rw-r--r-- | Source/SPWindow.m | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Source/SPWindow.m b/Source/SPWindow.m index 9353e80d..213d7740 100644 --- a/Source/SPWindow.m +++ b/Source/SPWindow.m @@ -27,6 +27,8 @@ @implementation SPWindow +@synthesize isSheetWhichCanBecomeMain; + #pragma mark - #pragma mark Keyboard shortcut additions @@ -115,6 +117,9 @@ [super sendEvent:theEvent]; } +#pragma mark - +#pragma mark Undo manager handling + /** * If this window is controlled by an SPWindowController, and thus supports being asked * for the frontmost SPTableDocument, request the undoController for that table @@ -129,4 +134,27 @@ return [super undoManager]; } +#pragma mark - +#pragma mark Method overrides + +/** + * Allow sheets to become main if necessary, for example if they are acting as an + * editor for a window. + */ +- (BOOL)canBecomeMainWindow +{ + + // If this window is a sheet which is permitted to become main, respond appropriately + if ([self isSheet] && isSheetWhichCanBecomeMain) { + return [self isVisible]; + } + + // Otherwise, if this window has a sheet attached which can become main, return NO. + if ([[self attachedSheet] isKindOfClass:[SPWindow class]] && [(SPWindow *)[self attachedSheet] isSheetWhichCanBecomeMain]) { + return NO; + } + + return [super canBecomeMainWindow]; +} + @end |