Revision: 14650
http://sourceforge.net/p/skim-app/code/14650
Author: hofman
Date: 2024-11-06 16:26:06 +0000 (Wed, 06 Nov 2024)
Log Message:
-----------
Better determination of page column width, tableviews can have different fonts
Modified Paths:
--------------
trunk/SKMainWindowController.m
Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m 2024-11-06 15:32:06 UTC (rev 14649)
+++ trunk/SKMainWindowController.m 2024-11-06 16:26:06 UTC (rev 14650)
@@ -712,7 +712,6 @@
NSString *label = nil;
NSString *firstLabel = nil;
CGFloat firstLabelWidth = 0.0;
- CGFloat maxWidth = MAX_PAGE_COLUMN_WIDTH;
for (NSString *aLabel in pageLabels) {
[cell setStringValue:aLabel];
@@ -726,19 +725,23 @@
}
}
- if (firstLabelWidth > labelWidth && labelWidth < MAX_PAGE_COLUMN_WIDTH_1) {
- label = firstLabel;
- maxWidth = MAX_PAGE_COLUMN_WIDTH_1;
- }
+ if (firstLabelWidth <= labelWidth)
+ firstLabel = nil;
for (NSTableView *tv in tvs) {
tableColumn = [tv tableColumnWithIdentifier:PAGE_COLUMNID];
cell = [tableColumn dataCell];
- [cell setStringValue:label];
- labelWidth = [cell cellSize].width;
+ labelWidth = 0.0;
+ if (label) {
+ [cell setStringValue:label];
+ labelWidth = fmin(ceil([cell cellSize].width),
MAX_PAGE_COLUMN_WIDTH);
+ }
if ([tv headerView])
- labelWidth = fmax(labelWidth, [[tableColumn headerCell]
cellSize].width);
- labelWidth = fmin(ceil(labelWidth), maxWidth);
+ labelWidth = fmax(labelWidth, fmin(ceil([[tableColumn headerCell]
cellSize].width), MAX_PAGE_COLUMN_WIDTH));
+ if (firstLabel) {
+ [cell setStringValue:firstLabel];
+ labelWidth = fmax(labelWidth, fmin(ceil([cell cellSize].width),
MAX_PAGE_COLUMN_WIDTH_1));
+ }
[tableColumn setMinWidth:labelWidth];
[tableColumn setMaxWidth:labelWidth];
[tableColumn setWidth:labelWidth];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit