Revision: 26889 http://sourceforge.net/p/bibdesk/svn/26889 Author: hofman Date: 2021-09-15 15:51:55 +0000 (Wed, 15 Sep 2021) Log Message: ----------- Use special subclass for group table text fields again, overriding intrinsicContentSize. Gets the correct single line height also when the text may contain newlines.
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-15 14:59:20 UTC (rev 26888) +++ trunk/bibdesk/BDSKGroupTextFieldCell.h 2021-09-15 15:51:55 UTC (rev 26889) @@ -46,3 +46,8 @@ @property (nonatomic) BOOL displayAsColor; @end + + +@interface BDSKGroupTextField : NSTextField +@end + Modified: trunk/bibdesk/BDSKGroupTextFieldCell.m =================================================================== --- trunk/bibdesk/BDSKGroupTextFieldCell.m 2021-09-15 14:59:20 UTC (rev 26888) +++ trunk/bibdesk/BDSKGroupTextFieldCell.m 2021-09-15 15:51:55 UTC (rev 26889) @@ -68,3 +68,21 @@ } @end + +@implementation BDSKGroupTextField + +- (NSSize)intrinsicContentSize { + static NSMapTable *heightTable = nil; + NSFont *font = [self font]; + CGFloat *height = heightTable ? NSMapGet(heightTable, font) : NULL; + if (height = NULL) { + height = NSZoneMalloc(NULL, sizeof(CGFloat)); + *height = [[self font] defaultViewLineHeight]; + if (heightTable == nil) + heightTable = NSCreateMapTable(NSObjectMapKeyCallBacks, NSOwnedPointerMapValueCallBacks, 0); + NSMapInsert(heightTable, font, height); + } + return NSMakeSize(NSViewNoIntrinsicMetric, *height); +} + +@end Modified: trunk/bibdesk/Base.lproj/BibDocument.xib =================================================================== --- trunk/bibdesk/Base.lproj/BibDocument.xib 2021-09-15 14:59:20 UTC (rev 26888) +++ trunk/bibdesk/Base.lproj/BibDocument.xib 2021-09-15 15:51:55 UTC (rev 26889) @@ -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