コード例 #1
0
        protected override bool OnMouseDown(MouseEventArgs eventArgs)
        {
            Point empty = Point.Empty;

            if ((eventArgs.Button & MouseButtons.Left) == MouseButtons.Left)
            {
                WorkflowView parentView  = base.ParentView;
                Point        clientPoint = new Point(eventArgs.X, eventArgs.Y);
                if ((parentView != null) && parentView.IsClientPointInActiveLayout(clientPoint))
                {
                    Point editPoint = parentView.ClientPointToLogical(clientPoint);
                    if (this.CanBeginEditing(editPoint, base.MessageHitTestContext))
                    {
                        this.initialDragPoint = new Point?(editPoint);
                        this.dragPointHitInfo = base.MessageHitTestContext;
                    }
                    empty = editPoint;
                }
            }
            else
            {
                this.EndEditing(null);
            }
            return(this.initialDragPoint.HasValue | this.UpdateCursor(new Point?(empty)));
        }
コード例 #2
0
        protected override bool OnMouseMove(MouseEventArgs eventArgs)
        {
            WorkflowView workflowView = ParentView;

            if (workflowView == null)
            {
                throw new InvalidOperationException(DR.GetString(DR.WorkflowViewNull));
            }

            bool          handledMessage = false;
            Point         clientPoint    = new Point(eventArgs.X, eventArgs.Y);
            Point         logicalPoint   = workflowView.ClientPointToLogical(clientPoint);
            DesignerEdges sizingEdge     = DesignerEdges.None;

            if (this.designerToResize != null)
            {
                sizingEdge = this.designerSizingEdge;
                UpdateDesignerSize(logicalPoint, this.designerToResize, this.designerSizingEdge);
                handledMessage = true;
            }
            else if (eventArgs.Button == MouseButtons.None)
            {
                ActivityDesigner designer = GetDesignerToResize(logicalPoint, out sizingEdge);
                if (designer != null && sizingEdge != DesignerEdges.None && CanResizeDesigner(designer))
                {
                    handledMessage = true;
                }
            }

            UpdateCursor(sizingEdge);
            return(handledMessage);
        }
コード例 #3
0
        protected override bool OnMouseUp(MouseEventArgs eventArgs)
        {
            if (this.dragStarted)
            {
                WorkflowView parentView = ParentView;

                //Invalidate the old rectangle so that we state the drag is complete
                if (!DragRectangle.IsEmpty)
                {
                    parentView.InvalidateLogicalRectangle(DragRectangle);
                }

                //End the actual drag/drop
                this.endDrag = parentView.ClientPointToLogical(new Point(eventArgs.X, eventArgs.Y));
                DragStarted  = false;

                //Send the notification of successful drag
                if (this.DragComplete != null)
                {
                    this.DragComplete(this, EventArgs.Empty);
                }

                return(true);
            }

            return(false);
        }
コード例 #4
0
        protected override bool OnMouseMove(MouseEventArgs eventArgs)
        {
            WorkflowView parentView = base.ParentView;

            if (parentView == null)
            {
                throw new InvalidOperationException(DR.GetString("WorkflowViewNull", new object[0]));
            }
            bool          flag        = false;
            Point         clientPoint = new Point(eventArgs.X, eventArgs.Y);
            Point         point       = parentView.ClientPointToLogical(clientPoint);
            DesignerEdges none        = DesignerEdges.None;

            if (this.designerToResize != null)
            {
                none = this.designerSizingEdge;
                this.UpdateDesignerSize(point, this.designerToResize, this.designerSizingEdge);
                flag = true;
            }
            else if (eventArgs.Button == MouseButtons.None)
            {
                ActivityDesigner designerToResize = this.GetDesignerToResize(point, out none);
                if (((designerToResize != null) && (none != DesignerEdges.None)) && this.CanResizeDesigner(designerToResize))
                {
                    flag = true;
                }
            }
            this.UpdateCursor(none);
            return(flag);
        }
コード例 #5
0
        protected override bool OnMouseDown(MouseEventArgs eventArgs)
        {
            Point cursorPoint = Point.Empty;

            //Check if we can start editing
            if ((eventArgs.Button & MouseButtons.Left) == MouseButtons.Left)
            {
                WorkflowView workflowView = ParentView;
                Point        clientPoint  = new Point(eventArgs.X, eventArgs.Y);

                //If the point is not in clickable area then return
                if (workflowView != null && workflowView.IsClientPointInActiveLayout(clientPoint))
                {
                    Point logicalPoint = workflowView.ClientPointToLogical(clientPoint);
                    if (CanBeginEditing(logicalPoint, MessageHitTestContext))
                    {
                        this.initialDragPoint = new Point?(logicalPoint);
                        this.dragPointHitInfo = MessageHitTestContext;
                    }
                    cursorPoint = logicalPoint;
                }
            }
            else
            {
                EndEditing(null);
            }

            //Update the cursor
            bool processedMessage = (this.initialDragPoint != null);

            processedMessage |= UpdateCursor(cursorPoint);
            return(processedMessage);
        }
コード例 #6
0
        protected override bool OnMouseUp(MouseEventArgs eventArgs)
        {
            //If left button is not down then return
            Point cursorPoint      = Point.Empty;
            bool  processedMessage = EditingInProgress;

            if ((eventArgs.Button & MouseButtons.Left) == MouseButtons.Left)
            {
                WorkflowView workflowView = ParentView;
                Point        clientPoint  = new Point(eventArgs.X, eventArgs.Y);
                if (workflowView != null && workflowView.IsClientPointInActiveLayout(clientPoint))
                {
                    Point logicalPoint = workflowView.ClientPointToLogical(clientPoint);
                    if (EditingInProgress)
                    {
                        EndEditing(logicalPoint);
                    }
                    cursorPoint = logicalPoint;
                }
            }

            //Make sure that whenever the mouse button is up we end the editing mode and update the cursor correctly
            EndEditing(null);
            processedMessage |= UpdateCursor(cursorPoint);
            return(processedMessage);
        }
コード例 #7
0
        protected override bool OnMouseMove(MouseEventArgs eventArgs)
        {
            WorkflowView parentView   = ParentView;
            Point        logicalPoint = parentView.ClientPointToLogical(new Point(eventArgs.X, eventArgs.Y));

            //We do nothing if the logical coordinate is not in the active layout
            //



            float dragMultiply = 2.0f / (float)parentView.Zoom * 100.0f;

            if (!this.dragStarted && (eventArgs.Button & MouseButtons.Left) > 0 &&
                (Math.Abs(this.startDrag.X - logicalPoint.X) > (int)(dragMultiply * (float)SystemInformation.DragSize.Width) || Math.Abs(this.startDrag.Y - logicalPoint.Y) > (int)(dragMultiply * (float)SystemInformation.DragSize.Height)))
            {
                DragStarted = true;
            }

            if (this.dragStarted)
            {
                if (!DragRectangle.IsEmpty)
                {
                    parentView.InvalidateLogicalRectangle(DragRectangle);
                }

                this.endDrag = logicalPoint;

                if (!DragRectangle.IsEmpty)
                {
                    parentView.InvalidateLogicalRectangle(DragRectangle);
                }
            }

            return(this.dragStarted);
        }
コード例 #8
0
        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)));
        }
コード例 #9
0
ファイル: DragDropManager.cs プロジェクト: dox0/DotNet471RS3
        protected override bool OnMouseMove(MouseEventArgs eventArgs)
        {
            Debug.Assert(this.dropTargetDesigner == null);

            WorkflowView parentView  = ParentView;
            Point        clientPoint = new Point(eventArgs.X, eventArgs.Y);

            //If the point is not a valid point on layout then return
            if (!parentView.IsClientPointInActiveLayout(clientPoint))
            {
                return(false);
            }

            if (eventArgs.Button == MouseButtons.Left)
            {
                Point       logicalPoint = parentView.ClientPointToLogical(clientPoint);
                HitTestInfo hitTestInfo  = MessageHitTestContext;

                if (this.draggedDesigner != null)
                {
                    ((IWorkflowDesignerMessageSink)this.draggedDesigner).OnMouseDragMove(eventArgs);
                }
                else if (parentView.RootDesigner != null && this.dragStarted && (eventArgs.Button & MouseButtons.Left) > 0 && (Math.Abs(this.dragInitiationPoint.X - logicalPoint.X) > SystemInformation.DragSize.Width || Math.Abs(this.dragInitiationPoint.Y - logicalPoint.Y) > SystemInformation.DragSize.Height))
                {
                    //Test if the mouse click was on the designer
                    ActivityDesigner potentialDraggedDesigner = hitTestInfo.AssociatedDesigner;
                    if (potentialDraggedDesigner != null)
                    {
                        //If we can intitiate the drag then do so otherwise just indicate that the designer isbeing dragged
                        if (CanInitiateDragDrop())
                        {
                            InitiateDragDrop();
                            this.dragStarted = false;
                        }
                        else
                        {
                            this.draggedDesigner = potentialDraggedDesigner;
                            ((IWorkflowDesignerMessageSink)this.draggedDesigner).OnMouseDragBegin(this.dragInitiationPoint, eventArgs);
                            parentView.Capture = true;
                        }
                    }
                }
            }
            else
            {
                if (this.draggedDesigner != null)
                {
                    ((IWorkflowDesignerMessageSink)this.draggedDesigner).OnMouseDragEnd();
                }
                this.draggedDesigner = null;
            }

            return(this.draggedDesigner != null);
        }
コード例 #10
0
        protected override bool OnMouseDown(MouseEventArgs eventArgs)
        {
            WorkflowView parentView  = base.ParentView;
            Point        clientPoint = new Point(eventArgs.X, eventArgs.Y);

            if (parentView.IsClientPointInActiveLayout(clientPoint) && (eventArgs.Button == MouseButtons.Left))
            {
                this.dragInitiationPoint = parentView.ClientPointToLogical(clientPoint);
                this.dragStarted         = true;
            }
            return(false);
        }
コード例 #11
0
 protected override bool OnMouseUp(MouseEventArgs eventArgs)
 {
     if ((this.designerToResize != null) && (eventArgs.Button == MouseButtons.Left))
     {
         WorkflowView parentView = base.ParentView;
         if (parentView == null)
         {
             throw new InvalidOperationException(DR.GetString("WorkflowViewNull", new object[0]));
         }
         this.UpdateDesignerSize(parentView.ClientPointToLogical(new Point(eventArgs.X, eventArgs.Y)), this.designerToResize, this.designerSizingEdge);
     }
     this.SetResizableDesigner(null, DesignerEdges.None);
     return(false);
 }
コード例 #12
0
        protected override bool OnMouseUp(MouseEventArgs eventArgs)
        {
            if (this.designerToResize != null && eventArgs.Button == MouseButtons.Left)
            {
                WorkflowView workflowView = ParentView;
                if (workflowView == null)
                {
                    throw new InvalidOperationException(DR.GetString(DR.WorkflowViewNull));
                }

                UpdateDesignerSize(workflowView.ClientPointToLogical(new Point(eventArgs.X, eventArgs.Y)), this.designerToResize, this.designerSizingEdge);
            }
            SetResizableDesigner(null, DesignerEdges.None);
            return(false);
        }
コード例 #13
0
        protected override bool OnMouseMove(MouseEventArgs eventArgs)
        {
            WorkflowView parentView  = base.ParentView;
            Point        clientPoint = new Point(eventArgs.X, eventArgs.Y);

            if (!parentView.IsClientPointInActiveLayout(clientPoint))
            {
                return(false);
            }
            if (eventArgs.Button == MouseButtons.Left)
            {
                Point point2 = parentView.ClientPointToLogical(clientPoint);
                System.Workflow.ComponentModel.Design.HitTestInfo messageHitTestContext = base.MessageHitTestContext;
                if (this.draggedDesigner != null)
                {
                    ((IWorkflowDesignerMessageSink)this.draggedDesigner).OnMouseDragMove(eventArgs);
                }
                else if ((((parentView.RootDesigner != null) && this.dragStarted) && ((eventArgs.Button & MouseButtons.Left) > MouseButtons.None)) && ((Math.Abs((int)(this.dragInitiationPoint.X - point2.X)) > SystemInformation.DragSize.Width) || (Math.Abs((int)(this.dragInitiationPoint.Y - point2.Y)) > SystemInformation.DragSize.Height)))
                {
                    ActivityDesigner associatedDesigner = messageHitTestContext.AssociatedDesigner;
                    if (associatedDesigner != null)
                    {
                        if (this.CanInitiateDragDrop())
                        {
                            this.InitiateDragDrop();
                            this.dragStarted = false;
                        }
                        else
                        {
                            this.draggedDesigner = associatedDesigner;
                            ((IWorkflowDesignerMessageSink)this.draggedDesigner).OnMouseDragBegin(this.dragInitiationPoint, eventArgs);
                            parentView.Capture = true;
                        }
                    }
                }
            }
            else
            {
                if (this.draggedDesigner != null)
                {
                    ((IWorkflowDesignerMessageSink)this.draggedDesigner).OnMouseDragEnd();
                }
                this.draggedDesigner = null;
            }
            return(this.draggedDesigner != null);
        }
コード例 #14
0
        protected override bool OnMouseMove(MouseEventArgs eventArgs)
        {
            Point        cursorPoint  = Point.Empty;
            WorkflowView workflowView = ParentView;
            Point        clientPoint  = new Point(eventArgs.X, eventArgs.Y);

            if (workflowView != null && workflowView.IsClientPointInActiveLayout(clientPoint))
            {
                Point logicalPoint = workflowView.ClientPointToLogical(clientPoint);

                if ((eventArgs.Button & MouseButtons.Left) == MouseButtons.Left)
                {
                    //Check if we can start editing a connector
                    if (!EditingInProgress && this.initialDragPoint != null &&
                        (Math.Abs(this.initialDragPoint.Value.X - logicalPoint.X) > SystemInformation.DragSize.Width ||
                         Math.Abs(this.initialDragPoint.Value.Y - logicalPoint.Y) > SystemInformation.DragSize.Height))
                    {
                        BeginEditing(GetConnectorEditor(this.initialDragPoint.Value, this.dragPointHitInfo), this.initialDragPoint.Value);
                    }

                    //If the editing is in progress then pump the messages to the edited connector
                    if (EditingInProgress)
                    {
                        ContinueEditing(logicalPoint);
                        if (SnappedConnectionPoint != null)
                        {
                            logicalPoint = SnappedConnectionPoint.Location;
                        }
                    }
                }
                else
                {
                    //Show the points from where we can start drawing connectors
                    FreeformActivityDesigner connectorContainer = ConnectionManager.GetConnectorContainer(MessageHitTestContext.AssociatedDesigner);
                    ConnectablePoints = (connectorContainer != null && connectorContainer.EnableUserDrawnConnectors) ? GetHighlightableConnectionPoints(logicalPoint, MessageHitTestContext.AssociatedDesigner) : null;
                }

                cursorPoint = logicalPoint;
            }

            bool processedMessage = EditingInProgress;

            processedMessage |= UpdateCursor(cursorPoint);
            return(processedMessage);
        }
コード例 #15
0
        protected override bool OnMouseEnter(MouseEventArgs eventArgs)
        {
            Point        empty       = Point.Empty;
            Point        clientPoint = new Point(eventArgs.X, eventArgs.Y);
            WorkflowView parentView  = base.ParentView;

            if (((parentView != null) && parentView.IsClientPointInActiveLayout(clientPoint)) && !this.EditingInProgress)
            {
                FreeformActivityDesigner connectorContainer = GetConnectorContainer(base.MessageHitTestContext.AssociatedDesigner);
                if ((connectorContainer != null) && connectorContainer.EnableUserDrawnConnectors)
                {
                    Point currentPoint = parentView.ClientPointToLogical(clientPoint);
                    this.ConnectablePoints = GetHighlightableConnectionPoints(currentPoint, base.MessageHitTestContext.AssociatedDesigner);
                    empty = currentPoint;
                }
            }
            return(this.UpdateCursor(new Point?(empty)));
        }
コード例 #16
0
 protected override bool OnMouseDown(MouseEventArgs eventArgs)
 {
     if (eventArgs.Button == MouseButtons.Left)
     {
         WorkflowView parentView = base.ParentView;
         if (parentView == null)
         {
             throw new InvalidOperationException(DR.GetString("WorkflowViewNull", new object[0]));
         }
         Point            clientPoint      = new Point(eventArgs.X, eventArgs.Y);
         Point            point            = parentView.ClientPointToLogical(clientPoint);
         DesignerEdges    none             = DesignerEdges.None;
         ActivityDesigner designerToResize = this.GetDesignerToResize(point, out none);
         if (((designerToResize != null) && (none != DesignerEdges.None)) && this.CanResizeDesigner(designerToResize))
         {
             this.SetResizableDesigner(designerToResize, none);
         }
     }
     return(this.designerToResize != null);
 }
コード例 #17
0
        protected override bool OnMouseUp(MouseEventArgs eventArgs)
        {
            if (!this.dragStarted)
            {
                return(false);
            }
            WorkflowView parentView = base.ParentView;

            if (!this.DragRectangle.IsEmpty)
            {
                parentView.InvalidateLogicalRectangle(this.DragRectangle);
            }
            this.endDrag     = parentView.ClientPointToLogical(new Point(eventArgs.X, eventArgs.Y));
            this.DragStarted = false;
            if (this.DragComplete != null)
            {
                this.DragComplete(this, EventArgs.Empty);
            }
            return(true);
        }
コード例 #18
0
        protected override bool OnMouseDown(MouseEventArgs eventArgs)
        {
            Debug.Assert(this.draggedDesigner == null);
            Debug.Assert(this.dropTargetDesigner == null);

            WorkflowView parentView = ParentView;
            Point clientPoint = new Point(eventArgs.X, eventArgs.Y);

            //If the point is not a valid point on layout then return
            if (!parentView.IsClientPointInActiveLayout(clientPoint))
                return false;

            //Cache the point where the mouse was clicked
            if (eventArgs.Button == MouseButtons.Left)
            {
                this.dragInitiationPoint = parentView.ClientPointToLogical(clientPoint);
                this.dragStarted = true;
            }

            return false;
        }
コード例 #19
0
        protected override bool OnMouseUp(MouseEventArgs eventArgs)
        {
            Point empty             = Point.Empty;
            bool  editingInProgress = this.EditingInProgress;

            if ((eventArgs.Button & MouseButtons.Left) == MouseButtons.Left)
            {
                WorkflowView parentView  = base.ParentView;
                Point        clientPoint = new Point(eventArgs.X, eventArgs.Y);
                if ((parentView != null) && parentView.IsClientPointInActiveLayout(clientPoint))
                {
                    Point point3 = parentView.ClientPointToLogical(clientPoint);
                    if (this.EditingInProgress)
                    {
                        this.EndEditing(new Point?(point3));
                    }
                    empty = point3;
                }
            }
            this.EndEditing(null);
            return(editingInProgress | this.UpdateCursor(new Point?(empty)));
        }
コード例 #20
0
        protected override bool OnMouseEnter(MouseEventArgs eventArgs)
        {
            Point        cursorPoint  = Point.Empty;
            Point        clientPoint  = new Point(eventArgs.X, eventArgs.Y);
            WorkflowView workflowView = ParentView;

            if (workflowView != null && workflowView.IsClientPointInActiveLayout(clientPoint) && !EditingInProgress)
            {
                //Highlight the connection points to indicate where user can start drawing connectors
                FreeformActivityDesigner connectorContainer = ConnectionManager.GetConnectorContainer(MessageHitTestContext.AssociatedDesigner);
                if (connectorContainer != null && connectorContainer.EnableUserDrawnConnectors)
                {
                    Point logicalPoint = workflowView.ClientPointToLogical(clientPoint);
                    ConnectablePoints = GetHighlightableConnectionPoints(logicalPoint, MessageHitTestContext.AssociatedDesigner);
                    cursorPoint       = logicalPoint;
                }
            }

            bool processedMessage = UpdateCursor(cursorPoint);

            return(processedMessage);
        }
コード例 #21
0
        protected override bool OnMouseDown(MouseEventArgs eventArgs)
        {
            if (eventArgs.Button == MouseButtons.Left)
            {
                WorkflowView workflowView = ParentView;
                if (workflowView == null)
                {
                    throw new InvalidOperationException(DR.GetString(DR.WorkflowViewNull));
                }

                Point clientPoint  = new Point(eventArgs.X, eventArgs.Y);
                Point logicalPoint = workflowView.ClientPointToLogical(clientPoint);

                DesignerEdges    sizingEdge = DesignerEdges.None;
                ActivityDesigner designer   = GetDesignerToResize(logicalPoint, out sizingEdge);
                if (designer != null && sizingEdge != DesignerEdges.None && CanResizeDesigner(designer))
                {
                    SetResizableDesigner(designer, sizingEdge);
                }
            }

            return(this.designerToResize != null);
        }
コード例 #22
0
        protected override bool OnMouseMove(MouseEventArgs eventArgs)
        {
            WorkflowView parentView = base.ParentView;
            Point        point      = parentView.ClientPointToLogical(new Point(eventArgs.X, eventArgs.Y));
            float        num        = (2f / ((float)parentView.Zoom)) * 100f;

            if ((!this.dragStarted && ((eventArgs.Button & MouseButtons.Left) > MouseButtons.None)) && ((Math.Abs((int)(this.startDrag.X - point.X)) > ((int)(num * SystemInformation.DragSize.Width))) || (Math.Abs((int)(this.startDrag.Y - point.Y)) > ((int)(num * SystemInformation.DragSize.Height)))))
            {
                this.DragStarted = true;
            }
            if (this.dragStarted)
            {
                if (!this.DragRectangle.IsEmpty)
                {
                    parentView.InvalidateLogicalRectangle(this.DragRectangle);
                }
                this.endDrag = point;
                if (!this.DragRectangle.IsEmpty)
                {
                    parentView.InvalidateLogicalRectangle(this.DragRectangle);
                }
            }
            return(this.dragStarted);
        }