Rename PresetPrefsViewController

This commit is contained in:
Damiano Galassi committed 2018-03-07 18:13:42 +01:00
1 parent 519fa17893
commit 3b461e7c3c
5 files changed
+45 -35

No files matched your search

@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13528" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14105" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13528"/>
<plugIn identifier="com.apple.imagekit.ibplugin" version="13528"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14105"/>
<plugIn identifier="com.apple.imagekit.ibplugin" version="14105"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -333,7 +333,7 @@
<subviews>
<comboBox verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="1000" translatesAutoresizingMaskIntoConstraints="NO" id="LbC-r6-Pau">
<rect key="frame" x="3" y="0.0" width="344" height="19"/>
<comboBoxCell key="cell" controlSize="small" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" alignment="left" title="Do not localize" usesSingleLineMode="YES" buttonBordered="NO" numberOfVisibleItems="5" id="jkg-xz-Hbn" customClass="ComboBoxCell" customModule="Subler" customModuleProvider="target">
<comboBoxCell key="cell" controlSize="small" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" alignment="left" title="Do not localize" usesSingleLineMode="YES" buttonBordered="NO" numberOfVisibleItems="5" id="jkg-xz-Hbn">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
@@ -1,13 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14087.3" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14105" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14087.3"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14105"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="SBSetPrefsViewController">
<customObject id="-2" userLabel="File's Owner" customClass="PresetPrefsViewController" customModule="Subler" customModuleProvider="target">
<connections>
<outlet property="editSetButton" destination="C1d-lu-T7S" id="iCc-jn-QrW"/>
<outlet property="removeSetButton" destination="SIg-lA-6FA" id="qp7-Jg-UWz"/>
<outlet property="tableView" destination="iRF-P7-a3Q" id="Z1g-o6-Efc"/>
<outlet property="view" destination="Sl5-b6-dQC" id="c8S-a4-aHa"/>
@@ -16,11 +17,11 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="Sl5-b6-dQC">
<rect key="frame" x="0.0" y="0.0" width="396" height="266"/>
<rect key="frame" x="0.0" y="0.0" width="396" height="268"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<scrollView autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Bgi-pA-eAO">
<rect key="frame" x="20" y="46" width="356" height="200"/>
<rect key="frame" x="20" y="48" width="356" height="200"/>
<clipView key="contentView" id="PH5-A6-LVO">
<rect key="frame" x="1" y="1" width="354" height="198"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
@@ -50,7 +51,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="G0s-9P-sPN">
<rect key="frame" x="0.0" y="0.0" width="326" height="17"/>
<rect key="frame" x="0.0" y="0.0" width="350" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" title="Table View Cell" id="6CG-pa-ocP">
<font key="font" metaFont="system"/>
@@ -61,18 +62,6 @@
<outlet property="delegate" destination="-2" id="2Uf-Z0-tF7"/>
</connections>
</textField>
<button toolTip="Show set details" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="IXy-8d-VMc">
<rect key="frame" x="332" y="0.0" width="16" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="bevel" bezelStyle="regularSquare" image="info" imagePosition="overlaps" alignment="center" alternateImage="info-pressed" imageScaling="proportionallyDown" inset="2" id="BeK-4k-Hpl">
<behavior key="behavior" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<accessibility description="Set details"/>
<connections>
<action selector="toggleInfoWindow:" target="-2" id="k0G-nt-Bqd"/>
</connections>
</button>
</subviews>
<connections>
<outlet property="textField" destination="G0s-9P-sPN" id="9Vs-Rk-Gcm"/>
@@ -103,9 +92,10 @@
</scroller>
</scrollView>
<button toolTip="Remove selected set" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="SIg-lA-6FA">
<rect key="frame" x="20" y="19" width="25" height="21"/>
<rect key="frame" x="20" y="19" width="25" height="23"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="25" id="KCi-qM-zwt"/>
<constraint firstAttribute="height" constant="21" id="MLy-Qh-J3X"/>
</constraints>
<buttonCell key="cell" type="smallSquare" bezelStyle="smallSquare" image="NSRemoveTemplate" imagePosition="overlaps" alignment="center" enabled="NO" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Y2I-ux-1v2">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -115,22 +105,36 @@
<action selector="deletePreset:" target="-2" id="afj-BK-TQl"/>
</connections>
</button>
<button toolTip="Edit selected set" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="C1d-lu-T7S">
<rect key="frame" x="53" y="19" width="45" height="23"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="45" id="8we-xP-MsB"/>
</constraints>
<buttonCell key="cell" type="smallSquare" title="Edit" bezelStyle="smallSquare" imagePosition="overlaps" alignment="center" enabled="NO" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="W45-Bf-XCJ">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="editPreset:" target="-2" id="u8x-oY-2Gk"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstItem="SIg-lA-6FA" firstAttribute="top" secondItem="Bgi-pA-eAO" secondAttribute="bottom" constant="7" id="0sg-zC-Z0Q"/>
<constraint firstItem="SIg-lA-6FA" firstAttribute="leading" secondItem="Sl5-b6-dQC" secondAttribute="leading" constant="20" id="4SR-ez-TOh"/>
<constraint firstItem="Bgi-pA-eAO" firstAttribute="top" secondItem="Sl5-b6-dQC" secondAttribute="top" constant="20" id="CfB-Vj-Oio"/>
<constraint firstItem="C1d-lu-T7S" firstAttribute="centerY" secondItem="SIg-lA-6FA" secondAttribute="centerY" id="D3e-th-GNg"/>
<constraint firstItem="C1d-lu-T7S" firstAttribute="leading" secondItem="SIg-lA-6FA" secondAttribute="trailing" constant="8" id="R2g-fk-MQZ"/>
<constraint firstItem="Bgi-pA-eAO" firstAttribute="leading" secondItem="Sl5-b6-dQC" secondAttribute="leading" constant="20" id="SNz-hG-5Nz"/>
<constraint firstAttribute="trailing" secondItem="Bgi-pA-eAO" secondAttribute="trailing" constant="20" id="cgL-bl-uVt"/>
<constraint firstAttribute="bottom" secondItem="SIg-lA-6FA" secondAttribute="bottom" constant="20" symbolic="YES" id="iX7-35-KVJ"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="SIg-lA-6FA" secondAttribute="trailing" constant="20" symbolic="YES" id="ssz-R1-wNZ"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="C1d-lu-T7S" secondAttribute="trailing" constant="20" symbolic="YES" id="ydN-Lk-gHL"/>
</constraints>
<point key="canvasLocation" x="-347" y="-669"/>
</customView>
</objects>
<resources>
<image name="NSRemoveTemplate" width="11" height="11"/>
<image name="info" width="16" height="16"/>
<image name="info-pressed" width="16" height="16"/>
</resources>
</document>
+5 -3
View File
@@ -14,12 +14,13 @@ class PresetPrefsViewController: NSViewController, NSTableViewDataSource, NSTabl
@IBOutlet var tableView: NSTableView!
@IBOutlet var removeSetButton: NSButton!
@IBOutlet var editSetButton: NSButton!
var controller: PresetEditorViewController?
var observer: Any?
override var nibName: NSNib.Name? {
return NSNib.Name(rawValue: "SBPresetPrefsViewController")
return NSNib.Name(rawValue: "PresetPrefsViewController")
}
init() {
@@ -63,6 +64,7 @@ class PresetPrefsViewController: NSViewController, NSTableViewDataSource, NSTabl
func tableViewSelectionDidChange(_ notification: Notification) {
removeSetButton.isEnabled = tableView.selectedRow != -1
editSetButton.isEnabled = tableView.selectedRow != -1
}
// MARK: UI Actions
@@ -100,8 +102,8 @@ class PresetPrefsViewController: NSViewController, NSTableViewDataSource, NSTabl
}
}
@IBAction func toggleInfoWindow(_ sender: NSView) {
let rowIndex = tableView.row(for: sender)
@IBAction func editPreset(_ sender: NSView) {
let rowIndex = tableView.selectedRow
if let preset = presetManager.presets[rowIndex] as? MetadataPreset {
currentRow = rowIndex