From bcd047907460cd107d90054286db76489c977459 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 5 Aug 2018 13:12:02 -0400 Subject: [PATCH] This in principle completes the insert action. With the caveat that 'New...' machines seem to have blocked the window's panel queue somehow. --- .../Mac/Clock Signal/Documents/MachineDocument.swift | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/OSBindings/Mac/Clock Signal/Documents/MachineDocument.swift b/OSBindings/Mac/Clock Signal/Documents/MachineDocument.swift index 3979472d6..9b31a9cee 100644 --- a/OSBindings/Mac/Clock Signal/Documents/MachineDocument.swift +++ b/OSBindings/Mac/Clock Signal/Documents/MachineDocument.swift @@ -222,12 +222,16 @@ class MachineDocument: } @IBAction final func insertMedia(_ sender: AnyObject!) { - let panel = NSOpenPanel() - self.openGLView.window!.beginSheet(panel) { (response) in + let openPanel = NSOpenPanel() + openPanel.beginSheetModal(for: self.windowControllers[0].window!) { (response) in if response == .OK { - Swift.print("An animal") + for url in openPanel.urls { + let mediaSet = CSMediaSet(fileAt: url) + if let mediaSet = mediaSet { + mediaSet.apply(to: self.machine) + } + } } - Swift.print("\(response)") } }