aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2011-01-25 13:53:46 +0000
committerBibiko <bibiko@eva.mpg.de>2011-01-25 13:53:46 +0000
commit03573a327829b79ce13de972b32a4a7fef12e04b (patch)
tree3c98f16d8454286068ec78effb83216b1c377684 /Source
parentb97df3f6a23a4eb7e440f421c7e43a12f3203abc (diff)
downloadsequelpro-03573a327829b79ce13de972b32a4a7fef12e04b.tar.gz
sequelpro-03573a327829b79ce13de972b32a4a7fef12e04b.tar.bz2
sequelpro-03573a327829b79ce13de972b32a4a7fef12e04b.zip
• some code improvements for willDisplayCell:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPTablesList.h3
-rw-r--r--Source/SPTablesList.m64
2 files changed, 44 insertions, 23 deletions
diff --git a/Source/SPTablesList.h b/Source/SPTablesList.h
index e53fb178..7729ed1d 100644
--- a/Source/SPTablesList.h
+++ b/Source/SPTablesList.h
@@ -103,6 +103,9 @@
BOOL tableListContainsViews;
BOOL alertSheetOpened;
+
+ NSFont *smallSystemFont;
+
}
// IBAction methods
diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m
index 6d96956c..a0a9bf92 100644
--- a/Source/SPTablesList.m
+++ b/Source/SPTablesList.m
@@ -1477,34 +1477,51 @@
/**
* Table view delegate method
*/
-- (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
+- (void)tableView:(NSTableView *)aTableView willDisplayCell:(ImageAndTextCell*)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
- if (rowIndex > 0 && rowIndex < [filteredTableTypes count]
- && [[aTableColumn identifier] isEqualToString:@"tables"]) {
- if(![[filteredTables objectAtIndex:rowIndex] isKindOfClass:[NSString class]]) {
- [(ImageAndTextCell*)aCell setImage:nil];
- [(ImageAndTextCell*)aCell setIndentationLevel:0];
- }
- else if ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SPTableTypeView) {
- [(ImageAndTextCell*)aCell setImage:[NSImage imageNamed:@"table-view-small"]];
- } else if ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SPTableTypeTable) {
- [(ImageAndTextCell*)aCell setImage:[NSImage imageNamed:@"table-small"]];
- } else if ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SPTableTypeProc) {
- [(ImageAndTextCell*)aCell setImage:[NSImage imageNamed:@"proc-small"]];
- } else if ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SPTableTypeFunc) {
- [(ImageAndTextCell*)aCell setImage:[NSImage imageNamed:@"func-small"]];
+ if (rowIndex > 0 && rowIndex < [filteredTableTypes count] && [[aTableColumn identifier] isEqualToString:@"tables"]) {
+
+ id item = NSArrayObjectAtIndex(filteredTables, rowIndex);
+
+ if(![item isKindOfClass:[NSString class]]) {
+ [aCell setImage:nil];
+ [aCell setIndentationLevel:0];
+ return;
}
- if ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SPTableTypeNone) {
- [(ImageAndTextCell*)aCell setImage:nil];
- [(ImageAndTextCell*)aCell setIndentationLevel:0];
- } else {
- [(ImageAndTextCell*)aCell setIndentationLevel:1];
- [(ImageAndTextCell*)aCell setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ switch([NSArrayObjectAtIndex(filteredTableTypes, rowIndex) integerValue]) {
+ case SPTableTypeView:
+ [aCell setImage:[NSImage imageNamed:@"table-view-small"]];
+ [aCell setIndentationLevel:1];
+ [aCell setFont:smallSystemFont];
+ break;
+ case SPTableTypeTable:
+ [aCell setImage:[NSImage imageNamed:@"table-small"]];
+ [aCell setIndentationLevel:1];
+ [aCell setFont:smallSystemFont];
+ break;
+ case SPTableTypeProc:
+ [aCell setImage:[NSImage imageNamed:@"proc-small"]];
+ [aCell setIndentationLevel:1];
+ [aCell setFont:smallSystemFont];
+ break;
+ case SPTableTypeFunc:
+ [aCell setImage:[NSImage imageNamed:@"func-small"]];
+ [aCell setIndentationLevel:1];
+ [aCell setFont:smallSystemFont];
+ break;
+ case SPTableTypeNone:
+ [aCell setImage:nil];
+ [aCell setIndentationLevel:0];
+ break;
+ default:
+ [aCell setIndentationLevel:1];
+ [aCell setFont:smallSystemFont];
}
+
} else {
- [(ImageAndTextCell*)aCell setImage:nil];
- [(ImageAndTextCell*)aCell setIndentationLevel:0];
+ [aCell setImage:nil];
+ [aCell setIndentationLevel:0];
}
}
@@ -1775,6 +1792,7 @@
selectedTableType = SPTableTypeNone;
selectedTableName = nil;
[tables addObject:NSLocalizedString(@"TABLES",@"header for table list")];
+ smallSystemFont = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]];
}
return self;