Adjust print panel accessory layout

This commit is contained in:
1024jp 2023-10-21 22:23:15 +09:00
parent 0aa6dbfea6
commit 666e065f69
3 changed files with 47 additions and 48 deletions

View File

@ -14,7 +14,7 @@
<rect key="frame" x="0.0" y="0.0" width="440" height="344"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="CvE-De-52u">
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="CvE-De-52u">
<rect key="frame" x="-2" y="288" width="37" height="16"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Color" id="yQ7-YE-ZK9">
<font key="font" usesAppearanceFont="YES"/>
@ -22,7 +22,7 @@
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="kYV-zv-wrQ">
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="kYV-zv-wrQ">
<rect key="frame" x="18" y="251" width="116" height="16"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Print Backgrounds" id="5eL-Aw-LdI">
<font key="font" usesAppearanceFont="YES"/>
@ -30,7 +30,7 @@
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Yho-OF-r7g">
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Yho-OF-r7g">
<rect key="frame" x="-2" y="214" width="120" height="16"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Print Line Numbers" id="L7u-ng-jC7">
<font key="font" usesAppearanceFont="YES"/>
@ -39,7 +39,7 @@
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="bRC-3n-rin" customClass="FormPopUpButton" customModule="CotEditor" customModuleProvider="target">
<rect key="frame" x="311" y="281" width="133" height="25"/>
<rect key="frame" x="310" y="281" width="133" height="25"/>
<popUpButtonCell key="cell" type="roundTextured" title="Black and White" bezelStyle="texturedRounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" autoenablesItems="NO" selectedItem="nUs-hp-672" id="2oE-V0-Tbw" customClass="FormPopUpButtonCell" customModule="CotEditor" customModuleProvider="target">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
@ -57,7 +57,7 @@
<box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="dK7-a2-oXG">
<rect key="frame" x="0.0" y="238" width="440" height="5"/>
</box>
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="wT3-Se-Vox">
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="wT3-Se-Vox">
<rect key="frame" x="-2" y="177" width="92" height="16"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Print Invisibles" id="M5e-Tg-MlQ">
<font key="font" usesAppearanceFont="YES"/>
@ -65,7 +65,7 @@
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="QKu-nK-alH">
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="QKu-nK-alH">
<rect key="frame" x="-2" y="140" width="163" height="16"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Print Headers and Footers" id="l4b-D2-DDX">
<font key="font" usesAppearanceFont="YES"/>
@ -73,7 +73,7 @@
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="qbD-t6-6u6">
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="qbD-t6-6u6">
<rect key="frame" x="18" y="105" width="49" height="16"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Header" id="JlJ-Fc-tes">
<font key="font" usesAppearanceFont="YES"/>
@ -91,21 +91,21 @@
<rect key="frame" x="20" y="201" width="420" height="5"/>
</box>
<switch horizontalHuggingPriority="750" verticalHuggingPriority="750" controlSize="mini" baseWritingDirection="leftToRight" alignment="left" translatesAutoresizingMaskIntoConstraints="NO" id="NX9-Wy-k9a">
<rect key="frame" x="413" y="212" width="28" height="16"/>
<rect key="frame" x="412" y="212" width="28" height="16"/>
<connections>
<accessibilityConnection property="title" destination="Yho-OF-r7g" id="VRX-qX-u5L"/>
<binding destination="bU7-R8-ocO" name="value" keyPath="printsLineNumbers" id="8GX-wv-uP9"/>
</connections>
</switch>
<switch horizontalHuggingPriority="750" verticalHuggingPriority="750" controlSize="mini" baseWritingDirection="leftToRight" alignment="left" translatesAutoresizingMaskIntoConstraints="NO" id="xyB-Z8-pVB">
<rect key="frame" x="413" y="249" width="28" height="16"/>
<rect key="frame" x="412" y="249" width="28" height="16"/>
<connections>
<accessibilityConnection property="title" destination="kYV-zv-wrQ" id="uVD-6X-fzE"/>
<binding destination="bU7-R8-ocO" name="value" keyPath="printsBackground" id="iWY-x1-Ymp"/>
</connections>
</switch>
<switch horizontalHuggingPriority="750" verticalHuggingPriority="750" controlSize="mini" baseWritingDirection="leftToRight" alignment="left" translatesAutoresizingMaskIntoConstraints="NO" id="SdK-De-aPG">
<rect key="frame" x="413" y="175" width="28" height="16"/>
<rect key="frame" x="412" y="175" width="28" height="16"/>
<connections>
<accessibilityConnection property="title" destination="wT3-Se-Vox" id="1IQ-2P-vMS"/>
<binding destination="bU7-R8-ocO" name="value" keyPath="printsInvisibles" id="0wL-g6-9Og"/>
@ -280,7 +280,7 @@
</connections>
</segmentedControl>
<switch horizontalHuggingPriority="750" verticalHuggingPriority="750" controlSize="mini" baseWritingDirection="leftToRight" alignment="left" state="on" translatesAutoresizingMaskIntoConstraints="NO" id="5oG-pS-6uI">
<rect key="frame" x="413" y="138" width="28" height="16"/>
<rect key="frame" x="412" y="138" width="28" height="16"/>
<connections>
<accessibilityConnection property="title" destination="QKu-nK-alH" id="0iv-CH-Pqt"/>
<binding destination="bU7-R8-ocO" name="value" keyPath="printsHeaderAndFooter" id="my2-d7-noX"/>
@ -289,7 +289,7 @@
<box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="27f-Ln-A2D">
<rect key="frame" x="0.0" y="275" width="440" height="5"/>
</box>
<textField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="pEn-Qn-GtM" customClass="NumberTextField" customModule="CotEditor" customModuleProvider="target">
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="pEn-Qn-GtM" customClass="NumberTextField" customModule="CotEditor" customModuleProvider="target">
<rect key="frame" x="364" y="323" width="40" height="21"/>
<constraints>
<constraint firstAttribute="width" constant="40" id="pfn-ZI-xFt"/>
@ -306,7 +306,7 @@
<binding destination="bU7-R8-ocO" name="value" keyPath="fontSize" id="eG0-pg-3e7"/>
</connections>
</textField>
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="XHM-1R-Fyr">
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="XHM-1R-Fyr">
<rect key="frame" x="425" y="326" width="17" height="16"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="pt" id="U13-G4-pKV">
<font key="font" metaFont="system"/>
@ -324,7 +324,7 @@
<box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="vig-41-Y5L">
<rect key="frame" x="0.0" y="312" width="440" height="5"/>
</box>
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="dCk-qa-Upw">
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="dCk-qa-Upw">
<rect key="frame" x="-2" y="326" width="61" height="16"/>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="Font Size" id="fSa-V2-D11">
<font key="font" metaFont="system"/>
@ -335,7 +335,7 @@
<box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="cut-IH-GkZ">
<rect key="frame" x="0.0" y="129" width="440" height="5"/>
</box>
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="3Af-55-FYV">
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="3Af-55-FYV">
<rect key="frame" x="18" y="34" width="44" height="16"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Footer" id="mY6-Zh-2Uc">
<font key="font" usesAppearanceFont="YES"/>
@ -355,7 +355,7 @@
<constraint firstItem="QKu-nK-alH" firstAttribute="top" secondItem="BB8-10-llF" secondAttribute="bottom" constant="10" id="79J-pw-XC3"/>
<constraint firstItem="BB8-10-llF" firstAttribute="top" secondItem="wT3-Se-Vox" secondAttribute="bottom" constant="10" id="7ca-AK-glB"/>
<constraint firstItem="27f-Ln-A2D" firstAttribute="leading" secondItem="tOy-S4-hL0" secondAttribute="leading" id="7yv-m3-TdX"/>
<constraint firstAttribute="trailing" secondItem="NX9-Wy-k9a" secondAttribute="trailing" id="9Cd-Ke-oU9"/>
<constraint firstAttribute="trailing" secondItem="NX9-Wy-k9a" secondAttribute="trailing" constant="1" id="9Cd-Ke-oU9"/>
<constraint firstItem="qUW-qA-jm5" firstAttribute="centerY" secondItem="pEn-Qn-GtM" secondAttribute="centerY" id="9eq-jf-cXz"/>
<constraint firstItem="XHM-1R-Fyr" firstAttribute="firstBaseline" secondItem="dCk-qa-Upw" secondAttribute="firstBaseline" id="9f4-Db-EbY"/>
<constraint firstItem="qbD-t6-6u6" firstAttribute="leading" secondItem="tOy-S4-hL0" secondAttribute="leading" constant="20" id="Azi-rn-3SF"/>
@ -374,7 +374,7 @@
<constraint firstItem="XHM-1R-Fyr" firstAttribute="leading" secondItem="qUW-qA-jm5" secondAttribute="trailing" constant="6" id="Hib-w5-nCg"/>
<constraint firstItem="dpB-O3-zLC" firstAttribute="leading" secondItem="tOy-S4-hL0" secondAttribute="leading" constant="20" symbolic="YES" id="Hqr-ur-Fe1"/>
<constraint firstItem="3Af-55-FYV" firstAttribute="leading" secondItem="tOy-S4-hL0" secondAttribute="leading" constant="20" id="IKR-q2-dNG"/>
<constraint firstAttribute="trailing" secondItem="SdK-De-aPG" secondAttribute="trailing" id="JN2-wh-ZXK"/>
<constraint firstAttribute="trailing" secondItem="SdK-De-aPG" secondAttribute="trailing" constant="1" id="JN2-wh-ZXK"/>
<constraint firstItem="NX9-Wy-k9a" firstAttribute="firstBaseline" secondItem="Yho-OF-r7g" secondAttribute="firstBaseline" id="K5Q-SK-sKc"/>
<constraint firstItem="zau-Af-OBf" firstAttribute="top" secondItem="Y6C-KD-Qlx" secondAttribute="bottom" constant="8" symbolic="YES" id="K70-QO-QcT"/>
<constraint firstItem="dCk-qa-Upw" firstAttribute="leading" secondItem="tOy-S4-hL0" secondAttribute="leading" id="KD7-7b-RtX"/>
@ -394,7 +394,7 @@
<constraint firstItem="wT3-Se-Vox" firstAttribute="top" secondItem="dpB-O3-zLC" secondAttribute="bottom" constant="10" id="UWz-oF-RwX"/>
<constraint firstItem="t3D-7C-ObH" firstAttribute="top" secondItem="qqp-Os-uMO" secondAttribute="bottom" constant="8" symbolic="YES" id="V5w-Qn-x58"/>
<constraint firstItem="t3D-7C-ObH" firstAttribute="firstBaseline" secondItem="BMN-9W-V2O" secondAttribute="firstBaseline" id="VEU-Q6-JRJ"/>
<constraint firstAttribute="trailing" secondItem="5oG-pS-6uI" secondAttribute="trailing" id="W1n-cr-TnJ"/>
<constraint firstAttribute="trailing" secondItem="5oG-pS-6uI" secondAttribute="trailing" constant="1" id="W1n-cr-TnJ"/>
<constraint firstItem="kYV-zv-wrQ" firstAttribute="leading" secondItem="tOy-S4-hL0" secondAttribute="leading" constant="20" id="WSe-UZ-wEH"/>
<constraint firstItem="qqp-Os-uMO" firstAttribute="leading" secondItem="JEM-Eg-bfM" secondAttribute="trailing" constant="8" symbolic="YES" id="Wwr-Qs-r0B"/>
<constraint firstItem="Y6C-KD-Qlx" firstAttribute="leading" secondItem="f1I-iq-7Ha" secondAttribute="trailing" constant="8" symbolic="YES" id="chi-yO-QH8"/>
@ -421,10 +421,10 @@
<constraint firstItem="zau-Af-OBf" firstAttribute="centerY" secondItem="lW8-WA-sUW" secondAttribute="centerY" id="rUC-Ai-d78"/>
<constraint firstAttribute="trailing" secondItem="vig-41-Y5L" secondAttribute="trailing" id="rlF-jt-ju1"/>
<constraint firstItem="zau-Af-OBf" firstAttribute="leading" secondItem="lW8-WA-sUW" secondAttribute="trailing" constant="8" symbolic="YES" id="sQp-ub-JHL"/>
<constraint firstAttribute="trailing" secondItem="bRC-3n-rin" secondAttribute="trailing" id="t9N-kV-8sR"/>
<constraint firstAttribute="trailing" secondItem="bRC-3n-rin" secondAttribute="trailing" constant="1" id="t9N-kV-8sR"/>
<constraint firstItem="cut-IH-GkZ" firstAttribute="leading" secondItem="tOy-S4-hL0" secondAttribute="leading" id="ubz-xN-bTU"/>
<constraint firstItem="5oG-pS-6uI" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="QKu-nK-alH" secondAttribute="trailing" constant="8" symbolic="YES" id="v5O-8X-Z8H"/>
<constraint firstAttribute="trailing" secondItem="xyB-Z8-pVB" secondAttribute="trailing" id="wWo-ZZ-AqQ"/>
<constraint firstAttribute="trailing" secondItem="xyB-Z8-pVB" secondAttribute="trailing" constant="1" id="wWo-ZZ-AqQ"/>
<constraint firstItem="vig-41-Y5L" firstAttribute="leading" secondItem="tOy-S4-hL0" secondAttribute="leading" id="wXp-RL-gQF"/>
<constraint firstAttribute="trailing" secondItem="NmH-od-2G4" secondAttribute="trailing" id="we1-vE-U1t"/>
<constraint firstAttribute="trailing" secondItem="qqp-Os-uMO" secondAttribute="trailing" id="xKH-KX-jAz"/>

View File

@ -95,9 +95,9 @@ final class FormPopUpButtonCell: NSPopUpButtonCell {
case (false, true, true): .tertiarySystemFill
case (false, true, false): .quaternarySystemFill
case (true, false, true): preconditionFailure() // gradient
case (true, false, false): .windowBackgroundColor // TODO: ??
case (true, false, false): .windowBackgroundColor // not exactly same
case (true, true, true): .labelColor
case (true, true, false): .tertiarySystemFill // TODO: a bit whiter
case (true, true, false): .tertiarySystemFill // not exactly same
}
fillColor.setFill()
@ -127,31 +127,6 @@ final class FormPopUpButtonCell: NSPopUpButtonCell {
public extension NSColor {
/// The back-deployed version of the `.systemFill`.
@backDeployed(before: macOS 14)
static var systemFill: NSColor { .labelColor.withAlphaComponent(0.50) }
/// The back-deployed version of the `.secondarySystemFill`.
@backDeployed(before: macOS 14)
static var secondarySystemFill: NSColor { .labelColor.withAlphaComponent(0.15) }
/// The back-deployed version of the `.tertiarySystemFill`.
@backDeployed(before: macOS 14)
static var tertiarySystemFill: NSColor { .labelColor.withAlphaComponent(0.10) }
/// The back-deployed version of the `.quaternarySystemFill`.
@backDeployed(before: macOS 14)
static var quaternarySystemFill: NSColor { .labelColor.withAlphaComponent(0.05) }
/// The back-deployed version of the `.quinarySystemFill`.
@backDeployed(before: macOS 14)
static var quinarySystemFill: NSColor { .labelColor.withAlphaComponent(0.03) }
}
// MARK: - Preview
@available(macOS 14, *)
@ -162,7 +137,6 @@ public extension NSColor {
return button
}
@available(macOS 14, *)
#Preview("Disabled") {
let button = FormPopUpButton()

View File

@ -46,3 +46,28 @@ extension NSColor {
.map { NSColor(calibratedHue: $0, saturation: self.saturationComponent, brightness: self.brightnessComponent, alpha: self.alphaComponent) }
}
}
public extension NSColor {
/// The back-deployed version of the `.systemFill`.
@backDeployed(before: macOS 14)
static var systemFill: NSColor { .labelColor.withAlphaComponent(0.50) }
/// The back-deployed version of the `.secondarySystemFill`.
@backDeployed(before: macOS 14)
static var secondarySystemFill: NSColor { .labelColor.withAlphaComponent(0.15) }
/// The back-deployed version of the `.tertiarySystemFill`.
@backDeployed(before: macOS 14)
static var tertiarySystemFill: NSColor { .labelColor.withAlphaComponent(0.10) }
/// The back-deployed version of the `.quaternarySystemFill`.
@backDeployed(before: macOS 14)
static var quaternarySystemFill: NSColor { .labelColor.withAlphaComponent(0.05) }
/// The back-deployed version of the `.quinarySystemFill`.
@backDeployed(before: macOS 14)
static var quinarySystemFill: NSColor { .labelColor.withAlphaComponent(0.03) }
}