implement 'current article' property of the application

Also, fix the unique-id based accessors (the four byte code  for id was
wrong in the sdef)
Add valueIn<Key>WithUniqueID accessors
Add a few protocols and protocol implementations for the AppDelegate
and MainWindowControllor so as to expose needed functionality for
scriptability
This commit is contained in:
Olof Hellman
2018-02-08 00:11:52 -08:00
parent 2e4217236b
commit 395af1420e
9 changed files with 192 additions and 10 deletions

View File

@@ -385,6 +385,28 @@ extension MainWindowController: NSToolbarDelegate {
}
}
// MARK: - Scripting Access
/*
the ScriptingMainWindowController protocol exposes a narrow set of accessors with
internal visibility which are very similar to some private vars.
These would be unnecessary if the similar accessors were marked internal rather than private,
but for now, we'll keep the stratification of visibility
*/
extension MainWindowController : ScriptingMainWindowController {
internal var scriptingCurrentArticle: Article? {
return self.oneSelectedArticle
}
internal var scriptingSelectedArticles: [Article] {
return self.selectedArticles ?? []
}
}
// MARK: - Private
private extension MainWindowController {