Changeset 4068 for trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/UndoRedo/Commands/AddMultiPointShapeCommand.cs
- Timestamp:
- 07/22/10 00:44:01 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/UndoRedo/Commands/AddMultiPointShapeCommand.cs
r2768 r4068 1 1 using System; 2 using System.Collections.Generic;3 using System.Text;4 2 using System.Drawing; 5 namespace Netron.Diagramming.Core 6 { 7 /// <summary> 8 /// ICommand implementation of the AddShape action 9 /// </summary> 10 class AddMultiPointShapeCommand : Command 11 { 12 IShape shape; 3 namespace Netron.Diagramming.Core { 4 /// <summary> 5 /// ICommand implementation of the AddShape action 6 /// </summary> 7 class AddMultiPointShapeCommand : Command { 8 IShape shape; 13 9 14 public IShape Shape 15 { 16 get { return shape; } 17 } 10 public IShape Shape { 11 get { return shape; } 12 } 18 13 19 20 14 21 public AddMultiPointShapeCommand(IController controller, IShape shape) :base(controller)22 {23 if (shape == null)24 throw new ArgumentNullException("The shape is 'null' and cannot be inserted.");25 this.Text = "Add " + shape.EntityName;26 15 27 28 this.shape = shape; 29 } 16 public AddMultiPointShapeCommand(IController controller, IShape shape) 17 : base(controller) { 18 if (shape == null) 19 throw new ArgumentNullException("The shape is 'null' and cannot be inserted."); 20 this.Text = "Add " + shape.EntityName; 30 21 31 public override void Redo()32 {33 Controller.Model.AddShape(shape);34 Rectangle rec = shape.Rectangle;35 rec.Inflate(20, 20);36 Controller.View.Invalidate(rec);37 }38 22 39 public override void Undo() 40 { 41 Rectangle rec = shape.Rectangle; 42 rec.Inflate(20, 20); 43 Controller.Model.RemoveShape(shape); 23 this.shape = shape; 24 } 44 25 45 Controller.View.Invalidate(rec); 46 47 } 26 public override void Redo() { 27 Controller.Model.AddShape(shape); 28 Rectangle rec = shape.Rectangle; 29 rec.Inflate(20, 20); 30 Controller.View.Invalidate(rec); 31 } 48 32 33 public override void Undo() { 34 Rectangle rec = shape.Rectangle; 35 rec.Inflate(20, 20); 36 Controller.Model.RemoveShape(shape); 37 38 Controller.View.Invalidate(rec); 49 39 50 40 } 51 41 42 43 } 44 52 45 }
Note: See TracChangeset
for help on using the changeset viewer.