macOS use AutoLayout in utility bars (#3326)
update filterbar to use constraints=
This commit is contained in:
parent
7f01ee52fe
commit
286d438222
|
@ -767,9 +767,6 @@ static void removeKeRangerRansomware()
|
|||
{
|
||||
[self showInfo:nil];
|
||||
}
|
||||
|
||||
//redraw filterbar to avoid clipping
|
||||
[NSNotificationCenter.defaultCenter postNotificationName:@"ResizeBar" object:nil];
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(NSNotification*)notification
|
||||
|
@ -4948,7 +4945,7 @@ static void removeKeRangerRansomware()
|
|||
[self.fStackView insertArrangedSubview:self.fFilterBar.view atIndex:idx];
|
||||
|
||||
NSDictionary* views = @{ @"fFilterBar" : self.fFilterBar.view };
|
||||
[self.fStackView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[fFilterBar(==21)]" options:0
|
||||
[self.fStackView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[fFilterBar(==23)]" options:0
|
||||
metrics:nil
|
||||
views:views]];
|
||||
|
||||
|
|
|
@ -25,20 +25,11 @@
|
|||
<rect key="frame" x="0.0" y="0.0" width="501" height="23"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<subviews>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="3" customClass="FilterButton">
|
||||
<rect key="frame" x="73" y="2" width="49" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="recessed" title="Active" bezelStyle="recessed" alignment="center" controlSize="mini" lineBreakMode="truncatingTail" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="21">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
|
||||
<font key="font" metaFont="smallSystemBold"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="setFilter:" target="-2" id="41"/>
|
||||
</connections>
|
||||
</button>
|
||||
<popUpButton verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4">
|
||||
<popUpButton verticalHuggingPriority="750" horizontalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="4">
|
||||
<rect key="frame" x="5" y="4" width="26" height="15"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="26" id="SSy-Cy-W3L"/>
|
||||
</constraints>
|
||||
<popUpButtonCell key="cell" type="recessed" bezelStyle="recessed" imagePosition="left" alignment="left" controlSize="mini" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" tag="-999" imageScaling="proportionallyDown" inset="2" pullsDown="YES" arrowPosition="noArrow" selectedItem="57" id="16">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
|
||||
<font key="font" metaFont="miniSystem"/>
|
||||
|
@ -60,57 +51,100 @@
|
|||
</menu>
|
||||
</popUpButtonCell>
|
||||
</popUpButton>
|
||||
<box horizontalHuggingPriority="750" fixedFrame="YES" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="5">
|
||||
<box horizontalHuggingPriority="750" horizontalCompressionResistancePriority="1000" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="5">
|
||||
<rect key="frame" x="34" y="5" width="5" height="13"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="1" id="6ed-rN-3Je"/>
|
||||
</constraints>
|
||||
</box>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="6" customClass="FilterButton">
|
||||
<rect key="frame" x="273" y="2" width="55" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="recessed" title="Paused" bezelStyle="recessed" alignment="center" controlSize="mini" lineBreakMode="truncatingTail" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="15">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
|
||||
<font key="font" metaFont="smallSystemBold"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="setFilter:" target="-2" id="44"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="7" customClass="FilterButton">
|
||||
<rect key="frame" x="213" y="2" width="59" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="recessed" title="Seeding" bezelStyle="recessed" alignment="center" controlSize="mini" lineBreakMode="truncatingTail" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="14">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
|
||||
<font key="font" metaFont="smallSystemBold"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="setFilter:" target="-2" id="43"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="8" customClass="FilterButton">
|
||||
<rect key="frame" x="123" y="2" width="89" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="recessed" title="Downloading" bezelStyle="recessed" alignment="center" controlSize="mini" lineBreakMode="truncatingTail" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="13">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
|
||||
<font key="font" metaFont="smallSystemBold"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="setFilter:" target="-2" id="42"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="9" customClass="FilterButton">
|
||||
<rect key="frame" x="42" y="2" width="30" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="recessed" title="All" bezelStyle="recessed" alignment="center" controlSize="mini" lineBreakMode="truncatingTail" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="12">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
|
||||
<font key="font" metaFont="smallSystemBold"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="setFilter:" target="-2" id="40"/>
|
||||
</connections>
|
||||
</button>
|
||||
<searchField wantsLayer="YES" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="10">
|
||||
<stackView distribution="fillProportionally" orientation="horizontal" alignment="centerY" spacing="1" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" horizontalClippingResistancePriority="750" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="mzg-HE-ptV">
|
||||
<rect key="frame" x="42" y="5" width="329" height="14"/>
|
||||
<subviews>
|
||||
<button verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="9" customClass="FilterButton">
|
||||
<rect key="frame" x="0.0" y="-1" width="29" height="15"/>
|
||||
<buttonCell key="cell" type="recessed" title="All" bezelStyle="recessed" alignment="center" controlSize="mini" lineBreakMode="truncatingTail" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="12">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
|
||||
<font key="font" metaFont="smallSystemBold"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="setFilter:" target="-2" id="40"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="3" customClass="FilterButton">
|
||||
<rect key="frame" x="30" y="-1" width="50" height="15"/>
|
||||
<buttonCell key="cell" type="recessed" title="Active" bezelStyle="recessed" alignment="center" controlSize="mini" lineBreakMode="truncatingTail" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="21">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
|
||||
<font key="font" metaFont="smallSystemBold"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="setFilter:" target="-2" id="41"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="8" customClass="FilterButton">
|
||||
<rect key="frame" x="81" y="-1" width="87" height="15"/>
|
||||
<buttonCell key="cell" type="recessed" title="Downloading" bezelStyle="recessed" alignment="center" controlSize="mini" lineBreakMode="truncatingTail" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="13">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
|
||||
<font key="font" metaFont="smallSystemBold"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="setFilter:" target="-2" id="42"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="7" customClass="FilterButton">
|
||||
<rect key="frame" x="169" y="-1" width="60" height="15"/>
|
||||
<buttonCell key="cell" type="recessed" title="Seeding" bezelStyle="recessed" alignment="center" controlSize="mini" lineBreakMode="truncatingTail" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="14">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
|
||||
<font key="font" metaFont="smallSystemBold"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="setFilter:" target="-2" id="43"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="6" customClass="FilterButton">
|
||||
<rect key="frame" x="230" y="-1" width="55" height="15"/>
|
||||
<buttonCell key="cell" type="recessed" title="Paused" bezelStyle="recessed" alignment="center" controlSize="mini" lineBreakMode="truncatingTail" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="15">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
|
||||
<font key="font" metaFont="smallSystemBold"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="setFilter:" target="-2" id="44"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="nvH-xy-86S" customClass="FilterButton">
|
||||
<rect key="frame" x="286" y="-1" width="43" height="15"/>
|
||||
<buttonCell key="cell" type="recessed" title="Error" bezelStyle="recessed" alignment="center" controlSize="mini" lineBreakMode="truncatingTail" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="AtX-O4-Mqp">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
|
||||
<font key="font" metaFont="smallSystemBold"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="setFilter:" target="-2" id="Rm7-FG-rfe"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<visibilityPriorities>
|
||||
<integer value="1000"/>
|
||||
<integer value="1000"/>
|
||||
<integer value="1000"/>
|
||||
<integer value="1000"/>
|
||||
<integer value="1000"/>
|
||||
<integer value="1000"/>
|
||||
</visibilityPriorities>
|
||||
<customSpacing>
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
</customSpacing>
|
||||
</stackView>
|
||||
<searchField wantsLayer="YES" verticalHuggingPriority="750" verticalCompressionResistancePriority="1000" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="10">
|
||||
<rect key="frame" x="401" y="2" width="95" height="19"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="95" placeholder="YES" id="RUH-hb-Ldl"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="48" id="Ven-bt-DjP"/>
|
||||
<constraint firstAttribute="width" relation="lessThanOrEqual" constant="95" id="b6y-sO-sUo"/>
|
||||
</constraints>
|
||||
<searchFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" borderStyle="bezel" bezelStyle="round" id="11">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
|
@ -121,18 +155,20 @@
|
|||
<outlet property="searchMenuTemplate" destination="22" id="48"/>
|
||||
</connections>
|
||||
</searchField>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="nvH-xy-86S" customClass="FilterButton">
|
||||
<rect key="frame" x="329" y="2" width="43" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="recessed" title="Error" bezelStyle="recessed" alignment="center" controlSize="mini" lineBreakMode="truncatingTail" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="AtX-O4-Mqp">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
|
||||
<font key="font" metaFont="smallSystemBold"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="setFilter:" target="-2" id="Rm7-FG-rfe"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="10" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="mzg-HE-ptV" secondAttribute="trailing" constant="5" id="09X-9L-yc0"/>
|
||||
<constraint firstItem="4" firstAttribute="centerY" secondItem="2" secondAttribute="centerY" id="AuI-QF-CKh"/>
|
||||
<constraint firstItem="mzg-HE-ptV" firstAttribute="leading" secondItem="5" secondAttribute="trailing" constant="5" id="KgL-2d-UXl"/>
|
||||
<constraint firstItem="5" firstAttribute="centerY" secondItem="2" secondAttribute="centerY" id="SAr-4s-SlW"/>
|
||||
<constraint firstItem="5" firstAttribute="top" secondItem="2" secondAttribute="top" constant="5" id="SlS-3C-JDT"/>
|
||||
<constraint firstItem="4" firstAttribute="leading" secondItem="2" secondAttribute="leading" constant="5" id="cB8-HO-JyJ"/>
|
||||
<constraint firstItem="mzg-HE-ptV" firstAttribute="centerY" secondItem="2" secondAttribute="centerY" id="cOt-Q3-x7T"/>
|
||||
<constraint firstItem="5" firstAttribute="leading" secondItem="4" secondAttribute="trailing" constant="5" id="dRA-mP-tCJ"/>
|
||||
<constraint firstItem="10" firstAttribute="centerY" secondItem="2" secondAttribute="centerY" id="ecz-eJ-l9b"/>
|
||||
<constraint firstAttribute="bottom" secondItem="5" secondAttribute="bottom" constant="5" id="fKx-Ct-3z1"/>
|
||||
<constraint firstAttribute="trailing" secondItem="10" secondAttribute="trailing" constant="5" id="s5c-0G-9tM"/>
|
||||
</constraints>
|
||||
<point key="canvasLocation" x="139" y="150"/>
|
||||
</customView>
|
||||
<menu title="Menu" id="22" userLabel="SearchFilterMenu">
|
||||
|
|
|
@ -10,9 +10,6 @@
|
|||
#define FILTER_TYPE_TAG_NAME 401
|
||||
#define FILTER_TYPE_TAG_TRACKER 402
|
||||
|
||||
#define SEARCH_MIN_WIDTH 48.0
|
||||
#define SEARCH_MAX_WIDTH 95.0
|
||||
|
||||
@interface FilterBarController ()
|
||||
|
||||
@property(nonatomic) IBOutlet FilterButton* fNoFilterButton;
|
||||
|
@ -26,7 +23,6 @@
|
|||
|
||||
@property(nonatomic) IBOutlet NSPopUpButton* fGroupsButton;
|
||||
|
||||
- (void)resizeBar;
|
||||
- (void)updateGroupsButton;
|
||||
- (void)updateGroups:(NSNotification*)notification;
|
||||
|
||||
|
@ -62,8 +58,6 @@
|
|||
|
||||
[self.fGroupsButton.menu itemWithTag:GROUP_FILTER_ALL_TAG].title = NSLocalizedString(@"All Groups", "Filter Bar -> group filter menu");
|
||||
|
||||
[self resizeBar];
|
||||
|
||||
//set current filter
|
||||
NSString* filterType = [NSUserDefaults.standardUserDefaults stringForKey:@"Filter"];
|
||||
|
||||
|
@ -127,11 +121,6 @@
|
|||
|
||||
[self updateGroupsButton];
|
||||
|
||||
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(resizeBar) name:NSWindowDidResizeNotification
|
||||
object:self.view.window];
|
||||
|
||||
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(resizeBar) name:@"ResizeBar" object:nil];
|
||||
|
||||
//update when groups change
|
||||
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(updateGroups:) name:@"UpdateGroups" object:nil];
|
||||
}
|
||||
|
@ -398,70 +387,6 @@
|
|||
|
||||
#pragma mark - Private
|
||||
|
||||
- (void)resizeBar
|
||||
{
|
||||
//replace all buttons
|
||||
[self.fNoFilterButton sizeToFit];
|
||||
[self.fActiveFilterButton sizeToFit];
|
||||
[self.fDownloadFilterButton sizeToFit];
|
||||
[self.fSeedFilterButton sizeToFit];
|
||||
[self.fPauseFilterButton sizeToFit];
|
||||
[self.fErrorFilterButton sizeToFit];
|
||||
|
||||
NSRect allRect = self.fNoFilterButton.frame;
|
||||
NSRect activeRect = self.fActiveFilterButton.frame;
|
||||
NSRect downloadRect = self.fDownloadFilterButton.frame;
|
||||
NSRect seedRect = self.fSeedFilterButton.frame;
|
||||
NSRect pauseRect = self.fPauseFilterButton.frame;
|
||||
NSRect errorRect = self.fErrorFilterButton.frame;
|
||||
|
||||
//size search filter to not overlap buttons
|
||||
NSRect searchFrame = self.fSearchField.frame;
|
||||
searchFrame.origin.x = NSMaxX(errorRect) + 5.0;
|
||||
searchFrame.size.width = NSWidth(self.view.frame) - searchFrame.origin.x - 5.0;
|
||||
|
||||
//make sure it is not too long
|
||||
if (NSWidth(searchFrame) > SEARCH_MAX_WIDTH)
|
||||
{
|
||||
searchFrame.origin.x += NSWidth(searchFrame) - SEARCH_MAX_WIDTH;
|
||||
searchFrame.size.width = SEARCH_MAX_WIDTH;
|
||||
}
|
||||
else if (NSWidth(searchFrame) < SEARCH_MIN_WIDTH)
|
||||
{
|
||||
searchFrame.origin.x += NSWidth(searchFrame) - SEARCH_MIN_WIDTH;
|
||||
searchFrame.size.width = SEARCH_MIN_WIDTH;
|
||||
|
||||
//calculate width the buttons can take up
|
||||
CGFloat const allowedWidth = (searchFrame.origin.x - 5.0) - allRect.origin.x;
|
||||
CGFloat const currentWidth = NSWidth(allRect) + NSWidth(activeRect) + NSWidth(downloadRect) + NSWidth(seedRect) +
|
||||
NSWidth(pauseRect) + NSWidth(errorRect) + 4.0; //add 4 for space between buttons
|
||||
CGFloat const ratio = allowedWidth / currentWidth;
|
||||
|
||||
//decrease button widths proportionally
|
||||
allRect.size.width = NSWidth(allRect) * ratio;
|
||||
activeRect.size.width = NSWidth(activeRect) * ratio;
|
||||
downloadRect.size.width = NSWidth(downloadRect) * ratio;
|
||||
seedRect.size.width = NSWidth(seedRect) * ratio;
|
||||
pauseRect.size.width = NSWidth(pauseRect) * ratio;
|
||||
errorRect.size.width = NSWidth(errorRect) * ratio;
|
||||
}
|
||||
|
||||
activeRect.origin.x = NSMaxX(allRect) + 1.0;
|
||||
downloadRect.origin.x = NSMaxX(activeRect) + 1.0;
|
||||
seedRect.origin.x = NSMaxX(downloadRect) + 1.0;
|
||||
pauseRect.origin.x = NSMaxX(seedRect) + 1.0;
|
||||
errorRect.origin.x = NSMaxX(pauseRect) + 1.0;
|
||||
|
||||
self.fNoFilterButton.frame = allRect;
|
||||
self.fActiveFilterButton.frame = activeRect;
|
||||
self.fDownloadFilterButton.frame = downloadRect;
|
||||
self.fSeedFilterButton.frame = seedRect;
|
||||
self.fPauseFilterButton.frame = pauseRect;
|
||||
self.fErrorFilterButton.frame = errorRect;
|
||||
|
||||
self.fSearchField.frame = searchFrame;
|
||||
}
|
||||
|
||||
- (void)updateGroupsButton
|
||||
{
|
||||
NSInteger const groupIndex = [NSUserDefaults.standardUserDefaults integerForKey:@"FilterGroup"];
|
||||
|
|
|
@ -22,9 +22,8 @@
|
|||
<rect key="frame" x="0.0" y="0.0" width="400" height="21"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<subviews>
|
||||
<popUpButton verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="3">
|
||||
<rect key="frame" x="5" y="2" width="103" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<popUpButton verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="3">
|
||||
<rect key="frame" x="5" y="2" width="89" height="17"/>
|
||||
<popUpButtonCell key="cell" type="recessed" title="status menu" bezelStyle="recessed" imagePosition="left" alignment="left" controlSize="small" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" tag="-1" inset="2" pullsDown="YES" arrowPosition="noArrow" selectedItem="33" id="12">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
|
@ -55,28 +54,24 @@
|
|||
</menu>
|
||||
</popUpButtonCell>
|
||||
</popUpButton>
|
||||
<imageView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4">
|
||||
<rect key="frame" x="247" y="5" width="8" height="12"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES"/>
|
||||
<imageView translatesAutoresizingMaskIntoConstraints="NO" id="4">
|
||||
<rect key="frame" x="218" y="5" width="8" height="12"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" animates="YES" image="DownArrowTemplate" id="11"/>
|
||||
</imageView>
|
||||
<imageView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="5">
|
||||
<rect key="frame" x="325" y="5" width="8" height="12"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES"/>
|
||||
<imageView translatesAutoresizingMaskIntoConstraints="NO" id="5">
|
||||
<rect key="frame" x="309" y="5" width="8" height="12"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" image="UpArrowTemplate" id="10"/>
|
||||
</imageView>
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="6">
|
||||
<rect key="frame" x="336" y="4" width="64" height="14"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES"/>
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="6">
|
||||
<rect key="frame" x="320" y="4" width="62" height="14"/>
|
||||
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="left" title="999.9 KB/s" id="9">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="7">
|
||||
<rect key="frame" x="258" y="4" width="64" height="14"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES"/>
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="7">
|
||||
<rect key="frame" x="229" y="4" width="62" height="14"/>
|
||||
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="left" title="999.9 KB/s" id="8">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
|
@ -84,6 +79,19 @@
|
|||
</textFieldCell>
|
||||
</textField>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="4" firstAttribute="centerY" secondItem="2" secondAttribute="centerY" id="5X1-ao-0Th"/>
|
||||
<constraint firstItem="6" firstAttribute="leading" secondItem="5" secondAttribute="trailing" constant="5" id="6EO-VX-DLE"/>
|
||||
<constraint firstItem="4" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="3" secondAttribute="trailing" constant="5" id="6tW-KD-to5"/>
|
||||
<constraint firstItem="6" firstAttribute="centerY" secondItem="2" secondAttribute="centerY" id="PhY-Kl-8UO"/>
|
||||
<constraint firstItem="7" firstAttribute="centerY" secondItem="2" secondAttribute="centerY" id="RUV-jV-Cu3"/>
|
||||
<constraint firstAttribute="trailing" secondItem="6" secondAttribute="trailing" constant="20" id="TYC-7o-i81"/>
|
||||
<constraint firstItem="3" firstAttribute="leading" secondItem="2" secondAttribute="leading" constant="5" id="aSH-P9-sbq"/>
|
||||
<constraint firstItem="5" firstAttribute="centerY" secondItem="2" secondAttribute="centerY" id="s5N-sn-GIz"/>
|
||||
<constraint firstItem="7" firstAttribute="leading" secondItem="4" secondAttribute="trailing" constant="5" id="ucx-2O-Qeb"/>
|
||||
<constraint firstItem="5" firstAttribute="leading" secondItem="7" secondAttribute="trailing" constant="20" id="w5L-Hb-0Ly"/>
|
||||
<constraint firstItem="3" firstAttribute="centerY" secondItem="2" secondAttribute="centerY" id="xna-mB-gNK"/>
|
||||
</constraints>
|
||||
<point key="canvasLocation" x="139" y="136"/>
|
||||
</customView>
|
||||
</objects>
|
||||
|
|
|
@ -32,8 +32,6 @@ typedef NS_ENUM(unsigned int, statusTag) {
|
|||
@property(nonatomic) CGFloat fPreviousDownloadRate;
|
||||
@property(nonatomic) CGFloat fPreviousUploadRate;
|
||||
|
||||
- (void)resizeStatusButton;
|
||||
|
||||
@end
|
||||
|
||||
@implementation StatusBarController
|
||||
|
@ -70,9 +68,6 @@ typedef NS_ENUM(unsigned int, statusTag) {
|
|||
//update when speed limits are changed
|
||||
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(updateSpeedFieldsToolTips) name:@"SpeedLimitUpdate"
|
||||
object:nil];
|
||||
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(resizeStatusButton)
|
||||
name:NSWindowDidResizeNotification
|
||||
object:self.view.window];
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
|
@ -137,7 +132,6 @@ typedef NS_ENUM(unsigned int, statusTag) {
|
|||
if (![self.fStatusButton.title isEqualToString:statusString])
|
||||
{
|
||||
self.fStatusButton.title = statusString;
|
||||
[self resizeStatusButton];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -247,23 +241,4 @@ typedef NS_ENUM(unsigned int, statusTag) {
|
|||
return YES;
|
||||
}
|
||||
|
||||
#pragma mark - Private
|
||||
|
||||
- (void)resizeStatusButton
|
||||
{
|
||||
[self.fStatusButton sizeToFit];
|
||||
|
||||
//width ends up being too long
|
||||
NSRect statusFrame = self.fStatusButton.frame;
|
||||
statusFrame.size.width -= 25.0;
|
||||
|
||||
CGFloat const difference = NSMaxX(statusFrame) + 5.0 - NSMinX(self.fTotalDLImageView.frame);
|
||||
if (difference > 0.0)
|
||||
{
|
||||
statusFrame.size.width -= difference;
|
||||
}
|
||||
|
||||
self.fStatusButton.frame = statusFrame;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in New Issue