mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 08:49:37 +00:00
49 lines
2.0 KiB
Swift
49 lines
2.0 KiB
Swift
//
|
|
// Atari2600Document.swift
|
|
// Clock Signal
|
|
//
|
|
// Created by Thomas Harte on 16/07/2015.
|
|
// Copyright © 2015 Thomas Harte. All rights reserved.
|
|
//
|
|
|
|
import Cocoa
|
|
|
|
class Atari2600Document: NSDocument {
|
|
|
|
override init() {
|
|
super.init()
|
|
// Add your subclass-specific initialization here.
|
|
}
|
|
|
|
override func windowControllerDidLoadNib(aController: NSWindowController) {
|
|
super.windowControllerDidLoadNib(aController)
|
|
// Add any code here that needs to be executed once the windowController has loaded the document's window.
|
|
}
|
|
|
|
override class func autosavesInPlace() -> Bool {
|
|
return true
|
|
}
|
|
|
|
override var windowNibName: String? {
|
|
// Returns the nib file name of the document
|
|
// If you need to use a subclass of NSWindowController or if your document supports multiple NSWindowControllers, you should remove this property and override -makeWindowControllers instead.
|
|
return "Atari2600Document"
|
|
}
|
|
|
|
private var atari2600: CSAtari2600? = nil
|
|
override func dataOfType(typeName: String) throws -> NSData {
|
|
// Insert code here to write your document to data of the specified type. If outError != nil, ensure that you create and set an appropriate error when returning nil.
|
|
// You can also choose to override fileWrapperOfType:error:, writeToURL:ofType:error:, or writeToURL:ofType:forSaveOperation:originalContentsURL:error: instead.
|
|
throw NSError(domain: NSOSStatusErrorDomain, code: unimpErr, userInfo: nil)
|
|
}
|
|
|
|
override func readFromData(data: NSData, ofType typeName: String) throws {
|
|
// Insert code here to read your document from the given data of the specified type. If outError != nil, ensure that you create and set an appropriate error when returning false.
|
|
// You can also choose to override readFromFileWrapper:ofType:error: or readFromURL:ofType:error: instead.
|
|
// If you override either of these, you should also override -isEntireFileLoaded to return false if the contents are lazily loaded.
|
|
atari2600 = CSAtari2600()
|
|
atari2600?.setROM(data)
|
|
}
|
|
|
|
|
|
} |