Revision: 12524 http://sourceforge.net/p/skim-app/code/12524 Author: hofman Date: 2021-11-04 18:24:02 +0000 (Thu, 04 Nov 2021) Log Message: ----------- Progress indicator in status bar using auto layout
Modified Paths: -------------- trunk/SKStatusBar.m Modified: trunk/SKStatusBar.m =================================================================== --- trunk/SKStatusBar.m 2021-11-04 17:57:39 UTC (rev 12523) +++ trunk/SKStatusBar.m 2021-11-04 18:24:02 UTC (rev 12524) @@ -382,23 +382,19 @@ [progressIndicator retain]; [progressIndicator removeFromSuperview]; } - [progressIndicator setAutoresizingMask:NSViewMinXMargin | NSViewMinYMargin | NSViewMaxYMargin]; [progressIndicator setStyle:NSProgressIndicatorSpinningStyle]; [progressIndicator setControlSize:NSSmallControlSize]; [progressIndicator setIndeterminate:style == SKProgressIndicatorStyleIndeterminate]; [progressIndicator setDisplayedWhenStopped:YES]; [progressIndicator setUsesThreadedAnimation:YES]; - [progressIndicator sizeToFit]; + [progressIndicator setTranslatesAutoresizingMaskIntoConstraints:NO]; - NSRect rect; - NSSize size = [progressIndicator frame].size; - if (size.width < 0.01) size.width = PROGRESSBAR_WIDTH; - rect = SKSliceRect(SKShrinkRect([self bounds], RIGHT_MARGIN, NSMaxXEdge), size.width, NSMaxXEdge); - rect.origin.y = floor(NSMidY(rect) - 0.5 * size.height) + VERTICAL_OFFSET; - rect.size.height = size.height; - [progressIndicator setFrame:rect]; - + NSArray *constraints = [NSArray arrayWithObjects: + [NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:progressIndicator attribute:NSLayoutAttributeTrailing multiplier:1.0 constant:RIGHT_MARGIN], + [NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:progressIndicator attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:VERTICAL_OFFSET], nil]; [self addSubview:progressIndicator]; + [NSLayoutConstraint activateConstraints:constraints]; + [progressIndicator release]; } [[self superview] setNeedsDisplayInRect:[self frame]]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Skim-app-commit mailing list Skim-app-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/skim-app-commit