Revision: 28849
http://sourceforge.net/p/bibdesk/svn/28849
Author: hofman
Date: 2024-04-06 09:43:00 +0000 (Sat, 06 Apr 2024)
Log Message:
-----------
combine enumerations
Modified Paths:
--------------
trunk/bibdesk/BDSKTextImportController.m
Modified: trunk/bibdesk/BDSKTextImportController.m
===================================================================
--- trunk/bibdesk/BDSKTextImportController.m 2024-04-05 23:13:50 UTC (rev
28848)
+++ trunk/bibdesk/BDSKTextImportController.m 2024-04-06 09:43:00 UTC (rev
28849)
@@ -739,32 +739,28 @@
}
- (void)updateColumnWidths {
- NSTableColumn *tc = [itemTableView tableColumnWithIdentifier:@"FieldName"];
- NSCell *cell = [tc dataCell];
- CGFloat width = 0.0;
- NSUInteger i, iMax = [fields count];
- for (i = 0; i < iMax; i++) {
- [cell setStringValue:[[fields objectAtIndex:i] localizedFieldName]];
- width = fmax(width, ceil([cell cellSize].width));
- }
- [tc setWidth:width];
- [tc setMaxWidth:width];
- [tc setMinWidth:width];
- tc = [itemTableView tableColumnWithIdentifier:@"Num"];
- cell = [tc dataCell];
- width = 0.0;
- for (i = 0; i < iMax; i++) {
+ NSTableColumn *tc1 = [itemTableView tableColumnWithIdentifier:@"Num"];
+ NSTableColumn *tc2 = [itemTableView
tableColumnWithIdentifier:@"FieldName"];
+ NSCell *cell1 = [tc1 dataCell];
+ NSCell *cell2 = [tc2 dataCell];
+ __block CGFloat width1 = 0.0, width2 = 0.0;
+ [fields enumerateObjectsUsingBlock:^(NSString *field, NSUInteger i, BOOL
*stop){
NSString *value = @"";
if (i < 10)
- value = [NSString stringWithFormat:@"%@%ld", [NSString
commandKeyIndicatorString], (long)((i + 1) % 10)];
+ value = [NSString stringWithFormat:@"%@%lu", [NSString
commandKeyIndicatorString], (unsigned long)((i + 1) % 10)];
else if (i < 20)
- value = [NSString stringWithFormat:@"%@%@%ld", [NSString
alternateKeyIndicatorString], [NSString commandKeyIndicatorString], (long)((i +
1) % 10)];
- [cell setStringValue:value];
- width = fmax(width, ceil([cell cellSize].width));
- }
- [tc setWidth:width];
- [tc setMaxWidth:width];
- [tc setMinWidth:width];
+ value = [NSString stringWithFormat:@"%@%@%lu", [NSString
alternateKeyIndicatorString], [NSString commandKeyIndicatorString], (unsigned
long)((i + 1) % 10)];
+ [cell1 setStringValue:value];
+ width1 = fmax(width1, ceil([cell1 cellSize].width));
+ [cell2 setStringValue:[field localizedFieldName]];
+ width2 = fmax(width2, ceil([cell2 cellSize].width));
+ }];
+ [tc1 setWidth:width1];
+ [tc1 setMaxWidth:width1];
+ [tc1 setMinWidth:width1];
+ [tc2 setWidth:width2];
+ [tc2 setMaxWidth:width2];
+ [tc2 setMinWidth:width2];
[itemTableView sizeToFit];
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit