AVRSack/AVRsack/ASProjDoc.swift

55 lines
2.3 KiB
Swift
Raw Normal View History

2014-11-15 03:39:10 +00:00
//
2014-11-15 22:47:46 +00:00
// ASProjDoc.swift
2014-11-15 03:39:10 +00:00
// AVRsack
//
// Created by Matthias Neeracher on 11/15/14.
// Copyright (c) 2014 Aere Perennius. All rights reserved.
//
import Cocoa
2014-11-15 22:47:46 +00:00
class ASProjDoc: NSDocument {
@IBOutlet weak var editor : ACEView!
@IBOutlet weak var outline: NSOutlineView!
2014-11-15 03:39:10 +00:00
override init() {
super.init()
// Add your subclass-specific initialization here.
}
override func windowControllerDidLoadNib(aController: NSWindowController) {
super.windowControllerDidLoadNib(aController)
2014-11-15 22:47:46 +00:00
editor.setString("Here we go!")
editor.setMode(UInt(ACEModeASCIIDoc))
editor.setTheme(UInt(ACEThemeXcode))
2014-11-15 03:39:10 +00:00
}
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.
2014-11-15 22:47:46 +00:00
return "ASProjDoc"
2014-11-15 03:39:10 +00:00
}
override func dataOfType(typeName: String, error outError: NSErrorPointer) -> 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.
outError.memory = NSError(domain: NSOSStatusErrorDomain, code: unimpErr, userInfo: nil)
return nil
}
override func readFromData(data: NSData, ofType typeName: String, error outError: NSErrorPointer) -> Bool {
// 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 NO if the contents are lazily loaded.
outError.memory = NSError(domain: NSOSStatusErrorDomain, code: unimpErr, userInfo: nil)
return false
}
}