MyDocument has-a Catalogue (my model class) which contains an
MyDocument.nib contains an NSArrayController whose contentArray is
bound to MyDocument.catalogue.definitionItems and an NSTableView whose
content is bound to the NSArrayController.
This all works fine, but I'm not sure where to put my undo logic. At
the moment I have this method in Catalogue (inspired by Hillegass):
DefinitionItem* d = [definitionItems objectAtIndex:index];
// add inverse of operation to undo stack
NSUndoManager* undo = [owner undoManager];
[[undo prepareWithInvocationTarget:self] insertObject:d
if (![undo isUndoing])
[undo setActionName:@"Delete Definition Item"];
and I set the owner of the Catalogue to the MyDocument instance, but
I'd rather not have undo logic in my model at all.
1. Where does the undo logic belong?
2. How does wherever it goes observe the changes to the definitionItems
Thanks for any ideas,
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden