diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPDatabaseDocument.m | 76 | ||||
-rw-r--r-- | Source/SPTableContent.m | 7 |
2 files changed, 52 insertions, 31 deletions
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index a57a5bba..5d36d864 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -119,14 +119,18 @@ static NSString *SPRenameDatabaseAction = @"SPRenameDatabase"; static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; @interface SPDatabaseDocument () + - (void)_addDatabase; - (void)_alterDatabase; + #ifndef SP_CODA /* method decls */ - (void)_copyDatabase; #endif + - (void)_renameDatabase; - (void)_removeDatabase; - (void)_selectDatabaseAndItem:(NSDictionary *)selectionDetails; + #ifndef SP_CODA /* method decls */ - (void)_processDatabaseChangedBundleTriggerActions; #endif @@ -166,9 +170,12 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; @synthesize structureContentSwitcher; #endif +#pragma mark - + - (id)init { if ((self = [super init])) { + #ifndef SP_CODA /* init ivars */ _mainNibLoaded = NO; @@ -179,6 +186,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; _supportsEncoding = NO; databaseListIsSelectable = YES; _queryMode = SPInterfaceQueryMode; + chooseDatabaseButton = nil; #ifndef SP_CODA /* init ivars */ chooseDatabaseToolbarItem = nil; @@ -200,6 +208,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; mySQLVersion = nil; allDatabases = nil; allSystemDatabases = nil; + #ifndef SP_CODA /* init ivars */ mainToolbar = nil; parentWindow = nil; @@ -225,6 +234,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; #endif titleAccessoryView = nil; + #ifndef SP_CODA /* init ivars */ taskProgressWindow = nil; taskDisplayIsIndeterminate = YES; @@ -241,6 +251,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; addDatabaseCharsetHelper = nil; keyChainID = nil; + #ifndef SP_CODA /* init ivars */ statusValues = nil; printThread = nil; @@ -262,34 +273,11 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; return self; } -#ifdef SP_CODA /* glue */ -- (SPConnectionController*)createConnectionController -{ - // Set up the connection controller - connectionController = [[SPConnectionController alloc] initWithDocument:self]; - - // Set the connection controller's delegate - [connectionController setDelegate:self]; - - return connectionController; -} - -- (void)setTableSourceInstance:(SPTableStructure*)source -{ - tableSourceInstance = source; -} - -- (void)setTableContentInstance:(SPTableContent*)content -{ - tableContentInstance = content; -} - -#endif - - (void)awakeFromNib { #ifndef SP_CODA if (_mainNibLoaded) return; + _mainNibLoaded = YES; // Set up the toolbar @@ -300,7 +288,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; // Set up the connection controller connectionController = [[SPConnectionController alloc] initWithDocument:self]; - + // Set the connection controller's delegate [connectionController setDelegate:self]; @@ -317,6 +305,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; [prefs addObserver:[SPQueryController sharedQueryController] forKeyPath:SPUseMonospacedFonts options:NSKeyValueObservingOptionNew context:NULL]; [prefs addObserver:tableContentInstance forKeyPath:SPGlobalResultTableFont options:NSKeyValueObservingOptionNew context:NULL]; + [prefs addObserver:tableContentInstance forKeyPath:SPDisplayBinaryDataAsHex options:NSKeyValueObservingOptionNew context:NULL]; // Register observers for when the logging preference changes [prefs addObserver:[SPQueryController sharedQueryController] forKeyPath:SPConsoleEnableLogging options:NSKeyValueObservingOptionNew context:NULL]; @@ -324,6 +313,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; // Register a second observer for when the logging preference changes so we can tell the current connection about it [prefs addObserver:self forKeyPath:SPConsoleEnableLogging options:NSKeyValueObservingOptionNew context:NULL]; #endif + // Register for notifications [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willPerformQuery:) name:@"SMySQLQueryWillBePerformed" object:self]; @@ -341,7 +331,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; // Hide the activity list [self setActivityPaneHidden:[NSNumber numberWithInteger:1]]; - + // Load additional nibs, keeping track of the top-level objects to allow correct release NSArray *connectionDialogTopLevelObjects = nil; NSNib *nibLoader = [[NSNib alloc] initWithNibNamed:@"ConnectionErrorDialog" bundle:[NSBundle mainBundle]]; @@ -353,7 +343,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; [nibLoader release]; // SP_CODA can't use progress indicator because of BWToolkit dependency - + NSArray *progressIndicatorLayerTopLevelObjects = nil; nibLoader = [[NSNib alloc] initWithNibNamed:@"ProgressIndicatorLayer" bundle:[NSBundle mainBundle]]; if (![nibLoader instantiateNibWithOwner:self topLevelObjects:&progressIndicatorLayerTopLevelObjects]) { @@ -366,7 +356,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; // Retain the icon accessory view to allow it to be added and removed from windows [titleAccessoryView retain]; #endif - + #ifndef SP_CODA // Set up the progress indicator child window and layer - change indicator color and size [taskProgressIndicator setForeColor:[NSColor whiteColor]]; @@ -385,11 +375,37 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; [self updateTitlebarStatusVisibilityForcingHide:NO]; #endif - + alterDatabaseCharsetHelper = [[SPCharsetCollationHelper alloc] initWithCharsetButton:databaseAlterEncodingButton CollationButton:databaseAlterCollationButton]; - addDatabaseCharsetHelper = [[SPCharsetCollationHelper alloc] initWithCharsetButton:databaseEncodingButton CollationButton:databaseCollationButton]; + addDatabaseCharsetHelper = [[SPCharsetCollationHelper alloc] initWithCharsetButton:databaseEncodingButton CollationButton:databaseCollationButton]; +} + +#pragma mark - + +#ifdef SP_CODA /* glue */ +- (SPConnectionController*)createConnectionController +{ + // Set up the connection controller + connectionController = [[SPConnectionController alloc] initWithDocument:self]; + + // Set the connection controller's delegate + [connectionController setDelegate:self]; + + return connectionController; +} + +- (void)setTableSourceInstance:(SPTableStructure*)source +{ + tableSourceInstance = source; } +- (void)setTableContentInstance:(SPTableContent*)content +{ + tableContentInstance = content; +} + +#endif + #ifndef SP_CODA /* password sheet and history navigation */ /** * Set the return code for entering the encryption passowrd sheet diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index 6ddc8012..52d0efc6 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -4191,10 +4191,15 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper // Table font preference changed else if ([keyPath isEqualToString:SPGlobalResultTableFont]) { NSFont *tableFont = [NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]]; - [tableContentView setRowHeight:2.0f+NSSizeToCGSize([@"{ǞṶḹÜ∑zgyf" sizeWithAttributes:[NSDictionary dictionaryWithObject:tableFont forKey:NSFontAttributeName]]).height]; + + [tableContentView setRowHeight:2.0f + NSSizeToCGSize([@"{ǞṶḹÜ∑zgyf" sizeWithAttributes:[NSDictionary dictionaryWithObject:tableFont forKey:NSFontAttributeName]]).height]; [tableContentView setFont:tableFont]; [tableContentView reloadData]; } + // Display binary data as Hex + else if ([keyPath isEqualToString:SPDisplayBinaryDataAsHex] && [tableContentView numberOfRows] > 0) { + [tableContentView reloadData]; + } #endif } |