aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMTextView.m88
-rw-r--r--Source/CustomQuery.m44
-rw-r--r--Source/SPConstants.h1
-rw-r--r--Source/SPConstants.m1
-rw-r--r--Source/SPPreferenceController.h4
-rw-r--r--Source/SPPreferenceController.m38
-rw-r--r--Source/SPTableView.m11
-rw-r--r--Source/TableContent.m20
-rw-r--r--Source/TableDocument.m8
9 files changed, 130 insertions, 85 deletions
diff --git a/Source/CMTextView.m b/Source/CMTextView.m
index e025296c..5afd08cb 100644
--- a/Source/CMTextView.m
+++ b/Source/CMTextView.m
@@ -169,6 +169,19 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
prefs = [[NSUserDefaults standardUserDefaults] retain];
+ [self setQueryHiliteColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorHighlightQueryColor]]];
+ [self setQueryEditorBackgroundColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorBackgroundColor]]];
+ [self setCommentColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorCommentColor]]];
+ [self setQuoteColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorQuoteColor]]];
+ [self setKeywordColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorSQLKeywordColor]]];
+ [self setBacktickColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorBacktickColor]]];
+ [self setNumericColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorNumericColor]]];
+ [self setVariableColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorVariableColor]]];
+ [self setOtherTextColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorTextColor]]];
+ [self setTextColor:[self otherTextColor]];
+ [self setInsertionPointColor:[self otherTextColor]];
+ [self setShouldHiliteQuery:[prefs boolForKey:SPCustomQueryHighlightCurrentQuery]];
+
// Register observers for the when editor background colors preference changes
[prefs addObserver:self forKeyPath:SPCustomQueryEditorBackgroundColor options:NSKeyValueObservingOptionNew context:NULL];
[prefs addObserver:self forKeyPath:SPCustomQueryEditorHighlightQueryColor options:NSKeyValueObservingOptionNew context:NULL];
@@ -205,32 +218,32 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
[self setNeedsDisplay:YES];
} else if ([keyPath isEqualToString:SPCustomQueryEditorCommentColor]) {
[self setCommentColor:[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]]];
- if([[self string] length]<100000)
+ if([[self string] length]<100000 && [self isEditable])
[self performSelector:@selector(doSyntaxHighlighting) withObject:nil afterDelay:0.1];
} else if ([keyPath isEqualToString:SPCustomQueryEditorQuoteColor]) {
[self setQuoteColor:[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]]];
- if([[self string] length]<100000)
+ if([[self string] length]<100000 && [self isEditable])
[self performSelector:@selector(doSyntaxHighlighting) withObject:nil afterDelay:0.1];
} else if ([keyPath isEqualToString:SPCustomQueryEditorSQLKeywordColor]) {
[self setKeywordColor:[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]]];
- if([[self string] length]<100000)
+ if([[self string] length]<100000 && [self isEditable])
[self performSelector:@selector(doSyntaxHighlighting) withObject:nil afterDelay:0.1];
} else if ([keyPath isEqualToString:SPCustomQueryEditorBacktickColor]) {
[self setBacktickColor:[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]]];
- if([[self string] length]<100000)
+ if([[self string] length]<100000 && [self isEditable])
[self performSelector:@selector(doSyntaxHighlighting) withObject:nil afterDelay:0.1];
} else if ([keyPath isEqualToString:SPCustomQueryEditorNumericColor]) {
[self setNumericColor:[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]]];
- if([[self string] length]<100000)
+ if([[self string] length]<100000 && [self isEditable])
[self performSelector:@selector(doSyntaxHighlighting) withObject:nil afterDelay:0.1];
} else if ([keyPath isEqualToString:SPCustomQueryEditorVariableColor]) {
[self setVariableColor:[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]]];
- if([[self string] length]<100000)
+ if([[self string] length]<100000 && [self isEditable])
[self performSelector:@selector(doSyntaxHighlighting) withObject:nil afterDelay:0.1];
} else if ([keyPath isEqualToString:SPCustomQueryEditorTextColor]) {
[self setOtherTextColor:[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]]];
[self setTextColor:[self otherTextColor]];
- if([[self string] length]<100000)
+ if([[self string] length]<100000 && [self isEditable])
[self performSelector:@selector(doSyntaxHighlighting) withObject:nil afterDelay:0.1];
}
}
@@ -2981,37 +2994,42 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
[[self queryEditorBackgroundColor] setFill];
NSRectFill(rect);
- // Highlightes the current query if set in the Pref and no snippet session
- // and if nothing is selected in the text view
- if ([self shouldHiliteQuery] && snippetControlCounter<=-1 && ![self selectedRange].length) {
- NSUInteger rectCount;
- [[self textStorage] ensureAttributesAreFixedInRange:[self queryRange]];
- NSRectArray queryRects = [[self layoutManager] rectArrayForCharacterRange: [self queryRange]
- withinSelectedCharacterRange: [self queryRange]
- inTextContainer: [self textContainer]
- rectCount: &rectCount ];
- [[self queryHiliteColor] setFill];
- NSRectFillList(queryRects, rectCount);
- }
+ if([[self delegate] isKindOfClass:[CustomQuery class]]) {
+
+ // Highlightes the current query if set in the Pref and no snippet session
+ // and if nothing is selected in the text view
+ if ([self shouldHiliteQuery] && snippetControlCounter<=-1 && ![self selectedRange].length) {
+ NSUInteger rectCount;
+ [[self textStorage] ensureAttributesAreFixedInRange:[self queryRange]];
+ NSRectArray queryRects = [[self layoutManager] rectArrayForCharacterRange: [self queryRange]
+ withinSelectedCharacterRange: [self queryRange]
+ inTextContainer: [self textContainer]
+ rectCount: &rectCount ];
+ [[self queryHiliteColor] setFill];
+ NSRectFillList(queryRects, rectCount);
+ }
- // Highlight snippets coming from the Query Favorite text macro
- if(snippetControlCounter > -1) {
- for(NSUInteger i=0; i<snippetControlMax; i++) {
- if(snippetControlArray[i][0] > -1) {
- // choose the colors for the snippet parts
- if(i == currentSnippetIndex) {
- [[NSColor colorWithCalibratedRed:1.0 green:0.6 blue:0.0 alpha:0.4] setFill];
- [[NSColor colorWithCalibratedRed:1.0 green:0.6 blue:0.0 alpha:0.8] setStroke];
- } else {
- [[NSColor colorWithCalibratedRed:1.0 green:0.8 blue:0.2 alpha:0.2] setFill];
- [[NSColor colorWithCalibratedRed:1.0 green:0.8 blue:0.2 alpha:0.5] setStroke];
+ // Highlight snippets coming from the Query Favorite text macro
+ if(snippetControlCounter > -1) {
+ for(NSUInteger i=0; i<snippetControlMax; i++) {
+ if(snippetControlArray[i][0] > -1) {
+ // choose the colors for the snippet parts
+ if(i == currentSnippetIndex) {
+ [[NSColor colorWithCalibratedRed:1.0 green:0.6 blue:0.0 alpha:0.4] setFill];
+ [[NSColor colorWithCalibratedRed:1.0 green:0.6 blue:0.0 alpha:0.8] setStroke];
+ } else {
+ [[NSColor colorWithCalibratedRed:1.0 green:0.8 blue:0.2 alpha:0.2] setFill];
+ [[NSColor colorWithCalibratedRed:1.0 green:0.8 blue:0.2 alpha:0.5] setStroke];
+ }
+ NSBezierPath *snippetPath = [self roundedBezierPathAroundRange: NSMakeRange(snippetControlArray[i][0],snippetControlArray[i][1]) ];
+ [snippetPath fill];
+ [snippetPath stroke];
}
- NSBezierPath *snippetPath = [self roundedBezierPathAroundRange: NSMakeRange(snippetControlArray[i][0],snippetControlArray[i][1]) ];
- [snippetPath fill];
- [snippetPath stroke];
}
}
+
}
+
[super drawRect:rect];
}
@@ -3275,11 +3293,11 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
}
/*
- * Show only setable modes in the font panel
+ * Set font panel's valid modes
*/
- (NSUInteger)validModesForFontPanel:(NSFontPanel *)fontPanel
{
- return (NSFontPanelFaceModeMask | NSFontPanelSizeModeMask);
+ return (NSFontPanelSizeModeMask|NSFontPanelCollectionModeMask);
}
#pragma mark -
diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m
index 1bc06e48..fd8af332 100644
--- a/Source/CustomQuery.m
+++ b/Source/CustomQuery.m
@@ -399,7 +399,7 @@
*/
- (NSUInteger)validModesForFontPanel:(NSFontPanel *)fontPanel
{
- return (NSFontPanelAllModesMask ^ NSFontPanelAllEffectsModeMask);
+ return (NSFontPanelSizeModeMask|NSFontPanelCollectionModeMask);
}
#pragma mark -
@@ -482,6 +482,8 @@
NSUInteger queryCount = [queries count];
NSMutableArray *tempQueries = [NSMutableArray arrayWithCapacity:queryCount];
+ NSFont *tableFont = [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPGlobalResultTableFont]];
+ [customQueryView setRowHeight:2.0f+NSSizeToCGSize([[NSString stringWithString:@"{ǞṶḹÜ∑zgyf"] sizeWithAttributes:[NSDictionary dictionaryWithObject:tableFont forKey:NSFontAttributeName]]).height];
// Enable task cancellation
if (queryCount > 1)
@@ -533,7 +535,8 @@
SPTextAndLinkCell *dataCell = [[[SPTextAndLinkCell alloc] initTextCell:@""] autorelease];
[dataCell setEditable:YES];
[dataCell setFormatter:[[SPDataCellFormatter new] autorelease]];
- [dataCell setFont:([prefs boolForKey:SPUseMonospacedFonts]) ? [NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ [dataCell setFont:tableFont];
+
[dataCell setLineBreakMode:NSLineBreakByTruncatingTail];
[theCol setDataCell:dataCell];
[[theCol headerCell] setStringValue:NSArrayObjectAtIndex(theColumns, j)];
@@ -855,7 +858,7 @@
// Init copyTable with necessary information for copying selected rows as SQL INSERT
[customQueryView setTableInstance:self withTableData:resultData withColumns:cqColumnDefinition withTableName:resultTableName withConnection:mySQLConnection];
-
+
//query finished
[[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
@@ -1276,22 +1279,6 @@
// Set up the interface
[textView setAllowsDocumentBackgroundColorChange:YES];
- [textView setTextColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorTextColor]]];
- [textView setInsertionPointColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorCaretColor]]];
-
- [textView setQueryHiliteColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorHighlightQueryColor]]];
- [textView setQueryEditorBackgroundColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorBackgroundColor]]];
-
- [textView setCommentColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorCommentColor]]];
- [textView setQuoteColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorQuoteColor]]];
- [textView setKeywordColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorSQLKeywordColor]]];
- [textView setBacktickColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorBacktickColor]]];
- [textView setNumericColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorNumericColor]]];
- [textView setVariableColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorVariableColor]]];
- [textView setOtherTextColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorTextColor]]];
- [textView setTextColor:[textView otherTextColor]];
-
- [textView setShouldHiliteQuery:[prefs boolForKey:SPCustomQueryHighlightCurrentQuery]];
[customQueryView setVerticalMotionCanBeginDrag:NO];
[textView setContinuousSpellCheckingEnabled:NO];
@@ -2822,16 +2809,11 @@
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]]];
- }
-
+ // Result Table Font preference changed
+ else if ([keyPath isEqualToString:SPGlobalResultTableFont]) {
+ NSFont *tableFont = [NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]];
+ [customQueryView setRowHeight:2.0f+NSSizeToCGSize([[NSString stringWithString:@"{ǞṶḹÜ∑zgyf"] sizeWithAttributes:[NSDictionary dictionaryWithObject:tableFont forKey:NSFontAttributeName]]).height];
+ [customQueryView setFont:tableFont];
[customQueryView reloadData];
}
}
@@ -3101,6 +3083,10 @@
selector:@selector(endDocumentTaskForTab:)
name:SPDocumentTaskEndNotification
object:tableDocumentInstance];
+
+ [prefs addObserver:self forKeyPath:SPGlobalResultTableFont options:NSKeyValueObservingOptionNew context:NULL];
+
+
}
/**
diff --git a/Source/SPConstants.h b/Source/SPConstants.h
index a4f844d4..0c237e17 100644
--- a/Source/SPConstants.h
+++ b/Source/SPConstants.h
@@ -96,6 +96,7 @@ extern NSString *SPNewFieldsAllowNulls;
extern NSString *SPLimitResults;
extern NSString *SPLimitResultsValue;
extern NSString *SPNullValue;
+extern NSString *SPGlobalResultTableFont;
// Favorites Prefpane
extern NSString *SPFavorites;
diff --git a/Source/SPConstants.m b/Source/SPConstants.m
index f5f6e5bf..90fd0e2b 100644
--- a/Source/SPConstants.m
+++ b/Source/SPConstants.m
@@ -64,6 +64,7 @@ NSString *SPNewFieldsAllowNulls = @"NewFieldsAllowNulls";
NSString *SPLimitResults = @"LimitResults";
NSString *SPLimitResultsValue = @"LimitResultsValue";
NSString *SPNullValue = @"NullValue";
+NSString *SPGlobalResultTableFont = @"GlobalResultTableFont";
// Favorites Prefpane
NSString *SPFavorites = @"favorites";
diff --git a/Source/SPPreferenceController.h b/Source/SPPreferenceController.h
index b8cf7be3..62babfed 100644
--- a/Source/SPPreferenceController.h
+++ b/Source/SPPreferenceController.h
@@ -62,6 +62,9 @@
NSDictionary *currentFavorite;
IBOutlet NSTextField *editorFontName;
+ IBOutlet NSTextField *globalResultTableFontName;
+
+ NSInteger fontChangeTarget;
NSToolbar *toolbar;
@@ -89,6 +92,7 @@
- (IBAction)saveFavorite:(id)sender;
- (IBAction)updateDefaultFavorite:(id)sender;
- (IBAction)showCustomQueryFontPanel:(id)sender;
+- (IBAction)showGlobalResultTableFontPanel:(id)sender;
- (IBAction)setDefaultColors:(id)sender;
// Toolbar item IBAction methods
diff --git a/Source/SPPreferenceController.m b/Source/SPPreferenceController.m
index 6377153a..d7d6bdbe 100644
--- a/Source/SPPreferenceController.m
+++ b/Source/SPPreferenceController.m
@@ -57,6 +57,7 @@
keychain = nil;
favoriteNameFieldWasTouched = YES;
favoriteType = 0;
+ fontChangeTarget = 0;
}
return self;
@@ -457,6 +458,8 @@
[[self window] setShowsResizeIndicator:NO];
[toolbar setSelectedItemIdentifier:SPPreferenceToolbarTables];
+ NSFont *nf = [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPGlobalResultTableFont]];
+ [globalResultTableFontName setStringValue:[NSString stringWithFormat:@"%@, %.1f pt", [nf displayName], [nf pointSize]]];
[self _resizeWindowForContentView:tablesView];
}
@@ -1051,12 +1054,23 @@
}
// -------------------------------------------------------------------------------
+// global table font selection
+// -------------------------------------------------------------------------------
+// show the font panel
+- (IBAction)showGlobalResultTableFontPanel:(id)sender
+{
+ fontChangeTarget = 1;
+ [[NSFontPanel sharedFontPanel] setPanelFont:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPGlobalResultTableFont]] isMultiple:NO];
+ [[NSFontPanel sharedFontPanel] makeKeyAndOrderFront:self];
+}
+
+// -------------------------------------------------------------------------------
// query editor font selection
-//
// -------------------------------------------------------------------------------
// show the font panel
- (IBAction)showCustomQueryFontPanel:(id)sender
{
+ fontChangeTarget = 2;
[[NSFontPanel sharedFontPanel] setPanelFont:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorFont]] isMultiple:NO];
[[NSFontPanel sharedFontPanel] makeKeyAndOrderFront:self];
}
@@ -1076,17 +1090,29 @@
[prefs setObject:[NSArchiver archivedDataWithRootObject:[NSColor whiteColor]] forKey:SPCustomQueryEditorBackgroundColor];
}
-// set font panel's valid modes
+
+// Set font panel's valid modes
- (NSUInteger)validModesForFontPanel:(NSFontPanel *)fontPanel
{
- return (NSFontPanelAllModesMask ^ NSFontPanelAllEffectsModeMask);
+ return (NSFontPanelSizeModeMask|NSFontPanelCollectionModeMask);
}
+
// Action receiver for a font change in the font panel
- (void)changeFont:(id)sender
{
- NSFont *nf = [[NSFontPanel sharedFontPanel] panelConvertFont:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorFont]]];
- [prefs setObject:[NSArchiver archivedDataWithRootObject:nf] forKey:SPCustomQueryEditorFont];
- [editorFontName setStringValue:[NSString stringWithFormat:@"%@, %.1f pt", [nf displayName], [nf pointSize]]];
+ NSFont *nf;
+ switch(fontChangeTarget) {
+ case 1:
+ nf = [[NSFontPanel sharedFontPanel] panelConvertFont:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPGlobalResultTableFont]]];
+ [prefs setObject:[NSArchiver archivedDataWithRootObject:nf] forKey:SPGlobalResultTableFont];
+ [globalResultTableFontName setStringValue:[NSString stringWithFormat:@"%@, %.1f pt", [nf displayName], [nf pointSize]]];
+ break;
+ case 2:
+ nf = [[NSFontPanel sharedFontPanel] panelConvertFont:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorFont]]];
+ [prefs setObject:[NSArchiver archivedDataWithRootObject:nf] forKey:SPCustomQueryEditorFont];
+ [editorFontName setStringValue:[NSString stringWithFormat:@"%@, %.1f pt", [nf displayName], [nf pointSize]]];
+ break;
+ }
}
// -------------------------------------------------------------------------------
diff --git a/Source/SPTableView.m b/Source/SPTableView.m
index 753996fb..0a1592ca 100644
--- a/Source/SPTableView.m
+++ b/Source/SPTableView.m
@@ -97,4 +97,15 @@
}
+- (void)setFont:(NSFont *)font;
+{
+ NSArray *tableColumns;
+ NSUInteger columnIndex;
+
+ tableColumns = [self tableColumns];
+ columnIndex = [tableColumns count];
+ while (columnIndex--)
+ [[(NSTableColumn *)[tableColumns objectAtIndex:columnIndex] dataCell] setFont:font];
+}
+
@end
diff --git a/Source/TableContent.m b/Source/TableContent.m
index 64996349..0a397707 100644
--- a/Source/TableContent.m
+++ b/Source/TableContent.m
@@ -224,7 +224,6 @@
// Init copyTable with necessary information for copying selected rows as SQL INSERT
[tableContentView setTableInstance:self withTableData:tableValues withColumns:dataColumns withTableName:selectedTable withConnection:mySQLConnection];
-
// Post the notification that the query is finished
[[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
@@ -374,6 +373,8 @@
}
NSString *nullValue = [prefs objectForKey:SPNullValue];
+ NSFont *tableFont = [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPGlobalResultTableFont]];
+ [tableContentView setRowHeight:2.0f+NSSizeToCGSize([[NSString stringWithString:@"{ǞṶḹÜ∑zgyf"] sizeWithAttributes:[NSDictionary dictionaryWithObject:tableFont forKey:NSFontAttributeName]]).height];
// Add the new columns to the table
for ( i = 0 ; i < [dataColumns count] ; i++ ) {
@@ -419,7 +420,7 @@
}
// Set the data cell font according to the preferences
- [dataCell setFont:([prefs boolForKey:SPUseMonospacedFonts]) ? [NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ [dataCell setFont:tableFont];
// Assign the data cell
[theCol setDataCell:dataCell];
@@ -3118,16 +3119,11 @@
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]]];
- }
-
+ // Table font preference changed
+ else if ([keyPath isEqualToString:SPGlobalResultTableFont]) {
+ NSFont *tableFont = [NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]];
+ [tableContentView setRowHeight:2.0f+NSSizeToCGSize([[NSString stringWithString:@"{ǞṶḹÜ∑zgyf"] sizeWithAttributes:[NSDictionary dictionaryWithObject:tableFont forKey:NSFontAttributeName]]).height];
+ [tableContentView setFont:tableFont];
[tableContentView reloadData];
}
}
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index fecea349..368d9f94 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -179,10 +179,12 @@
// 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: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];
-
+
+ [prefs addObserver:tableContentInstance forKeyPath:SPGlobalResultTableFont options:NSKeyValueObservingOptionNew context:NULL];
+
// Register observers for when the logging preference changes
[prefs addObserver:[SPQueryController sharedQueryController] forKeyPath:SPConsoleEnableLogging options:NSKeyValueObservingOptionNew context:NULL];