/// <summary> /// Redo next component. /// </summary> public void RedoComponent() { JCS_UndoRedoComponent redoComp = JCS_Utility.ListPopBack(mRedoComp); if (redoComp == null) { return; } redoComp.Redo(); mUndoComp.Add(redoComp); }
/*******************************************/ /* Self-Define */ /*******************************************/ //---------------------- // Public Functions /// <summary> /// Undo next component. /// </summary> public void UndoComponent() { JCS_UndoRedoComponent undoComp = JCS_Utility.ListPopBack(mUndoComp); if (undoComp == null) { return; } undoComp.Undo(); mRedoComp.Add(undoComp); }
/// <summary> /// Start recording undo/redo /// </summary> public void StartRecordingAll() { for (int index = 0; index < mAllUndoRedoComp.Count; ++index) { JCS_UndoRedoComponent comp = mAllUndoRedoComp[index]; if (comp == null) { continue; } comp.StartRecording(); } }
/// <summary> /// Record down the previous data before we do /// undo/redo action. /// </summary> public void RecordPrevData() { for (int index = 0; index < mAllUndoRedoComp.Count; ++index) { JCS_UndoRedoComponent comp = mAllUndoRedoComp[index]; if (comp == null) { continue; } comp.RecordPrevData(); } }
/// <summary> /// Clear all redo component queue. /// </summary> public void ClearRedoComp() { // Clear all repo components' history data. for (int index = 0; index < mRedoComp.Count; ++index) { JCS_UndoRedoComponent comp = mRedoComp[index]; if (comp == null) { continue; } comp.ClearAllRedo(); } // Clear it. mRedoComp.Clear(); }
/// <summary> /// Clear all the undo/redo history data. /// </summary> public void ClearAllUndoRedoHistory() { // Clear all undo/repo components' history data. for (int index = 0; index < mAllUndoRedoComp.Count; ++index) { JCS_UndoRedoComponent comp = mAllUndoRedoComp[index]; if (comp == null) { continue; } comp.ClearAllUndoRedoHistory(); } // Clear all undo redo component history data. ClearUndoComp(); ClearRedoComp(); }
/// <summary> /// Add component to next redo component. /// </summary> /// <param name="redoComp"></param> public void AddRedoComponent(JCS_UndoRedoComponent redoComp) { mRedoComp.Add(redoComp); }
/// <summary> /// Add component to next undo component. /// </summary> /// <param name="undoComp"></param> public void AddUndoComponent(JCS_UndoRedoComponent undoComp) { mUndoComp.Add(undoComp); }
/// <summary> /// Add a undo redo component to the system in order to /// get manage. /// </summary> /// <param name="comp"></param> public void AddUndoRedoComponentToSystem(JCS_UndoRedoComponent comp) { mAllUndoRedoComp.Add(comp); }