Exemple #1
0
        /// <summary>
        /// Add new object to draw area.
        /// Function is called when user left-clicks draw area,
        /// and one of ToolObject-derived tools is active.
        /// </summary>
        /// <param name="drawArea"></param>
        /// <param name="o"></param>
        protected void AddNewObject(DrawArea drawArea, DrawObject o)
        {
            drawArea.GraphicsList.UnselectAll();

            o.Selected = true;
            drawArea.GraphicsList.Add(o);

            drawArea.Capture = true;
            drawArea.Refresh();

            drawArea.SetDirty();
        }
Exemple #2
0
 /// <summary>
 /// Replace object in specified place.
 /// Used for Undo.
 /// </summary>
 public void Replace(int index, DrawObject obj)
 {
     if (index >= 0 && index < graphicsList.Count)
     {
         graphicsList.RemoveAt(index);
         graphicsList.Insert(index, obj);
     }
 }
Exemple #3
0
 /// <summary>
 /// Insert object to specified place.
 /// Used for Undo.
 /// </summary>
 public void Insert(int index, DrawObject obj)
 {
     if ( index >= 0  && index < graphicsList.Count )
     {
         graphicsList.Insert(index, obj);
     }
 }
Exemple #4
0
 public void Add(DrawObject obj)
 {
     // insert to the top of z-order
     graphicsList.Insert(0, obj);
 }
Exemple #5
0
 /// <summary>
 /// Copy fields from this instance to cloned instance drawObject.
 /// Called from Clone functions of derived classes.
 /// </summary>
 protected void FillDrawObjectFields(DrawObject drawObject)
 {
     drawObject.selected = this.selected;
     drawObject.color = this.color;
     drawObject.penWidth = this.penWidth;
     drawObject.ID = this.ID;
 }
Exemple #6
0
 // Create this command with DrawObject instance added to the list
 public CommandAdd(DrawObject drawObject) : base()
 {
     // Keep copy of added object
     this.drawObject = drawObject.Clone();
 }