mirror of
https://github.com/trudnai/Steve2.git
synced 2024-06-01 07:41:49 +00:00
DebuggerWindowController
This commit is contained in:
parent
08834ee59d
commit
d6323ee902
|
@ -219,6 +219,9 @@
|
|||
32C6995327C5439300D0F25D /* Debugger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C6995127C5439300D0F25D /* Debugger.swift */; };
|
||||
32C6995D27C548C800D0F25D /* Shaders.metal in Sources */ = {isa = PBXBuildFile; fileRef = 32B18435233F10BC00DBB4AB /* Shaders.metal */; };
|
||||
32C6996727C548C900D0F25D /* Shaders.metal in Sources */ = {isa = PBXBuildFile; fileRef = 32B18435233F10BC00DBB4AB /* Shaders.metal */; };
|
||||
32C8233A2908822E0018438F /* DebuggerWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C823392908822E0018438F /* DebuggerWindowController.swift */; };
|
||||
32C82356290888C50018438F /* DebuggerWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C823392908822E0018438F /* DebuggerWindowController.swift */; };
|
||||
32C82360290888D10018438F /* CheatMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32100A8A2875387300D894EE /* CheatMenu.swift */; };
|
||||
32E3126624A7193700E61891 /* disk_ii_arm.sfx in Resources */ = {isa = PBXBuildFile; fileRef = 32E3126424A7193700E61891 /* disk_ii_arm.sfx */; };
|
||||
32E3126724A7194900E61891 /* disk_ii_arm.sfx in Copy SFX Files */ = {isa = PBXBuildFile; fileRef = 32E3126424A7193700E61891 /* disk_ii_arm.sfx */; };
|
||||
32E3126924A98B9300E61891 /* dsk2woz.c in Sources */ = {isa = PBXBuildFile; fileRef = 32E3126824A98B9300E61891 /* dsk2woz.c */; };
|
||||
|
@ -730,6 +733,7 @@
|
|||
32C4532C2331FEDA0000EBA1 /* A2Mac copy2-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "A2Mac copy2-Info.plist"; path = "/Users/trudnai/Projects/A2Mac/A2Mac copy2-Info.plist"; sourceTree = "<absolute>"; };
|
||||
32C4532D233345420000EBA1 /* MonitorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MonitorView.swift; sourceTree = "<group>"; };
|
||||
32C6995127C5439300D0F25D /* Debugger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Debugger.swift; sourceTree = "<group>"; };
|
||||
32C823392908822E0018438F /* DebuggerWindowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DebuggerWindowController.swift; sourceTree = "<group>"; };
|
||||
32DBF7632334657900DD50E7 /* HiRes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HiRes.swift; sourceTree = "<group>"; };
|
||||
32DBF76723373FB400DD50E7 /* disassembler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = disassembler.h; sourceTree = "<group>"; };
|
||||
32E21BE62491BF8B006C0C72 /* apple-rainbow.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "apple-rainbow.png"; sourceTree = "<group>"; };
|
||||
|
@ -1174,6 +1178,7 @@
|
|||
32BFFB6422EACC660003B53F /* A2Mac.entitlements */,
|
||||
32439F7222ECD8AC0077AAE0 /* A2Mac-Bridging-Header.h */,
|
||||
32E3126C24AC033A00E61891 /* ToolBarController.swift */,
|
||||
32C823392908822E0018438F /* DebuggerWindowController.swift */,
|
||||
3267641724BCC9A5000BEA11 /* COPYING */,
|
||||
3277D7A2273C603600749544 /* DisplayScrollView.swift */,
|
||||
3268B96F27DBD219003FBDCC /* convert_spkr_buf_to_wav.py */,
|
||||
|
@ -1620,6 +1625,7 @@
|
|||
files = (
|
||||
32799F7A264B1A5700255669 /* DisplayView.swift in Sources */,
|
||||
32799F7B264B1A5700255669 /* AppDelegate.swift in Sources */,
|
||||
32C82356290888C50018438F /* DebuggerWindowController.swift in Sources */,
|
||||
32799F7C264B1A5700255669 /* ToolBarController.swift in Sources */,
|
||||
32799F7D264B1A5700255669 /* PreferencesViewController.swift in Sources */,
|
||||
32BCCCFC2650D275002151C5 /* 6502.c in Sources */,
|
||||
|
@ -1627,6 +1633,7 @@
|
|||
32799F80264B1A5700255669 /* dsk2woz.c in Sources */,
|
||||
32799F81264B1A5700255669 /* disk.c in Sources */,
|
||||
3268B97B27DE7D6B003FBDCC /* disassembler.c in Sources */,
|
||||
32C82360290888D10018438F /* CheatMenu.swift in Sources */,
|
||||
32100AB52877AB8600D894EE /* scsi.c in Sources */,
|
||||
32C6996727C548C900D0F25D /* Shaders.metal in Sources */,
|
||||
32799F82264B1A5700255669 /* woz.c in Sources */,
|
||||
|
@ -1676,6 +1683,7 @@
|
|||
327B75D729064FDC00A86A71 /* DebuggerViewController.swift in Sources */,
|
||||
32C4532E233345430000EBA1 /* MonitorView.swift in Sources */,
|
||||
3277D7A3273C603600749544 /* DisplayScrollView.swift in Sources */,
|
||||
32C8233A2908822E0018438F /* DebuggerWindowController.swift in Sources */,
|
||||
32A6AB1B266B19680023257A /* hires.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
335
A2Mac/DebuggerWindowController.swift
Normal file
335
A2Mac/DebuggerWindowController.swift
Normal file
|
@ -0,0 +1,335 @@
|
|||
//
|
||||
// ToolBarController.swift
|
||||
// Steve ][
|
||||
//
|
||||
// Created by Tamas Rudnai on 6/30/20.
|
||||
// Copyright © 2019, 2020 Tamas Rudnai. All rights reserved.
|
||||
//
|
||||
// This file is part of Steve ][ -- The Apple ][ Emulator.
|
||||
//
|
||||
// Steve ][ is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Steve ][ is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Steve ][. If not, see <https://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
import Cocoa
|
||||
|
||||
|
||||
class DebuggerToolBarController: NSWindowController, NSWindowDelegate {
|
||||
|
||||
static var current : DebuggerToolBarController? = nil
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
super.init(coder: coder)
|
||||
DebuggerToolBarController.current = self
|
||||
}
|
||||
|
||||
func window(_ window: NSWindow, willUseFullScreenPresentationOptions proposedOptions: NSApplication.PresentationOptions = []) -> NSApplication.PresentationOptions {
|
||||
return [.autoHideToolbar, .autoHideMenuBar, .fullScreen]
|
||||
}
|
||||
|
||||
var sideBarWidth = CGFloat()
|
||||
|
||||
func setDisplaySize(
|
||||
leading: CGFloat,
|
||||
trailing: CGFloat,
|
||||
top: CGFloat,
|
||||
bottom: CGFloat,
|
||||
sidePanelSize: CGFloat,
|
||||
sidePanelHidden: Bool
|
||||
) {
|
||||
if let view = window?.contentView {
|
||||
for constraint in view.constraints {
|
||||
switch constraint.identifier {
|
||||
case "Display Background Trailing":
|
||||
constraint.constant = sidePanelSize
|
||||
case "Display Margin Leading":
|
||||
constraint.constant = leading
|
||||
case "Display Margin Trailing":
|
||||
constraint.constant = trailing
|
||||
case "Display Margin Top":
|
||||
constraint.constant = top
|
||||
case "Display Margin Bottom":
|
||||
constraint.constant = bottom
|
||||
default:
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
for subview in view.subviews {
|
||||
if subview.identifier?.rawValue == "Side Panel" {
|
||||
subview.isHidden = sidePanelHidden
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func setDisplayFullscreen() {
|
||||
print("setDisplayFullscreen")
|
||||
setDisplaySize(
|
||||
leading: 0,
|
||||
trailing: 0,
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
sidePanelSize: 0,
|
||||
sidePanelHidden: true
|
||||
)
|
||||
}
|
||||
|
||||
func setDisplayWindowed() {
|
||||
print("setDisplayWindowed")
|
||||
setDisplaySize(
|
||||
leading: 11,
|
||||
trailing: -11,
|
||||
top: 16,
|
||||
bottom: -16,
|
||||
sidePanelSize: 136,
|
||||
sidePanelHidden: false
|
||||
)
|
||||
}
|
||||
|
||||
func windowWillEnterFullScreen(_ notification: Notification) {
|
||||
setDisplayFullscreen()
|
||||
}
|
||||
|
||||
func windowWillExitFullScreen(_ notification: Notification) {
|
||||
setDisplayWindowed()
|
||||
}
|
||||
|
||||
|
||||
override func windowDidLoad() {
|
||||
let isWindowFullscreen = window?.styleMask.contains(.fullSizeContentView) ?? false
|
||||
if isWindowFullscreen {
|
||||
window?.toggleFullScreen(self)
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func Continue(_ sender: Any) {
|
||||
switch cpuState {
|
||||
case cpuState_inited, cpuState_unknown:
|
||||
ViewController.current?.PowerOn(sender)
|
||||
|
||||
default:
|
||||
ViewController.current?.PowerOff(sender)
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func Step_Over(_ sender: Any) {
|
||||
switch cpuState {
|
||||
case cpuState_halted:
|
||||
ViewController.current?.Pause(sender)
|
||||
|
||||
case cpuState_running:
|
||||
ViewController.current?.Pause(sender)
|
||||
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@IBAction func Reset(_ sender: Any) {
|
||||
ViewController.current?.Reset(sender)
|
||||
}
|
||||
|
||||
@IBAction func SelectAll(_ sender: Any) {
|
||||
// ViewController.current?.displayField.currentEditor()?.selectAll(nil)
|
||||
// ViewController.current?.displayField.selectText(nil)
|
||||
ViewController.current?.textDisplay.setSelectedRange(NSRange())
|
||||
}
|
||||
|
||||
@IBAction func SetBreakPoint(_ sender: Any) {
|
||||
ViewController.current?.Copy()
|
||||
}
|
||||
|
||||
@IBAction func DisableBreakPoint(_ sender: Any) {
|
||||
ViewController.current?.Paste()
|
||||
}
|
||||
|
||||
@IBAction func Green(_ sender: Any) {
|
||||
// print("NSToolbarItem:", sender.tag)
|
||||
ViewController.current?.MonoMonitorChange(color: "Green")
|
||||
}
|
||||
|
||||
@IBAction func Amber(_ sender: Any) {
|
||||
// print("NSToolbarItem:", sender.tag)
|
||||
ViewController.current?.MonoMonitorChange(color: "Amber")
|
||||
}
|
||||
|
||||
@IBAction func White(_ sender: Any) {
|
||||
// print("NSToolbarItem:", sender.tag)
|
||||
ViewController.current?.MonoMonitorChange(color: "White")
|
||||
}
|
||||
|
||||
@IBAction func Color(_ sender: Any) {
|
||||
ViewController.current?.ColorMonitorSelector(color: true)
|
||||
}
|
||||
|
||||
@IBOutlet weak var SpeedSelector: NSToolbarItem!
|
||||
|
||||
@IBAction func SpeedSelected(_ slider: NSSliderCell) {
|
||||
switch slider.intValue {
|
||||
case 1:
|
||||
ViewController.current?.setCPUClockSpeed(freq: 0.25)
|
||||
SpeedSelector.label = "0.25 MHz"
|
||||
|
||||
case 2:
|
||||
ViewController.current?.setCPUClockSpeed(freq: 0.5)
|
||||
SpeedSelector.label = "0.5 MHz"
|
||||
|
||||
case 4:
|
||||
ViewController.current?.setCPUClockSpeed(freq: 1.5)
|
||||
SpeedSelector.label = "1.5 MHz"
|
||||
|
||||
case 5:
|
||||
ViewController.current?.setCPUClockSpeed(freq: 2)
|
||||
SpeedSelector.label = "2 MHz"
|
||||
|
||||
case 6:
|
||||
ViewController.current?.setCPUClockSpeed(freq: 2.8)
|
||||
SpeedSelector.label = "2.8 MHz"
|
||||
|
||||
case 7:
|
||||
ViewController.current?.setCPUClockSpeed(freq: 4)
|
||||
SpeedSelector.label = "4 MHz"
|
||||
|
||||
case 8:
|
||||
ViewController.current?.setCPUClockSpeed(freq: 10)
|
||||
SpeedSelector.label = "10 MHz"
|
||||
|
||||
case 9:
|
||||
ViewController.current?.setCPUClockSpeed(freq: 100)
|
||||
SpeedSelector.label = "100 MHz"
|
||||
|
||||
case 10:
|
||||
ViewController.current?.setCPUClockSpeed(freq: 2000)
|
||||
SpeedSelector.label = "MAX Speed"
|
||||
|
||||
default:
|
||||
ViewController.current?.setCPUClockSpeed(freq: 14.31818 / 14.0)
|
||||
SpeedSelector.label = "1.023 MHz"
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func Mute(_ sender: Any) {
|
||||
spkr_mute()
|
||||
}
|
||||
|
||||
@IBAction func VolDn(_ sender: Any) {
|
||||
spkr_vol_dn()
|
||||
}
|
||||
|
||||
@IBAction func VolUp(_ sender: Any) {
|
||||
spkr_vol_up()
|
||||
}
|
||||
|
||||
|
||||
@IBAction func GamePort(_ sender: NSPopUpButton) {
|
||||
switch sender.selectedItem?.tag {
|
||||
case 1: // "Keyboard -> Joystick"
|
||||
if let state = ViewController.current?.Keyboard2Joystick {
|
||||
ViewController.current?.Keyboard2Joystick = !state
|
||||
sender.selectedItem?.state = state ? .off : .on
|
||||
}
|
||||
break
|
||||
|
||||
case 2: // "Mouse -> Joystick"
|
||||
if let state = ViewController.current?.Mouse2Joystick {
|
||||
ViewController.current?.Mouse2Joystick = !state
|
||||
sender.selectedItem?.state = state ? .off : .on
|
||||
|
||||
ViewController.current?.mouseCursor(hide: !state)
|
||||
}
|
||||
break
|
||||
|
||||
case 3: // "Mouse Enabled"
|
||||
if let state = ViewController.current?.MouseInterface {
|
||||
ViewController.current?.MouseInterface = !state
|
||||
sender.selectedItem?.state = state ? .off : .on
|
||||
}
|
||||
break
|
||||
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@IBOutlet weak var MouseToJoystickMenuItem: NSMenuItem!
|
||||
|
||||
@IBAction func DiskOptions(_ sender: NSPopUpButton) {
|
||||
switch sender.selectedItem?.tag {
|
||||
case 1: // "Quick Disk"
|
||||
if diskAccelerator_enabled == 0 {
|
||||
diskAccelerator_enabled = 1;
|
||||
}
|
||||
else {
|
||||
diskAccelerator_enabled = 0;
|
||||
}
|
||||
|
||||
sender.selectedItem?.state = diskAccelerator_enabled == 1 ? .on : .off
|
||||
break
|
||||
|
||||
case 2: // "Disk Sound"
|
||||
if disk_sfx_enabled == 0 {
|
||||
disk_sfx_enabled = 1;
|
||||
}
|
||||
else {
|
||||
disk_sfx_enabled = 0;
|
||||
}
|
||||
|
||||
sender.selectedItem?.state = disk_sfx_enabled == 1 ? .on : .off
|
||||
break
|
||||
|
||||
case 3: // "Write Enabled"
|
||||
break
|
||||
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func CPUMode(_ sender: NSPopUpButton) {
|
||||
switch sender.selectedItem?.tag {
|
||||
case 1: // "Normal Mode"
|
||||
ViewController.current?.setSimulationMode( mode: "Normal" )
|
||||
for i in sender.itemArray {
|
||||
i.state = .off
|
||||
}
|
||||
sender.selectedItem?.state = .on
|
||||
break
|
||||
|
||||
case 2: // "Eco Mode"
|
||||
ViewController.current?.setSimulationMode( mode: "Eco" )
|
||||
for i in sender.itemArray {
|
||||
i.state = .off
|
||||
}
|
||||
sender.selectedItem?.state = .on
|
||||
break
|
||||
|
||||
case 3: // "Write Enabled"
|
||||
ViewController.current?.setSimulationMode( mode: "Game" )
|
||||
for i in sender.itemArray {
|
||||
i.state = .off
|
||||
}
|
||||
sender.selectedItem?.state = .on
|
||||
break
|
||||
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func CRTModeOnOff(_ sender: NSButton) {
|
||||
ViewController.current?.CRTMonitorOnOff(sender)
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user