Enable full size content for better big sur experience

This commit is contained in:
Michael Starke
2020-11-24 13:37:03 +01:00
parent 381d4b1cac
commit 501501fce1
3 changed files with 28 additions and 4 deletions

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="15705" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="17506" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="15705"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17506"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -200,7 +200,7 @@
<constraint firstItem="3145" firstAttribute="leading" secondItem="2894" secondAttribute="leading" id="3155"/>
<constraint firstAttribute="bottom" secondItem="3145" secondAttribute="bottom" id="PjS-Y5-YA6"/>
</constraints>
<point key="canvasLocation" x="-224" y="-890"/>
<point key="canvasLocation" x="-349" y="-997"/>
</customView>
</objects>
<resources>

View File

@@ -17,6 +17,7 @@
@property (strong) MPEntryViewController *entryViewController;
@property (strong) MPOutlineViewController *outlineViewController;
@property (strong) MPInspectorViewController *inspectorViewController;
@property (strong) NSLayoutConstraint *inspectorTopEdgeConstraint;
@end
@@ -39,6 +40,28 @@
- (void)viewWillLayout {
self.splitView.autosaveName = @"SplitView";
[super viewWillLayout];
}
- (void)updateViewConstraints {
[super updateViewConstraints];
if(self.inspectorTopEdgeConstraint) {
if(!self.inspectorTopEdgeConstraint.isActive) {
self.inspectorTopEdgeConstraint.active = YES;
}
return; // everything is set up.
}
/* setup the constraint if needed */
NSWindow *window = self.view.window;
if(!window) {
return;
}
NSSplitViewItem *inspector = [self splitViewItemForViewController:self.inspectorViewController];
if(inspector) {
self.inspectorTopEdgeConstraint = [NSLayoutConstraint constraintWithItem:inspector.viewController.view attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:window.contentLayoutGuide attribute:NSLayoutAttributeTop multiplier:1 constant:0];
self.inspectorTopEdgeConstraint.active = YES;
}
}
- (void)viewDidLoad {
@@ -61,7 +84,7 @@
[self addSplitViewItem:outlineItem];
[self addSplitViewItem:entries];
[self addSplitViewItem:inspector];
BOOL showInspector = [NSUserDefaults.standardUserDefaults boolForKey:kMPSettingsKeyShowInspector];
inspector.collapsed = !showInspector;
}

View File

@@ -100,6 +100,7 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword);
[super windowDidLoad];
self.window.delegate = self.documentWindowDelegate;
self.window.styleMask |= NSWindowStyleMaskFullSizeContentView;
[self.window registerForDraggedTypes:@[NSURLPboardType]];
MPDocument *document = self.document;