Revision: 3095
          http://skim-app.svn.sourceforge.net/skim-app/?rev=3095&view=rev
Author:   hofman
Date:     2007-10-30 03:49:51 -0700 (Tue, 30 Oct 2007)

Log Message:
-----------
Set width of page column separately for different tables.

Modified Paths:
--------------
    trunk/SKMainWindowController.m
    trunk/SKThumbnailTableView.m

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2007-10-29 13:58:05 UTC (rev 3094)
+++ trunk/SKMainWindowController.m      2007-10-30 10:49:51 UTC (rev 3095)
@@ -807,11 +807,25 @@
     [statusBar setRightStringValue:message];
 }
 
+- (void)updatePageColumnWidthForTableView:(NSTableView *)tv {
+    NSTableColumn *tableColumn = [tv tableColumnWithIdentifier:@"page"];
+    id cell = [tableColumn dataCell];
+    float labelWidth = 0.0;
+    NSEnumerator *labelEnum = [pageLabels objectEnumerator];
+    NSString *label;
+    
+    while (label = [labelEnum nextObject]) {
+        [cell setStringValue:label];
+        labelWidth = fmaxf(labelWidth, [cell cellSize].width);
+    }
+    
+    [tableColumn setMinWidth:labelWidth];
+    [tableColumn setMaxWidth:labelWidth];
+    [tv sizeToFit];
+}
+
 - (void)updatePageLabelsAndOutline {
     PDFDocument *pdfDoc = [pdfView document];
-    NSTableColumn *tableColumn = [thumbnailTableView 
tableColumnWithIdentifier:@"page"];
-    id cell = [tableColumn dataCell];
-    float labelWidth = 0.0;
     int i, count = [pdfDoc pageCount];
     
     // update page labels, also update the size of the table columns 
displaying the labels
@@ -823,23 +837,13 @@
         if (label == nil)
             label = [NSString stringWithFormat:@"%i", i+1];
         [pageLabels addObject:label];
-        [cell setStringValue:label];
-        labelWidth = fmaxf(labelWidth, [cell cellSize].width);
     }
     [self didChangeValueForKey:@"pageLabels"];
     [self didChangeValueForKey:@"pageLabel"];
     
-    [tableColumn setMinWidth:labelWidth];
-    [tableColumn setMaxWidth:labelWidth];
-    [thumbnailTableView sizeToFit];
-    tableColumn = [outlineView tableColumnWithIdentifier:@"page"];
-    [tableColumn setMinWidth:labelWidth];
-    [tableColumn setMaxWidth:labelWidth];
-    [outlineView sizeToFit];
-    tableColumn = [snapshotTableView tableColumnWithIdentifier:@"page"];
-    [tableColumn setMinWidth:labelWidth];
-    [tableColumn setMaxWidth:labelWidth];
-    [snapshotTableView sizeToFit];
+    [self updatePageColumnWidthForTableView:thumbnailTableView];
+    [self updatePageColumnWidthForTableView:snapshotTableView];
+    [self updatePageColumnWidthForTableView:outlineView];
     
     // this uses the pageLabels
     [[thumbnailTableView typeSelectHelper] rebuildTypeSelectSearchCache];
@@ -3441,7 +3445,7 @@
 
 - (float)outlineView:(NSOutlineView *)ov heightOfRowByItem:(id)item {
     if ([ov isEqual:outlineView]) {
-        return 17.0;
+        return [ov rowHeight];
     } else if ([ov isEqual:noteOutlineView]) {
         // the item is an opaque wrapper object used for binding. The actual 
note is is given by -observedeObject. I don't know of any alternative (read 
public) way to get the actual item
         if ([item respondsToSelector:@selector(rowHeight)] == NO)

Modified: trunk/SKThumbnailTableView.m
===================================================================
--- trunk/SKThumbnailTableView.m        2007-10-29 13:58:05 UTC (rev 3094)
+++ trunk/SKThumbnailTableView.m        2007-10-30 10:49:51 UTC (rev 3095)
@@ -207,8 +207,12 @@
 }
 
 - (void)setObjectValue:(id)anObject {
-    [super setObjectValue:[anObject valueForKey:@"label"]];
-    hasWindow = [[anObject valueForKey:@"hasWindow"] boolValue];
+    if ([anObject isKindOfClass:[NSString class]]) {
+        [super setObjectValue:anObject];
+    } else {
+        [super setObjectValue:[anObject valueForKey:@"label"]];
+        hasWindow = [[anObject valueForKey:@"hasWindow"] boolValue];
+    }
 }
 
 - (id)objectValue {


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: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to