From 1fb0b9c01f8c2678a9cab3da8bfa3f27c42b1937 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Tue, 4 Apr 2017 14:30:33 +0200 Subject: [PATCH] wxOSX: Don't tighten truncated markup in wxDataViewCtrl Starting with OS X 10.10, rich text is automatically tightened if it doesn't fit and needs to be ellipsized, in an effort to fit more text on screen. This is not desirable in wxDataViewCtrl where the cells may display texts of varying lengths, some tightened and some not. Explicitly disable this functionality to have consistent appearance. --- src/osx/cocoa/dataview.mm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/osx/cocoa/dataview.mm b/src/osx/cocoa/dataview.mm index af7780a4c0..ef7641d1d3 100644 --- a/src/osx/cocoa/dataview.mm +++ b/src/osx/cocoa/dataview.mm @@ -2963,6 +2963,22 @@ bool wxDataViewTextRenderer::MacRender() { NSMutableParagraphStyle *par = [[NSMutableParagraphStyle defaultParagraphStyle] mutableCopy]; [par setLineBreakMode:[cell lineBreakMode]]; + // Tightening looks very ugly when combined with non-tightened rows, + // so disabled it on OS X version where it's used: +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_11 + if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_11) + { + [par setAllowsDefaultTighteningForTruncation:NO]; + } + else +#endif +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10 + if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_10) + { + [par setTighteningFactorForTruncation:0.0]; + } +#endif + [str addAttribute:NSParagraphStyleAttributeName value:par range:NSMakeRange(0, [str length])];