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

Fix a small issue on Linux with Mono, and more.

This commit is contained in:
dgis 2016-02-27 20:50:46 +01:00
parent fec9ca0aaa
commit 97f914ff80
6 changed files with 88 additions and 56 deletions

22
MainForm.Designer.cs generated
View File

@ -515,6 +515,7 @@ namespace XSDDiagram
this.toolStripButtonShowReferenceBoundingBox.Size = new System.Drawing.Size(23, 22);
this.toolStripButtonShowReferenceBoundingBox.Text = "References";
this.toolStripButtonShowReferenceBoundingBox.ToolTipText = "Show the bounding box for the referenced elements";
this.toolStripButtonShowReferenceBoundingBox.Visible = false;
this.toolStripButtonShowReferenceBoundingBox.Click += new System.EventHandler(this.toolStripButtonShowReferenceBoundingBox_Click);
//
// toolStripButtonShowDocumentation
@ -895,14 +896,14 @@ namespace XSDDiagram
this.removeAllToolStripMenuItem,
this.expandOneLevelToolStripMenuItem});
this.contextMenuStripDiagram.Name = "contextMenuStripDiagram";
this.contextMenuStripDiagram.Size = new System.Drawing.Size(234, 142);
this.contextMenuStripDiagram.Size = new System.Drawing.Size(265, 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(233, 22);
this.gotoXSDFileToolStripMenuItem.Size = new System.Drawing.Size(264, 22);
this.gotoXSDFileToolStripMenuItem.Text = "&Goto XSD File";
this.gotoXSDFileToolStripMenuItem.Click += new System.EventHandler(this.gotoXSDFileToolStripMenuItem_Click);
//
@ -910,29 +911,28 @@ namespace XSDDiagram
//
this.expandToolStripMenuItem.Image = global::XSDDiagram.Properties.Resources.Expand;
this.expandToolStripMenuItem.Name = "expandToolStripMenuItem";
this.expandToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Space)));
this.expandToolStripMenuItem.Size = new System.Drawing.Size(233, 22);
this.expandToolStripMenuItem.Text = "E&xpand / Collapse";
this.expandToolStripMenuItem.Size = new System.Drawing.Size(264, 22);
this.expandToolStripMenuItem.Text = "E&xpand / Collapse [SPACE or RIGHT]";
this.expandToolStripMenuItem.Click += new System.EventHandler(this.expandToolStripMenuItem_Click);
//
// removeFromDiagramToolStripMenuItem
//
this.removeFromDiagramToolStripMenuItem.Image = global::XSDDiagram.Properties.Resources.Minus;
this.removeFromDiagramToolStripMenuItem.Name = "removeFromDiagramToolStripMenuItem";
this.removeFromDiagramToolStripMenuItem.Size = new System.Drawing.Size(233, 22);
this.removeFromDiagramToolStripMenuItem.Text = "&Remove From Diagram";
this.removeFromDiagramToolStripMenuItem.Size = new System.Drawing.Size(264, 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(230, 6);
this.toolStripMenuItem3.Size = new System.Drawing.Size(261, 6);
//
// addAllToolStripMenuItem
//
this.addAllToolStripMenuItem.Image = global::XSDDiagram.Properties.Resources.PlusPlus;
this.addAllToolStripMenuItem.Name = "addAllToolStripMenuItem";
this.addAllToolStripMenuItem.Size = new System.Drawing.Size(233, 22);
this.addAllToolStripMenuItem.Size = new System.Drawing.Size(264, 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(233, 22);
this.removeAllToolStripMenuItem.Size = new System.Drawing.Size(264, 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(233, 22);
this.expandOneLevelToolStripMenuItem.Size = new System.Drawing.Size(264, 22);
this.expandOneLevelToolStripMenuItem.Text = "&Expand All One Level";
this.expandOneLevelToolStripMenuItem.Click += new System.EventHandler(this.expandOneLevelToolStripMenuItem_Click);
//

View File

@ -147,6 +147,14 @@ namespace XSDDiagram
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (Options.IsRunningOnMono)
{
// Prevent exception with Linux on Mono
object[] toolStripMenuItems = new object[] { this.fileToolStripMenuItem, this.fileToolStripMenuItem, this.openToolStripMenuItem, this.openToolStripMenuItem, this.openURLToolStripMenuItem, this.openURLToolStripMenuItem, this.saveDiagramToolStripMenuItem, this.saveDiagramToolStripMenuItem, this.validateXMLFileToolStripMenuItem, this.validateXMLFileToolStripMenuItem, this.recentFilesToolStripMenuItem, this.recentFilesToolStripMenuItem, this.closeToolStripMenuItem, this.closeToolStripMenuItem, this.toolStripMenuItem2, this.pageToolStripMenuItem, this.pageToolStripMenuItem, this.printPreviewToolStripMenuItem, this.printPreviewToolStripMenuItem, this.printToolStripMenuItem, this.printToolStripMenuItem, this.toolStripMenuItem1, this.exitToolStripMenuItem, this.exitToolStripMenuItem, this.toolsToolStripMenuItem, this.toolsToolStripMenuItem, this.windowsExplorerRegistrationToolStripMenuItem, this.windowsExplorerRegistrationToolStripMenuItem, this.registerToolStripMenuItem, this.registerToolStripMenuItem, this.unregisterToolStripMenuItem, this.unregisterToolStripMenuItem, this.windowToolStripMenuItem, this.windowToolStripMenuItem, this.nextTabToolStripMenuItem, this.nextTabToolStripMenuItem, this.previousTabToolStripMenuItem, this.previousTabToolStripMenuItem, this.helpToolStripMenuItem, this.helpToolStripMenuItem, this.aboutToolStripMenuItem, this.aboutToolStripMenuItem, this.toolStripMenuItemAttributesCopyLine, this.toolStripMenuItemAttributesCopyLine, this.toolStripMenuItemAttributesCopyList, this.toolStripMenuItemAttributesCopyList, this.toolStripMenuItemEnumerateCopyLine, this.toolStripMenuItemEnumerateCopyLine, this.toolStripMenuItemEnumerateCopyList, this.toolStripMenuItemEnumerateCopyList, this.addToDiagrammToolStripMenuItem, this.addToDiagrammToolStripMenuItem, this.toolStripMenuItem4, this.toolStripMenuItemElementsCopyLine, this.toolStripMenuItemElementsCopyLine, this.toolStripMenuItemElementsCopyList, this.toolStripMenuItemElementsCopyList, this.gotoXSDFileToolStripMenuItem, this.gotoXSDFileToolStripMenuItem, this.expandToolStripMenuItem, this.expandToolStripMenuItem, this.removeFromDiagramToolStripMenuItem, this.removeFromDiagramToolStripMenuItem, this.toolStripMenuItem3, this.addAllToolStripMenuItem, this.addAllToolStripMenuItem, this.removeAllToolStripMenuItem, this.removeAllToolStripMenuItem, this.expandOneLevelToolStripMenuItem, this.expandOneLevelToolStripMenuItem };
foreach (var toolStripMenuItem in toolStripMenuItems)
GC.SuppressFinalize(toolStripMenuItem);
}
if (disposing)
{
if (components != null)
@ -320,21 +328,34 @@ namespace XSDDiagram
private void toolStripButtonAddToDiagram_Click(object sender, EventArgs e)
{
if (this.toolStripComboBoxSchemaElement.SelectedItem != null)
{
XSDObject xsdObject = this.toolStripComboBoxSchemaElement.SelectedItem as XSDObject;
if (xsdObject != null)
this.diagram.Add(xsdObject.Tag, xsdObject.NameSpace);
UpdateDiagram();
}
}
{
XSDObject xsdObject = this.toolStripComboBoxSchemaElement.SelectedItem as XSDObject;
if (xsdObject != null)
{
DiagramItem diagramItem = this.diagram.Add(xsdObject.Tag, xsdObject.NameSpace);
if(diagramItem != null)
SelectDiagramElement(diagramItem, true);
else
UpdateDiagram();
}
}
}
private void toolStripButtonAddAllToDiagram_Click(object sender, EventArgs e)
private void toolStripButtonAddAllToDiagram_Click(object sender, EventArgs e)
{
foreach (XSDObject xsdObject in this.schema.ElementsByName.Values)
if (xsdObject != null)
this.diagram.Add(xsdObject.Tag, xsdObject.NameSpace);
UpdateDiagram();
}
DiagramItem firstDiagramItem = null;
foreach (XSDObject xsdObject in this.schema.ElementsByName.Values)
if (xsdObject != null)
{
DiagramItem diagramItem = this.diagram.Add(xsdObject.Tag, xsdObject.NameSpace);
if (firstDiagramItem == null && diagramItem != null)
firstDiagramItem = diagramItem;
}
if(firstDiagramItem != null)
SelectDiagramElement(firstDiagramItem, true);
else
UpdateDiagram();
}
void DiagramControl_Paint(object sender, PaintEventArgs e)
{
@ -565,11 +586,10 @@ namespace XSDDiagram
this.textBoxElementPath.Text = path;
}
if (element != this.diagram.SelectedElement)
this.diagram.SelectElement(element);
this.diagram.SelectElement(element);
UpdateDiagram();
if (scrollToElement)
this.panelDiagram.ScrollTo(this.diagram.ScalePoint(element.Location), true);
UpdateDiagram();
}
private void SelectSchemaElement(XSDObject xsdObject)
@ -1437,27 +1457,35 @@ namespace XSDDiagram
{
if (this.listViewElements.SelectedItems.Count > 0)
{
foreach (ListViewItem lvi in this.listViewElements.SelectedItems)
DiagramItem firstDiagramItem = null;
foreach (ListViewItem lvi in this.listViewElements.SelectedItems)
{
XSDObject xsdObject = lvi.Tag as XSDObject;
this.diagram.Add(xsdObject.Tag as XMLSchema.openAttrs, xsdObject.NameSpace);
//switch (xsdObject.Type)
//{
// case "element":
// this.diagram.AddElement(xsdObject.Tag as XMLSchema.element, xsdObject.NameSpace);
// break;
// case "group":
// this.diagram.AddCompositors(xsdObject.Tag as XMLSchema.group, xsdObject.NameSpace);
// break;
// case "complexType":
// this.diagram.AddComplexType(xsdObject.Tag as XMLSchema.complexType, xsdObject.NameSpace);
// break;
// case "simpleType":
// this.diagram.Add(xsdObject.Tag as XMLSchema.simpleType, xsdObject.NameSpace);
// break;
//}
}
UpdateDiagram();
DiagramItem diagramItem = this.diagram.Add(xsdObject.Tag as XMLSchema.openAttrs, xsdObject.NameSpace);
if (firstDiagramItem == null && diagramItem != null)
firstDiagramItem = diagramItem;
//switch (xsdObject.Type)
//{
// case "element":
// this.diagram.AddElement(xsdObject.Tag as XMLSchema.element, xsdObject.NameSpace);
// break;
// case "group":
// this.diagram.AddCompositors(xsdObject.Tag as XMLSchema.group, xsdObject.NameSpace);
// break;
// case "complexType":
// this.diagram.AddComplexType(xsdObject.Tag as XMLSchema.complexType, xsdObject.NameSpace);
// break;
// case "simpleType":
// this.diagram.Add(xsdObject.Tag as XMLSchema.simpleType, xsdObject.NameSpace);
// break;
//}
}
if (firstDiagramItem != null)
SelectDiagramElement(firstDiagramItem, true);
else
UpdateDiagram();
}
}
@ -1508,11 +1536,15 @@ namespace XSDDiagram
private void toolStripButtonRemoveAllFromDiagram_Click(object sender, EventArgs e)
{
this.diagram.RemoveAll();
UpdateDiagram();
this.panelDiagram.VirtualPoint = new Point(0, 0);
this.panelDiagram.Clear();
}
DialogResult dialogResult = MessageBox.Show("Are you sure to remove everything?", "Remove All", MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.Yes)
{
this.diagram.RemoveAll();
UpdateDiagram();
this.panelDiagram.VirtualPoint = new Point(0, 0);
this.panelDiagram.Clear();
}
}
private void listView_AfterLabelEdit(object sender, LabelEditEventArgs e)
{

View File

@ -1,6 +1,6 @@
XSD Diagram is a free xml schema definition diagram viewer (http://regis.cosnier.free.fr).
Version 1.0alpha Copyright (c) 2006-2016 Regis Cosnier, All Rights Reserved.
Version 1.0 Copyright (c) 2006-2016 Regis Cosnier, All Rights Reserved.
This program is free software and may be distributed
according to the terms of the GNU General Public License (GPL).
@ -121,8 +121,8 @@ TODO LIST:
CHANGES:
version 1.0a (Not released yet)
- Add the documentation in the diagram (experimental).
version 1.0 (2016-02-28)
- Add the documentation in the diagram.
- Add a close entry in the File menu.
- Add a recently opened list.
- Add the selection of an element in the diagram and allow to move from one element to another with the arrow key.

Binary file not shown.

Binary file not shown.

View File

@ -633,9 +633,9 @@ namespace XSDDiagram.Rendering
if (_documentationBox != null)
{
if(_diagram.Alignement == DiagramAlignement.Far)
_documentationBox.Offset(_location.X - _padding.Height / 2, _location.Y - _documentationBox.Height - _padding.Height);
_documentationBox.Offset(_location.X, _location.Y - _documentationBox.Height - _padding.Height);
else
_documentationBox.Offset(_location.X - _padding.Height / 2, _location.Y + _elementBox.Height + _padding.Height);
_documentationBox.Offset(_location.X, _location.Y + _elementBox.Height + _padding.Height);
}
}