mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 23:52:26 +00:00
ddf1bf3cbf
For everything except the Vic-20, anyway. That has a somewhat outdated notion of what an options panel should be, corresponding to the work yet to do on its analyser.
50 lines
1.8 KiB
Swift
50 lines
1.8 KiB
Swift
//
|
|
// ZX8081OptionsPanel.swift
|
|
// Clock Signal
|
|
//
|
|
// Created by Thomas Harte on 08/07/2017.
|
|
// Copyright © 2017 Thomas Harte. All rights reserved.
|
|
//
|
|
|
|
class ZX8081OptionsPanel: MachinePanel {
|
|
var zx8081: CSZX8081! {
|
|
get {
|
|
return self.machine.zx8081
|
|
}
|
|
}
|
|
|
|
@IBOutlet var automaticTapeMotorControlButton: NSButton!
|
|
var automaticTapeMotorControlDefaultsKey: String {
|
|
get { return prefixedUserDefaultsKey("automaticTapeMotorControl") }
|
|
}
|
|
@IBAction func setAutomaticTapeMotorConrol(_ sender: NSButton!) {
|
|
let isEnabled = sender.state == .on
|
|
UserDefaults.standard.set(isEnabled, forKey: self.automaticTapeMotorControlDefaultsKey)
|
|
self.playOrPauseTapeButton.isEnabled = !isEnabled
|
|
self.machine.useAutomaticTapeMotorControl = isEnabled
|
|
}
|
|
|
|
@IBOutlet var playOrPauseTapeButton: NSButton!
|
|
@IBAction func playOrPauseTape(_ sender: NSButton!) {
|
|
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)
|
|
self.automaticTapeMotorControlButton.state = automaticTapeMotorControlIsEnabled ? .on : .off
|
|
self.playOrPauseTapeButton.isEnabled = !automaticTapeMotorControlIsEnabled
|
|
self.machine.useAutomaticTapeMotorControl = automaticTapeMotorControlIsEnabled
|
|
}
|
|
}
|