aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TableDump.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2009-11-14 22:21:13 +0000
committerstuconnolly <stuart02@gmail.com>2009-11-14 22:21:13 +0000
commit694e5a55fe9f2579fdef121e3da9d300ed372f89 (patch)
tree6a3e033bc5437ef157a225d2cdf7975ea4cfb9af /Source/TableDump.m
parent1ac04adbfe9ad64a9aaa35780301309718ff85d9 (diff)
downloadsequelpro-694e5a55fe9f2579fdef121e3da9d300ed372f89.tar.gz
sequelpro-694e5a55fe9f2579fdef121e3da9d300ed372f89.tar.bz2
sequelpro-694e5a55fe9f2579fdef121e3da9d300ed372f89.zip
Updates to the 'use monospaced font' preference, making it a lot more consistent across all table views. Also includes live updating when the preference is changed as well as its implementation in the query console, process list and variables table views.
Diffstat (limited to 'Source/TableDump.m')
-rw-r--r--Source/TableDump.m43
1 files changed, 12 insertions, 31 deletions
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];
}
}