Exercises
Some of the functions that we implement in the PrefController class are provided as part of the NSWindowController class. Reimplement the PrefController class as a subclass of NSWindowController, removing any code possible.
In our implementation of the GraphPaper application, the PrefController communicates directly with the GraphView object when the preferences are changed. This design violates encapsulation between the two class designs and limits the application to having a maximum of one GraphView object. A better design would be to have the GraphView object register to receive an NSDefaultsChangedNotification and use this as a signal to reread the values from the defaults database. The PrefController would then post an NSDefaultsChangedNotification when the default values changed. Implement this design.
After you have completed the previous exercise, rewrite the GraphPaper application so that it uses the multiple-document architecture that we used with MathPaper.
Implement Document Save and Document Load for the multiple-document version of GraphPaper that you developed in the previous exercise. Your GraphPaper “document” should include formulae to be graphed, as well as the current color-well settings.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access