This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Is there any way to provide a different implementation of the UndoManager that is used by the DiagramSurface? I need more control over the snapshotting and either need to be able to provide my own implementation or have a way to disable the default implementation and manage the state externally. Regards -Ryan |
|
|
Hello Ryan What people have done in the past for this is build their own undo logic in their model. You can listen to property changes in your model to know when to create a snapshot and update your own undo manager. You shouldn't need to integrate this into the control itself, you can just have this sitting in your application somewhere. Listening to changes in your model would be easier than listening to completed events coming from the various thumb controls. Then you can listen to the Undo/Redo commands produced by the application to call your undo or redo methods. Although we do not provide a way to fully disable the built in undo manager, you can call DiagramSurface.ResetUndo every now and then so that it does not affect performance or the memory footprint. Jason Fauchelle |
|
|
I can certainly maintain my state separately, but then I have your control eating up memory unnecessarily. Your suggestion to call ResetUndo periodically isn't really a sufficient solution as I still have snapshots being generated which, I assume, are not executing in O(1) time. Ultimately, if I can't rely on your UndoManager, why do I have to live with it creating snapshots and holding onto references? If you expose the UndoManager through an interface (in the same way you expose the ConnectionRelocator, NodeRelocator, ConnectionBuilder, etc) then I can supply a no-op implementation. |
|
|
Hello Ryan I have now added a boolean property called IsUndoManagerEnabled. By default this is true of course. If you set this to false, the built in undo logic will not be used at all, taking up no time or memory. This update can be downloaded through the next nightly build. The next nightly build will be available at around 1200 GMT (about 15 hours from now) which you can find on your account page: http://www.mindscapehq.com/store/myaccount Jason Fauchelle |
|