Example #1
0
 protected void DetachFromAllShapes(GraphicElement el)
 {
     /*    el.DisconnectShapeFromConnector(GripType.Start);
      *  el.DisconnectShapeFromConnector(GripType.End);
      *  el.RemoveConnection(GripType.Start);
      *  el.RemoveConnection(GripType.End);*/
 }
Example #2
0
 public void SelectElement(GraphicElement el)
 {
     if (!selectedElements.Contains(el))
     {
         selectedElements.Add(el);
         el.Select();
         el.DrawSelection();
     }
 }
Example #3
0
 public SnapAction(Action action, GraphicElement lineShape, GripType gripType, GraphicElement targetShape, ConnectionPoint lineConnectionPoint, ConnectionPoint shapeConnectionPoint, Point delta)
 {
     SnapType                  = action;
     this.connector            = lineShape;
     this.gripType             = gripType;
     this.targetShape          = targetShape;
     this.lineConnectionPoint  = lineConnectionPoint;
     this.shapeConnectionPoint = shapeConnectionPoint;
     Delta = delta;
 }
Example #4
0
        protected bool SelectElement(Point p)
        {
            GraphicElement el = elements.FirstOrDefault(e => e.IsSelectable(p));

            if (el != null)
            {
                SelectElement(el);
            }

            return(el != null);
        }
 public void ShowAnchors()
 {
     try
     {
         GraphicElement el = canvascontroller.GetRootShapeAt(CurrentMousePosition);
         Trace.WriteLine("*** ShowAnchors " + el.GetType().Name);
         el.ShowAnchors = true;
         el.DrawAnchors();
         HoverShape = el;
     }
     catch { }
     //canvascontroller.SetAnchorCursor(el);
 }
        protected void SelectSingleRootShape()
        {
            // Preserve for undo:
            List <GraphicElement> selectedShapes = canvascontroller.SelectedElements.ToList();
            GraphicElement        el             = canvascontroller.GetRootShapeAt(CurrentMousePosition);

            if (!selectedShapes.Contains(el))
            {
                MessageBox.Show(selectedShapes.Count + "");
                canvascontroller.DeselectCurrentSelectedElements();
                canvascontroller.SelectElement(el);
            }
        }
Example #7
0
 public override void Update(GraphicElement el, string label)
 {
     // X1
     //(label == nameof(StartCap)).If(() => this.ChangePropertyWithUndoRedo<AvailableLineCap>(el, nameof(StartCap), nameof(StartCap)));
     //(label == nameof(EndCap)).If(() => this.ChangePropertyWithUndoRedo<AvailableLineCap>(el, nameof(EndCap), nameof(EndCap)));
     if (label == nameof(StartCap))
     {
         ((Connector)el).StartCap = StartCap;
     }
     ;
     if (label == nameof(EndCap))
     {
         ((Connector)el).EndCap = EndCap;
     }
     ;
     base.Update(el, label);
 }
 public virtual void Update(GraphicElement el, string label)
 {
     // X1
     //(label == nameof(Rectangle)).If(() => this.ChangePropertyWithUndoRedo<Rectangle>(el, nameof(el.DisplayRectangle), nameof(Rectangle)));
     //(label == nameof(BorderColor)).If(() => this.ChangePropertyWithUndoRedo<Color>(el, nameof(el.BorderPenColor), nameof(BorderColor)));
     //(label == nameof(BorderWidth)).If(() => this.ChangePropertyWithUndoRedo<int>(el, nameof(el.BorderPenWidth), nameof(BorderWidth)));
     //(label == nameof(FillColor)).If(() => this.ChangePropertyWithUndoRedo<Color>(el, nameof(el.FillColor), nameof(FillColor)));
     if (label == nameof(borderShape))
     {
         el.DisplayRectangle = borderShape;
     }
     ;
     if (label == nameof(Name))
     {
         el.Name = Name;
     }
     ;
 }
Example #9
0
 public void AddElement(GraphicElement el)
 {
     elements.Add(el);
 }
Example #10
0
        //  public bool IsSnapToBeIgnored { get { return ((Control.ModifierKeys & Keys.Control) == Keys.Control) || UndoRedoIgnoreSnapCheck; } }

        public virtual void DeselectElement(GraphicElement el)
        {
        }
Example #11
0
 public virtual void SetAnchorCursor(GraphicElement el)
 {
 }
Example #12
0
 //public virtual void SelectElement(GraphicElement el) { }
 public virtual void SelectOnlyElement(GraphicElement el)
 {
 }
 private void CreateControl(GraphicElement el)
 {
     IServiceManager.canvasController.AddElement(el);
     el.Draw();
 }
 public virtual void SetConnection(GripType gt, GraphicElement shape)
 {
 }
 public virtual void UpdateFrom(GraphicElement el)
 {
     // The only property that can change.
     borderShape = el.DisplayRectangle;
 }
 public ElementProperties(GraphicElement el)
 {
     this.element = el;
     borderShape  = el.DisplayRectangle;
     Name         = el.Name;
 }