Revision: 26851 http://sourceforge.net/p/bibdesk/svn/26851 Author: hofman Date: 2021-09-12 14:48:04 +0000 (Sun, 12 Sep 2021) Log Message: ----------- Return intrinsic content size with dummy width for group text fields on older systems, because auto layout takes an extremely long time calculating the width, which is not even relevant for layout.
Modified Paths: -------------- trunk/bibdesk/BDSKGroupTextFieldCell.h trunk/bibdesk/BDSKGroupTextFieldCell.m trunk/bibdesk/Base.lproj/BibDocument.xib Modified: trunk/bibdesk/BDSKGroupTextFieldCell.h =================================================================== --- trunk/bibdesk/BDSKGroupTextFieldCell.h 2021-09-12 06:30:36 UTC (rev 26850) +++ trunk/bibdesk/BDSKGroupTextFieldCell.h 2021-09-12 14:48:04 UTC (rev 26851) @@ -46,3 +46,8 @@ @property (nonatomic) BOOL displayAsColor; @end + + +@interface BDSKGroupTextField : NSTextField +@end + Modified: trunk/bibdesk/BDSKGroupTextFieldCell.m =================================================================== --- trunk/bibdesk/BDSKGroupTextFieldCell.m 2021-09-12 06:30:36 UTC (rev 26850) +++ trunk/bibdesk/BDSKGroupTextFieldCell.m 2021-09-12 14:48:04 UTC (rev 26851) @@ -38,6 +38,7 @@ #import "BDSKGroupTextFieldCell.h" #import "NSColor_BDSKExtensions.h" +#import "NSFont_BDSKExtensions.h" @implementation BDSKGroupTextFieldCell @@ -67,3 +68,27 @@ } @end + + +@implementation BDSKGroupTextField + +// Older systems take an extremely long time calucalting the text size for laying out some text fields +// espcially in the group outline view, but the text width is irrelevcant for layout +- (NSSize)intrinsicContentSize { + if (RUNNING_AFTER(10_15)) + return [super intrinsicContentSize]; + static NSMapTable *heightTable = nil; + NSFont *font = [self font] ?: [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]; + CGFloat *height = heightTable && font ? NSMapGet(heightTable, font) : NULL; + if (height == NULL) { + height = NSZoneMalloc(NULL, sizeof(CGFloat)); + *height = [font defaultViewLineHeight]; + NSMapInsert(heightTable, font, height); + if (heightTable == nil) + heightTable = NSCreateMapTable(NSObjectMapKeyCallBacks, NSOwnedPointerMapValueCallBacks, 0); + } + return NSMakeSize(NSViewNoIntrinsicMetric, *height); +} + +@end + Modified: trunk/bibdesk/Base.lproj/BibDocument.xib =================================================================== --- trunk/bibdesk/Base.lproj/BibDocument.xib 2021-09-12 06:30:36 UTC (rev 26850) +++ trunk/bibdesk/Base.lproj/BibDocument.xib 2021-09-12 14:48:04 UTC (rev 26851) @@ -101,7 +101,7 @@ <rect key="frame" x="92" y="9" width="0.0" height="0.0"/> <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="eOM-PZ-O5b" customClass="BDSKGroupBubbleCell"/> </imageView> - <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="751" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="oFI-uU-pLf"> + <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="751" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="oFI-uU-pLf" customClass="BDSKGroupTextField"> <rect key="frame" x="20" y="2" width="74" height="12"/> <textFieldCell key="cell" lineBreakMode="truncatingTail" id="tSR-5x-qeN"> <font key="font" metaFont="miniSystem"/> @@ -117,7 +117,7 @@ </binding> </connections> </textField> - <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="h4r-Dh-CgO"> + <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="h4r-Dh-CgO" customClass="BDSKGroupTextField"> <rect key="frame" x="20" y="1" width="74" height="14"/> <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" id="bzr-RQ-gYy" customClass="BDSKGroupTextFieldCell"> <font key="font" metaFont="smallSystem"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Bibdesk-commit mailing list Bibdesk-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-commit