Sync source edition with VCC Plus 3.7.0 build 63
This commit is contained in:
1 parent
c652a5276d
commit
b2ecec4d87
86 files changed
+10519
-472
No files matched your search
@@ -54,7 +54,7 @@ final class ApplicationDelegate: NSObject, NSApplicationDelegate, ObservableObje
|
||||
basicExamples[id] = workspace
|
||||
return workspace
|
||||
}
|
||||
lazy var softwareLibrary = SoftwareLibraryModel(state: SoftwareLibraryState(directory: profileStore.directory.deletingLastPathComponent().appendingPathComponent("SoftwareLibrary")), artworkDirectory: profileStore.directory.deletingLastPathComponent().appendingPathComponent("SoftwareLibrary/ArtworkCache"), machine: machine,
|
||||
lazy var softwareLibrary = SoftwareLibraryModel(state: SoftwareLibraryState(directory: profileStore.directory.deletingLastPathComponent().appendingPathComponent("SoftwareLibrary")), continuity: LibraryContinuityStore.shared, artworkDirectory: profileStore.directory.deletingLastPathComponent().appendingPathComponent("SoftwareLibrary/ArtworkCache"), machine: machine,
|
||||
sourceWorkspaceIdentity: { [weak self] in self?.development.assistantProjectID ?? UUID() },
|
||||
openSourceProject: { [weak self] directory, identity, configuration in
|
||||
guard let self else { return false }
|
||||
@@ -121,6 +121,7 @@ final class ApplicationDelegate: NSObject, NSApplicationDelegate, ObservableObje
|
||||
#endif
|
||||
}
|
||||
super.init()
|
||||
LibraryContinuityStore.configureShared(directory: profileStore.directory.deletingLastPathComponent())
|
||||
}
|
||||
func applicationDidFinishLaunching(_ notification: Notification) {
|
||||
#if VCC_UI_TESTING
|
||||
@@ -239,6 +240,33 @@ final class ApplicationDelegate: NSObject, NSApplicationDelegate, ObservableObje
|
||||
}
|
||||
private var terminationPending = false
|
||||
func applicationShouldTerminate(_ sender: NSApplication) -> NSApplication.TerminateReply {
|
||||
if machine.captures.saving {
|
||||
let alert = NSAlert(); alert.messageText = "Wait for the CoCo image to finish saving."
|
||||
alert.informativeText = "Your captured picture is still being written. Try quitting again after saving completes."
|
||||
alert.runModal()
|
||||
return .terminateCancel
|
||||
}
|
||||
if machine.captures.hasPendingImage {
|
||||
let alert = NSAlert(); alert.messageText = "A captured CoCo image has not been saved."
|
||||
alert.addButton(withTitle: "Cancel Quit"); alert.addButton(withTitle: "Save Image As…"); alert.addButton(withTitle: "Discard Image and Continue")
|
||||
let choice = alert.runModal()
|
||||
if choice == .alertSecondButtonReturn { machine.captures.saveImageAs(); return .terminateCancel }
|
||||
guard choice == .alertThirdButtonReturn else { return .terminateCancel }
|
||||
machine.captures.discardImage()
|
||||
}
|
||||
if machine.captures.active {
|
||||
guard machine.captures.recording, !terminationPending else { return .terminateCancel }
|
||||
let alert = NSAlert(); alert.messageText = "Stop and save the CoCo movie before quitting?"
|
||||
alert.addButton(withTitle: "Cancel Quit"); alert.addButton(withTitle: "Stop and Save")
|
||||
guard alert.runModal() == .alertSecondButtonReturn else { return .terminateCancel }
|
||||
terminationPending = true
|
||||
Task { @MainActor in
|
||||
await machine.captures.stopRecording()
|
||||
terminationPending = false
|
||||
if machine.captures.error == nil { sender.terminate(nil) }
|
||||
}
|
||||
return .terminateCancel
|
||||
}
|
||||
if companionLaunchDeferred {
|
||||
guard !terminationPending else { return .terminateCancel }
|
||||
terminationPending = true
|
||||
@@ -392,6 +420,7 @@ struct MachineCommands: Commands {
|
||||
@FocusedValue(\.emulatorWindow) private var emulatorWindow
|
||||
let machine: MachineModel
|
||||
@ObservedObject private var menu: MachineMenuState
|
||||
@ObservedObject private var captureMenu: CoCoCaptureMenuState
|
||||
@ObservedObject var presentation: PresentationSettings
|
||||
let connectAssistant: () -> Void
|
||||
init(machine: MachineModel, presentation: PresentationSettings, connectAssistant: @escaping () -> Void) {
|
||||
@@ -399,6 +428,7 @@ struct MachineCommands: Commands {
|
||||
self.presentation = presentation
|
||||
self.machine = machine
|
||||
self.menu = machine.menuState
|
||||
self.captureMenu = machine.captures.menuState
|
||||
}
|
||||
@Environment(\.openWindow) private var openWindow
|
||||
@CommandsBuilder
|
||||
@@ -414,6 +444,9 @@ struct MachineCommands: Commands {
|
||||
Button("Assembly Quick Reference…") { openWindow(id: "assembly-reference") }
|
||||
Button("Keyboard & Shortcuts…") { openWindow(id: "keyboard-help") }
|
||||
Button("Release History…") { openWindow(id: "release-history") }
|
||||
Button("Feedback…") {
|
||||
NSWorkspace.shared.open(URL(string: "https://vccplus.brianholman.com/feedback/?product=vcc-plus")!)
|
||||
}
|
||||
Button("Licenses & Notices…") { openWindow(id: "credits") }
|
||||
Button("About VCC Plus OSS") { openWindow(id: "about") }
|
||||
}
|
||||
@@ -479,6 +512,16 @@ struct MachineCommands: Commands {
|
||||
Button("Save CoCo Screen…", action: machine.saveScreenshot)
|
||||
.keyboardShortcut("s", modifiers: [.command, .shift])
|
||||
.disabled(menu.values.busy || !(menu.values.state == .running || menu.values.state == .paused))
|
||||
Menu("Quick CoCo Capture") {
|
||||
Button("Capture CoCo Screen", action: machine.captures.capture)
|
||||
CoCoCaptureOptions(preferences: machine.captures.preferences)
|
||||
Button("Cancel Timed Capture", action: machine.captures.cancelCountdown).disabled(!captureMenu.countdown)
|
||||
}.disabled(!(menu.values.state == .running || menu.values.state == .paused))
|
||||
Button(captureMenu.state == .recording ? "Stop CoCo Video Recording" : "Record CoCo Video") {
|
||||
if machine.captures.recording { Task { await machine.captures.stopRecording() } }
|
||||
else { machine.captures.startRecording() }
|
||||
}.disabled(captureMenu.state == .starting || captureMenu.state == .finishing || (captureMenu.state != .recording && !(menu.values.state == .running || menu.values.state == .paused)))
|
||||
Button("Capture Settings…") { openWindow(id: "machine"); machine.captures.settingsShown = true }
|
||||
}
|
||||
CommandGroup(after: .pasteboard) {
|
||||
Divider()
|
||||
|
||||
Reference in new issue
Block a user