Using Undo for a ported PC app
Using Undo for a ported PC app
- Subject: Using Undo for a ported PC app
- From: "Theodore H. Smith" <email@hidden>
- Date: Wed, 24 Jan 2007 13:56:01 +0000
Hi people,
I've been porting a PC app to the Mac.
This app doesn't use any undo framework. It uses a two state system,
where the entire current document is copied over to another backup
state, before any change is made. Then the change is made, and an
undo is made available. It's all done with C++ objects, no NS objects
going on for the undo.
Now, how should I integrate that with NSUndoManager?
Currently, I actually deleted the undo menu, and replaced it with
another undo menu that just linked to a "MyUndo:" method. Because I
found that Cocoa was taking over the undo menu and wouldn't enable it
when I wanted it to be enabled. It wasn't even being passed to
validateMenuItem, unlike cut and copy!
But I think this was a mistake. I should instead actually use the
framework as it was meant to be used. For a start this taking over
undo, has interefered with how NSTextView works. If I try to undo
within an NSTextView, it actually undoes the document instead.
I wanted the document and the NSTextView's undo states to be
independant. But I do want the text field to know what states were
written by the app itself and s houldn't be undoable. I want it to
know what the field's "initial" state is! How can I tell my
NSTextfield "this is your initial state, all undoes lead back to this
state"?
One problem with doing it the proper way..., I have no idea how the
framework works. The documentation is very abstract and I can't
understand it without any simple examples. It's just words to me
right now, it just doesn't sink in.
The thing about NSUndoManager is that it is a multi-level undo
framework, and this app is a single undo.
Any help or pointers anyone?
--
http://elfdata.com/plugin/
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden