Fixed rendering bug on 10.10 and 10.11 for custom fields

This commit is contained in:
Michael Starke
2018-09-11 09:48:08 +02:00
parent 366db91df5
commit 2b694663e3
6 changed files with 64 additions and 8 deletions

View File

@@ -22,6 +22,7 @@
4C0B533F205C1561003D277E /* PickfieldView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C0B5341205C1561003D277E /* PickfieldView.xib */; }; 4C0B533F205C1561003D277E /* PickfieldView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C0B5341205C1561003D277E /* PickfieldView.xib */; };
4C0C59F118B17F10009C7B76 /* DDHotKeyUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C0C59EF18B17F10009C7B76 /* DDHotKeyUtilities.m */; }; 4C0C59F118B17F10009C7B76 /* DDHotKeyUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C0C59EF18B17F10009C7B76 /* DDHotKeyUtilities.m */; };
4C0DBEF51BF508DE00F9B287 /* PluginSettings.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C0DBEF71BF508DE00F9B287 /* PluginSettings.xib */; }; 4C0DBEF51BF508DE00F9B287 /* PluginSettings.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C0DBEF71BF508DE00F9B287 /* PluginSettings.xib */; };
4C0F04402147A6FA000B8568 /* MPCustomFieldTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C0F043F2147A6FA000B8568 /* MPCustomFieldTableView.m */; };
4C0F647B17B6BC9C00D9522A /* MPSavePanelAccessoryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C0F647A17B6BC9C00D9522A /* MPSavePanelAccessoryViewController.m */; }; 4C0F647B17B6BC9C00D9522A /* MPSavePanelAccessoryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C0F647A17B6BC9C00D9522A /* MPSavePanelAccessoryViewController.m */; };
4C10207F1B750E2F00BFCD59 /* MPTestAutotype.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C10207E1B750E2F00BFCD59 /* MPTestAutotype.m */; }; 4C10207F1B750E2F00BFCD59 /* MPTestAutotype.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C10207E1B750E2F00BFCD59 /* MPTestAutotype.m */; };
4C10412C178CDD44001B5239 /* NSDate+Humanized.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C10412B178CDD44001B5239 /* NSDate+Humanized.m */; }; 4C10412C178CDD44001B5239 /* NSDate+Humanized.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C10412B178CDD44001B5239 /* NSDate+Humanized.m */; };
@@ -350,6 +351,8 @@
4C0C59EF18B17F10009C7B76 /* DDHotKeyUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DDHotKeyUtilities.m; path = DDHotKey/DDHotKeyUtilities.m; sourceTree = "<group>"; }; 4C0C59EF18B17F10009C7B76 /* DDHotKeyUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DDHotKeyUtilities.m; path = DDHotKey/DDHotKeyUtilities.m; sourceTree = "<group>"; };
4C0C59F018B17F10009C7B76 /* DDHotKeyUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = DDHotKeyUtilities.h; path = DDHotKey/DDHotKeyUtilities.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 4C0C59F018B17F10009C7B76 /* DDHotKeyUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = DDHotKeyUtilities.h; path = DDHotKey/DDHotKeyUtilities.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
4C0DBEF61BF508DE00F9B287 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/PluginSettings.xib; sourceTree = "<group>"; }; 4C0DBEF61BF508DE00F9B287 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/PluginSettings.xib; sourceTree = "<group>"; };
4C0F043E2147A6FA000B8568 /* MPCustomFieldTableView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MPCustomFieldTableView.h; sourceTree = "<group>"; };
4C0F043F2147A6FA000B8568 /* MPCustomFieldTableView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MPCustomFieldTableView.m; sourceTree = "<group>"; };
4C0F647917B6BC9C00D9522A /* MPSavePanelAccessoryViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPSavePanelAccessoryViewController.h; sourceTree = "<group>"; }; 4C0F647917B6BC9C00D9522A /* MPSavePanelAccessoryViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPSavePanelAccessoryViewController.h; sourceTree = "<group>"; };
4C0F647A17B6BC9C00D9522A /* MPSavePanelAccessoryViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPSavePanelAccessoryViewController.m; sourceTree = "<group>"; }; 4C0F647A17B6BC9C00D9522A /* MPSavePanelAccessoryViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPSavePanelAccessoryViewController.m; sourceTree = "<group>"; };
4C10207E1B750E2F00BFCD59 /* MPTestAutotype.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPTestAutotype.m; sourceTree = "<group>"; }; 4C10207E1B750E2F00BFCD59 /* MPTestAutotype.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPTestAutotype.m; sourceTree = "<group>"; };
@@ -1034,6 +1037,8 @@
4CE082C21F6FCD2A0034FF56 /* MPCollectionView.m */, 4CE082C21F6FCD2A0034FF56 /* MPCollectionView.m */,
4CF6C3001FBF39BF0055AD03 /* MPPluginTabelCellView.h */, 4CF6C3001FBF39BF0055AD03 /* MPPluginTabelCellView.h */,
4CF6C3011FBF39BF0055AD03 /* MPPluginTabelCellView.m */, 4CF6C3011FBF39BF0055AD03 /* MPPluginTabelCellView.m */,
4C0F043E2147A6FA000B8568 /* MPCustomFieldTableView.h */,
4C0F043F2147A6FA000B8568 /* MPCustomFieldTableView.m */,
); );
name = Views; name = Views;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -1934,6 +1939,7 @@
files = ( files = (
4CD034AC1BFE113B003C002C /* MPPluginHost.m in Sources */, 4CD034AC1BFE113B003C002C /* MPPluginHost.m in Sources */,
4C77E37315B84A240093A587 /* main.m in Sources */, 4C77E37315B84A240093A587 /* main.m in Sources */,
4C0F04402147A6FA000B8568 /* MPCustomFieldTableView.m in Sources */,
4CBA2ABA17074C07006D8139 /* MPSettingsHelper.m in Sources */, 4CBA2ABA17074C07006D8139 /* MPSettingsHelper.m in Sources */,
4C77E37A15B84A240093A587 /* MPAppDelegate.m in Sources */, 4C77E37A15B84A240093A587 /* MPAppDelegate.m in Sources */,
4C37A84015B8B474005EF8EE /* MPOutlineDataSource.m in Sources */, 4C37A84015B8B474005EF8EE /* MPOutlineDataSource.m in Sources */,

View File

@@ -798,7 +798,7 @@
<rect key="frame" x="1" y="1" width="259" height="268"/> <rect key="frame" x="1" y="1" width="259" height="268"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<tableView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" selectionHighlightStyle="none" columnSelection="YES" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowHeight="54" viewBased="YES" id="193"> <tableView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" selectionHighlightStyle="none" columnSelection="YES" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowHeight="54" viewBased="YES" id="193" customClass="MPCustomFieldTableView">
<rect key="frame" x="0.0" y="0.0" width="259" height="268"/> <rect key="frame" x="0.0" y="0.0" width="259" height="268"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/> <size key="intercellSpacing" width="3" height="2"/>

View File

@@ -0,0 +1,13 @@
//
// MPCustomFieldTableView.h
// MacPass
//
// Created by Michael Starke on 11.09.18.
// Copyright © 2018 HicknHack Software GmbH. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface MPCustomFieldTableView : NSTableView
@end

View File

@@ -0,0 +1,24 @@
//
// MPCustomFieldTableView.m
// MacPass
//
// Created by Michael Starke on 11.09.18.
// Copyright © 2018 HicknHack Software GmbH. All rights reserved.
//
#import "MPCustomFieldTableView.h"
@implementation MPCustomFieldTableView
- (NSSize)intrinsicContentSize {
if(@available(macOS 10.12, *)) {
return [super intrinsicContentSize];
}
if(self.numberOfRows > 0) {
return NSMakeSize(-1, self.numberOfRows * self.rowHeight);
}
return NSMakeSize(-1, -1);
}
@end

View File

@@ -35,6 +35,24 @@ NSInteger MPCustomFieldIndexFromTag(NSInteger tag) {
@implementation MPCustomFieldTableViewDelegate @implementation MPCustomFieldTableViewDelegate
- (void)tableView:(NSTableView *)tableView didRemoveRowView:(NSTableRowView *)rowView forRow:(NSInteger)row {
if(@available(macOS 10.12, *)) {
// 10.12 and higher are working correctly
}
else {
[tableView invalidateIntrinsicContentSize];
}
}
- (void)tableView:(NSTableView *)tableView didAddRowView:(NSTableRowView *)rowView forRow:(NSInteger)row {
if(@available(macOS 10.12, *)) {
// 10.12 and higher are working correctly
}
else {
[tableView invalidateIntrinsicContentSize];
}
}
/* /*
- (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row { - (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row {
static NSTextFieldCell *cell; static NSTextFieldCell *cell;

View File

@@ -134,15 +134,10 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
[self.attachmentTableView registerForDraggedTypes:@[NSFilenamesPboardType]]; [self.attachmentTableView registerForDraggedTypes:@[NSFilenamesPboardType]];
/* extract custom field table view */ /* extract custom field table view */
self.customFieldsTableView.translatesAutoresizingMaskIntoConstraints = NO;
NSView *customFieldTableView = self.customFieldsTableView; NSView *customFieldTableView = self.customFieldsTableView;
self.customFieldsTableView.translatesAutoresizingMaskIntoConstraints = NO;
[self.customFieldsTableView.enclosingScrollView removeFromSuperviewWithoutNeedingDisplay]; [self.customFieldsTableView.enclosingScrollView removeFromSuperviewWithoutNeedingDisplay];
if (@available(macOS 10.13, *)) { [self.customFieldsTableView removeFromSuperviewWithoutNeedingDisplay];
//self.customFieldsTableView.usesAutomaticRowHeights = YES;
} else {
// Fallback on earlier versions
}
[self.generalView addSubview:customFieldTableView]; [self.generalView addSubview:customFieldTableView];