2016-10-03 01:56:50 +00:00
|
|
|
//
|
|
|
|
// 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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-03 02:04:47 +00:00
|
|
|
fileprivate let displayTypeUserDefaultsKey = "electron.displayType"
|
|
|
|
|
2016-10-03 01:56:50 +00:00
|
|
|
@IBOutlet var displayTypeButton: NSPopUpButton?
|
|
|
|
@IBAction func setDisplayType(_ sender: NSPopUpButton!) {
|
2017-11-25 02:36:22 +00:00
|
|
|
electron.useCompositeOutput = (sender.indexOfSelectedItem == 1)
|
2016-10-03 02:04:47 +00:00
|
|
|
UserDefaults.standard.set(sender.indexOfSelectedItem, forKey: self.displayTypeUserDefaultsKey)
|
2016-10-03 01:56:50 +00:00
|
|
|
}
|
2016-10-03 02:04:47 +00:00
|
|
|
|
|
|
|
override func establishStoredOptions() {
|
|
|
|
super.establishStoredOptions()
|
|
|
|
let standardUserDefaults = UserDefaults.standard
|
|
|
|
standardUserDefaults.register(defaults: [
|
|
|
|
displayTypeUserDefaultsKey: 0,
|
|
|
|
])
|
|
|
|
|
|
|
|
let displayType = standardUserDefaults.integer(forKey: self.displayTypeUserDefaultsKey)
|
2017-11-25 02:36:22 +00:00
|
|
|
electron.useCompositeOutput = (displayType == 1)
|
2016-10-03 02:04:47 +00:00
|
|
|
self.displayTypeButton?.selectItem(at: displayType)
|
2016-10-03 02:06:28 +00:00
|
|
|
}
|
|
|
|
}
|