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);
     }
 }
示例#2
0
		public DrawArea()
		{
			// create list of Layers, with one default active visible layer
			_layers = new Layers();
			_layers.CreateNewLayer("Default");
			_panning = false;
			_panX = 0;
			_panY = 0;
			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();
		}
        // 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());
            }
        }
示例#4
0
		public LayerDialog(Layers _layers)
		{
			InitializeComponent();
			for (int i = 0; i < _layers.Count; i++)
			{
				LayerEdit le = new LayerEdit();
				le.LayerName = ((Layer)_layers[i]).LayerName;
				le.LayerVisible = ((Layer)_layers[i]).IsVisible;
				le.LayerActive = ((Layer)_layers[i]).IsActive;

				layerList.Add(le);
			}
			dgvLayers.DataSource = layerList;
			dgvLayers.Columns[0].HeaderText = "Layer Name";
			dgvLayers.Columns[1].HeaderText = "New Layer";
			dgvLayers.Columns[2].HeaderText = "Active";
			dgvLayers.Columns[3].HeaderText = "Deleted";
			dgvLayers.Columns[4].HeaderText = "Visible";
		}
示例#5
0
		public UndoManager(Layers layerList)
		{
			this.layers = layerList;

			ClearHistory();
		}
示例#6
0
        // 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);
示例#7
0
        // 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);
		public override void Redo(Layers list)
		{
			// Replace all objects in the list with objects from listAfter
			ReplaceObjects(list[activeLayer].Graphics, listAfter);
		}
		public override void Undo(Layers list)
		{
			// Replace all objects in the list with objects from listBefore
			ReplaceObjects(list[activeLayer].Graphics, listBefore);
		}
		// 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);
		}
示例#12
0
 public override void Redo(Layers list)
 {
     // Clear list - make DeleteAll again
     list[list.ActiveLayerIndex].Graphics.Clear();
 }
示例#13
0
 /// <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);
 }
示例#14
0
 /// <summary>
 /// Undo last Add command
 /// </summary>
 /// <param name="list">Layers collection</param>
 public override void Undo(Layers list)
 {
     list[list.ActiveLayerIndex].Graphics.DeleteLastAddedObject();
 }
示例#15
0
		/// <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);
		}
示例#16
0
		/// <summary>
		/// Undo last Add command
		/// </summary>
		/// <param name="list">Layers collection</param>
		public override void Undo(Layers list)
		{
			list[list.ActiveLayerIndex].Graphics.DeleteLastAddedObject();
		}