/// <summary> /// Called when we want to undo a change in the model. /// </summary> /// <param name="clearUndoneModel">Set to false if you want it to /// be possible to redo the action.</param> internal void Undo(Boolean clearUndoneModel) { ModelHistoryItem historyItem = mModelHistory.Undo(clearUndoneModel); if (historyItem != null) { mPlayModel = historyItem.model; viewPanel.CurrentFrame = mPlayModel.GetFrame(viewPanel.CurrentFrame.UniqueId); if (viewPanel.CurrentFrame == null) { viewPanel.CurrentFrame = mPlayModel.FirstFrame(); } viewPanel.Refresh(); // Need to tell the frame collection that the model has changed as well // since it usually finds out from the ModelChanged function of the // main designer form (which isn't called during an undo). frameCollection.ModelChanged(mPlayModel); frameCollection.CurrentFrameChanged(viewPanel.CurrentFrame); } // Each time the model changes we check to see whether the undo/redo // buttons should be greyed out. undoToolStripMenuItem.Enabled = mModelHistory.CanUndo(); redoToolStripMenuItem.Enabled = mModelHistory.CanRedo(); }