Switchted to NSStackView for search options. This raises the deployment target to 10.11.

This commit is contained in:
Michael Starke
2018-08-17 15:43:38 +02:00
parent 27d1f512f0
commit 36e6472822
3 changed files with 157 additions and 116 deletions

View File

@@ -26,19 +26,22 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/> <customObject id="-3" userLabel="Application" customClass="NSObject"/>
<tabView type="noTabsNoBorder" translatesAutoresizingMaskIntoConstraints="NO" id="8MB-fC-M2Q"> <tabView type="noTabsNoBorder" translatesAutoresizingMaskIntoConstraints="NO" id="8MB-fC-M2Q">
<rect key="frame" x="0.0" y="0.0" width="576" height="30"/> <rect key="frame" x="0.0" y="0.0" width="838" height="30"/>
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
<tabViewItems> <tabViewItems>
<tabViewItem label="Filter" identifier="1" id="Ud6-Nz-6PS"> <tabViewItem label="Filter" identifier="1" id="Ud6-Nz-6PS">
<view key="view" id="caQ-XO-RkM"> <view key="view" id="caQ-XO-RkM">
<rect key="frame" x="0.0" y="0.0" width="576" height="30"/> <rect key="frame" x="0.0" y="0.0" width="838" height="30"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="1" customClass="HNHUIGradientView"> <customView translatesAutoresizingMaskIntoConstraints="NO" id="1" customClass="HNHUIGradientView">
<rect key="frame" x="0.0" y="0.0" width="576" height="30"/> <rect key="frame" x="0.0" y="0.0" width="838" height="30"/>
<subviews> <subviews>
<stackView orientation="horizontal" alignment="centerY" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" horizontalClippingResistancePriority="250" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="AEr-b4-tMm">
<rect key="frame" x="0.0" y="0.0" width="838" height="30"/>
<beginningViews>
<textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="6"> <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="6">
<rect key="frame" x="6" y="8" width="47" height="14"/> <rect key="frame" x="-2" y="8" width="47" height="14"/>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Search:" id="7"> <textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Search:" id="7">
<font key="font" metaFont="smallSystemBold"/> <font key="font" metaFont="smallSystemBold"/>
<color key="textColor" name="disabledControlTextColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="disabledControlTextColor" catalog="System" colorSpace="catalog"/>
@@ -46,7 +49,7 @@
</textFieldCell> </textFieldCell>
</textField> </textField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="O7W-cn-eUP"> <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="O7W-cn-eUP">
<rect key="frame" x="59" y="6" width="41" height="17"/> <rect key="frame" x="51" y="6" width="41" height="17"/>
<buttonCell key="cell" type="recessed" title="Title" bezelStyle="recessed" alignment="center" controlSize="small" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="53D-ne-nv6"> <buttonCell key="cell" type="recessed" title="Title" bezelStyle="recessed" alignment="center" controlSize="small" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="53D-ne-nv6">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
<font key="font" metaFont="systemBold" size="12"/> <font key="font" metaFont="systemBold" size="12"/>
@@ -56,7 +59,7 @@
</connections> </connections>
</button> </button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="0R1-PX-dgn"> <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="0R1-PX-dgn">
<rect key="frame" x="108" y="6" width="76" height="17"/> <rect key="frame" x="100" y="6" width="76" height="17"/>
<buttonCell key="cell" type="recessed" title="Username" bezelStyle="recessed" alignment="center" controlSize="small" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="jfQ-Jh-2gl"> <buttonCell key="cell" type="recessed" title="Username" bezelStyle="recessed" alignment="center" controlSize="small" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="jfQ-Jh-2gl">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
<font key="font" metaFont="systemBold" size="12"/> <font key="font" metaFont="systemBold" size="12"/>
@@ -66,7 +69,7 @@
</connections> </connections>
</button> </button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Uhl-ck-vVQ"> <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Uhl-ck-vVQ">
<rect key="frame" x="192" y="6" width="73" height="17"/> <rect key="frame" x="184" y="6" width="73" height="17"/>
<buttonCell key="cell" type="recessed" title="Password" bezelStyle="recessed" alignment="center" controlSize="small" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="rvQ-4V-SsS"> <buttonCell key="cell" type="recessed" title="Password" bezelStyle="recessed" alignment="center" controlSize="small" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="rvQ-4V-SsS">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
<font key="font" metaFont="systemBold" size="12"/> <font key="font" metaFont="systemBold" size="12"/>
@@ -76,7 +79,7 @@
</connections> </connections>
</button> </button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Bn2-iY-mQ3"> <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Bn2-iY-mQ3">
<rect key="frame" x="273" y="6" width="39" height="17"/> <rect key="frame" x="265" y="6" width="39" height="17"/>
<buttonCell key="cell" type="recessed" title="URL" bezelStyle="recessed" alignment="center" controlSize="small" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="92o-gN-Psj"> <buttonCell key="cell" type="recessed" title="URL" bezelStyle="recessed" alignment="center" controlSize="small" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="92o-gN-Psj">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
<font key="font" metaFont="systemBold" size="12"/> <font key="font" metaFont="systemBold" size="12"/>
@@ -86,7 +89,7 @@
</connections> </connections>
</button> </button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="SaV-5p-jIX"> <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="SaV-5p-jIX">
<rect key="frame" x="320" y="6" width="50" height="17"/> <rect key="frame" x="312" y="6" width="50" height="17"/>
<buttonCell key="cell" type="recessed" title="Notes" bezelStyle="recessed" alignment="center" controlSize="small" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="iDN-2E-hwt"> <buttonCell key="cell" type="recessed" title="Notes" bezelStyle="recessed" alignment="center" controlSize="small" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="iDN-2E-hwt">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
<font key="font" metaFont="systemBold" size="12"/> <font key="font" metaFont="systemBold" size="12"/>
@@ -95,8 +98,17 @@
<action selector="toggleSearchFlags:" target="-1" id="cuN-5p-vZD"/> <action selector="toggleSearchFlags:" target="-1" id="cuN-5p-vZD"/>
</connections> </connections>
</button> </button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="RGg-wK-hz4">
<rect key="frame" x="370" y="6" width="86" height="17"/>
<buttonCell key="cell" type="recessed" title="Everywhere" bezelStyle="recessed" alignment="center" controlSize="small" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="WMK-bb-ESj">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
<font key="font" metaFont="systemBold" size="12"/>
</buttonCell>
</button>
</beginningViews>
<endViews>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="aPQ-t2-bgz"> <popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="aPQ-t2-bgz">
<rect key="frame" x="492" y="5" width="64" height="19"/> <rect key="frame" x="774" y="5" width="64" height="19"/>
<popUpButtonCell key="cell" type="recessed" title="Item 1" bezelStyle="recessed" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" autoenablesItems="NO" selectedItem="LRm-iZ-XrA" id="faz-pC-uGX"> <popUpButtonCell key="cell" type="recessed" title="Item 1" bezelStyle="recessed" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" autoenablesItems="NO" selectedItem="LRm-iZ-XrA" id="faz-pC-uGX">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
<font key="font" metaFont="systemBold" size="12"/> <font key="font" metaFont="systemBold" size="12"/>
@@ -109,32 +121,37 @@
</menu> </menu>
</popUpButtonCell> </popUpButtonCell>
</popUpButton> </popUpButton>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="RGg-wK-hz4"> </endViews>
<rect key="frame" x="378" y="6" width="86" height="17"/> <visibilityPriorities>
<buttonCell key="cell" type="recessed" title="Everywhere" bezelStyle="recessed" alignment="center" controlSize="small" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="WMK-bb-ESj"> <integer value="1000"/>
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/> <real value="999"/>
<font key="font" metaFont="systemBold" size="12"/> <real value="998"/>
</buttonCell> <real value="997"/>
</button> <real value="996"/>
<real value="995"/>
<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"/>
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
</customSpacing>
<connections>
<outlet property="delegate" destination="-2" id="5a7-1L-C6J"/>
</connections>
</stackView>
</subviews> </subviews>
<constraints> <constraints>
<constraint firstAttribute="centerY" secondItem="O7W-cn-eUP" secondAttribute="centerY" id="2uC-wS-HDi"/> <constraint firstItem="AEr-b4-tMm" firstAttribute="leading" secondItem="1" secondAttribute="leading" id="4Ca-JQ-6SM"/>
<constraint firstItem="O7W-cn-eUP" firstAttribute="leading" secondItem="6" secondAttribute="trailing" constant="8" symbolic="YES" id="5hN-x3-XlX"/> <constraint firstAttribute="trailing" secondItem="AEr-b4-tMm" secondAttribute="trailing" id="8JE-jl-Ko3"/>
<constraint firstItem="0R1-PX-dgn" firstAttribute="leading" secondItem="O7W-cn-eUP" secondAttribute="trailing" constant="8" symbolic="YES" id="67f-i6-eOb"/> <constraint firstItem="AEr-b4-tMm" firstAttribute="top" secondItem="1" secondAttribute="top" id="EHZ-ac-GsP"/>
<constraint firstAttribute="centerY" secondItem="SaV-5p-jIX" secondAttribute="centerY" id="7ch-eZ-Hzh"/> <constraint firstAttribute="bottom" secondItem="AEr-b4-tMm" secondAttribute="bottom" id="Ztr-3u-eI0"/>
<constraint firstItem="RGg-wK-hz4" firstAttribute="leading" secondItem="SaV-5p-jIX" secondAttribute="trailing" constant="8" symbolic="YES" id="Bbh-au-wHa"/>
<constraint firstItem="aPQ-t2-bgz" firstAttribute="centerY" secondItem="SaV-5p-jIX" secondAttribute="centerY" id="EUG-hL-jbn"/>
<constraint firstAttribute="centerY" secondItem="0R1-PX-dgn" secondAttribute="centerY" id="Huh-PB-cbs"/>
<constraint firstItem="aPQ-t2-bgz" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="RGg-wK-hz4" secondAttribute="trailing" constant="8" symbolic="YES" id="QoK-F3-goX"/>
<constraint firstItem="6" firstAttribute="leading" secondItem="1" secondAttribute="leading" constant="8" id="Seo-dI-FzX"/>
<constraint firstItem="Bn2-iY-mQ3" firstAttribute="leading" secondItem="Uhl-ck-vVQ" secondAttribute="trailing" constant="8" id="TCJ-vg-IIt"/>
<constraint firstAttribute="trailing" secondItem="aPQ-t2-bgz" secondAttribute="trailing" constant="20" symbolic="YES" id="XFv-Pv-Bzq"/>
<constraint firstItem="RGg-wK-hz4" firstAttribute="centerY" secondItem="1" secondAttribute="centerY" id="hsT-uo-6H8"/>
<constraint firstItem="SaV-5p-jIX" firstAttribute="leading" secondItem="Bn2-iY-mQ3" secondAttribute="trailing" constant="8" symbolic="YES" id="pAA-uU-moF"/>
<constraint firstAttribute="centerY" secondItem="6" secondAttribute="centerY" id="qak-8F-xbj"/>
<constraint firstItem="Uhl-ck-vVQ" firstAttribute="leading" secondItem="0R1-PX-dgn" secondAttribute="trailing" constant="8" id="u8d-C2-O9h"/>
<constraint firstAttribute="centerY" secondItem="Uhl-ck-vVQ" secondAttribute="centerY" id="uvE-ch-ysK"/>
<constraint firstAttribute="centerY" secondItem="Bn2-iY-mQ3" secondAttribute="centerY" id="xZJ-EZ-Nic"/>
</constraints> </constraints>
</customView> </customView>
</subviews> </subviews>
@@ -150,14 +167,14 @@
</tabViewItem> </tabViewItem>
<tabViewItem label="Trash" identifier="2" id="na6-h9-r9q"> <tabViewItem label="Trash" identifier="2" id="na6-h9-r9q">
<view key="view" id="F6S-GS-AwI"> <view key="view" id="F6S-GS-AwI">
<rect key="frame" x="0.0" y="0.0" width="576" height="30"/> <rect key="frame" x="0.0" y="0.0" width="838" height="30"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="DXf-SC-gVG" customClass="HNHUIGradientView"> <customView translatesAutoresizingMaskIntoConstraints="NO" id="DXf-SC-gVG" customClass="HNHUIGradientView">
<rect key="frame" x="0.0" y="0.0" width="576" height="30"/> <rect key="frame" x="0.0" y="0.0" width="838" height="30"/>
<subviews> <subviews>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="szx-Hx-OrV"> <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="szx-Hx-OrV">
<rect key="frame" x="469" y="0.0" width="92" height="28"/> <rect key="frame" x="731" y="0.0" width="92" height="28"/>
<buttonCell key="cell" type="push" title="Empty Trash" bezelStyle="rounded" alignment="center" controlSize="small" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="8Ok-oe-6AB"> <buttonCell key="cell" type="push" title="Empty Trash" bezelStyle="rounded" alignment="center" controlSize="small" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="8Ok-oe-6AB">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystem"/> <font key="font" metaFont="smallSystem"/>
@@ -198,14 +215,14 @@
</tabViewItem> </tabViewItem>
<tabViewItem label="History" identifier="3" id="z4I-cp-nhf"> <tabViewItem label="History" identifier="3" id="z4I-cp-nhf">
<view key="view" id="iPb-SZ-Lfm"> <view key="view" id="iPb-SZ-Lfm">
<rect key="frame" x="0.0" y="0.0" width="576" height="30"/> <rect key="frame" x="0.0" y="0.0" width="838" height="30"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="S8L-rB-h0h" customClass="HNHUIGradientView"> <customView translatesAutoresizingMaskIntoConstraints="NO" id="S8L-rB-h0h" customClass="HNHUIGradientView">
<rect key="frame" x="0.0" y="0.0" width="576" height="30"/> <rect key="frame" x="0.0" y="0.0" width="838" height="30"/>
<subviews> <subviews>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="pqx-su-vAh"> <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="pqx-su-vAh">
<rect key="frame" x="474" y="0.0" width="87" height="28"/> <rect key="frame" x="736" y="0.0" width="87" height="28"/>
<buttonCell key="cell" type="push" title="Exit History" bezelStyle="rounded" alignment="center" controlSize="small" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="ewQ-8F-e1E"> <buttonCell key="cell" type="push" title="Exit History" bezelStyle="rounded" alignment="center" controlSize="small" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="ewQ-8F-e1E">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystem"/> <font key="font" metaFont="smallSystem"/>
@@ -215,7 +232,7 @@
</buttonCell> </buttonCell>
</button> </button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="JNP-Sd-Zh1"> <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="JNP-Sd-Zh1">
<rect key="frame" x="379" y="0.0" width="97" height="28"/> <rect key="frame" x="641" y="0.0" width="97" height="28"/>
<buttonCell key="cell" type="push" title="Restore Entry" bezelStyle="rounded" alignment="center" controlSize="small" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="UTg-y9-4DN"> <buttonCell key="cell" type="push" title="Restore Entry" bezelStyle="rounded" alignment="center" controlSize="small" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="UTg-y9-4DN">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystem"/> <font key="font" metaFont="smallSystem"/>
@@ -256,7 +273,7 @@
</connections> </connections>
</tabViewItem> </tabViewItem>
</tabViewItems> </tabViewItems>
<point key="canvasLocation" x="-1" y="79"/> <point key="canvasLocation" x="130" y="79"/>
</tabView> </tabView>
</objects> </objects>
</document> </document>

View File

@@ -26,14 +26,13 @@
@class HNHUIGradientView; @class HNHUIGradientView;
@class MPDocument; @class MPDocument;
@interface MPContextBarViewController : MPViewController @interface MPContextBarViewController : MPViewController <NSStackViewDelegate>
@property (weak) IBOutlet NSButton *titleButton; @property (weak) IBOutlet NSButton *titleButton;
@property (weak) IBOutlet NSButton *usernameButton; @property (weak) IBOutlet NSButton *usernameButton;
@property (weak) IBOutlet NSButton *passwordButton; @property (weak) IBOutlet NSButton *passwordButton;
@property (weak) IBOutlet NSButton *urlButton; @property (weak) IBOutlet NSButton *urlButton;
@property (weak) IBOutlet NSButton *notesButton; @property (weak) IBOutlet NSButton *notesButton;
@property (weak) IBOutlet NSButton *duplicatePasswordsButton;
@property (weak) IBOutlet NSPopUpButton *specialFilterPopUpButton; @property (weak) IBOutlet NSPopUpButton *specialFilterPopUpButton;
@property (weak) IBOutlet NSButton *everywhereButton; @property (weak) IBOutlet NSButton *everywhereButton;

View File

@@ -134,21 +134,40 @@ typedef NS_ENUM(NSUInteger, MPContextTab) {
} }
} }
/* - (void)stackView:(NSStackView *)stackView willDetachViews:(NSArray<NSView *> *)views {
- (BOOL)control:(NSControl*)control textView:(NSTextView*)textView doCommandBySelector:(SEL)commandSelector { for(NSView *view in views) {
if(commandSelector == @selector(insertNewline:)) { if([view isKindOfClass:NSButton.class]) {
[self _didChangeFilter]; NSButton *button = (NSButton *)view;
NSMenuItem *item = [self.specialFilterPopUpButton.menu itemWithTag:button.tag];
if(item) {
return; // no duplicates
} }
return NO; item = [self _menuItemForButton:button];
if(item) {
[self.specialFilterPopUpButton.menu addItem:item];
} }
*/ }
}
[self _updateFilterButtons];
}
- (void)stackView:(NSStackView *)stackView didReattachViews:(NSArray<NSView *> *)views {
for(NSView *view in views) {
if([view isKindOfClass:NSButton.class]) {
NSButton *button = (NSButton *)view;
NSMenuItem *item = [self.specialFilterPopUpButton.menu itemWithTag:button.tag];
if(item) {
[self.specialFilterPopUpButton.menu removeItem:item];
}
}
}
[self _updateFilterButtons];
}
#pragma mark UI Helper #pragma mark UI Helper
- (void)_updateFilterButtons { - (void)_updateFilterButtons {
MPDocument *document = self.windowController.document; MPDocument *document = self.windowController.document;
MPEntrySearchFlags currentFlags = document.searchContext.searchFlags; MPEntrySearchFlags currentFlags = document.searchContext.searchFlags;
self.duplicatePasswordsButton.state = HNHUIStateForBool(MPIsFlagSetInOptions(MPEntrySearchDoublePasswords, currentFlags));
self.notesButton.state = HNHUIStateForBool(MPIsFlagSetInOptions(MPEntrySearchNotes, currentFlags)); self.notesButton.state = HNHUIStateForBool(MPIsFlagSetInOptions(MPEntrySearchNotes, currentFlags));
self.passwordButton.state = HNHUIStateForBool(MPIsFlagSetInOptions(MPEntrySearchPasswords, currentFlags)); self.passwordButton.state = HNHUIStateForBool(MPIsFlagSetInOptions(MPEntrySearchPasswords, currentFlags));
self.titleButton.state = HNHUIStateForBool(MPIsFlagSetInOptions(MPEntrySearchTitles, currentFlags)); self.titleButton.state = HNHUIStateForBool(MPIsFlagSetInOptions(MPEntrySearchTitles, currentFlags));
@@ -173,4 +192,10 @@ typedef NS_ENUM(NSUInteger, MPContextTab) {
[self.specialFilterPopUpButton selectItemWithTag:selectedTag]; [self.specialFilterPopUpButton selectItemWithTag:selectedTag];
} }
- (NSMenuItem *)_menuItemForButton:(NSButton *)button {
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:button.title action:@selector(toggleSearchFlags:) keyEquivalent:@""];
item.tag = button.tag;
return item;
}
@end @end