diff options
Diffstat (limited to 'Source')
51 files changed, 259 insertions, 186 deletions
diff --git a/Source/GeneratePreviewForURL.m b/Source/GeneratePreviewForURL.m index e72f8d9b..60e5d80c 100644 --- a/Source/GeneratePreviewForURL.m +++ b/Source/GeneratePreviewForURL.m @@ -28,7 +28,6 @@ #include <QuickLook/QuickLook.h> #import "SPDataAdditions.h" -#import "SPStringAdditions.h" #import "SPEditorTokens.h" /* ----------------------------------------------------------------------------- diff --git a/Source/NSNotificationAdditions.h b/Source/NSNotificationAdditions.h index d11f6185..d1903da5 100644 --- a/Source/NSNotificationAdditions.h +++ b/Source/NSNotificationAdditions.h @@ -25,11 +25,11 @@ @interface NSNotificationCenter (NSNotificationCenterAdditions) -- (void) postNotificationOnMainThread:(NSNotification *) notification; -- (void) postNotificationOnMainThread:(NSNotification *) notification waitUntilDone:(BOOL) wait; +- (void)postNotificationOnMainThread:(NSNotification *)notification; +- (void)postNotificationOnMainThread:(NSNotification *)notification waitUntilDone:(BOOL)wait; -- (void) postNotificationOnMainThreadWithName:(NSString *) name object:(id) object; -- (void) postNotificationOnMainThreadWithName:(NSString *) name object:(id) object userInfo:(NSDictionary *) userInfo; -- (void) postNotificationOnMainThreadWithName:(NSString *) name object:(id) object userInfo:(NSDictionary *) userInfo waitUntilDone:(BOOL) wait; +- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object; +- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo; +- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo waitUntilDone:(BOOL)wait; @end diff --git a/Source/NSNotificationAdditions.m b/Source/NSNotificationAdditions.m index 78233de4..53917dae 100644 --- a/Source/NSNotificationAdditions.m +++ b/Source/NSNotificationAdditions.m @@ -28,48 +28,62 @@ @implementation NSNotificationCenter (NSNotificationCenterAdditions) -- (void) postNotificationOnMainThread:(NSNotification *) notification { - if( pthread_main_np() ) return [self postNotification:notification]; +- (void)postNotificationOnMainThread:(NSNotification *)notification +{ + if (pthread_main_np()) return [self postNotification:notification]; + [self postNotificationOnMainThread:notification waitUntilDone:NO]; } -- (void) postNotificationOnMainThread:(NSNotification *) notification waitUntilDone:(BOOL) wait { - if( pthread_main_np() ) return [self postNotification:notification]; - [[self class] performSelectorOnMainThread:@selector( _postNotification: ) withObject:notification waitUntilDone:wait]; +- (void)postNotificationOnMainThread:(NSNotification *)notification waitUntilDone:(BOOL)wait +{ + if (pthread_main_np()) return [self postNotification:notification]; + + [[self class] performSelectorOnMainThread:@selector(_postNotification:) withObject:notification waitUntilDone:wait]; } -+ (void) _postNotification:(NSNotification *) notification { ++ (void)_postNotification:(NSNotification *)notification +{ [[self defaultCenter] postNotification:notification]; } -- (void) postNotificationOnMainThreadWithName:(NSString *) name object:(id) object { - if( pthread_main_np() ) return [self postNotificationName:name object:object userInfo:nil]; +- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object +{ + if (pthread_main_np()) return [self postNotificationName:name object:object userInfo:nil]; + [self postNotificationOnMainThreadWithName:name object:object userInfo:nil waitUntilDone:NO]; } -- (void) postNotificationOnMainThreadWithName:(NSString *) name object:(id) object userInfo:(NSDictionary *) userInfo { - if( pthread_main_np() ) return [self postNotificationName:name object:object userInfo:userInfo]; +- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo +{ + if(pthread_main_np()) return [self postNotificationName:name object:object userInfo:userInfo]; + [self postNotificationOnMainThreadWithName:name object:object userInfo:userInfo waitUntilDone:NO]; } -- (void) postNotificationOnMainThreadWithName:(NSString *) name object:(id) object userInfo:(NSDictionary *) userInfo waitUntilDone:(BOOL) wait { - if( pthread_main_np() ) return [self postNotificationName:name object:object userInfo:userInfo]; - +- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo waitUntilDone:(BOOL)wait +{ + if (pthread_main_np()) return [self postNotificationName:name object:object userInfo:userInfo]; + NSMutableDictionary *info = [[NSMutableDictionary allocWithZone:nil] initWithCapacity:3]; - if( name ) [info setObject:name forKey:@"name"]; - if( object ) [info setObject:object forKey:@"object"]; - if( userInfo ) [info setObject:userInfo forKey:@"userInfo"]; - - [[self class] performSelectorOnMainThread:@selector( _postNotificationName: ) withObject:info waitUntilDone:wait]; - + + if (name) [info setObject:name forKey:@"name"]; + if (object) [info setObject:object forKey:@"object"]; + if (userInfo) [info setObject:userInfo forKey:@"userInfo"]; + + [[self class] performSelectorOnMainThread:@selector(_postNotificationName:) withObject:info waitUntilDone:wait]; + [info release]; } -+ (void) _postNotificationName:(NSDictionary *) info { ++ (void)_postNotificationName:(NSDictionary *)info +{ NSString *name = [info objectForKey:@"name"]; + id object = [info objectForKey:@"object"]; + NSDictionary *userInfo = [info objectForKey:@"userInfo"]; - + [[self defaultCenter] postNotificationName:name object:object userInfo:userInfo]; } diff --git a/Source/NoodleLineNumberView.m b/Source/NoodleLineNumberView.m index 5b13cab2..0bb9b25e 100644 --- a/Source/NoodleLineNumberView.m +++ b/Source/NoodleLineNumberView.m @@ -31,7 +31,6 @@ // functionality and adds selection by clicking on the ruler. #import "NoodleLineNumberView.h" -#import "SPArrayAdditions.h" #include <tgmath.h> diff --git a/Source/SPAlertSheets.m b/Source/SPAlertSheets.m index 8f6a21fd..3299c351 100644 --- a/Source/SPAlertSheets.m +++ b/Source/SPAlertSheets.m @@ -22,8 +22,6 @@ // // More info at <http://code.google.com/p/sequel-pro/> -#import "SPMainThreadTrampoline.h" - /** * Provide a simple alias of NSBeginAlertSheet, with a few differences: * - printf-type format strings are no longer supported within the "msg" diff --git a/Source/SPArrayAdditions.m b/Source/SPArrayAdditions.m index e7ad01fe..7cc5bb4e 100644 --- a/Source/SPArrayAdditions.m +++ b/Source/SPArrayAdditions.m @@ -23,7 +23,6 @@ // More info at <http://code.google.com/p/sequel-pro/> #import "SPArrayAdditions.h" -#import "SPStringAdditions.h" @implementation NSArray (SPArrayAdditions) diff --git a/Source/SPCSVExporter.m b/Source/SPCSVExporter.m index 132d181b..c874e9aa 100644 --- a/Source/SPCSVExporter.m +++ b/Source/SPCSVExporter.m @@ -26,8 +26,6 @@ #import <MCPKit/MCPKit.h> #import "SPCSVExporter.h" -#import "SPArrayAdditions.h" -#import "SPStringAdditions.h" #import "SPFileHandle.h" #import "SPTableData.h" #import "SPExportUtilities.h" diff --git a/Source/SPCSVExporterDelegate.m b/Source/SPCSVExporterDelegate.m index 6a0127c3..226dea8d 100644 --- a/Source/SPCSVExporterDelegate.m +++ b/Source/SPCSVExporterDelegate.m @@ -28,7 +28,6 @@ #import "SPCSVExporter.h" #import "SPCSVExporterDelegate.h" #import "SPDatabaseDocument.h" -#import "SPMainThreadTrampoline.h" #import "SPFileHandle.h" @implementation SPExportController (SPCSVExporterDelegate) diff --git a/Source/SPCSVParser.m b/Source/SPCSVParser.m index e4755a7e..f1e63c72 100644 --- a/Source/SPCSVParser.m +++ b/Source/SPCSVParser.m @@ -24,7 +24,6 @@ // More info at <http://code.google.com/p/sequel-pro/> #import "SPCSVParser.h" -#import "SPNotLoaded.h" /** * Please see the header files for a general description of the purpose of this class. diff --git a/Source/SPCategoryAdditions.h b/Source/SPCategoryAdditions.h new file mode 100644 index 00000000..f1d6b6a2 --- /dev/null +++ b/Source/SPCategoryAdditions.h @@ -0,0 +1,43 @@ +// +// $Id$ +// +// SPCategoryAdditions.h +// sequel-pro +// +// Created by Stuart Connolly (stuconnolly.com) on October 23, 2010 +// Copyright (c) 2010 Stuart Connolly. All rights reserved. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// More info at <http://code.google.com/p/sequel-pro/> + +/** + * This header is intended to import all of our custom category additions to classes outwith our control. + * It is subsequently included in Sequel Pro's precompiled header making all of the additional methods/functions + * included in header available to all classes within the application. + */ + +#import "SPArrayAdditions.h" +#import "SPStringAdditions.h" +#import "SPTextViewAdditions.h" +#import "SPWindowAdditions.h" +#import "SPDataAdditions.h" +#import "SPNotLoaded.h" +#import "SPMainThreadTrampoline.h" +#import "SPColorAdditions.h" +#import "SPFileManagerAdditions.h" + +#import "NSNotificationAdditions.h" +#import "NSMutableArray-MultipleSort.h" diff --git a/Source/SPCopyTable.m b/Source/SPCopyTable.m index 41ca1b65..c8a32f00 100644 --- a/Source/SPCopyTable.m +++ b/Source/SPCopyTable.m @@ -25,13 +25,10 @@ #import <MCPKit/MCPKit.h> #import "SPCopyTable.h" -#import "SPArrayAdditions.h" -#import "SPStringAdditions.h" #import "SPTableContent.h" #import "SPTableTriggers.h" #import "SPTableRelations.h" #import "SPCustomQuery.h" -#import "SPNotLoaded.h" #import "SPDataStorage.h" #import "SPTextAndLinkCell.h" diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m index 151e2340..02822f92 100644 --- a/Source/SPCustomQuery.m +++ b/Source/SPCustomQuery.m @@ -26,10 +26,6 @@ #import "SPCustomQuery.h" #import "SPSQLParser.h" #import "SPGrowlController.h" -#import "SPStringAdditions.h" -#import "SPTextViewAdditions.h" -#import "SPArrayAdditions.h" -#import "SPDataAdditions.h" #import "SPDataCellFormatter.h" #import "SPDatabaseDocument.h" #import "SPTablesList.h" @@ -42,7 +38,6 @@ #import "SPEncodingPopupAccessory.h" #import "SPDataStorage.h" #import "SPAlertSheets.h" -#import "SPMainThreadTrampoline.h" #import "SPCopyTable.h" #import "SPGeometryDataView.h" diff --git a/Source/SPDataImport.m b/Source/SPDataImport.m index 61698b46..5fafe4a4 100644 --- a/Source/SPDataImport.m +++ b/Source/SPDataImport.m @@ -33,13 +33,9 @@ #import "SPSQLParser.h" #import "SPCSVParser.h" #import "SPTableData.h" -#import "SPStringAdditions.h" -#import "SPArrayAdditions.h" #import "RegexKitLite.h" #import "SPAlertSheets.h" #import "SPFieldMapperController.h" -#import "SPMainThreadTrampoline.h" -#import "SPNotLoaded.h" #import "SPFileHandle.h" #import "SPEncodingPopupAccessory.h" diff --git a/Source/SPDatabaseData.m b/Source/SPDatabaseData.m index 73fcfe74..21993d95 100644 --- a/Source/SPDatabaseData.m +++ b/Source/SPDatabaseData.m @@ -24,7 +24,6 @@ // More info at <http://code.google.com/p/sequel-pro/> #import "SPDatabaseData.h" -#import "SPStringAdditions.h" #import "SPServerSupport.h" #import "SPDatabaseCharacterSets.h" diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index f8b74a86..914ab259 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -39,9 +39,6 @@ #import "SPSQLParser.h" #import "SPTableData.h" #import "SPDatabaseData.h" -#import "SPStringAdditions.h" -#import "SPArrayAdditions.h" -#import "SPDataAdditions.h" #import "SPAppController.h" #import "SPExtendedTableInfo.h" #import "SPConnectionController.h" @@ -53,7 +50,6 @@ #import "SPProcessListController.h" #import "SPServerVariablesController.h" #import "SPAlertSheets.h" -#import "SPMainThreadTrampoline.h" #import "SPLogger.h" #import "SPDatabaseCopy.h" #import "SPTableCopy.h" diff --git a/Source/SPDotExporter.m b/Source/SPDotExporter.m index c2e81862..9db34a7c 100644 --- a/Source/SPDotExporter.m +++ b/Source/SPDotExporter.m @@ -25,7 +25,6 @@ #import "SPDotExporter.h" #import "SPFileHandle.h" -#import "SPArrayAdditions.h" #import "SPTableData.h" #import "SPExportUtilities.h" diff --git a/Source/SPDotExporterDelegate.m b/Source/SPDotExporterDelegate.m index 6d1b8954..ceb24354 100644 --- a/Source/SPDotExporterDelegate.m +++ b/Source/SPDotExporterDelegate.m @@ -26,7 +26,6 @@ #import "SPDotExporterDelegate.h" #import "SPDotExporter.h" #import "SPDatabaseDocument.h" -#import "SPMainThreadTrampoline.h" @implementation SPExportController (SPDotExporterDelegate) diff --git a/Source/SPExportController.h b/Source/SPExportController.h index 7cedc6d8..32cf189a 100644 --- a/Source/SPExportController.h +++ b/Source/SPExportController.h @@ -106,12 +106,6 @@ // XML IBOutlet NSTextField *exportXMLNULLValuesAsTextField; - // HTML - IBOutlet NSButton *exportHTMLIncludeStructureCheck; - - // PDF - IBOutlet NSButton *exportPDFIncludeStructureCheck; - /** * Cancellation flag */ diff --git a/Source/SPExportController.m b/Source/SPExportController.m index 12ea51dc..3ca2c996 100644 --- a/Source/SPExportController.m +++ b/Source/SPExportController.m @@ -30,16 +30,22 @@ #import "SPTablesList.h" #import "SPTableData.h" #import "SPTableContent.h" -#import "SPArrayAdditions.h" -#import "SPStringAdditions.h" #import "SPGrowlController.h" #import "SPExportFile.h" #import "SPAlertSheets.h" +// Constants +static const NSUInteger SPExportUIPadding = 20; + +static const NSString *SPTableViewStructureColumnID = @"structure"; +static const NSString *SPTableViewContentColumnID = @"content"; +static const NSString *SPTableViewDropColumnID = @"drop"; + @interface SPExportController (PrivateAPI) - (void)_switchTab; - (void)_checkForDatabaseChanges; +- (void)_displayExportTypeOptions:(BOOL)display; - (void)_toggleExportButton:(id)uiStateDict; - (void)_toggleExportButtonOnBackgroundThread; @@ -123,6 +129,11 @@ // If found the set the default path to the user's desktop, otherwise use their home directory [exportPathField setStringValue:([paths count] > 0) ? [paths objectAtIndex:0] : NSHomeDirectory()]; + + // Accept Core Animation + [exportOptionsTabBar wantsLayer]; + [exportTablelistScrollView wantsLayer]; + [exportTableListButtonBar wantsLayer]; } #pragma mark - @@ -499,7 +510,7 @@ */ - (IBAction)toggleSQLIncludeStructure:(id)sender { - [[exportTableList tableColumnWithIdentifier:@"structure"] setHidden:(![sender state])]; + [[exportTableList tableColumnWithIdentifier:SPTableViewStructureColumnID] setHidden:(![sender state])]; [self _toggleExportButtonOnBackgroundThread]; } @@ -509,7 +520,7 @@ */ - (IBAction)toggleSQLIncludeContent:(id)sender { - [[exportTableList tableColumnWithIdentifier:@"content"] setHidden:(![sender state])]; + [[exportTableList tableColumnWithIdentifier:SPTableViewContentColumnID] setHidden:(![sender state])]; [self _toggleExportButtonOnBackgroundThread]; } @@ -519,7 +530,7 @@ */ - (IBAction)toggleSQLIncludeDropSyntax:(id)sender { - [[exportTableList tableColumnWithIdentifier:@"drop"] setHidden:(![sender state])]; + [[exportTableList tableColumnWithIdentifier:SPTableViewDropColumnID] setHidden:(![sender state])]; [self _toggleExportButtonOnBackgroundThread]; } @@ -536,64 +547,6 @@ } #pragma mark - -#pragma mark Table view datasource methods - -- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView; -{ - return [tables count]; -} - -- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex -{ - return NSArrayObjectAtIndex([tables objectAtIndex:rowIndex], [exportTableList columnWithIdentifier:[tableColumn identifier]]); -} - -- (void)tableView:(NSTableView *)tableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex -{ - [[tables objectAtIndex:rowIndex] replaceObjectAtIndex:[exportTableList columnWithIdentifier:[tableColumn identifier]] withObject:anObject]; - - [self _toggleExportButtonOnBackgroundThread]; -} - -#pragma mark - -#pragma mark Table view delegate methods - -- (BOOL)tableView:(NSTableView *)tableView shouldSelectRow:(NSInteger)rowIndex -{ - return (tableView != exportTableList); -} - -- (BOOL)tableView:(NSTableView *)tableView shouldTrackCell:(NSCell *)cell forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex -{ - return (tableView == exportTableList); -} - -- (void)tableView:(NSTableView *)tableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex -{ - [aCell setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; -} - -#pragma mark - -#pragma mark Tabview delegate methods - -- (void)tabView:(NSTabView *)tabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem -{ - [tabViewItem setView:exporterView]; - - [self _switchTab]; -} - -#pragma mark - -#pragma mark Combo box delegate methods - -- (void)comboBoxSelectionDidChange:(NSNotification *)notification -{ - if ([notification object] == exportCSVFieldsTerminatedField) { - [self updateDisplayedExportFilename]; - } -} - -#pragma mark - #pragma mark Other /** @@ -728,17 +681,18 @@ [[[exportInputPopUpButton menu] itemAtIndex:SPQueryExport] setEnabled:((enable) && ([[customQueryInstance currentResult] count] > 1))]; } - [[exportTableList tableColumnWithIdentifier:@"structure"] setHidden:(isSQL) ? (![exportSQLIncludeStructureCheck state]) : YES]; - [[exportTableList tableColumnWithIdentifier:@"drop"] setHidden:(isSQL) ? (![exportSQLIncludeDropSyntaxCheck state]) : YES]; + [[exportTableList tableColumnWithIdentifier:SPTableViewStructureColumnID] setHidden:(isSQL) ? (![exportSQLIncludeStructureCheck state]) : YES]; + [[exportTableList tableColumnWithIdentifier:SPTableViewDropColumnID] setHidden:(isSQL) ? (![exportSQLIncludeDropSyntaxCheck state]) : YES]; - [[[exportTableList tableColumnWithIdentifier:@"content"] headerCell] setStringValue:(enable) ? @"" : @"C"]; + [[[exportTableList tableColumnWithIdentifier:SPTableViewContentColumnID] headerCell] setStringValue:(enable) ? @"" : @"C"]; // Set the tooltip - [[exportTableList tableColumnWithIdentifier:@"content"] setHeaderToolTip:(enable) ? @"" : NSLocalizedString(@"Include content", @"include content table column tooltip")]; + [[exportTableList tableColumnWithIdentifier:SPTableViewContentColumnID] setHeaderToolTip:(enable) ? @"" : NSLocalizedString(@"Include content", @"include content table column tooltip")]; [exportCSVNULLValuesAsTextField setStringValue:[prefs stringForKey:SPNullValue]]; [exportXMLNULLValuesAsTextField setStringValue:[prefs stringForKey:SPNullValue]]; + [self _displayExportTypeOptions:(isSQL || isCSV || isXML)]; [self updateAvailableExportFilenameTokens]; if (!showCustomFilenameView) [self updateDisplayedExportFilename]; @@ -775,6 +729,32 @@ } /** + * Toggles the display of the export type options view. + * + * @param display A BOOL indicating whether or not the view should be visible + */ +- (void)_displayExportTypeOptions:(BOOL)display +{ + NSRect windowFrame = [[exportTablelistScrollView window] frame]; + NSRect viewFrame = [exportTablelistScrollView frame]; + NSRect barFrame = [exportTableListButtonBar frame]; + + NSUInteger padding = (2 * SPExportUIPadding); + + CGFloat width = (!display) ? (windowFrame.size.width - (padding + 2)) : (windowFrame.size.width - ([exportOptionsTabBar frame].size.width + (padding + 4))); + CGFloat width2 = (!display) ? (windowFrame.size.width - (padding + 2)) : (windowFrame.size.width - ([exportTableListButtonBar frame].size.width + (padding + 4))); + + [NSAnimationContext beginGrouping]; + [[NSAnimationContext currentContext] setDuration:0.3]; + + [[exportOptionsTabBar animator] setHidden:(!display)]; + [[exportTablelistScrollView animator] setFrame:NSMakeRect(viewFrame.origin.x, viewFrame.origin.y, width, viewFrame.size.height)]; + [[exportTableListButtonBar animator] setFrame:NSMakeRect(barFrame.origin.x, barFrame.origin.y, width, barFrame.size.height)]; + + [NSAnimationContext endGrouping]; +} + +/** * Enables or disables the export button based on the state of various interface controls. * * @param uiStateDict A dictionary containing the state of various UI controls. diff --git a/Source/SPExportControllerDelegate.h b/Source/SPExportControllerDelegate.h new file mode 100644 index 00000000..f9406be4 --- /dev/null +++ b/Source/SPExportControllerDelegate.h @@ -0,0 +1,37 @@ +// +// $Id$ +// +// SPExportControllerDelegate.h +// sequel-pro +// +// Created by Stuart Connolly (stuconnolly.com) on October 23, 2010 +// Copyright (c) 2010 Stuart Connolly. All rights reserved. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// More info at <http://code.google.com/p/sequel-pro/> + +#import "SPExportController.h" + +/** + * @category SPExportControllerDelegate SPExportControllerDelegate.h + * + * @author Stuart Connolly http://stuconnolly.com/ + * + * Export controller delegate category. + */ +@interface SPExportController (SPExportControllerDelegate) + +@end diff --git a/Source/SPExportControllerDelegate.m b/Source/SPExportControllerDelegate.m new file mode 100644 index 00000000..bc9608e7 --- /dev/null +++ b/Source/SPExportControllerDelegate.m @@ -0,0 +1,88 @@ +// +// $Id$ +// +// SPExportControllerDelegate.m +// sequel-pro +// +// Created by Stuart Connolly (stuconnolly.com) on October 23, 2010 +// Copyright (c) 2010 Stuart Connolly. All rights reserved. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// More info at <http://code.google.com/p/sequel-pro/> + +#import "SPExportControllerDelegate.h" + +@implementation SPExportController (SPExportControllerDelegate) + +#pragma mark - +#pragma mark Table view datasource methods + +- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView; +{ + return [tables count]; +} + +- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex +{ + return NSArrayObjectAtIndex([tables objectAtIndex:rowIndex], [exportTableList columnWithIdentifier:[tableColumn identifier]]); +} + +- (void)tableView:(NSTableView *)tableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex +{ + [[tables objectAtIndex:rowIndex] replaceObjectAtIndex:[exportTableList columnWithIdentifier:[tableColumn identifier]] withObject:anObject]; + + [self _toggleExportButtonOnBackgroundThread]; +} + +#pragma mark - +#pragma mark Table view delegate methods + +- (BOOL)tableView:(NSTableView *)tableView shouldSelectRow:(NSInteger)rowIndex +{ + return (tableView != exportTableList); +} + +- (BOOL)tableView:(NSTableView *)tableView shouldTrackCell:(NSCell *)cell forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex +{ + return (tableView == exportTableList); +} + +- (void)tableView:(NSTableView *)tableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex +{ + [aCell setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; +} + +#pragma mark - +#pragma mark Tabview delegate methods + +- (void)tabView:(NSTabView *)tabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem +{ + [tabViewItem setView:exporterView]; + + [self _switchTab]; +} + +#pragma mark - +#pragma mark Combo box delegate methods + +- (void)comboBoxSelectionDidChange:(NSNotification *)notification +{ + if ([notification object] == exportCSVFieldsTerminatedField) { + [self updateDisplayedExportFilename]; + } +} + +@end diff --git a/Source/SPExportInitializer.m b/Source/SPExportInitializer.m index ee184701..a23ff1b9 100644 --- a/Source/SPExportInitializer.m +++ b/Source/SPExportInitializer.m @@ -26,12 +26,10 @@ #import <MCPKit/MCPKit.h> #import "SPExportInitializer.h" -#import "SPStringAdditions.h" #import "SPTableData.h" #import "SPDatabaseDocument.h" #import "SPTablesList.h" #import "SPGrowlController.h" -#import "SPMainThreadTrampoline.h" #import "SPDatabaseDocument.h" #import "SPCustomQuery.h" #import "SPAlertSheets.h" diff --git a/Source/SPExtendedTableInfo.m b/Source/SPExtendedTableInfo.m index b46bbea4..bcf726c7 100644 --- a/Source/SPExtendedTableInfo.m +++ b/Source/SPExtendedTableInfo.m @@ -27,7 +27,6 @@ #import "SPTableData.h" #import "RegexKitLite.h" #import "SPDatabaseData.h" -#import "SPStringAdditions.h" #import "SPDatabaseDocument.h" #import "SPTablesList.h" #import "SPAlertSheets.h" diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m index 086811ed..16823fed 100644 --- a/Source/SPFieldEditorController.m +++ b/Source/SPFieldEditorController.m @@ -23,10 +23,6 @@ // More info at <http://code.google.com/p/sequel-pro/> #import "SPFieldEditorController.h" -#import "SPStringAdditions.h" -#import "SPArrayAdditions.h" -#import "SPTextViewAdditions.h" -#import "SPDataAdditions.h" #import "QLPreviewPanel.h" #import "SPDataCellFormatter.h" #import "RegexKitLite.h" diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m index 10afade0..ca43d4d0 100644 --- a/Source/SPFieldMapperController.m +++ b/Source/SPFieldMapperController.m @@ -26,9 +26,6 @@ #import "SPTableData.h" #import "SPDataImport.h" #import "SPTablesList.h" -#import "SPArrayAdditions.h" -#import "SPStringAdditions.h" -#import "SPNotLoaded.h" #import "SPTextView.h" #import "SPTableView.h" diff --git a/Source/SPGrowlController.m b/Source/SPGrowlController.m index d61ffd1f..24eccb50 100644 --- a/Source/SPGrowlController.m +++ b/Source/SPGrowlController.m @@ -24,7 +24,6 @@ // More info at <http://code.google.com/p/sequel-pro/> #import "SPGrowlController.h" -#import "SPMainThreadTrampoline.h" #include <mach/mach_time.h> diff --git a/Source/SPHistoryController.m b/Source/SPHistoryController.m index 6ef82d83..3d7f00d0 100644 --- a/Source/SPHistoryController.m +++ b/Source/SPHistoryController.m @@ -26,8 +26,6 @@ #import "SPTableContent.h" #import "SPTablesList.h" #import "SPHistoryController.h" -#import "SPStringAdditions.h" -#import "SPMainThreadTrampoline.h" @implementation SPHistoryController diff --git a/Source/SPNarrowDownCompletion.m b/Source/SPNarrowDownCompletion.m index 9f6e7abb..fc2c8728 100644 --- a/Source/SPNarrowDownCompletion.m +++ b/Source/SPNarrowDownCompletion.m @@ -30,8 +30,6 @@ #import <tgmath.h> #import "SPNarrowDownCompletion.h" -#import "SPArrayAdditions.h" -#import "SPStringAdditions.h" #import "ImageAndTextCell.h" #import "SPQueryController.h" #import "RegexKitLite.h" diff --git a/Source/SPNavigatorController.m b/Source/SPNavigatorController.m index 86a31fd5..58141936 100644 --- a/Source/SPNavigatorController.m +++ b/Source/SPNavigatorController.m @@ -28,9 +28,9 @@ #import "ImageAndTextCell.h" #import "SPDatabaseDocument.h" #import "SPTablesList.h" -#import "SPArrayAdditions.h" #import "SPLogger.h" #import "SPTooltip.h" + #import <objc/runtime.h> static SPNavigatorController *sharedNavigatorController = nil; diff --git a/Source/SPPreferenceController.m b/Source/SPPreferenceController.m index eb429b61..ad6a7061 100644 --- a/Source/SPPreferenceController.m +++ b/Source/SPPreferenceController.m @@ -24,14 +24,11 @@ // More info at <http://code.google.com/p/sequel-pro/> #import "SPPreferenceController.h" -#import "SPWindowAdditions.h" #import "SPFavoriteTextFieldCell.h" #import "SPKeychain.h" #import "SPDatabaseDocument.h" #import "SPConnectionController.h" -#import "SPColorAdditions.h" #import "SPColorWellCell.h" -#import "SPFileManagerAdditions.h" #import "SPAlertSheets.h" @interface SPPreferenceController (PrivateAPI) diff --git a/Source/SPProcessListController.m b/Source/SPProcessListController.m index 20c1c4c6..82075eac 100644 --- a/Source/SPProcessListController.m +++ b/Source/SPProcessListController.m @@ -24,7 +24,6 @@ // More info at <http://code.google.com/p/sequel-pro/> #import "SPProcessListController.h" -#import "SPArrayAdditions.h" #import "SPDatabaseDocument.h" #import "SPAlertSheets.h" diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m index 53346a21..480d3e9e 100644 --- a/Source/SPQueryController.m +++ b/Source/SPQueryController.m @@ -25,7 +25,6 @@ #import "SPQueryController.h" #import "SPConsoleMessage.h" -#import "SPArrayAdditions.h" #import "SPCustomQuery.h" #import "pthread.h" diff --git a/Source/SPSQLExporter.m b/Source/SPSQLExporter.m index 78966b36..1374ccda 100644 --- a/Source/SPSQLExporter.m +++ b/Source/SPSQLExporter.m @@ -27,8 +27,6 @@ #import "SPSQLExporter.h" #import "SPTablesList.h" -#import "SPArrayAdditions.h" -#import "SPStringAdditions.h" #import "SPFileHandle.h" #import "SPExportUtilities.h" #import "SPTableData.h" diff --git a/Source/SPSQLExporterDelegate.m b/Source/SPSQLExporterDelegate.m index 2aad2f7e..89bc9b89 100644 --- a/Source/SPSQLExporterDelegate.m +++ b/Source/SPSQLExporterDelegate.m @@ -26,7 +26,6 @@ #import "SPSQLExporterDelegate.h" #import "SPSQLExporter.h" #import "SPDatabaseDocument.h" -#import "SPMainThreadTrampoline.h" @implementation SPExportController (SPSQLExporterDelegate) diff --git a/Source/SPSSHTunnel.m b/Source/SPSSHTunnel.m index 01ce909c..76508304 100644 --- a/Source/SPSSHTunnel.m +++ b/Source/SPSSHTunnel.m @@ -26,7 +26,6 @@ #import "SPSSHTunnel.h" #import "RegexKitLite.h" #import "SPKeychain.h" -#import "SPMainThreadTrampoline.h" #import "SPAlertSheets.h" #import <netinet/in.h> diff --git a/Source/SPServerVariablesController.m b/Source/SPServerVariablesController.m index e1383edf..e0796454 100644 --- a/Source/SPServerVariablesController.m +++ b/Source/SPServerVariablesController.m @@ -24,7 +24,6 @@ // More info at <http://code.google.com/p/sequel-pro/> #import "SPServerVariablesController.h" -#import "SPArrayAdditions.h" #import "SPDatabaseDocument.h" @interface SPServerVariablesController (PrivateAPI) diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index dfb54e69..fe586e8a 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -35,20 +35,14 @@ #import "SPDataCellFormatter.h" #import "SPTableData.h" #import "SPQueryController.h" -#import "SPStringAdditions.h" -#import "SPArrayAdditions.h" -#import "SPTextViewAdditions.h" -#import "SPDataAdditions.h" #import "SPTextAndLinkCell.h" #import "QLPreviewPanel.h" #import "SPFieldEditorController.h" #import "SPTooltip.h" #import "RegexKitLite.h" #import "SPContentFilterManager.h" -#import "SPNotLoaded.h" #import "SPDataStorage.h" #import "SPAlertSheets.h" -#import "SPMainThreadTrampoline.h" #import "SPHistoryController.h" #import "SPGeometryDataView.h" diff --git a/Source/SPTableData.m b/Source/SPTableData.m index 8a253854..e39635c7 100644 --- a/Source/SPTableData.m +++ b/Source/SPTableData.m @@ -27,8 +27,6 @@ #import "SPSQLParser.h" #import "SPDatabaseDocument.h" #import "SPTablesList.h" -#import "SPStringAdditions.h" -#import "SPArrayAdditions.h" #import "SPAlertSheets.h" #import "RegexKitLite.h" #import "SPServerSupport.h" diff --git a/Source/SPTableInfo.m b/Source/SPTableInfo.m index 68cc1ae3..0270c097 100644 --- a/Source/SPTableInfo.m +++ b/Source/SPTableInfo.m @@ -27,7 +27,6 @@ #import "SPDatabaseDocument.h" #import "SPTablesList.h" #import "SPTableData.h" -#import "SPStringAdditions.h" @interface SPTableInfo (PrivateAPI) diff --git a/Source/SPTableRelations.m b/Source/SPTableRelations.m index 138ec35c..b7a4bde6 100644 --- a/Source/SPTableRelations.m +++ b/Source/SPTableRelations.m @@ -27,7 +27,6 @@ #import "SPDatabaseDocument.h" #import "SPTablesList.h" #import "SPTableData.h" -#import "SPStringAdditions.h" #import "SPAlertSheets.h" @interface SPTableRelations (PrivateAPI) diff --git a/Source/SPTableStructure.m b/Source/SPTableStructure.m index 61659194..e6afab2d 100644 --- a/Source/SPTableStructure.m +++ b/Source/SPTableStructure.m @@ -29,10 +29,7 @@ #import "SPTablesList.h" #import "SPTableData.h" #import "SPSQLParser.h" -#import "SPStringAdditions.h" -#import "SPArrayAdditions.h" #import "SPAlertSheets.h" -#import "SPMainThreadTrampoline.h" #import "SPIndexesController.h" #import "RegexKitLite.h" diff --git a/Source/SPTableTriggers.m b/Source/SPTableTriggers.m index dc67e76a..44a17549 100644 --- a/Source/SPTableTriggers.m +++ b/Source/SPTableTriggers.m @@ -27,7 +27,6 @@ #import "SPDatabaseDocument.h" #import "SPTablesList.h" #import "SPTableData.h" -#import "SPStringAdditions.h" #import "SPAlertSheets.h" #import "SPServerSupport.h" diff --git a/Source/SPTableView.m b/Source/SPTableView.m index 531e3041..d1aa5700 100644 --- a/Source/SPTableView.m +++ b/Source/SPTableView.m @@ -24,7 +24,6 @@ #import "SPTableView.h" #import "SPQueryFavoriteManager.h" -#import "SPArrayAdditions.h" #import "SPDatabaseDocument.h" @implementation SPTableView diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m index 67e650b1..722c3242 100644 --- a/Source/SPTablesList.m +++ b/Source/SPTablesList.m @@ -31,15 +31,10 @@ #import "SPTableInfo.h" #import "SPDataImport.h" #import "ImageAndTextCell.h" -#import "SPStringAdditions.h" -#import "SPArrayAdditions.h" #import "RegexKitLite.h" #import "SPDatabaseData.h" -#import "NSMutableArray-MultipleSort.h" -#import "NSNotificationAdditions.h" #import "SPAlertSheets.h" #import "SPNavigatorController.h" -#import "SPMainThreadTrampoline.h" #import "SPHistoryController.h" #import "SPServerSupport.h" diff --git a/Source/SPTextView.m b/Source/SPTextView.m index c584a407..39e7b5e7 100644 --- a/Source/SPTextView.m +++ b/Source/SPTextView.m @@ -25,9 +25,6 @@ #import "SPTextView.h" #import "SPCustomQuery.h" #import "SPDatabaseDocument.h" -#import "SPStringAdditions.h" -#import "SPArrayAdditions.h" -#import "SPTextViewAdditions.h" #import "SPNarrowDownCompletion.h" #import "SPQueryController.h" #import "SPTooltip.h" diff --git a/Source/SPTextViewAdditions.m b/Source/SPTextViewAdditions.m index 2789ad87..93eccf5b 100644 --- a/Source/SPTextViewAdditions.m +++ b/Source/SPTextViewAdditions.m @@ -22,9 +22,6 @@ // // More info at <http://code.google.com/p/sequel-pro/> -#import "SPStringAdditions.h" -#import "SPTextViewAdditions.h" - @implementation NSTextView (SPTextViewAdditions) /* diff --git a/Source/SPTooltip.m b/Source/SPTooltip.m index fc7133e2..f35dc155 100644 --- a/Source/SPTooltip.m +++ b/Source/SPTooltip.m @@ -55,7 +55,6 @@ // See more possible syntaxa in SPTooltip to init a tooltip #import "SPTooltip.h" -#import "SPTextViewAdditions.h" #include <tgmath.h> diff --git a/Source/SPUserManager.m b/Source/SPUserManager.m index 2014b2d6..f947568e 100644 --- a/Source/SPUserManager.m +++ b/Source/SPUserManager.m @@ -25,8 +25,6 @@ #import "SPUserManager.h" #import "SPUserMO.h" #import "ImageAndTextCell.h" -#import "SPArrayAdditions.h" -#import "SPStringAdditions.h" #import "SPGrowlController.h" #import "SPConnectionController.h" #import "SPServerSupport.h" diff --git a/Source/SPXMLExporter.m b/Source/SPXMLExporter.m index 1e2782b1..c3fee7c2 100644 --- a/Source/SPXMLExporter.m +++ b/Source/SPXMLExporter.m @@ -26,8 +26,6 @@ #import <MCPKit/MCPKit.h> #import "SPXMLExporter.h" -#import "SPArrayAdditions.h" -#import "SPStringAdditions.h" #import "SPFileHandle.h" #import "SPExportUtilities.h" diff --git a/Source/SPXMLExporterDelegate.m b/Source/SPXMLExporterDelegate.m index e5073aed..12274a4b 100644 --- a/Source/SPXMLExporterDelegate.m +++ b/Source/SPXMLExporterDelegate.m @@ -25,10 +25,8 @@ #import "SPXMLExporterDelegate.h" #import "SPXMLExporter.h" -#import "SPMainThreadTrampoline.h" #import "SPDatabaseDocument.h" #import "SPFileHandle.h" -#import "SPStringAdditions.h" @implementation SPExportController (SPXMLExporterDelegate) diff --git a/Source/Sequel-Pro.pch b/Source/Sequel-Pro.pch index a13ad20f..471695d6 100644 --- a/Source/Sequel-Pro.pch +++ b/Source/Sequel-Pro.pch @@ -27,4 +27,7 @@ // Nearly every class uses constants #import "SPConstants.h" + + // Make all our custom additions available + #import "SPCategoryAdditions.h" #endif |