Save recent boards / programmers, handle early notifications

This commit is contained in:
Matthias Neeracher 2015-07-11 00:48:07 +02:00 committed by Matthias Neeracher
parent b382467226
commit d3a17159ad

View File

@ -91,10 +91,12 @@ class ASProjDoc: NSDocument, NSOutlineViewDelegate, NSMenuDelegate, NSOpenSavePa
var nc = NSNotificationCenter.defaultCenter() var nc = NSNotificationCenter.defaultCenter()
themeObserver = nc.addObserverForName(kBindingsKey, object: nil, queue: nil, usingBlock: { (NSNotification) in themeObserver = nc.addObserverForName(kBindingsKey, object: nil, queue: nil, usingBlock: { (NSNotification) in
self.editor.setKeyboardHandler(keyboardHandler) self.editor?.setKeyboardHandler(keyboardHandler)
}) })
serialObserver = nc.addObserverForName(kASSerialPortsChanged, object: nil, queue: nil, usingBlock: { (NSNotification) in serialObserver = nc.addObserverForName(kASSerialPortsChanged, object: nil, queue: nil, usingBlock: { (NSNotification) in
if self.portTool != nil {
self.rebuildPortMenu() self.rebuildPortMenu()
}
}) })
updateLogTimer = updateLogTimer =
NSTimer.scheduledTimerWithTimeInterval(1.0, target: self, selector: "updateLog:", userInfo: nil, repeats: true) NSTimer.scheduledTimerWithTimeInterval(1.0, target: self, selector: "updateLog:", userInfo: nil, repeats: true)
@ -153,7 +155,9 @@ class ASProjDoc: NSDocument, NSOutlineViewDelegate, NSMenuDelegate, NSOpenSavePa
kFilesKey: files.propertyList(), kFilesKey: files.propertyList(),
kBoardKey: board, kBoardKey: board,
kProgrammerKey: programmer, kProgrammerKey: programmer,
kPortKey: port kPortKey: port,
kRecentBoardsKey: recentBoards,
kRecentProgrammersKey: recentProgrammers
] ]
return NSPropertyListSerialization.dataWithPropertyList(data, format:.XMLFormat_v1_0, options:0, error:nil) return NSPropertyListSerialization.dataWithPropertyList(data, format:.XMLFormat_v1_0, options:0, error:nil)
} }