2017-07-08 21:59:33 +00:00
|
|
|
//
|
|
|
|
// ZX8081OptionsPanel.swift
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 08/07/2017.
|
2018-05-13 19:19:52 +00:00
|
|
|
// Copyright 2017 Thomas Harte. All rights reserved.
|
2017-07-08 21:59:33 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
class ZX8081OptionsPanel: MachinePanel {
|
2017-07-08 23:12:06 +00:00
|
|
|
var zx8081: CSZX8081! {
|
|
|
|
get {
|
2018-02-13 02:46:21 +00:00
|
|
|
return self.machine.zx8081
|
2017-07-08 23:12:06 +00:00
|
|
|
}
|
|
|
|
}
|
2017-07-08 21:59:33 +00:00
|
|
|
|
2017-07-08 23:12:06 +00:00
|
|
|
@IBOutlet var automaticTapeMotorControlButton: NSButton!
|
|
|
|
var automaticTapeMotorControlDefaultsKey: String {
|
|
|
|
get { return prefixedUserDefaultsKey("automaticTapeMotorControl") }
|
2017-07-08 21:59:33 +00:00
|
|
|
}
|
2017-07-08 23:12:06 +00:00
|
|
|
@IBAction func setAutomaticTapeMotorConrol(_ sender: NSButton!) {
|
2017-09-20 03:06:37 +00:00
|
|
|
let isEnabled = sender.state == .on
|
2017-07-08 23:12:06 +00:00
|
|
|
UserDefaults.standard.set(isEnabled, forKey: self.automaticTapeMotorControlDefaultsKey)
|
|
|
|
self.playOrPauseTapeButton.isEnabled = !isEnabled
|
2018-02-13 02:46:21 +00:00
|
|
|
self.machine.useAutomaticTapeMotorControl = isEnabled
|
2017-07-08 23:12:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@IBOutlet var playOrPauseTapeButton: NSButton!
|
2017-07-08 21:59:33 +00:00
|
|
|
@IBAction func playOrPauseTape(_ sender: NSButton!) {
|
2017-07-08 23:12:06 +00:00
|
|
|
self.zx8081.tapeIsPlaying = !self.zx8081.tapeIsPlaying
|
|
|
|
self.playOrPauseTapeButton.title = self.zx8081.tapeIsPlaying
|
|
|
|
? NSLocalizedString("Stop Tape", comment: "Text for a button that will stop tape playback")
|
|
|
|
: NSLocalizedString("Play Tape", comment: "Text for a button that will start tape playback")
|
|
|
|
}
|
|
|
|
|
|
|
|
// MARK: option restoration
|
|
|
|
override func establishStoredOptions() {
|
|
|
|
super.establishStoredOptions()
|
|
|
|
|
|
|
|
let standardUserDefaults = UserDefaults.standard
|
|
|
|
standardUserDefaults.register(defaults: [
|
|
|
|
self.automaticTapeMotorControlDefaultsKey: true
|
|
|
|
])
|
|
|
|
|
|
|
|
let automaticTapeMotorControlIsEnabled = standardUserDefaults.bool(forKey: self.automaticTapeMotorControlDefaultsKey)
|
2017-09-20 03:06:37 +00:00
|
|
|
self.automaticTapeMotorControlButton.state = automaticTapeMotorControlIsEnabled ? .on : .off
|
2017-07-08 23:12:06 +00:00
|
|
|
self.playOrPauseTapeButton.isEnabled = !automaticTapeMotorControlIsEnabled
|
2018-02-13 02:46:21 +00:00
|
|
|
self.machine.useAutomaticTapeMotorControl = automaticTapeMotorControlIsEnabled
|
2017-07-08 21:59:33 +00:00
|
|
|
}
|
|
|
|
}
|