1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-23 03:32:32 +00:00

Adds a workaround to display the ROM import banner even from File -> Open... .

This commit is contained in:
Thomas Harte 2019-07-30 13:07:33 -04:00
parent bba34b28b8
commit c41cccd9a6

View File

@ -56,7 +56,16 @@ class MachineDocument:
override func windowControllerDidLoadNib(_ aController: NSWindowController) {
super.windowControllerDidLoadNib(aController)
aController.window?.contentAspectRatio = self.aspectRatio()
setupMachineOutput()
if self.machine != nil {
setupMachineOutput()
} else {
// This is somewhat of a desperate workaround; just having loaded the Nib doesn't
// mean that the window is visible yet, but presenting the ROM import sheet before
// the window is visible will result in it being free floating.
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + .milliseconds(500)) {
self.configureAs(self.selectedMachine!)
}
}
}
// Attempting to show a sheet before the window is visible (such as when the NIB is loaded) results in
@ -340,6 +349,11 @@ class MachineDocument:
@IBOutlet var romReceiverView: CSROMReceiverView?
private var romRequestBaseText = ""
func requestRoms() {
// Don't act yet if there's no window controller yet.
if self.windowControllers.count == 0 {
return
}
// Load the ROM requester dialogue.
Bundle.main.loadNibNamed("ROMRequester", owner: self, topLevelObjects: nil)
self.romReceiverView!.delegate = self