Skip to content

Commit

Permalink
merge 'Resize icons and padding capability added #101'
Browse files Browse the repository at this point in the history
  • Loading branch information
Mortennn committed Apr 6, 2020
1 parent 618d120 commit 7b1f0d0
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 27 deletions.
8 changes: 4 additions & 4 deletions Dozer/DozerIcons.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,18 @@ public final class DozerIcons {
}
}

public var iconFontSize: Int = defaults[.iconSize] {
public var iconFontSize: Int = Defaults[.iconSize] {
didSet {
defaults[.iconSize] = self.iconFontSize
Defaults[.iconSize] = self.iconFontSize
for icon in dozerIcons {
icon.setSize()
}
}
}

public var buttonPadding: CGFloat = defaults[.buttonPadding] {
public var buttonPadding: CGFloat = Defaults[.buttonPadding] {
didSet {
defaults[.buttonPadding] = self.buttonPadding
Defaults[.buttonPadding] = self.buttonPadding
for icon in dozerIcons {
icon.setSize()
}
Expand Down
2 changes: 1 addition & 1 deletion Dozer/StatusIconClasses/HelperStatusIcon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Defaults

private struct StatusIconLength {
static var show: CGFloat {
return defaults[.buttonPadding]
return Defaults[.buttonPadding]
}
static let hide: CGFloat = 10_000
}
Expand Down
4 changes: 2 additions & 2 deletions Dozer/Util.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ extension NSButton {

struct Icons {
var helperstatusIcon: NSImage {
let size = defaults[.iconSize]
let size = Defaults[.iconSize]
return create(image: Assets.helperStatusItemIcon.name, size, size)
}

var removeStatusIcon: NSImage {
let size = defaults[.iconSize] / 2
let size = Defaults[.iconSize] / 2
return create(image: Assets.helperStatusItemIcon.name, size, size)
}

Expand Down
111 changes: 91 additions & 20 deletions Dozer/XIB/General.xib
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="General" customModule="Dozer" customModuleProvider="target">
<connections>
<outlet property="ButtonPaddingPopUpButton" destination="xKW-RS-k5v" id="Awg-zN-TFh"/>
<outlet property="ButtonPaddingPopUpButton" destination="D1W-S4-kqi" id="FHs-Gq-kJv"/>
<outlet property="CheckForUpdatesCheckbox" destination="htn-2c-54s" id="sO5-Ft-amU"/>
<outlet property="EnableRemoveDozerIconCheckbox" destination="pDX-1f-4hl" id="uHk-1U-HG9"/>
<outlet property="FontSizePopUpButton" destination="CfO-pA-9W4" id="Yi4-yI-qDQ"/>
<outlet property="FontSizePopUpButton" destination="Lku-wR-aPA" id="GZe-ld-Ip5"/>
<outlet property="HideBothDozerIconsCheckbox" destination="w7z-Qa-kqw" id="L5J-6S-jtb"/>
<outlet property="HideStatusBarIconsAfterDelayCheckbox" destination="hOy-nu-Sy0" id="aNv-vt-dQL"/>
<outlet property="HideStatusBarIconsAtLaunchCheckbox" destination="phN-BY-WEC" id="zff-cm-aik"/>
Expand All @@ -38,7 +38,7 @@
</connections>
</button>
<textField horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Yjj-cw-XAs">
<rect key="frame" x="37" y="216" width="361" height="13"/>
<rect key="frame" x="35" y="170" width="361" height="13"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" title="The delay resets when you interact with the status bar." id="vbw-Q7-ecG">
<font key="font" metaFont="system" size="10"/>
Expand All @@ -47,7 +47,7 @@
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="hOy-nu-Sy0">
<rect key="frame" x="18" y="184" width="183" height="18"/>
<rect key="frame" x="18" y="232" width="183" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Hide status bar icons after" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="hS1-gl-Pc1">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
Expand All @@ -69,7 +69,7 @@
</connections>
</button>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="w7z-Qa-kqw">
<rect key="frame" x="18" y="192" width="361" height="18"/>
<rect key="frame" x="16" y="189" width="361" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Hide both Dozer icons when status bar icons are hidden" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="PrK-hp-6i2">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
Expand All @@ -80,7 +80,7 @@
</connections>
</button>
<textField horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="CNz-dE-9vs">
<rect key="frame" x="37" y="173" width="361" height="13"/>
<rect key="frame" x="37" y="213" width="342" height="13"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" title="Use the shortcut to show the status bar icons." id="QoH-wj-4Bo">
<font key="font" metaFont="system" size="10"/>
Expand All @@ -89,7 +89,7 @@
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="pDX-1f-4hl">
<rect key="frame" x="18" y="149" width="361" height="18"/>
<rect key="frame" x="18" y="146" width="361" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Enable 'remove' Dozer icon" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="Toa-to-mCu">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
Expand All @@ -99,25 +99,16 @@
<action selector="enableRemoveDozerIconClicked:" target="-2" id="vr8-Rh-V8P"/>
</connections>
</button>
<textField horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="IDw-Ag-Gcv">
<rect key="frame" x="37" y="117" width="342" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" title="Enable additional Dozer icon. Show/hide less frequently used status bar icons using option+click." id="UjO-Yp-XO4">
<font key="font" metaFont="system" size="10"/>
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<box verticalHuggingPriority="750" fixedFrame="YES" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="ayr-kp-VXW">
<rect key="frame" x="20" y="284" width="361" height="5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
</box>
<box verticalHuggingPriority="750" fixedFrame="YES" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="6Mb-v7-wV4">
<rect key="frame" x="18" y="46" width="361" height="5"/>
<rect key="frame" x="18" y="40" width="361" height="5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
</box>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4Dt-wS-aZ8" customClass="MASShortcutView">
<rect key="frame" x="20" y="20" width="106" height="20"/>
<rect key="frame" x="20" y="14" width="106" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
</customView>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="htn-2c-54s">
Expand All @@ -132,7 +123,7 @@
</connections>
</button>
<popUpButton verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Ziw-so-qpj" userLabel="10 seconds">
<rect key="frame" x="205" y="179" width="114" height="25"/>
<rect key="frame" x="205" y="227" width="114" height="25"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="push" title="10 seconds" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" tag="10" imageScaling="proportionallyDown" inset="2" selectedItem="OdJ-mZ-u0T" id="JbX-Xw-iVE" userLabel="10 seconds">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
Expand All @@ -152,12 +143,92 @@
<action selector="hideStatusBarIconsSecondsUpdated:" target="-2" id="07d-zi-l5c"/>
</connections>
</popUpButton>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="nmU-jA-Ht8">
<rect key="frame" x="130" y="15" width="249" height="17"/>
<autoresizingMask key="autoresizingMask"/>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="left" title="Show/hide status bar icons" id="HZP-sl-H5I">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="tB7-K2-Gts">
<rect key="frame" x="95" y="54" width="136" height="16"/>
<autoresizingMask key="autoresizingMask"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Width for Dozer icons" id="y67-Ov-Fvx">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="TmQ-WL-Cmf">
<rect key="frame" x="95" y="85" width="150" height="16"/>
<autoresizingMask key="autoresizingMask"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Font size of Dozer icons" id="lI8-BD-YX6">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Lku-wR-aPA">
<rect key="frame" x="18" y="79" width="76" height="25"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="push" title="10 px" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" tag="10" imageScaling="proportionallyDown" inset="2" selectedItem="K1H-GX-dgi" id="dMj-ju-7Q7">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
<menu key="menu" id="Ve7-Ni-pIE">
<items>
<menuItem title="10 px" state="on" tag="10" id="K1H-GX-dgi"/>
<menuItem title="9 px" tag="9" id="MjK-xE-xDS"/>
<menuItem title="8 px" tag="8" id="Tbm-iD-LcT"/>
<menuItem title="7 px" tag="7" id="As9-yv-ClQ"/>
<menuItem title="6 px" tag="6" id="QkM-lb-TEG"/>
<menuItem title="5 px" tag="5" id="eXo-xP-6N7"/>
<menuItem title="4 px" tag="4" id="LhP-q9-3yU"/>
</items>
</menu>
</popUpButtonCell>
<connections>
<action selector="fontSizeChanged:" target="-2" id="u5V-8g-GVu"/>
</connections>
</popUpButton>
<popUpButton verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="D1W-S4-kqi">
<rect key="frame" x="18" y="48" width="76" height="25"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="push" title="40 px" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" tag="40" imageScaling="proportionallyDown" inset="2" selectedItem="nEF-ne-Uur" id="4qm-Fp-7BG">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
<menu key="menu" id="PKu-6K-JrX">
<items>
<menuItem title="40 px" state="on" tag="40" id="nEF-ne-Uur"/>
<menuItem title="35 px" tag="35" id="MuZ-9R-GNV"/>
<menuItem title="30 px" tag="30" id="RRq-eq-zCw"/>
<menuItem title="25 px" tag="25" id="j6J-tT-q5c"/>
<menuItem title="20 px" tag="20" id="CSv-Pn-4v4"/>
<menuItem title="15 px" tag="15" id="SEt-aL-AMP"/>
<menuItem title="10 px" tag="10" id="xkS-gq-5Cm"/>
</items>
</menu>
</popUpButtonCell>
<connections>
<action selector="buttonPaddingChanged:" target="-2" id="Wk8-Qm-W0g"/>
</connections>
</popUpButton>
<textField horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="IDw-Ag-Gcv">
<rect key="frame" x="37" y="114" width="342" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" title="Enable additional Dozer icon. Show/hide less frequently used status bar icons using option+click." id="UjO-Yp-XO4">
<font key="font" metaFont="system" size="10"/>
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<constraints>
<constraint firstAttribute="width" constant="397" id="WEJ-WZ-mea"/>
<constraint firstAttribute="height" constant="354" id="ieY-Q5-nHf"/>
</constraints>
<point key="canvasLocation" x="138.5" y="145"/>
<point key="canvasLocation" x="138.5" y="148"/>
</customView>
</objects>
</document>

0 comments on commit 7b1f0d0

Please sign in to comment.