public override void Undo(Layers list) { if (this.prepareHitProject != null) { prepareHitProject.ApplyProperties(prepareHitProject.OldProperties); } }
public override void Undo(Layers list) { // Delete from list all objects kept in cloneList int n = list[list.ActiveLayerIndex].Graphics.Count; for (int i = n - 1; i >= 0; i--) { bool toDelete = false; DrawObject objectToDelete = list[list.ActiveLayerIndex].Graphics[i]; foreach (DrawObject o in cloneList) { if (objectToDelete.ID == o.ID) { toDelete = true; break; } } if (toDelete) { list[list.ActiveLayerIndex].Graphics.RemoveAt(i); } } }
public override void Undo(Layers list) { // Add all objects from clone list to list - // opposite to DeleteAll foreach (DrawObject o in cloneList) { list[list.ActiveLayerIndex].Graphics.Add(o); } }
public override void Undo(Layers list) { list[list.ActiveLayerIndex].Graphics.UnselectAll(); // Add all objects from cloneList to list. foreach (DrawObject o in cloneList) { list[list.ActiveLayerIndex].Graphics.Add(o); } }
public override void Redo(Layers list) { list[list.ActiveLayerIndex].Graphics.UnselectAll(); // Add all objects from cloneList to list. for (int i = cloneList.Count - 1; i >= 0; i--) { list[list.ActiveLayerIndex].Graphics.Add(cloneList[i]); } }
private List<DrawObject> cloneList; // contains selected items which are deleted #endregion Fields #region Constructors // Create this command BEFORE applying Delete All function. public CommandPaste(Layers list) { cloneList = new List<DrawObject>(); // Make clone of the list selection. foreach (DrawObject o in list[list.ActiveLayerIndex].Graphics.Selection) { cloneList.Add(o.Clone()); } }
public LayerDialog(Layers _layers) { InitializeComponent(); for (int i = 0; i < _layers.Count; i++) { LayerEdit le = new LayerEdit(); le.LayerName = _layers[i].LayerName; le.LayerVisible = _layers[i].IsVisible; le.LayerActive = _layers[i].IsActive; layerList.Add(le); } SetDataGrid(); }
// Create this command BEFORE applying Delete All function. public CommandDeleteAll(Layers list) { cloneList = new List<DrawObject>(); // Make clone of the whole list. // Add objects in reverse order because GraphicsList.Add // insert every object to the beginning. int n = list[list.ActiveLayerIndex].Graphics.Count; for (int i = n - 1; i >= 0; i--) { cloneList.Add(list[list.ActiveLayerIndex].Graphics[i].Clone()); } }
public UndoManager(Layers layerList) { layers = layerList; ClearHistory(); }
public override void Undo(Layers list) { // Replace all objects in the list with objects from listBefore ReplaceObjects(list[activeLayer].Graphics, listBefore); }
public override void Redo(Layers list) { // Replace all objects in the list with objects from listAfter ReplaceObjects(list[activeLayer].Graphics, listAfter); }
// Call this function AFTER operation. public void NewState(Layers layerList) { // Keep objects state after operation. FillList(layerList[activeLayer].Graphics, ref listAfter); }
// Create this command BEFORE operation. public CommandChangeState(Layers layerList) { // Keep objects state before operation. activeLayer = layerList.ActiveLayerIndex; FillList(layerList[activeLayer].Graphics, ref listBefore); }
public override void Redo(Layers list) { // Clear list - make DeleteAll again list[list.ActiveLayerIndex].Graphics.Clear(); }
/// <summary> /// Undo last Add command /// </summary> /// <param name="list">Layers collection</param> public override void Undo(Layers list) { list[list.ActiveLayerIndex].Graphics.DeleteLastAddedObject(); }
/// <summary> /// Redo last Add command /// </summary> /// <param name="list">Layers collection</param> public override void Redo(Layers list) { list[list.ActiveLayerIndex].Graphics.UnselectAll(); list[list.ActiveLayerIndex].Graphics.Add(drawObject); }
// This function is used to make Undo operation. // It makes action opposite to the original command. //public abstract void Undo(GraphicsList list); public abstract void Undo(Layers list);
// This command is used to make Redo operation. // It makes original command again. //public abstract void Redo(GraphicsList list); public abstract void Redo(Layers list);