Revision: 4955
          http://skim-app.svn.sourceforge.net/skim-app/?rev=4955&view=rev
Author:   hofman
Date:     2008-11-13 16:13:24 +0000 (Thu, 13 Nov 2008)

Log Message:
-----------
Consider only text type cells for font of table or outline

Modified Paths:
--------------
    trunk/SKOutlineView.m
    trunk/SKTableView.m

Modified: trunk/SKOutlineView.m
===================================================================
--- trunk/SKOutlineView.m       2008-11-13 16:00:35 UTC (rev 4954)
+++ trunk/SKOutlineView.m       2008-11-13 16:13:24 UTC (rev 4955)
@@ -187,16 +187,26 @@
 }
 
 - (NSFont *)font {
-    NSArray *tableColumns = [self tableColumns];
-    return [tableColumns count] ? [[(NSTableColumn *)[tableColumns 
objectAtIndex:0] dataCell] font] : nil;
+    NSEnumerator *tcEnum = [[self tableColumns] objectEnumerator];
+    NSTableColumn *tc;
+    
+    while (tc = [tcEnum nextObject]) {
+        NSCell *cell = [tc dataCell];
+        if ([cell type] == NSTextCellType)
+            return [cell font];
+    }
+    return nil;
 }
 
 - (void)setFont:(NSFont *)font {
     NSEnumerator *tcEnum = [[self tableColumns] objectEnumerator];
     NSTableColumn *tc;
     
-    while (tc = [tcEnum nextObject])
-        [[tc dataCell] setFont:font];
+    while (tc = [tcEnum nextObject]) {
+        NSCell *cell = [tc dataCell];
+        if ([cell type] == NSTextCellType)
+            [cell setFont:font];
+    }
     
     [self setRowHeight:[NSLayoutManager defaultViewLineHeightForFont:font]];
     [self noteHeightOfRowsWithIndexesChanged:[NSIndexSet 
indexSetWithIndexesInRange:NSMakeRange(0, [self numberOfRows])]];

Modified: trunk/SKTableView.m
===================================================================
--- trunk/SKTableView.m 2008-11-13 16:00:35 UTC (rev 4954)
+++ trunk/SKTableView.m 2008-11-13 16:13:24 UTC (rev 4955)
@@ -158,16 +158,26 @@
 }
 
 - (NSFont *)font {
-    NSArray *tableColumns = [self tableColumns];
-    return [tableColumns count] ? [[(NSTableColumn *)[tableColumns 
objectAtIndex:0] dataCell] font] : nil;
+    NSEnumerator *tcEnum = [[self tableColumns] objectEnumerator];
+    NSTableColumn *tc;
+    
+    while (tc = [tcEnum nextObject]) {
+        NSCell *cell = [tc dataCell];
+        if ([cell type] == NSTextCellType)
+            return [cell font];
+    }
+    return nil;
 }
 
 - (void)setFont:(NSFont *)font {
     NSEnumerator *tcEnum = [[self tableColumns] objectEnumerator];
     NSTableColumn *tc;
     
-    while (tc = [tcEnum nextObject])
-        [[tc dataCell] setFont:font];
+    while (tc = [tcEnum nextObject]) {
+        NSCell *cell = [tc dataCell];
+        if ([cell type] == NSTextCellType)
+            [cell setFont:font];
+    }
     
     [self setRowHeight:[NSLayoutManager defaultViewLineHeightForFont:font]];
     [self noteHeightOfRowsWithIndexesChanged:[NSIndexSet 
indexSetWithIndexesInRange:NSMakeRange(0, [self numberOfRows])]];


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to