diff options
author | stuconnolly <stuart02@gmail.com> | 2012-04-29 10:08:52 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2012-04-29 10:08:52 +0000 |
commit | fb3b03a7d96870cc3829a8c1d01b37267866e8e7 (patch) | |
tree | 6ec3239fcdf8085273c53359e0a6ea58ed421706 /Source | |
parent | 4cad6f0e6e4fb497b480256c2abe3de34ebf225c (diff) | |
download | sequelpro-fb3b03a7d96870cc3829a8c1d01b37267866e8e7.tar.gz sequelpro-fb3b03a7d96870cc3829a8c1d01b37267866e8e7.tar.bz2 sequelpro-fb3b03a7d96870cc3829a8c1d01b37267866e8e7.zip |
Bring outline view branch up to date with trunk (r3586:r3592).
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPEditSheetTextView.m | 17 | ||||
-rw-r--r-- | Source/SPExportFilenameUtilities.m | 28 | ||||
-rw-r--r-- | Source/SPExtendedTableInfo.m | 1 | ||||
-rw-r--r-- | Source/SPFieldEditorController.h | 3 | ||||
-rw-r--r-- | Source/SPFieldEditorController.m | 17 | ||||
-rw-r--r-- | Source/SPNarrowDownCompletion.m | 2 | ||||
-rw-r--r-- | Source/SPWindow.h | 5 | ||||
-rw-r--r-- | Source/SPWindow.m | 28 |
8 files changed, 59 insertions, 42 deletions
diff --git a/Source/SPEditSheetTextView.m b/Source/SPEditSheetTextView.m index b028c177..a5d110a6 100644 --- a/Source/SPEditSheetTextView.m +++ b/Source/SPEditSheetTextView.m @@ -343,21 +343,4 @@ [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/SPExportFilenameUtilities.m b/Source/SPExportFilenameUtilities.m index ad5ab36b..1f37a561 100644 --- a/Source/SPExportFilenameUtilities.m +++ b/Source/SPExportFilenameUtilities.m @@ -65,32 +65,38 @@ BOOL isCSV = exportType == SPCSVExport; BOOL isDot = exportType == SPDotExport; BOOL isXML = exportType == SPXMLExport; - - NSString *tokens = NSLocalizedString(@"host,database,table,date,year,month,day,time", @"default custom export filename tokens");; - NSString *tokensWithoutTable = NSLocalizedString(@"host,database,date,year,month,day,time", @"custom export filename tokens without table"); - + + NSMutableArray *exportTokens = [NSMutableArray arrayWithObjects: + NSLocalizedString(@"host", @"export filename host token"), + NSLocalizedString(@"database", @"export filename database token"), + NSLocalizedString(@"table", @"table"), + NSLocalizedString(@"date", @"export filename date token"), + NSLocalizedString(@"year", @"export filename date token"), + NSLocalizedString(@"month", @"export filename date token"), + NSLocalizedString(@"day", @"export filename date token"), + NSLocalizedString(@"time", @"export filename time token"), + nil]; + + // Determine whether to remove the table from the tokens list if (exportSource == SPQueryExport || isDot) { - tokens = tokensWithoutTable; + removeTable = YES; } else if (isSQL || isCSV || isXML) { for (NSArray *table in tables) { if ([NSArrayObjectAtIndex(table, 2) boolValue]) { i++; - removeTable = YES; - if (i == 2) break; } } if (i > 1) { removeTable = isSQL ? YES : ![exportFilePerTableCheck state]; - - tokens = isSQL ? tokensWithoutTable : ([exportFilePerTableCheck state] ? tokens : tokensWithoutTable); } } if (removeTable) { + [exportTokens removeObject:NSLocalizedString(@"table", @"table")]; NSArray *tokenParts = [exportCustomFilenameTokenField objectValue]; for (id token in [exportCustomFilenameTokenField objectValue]) @@ -107,8 +113,8 @@ } } } - - [exportCustomFilenameTokensField setStringValue:tokens]; + + [exportCustomFilenameTokensField setStringValue:[exportTokens componentsJoinedByString:@","]]; } /** diff --git a/Source/SPExtendedTableInfo.m b/Source/SPExtendedTableInfo.m index 23f3c426..260c90fd 100644 --- a/Source/SPExtendedTableInfo.m +++ b/Source/SPExtendedTableInfo.m @@ -526,6 +526,7 @@ static NSString *SPUpdateTableTypeNewType = @"SPUpdateTableTypeNewType"; */ - (void)confirmChangeTableTypeDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(NSDictionary *)contextInfo { + [[alert window] orderOut:self]; if (returnCode == NSAlertDefaultReturn) { [self _changeCurrentTableTypeFrom:[contextInfo objectForKey:SPUpdateTableTypeCurrentType] to:[contextInfo objectForKey:SPUpdateTableTypeNewType]]; diff --git a/Source/SPFieldEditorController.h b/Source/SPFieldEditorController.h index f45b6070..da78785b 100644 --- a/Source/SPFieldEditorController.h +++ b/Source/SPFieldEditorController.h @@ -22,6 +22,7 @@ // // More info at <http://code.google.com/p/sequel-pro/> +@class SPWindow; /** * @class SPFieldEditorController SPFieldEditorController.h @@ -45,7 +46,7 @@ IBOutlet id hexTextView; IBOutlet id editTextScrollView; IBOutlet id hexTextScrollView; - IBOutlet id editSheet; + IBOutlet SPWindow *editSheet; IBOutlet id editSheetCancelButton; IBOutlet id editSheetIsNotEditableCancelButton; IBOutlet id editSheetOkButton; diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m index 3a4ee14c..f94af537 100644 --- a/Source/SPFieldEditorController.m +++ b/Source/SPFieldEditorController.m @@ -32,6 +32,7 @@ #import "SPTooltip.h" #import "SPGeometryDataView.h" #import "SPCopyTable.h" +#import "SPWindow.h" #include <objc/objc-runtime.h> #import "SPCustomQuery.h" #import "SPTableContent.h" @@ -85,6 +86,10 @@ // 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]; + allowUndo = NO; selectionChanged = NO; @@ -431,19 +436,7 @@ editSheetWillBeInitialized = NO; [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. -#ifndef SP_REFACTOR - if([[self window] firstResponder] == editTextView) - [[NSApp mainWindow] makeFirstResponder:[[self window] firstResponder]]; -#endif - } - } /** diff --git a/Source/SPNarrowDownCompletion.m b/Source/SPNarrowDownCompletion.m index db3f5e3a..76336069 100644 --- a/Source/SPNarrowDownCompletion.m +++ b/Source/SPNarrowDownCompletion.m @@ -862,7 +862,7 @@ break; } } - else if(key == NSCarriageReturnCharacter || (key == NSTabCharacter && !triggerMode)) + else if(key == NSCarriageReturnCharacter || key == NSEnterCharacter || key == NSRightArrowFunctionKey || (key == NSTabCharacter && !triggerMode)) { [self completeAndInsertSnippet]; } diff --git a/Source/SPWindow.h b/Source/SPWindow.h index 74c4f804..9809f3d3 100644 --- a/Source/SPWindow.h +++ b/Source/SPWindow.h @@ -25,5 +25,10 @@ #import <Cocoa/Cocoa.h> @interface SPWindow : NSWindow +{ + BOOL isSheetWhichCanBecomeMain; +} + +@property (assign) BOOL isSheetWhichCanBecomeMain; @end diff --git a/Source/SPWindow.m b/Source/SPWindow.m index 0285ce8a..d023b7b4 100644 --- a/Source/SPWindow.m +++ b/Source/SPWindow.m @@ -27,6 +27,8 @@ @implementation SPWindow +@synthesize isSheetWhichCanBecomeMain; + #pragma mark - #pragma mark Keyboard shortcut additions @@ -116,6 +118,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 @@ -130,4 +135,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 |