mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-03 08:05:40 +00:00
36 lines
1.0 KiB
Swift
36 lines
1.0 KiB
Swift
//
|
|
// ElectronOptionsPanel.swift
|
|
// Clock Signal
|
|
//
|
|
// Created by Thomas Harte on 02/10/2016.
|
|
// Copyright © 2016 Thomas Harte. All rights reserved.
|
|
//
|
|
|
|
class ElectronOptionsPanel: MachinePanel {
|
|
var electron: CSElectron! {
|
|
get {
|
|
return self.machine as! CSElectron
|
|
}
|
|
}
|
|
|
|
fileprivate let displayTypeUserDefaultsKey = "electron.displayType"
|
|
|
|
@IBOutlet var displayTypeButton: NSPopUpButton?
|
|
@IBAction func setDisplayType(_ sender: NSPopUpButton!) {
|
|
electron.useTelevisionOutput = (sender.indexOfSelectedItem == 1)
|
|
UserDefaults.standard.set(sender.indexOfSelectedItem, forKey: self.displayTypeUserDefaultsKey)
|
|
}
|
|
|
|
override func establishStoredOptions() {
|
|
super.establishStoredOptions()
|
|
let standardUserDefaults = UserDefaults.standard
|
|
standardUserDefaults.register(defaults: [
|
|
displayTypeUserDefaultsKey: 0,
|
|
])
|
|
|
|
let displayType = standardUserDefaults.integer(forKey: self.displayTypeUserDefaultsKey)
|
|
electron.useTelevisionOutput = (displayType == 1)
|
|
self.displayTypeButton?.selectItem(at: displayType)
|
|
}
|
|
}
|