It's customary for cases such as your "B" action not to record the state change in the GoUndoManager at all, rather than remembering it and then having Undo and Redo skip over those changes.
Part of the reason is that in your A,B,C scenario the user has to undo 3 times to return to the original state instead of just 2 times. That means that the second undo seems to have no effect, which can be confusing to users. And the same goes for Redo, of course.
Programs that have this issue sometimes prompt "this action can't be undone, are you sure?".
So when A,B,C actions occur, the GoUndoManager should just remember A,C.
You can accomplish this by temporarily setting either GoDocument.SkipsUndoManager or GoObject.SkipsUndoManager to true, depending on the scope of changes you want it to skip. (You can also override GoUndoManager.SkipEvent if your decision about skipping is more dynamic than just setting the SkipsUndoManager property, but that's rare.)
----
But, to answer your main question, you can try overriding GoUndoManager.Undo() to call the base method and then: if a "B"action had occurred sometime and if GoUndoManager.UndoEditIndex < 0, set GoDocument.IsModified to true. Of course you'll need to define your own boolean property to keep track of whether a "B" action has occurred.
it would look something like this:
[code]
[Serializable]
public class SpecialUndoMgr : GoUndoManager {
public SpecialUndoMgr() {
}
public override void Undo() {
base.Undo();
if (bHappened && this.UndoEditIndex < 0) {
foreach (GoDocument doc in this.Documents) {
doc.IsModified = true;
}
}
}
private bool bHappened = true;
}
[/code]
note, UndoManager supports multiple documents, so we're using a shotgun here and setting them ALL to IsModified. If you only have 1 document, that's ok. If you have more, then you need to ponder this a bit.
also, we have a very simple definition for "B happened"... you obviously will want to flesh that out too.