Imported Upstream version 4.6.0.125

Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2016-08-03 10:59:49 +00:00
parent a569aebcfd
commit e79aa3c0ed
17047 changed files with 3137615 additions and 392334 deletions

View File

@@ -0,0 +1,60 @@
namespace System.Workflow.ComponentModel.Design
{
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
#region Glyphs
#region Class CommentGlyph
//Class is internal but not sealed as we dont expect the ActivityDesigner writers to supply their own
//Glyph instead based on comment property comment glyph is shown
//Exception: StripItemCommentGlyph
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
public class CommentGlyph : DesignerGlyph
{
private static CommentGlyph defaultCommentGlyph = null;
internal static CommentGlyph Default
{
get
{
if (CommentGlyph.defaultCommentGlyph == null)
CommentGlyph.defaultCommentGlyph = new CommentGlyph();
return CommentGlyph.defaultCommentGlyph;
}
}
public override Rectangle GetBounds(ActivityDesigner designer, bool activated)
{
if (designer == null)
throw new ArgumentNullException("designer");
Rectangle bounds = designer.Bounds;
bounds.Inflate(WorkflowTheme.CurrentTheme.AmbientTheme.Margin);
return bounds;
}
public override int Priority
{
get
{
return DesignerGlyph.CommentPriority;
}
}
protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer)
{
Rectangle bounds = GetBounds(designer, activated);
graphics.FillRectangle(AmbientTheme.FadeBrush, bounds);
graphics.FillRectangle(ambientTheme.CommentIndicatorBrush, bounds);
graphics.DrawRectangle(ambientTheme.CommentIndicatorPen, bounds);
}
}
#endregion
#endregion
}

View File

@@ -0,0 +1,125 @@
namespace System.Workflow.ComponentModel.Design
{
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
#region Glyphs
#region Class ConfigErrorGlyph
//Class is internal but not sealed as we dont expect the ActivityDesigner writers to supply their own
//Glyph instead based on designer actions the smart tag will be shown
//Exception: StripItemConfigErrorGlyph
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
public class ConfigErrorGlyph : DesignerGlyph
{
private static ConfigErrorGlyph defaultConfigErrorGlyph = null;
internal static ConfigErrorGlyph Default
{
get
{
if (defaultConfigErrorGlyph == null)
defaultConfigErrorGlyph = new ConfigErrorGlyph();
return defaultConfigErrorGlyph;
}
}
public override bool CanBeActivated
{
get
{
return true;
}
}
public override int Priority
{
get
{
return DesignerGlyph.ConfigErrorPriority;
}
}
public override Rectangle GetBounds(ActivityDesigner designer, bool activated)
{
if (designer == null)
throw new ArgumentNullException("designer");
Size configErrorSize = WorkflowTheme.CurrentTheme.AmbientTheme.GlyphSize;
Size margin = WorkflowTheme.CurrentTheme.AmbientTheme.Margin;
Point configErrorLocation = new Point(designer.Bounds.Right - configErrorSize.Width - margin.Width / 2, designer.Bounds.Top - configErrorSize.Height + margin.Height);
Rectangle bounds = new Rectangle(configErrorLocation, configErrorSize);
if (activated)
{
bounds.Width *= 2;
AmbientTheme ambientTheme = WorkflowTheme.CurrentTheme.AmbientTheme;
bounds.Inflate(ambientTheme.Margin.Width / 2, ambientTheme.Margin.Height / 2);
}
return bounds;
}
protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer)
{
Rectangle bounds = GetBounds(designer, false);
Rectangle activatedBounds = GetBounds(designer, activated);
Region clipRegion = null;
Region oldClipRegion = graphics.Clip;
try
{
if (oldClipRegion != null)
{
clipRegion = oldClipRegion.Clone();
if (activated)
clipRegion.Union(activatedBounds);
graphics.Clip = clipRegion;
}
if (activated)
{
graphics.FillRectangle(SystemBrushes.ButtonFace, activatedBounds);
graphics.DrawRectangle(SystemPens.ControlDarkDark, activatedBounds.Left, activatedBounds.Top, activatedBounds.Width - 1, activatedBounds.Height - 1);
activatedBounds.X += bounds.Width + ambientTheme.Margin.Width;
activatedBounds.Width -= (bounds.Width + 2 * ambientTheme.Margin.Width);
using (GraphicsPath dropDownIndicator = ActivityDesignerPaint.GetScrollIndicatorPath(activatedBounds, ScrollButton.Down))
{
graphics.FillPath(SystemBrushes.ControlText, dropDownIndicator);
graphics.DrawPath(SystemPens.ControlText, dropDownIndicator);
}
}
ActivityDesignerPaint.DrawImage(graphics, AmbientTheme.ConfigErrorImage, bounds, DesignerContentAlignment.Fill);
}
finally
{
if (clipRegion != null)
{
graphics.Clip = oldClipRegion;
clipRegion.Dispose();
}
}
}
protected override void OnActivate(ActivityDesigner designer)
{
if (designer != null)
{
if (designer.DesignerActions.Count > 0)
{
Rectangle bounds = GetBounds(designer, false);
Point location = designer.ParentView.LogicalPointToScreen(new Point(bounds.Left, bounds.Bottom));
DesignerHelpers.ShowDesignerVerbs(designer, location, DesignerHelpers.GetDesignerActionVerbs(designer, designer.DesignerActions));
}
}
}
}
#endregion
#endregion
}

View File

@@ -0,0 +1,47 @@
namespace System.Workflow.ComponentModel.Design
{
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
#region Glyphs
#region Class ConnectionPointGlyph
internal sealed class ConnectionPointGlyph : DesignerGlyph
{
private ConnectionPoint connectionPoint;
internal ConnectionPointGlyph(ConnectionPoint connectionPoint)
{
this.connectionPoint = connectionPoint;
}
protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer)
{
if (designer.Activity != null && designer.Activity.Site != null && this.connectionPoint != null)
{
WorkflowView workflowView = designer.Activity.Site.GetService(typeof(WorkflowView)) as WorkflowView;
Rectangle viewPort = (workflowView != null) ? workflowView.ViewPortRectangle : Rectangle.Empty;
Rectangle clipRectangle = (designer.ParentDesigner != null) ? designer.ParentDesigner.Bounds : designer.Bounds;
ConnectionManager connectionManager = designer.Activity.Site.GetService(typeof(ConnectionManager)) as ConnectionManager;
ActivityDesignerPaintEventArgs e = new ActivityDesignerPaintEventArgs(graphics, clipRectangle, viewPort, designer.DesignerTheme);
bool drawHilited = (connectionManager != null && this.connectionPoint.Equals(connectionManager.SnappedConnectionPoint));
this.connectionPoint.OnPaint(e, drawHilited);
}
}
public override int Priority
{
get
{
return DesignerGlyph.ConnectionPointPriority;
}
}
}
#endregion
#endregion
}

View File

@@ -0,0 +1,46 @@
namespace System.Workflow.ComponentModel.Design
{
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
#region Glyphs
#region Class ConnectorDragDropGlyph
internal sealed class ConnectorDragDropGlyph : DesignerGlyph
{
private int connectorIndex = 0;
private Point glyphPoint = Point.Empty;
public ConnectorDragDropGlyph(int connectorIndex, Point connectorCenter)
{
this.connectorIndex = connectorIndex;
AmbientTheme ambientTheme = WorkflowTheme.CurrentTheme.AmbientTheme;
this.glyphPoint = new Point(connectorCenter.X - ambientTheme.DropIndicatorSize.Width / 2, connectorCenter.Y - ambientTheme.DropIndicatorSize.Height / 2);
}
public override Rectangle GetBounds(ActivityDesigner designer, bool activated)
{
return new Rectangle(this.glyphPoint, WorkflowTheme.CurrentTheme.AmbientTheme.DropIndicatorSize);
}
protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer)
{
ActivityDesignerPaint.DrawImage(graphics, AmbientTheme.DropIndicatorImage, GetBounds(designer, activated), DesignerContentAlignment.Fill);
}
public override int Priority
{
get
{
return DesignerGlyph.ConnectorDragDropPriority;
}
}
}
#endregion
#endregion
}

View File

@@ -0,0 +1,30 @@
namespace System.Workflow.ComponentModel.Design
{
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
#region Glyphs
#region Class ConnectorSelectionGlyph
//
internal abstract class ConnectorSelectionGlyph : SelectionGlyph
{
protected int connectorIndex = 0;
protected bool isPrimarySelectionGlyph = true;
public ConnectorSelectionGlyph(int connectorIndex, bool isPrimarySelectionGlyph)
{
this.connectorIndex = connectorIndex;
this.isPrimarySelectionGlyph = isPrimarySelectionGlyph;
}
}
#endregion
#endregion
}

View File

@@ -0,0 +1,63 @@
namespace System.Workflow.ComponentModel.Design
{
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
#region Glyphs
#region Class LockedActivityGlyph
//Class is internal but not sealed as we dont expect the ActivityDesigner writers to supply their own
//Glyph instead based on comment property comment glyph is shown
//Exception: StripItemCommentGlyph
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
public class LockedActivityGlyph : DesignerGlyph
{
private static LockedActivityGlyph defaultLockedGlyph = null;
internal static LockedActivityGlyph Default
{
get
{
if (LockedActivityGlyph.defaultLockedGlyph == null)
LockedActivityGlyph.defaultLockedGlyph = new LockedActivityGlyph();
return LockedActivityGlyph.defaultLockedGlyph;
}
}
public LockedActivityGlyph()
{
}
public override Rectangle GetBounds(ActivityDesigner designer, bool activated)
{
if (designer == null)
throw new ArgumentNullException("designer");
Rectangle bounds = designer.Bounds;
bounds.Inflate(WorkflowTheme.CurrentTheme.AmbientTheme.Margin);
return bounds;
}
public override int Priority
{
get
{
return DesignerGlyph.LockedGlyphPriority;
}
}
protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer)
{
Rectangle bounds = GetBounds(designer, activated);
bounds.Inflate(WorkflowTheme.CurrentTheme.AmbientTheme.Margin);
ActivityDesignerPaint.DrawImage(graphics, AmbientTheme.LockImage, bounds, DesignerContentAlignment.TopLeft);
}
}
#endregion
#endregion
}

View File

@@ -0,0 +1,39 @@
namespace System.Workflow.ComponentModel.Design
{
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
#region Glyphs
#region Class NonPrimarySelectionGlyph
internal sealed class NonPrimarySelectionGlyph : SelectionGlyph
{
private static NonPrimarySelectionGlyph defaultNonPrimarySelectionGlyph = null;
internal static NonPrimarySelectionGlyph Default
{
get
{
if (defaultNonPrimarySelectionGlyph == null)
defaultNonPrimarySelectionGlyph = new NonPrimarySelectionGlyph();
return defaultNonPrimarySelectionGlyph;
}
}
public override bool IsPrimarySelection
{
get
{
return false;
}
}
}
#endregion
#endregion
}

View File

@@ -0,0 +1,39 @@
namespace System.Workflow.ComponentModel.Design
{
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
#region Glyphs
#region Class PrimarySelectionGlyph
internal sealed class PrimarySelectionGlyph : SelectionGlyph
{
private static PrimarySelectionGlyph defaultPrimarySelectionGlyph = null;
internal static PrimarySelectionGlyph Default
{
get
{
if (defaultPrimarySelectionGlyph == null)
defaultPrimarySelectionGlyph = new PrimarySelectionGlyph();
return defaultPrimarySelectionGlyph;
}
}
public override bool IsPrimarySelection
{
get
{
return true;
}
}
}
#endregion
#endregion
}

View File

@@ -0,0 +1,48 @@
namespace System.Workflow.ComponentModel.Design
{
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
#region Glyphs
#region Class ReadOnlyActivityGlyph
//Class is internal but not sealed as we dont expect the ActivityDesigner writers to supply their own
//Glyph instead based on comment property comment glyph is shown
//Exception: StripItemCommentGlyph
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
public class ReadOnlyActivityGlyph : DesignerGlyph
{
public override Rectangle GetBounds(ActivityDesigner designer, bool activated)
{
if (designer == null)
throw new ArgumentNullException("designer");
Rectangle bounds = designer.Bounds;
bounds.Inflate(WorkflowTheme.CurrentTheme.AmbientTheme.Margin);
return bounds;
}
public override int Priority
{
get
{
return DesignerGlyph.ReadOnlyGlyphPriority;
}
}
protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer)
{
Rectangle bounds = GetBounds(designer, activated);
bounds.Inflate(WorkflowTheme.CurrentTheme.AmbientTheme.Margin);
ActivityDesignerPaint.DrawImage(graphics, AmbientTheme.ReadOnlyImage, bounds, DesignerContentAlignment.TopLeft);
}
}
#endregion
#endregion
}

View File

@@ -0,0 +1,79 @@
namespace System.Workflow.ComponentModel.Design
{
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
#region Glyphs
#region Class SelectionGlyph
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
public abstract class SelectionGlyph : DesignerGlyph
{
public override Rectangle GetBounds(ActivityDesigner designer, bool activated)
{
if (designer == null)
throw new ArgumentNullException("designer");
Rectangle rectangle = designer.Bounds;
rectangle.Inflate(WorkflowTheme.CurrentTheme.AmbientTheme.SelectionSize.Width / 2, WorkflowTheme.CurrentTheme.AmbientTheme.SelectionSize.Height / 2);
return rectangle;
}
protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer)
{
ActivityDesignerPaint.DrawSelection(graphics, GetBounds(designer, activated), IsPrimarySelection, WorkflowTheme.CurrentTheme.AmbientTheme.SelectionSize, GetGrabHandles(designer));
}
public override int Priority
{
get
{
return DesignerGlyph.SelectionPriority;
}
}
public abstract bool IsPrimarySelection { get; }
public virtual Rectangle[] GetGrabHandles(ActivityDesigner designer)
{
Size selectionSize = WorkflowTheme.CurrentTheme.AmbientTheme.SelectionSize;
Size grabHandleSize = new Size(selectionSize.Width, selectionSize.Height);
Rectangle selectionRect = GetBounds(designer, false);
selectionRect.Inflate(selectionSize.Width, selectionSize.Height);
//we need grab handles only in case this activity is an immediate child of a free-form activity
//otherwise, no grab handles
ActivityDesigner parentDesigner = designer.ParentDesigner;
Rectangle[] grabHandles = null;
if (parentDesigner != null && parentDesigner is FreeformActivityDesigner)
{
grabHandles = new Rectangle[8];
grabHandles[0] = new Rectangle(selectionRect.Location, grabHandleSize);
grabHandles[1] = new Rectangle(new Point(selectionRect.Left + (selectionRect.Width - grabHandleSize.Width) / 2, selectionRect.Top), grabHandleSize);
grabHandles[2] = new Rectangle(selectionRect.Right - grabHandleSize.Width, selectionRect.Top, grabHandleSize.Width, grabHandleSize.Height);
grabHandles[3] = new Rectangle(new Point(selectionRect.Right - grabHandleSize.Width, selectionRect.Top + (selectionRect.Height - grabHandleSize.Height) / 2), grabHandleSize);
grabHandles[4] = new Rectangle(selectionRect.Right - grabHandleSize.Width, selectionRect.Bottom - grabHandleSize.Height, grabHandleSize.Width, grabHandleSize.Height);
grabHandles[5] = new Rectangle(new Point(selectionRect.Left + (selectionRect.Width - grabHandleSize.Width) / 2, selectionRect.Bottom - grabHandleSize.Height), grabHandleSize);
grabHandles[6] = new Rectangle(selectionRect.Left, selectionRect.Bottom - grabHandleSize.Height, grabHandleSize.Width, grabHandleSize.Height);
grabHandles[7] = new Rectangle(new Point(selectionRect.Left, selectionRect.Top + (selectionRect.Height - grabHandleSize.Height) / 2), grabHandleSize);
return grabHandles;
}
else
{
grabHandles = new Rectangle[1];
grabHandles[0] = new Rectangle(selectionRect.Location, grabHandleSize);
}
return grabHandles;
}
}
#endregion
#endregion
}

View File

@@ -0,0 +1,58 @@
namespace System.Workflow.ComponentModel.Design
{
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
#region Glyphs
#region Class ShadowGlyph
[Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
public sealed class ShadowGlyph : DesignerGlyph
{
private static ShadowGlyph defaultShadowGlyph = null;
internal static ShadowGlyph Default
{
get
{
if (defaultShadowGlyph == null)
defaultShadowGlyph = new ShadowGlyph();
return defaultShadowGlyph;
}
}
public override Rectangle GetBounds(ActivityDesigner designer, bool activated)
{
if (designer == null)
throw new ArgumentNullException("designer");
Rectangle bounds = designer.Bounds;
bounds.Inflate(AmbientTheme.DropShadowWidth + 1, AmbientTheme.DropShadowWidth + 1);
return bounds;
}
protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer)
{
Rectangle bounds = GetBounds(designer, activated);
if (!bounds.Size.IsEmpty)
{
bool drawRounded = (designer.DesignerTheme.DesignerGeometry == DesignerGeometry.RoundedRectangle && !designer.IsRootDesigner);
ActivityDesignerPaint.DrawDropShadow(graphics, designer.Bounds, designer.DesignerTheme.BorderPen.Color, AmbientTheme.DropShadowWidth, LightSourcePosition.Left | LightSourcePosition.Top, 0.5f, drawRounded);
}
}
public override int Priority
{
get
{
return DesignerGlyph.LowestPriority;
}
}
}
#endregion
#endregion
}