Permalink
Browse files

Force a table reload (just the view not the actual data retrieval) wh…

…enever the view binary data as hex option is toggled. Fixes #1875.
  • Loading branch information...
stuconnolly committed Jan 20, 2014
1 parent 2d299f2 commit 0d1e5180d575e6191362ae4ba411d240da93c14d
Showing with 52 additions and 31 deletions.
  1. +46 −30 Source/SPDatabaseDocument.m
  2. +6 −1 Source/SPTableContent.m
@@ -119,14 +119,18 @@
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 @@ @implementation SPDatabaseDocument
@synthesize structureContentSwitcher;
#endif
#pragma mark -
- (id)init
{
if ((self = [super init])) {
#ifndef SP_CODA /* init ivars */
_mainNibLoaded = NO;
@@ -179,6 +186,7 @@ - (id)init
_supportsEncoding = NO;
databaseListIsSelectable = YES;
_queryMode = SPInterfaceQueryMode;
chooseDatabaseButton = nil;
#ifndef SP_CODA /* init ivars */
chooseDatabaseToolbarItem = nil;
@@ -200,6 +208,7 @@ - (id)init
mySQLVersion = nil;
allDatabases = nil;
allSystemDatabases = nil;
#ifndef SP_CODA /* init ivars */
mainToolbar = nil;
parentWindow = nil;
@@ -225,6 +234,7 @@ - (id)init
#endif
titleAccessoryView = nil;
#ifndef SP_CODA /* init ivars */
taskProgressWindow = nil;
taskDisplayIsIndeterminate = YES;
@@ -241,6 +251,7 @@ - (id)init
addDatabaseCharsetHelper = nil;
keyChainID = nil;
#ifndef SP_CODA /* init ivars */
statusValues = nil;
printThread = nil;
@@ -262,34 +273,11 @@ - (id)init
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 @@ - (void)awakeFromNib
// Set up the connection controller
connectionController = [[SPConnectionController alloc] initWithDocument:self];
// Set the connection controller's delegate
[connectionController setDelegate:self];
@@ -317,13 +305,15 @@ - (void)awakeFromNib
[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];
// 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 @@ - (void)awakeFromNib
// 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 @@ - (void)awakeFromNib
[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 @@ - (void)awakeFromNib
// 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 @@ - (void)awakeFromNib
[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
View
@@ -4191,10 +4191,15 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
// 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
}

0 comments on commit 0d1e518

Please sign in to comment.