1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-04 15:05:36 +00:00

Makes first attempt to connect up an in-machine open panel.

This commit is contained in:
Thomas Harte 2018-08-04 22:21:23 -04:00
parent 101fb5d7bf
commit c939a274be
2 changed files with 16 additions and 0 deletions

View File

@ -116,6 +116,11 @@
<action selector="saveScreenshot:" target="-1" id="7ky-xD-tip"/> <action selector="saveScreenshot:" target="-1" id="7ky-xD-tip"/>
</connections> </connections>
</menuItem> </menuItem>
<menuItem title="Insert..." keyEquivalent="O" id="qQa-kh-4nz">
<connections>
<action selector="insertMedia:" target="-1" id="9Hs-9J-dlY"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="rXU-KX-GkZ"/> <menuItem isSeparatorItem="YES" id="rXU-KX-GkZ"/>
<menuItem title="Page Setup…" enabled="NO" keyEquivalent="P" id="qIS-W8-SiK"> <menuItem title="Page Setup…" enabled="NO" keyEquivalent="P" id="qIS-W8-SiK">
<modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/> <modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/>

View File

@ -213,6 +213,7 @@ class MachineDocument:
} }
} }
// MARK: Runtime media insertion.
final func openGLView(_ view: CSOpenGLView, didReceiveFileAt URL: URL) { final func openGLView(_ view: CSOpenGLView, didReceiveFileAt URL: URL) {
let mediaSet = CSMediaSet(fileAt: URL) let mediaSet = CSMediaSet(fileAt: URL)
if let mediaSet = mediaSet { if let mediaSet = mediaSet {
@ -220,6 +221,16 @@ class MachineDocument:
} }
} }
@IBAction final func insertMedia(_ sender: AnyObject!) {
let panel = NSOpenPanel()
self.openGLView.window!.beginSheet(panel) { (response) in
if response == .OK {
Swift.print("An animal")
}
Swift.print("\(response)")
}
}
// MARK: NSDocument overrides // MARK: NSDocument overrides
override func data(ofType typeName: String) throws -> Data { override func data(ofType typeName: String) throws -> Data {
throw NSError(domain: NSOSStatusErrorDomain, code: unimpErr, userInfo: nil) throw NSError(domain: NSOSStatusErrorDomain, code: unimpErr, userInfo: nil)