Hi, folks!
I use GoDiagram Win 2.0.1 eval
under VisualStudio.NET 1.0 with C#.
My nodes contains reference
to additional data in .UserObject property.
I need to undo/redo changes in additional data
using GoUndoManager.
What’s is now?
First, every node overrides CopyObject member:
public override GoObject CopyObject(GoCopyDictionary env)
{
MyNode n = (MyNode)base.CopyObject(env);
if (n == null)
return null;
MyData d = this.UserObject as MyData;
if (d == null)
n.UserObject = null;
else
n.UserObject = wfData.Clone();
return n;
}
Second, MyData provides correct implementation of Clone member.
Third, every changing of UserObject is implemented as following.
By the way, I don’t know exactly how to call
GoView.RaiseChanged(GoDocument.ChangedUserObject,…)
because there are no suitable example!!
public static bool CallPropertiesDialog(GoView v, GoObject src)
{
GoDocument doc = src.Document;
if (doc == null)
return false;
bool hasUndo = doc.StartTransaction();
IPropertiesDialogContainer i = src as IPropertiesDialogContainer;
bool result = ( (i == null) ? false : i.PropertiesDialog() );
if (!result) {
if (hasUndo)
doc.AbortTransaction();
return false;
}
if (v != null) {
v.RaiseChanged(GoDocument.ChangedUserObject, 0,
src, 0, null, GoObject.NullRect, 0, null, GoObject.NullRect);
} else {
doc.IsModified = true;
}
if (hasUndo)
doc.FinishTransaction(“Edit properties”);
return true;
}
But MyNode.CopyObject nor MyData.Clone is not called inside this routine
and Undo queue still empty, so that view.CanUndo() returns ‘false’.
Of course, there is “view.Document.UndoManager = new GoUndoManager()” line
at view creation.
Help! I need somebody! (c) John L.
Ilya