Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic UndoManager filters (Read 3708 times)
sledenev
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 25
Joined: Dec 16th, 2009
UndoManager filters
Oct 13th, 2010 at 11:21am
Print Post  
Hi,

Changing Bounds of DiagramNode leads to adding ModifyItemCmd to UndoManager. Is there any way to filter modification commands with exact fields (e.g. Bounds) for excluding them from UndoManager.History list?

I suppose it must be done in ActionRecording event. But how can I understand which of fields are changed?

Thanks in advance.


  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: UndoManager filters
Reply #1 - Oct 13th, 2010 at 11:56am
Print Post  
Hi,

ModifyItemCmd objects are created only when changing nodes and links' positions. There are ChangeItemCmds used for storing item property changes. So I suppose you can check just the command type in that case.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
sledenev
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 25
Joined: Dec 16th, 2009
Re: UndoManager filters
Reply #2 - Oct 13th, 2010 at 12:12pm
Print Post  
Stoyo wrote on Oct 13th, 2010 at 11:56am:
Hi,

ModifyItemCmd objects are created only when changing nodes and links' positions. There are ChangeItemCmds used for storing item property changes. So I suppose you can check just the command type in that case.

I hope that helps,
Stoyan


I'm using my own node class inherited from DiagramNode. In overridden metod Draw() I call Resize() method. After Resize() ModifyItemCmd is catched in ActionRecording event handler.

If I comment Resize() then nothing is catched.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: UndoManager filters
Reply #3 - Oct 13th, 2010 at 1:04pm
Print Post  
That's right, both Resize() and Move() just set Bounds, and the Bounds setter creates a ModifyItemCmd.
  
Back to top
 
IP Logged
 
sledenev
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 25
Joined: Dec 16th, 2009
Re: UndoManager filters
Reply #4 - Oct 13th, 2010 at 1:31pm
Print Post  
Stoyo wrote on Oct 13th, 2010 at 1:04pm:
That's right, both Resize() and Move() just set Bounds, and the Bounds setter creates a ModifyItemCmd.


So, back to my question - is there any way to determine that changes in Bounds field (or any other in general) of node were the reason of generating ModifyItemCmd?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: UndoManager filters
Reply #5 - Oct 13th, 2010 at 2:08pm
Print Post  
If it's a ModifyItemCmd and if cmd.Item is a DiagramNode then it can be generated only because of change in Bounds, in whatever way that change is done. If you need to filter out only the ones coming from your Draw method, you can always use a boolean flag that is set only while Draw runs.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint