1
1
mirror of https://github.com/dgis/xsddiagram.git synced 2024-08-17 06:20:23 +03:00

Improve documentation and set a min width for the element with documentation.

This commit is contained in:
dgis 2016-07-08 17:21:04 +02:00
parent ea3d5e76f1
commit b6bc9a5860
7 changed files with 45 additions and 16 deletions

22
MainForm.Designer.cs generated
View File

@ -248,7 +248,7 @@ namespace XSDDiagram
this.toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.windowsExplorerRegistrationToolStripMenuItem});
this.toolsToolStripMenuItem.Name = "toolsToolStripMenuItem";
this.toolsToolStripMenuItem.Size = new System.Drawing.Size(47, 20);
this.toolsToolStripMenuItem.Size = new System.Drawing.Size(48, 20);
this.toolsToolStripMenuItem.Text = "&Tools";
//
// windowsExplorerRegistrationToolStripMenuItem
@ -290,7 +290,7 @@ namespace XSDDiagram
//
this.nextTabToolStripMenuItem.Name = "nextTabToolStripMenuItem";
this.nextTabToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Tab)));
this.nextTabToolStripMenuItem.Size = new System.Drawing.Size(226, 22);
this.nextTabToolStripMenuItem.Size = new System.Drawing.Size(228, 22);
this.nextTabToolStripMenuItem.Text = "&Next Tab";
this.nextTabToolStripMenuItem.Click += new System.EventHandler(this.nextTabToolStripMenuItem_Click);
//
@ -299,7 +299,7 @@ namespace XSDDiagram
this.previousTabToolStripMenuItem.Name = "previousTabToolStripMenuItem";
this.previousTabToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
| System.Windows.Forms.Keys.Tab)));
this.previousTabToolStripMenuItem.Size = new System.Drawing.Size(226, 22);
this.previousTabToolStripMenuItem.Size = new System.Drawing.Size(228, 22);
this.previousTabToolStripMenuItem.Text = "&Previous Tab";
this.previousTabToolStripMenuItem.Click += new System.EventHandler(this.previousTabToolStripMenuItem_Click);
//
@ -896,14 +896,14 @@ namespace XSDDiagram
this.removeAllToolStripMenuItem,
this.expandOneLevelToolStripMenuItem});
this.contextMenuStripDiagram.Name = "contextMenuStripDiagram";
this.contextMenuStripDiagram.Size = new System.Drawing.Size(265, 142);
this.contextMenuStripDiagram.Size = new System.Drawing.Size(266, 142);
this.contextMenuStripDiagram.Opened += new System.EventHandler(this.contextMenuStripDiagram_Opened);
//
// gotoXSDFileToolStripMenuItem
//
this.gotoXSDFileToolStripMenuItem.Image = global::XSDDiagram.Properties.Resources.Move;
this.gotoXSDFileToolStripMenuItem.Name = "gotoXSDFileToolStripMenuItem";
this.gotoXSDFileToolStripMenuItem.Size = new System.Drawing.Size(264, 22);
this.gotoXSDFileToolStripMenuItem.Size = new System.Drawing.Size(265, 22);
this.gotoXSDFileToolStripMenuItem.Text = "&Goto XSD File";
this.gotoXSDFileToolStripMenuItem.Click += new System.EventHandler(this.gotoXSDFileToolStripMenuItem_Click);
//
@ -911,7 +911,7 @@ namespace XSDDiagram
//
this.expandToolStripMenuItem.Image = global::XSDDiagram.Properties.Resources.Expand;
this.expandToolStripMenuItem.Name = "expandToolStripMenuItem";
this.expandToolStripMenuItem.Size = new System.Drawing.Size(264, 22);
this.expandToolStripMenuItem.Size = new System.Drawing.Size(265, 22);
this.expandToolStripMenuItem.Text = "E&xpand / Collapse [SPACE or RIGHT]";
this.expandToolStripMenuItem.Click += new System.EventHandler(this.expandToolStripMenuItem_Click);
//
@ -919,20 +919,20 @@ namespace XSDDiagram
//
this.removeFromDiagramToolStripMenuItem.Image = global::XSDDiagram.Properties.Resources.Minus;
this.removeFromDiagramToolStripMenuItem.Name = "removeFromDiagramToolStripMenuItem";
this.removeFromDiagramToolStripMenuItem.Size = new System.Drawing.Size(264, 22);
this.removeFromDiagramToolStripMenuItem.Size = new System.Drawing.Size(265, 22);
this.removeFromDiagramToolStripMenuItem.Text = "&Remove From Diagram [DEL]";
this.removeFromDiagramToolStripMenuItem.Click += new System.EventHandler(this.removeFromDiagramToolStripMenuItem_Click);
//
// toolStripMenuItem3
//
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
this.toolStripMenuItem3.Size = new System.Drawing.Size(261, 6);
this.toolStripMenuItem3.Size = new System.Drawing.Size(262, 6);
//
// addAllToolStripMenuItem
//
this.addAllToolStripMenuItem.Image = global::XSDDiagram.Properties.Resources.PlusPlus;
this.addAllToolStripMenuItem.Name = "addAllToolStripMenuItem";
this.addAllToolStripMenuItem.Size = new System.Drawing.Size(264, 22);
this.addAllToolStripMenuItem.Size = new System.Drawing.Size(265, 22);
this.addAllToolStripMenuItem.Text = "Add &All";
this.addAllToolStripMenuItem.Click += new System.EventHandler(this.toolStripButtonAddAllToDiagram_Click);
//
@ -940,7 +940,7 @@ namespace XSDDiagram
//
this.removeAllToolStripMenuItem.Image = global::XSDDiagram.Properties.Resources.Delete;
this.removeAllToolStripMenuItem.Name = "removeAllToolStripMenuItem";
this.removeAllToolStripMenuItem.Size = new System.Drawing.Size(264, 22);
this.removeAllToolStripMenuItem.Size = new System.Drawing.Size(265, 22);
this.removeAllToolStripMenuItem.Text = "&Remove All";
this.removeAllToolStripMenuItem.Click += new System.EventHandler(this.toolStripButtonRemoveAllFromDiagram_Click);
//
@ -948,7 +948,7 @@ namespace XSDDiagram
//
this.expandOneLevelToolStripMenuItem.Image = global::XSDDiagram.Properties.Resources.Expand;
this.expandOneLevelToolStripMenuItem.Name = "expandOneLevelToolStripMenuItem";
this.expandOneLevelToolStripMenuItem.Size = new System.Drawing.Size(264, 22);
this.expandOneLevelToolStripMenuItem.Size = new System.Drawing.Size(265, 22);
this.expandOneLevelToolStripMenuItem.Text = "&Expand All One Level";
this.expandOneLevelToolStripMenuItem.Click += new System.EventHandler(this.expandOneLevelToolStripMenuItem_Click);
//

View File

@ -121,10 +121,11 @@ TODO LIST:
CHANGES:
version 1.1 (Not released yet)
version 1.1 (2016-07-08)
- Fix SVG page size.
- The error dialog should now appear if a local dependency cannot be loaded.
- Fix the "use" field of an attribute with a reference (Thanks Christelle S.).
- I increase the minimum width of an element when showing the documentation for an easier reading (Thanks Stefan B.).
version 1.0 (2016-02-28)
- Add the documentation in the diagram.
@ -149,7 +150,7 @@ version 0.17 (2015-09-02)
- Fix a typo with "Attributes".
version 0.16 (2013-01-23)
- Fix an issue to prevent the cylcles in the imported files.
- Fix an issue to prevent the cycles in the imported files.
- Add a dialog to download a xsd file with its URL.
version 0.15 (2013-01-13)

Binary file not shown.

Binary file not shown.

View File

@ -174,7 +174,7 @@ namespace XSDDiagram.Rendering
foregroundInheritPen.StartCap = LineCap.Round;
foregroundInheritPen.EndCap = LineCap.Round;
bool showDocumentation = (drawingItem.Diagram.ShowDocumentation && !drawingItem.DocumentationBox.IsEmpty);
bool showDocumentation = (drawingItem.Diagram.ShowDocumentation); // && !drawingItem.DocumentationBox.IsEmpty);
if (drawingItem.ChildElements.Count == 1 && !showDocumentation)
{
int parentMidleY = drawingItem.ScaleInt(drawingItem.Location.Y + drawingItem.Size.Height / 2);
@ -559,6 +559,15 @@ namespace XSDDiagram.Rendering
Point targetPoint = basePoint + new Size(3, -3);
basePoint = drawingItem.ScalePoint(basePoint);
targetPoint = drawingItem.ScalePoint(targetPoint);
if (drawingItem.ItemType == DiagramItemType.group)
{
int bevel = (int)(scaledElementBox.Height * 0.30);
int groupCornerOffset = (int)((double)bevel * 0.424264068713); // 0.6/sqr(2)
basePoint.X += groupCornerOffset;
basePoint.Y -= groupCornerOffset;
targetPoint.X += groupCornerOffset;
targetPoint.Y -= groupCornerOffset;
}
_graphics.DrawLine(arrowPen, basePoint, targetPoint);
Point[] pathPoint = new Point[5];

View File

@ -46,6 +46,7 @@ namespace XSDDiagram.Rendering
private Rectangle _childExpandButtonBox;
private Rectangle _documentationBox;
private Rectangle _boundingBox;
private int _documentationMinWidth;
private Diagram _diagram;
private DiagramItem _parent;
@ -74,6 +75,7 @@ namespace XSDDiagram.Rendering
_documentationBox = Rectangle.Empty;
_childExpandButtonBox = Rectangle.Empty;
_boundingBox = Rectangle.Empty;
_documentationMinWidth = 100;
_size = new Size(50, 25);
_margin = new Size(10, 5);
_padding = new Size(10, 15);
@ -539,6 +541,7 @@ namespace XSDDiagram.Rendering
int childBoundingBoxWidth = 0;
if (_showChildElements)
{
// Measure the children
foreach (DiagramItem element in _childElements)
{
//MONOFIX GenerateMeasure not supported???
@ -555,9 +558,16 @@ namespace XSDDiagram.Rendering
string text = GetTextDocumentation();
if (text != null)
{
if (_size.Width < _documentationMinWidth)
{
int widthOffset = _documentationMinWidth - _size.Width;
_size.Width += widthOffset;
_boundingBox.Width += widthOffset;
}
SizeF sizeF = g.MeasureString(text, DocumentationFont);
double documentationWidth = Math.Max(1.0, _size.Width + _padding.Width); // * 2.0);
double documentationHeight = (Math.Ceiling(sizeF.Width / documentationWidth) + 1) * sizeF.Height;
double documentationHeight = (Math.Ceiling(sizeF.Width / documentationWidth) + 1.8) * sizeF.Height;
_documentationBox = new Rectangle(new Point(0, 0), new Size((int)documentationWidth, (int)documentationHeight));
_boundingBox.Height = Math.Max(_size.Height + 2 * _padding.Height + _documentationBox.Height + 2 * _padding.Height, childBoundingBoxHeight);
}
@ -583,7 +593,7 @@ namespace XSDDiagram.Rendering
case DiagramAlignement.Center:
_location.Y = _boundingBox.Y +
(_boundingBox.Height - _size.Height) / 2;
if(_diagram.ShowDocumentation && !_documentationBox.IsEmpty)
if(_diagram.ShowDocumentation && !_documentationBox.IsEmpty)
{
_location.Y = _boundingBox.Y +
(_boundingBox.Height - (2 * _padding.Height + _documentationBox.Height)) / 2;

View File

@ -542,6 +542,15 @@ namespace XSDDiagram.Rendering
Point targetPoint = basePoint + new Size(3, -3);
basePoint = drawingItem.ScalePoint(basePoint);
targetPoint = drawingItem.ScalePoint(targetPoint);
if (drawingItem.ItemType == DiagramItemType.group)
{
int bevel = (int)(scaledElementBox.Height * 0.30);
int groupCornerOffset = (int)((double)bevel * 0.424264068713); // 0.6/sqr(2)
basePoint.X += groupCornerOffset;
basePoint.Y -= groupCornerOffset;
targetPoint.X += groupCornerOffset;
targetPoint.Y -= groupCornerOffset;
}
SVGLine(arrowPen, basePoint, targetPoint);
Point[] pathPoint = new Point[5];