2018-04-03 02:42:41 +00:00
|
|
|
//
|
|
|
|
// MachinePicker.swift
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 02/04/2018.
|
2018-05-13 19:19:52 +00:00
|
|
|
// Copyright 2018 Thomas Harte. All rights reserved.
|
2018-04-03 02:42:41 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
import Cocoa
|
|
|
|
|
2021-03-25 20:25:11 +00:00
|
|
|
// Quick note on structure below: I have an NSTableView to contain machine names,
|
|
|
|
// programmatically manipulating the selected tab in an NSTabView. I admit that this
|
|
|
|
// is odd. It's partly for historical reasons — this was purely an NSTabView until
|
|
|
|
// the number of options got too large — and partly because it makes designing things
|
|
|
|
// in the interface builder easier.
|
|
|
|
//
|
|
|
|
// I accept that I'll have to rethink this again if the machine list keeps growing.
|
|
|
|
class MachinePicker: NSObject, NSTableViewDataSource, NSTableViewDelegate {
|
2021-03-06 23:53:09 +00:00
|
|
|
@IBOutlet var machineSelector: NSTabView!
|
2021-03-25 20:25:11 +00:00
|
|
|
@IBOutlet var machineNameTable: NSTableView!
|
2018-04-03 02:42:41 +00:00
|
|
|
|
2021-12-22 23:20:55 +00:00
|
|
|
// MARK: - Amiga properties
|
|
|
|
@IBOutlet var amigaChipRAMButton: NSPopUpButton!
|
|
|
|
@IBOutlet var amigaFastRAMButton: NSPopUpButton!
|
|
|
|
|
2018-05-03 23:37:32 +00:00
|
|
|
// MARK: - Apple II properties
|
2021-03-06 23:53:09 +00:00
|
|
|
@IBOutlet var appleIIModelButton: NSPopUpButton!
|
|
|
|
@IBOutlet var appleIIDiskControllerButton: NSPopUpButton!
|
2024-02-15 14:10:19 +00:00
|
|
|
@IBOutlet var appleIIMockingboardButton: NSButton!
|
2018-05-03 23:37:32 +00:00
|
|
|
|
2020-10-21 02:18:11 +00:00
|
|
|
// MARK: - Apple IIgs properties
|
2021-03-06 23:53:09 +00:00
|
|
|
@IBOutlet var appleIIgsModelButton: NSPopUpButton!
|
|
|
|
@IBOutlet var appleIIgsMemorySizeButton: NSPopUpButton!
|
2020-10-21 02:18:11 +00:00
|
|
|
|
2022-08-10 18:58:19 +00:00
|
|
|
// MARK: - Atari ST properties
|
|
|
|
@IBOutlet var atariSTMemorySizeButton: NSPopUpButton!
|
|
|
|
|
2021-06-23 01:39:07 +00:00
|
|
|
// MARK: - CPC properties
|
|
|
|
@IBOutlet var cpcModelTypeButton: NSPopUpButton!
|
|
|
|
|
2018-04-03 02:42:41 +00:00
|
|
|
// MARK: - Electron properties
|
2021-03-06 23:53:09 +00:00
|
|
|
@IBOutlet var electronDFSButton: NSButton!
|
|
|
|
@IBOutlet var electronADFSButton: NSButton!
|
|
|
|
@IBOutlet var electronAP6Button: NSButton!
|
|
|
|
@IBOutlet var electronSidewaysRAMButton: NSButton!
|
2018-04-03 02:42:41 +00:00
|
|
|
|
2021-06-23 01:39:07 +00:00
|
|
|
// MARK: - Enterprise properties
|
|
|
|
@IBOutlet var enterpriseModelButton: NSPopUpButton!
|
2021-07-08 22:50:37 +00:00
|
|
|
@IBOutlet var enterpriseSpeedButton: NSPopUpButton!
|
2021-06-23 01:39:07 +00:00
|
|
|
@IBOutlet var enterpriseEXOSButton: NSPopUpButton!
|
|
|
|
@IBOutlet var enterpriseBASICButton: NSPopUpButton!
|
|
|
|
@IBOutlet var enterpriseDOSButton: NSPopUpButton!
|
2018-04-03 02:42:41 +00:00
|
|
|
|
2019-09-25 02:48:34 +00:00
|
|
|
// MARK: - Macintosh properties
|
2021-03-06 23:53:09 +00:00
|
|
|
@IBOutlet var macintoshModelTypeButton: NSPopUpButton!
|
2019-09-25 02:48:34 +00:00
|
|
|
|
2018-04-03 02:42:41 +00:00
|
|
|
// MARK: - MSX properties
|
2023-03-22 00:05:10 +00:00
|
|
|
@IBOutlet var msxModelButton: NSPopUpButton!
|
2021-03-06 23:53:09 +00:00
|
|
|
@IBOutlet var msxRegionButton: NSPopUpButton!
|
|
|
|
@IBOutlet var msxHasDiskDriveButton: NSButton!
|
2023-05-14 02:25:50 +00:00
|
|
|
@IBOutlet var msxHasMSXMUSICButton: NSButton!
|
2018-04-03 02:42:41 +00:00
|
|
|
|
|
|
|
// MARK: - Oric properties
|
2021-03-06 23:53:09 +00:00
|
|
|
@IBOutlet var oricModelTypeButton: NSPopUpButton!
|
|
|
|
@IBOutlet var oricDiskInterfaceButton: NSPopUpButton!
|
2018-04-03 02:42:41 +00:00
|
|
|
|
2023-12-05 21:42:55 +00:00
|
|
|
// MARK: - PC compatible properties
|
|
|
|
@IBOutlet var pcVideoAdaptorButton: NSPopUpButton!
|
2023-12-08 19:23:27 +00:00
|
|
|
@IBOutlet var pcSpeedButton: NSPopUpButton!
|
2023-12-05 21:42:55 +00:00
|
|
|
|
2021-03-22 01:50:50 +00:00
|
|
|
// MARK: - Spectrum properties
|
|
|
|
@IBOutlet var spectrumModelTypeButton: NSPopUpButton!
|
|
|
|
|
2018-04-03 02:42:41 +00:00
|
|
|
// MARK: - Vic-20 properties
|
2021-03-06 23:53:09 +00:00
|
|
|
@IBOutlet var vic20RegionButton: NSPopUpButton!
|
|
|
|
@IBOutlet var vic20MemorySizeButton: NSPopUpButton!
|
|
|
|
@IBOutlet var vic20HasC1540Button: NSButton!
|
2018-04-03 02:42:41 +00:00
|
|
|
|
|
|
|
// MARK: - ZX80 properties
|
2021-03-06 23:53:09 +00:00
|
|
|
@IBOutlet var zx80MemorySizeButton: NSPopUpButton!
|
|
|
|
@IBOutlet var zx80UsesZX81ROMButton: NSButton!
|
2018-04-03 02:42:41 +00:00
|
|
|
|
|
|
|
// MARK: - ZX81 properties
|
2021-03-06 23:53:09 +00:00
|
|
|
@IBOutlet var zx81MemorySizeButton: NSPopUpButton!
|
2018-04-03 02:42:41 +00:00
|
|
|
|
2018-04-04 03:01:12 +00:00
|
|
|
// MARK: - Preferences
|
|
|
|
func establishStoredOptions() {
|
|
|
|
let standardUserDefaults = UserDefaults.standard
|
|
|
|
|
2021-03-25 20:25:11 +00:00
|
|
|
// Set up data soure.
|
|
|
|
|
2023-11-17 04:33:42 +00:00
|
|
|
// TEMPORARY: remove the Apple IIgs and PC compatible options.
|
|
|
|
// Neither is yet a fully-working machine.
|
2023-11-22 03:48:26 +00:00
|
|
|
#if !DEBUG
|
2023-12-21 17:59:53 +00:00
|
|
|
for hidden in ["appleiigs"] {
|
2023-11-17 14:13:45 +00:00
|
|
|
let tabIndex = machineSelector.indexOfTabViewItem(withIdentifier: hidden)
|
|
|
|
machineSelector.removeTabViewItem(machineSelector.tabViewItem(at: tabIndex))
|
|
|
|
}
|
2021-03-25 20:25:11 +00:00
|
|
|
machineNameTable.reloadData()
|
2023-11-22 03:02:36 +00:00
|
|
|
#endif
|
2021-03-07 02:32:35 +00:00
|
|
|
|
2018-04-04 03:01:12 +00:00
|
|
|
// Machine type
|
|
|
|
if let machineIdentifier = standardUserDefaults.string(forKey: "new.machine") {
|
2020-11-13 23:29:48 +00:00
|
|
|
// If I've changed my mind about visible tabs between versions, there may not be one that corresponds
|
|
|
|
// to the stored identifier. Make sure not to raise an NSRangeException in that scenario.
|
2021-03-06 23:53:09 +00:00
|
|
|
let index = machineSelector.indexOfTabViewItem(withIdentifier: machineIdentifier as Any)
|
|
|
|
if index != NSNotFound {
|
|
|
|
machineSelector.selectTabViewItem(at: index)
|
2021-03-25 20:25:11 +00:00
|
|
|
machineNameTable.selectRowIndexes(IndexSet(integer: index), byExtendingSelection: false)
|
|
|
|
machineNameTable.scrollRowToVisible(index)
|
2020-11-13 23:29:48 +00:00
|
|
|
}
|
2018-04-04 03:01:12 +00:00
|
|
|
}
|
|
|
|
|
2021-12-22 23:20:55 +00:00
|
|
|
// Amiga settings
|
|
|
|
amigaChipRAMButton.selectItem(withTag: standardUserDefaults.integer(forKey: "new.amigaChipRAM"))
|
|
|
|
amigaFastRAMButton.selectItem(withTag: standardUserDefaults.integer(forKey: "new.amigaFastRAM"))
|
|
|
|
|
2018-05-03 23:37:32 +00:00
|
|
|
// Apple II settings
|
2021-03-06 23:53:09 +00:00
|
|
|
appleIIModelButton.selectItem(withTag: standardUserDefaults.integer(forKey: "new.appleIIModel"))
|
|
|
|
appleIIDiskControllerButton.selectItem(withTag: standardUserDefaults.integer(forKey: "new.appleIIDiskController"))
|
2024-02-15 14:10:19 +00:00
|
|
|
appleIIMockingboardButton.state = standardUserDefaults.bool(forKey: "new.appleIIMockingboard") ? .on : .off
|
2018-05-03 23:37:32 +00:00
|
|
|
|
2020-10-21 02:18:11 +00:00
|
|
|
// Apple IIgs settings
|
2021-03-06 23:53:09 +00:00
|
|
|
appleIIgsModelButton.selectItem(withTag: standardUserDefaults.integer(forKey: "new.appleIIgsModel"))
|
|
|
|
appleIIgsMemorySizeButton.selectItem(withTag: standardUserDefaults.integer(forKey: "new.appleIIgsMemorySize"))
|
2020-10-21 02:18:11 +00:00
|
|
|
|
2022-08-10 18:58:19 +00:00
|
|
|
// Atari ST settings
|
|
|
|
atariSTMemorySizeButton.selectItem(withTag: standardUserDefaults.integer(forKey: "new.atariSTMemorySize"))
|
|
|
|
|
2021-06-23 01:39:07 +00:00
|
|
|
// CPC settings
|
|
|
|
cpcModelTypeButton.selectItem(withTag: standardUserDefaults.integer(forKey: "new.cpcModel"))
|
|
|
|
|
2018-04-04 03:01:12 +00:00
|
|
|
// Electron settings
|
2021-03-06 23:53:09 +00:00
|
|
|
electronDFSButton.state = standardUserDefaults.bool(forKey: "new.electronDFS") ? .on : .off
|
|
|
|
electronADFSButton.state = standardUserDefaults.bool(forKey: "new.electronADFS") ? .on : .off
|
|
|
|
electronAP6Button.state = standardUserDefaults.bool(forKey: "new.electronAP6") ? .on : .off
|
|
|
|
electronSidewaysRAMButton.state = standardUserDefaults.bool(forKey: "new.electronSidewaysRAM") ? .on : .off
|
2018-04-04 03:01:12 +00:00
|
|
|
|
2021-06-23 01:39:07 +00:00
|
|
|
// Enterprise settings
|
|
|
|
enterpriseModelButton.selectItem(withTag: standardUserDefaults.integer(forKey: "new.enterpriseModel"))
|
2021-07-08 22:50:37 +00:00
|
|
|
enterpriseSpeedButton.selectItem(withTag: standardUserDefaults.integer(forKey: "new.enterpriseSpeed"))
|
2021-06-23 01:39:07 +00:00
|
|
|
enterpriseEXOSButton.selectItem(withTag: standardUserDefaults.integer(forKey: "new.enterpriseEXOSVersion"))
|
|
|
|
enterpriseBASICButton.selectItem(withTag: standardUserDefaults.integer(forKey: "new.enterpriseBASICVersion"))
|
|
|
|
enterpriseDOSButton.selectItem(withTag: standardUserDefaults.integer(forKey: "new.enterpriseDOS"))
|
2018-04-04 03:01:12 +00:00
|
|
|
|
2019-09-25 02:48:34 +00:00
|
|
|
// Macintosh settings
|
2021-03-06 23:53:09 +00:00
|
|
|
macintoshModelTypeButton.selectItem(withTag: standardUserDefaults.integer(forKey: "new.macintoshModel"))
|
2019-09-25 02:48:34 +00:00
|
|
|
|
2018-04-04 03:01:12 +00:00
|
|
|
// MSX settings
|
2023-03-22 00:05:10 +00:00
|
|
|
msxModelButton.selectItem(withTag: standardUserDefaults.integer(forKey: "new.msxModel"))
|
2021-03-06 23:53:09 +00:00
|
|
|
msxRegionButton.selectItem(withTag: standardUserDefaults.integer(forKey: "new.msxRegion"))
|
|
|
|
msxHasDiskDriveButton.state = standardUserDefaults.bool(forKey: "new.msxDiskDrive") ? .on : .off
|
2023-05-14 02:25:50 +00:00
|
|
|
msxHasMSXMUSICButton.state = standardUserDefaults.bool(forKey: "new.msxMSXMUSIC") ? .on : .off
|
2018-04-04 03:01:12 +00:00
|
|
|
|
|
|
|
// Oric settings
|
2021-03-06 23:53:09 +00:00
|
|
|
oricDiskInterfaceButton.selectItem(withTag: standardUserDefaults.integer(forKey: "new.oricDiskInterface"))
|
|
|
|
oricModelTypeButton.selectItem(withTag: standardUserDefaults.integer(forKey: "new.oricModel"))
|
2018-04-04 03:01:12 +00:00
|
|
|
|
2023-12-05 21:42:55 +00:00
|
|
|
// PC settings
|
|
|
|
pcVideoAdaptorButton.selectItem(withTag: standardUserDefaults.integer(forKey: "new.pcVideoAdaptor"))
|
2023-12-08 19:23:27 +00:00
|
|
|
pcSpeedButton.selectItem(withTag: standardUserDefaults.integer(forKey: "new.pcSpeed"))
|
2023-12-05 21:42:55 +00:00
|
|
|
|
2021-03-22 01:50:50 +00:00
|
|
|
// Spectrum settings
|
|
|
|
spectrumModelTypeButton.selectItem(withTag: standardUserDefaults.integer(forKey: "new.spectrumModel"))
|
|
|
|
|
2018-04-04 03:01:12 +00:00
|
|
|
// Vic-20 settings
|
2021-03-06 23:53:09 +00:00
|
|
|
vic20RegionButton.selectItem(withTag: standardUserDefaults.integer(forKey: "new.vic20Region"))
|
|
|
|
vic20MemorySizeButton.selectItem(withTag: standardUserDefaults.integer(forKey: "new.vic20MemorySize"))
|
|
|
|
vic20HasC1540Button.state = standardUserDefaults.bool(forKey: "new.vic20C1540") ? .on : .off
|
2018-04-04 03:01:12 +00:00
|
|
|
|
|
|
|
// ZX80
|
2021-03-06 23:53:09 +00:00
|
|
|
zx80MemorySizeButton.selectItem(withTag: standardUserDefaults.integer(forKey: "new.zx80MemorySize"))
|
|
|
|
zx80UsesZX81ROMButton.state = standardUserDefaults.bool(forKey: "new.zx80UsesZX81ROM") ? .on : .off
|
2018-04-04 03:01:12 +00:00
|
|
|
|
|
|
|
// ZX81
|
2021-03-06 23:53:09 +00:00
|
|
|
zx81MemorySizeButton.selectItem(withTag: standardUserDefaults.integer(forKey: "new.zx81MemorySize"))
|
2018-04-04 03:01:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fileprivate func storeOptions() {
|
|
|
|
let standardUserDefaults = UserDefaults.standard
|
|
|
|
|
|
|
|
// Machine type
|
2021-03-06 23:53:09 +00:00
|
|
|
standardUserDefaults.set(machineSelector.selectedTabViewItem!.identifier as! String, forKey: "new.machine")
|
2018-04-04 03:01:12 +00:00
|
|
|
|
2021-12-22 23:20:55 +00:00
|
|
|
// Amiga settings
|
|
|
|
standardUserDefaults.set(amigaChipRAMButton.selectedTag(), forKey: "new.amigaChipRAM")
|
|
|
|
standardUserDefaults.set(amigaFastRAMButton.selectedTag(), forKey: "new.amigaFastRAM")
|
|
|
|
|
2018-05-03 23:37:32 +00:00
|
|
|
// Apple II settings
|
2021-03-06 23:53:09 +00:00
|
|
|
standardUserDefaults.set(appleIIModelButton.selectedTag(), forKey: "new.appleIIModel")
|
|
|
|
standardUserDefaults.set(appleIIDiskControllerButton.selectedTag(), forKey: "new.appleIIDiskController")
|
2024-02-15 14:10:19 +00:00
|
|
|
standardUserDefaults.set(appleIIMockingboardButton.state == .on, forKey: "new.appleIIMockingboard")
|
2018-05-03 23:37:32 +00:00
|
|
|
|
2020-10-21 02:18:11 +00:00
|
|
|
// Apple IIgs settings
|
2021-03-06 23:53:09 +00:00
|
|
|
standardUserDefaults.set(appleIIgsModelButton.selectedTag(), forKey: "new.appleIIgsModel")
|
|
|
|
standardUserDefaults.set(appleIIgsMemorySizeButton.selectedTag(), forKey: "new.appleIIgsMemorySize")
|
2020-10-21 02:18:11 +00:00
|
|
|
|
2022-08-10 18:58:19 +00:00
|
|
|
// Atari ST settings
|
|
|
|
standardUserDefaults.set(atariSTMemorySizeButton.selectedTag(), forKey: "new.atariSTMemorySize")
|
|
|
|
|
2021-06-23 01:39:07 +00:00
|
|
|
// CPC settings
|
|
|
|
standardUserDefaults.set(cpcModelTypeButton.selectedTag(), forKey: "new.cpcModel")
|
|
|
|
|
2018-04-04 03:01:12 +00:00
|
|
|
// Electron settings
|
2021-03-06 23:53:09 +00:00
|
|
|
standardUserDefaults.set(electronDFSButton.state == .on, forKey: "new.electronDFS")
|
|
|
|
standardUserDefaults.set(electronADFSButton.state == .on, forKey: "new.electronADFS")
|
|
|
|
standardUserDefaults.set(electronAP6Button.state == .on, forKey: "new.electronAP6")
|
|
|
|
standardUserDefaults.set(electronSidewaysRAMButton.state == .on, forKey: "new.electronSidewaysRAM")
|
2018-04-04 03:01:12 +00:00
|
|
|
|
2021-06-23 01:39:07 +00:00
|
|
|
// Enterprise settings
|
|
|
|
standardUserDefaults.set(enterpriseModelButton.selectedTag(), forKey: "new.enterpriseModel")
|
2021-07-08 22:50:37 +00:00
|
|
|
standardUserDefaults.set(enterpriseSpeedButton.selectedTag(), forKey: "new.enterpriseSpeed")
|
2021-06-23 01:39:07 +00:00
|
|
|
standardUserDefaults.set(enterpriseEXOSButton.selectedTag(), forKey: "new.enterpriseEXOSVersion")
|
|
|
|
standardUserDefaults.set(enterpriseBASICButton.selectedTag(), forKey: "new.enterpriseBASICVersion")
|
|
|
|
standardUserDefaults.set(enterpriseDOSButton.selectedTag(), forKey: "new.enterpriseDOS")
|
2018-04-04 03:01:12 +00:00
|
|
|
|
2019-09-25 02:48:34 +00:00
|
|
|
// Macintosh settings
|
2021-03-06 23:53:09 +00:00
|
|
|
standardUserDefaults.set(macintoshModelTypeButton.selectedTag(), forKey: "new.macintoshModel")
|
2019-09-25 02:48:34 +00:00
|
|
|
|
2018-04-04 03:01:12 +00:00
|
|
|
// MSX settings
|
2023-03-22 00:05:10 +00:00
|
|
|
standardUserDefaults.set(msxModelButton.selectedTag(), forKey: "new.msxModel")
|
2021-03-06 23:53:09 +00:00
|
|
|
standardUserDefaults.set(msxRegionButton.selectedTag(), forKey: "new.msxRegion")
|
|
|
|
standardUserDefaults.set(msxHasDiskDriveButton.state == .on, forKey: "new.msxDiskDrive")
|
2023-05-14 02:25:50 +00:00
|
|
|
standardUserDefaults.set(msxHasMSXMUSICButton.state == .on, forKey: "new.msxMSXMUSIC")
|
2018-04-04 03:01:12 +00:00
|
|
|
|
|
|
|
// Oric settings
|
2021-03-06 23:53:09 +00:00
|
|
|
standardUserDefaults.set(oricDiskInterfaceButton.selectedTag(), forKey: "new.oricDiskInterface")
|
|
|
|
standardUserDefaults.set(oricModelTypeButton.selectedTag(), forKey: "new.oricModel")
|
2018-04-04 03:01:12 +00:00
|
|
|
|
2023-12-05 21:42:55 +00:00
|
|
|
// PC settings
|
|
|
|
standardUserDefaults.set(pcVideoAdaptorButton.selectedTag(), forKey: "new.pcVideoAdaptor")
|
2023-12-08 19:23:27 +00:00
|
|
|
standardUserDefaults.set(pcSpeedButton.selectedTag(), forKey: "new.pcSpeed")
|
2023-12-05 21:42:55 +00:00
|
|
|
|
2021-03-22 01:50:50 +00:00
|
|
|
// Spectrum settings
|
|
|
|
standardUserDefaults.set(spectrumModelTypeButton.selectedTag(), forKey: "new.spectrumModel")
|
|
|
|
|
2018-04-04 03:01:12 +00:00
|
|
|
// Vic-20 settings
|
2021-03-06 23:53:09 +00:00
|
|
|
standardUserDefaults.set(vic20RegionButton.selectedTag(), forKey: "new.vic20Region")
|
|
|
|
standardUserDefaults.set(vic20MemorySizeButton.selectedTag(), forKey: "new.vic20MemorySize")
|
|
|
|
standardUserDefaults.set(vic20HasC1540Button.state == .on, forKey: "new.vic20C1540")
|
2018-04-04 03:01:12 +00:00
|
|
|
|
|
|
|
// ZX80
|
2021-03-06 23:53:09 +00:00
|
|
|
standardUserDefaults.set(zx80MemorySizeButton.selectedTag(), forKey: "new.zx80MemorySize")
|
|
|
|
standardUserDefaults.set(zx80UsesZX81ROMButton.state == .on, forKey: "new.zx80UsesZX81ROM")
|
2018-04-04 03:01:12 +00:00
|
|
|
|
|
|
|
// ZX81
|
2021-03-06 23:53:09 +00:00
|
|
|
standardUserDefaults.set(zx81MemorySizeButton.selectedTag(), forKey: "new.zx81MemorySize")
|
2018-04-04 03:01:12 +00:00
|
|
|
}
|
|
|
|
|
2021-03-25 20:25:11 +00:00
|
|
|
// MARK: - Table view handling
|
|
|
|
func numberOfRows(in tableView: NSTableView) -> Int {
|
|
|
|
return machineSelector.numberOfTabViewItems
|
|
|
|
}
|
|
|
|
|
|
|
|
func tableView(_ tableView: NSTableView, objectValueFor tableColumn: NSTableColumn?, row: Int) -> Any? {
|
|
|
|
return machineSelector.tabViewItem(at: row).label
|
|
|
|
}
|
|
|
|
|
|
|
|
func tableViewSelectionDidChange(_ notification: Notification) {
|
|
|
|
machineSelector.selectTabViewItem(at: machineNameTable.selectedRow)
|
|
|
|
}
|
|
|
|
|
2021-03-25 20:48:11 +00:00
|
|
|
func tableView(_ tableView: NSTableView, heightOfRow row: Int) -> CGFloat {
|
|
|
|
let font = NSFont.systemFont(ofSize: NSFont.systemFontSize)
|
|
|
|
|
2021-03-25 21:44:46 +00:00
|
|
|
// YUCK. TODO: find a way to use cells with vertically-centred text.
|
2021-03-25 20:48:11 +00:00
|
|
|
// Likely that means not using NSTextFieldCell.
|
2021-03-25 21:44:46 +00:00
|
|
|
return font.ascender - font.descender + 2.5
|
2021-03-25 20:48:11 +00:00
|
|
|
}
|
|
|
|
|
2018-04-03 02:42:41 +00:00
|
|
|
// MARK: - Machine builder
|
|
|
|
func selectedMachine() -> CSStaticAnalyser {
|
2018-04-04 03:01:12 +00:00
|
|
|
storeOptions()
|
|
|
|
|
2021-03-06 23:53:09 +00:00
|
|
|
switch machineSelector.selectedTabViewItem!.identifier as! String {
|
2018-04-03 02:42:41 +00:00
|
|
|
|
2021-08-07 01:58:31 +00:00
|
|
|
case "amiga":
|
2021-12-22 23:20:55 +00:00
|
|
|
return CSStaticAnalyser(amigaModel: .A500, chipMemorySize: Kilobytes(amigaChipRAMButton.selectedTag()), fastMemorySize: Kilobytes(amigaFastRAMButton.selectedTag()))
|
2021-08-07 01:58:31 +00:00
|
|
|
|
2018-04-14 23:46:15 +00:00
|
|
|
case "appleii":
|
2018-05-03 23:37:32 +00:00
|
|
|
var model: CSMachineAppleIIModel = .appleII
|
2021-03-06 23:53:09 +00:00
|
|
|
switch appleIIModelButton.selectedTag() {
|
2018-05-03 23:37:32 +00:00
|
|
|
case 1: model = .appleIIPlus
|
2018-07-25 22:58:34 +00:00
|
|
|
case 2: model = .appleIIe
|
2018-08-11 14:26:30 +00:00
|
|
|
case 3: model = .appleEnhancedIIe
|
2018-05-03 23:37:32 +00:00
|
|
|
case 0: fallthrough
|
|
|
|
default: model = .appleII
|
|
|
|
}
|
|
|
|
|
|
|
|
var diskController: CSMachineAppleIIDiskController = .none
|
2021-03-06 23:53:09 +00:00
|
|
|
switch appleIIDiskControllerButton.selectedTag() {
|
2018-05-03 23:37:32 +00:00
|
|
|
case 13: diskController = .thirteenSector
|
|
|
|
case 16: diskController = .sixteenSector
|
|
|
|
case 0: fallthrough
|
2018-11-24 03:32:32 +00:00
|
|
|
default: diskController = .none
|
2018-05-03 23:37:32 +00:00
|
|
|
}
|
|
|
|
|
2024-02-15 14:10:19 +00:00
|
|
|
return CSStaticAnalyser(appleIIModel: model, diskController: diskController, hasMockingboard: appleIIMockingboardButton.state == .on)
|
2018-04-14 23:46:15 +00:00
|
|
|
|
2020-10-21 02:18:11 +00:00
|
|
|
case "appleiigs":
|
|
|
|
var model: CSMachineAppleIIgsModel = .ROM00
|
2021-03-06 23:53:09 +00:00
|
|
|
switch appleIIgsModelButton.selectedTag() {
|
2020-10-21 02:18:11 +00:00
|
|
|
case 1: model = .ROM01
|
|
|
|
case 2: model = .ROM03
|
|
|
|
case 0: fallthrough
|
|
|
|
default: model = .ROM00
|
|
|
|
}
|
|
|
|
|
2021-07-09 02:38:54 +00:00
|
|
|
let memorySize = Kilobytes(appleIIgsMemorySizeButton.selectedTag())
|
2020-10-21 02:18:11 +00:00
|
|
|
return CSStaticAnalyser(appleIIgsModel: model, memorySize: memorySize)
|
|
|
|
|
2019-12-18 04:04:12 +00:00
|
|
|
case "atarist":
|
2022-08-10 18:58:19 +00:00
|
|
|
let memorySize = Kilobytes(atariSTMemorySizeButton.selectedTag())
|
|
|
|
return CSStaticAnalyser(atariSTModel: .model512k, memorySize: memorySize)
|
2019-12-18 04:04:12 +00:00
|
|
|
|
2018-04-03 02:42:41 +00:00
|
|
|
case "cpc":
|
2021-07-09 02:38:54 +00:00
|
|
|
switch cpcModelTypeButton.selectedTag() {
|
2018-04-03 02:42:41 +00:00
|
|
|
case 464: return CSStaticAnalyser(amstradCPCModel: .model464)
|
|
|
|
case 664: return CSStaticAnalyser(amstradCPCModel: .model664)
|
|
|
|
case 6128: fallthrough
|
|
|
|
default: return CSStaticAnalyser(amstradCPCModel: .model6128)
|
|
|
|
}
|
|
|
|
|
2021-06-15 00:55:39 +00:00
|
|
|
case "electron":
|
|
|
|
return CSStaticAnalyser(
|
|
|
|
electronDFS: electronDFSButton.state == .on,
|
|
|
|
adfs: electronADFSButton.state == .on,
|
|
|
|
ap6: electronAP6Button.state == .on,
|
|
|
|
sidewaysRAM: electronSidewaysRAMButton.state == .on)
|
|
|
|
|
|
|
|
case "enterprise":
|
2021-06-23 01:39:07 +00:00
|
|
|
var model: CSMachineEnterpriseModel = .model128
|
2021-07-09 02:38:54 +00:00
|
|
|
switch enterpriseModelButton.selectedTag() {
|
2021-06-23 01:39:07 +00:00
|
|
|
case 64: model = .model64
|
|
|
|
case 256: model = .model256
|
|
|
|
case 128: fallthrough
|
|
|
|
default: model = .model128
|
|
|
|
}
|
|
|
|
|
2021-07-08 22:50:37 +00:00
|
|
|
var speed: CSMachineEnterpriseSpeed = .speed4MHz
|
2021-07-09 02:38:54 +00:00
|
|
|
switch enterpriseSpeedButton.selectedTag() {
|
2021-07-08 22:50:37 +00:00
|
|
|
case 6: speed = .speed6MHz
|
|
|
|
case 4: fallthrough
|
|
|
|
default: speed = .speed4MHz
|
|
|
|
}
|
|
|
|
|
2021-06-23 01:39:07 +00:00
|
|
|
var exos: CSMachineEnterpriseEXOS = .version21
|
2021-07-09 02:38:54 +00:00
|
|
|
switch enterpriseEXOSButton.selectedTag() {
|
2021-06-23 01:39:07 +00:00
|
|
|
case 10: exos = .version10
|
|
|
|
case 20: exos = .version20
|
|
|
|
case 21: fallthrough
|
|
|
|
default: exos = .version21
|
|
|
|
}
|
|
|
|
|
|
|
|
var basic: CSMachineEnterpriseBASIC = .version21
|
|
|
|
switch enterpriseBASICButton.selectedTag() {
|
|
|
|
case 0: basic = .none
|
|
|
|
case 10: basic = .version10
|
|
|
|
case 11: basic = .version11
|
|
|
|
case 21: fallthrough
|
|
|
|
default: basic = .version21
|
|
|
|
}
|
|
|
|
|
|
|
|
var dos: CSMachineEnterpriseDOS = .dosNone
|
|
|
|
switch enterpriseDOSButton.selectedTag() {
|
|
|
|
case 1: dos = .DOSEXDOS
|
|
|
|
case 0: fallthrough
|
|
|
|
default: dos = .dosNone
|
|
|
|
}
|
|
|
|
|
2021-07-08 22:50:37 +00:00
|
|
|
return CSStaticAnalyser(enterpriseModel: model, speed: speed, exosVersion: exos, basicVersion: basic, dos: dos)
|
2021-06-15 00:55:39 +00:00
|
|
|
|
2019-05-04 02:16:07 +00:00
|
|
|
case "mac":
|
2021-07-09 02:38:54 +00:00
|
|
|
switch macintoshModelTypeButton.selectedTag() {
|
2019-09-25 02:48:34 +00:00
|
|
|
case 0: return CSStaticAnalyser(macintoshModel: .model128k)
|
|
|
|
case 1: return CSStaticAnalyser(macintoshModel: .model512k)
|
|
|
|
case 2: return CSStaticAnalyser(macintoshModel: .model512ke)
|
|
|
|
case 3: fallthrough
|
|
|
|
default: return CSStaticAnalyser(macintoshModel: .modelPlus)
|
|
|
|
}
|
2019-05-04 02:16:07 +00:00
|
|
|
|
2018-04-03 02:42:41 +00:00
|
|
|
case "msx":
|
2021-03-06 23:53:09 +00:00
|
|
|
let hasDiskDrive = msxHasDiskDriveButton.state == .on
|
2023-05-14 02:25:50 +00:00
|
|
|
let hasMSXMUSIC = msxHasMSXMUSICButton.state == .on
|
2023-03-22 00:05:10 +00:00
|
|
|
var region: CSMachineMSXRegion
|
2021-07-09 02:38:54 +00:00
|
|
|
switch msxRegionButton.selectedTag() {
|
2023-03-22 00:05:10 +00:00
|
|
|
case 2: region = .japanese
|
|
|
|
case 1: region = .american
|
|
|
|
case 0: fallthrough
|
|
|
|
default: region = .european
|
|
|
|
}
|
|
|
|
var model: CSMachineMSXModel
|
|
|
|
switch msxModelButton.selectedTag() {
|
|
|
|
case 2: model = .MSX2
|
|
|
|
case 1: fallthrough
|
|
|
|
default: model = .MSX1
|
2019-03-01 01:54:43 +00:00
|
|
|
}
|
2023-05-14 02:25:50 +00:00
|
|
|
return CSStaticAnalyser(msxModel: model, region: region, hasDiskDrive: hasDiskDrive, hasMSXMUSIC: hasMSXMUSIC)
|
2018-04-03 02:42:41 +00:00
|
|
|
|
|
|
|
case "oric":
|
2018-05-09 02:05:43 +00:00
|
|
|
var diskInterface: CSMachineOricDiskInterface = .none
|
2021-03-06 23:53:09 +00:00
|
|
|
switch oricDiskInterfaceButton.selectedTag() {
|
2018-05-09 02:05:43 +00:00
|
|
|
case 1: diskInterface = .microdisc
|
|
|
|
case 2: diskInterface = .pravetz
|
2020-01-06 02:57:33 +00:00
|
|
|
case 3: diskInterface = .jasmin
|
2020-01-16 04:56:56 +00:00
|
|
|
case 4: diskInterface = .BD500
|
2021-03-22 01:50:50 +00:00
|
|
|
default: break
|
2018-05-09 02:05:43 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
var model: CSMachineOricModel = .oric1
|
2021-07-09 02:38:54 +00:00
|
|
|
switch oricModelTypeButton.selectedTag() {
|
2018-05-09 02:05:43 +00:00
|
|
|
case 1: model = .oricAtmos
|
|
|
|
case 2: model = .pravetz
|
2021-03-22 01:50:50 +00:00
|
|
|
default: break
|
2018-04-03 02:42:41 +00:00
|
|
|
}
|
|
|
|
|
2018-05-09 02:05:43 +00:00
|
|
|
return CSStaticAnalyser(oricModel: model, diskInterface: diskInterface)
|
|
|
|
|
2023-11-15 19:27:04 +00:00
|
|
|
case "pc":
|
2023-12-05 21:42:55 +00:00
|
|
|
var videoAdaptor: CSPCCompatibleVideoAdaptor = .MDA
|
|
|
|
switch pcVideoAdaptorButton.selectedTag() {
|
|
|
|
case 1: videoAdaptor = .CGA
|
|
|
|
default: break
|
|
|
|
}
|
2023-12-08 19:23:27 +00:00
|
|
|
var speed: CSPCCompatibleSpeed = .original
|
|
|
|
switch pcSpeedButton.selectedTag() {
|
|
|
|
case 80286: speed = .turbo
|
|
|
|
default: break
|
|
|
|
}
|
|
|
|
return CSStaticAnalyser(pcCompatibleSpeed: speed, videoAdaptor: videoAdaptor)
|
2023-11-15 19:27:04 +00:00
|
|
|
|
2021-03-22 01:50:50 +00:00
|
|
|
case "spectrum":
|
|
|
|
var model: CSMachineSpectrumModel = .plus2a
|
2021-07-09 02:38:54 +00:00
|
|
|
switch spectrumModelTypeButton.selectedTag() {
|
2021-04-15 01:37:10 +00:00
|
|
|
case 16: model = .sixteenK
|
|
|
|
case 48: model = .fortyEightK
|
|
|
|
case 128: model = .oneTwoEightK
|
|
|
|
case 2: model = .plus2
|
2021-03-22 01:50:50 +00:00
|
|
|
case 21: model = .plus2a
|
|
|
|
case 3: model = .plus3
|
|
|
|
default: break
|
|
|
|
}
|
|
|
|
|
|
|
|
return CSStaticAnalyser(spectrumModel: model)
|
|
|
|
|
2018-04-03 02:42:41 +00:00
|
|
|
case "vic20":
|
2021-07-09 02:38:54 +00:00
|
|
|
let memorySize = Kilobytes(vic20MemorySizeButton.selectedTag())
|
2021-03-06 23:53:09 +00:00
|
|
|
let hasC1540 = vic20HasC1540Button.state == .on
|
2021-07-09 02:38:54 +00:00
|
|
|
switch vic20RegionButton.selectedTag() {
|
2018-04-03 02:42:41 +00:00
|
|
|
case 1:
|
|
|
|
return CSStaticAnalyser(vic20Region: .american, memorySize: memorySize, hasC1540: hasC1540)
|
|
|
|
case 2:
|
|
|
|
return CSStaticAnalyser(vic20Region: .danish, memorySize: memorySize, hasC1540: hasC1540)
|
|
|
|
case 3:
|
|
|
|
return CSStaticAnalyser(vic20Region: .swedish, memorySize: memorySize, hasC1540: hasC1540)
|
|
|
|
case 4:
|
|
|
|
return CSStaticAnalyser(vic20Region: .japanese, memorySize: memorySize, hasC1540: hasC1540)
|
|
|
|
case 0: fallthrough
|
|
|
|
default:
|
|
|
|
return CSStaticAnalyser(vic20Region: .european, memorySize: memorySize, hasC1540: hasC1540)
|
|
|
|
}
|
|
|
|
|
|
|
|
case "zx80":
|
2021-07-09 02:38:54 +00:00
|
|
|
return CSStaticAnalyser(zx80MemorySize: Kilobytes(zx80MemorySizeButton.selectedTag()), useZX81ROM: zx80UsesZX81ROMButton.state == .on)
|
2018-04-03 02:42:41 +00:00
|
|
|
|
|
|
|
case "zx81":
|
2021-07-09 02:38:54 +00:00
|
|
|
return CSStaticAnalyser(zx81MemorySize: Kilobytes(zx81MemorySizeButton.selectedTag()))
|
2018-04-03 02:42:41 +00:00
|
|
|
|
|
|
|
default: return CSStaticAnalyser()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|