Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Question about redo/undo (Read 3406 times)
CanadaProgrammer
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 113
Joined: Jun 30th, 2011
Question about redo/undo
Jul 11th, 2011 at 8:15am
Print Post  
I do action A1, A2, then undo, undo, redo, redo,... that can work fine. But if I do action A1, A2, undo , do action A3, then I could not redo A2. So I think when a action was recorded then the redo buffer will be cleared. Is it true ?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Question about redo/undo
Reply #1 - Jul 11th, 2011 at 9:11am
Print Post  
It's true. Any new action you do could modify the diagram in a way that makes the commands ahead in the buffer invalid, so they are purged. For example, if the new action is removing a node, you can't redo a modify command recorded for it, or a create-link command that connects it to another node.
  
Back to top
 
IP Logged
 
CanadaProgrammer
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 113
Joined: Jun 30th, 2011
Re: Question about redo/undo
Reply #2 - Jul 12th, 2011 at 1:59am
Print Post  
It's not a good news for me. There is a action to move a shape(or a node). Diagram object can redo and undo it fine. That means the orignal position and current position of a shape must be saved in a command object. But I can not find these data in a modify command.

If I can get these data then it's much easier for me to handle redo/undo by myself. Is there any helpful idea ?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Question about redo/undo
Reply #3 - Jul 12th, 2011 at 6:15am
Print Post  
I don't think that's safe even for move operations. For example if there are containers, groups or auto-routed links involved, you can easily get incorrect results if you undo some action, move a node and redo. Now if all that your application does is letting the user move existing nodes around, you can handle NodeStartModifying and NodeModified to record the node positions and keep them in your own undo/redo list.
  
Back to top
 
IP Logged
 
CanadaProgrammer
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 113
Joined: Jun 30th, 2011
Re: Question about redo/undo
Reply #4 - Jul 13th, 2011 at 2:36am
Print Post  
Yes I already handled event NodeStartModify but, this event will be lauched only one node selected. If I choose (nodes) or (node and links) then the event does not work.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Question about redo/undo
Reply #5 - Jul 13th, 2011 at 7:43am
Print Post  
You can record initial positions from one of the multiple-selection related events then, such as SelectionChanged or SelectionMoving.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint