Ejemplo n.º 1
0
 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);
     }
 }
Ejemplo n.º 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();
		}
Ejemplo n.º 3
0
        // 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());
            }
        }
Ejemplo n.º 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";
		}
Ejemplo n.º 5
0
		public UndoManager(Layers layerList)
		{
			this.layers = layerList;

			ClearHistory();
		}
Ejemplo n.º 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);
Ejemplo n.º 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);
Ejemplo n.º 8
0
		public override void Redo(Layers list)
		{
			// Replace all objects in the list with objects from listAfter
			ReplaceObjects(list[activeLayer].Graphics, listAfter);
		}
Ejemplo n.º 9
0
		public override void Undo(Layers list)
		{
			// Replace all objects in the list with objects from listBefore
			ReplaceObjects(list[activeLayer].Graphics, listBefore);
		}
Ejemplo n.º 10
0
		// Call this function AFTER operation.
		public void NewState(Layers layerList)
		{
			// Keep objects state after operation.
			FillList(layerList[activeLayer].Graphics, ref listAfter);
		}
Ejemplo n.º 11
0
		// Create this command BEFORE operation.
		public CommandChangeState(Layers layerList)
		{
			// Keep objects state before operation.
			activeLayer = layerList.ActiveLayerIndex;
			FillList(layerList[activeLayer].Graphics, ref listBefore);
		}
Ejemplo n.º 12
0
 public override void Redo(Layers list)
 {
     // Clear list - make DeleteAll again
     list[list.ActiveLayerIndex].Graphics.Clear();
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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();
 }
Ejemplo n.º 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);
		}
Ejemplo n.º 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();
		}