aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CustomQuery.m27
-rw-r--r--Source/SPConstants.h3
-rw-r--r--Source/SPConstants.m3
-rw-r--r--Source/SPFieldEditorController.m21
-rw-r--r--Source/SPProcessListController.m28
-rw-r--r--Source/SPQueryController.m21
-rw-r--r--Source/SPServerVariablesController.m28
-rw-r--r--Source/SPTooltip.m2
-rw-r--r--Source/TableContent.m32
-rw-r--r--Source/TableDocument.m24
-rw-r--r--Source/TableDump.m43
-rw-r--r--Source/TableSource.m126
12 files changed, 194 insertions, 164 deletions
diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m
index 14b8c191..f515f335 100644
--- a/Source/CustomQuery.m
+++ b/Source/CustomQuery.m
@@ -468,11 +468,7 @@
SPTextAndLinkCell *dataCell = [[[SPTextAndLinkCell alloc] initTextCell:@""] autorelease];
[dataCell setEditable:YES];
[dataCell setFormatter:[[SPDataCellFormatter new] autorelease]];
- if ( [prefs boolForKey:SPUseMonospacedFonts] ) {
- [dataCell setFont:[NSFont fontWithName:@"Monaco" size:10]];
- } else {
- [dataCell setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
- }
+ [dataCell setFont:([prefs boolForKey:SPUseMonospacedFonts]) ? [NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
[dataCell setLineBreakMode:NSLineBreakByTruncatingTail];
[theCol setDataCell:dataCell];
[[theCol headerCell] setStringValue:NSArrayObjectAtIndex(theColumns, i)];
@@ -2623,9 +2619,22 @@
*/
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
+ // Display table veiew vertical gridlines preference changed
if ([keyPath isEqualToString:SPDisplayTableViewVerticalGridlines]) {
[customQueryView setGridStyleMask:([[change objectForKey:NSKeyValueChangeNewKey] boolValue]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone];
}
+ // Use monospaced fonts preference changed
+ else if ([keyPath isEqualToString:SPUseMonospacedFonts]) {
+
+ BOOL useMonospacedFont = [[change objectForKey:NSKeyValueChangeNewKey] boolValue];
+
+ for (NSTableColumn *column in [customQueryView tableColumns])
+ {
+ [[column dataCell] setFont:(useMonospacedFont) ? [NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ }
+
+ [customQueryView reloadData];
+ }
}
/**
@@ -2761,7 +2770,6 @@
for (i=6; i< [menu numberOfItems]; i++)
[[menu itemAtIndex:i] setHidden:([[menu itemAtIndex:i] tag] != SP_FAVORITE_HEADER_MENUITEM_TAG
&& ![[[menu itemAtIndex:i] title] isMatchedByRegex:[NSString stringWithFormat:@"(?i).*%@.*", searchPattern]])];
-
}
- (IBAction)filterQueryHistory:(id)sender
@@ -2771,19 +2779,17 @@
NSString *searchPattern = [queryHistorySearchField stringValue];
for (i=2; i< [menu numberOfItems]; i++)
[[menu itemAtIndex:i] setHidden:(![[[menu itemAtIndex:i] title] isMatchedByRegex:[NSString stringWithFormat:@"(?i).*%@.*", searchPattern]])];
-
}
- (void)awakeFromNib
{
-
// Set pre-defined menu tags
[queryFavoritesSaveAsMenuItem setTag:SP_SAVE_SELECTION_FAVORTITE_MENUITEM_TAG];
[queryFavoritesSaveAllMenuItem setTag:SP_SAVE_ALL_FAVORTITE_MENUITEM_TAG];
// Set the structure and index view's vertical gridlines if required
- [customQueryView setGridStyleMask:([prefs boolForKey:SPDisplayTableViewVerticalGridlines]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone];
-
+ [customQueryView setGridStyleMask:([prefs boolForKey:SPDisplayTableViewVerticalGridlines]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone];
+
// Add observers for document task activity
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(startDocumentTaskForTab:)
@@ -2802,6 +2808,7 @@
[usedQuery release];
[fullResult release];
[favoritesManager release];
+
if (helpHTMLTemplate) [helpHTMLTemplate release];
if (mySQLversion) [mySQLversion release];
if (sortField) [sortField release];
diff --git a/Source/SPConstants.h b/Source/SPConstants.h
index 3c40fc66..af884ac3 100644
--- a/Source/SPConstants.h
+++ b/Source/SPConstants.h
@@ -78,6 +78,9 @@ typedef enum {
extern NSString *SPKillProcessQueryMode;
extern NSString *SPKillProcessConnectionMode;
+// Default monospaced font name
+extern NSString *SPDefaultMonospacedFontName;
+
// Preference key constants
// General Prefpane
extern NSString *SPDefaultFavorite;
diff --git a/Source/SPConstants.m b/Source/SPConstants.m
index 4cafc02e..e9a87ff7 100644
--- a/Source/SPConstants.m
+++ b/Source/SPConstants.m
@@ -29,6 +29,9 @@
NSString *SPKillProcessQueryMode = @"SPKillProcessQueryMode";
NSString *SPKillProcessConnectionMode = @"SPKillProcessConnectionMode";
+// Default monospaced font name
+NSString *SPDefaultMonospacedFontName = @"Courier";
+
// Preference key constants
// General Prefpane
NSString *SPDefaultFavorite = @"DefaultFavorite";
diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m
index 96631502..43bab67c 100644
--- a/Source/SPFieldEditorController.m
+++ b/Source/SPFieldEditorController.m
@@ -131,18 +131,15 @@
- (id)editWithObject:(id)data fieldName:(NSString*)fieldName usingEncoding:(NSStringEncoding)anEncoding
isObjectBlob:(BOOL)isFieldBlob isEditable:(BOOL)isEditable withWindow:(NSWindow *)tableWindow
{
-
- if ( ![prefs objectForKey:SPFieldEditorSheetFont] )
- if ( [prefs boolForKey:SPUseMonospacedFonts] ) {
- [editTextView setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
- } else {
- [editTextView setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
- // [prefs setObject:[NSArchiver archivedDataWithRootObject:[editTextView font]] forKey:@"FieldEditorSheetFont"];
- }
- else
+ // If required, use monospaced fonts
+ if (![prefs objectForKey:SPFieldEditorSheetFont]) {
+ [editTextView setFont:([prefs boolForKey:SPUseMonospacedFonts]) ? [NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ }
+ else {
[editTextView setFont:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:@"FieldEditorSheetFont"]]];
+ }
- [hexTextView setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
+ [hexTextView setFont:[NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]]];
[editSheetFieldName setStringValue:[NSString stringWithFormat:@"%@: %@", NSLocalizedString(@"Field", @"Field"), fieldName]];
@@ -153,7 +150,7 @@
[editTextView setHidden:YES];
[editTextScrollView setHidden:YES];
- if(!isEditable) {
+ if (!isEditable) {
[editSheetOkButton setHidden:YES];
[editSheetCancelButton setHidden:YES];
[editSheetIsNotEditableCancelButton setHidden:NO];
@@ -180,7 +177,7 @@
[editSheetSegmentControl setHidden:(!isBlob)];
// Set window's min size since no segment and quicklook buttons are hidden
- if(isBlob) {
+ if (isBlob) {
[editSheet setFrameAutosaveName:@"SPFieldEditorBlobSheet"];
[editSheet setMinSize:NSMakeSize(560, 200)];
} else {
diff --git a/Source/SPProcessListController.m b/Source/SPProcessListController.m
index 864bccc3..5087ef2a 100644
--- a/Source/SPProcessListController.m
+++ b/Source/SPProcessListController.m
@@ -60,8 +60,21 @@
*/
- (void)awakeFromNib
{
+ NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
+
// Set the process table view's vertical gridlines if required
- [processListTableView setGridStyleMask:([[NSUserDefaults standardUserDefaults] boolForKey:SPDisplayTableViewVerticalGridlines]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone];
+ [processListTableView setGridStyleMask:([prefs boolForKey:SPDisplayTableViewVerticalGridlines]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone];
+
+ // Set the strutcture and index view's font
+ BOOL useMonospacedFont = [prefs boolForKey:SPUseMonospacedFonts];
+
+ for (NSTableColumn *column in [processListTableView tableColumns])
+ {
+ [[column dataCell] setFont:(useMonospacedFont) ? [NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ }
+
+ // Register as an observer for the when the UseMonospacedFonts preference changes
+ [prefs addObserver:self forKeyPath:SPUseMonospacedFonts options:NSKeyValueObservingOptionNew context:NULL];
}
#pragma mark -
@@ -326,9 +339,22 @@
*/
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
+ // Display table veiew vertical gridlines preference changed
if ([keyPath isEqualToString:SPDisplayTableViewVerticalGridlines]) {
[processListTableView setGridStyleMask:([[change objectForKey:NSKeyValueChangeNewKey] boolValue]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone];
}
+ // Use monospaced fonts preference changed
+ else if ([keyPath isEqualToString:SPUseMonospacedFonts]) {
+
+ BOOL useMonospacedFont = [[change objectForKey:NSKeyValueChangeNewKey] boolValue];
+
+ for (NSTableColumn *column in [processListTableView tableColumns])
+ {
+ [[column dataCell] setFont:(useMonospacedFont) ? [NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ }
+
+ [processListTableView reloadData];
+ }
}
#pragma mark -
diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m
index f951e582..891f4fb5 100644
--- a/Source/SPQueryController.m
+++ b/Source/SPQueryController.m
@@ -153,6 +153,13 @@ static SPQueryController *sharedQueryController = nil;
// Set the process table view's vertical gridlines if required
[consoleTableView setGridStyleMask:([prefs boolForKey:SPDisplayTableViewVerticalGridlines]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone];
+ // Set the strutcture and index view's font
+ BOOL useMonospacedFont = [prefs boolForKey:SPUseMonospacedFonts];
+
+ for (NSTableColumn *column in [consoleTableView tableColumns])
+ {
+ [[column dataCell] setFont:(useMonospacedFont) ? [NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ }
}
#pragma mark -
@@ -395,10 +402,22 @@ static SPQueryController *sharedQueryController = nil;
if ([keyPath isEqualToString:SPConsoleEnableLogging]) {
[loggingDisabledTextField setStringValue:([[change objectForKey:NSKeyValueChangeNewKey] boolValue]) ? @"" : @"Query logging is currently disabled"];
}
- // Show/hide vertical grid lines in console table view
+ // Display table veiew vertical gridlines preference changed
else if ([keyPath isEqualToString:SPDisplayTableViewVerticalGridlines]) {
[consoleTableView setGridStyleMask:([[change objectForKey:NSKeyValueChangeNewKey] boolValue]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone];
}
+ // Use monospaced fonts preference changed
+ else if ([keyPath isEqualToString:SPUseMonospacedFonts]) {
+
+ BOOL useMonospacedFont = [[change objectForKey:NSKeyValueChangeNewKey] boolValue];
+
+ for (NSTableColumn *column in [consoleTableView tableColumns])
+ {
+ [[column dataCell] setFont:(useMonospacedFont) ? [NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ }
+
+ [consoleTableView reloadData];
+ }
}
/**
diff --git a/Source/SPServerVariablesController.m b/Source/SPServerVariablesController.m
index 17bb5ba0..3046c2dd 100644
--- a/Source/SPServerVariablesController.m
+++ b/Source/SPServerVariablesController.m
@@ -59,8 +59,21 @@
*/
- (void)awakeFromNib
{
+ NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
+
// Set the process table view's vertical gridlines if required
- [variablesTableView setGridStyleMask:([[NSUserDefaults standardUserDefaults] boolForKey:SPDisplayTableViewVerticalGridlines]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone];
+ [variablesTableView setGridStyleMask:([prefs boolForKey:SPDisplayTableViewVerticalGridlines]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone];
+
+ // Set the strutcture and index view's font
+ BOOL useMonospacedFont = [prefs boolForKey:SPUseMonospacedFonts];
+
+ for (NSTableColumn *column in [variablesTableView tableColumns])
+ {
+ [[column dataCell] setFont:(useMonospacedFont) ? [NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ }
+
+ // Register as an observer for the when the UseMonospacedFonts preference changes
+ [prefs addObserver:self forKeyPath:SPUseMonospacedFonts options:NSKeyValueObservingOptionNew context:NULL];
}
#pragma mark -
@@ -199,9 +212,22 @@
*/
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
+ // Display table veiew vertical gridlines preference changed
if ([keyPath isEqualToString:SPDisplayTableViewVerticalGridlines]) {
[variablesTableView setGridStyleMask:([[change objectForKey:NSKeyValueChangeNewKey] boolValue]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone];
}
+ // Use monospaced fonts preference changed
+ else if ([keyPath isEqualToString:SPUseMonospacedFonts]) {
+
+ BOOL useMonospacedFont = [[change objectForKey:NSKeyValueChangeNewKey] boolValue];
+
+ for (NSTableColumn *column in [variablesTableView tableColumns])
+ {
+ [[column dataCell] setFont:(useMonospacedFont) ? [NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ }
+
+ [variablesTableView reloadData];
+ }
}
#pragma mark -
diff --git a/Source/SPTooltip.m b/Source/SPTooltip.m
index 9b321005..5a0bd954 100644
--- a/Source/SPTooltip.m
+++ b/Source/SPTooltip.m
@@ -31,7 +31,7 @@
//
// [SPTooltip showWithObject:@"<h1>Hello</h1>I am a <b>tooltip</b>" ofType:@"html"
// displayOptions:[NSDictionary dictionaryWithObjectsAndKeys:
-// @"Monaco", @"fontname",
+// SPDefaultMonospacedFontName, @"fontname",
// @"#EEEEEE", @"backgroundcolor",
// @"20", @"fontsize",
// @"transparent", @"transparent", nil]];
diff --git a/Source/TableContent.m b/Source/TableContent.m
index d479a3a3..552fbd41 100644
--- a/Source/TableContent.m
+++ b/Source/TableContent.m
@@ -119,11 +119,14 @@
return self;
}
+/**
+ * Initialise various interface controls
+ */
- (void)awakeFromNib
{
// Set the table content view's vertical gridlines if required
[tableContentView setGridStyleMask:([prefs boolForKey:SPDisplayTableViewVerticalGridlines]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone];
-
+
// Add observers for document task activity
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(startDocumentTaskForTab:)
@@ -319,11 +322,7 @@
}
// Set the data cell font according to the preferences
- if ( [prefs boolForKey:SPUseMonospacedFonts] ) {
- [dataCell setFont:[NSFont fontWithName:@"Monaco" size:10]];
- } else {
- [dataCell setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
- }
+ [dataCell setFont:([prefs boolForKey:SPUseMonospacedFonts]) ? [NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
// Assign the data cell
[theCol setDataCell:dataCell];
@@ -1257,14 +1256,8 @@
[tableContentView setVerticalMotionCanBeginDrag:NO];
- if ( [prefs boolForKey:SPUseMonospacedFonts] ) {
- [argumentField setFont:[NSFont fontWithName:@"Monaco" size:10]];
- [limitRowsField setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
- } else {
- [limitRowsField setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
- [argumentField setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
- }
[limitRowsStepper setEnabled:NO];
+
if ( ![prefs boolForKey:SPLimitResults] ) {
[limitRowsField setStringValue:@""];
}
@@ -2878,9 +2871,22 @@
*/
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
+ // Display table veiew vertical gridlines preference changed
if ([keyPath isEqualToString:SPDisplayTableViewVerticalGridlines]) {
[tableContentView setGridStyleMask:([[change objectForKey:NSKeyValueChangeNewKey] boolValue]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone];
}
+ // Use monospaced fonts preference changed
+ else if ([keyPath isEqualToString:SPUseMonospacedFonts]) {
+
+ BOOL useMonospacedFont = [[change objectForKey:NSKeyValueChangeNewKey] boolValue];
+
+ for (NSTableColumn *column in [tableContentView tableColumns])
+ {
+ [[column dataCell] setFont:(useMonospacedFont) ? [NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ }
+
+ [tableContentView reloadData];
+ }
}
/**
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index df856d33..69fc54d5 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -174,6 +174,12 @@
[prefs addObserver:tableRelationsInstance forKeyPath:SPDisplayTableViewVerticalGridlines options:NSKeyValueObservingOptionNew context:NULL];
[prefs addObserver:[SPQueryController sharedQueryController] forKeyPath:SPDisplayTableViewVerticalGridlines options:NSKeyValueObservingOptionNew context:NULL];
+ // Register observers for the when the UseMonospacedFonts preference changes
+ [prefs addObserver:tableSourceInstance forKeyPath:SPUseMonospacedFonts options:NSKeyValueObservingOptionNew context:NULL];
+ [prefs addObserver:tableContentInstance forKeyPath:SPUseMonospacedFonts options:NSKeyValueObservingOptionNew context:NULL];
+ [prefs addObserver:customQueryInstance forKeyPath:SPUseMonospacedFonts options:NSKeyValueObservingOptionNew context:NULL];
+ [prefs addObserver:[SPQueryController sharedQueryController] forKeyPath:SPUseMonospacedFonts options:NSKeyValueObservingOptionNew context:NULL];
+
// Register observers for when the logging preference changes
[prefs addObserver:[SPQueryController sharedQueryController] forKeyPath:SPConsoleEnableLogging options:NSKeyValueObservingOptionNew context:NULL];
@@ -3300,9 +3306,6 @@
[aController setShouldCascadeWindows:YES];
[super windowControllerDidLoadNib:aController];
- //NSEnumerator *theCols = [[variablesTableView tableColumns] objectEnumerator];
- //NSTableColumn *theCol;
-
//register for notifications
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willPerformQuery:)
name:@"SMySQLQueryWillBePerformed" object:self];
@@ -3310,21 +3313,6 @@
name:@"SMySQLQueryHasBeenPerformed" object:self];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillTerminate:)
name:@"NSApplicationWillTerminateNotification" object:nil];
-
- //set up interface
- /*if ( [prefs boolForKey:SPUseMonospacedFonts] ) {
- [[SPQueryController sharedQueryController] setConsoleFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
-
- while ( (theCol = [theCols nextObject]) ) {
- [[theCol dataCell] setFont:[NSFont fontWithName:@"Monaco" size:10]];
- }
- } else {
- [[SPQueryController sharedQueryController] setConsoleFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
-
- while ( (theCol = [theCols nextObject]) ) {
- [[theCol dataCell] setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
- }
- }*/
}
// NSWindow delegate methods
diff --git a/Source/TableDump.m b/Source/TableDump.m
index 02e46cd7..90c27a42 100644
--- a/Source/TableDump.m
+++ b/Source/TableDump.m
@@ -2525,14 +2525,14 @@
[switchButton release];
if ( [prefs boolForKey:SPUseMonospacedFonts] ) {
[[[exportDumpTableView tableColumnWithIdentifier:@"tables"] dataCell]
- setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
+ setFont:[NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]]];
[[[exportMultipleCSVTableView tableColumnWithIdentifier:@"tables"] dataCell]
- setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
+ setFont:[NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]]];
[[[exportMultipleXMLTableView tableColumnWithIdentifier:@"tables"] dataCell]
- setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
+ setFont:[NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]]];
[[[fieldMappingTableView tableColumnWithIdentifier:@"0"] dataCell]
- setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
- [errorsView setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
+ setFont:[NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]]];
+ [errorsView setFont:[NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]]];
} else {
[[[exportDumpTableView tableColumnWithIdentifier:@"tables"] dataCell]
setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
@@ -2544,7 +2544,6 @@
setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
[errorsView setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
}
- // [self reloadTables:self];
}
#pragma mark -
@@ -2552,30 +2551,15 @@
- (int)numberOfRowsInTableView:(NSTableView *)aTableView;
{
- if ( aTableView == fieldMappingTableView ) {
- return [fieldMappingTableColumnNames count];
- } else {
- return [tables count];
- }
+ return (aTableView == fieldMappingTableView) ? [fieldMappingTableColumnNames count] : [tables count];
}
-- (void)tableView:(NSTableView *)aTableView
- willDisplayCell:(id)aCell
- forTableColumn:(NSTableColumn *)aTableColumn
- row:(int)rowIndex
+- (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
{
- if ( [[NSUserDefaults standardUserDefaults] boolForKey:SPUseMonospacedFonts] ) {
- [aCell setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
- }
- else
- {
- [aCell setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
- }
+ [aCell setFont:([prefs boolForKey:SPUseMonospacedFonts]) ? [NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
}
-- (id)tableView:(NSTableView *)aTableView
-objectValueForTableColumn:(NSTableColumn *)aTableColumn
- row:(int)rowIndex
+- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
{
id returnObject = nil;
@@ -2603,15 +2587,12 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn
return returnObject;
}
-- (void)tableView:(NSTableView *)aTableView
- setObjectValue:(id)anObject
- forTableColumn:(NSTableColumn *)aTableColumn
- row:(int)rowIndex
+- (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
{
if ( aTableView == fieldMappingTableView ) {
[fieldMappingArray replaceObjectAtIndex:rowIndex withObject:anObject];
-
- } else {
+ }
+ else {
[[tables objectAtIndex:rowIndex] replaceObjectAtIndex:0 withObject:anObject];
}
}
diff --git a/Source/TableSource.m b/Source/TableSource.m
index 4d89ddbf..932d9cdd 100644
--- a/Source/TableSource.m
+++ b/Source/TableSource.m
@@ -216,28 +216,9 @@ loads aTable, put it in an array, update the tableViewColumns and reload the tab
} else {
[indexedColumnsField setNumberOfVisibleItems:10];
}
-
- // Reset font for field and index table
- NSEnumerator *indexColumnsEnumerator = [[indexView tableColumns] objectEnumerator];
- NSEnumerator *fieldColumnsEnumerator = [[tableSourceView tableColumns] objectEnumerator];
- id indexColumn;
- id fieldColumn;
- BOOL useMonospacedFont = [prefs boolForKey:SPUseMonospacedFonts];
-
- while ( (indexColumn = [indexColumnsEnumerator nextObject]) )
- if ( useMonospacedFont )
- [[indexColumn dataCell] setFont:[NSFont fontWithName:@"Monaco" size:10]];
- else
- [[indexColumn dataCell] setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
-
- while ( (fieldColumn = [fieldColumnsEnumerator nextObject]) )
- if ( useMonospacedFont )
- [[fieldColumn dataCell] setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
- else
- [[fieldColumn dataCell] setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
-
- [tableSourceView reloadData];
+
[indexView reloadData];
+ [tableSourceView reloadData];
// display and *then* tile to force scroll bars to be in the correct position
[[tableSourceView enclosingScrollView] display];
@@ -246,8 +227,8 @@ loads aTable, put it in an array, update the tableViewColumns and reload the tab
// Enable 'Duplicate field' if at least one field is specified
// if no field is selected 'Duplicate field' will copy the last field
// Enable 'Duplicate field' only for tables!
- if([tablesListInstance tableType] == SP_TABLETYPE_TABLE)
- [copyFieldButton setEnabled:enableInteraction && ([tableSourceView numberOfRows] > 0)];
+ if ([tablesListInstance tableType] == SP_TABLETYPE_TABLE)
+ [copyFieldButton setEnabled:enableInteraction && ([tableSourceView numberOfRows] > 0)];
else
[copyFieldButton setEnabled:NO];
@@ -255,9 +236,9 @@ loads aTable, put it in an array, update the tableViewColumns and reload the tab
[[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
}
-/*
-reloads the table (performing a new mysql-query)
-*/
+/**
+ * Reloads the table (performing a new mysql-query)
+ */
- (IBAction)reloadTable:(id)sender
{
[tableDataInstance resetAllData];
@@ -265,7 +246,6 @@ reloads the table (performing a new mysql-query)
[self loadTable:selectedTable];
}
-
#pragma mark -
#pragma mark Edit methods
@@ -482,39 +462,15 @@ closes the keySheet
#pragma mark -
#pragma mark Additional methods
-/*
-sets the connection (received from TableDocument) and makes things that have to be done only once
-*/
+/**
+ * Sets the connection (received from TableDocument) and makes things that have to be done only once
+ */
- (void)setConnection:(MCPConnection *)theConnection
{
- NSEnumerator *indexColumnsEnumerator = [[indexView tableColumns] objectEnumerator];
- NSEnumerator *fieldColumnsEnumerator = [[tableSourceView tableColumns] objectEnumerator];
- id indexColumn;
- id fieldColumn;
-
mySQLConnection = theConnection;
- //set up tableView
+ // Set up tableView
[tableSourceView registerForDraggedTypes:[NSArray arrayWithObjects:@"SequelProPasteboard", nil]];
-
- while ( (indexColumn = [indexColumnsEnumerator nextObject]) ) {
- if ( [prefs boolForKey:SPUseMonospacedFonts] ) {
- [[indexColumn dataCell] setFont:[NSFont fontWithName:@"Monaco" size:10]];
- }
- else
- {
- [[indexColumn dataCell] setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
- }
- }
- while ( (fieldColumn = [fieldColumnsEnumerator nextObject]) ) {
- if ( [prefs boolForKey:SPUseMonospacedFonts] ) {
- [[fieldColumn dataCell] setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
- }
- else
- {
- [[fieldColumn dataCell] setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
- }
- }
}
/*
@@ -822,10 +778,29 @@ fetches the result as an array with a dictionary for each row in it
*/
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
+ // Display table veiew vertical gridlines preference changed
if ([keyPath isEqualToString:SPDisplayTableViewVerticalGridlines]) {
[tableSourceView setGridStyleMask:([[change objectForKey:NSKeyValueChangeNewKey] boolValue]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone];
[indexView setGridStyleMask:([[change objectForKey:NSKeyValueChangeNewKey] boolValue]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone];
}
+ // Use monospaced fonts preference changed
+ else if ([keyPath isEqualToString:SPUseMonospacedFonts]) {
+
+ BOOL useMonospacedFont = [[change objectForKey:NSKeyValueChangeNewKey] boolValue];
+
+ for (NSTableColumn *indexColumn in [indexView tableColumns])
+ {
+ [[indexColumn dataCell] setFont:(useMonospacedFont) ? [NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ }
+
+ for (NSTableColumn *fieldColumn in [tableSourceView tableColumns])
+ {
+ [[fieldColumn dataCell] setFont:(useMonospacedFont) ? [NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ }
+
+ [tableSourceView reloadData];
+ [indexView reloadData];
+ }
}
/**
@@ -1057,26 +1032,12 @@ returns a dictionary containing enum/set field names as key and possible values
return (aTableView == tableSourceView) ? [tableFields count] : [indexes count];
}
-- (id)tableView:(NSTableView *)aTableView
- objectValueForTableColumn:(NSTableColumn *)aTableColumn
- row:(int)rowIndex
-{
- id theRow, theValue;
-
- if ( aTableView == tableSourceView ) {
- theRow = [tableFields objectAtIndex:rowIndex];
- } else {
- theRow = [indexes objectAtIndex:rowIndex];
- }
- theValue = [theRow objectForKey:[aTableColumn identifier]];
-
- return theValue;
+- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
+{
+ return [(aTableView == tableSourceView) ? [tableFields objectAtIndex:rowIndex] : [indexes objectAtIndex:rowIndex] objectForKey:[aTableColumn identifier]];
}
-- (void)tableView:(NSTableView *)aTableView
- setObjectValue:(id)anObject
- forTableColumn:(NSTableColumn *)aTableColumn
- row:(int)rowIndex
+- (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
{
// Make sure that the drag operation is for the right table view
if (aTableView!=tableSourceView) return;
@@ -1369,12 +1330,12 @@ would result in a position change.
- (float)splitView:(NSSplitView *)sender constrainMaxCoordinate:(float)proposedMax ofSubviewAt:(int)offset
{
- return proposedMax - 150;
+ return proposedMax - 150;
}
- (float)splitView:(NSSplitView *)sender constrainMinCoordinate:(float)proposedMin ofSubviewAt:(int)offset
{
- return proposedMin + 150;
+ return proposedMin + 150;
}
- (NSRect)splitView:(NSSplitView *)splitView additionalEffectiveRectOfDividerAtIndex:(int)dividerIndex
@@ -1409,7 +1370,20 @@ would result in a position change.
// Set the structure and index view's vertical gridlines if required
[tableSourceView setGridStyleMask:([prefs boolForKey:SPDisplayTableViewVerticalGridlines]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone];
[indexView setGridStyleMask:([prefs boolForKey:SPDisplayTableViewVerticalGridlines]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone];
-
+
+ // Set the strutcture and index view's font
+ BOOL useMonospacedFont = [prefs boolForKey:SPUseMonospacedFonts];
+
+ for (NSTableColumn *indexColumn in [indexView tableColumns])
+ {
+ [[indexColumn dataCell] setFont:(useMonospacedFont) ? [NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ }
+
+ for (NSTableColumn *fieldColumn in [tableSourceView tableColumns])
+ {
+ [[fieldColumn dataCell] setFont:(useMonospacedFont) ? [NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ }
+
// Add observers for document task activity
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(startDocumentTaskForTab:)