private void EndEditing(Point?editPoint) { WorkflowView parentView = base.ParentView; if (parentView != null) { if (this.EditingInProgress) { if (editPoint.HasValue) { if (this.connectorEditor.EditedConectionPoint != null) { ConnectionPoint sourceConnectionPoint = (this.connectorEditor.EditedConnector.Source == this.connectorEditor.EditedConectionPoint) ? this.connectorEditor.EditedConnector.Target : this.connectorEditor.EditedConnector.Source; GetSnappableConnectionPoints(editPoint.Value, sourceConnectionPoint, this.connectorEditor.EditedConectionPoint, base.MessageHitTestContext.AssociatedDesigner, out this.snappedConnectionPoint); } if (this.SnappedConnectionPoint != null) { editPoint = new Point?(this.SnappedConnectionPoint.Location); } } this.connectorEditor.OnEndEditing(editPoint.HasValue ? editPoint.Value : Point.Empty, editPoint.HasValue); } this.initialDragPoint = null; this.dragPointHitInfo = null; this.snappedConnectionPoint = null; this.ConnectablePoints = null; parentView.Capture = false; this.connectorEditor = null; } }
public EditPoint(ConnectorEditor owner, ConnectionPoint connectionPoint) { this.owner = owner; this.editPointType = EditPointTypes.ConnectionEditPoint; this.connectionPoint = connectionPoint; this.point = connectionPoint.Location; }
protected override bool OnMouseMove(MouseEventArgs eventArgs) { Point empty = Point.Empty; WorkflowView parentView = base.ParentView; Point clientPoint = new Point(eventArgs.X, eventArgs.Y); if ((parentView != null) && parentView.IsClientPointInActiveLayout(clientPoint)) { Point editPoint = parentView.ClientPointToLogical(clientPoint); if ((eventArgs.Button & MouseButtons.Left) == MouseButtons.Left) { if ((!this.EditingInProgress && this.initialDragPoint.HasValue) && ((Math.Abs((int)(this.initialDragPoint.Value.X - editPoint.X)) > SystemInformation.DragSize.Width) || (Math.Abs((int)(this.initialDragPoint.Value.Y - editPoint.Y)) > SystemInformation.DragSize.Height))) { ConnectorEditor connectorEditor = this.GetConnectorEditor(this.initialDragPoint.Value, this.dragPointHitInfo); this.BeginEditing(connectorEditor, this.initialDragPoint.Value); } if (this.EditingInProgress) { this.ContinueEditing(editPoint); if (this.SnappedConnectionPoint != null) { editPoint = this.SnappedConnectionPoint.Location; } } } else { FreeformActivityDesigner connectorContainer = GetConnectorContainer(base.MessageHitTestContext.AssociatedDesigner); this.ConnectablePoints = ((connectorContainer != null) && connectorContainer.EnableUserDrawnConnectors) ? GetHighlightableConnectionPoints(editPoint, base.MessageHitTestContext.AssociatedDesigner) : null; } empty = editPoint; } return(this.EditingInProgress | this.UpdateCursor(new Point?(empty))); }
protected override bool OnPaint(PaintEventArgs e, Rectangle viewPort, AmbientTheme ambientTheme) { //Draw the selected connectors at top of the z level Connector selectedConnector = null; ISelectionService selectionService = GetService(typeof(ISelectionService)) as ISelectionService; foreach (object selectedComponents in selectionService.GetSelectedComponents()) { Connector connector = Connector.GetConnectorFromSelectedObject(selectedComponents); if (connector != null) { connector.OnPaintSelected(new ActivityDesignerPaintEventArgs(e.Graphics, connector.ParentDesigner.Bounds, viewPort, connector.ParentDesigner.DesignerTheme), (selectedComponents == selectionService.PrimarySelection), new Point[] { }); if (selectedComponents == selectionService.PrimarySelection) { selectedConnector = connector; } } } //Draw selected connector adorned with the edit points if (selectedConnector != null) { ConnectorEditor editableConnector = new ConnectorEditor(selectedConnector); editableConnector.OnPaint(new ActivityDesignerPaintEventArgs(e.Graphics, selectedConnector.ParentDesigner.Bounds, viewPort, selectedConnector.ParentDesigner.DesignerTheme), true, true); } //If editing is in progress then draw the connector being edited if (EditingInProgress) { FreeformActivityDesigner designer = (this.connectorEditor.EditedConnector.ParentDesigner != null) ? this.connectorEditor.EditedConnector.ParentDesigner : ConnectionManager.GetConnectorContainer(this.connectorEditor.EditedConnector.Source.AssociatedDesigner); this.connectorEditor.OnPaint(new ActivityDesignerPaintEventArgs(e.Graphics, designer.Bounds, viewPort, designer.DesignerTheme), false, false); } return(false); }
private bool UpdateCursor(Nullable <Point> cursorPoint) { Cursor cursorToSet = Cursors.Default; if (cursorPoint != null) { if (EditingInProgress) { cursorToSet = this.connectorEditor.GetCursor(cursorPoint.Value); } //Connector snap cursor always takes precedence over other cursors if (SnappedConnectionPoint != null) { cursorToSet = ConnectionManager.SnappedConnectionCursor; } else if (ConnectablePoints != null) { foreach (ConnectionPoint connectablePoint in ConnectablePoints) { if (connectablePoint.Bounds.Contains(cursorPoint.Value)) { cursorToSet = ConnectionManager.SnappedConnectionCursor; break; } } //Fall back and check if we are hovering on any edit points if (cursorToSet == Cursors.Default) { ISelectionService selectionService = GetService(typeof(ISelectionService)) as ISelectionService; if (selectionService != null) { Connector selectedConnector = Connector.GetConnectorFromSelectedObject(selectionService.PrimarySelection); if (selectedConnector != null && selectedConnector.ParentDesigner.EnableUserDrawnConnectors) { ConnectorEditor connectorEditor = new ConnectorEditor(selectedConnector); cursorToSet = connectorEditor.GetCursor(cursorPoint.Value); } } } } } WorkflowView workflowView = ParentView; if (workflowView != null && (cursorToSet != Cursors.Default || workflowView.Cursor == ConnectionManager.SnappedConnectionCursor || workflowView.Cursor == ConnectionManager.NewConnectorCursor)) { workflowView.Cursor = cursorToSet; } return(cursorToSet != Cursors.Default); }
private void BeginEditing(ConnectorEditor editableConnector, Point editPoint) { WorkflowView parentView = base.ParentView; if ((parentView != null) && (editableConnector != null)) { this.connectorEditor = editableConnector; parentView.Capture = true; this.connectorEditor.OnBeginEditing(editPoint); } }
private void BeginEditing(ConnectorEditor editableConnector, Point editPoint) { WorkflowView workflowView = ParentView; if (workflowView != null && editableConnector != null) { this.connectorEditor = editableConnector; workflowView.Capture = true; this.connectorEditor.OnBeginEditing(editPoint); } }
private bool UpdateCursor(Point?cursorPoint) { Cursor snappedConnectionCursor = Cursors.Default; if (cursorPoint.HasValue) { if (this.EditingInProgress) { snappedConnectionCursor = this.connectorEditor.GetCursor(cursorPoint.Value); } if (this.SnappedConnectionPoint != null) { snappedConnectionCursor = SnappedConnectionCursor; } else if (this.ConnectablePoints != null) { foreach (ConnectionPoint point in this.ConnectablePoints) { if (point.Bounds.Contains(cursorPoint.Value)) { snappedConnectionCursor = SnappedConnectionCursor; break; } } if (snappedConnectionCursor == Cursors.Default) { ISelectionService service = base.GetService(typeof(ISelectionService)) as ISelectionService; if (service != null) { Connector connectorFromSelectedObject = Connector.GetConnectorFromSelectedObject(service.PrimarySelection); if ((connectorFromSelectedObject != null) && connectorFromSelectedObject.ParentDesigner.EnableUserDrawnConnectors) { snappedConnectionCursor = new ConnectorEditor(connectorFromSelectedObject).GetCursor(cursorPoint.Value); } } } } } WorkflowView parentView = base.ParentView; if ((parentView != null) && (((snappedConnectionCursor != Cursors.Default) || (parentView.Cursor == SnappedConnectionCursor)) || (parentView.Cursor == NewConnectorCursor))) { parentView.Cursor = snappedConnectionCursor; } return(snappedConnectionCursor != Cursors.Default); }
private void EndEditing(Nullable <Point> editPoint) { WorkflowView workflowView = ParentView; if (workflowView == null) { return; } if (EditingInProgress) { if (editPoint != null) { ConnectionPoint[] snapableConnectionPoints = null; if (this.connectorEditor.EditedConectionPoint != null) { ConnectionPoint sourceConnectionPoint = this.connectorEditor.EditedConnector.Source == this.connectorEditor.EditedConectionPoint ? this.connectorEditor.EditedConnector.Target : this.connectorEditor.EditedConnector.Source; snapableConnectionPoints = GetSnappableConnectionPoints(editPoint.Value, sourceConnectionPoint, this.connectorEditor.EditedConectionPoint, MessageHitTestContext.AssociatedDesigner, out this.snappedConnectionPoint); } if (SnappedConnectionPoint != null) { editPoint = SnappedConnectionPoint.Location; } } this.connectorEditor.OnEndEditing((editPoint != null) ? editPoint.Value : Point.Empty, (editPoint != null)); } this.initialDragPoint = null; this.dragPointHitInfo = null; this.snappedConnectionPoint = null; ConnectablePoints = null; workflowView.Capture = false; this.connectorEditor = null; }
protected override bool OnPaint(PaintEventArgs e, Rectangle viewPort, AmbientTheme ambientTheme) { //Draw the selected connectors at top of the z level Connector selectedConnector = null; ISelectionService selectionService = GetService(typeof(ISelectionService)) as ISelectionService; foreach (object selectedComponents in selectionService.GetSelectedComponents()) { Connector connector = Connector.GetConnectorFromSelectedObject(selectedComponents); if (connector != null) { connector.OnPaintSelected(new ActivityDesignerPaintEventArgs(e.Graphics, connector.ParentDesigner.Bounds, viewPort, connector.ParentDesigner.DesignerTheme), (selectedComponents == selectionService.PrimarySelection), new Point[] { }); if (selectedComponents == selectionService.PrimarySelection) selectedConnector = connector; } } //Draw selected connector adorned with the edit points if (selectedConnector != null) { ConnectorEditor editableConnector = new ConnectorEditor(selectedConnector); editableConnector.OnPaint(new ActivityDesignerPaintEventArgs(e.Graphics, selectedConnector.ParentDesigner.Bounds, viewPort, selectedConnector.ParentDesigner.DesignerTheme), true, true); } //If editing is in progress then draw the connector being edited if (EditingInProgress) { FreeformActivityDesigner designer = (this.connectorEditor.EditedConnector.ParentDesigner != null) ? this.connectorEditor.EditedConnector.ParentDesigner : ConnectionManager.GetConnectorContainer(this.connectorEditor.EditedConnector.Source.AssociatedDesigner); this.connectorEditor.OnPaint(new ActivityDesignerPaintEventArgs(e.Graphics, designer.Bounds, viewPort, designer.DesignerTheme), false, false); } return false; }
private bool UpdateCursor(Point? cursorPoint) { Cursor snappedConnectionCursor = Cursors.Default; if (cursorPoint.HasValue) { if (this.EditingInProgress) { snappedConnectionCursor = this.connectorEditor.GetCursor(cursorPoint.Value); } if (this.SnappedConnectionPoint != null) { snappedConnectionCursor = SnappedConnectionCursor; } else if (this.ConnectablePoints != null) { foreach (ConnectionPoint point in this.ConnectablePoints) { if (point.Bounds.Contains(cursorPoint.Value)) { snappedConnectionCursor = SnappedConnectionCursor; break; } } if (snappedConnectionCursor == Cursors.Default) { ISelectionService service = base.GetService(typeof(ISelectionService)) as ISelectionService; if (service != null) { Connector connectorFromSelectedObject = Connector.GetConnectorFromSelectedObject(service.PrimarySelection); if ((connectorFromSelectedObject != null) && connectorFromSelectedObject.ParentDesigner.EnableUserDrawnConnectors) { snappedConnectionCursor = new ConnectorEditor(connectorFromSelectedObject).GetCursor(cursorPoint.Value); } } } } } WorkflowView parentView = base.ParentView; if ((parentView != null) && (((snappedConnectionCursor != Cursors.Default) || (parentView.Cursor == SnappedConnectionCursor)) || (parentView.Cursor == NewConnectorCursor))) { parentView.Cursor = snappedConnectionCursor; } return (snappedConnectionCursor != Cursors.Default); }
private void EndEditing(Point? editPoint) { WorkflowView parentView = base.ParentView; if (parentView != null) { if (this.EditingInProgress) { if (editPoint.HasValue) { if (this.connectorEditor.EditedConectionPoint != null) { ConnectionPoint sourceConnectionPoint = (this.connectorEditor.EditedConnector.Source == this.connectorEditor.EditedConectionPoint) ? this.connectorEditor.EditedConnector.Target : this.connectorEditor.EditedConnector.Source; GetSnappableConnectionPoints(editPoint.Value, sourceConnectionPoint, this.connectorEditor.EditedConectionPoint, base.MessageHitTestContext.AssociatedDesigner, out this.snappedConnectionPoint); } if (this.SnappedConnectionPoint != null) { editPoint = new Point?(this.SnappedConnectionPoint.Location); } } this.connectorEditor.OnEndEditing(editPoint.HasValue ? editPoint.Value : Point.Empty, editPoint.HasValue); } this.initialDragPoint = null; this.dragPointHitInfo = null; this.snappedConnectionPoint = null; this.ConnectablePoints = null; parentView.Capture = false; this.connectorEditor = null; } }
private void EndEditing(Nullable<Point> editPoint) { WorkflowView workflowView = ParentView; if (workflowView == null) return; if (EditingInProgress) { if (editPoint != null) { ConnectionPoint[] snapableConnectionPoints = null; if (this.connectorEditor.EditedConectionPoint != null) { ConnectionPoint sourceConnectionPoint = this.connectorEditor.EditedConnector.Source == this.connectorEditor.EditedConectionPoint ? this.connectorEditor.EditedConnector.Target : this.connectorEditor.EditedConnector.Source; snapableConnectionPoints = GetSnappableConnectionPoints(editPoint.Value, sourceConnectionPoint, this.connectorEditor.EditedConectionPoint, MessageHitTestContext.AssociatedDesigner, out this.snappedConnectionPoint); } if (SnappedConnectionPoint != null) editPoint = SnappedConnectionPoint.Location; } this.connectorEditor.OnEndEditing((editPoint != null) ? editPoint.Value : Point.Empty, (editPoint != null)); } this.initialDragPoint = null; this.dragPointHitInfo = null; this.snappedConnectionPoint = null; ConnectablePoints = null; workflowView.Capture = false; this.connectorEditor = null; }
private bool UpdateCursor(Nullable<Point> cursorPoint) { Cursor cursorToSet = Cursors.Default; if (cursorPoint != null) { if (EditingInProgress) cursorToSet = this.connectorEditor.GetCursor(cursorPoint.Value); //Connector snap cursor always takes precedence over other cursors if (SnappedConnectionPoint != null) { cursorToSet = ConnectionManager.SnappedConnectionCursor; } else if (ConnectablePoints != null) { foreach (ConnectionPoint connectablePoint in ConnectablePoints) { if (connectablePoint.Bounds.Contains(cursorPoint.Value)) { cursorToSet = ConnectionManager.SnappedConnectionCursor; break; } } //Fall back and check if we are hovering on any edit points if (cursorToSet == Cursors.Default) { ISelectionService selectionService = GetService(typeof(ISelectionService)) as ISelectionService; if (selectionService != null) { Connector selectedConnector = Connector.GetConnectorFromSelectedObject(selectionService.PrimarySelection); if (selectedConnector != null && selectedConnector.ParentDesigner.EnableUserDrawnConnectors) { ConnectorEditor connectorEditor = new ConnectorEditor(selectedConnector); cursorToSet = connectorEditor.GetCursor(cursorPoint.Value); } } } } } WorkflowView workflowView = ParentView; if (workflowView != null && (cursorToSet != Cursors.Default || workflowView.Cursor == ConnectionManager.SnappedConnectionCursor || workflowView.Cursor == ConnectionManager.NewConnectorCursor)) { workflowView.Cursor = cursorToSet; } return (cursorToSet != Cursors.Default); }
public EditPoint(ConnectorEditor owner, EditPointTypes editPointType, Point point) { this.owner = owner; this.editPointType = editPointType; this.point = point; }