From 4e8cebab3796c2101541d9947e5f47c2d613040a Mon Sep 17 00:00:00 2001 From: tudnai Date: Fri, 5 Jun 2020 17:11:22 -0700 Subject: [PATCH] Preferences Dialog Box --- A2Mac.xcodeproj/project.pbxproj | 12 + .../xcdebugger/Expressions.xcexplist | 8 + A2Mac/AppDelegate.swift | 15 + A2Mac/Base.lproj/Main.storyboard | 6 +- A2Mac/Preferences.storyboard | 430 ++++++++++++++++++ A2Mac/PreferencesViewController.swift | 26 ++ A2Mac/PreferencesWindowController.swift | 25 + 7 files changed, 521 insertions(+), 1 deletion(-) create mode 100644 A2Mac/Preferences.storyboard create mode 100644 A2Mac/PreferencesViewController.swift create mode 100644 A2Mac/PreferencesWindowController.swift diff --git a/A2Mac.xcodeproj/project.pbxproj b/A2Mac.xcodeproj/project.pbxproj index 627ce0d..80c01b8 100644 --- a/A2Mac.xcodeproj/project.pbxproj +++ b/A2Mac.xcodeproj/project.pbxproj @@ -10,6 +10,9 @@ 32089E4824556DBD0036E667 /* PRNumber3.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 32089E4724556DBD0036E667 /* PRNumber3.ttf */; }; 32089E4924556DBD0036E667 /* PRNumber3.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 32089E4724556DBD0036E667 /* PRNumber3.ttf */; }; 3213936624079C30007F5C4A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 32BFFB6022EACC660003B53F /* Main.storyboard */; }; + 323D042E248980600086A901 /* Preferences.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 323D042D248980600086A901 /* Preferences.storyboard */; }; + 323D043024898AB70086A901 /* PreferencesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 323D042F24898AB70086A901 /* PreferencesViewController.swift */; }; + 323D04332489BFD80086A901 /* PreferencesWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 323D04312489BFD80086A901 /* PreferencesWindowController.swift */; }; 323E2DCE245531E600156805 /* Apple2e_Enhanced.rom in Resources */ = {isa = PBXBuildFile; fileRef = 323E2DCC245531E500156805 /* Apple2e_Enhanced.rom */; }; 323E2DCF245531E600156805 /* Apple2e_Enhanced.rom in Resources */ = {isa = PBXBuildFile; fileRef = 323E2DCC245531E500156805 /* Apple2e_Enhanced.rom */; }; 323E2DD0245531E600156805 /* Apple2e.rom in Resources */ = {isa = PBXBuildFile; fileRef = 323E2DCD245531E500156805 /* Apple2e.rom */; }; @@ -148,6 +151,9 @@ /* Begin PBXFileReference section */ 32089E4724556DBD0036E667 /* PRNumber3.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = PRNumber3.ttf; sourceTree = ""; }; + 323D042D248980600086A901 /* Preferences.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Preferences.storyboard; sourceTree = ""; }; + 323D042F24898AB70086A901 /* PreferencesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferencesViewController.swift; sourceTree = ""; }; + 323D04312489BFD80086A901 /* PreferencesWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferencesWindowController.swift; sourceTree = ""; }; 323E2DCC245531E500156805 /* Apple2e_Enhanced.rom */ = {isa = PBXFileReference; lastKnownFileType = file; path = Apple2e_Enhanced.rom; sourceTree = ""; }; 323E2DCD245531E500156805 /* Apple2e.rom */ = {isa = PBXFileReference; lastKnownFileType = file; path = Apple2e.rom; sourceTree = ""; }; 32439F7222ECD8AC0077AAE0 /* A2Mac-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "A2Mac-Bridging-Header.h"; sourceTree = ""; }; @@ -550,6 +556,8 @@ 32B18438233FAB3900DBB4AB /* verticies.swift */, 32BFFB5A22EACC630003B53F /* AppDelegate.swift */, 32BFFB5C22EACC630003B53F /* ViewController.swift */, + 323D042F24898AB70086A901 /* PreferencesViewController.swift */, + 323D04312489BFD80086A901 /* PreferencesWindowController.swift */, 32B18435233F10BC00DBB4AB /* Shaders.metal */, 32C4532D233345420000EBA1 /* MonitorView.swift */, 32C453072331C0910000EBA1 /* NSLayoutManager-Extension.swift */, @@ -558,6 +566,7 @@ 32EDB7A123272CA80073AF2D /* fail1.txt */, 32BFFB5E22EACC660003B53F /* Assets.xcassets */, 32BFFB6022EACC660003B53F /* Main.storyboard */, + 323D042D248980600086A901 /* Preferences.storyboard */, 32BFFB6322EACC660003B53F /* Info.plist */, 32BFFB6422EACC660003B53F /* A2Mac.entitlements */, 32439F7222ECD8AC0077AAE0 /* A2Mac-Bridging-Header.h */, @@ -876,6 +885,7 @@ 323E2DCE245531E600156805 /* Apple2e_Enhanced.rom in Resources */, 32440B7D247CB649000F9DA1 /* Merlin Macroassembler Side 1 (SDS, 1983).woz in Resources */, 325EB68623FC707A00C6B4A4 /* Apple DOS 3.3 January 1983.woz in Resources */, + 323D042E248980600086A901 /* Preferences.storyboard in Resources */, 325EB6A32401118300C6B4A4 /* Qbit.woz in Resources */, 32440BA1247F9F99000F9DA1 /* LOCKSMITH_V7_REV_B.woz in Resources */, 32439F8822ECD8AD0077AAE0 /* apple.rom in Resources */, @@ -967,8 +977,10 @@ 32440BA32480D5C0000F9DA1 /* LoRes.swift in Sources */, 32440B84247E27D3000F9DA1 /* 6502.c in Sources */, 325EB62F23F8856F00C6B4A4 /* woz.c in Sources */, + 323D04332489BFD80086A901 /* PreferencesWindowController.swift in Sources */, 32BFFB5B22EACC630003B53F /* AppDelegate.swift in Sources */, 32C45306232E3EEF0000EBA1 /* RepeatingTimer.swift in Sources */, + 323D043024898AB70086A901 /* PreferencesViewController.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/A2Mac.xcodeproj/project.xcworkspace/xcuserdata/trudnai.xcuserdatad/xcdebugger/Expressions.xcexplist b/A2Mac.xcodeproj/project.xcworkspace/xcuserdata/trudnai.xcuserdatad/xcdebugger/Expressions.xcexplist index ce9a148..bc11d7e 100644 --- a/A2Mac.xcodeproj/project.xcworkspace/xcuserdata/trudnai.xcuserdatad/xcdebugger/Expressions.xcexplist +++ b/A2Mac.xcodeproj/project.xcworkspace/xcuserdata/trudnai.xcuserdatad/xcdebugger/Expressions.xcexplist @@ -652,6 +652,14 @@ + + + + + + diff --git a/A2Mac/AppDelegate.swift b/A2Mac/AppDelegate.swift index 09a832f..614898e 100644 --- a/A2Mac/AppDelegate.swift +++ b/A2Mac/AppDelegate.swift @@ -11,6 +11,7 @@ import Cocoa @NSApplicationMain class AppDelegate: NSObject, NSApplicationDelegate { + var preferencesController : PreferencesWindowController? @IBAction func ROM_Selected(_ sender: NSMenuItem) { if let menuIdentifier = sender.identifier { @@ -46,5 +47,19 @@ class AppDelegate: NSObject, NSApplicationDelegate { return woz_err == 0; } + + @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) + } + + } + } diff --git a/A2Mac/Base.lproj/Main.storyboard b/A2Mac/Base.lproj/Main.storyboard index 041b736..6d444b5 100644 --- a/A2Mac/Base.lproj/Main.storyboard +++ b/A2Mac/Base.lproj/Main.storyboard @@ -23,7 +23,11 @@ - + + + + + diff --git a/A2Mac/Preferences.storyboard b/A2Mac/Preferences.storyboard new file mode 100644 index 0000000..eaf3d2e --- /dev/null +++ b/A2Mac/Preferences.storyboard @@ -0,0 +1,430 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + adasd +asdasd +asdasd kjhkj hskdj skdh kahs dkh a +asdasdadasd +asdasd +asdasd kjhkj hskdj skdh kahs dkh a +asdasd +adasd +asdasd +asdasd kjhkj hskdj skdh kahs dkh a +asdasd +adasd +asdasd +asdasd kjhkj hskdj skdh kahs dkh a +asdasd +adasd +asdasd +asdasd kjhkj hskdj skdh kahs dkh a +asdasd +adasd +asdasd +asdasd kjhkj hskdj skdh kahs dkh a +asdasd +adasd +asdasd +asdasd kjhkj hskdj skdh kahs dkh a +asdasd +adasd +asdasd +asdasd kjhkj hskdj skdh kahs dkh a +asdasd +adasd +asdasd +asdasd kjhkj hskdj skdh kahs dkh a +asdasd +adasd +asdasd +asdasd kjhkj hskdj skdh kahs dkh a +asdasd +adasd +asdasd +asdasd kjhkj hskdj skdh kahs dkh a +asdasd + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/A2Mac/PreferencesViewController.swift b/A2Mac/PreferencesViewController.swift new file mode 100644 index 0000000..ca1d6e8 --- /dev/null +++ b/A2Mac/PreferencesViewController.swift @@ -0,0 +1,26 @@ +// +// PreferencesViewController.swift +// A2Mac +// +// Created by Tamas Rudnai on 6/4/20. +// Copyright © 2020 GameAlloy. All rights reserved. +// + +import Cocoa + +class PreferencesViewController: NSViewController { + + override func viewDidLoad() { + super.viewDidLoad() + + self.preferredContentSize = NSMakeSize(self.view.frame.size.width, self.view.frame.size.height) + } + + + override func viewDidAppear() { + super.viewDidAppear() + +// // Update window title with the active TableView Title +// self.parent?.view.window?.title = self.title! + } +} diff --git a/A2Mac/PreferencesWindowController.swift b/A2Mac/PreferencesWindowController.swift new file mode 100644 index 0000000..881ea6f --- /dev/null +++ b/A2Mac/PreferencesWindowController.swift @@ -0,0 +1,25 @@ +// +// PreferencesWindowController.swift +// A2Mac +// +// Created by Tamas Rudnai on 6/4/20. +// Copyright © 2020 GameAlloy. All rights reserved. +// + +import Cocoa + +class PreferencesWindowController: NSWindowController, NSWindowDelegate { + + override func windowDidLoad() { + super.windowDidLoad() + + // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file. + } + + func windowShouldClose(_ sender: NSWindow) -> Bool { + // Hide window instead of closing + self.window?.orderOut(sender) + return false + } + +}