diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-10-29 22:52:44 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-10-29 22:52:44 +0000 |
commit | 8a061fc1d3903ca61ab6287ce822ab8d500ce4bb (patch) | |
tree | 217ed443792333a0c8d1f900760714a672be6691 | |
parent | c9b0e698e7d2bcdbe7257555f54de62241db0531 (diff) | |
download | sequelpro-8a061fc1d3903ca61ab6287ce822ab8d500ce4bb.tar.gz sequelpro-8a061fc1d3903ca61ab6287ce822ab8d500ce4bb.tar.bz2 sequelpro-8a061fc1d3903ca61ab6287ce822ab8d500ce4bb.zip |
• enabled Find Panel inside Field Editor Sheet's textView
- to enable Find Panel in such a NSTextView which will be displayed in a sheet one has to do the following:
* [main problem is that Find Panel validates its buttons against [[NSApp mainWindow] firstResponder] == NSTextView]
* subclass the NSTextView and add the methods becomeFirstResponder and resignFirstResponder which has to return YES
* since the last first responder remains the first mainWindow responder status one has to set [[NSApp mainWindow] makeFirstResponder:theTextView] directly after displaying the sheet
• corrected SPUserManager message in (IBAction)removeHost:
-rw-r--r-- | Source/SPCustomQuery.m | 17 | ||||
-rw-r--r-- | Source/SPEditSheetTextView.m | 17 | ||||
-rw-r--r-- | Source/SPFieldEditorController.m | 9 | ||||
-rw-r--r-- | Source/SPUserManager.m | 2 |
4 files changed, 32 insertions, 13 deletions
diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m index 41a6b62f..1a7eeffe 100644 --- a/Source/SPCustomQuery.m +++ b/Source/SPCustomQuery.m @@ -2319,11 +2319,6 @@ [NSNumber numberWithBool:isFieldEditable], @"isFieldEditable", nil]]; - // Preserve focus and restore selection indexes if appropriate - [[tableDocumentInstance parentWindow] makeFirstResponder:customQueryView]; - if (selectionIndexToRestore) - [customQueryView selectRowIndexes:selectionIndexToRestore byExtendingSelection:NO]; - return NO; } @@ -3418,12 +3413,6 @@ NSUInteger column = [[contextInfo objectForKey:@"column"] integerValue]; BOOL isFieldEditable = ([contextInfo objectForKey:@"isFieldEditable"]) ? YES : NO; - // if ([data isKindOfClass:[NSString class]] - // && [data isEqualToString:[prefs objectForKey:SPNullValue]] - // && [[NSArrayObjectAtIndex(dataColumns, column) objectForKey:@"null"] boolValue]) - // { - // data = [[NSNull null] retain]; - // } if(isFieldEditable) { [self tableView:customQueryView setObjectValue:[[data copy] autorelease] forTableColumn:[customQueryView tableColumnWithIdentifier:[contextInfo objectForKey:@"column"]] row:row]; } @@ -3434,7 +3423,11 @@ fieldEditor = nil; } - // [[tableDocumentInstance parentWindow] makeFirstResponder:tableContentView]; + // Preserve focus and restore selection indexes if appropriate + [[tableDocumentInstance parentWindow] makeFirstResponder:customQueryView]; + if (selectionIndexToRestore) + [customQueryView selectRowIndexes:selectionIndexToRestore byExtendingSelection:NO]; + } #pragma mark - diff --git a/Source/SPEditSheetTextView.m b/Source/SPEditSheetTextView.m index e46868b7..ab6530e9 100644 --- a/Source/SPEditSheetTextView.m +++ b/Source/SPEditSheetTextView.m @@ -327,4 +327,21 @@ [self saveChangedFontInUserDefaults]; } +/** + * Needed to allow Find Panel inside the textView if it runs in a sheet + */ +- (BOOL)becomeFirstResponder +{ + return YES; +} + +/** + * Needed to allow Find Panel inside the textView if it runs in a sheet + */ +- (BOOL)resignFirstResponder +{ + return YES; +} + + @end diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m index b8b250ce..05266381 100644 --- a/Source/SPFieldEditorController.m +++ b/Source/SPFieldEditorController.m @@ -423,6 +423,14 @@ [editSheetProgressBar stopAnimation:self]; + // The field editor sheet runs as sheet thus a NSTextView won't respond to the Find Panel + // since the Find Panel validate its buttons against [[NSApp mainWindow] firstResponder] == NSTextView. + // After ordering out this sheet SPCopyTable remains the first responder thus set it hard. + // This only works in conjunction with [NSTextView becomeFirstResponder] and [NSTextView resignFirstResponder] + // which has to return YES. + if([[self window] firstResponder] == editTextView) + [[NSApp mainWindow] makeFirstResponder:[[self window] firstResponder]]; + } } @@ -507,6 +515,7 @@ [hexTextView setHidden:YES]; [hexTextScrollView setHidden:YES]; [usedSheet makeFirstResponder:editTextView]; + [[NSApp mainWindow] makeFirstResponder:editTextView]; break; case 1: // image [editTextView setHidden:YES]; diff --git a/Source/SPUserManager.m b/Source/SPUserManager.m index f947568e..d8851c3c 100644 --- a/Source/SPUserManager.m +++ b/Source/SPUserManager.m @@ -739,7 +739,7 @@ static const NSString *SPTableViewNameColumnID = @"NameColumn"; { SPBeginAlertSheet(NSLocalizedString(@"Unable to remove host", @"error removing host message"), NSLocalizedString(@"OK", @"OK button"), nil, nil, [self window], self, nil, nil, - NSLocalizedString(@"This user doesn't seem have any hosts associated with it. The user will be removed unless one is added", @"error removing host informative message")); + NSLocalizedString(@"This user doesn't seem to have any associated hosts and will be removed unless a host is added.", @"error removing host informative message")); } } |