Revision: 27700
http://sourceforge.net/p/bibdesk/svn/27700
Author: hofman
Date: 2022-07-06 19:20:48 +0000 (Wed, 06 Jul 2022)
Log Message:
-----------
use auto layout for status bar progress indicator
Modified Paths:
--------------
trunk/bibdesk/BDSKStatusBar.m
Modified: trunk/bibdesk/BDSKStatusBar.m
===================================================================
--- trunk/bibdesk/BDSKStatusBar.m 2022-07-06 19:04:11 UTC (rev 27699)
+++ trunk/bibdesk/BDSKStatusBar.m 2022-07-06 19:20:48 UTC (rev 27700)
@@ -72,9 +72,9 @@
[textField
setContentCompressionResistancePriority:NSLayoutPriorityDefaultLow
forOrientation:NSLayoutConstraintOrientationHorizontal];
[self addSubview:textField];
NSArray *constraints = [NSArray arrayWithObjects:
- [NSLayoutConstraint constraintWithItem:textField
attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:self
attribute:NSLayoutAttributeLeading multiplier:1.0 constant:LEFT_MARGIN +
TEXT_INSET],
- [NSLayoutConstraint constraintWithItem:self
attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual
toItem:textField attribute:NSLayoutAttributeTrailing multiplier:1.0
constant:RIGHT_MARGIN + TEXT_INSET],
- [NSLayoutConstraint constraintWithItem:textField
attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self
attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:0.0], nil];
+ [NSLayoutConstraint constraintWithLeadingMargin:LEFT_MARGIN +
TEXT_INSET forItem:textField toItem:self],
+ [NSLayoutConstraint constraintWithTrailingMargin:RIGHT_MARGIN +
TEXT_INSET forItem:textField toItem:self],
+ [NSLayoutConstraint constraintWithCenterYOffset:0.0
forItem:textField toItem:self], nil];
[[constraints objectAtIndex:1] setPriority:499.0];
[NSLayoutConstraint activateConstraints:constraints];
@@ -403,25 +403,21 @@
return;
if(progressIndicator == nil) {
progressIndicator = [[NSProgressIndicator alloc] init];
- } else {
+ [progressIndicator setStyle:NSProgressIndicatorSpinningStyle];
+ [progressIndicator setControlSize:NSSmallControlSize];
+ [progressIndicator setDisplayedWhenStopped:NO];
+ [progressIndicator setMaxValue:1.0];
+ [progressIndicator
setTranslatesAutoresizingMaskIntoConstraints:NO];
+ } else {
[progressIndicator retain];
[progressIndicator removeFromSuperview];
}
- [progressIndicator setAutoresizingMask:NSViewMinXMargin |
NSViewMinYMargin | NSViewMaxYMargin];
- [progressIndicator setStyle:NSProgressIndicatorSpinningStyle];
- [progressIndicator setControlSize:NSSmallControlSize];
- [progressIndicator setMaxValue:1.0];
[progressIndicator setIndeterminate:style ==
BDSKProgressIndicatorStyleIndeterminate];
- [progressIndicator setDisplayedWhenStopped:NO];
- [progressIndicator sizeToFit];
- NSRect rect;
- NSSize size = [progressIndicator frame].size;
- rect = BDSKCenterRect(BDSKSliceRect(BDSKShrinkRect([self bounds],
rightMargin, NSMaxXEdge), size.width, NSMaxXEdge), size, [self isFlipped]);
- rect.origin.y += VERTICAL_OFFSET;
- [progressIndicator setFrame:rect];
-
[self addSubview:progressIndicator];
+ [NSLayoutConstraint activateConstraints:[NSArray arrayWithObjects:
+ [NSLayoutConstraint constraintWithTrailingMargin:rightMargin +
[progressIndicator alignmentRectInsets].right forItem:progressIndicator
toItem:self],
+ [NSLayoutConstraint constraintWithCenterYOffset:0.0
forItem:progressIndicator toItem:self], nil]];
[progressIndicator release];
[[self constraintWithSecondItem:textField
secondAttribute:NSLayoutAttributeTrailing] setConstant:[self fullRightMargin]];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit