Revision: 14095
http://sourceforge.net/p/skim-app/code/14095
Author: hofman
Date: 2024-03-07 16:39:53 +0000 (Thu, 07 Mar 2024)
Log Message:
-----------
Use layout anchors to build constraints
Modified Paths:
--------------
trunk/NSView_SKExtensions.m
trunk/SKColorPicker.m
trunk/SKMainWindowController.m
trunk/SKNoteWindowController.m
trunk/SKPreferenceController.m
trunk/SKSecondaryPDFView.m
trunk/SKSideViewController.m
trunk/SKSnapshotPDFView.m
trunk/SKStatusBar.m
Modified: trunk/NSView_SKExtensions.m
===================================================================
--- trunk/NSView_SKExtensions.m 2024-03-07 15:09:34 UTC (rev 14094)
+++ trunk/NSView_SKExtensions.m 2024-03-07 16:39:53 UTC (rev 14095)
@@ -102,10 +102,10 @@
- (void)activateConstraintsToSuperview {
NSView *superview = [self superview];
NSArray *constraints = @[
- [NSLayoutConstraint constraintWithItem:self
attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual
toItem:superview attribute:NSLayoutAttributeLeading multiplier:1.0
constant:0.0],
- [NSLayoutConstraint constraintWithItem:superview
attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:self
attribute:NSLayoutAttributeTrailing multiplier:1.0 constant:0.0],
- [NSLayoutConstraint constraintWithItem:self
attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:superview
attribute:NSLayoutAttributeTop multiplier:1.0 constant:0.0],
- [NSLayoutConstraint constraintWithItem:superview
attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self
attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.0]];
+ [[self leadingAnchor] constraintEqualToAnchor:[superview
leadingAnchor]],
+ [[superview trailingAnchor] constraintEqualToAnchor:[self
trailingAnchor]],
+ [[self topAnchor] constraintEqualToAnchor:[superview topAnchor]],
+ [[superview bottomAnchor] constraintEqualToAnchor:[self
bottomAnchor]]];
[NSLayoutConstraint activateConstraints:constraints];
}
Modified: trunk/SKColorPicker.m
===================================================================
--- trunk/SKColorPicker.m 2024-03-07 15:09:34 UTC (rev 14094)
+++ trunk/SKColorPicker.m 2024-03-07 16:39:53 UTC (rev 14095)
@@ -64,10 +64,10 @@
NSView *view = [[NSView alloc] initWithFrame:NSMakeRect(0.0, 0.0, 180,
30.0)];
NSArray *constraints = @[
- [NSLayoutConstraint constraintWithItem:scrubber
attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:view
attribute:NSLayoutAttributeLeading multiplier:1.0 constant:0.0],
- [NSLayoutConstraint constraintWithItem:scrubber
attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:view
attribute:NSLayoutAttributeTrailing multiplier:1.0 constant:0.0],
- [NSLayoutConstraint constraintWithItem:scrubber
attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:view
attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:0.0],
- [NSLayoutConstraint constraintWithItem:scrubber
attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil
attribute:NSLayoutAttributeNotAnAttribute multiplier:0.0 constant:22.0]];
+ [[scrubber leadingAnchor] constraintEqualToAnchor:[view
leadingAnchor]],
+ [[scrubber trailingAnchor] constraintEqualToAnchor:[view
trailingAnchor]],
+ [[scrubber centerYAnchor] constraintEqualToAnchor:[view
centerYAnchor]],
+ [[scrubber heightAnchor] constraintEqualToConstant:22.0]];
[scrubber setTranslatesAutoresizingMaskIntoConstraints:NO];
[view addSubview:scrubber];
[NSLayoutConstraint activateConstraints:constraints];
Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m 2024-03-07 15:09:34 UTC (rev 14094)
+++ trunk/SKMainWindowController.m 2024-03-07 16:39:53 UTC (rev 14095)
@@ -351,7 +351,7 @@
[rightSideController setTopInset:titleBarHeight];
} else if (topConstraint) {
[topConstraint setActive:NO];
- topConstraint = [NSLayoutConstraint constraintWithItem:splitView
attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:[window
contentLayoutGuide] attribute:NSLayoutAttributeTop multiplier:1.0 constant:0.0];
+ topConstraint = [[splitView topAnchor]
constraintEqualToAnchor:[[window contentLayoutGuide] topAnchor]];
[topConstraint setActive:YES];
}
@@ -1561,10 +1561,10 @@
NSView *contentView = [oldView superview];
BOOL hasStatus = isPresentation == NO && [statusBar isVisible];
NSArray *constraints = @[
- [NSLayoutConstraint constraintWithItem:overviewContentView
attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual
toItem:contentView attribute:NSLayoutAttributeLeading multiplier:1.0
constant:0.0],
- [NSLayoutConstraint constraintWithItem:contentView
attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual
toItem:overviewContentView attribute:NSLayoutAttributeTrailing multiplier:1.0
constant:0.0],
- [NSLayoutConstraint constraintWithItem:overviewContentView
attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual
toItem:mwcFlags.fullSizeContent || isPresentation ? contentView : [[self
window] contentLayoutGuide] attribute:NSLayoutAttributeTop multiplier:1.0
constant:0.0],
- [NSLayoutConstraint constraintWithItem:hasStatus ? statusBar :
contentView attribute:hasStatus ? NSLayoutAttributeTop :
NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual
toItem:overviewContentView attribute:NSLayoutAttributeBottom multiplier:1.0
constant:0.0]];
+ [[overviewContentView leadingAnchor]
constraintEqualToAnchor:[contentView leadingAnchor]],
+ [[contentView trailingAnchor]
constraintEqualToAnchor:[overviewContentView trailingAnchor]],
+ [[overviewContentView topAnchor]
constraintEqualToAnchor:[(mwcFlags.fullSizeContent || isPresentation ?
contentView : [[self window] contentLayoutGuide]) topAnchor]],
+ [(hasStatus ? [statusBar topAnchor] : [contentView bottomAnchor])
constraintEqualToAnchor:[overviewContentView bottomAnchor]]];
[overviewContentView setFrame:[oldView frame]];
[overviewView scrollRectToVisible:[overviewView
frameForItemAtIndex:[[pdfView currentPage] pageIndex]]];
@@ -1620,10 +1620,10 @@
NSView *contentView = [overviewContentView superview];
BOOL hasStatus = isMainWindow && [statusBar isVisible];
NSArray *constraints = @[
- [NSLayoutConstraint constraintWithItem:newView
attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual
toItem:contentView attribute:NSLayoutAttributeLeading multiplier:1.0
constant:0.0],
- [NSLayoutConstraint constraintWithItem:contentView
attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual
toItem:newView attribute:NSLayoutAttributeTrailing multiplier:1.0 constant:0.0],
- [NSLayoutConstraint constraintWithItem:newView
attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual
toItem:mwcFlags.fullSizeContent || isMainWindow == NO ? contentView :
[mainWindow contentLayoutGuide] attribute:NSLayoutAttributeTop multiplier:1.0
constant:0.0],
- [NSLayoutConstraint constraintWithItem:hasStatus ? statusBar :
contentView attribute:hasStatus ? NSLayoutAttributeTop :
NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:newView
attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.0]];
+ [[newView leadingAnchor] constraintEqualToAnchor:[contentView
leadingAnchor]],
+ [[contentView trailingAnchor] constraintEqualToAnchor:[newView
trailingAnchor]],
+ [[newView topAnchor]
constraintEqualToAnchor:[(mwcFlags.fullSizeContent || isMainWindow == NO ?
contentView : [mainWindow contentLayoutGuide]) topAnchor]],
+ [(hasStatus ? [statusBar topAnchor] : [contentView bottomAnchor])
constraintEqualToAnchor:[newView bottomAnchor]]];
if (animate) {
[NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){
@@ -1732,7 +1732,7 @@
CGFloat barHeight = [findController height];
if (mwcFlags.fullSizeContent == NO)
- newTopConstraint = [NSLayoutConstraint constraintWithItem:pdfSplitView
attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual
toItem:contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0.0];
+ newTopConstraint = [[pdfSplitView topAnchor]
constraintEqualToAnchor:[contentView topAnchor]];
if ([[mainWindow firstResponder] isDescendantOf:findBar])
[mainWindow makeFirstResponder:pdfView];
@@ -1790,13 +1790,13 @@
[barTopConstraint setConstant:animate ? -barHeight : 0.0];
[contentView addSubview:findBar];
constraints = @[
- [NSLayoutConstraint constraintWithItem:findBar
attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual
toItem:contentView attribute:NSLayoutAttributeLeading multiplier:1.0
constant:0.0],
- [NSLayoutConstraint constraintWithItem:contentView
attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual
toItem:findBar attribute:NSLayoutAttributeTrailing multiplier:1.0 constant:0.0],
- [NSLayoutConstraint constraintWithItem:findBar
attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual
toItem:contentView attribute:NSLayoutAttributeTop multiplier:1.0
constant:titleBarHeight]];
+ [[findBar leadingAnchor] constraintEqualToAnchor:[contentView
leadingAnchor]],
+ [[contentView trailingAnchor] constraintEqualToAnchor:[findBar
trailingAnchor]],
+ [[findBar topAnchor] constraintEqualToAnchor:[contentView
topAnchor] constant:titleBarHeight]];
[NSLayoutConstraint activateConstraints:constraints];
if (mwcFlags.fullSizeContent == NO) {
[findBarTopConstraint setActive:NO];
- [[NSLayoutConstraint constraintWithItem:pdfSplitView
attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:findBar
attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.0] setActive:YES];
+ [[[pdfSplitView topAnchor] constraintEqualToAnchor:[findBar
bottomAnchor]] setActive:YES];
}
findBarTopConstraint = [constraints objectAtIndex:2];
[contentView layoutSubtreeIfNeeded];
Modified: trunk/SKNoteWindowController.m
===================================================================
--- trunk/SKNoteWindowController.m 2024-03-07 15:09:34 UTC (rev 14094)
+++ trunk/SKNoteWindowController.m 2024-03-07 16:39:53 UTC (rev 14095)
@@ -190,7 +190,7 @@
} else {
[topView removeFromSuperview];
- NSLayoutConstraint *constraint = [NSLayoutConstraint
constraintWithItem:[textView enclosingScrollView]
attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:[[self
window] contentView] attribute:NSLayoutAttributeTop multiplier:1.0
constant:0.0];
+ NSLayoutConstraint *constraint = [[[textView enclosingScrollView]
topAnchor] constraintEqualToAnchor:[[[self window] contentView] topAnchor]];
[constraint setActive:YES];
[textView setRichText:NO];
Modified: trunk/SKPreferenceController.m
===================================================================
--- trunk/SKPreferenceController.m 2024-03-07 15:09:34 UTC (rev 14094)
+++ trunk/SKPreferenceController.m 2024-03-07 16:39:53 UTC (rev 14095)
@@ -129,10 +129,10 @@
[panesButton setSelectedSegment:[preferencePanes
indexOfObject:currentPane]];
NSArray *constraints = @[
- [NSLayoutConstraint constraintWithItem:view
attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual
toItem:contentView attribute:NSLayoutAttributeCenterX multiplier:1.0
constant:0.0],
- [NSLayoutConstraint constraintWithItem:contentView
attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:view
attribute:NSLayoutAttributeBottom multiplier:1.0 constant:BOTTOM_MARGIN],
- [NSLayoutConstraint constraintWithItem:view
attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationGreaterThanOrEqual
toItem:contentView attribute:NSLayoutAttributeLeading multiplier:1.0
constant:0.0],
- [NSLayoutConstraint constraintWithItem:view
attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual
toItem:contentView attribute:NSLayoutAttributeLeading multiplier:1.0
constant:0.0]];
+ [[view centerXAnchor] constraintEqualToAnchor:[contentView
centerXAnchor]],
+ [[contentView bottomAnchor] constraintEqualToAnchor:[view
bottomAnchor] constant:BOTTOM_MARGIN],
+ [[view leadingAnchor]
constraintGreaterThanOrEqualToAnchor:[contentView leadingAnchor]],
+ [[view leadingAnchor] constraintEqualToAnchor:[contentView
leadingAnchor]]];
[[constraints lastObject] setPriority:NSLayoutPriorityDefaultLow];
if ([NSView shouldShowFadeAnimation]) {
@@ -200,10 +200,10 @@
[[window contentView] addSubview:view];
NSArray *constraints = @[
- [NSLayoutConstraint constraintWithItem:view
attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual
toItem:contentView attribute:NSLayoutAttributeCenterX multiplier:1.0
constant:0.0],
- [NSLayoutConstraint constraintWithItem:contentView
attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:view
attribute:NSLayoutAttributeBottom multiplier:1.0 constant:BOTTOM_MARGIN],
- [NSLayoutConstraint constraintWithItem:view
attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationGreaterThanOrEqual
toItem:contentView attribute:NSLayoutAttributeLeading multiplier:1.0
constant:0.0],
- [NSLayoutConstraint constraintWithItem:view
attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual
toItem:contentView attribute:NSLayoutAttributeLeading multiplier:1.0
constant:0.0]];
+ [[view centerXAnchor] constraintEqualToAnchor:[contentView
centerXAnchor]],
+ [[contentView bottomAnchor] constraintEqualToAnchor:[view
bottomAnchor] constant:BOTTOM_MARGIN],
+ [[view leadingAnchor]
constraintGreaterThanOrEqualToAnchor:[contentView leadingAnchor]],
+ [[view leadingAnchor] constraintEqualToAnchor:[contentView
leadingAnchor]]];
[[constraints lastObject] setPriority:NSLayoutPriorityDefaultLow];
[NSLayoutConstraint activateConstraints:constraints];
}
Modified: trunk/SKSecondaryPDFView.m
===================================================================
--- trunk/SKSecondaryPDFView.m 2024-03-07 15:09:34 UTC (rev 14094)
+++ trunk/SKSecondaryPDFView.m 2024-03-07 16:39:53 UTC (rev 14095)
@@ -261,13 +261,13 @@
[controlView setTranslatesAutoresizingMaskIntoConstraints:NO];
NSArray *constraints = @[
- [NSLayoutConstraint constraintWithItem:controlView
attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil
attribute:NSLayoutAttributeNotAnAttribute multiplier:0.0
constant:CONTROL_HEIGHT],
- [NSLayoutConstraint constraintWithItem:toolModeButton
attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual
toItem:controlView attribute:NSLayoutAttributeLeading multiplier:1.0
constant:5.0],
- [NSLayoutConstraint constraintWithItem:toolModeButton
attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual
toItem:controlView attribute:NSLayoutAttributeCenterY multiplier:1.0
constant:0.0],
- [NSLayoutConstraint constraintWithItem:pagePopUpButton
attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual
toItem:toolModeButton attribute:NSLayoutAttributeTrailing multiplier:1.0
constant:5.0],
- [NSLayoutConstraint constraintWithItem:pagePopUpButton
attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual
toItem:controlView attribute:NSLayoutAttributeCenterY multiplier:1.0
constant:0.0],
- [NSLayoutConstraint constraintWithItem:scalePopUpButton
attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual
toItem:pagePopUpButton attribute:NSLayoutAttributeTrailing multiplier:1.0
constant:5.0],
- [NSLayoutConstraint constraintWithItem:scalePopUpButton
attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual
toItem:controlView attribute:NSLayoutAttributeCenterY multiplier:1.0
constant:0.0]];
+ [[controlView heightAnchor]
constraintEqualToConstant:CONTROL_HEIGHT],
+ [[toolModeButton leadingAnchor]
constraintEqualToAnchor:[controlView leadingAnchor] constant:5.0],
+ [[toolModeButton centerYAnchor]
constraintEqualToAnchor:[controlView centerYAnchor]],
+ [[pagePopUpButton leadingAnchor]
constraintEqualToAnchor:[toolModeButton trailingAnchor] constant:5.0],
+ [[pagePopUpButton centerYAnchor]
constraintEqualToAnchor:[controlView centerYAnchor]],
+ [[scalePopUpButton leadingAnchor]
constraintEqualToAnchor:[pagePopUpButton trailingAnchor] constant:5.0],
+ [[scalePopUpButton centerYAnchor]
constraintEqualToAnchor:[controlView centerYAnchor]]];
[NSLayoutConstraint activateConstraints:constraints];
[self updateTrackingAreas];
@@ -285,9 +285,9 @@
[controlView setAlphaValue:0.0];
[self addSubview:controlView positioned:NSWindowAbove relativeTo:nil];
NSArray *constraints = @[
- [NSLayoutConstraint constraintWithItem:controlView
attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:self
attribute:NSLayoutAttributeLeading multiplier:1.0 constant:0.0],
- [NSLayoutConstraint constraintWithItem:controlView
attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:self
attribute:NSLayoutAttributeTrailing multiplier:1.0 constant:0.0],
- [NSLayoutConstraint constraintWithItem:controlView
attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self
attribute:NSLayoutAttributeTop multiplier:1.0 constant:0.0]];
+ [[controlView leadingAnchor] constraintEqualToAnchor:[self
leadingAnchor]],
+ [[controlView trailingAnchor] constraintEqualToAnchor:[self
trailingAnchor]],
+ [[controlView topAnchor] constraintEqualToAnchor:[self topAnchor]]];
[[controlView animator] setAlphaValue:1.0];
[NSLayoutConstraint activateConstraints:constraints];
NSAccessibilityPostNotificationWithUserInfo(NSAccessibilityUnignoredAncestor([self
documentView]), NSAccessibilityLayoutChangedNotification, [NSDictionary
dictionaryWithObjectsAndKeys:NSAccessibilityUnignoredChildren([controlView
subviews]), NSAccessibilityUIElementsKey, nil]);
Modified: trunk/SKSideViewController.m
===================================================================
--- trunk/SKSideViewController.m 2024-03-07 15:09:34 UTC (rev 14094)
+++ trunk/SKSideViewController.m 2024-03-07 16:39:53 UTC (rev 14095)
@@ -110,10 +110,10 @@
[newView setFrame:[oldView frame]];
NSArray *constraints = @[
- [NSLayoutConstraint constraintWithItem:newView
attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual
toItem:contentView attribute:NSLayoutAttributeLeading multiplier:1.0
constant:-1.0],
- [NSLayoutConstraint constraintWithItem:contentView
attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual
toItem:newView attribute:NSLayoutAttributeTrailing multiplier:1.0
constant:-1.0],
- [NSLayoutConstraint constraintWithItem:newView
attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual
toItem:contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:-1.0],
- [NSLayoutConstraint constraintWithItem:contentView
attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual
toItem:newView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-1.0]];
+ [[newView leadingAnchor] constraintEqualToAnchor:[contentView
leadingAnchor] constant:-1.0],
+ [[contentView trailingAnchor] constraintEqualToAnchor:[newView
trailingAnchor] constant:-1.0],
+ [[newView topAnchor] constraintEqualToAnchor:[contentView topAnchor]
constant:-1.0],
+ [[contentView bottomAnchor] constraintEqualToAnchor:[newView
bottomAnchor] constant:-1.0]];
if (animate == NO) {
[contentView replaceSubview:oldView with:newView];
Modified: trunk/SKSnapshotPDFView.m
===================================================================
--- trunk/SKSnapshotPDFView.m 2024-03-07 15:09:34 UTC (rev 14094)
+++ trunk/SKSnapshotPDFView.m 2024-03-07 16:39:53 UTC (rev 14095)
@@ -176,9 +176,9 @@
[controlView setTranslatesAutoresizingMaskIntoConstraints:NO];
NSArray *constraints = @[
- [NSLayoutConstraint constraintWithItem:controlView
attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil
attribute:NSLayoutAttributeNotAnAttribute multiplier:0.0
constant:CONTROL_HEIGHT],
- [NSLayoutConstraint constraintWithItem:scalePopUpButton
attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual
toItem:controlView attribute:NSLayoutAttributeLeading multiplier:1.0
constant:5.0],
- [NSLayoutConstraint constraintWithItem:scalePopUpButton
attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual
toItem:controlView attribute:NSLayoutAttributeCenterY multiplier:1.0
constant:0.0]];
+ [[controlView heightAnchor]
constraintEqualToConstant:CONTROL_HEIGHT],
+ [[scalePopUpButton leadingAnchor]
constraintEqualToAnchor:[controlView leadingAnchor] constant:5.0],
+ [[scalePopUpButton centerYAnchor]
constraintEqualToAnchor:[controlView centerYAnchor]]];
[NSLayoutConstraint activateConstraints:constraints];
[self updateTrackingAreas];
}
@@ -194,9 +194,9 @@
[controlView setAlphaValue:0.0];
[self addSubview:controlView positioned:NSWindowAbove relativeTo:nil];
NSArray *constraints = @[
- [NSLayoutConstraint constraintWithItem:controlView
attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:self
attribute:NSLayoutAttributeLeading multiplier:1.0 constant:0.0],
- [NSLayoutConstraint constraintWithItem:controlView
attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:self
attribute:NSLayoutAttributeTrailing multiplier:1.0 constant:0.0],
- [NSLayoutConstraint constraintWithItem:controlView
attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self
attribute:NSLayoutAttributeTop multiplier:1.0 constant:0.0]];
+ [[controlView leadingAnchor] constraintEqualToAnchor:[self
leadingAnchor]],
+ [[controlView trailingAnchor] constraintEqualToAnchor:[self
trailingAnchor]],
+ [[controlView topAnchor] constraintEqualToAnchor:[self topAnchor]]];
[NSLayoutConstraint activateConstraints:constraints];
[[controlView animator] setAlphaValue:1.0];
NSAccessibilityPostNotificationWithUserInfo(NSAccessibilityUnignoredAncestor([self
documentView]), NSAccessibilityLayoutChangedNotification, [NSDictionary
dictionaryWithObjectsAndKeys:NSAccessibilityUnignoredChildren([controlView
subviews]), NSAccessibilityUIElementsKey, nil]);
Modified: trunk/SKStatusBar.m
===================================================================
--- trunk/SKStatusBar.m 2024-03-07 15:09:34 UTC (rev 14094)
+++ trunk/SKStatusBar.m 2024-03-07 16:39:53 UTC (rev 14095)
@@ -90,10 +90,10 @@
[self addSubview:rightField];
NSArray *constraints = @[
- [NSLayoutConstraint constraintWithItem:leftField
attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:self
attribute:NSLayoutAttributeLeading multiplier:1.0 constant:LEFT_MARGIN],
- [NSLayoutConstraint constraintWithItem:leftField
attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self
attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:0.0],
- [NSLayoutConstraint constraintWithItem:self
attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual
toItem:rightField attribute:NSLayoutAttributeTrailing multiplier:1.0
constant:RIGHT_MARGIN],
- [NSLayoutConstraint constraintWithItem:rightField
attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self
attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:0.0]];
+ [[leftField leadingAnchor] constraintEqualToAnchor:[self
leadingAnchor] constant:LEFT_MARGIN],
+ [[leftField centerYAnchor]constraintEqualToAnchor:[self
centerYAnchor]],
+ [[self trailingAnchor]constraintEqualToAnchor:[rightField
trailingAnchor] constant:RIGHT_MARGIN],
+ [[rightField centerYAnchor] constraintEqualToAnchor:[self
centerYAnchor]]];
leftLeadingConstraint = [constraints objectAtIndex:0];
rightTrailingConstraint = [constraints objectAtIndex:2];
[NSLayoutConstraint activateConstraints:constraints];
@@ -145,16 +145,16 @@
[[view window] setContentBorderThickness:statusHeight
forEdge:NSMinYEdge];
[contentView addSubview:self];
constraints = @[
- [NSLayoutConstraint constraintWithItem:self
attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual
toItem:contentView attribute:NSLayoutAttributeLeading multiplier:1.0
constant:0.0],
- [NSLayoutConstraint constraintWithItem:contentView
attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:self
attribute:NSLayoutAttributeTrailing multiplier:1.0 constant:0.0],
- [NSLayoutConstraint constraintWithItem:contentView
attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self
attribute:NSLayoutAttributeBottom multiplier:1.0 constant:animate ?
-statusHeight : 0.0],
- [NSLayoutConstraint constraintWithItem:self
attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:view
attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.0]];
+ [[self leadingAnchor] constraintEqualToAnchor:[contentView
leadingAnchor]],
+ [[contentView trailingAnchor]constraintEqualToAnchor:[self
trailingAnchor]],
+ [[contentView bottomAnchor] constraintEqualToAnchor:[self
bottomAnchor] constant:animate ? -statusHeight : 0.0],
+ [[self topAnchor] constraintEqualToAnchor:[view bottomAnchor]]];
[bottomConstraint setActive:NO];
[NSLayoutConstraint activateConstraints:constraints];
[contentView layoutSubtreeIfNeeded];
bottomConstraint = [constraints objectAtIndex:2];
} else {
- constraints = @[[NSLayoutConstraint constraintWithItem:contentView
attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:view
attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.0]];
+ constraints = @[[[contentView bottomAnchor]
constraintEqualToAnchor:[view bottomAnchor]]];
}
if (animate) {
@@ -278,10 +278,10 @@
[self addSubview:iconView];
[leftLeadingConstraint setActive:NO];
NSArray *constraints = @[
- [NSLayoutConstraint constraintWithItem:iconView
attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:self
attribute:NSLayoutAttributeLeading multiplier:1.0 constant:LEFT_MARGIN],
- [NSLayoutConstraint constraintWithItem:leftField
attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual
toItem:iconView attribute:NSLayoutAttributeTrailing multiplier:1.0
constant:SEPARATION],
- [NSLayoutConstraint constraintWithItem:iconView
attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self
attribute:NSLayoutAttributeTop multiplier:1.0 constant:1.0],
- [NSLayoutConstraint constraintWithItem:iconView
attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual
toItem:iconView attribute:NSLayoutAttributeHeight multiplier:1.0 constant:0.0]];
+ [[iconView leadingAnchor] constraintEqualToAnchor:[self
leadingAnchor] constant:LEFT_MARGIN],
+ [[leftField leadingAnchor] constraintEqualToAnchor:[iconView
trailingAnchor] constant:SEPARATION],
+ [[iconView topAnchor] constraintEqualToAnchor:[self
topAnchor]],
+ [[iconView widthAnchor] constraintEqualToAnchor:[iconView
heightAnchor]]];
leftLeadingConstraint = [constraints objectAtIndex:1];
[NSLayoutConstraint activateConstraints:constraints];
}
@@ -289,7 +289,7 @@
} else if (iconView) {
[iconView removeFromSuperview];
iconView = nil;
- leftLeadingConstraint = [NSLayoutConstraint
constraintWithItem:leftField attribute:NSLayoutAttributeLeading
relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeading
multiplier:1.0 constant:LEFT_MARGIN];
+ leftLeadingConstraint = [[leftField leadingAnchor]
constraintEqualToAnchor:[self leadingAnchor] constant:LEFT_MARGIN];
[leftLeadingConstraint setActive:YES];
}
}
@@ -309,7 +309,7 @@
return;
[progressIndicator removeFromSuperview];
progressIndicator = nil;
- rightTrailingConstraint = [NSLayoutConstraint constraintWithItem:self
attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual
toItem:rightField attribute:NSLayoutAttributeTrailing multiplier:1.0
constant:RIGHT_MARGIN];
+ rightTrailingConstraint = [[self trailingAnchor]
constraintEqualToAnchor:[rightField trailingAnchor] constant:RIGHT_MARGIN];
[rightTrailingConstraint setActive:YES];
} else {
if (progressIndicator && (NSInteger)[progressIndicator style]
== style)
@@ -324,9 +324,9 @@
[self addSubview:progressIndicator];
[rightTrailingConstraint setActive:NO];
NSArray *constraints = @[
- [NSLayoutConstraint constraintWithItem:self
attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual
toItem:progressIndicator attribute:NSLayoutAttributeTrailing multiplier:1.0
constant:RIGHT_MARGIN],
- [NSLayoutConstraint constraintWithItem:progressIndicator
attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual
toItem:rightField attribute:NSLayoutAttributeTrailing multiplier:1.0
constant:SEPARATION],
- [NSLayoutConstraint constraintWithItem:progressIndicator
attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self
attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:0.0]];
+ [[self trailingAnchor]
constraintEqualToAnchor:[progressIndicator trailingAnchor]
constant:RIGHT_MARGIN],
+ [[progressIndicator
leadingAnchor]constraintEqualToAnchor:[rightField trailingAnchor]
constant:SEPARATION],
+ [[progressIndicator centerYAnchor]
constraintEqualToAnchor:[self centerYAnchor]]];
rightTrailingConstraint = [constraints objectAtIndex:1];
[NSLayoutConstraint activateConstraints:constraints];
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit