aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTableStructure.m
diff options
context:
space:
mode:
authorStuart Connolly <stuart02@gmail.com>2014-05-26 23:01:08 +0100
committerStuart Connolly <stuart02@gmail.com>2014-05-26 23:01:08 +0100
commitf25c62d78bbd5d6fbe7a6fac09294317ccd3eeaf (patch)
treef9cdf6b0ef6bdac0ceb25283997aded6cf3e3906 /Source/SPTableStructure.m
parentafadd0273178b5803b11ba69a37b6a1138771216 (diff)
downloadsequelpro-f25c62d78bbd5d6fbe7a6fac09294317ccd3eeaf.tar.gz
sequelpro-f25c62d78bbd5d6fbe7a6fac09294317ccd3eeaf.tar.bz2
sequelpro-f25c62d78bbd5d6fbe7a6fac09294317ccd3eeaf.zip
Add a hidden preference to control the size of the UI's monospaced font.
Diffstat (limited to 'Source/SPTableStructure.m')
-rw-r--r--Source/SPTableStructure.m22
1 files changed, 13 insertions, 9 deletions
diff --git a/Source/SPTableStructure.m b/Source/SPTableStructure.m
index 807ff1ae..05bf1186 100644
--- a/Source/SPTableStructure.m
+++ b/Source/SPTableStructure.m
@@ -100,17 +100,20 @@ static NSString *SPRemoveFieldAndForeignKey = @"SPRemoveFieldAndForeignKey";
{
#ifndef SP_CODA /* ui manipulation */
// Set the structure and index view's vertical gridlines if required
- [tableSourceView setGridStyleMask:([prefs boolForKey:SPDisplayTableViewVerticalGridlines]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone];
- [indexesTableView setGridStyleMask:([prefs boolForKey:SPDisplayTableViewVerticalGridlines]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone];
+ [tableSourceView setGridStyleMask:[prefs boolForKey:SPDisplayTableViewVerticalGridlines] ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone];
+ [indexesTableView setGridStyleMask:[prefs boolForKey:SPDisplayTableViewVerticalGridlines] ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone];
#endif
// Set the double-click action in blank areas of the table to create new rows
[tableSourceView setEmptyDoubleClickAction:@selector(addField:)];
#ifndef SP_CODA /* set font from prefs */
+ BOOL useMonospacedFont = [prefs boolForKey:SPUseMonospacedFonts];
+ NSInteger monospacedFontSize = [prefs integerForKey:SPMonospacedFontSize] > 0 ? [prefs integerForKey:SPMonospacedFontSize] : [NSFont smallSystemFontSize];
+
// Set the strutcture and index view's font
- [tableSourceView setFont:([prefs boolForKey:SPUseMonospacedFonts]) ? [NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
- [indexesTableView setFont:([prefs boolForKey:SPUseMonospacedFonts]) ? [NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ [tableSourceView setFont:useMonospacedFont ? [NSFont fontWithName:SPDefaultMonospacedFontName size:monospacedFontSize] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ [indexesTableView setFont:useMonospacedFont ? [NSFont fontWithName:SPDefaultMonospacedFontName size:monospacedFontSize] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
#endif
extraFieldSuggestions = [[NSArray arrayWithObjects:
@@ -1159,7 +1162,7 @@ static NSString *SPRemoveFieldAndForeignKey = @"SPRemoveFieldAndForeignKey";
else {
[self cancelRowEditing];
}
-
+
[tableSourceView reloadData];
}
@@ -1178,11 +1181,12 @@ static NSString *SPRemoveFieldAndForeignKey = @"SPRemoveFieldAndForeignKey";
}
// Use monospaced fonts preference changed
else if ([keyPath isEqualToString:SPUseMonospacedFonts]) {
-
+
BOOL useMonospacedFont = [[change objectForKey:NSKeyValueChangeNewKey] boolValue];
-
- [tableSourceView setFont:(useMonospacedFont) ? [NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
- [indexesTableView setFont:(useMonospacedFont) ? [NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ CGFloat monospacedFontSize = [prefs floatForKey:SPMonospacedFontSize] > 0 ? [prefs floatForKey:SPMonospacedFontSize] : [NSFont smallSystemFontSize];
+
+ [tableSourceView setFont:useMonospacedFont ? [NSFont fontWithName:SPDefaultMonospacedFontName size:monospacedFontSize] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ [indexesTableView setFont:useMonospacedFont ? [NSFont fontWithName:SPDefaultMonospacedFontName size:monospacedFontSize] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
[tableSourceView reloadData];
[indexesTableView reloadData];