Browse Source

Add ClassDiagram AddIn by Itai Bar-Haim.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2204 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 19 years ago
parent
commit
1092a4033b
  1. 22
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/AssemblyInfo.cs
  2. 490
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/CanvasItem.cs
  3. 91
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/ClassCanvas.Designer.cs
  4. 171
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/ClassCanvas.cd
  5. 598
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/ClassCanvas.cs
  6. 108
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/ClassCanvas.csproj
  7. 120
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/ClassCanvas.resx
  8. 573
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/ClassCanvasItem.cs
  9. 55
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Decorators/FocusDecorator.cs
  10. 249
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Decorators/SizeGripDecorator.cs
  11. 64
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/DelegateCanvasItem.cs
  12. 47
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/EnumCanvasItem.cs
  13. 29
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/IHitTestable.cs
  14. 19
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/IInteractiveDrawable.cs
  15. 81
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/IMouseInteractable.cs
  16. 111
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/InteractiveHeaderedItem.cs
  17. 38
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/InterfaceCanvasItem.cs
  18. 92
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/NoteCanvasItem.cs
  19. 73
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/RectangleDecorator.cs
  20. 95
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Shapes/CollapseExpandShape.cs
  21. 78
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Shapes/CollapseShape.cs
  22. 68
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Shapes/EventShape.cs
  23. 30
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Shapes/ExpandShape.cs
  24. 35
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Shapes/FieldShape.cs
  25. 61
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Shapes/InheritanceShape.cs
  26. 69
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Shapes/MethodShape.cs
  27. 31
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Shapes/MinusShape.cs
  28. 44
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Shapes/PlusShape.cs
  29. 80
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Shapes/PropertyShape.cs
  30. 47
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Shapes/RouteInheritanceShape.cs
  31. 69
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Shapes/RouteShape.cs
  32. 34
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Shapes/Shapes.cs
  33. 31
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Shapes/SmallButtonShape.cs
  34. 29
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Shapes/SmallIconShape.cs
  35. 78
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Shapes/VectorShape.cs
  36. 34
      src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/StructCanvasItem.cs
  37. 120
      src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin.sln
  38. 151
      src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/ClassDiagramAddin.addin
  39. 63
      src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/ClassDiagramAddin.cd
  40. 104
      src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/ClassDiagramAddin.csproj
  41. 22
      src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/Configuration/AssemblyInfo.cs
  42. BIN
      src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/Resources/Bitmaps.resources
  43. 73
      src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/Src/ClassDiagramAddItemCommands.cs
  44. 121
      src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/Src/ClassDiagramCommand.cs
  45. 46
      src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/Src/ClassDiagramDisplayBinding.cs
  46. 182
      src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/Src/ClassDiagramViewContent.cs
  47. 82
      src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/Src/ClassEditorPad.cs
  48. 36
      src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/Src/SaveToBitmapCommand.cs
  49. 64
      src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/Src/ShowClassDiagramCommand.cs
  50. 38
      src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramApp/AssemblyInfo.cs
  51. 70
      src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramApp/ClassDiagramApp.csproj
  52. 310
      src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramApp/MainForm.Designer.cs
  53. 185
      src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramApp/MainForm.cs
  54. 126
      src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramApp/MainForm.resx
  55. 22
      src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/AssemblyInfo.cs
  56. 50
      src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/ClassEditor.Designer.cs
  57. 302
      src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/ClassEditor.cs
  58. 74
      src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/ClassEditor.csproj
  59. 157
      src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/ClassEditor.resx
  60. 55
      src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/MembersList.cs
  61. BIN
      src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/closebrace.bmp
  62. BIN
      src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/comma.bmp
  63. BIN
      src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/emptybraces.bmp
  64. BIN
      src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/openbrace.bmp
  65. 22
      src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/AssemblyInfo.cs
  66. 185
      src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/BaseRectangle.cs
  67. 126
      src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/DependencyTree.cs
  68. 81
      src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/DependencyTreeNode.cs
  69. 269
      src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/DiagramRouter.cs
  70. 56
      src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/Diagrams.csproj
  71. 15
      src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/Direction.cs
  72. 35
      src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/Drawables/DrawableItemsStack.cs
  73. 83
      src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/Drawables/DrawableRectangle.cs
  74. 166
      src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/Drawables/HeaderedItem.cs
  75. 17
      src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/Drawables/IDrawable.cs
  76. 17
      src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/Drawables/IDrawableRectangle.cs
  77. 126
      src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/Drawables/TextSegment.cs
  78. 118
      src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/IRectangle.cs
  79. 410
      src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/ItemsStack.cs
  80. 294
      src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/Route.cs
  81. 99
      src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/RouteSegment.cs
  82. 17
      src/Setup/Files.wxs
  83. 2
      src/Setup/Setup.wxs
  84. 35
      src/SharpDevelop.sln

22
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/AssemblyInfo.cs

@ -0,0 +1,22 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Information about this assembly is defined by the following
// attributes.
//
// change them to the information which is associated with the assembly
// you compile.
[assembly: AssemblyTitle("ClassCanvas")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

490
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/CanvasItem.cs

@ -0,0 +1,490 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml;
using System.Xml.XPath;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Project;
using System.Globalization;
using Tools.Diagrams;
namespace ClassDiagram
{
public class ValueChangedEventArgs<T> : EventArgs
{
private T val;
public ValueChangedEventArgs (T value)
{
this.val = value;
}
public virtual T Value
{
get { return val; }
set { throw new InvalidOperationException("Cannot set the value of an event that type of event."); }
}
protected void SetValue (T value)
{
val = value;
}
}
public class ValueChangingEventArgs<T> : ValueChangedEventArgs<T>
{
bool cancel;
public ValueChangingEventArgs (T value) : base (value) {}
public override T Value
{
set { base.SetValue(value); }
}
public bool Cancel
{
get { return cancel; }
set { cancel = value; }
}
}
public abstract class CanvasItem : IInteractiveDrawable, IRectangle
{
#region Constructors
protected CanvasItem ()
{
Bitmap bitmap = new Bitmap(1, 1);
this.g = Graphics.FromImage(bitmap);
}
#endregion
public virtual bool IsHResizable
{
get { return true; }
}
public virtual bool IsVResizable
{
get { return true; }
}
#region Layout Events
bool dontHandleLayoutChanges;
bool layoutChangesOccured;
public event EventHandler LayoutChanged = delegate {};
public event EventHandler RedrawNeeded = delegate {};
protected bool HoldLayoutChanges
{
get { return dontHandleLayoutChanges; }
set
{
dontHandleLayoutChanges = value;
if (layoutChangesOccured && !value)
EmitLayoutUpdate();
}
}
protected void EmitLayoutUpdate()
{
if (HoldLayoutChanges)
{
layoutChangesOccured = true;
return;
}
LayoutChanged(this, EventArgs.Empty);
}
protected void EmitRedrawNeeded()
{
RedrawNeeded(this, EventArgs.Empty);
}
#endregion
#region Geometry
private float x, y, w, h;
#region Geometry related events
public event EventHandler<ValueChangingEventArgs<PointF>> PositionChanging = delegate { };
public event EventHandler<ValueChangedEventArgs<PointF>> PositionChanged = delegate { };
public event EventHandler<ValueChangingEventArgs<SizeF>> SizeChanging = delegate { };
public event EventHandler<ValueChangedEventArgs<SizeF>> SizeChanged = delegate { };
#endregion
#region Geometry related methods
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
public void Move (float x, float y)
{
ValueChangingEventArgs<PointF> e = new ValueChangingEventArgs<PointF>(new PointF(x, y));
PositionChanging (this, e);
if (e.Cancel) return;
if (AllowXModifications())
this.x = e.Value.X;
else
this.x = x;
if (AllowYModifications())
this.y = e.Value.Y;
else
this.y = y;
PositionChanged (this, new ValueChangedEventArgs<PointF> (new PointF(this.x, this.y)));
EmitLayoutUpdate();
}
public void Resize (float width, float height)
{
ValueChangingEventArgs<SizeF> e = new ValueChangingEventArgs<SizeF>(new SizeF(width, height));
SizeChanging (this, e);
if (e.Cancel) return;
if (AllowWidthModifications())
this.w = e.Value.Width;
else
this.w = width;
if (AllowHeightModifications())
this.h = e.Value.Height;
else
this.h = height;
SizeChanged (this, new ValueChangedEventArgs<SizeF> (new SizeF(this.w, this.h)));
EmitLayoutUpdate();
}
#endregion
#region Geometry related properties
#region IRectangle implementation
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "X")]
public virtual float X
{
get { return x; }
set { Move(value, y); }
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Y")]
public virtual float Y
{
get { return y; }
set { Move(x, value); }
}
public virtual float AbsoluteX
{
get { return x; }
}
public virtual float AbsoluteY
{
get { return y; }
}
public virtual float Width
{
get { return w; }
set { Resize (value, h); WidthChanged(this, EventArgs.Empty); }
}
public virtual float Height
{
get { return h; }
set { Resize (w, value); HeightChanged(this, EventArgs.Empty); }
}
public virtual float ActualWidth
{
get { return Width; }
set { Width = value; ActualWidthChanged(this, EventArgs.Empty); }
}
public virtual float ActualHeight
{
get { return Height; }
set { Height = value; ActualHeightChanged(this, EventArgs.Empty); }
}
public virtual float Border
{
get { return 0; }
set { }
}
public virtual float Padding
{
get { return 0; }
set { }
}
public virtual IRectangle Container
{
get { return null; }
set {}
}
#endregion
#region Geometry Controllers
protected virtual bool AllowXModifications ()
{
return true;
}
protected virtual bool AllowYModifications ()
{
return true;
}
protected virtual bool AllowWidthModifications ()
{
return true;
}
protected virtual bool AllowHeightModifications ()
{
return true;
}
#endregion
#endregion
#endregion
#region Graphics
Graphics g;
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
public static readonly Brush ShadowBrush = new SolidBrush(Color.FromArgb(64,0,0,0));
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
public static readonly Font MemberFont = new Font (FontFamily.GenericSansSerif, 11, FontStyle.Regular, GraphicsUnit.Pixel);
/// <summary>
/// Draws the item decorators to the given graphics object.
/// Inheriters of this class should override this method and call the base implementation
/// at the end of their implementation, or call DrawDecorators instead.
/// </summary>
/// <param name="graphics"></param>
public virtual void DrawToGraphics (Graphics graphics)
{
DrawDecorators(graphics);
}
/// <summary>
/// Returns an initialized <see cref="System.Drawing.Graphics">System.Drawing.Graphics</see>
/// object, that should ONLY be used where a Graphics object is needed for initialization
/// of other objects, like to create a font for text measurment.
/// </summary>
protected Graphics Graphics // TODO - try to abandon this
{
get { return g; }
}
#endregion
#region Decorators
List <RectangleDecorator> decorators = new List<RectangleDecorator>();
public void AddDecorator (RectangleDecorator decorator)
{
decorators.Add(decorator);
decorator.RedrawNeeded += HandleDecoratorRedrawRequest;
}
public void RemoveDecorator (RectangleDecorator decorator)
{
decorator.RedrawNeeded -= HandleDecoratorRedrawRequest;
decorators.Remove(decorator);
}
protected void DrawDecorators (Graphics graphics)
{
foreach (RectangleDecorator decorator in decorators)
{
if (decorator.Active)
decorator.DrawToGraphics(graphics);
}
}
#endregion
#region Mouse Events
#region Dragging Variables
private PointF dragPos = new Point(0, 0);
private PointF dragOfst = new Point(0, 0);
private bool dragged;
#endregion
public virtual void HandleMouseClick (PointF pos)
{
foreach (RectangleDecorator decorator in decorators)
{
if (decorator.Active)
decorator.HandleMouseClick(pos);
}
}
public virtual void HandleMouseDown (PointF pos)
{
foreach (RectangleDecorator decorator in decorators)
{
if (decorator.Active)
decorator.HandleMouseDown(pos);
}
bool hit = HitTest(pos);
if (DragAreaHitTest(pos))
{
dragPos = pos;
dragOfst.X = X - dragPos.X;
dragOfst.Y = Y - dragPos.Y;
dragged = true;
}
}
public virtual void HandleMouseMove (PointF pos)
{
foreach (RectangleDecorator decorator in decorators)
{
if (decorator.Active)
decorator.HandleMouseMove(pos);
}
if (dragged)
{
Move (dragOfst.X + pos.X, dragOfst.Y + pos.Y);
}
}
public virtual void HandleMouseUp (PointF pos)
{
foreach (RectangleDecorator decorator in decorators)
{
if (decorator.Active)
decorator.HandleMouseUp(pos);
}
dragged = false;
}
public virtual void HandleMouseLeave ()
{
foreach (RectangleDecorator decorator in decorators)
{
if (decorator.Active)
decorator.HandleMouseLeave();
}
}
#endregion
private void HandleDecoratorRedrawRequest (object sender, EventArgs args)
{
EmitRedrawNeeded();
}
#region User Interaction
public virtual bool HitTest(PointF pos)
{
bool ret = (pos.X > X && pos.Y > Y && pos.X < X + ActualWidth && pos.Y < Y + ActualHeight);
foreach (RectangleDecorator decorator in decorators)
{
if (decorator.Active)
ret |= decorator.HitTest(pos);
}
return ret;
}
protected virtual bool DragAreaHitTest(PointF pos)
{
return (pos.X > X && pos.Y > Y && pos.X < X + ActualWidth && pos.Y < Y + ActualHeight);
}
#endregion
public virtual float GetAbsoluteContentWidth()
{
throw new NotImplementedException();
}
public virtual float GetAbsoluteContentHeight()
{
throw new NotImplementedException();
}
#region Storage
protected virtual XmlElement CreateXmlElement(XmlDocument doc)
{
return doc.CreateElement("CanvasItem");
}
protected virtual void FillXmlElement (XmlElement element, XmlDocument document)
{
element.SetAttribute("X", X.ToString(CultureInfo.InvariantCulture));
element.SetAttribute("Y", Y.ToString(CultureInfo.InvariantCulture));
element.SetAttribute("Width", Width.ToString(CultureInfo.InvariantCulture));
}
public virtual void WriteToXml(XmlDocument document)
{
XmlElement elem = CreateXmlElement(document);
FillXmlElement (elem, document);
document.DocumentElement.AppendChild(elem);
}
public virtual void LoadFromXml (XPathNavigator navigator)
{
X = float.Parse(navigator.GetAttribute("X", ""), CultureInfo.InvariantCulture);
Y = float.Parse(navigator.GetAttribute("Y", ""), CultureInfo.InvariantCulture);
Width = float.Parse(navigator.GetAttribute("Width", ""), CultureInfo.InvariantCulture);
}
#endregion
public bool KeepAspectRatio
{
get { return false; }
set {}
}
public event EventHandler WidthChanged = delegate {};
public event EventHandler HeightChanged = delegate {};
public event EventHandler ActualWidthChanged = delegate {};
public event EventHandler ActualHeightChanged = delegate {};
}
}

91
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/ClassCanvas.Designer.cs generated

@ -0,0 +1,91 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
namespace ClassDiagram
{
partial class ClassCanvas : System.Windows.Forms.UserControl
{
/// <summary>
/// Designer variable used to keep track of non-visual components.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Disposes resources used by the control.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing) {
if (components != null) {
components.Dispose();
}
}
base.Dispose(disposing);
}
/// <summary>
/// This method is required for Windows Forms designer support.
/// Do not change the method contents inside the source code editor. The Forms designer might
/// not be able to load this method if it was changed manually.
/// </summary>
private void InitializeComponent()
{
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.panel1 = new System.Windows.Forms.Panel();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.Cursor = System.Windows.Forms.Cursors.Default;
this.pictureBox1.Location = new System.Drawing.Point(0, 0);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(155, 167);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
this.pictureBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PictureBox1MouseDown);
this.pictureBox1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.PictureBox1MouseMove);
this.pictureBox1.Paint += new System.Windows.Forms.PaintEventHandler(this.PictureBox1Paint);
this.pictureBox1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.PictureBox1MouseClick);
this.pictureBox1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.PictureBox1MouseUp);
//
// panel1
//
this.panel1.AllowDrop = true;
this.panel1.AutoScroll = true;
this.panel1.Controls.Add(this.pictureBox1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(253, 259);
this.panel1.TabIndex = 1;
//
// ClassCanvas
//
this.AllowDrop = true;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoScroll = true;
this.BackColor = System.Drawing.Color.White;
this.Controls.Add(this.panel1);
this.Cursor = System.Windows.Forms.Cursors.Default;
this.Name = "ClassCanvas";
this.Size = new System.Drawing.Size(253, 259);
this.DragOver += new System.Windows.Forms.DragEventHandler(this.ClassCanvasDragOver);
this.DragDrop += new System.Windows.Forms.DragEventHandler(this.ClassCanvasDragDrop);
this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.ClassCanvasKeyUp);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ClassCanvasKeyDown);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.panel1.ResumeLayout(false);
this.ResumeLayout(false);
}
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.PictureBox pictureBox1;
}
}

171
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/ClassCanvas.cd

@ -0,0 +1,171 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<ClassDiagram Zoom="1">
<ClassItem X="40" Y="1270" Width="424.9121" Type="ClassDiagram.ClassCanvas" Collapsed="True">
<Properties Collapsed="False" />
<Methods Collapsed="False" />
<Fields Collapsed="False" />
<Events Collapsed="False" />
</ClassItem>
<ClassItem X="40" Y="1360" Width="339.4419" Type="ClassDiagram.CanvasItemEventArgs" Collapsed="True">
<Properties Collapsed="False" />
<Methods Collapsed="False" />
<Fields Collapsed="False" />
</ClassItem>
<ClassItem X="40" Y="1460" Width="100" Type="ClassDiagram.TestEnum" Collapsed="True" />
<ClassItem X="40" Y="890" Width="423.999" Type="ClassDiagram.ClassCanvasItem" Collapsed="True">
<Properties Collapsed="False" />
<Methods Collapsed="False" />
<Fields Collapsed="False" />
</ClassItem>
<ClassItem X="40" Y="1550" Width="105.853" Type="ClassDiagram.TestInterface" Collapsed="True" />
<ClassItem X="40" Y="1640" Width="175.7578" Type="ClassDiagram.TestClass_Long_Title" Collapsed="True">
<Properties Collapsed="False" />
<Methods Collapsed="False" />
<Fields Collapsed="False" />
<Events Collapsed="False" />
</ClassItem>
<ClassItem X="40" Y="980" Width="296.833" Type="ClassDiagram.DelegateCanvasItem" Collapsed="True">
<Properties Collapsed="False" />
<Methods Collapsed="False" />
<Fields Collapsed="False" />
</ClassItem>
<ClassItem X="40" Y="1730" Width="345.1782" Type="ClassDiagram.TestDelegate" Collapsed="True">
<Methods Collapsed="False" />
</ClassItem>
<ClassItem X="40" Y="1820" Width="620.538" Type="ClassDiagram.InteractiveHeaderedItem" Collapsed="True">
<Methods Collapsed="False" />
<Events Collapsed="False" />
</ClassItem>
<ClassItem X="380" Y="980" Width="294.1689" Type="ClassDiagram.InterfaceCanvasItem" Collapsed="True">
<Properties Collapsed="False" />
<Methods Collapsed="False" />
<Fields Collapsed="False" />
</ClassItem>
<ClassItem X="710" Y="980" Width="265.1865" Type="ClassDiagram.StructCanvasItem" Collapsed="True">
<Properties Collapsed="False" />
<Methods Collapsed="False" />
</ClassItem>
<ClassItem X="1020" Y="980" Width="265.1972" Type="ClassDiagram.EnumCanvasItem" Collapsed="True">
<Properties Collapsed="False" />
<Methods Collapsed="False" />
<Fields Collapsed="False" />
</ClassItem>
<ClassItem X="270" Y="220" Width="181.5639" Type="ClassDiagram.SmallButtonShape" Collapsed="True">
<Methods Collapsed="False" />
<Fields Collapsed="False" />
</ClassItem>
<ClassItem X="40" Y="1920" Width="172.1215" Type="ClassDiagram.Shapes" Collapsed="True">
<Fields Collapsed="False" />
</ClassItem>
<ClassItem X="270" Y="310" Width="146.2543" Type="ClassDiagram.PlusShape" Collapsed="True">
<Methods Collapsed="False" />
<Fields Collapsed="False" />
</ClassItem>
<ClassItem X="460" Y="310" Width="146.2543" Type="ClassDiagram.MinusShape" Collapsed="True">
<Methods Collapsed="False" />
<Fields Collapsed="False" />
</ClassItem>
<ClassItem X="40" Y="130" Width="186.7793" Type="ClassDiagram.InheritanceShape" Collapsed="True">
<Properties Collapsed="False" />
<Methods Collapsed="False" />
<Fields Collapsed="False" />
</ClassItem>
<ClassItem X="270" Y="130" Width="133.0791" Type="ClassDiagram.SmallIconShape" Collapsed="True">
<Properties Collapsed="False" />
</ClassItem>
<ClassItem X="40" Y="40" Width="315.417" Type="ClassDiagram.VectorShape" Collapsed="True">
<Properties Collapsed="False" />
<Methods Collapsed="False" />
</ClassItem>
<ClassItem X="720" Y="130" Width="228.9853" Type="ClassDiagram.CollapseShape" Collapsed="True">
<Properties Collapsed="False" />
<Methods Collapsed="False" />
<Fields Collapsed="False" />
</ClassItem>
<ClassItem X="720" Y="220" Width="146.2543" Type="ClassDiagram.ExpandShape" Collapsed="True">
<Methods Collapsed="False" />
</ClassItem>
<ClassItem X="990" Y="130" Width="278.7485" Type="ClassDiagram.MethodShape" Collapsed="True">
<Properties Collapsed="False" />
<Methods Collapsed="False" />
<Fields Collapsed="False" />
</ClassItem>
<ClassItem X="990" Y="220" Width="146.2543" Type="ClassDiagram.FieldShape" Collapsed="True">
<Methods Collapsed="False" />
<Fields Collapsed="False" />
</ClassItem>
<ClassItem X="1310" Y="130" Width="165.3916" Type="ClassDiagram.EventShape" Collapsed="True">
<Properties Collapsed="False" />
<Methods Collapsed="False" />
<Fields Collapsed="False" />
</ClassItem>
<ClassItem X="1510" Y="130" Width="228.9853" Type="ClassDiagram.CollapseExpandShape" Collapsed="True">
<Properties Collapsed="False" />
<Methods Collapsed="False" />
<Fields Collapsed="False" />
</ClassItem>
<ClassItem X="40" Y="510" Width="186.1455" Type="ClassDiagram.RouteInheritanceShape" Collapsed="True">
<Methods Collapsed="False" />
<Fields Collapsed="False" />
</ClassItem>
<ClassItem X="40" Y="420" Width="210.2778" Type="ClassDiagram.RouteShape" Collapsed="True">
<Properties Collapsed="False" />
<Methods Collapsed="False" />
<Fields Collapsed="False" />
</ClassItem>
<ClassItem X="1780" Y="130" Width="146.2543" Type="ClassDiagram.PropertyShape" Collapsed="True">
<Properties Collapsed="False" />
<Methods Collapsed="False" />
<Fields Collapsed="False" />
</ClassItem>
<ClassItem X="1360" Y="890" Width="288.8676" Type="ClassDiagram.NoteCanvasItem" Collapsed="True">
<Properties Collapsed="False" />
<Methods Collapsed="False" />
<Fields Collapsed="False" />
</ClassItem>
<ClassItem X="40" Y="1080" Width="309.4282" Type="ClassDiagram.RectangleDecorator" Collapsed="True">
<Properties Collapsed="False" />
<Methods Collapsed="False" />
<Fields Collapsed="False" />
<Events Collapsed="False" />
</ClassItem>
<ClassItem X="40" Y="2010" Width="206.1635" Type="ClassDiagram.IMouseInteractable" Collapsed="True">
<Methods Collapsed="False" />
</ClassItem>
<ClassItem X="40" Y="2090" Width="144.686" Type="ClassDiagram.IInteractiveDrawable" Collapsed="True" />
<ClassItem X="40" Y="2190" Width="143.8159" Type="ClassDiagram.IHitTestable" Collapsed="True">
<Methods Collapsed="False" />
</ClassItem>
<ClassItem X="40" Y="610" Width="315.0732" Type="ClassDiagram.ValueChangedEventArgs" Collapsed="True">
<Properties Collapsed="False" />
<Methods Collapsed="False" />
<Fields Collapsed="False" />
</ClassItem>
<ClassItem X="40" Y="700" Width="320.2402" Type="ClassDiagram.ValueChangingEventArgs" Collapsed="True">
<Properties Collapsed="False" />
<Methods Collapsed="False" />
<Fields Collapsed="False" />
</ClassItem>
<ClassItem X="40" Y="800" Width="423.6176" Type="ClassDiagram.CanvasItem" Collapsed="True">
<Properties Collapsed="False" />
<Methods Collapsed="False" />
<Fields Collapsed="False" />
<Events Collapsed="False" />
</ClassItem>
<ClassItem X="40" Y="1170" Width="268.9839" Type="ClassDiagram.FocusDecorator" Collapsed="True">
<Methods Collapsed="False" />
<Fields Collapsed="False" />
</ClassItem>
<ClassItem X="40" Y="2270" Width="130.2968" Type="ClassDiagram.SizeGripPositions" Collapsed="True" />
<ClassItem X="40" Y="2370" Width="334.9355" Type="ClassDiagram.SizeGripEventArgs" Collapsed="True">
<Properties Collapsed="False" />
<Methods Collapsed="False" />
<Fields Collapsed="False" />
</ClassItem>
<ClassItem X="350" Y="1170" Width="362.9834" Type="ClassDiagram.SizeGripDecorator" Collapsed="True">
<Properties Collapsed="False" />
<Methods Collapsed="False" />
<Fields Collapsed="False" />
<Events Collapsed="False" />
</ClassItem>
</ClassDiagram>

598
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/ClassCanvas.cs

@ -0,0 +1,598 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
using System.Xml;
using System.Xml.XPath;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Project;
using Tools.Diagrams;
namespace ClassDiagram
{
public partial class ClassCanvas
{
private class CanvasItemData : IDisposable
{
public CanvasItemData (CanvasItem item,
EventHandler<SizeGripEventArgs> SizeGripMouseEntered,
EventHandler<SizeGripEventArgs> SizeGripMouseLeft)
{
this.item = item;
focusDecorator = new FocusDecorator(item);
sizeGripDecorator = new SizeGripDecorator(item);
sizeGripDecorator.SizeGripMouseEnter += SizeGripMouseEntered;
sizeGripDecorator.SizeGripMouseLeave += SizeGripMouseLeft;
item.AddDecorator(focusDecorator);
item.AddDecorator(sizeGripDecorator);
}
CanvasItem item;
public CanvasItem Item
{
get { return item; }
}
public bool Focused
{
get { return focusDecorator.Active; }
set
{
focusDecorator.Active = value;
sizeGripDecorator.Active = value;
}
}
FocusDecorator focusDecorator;
SizeGripDecorator sizeGripDecorator;
public void Dispose()
{
item.RemoveDecorator(focusDecorator);
item.RemoveDecorator(sizeGripDecorator);
}
}
LinkedListNode<CanvasItemData> dragItemNode;
LinkedListNode<CanvasItemData> hoverItemNode;
LinkedList<CanvasItemData> itemsList = new LinkedList<CanvasItemData>();
Dictionary<CanvasItem, CanvasItemData> itemsData = new Dictionary<CanvasItem, CanvasItemData>();
DiagramRouter diagramRouter = new DiagramRouter();
float zoom = 1.0f;
bool ctrlDown;
bool holdRedraw;
bool redrawNeeded;
PointF lastMouseClickPosition;
public ClassCanvas()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
}
#region Diagram Activities
public float Zoom
{
get { return zoom; }
set
{
zoom = value;
pictureBox1.Invalidate();
LayoutChanged (this, EventArgs.Empty);
}
}
public void CollapseAll ()
{
foreach (CanvasItemData item in itemsList)
{
ClassCanvasItem classitem = item.Item as ClassCanvasItem;
if (classitem != null)
classitem.Collapsed = true;
}
LayoutChanged (this, EventArgs.Empty);
}
public void ExpandAll ()
{
foreach (CanvasItemData item in itemsList)
{
ClassCanvasItem classitem = item.Item as ClassCanvasItem;
if (classitem != null)
classitem.Collapsed = false;
}
LayoutChanged (this, EventArgs.Empty);
}
public void MatchAllWidths ()
{
foreach (CanvasItemData item in itemsList)
{
ClassCanvasItem classitem = item.Item as ClassCanvasItem;
if (classitem != null)
classitem.Width = classitem.GetAbsoluteContentWidth();
}
LayoutChanged (this, EventArgs.Empty);
}
public void ShrinkAllWidths ()
{
foreach (CanvasItemData item in itemsList)
{
ClassCanvasItem classitem = item.Item as ClassCanvasItem;
if (classitem != null)
classitem.Width = 0;
}
LayoutChanged (this, EventArgs.Empty);
}
#endregion
public SizeF GetDiagramLogicalSize ()
{
float w=1, h=1;
foreach (CanvasItemData item in itemsList)
{
w = Math.Max(w, item.Item.X + item.Item.ActualWidth + item.Item.Border);
h = Math.Max(h, item.Item.Y + item.Item.ActualHeight + item.Item.Border);
}
return new SizeF(w + 40, h + 40);
}
public Size GetDiagramPixelSize ()
{
float zoom = Math.Max(this.zoom, 0.1f);
SizeF size = GetDiagramLogicalSize();
return new Size((int)(size.Width * zoom), (int)(size.Height * zoom));
}
public void SetRecommendedGraphicsAttributes (Graphics graphics)
{
graphics.CompositingQuality = CompositingQuality.HighSpeed;
graphics.SmoothingMode = SmoothingMode.AntiAlias;
graphics.PageUnit = GraphicsUnit.Pixel;
graphics.PixelOffsetMode = PixelOffsetMode.Half;
graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
}
public void DrawToGraphics(Graphics graphics)
{
foreach (CanvasItemData item in itemsList)
item.Item.DrawToGraphics(graphics);
DrawRoutes(graphics);
}
private void PictureBox1Paint (object sender, PaintEventArgs e)
{
Size bbox = GetDiagramPixelSize();
pictureBox1.Width = bbox.Width + 100;
pictureBox1.Height = bbox.Height + 100;
e.Graphics.PageScale = zoom;
SetRecommendedGraphicsAttributes(e.Graphics);
DrawToGraphics(e.Graphics);
}
private void DrawRoutes (Graphics g)
{
foreach (Route route in diagramRouter.Routes)
{
route.Recalc(itemsList as IEnumerable<IRectangle>);
PointF origin = route.GetStartPoint();
RouteSegment[] segments = route.RouteSegments;
foreach (RouteSegment rs in segments)
{
PointF dest = rs.CreateDestinationPoint(origin);
g.DrawLine(Pens.Black, origin, dest);
origin = dest;
}
if (route.EndShape != null)
((RouteShape)route.EndShape).Draw(g, route, true);
if (route.StartShape != null)
((RouteShape)route.StartShape).Draw(g, route, false);
}
}
private LinkedListNode<CanvasItemData> FindCanvasItemNode (PointF pos)
{
LinkedListNode<CanvasItemData> itemNode = itemsList.Last;
while (itemNode != null)
{
if (itemNode.Value.Item.HitTest(pos))
{
return itemNode;
}
itemNode = itemNode.Previous;
}
return null;
}
#region Diagram Items Drag and Selection
private void PictureBox1MouseClick (object sender, MouseEventArgs e)
{
PointF pos = new PointF(e.X / zoom, e.Y / zoom);
lastMouseClickPosition = pos;
LinkedListNode<CanvasItemData> itemNode = FindCanvasItemNode(pos);
if (itemNode != null)
itemNode.Value.Item.HandleMouseClick(pos);
}
private void PictureBox1MouseDown (object sender, MouseEventArgs e)
{
HoldRedraw = true;
PointF pos = new PointF(e.X / zoom, e.Y / zoom);
LinkedListNode<CanvasItemData> itemNode = FindCanvasItemNode(pos);
dragItemNode = itemNode;
if (!ctrlDown)
{
foreach (CanvasItemData item in itemsList)
item.Focused = false;
}
if (itemNode != null)
{
itemNode.Value.Focused = true;
itemNode.Value.Item.HandleMouseDown(pos);
itemsList.Remove(itemNode);
itemsList.AddLast(itemNode);
CanvasItemSelected (this, new CanvasItemEventArgs (itemNode.Value.Item));
}
HoldRedraw = false;
}
private void PictureBox1MouseMove (object sender, MouseEventArgs e)
{
HoldRedraw = true;
PointF pos = new PointF(e.X / zoom, e.Y / zoom);
if (dragItemNode != null)
dragItemNode.Value.Item.HandleMouseMove(pos);
else
{
LinkedListNode<CanvasItemData> itemNode = FindCanvasItemNode(pos);
if (hoverItemNode != itemNode)
{
if (hoverItemNode != null && hoverItemNode.Value != null)
hoverItemNode.Value.Item.HandleMouseLeave();
hoverItemNode = itemNode;
}
if (itemNode != null)
itemNode.Value.Item.HandleMouseMove(pos);
}
HoldRedraw = false;
}
private void PictureBox1MouseUp (object sender, MouseEventArgs e)
{
PointF pos = new PointF(e.X / zoom, e.Y / zoom);
if (dragItemNode != null)
dragItemNode.Value.Item.HandleMouseUp(pos);
dragItemNode = null;
LinkedListNode<CanvasItemData> itemNode = FindCanvasItemNode(pos);
if (itemNode != null)
itemNode.Value.Item.HandleMouseUp(pos);
}
#endregion
private bool HoldRedraw
{
get { return holdRedraw; }
set
{
holdRedraw = value;
if (!value && redrawNeeded)
{
redrawNeeded = false;
this.Invalidate(true);
HandleRedraw (this, EventArgs.Empty);
}
}
}
private void HandleItemLayoutChange (object sender, EventArgs args)
{
LayoutChanged (this, args);
if (HoldRedraw)
redrawNeeded = true;
else
HandleRedraw (sender, args);
}
private void HandleRedraw (object sender, EventArgs args)
{
if (HoldRedraw)
{
redrawNeeded = true;
return;
}
this.Invalidate(true);
}
private void HandleItemPositionChange (object sender, ValueChangingEventArgs<PointF> args)
{
PointF pos = new PointF(args.Value.X, args.Value.Y);
pos.X = Math.Max ((float) Math.Round(pos.X / 10.0f) * 10.0f, 40.0f);
pos.Y = Math.Max ((float) Math.Round(pos.Y / 10.0f) * 10.0f, 40.0f);
args.Cancel = (pos.X == args.Value.X) && (pos.Y == args.Value.Y);
args.Value = pos;
}
private void HandleItemSizeChange (object sender, ValueChangingEventArgs<SizeF> args)
{
SizeF size = new SizeF(args.Value);
size.Width = (float) Math.Round(size.Width / 10.0f) * 10.0f;
size.Height = (float) Math.Round(size.Height / 10.0f) * 10.0f;
args.Cancel = (size.Width == args.Value.Width) && (size.Height == args.Value.Height);
args.Value = size;
}
private void SizeGripMouseEntered (object sender, SizeGripEventArgs e)
{
if ((e.GripPosition & SizeGripPositions.EastWest) != SizeGripPositions.None)
{
pictureBox1.Cursor = Cursors.SizeWE;
}
else if ((e.GripPosition & SizeGripPositions.NorthSouth) != SizeGripPositions.None)
{
pictureBox1.Cursor = Cursors.SizeNS;
}
}
private void SizeGripMouseLeft (object sender, SizeGripEventArgs e)
{
pictureBox1.Cursor = Cursors.Default;
}
public void AddCanvasItem (CanvasItem item)
{
ClassCanvasItem classItem = item as ClassCanvasItem;
if (classItem != null)
{
foreach (CanvasItemData ci in itemsList)
{
ClassCanvasItem cci = ci.Item as ClassCanvasItem;
if (cci != null)
{
Route r = null;
if (cci.RepresentedClassType == classItem.RepresentedClassType.BaseClass)
r = diagramRouter.AddRoute(item, cci);
else if (classItem.RepresentedClassType == cci.RepresentedClassType.BaseClass)
r = diagramRouter.AddRoute(cci, classItem);
if (r != null)
r.EndShape = new RouteInheritanceShape();
}
}
}
diagramRouter.AddItem(item);
CanvasItemData itemData = new CanvasItemData(item, SizeGripMouseEntered, SizeGripMouseLeft);
itemsData[item] = itemData;
itemsList.AddLast(itemData);
item.RedrawNeeded += HandleRedraw;
item.LayoutChanged += HandleItemLayoutChange;
item.PositionChanging += HandleItemPositionChange;
item.SizeChanging += HandleItemSizeChange;
}
public void RemoveCanvasItem (CanvasItem item)
{
itemsList.Remove(itemsData[item]);
Stack<Route> routesToRemove = new Stack<Route>();
foreach (Route r in diagramRouter.Routes)
{
if (r.From == item || r.To == item)
routesToRemove.Push(r);
}
foreach (Route r in routesToRemove)
diagramRouter.RemoveRoute(r);
diagramRouter.RemoveItem (item);
LayoutChanged(this, EventArgs.Empty);
}
/// <summary>
/// Retruns a copy of the the canvas items list as an array.
/// </summary>
public CanvasItem[] GetCanvasItems()
{
CanvasItem[] items = new CanvasItem[itemsList.Count];
int i = 0;
foreach (CanvasItemData item in itemsList)
items[i++] = item.Item;
return items;
}
public bool Contains (IClass ct)
{
foreach (CanvasItemData ci in itemsList)
{
ClassCanvasItem cci = ci.Item as ClassCanvasItem;
if (cci != null)
if (cci.RepresentedClassType.Equals(ct)) return true;
}
return false;
}
public void AutoArrange ()
{
diagramRouter.RecalcPositions();
}
public static ClassCanvasItem CreateItemFromType (IClass ct)
{
if (ct == null) return null;
ClassCanvasItem item = null;
if (ct.ClassType == ClassType.Interface)
item = new InterfaceCanvasItem(ct);
else if (ct.ClassType == ClassType.Enum)
item = new EnumCanvasItem(ct);
else if (ct.ClassType == ClassType.Struct)
item = new StructCanvasItem(ct);
else if (ct.ClassType == ClassType.Delegate)
item = new DelegateCanvasItem(ct);
else
item = new ClassCanvasItem(ct);
item.Initialize();
return item;
}
#region File Save/Load
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1059:MembersShouldNotExposeCertainConcreteTypes", MessageId = "System.Xml.XmlNode")]
public XmlDocument WriteToXml ()
{
XmlDocument doc = new XmlDocument();
doc.LoadXml("<ClassDiagram/>");
XmlDeclaration decl = doc.CreateXmlDeclaration("1.0", "utf-8", "yes");
doc.InsertBefore(decl, doc.FirstChild);
XmlAttribute zoom = doc.CreateAttribute("Zoom");
zoom.Value = Zoom.ToString(System.Globalization.CultureInfo.InvariantCulture);
doc.DocumentElement.Attributes.Append(zoom);
foreach (CanvasItemData item in itemsList)
{
item.Item.WriteToXml(doc);
}
return doc;
}
public void LoadFromXml (IXPathNavigable doc, IProjectContent pc)
{
if (pc == null) return;
if (doc == null) return;
XPathNavigator nav = doc.CreateNavigator();
XPathNodeIterator ni = nav.Select(@"/ClassDiagram/ClassItem");
while (ni.MoveNext())
{
string typeName = ni.Current.GetAttribute("Type", "");
IClass ct = pc.GetClass(typeName, 0);
ClassCanvasItem canvasitem = ClassCanvas.CreateItemFromType(ct);
if (canvasitem != null)
{
canvasitem.LoadFromXml (ni.Current);
AddCanvasItem(canvasitem);
}
}
ni = nav.Select(@"/ClassDiagram/Note");
while (ni.MoveNext())
{
NoteCanvasItem note = new NoteCanvasItem();
note.LoadFromXml(ni.Current);
AddCanvasItem(note);
}
}
#endregion
public event EventHandler LayoutChanged = delegate {};
public event EventHandler<CanvasItemEventArgs> CanvasItemSelected = delegate {};
public Bitmap GetAsBitmap ()
{
Size bbox = GetDiagramPixelSize();
Bitmap bitmap = new Bitmap(bbox.Width, bbox.Height);
Graphics g = Graphics.FromImage(bitmap);
g.PageScale = zoom;
SetRecommendedGraphicsAttributes(g);
DrawToGraphics(g);
return bitmap;
}
public void SaveToImage (string filename)
{
GetAsBitmap().Save(filename);
}
public PointF LastMouseClickPosition
{
get { return lastMouseClickPosition; }
}
#region Drag/Drop from Class Browser Handling
private void ClassCanvasDragOver(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.Link;
}
private void ClassCanvasDragDrop(object sender, DragEventArgs e)
{
}
#endregion
void ClassCanvasKeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Control)
ctrlDown = true;
}
void ClassCanvasKeyUp(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Control)
ctrlDown = false;
}
}
public class CanvasItemEventArgs : EventArgs
{
public CanvasItemEventArgs (CanvasItem canvasItem)
{
this.canvasItem = canvasItem;
}
private CanvasItem canvasItem;
public CanvasItem CanvasItem
{
get { return canvasItem; }
}
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
public enum TestEnum {Dog, Cat, Fish};
}

108
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/ClassCanvas.csproj

@ -0,0 +1,108 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OutputType>Library</OutputType>
<RootNamespace>ClassCanvas</RootNamespace>
<AssemblyName>ClassCanvas</AssemblyName>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{08F772A1-F0BE-433E-8B37-F6522953DB05}</ProjectGuid>
<RunCodeAnalysis>False</RunCodeAnalysis>
<CodeAnalysisRules>-Microsoft.Design#CA1063</CodeAnalysisRules>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
<IntermediateOutputPath>obj\Debug\</IntermediateOutputPath>
<OutputPath>bin\Debug\</OutputPath>
<Optimize>False</Optimize>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugSymbols>True</DebugSymbols>
<DebugType>Full</DebugType>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
<IntermediateOutputPath>obj\Release\</IntermediateOutputPath>
<OutputPath>bin\Release\</OutputPath>
<Optimize>True</Optimize>
<DefineConstants>TRACE</DefineConstants>
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\..\Main\GlobalAssemblyInfo.cs">
<Link>GlobalAssemblyInfo.cs</Link>
</Compile>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="ClassCanvas.cs" />
<Compile Include="ClassCanvas.Designer.cs">
<DependentUpon>ClassCanvas.cs</DependentUpon>
</Compile>
<Compile Include="ClassCanvasItem.cs" />
<Compile Include="DelegateCanvasItem.cs" />
<Compile Include="InteractiveHeaderedItem.cs" />
<Compile Include="InterfaceCanvasItem.cs" />
<Compile Include="StructCanvasItem.cs" />
<Compile Include="EnumCanvasItem.cs" />
<Compile Include="Shapes\SmallButtonShape.cs" />
<Compile Include="Shapes\Shapes.cs" />
<Compile Include="Shapes\PlusShape.cs" />
<Compile Include="Shapes\MinusShape.cs" />
<Compile Include="Shapes\InheritanceShape.cs" />
<Compile Include="Shapes\SmallIconShape.cs" />
<Compile Include="Shapes\VectorShape.cs" />
<Compile Include="Shapes\CollapseShape.cs" />
<Compile Include="Shapes\ExpandShape.cs" />
<Compile Include="Shapes\MethodShape.cs" />
<Compile Include="Shapes\FieldShape.cs" />
<Compile Include="Shapes\EventShape.cs" />
<Compile Include="Shapes\CollapseExpandShape.cs" />
<Compile Include="Shapes\RouteInheritanceShape.cs" />
<Compile Include="Shapes\RouteShape.cs" />
<Compile Include="Shapes\PropertyShape.cs" />
<Compile Include="NoteCanvasItem.cs" />
<EmbeddedResource Include="ClassCanvas.resx">
<DependentUpon>ClassCanvas.Designer.cs</DependentUpon>
</EmbeddedResource>
<Compile Include="RectangleDecorator.cs" />
<Compile Include="IMouseInteractable.cs" />
<Compile Include="IInteractiveDrawable.cs" />
<Compile Include="IHitTestable.cs" />
<Compile Include="CanvasItem.cs" />
<Compile Include="Decorators\FocusDecorator.cs" />
<Compile Include="Decorators\SizeGripDecorator.cs" />
<Content Include="ClassCanvas.cd" />
<Content Include="ClassCanvas.cd" />
</ItemGroup>
<ItemGroup>
<Folder Include="Shapes" />
<ProjectReference Include="..\..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj">
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project>
<Name>ICSharpCode.SharpDevelop</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\Core\Project\ICSharpCode.Core.csproj">
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project>
<Name>ICSharpCode.Core</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.SharpDevelop.Dom\Project\ICSharpCode.SharpDevelop.Dom.csproj">
<Project>{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}</Project>
<Name>ICSharpCode.SharpDevelop.Dom</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\DiagramRouter\Diagrams.csproj">
<Project>{0991423A-DBF6-4C89-B365-A1DF1EB32E42}</Project>
<Name>Diagrams</Name>
</ProjectReference>
<Folder Include="Decorators" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

120
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/ClassCanvas.resx

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

573
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/ClassCanvasItem.cs

@ -0,0 +1,573 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml;
using System.Xml.XPath;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Project;
using System.Globalization;
using Tools.Diagrams;
using Tools.Diagrams.Drawables;
namespace ClassDiagram
{
public class ClassCanvasItem : CanvasItem, IDisposable
{
IClass classtype;
string typeclass;
InteractiveHeaderedItem classItemHeaderedContent;
DrawableItemsStack classItemContainer = new DrawableItemsStack();
const int radius = 20;
#region Graphics related variables
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
public static readonly Font TitleFont = new Font (FontFamily.GenericSansSerif, 11, FontStyle.Bold, GraphicsUnit.Pixel);
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
public static readonly Font SubtextFont = new Font (FontFamily.GenericSansSerif, 11, FontStyle.Regular, GraphicsUnit.Pixel);
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
public static readonly Font GroupTitleFont = new Font (FontFamily.GenericSansSerif, 11, FontStyle.Regular, GraphicsUnit.Pixel);
LinearGradientBrush grad;
GraphicsPath shadowpath;
#endregion
CollapseExpandShape collapseExpandShape = new CollapseExpandShape();
DrawableItemsStack titles = new DrawableItemsStack();
DrawableItemsStack titlesCollapsed = new DrawableItemsStack();
DrawableItemsStack titlesExpanded = new DrawableItemsStack();
DrawableItemsStack<InteractiveHeaderedItem> groups = new DrawableItemsStack<InteractiveHeaderedItem>();
Dictionary<InteractiveHeaderedItem, string> groupNames = new Dictionary<InteractiveHeaderedItem, string>(); // TODO - this is really an ugly patch
DrawableItemsStack<TextSegment> interfaces = new DrawableItemsStack<TextSegment>();
DrawableRectangle titlesBackgroundCollapsed;
DrawableRectangle titlesBackgroundExpanded;
protected override bool AllowHeightModifications()
{
return false;
}
public override float Width
{
set
{
base.Width = Math.Max (value, 100.0f);
PrepareFrame();
}
}
public override float GetAbsoluteContentWidth()
{
return classItemHeaderedContent.GetAbsoluteContentWidth();
}
public override float GetAbsoluteContentHeight()
{
return classItemHeaderedContent.GetAbsoluteContentHeight();
}
public IClass RepresentedClassType
{
get { return classtype; }
}
#region Constructors
public ClassCanvasItem (IClass ct)
{
classtype = ct;
classItemHeaderedContent = new InteractiveHeaderedItem(titlesCollapsed, titlesExpanded, InitContentContainer(InitContent()));
classItemContainer.Container = this;
classItemContainer.Add(classItemHeaderedContent);
classItemContainer.Add(new DrawableRectangle(null, Pens.Gray, radius, radius, radius, radius));
classItemContainer.OrientationAxis = Axis.Z;
grad = new LinearGradientBrush(
new PointF(0, 0), new PointF(1, 0),
TitleBackground, Color.White);
titlesBackgroundCollapsed = new DrawableRectangle(grad, null, radius, radius, radius, radius);
titlesBackgroundExpanded = new DrawableRectangle(grad, null, radius, radius, 1, 1);
titles.Border = 5;
titlesCollapsed.Add(titlesBackgroundCollapsed);
titlesCollapsed.Add(titles);
titlesCollapsed.OrientationAxis = Axis.Z;
titlesExpanded.Add(titlesBackgroundExpanded);
titlesExpanded.Add(titles);
titlesExpanded.OrientationAxis = Axis.Z;
if (classtype != null)
{
typeclass = classtype.Modifiers.ToString();
typeclass += " " + classtype.ClassType.ToString();
}
}
#endregion
public override bool IsVResizable
{
get { return false; }
}
protected virtual DrawableItemsStack InitContentContainer(params IDrawableRectangle[] items)
{
DrawableItemsStack content = new DrawableItemsStack();
content.OrientationAxis = Axis.Z;
content.Add(new DrawableRectangle(Brushes.White, null, 1, 1, radius, radius));
foreach (IDrawableRectangle item in items)
content.Add(item);
return content;
}
protected virtual IDrawableRectangle InitContent ()
{
groups.MinWidth = 80;
groups.Spacing = 5;
groups.Border = 5;
return groups;
}
public void Initialize ()
{
PrepareMembersContent();
PrepareTitles();
Width = GetAbsoluteContentWidth();
}
#region Graphics related members
protected virtual Color TitleBackground
{
get { return Color.LightSteelBlue;}
}
protected virtual Brush InnerTitlesBackground
{
get { return Brushes.AliceBlue;}
}
#endregion
#region Preparations
protected IAmbience GetAmbience()
{
IAmbience ambience = null;
try
{
ambience = AmbienceService.CurrentAmbience;
}
catch (NullReferenceException)
{
ambience = ICSharpCode.SharpDevelop.Dom.CSharp.CSharpAmbience.Instance;
}
ambience.ConversionFlags = ConversionFlags.None;
return ambience;
}
protected virtual void PrepareTitles ()
{
if (classtype == null) return;
IAmbience ambience = GetAmbience();
DrawableItemsStack title = new DrawableItemsStack();
title.OrientationAxis = Axis.X;
TextSegment titleString = new TextSegment(base.Graphics, classtype.Name, TitleFont, true);
title.Add(titleString);
title.Add(collapseExpandShape);
collapseExpandShape.Collapsed = Collapsed;
titles.OrientationAxis = Axis.Y;
titles.Add(title);
titles.Add(new TextSegment(base.Graphics, typeclass, SubtextFont, true));
if (classtype.BaseClass != null)
{
DrawableItemsStack inherits = new DrawableItemsStack();
inherits.OrientationAxis = Axis.X;
inherits.Add(new InheritanceShape());
inherits.Add(new TextSegment(base.Graphics, classtype.BaseClass.Name, SubtextFont, true));
titles.Add(inherits);
}
foreach (IReturnType rt in classtype.BaseTypes)
{
IClass ct = rt.GetUnderlyingClass();
if (ct != null && ct.ClassType == ClassType.Interface)
interfaces.Add(new TextSegment(base.Graphics, ambience.Convert(rt), SubtextFont, true));
}
}
protected class MemberData : IComparable<MemberData>
{
public MemberData (IMember member, IAmbience ambience, Graphics graphics, Font font)
{
IMethod methodMember = member as IMethod;
IEvent eventMember = member as IEvent;
IProperty propertyMember = member as IProperty;
IField fieldMember = member as IField;
DrawableItemsStack<VectorShape> image = new DrawableItemsStack<VectorShape>();
image.OrientationAxis = Axis.Z; // stack image components one on top of the other
image.KeepAspectRatio = true;
if (methodMember != null)
{
memberString = ambience.Convert(methodMember) + " : " + ambience.Convert(member.ReturnType);
image.Add(new MethodShape());
}
else if (eventMember != null)
{
memberString = ambience.Convert(eventMember) + " : " + ambience.Convert(member.ReturnType);
image.Add(new EventShape());
}
else if (fieldMember != null)
{
memberString = ambience.Convert(fieldMember) + " : " + ambience.Convert(member.ReturnType);
image.Add(new FieldShape());
}
else if (propertyMember != null)
{
memberString = ambience.Convert(propertyMember) + " : " + ambience.Convert(member.ReturnType);
image.Add(new PropertyShape());
}
memberItem.OrientationAxis = Axis.X;
memberItem.Add(image);
memberItem.Add(new TextSegment(graphics, memberString, font, true));
image.Border = 1;
}
DrawableItemsStack memberItem = new DrawableItemsStack();
string memberString;
public string MemberString
{
get { return memberString; }
}
public int CompareTo(MemberData other)
{
return memberString.CompareTo(other.MemberString);
}
public DrawableItemsStack<IDrawableRectangle> Item
{
get { return memberItem; }
}
}
protected InteractiveHeaderedItem PrepareGroup (string title, IDrawableRectangle content)
{
#region Prepare Group Container
DrawableItemsStack headerPlus = new DrawableItemsStack();
DrawableItemsStack headerMinus = new DrawableItemsStack();
headerPlus.OrientationAxis = Axis.X;
headerMinus.OrientationAxis = Axis.X;
#endregion
#region Create Header
TextSegment titleSegment = new TextSegment(Graphics, title, GroupTitleFont, true);
headerPlus.Add(new PlusShape());
headerPlus.Add(titleSegment);
headerMinus.Add(new MinusShape());
headerMinus.Add(titleSegment);
DrawableItemsStack headerCollapsed = new DrawableItemsStack();
DrawableItemsStack headerExpanded = new DrawableItemsStack();
headerCollapsed.OrientationAxis = Axis.Z;
headerExpanded.OrientationAxis = Axis.Z;
headerCollapsed.Add (new DrawableRectangle(InnerTitlesBackground, null));
headerCollapsed.Add (headerPlus);
headerExpanded.Add (new DrawableRectangle(InnerTitlesBackground, null));
headerExpanded.Add (headerMinus);
#endregion
InteractiveHeaderedItem tg = new InteractiveHeaderedItem(headerCollapsed, headerExpanded, content);
tg.HeaderClicked += delegate { tg.Collapsed = !tg.Collapsed; };
tg.RedrawNeeded += HandleRedraw;
return tg;
}
protected virtual DrawableItemsStack PrepareMembersContent <MT> (ICollection<MT> members) where MT : IMember
{
if (members == null) return null;
if (members.Count == 0) return null;
DrawableItemsStack content = new DrawableItemsStack();
content.OrientationAxis = Axis.Y;
PrepareMembersContent <MT> (members, content);
return content;
}
protected virtual void PrepareMembersContent <MT> (ICollection<MT> members, DrawableItemsStack content) where MT : IMember
{
if (members == null) return;
if (members.Count == 0) return;
IAmbience ambience = GetAmbience();
#region Prepare Group Members
List<MemberData> membersData = new List<MemberData>();
foreach (MT member in members)
{
membersData.Add(new MemberData(member, ambience, Graphics, MemberFont));
}
membersData.Sort();
#endregion
#region Add Members To Group
foreach (MemberData memberData in membersData)
{
content.Add(memberData.Item);
}
#endregion
}
private void AddGroupToContent(string title, DrawableItemsStack groupContent)
{
if (groupContent != null)
{
InteractiveHeaderedItem tg = PrepareGroup (title, groupContent);
groupNames.Add(tg, title);
groups.Add(tg);
}
}
protected virtual void PrepareMembersContent ()
{
if (classtype == null) return;
groups.Clear();
DrawableItemsStack propertiesContent = PrepareMembersContent <IProperty> (classtype.Properties);
DrawableItemsStack methodsContent = PrepareMembersContent <IMethod> (classtype.Methods);
DrawableItemsStack fieldsContent = PrepareMembersContent <IField> (classtype.Fields);
DrawableItemsStack eventsContent = PrepareMembersContent <IEvent> (classtype.Events);
AddGroupToContent("Properties", propertiesContent);
AddGroupToContent("Methods", methodsContent);
AddGroupToContent("Fields", fieldsContent);
AddGroupToContent("Events", eventsContent);
}
protected virtual void PrepareFrame ()
{
ActualHeight = classItemContainer.GetAbsoluteContentHeight();
shadowpath = new GraphicsPath();
shadowpath.AddArc(ActualWidth-radius + 4, 3, radius, radius, 300, 60);
shadowpath.AddArc(ActualWidth-radius + 4, ActualHeight-radius + 3, radius, radius, 0, 90);
shadowpath.AddArc(4, ActualHeight-radius + 3, radius, radius, 90, 45);
shadowpath.AddArc(ActualWidth-radius, ActualHeight-radius, radius, radius, 90, -90);
shadowpath.CloseFigure();
}
#endregion
public override void DrawToGraphics (Graphics graphics)
{
grad.ResetTransform();
grad.TranslateTransform(X, Y);
grad.ScaleTransform(ActualWidth, 1);
GraphicsState state = graphics.Save();
graphics.TranslateTransform (X, Y);
//Draw Shadow
graphics.FillPath(CanvasItem.ShadowBrush, shadowpath);
classItemContainer.Width = Width;
classItemContainer.Height = Height;
graphics.Restore(state);
classItemContainer.DrawToGraphics(graphics);
//Draw interfaces lollipops
//TODO - should be converted to an headered item.
if (interfaces.Count > 0)
{
interfaces.X = X + 15;
interfaces.Y = Y - interfaces.ActualHeight - 1;
interfaces.DrawToGraphics(graphics);
graphics.DrawEllipse(Pens.Black, X + 9, Y - interfaces.ActualHeight - 11, 10, 10);
graphics.DrawLine(Pens.Black, X + 14, Y - interfaces.ActualHeight - 1, X + 14, Y);
}
base.DrawToGraphics(graphics);
}
public bool Collapsed
{
get { return classItemHeaderedContent.Collapsed; }
set
{
classItemHeaderedContent.Collapsed = value;
collapseExpandShape.Collapsed = value;
PrepareFrame();
EmitLayoutUpdate();
}
}
private void HandleRedraw (object sender, EventArgs args)
{
PrepareFrame();
EmitLayoutUpdate();
}
#region Behaviour
public override void HandleMouseClick (PointF pos)
{
base.HandleMouseClick(pos);
if (collapseExpandShape.IsInside(pos.X, pos.Y))
{
Collapsed = !Collapsed;
}
else
{
foreach (InteractiveHeaderedItem tg in groups)
{
if (tg.HitTest(pos))
{
tg.HandleMouseClick(pos);
}
}
}
}
#endregion
#region Storage
protected override XmlElement CreateXmlElement(XmlDocument doc)
{
return doc.CreateElement("ClassItem");
}
protected override void FillXmlElement(XmlElement element, XmlDocument document)
{
base.FillXmlElement(element, document);
element.SetAttribute("Type", RepresentedClassType.FullyQualifiedName);
element.SetAttribute("Collapsed", Collapsed.ToString());
foreach (InteractiveHeaderedItem tg in groups)
{
XmlElement grp = document.CreateElement(groupNames[tg]);
grp.SetAttribute("Collapsed", tg.Collapsed.ToString());
element.AppendChild(grp);
}
}
public override void LoadFromXml (XPathNavigator navigator)
{
base.LoadFromXml(navigator);
Collapsed = bool.Parse(navigator.GetAttribute("Collapsed", ""));
foreach (InteractiveHeaderedItem tg in groups)
{
XPathNodeIterator ni = navigator.SelectChildren(groupNames[tg], "");
ni.MoveNext();
tg.Collapsed = bool.Parse(ni.Current.GetAttribute("Collapsed", ""));
}
}
#endregion
public void Dispose()
{
grad.Dispose();
shadowpath.Dispose();
}
public override string ToString()
{
return "ClasCanvasItem: " + classtype.Name;
}
}
/// <summary>
/// Test interface
/// </summary>
public interface TestInterface
{
}
/// <summary>
/// Test class.
/// </summary>
public class TestClass_Long_Title : TestInterface
{
/// <summary>
/// A method with a common test name and one parameter.
/// </summary>
public void foo(string str) {}
/// <summary>
/// Some test field.
/// </summary>
public int bar;
/// <summary>
/// The getter for the 'bar' field.
/// </summary>
public int Bar { get { return bar; } }
/// <summary>
/// A simple test event.
/// </summary>
public event EventHandler stupid = delegate {};
}
}

55
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Decorators/FocusDecorator.cs

@ -0,0 +1,55 @@
/*
* Created by SharpDevelop.
* User: itai
* Date: 28/09/2006
* Time: 19:03
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml;
using System.Xml.XPath;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Project;
using Tools.Diagrams;
namespace ClassDiagram
{
public class FocusDecorator : RectangleDecorator
{
public FocusDecorator (IRectangle rectangle) : base (rectangle) {}
static Pen InitPen ()
{
Pen pen = new Pen(Color.Black);
pen.DashStyle = DashStyle.Dot;
return pen;
}
static Pen pen = InitPen();
public override void DrawToGraphics(Graphics graphics)
{
if (graphics == null) return;
graphics.DrawRectangle(pen,
Rectangle.AbsoluteX - 4, Rectangle.AbsoluteY - 4,
Rectangle.ActualWidth + 8, Rectangle.ActualHeight + 8);
}
public override void HandleMouseClick(PointF pos) { }
public override void HandleMouseDown(PointF pos) { }
public override void HandleMouseMove(PointF pos) { }
public override void HandleMouseUp(PointF pos) { }
public override void HandleMouseLeave() { }
}
}

249
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Decorators/SizeGripDecorator.cs

@ -0,0 +1,249 @@
/*
* Created by SharpDevelop.
* User: itai
* Date: 28/09/2006
* Time: 19:03
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml;
using System.Xml.XPath;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Project;
using Tools.Diagrams;
namespace ClassDiagram
{
[Flags]
public enum SizeGripPositions {
None = 0,
North = 1,
East = 2,
South = 4,
West = 8,
NorthSouth = 5,
EastWest = 10,
All = 15
};
public class SizeGripEventArgs : EventArgs
{
SizeGripPositions gripPosition;
public SizeGripEventArgs (SizeGripPositions gripPosition)
{
this.gripPosition = gripPosition;
}
public SizeGripPositions GripPosition
{
get { return gripPosition; }
}
}
public class SizeGripDecorator : RectangleDecorator
{
public SizeGripDecorator (IRectangle rectangle)
: base (rectangle)
{
if (rectangle.IsHResizable)
this.gripPositions |= SizeGripPositions.EastWest;
if (rectangle.IsVResizable)
this.gripPositions |= SizeGripPositions.NorthSouth;
}
private SizeGripPositions gripPositions;
private SizeGripPositions grabbedGrip;
private SizeGripPositions highlightedGrip;
private PointF dragPos = new Point(0, 0);
private PointF dragOfst = new Point(0, 0);
private float dragOrigWidth;
private float dragOrigHeight;
private PointF GetGripPosition (SizeGripPositions grip)
{
PointF pos = new PointF(0, 0);
if (grip == SizeGripPositions.North)
{
pos.X = Rectangle.ActualWidth / 2;
pos.Y = -4;
}
else if (grip == SizeGripPositions.East)
{
pos.X = Rectangle.ActualWidth + 4;
pos.Y = Rectangle.ActualHeight / 2;
}
else if (grip == SizeGripPositions.South)
{
pos.X = Rectangle.ActualWidth / 2;
pos.Y = Rectangle.ActualHeight + 4;
}
else if (grip == SizeGripPositions.West)
{
pos.X = - 4;
pos.Y = Rectangle.ActualHeight / 2;
}
pos.X += Rectangle.AbsoluteX;
pos.Y += Rectangle.AbsoluteY;
return pos;
}
private void DrawGripRect (Graphics graphics, SizeGripPositions grip)
{
Pen pen = Pens.Gray;
if (grip == highlightedGrip)
pen = Pens.Black;
PointF pos = GetGripPosition (grip);
graphics.FillRectangle(Brushes.White, pos.X - 3, pos.Y - 3, 6, 6);
graphics.DrawRectangle(pen, pos.X - 3, pos.Y - 3, 6, 6);
}
private static bool IsInGrip (PointF pos, PointF gripPos)
{
return (pos.X >= gripPos.X - 3 && pos.Y >= gripPos.Y - 3 &&
pos.X <= gripPos.X + 3 && pos.Y <= gripPos.Y + 3);
}
public override void DrawToGraphics(Graphics graphics)
{
if (graphics == null) return;
if ((gripPositions & SizeGripPositions.North) == SizeGripPositions.North)
DrawGripRect (graphics, SizeGripPositions.North);
if ((gripPositions & SizeGripPositions.East) == SizeGripPositions.East)
DrawGripRect (graphics, SizeGripPositions.East);
if ((gripPositions & SizeGripPositions.South) == SizeGripPositions.South)
DrawGripRect (graphics, SizeGripPositions.South);
if ((gripPositions & SizeGripPositions.West) == SizeGripPositions.West)
DrawGripRect (graphics, SizeGripPositions.West);
}
public SizeGripPositions GripPositions
{
get { return gripPositions; }
set { gripPositions = value; }
}
private bool InternalHitTest(PointF pos, SizeGripPositions grip)
{
if ((gripPositions & grip) == grip)
if (IsInGrip (pos, GetGripPosition(grip)))
return true;
return false;
}
private SizeGripPositions InternalHitTest(PointF pos)
{
if (InternalHitTest (pos, SizeGripPositions.North))
return SizeGripPositions.North;
if (InternalHitTest (pos, SizeGripPositions.East))
return SizeGripPositions.East;
if (InternalHitTest (pos, SizeGripPositions.South))
return SizeGripPositions.South;
if (InternalHitTest (pos, SizeGripPositions.West))
return SizeGripPositions.West;
return SizeGripPositions.None;
}
public override bool HitTest(PointF pos)
{
return InternalHitTest(pos) != SizeGripPositions.None;
}
public override void HandleMouseClick(PointF pos) { }
public override void HandleMouseDown(PointF pos)
{
grabbedGrip = InternalHitTest(pos);
dragPos = pos;
dragOfst.X = Rectangle.X - dragPos.X;
dragOfst.Y = Rectangle.Y - dragPos.Y;
dragOrigWidth = Rectangle.ActualWidth;
dragOrigHeight = Rectangle.ActualHeight;
}
public override void HandleMouseMove(PointF pos)
{
SizeGripPositions newGrip = InternalHitTest(pos);
if (grabbedGrip == SizeGripPositions.None)
{
if (highlightedGrip != newGrip)
{
SizeGripMouseLeave (this, new SizeGripEventArgs(highlightedGrip));
highlightedGrip = newGrip;
SizeGripMouseEnter (this, new SizeGripEventArgs(highlightedGrip));
EmitRedraw();
}
}
if (grabbedGrip != SizeGripPositions.None)
{
if (grabbedGrip == SizeGripPositions.North)
{
if (pos.Y >= 40)
{
Rectangle.Y = dragOfst.Y + pos.Y;
Rectangle.Height = dragOrigHeight - pos.Y + dragPos.Y;
}
}
else if (grabbedGrip == SizeGripPositions.East)
{
Rectangle.Width = dragOrigWidth + pos.X - dragPos.X;
}
else if (grabbedGrip == SizeGripPositions.South)
{
Rectangle.Height = dragOrigHeight + pos.Y - dragPos.Y;
}
else if (grabbedGrip == SizeGripPositions.West)
{
if (pos.X >= 40)
{
Rectangle.X = dragOfst.X + pos.X;
Rectangle.Width = dragOrigWidth - pos.X + dragPos.X;
}
}
}
}
public override void HandleMouseUp(PointF pos)
{
grabbedGrip = SizeGripPositions.None;
}
public override void HandleMouseLeave()
{
if (grabbedGrip == SizeGripPositions.None)
{
SizeGripMouseLeave (this, new SizeGripEventArgs(highlightedGrip));
highlightedGrip = SizeGripPositions.None;
EmitRedraw();
}
}
public event EventHandler<SizeGripEventArgs> SizeGripMouseEnter = delegate { };
public event EventHandler<SizeGripEventArgs> SizeGripMouseLeave = delegate { };
}
}

64
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/DelegateCanvasItem.cs

@ -0,0 +1,64 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml;
using System.Xml.XPath;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Project;
using System.Globalization;
using Tools.Diagrams;
using Tools.Diagrams.Drawables;
namespace ClassDiagram
{
// TODO - should look at the Invoke method and extract the parameters and return type.
// this is the only information that need to be shown. The parameters should
// be listed in the form of paramName : paramType, as for the return type, still
// need to figure that out ;)
public class DelegateCanvasItem : ClassCanvasItem
{
public DelegateCanvasItem (IClass ct) : base (ct) {}
private DrawableItemsStack parameters = new DrawableItemsStack();
protected override Color TitleBackground
{
get { return Color.LightPink;}
}
protected override IDrawableRectangle InitContent()
{
parameters.Border = 5;
parameters.OrientationAxis = Axis.Y;
return parameters;
}
protected override void PrepareMembersContent()
{
parameters.Clear();
IMethod invokeMethod = RepresentedClassType.SearchMember("Invoke", RepresentedClassType.ProjectContent.Language) as IMethod;
IAmbience ambience = GetAmbience();
foreach (IParameter par in invokeMethod.Parameters)
{
TextSegment ts = new TextSegment(Graphics, par.Name + " : " + ambience.Convert(par.ReturnType), MemberFont, true);
parameters.Add(ts);
}
}
}
public delegate TestEnum TestDelegate (int num, string str);
}

47
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/EnumCanvasItem.cs

@ -0,0 +1,47 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Project;
using Tools.Diagrams;
using Tools.Diagrams.Drawables;
namespace ClassDiagram
{
//TODO - an enum looks differently.
public class EnumCanvasItem : ClassCanvasItem
{
public EnumCanvasItem (IClass ct) : base (ct) {}
private DrawableItemsStack fields = new DrawableItemsStack();
protected override Color TitleBackground
{
get { return Color.Plum; }
}
protected override IDrawableRectangle InitContent()
{
fields.Border = 5;
fields.OrientationAxis = Axis.Y;
return fields;
}
protected override void PrepareMembersContent ()
{
fields.Clear();
PrepareMembersContent <IField> (RepresentedClassType.Fields, fields);
}
}
}

29
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/IHitTestable.cs

@ -0,0 +1,29 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml;
using System.Xml.XPath;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Project;
using Tools.Diagrams;
namespace ClassDiagram
{
public interface IHitTestable
{
bool HitTest (PointF pos);
}
}

19
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/IInteractiveDrawable.cs

@ -0,0 +1,19 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using Tools.Diagrams;
using Tools.Diagrams.Drawables;
namespace ClassDiagram
{
public interface IInteractiveDrawable : IDrawable, IHitTestable, IMouseInteractable
{
}
}

81
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/IMouseInteractable.cs

@ -0,0 +1,81 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml;
using System.Xml.XPath;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Project;
using Tools.Diagrams;
namespace ClassDiagram
{
public interface IMouseInteractable
{
/// <summary>
/// Called by the canvas when the user clicks inside the item.
/// </summary>
/// <remarks>
/// The given point is relative to the canvas origin.
/// Subtruct the item's X and Y values to get a position relative to the item's origin.
/// </remarks>
/// <param name="pos">
/// The click position relative to the canvas origin.
/// </param>
void HandleMouseClick (PointF pos);
/// <summary>
/// Called by the canvas when the user presses a mouse button inside the item.
/// </summary>
/// <remarks>
/// The given point is relative to the canvas origin.
/// Subtruct the item's X and Y values to get a position relative to the item's origin.
/// </remarks>
/// <param name="pos">
/// The mouse button press position relative to the canvas origin.
/// </param>
void HandleMouseDown (PointF pos);
/// <summary>
/// Called by the canvas when the user moves the mouse cursor inside the item.
/// </summary>
/// <remarks>
/// The given point is relative to the canvas origin.
/// Subtruct the item's X and Y values to get a position relative to the item's origin.
/// </remarks>
/// <param name="pos">
/// The mouse cursor position relative to the canvas origin.
/// </param>
void HandleMouseMove (PointF pos);
/// <summary>
/// Called by the canvas when the user releases a mouse button inside the item.
/// </summary>
/// <remarks>
/// The given point is relative to the canvas origin.
/// Subtruct the item's X and Y values to get a position relative to the item's origin.
/// </remarks>
/// <param name="pos">
/// The mouse button release position relative to the canvas origin.
/// </param>
void HandleMouseUp (PointF pos);
/// <summary>
/// Called by the canvas whenever the mouse cursor leaves the item (i.e. the HitTest
/// method returns false after it returned true).
/// </summary>
void HandleMouseLeave ();
}
}

111
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/InteractiveHeaderedItem.cs

@ -0,0 +1,111 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using Tools.Diagrams;
using Tools.Diagrams.Drawables;
namespace ClassDiagram
{
public class InteractiveHeaderedItem : HeaderedItem, IMouseInteractable, IHitTestable
{
public InteractiveHeaderedItem(IDrawableRectangle headerCollapsed,
IDrawableRectangle headerExpanded,
IDrawableRectangle content)
: base (headerCollapsed, headerExpanded, content) {}
public event EventHandler HeaderClicked = delegate {};
public event EventHandler ContentClicked = delegate {};
public event EventHandler HeaderMouseDown = delegate {};
public event EventHandler ContentMouseDown = delegate {};
public event EventHandler HeaderMouseMove = delegate {};
public event EventHandler ContentMouseMove = delegate {};
public event EventHandler HeaderMouseUp = delegate {};
public event EventHandler ContentMouseUp = delegate {};
private void HandleMouseEvent(PointF pos, EventHandler headerEvent, EventHandler contentEvent)
{
if (Collapsed)
{
if (pos.X >= HeaderCollapsed.AbsoluteX &&
pos.X <= HeaderCollapsed.AbsoluteX + HeaderCollapsed.ActualWidth &&
pos.Y >= HeaderCollapsed.AbsoluteY &&
pos.Y <= HeaderCollapsed.AbsoluteY + HeaderCollapsed.ActualHeight)
{
headerEvent(this, EventArgs.Empty);
}
}
else
{
if (pos.X >= HeaderExpanded.AbsoluteX &&
pos.X <= HeaderExpanded.AbsoluteX + HeaderExpanded.ActualWidth &&
pos.Y >= HeaderExpanded.AbsoluteY &&
pos.Y <= HeaderExpanded.AbsoluteY + HeaderExpanded.ActualHeight)
{
headerEvent(this, EventArgs.Empty);
}
else if (pos.X >= Content.AbsoluteX &&
pos.X <= Content.AbsoluteX + Content.ActualWidth &&
pos.Y >= Content.AbsoluteY &&
pos.Y <= Content.AbsoluteY + Content.ActualHeight)
{
contentEvent(this, EventArgs.Empty);
}
}
}
public void HandleMouseClick(PointF pos)
{
HandleMouseEvent (pos, HeaderClicked, ContentClicked);
}
public void HandleMouseDown(PointF pos)
{
HandleMouseEvent (pos, HeaderMouseDown, ContentMouseDown);
}
public void HandleMouseMove(PointF pos)
{
HandleMouseEvent (pos, HeaderMouseMove, ContentMouseMove);
}
public void HandleMouseUp(PointF pos)
{
HandleMouseEvent (pos, HeaderMouseUp, ContentMouseUp);
}
public void HandleMouseLeave()
{
// TODO implement HandleMouseLeave
}
public bool HitTest(PointF pos)
{
return (pos.X >= AbsoluteX && pos.X <= AbsoluteX + ActualWidth &&
pos.Y >= AbsoluteY && pos.Y <= AbsoluteY + ActualHeight);
}
public bool HeaderHitTest(PointF pos)
{
if (Collapsed)
{
return (pos.X >= HeaderCollapsed.AbsoluteX && pos.X <= HeaderCollapsed.AbsoluteX + HeaderCollapsed.ActualWidth &&
pos.Y >= HeaderCollapsed.AbsoluteY && pos.Y <= HeaderCollapsed.AbsoluteY + HeaderCollapsed.ActualHeight);
}
else
{
return (pos.X >= HeaderExpanded.AbsoluteX && pos.X <= HeaderExpanded.AbsoluteX + HeaderExpanded.ActualWidth &&
pos.Y >= HeaderExpanded.AbsoluteY && pos.Y <= HeaderExpanded.AbsoluteY + HeaderExpanded.ActualHeight);
}
}
}
}

38
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/InterfaceCanvasItem.cs

@ -0,0 +1,38 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
//using System.Reflection;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Project;
namespace ClassDiagram
{
public class InterfaceCanvasItem : ClassCanvasItem
{
static Brush innerTitlesBG = new SolidBrush(Color.FromArgb(255, 224, 255, 224));
static Color titlesBG = Color.FromArgb(255, 192, 224, 192);
public InterfaceCanvasItem (IClass ct) : base (ct) {}
protected override Color TitleBackground
{
get { return titlesBG;}
}
protected override Brush InnerTitlesBackground
{
get { return innerTitlesBG; }
}
}
}

92
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/NoteCanvasItem.cs

@ -0,0 +1,92 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml;
using System.Xml.XPath;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Project;
using System.Globalization;
namespace ClassDiagram
{
//TODO - complete note item
public class NoteCanvasItem : CanvasItem
{
private string note = "<Text editing not implemented yet.>";
public NoteCanvasItem()
{
}
public string Note
{
get { return note; }
set { note = value; }
}
public override void DrawToGraphics (Graphics graphics)
{
if (graphics == null) return;
// Draw Shadow
graphics.FillRectangle(CanvasItem.ShadowBrush, X + ActualWidth, Y + 3, 4, ActualHeight);
graphics.FillRectangle(CanvasItem.ShadowBrush, X + 4, Y + ActualHeight, ActualWidth - 4, 3);
// Draw Note Area
graphics.FillRectangle(Brushes.LightYellow, X, Y, ActualWidth, ActualHeight);
graphics.DrawRectangle(Pens.Olive, X, Y, ActualWidth, ActualHeight);
// Draw Note Text
RectangleF rect = new RectangleF (X + 5, Y + 5, ActualWidth - 10, ActualHeight - 10);
graphics.DrawString(note, MemberFont, Brushes.Black, rect);
base.DrawToGraphics(graphics);
}
protected override bool DragAreaHitTest(PointF pos)
{
return (pos.X > X && pos.Y > Y && pos.X < X + ActualWidth && pos.Y < Y + ActualHeight);
}
protected override XmlElement CreateXmlElement(XmlDocument doc)
{
return doc.CreateElement("Note");
}
protected override void FillXmlElement(XmlElement element, XmlDocument document)
{
base.FillXmlElement(element, document);
element.SetAttribute("Height", Height.ToString(CultureInfo.InvariantCulture));
element.SetAttribute("Note", Note);
}
public override void LoadFromXml (XPathNavigator navigator)
{
base.LoadFromXml(navigator);
Height = float.Parse(navigator.GetAttribute("Height", ""), CultureInfo.InvariantCulture);
Note = navigator.GetAttribute("Note", "");
}
public override float Width
{
set { base.Width = Math.Max (value, 40.0f); }
}
public override float Height
{
set { base.Height = Math.Max (value, 40.0f); }
}
}
}

73
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/RectangleDecorator.cs

@ -0,0 +1,73 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml;
using System.Xml.XPath;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Project;
using Tools.Diagrams;
namespace ClassDiagram
{
public abstract class RectangleDecorator : IInteractiveDrawable
{
private IRectangle rect;
private bool active;
protected RectangleDecorator (IRectangle rectangle)
{
this.rect = rectangle;
}
public IRectangle Rectangle
{
get { return rect; }
}
public bool Active
{
get { return active; }
set
{
active = value;
EmitRedraw();
}
}
public event EventHandler RedrawNeeded = delegate { };
public abstract void DrawToGraphics(Graphics graphics);
public virtual bool HitTest(PointF pos)
{
return (pos.X >= rect.AbsoluteX && pos.X <= rect.AbsoluteX + rect.ActualWidth &&
pos.Y >= rect.AbsoluteY && pos.Y <= rect.AbsoluteY + rect.ActualHeight);
}
public abstract void HandleMouseClick(PointF pos);
public abstract void HandleMouseDown(PointF pos);
public abstract void HandleMouseMove(PointF pos);
public abstract void HandleMouseUp(PointF pos);
public abstract void HandleMouseLeave();
protected void EmitRedraw ()
{
RedrawNeeded (this, EventArgs.Empty);
}
}
}

95
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Shapes/CollapseExpandShape.cs

@ -0,0 +1,95 @@
/*
* Created by SharpDevelop.
* User: itai
* Date: 28/09/2006
* Time: 19:04
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace ClassDiagram
{
public class CollapseExpandShape : VectorShape
{
private bool collapsed;
static LinearGradientBrush shade = new LinearGradientBrush(
new PointF(0, 0), new PointF(0, 22),
Color.White, Color.LightSteelBlue);
static PointF[] arrowPoints = new PointF[]{
new PointF(4.0f, 9.0f),
new PointF(10.0f, 3.0f),
new PointF(16.0f, 9.0f),
new PointF(15.0f, 11.0f),
new PointF(10.0f, 6.0f),
new PointF(5.0f, 11.0f)
};
static GraphicsPath roundedButton = InitializeButtonShape();
static Pen buttonPen = Pens.SteelBlue;
static Brush arrowBrush = Brushes.DarkBlue;
static GraphicsPath InitializeButtonShape()
{
GraphicsPath path = new GraphicsPath();
path.AddArc(0, 0, 3, 3, 180, 90);
path.AddArc(17, 0, 3, 3, 270, 90);
path.AddArc(17, 17, 3, 3, 0, 90);
path.AddArc(0, 17, 3, 3, 90, 90);
path.CloseFigure();
return path;
}
static protected void DrawButton (Graphics graphics)
{
if (graphics == null) return;
graphics.FillPath(shade, roundedButton);
graphics.DrawPath(buttonPen, roundedButton);
}
static protected void DrawArrow (Graphics graphics)
{
if (graphics == null) return;
graphics.FillPolygon (arrowBrush, arrowPoints);
}
public bool Collapsed
{
get { return collapsed; }
set { collapsed = value; }
}
public override void Draw(Graphics graphics)
{
if (graphics == null) return;
GraphicsState state = graphics.Save();
CollapseExpandShape.DrawButton(graphics);
if (collapsed)
{
graphics.TranslateTransform(0, 21);
graphics.ScaleTransform(1, -1);
}
CollapseExpandShape.DrawArrow(graphics);
graphics.TranslateTransform(0, 6);
CollapseExpandShape.DrawArrow(graphics);
graphics.Restore(state);
}
public override float ShapeWidth
{
get { return 20; }
}
public override float ShapeHeight
{
get { return 20; }
}
}
}

78
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Shapes/CollapseShape.cs

@ -0,0 +1,78 @@
/*
* Created by SharpDevelop.
* User: itai
* Date: 28/09/2006
* Time: 19:04
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace ClassDiagram
{
public class CollapseShape : VectorShape
{
static LinearGradientBrush shade = new LinearGradientBrush(
new PointF(0, 0), new PointF(0, 22),
Color.White, Color.LightSteelBlue);
static PointF[] arrowPoints = new PointF[]{
new PointF(5.0f, 10.0f),
new PointF(11.0f, 4.0f),
new PointF(17.0f, 10.0f),
new PointF(16.0f, 12.0f),
new PointF(11.0f, 7.0f),
new PointF(6.0f, 12.0f)
};
static GraphicsPath roundedButton = InitializeButtonShape();
static GraphicsPath InitializeButtonShape()
{
GraphicsPath path = new GraphicsPath();
path.AddArc(3, 3, 3, 3, 180, 90);
path.AddArc(18, 3, 3, 3, 270, 90);
path.AddArc(18, 18, 3, 3, 0, 90);
path.AddArc(3, 18, 3, 3, 90, 90);
path.CloseFigure();
return path;
}
static protected void DrawButton (Graphics graphics)
{
if (graphics == null) return;
graphics.FillPath(shade, roundedButton);
graphics.DrawPath(Pens.SteelBlue, roundedButton);
}
static protected void DrawArrow (Graphics graphics)
{
if (graphics == null) return;
graphics.FillPolygon (Brushes.DarkBlue, arrowPoints);
}
public override void Draw(Graphics graphics)
{
if (graphics == null) return;
CollapseShape.DrawButton(graphics);
graphics.TranslateTransform(1, 1);
CollapseShape.DrawArrow(graphics);
graphics.TranslateTransform(0, 6);
CollapseShape.DrawArrow(graphics);
}
public override float ShapeWidth
{
get { return 23; }
}
public override float ShapeHeight
{
get { return 23; }
}
}
}

68
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Shapes/EventShape.cs

@ -0,0 +1,68 @@
/*
* Created by SharpDevelop.
* User: itai
* Date: 28/09/2006
* Time: 19:04
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace ClassDiagram
{
public class EventShape : VectorShape
{
static PointF[] lightningPoints1 = new PointF[]{
new PointF( 5.0f, 1.0f),
new PointF( 9.0f, 1.0f),
new PointF( 6.0f, 5.0f),
new PointF( 8.0f, 5.0f),
new PointF( 4.0f, 12.0f),
new PointF( 6.0f, 6.0f),
new PointF( 4.0f, 6.0f)
};
static PointF[] lightningPoints2 = new PointF[]{
new PointF( 9.0f, 1.0f),
new PointF(10.0f, 2.0f),
new PointF( 8.0f, 5.0f),
new PointF( 6.0f, 5.0f)
};
static PointF[] lightningPoints3 = new PointF[]{
new PointF( 8.0f, 5.0f),
new PointF( 9.0f, 6.0f),
new PointF( 5.0f, 13.0f),
new PointF( 4.0f, 12.0f)
};
static PointF[] lightningPoints4 = new PointF[]{
new PointF( 4.0f, 6.0f),
new PointF( 6.0f, 6.0f),
new PointF( 6.0f, 7.0f),
new PointF( 5.0f, 7.0f)
};
public override void Draw(Graphics graphics)
{
if (graphics == null) return;
graphics.FillPolygon (Brushes.DarkGoldenrod, lightningPoints2);
graphics.FillPolygon (Brushes.DarkGoldenrod, lightningPoints3);
graphics.FillPolygon (Brushes.DarkGoldenrod, lightningPoints4);
graphics.FillPolygon (Brushes.Gold, lightningPoints1);
}
public override float ShapeWidth
{
get { return 14.0f; }
}
public override float ShapeHeight
{
get { return 14.0f; }
}
}
}

30
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Shapes/ExpandShape.cs

@ -0,0 +1,30 @@
/*
* Created by SharpDevelop.
* User: itai
* Date: 28/09/2006
* Time: 19:04
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace ClassDiagram
{
public class ExpandShape : CollapseShape
{
public override void Draw(Graphics graphics)
{
if (graphics == null) return;
CollapseShape.DrawButton(graphics);
graphics.TranslateTransform(1, 23);
graphics.ScaleTransform(1, -1);
CollapseShape.DrawArrow(graphics);
graphics.TranslateTransform(0, 6);
CollapseShape.DrawArrow(graphics);
}
}
}

35
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Shapes/FieldShape.cs

@ -0,0 +1,35 @@
/*
* Created by SharpDevelop.
* User: itai
* Date: 28/09/2006
* Time: 19:04
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace ClassDiagram
{
public class FieldShape : MethodShape
{
static Brush brickBrush1 = new SolidBrush(Color.FromArgb(255, 0, 192, 192));
static Brush brickBrush2 = new SolidBrush(Color.FromArgb(255, 0, 064, 064));
static Brush brickBrush3 = new SolidBrush(Color.FromArgb(255, 0, 128, 128));
public override void Draw(Graphics graphics)
{
if (graphics == null) return;
GraphicsState state = graphics.Save();
graphics.TranslateTransform(17.0f, 0.0f);
graphics.ScaleTransform(-1.0f, 1.0f);
MethodShape.DrawBrick(graphics, brickBrush1, brickBrush2, brickBrush3);
graphics.Restore(state);
graphics.FillRectangle(Brushes.Gray, 1.0f, 4.5f, 3.5f, 0.5f);
graphics.FillRectangle(Brushes.Gray, 0.0f, 6.5f, 3.5f, 0.5f);
graphics.FillRectangle(Brushes.Gray, 2.0f, 8.5f, 3.5f, 0.5f);
}
}
}

61
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Shapes/InheritanceShape.cs

@ -0,0 +1,61 @@
/*
* Created by SharpDevelop.
* User: itai
* Date: 28/09/2006
* Time: 19:04
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace ClassDiagram
{
public class InheritanceShape : VectorShape
{
static GraphicsPath path = InitializePath();
static GraphicsPath InitializePath ()
{
GraphicsPath path = new GraphicsPath();
path.StartFigure();
path.AddPolygon(new PointF[]{
new PointF(0.0f, 1.9f),
new PointF(2.0f, 1.9f),
new PointF(2.0f, 1.0f),
new PointF(3.0f, 2.0f),
new PointF(2.0f, 3.0f),
new PointF(2.0f, 2.1f),
new PointF(0.0f, 2.1f)
});
path.CloseFigure();
path.StartFigure();
path.AddPolygon(new PointF[]{
new PointF(2.2f, 1.4f),
new PointF(2.7f, 2.0f),
new PointF(2.2f, 2.6f)
});
path.FillMode = FillMode.Alternate;
path.CloseFigure();
return path;
}
public override float ShapeWidth
{
get { return 3.0f; }
}
public override float ShapeHeight
{
get { return 4.0f; }
}
public override void Draw(Graphics graphics)
{
if (graphics == null) return;
graphics.FillPath(Brushes.Black, path);
}
}
}

69
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Shapes/MethodShape.cs

@ -0,0 +1,69 @@
/*
* Created by SharpDevelop.
* User: itai
* Date: 28/09/2006
* Time: 19:04
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace ClassDiagram
{
public class MethodShape : VectorShape
{
static Brush brickBrush1 = new SolidBrush(Color.FromArgb(255, 192, 0, 192));
static PointF[] brickPoints1 = new PointF[]{
new PointF( 8.0f, 2.0f),
new PointF(12.0f, 5.0f),
new PointF( 9.0f, 8.0f),
new PointF( 5.0f, 4.0f)
};
static Brush brickBrush2 = new SolidBrush(Color.FromArgb(255, 064, 0, 064));
static PointF[] brickPoints2 = new PointF[]{
new PointF( 9.0f, 8.0f),
new PointF(12.0f, 5.0f),
new PointF(12.0f, 7.0f),
new PointF( 9.0f, 10.0f),
};
static Brush brickBrush3 = new SolidBrush(Color.FromArgb(255, 128, 0, 128));
static PointF[] brickPoints3 = new PointF[]{
new PointF( 5.0f, 4.0f),
new PointF( 9.0f, 8.0f),
new PointF( 9.0f, 10.0f),
new PointF( 5.0f, 6.0f)
};
static protected void DrawBrick (Graphics graphics, Brush b1, Brush b2, Brush b3)
{
if (graphics == null) return;
graphics.FillPolygon (b1, brickPoints1);
graphics.FillPolygon (b2, brickPoints2);
graphics.FillPolygon (b3, brickPoints3);
}
public override void Draw(Graphics graphics)
{
if (graphics == null) return;
MethodShape.DrawBrick(graphics, brickBrush1, brickBrush2, brickBrush3);
graphics.FillRectangle(Brushes.Gray, 1.0f, 4.5f, 3.5f, 0.5f);
graphics.FillRectangle(Brushes.Gray, 0.0f, 6.5f, 3.5f, 0.5f);
graphics.FillRectangle(Brushes.Gray, 2.0f, 8.5f, 3.5f, 0.5f);
}
public override float ShapeWidth
{
get { return 13.0f; }
}
public override float ShapeHeight
{
get { return 13.0f; }
}
}
}

31
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Shapes/MinusShape.cs

@ -0,0 +1,31 @@
/*
* Created by SharpDevelop.
* User: itai
* Date: 28/09/2006
* Time: 19:04
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace ClassDiagram
{
public class MinusShape : SmallButtonShape
{
static Rectangle minus = new Rectangle(2, 4, 6, 2);
static Pen stroke = Pens.Black;
static Brush fill = Brushes.White;
public override void Draw(Graphics graphics)
{
if (graphics == null) return;
base.Draw(graphics);
graphics.FillRectangle (fill, minus);
graphics.DrawRectangle (stroke, minus);
}
}
}

44
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Shapes/PlusShape.cs

@ -0,0 +1,44 @@
/*
* Created by SharpDevelop.
* User: itai
* Date: 28/09/2006
* Time: 19:04
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace ClassDiagram
{
public class PlusShape : SmallButtonShape
{
static PointF[] plusPoints = new PointF[]{
new PointF(4.0f, 2.0f),
new PointF(6.0f, 2.0f),
new PointF(6.0f, 4.0f),
new PointF(8.0f, 4.0f),
new PointF(8.0f, 6.0f),
new PointF(6.0f, 6.0f),
new PointF(6.0f, 8.0f),
new PointF(4.0f, 8.0f),
new PointF(4.0f, 6.0f),
new PointF(2.0f, 6.0f),
new PointF(2.0f, 4.0f),
new PointF(4.0f, 4.0f)
};
static Pen stroke = Pens.Black;
static Brush fill = Brushes.White;
public override void Draw(Graphics graphics)
{
if (graphics == null) return;
base.Draw(graphics);
graphics.FillPolygon (fill , plusPoints);
graphics.DrawPolygon (stroke, plusPoints);
}
}
}

80
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Shapes/PropertyShape.cs

@ -0,0 +1,80 @@
/*
* Created by SharpDevelop.
* User: itai
* Date: 28/09/2006
* Time: 19:04
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace ClassDiagram
{
public class PropertyShape : VectorShape
{
static PointF[] handPoints = new PointF[]{
new PointF( 3.0f, 7.0f),
new PointF( 4.0f, 8.0f),
new PointF( 6.0f, 6.0f),
new PointF( 8.0f, 8.0f),
new PointF( 9.0f, 7.0f),
new PointF(10.0f, 8.0f),
new PointF(12.0f, 6.0f),
new PointF(13.0f, 6.0f),
new PointF(13.0f, 2.0f),
new PointF( 8.0f, 2.0f)
};
static Pen handPen = new Pen(Color.Brown, 0.5f);
static Brush handBrush = Brushes.Yellow;
static Pen sleevePen = Pens.DarkBlue;
static Brush sleeveBrush = Brushes.Blue;
static Brush shadowBrush = Brushes.Gray;
static Brush linesBrush = Brushes.Black;
static Brush panelBrush = Brushes.White;
static Pen panelPen = Pens.SteelBlue;
public override void Draw(Graphics graphics)
{
if (graphics == null) return;
#region Panel
graphics.FillRectangle(shadowBrush, 1, 14, 10.5f, 1.5f);
graphics.FillRectangle(shadowBrush, 10, 6, 1.5f, 9);
graphics.FillRectangle(panelBrush, 0, 5, 10, 9);
graphics.DrawRectangle(panelPen, 0, 5, 10, 9);
graphics.FillRectangle(linesBrush, 1.5f, 9, 2, 1);
graphics.FillRectangle(linesBrush, 5, 9, 3, 1);
graphics.FillRectangle(linesBrush, 1.5f, 11, 2, 1);
graphics.FillRectangle(linesBrush, 5, 11, 3, 1);
#endregion
#region Hand
//TODO - improve the hand, choose better colors
graphics.FillPolygon(handBrush, handPoints);
graphics.DrawPolygon(handPen, handPoints);
graphics.DrawLine(handPen, 6, 6, 8, 4);
graphics.DrawLine(handPen, 7, 7, 9.5f, 4.5f);
graphics.DrawLine(handPen, 8, 8, 11, 5);
graphics.FillRectangle(sleeveBrush, 13, 2, 2, 4);
graphics.DrawRectangle(sleevePen, 13, 2, 2, 4);
#endregion
}
public override float ShapeWidth
{
get { return 16.0f; }
}
public override float ShapeHeight
{
get { return 16.0f; }
}
}
}

47
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Shapes/RouteInheritanceShape.cs

@ -0,0 +1,47 @@
/*
* Created by SharpDevelop.
* User: itai
* Date: 11/9/2006
* Time: 4:57 PM
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using Tools.Diagrams;
namespace ClassDiagram
{
/// <summary>
/// Description of RouteInheritanceShape.
/// </summary>
public class RouteInheritanceShape : RouteShape
{
static GraphicsPath path = InitizlizePath();
static GraphicsPath InitizlizePath()
{
GraphicsPath path = new GraphicsPath();
path.AddLines( new PointF[]
{
new PointF(0.0f, 0.0f),
new PointF(5.0f, 9.0f),
new PointF(-5.0f, 9.0f)
});
path.CloseFigure();
return path;
}
static Pen stroke = Pens.Black;
static Brush fill = Brushes.White;
protected override void Paint (Graphics graphics)
{
graphics.FillPath(fill, path);
graphics.DrawPath(stroke, path);
}
}
}

69
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Shapes/RouteShape.cs

@ -0,0 +1,69 @@
/*
* Created by SharpDevelop.
* User: itai
* Date: 03/11/2006
* Time: 19:42
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using Tools.Diagrams;
namespace ClassDiagram
{
public abstract class RouteShape : IRouteShape
{
private static SizeF baseSize = new SizeF(10, 10);
private static float ConvertDirection (Direction dir)
{
switch (dir)
{
case Direction.Up: return 0;
case Direction.Down: return 180;
case Direction.Right: return 90;
case Direction.Left: return 270;
}
return 0;
}
public void Draw (Graphics graphics, Route route, bool atEnd)
{
if (graphics == null) return;
if (route == null) return;
GraphicsState state = graphics.Save();
float direction = 0;
PointF pos = default(PointF);
if (atEnd)
{
pos = route.GetEndPoint();
direction = ConvertDirection(route.GetEndDirection());
}
else
{
pos = route.GetStartPoint();
direction = ConvertDirection(route.GetStartDirection());
}
// In matrix math, the correct way is to put rotation BEFORE
// translation. However, the simple transformation maethods of
// GDI+ works in "Prepend" mode, which reverses the order of
// operations.
graphics.TranslateTransform(pos.X, pos.Y);
graphics.RotateTransform(direction);
Paint(graphics);
graphics.Restore(state);
}
protected abstract void Paint (Graphics graphics);
protected virtual SizeF Size
{
get { return RouteShape.baseSize; }
}
}
}

34
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Shapes/Shapes.cs

@ -0,0 +1,34 @@
/*
* Created by SharpDevelop.
* User: itai
* Date: 28/09/2006
* Time: 19:04
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace ClassDiagram
{
public static class Shapes
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
public static readonly PlusShape Plus = new PlusShape();
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
public static readonly MinusShape Minus = new MinusShape();
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
public static readonly CollapseShape Collapse = new CollapseShape();
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
public static readonly ExpandShape Expand = new ExpandShape();
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
public static readonly InheritanceShape Inherits = new InheritanceShape();
}
}

31
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Shapes/SmallButtonShape.cs

@ -0,0 +1,31 @@
/*
* Created by SharpDevelop.
* User: itai
* Date: 28/09/2006
* Time: 19:04
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace ClassDiagram
{
public class SmallButtonShape : SmallIconShape
{
static Rectangle rect = new Rectangle(0, 0, 10, 10);
static LinearGradientBrush shade = new LinearGradientBrush(
new PointF(0, 0), new PointF(0, 10),
Color.White, Color.LightGray);
static Pen strokePen = Pens.SteelBlue;
public override void Draw(Graphics graphics)
{
if (graphics == null) return;
graphics.FillRectangle(shade, rect);
graphics.DrawRectangle(strokePen, rect);
}
}
}

29
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Shapes/SmallIconShape.cs

@ -0,0 +1,29 @@
/*
* Created by SharpDevelop.
* User: itai
* Date: 28/09/2006
* Time: 19:04
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace ClassDiagram
{
public abstract class SmallIconShape : VectorShape
{
public override float ShapeWidth
{
get { return 10.0f; }
}
public override float ShapeHeight
{
get { return 10.0f; }
}
}
}

78
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/Shapes/VectorShape.cs

@ -0,0 +1,78 @@
/*
* Created by SharpDevelop.
* User: itai
* Date: 28/09/2006
* Time: 19:04
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using Tools.Diagrams.Drawables;
using Tools.Diagrams;
namespace ClassDiagram
{
public abstract class VectorShape : BaseRectangle, IDrawableRectangle
{
public VectorShape ()
{
KeepAspectRatio = true;
}
public abstract void Draw (Graphics graphics);
/// <summary>
/// Draw the shape to the given graphics object.
/// </summary>
/// <param name="graphics"></param>
public void DrawToGraphics (Graphics graphics)
{
float scalex = base.ActualWidth / ShapeWidth;
float scaley = base.ActualHeight / ShapeHeight;
if (scalex == 0 || scaley == 0) return;
DrawToGraphics (graphics, AbsoluteX, AbsoluteY, scalex, scaley);
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
public virtual void DrawToGraphics (Graphics graphics, float x, float y)
{
DrawToGraphics(graphics, x, y, 1);
}
public virtual void DrawToGraphics (Graphics graphics, float x, float y, float scale)
{
DrawToGraphics(graphics, x, y, scale, scale);
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
public virtual void DrawToGraphics (Graphics graphics, float x, float y, float scaleX, float scaleY)
{
if (graphics == null) return;
GraphicsState state = graphics.Save();
graphics.TranslateTransform (x, y);
graphics.ScaleTransform(scaleX, scaleY);
Draw(graphics);
//graphics.DrawRectangle(Pens.Magenta, 0, 0, ShapeWidth, ShapeHeight);
graphics.Restore(state);
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
public virtual bool IsInside (float x, float y)
{
return (x >= AbsoluteX && x < AbsoluteX + ActualWidth &&
y >= AbsoluteY && y < AbsoluteY + ActualHeight);
}
public abstract float ShapeWidth { get; }
public abstract float ShapeHeight { get; }
public override float GetAbsoluteContentWidth() { return ShapeWidth; }
public override float GetAbsoluteContentHeight() { return ShapeHeight; }
}
}

34
src/AddIns/DisplayBindings/ClassDiagram/ClassCanvas/StructCanvasItem.cs

@ -0,0 +1,34 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
//using System.Reflection;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Project;
namespace ClassDiagram
{
public class StructCanvasItem : ClassCanvasItem
{
public StructCanvasItem (IClass ct) : base (ct) {}
protected override Color TitleBackground
{
get { return Color.Wheat;}
}
protected override Brush InnerTitlesBackground
{
get { return Brushes.PapayaWhip;}
}
}
}

120
src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin.sln

@ -0,0 +1,120 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
# SharpDevelop 2.1.0.2192
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassDiagramAddin", "ClassDiagramAddin\ClassDiagramAddin.csproj", "{5A1354DF-4989-4BB4-BC6B-D627C2E9FA13}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassCanvas", "ClassCanvas\ClassCanvas.csproj", "{08F772A1-F0BE-433E-8B37-F6522953DB05}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Diagrams", "DiagramRouter\Diagrams.csproj", "{0991423A-DBF6-4C89-B365-A1DF1EB32E42}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassEditor", "ClassEditor\ClassEditor.csproj", "{F5E059BB-96C2-4398-BED0-8598CD434173}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SharpDevelop", "SharpDevelop", "{7C408F87-A95D-4EEF-B20D-A15200F42640}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormsUI", "..\..\..\Libraries\DockPanel_Src\WinFormsUI\WinFormsUI.csproj", "{D3C782BA-178E-4235-A3BA-8C11DEBB6BEE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TreeListView", "..\..\Misc\Debugger\TreeListView\Project\TreeListView.csproj", "{B08385CD-F0CC-488C-B4F4-EEB34B6D2688}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactory", "..\..\..\Libraries\NRefactory\Project\NRefactory.csproj", "{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.TextEditor", "..\..\..\Libraries\ICSharpCode.TextEditor\Project\ICSharpCode.TextEditor.csproj", "{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.Widgets", "..\..\..\Main\ICSharpCode.SharpDevelop.Widgets\Project\ICSharpCode.SharpDevelop.Widgets.csproj", "{8035765F-D51F-4A0C-A746-2FD100E19419}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.Dom", "..\..\..\Main\ICSharpCode.SharpDevelop.Dom\Project\ICSharpCode.SharpDevelop.Dom.csproj", "{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop", "..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj", "{2748AD25-9C63-4E12-877B-4DCE96FBED54}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Core", "..\..\..\Main\Core\Project\ICSharpCode.Core.csproj", "{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassDiagramApp", "ClassDiagramApp\ClassDiagramApp.csproj", "{709D6ACE-4921-4DF6-831A-E74E3EFAA742}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5A1354DF-4989-4BB4-BC6B-D627C2E9FA13}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5A1354DF-4989-4BB4-BC6B-D627C2E9FA13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5A1354DF-4989-4BB4-BC6B-D627C2E9FA13}.Release|Any CPU.Build.0 = Release|Any CPU
{5A1354DF-4989-4BB4-BC6B-D627C2E9FA13}.Release|Any CPU.ActiveCfg = Release|Any CPU
{08F772A1-F0BE-433E-8B37-F6522953DB05}.Debug|Any CPU.Build.0 = Debug|Any CPU
{08F772A1-F0BE-433E-8B37-F6522953DB05}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{08F772A1-F0BE-433E-8B37-F6522953DB05}.Release|Any CPU.Build.0 = Release|Any CPU
{08F772A1-F0BE-433E-8B37-F6522953DB05}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A66666C9-58CC-4DC1-A6BD-FFD950A3D5B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A66666C9-58CC-4DC1-A6BD-FFD950A3D5B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A66666C9-58CC-4DC1-A6BD-FFD950A3D5B8}.Release|Any CPU.Build.0 = Release|Any CPU
{A66666C9-58CC-4DC1-A6BD-FFD950A3D5B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2A7FD990-F2C5-4A99-BD69-07DE56DAD931}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2A7FD990-F2C5-4A99-BD69-07DE56DAD931}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2A7FD990-F2C5-4A99-BD69-07DE56DAD931}.Release|Any CPU.Build.0 = Release|Any CPU
{2A7FD990-F2C5-4A99-BD69-07DE56DAD931}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0991423A-DBF6-4C89-B365-A1DF1EB32E42}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0991423A-DBF6-4C89-B365-A1DF1EB32E42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0991423A-DBF6-4C89-B365-A1DF1EB32E42}.Release|Any CPU.Build.0 = Release|Any CPU
{0991423A-DBF6-4C89-B365-A1DF1EB32E42}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F5E059BB-96C2-4398-BED0-8598CD434173}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F5E059BB-96C2-4398-BED0-8598CD434173}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F5E059BB-96C2-4398-BED0-8598CD434173}.Release|Any CPU.Build.0 = Release|Any CPU
{F5E059BB-96C2-4398-BED0-8598CD434173}.Release|Any CPU.ActiveCfg = Release|Any CPU
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Release|Any CPU.Build.0 = Release|Any CPU
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2748AD25-9C63-4E12-877B-4DCE96FBED54}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2748AD25-9C63-4E12-877B-4DCE96FBED54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2748AD25-9C63-4E12-877B-4DCE96FBED54}.Release|Any CPU.Build.0 = Release|Any CPU
{2748AD25-9C63-4E12-877B-4DCE96FBED54}.Release|Any CPU.ActiveCfg = Release|Any CPU
{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Release|Any CPU.Build.0 = Release|Any CPU
{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{80318B5F-A25D-45AB-8A95-EF31D2370A4C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{80318B5F-A25D-45AB-8A95-EF31D2370A4C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{80318B5F-A25D-45AB-8A95-EF31D2370A4C}.Release|Any CPU.Build.0 = Release|Any CPU
{80318B5F-A25D-45AB-8A95-EF31D2370A4C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{29FD215C-31A9-4B44-B754-EF4627B30EF3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{29FD215C-31A9-4B44-B754-EF4627B30EF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{29FD215C-31A9-4B44-B754-EF4627B30EF3}.Release|Any CPU.Build.0 = Release|Any CPU
{29FD215C-31A9-4B44-B754-EF4627B30EF3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8035765F-D51F-4A0C-A746-2FD100E19419}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8035765F-D51F-4A0C-A746-2FD100E19419}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8035765F-D51F-4A0C-A746-2FD100E19419}.Release|Any CPU.Build.0 = Release|Any CPU
{8035765F-D51F-4A0C-A746-2FD100E19419}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}.Release|Any CPU.Build.0 = Release|Any CPU
{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Release|Any CPU.Build.0 = Release|Any CPU
{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B08385CD-F0CC-488C-B4F4-EEB34B6D2688}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B08385CD-F0CC-488C-B4F4-EEB34B6D2688}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B08385CD-F0CC-488C-B4F4-EEB34B6D2688}.Release|Any CPU.Build.0 = Release|Any CPU
{B08385CD-F0CC-488C-B4F4-EEB34B6D2688}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D3C782BA-178E-4235-A3BA-8C11DEBB6BEE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D3C782BA-178E-4235-A3BA-8C11DEBB6BEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D3C782BA-178E-4235-A3BA-8C11DEBB6BEE}.Release|Any CPU.Build.0 = Release|Any CPU
{D3C782BA-178E-4235-A3BA-8C11DEBB6BEE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{709D6ACE-4921-4DF6-831A-E74E3EFAA742}.Debug|Any CPU.Build.0 = Debug|Any CPU
{709D6ACE-4921-4DF6-831A-E74E3EFAA742}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{709D6ACE-4921-4DF6-831A-E74E3EFAA742}.Release|Any CPU.Build.0 = Release|Any CPU
{709D6ACE-4921-4DF6-831A-E74E3EFAA742}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {7C408F87-A95D-4EEF-B20D-A15200F42640}
{2748AD25-9C63-4E12-877B-4DCE96FBED54} = {7C408F87-A95D-4EEF-B20D-A15200F42640}
{924EE450-603D-49C1-A8E5-4AFAA31CE6F3} = {7C408F87-A95D-4EEF-B20D-A15200F42640}
{8035765F-D51F-4A0C-A746-2FD100E19419} = {7C408F87-A95D-4EEF-B20D-A15200F42640}
{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D} = {7C408F87-A95D-4EEF-B20D-A15200F42640}
{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195} = {7C408F87-A95D-4EEF-B20D-A15200F42640}
{B08385CD-F0CC-488C-B4F4-EEB34B6D2688} = {7C408F87-A95D-4EEF-B20D-A15200F42640}
{D3C782BA-178E-4235-A3BA-8C11DEBB6BEE} = {7C408F87-A95D-4EEF-B20D-A15200F42640}
EndGlobalSection
EndGlobal

151
src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/ClassDiagramAddin.addin

@ -0,0 +1,151 @@
<?xml version="1.0" encoding="utf-8" ?>
<AddIn name = "Class Diagram"
author = "Itai Bar-Haim"
url = "http://sdclassdiagram.sf.net"
description = "Shows a visual class diagram of the project.">
<Manifest>
<Identity name="ClassDiagram" version="@ClassDiagramAddin.dll"/>
<Dependency addin="SharpDevelop" version="3.0"/>
</Manifest>
<Runtime>
<Import assembly="ClassDiagramAddin.dll"/>
</Runtime>
<Path name = "/SharpDevelop/Pads/ProjectBrowser/ContextMenu/ProjectActions">
<MenuItem id = "ShowClassDiagram"
label = "Show Class Diagram"
class = "ClassDiagramAddin.ShowClassDiagramCommand"
icon = "ClassDiagram.ShowClassDiagram"/>
</Path>
<Path name="/SharpDevelop/ViewContent/ClassDiagram/Toolbar">
<ToolbarItem id = "AutoArrangeDiagram"
tooltip = "Auto Arrange"
class = "ClassDiagramAddin.AutoArrangeDiagramCommand"
icon = "ClassDiagram.AutoArrange"/>
<ToolbarItem id = "ExpandAll"
tooltip = "Expand All"
class = "ClassDiagramAddin.ExpandAllCommand"
icon = "ClassDiagram.ExpandAll"/>
<ToolbarItem id = "CollapseAll"
tooltip = "Collapse All"
class = "ClassDiagramAddin.CollapseAllCommand"
icon = "ClassDiagram.CollapseAll"/>
<ToolbarItem id = "MatchAllWidths"
tooltip = "Match All Widths"
class = "ClassDiagramAddin.MatchAllWidthsCommand"
icon = "ClassDiagram.MatchWidth" />
<ToolbarItem id = "ShrinkAllWidths"
tooltip = "Shrink All Widths"
class = "ClassDiagramAddin.ShrinkAllWidthsCommand"
icon = "ClassDiagram.ShrinkWidth" />
<ToolbarItem id = "Zoom"
type = "ComboBox"
tooltip = "Zoom"
class = "ClassDiagramAddin.SetDiagramZoomCommand"/>
</Path>
<Path name="/SharpDevelop/ViewContent/ClassDiagram/ContextMenu">
<MenuItem id = "AddItem"
label = "Add"
type = "Menu">
<MenuItem id = "AddClassItem"
label = "Class"
class = "ClassDiagramAddin.AddClassCommand"/>
<MenuItem id = "AddAbstractClassItem"
label = "Abstract Class"
class = "ClassDiagramAddin.AddAbstractClassCommand"/>
<MenuItem id = "AddInterfaceItem"
label = "Interface"
class = "ClassDiagramAddin.AddInterfaceCommand"/>
<MenuItem id = "AddDelegateItem"
label = "Delegate"
class = "ClassDiagramAddin.AddDelegateCommand"/>
<MenuItem id = "AddEnumItem"
label = "Enum"
class = "ClassDiagramAddin.AddEnumCommand"/>
<MenuItem id = "AddNoteItem"
label = "Note"
class = "ClassDiagramAddin.AddNoteCommand"/>
</MenuItem>
<MenuItem type = "Separator" />
<MenuItem id = "AutoArrangeDiagram"
label = "Auto Arrange"
class = "ClassDiagramAddin.AutoArrangeDiagramCommand"
icon = "ClassDiagram.AutoArrange"/>
<MenuItem id = "ExpandAll"
label = "Expand All"
class = "ClassDiagramAddin.ExpandAllCommand"
icon = "ClassDiagram.ExpandAll"/>
<MenuItem id = "CollapseAll"
label = "Collapse All"
class = "ClassDiagramAddin.CollapseAllCommand"
icon = "ClassDiagram.CollapseAll"/>
<MenuItem id = "MatchAllWidths"
label = "Match All Widths"
class = "ClassDiagramAddin.MatchAllWidthsCommand"
icon = "ClassDiagram.MatchWidth" />
<MenuItem id = "ShrinkAllWidths"
label = "Shrink All Widths"
class = "ClassDiagramAddin.ShrinkAllWidthsCommand"
icon = "ClassDiagram.ShrinkWidth" />
<MenuItem type = "Separator" />
<MenuItem id = "SaveAsImage"
label = "Save to Bitmap"
class = "ClassDiagramAddin.SaveToBitmapCommand" />
</Path>
<Path name = "/Workspace/Icons">
<!-- CD -->
<Icon id = "CDFile"
extensions = ".cd"
resource = "ClassDiagram.ShowClassDiagram"/>
</Path>
<Path name="/SharpDevelop/Workbench/FileFilter">
<FileFilter id = "ClassDiagramFileFilter"
name = "Class Diagrams (*.cd)"
extensions = "*.cd"
insertbefore = "Boo"/>
</Path>
<Path name = "/SharpDevelop/Workbench/DisplayBindings">
<DisplayBinding id = "ClassDiagram"
class = "ClassDiagramAddin.ClassDiagramDisplayBinding"
insertbefore = "Text"
fileNamePattern = "\.(cd)$"
languagePattern = "^ClassDiagramFiles$"/>
</Path>
<Path name = "/SharpDevelop/Workbench/Pads">
<Pad id = "ClassEditorPad"
category = "Tools"
title = "Class Editor"
class = "ClassDiagramAddin.ClassEditorPad"
icon = "ClassDiagram.ClassEditor" />
</Path>
<BitmapResources file="Resources\Bitmaps.resources" />
</AddIn>

63
src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/ClassDiagramAddin.cd

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<ClassDiagram Zoom="1">
<ClassItem X="40" Y="230" Width="393.7436" Type="ClassDiagramAddin.ClassDiagramViewContent" Collapsed="True">
<Properties Collapsed="False" />
<Methods Collapsed="False" />
<Fields Collapsed="False" />
</ClassItem>
<ClassItem X="40" Y="320" Width="325.708" Type="ClassDiagramAddin.ClassEditorPad" Collapsed="True">
<Properties Collapsed="False" />
<Methods Collapsed="False" />
<Fields Collapsed="False" />
</ClassItem>
<ClassItem X="40" Y="130" Width="189.4326" Type="ClassDiagramAddin.SaveToBitmapCommand" Collapsed="True">
<Methods Collapsed="False" />
</ClassItem>
<ClassItem X="40" Y="420" Width="193.8208" Type="ClassDiagramAddin.ShowClassDiagramCommand" Collapsed="True">
<Methods Collapsed="False" />
</ClassItem>
<ClassItem X="40" Y="510" Width="346.521" Type="ClassDiagramAddin.ClassDiagramDisplayBinding" Collapsed="True">
<Methods Collapsed="False" />
</ClassItem>
<ClassItem X="40" Y="40" Width="194.7392" Type="ClassDiagramAddin.ClassDiagramAddinCommand" Collapsed="True">
<Properties Collapsed="False" />
</ClassItem>
<ClassItem X="270" Y="130" Width="201.1308" Type="ClassDiagramAddin.AutoArrangeDiagramCommand" Collapsed="True">
<Methods Collapsed="False" />
</ClassItem>
<ClassItem X="510" Y="130" Width="189.4326" Type="ClassDiagramAddin.ExpandAllCommand" Collapsed="True">
<Methods Collapsed="False" />
</ClassItem>
<ClassItem X="740" Y="130" Width="189.4326" Type="ClassDiagramAddin.CollapseAllCommand" Collapsed="True">
<Methods Collapsed="False" />
</ClassItem>
<ClassItem X="970" Y="130" Width="189.4326" Type="ClassDiagramAddin.MatchAllWidthsCommand" Collapsed="True">
<Methods Collapsed="False" />
</ClassItem>
<ClassItem X="1200" Y="130" Width="189.4326" Type="ClassDiagramAddin.ShrinkAllWidthsCommand" Collapsed="True">
<Methods Collapsed="False" />
</ClassItem>
<ClassItem X="40" Y="610" Width="287.2026" Type="ClassDiagramAddin.SetDiagramZoomCommand" Collapsed="True">
<Properties Collapsed="False" />
<Methods Collapsed="False" />
<Fields Collapsed="False" />
</ClassItem>
<ClassItem X="1430" Y="130" Width="189.4326" Type="ClassDiagramAddin.AddClassCommand" Collapsed="True">
<Methods Collapsed="False" />
</ClassItem>
<ClassItem X="1660" Y="130" Width="189.4326" Type="ClassDiagramAddin.AddAbstractClassCommand" Collapsed="True">
<Methods Collapsed="False" />
</ClassItem>
<ClassItem X="1890" Y="130" Width="189.4326" Type="ClassDiagramAddin.AddInterfaceCommand" Collapsed="True">
<Methods Collapsed="False" />
</ClassItem>
<ClassItem X="2120" Y="130" Width="189.4326" Type="ClassDiagramAddin.AddDelegateCommand" Collapsed="True">
<Methods Collapsed="False" />
</ClassItem>
<ClassItem X="2350" Y="130" Width="189.4326" Type="ClassDiagramAddin.AddEnumCommand" Collapsed="True">
<Methods Collapsed="False" />
</ClassItem>
<ClassItem X="2580" Y="130" Width="189.4326" Type="ClassDiagramAddin.AddNoteCommand" Collapsed="True">
<Methods Collapsed="False" />
</ClassItem>
</ClassDiagram>

104
src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/ClassDiagramAddin.csproj

@ -0,0 +1,104 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OutputType>Library</OutputType>
<RootNamespace>ClassDiagramAddin</RootNamespace>
<AssemblyName>ClassDiagramAddin</AssemblyName>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{5A1354DF-4989-4BB4-BC6B-D627C2E9FA13}</ProjectGuid>
<OutputPath>..\..\..\..\..\AddIns\AddIns\DisplayBindings\ClassDiagram\</OutputPath>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<IntermediateOutputPath>obj\Debug\</IntermediateOutputPath>
<Optimize>False</Optimize>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugSymbols>true</DebugSymbols>
<DebugType>Full</DebugType>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<StartAction>Program</StartAction>
<StartProgram>..\..\..\..\..\bin\SharpDevelop.exe</StartProgram>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
<IntermediateOutputPath>obj\Release\</IntermediateOutputPath>
<Optimize>True</Optimize>
<DefineConstants>TRACE</DefineConstants>
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<BaseAddress>4194304</BaseAddress>
<PlatformTarget>AnyCPU</PlatformTarget>
<FileAlignment>4096</FileAlignment>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<None Include="ClassDiagramAddin.addin">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Compile Include="..\..\..\..\Main\GlobalAssemblyInfo.cs">
<Link>Configuration\GlobalAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Configuration\AssemblyInfo.cs" />
<Compile Include="Src\ClassDiagramViewContent.cs" />
<Compile Include="Src\ClassEditorPad.cs" />
<Compile Include="Src\SaveToBitmapCommand.cs" />
<Compile Include="Src\ShowClassDiagramCommand.cs" />
<Compile Include="Src\ClassDiagramDisplayBinding.cs" />
<Compile Include="Src\ClassDiagramCommand.cs" />
<None Include="Resources\Bitmaps.resources">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Compile Include="Src\ClassDiagramAddItemCommands.cs" />
<Content Include="ClassDiagramAddin.cd" />
<Content Include="ClassDiagramAddin.cd" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\Libraries\ICSharpCode.TextEditor\Project\ICSharpCode.TextEditor.csproj">
<Project>{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}</Project>
<Name>ICSharpCode.TextEditor</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj">
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project>
<Name>ICSharpCode.SharpDevelop</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\Core\Project\ICSharpCode.Core.csproj">
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project>
<Name>ICSharpCode.Core</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.SharpDevelop.Dom\Project\ICSharpCode.SharpDevelop.Dom.csproj">
<Project>{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}</Project>
<Name>ICSharpCode.SharpDevelop.Dom</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\ClassCanvas\ClassCanvas.csproj">
<Project>{08F772A1-F0BE-433E-8B37-F6522953DB05}</Project>
<Name>ClassCanvas</Name>
</ProjectReference>
<ProjectReference Include="..\ClassEditor\ClassEditor.csproj">
<Project>{F5E059BB-96C2-4398-BED0-8598CD434173}</Project>
<Name>ClassEditor</Name>
</ProjectReference>
<ProjectReference Include="..\DiagramRouter\Diagrams.csproj">
<Project>{0991423A-DBF6-4C89-B365-A1DF1EB32E42}</Project>
<Name>Diagrams</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

22
src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/Configuration/AssemblyInfo.cs

@ -0,0 +1,22 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Information about this assembly is defined by the following
// attributes.
//
// change them to the information which is associated with the assembly
// you compile.
[assembly: AssemblyTitle("ClassDiagramAddin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

BIN
src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/Resources/Bitmaps.resources

Binary file not shown.

73
src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/Src/ClassDiagramAddItemCommands.cs

@ -0,0 +1,73 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Windows.Forms;
using ClassDiagram;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Commands;
using ICSharpCode.SharpDevelop.Dom;
namespace ClassDiagramAddin
{
public class AddClassCommand : ClassDiagramAddinCommand
{
public override void Run()
{
// TODO implement AddClassCommand
}
}
public class AddAbstractClassCommand : ClassDiagramAddinCommand
{
public override void Run()
{
// TODO implement AddAbstractClassCommand
}
}
public class AddInterfaceCommand : ClassDiagramAddinCommand
{
public override void Run()
{
// TODO implement AddInterfaceCommand
}
}
public class AddDelegateCommand : ClassDiagramAddinCommand
{
public override void Run()
{
// TODO implement AddDelegateCommand
}
}
public class AddEnumCommand : ClassDiagramAddinCommand
{
public override void Run()
{
// TODO implement AddEnumCommand
}
}
public class AddNoteCommand : ClassDiagramAddinCommand
{
public override void Run()
{
NoteCanvasItem item = new NoteCanvasItem();
item.Width = 200;
item.Height = 200;
item.X = Canvas.LastMouseClickPosition.X;
item.Y = Canvas.LastMouseClickPosition.Y;
Canvas.AddCanvasItem(item);
}
}
}

121
src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/Src/ClassDiagramCommand.cs

@ -0,0 +1,121 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Windows.Forms;
using System.Globalization;
using ClassDiagram;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Commands;
using ICSharpCode.SharpDevelop.Dom;
namespace ClassDiagramAddin
{
public abstract class ClassDiagramAddinCommand : AbstractMenuCommand
{
protected ClassCanvas Canvas
{
get { return (ClassCanvas)((ClassDiagramViewContent)this.Owner).Control; }
}
}
public class AutoArrangeDiagramCommand : ClassDiagramAddinCommand
{
public override void Run()
{
Canvas.AutoArrange();
}
}
public class ExpandAllCommand : ClassDiagramAddinCommand
{
public override void Run()
{
Canvas.ExpandAll();
}
}
public class CollapseAllCommand : ClassDiagramAddinCommand
{
public override void Run()
{
Canvas.CollapseAll();
}
}
public class MatchAllWidthsCommand : ClassDiagramAddinCommand
{
public override void Run()
{
Canvas.MatchAllWidths();
}
}
public class ShrinkAllWidthsCommand : ClassDiagramAddinCommand
{
public override void Run()
{
Canvas.ShrinkAllWidths();
}
}
public class SetDiagramZoomCommand : AbstractComboBoxCommand
{
protected ClassCanvas Canvas
{
get
{
return (ClassCanvas)((ToolBarComboBox)this.Owner).Owner.Parent;
}
}
public override void Run()
{
Canvas.Zoom = zoom;
}
private void ComboBoxTextChanged(object sender, EventArgs e)
{
float zoomPercent = 100.0f;
string s = comboBox.Text.Trim().Trim('%');
if (float.TryParse (s, out zoomPercent))
{
zoom = zoomPercent / 100.0f;
this.Run();
}
}
protected override void OnOwnerChanged(EventArgs e)
{
base.OnOwnerChanged(e);
ToolBarComboBox box1 = (ToolBarComboBox) this.Owner;
comboBox = box1.ComboBox;
comboBox.DropDownStyle = ComboBoxStyle.DropDown;
comboBox.Items.Add("10%");
comboBox.Items.Add("25%");
comboBox.Items.Add("50%");
comboBox.Items.Add("75%");
comboBox.Items.Add("100%");
comboBox.Items.Add("125%");
comboBox.Items.Add("150%");
comboBox.Items.Add("175%");
comboBox.Items.Add("200%");
comboBox.Items.Add("250%");
comboBox.Items.Add("300%");
comboBox.Items.Add("350%");
comboBox.Items.Add("400%");
comboBox.TextChanged += new EventHandler(this.ComboBoxTextChanged);
}
ComboBox comboBox;
float zoom = 1.0f;
}
}

46
src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/Src/ClassDiagramDisplayBinding.cs

@ -0,0 +1,46 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Reflection;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop;
namespace ClassDiagramAddin
{
public class ClassDiagramDisplayBinding : IDisplayBinding
{
public ClassDiagramDisplayBinding ()
{
// ResourceService.RegisterImages("ClassDiagram", Assembly.GetExecutingAssembly());
}
public bool CanCreateContentForFile(string fileName)
{
return true;
}
public IViewContent CreateContentForFile(string fileName)
{
ClassDiagramViewContent vc = new ClassDiagramViewContent();
vc.Load(fileName);
return vc;
}
public bool CanCreateContentForLanguage(string languageName)
{
return false;
}
public IViewContent CreateContentForLanguage(string languageName, string content)
{
throw new NotImplementedException();
}
}
}

182
src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/Src/ClassDiagramViewContent.cs

@ -0,0 +1,182 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Project;
using ClassDiagram;
using System.IO;
using System.Xml;
namespace ClassDiagramAddin
{
/// <summary>
/// Description of the view content
/// </summary>
public class ClassDiagramViewContent : AbstractViewContent
{
private IProjectContent projectContent;
private ClassCanvas canvas = new ClassCanvas();
private ToolStrip toolstrip;
public ClassDiagramViewContent ()
{
canvas.LayoutChanged += HandleLayoutChange;
ParserService.ParseInformationUpdated += OnParseInformationUpdated;
toolstrip = ToolbarService.CreateToolStrip(this, "/SharpDevelop/ViewContent/ClassDiagram/Toolbar");
toolstrip.GripStyle = ToolStripGripStyle.Hidden;
toolstrip.Stretch = true;
canvas.Controls.Add(toolstrip);
canvas.ContextMenuStrip = MenuService.CreateContextMenu(this, "/SharpDevelop/ViewContent/ClassDiagram/ContextMenu");
canvas.CanvasItemSelected += HandleItemSelected;
}
public override Control Control
{
get { return canvas; }
}
public override string TabPageText
{
get { return "Class Diagram"; }
}
public override void Load(string fileName)
{
FileName = fileName;
TitleName = Path.GetFileName(fileName);
IsDirty = false;
if (fileName.EndsWith(".cd"))
{
XmlDocument doc = new XmlDocument();
doc.Load(fileName);
projectContent = ParserService.GetProjectContent(ProjectService.CurrentProject);
canvas.LoadFromXml(doc, projectContent);
}
}
public override void Save(string fileName)
{
if (!fileName.EndsWith(".cd")) return;
this.IsDirty = false;
this.FileName = fileName;
this.TitleName = Path.GetFileName(fileName);
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
settings.Encoding = System.Text.Encoding.UTF8;
XmlWriter xw = XmlWriter.Create(fileName, settings);
canvas.WriteToXml().WriteTo(xw);
xw.Close();
}
void OnParseInformationUpdated(object sender, ParseInformationEventArgs e)
{
if (e == null) return;
if (e.CompilationUnit == null) return;
if (e.CompilationUnit.ProjectContent == null) return;
if (e.CompilationUnit.ProjectContent.Classes == null) return;
if (e.CompilationUnit.ProjectContent != projectContent) return;
List<CanvasItem> addedItems = new List<CanvasItem>();
foreach (IClass ct in e.CompilationUnit.ProjectContent.Classes)
{
if (!canvas.Contains(ct))
{
ClassCanvasItem item = ClassCanvas.CreateItemFromType(ct);
canvas.AddCanvasItem(item);
addedItems.Add(item);
}
}
WorkbenchSingleton.SafeThreadAsyncCall<ICollection<CanvasItem>>(PlaceNewItems, addedItems);
foreach (CanvasItem ci in canvas.GetCanvasItems())
{
ClassCanvasItem cci = ci as ClassCanvasItem;
if (cci != null)
{
if (!e.CompilationUnit.ProjectContent.Classes.Contains(cci.RepresentedClassType))
canvas.RemoveCanvasItem(cci);
}
}
}
private void PlaceNewItems (ICollection<CanvasItem> items)
{
float minX = float.MaxValue, minY = float.MaxValue;
float maxX = float.MinValue, maxY = float.MinValue;
foreach (CanvasItem ci in canvas.GetCanvasItems())
{
minX = Math.Min(ci.X, minX);
minY = Math.Min(ci.Y, minY);
maxX = Math.Max(ci.X + ci.ActualWidth, maxX);
maxY = Math.Max(ci.Y + ci.ActualHeight, maxY);
}
float x = 20;
float y = maxY + 20;
float max_h = 0;
foreach (CanvasItem ci in items)
{
ci.X = x;
ci.Y = y;
x += ci.Width + 20;
if (ci.Height > max_h)
max_h = ci.Height;
if (x > 1000)
{
x = 20;
y += max_h + 20;
max_h = 0;
}
}
}
public override void RedrawContent()
{
// TODO: Refresh the whole view control here, renew all resource strings
// Note that you do not need to recreate the control.
base.RedrawContent();
}
public override void Dispose()
{
canvas.Dispose();
}
protected void HandleLayoutChange (object sender, EventArgs args)
{
this.IsDirty = true;
}
private void HandleItemSelected (object sender, CanvasItemEventArgs args)
{
ClassCanvasItem cci = args.CanvasItem as ClassCanvasItem;
if (cci != null)
{
PadDescriptor padDesc = WorkbenchSingleton.Workbench.GetPad(typeof(ClassEditorPad));
if (padDesc != null)
{
((ClassEditor)padDesc.PadContent.Control).SetClass(cci.RepresentedClassType);
}
}
}
}
}

82
src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/Src/ClassEditorPad.cs

@ -0,0 +1,82 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.TextEditor;
using ClassDiagram;
namespace ClassDiagramAddin
{
/// <summary>
/// Description of the pad content
/// </summary>
public class ClassEditorPad : AbstractPadContent
{
ClassEditor editor = new ClassEditor();
/// <summary>
/// Creates a new ClassEditorPad object
/// </summary>
public ClassEditorPad()
{
editor.MemberActivated += EditorMemberActivated;
}
private void EditorMemberActivated (object sender, IMemberEventArgs e)
{
ICompilationUnit compUnit = e.Member.DeclaringType.CompilationUnit;
FileService.JumpToFilePosition(compUnit.FileName,
e.Member.Region.BeginLine - 1,
e.Member.Region.BeginColumn - 1);
}
/// <summary>
/// The <see cref="System.Windows.Forms.Control"/> representing the pad
/// </summary>
public override Control Control
{
get { return editor; }
}
/// <summary>
/// Refreshes the pad
/// </summary>
public override void RedrawContent()
{
// TODO: Refresh the whole pad control here, renew all resource strings whatever
// Note that you do not need to recreate the control.
}
/// <summary>
/// Cleans up all used resources
/// </summary>
public override void Dispose()
{
editor.Dispose();
}
private static TextEditorControl GetTextEditorControl()
{
TextEditorControl tec = null;
IWorkbenchWindow window1 = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
if ((window1 != null) && (window1.ViewContent is ITextEditorControlProvider))
{
tec = ((ITextEditorControlProvider) window1.ViewContent).TextEditorControl;
}
return tec;
}
}
}

36
src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/Src/SaveToBitmapCommand.cs

@ -0,0 +1,36 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Windows.Forms;
using ClassDiagram;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Commands;
using ICSharpCode.SharpDevelop.Dom;
namespace ClassDiagramAddin
{
public class SaveToBitmapCommand : ClassDiagramAddinCommand
{
public override void Run()
{
SaveFileDialog sfd = new SaveFileDialog();
sfd.Title = "Save Diagram To Bitmap";
sfd.Filter = "All Image Formats|*.bmp; *.png; *.jpg; *.jpeg; *.gif; *.tif; *.tiff|Bitmap files|*.bmp|Portable Network Graphics|*.png|JPEG files|*.jpg;*.jpeg|Graphics Interchange Format|*.gif|Tagged Image File|*.tif; *.tiff";
sfd.OverwritePrompt = true;
sfd.DefaultExt = ".png";
if (sfd.ShowDialog() != DialogResult.Cancel)
{
Canvas.SaveToImage(sfd.FileName);
}
}
}
}

64
src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/Src/ShowClassDiagramCommand.cs

@ -0,0 +1,64 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Windows.Forms;
using ClassDiagram;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Commands;
using ICSharpCode.SharpDevelop.Dom;
namespace ClassDiagramAddin
{
public class ShowClassDiagramCommand : AbstractMenuCommand
{
public override void Run()
{
IProject p = ProjectService.CurrentProject;
string filename = p.Directory+System.IO.Path.DirectorySeparatorChar+p.Name+".cd";
if (p == null) return;
/*if (p.IsFileInProject(filename))
{
ProjectItem pi = p.Items.Find(
delegate(ProjectItem pItem)
{ return pItem.FileName == filename; }
);
}
else*/
{
//MessageBox.Show("Creating a new class diagram file named "+"\"+p.Directory+filename);
ClassCanvas classcanvas = new ClassCanvas();
IProjectContent pc = ParserService.GetProjectContent(p);
//float x = 20, y = 20;
//float max_h = 0;
foreach (IClass ct in pc.Classes)
{
ClassCanvasItem classitem = ClassCanvas.CreateItemFromType(ct);
classcanvas.AddCanvasItem(classitem);
}
classcanvas.AutoArrange();
classcanvas.WriteToXml().Save(filename);
FileProjectItem fpi = new FileProjectItem(p, ItemType.Content);
fpi.BuildAction = "Content";
//fpi.BuildAction = FileProjectItem.FileBuildAction.Content;
fpi.FileName = filename;
ProjectService.AddProjectItem(p, fpi);
ProjectBrowserPad.Instance.ProjectBrowserControl.RefreshView();
p.Save();
FileService.OpenFile(filename);
}
}
}
}

38
src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramApp/AssemblyInfo.cs

@ -0,0 +1,38 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Information about this assembly is defined by the following
// attributes.
//
// change them to the information which is associated with the assembly
// you compile.
[assembly: AssemblyTitle("ClassDiagramApp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ClassDiagramApp")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// This sets the default COM visibility of types in the assembly to invisible.
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
[assembly: ComVisible(false)]
// The assembly version has following format :
//
// Major.Minor.Build.Revision
//
// You can specify all values by your own or you can build default build and revision
// numbers with the '*' character (the default):
[assembly: AssemblyVersion("1.0.*")]

70
src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramApp/ClassDiagramApp.csproj

@ -0,0 +1,70 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<RootNamespace>ClassDiagramApp</RootNamespace>
<AssemblyName>ClassDiagramApp</AssemblyName>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{709D6ACE-4921-4DF6-831A-E74E3EFAA742}</ProjectGuid>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
<IntermediateOutputPath>obj\Debug\</IntermediateOutputPath>
<OutputPath>bin\Debug\</OutputPath>
<Optimize>False</Optimize>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugSymbols>True</DebugSymbols>
<DebugType>Full</DebugType>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
<IntermediateOutputPath>obj\Release\</IntermediateOutputPath>
<OutputPath>bin\Release\</OutputPath>
<Optimize>True</Optimize>
<DefineConstants>TRACE</DefineConstants>
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="MainForm.cs" />
<Compile Include="MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="AssemblyInfo.cs" />
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj">
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project>
<Name>ICSharpCode.SharpDevelop</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.SharpDevelop.Dom\Project\ICSharpCode.SharpDevelop.Dom.csproj">
<Project>{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}</Project>
<Name>ICSharpCode.SharpDevelop.Dom</Name>
</ProjectReference>
<ProjectReference Include="..\ClassCanvas\ClassCanvas.csproj">
<Project>{08F772A1-F0BE-433E-8B37-F6522953DB05}</Project>
<Name>ClassCanvas</Name>
</ProjectReference>
<ProjectReference Include="..\ClassEditor\ClassEditor.csproj">
<Project>{F5E059BB-96C2-4398-BED0-8598CD434173}</Project>
<Name>ClassEditor</Name>
</ProjectReference>
<ProjectReference Include="..\DiagramRouter\Diagrams.csproj">
<Project>{0991423A-DBF6-4C89-B365-A1DF1EB32E42}</Project>
<Name>Diagrams</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

310
src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramApp/MainForm.Designer.cs generated

@ -0,0 +1,310 @@
/*
* Created by SharpDevelop.
* User: itai
* Date: 23/09/2006
* Time: 14:07
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
namespace ClassDiagramApp
{
partial class MainForm : System.Windows.Forms.Form
{
/// <summary>
/// Designer variable used to keep track of non-visual components.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Disposes resources used by the form.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing) {
if (components != null) {
components.Dispose();
}
}
base.Dispose(disposing);
}
/// <summary>
/// This method is required for Windows Forms designer support.
/// Do not change the method contents inside the source code editor. The Forms designer might
/// not be able to load this method if it was changed manually.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.saveImgBtn = new System.Windows.Forms.Button();
this.addNoteBtn = new System.Windows.Forms.Button();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.shrinkBtn = new System.Windows.Forms.Button();
this.matchBtn = new System.Windows.Forms.Button();
this.modifiedBtn = new System.Windows.Forms.Button();
this.layoutBtn = new System.Windows.Forms.Button();
this.initBtn = new System.Windows.Forms.Button();
this.loadBtn = new System.Windows.Forms.Button();
this.saveBtn = new System.Windows.Forms.Button();
this.colExpBtn = new System.Windows.Forms.Button();
this.zoom = new System.Windows.Forms.TrackBar();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.addInterfaceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.addEnumToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.splitContainer2.Panel1.SuspendLayout();
this.splitContainer2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.zoom)).BeginInit();
this.contextMenuStrip1.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
this.splitContainer1.Size = new System.Drawing.Size(631, 480);
this.splitContainer1.SplitterDistance = 278;
this.splitContainer1.TabIndex = 0;
//
// splitContainer2
//
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer2.Location = new System.Drawing.Point(0, 0);
this.splitContainer2.Name = "splitContainer2";
//
// splitContainer2.Panel1
//
this.splitContainer2.Panel1.Controls.Add(this.saveImgBtn);
this.splitContainer2.Panel1.Controls.Add(this.addNoteBtn);
this.splitContainer2.Panel1.Controls.Add(this.comboBox1);
this.splitContainer2.Panel1.Controls.Add(this.shrinkBtn);
this.splitContainer2.Panel1.Controls.Add(this.matchBtn);
this.splitContainer2.Panel1.Controls.Add(this.modifiedBtn);
this.splitContainer2.Panel1.Controls.Add(this.layoutBtn);
this.splitContainer2.Panel1.Controls.Add(this.initBtn);
this.splitContainer2.Panel1.Controls.Add(this.loadBtn);
this.splitContainer2.Panel1.Controls.Add(this.saveBtn);
this.splitContainer2.Panel1.Controls.Add(this.colExpBtn);
this.splitContainer2.Panel1.Controls.Add(this.zoom);
this.splitContainer2.Size = new System.Drawing.Size(631, 198);
this.splitContainer2.SplitterDistance = 222;
this.splitContainer2.TabIndex = 5;
//
// saveImgBtn
//
this.saveImgBtn.Location = new System.Drawing.Point(113, 170);
this.saveImgBtn.Name = "saveImgBtn";
this.saveImgBtn.Size = new System.Drawing.Size(104, 23);
this.saveImgBtn.TabIndex = 16;
this.saveImgBtn.Text = "Save as Bitmap";
this.saveImgBtn.UseVisualStyleBackColor = true;
this.saveImgBtn.Click += new System.EventHandler(this.SaveImgBtnClick);
//
// addNoteBtn
//
this.addNoteBtn.Location = new System.Drawing.Point(3, 170);
this.addNoteBtn.Name = "addNoteBtn";
this.addNoteBtn.Size = new System.Drawing.Size(104, 23);
this.addNoteBtn.TabIndex = 15;
this.addNoteBtn.Text = "Add Note";
this.addNoteBtn.UseVisualStyleBackColor = true;
this.addNoteBtn.Click += new System.EventHandler(this.AddNoteBtnClick);
//
// comboBox1
//
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Items.AddRange(new object[] {
"10%",
"25%",
"50%",
"75%",
"100%",
"125%",
"150%",
"175%",
"200%",
"250%",
"300%",
"350%",
"400%"});
this.comboBox1.Location = new System.Drawing.Point(113, 12);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(104, 21);
this.comboBox1.TabIndex = 14;
this.comboBox1.Text = "100%";
this.comboBox1.TextChanged += new System.EventHandler(this.ComboBox1TextChanged);
//
// shrinkBtn
//
this.shrinkBtn.Location = new System.Drawing.Point(113, 141);
this.shrinkBtn.Name = "shrinkBtn";
this.shrinkBtn.Size = new System.Drawing.Size(104, 23);
this.shrinkBtn.TabIndex = 13;
this.shrinkBtn.Text = "Shrink";
this.shrinkBtn.UseVisualStyleBackColor = true;
this.shrinkBtn.Click += new System.EventHandler(this.ShrinkBtnClick);
//
// matchBtn
//
this.matchBtn.Location = new System.Drawing.Point(113, 112);
this.matchBtn.Name = "matchBtn";
this.matchBtn.Size = new System.Drawing.Size(104, 23);
this.matchBtn.TabIndex = 12;
this.matchBtn.Text = "Match";
this.matchBtn.UseVisualStyleBackColor = true;
this.matchBtn.Click += new System.EventHandler(this.MatchBtnClick);
//
// modifiedBtn
//
this.modifiedBtn.Enabled = false;
this.modifiedBtn.Location = new System.Drawing.Point(3, 141);
this.modifiedBtn.Name = "modifiedBtn";
this.modifiedBtn.Size = new System.Drawing.Size(104, 23);
this.modifiedBtn.TabIndex = 11;
this.modifiedBtn.Text = "Modified";
this.modifiedBtn.UseVisualStyleBackColor = true;
this.modifiedBtn.Click += new System.EventHandler(this.ModifiedBtnClick);
//
// layoutBtn
//
this.layoutBtn.Location = new System.Drawing.Point(113, 83);
this.layoutBtn.Name = "layoutBtn";
this.layoutBtn.Size = new System.Drawing.Size(104, 23);
this.layoutBtn.TabIndex = 10;
this.layoutBtn.Text = "Layout";
this.layoutBtn.UseVisualStyleBackColor = true;
this.layoutBtn.Click += new System.EventHandler(this.LayoutBtnClick);
//
// initBtn
//
this.initBtn.Location = new System.Drawing.Point(3, 54);
this.initBtn.Name = "initBtn";
this.initBtn.Size = new System.Drawing.Size(104, 23);
this.initBtn.TabIndex = 9;
this.initBtn.Text = "Init";
this.initBtn.UseVisualStyleBackColor = true;
this.initBtn.Click += new System.EventHandler(this.InitBtnClick);
//
// loadBtn
//
this.loadBtn.Location = new System.Drawing.Point(3, 83);
this.loadBtn.Name = "loadBtn";
this.loadBtn.Size = new System.Drawing.Size(104, 23);
this.loadBtn.TabIndex = 8;
this.loadBtn.Text = "Load";
this.loadBtn.UseVisualStyleBackColor = true;
this.loadBtn.Click += new System.EventHandler(this.LoadBtnClick);
//
// saveBtn
//
this.saveBtn.Location = new System.Drawing.Point(3, 112);
this.saveBtn.Name = "saveBtn";
this.saveBtn.Size = new System.Drawing.Size(104, 23);
this.saveBtn.TabIndex = 7;
this.saveBtn.Text = "Save";
this.saveBtn.UseVisualStyleBackColor = true;
this.saveBtn.Click += new System.EventHandler(this.SaveBtnClick);
//
// colExpBtn
//
this.colExpBtn.Location = new System.Drawing.Point(113, 54);
this.colExpBtn.Name = "colExpBtn";
this.colExpBtn.Size = new System.Drawing.Size(104, 23);
this.colExpBtn.TabIndex = 6;
this.colExpBtn.Text = "Collapse All";
this.colExpBtn.UseVisualStyleBackColor = true;
this.colExpBtn.Click += new System.EventHandler(this.ColExpBtnClick);
//
// zoom
//
this.zoom.Location = new System.Drawing.Point(3, 3);
this.zoom.Maximum = 400;
this.zoom.Minimum = 25;
this.zoom.Name = "zoom";
this.zoom.Size = new System.Drawing.Size(104, 45);
this.zoom.SmallChange = 25;
this.zoom.TabIndex = 5;
this.zoom.TickFrequency = 25;
this.zoom.Value = 100;
this.zoom.Scroll += new System.EventHandler(this.ZoomValueChanged);
//
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem1,
this.addInterfaceToolStripMenuItem,
this.addEnumToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(142, 70);
//
// toolStripMenuItem1
//
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(141, 22);
this.toolStripMenuItem1.Text = "Add Class";
this.toolStripMenuItem1.Click += new System.EventHandler(this.ToolStripMenuItem1Click);
//
// addInterfaceToolStripMenuItem
//
this.addInterfaceToolStripMenuItem.Name = "addInterfaceToolStripMenuItem";
this.addInterfaceToolStripMenuItem.Size = new System.Drawing.Size(141, 22);
this.addInterfaceToolStripMenuItem.Text = "Add Interface";
//
// addEnumToolStripMenuItem
//
this.addEnumToolStripMenuItem.Name = "addEnumToolStripMenuItem";
this.addEnumToolStripMenuItem.Size = new System.Drawing.Size(141, 22);
this.addEnumToolStripMenuItem.Text = "Add Enum";
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(631, 480);
this.Controls.Add(this.splitContainer1);
this.Name = "MainForm";
this.Text = "ClassDiagramApp";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.MainFormFormClosed);
this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.ResumeLayout(false);
this.splitContainer2.Panel1.ResumeLayout(false);
this.splitContainer2.Panel1.PerformLayout();
this.splitContainer2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.zoom)).EndInit();
this.contextMenuStrip1.ResumeLayout(false);
this.ResumeLayout(false);
}
private System.Windows.Forms.SaveFileDialog saveFileDialog1;
private System.Windows.Forms.Button saveImgBtn;
private System.Windows.Forms.Button addNoteBtn;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Button shrinkBtn;
private System.Windows.Forms.Button matchBtn;
private System.Windows.Forms.Button layoutBtn;
private System.Windows.Forms.Button modifiedBtn;
private System.Windows.Forms.SplitContainer splitContainer2;
private System.Windows.Forms.Button loadBtn;
private System.Windows.Forms.Button initBtn;
private System.Windows.Forms.Button saveBtn;
private System.Windows.Forms.Button colExpBtn;
private System.Windows.Forms.TrackBar zoom;
private System.Windows.Forms.ToolStripMenuItem addEnumToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem addInterfaceToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.SplitContainer splitContainer1;
}
}

185
src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramApp/MainForm.cs

@ -0,0 +1,185 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Globalization;
using System.Collections.Generic;
using System.Reflection;
using System.Drawing;
using System.Windows.Forms;
using System.Xml;
using ClassDiagram;
using ICSharpCode.SharpDevelop.Dom;
namespace ClassDiagramApp
{
/// <summary>
/// Description of MainForm.
/// </summary>
public partial class MainForm
{
[STAThread]
public static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
ClassCanvas classcanvas = new ClassCanvas();
ClassEditor classeditor = new ClassEditor();
ProjectContentRegistry registry = new ProjectContentRegistry();
IProjectContent pc;
ICompilationUnit cu;
public MainForm()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
splitContainer1.Panel1.Controls.Add (classcanvas);
classcanvas.Dock = DockStyle.Fill;
splitContainer2.Panel2.Controls.Add (classeditor);
classeditor.Dock = DockStyle.Fill;
pc = new ReflectionProjectContent(Assembly.LoadFrom("ClassCanvas.dll"), registry);
cu = new DefaultCompilationUnit(pc);
classcanvas.CanvasItemSelected += OnItemSelected;
classcanvas.LayoutChanged += HandleLayoutChange;
}
void MainFormFormClosed(object sender, System.Windows.Forms.FormClosedEventArgs e)
{
Application.Exit();
}
void ToolStripMenuItem1Click(object sender, System.EventArgs e)
{
ClassCanvasItem item = ClassCanvas.CreateItemFromType(new DefaultClass(cu, "ClassDiagram.ClassCanvasItem"));
item.X = 20;
item.Y = 20;
classcanvas.AddCanvasItem(item);
}
void ZoomValueChanged(object sender, System.EventArgs e)
{
classcanvas.Zoom = zoom.Value / 100f;
}
void ColExpBtnClick(object sender, System.EventArgs e)
{
if (colExpBtn.Text == "Collapse All")
{
classcanvas.CollapseAll();
colExpBtn.Text = "Expand All";
}
else
{
classcanvas.ExpandAll();
colExpBtn.Text = "Collapse All";
}
}
void OnItemSelected (object sender, CanvasItemEventArgs e)
{
if (e.CanvasItem is ClassCanvasItem)
classeditor.SetClass(((ClassCanvasItem)e.CanvasItem).RepresentedClassType);
else
classeditor.SetClass (null);
}
void SaveBtnClick(object sender, System.EventArgs e)
{
classcanvas.WriteToXml().Save(@"C:\Documents and Settings\itai\My Documents\test.cd");
}
void InitBtnClick(object sender, System.EventArgs e)
{
float x=20, y=20;
float max_h = 0;
foreach (IClass ct in pc.Classes)
{
ClassCanvasItem classitem = ClassCanvas.CreateItemFromType(ct);
classitem.X = x;
classitem.Y = y;
classcanvas.AddCanvasItem(classitem);
x += classitem.Width + 20;
if (classitem.Height > max_h)
max_h = classitem.Height;
if (x > 1000)
{
x = 20;
y += max_h + 20;
max_h = 0;
}
}
}
void LoadBtnClick(object sender, System.EventArgs e)
{
XmlDocument doc = new XmlDocument();
doc.Load(@"C:\Documents and Settings\itai\My Documents\test.cd");
classcanvas.LoadFromXml(doc, pc);
}
void ModifiedBtnClick(object sender, System.EventArgs e)
{
modifiedBtn.Enabled = false;
}
void HandleLayoutChange(object sender, System.EventArgs e)
{
modifiedBtn.Enabled = true;
}
void LayoutBtnClick(object sender, System.EventArgs e)
{
classcanvas.AutoArrange();
}
void MatchBtnClick(object sender, System.EventArgs e)
{
classcanvas.MatchAllWidths();
}
void ShrinkBtnClick(object sender, System.EventArgs e)
{
classcanvas.ShrinkAllWidths();
}
void ComboBox1TextChanged(object sender, System.EventArgs e)
{
float zoomPercent = 100.0f;
string s = comboBox1.Text.Trim().Trim('%');
if (float.TryParse (s, out zoomPercent))
{
classcanvas.Zoom = zoomPercent / 100.0f;
}
}
void AddNoteBtnClick(object sender, EventArgs e)
{
NoteCanvasItem note = new NoteCanvasItem();
note.X = 40;
note.Y = 40;
note.Width = 100;
note.Height = 100;
classcanvas.AddCanvasItem(note);
}
void SaveImgBtnClick(object sender, EventArgs e)
{
classcanvas.SaveToImage(@"C:\Documents and Settings\itai\My Documents\test.png");
}
}
}

126
src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramApp/MainForm.resx

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="saveFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>163, 17</value>
</metadata>
</root>

22
src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/AssemblyInfo.cs

@ -0,0 +1,22 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Information about this assembly is defined by the following
// attributes.
//
// change them to the information which is associated with the assembly
// you compile.
[assembly: AssemblyTitle("ClassEditor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

50
src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/ClassEditor.Designer.cs generated

@ -0,0 +1,50 @@
/*
* Created by SharpDevelop.
* User: itai
* Date: 20/10/2006
* Time: 20:08
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
namespace ClassDiagram
{
partial class ClassEditor : System.Windows.Forms.UserControl
{
/// <summary>
/// Designer variable used to keep track of non-visual components.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Disposes resources used by the form.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing) {
if (components != null) {
components.Dispose();
}
}
base.Dispose(disposing);
}
/// <summary>
/// This method is required for Windows Forms designer support.
/// Do not change the method contents inside the source code editor. The Forms designer might
/// not be able to load this method if it was changed manually.
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// ClassEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Name = "ClassEditor";
this.Size = new System.Drawing.Size(603, 299);
this.ResumeLayout(false);
}
}
}

302
src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/ClassEditor.cs

@ -0,0 +1,302 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using System.IO;
using System.Xml;
using System.Xml.XPath;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.TextEditor;
namespace ClassDiagram
{
/// <summary>
/// Description of UserControl1.
/// </summary>
public partial class ClassEditor
{
TreeListView membersList = new TreeListView();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(ClassEditor));
Dictionary<Type, TreeListViewItem> addMemberItems = new Dictionary<Type, TreeListViewItem>();
Dictionary<IMethod, TreeListViewItem> addParameterItems = new Dictionary<IMethod, TreeListViewItem>();
Dictionary<ClassType, Action<IClass>> classTypeGroupCreators = new Dictionary<ClassType, Action<IClass>>();
IClass currClass;
public event EventHandler<IMemberEventArgs> MemberActivated = delegate {};
public ClassEditor()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
ColumnHeader nameCol = membersList.Columns.Add("Name");
ColumnHeader typeCol = membersList.Columns.Add("Type");
ColumnHeader modifierCol = membersList.Columns.Add("Modifier");
ColumnHeader summaryCol = membersList.Columns.Add("Summary");
nameCol.Width = 160;
typeCol.Width = 100;
modifierCol.Width = 100;
summaryCol.Width = 200;
try
{
membersList.SmallImageList = ClassBrowserIconService.ImageList;
}
catch
{
membersList.SmallImageList = new ImageList();
}
//TODO - check with the #D documentation how to add new icons correctly.
membersList.SmallImageList.Images.Add("OpenBrace", (Bitmap)resources.GetObject("openbrace"));
membersList.SmallImageList.Images.Add("Comma", (Bitmap)resources.GetObject("comma"));
membersList.SmallImageList.Images.Add("CloseBrace", (Bitmap)resources.GetObject("closebrace"));
membersList.SmallImageList.Images.Add("EmptyBraces", (Bitmap)resources.GetObject("emptybraces"));
membersList.Sorting = SortOrder.None;
membersList.ShowPlusMinus = true;
membersList.FullRowSelect = true;
membersList.Items.Sortable = false;
membersList.HeaderStyle = ColumnHeaderStyle.Nonclickable;
membersList.DoubleClick += HandleDoubleClick;
Controls.Add(membersList);
membersList.Dock = DockStyle.Fill;
classTypeGroupCreators.Add(ClassType.Class, SetClassGroups);
classTypeGroupCreators.Add(ClassType.Interface, SetClassGroups);
classTypeGroupCreators.Add(ClassType.Struct, SetClassGroups);
classTypeGroupCreators.Add(ClassType.Enum, SetEnumGroups);
classTypeGroupCreators.Add(ClassType.Delegate, SetDelegateGroups);
//classTypeGroupCreators[ClassType.Module] = SetClassGroups; //???
}
private void HandleDoubleClick (object sender, EventArgs e)
{
if (membersList.SelectedItems.Count == 0) return;
if (addMemberItems.ContainsValue(membersList.SelectedItems[0]))
{
}
else if (addParameterItems.ContainsValue(membersList.SelectedItems[0]))
{
}
else
{
IMember itemMember = membersList.SelectedItems[0].Tag as IMember;
if (itemMember != null)
MemberActivated(this, new IMemberEventArgs(itemMember));
}
}
private void SetClassGroups (IClass classType)
{
AddGroup<IMethod>("Methods", "method", classType.Methods);
AddGroup<IProperty>("Properties", "property", classType.Properties);
AddGroup<IField>("Fields", "field", classType.Fields);
AddGroup<IEvent>("Events", "event", classType.Events);
}
private void SetEnumGroups (IClass classType)
{
AddGroup<IField>("Fields", "field", classType.Fields);
}
private void SetDelegateGroups (IClass classType)
{
}
public void SetClass (IClass classType)
{
membersList.BeginUpdate();
membersList.Items.Clear();
currClass = classType;
if (classType != null)
classTypeGroupCreators[classType.ClassType](classType);
membersList.EndUpdate();
}
private TreeListViewItem AddGroup<MT>(string title, string type, ICollection<MT> members) where MT : IMember
{
if (members == null) return null;
TreeListViewItem group = new TreeListViewItem(title);
group.ForeColor = Color.Gray;
group.Font = new Font(group.Font, FontStyle.Bold);
group.Items.Sortable = false;
if (members.Count != 0)
{
foreach (IMember member in members)
{
IMethod methodMember = member as IMethod;
IEvent eventMember = member as IEvent;
IProperty propertyMember = member as IProperty;
IField fieldMember = member as IField;
int icon = -1;
try
{
icon = ClassBrowserIconService.GetIcon(member);
}
catch {}
IAmbience ambience = GetAmbience();
string memberName = "";
if (methodMember != null)
{
if (methodMember.IsConstructor)
{
if (methodMember.DeclaringType != null)
{
memberName = methodMember.DeclaringType.Name;
}
else
{
memberName = methodMember.Name;
}
}
else
{
memberName = methodMember.Name;
}
}
if (eventMember != null)
{
memberName = eventMember.Name;
}
if (propertyMember != null) memberName = ambience.Convert(propertyMember);
if (fieldMember != null) memberName = ambience.Convert(fieldMember);
TreeListViewItem memberItem = new TreeListViewItem(memberName, icon);
memberItem.Items.Sortable = false;
memberItem.Items.SortOrder = SortOrder.None;
memberItem.Tag = member;
group.Items.Add(memberItem);
if (methodMember != null)
FillParams (memberItem, methodMember);
memberItem.SubItems.Add(ambience.Convert(member.ReturnType));
memberItem.SubItems.Add(member.Modifiers.ToString());
memberItem.SubItems.Add(GetSummary(member));
}
}
TreeListViewItem addNewMember = new TreeListViewItem(String.Format("<add {0}>", type));
addNewMember.ForeColor = Color.Gray;
group.Items.Add(addNewMember);
addMemberItems[typeof(MT)] = addNewMember;
membersList.Items.Add(group);
return group;
}
private string GetSummary (IDecoration decoration)
{
StringReader strReader = new StringReader("<docroot>" + decoration.Documentation + "</docroot>");
XmlDocument doc = new XmlDocument();
doc.Load(strReader);
XPathNavigator nav = doc.CreateNavigator();
XPathNodeIterator ni = nav.Select(@"/docroot/summary");
if (ni.MoveNext())
return ni.Current.InnerXml;
else
return String.Empty;
}
private void FillParams(TreeListViewItem item, IMethod method)
{
string imageKey = "OpenBrace";
foreach (IParameter param in method.Parameters)
{
TreeListViewItem parameter = new TreeListViewItem(param.Name);
parameter.ImageKey = imageKey;
parameter.SubItems.Add (param.ReturnType.Name);
item.Items.Add(parameter);
imageKey = "Comma";
}
TreeListViewItem addParam = new TreeListViewItem("<add parameter>");
if (imageKey == "OpenBrace")
addParam.ImageKey = "EmptyBraces";
else
addParam.ImageKey = "CloseBrace";
addParam.ForeColor = Color.Gray;
item.Items.Add (addParam);
addParameterItems[method] = addParam;
}
protected IAmbience GetAmbience()
{
IAmbience ambience = null;
try
{
ambience = AmbienceService.CurrentAmbience;
}
catch (NullReferenceException)
{
ambience = ICSharpCode.SharpDevelop.Dom.CSharp.CSharpAmbience.Instance;
}
ambience.ConversionFlags = ConversionFlags.None;
return ambience;
}
private static TextEditorControl GetTextEditorControl()
{
TextEditorControl control1 = null;
IWorkbenchWindow window1 = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
if ((window1 != null) && (window1.ViewContent is ITextEditorControlProvider))
{
control1 = ((ITextEditorControlProvider) window1.ViewContent).TextEditorControl;
}
return control1;
}
}
public class IMemberEventArgs : EventArgs
{
IMember member;
public IMemberEventArgs(IMember member)
{
this.member = member;
}
public IMember Member
{
get { return member; }
}
}
}

74
src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/ClassEditor.csproj

@ -0,0 +1,74 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OutputType>Library</OutputType>
<RootNamespace>ClassEditor</RootNamespace>
<AssemblyName>ClassEditor</AssemblyName>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{F5E059BB-96C2-4398-BED0-8598CD434173}</ProjectGuid>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>bin\Debug\</OutputPath>
<Optimize>False</Optimize>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugSymbols>True</DebugSymbols>
<DebugType>Full</DebugType>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>bin\Release\</OutputPath>
<Optimize>True</Optimize>
<DefineConstants>TRACE</DefineConstants>
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\..\Main\GlobalAssemblyInfo.cs">
<Link>GlobalAssemblyInfo.cs</Link>
</Compile>
<Compile Include="ClassEditor.cs" />
<Compile Include="ClassEditor.Designer.cs">
<DependentUpon>ClassEditor.cs</DependentUpon>
</Compile>
<Compile Include="AssemblyInfo.cs" />
<EmbeddedResource Include="ClassEditor.resx">
<DependentUpon>ClassEditor.cs</DependentUpon>
</EmbeddedResource>
<Compile Include="MembersList.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\Libraries\ICSharpCode.TextEditor\Project\ICSharpCode.TextEditor.csproj">
<Project>{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}</Project>
<Name>ICSharpCode.TextEditor</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj">
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project>
<Name>ICSharpCode.SharpDevelop</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\Core\Project\ICSharpCode.Core.csproj">
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project>
<Name>ICSharpCode.Core</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.SharpDevelop.Dom\Project\ICSharpCode.SharpDevelop.Dom.csproj">
<Project>{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}</Project>
<Name>ICSharpCode.SharpDevelop.Dom</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\Misc\Debugger\TreeListView\Project\TreeListView.csproj">
<Project>{B08385CD-F0CC-488C-B4F4-EEB34B6D2688}</Project>
<Name>TreeListView</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

157
src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/ClassEditor.resx

@ -0,0 +1,157 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="closebrace" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
Qk32AAAAAAAAAHYAAAAoAAAAEAAAABAAAAABAAQAAAAAAAAAAADEDgAAxA4AABAAAAAQAAAAAAAA/wAA
gP8AgAD/AICA/4AAAP+AAID/gIAA/4CAgP/AwMD/AAD//wD/AP8A/////wAA//8A/////wD/////////
////////////8I/////////4CP////////8H/////////wD/////////AP////////8A/////////wD/
////////AP////////8A/////////wD/////////AP////////8H////////+Aj////////wj///////
////////
</value>
</data>
<data name="comma" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
Qk32AAAAAAAAAHYAAAAoAAAAEAAAABAAAAABAAQAAAAAAAAAAADEDgAAxA4AABAAAAAQAAAAAAAA/wAA
gP8AgAD/AICA/4AAAP+AAID/gIAA/4CAgP/AwMD/AAD//wD/AP8A/////wAA//8A/////wD/////////
////////////8A//////////AP////////8A////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////
</value>
</data>
<data name="openbrace" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
Qk32AAAAAAAAAHYAAAAoAAAAEAAAABAAAAABAAQAAAAAAAAAAADEDgAAxA4AABAAAAAQAAAAAAAA/wAA
gP8AgAD/AICA/4AAAP+AAID/gIAA/4CAgP/AwMD/AAD//wD/AP8A/////wAA//8A/////wD/////////
////////////+A////////+Aj////////3D/////////AP////////8A/////////wD/////////AP//
//////8A/////////wD/////////AP////////8A/////////3D/////////gI/////////4D///////
////////
</value>
</data>
<data name="emptybraces" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
Qk32AAAAAAAAAHYAAAAoAAAAEAAAABAAAAABAAQAAAAAAAAAAADEDgAAxA4AABAAAAAQAAAAAAAA/wAA
gP8AgAD/AICA/4AAAP+AAID/gIAA/4CAgP/AwMD/AAD//wD/AP8A/////wAA//8A/////wD/////////
//////////+A//8I////+Aj//4CP///3D///8H////AP///wD///8A////AP///wD///8A////AP///w
D///8A////AP///wD///8A////AP///wD///8A////AP///3D///8H////gI//+Aj////4D//wj/////
////////
</value>
</data>
</root>

55
src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/MembersList.cs

@ -0,0 +1,55 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop;
namespace ClassDiagram
{
/// <summary>
/// Description of MembersList.
/// </summary>
public class MembersList<MT> where MT : IMember
{
TreeListViewItem titleItem;
TreeListViewItem addNewMember;
TreeListView treeListView;
public MembersList(string title, ICollection<MT> members, TreeListView tlv)
{
treeListView = tlv;
titleItem = tlv.Items.Add(title);
//tlv.SmallImageList = ClassBrowserIconService.ImageList;
if (members != null && members.Count != 0)
{
foreach (IMember member in members)
{
int icon = ClassBrowserIconService.GetIcon(member);
TreeListViewItem methodItem = titleItem.Items.Add(member.Name, icon);
}
}
addNewMember = titleItem.Items.Add("[Add]");
}
private void ItemActivated (object sender, EventArgs e)
{
}
}
}

BIN
src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/closebrace.bmp

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

BIN
src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/comma.bmp

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

BIN
src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/emptybraces.bmp

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

BIN
src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/openbrace.bmp

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

22
src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/AssemblyInfo.cs

@ -0,0 +1,22 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Information about this assembly is defined by the following
// attributes.
//
// change them to the information which is associated with the assembly
// you compile.
[assembly: AssemblyTitle("DiagramRouter")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

185
src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/BaseRectangle.cs

@ -0,0 +1,185 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
namespace Tools.Diagrams
{
public abstract class BaseRectangle : IRectangle
{
private float x, y;
private float w = float.NaN, h = float.NaN;
private float b, p;
private float aw = float.NaN, ah = float.NaN;
private bool ar = false;
private IRectangle container;
public IRectangle Container
{
get { return container; }
set { container = value; }
}
#region Geometry
public virtual float X
{
get { return x; }
set { x = value; }
}
public virtual float Y
{
get { return y; }
set { y = value; }
}
public virtual float AbsoluteX
{
get
{
if (container != null)
return container.AbsoluteX + X;
else
return X;
}
}
public virtual float AbsoluteY
{
get
{
if (container != null)
return container.AbsoluteY + Y;
else
return Y;
}
}
public virtual float ActualWidth
{
get { return aw; }
set
{
aw = value;
if (ar)
ah = aw * (GetAbsoluteContentHeight() / GetAbsoluteContentWidth());
OnActualSizeChanged();
OnActualWidthChanged();
}
}
public virtual float ActualHeight
{
get { return ah; }
set
{
ah = value;
if (ar)
aw = ah * (GetAbsoluteContentWidth() / GetAbsoluteContentHeight());
OnActualSizeChanged();
OnActualHeightChanged();
}
}
public virtual float Width
{
get { return w; }
set
{
w = value;
OnSizeChanged();
OnWidthChanged();
}
}
public virtual float Height
{
get { return h; }
set
{
h = value;
OnSizeChanged();
OnHeightChanged();
}
}
#endregion
public virtual float Border
{
get { return b; }
set { b = value; }
}
public virtual float Padding
{
get { return p; }
set { p = value; }
}
public virtual float GetAbsoluteContentWidth()
{
if (float.IsNaN(w) || w < 0)
return 0;
return w;
}
public virtual float GetAbsoluteContentHeight()
{
if (float.IsNaN(h) || h < 0)
return 0;
return h;
}
public bool KeepAspectRatio
{
get { return ar; }
set { ar = value; }
}
protected virtual void OnSizeChanged() {}
protected virtual void OnWidthChanged()
{
WidthChanged(this, EventArgs.Empty);
}
protected virtual void OnHeightChanged()
{
HeightChanged(this, EventArgs.Empty);
}
protected virtual void OnActualSizeChanged() {}
protected virtual void OnActualWidthChanged()
{
ActualWidthChanged(this, EventArgs.Empty);
}
protected virtual void OnActualHeightChanged()
{
ActualHeightChanged(this, EventArgs.Empty);
}
public virtual bool IsHResizable
{
get { return true; }
}
public virtual bool IsVResizable
{
get { return true; }
}
public event EventHandler WidthChanged = delegate {};
public event EventHandler HeightChanged = delegate {};
public event EventHandler ActualWidthChanged = delegate {};
public event EventHandler ActualHeightChanged = delegate {};
}
}

126
src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/DependencyTree.cs

@ -0,0 +1,126 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
namespace Tools.Diagrams
{
public class DependencyTree<T> where T : class, IEquatable<T>
{
DependencyTreeNode<T> root = new DependencyTreeNode<T>(default(T));
public DependencyTree() { }
public static DependencyTreeNode<T> FindNode (DependencyTreeNode<T> root, Predicate<DependencyTreeNode<T>> predicate)
{
if (predicate(root)) return root;
DependencyTreeNode<T> ret = null;
foreach (DependencyTreeNode<T> node in root.Dependants)
{
ret = FindNode(node, predicate);
if (ret != null) break;
}
return ret;
}
public static DependencyTreeNode<T> FindNode (DependencyTreeNode<T> root, Predicate<T> predicate)
{
return FindNode(root, delegate (DependencyTreeNode<T> item) { return predicate (item.Item); } );
}
public static DependencyTreeNode<T> FindNode (DependencyTreeNode<T> root, T item)
{
if (item == null) return null;
return FindNode(root, delegate (T nodeItem)
{
bool ret = (item.Equals(nodeItem));
return ret;
} );
}
public static void WalkTreeRootFirst (DependencyTreeNode<T> root, Action<DependencyTreeNode<T>> action)
{
action(root);
foreach (DependencyTreeNode<T> node in root.Dependants)
WalkTreeRootFirst(node, action);
}
public static void WalkTreeRootFirst (DependencyTreeNode<T> root, Action<T> action)
{
WalkTreeRootFirst (root, delegate (DependencyTreeNode<T> item) { action(item.Item); });
}
public static void WalkTreeChildrenFirst (DependencyTreeNode<T> root, Action<DependencyTreeNode<T>> action)
{
foreach (DependencyTreeNode<T> node in root.Dependants)
WalkTreeChildrenFirst(node, action);
action(root);
}
public static void WalkTreeChildrenFirst (DependencyTreeNode<T> root, Action<T> action)
{
WalkTreeChildrenFirst (root, delegate (DependencyTreeNode<T> item) { action(item.Item); });
}
public DependencyTreeNode<T> FindNode (Predicate<T> predicate)
{
return FindNode(root, predicate);
}
public DependencyTreeNode<T> FindNode (T item)
{
if (item == null) return null;
return FindNode(root, item);
}
public void WalkTreeRootFirst (Action<T> action)
{
WalkTreeRootFirst (root, action);
}
public void WalkTreeRootFirst (Action<DependencyTreeNode<T>> action)
{
WalkTreeRootFirst (root, action);
}
public void WalkTreeChildrenFirst (Action<T> action)
{
WalkTreeChildrenFirst (root, action);
}
public void WalkTreeChildrenFirst (Action<DependencyTreeNode<T>> action)
{
WalkTreeChildrenFirst (root, action);
}
public void AddDependency (T item, T dependency)
{
DependencyTreeNode<T> depNode = null;
if (dependency == null)
depNode = root;
else
depNode = FindNode(dependency);
DependencyTreeNode<T> itemNode = FindNode(item);
if (depNode == null)
depNode = root.AddDependency(dependency);
if (itemNode == null)
depNode.AddDependency(item);
else if (dependency != null)
itemNode.Reparent(depNode);
}
public DependencyTreeNode<T> Root
{
get { return root; }
}
}
}

81
src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/DependencyTreeNode.cs

@ -0,0 +1,81 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
namespace Tools.Diagrams
{
public class DependencyTreeNode<T>
{
private T item;
private DependencyTreeNode<T> parentNode;
private List<DependencyTreeNode<T>> dependants = new List<DependencyTreeNode<T>>();
private DependencyTreeNode(T item, DependencyTreeNode<T> parent)
{
this.item = item;
parentNode = parent;
}
public DependencyTreeNode(T item)
{
this.item = item;
}
public T Item
{
get { return item; }
}
public DependencyTreeNode<T> ParentNode
{
get { return parentNode; }
}
public DependencyTreeNode<T> AddDependency (T item)
{
DependencyTreeNode<T> node = new DependencyTreeNode<T>(item, this);
dependants.Add (node);
return node;
}
public void Reparent (DependencyTreeNode<T> parent)
{
parent.dependants.Add(this);
this.parentNode.dependants.Remove(this);
this.parentNode = parent;
}
public bool IsLeaf
{
get { return dependants.Count == 0; }
}
public int ChildrenCount
{
get { return dependants.Count; }
}
public int LeafsCount
{
get
{
int count = 0;
foreach (DependencyTreeNode<T> node in dependants)
if (node.IsLeaf)
count++;
return count;
}
}
public List <DependencyTreeNode<T>> Dependants
{
get { return dependants; }
}
}
}

269
src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/DiagramRouter.cs

@ -0,0 +1,269 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
namespace Tools.Diagrams
{
public class DiagramRouter
{
private IList<IRectangle> rects = new List<IRectangle>();
private List<Route> routes = new List<Route>();
private const float XSpacing = 40;
private const float YSpacing = 40;
private class IRectangleSizeDecorator : IEquatable<IRectangleSizeDecorator>
{
private IRectangle rect;
private float size;
private float childrenSize;
private float summedSize;
private float x;
private float y;
private float width;
private float height;
public IRectangleSizeDecorator (IRectangle rect)
{
this.rect = rect;
}
public float Size
{
get { return size; }
set { size = value; }
}
public float SummedSize
{
get { return summedSize; }
set { summedSize = value; }
}
public float ChildrenSize
{
get { return childrenSize; }
set { childrenSize = value; }
}
public float X
{
get { return x; }
set { x = value; }
}
public float Y
{
get { return y; }
set { y = value; }
}
public float Width
{
get { return width; }
set { width = value; }
}
public float Height
{
get { return height; }
set { height = value; }
}
public IRectangle Rectangle
{
get { return rect; }
}
public bool Equals(IRectangleSizeDecorator other)
{
if (other == null) return false;
return rect.Equals(other.Rectangle);
}
}
public IList<IRectangle> Rectangles
{
get { return rects; }
}
public void AddItem (IRectangle item)
{
rects.Add(item);
}
public void RemoveItem (IRectangle item)
{
rects.Remove(item);
}
public Route AddRoute (IRectangle from, IRectangle to)
{
Route route = new Route (from, to);
routes.Add(route);
return route;
}
public void RemoveRoute (Route route)
{
routes.Remove(route);
}
private DependencyTree<IRectangleSizeDecorator> BuildDependenciesTree ()
{
DependencyTree<IRectangleSizeDecorator> deps = new DependencyTree<IRectangleSizeDecorator>();
foreach (Route r in routes)
{
deps.AddDependency(new IRectangleSizeDecorator(r.From),
new IRectangleSizeDecorator(r.To));
}
foreach (IRectangle r in rects)
{
deps.AddDependency(new IRectangleSizeDecorator(r), deps.Root.Item);
}
return deps;
}
public void RecalcPositions ()
{
DependencyTree<IRectangleSizeDecorator> deps = BuildDependenciesTree();
// 1. Make sure each node's initial size is the same as its rectangle size.
deps.WalkTreeRootFirst(CopyPhysicalSize);
// 2. Arrange the nodes in groups with known width and height.
deps.WalkTreeChildrenFirst(ArrangeNodes);
// 3. Calculate the physical size of all the nodes.
// Treat the nodes decendants as part of the node itself.
//deps.WalkTreeChildrenFirst(CalcPhysicalSizeRecursive);
// 4. Sort everything by its physical size.
//deps.WalkTreeChildrenFirst(SortByPhysicalSize);
// 5. Set the positions of the nodes.
deps.WalkTreeRootFirst(SetupPositions);
deps.WalkTreeRootFirst(MoveSubTreeByParentPosition);
float y = 0;
foreach (DependencyTreeNode<IRectangleSizeDecorator> group in deps.Root.Dependants)
{
if (group.Item == null) continue;
MoveSubTreeBy(group, 0, y);
y += group.Item.Height + YSpacing;
}
}
private void CopyPhysicalSize(IRectangleSizeDecorator rect)
{
if (rect == null) return;
if (rect.Rectangle == null) return;
rect.Width = rect.Rectangle.ActualWidth;
rect.Height = rect.Rectangle.ActualHeight;
}
private void ArrangeNodes(DependencyTreeNode<IRectangleSizeDecorator> rectNode)
{
// Don't handle leafs directly. Let their parent arrange them.
if (rectNode.IsLeaf) return;
if (rectNode.Item == null) return;
float x = XSpacing;
rectNode.Item.X = XSpacing;
rectNode.Item.Y = YSpacing;
float h = rectNode.Item.Height;
foreach (DependencyTreeNode<IRectangleSizeDecorator> node in rectNode.Dependants)
{
node.Item.X = x;
node.Item.Y = YSpacing;
x += node.Item.Width + XSpacing;
h = Math.Max (h, rectNode.Item.Height + YSpacing + node.Item.Height);
}
rectNode.Item.Height = h;
rectNode.Item.Width = Math.Max (x - XSpacing, rectNode.Item.Width);
}
private void MoveSubTreeByParentPosition (DependencyTreeNode<IRectangleSizeDecorator> rectNode)
{
if (rectNode.Item == null) return;
foreach (DependencyTreeNode<IRectangleSizeDecorator> node in rectNode.Dependants)
MoveSubTreeBy(node, rectNode.Item.X - XSpacing, rectNode.Item.Y - YSpacing);
}
private void MoveSubTreeBy (DependencyTreeNode<IRectangleSizeDecorator> root, float x, float y)
{
DependencyTree<IRectangleSizeDecorator>.WalkTreeRootFirst(
root,
delegate (IRectangleSizeDecorator rect)
{
if (rect == null) return;
rect.Rectangle.X += x;
rect.Rectangle.Y += y;
});
}
private void CalcPhysicalSizeRecursive(DependencyTreeNode<IRectangleSizeDecorator> rectNode)
{
rectNode.Item.Size = (rectNode.Item.Rectangle.ActualWidth + XSpacing) * (rectNode.Item.Rectangle.ActualHeight + YSpacing);
rectNode.Item.ChildrenSize = 0;
rectNode.Item.SummedSize = rectNode.Item.Size;
foreach(DependencyTreeNode<IRectangleSizeDecorator> dn in rectNode.Dependants)
{
rectNode.Item.ChildrenSize += dn.Item.Size;
rectNode.Item.SummedSize += dn.Item.SummedSize;
}
}
private void SetupPositions(DependencyTreeNode<IRectangleSizeDecorator> rectNode)
{
if (rectNode.Item == null) return;
if (rectNode.Item.Rectangle == null) return;
if (rectNode.ParentNode != null && rectNode.ParentNode.Item != null)
{
IRectangle parent = rectNode.ParentNode.Item.Rectangle;
rectNode.Item.Rectangle.Y = parent.Y + parent.ActualHeight + YSpacing;
rectNode.Item.Rectangle.X = rectNode.Item.X;
}
else
{
rectNode.Item.Rectangle.X = XSpacing;
rectNode.Item.Rectangle.Y = YSpacing;
}
}
private void SortByPhysicalSize(DependencyTreeNode<IRectangleSizeDecorator> rectNode)
{
rectNode.Dependants.Sort(ComparePairValue);
}
private int ComparePairValue (
DependencyTreeNode<IRectangleSizeDecorator> a,
DependencyTreeNode<IRectangleSizeDecorator> b)
{
return a.Item.SummedSize.CompareTo(b.Item.SummedSize);
}
public void RecalcRoutes ()
{
}
public Route[] Routes
{
get
{
return routes.ToArray();
}
}
}
}

56
src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/Diagrams.csproj

@ -0,0 +1,56 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OutputType>Library</OutputType>
<RootNamespace>DiagramRouter</RootNamespace>
<AssemblyName>Diagrams</AssemblyName>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{0991423A-DBF6-4C89-B365-A1DF1EB32E42}</ProjectGuid>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>bin\Debug\</OutputPath>
<Optimize>False</Optimize>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugSymbols>True</DebugSymbols>
<DebugType>Full</DebugType>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>bin\Release\</OutputPath>
<Optimize>True</Optimize>
<DefineConstants>TRACE</DefineConstants>
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Drawing" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\..\Main\GlobalAssemblyInfo.cs">
<Link>GlobalAssemblyInfo.cs</Link>
</Compile>
<Compile Include="BaseRectangle.cs" />
<Compile Include="DiagramRouter.cs" />
<Compile Include="AssemblyInfo.cs" />
<Compile Include="Drawables\DrawableItemsStack.cs" />
<Compile Include="Drawables\DrawableRectangle.cs" />
<Compile Include="Drawables\HeaderedItem.cs" />
<Compile Include="Drawables\IDrawable.cs" />
<Compile Include="Drawables\IDrawableRectangle.cs" />
<Compile Include="Drawables\TextSegment.cs" />
<Compile Include="IRectangle.cs" />
<Compile Include="ItemsStack.cs" />
<Compile Include="Route.cs" />
<Compile Include="RouteSegment.cs" />
<Compile Include="Direction.cs" />
<Compile Include="DependencyTree.cs" />
<Compile Include="DependencyTreeNode.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Drawables" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

15
src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/Direction.cs

@ -0,0 +1,15 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.Drawing;
namespace Tools.Diagrams
{
public enum Direction { Up, Right, Down, Left };
}

35
src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/Drawables/DrawableItemsStack.cs

@ -0,0 +1,35 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml;
using Tools.Diagrams;
namespace Tools.Diagrams.Drawables
{
public class DrawableItemsStack : DrawableItemsStack<IDrawableRectangle> {}
public class DrawableItemsStack<T>
: ItemsStack<T>, IDrawableRectangle
where T : IDrawableRectangle
{
public void DrawToGraphics(Graphics graphics)
{
Recalculate();
foreach (IDrawable d in this)
d.DrawToGraphics(graphics);
}
}
}

83
src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/Drawables/DrawableRectangle.cs

@ -0,0 +1,83 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using Tools.Diagrams;
namespace Tools.Diagrams.Drawables
{
public class DrawableRectangle : BaseRectangle, IDrawableRectangle
{
private Brush fillBrush;
private Pen strokePen;
private float tlRad, trRad, brRad, blRad;
private GraphicsPath path;
public DrawableRectangle (Brush fill, Pen stroke)
: this (fill, stroke, 1, 1, 1, 1)
{
}
public DrawableRectangle (Brush fill, Pen stroke, float tl, float tr, float br, float bl)
{
fillBrush = fill;
strokePen = stroke;
tlRad = tl;
trRad = tr;
brRad = br;
blRad = bl;
}
public Brush FillBrush
{
get { return fillBrush; }
set { fillBrush = value; }
}
public Pen StrokePen
{
get { return strokePen; }
set { strokePen = value; }
}
protected override void OnActualSizeChanged()
{
path = null;
}
protected override void OnSizeChanged()
{
path = null;
}
private void RecreatePath()
{
path = new GraphicsPath();
path.AddArc(AbsoluteX, AbsoluteY, tlRad, tlRad, 180, 90);
path.AddArc(AbsoluteX + ActualWidth-trRad, AbsoluteY, trRad, trRad, 270, 90);
path.AddArc(AbsoluteX + ActualWidth-brRad, AbsoluteY + ActualHeight-brRad, brRad, brRad, 0, 90);
path.AddArc(AbsoluteX, AbsoluteY + ActualHeight-blRad, blRad, blRad, 90, 90);
path.CloseFigure();
}
public void DrawToGraphics(Graphics graphics)
{
if (graphics == null) return;
if (path == null) RecreatePath();
if (fillBrush != null)
graphics.FillPath(fillBrush, path);
if (strokePen != null)
graphics.DrawPath(strokePen, path);
}
}
}

166
src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/Drawables/HeaderedItem.cs

@ -0,0 +1,166 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using Tools.Diagrams;
namespace Tools.Diagrams.Drawables
{
public class HeaderedItem : BaseRectangle, IDrawableRectangle
{
bool collapsed;
IDrawableRectangle headerExpanded;
IDrawableRectangle content;
IDrawableRectangle headerCollapsed;
public event EventHandler RedrawNeeded = delegate {};
public HeaderedItem(IDrawableRectangle headerCollapsed,
IDrawableRectangle headerExpanded,
IDrawableRectangle content)
{
this.headerCollapsed = headerCollapsed;
this.headerExpanded = headerExpanded;
this.content = content;
headerCollapsed.Container = this;
headerExpanded.Container = this;
content.Container = this;
headerCollapsed.X = 0;
headerCollapsed.Y = 0;
headerExpanded.X = 0;
headerExpanded.Y = 0;
content.X = 0;
content.Y = headerExpanded.GetAbsoluteContentHeight();
headerExpanded.HeightChanged += delegate { content.Y = headerExpanded.GetAbsoluteContentHeight(); };
}
protected IDrawableRectangle HeaderCollapsed
{
get { return headerCollapsed; }
}
protected IDrawableRectangle HeaderExpanded
{
get { return headerExpanded; }
}
protected IDrawableRectangle Content
{
get { return content; }
}
public bool Collapsed
{
get { return collapsed; }
set
{
collapsed = value;
FireRedrawNeeded();
}
}
protected void FireRedrawNeeded()
{
RedrawNeeded(this, EventArgs.Empty);
}
#region Geometry
public override float ActualHeight
{
get { return GetAbsoluteContentHeight(); }
set { base.Height = value; }
}
public override float ActualWidth
{
get { return GetAbsoluteContentWidth(); }
set { base.Width = value; }
}
protected override void OnWidthChanged()
{
headerCollapsed.Width = base.Width;
headerExpanded.Width = base.Width;
content.Width = base.Width;
}
protected override void OnHeightChanged()
{
headerCollapsed.Height = headerCollapsed.GetAbsoluteContentHeight();
headerExpanded.Height = headerExpanded.GetAbsoluteContentHeight();
content.Height = content.GetAbsoluteContentHeight();
}
protected override void OnActualWidthChanged()
{
headerCollapsed.ActualWidth = base.ActualWidth;
headerExpanded.ActualWidth = base.ActualWidth;
content.ActualWidth = base.ActualWidth;
}
protected override void OnActualHeightChanged()
{
headerCollapsed.ActualHeight = headerCollapsed.GetAbsoluteContentHeight();
headerExpanded.ActualHeight = headerExpanded.GetAbsoluteContentHeight();
content.ActualHeight = content.GetAbsoluteContentHeight();
}
#endregion
public void DrawToGraphics(Graphics graphics)
{
if (!collapsed)
{
//TODO - add orientation, so the header could also be on the side.
headerExpanded.DrawToGraphics(graphics);
content.DrawToGraphics(graphics);
}
else
{
headerCollapsed.DrawToGraphics(graphics);
}
}
public override float GetAbsoluteContentWidth()
{
float width = 0;
if (!collapsed)
{
width = Math.Max(width, headerExpanded.GetAbsoluteContentWidth());
width = Math.Max(width, content.GetAbsoluteContentWidth());
}
else
width = headerCollapsed.GetAbsoluteContentWidth();
return width;
}
public override float GetAbsoluteContentHeight()
{
float height = 0;
if (!collapsed)
{
height = headerExpanded.GetAbsoluteContentHeight();
height += content.GetAbsoluteContentHeight();
}
else
{
height = headerCollapsed.GetAbsoluteContentHeight();
}
return height;
}
}
}

17
src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/Drawables/IDrawable.cs

@ -0,0 +1,17 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Drawing;
namespace Tools.Diagrams.Drawables
{
public interface IDrawable
{
void DrawToGraphics (Graphics graphics);
}
}

17
src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/Drawables/IDrawableRectangle.cs

@ -0,0 +1,17 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using Tools.Diagrams;
namespace Tools.Diagrams.Drawables
{
public interface IDrawableRectangle : IDrawable, IRectangle
{
}
}

126
src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/Drawables/TextSegment.cs

@ -0,0 +1,126 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace Tools.Diagrams.Drawables
{
public class TextSegment : BaseRectangle, IDrawableRectangle, IDisposable
{
float tw;
Font font;
Brush brush = Brushes.Black;
Graphics g;
string text;
StringFormat sf = new StringFormat();
public TextSegment (Graphics graphics, string text)
: this (graphics, text, new Font(System.Drawing.FontFamily.GenericSansSerif, 10.0f), false)
{
}
public TextSegment (Graphics graphics, string text, Font font, bool resizable)
{
if (graphics == null) throw new ArgumentNullException("graphics");
this.g = graphics;
this.text = text;
this.font = font;
sf.Trimming = StringTrimming.EllipsisCharacter;
MeasureString();
if (resizable)
Width = -1;
else
Width = float.NaN;
}
private void MeasureString ()
{
if (text != null && font != null && g != null)
tw = g.MeasureString(text, font).Width;
else
tw = float.NaN;
}
public override float Width
{
get
{
if (float.IsNaN(base.Width)) return tw;
return base.Width;
}
set { base.Width = value; }
}
public float TextWidth
{
get { return tw; }
}
public override float Height
{
get { return font.Size * 1.2f; }
set {}
}
public override float ActualHeight
{
get { return Height; }
set { base.ActualHeight = value; }
}
public string Text
{
get { return text; }
set
{
text = value;
MeasureString();
}
}
public Font Font
{
get { return font; }
set
{
font = value;
MeasureString();
}
}
public Brush Brush
{
get { return brush; }
set { brush = value; }
}
public void DrawToGraphics (Graphics graphics)
{
if (graphics == null) return;
RectangleF rect = new RectangleF(AbsoluteX, AbsoluteY, ActualWidth, ActualHeight);
graphics.DrawString(Text, Font, Brush, rect, sf);
}
public void Dispose()
{
brush.Dispose();
sf.Dispose();
}
public override float GetAbsoluteContentWidth()
{
return TextWidth + 20;
}
public override float GetAbsoluteContentHeight()
{
return Height;
}
}
}

118
src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/IRectangle.cs

@ -0,0 +1,118 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
namespace Tools.Diagrams
{
public interface IRectangle
{
/// <summary>
/// The X position of the rectangular item, relative to its container.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "X")]
float X { get; set; }
/// <summary>
/// The Y position of the rectangular item, relative to its container.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Y")]
float Y { get; set; }
/// <summary>
/// The X position of the rectangular item, relative to the root container.
/// </summary>
float AbsoluteX { get; }
/// <summary>
/// The Y position of the rectangular item, relative to the root container.
/// </summary>
float AbsoluteY { get; }
/// <summary>
/// The visible width of the item.
/// Layout managers such as ItemsStack change this value to define the width of
/// the item.
/// The value returned from this property must a positive decimal or zero, and must never
/// be NaN or infinite.
/// </summary>
float ActualWidth { get; set; }
/// <summary>
/// The visible height of the item.
/// Layout managers such as ItemsStack change this value to define the height of
/// the item.
/// The value returned from this property must a positive decimal or zero, and must never
/// be NaN or infinite.
/// </summary>
float ActualHeight { get; set; }
/// <summary>
/// The defined width of the item.
/// </summary>
/// <remarks>
/// A negative value means the the width is undefined, and is due to change by
/// layout managers, such as ItemsStack. In that case, ActualWidth is set to the
/// wanted value minus twice the border size.
/// </remarks>
float Width { get; set; }
/// <summary>
/// The defined height of the item.
/// </summary>
/// <remarks>
/// A negative value means the the height is undefined, and is due to change by
/// layout managers, such as ItemsStack. In that case, ActualHeight is set to the
/// wanted value minus twice the border size.
/// </remarks>
float Height { get; set; }
/// <summary>
/// The distance between the item borders to its container's content borders.
/// </summary>
float Border { get; set; }
/// <summary>
/// The distance between the item borders to its content.
/// </summary>
float Padding { get; set; }
/// <summary>
/// The width of the item content disregarding defined of visible modifying values,
/// such as border or width.
/// The value returned must a positive decimal or zero, and must never
/// be NaN or infinite.
/// </summary>
float GetAbsoluteContentWidth ();
/// <summary>
/// The height of the item content disregarding defined of visible modifying values,
/// such as border or height.
/// The value returned must a positive decimal or zero, and must never
/// be NaN or infinite.
/// </summary>
float GetAbsoluteContentHeight ();
bool KeepAspectRatio { get; set; }
/// <summary>
/// If the implementing object is contained within another rectangle,
/// this property points to the container.
/// </summary>
IRectangle Container { get; set; }
bool IsHResizable { get; }
bool IsVResizable { get; }
event EventHandler WidthChanged;
event EventHandler HeightChanged;
event EventHandler ActualWidthChanged;
event EventHandler ActualHeightChanged;
}
}

410
src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/ItemsStack.cs

@ -0,0 +1,410 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
namespace Tools.Diagrams
{
public enum Axis {X, Y, Z};
public class ItemsStack : ItemsStack<IRectangle> {}
public class ItemsStack<T> : BaseRectangle where T : IRectangle
{
List<T> items = new List<T>();
Axis axis = Axis.Y;
bool dontHandleResize;
public ItemsStack()
{
dontHandleResize = true;
base.Width = float.NaN;
base.Height = float.NaN;
dontHandleResize = false;
}
float minWidth = 0, minHeight = 0;
float spacing = 0;
bool modified = false;
public void Add (T item)
{
items.Add(item);
item.Container = this;
modified = true;
}
public void Remove (T item)
{
items.Remove(item);
item.Container = null;
modified = true;
}
public void Clear()
{
items.Clear();
modified = true;
}
public Axis OrientationAxis
{
get { return axis; }
set
{
axis = value;
modified = true;
}
}
#region Width Calculations
private float FindHeight()
{
if (!float.IsNaN(base.Height) || base.Height < 0) return base.Height;
if (!float.IsNaN(base.ActualHeight) || base.ActualHeight < 0) return base.ActualHeight;
float h = 0;
foreach (IRectangle r in items)
if (!float.IsNaN(r.ActualHeight) && r.ActualHeight >= 0)
h = Math.Max(h, r.ActualHeight);
return h;
}
private bool IsItemWidthValid(IRectangle r)
{
bool ret = true;
if (float.IsNaN(r.Width) || r.Width < 0)
{
if (!r.KeepAspectRatio)
ret = false;
}
return ret;
}
private float CalcUsedWidthSpace()
{
float usedSpace = 0.0f;
foreach (IRectangle r in items)
{
if (IsItemWidthValid(r))
usedSpace += (r.ActualWidth + spacing);
}
return usedSpace;
}
private float CalcWidthPerUndefined()
{
float width = base.ActualWidth;
if (float.IsNaN(width) || width < 0)
width = base.Width;
if (float.IsNaN(width) || width < 0)
return 0;
int count = 0;
foreach (IRectangle r in items)
if (!IsItemWidthValid(r))
count++;
if (count == 0) return 0;
float usedSpace = CalcUsedWidthSpace();
return (width - usedSpace - (count-1) * spacing) / count;
}
private void HRecalc()
{
float x = Padding, w = Padding;
float h = Math.Max(FindHeight(), minHeight);
foreach (IRectangle r in items)
r.ActualHeight = h - (r.Border + Padding) * 2;
float spacePerUndefined = CalcWidthPerUndefined();
foreach (IRectangle r in items)
{
r.X = x + r.Border;
r.Y = r.Border + Padding;
if (!IsItemWidthValid(r))
r.ActualWidth = Math.Max(spacePerUndefined - r.Border * 2, 0);
w += r.ActualWidth + spacing + r.Border * 2;
x = w;
}
dontHandleResize = true;
base.ActualWidth = Math.Max(w - spacing, minWidth);
base.ActualHeight = h;
dontHandleResize = false;
}
#endregion
#region Height Calculations
private float FindWidth()
{
if (!float.IsNaN(base.Width) || base.Width < 0) return base.Width;
if (!float.IsNaN(base.ActualWidth) || base.ActualWidth < 0) return base.ActualWidth;
float w = 0;
foreach (IRectangle r in items)
if (!float.IsNaN(r.ActualWidth) && r.ActualWidth >= 0)
w = Math.Max(w, r.ActualWidth);
return w;
}
private bool IsItemHeightValid(IRectangle r)
{
bool ret = true;
if (float.IsNaN(r.Height) || r.Height < 0)
{
if (!r.KeepAspectRatio)
ret = false;
}
return ret;
}
private float CalcUsedHeightSpace()
{
float usedSpace = 0;
foreach (IRectangle r in items)
if (IsItemHeightValid(r))
usedSpace += r.ActualHeight + spacing;
return usedSpace;
}
private float CalcHeightPerUndefined()
{
float height = base.ActualHeight;
if (float.IsNaN(height) || height < 0)
height = base.Height;
if (float.IsNaN(height) || height < 0)
return 0;
int count = 0;
foreach (IRectangle r in items)
if (!IsItemHeightValid(r))
count++;
if (count == 0) return 0;
float usedSpace = CalcUsedHeightSpace();
return(height - usedSpace - (count-1) * spacing) / count;
}
private void VRecalc()
{
if (items.Count == 0) return;
float y = Padding, h = Padding;
float w = Math.Max(FindWidth(), minWidth);
foreach (IRectangle r in items)
r.ActualWidth = w - (r.Border + Padding) * 2;
float spacePerUndefined = CalcHeightPerUndefined();
foreach (IRectangle r in items)
{
r.X = r.Border + Padding;
r.Y = y + r.Border;
if (!IsItemHeightValid(r))
r.ActualHeight = Math.Max (spacePerUndefined - r.Border * 2, 0);
h += r.ActualHeight + spacing + r.Border * 2;
y = h;
}
dontHandleResize = true;
base.ActualWidth = w;
base.ActualHeight = Math.Max(h - spacing + Padding, minHeight);
dontHandleResize = false;
}
#endregion
private void ZRecalc()
{
float w = Math.Max(FindWidth(), minWidth);
float h = Math.Max(FindHeight(), minHeight);
foreach (IRectangle r in items)
{
r.X = r.Border + Padding;
r.Y = r.Border + Padding;
r.ActualWidth = w - (r.Border + Padding) * 2;
r.ActualHeight = h - (r.Border + Padding) * 2;
}
dontHandleResize = true;
base.ActualWidth = w;
base.ActualHeight = h;
dontHandleResize = false;
}
public void Recalculate()
{
if (!modified) return;
if (dontHandleResize) return;
if (axis == Axis.X)
HRecalc();
else if (axis == Axis.Y)
VRecalc();
else if (axis == Axis.Z)
ZRecalc();
modified = false;
}
protected override void OnActualSizeChanged()
{
modified = true;
}
protected override void OnSizeChanged()
{
modified = true;
base.ActualWidth = float.NaN;
base.ActualHeight = float.NaN;
}
#region Geometry
public float MinHeight
{
get { return minHeight; }
set
{
minHeight = value;
modified = true;
}
}
public float MinWidth
{
get { return minWidth; }
set
{
minWidth = value;
modified = true;
}
}
public override float Width
{
get
{
Recalculate();
return base.Width;
}
set { base.Width = value; }
}
public override float Height
{
get
{
Recalculate();
return base.Height;
}
set { base.Height = value; }
}
public override float ActualWidth
{
get
{
Recalculate();
return base.ActualWidth;
}
set { base.ActualWidth = value; }
}
public override float ActualHeight
{
get
{
Recalculate();
return base.ActualHeight;
}
set { base.ActualHeight = value; }
}
#endregion
public float Spacing
{
get { return spacing; }
set
{
spacing = value;
modified = true;
}
}
public IEnumerator<T> GetEnumerator()
{
return items.GetEnumerator();
}
public int Count
{
get { return items.Count; }
}
public override float GetAbsoluteContentWidth()
{
float w = 0;
if (axis == Axis.X || axis == Axis.Z)
{
foreach (T item in items)
w += item.GetAbsoluteContentWidth() + item.Border * 2 + spacing;
w = Math.Max(w - spacing, 0);
}
else if (axis == Axis.Y)
{
foreach (T item in items)
w = Math.Max(w, item.GetAbsoluteContentWidth() + item.Border * 2);
}
return w;
}
public override float GetAbsoluteContentHeight()
{
float h = 0;
if (axis == Axis.X || axis == Axis.Z)
{
foreach (T item in items)
h = Math.Max(h, item.GetAbsoluteContentHeight() + item.Border * 2);
}
else if (axis == Axis.Y)
{
foreach (T item in items)
h += item.GetAbsoluteContentHeight() + item.Border * 2 + spacing;
h = Math.Max(h - spacing, 0);
}
return h;
}
public override string ToString()
{
if (items.Count > 0)
return "ItemStack - first item: " + items[0].ToString();
else
return base.ToString();
}
}
}

294
src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/Route.cs

@ -0,0 +1,294 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace Tools.Diagrams
{
public interface IRouteShape
{
}
public class Route
{
private IRectangle from;
private IRectangle to;
private LinkedList<RouteSegment> segments = new LinkedList<RouteSegment>();
private IRouteShape startShape;
private IRouteShape endShape;
private enum ConnectionPoint {North, East, South, West, Center};
public Route (IRectangle from, IRectangle to)
{
this.from = from;
this.to = to;
}
public IRectangle From
{
get { return from; }
set { from = value; }
}
public IRectangle To
{
get { return to; }
set { to = value; }
}
public IRouteShape StartShape
{
get { return startShape; }
set { startShape = value; }
}
public IRouteShape EndShape
{
get { return endShape; }
set { endShape = value; }
}
private static PointF GetConnectionPointPosition (IRectangle rect, ConnectionPoint point)
{
switch (point)
{
case ConnectionPoint.North: return new PointF(rect.X + rect.ActualWidth / 2, rect.Y);
case ConnectionPoint.East: return new PointF(rect.X + rect.ActualWidth, rect.Y + rect.ActualHeight / 2);
case ConnectionPoint.South: return new PointF(rect.X + rect.ActualWidth / 2, rect.Y + rect.ActualHeight);
case ConnectionPoint.West: return new PointF(rect.X, rect.Y + rect.ActualHeight / 2);
}
return new PointF(rect.X + rect.ActualWidth / 2, rect.Y + rect.ActualHeight / 2);
}
private void GetClosestConnectionPoints(out ConnectionPoint fromPoint, out ConnectionPoint toPoint)
{
float shortestDist = float.MaxValue;
float dist = shortestDist;
fromPoint = ConnectionPoint.Center;
toPoint = ConnectionPoint.Center;
for (int i = 0; i < 4; ++i)
{
PointF posF = GetConnectionPointPosition(from, (ConnectionPoint)i);
for (int j = 0; j < 4; ++j)
{
PointF posT = GetConnectionPointPosition(to, (ConnectionPoint)j);
float dx = posF.X - posT.X;
float dy = posF.Y - posT.Y;
dist = (dx*dx) + (dy*dy);
if (dist < shortestDist)
{
shortestDist = dist;
fromPoint = (ConnectionPoint)i;
toPoint = (ConnectionPoint)j;
}
}
}
}
public PointF GetStartPoint()
{
ConnectionPoint startPoint = ConnectionPoint.Center;
ConnectionPoint endPoint = ConnectionPoint.Center;
GetClosestConnectionPoints(out startPoint, out endPoint);
return GetConnectionPointPosition(from, startPoint);
}
public PointF GetEndPoint()
{
PointF p = GetStartPoint();
foreach (RouteSegment seg in segments)
{
p = seg.CreateDestinationPoint(p);
}
return p;
}
public Direction GetStartDirection()
{
return segments.First.Value.Direction;
}
public Direction GetEndDirection()
{
return segments.Last.Value.Direction;
}
public RouteSegment[] RouteSegments
{
get
{
RouteSegment[] rs = new RouteSegment[segments.Count];
segments.CopyTo(rs, 0);
return rs;
}
}
private IRectangle FindClosestObstacle (RouteSegment seg, PointF origin, IList<IRectangle> rectangles)
{
IRectangle closestRect = null;
float minDist = float.MaxValue;
foreach (IRectangle rect in FindAllSegmentObstacles(seg, origin, rectangles))
{
if (closestRect != null)
{
float dist = seg.IntersectionDistance(origin, rect);
if (minDist > dist)
{
minDist = dist;
closestRect = rect;
}
}
else
closestRect = rect;
}
return closestRect;
}
private ICollection<IRectangle> FindAllSegmentObstacles (RouteSegment seg, PointF origin, IList<IRectangle> rectangles)
{
List<IRectangle> obstacles = new List<IRectangle>();
foreach (IRectangle rect in rectangles)
{
if (seg.IntersectsWith(origin, rect))
obstacles.Add(rect);
}
return obstacles;
}
private ICollection<IRectangle> FindAllRouteObstacles (IList<IRectangle> rectangles)
{
PointF fromPoint = GetStartPoint();
PointF p = fromPoint;
List<IRectangle> allobstacles = new List<IRectangle>();
foreach (RouteSegment seg in segments)
{
ICollection<IRectangle> rects = FindAllSegmentObstacles(seg, p, rectangles);
foreach (IRectangle rect in rects)
{
if (!allobstacles.Contains(rect))
allobstacles.Add(rect);
}
p = seg.CreateDestinationPoint(p);
}
return allobstacles;
}
private void FixRouteSegment (RouteSegment seg)
{
}
public void Recalc (IEnumerable<IRectangle> rectangles)
{
segments.Clear();
ConnectionPoint startPoint = ConnectionPoint.Center;
ConnectionPoint endPoint = ConnectionPoint.Center;
GetClosestConnectionPoints(out startPoint, out endPoint);
PointF posF = GetConnectionPointPosition(from, startPoint);
PointF posT = GetConnectionPointPosition(to, endPoint);
Direction dir1 = default (Direction);
Direction dir2 = default (Direction);
Direction dir3 = default (Direction);
float l1 = 0;
float l2 = 0;
float l3 = 0;
switch (startPoint)
{
case ConnectionPoint.North: dir1 = Direction.Up; break;
case ConnectionPoint.East: dir1 = Direction.Right; break;
case ConnectionPoint.South: dir1 = Direction.Down; break;
case ConnectionPoint.West: dir1 = Direction.Left; break;
}
switch (endPoint)
{
case ConnectionPoint.North: dir3 = Direction.Down; break;
case ConnectionPoint.East: dir3 = Direction.Left; break;
case ConnectionPoint.South: dir3 = Direction.Up; break;
case ConnectionPoint.West: dir3 = Direction.Right; break;
}
if ((dir1 == Direction.Down && dir3 == Direction.Up) ||
(dir3 == Direction.Down && dir1 == Direction.Up))
{
l1 = l3 = 20;
float h = Math.Abs(posF.Y - posT.Y);
if (posT.Y > posF.Y)
l3 += h;
else
l1 += h;
l2 = Math.Abs(posF.X - posT.X);
dir2 = (posT.X > posF.X) ? Direction.Right : Direction.Left;
}
else if ((dir1 == Direction.Left && dir3 == Direction.Right) ||
(dir3 == Direction.Left && dir1 == Direction.Right))
{
l1 = l3 = 20;
float w = Math.Abs(posF.X - posT.X);
if (posT.X > posF.X)
l3 += w;
else
l1 += w;
l2 = Math.Abs(posF.Y - posT.Y);
dir2 = (posT.Y > posF.Y) ? Direction.Down : Direction.Up;
}
else if ((dir1 == Direction.Down && dir3 == Direction.Down) ||
(dir1 == Direction.Up && dir3 == Direction.Up))
{
l1 = l3 = Math.Abs(posF.Y - posT.Y) / 2;
l2 = Math.Abs(posF.X - posT.X);
dir2 = (posT.X > posF.X) ? Direction.Right : Direction.Left;
}
else if ((dir1 == Direction.Left && dir3 == Direction.Left) ||
(dir1 == Direction.Right && dir3 == Direction.Right))
{
l1 = l3 = Math.Abs(posF.X - posT.X) / 2;
l2 = Math.Abs(posF.Y - posT.Y);
dir2 = (posT.Y > posF.Y) ? Direction.Down : Direction.Up;
}
else if ((dir1 == Direction.Left || dir1 == Direction.Right) &&
(dir3 == Direction.Up || dir3 == Direction.Down))
{
l1 = Math.Abs(posF.X - posT.X);
l3 = Math.Abs(posF.Y - posT.Y);
}
else if ((dir3 == Direction.Left || dir3 == Direction.Right) &&
(dir1 == Direction.Up || dir1 == Direction.Down))
{
l3 = Math.Abs(posF.X - posT.X);
l1 = Math.Abs(posF.Y - posT.Y);
}
RouteSegment seg2 = null;
RouteSegment seg1 = new RouteSegment(l1, dir1);
if (l2 > 0)
seg2 = new RouteSegment(l2, dir2);
RouteSegment seg3 = new RouteSegment(l3, dir3);
segments.AddFirst(seg1);
if (seg2 != null)
segments.AddLast(seg2);
segments.AddLast(seg3);
}
}
}

99
src/AddIns/DisplayBindings/ClassDiagram/DiagramRouter/RouteSegment.cs

@ -0,0 +1,99 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.Drawing;
namespace Tools.Diagrams
{
public class RouteSegment
{
private Direction direction;
private float length;
public RouteSegment (float length, Direction direction)
{
this.length = length;
this.direction = direction;
}
public Direction Direction
{
get { return direction; }
set { direction = value; }
}
public float Length
{
get { return length; }
set { length = value; }
}
public PointF CreateDestinationPoint (PointF origin)
{
PointF dest = new PointF (origin.X, origin.Y);
switch (direction)
{
case Direction.Up: dest.Y -= length; break;
case Direction.Down: dest.Y += length; break;
case Direction.Left: dest.X -= length; break;
case Direction.Right: dest.X += length; break;
}
return dest;
}
public bool IntersectsWith (PointF origin, IRectangle rect)
{
PointF dest = CreateDestinationPoint(origin);
bool xIntersects = false;
bool yIntersects = false;
if (direction == Direction.Left || direction == Direction.Right)
{
float y = origin.Y;
float x1 = Math.Min(origin.X, dest.X);
float x2 = Math.Max(origin.X, dest.X);
yIntersects = (rect.Y <= y && rect.Y + rect.ActualHeight >= y);
xIntersects = (x2 < rect.X || x1 > rect.X + rect.ActualWidth);
}
else
{
float x = origin.X;
float y1 = Math.Min(origin.Y, dest.Y);
float y2 = Math.Max(origin.Y, dest.Y);
xIntersects = (rect.X <= x && rect.X + rect.ActualWidth >= x);
yIntersects = (y2 < rect.Y || y1 > rect.Y + rect.ActualHeight);
}
return xIntersects && yIntersects;
}
public float IntersectionDistance (PointF origin, IRectangle rect)
{
PointF dest = CreateDestinationPoint(origin);
float dist = -1;
switch (direction)
{
case Direction.Left:
dist = (origin.X - rect.X + rect.ActualWidth);
break;
case Direction.Right:
dist = rect.X - origin.X;
break;
case Direction.Up:
dist = (origin.Y - rect.Y + rect.ActualHeight);
break;
case Direction.Down:
dist = rect.Y - origin.Y;
break;
}
return dist;
}
}
}

17
src/Setup/Files.wxs

@ -897,6 +897,21 @@
<File Source="..\..\AddIns\AddIns\DisplayBindings\XmlEditor\XmlEditor.addin" Name="XMLEDI_1.ADD" Id="XmlEditor.addin" LongName="XmlEditor.addin" /> <File Source="..\..\AddIns\AddIns\DisplayBindings\XmlEditor\XmlEditor.addin" Name="XMLEDI_1.ADD" Id="XmlEditor.addin" LongName="XmlEditor.addin" />
</Component> </Component>
</Directory> </Directory>
<Directory Id="ClassDiagram" Name="ClassDia" LongName="ClassDiagram">
<Directory Id="Resources" Name="Resource" LongName="Resources">
<Component Guid="75152D8C-5D9A-4728-AB18-62637C785A7D" Id="ClassDiagramResources" DiskId="1">
<File Source="..\..\AddIns\AddIns\DisplayBindings\ClassDiagram\Resources\Bitmaps.resources" Name="BITMAPS.RES" Id="Bitmaps.resources" LongName="Bitmaps.resources" />
</Component>
</Directory>
<Component Guid="3939D17D-14A9-46F3-B568-05682BA10FB4" Id="ClassDiagramFiles" DiskId="1">
<File Source="..\..\AddIns\AddIns\DisplayBindings\ClassDiagram\ClassCanvas.dll" Name="CLASSC_1.DLL" Id="ClassCanvas.dll" LongName="ClassCanvas.dll" />
<File Source="..\..\AddIns\AddIns\DisplayBindings\ClassDiagram\ClassDiagramAddin.addin" Name="CLASSD_1.ADD" Id="ClassDiagramAddin.addin" LongName="ClassDiagramAddin.addin" />
<File Source="..\..\AddIns\AddIns\DisplayBindings\ClassDiagram\ClassDiagramAddin.dll" Name="CLASSD_1.DLL" Id="ClassDiagramAddin.dll" LongName="ClassDiagramAddin.dll" />
<File Source="..\..\AddIns\AddIns\DisplayBindings\ClassDiagram\ClassEditor.dll" Name="CLASSE_1.DLL" Id="ClassEditor.dll" LongName="ClassEditor.dll" />
<File Source="..\..\AddIns\AddIns\DisplayBindings\ClassDiagram\Diagrams.dll" Name="Diagrams.dll" Id="Diagrams.dll" />
<File Source="..\..\AddIns\AddIns\DisplayBindings\ClassDiagram\TreeListView.dll" Name="TREELI_1.DLL" Id="ClassDiagram.TreeListView.dll" LongName="TreeListView.dll" />
</Component>
</Directory>
</Directory> </Directory>
<Directory Id="MiscAddInsFolder" Name="Misc"> <Directory Id="MiscAddInsFolder" Name="Misc">
<Directory Id="AddInManagerFolder" LongName="AddInManager" Name="AddMan"> <Directory Id="AddInManagerFolder" LongName="AddInManager" Name="AddMan">
@ -1164,4 +1179,4 @@
</Directory> </Directory>
</DirectoryRef> </DirectoryRef>
</Fragment> </Fragment>
</Wix> </Wix>

2
src/Setup/Setup.wxs

@ -275,6 +275,8 @@
<ComponentRef Id="IconEditorExe"/> <ComponentRef Id="IconEditorExe"/>
<ComponentRef Id="ResourceEditorFiles"/> <ComponentRef Id="ResourceEditorFiles"/>
<ComponentRef Id="SettingsEditorFiles"/> <ComponentRef Id="SettingsEditorFiles"/>
<ComponentRef Id="ClassDiagramResources"/>
<ComponentRef Id="ClassDiagramFiles"/>
<ComponentRef Id="XmlEditorFiles"/> <ComponentRef Id="XmlEditorFiles"/>
<ComponentRef Id="AddInManagerFiles"/> <ComponentRef Id="AddInManagerFiles"/>
<ComponentRef Id="AddInManagerSharpZipLibDll"/> <ComponentRef Id="AddInManagerSharpZipLibDll"/>

35
src/SharpDevelop.sln

@ -1,7 +1,7 @@
 
Microsoft Visual Studio Solution File, Format Version 9.00 Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005 # Visual Studio 2005
# SharpDevelop 3.0.0.2190 # SharpDevelop 2.1.0.2192
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AddIns", "AddIns", "{14A277EE-7DF1-4529-B639-7D1EF334C1C5}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AddIns", "AddIns", "{14A277EE-7DF1-4529-B639-7D1EF334C1C5}"
ProjectSection(SolutionItems) = postProject ProjectSection(SolutionItems) = postProject
EndProjectSection EndProjectSection
@ -10,6 +10,18 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Display Bindings", "Display
ProjectSection(SolutionItems) = postProject ProjectSection(SolutionItems) = postProject
EndProjectSection EndProjectSection
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ClassDiagram", "ClassDiagram", "{DB137F0B-9B62-4232-AE92-F7BE0280B8D3}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Diagrams", "AddIns\DisplayBindings\ClassDiagram\DiagramRouter\Diagrams.csproj", "{0991423A-DBF6-4C89-B365-A1DF1EB32E42}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassDiagramAddin", "AddIns\DisplayBindings\ClassDiagram\ClassDiagramAddin\ClassDiagramAddin.csproj", "{5A1354DF-4989-4BB4-BC6B-D627C2E9FA13}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassEditor", "AddIns\DisplayBindings\ClassDiagram\ClassEditor\ClassEditor.csproj", "{F5E059BB-96C2-4398-BED0-8598CD434173}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassCanvas", "AddIns\DisplayBindings\ClassDiagram\ClassCanvas\ClassCanvas.csproj", "{08F772A1-F0BE-433E-8B37-F6522953DB05}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SettingsEditor", "AddIns\DisplayBindings\SettingsEditor\Project\SettingsEditor.csproj", "{85226AFB-CE71-4851-9A75-7EEC663A8E8A}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SettingsEditor", "AddIns\DisplayBindings\SettingsEditor\Project\SettingsEditor.csproj", "{85226AFB-CE71-4851-9A75-7EEC663A8E8A}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "IconEditor", "IconEditor", "{0D37CE59-B0EF-4F3C-B9EB-8557E53A448B}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "IconEditor", "IconEditor", "{0D37CE59-B0EF-4F3C-B9EB-8557E53A448B}"
@ -406,6 +418,22 @@ Global
{8C692BAF-108E-4346-B41E-6EE7D20E2E9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8C692BAF-108E-4346-B41E-6EE7D20E2E9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8C692BAF-108E-4346-B41E-6EE7D20E2E9D}.Release|Any CPU.Build.0 = Release|Any CPU {8C692BAF-108E-4346-B41E-6EE7D20E2E9D}.Release|Any CPU.Build.0 = Release|Any CPU
{8C692BAF-108E-4346-B41E-6EE7D20E2E9D}.Release|Any CPU.ActiveCfg = Release|Any CPU {8C692BAF-108E-4346-B41E-6EE7D20E2E9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{08F772A1-F0BE-433E-8B37-F6522953DB05}.Debug|Any CPU.Build.0 = Debug|Any CPU
{08F772A1-F0BE-433E-8B37-F6522953DB05}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{08F772A1-F0BE-433E-8B37-F6522953DB05}.Release|Any CPU.Build.0 = Release|Any CPU
{08F772A1-F0BE-433E-8B37-F6522953DB05}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F5E059BB-96C2-4398-BED0-8598CD434173}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F5E059BB-96C2-4398-BED0-8598CD434173}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F5E059BB-96C2-4398-BED0-8598CD434173}.Release|Any CPU.Build.0 = Release|Any CPU
{F5E059BB-96C2-4398-BED0-8598CD434173}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5A1354DF-4989-4BB4-BC6B-D627C2E9FA13}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5A1354DF-4989-4BB4-BC6B-D627C2E9FA13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5A1354DF-4989-4BB4-BC6B-D627C2E9FA13}.Release|Any CPU.Build.0 = Release|Any CPU
{5A1354DF-4989-4BB4-BC6B-D627C2E9FA13}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0991423A-DBF6-4C89-B365-A1DF1EB32E42}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0991423A-DBF6-4C89-B365-A1DF1EB32E42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0991423A-DBF6-4C89-B365-A1DF1EB32E42}.Release|Any CPU.Build.0 = Release|Any CPU
{0991423A-DBF6-4C89-B365-A1DF1EB32E42}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(NestedProjects) = preSolution GlobalSection(NestedProjects) = preSolution
{CE5B42B7-6E8C-4385-9E97-F4023FC16BF2} = {14A277EE-7DF1-4529-B639-7D1EF334C1C5} {CE5B42B7-6E8C-4385-9E97-F4023FC16BF2} = {14A277EE-7DF1-4529-B639-7D1EF334C1C5}
@ -416,6 +444,11 @@ Global
{6B717BD1-CD5E-498C-A42E-9E6A4584DC48} = {4EA396ED-64AD-4AD0-A67A-AB363F3E0C79} {6B717BD1-CD5E-498C-A42E-9E6A4584DC48} = {4EA396ED-64AD-4AD0-A67A-AB363F3E0C79}
{0D37CE59-B0EF-4F3C-B9EB-8557E53A448B} = {4EA396ED-64AD-4AD0-A67A-AB363F3E0C79} {0D37CE59-B0EF-4F3C-B9EB-8557E53A448B} = {4EA396ED-64AD-4AD0-A67A-AB363F3E0C79}
{85226AFB-CE71-4851-9A75-7EEC663A8E8A} = {4EA396ED-64AD-4AD0-A67A-AB363F3E0C79} {85226AFB-CE71-4851-9A75-7EEC663A8E8A} = {4EA396ED-64AD-4AD0-A67A-AB363F3E0C79}
{DB137F0B-9B62-4232-AE92-F7BE0280B8D3} = {4EA396ED-64AD-4AD0-A67A-AB363F3E0C79}
{08F772A1-F0BE-433E-8B37-F6522953DB05} = {DB137F0B-9B62-4232-AE92-F7BE0280B8D3}
{F5E059BB-96C2-4398-BED0-8598CD434173} = {DB137F0B-9B62-4232-AE92-F7BE0280B8D3}
{5A1354DF-4989-4BB4-BC6B-D627C2E9FA13} = {DB137F0B-9B62-4232-AE92-F7BE0280B8D3}
{0991423A-DBF6-4C89-B365-A1DF1EB32E42} = {DB137F0B-9B62-4232-AE92-F7BE0280B8D3}
{DC1CCE11-CB91-40FA-9C47-4D9EB5D67BFD} = {0D37CE59-B0EF-4F3C-B9EB-8557E53A448B} {DC1CCE11-CB91-40FA-9C47-4D9EB5D67BFD} = {0D37CE59-B0EF-4F3C-B9EB-8557E53A448B}
{DFB936AD-90EE-4B4F-941E-4F4A636F0D92} = {0D37CE59-B0EF-4F3C-B9EB-8557E53A448B} {DFB936AD-90EE-4B4F-941E-4F4A636F0D92} = {0D37CE59-B0EF-4F3C-B9EB-8557E53A448B}
{1F1AC7CD-D154-45BB-8EAF-804CA8055F5A} = {FEB825FA-4AD8-425D-8E4A-B5A18EE1B81C} {1F1AC7CD-D154-45BB-8EAF-804CA8055F5A} = {FEB825FA-4AD8-425D-8E4A-B5A18EE1B81C}

Loading…
Cancel
Save