private void UpdateDesignerSize(Point point, ActivityDesigner designerToSize, DesignerEdges sizingEdge) { if (base.ParentView == null) { throw new InvalidOperationException(DR.GetString("WorkflowViewNull", new object[0])); } Rectangle empty = Rectangle.Empty; if (designerToSize.ParentDesigner != null) { empty = designerToSize.ParentDesigner.Bounds; Size selectionSize = WorkflowTheme.CurrentTheme.AmbientTheme.SelectionSize; empty.Inflate(-2 * selectionSize.Width, -2 * selectionSize.Height); } Rectangle bounds = designerToSize.Bounds; if ((sizingEdge & DesignerEdges.Left) > DesignerEdges.None) { int x = point.X; if (!empty.IsEmpty) { x = Math.Max(x, empty.X); } x = DesignerHelpers.SnapToGrid(new Point(x, 0)).X; bounds.Width += bounds.Left - x; int num2 = (bounds.Width < designerToSize.MinimumSize.Width) ? (bounds.Width - designerToSize.MinimumSize.Width) : 0; bounds.X = x + num2; } if ((sizingEdge & DesignerEdges.Top) > DesignerEdges.None) { int y = point.Y; if (!empty.IsEmpty) { y = Math.Max(y, empty.Y); } y = DesignerHelpers.SnapToGrid(new Point(0, y)).Y; bounds.Height += bounds.Top - y; int num4 = (bounds.Height < designerToSize.MinimumSize.Height) ? (bounds.Height - designerToSize.MinimumSize.Height) : 0; bounds.Y = y + num4; } if ((sizingEdge & DesignerEdges.Right) > DesignerEdges.None) { bounds.Width += point.X - bounds.Right; } if ((sizingEdge & DesignerEdges.Bottom) > DesignerEdges.None) { bounds.Height += point.Y - bounds.Bottom; } bounds.Width = Math.Max(bounds.Width, designerToSize.MinimumSize.Width); bounds.Height = Math.Max(bounds.Height, designerToSize.MinimumSize.Height); if (!empty.IsEmpty) { bounds = Rectangle.Intersect(bounds, empty); } ((IWorkflowDesignerMessageSink)designerToSize).OnResizing(sizingEdge, bounds); }
protected override void OnThemeChange(ActivityDesignerTheme newTheme) { base.OnThemeChange(newTheme); if (WorkflowTheme.CurrentTheme.AmbientTheme.ShowGrid) { foreach (ActivityDesigner designer in this.ContainedDesigners) { designer.Location = DesignerHelpers.SnapToGrid(designer.Location); } base.PerformLayout(); } }
internal static Point[] GetDesignerLocations(Point startPoint, Point endPoint, ICollection <Activity> activitiesToMove) { List <Point> list = new List <Point>(); foreach (Activity activity in activitiesToMove) { Point location = endPoint; ActivityDesigner designer = ActivityDesigner.GetDesigner(activity); if ((designer != null) && !startPoint.IsEmpty) { Size size = new Size(endPoint.X - startPoint.X, endPoint.Y - startPoint.Y); location = new Point(designer.Location.X + size.Width, designer.Location.Y + size.Height); } location = DesignerHelpers.SnapToGrid(location); list.Add(location); } return(list.ToArray()); }
internal static Point[] GetDesignerLocations(Point startPoint, Point endPoint, ICollection <Activity> activitiesToMove) { List <Point> locations = new List <Point>(); //We move all the designers foreach (Activity activityToMove in activitiesToMove) { Point location = endPoint; ActivityDesigner designerToMove = ActivityDesigner.GetDesigner(activityToMove); if (designerToMove != null && !startPoint.IsEmpty) { Size delta = new Size(endPoint.X - startPoint.X, endPoint.Y - startPoint.Y); location = new Point(designerToMove.Location.X + delta.Width, designerToMove.Location.Y + delta.Height); } location = DesignerHelpers.SnapToGrid(location); locations.Add(location); } return(locations.ToArray()); }
private void UpdateDesignerSize(Point point, ActivityDesigner designerToSize, DesignerEdges sizingEdge) { WorkflowView workflowView = ParentView; if (workflowView == null) { throw new InvalidOperationException(DR.GetString(DR.WorkflowViewNull)); } Rectangle clipBounds = Rectangle.Empty; if (designerToSize.ParentDesigner != null) { clipBounds = designerToSize.ParentDesigner.Bounds; Size selectionSize = WorkflowTheme.CurrentTheme.AmbientTheme.SelectionSize; clipBounds.Inflate(-2 * selectionSize.Width, -2 * selectionSize.Height); } Rectangle designerBounds = designerToSize.Bounds; if ((sizingEdge & DesignerEdges.Left) > 0) { int x = point.X; if (!clipBounds.IsEmpty) { x = Math.Max(x, clipBounds.X); } x = DesignerHelpers.SnapToGrid(new Point(x, 0)).X; designerBounds.Width += (designerBounds.Left - x); int delta = (designerBounds.Width < designerToSize.MinimumSize.Width) ? designerBounds.Width - designerToSize.MinimumSize.Width : 0; designerBounds.X = x + delta; } if ((sizingEdge & DesignerEdges.Top) > 0) { int y = point.Y; if (!clipBounds.IsEmpty) { y = Math.Max(y, clipBounds.Y); } y = DesignerHelpers.SnapToGrid(new Point(0, y)).Y; designerBounds.Height += (designerBounds.Top - y); int delta = (designerBounds.Height < designerToSize.MinimumSize.Height) ? designerBounds.Height - designerToSize.MinimumSize.Height : 0; designerBounds.Y = y + delta; } if ((sizingEdge & DesignerEdges.Right) > 0) { designerBounds.Width += (point.X - designerBounds.Right); } if ((sizingEdge & DesignerEdges.Bottom) > 0) { designerBounds.Height += (point.Y - designerBounds.Bottom); } //Clip to lower bounds and upper bounds designerBounds.Width = Math.Max(designerBounds.Width, designerToSize.MinimumSize.Width); designerBounds.Height = Math.Max(designerBounds.Height, designerToSize.MinimumSize.Height); if (!clipBounds.IsEmpty) { designerBounds = Rectangle.Intersect(designerBounds, clipBounds); } ((IWorkflowDesignerMessageSink)designerToSize).OnResizing(sizingEdge, designerBounds); }