Set the action of the new preset button.
This commit is contained in:
3 files changed
+23
-3
No files matched your search
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14105" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14111" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14105"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14111"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
@@ -75,7 +75,7 @@
|
||||
<rect key="frame" x="0.0" y="1" width="350" height="14"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="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" size="11"/>
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
@@ -149,6 +149,9 @@
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="addPreset:" target="-2" id="Mlv-pO-Ewu"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
|
||||
@@ -20,6 +20,10 @@ import Foundation
|
||||
let version: Int
|
||||
var changed: Bool
|
||||
|
||||
convenience init(title: String) {
|
||||
self.init(title: title, metadata: MP42Metadata(), replaceArtworks: true, replaceAnnotations: true)
|
||||
}
|
||||
|
||||
init(title: String, metadata: MP42Metadata, replaceArtworks: Bool, replaceAnnotations: Bool) {
|
||||
self.title = title
|
||||
self.metadata = metadata.copy() as! MP42Metadata
|
||||
|
||||
@@ -128,6 +128,19 @@ class PresetPrefsViewController: NSViewController, SectionsTableViewDataSource,
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func addPreset(_ sender: Any) {
|
||||
var index = 0
|
||||
while true {
|
||||
do {
|
||||
let preset = MetadataPreset(title: "Untitled Preset \(index)")
|
||||
try presetManager.append(newElement: preset)
|
||||
break
|
||||
} catch {
|
||||
index += 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func deletePreset(_ sender: Any) {
|
||||
let rowIndex = tableView.selectedRow
|
||||
let sectionRow = tableView.section(for: rowIndex)
|
||||
|
||||
Reference in new issue
Block a user