2019-07-26 05:51:36 +00:00
|
|
|
//
|
|
|
|
// AppDelegate.swift
|
|
|
|
// A2Mac
|
|
|
|
//
|
|
|
|
// Created by Tamas Rudnai on 7/25/19.
|
|
|
|
// Copyright © 2019 GameAlloy. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Cocoa
|
|
|
|
|
|
|
|
@NSApplicationMain
|
|
|
|
class AppDelegate: NSObject, NSApplicationDelegate {
|
|
|
|
|
2020-06-06 00:11:22 +00:00
|
|
|
var preferencesController : PreferencesWindowController?
|
2019-07-26 05:51:36 +00:00
|
|
|
|
2020-04-26 07:23:05 +00:00
|
|
|
@IBAction func ROM_Selected(_ sender: NSMenuItem) {
|
|
|
|
if let menuIdentifier = sender.identifier {
|
|
|
|
// rom_loadFile( Bundle.main.resourcePath, menuIdentifier.rawValue + ".rom" )
|
|
|
|
ViewController.romFileName = menuIdentifier.rawValue + ".rom"
|
2020-06-24 22:44:15 +00:00
|
|
|
// print("Resource Path: " + Bundle.main.resourcePath!)
|
|
|
|
m6502_ColdReset( Bundle.main.resourcePath! + "/rom/", ViewController.romFileName )
|
2020-04-26 07:23:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-23 06:16:41 +00:00
|
|
|
@IBAction func Disk1_Selected(_ sender: NSMenuItem) {
|
|
|
|
if let menuIdentifier = sender.identifier {
|
2020-06-24 22:44:15 +00:00
|
|
|
let woz_err = woz_loadFile( Bundle.main.resourcePath! + "/dsk/" + menuIdentifier.rawValue + ".woz" )
|
2020-06-04 18:37:35 +00:00
|
|
|
ViewController.current?.chk_woz_load(err: woz_err)
|
2020-06-26 02:52:23 +00:00
|
|
|
woz_flags.image_file_readonly = 1
|
2020-02-23 06:16:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-26 05:51:36 +00:00
|
|
|
func applicationDidFinishLaunching(_ aNotification: Notification) {
|
|
|
|
// Insert code here to initialize your application
|
|
|
|
}
|
|
|
|
|
|
|
|
func applicationWillTerminate(_ aNotification: Notification) {
|
|
|
|
// Insert code here to tear down your application
|
|
|
|
}
|
2020-06-03 17:23:55 +00:00
|
|
|
|
2020-06-02 17:10:18 +00:00
|
|
|
@IBAction func selectAnImageFromFile(sender: AnyObject) {
|
2020-07-04 17:13:12 +00:00
|
|
|
ViewController.current?.openDiskImageDialog()
|
2020-06-02 17:10:18 +00:00
|
|
|
}
|
2019-07-26 05:51:36 +00:00
|
|
|
|
2020-06-03 17:23:55 +00:00
|
|
|
|
|
|
|
func application(_ sender: NSApplication, openFile filename: String) -> Bool {
|
2020-07-04 17:13:12 +00:00
|
|
|
ViewController.current?.openDiskImage(url: URL(fileURLWithPath: filename))
|
|
|
|
return true;
|
2020-06-03 17:23:55 +00:00
|
|
|
}
|
2020-06-04 18:37:35 +00:00
|
|
|
|
2020-06-25 23:23:20 +00:00
|
|
|
@IBAction func saveFile(_ sender: NSMenuItem) {
|
2020-06-26 02:52:23 +00:00
|
|
|
ViewController.current?.saveFile()
|
|
|
|
}
|
|
|
|
|
|
|
|
@IBAction func saveFileAs(_ sender: NSMenuItem) {
|
|
|
|
ViewController.current?.saveFileAs()
|
2020-06-25 23:23:20 +00:00
|
|
|
}
|
2020-06-06 00:11:22 +00:00
|
|
|
|
|
|
|
@IBAction func showPreferences(_ sender: NSMenuItem) {
|
|
|
|
|
|
|
|
if ( preferencesController == nil ) {
|
|
|
|
let storyboard = NSStoryboard(name: NSStoryboard.Name("Preferences"), bundle: nil)
|
|
|
|
preferencesController = storyboard.instantiateInitialController() as? PreferencesWindowController
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( preferencesController != nil ) {
|
|
|
|
preferencesController?.showWindow(sender)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-26 03:23:08 +00:00
|
|
|
@IBAction func PowerOn(_ sender: Any) {
|
|
|
|
ViewController.current?.PowerOn(sender)
|
|
|
|
}
|
|
|
|
|
|
|
|
@IBAction func Pause(_ sender: Any) {
|
|
|
|
ViewController.current?.Pause(sender)
|
|
|
|
}
|
|
|
|
|
|
|
|
@IBAction func PowerOff(_ sender: Any) {
|
|
|
|
ViewController.current?.PowerOff(sender)
|
|
|
|
}
|
|
|
|
|
|
|
|
@IBAction func ColdReset(_ sender: Any) {
|
|
|
|
ViewController.current?.Reset(sender)
|
|
|
|
}
|
|
|
|
|
|
|
|
@IBAction func WarmReset(_ sender: Any) {
|
|
|
|
ViewController.current?.Reset(sender)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-07-26 05:51:36 +00:00
|
|
|
}
|
|
|
|
|