mirror of
https://github.com/dgis/xsddiagram.git
synced 2024-10-27 03:01:06 +03:00
Merge branch 'master' of https://github.com/dgis/xsddiagram into descriptions
This commit is contained in:
commit
7ed08010b5
@ -144,14 +144,12 @@ namespace XSDDiagram
|
|||||||
this.hScrollBar.Minimum = 0;
|
this.hScrollBar.Minimum = 0;
|
||||||
this.hScrollBar.Maximum = this.virtualSize.Width;
|
this.hScrollBar.Maximum = this.virtualSize.Width;
|
||||||
this.hScrollBar.LargeChange = this.diagramControl.ClientSize.Width;
|
this.hScrollBar.LargeChange = this.diagramControl.ClientSize.Width;
|
||||||
this.hScrollBar.Visible = true;
|
|
||||||
diagramControlNewSize.Height -= this.hScrollBar.Height;
|
diagramControlNewSize.Height -= this.hScrollBar.Height;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.hScrollBar.Minimum = 0;
|
this.hScrollBar.Minimum = 0;
|
||||||
this.hScrollBar.Maximum = 0;
|
this.hScrollBar.Maximum = 0;
|
||||||
this.hScrollBar.Visible = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.virtualSize.Height > this.diagramControl.ClientSize.Height)
|
if (this.virtualSize.Height > this.diagramControl.ClientSize.Height)
|
||||||
@ -159,30 +157,32 @@ namespace XSDDiagram
|
|||||||
this.vScrollBar.Minimum = 0;
|
this.vScrollBar.Minimum = 0;
|
||||||
this.vScrollBar.Maximum = this.virtualSize.Height;
|
this.vScrollBar.Maximum = this.virtualSize.Height;
|
||||||
this.vScrollBar.LargeChange = this.diagramControl.ClientSize.Height;
|
this.vScrollBar.LargeChange = this.diagramControl.ClientSize.Height;
|
||||||
this.vScrollBar.Visible = true;
|
|
||||||
diagramControlNewSize.Width -= this.vScrollBar.Width;
|
diagramControlNewSize.Width -= this.vScrollBar.Width;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.vScrollBar.Minimum = 0;
|
this.vScrollBar.Minimum = 0;
|
||||||
this.vScrollBar.Maximum = 0;
|
this.vScrollBar.Maximum = 0;
|
||||||
this.vScrollBar.Visible = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fix the Bottom right corner of the scrollbar area.
|
||||||
|
// Seems to be an issue with Mono on Linux!!!
|
||||||
|
if (!Options.IsRunningOnMono)
|
||||||
|
{
|
||||||
Size hScrollBarSize = this.hScrollBar.Size;
|
Size hScrollBarSize = this.hScrollBar.Size;
|
||||||
if (this.hScrollBar.Visible && !this.vScrollBar.Visible)
|
if (this.hScrollBar.Maximum > 0 && this.vScrollBar.Maximum == 0)
|
||||||
hScrollBarSize.Width = this.ClientSize.Width;
|
hScrollBarSize.Width = this.ClientSize.Width;
|
||||||
else
|
else
|
||||||
hScrollBarSize.Width = this.ClientSize.Width - this.vScrollBar.Width;
|
hScrollBarSize.Width = this.ClientSize.Width - this.vScrollBar.Width;
|
||||||
this.hScrollBar.Size = hScrollBarSize;
|
this.hScrollBar.Size = hScrollBarSize;
|
||||||
|
|
||||||
Size vScrollBarSize = this.vScrollBar.Size;
|
Size vScrollBarSize = this.vScrollBar.Size;
|
||||||
if (this.vScrollBar.Visible && !this.hScrollBar.Visible)
|
if (this.vScrollBar.Maximum > 0 && this.hScrollBar.Maximum == 0)
|
||||||
vScrollBarSize.Height = this.ClientSize.Height;
|
vScrollBarSize.Height = this.ClientSize.Height;
|
||||||
else
|
else
|
||||||
vScrollBarSize.Height = this.ClientSize.Height - this.hScrollBar.Height;
|
vScrollBarSize.Height = this.ClientSize.Height - this.hScrollBar.Height;
|
||||||
this.vScrollBar.Size = vScrollBarSize;
|
this.vScrollBar.Size = vScrollBarSize;
|
||||||
|
}
|
||||||
|
|
||||||
this.diagramControl.Size = diagramControlNewSize;
|
this.diagramControl.Size = diagramControlNewSize;
|
||||||
this.diagramControl.Invalidate(this.diagramControl.ClientRectangle);
|
this.diagramControl.Invalidate(this.diagramControl.ClientRectangle);
|
||||||
|
155
MRUManager.cs
Normal file
155
MRUManager.cs
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.IO;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
|
||||||
|
|
||||||
|
namespace XSDDiagram
|
||||||
|
{
|
||||||
|
public class MRUManager
|
||||||
|
{
|
||||||
|
public delegate void EventDelegate(object sender, EventArgs e);
|
||||||
|
|
||||||
|
private string nameOfProgram;
|
||||||
|
private string subKeyName;
|
||||||
|
private ToolStripMenuItem parentMenuItem;
|
||||||
|
private EventDelegate onRecentFileClick;
|
||||||
|
private EventDelegate onClearRecentFilesClick;
|
||||||
|
|
||||||
|
|
||||||
|
public MRUManager(ToolStripMenuItem parentMenuItem, string nameOfProgram, EventDelegate onRecentFileClick, EventDelegate onClearRecentFilesClick = null)
|
||||||
|
{
|
||||||
|
if (parentMenuItem == null || onRecentFileClick == null ||
|
||||||
|
nameOfProgram == null || nameOfProgram.Length == 0 || nameOfProgram.Contains("\\"))
|
||||||
|
throw new ArgumentException("Bad argument.");
|
||||||
|
|
||||||
|
this.parentMenuItem = parentMenuItem;
|
||||||
|
this.nameOfProgram = nameOfProgram;
|
||||||
|
this.onRecentFileClick = onRecentFileClick;
|
||||||
|
this.onClearRecentFilesClick = onClearRecentFilesClick;
|
||||||
|
this.subKeyName = string.Format("Software\\{0}\\MRU", this.nameOfProgram);
|
||||||
|
|
||||||
|
this._refreshRecentFilesMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddRecentFile(string fileNameWithFullPath)
|
||||||
|
{
|
||||||
|
string value;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
RegistryKey registryKey = Registry.CurrentUser.CreateSubKey(this.subKeyName, RegistryKeyPermissionCheck.ReadWriteSubTree);
|
||||||
|
for (int i = 0; true; i++)
|
||||||
|
{
|
||||||
|
value = registryKey.GetValue(i.ToString(), null) as string;
|
||||||
|
if (value == null)
|
||||||
|
{
|
||||||
|
registryKey.SetValue(i.ToString(), fileNameWithFullPath);
|
||||||
|
registryKey.Close();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if (value == fileNameWithFullPath)
|
||||||
|
{
|
||||||
|
registryKey.Close();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine(ex.ToString());
|
||||||
|
}
|
||||||
|
this._refreshRecentFilesMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveRecentFile(string fileNameWithFullPath)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
RegistryKey registryKey = Registry.CurrentUser.OpenSubKey(this.subKeyName, true);
|
||||||
|
string[] valuesNames = registryKey.GetValueNames();
|
||||||
|
foreach (string valueName in valuesNames)
|
||||||
|
{
|
||||||
|
if ((registryKey.GetValue(valueName, null) as string) == fileNameWithFullPath)
|
||||||
|
{
|
||||||
|
registryKey.DeleteValue(valueName, true);
|
||||||
|
this._refreshRecentFilesMenu();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine(ex.ToString());
|
||||||
|
}
|
||||||
|
this._refreshRecentFilesMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void _onClearRecentFiles_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
RegistryKey registryKey = Registry.CurrentUser.OpenSubKey(this.subKeyName, true);
|
||||||
|
if (registryKey == null)
|
||||||
|
return;
|
||||||
|
string[] values = registryKey.GetValueNames();
|
||||||
|
foreach (string valueName in values)
|
||||||
|
registryKey.DeleteValue(valueName, true);
|
||||||
|
registryKey.Close();
|
||||||
|
this.parentMenuItem.DropDownItems.Clear();
|
||||||
|
this.parentMenuItem.Enabled = false;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine(ex.ToString());
|
||||||
|
}
|
||||||
|
if (onClearRecentFilesClick != null)
|
||||||
|
this.onClearRecentFilesClick(sender, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void _refreshRecentFilesMenu()
|
||||||
|
{
|
||||||
|
RegistryKey registryKey;
|
||||||
|
string value;
|
||||||
|
ToolStripItem toolStripItem;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
registryKey = Registry.CurrentUser.OpenSubKey(this.subKeyName, false);
|
||||||
|
if (registryKey == null)
|
||||||
|
{
|
||||||
|
this.parentMenuItem.Enabled = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Cannot open recent files registry key:\n" + ex.ToString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.parentMenuItem.DropDownItems.Clear();
|
||||||
|
string[] valueNames = registryKey.GetValueNames();
|
||||||
|
foreach (string valueName in valueNames)
|
||||||
|
{
|
||||||
|
value = registryKey.GetValue(valueName, null) as string;
|
||||||
|
if (value == null)
|
||||||
|
continue;
|
||||||
|
toolStripItem = this.parentMenuItem.DropDownItems.Add(value);
|
||||||
|
toolStripItem.Click += new EventHandler(this.onRecentFileClick);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.parentMenuItem.DropDownItems.Count == 0)
|
||||||
|
{
|
||||||
|
this.parentMenuItem.Enabled = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.parentMenuItem.DropDownItems.Add("-");
|
||||||
|
toolStripItem = this.parentMenuItem.DropDownItems.Add("Clear list");
|
||||||
|
toolStripItem.Click += new EventHandler(this._onClearRecentFiles_Click);
|
||||||
|
this.parentMenuItem.Enabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
63
MainForm.Designer.cs
generated
63
MainForm.Designer.cs
generated
@ -20,8 +20,10 @@ namespace XSDDiagram
|
|||||||
this.menuStripMain = new System.Windows.Forms.MenuStrip();
|
this.menuStripMain = new System.Windows.Forms.MenuStrip();
|
||||||
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.openURLToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.saveDiagramToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.saveDiagramToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.validateXMLFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.validateXMLFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.closeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
|
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
this.pageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.pageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.printPreviewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.printPreviewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
@ -64,10 +66,10 @@ namespace XSDDiagram
|
|||||||
this.tabControlElement = new System.Windows.Forms.TabControl();
|
this.tabControlElement = new System.Windows.Forms.TabControl();
|
||||||
this.tabPageElementAttibutes = new System.Windows.Forms.TabPage();
|
this.tabPageElementAttibutes = new System.Windows.Forms.TabPage();
|
||||||
this.listViewAttributes = new System.Windows.Forms.ListView();
|
this.listViewAttributes = new System.Windows.Forms.ListView();
|
||||||
this.columnHeaderAttributesName = new System.Windows.Forms.ColumnHeader();
|
this.columnHeaderAttributesName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||||
this.columnHeaderAttributesType = new System.Windows.Forms.ColumnHeader();
|
this.columnHeaderAttributesType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||||
this.columnHeaderAttributesUse = new System.Windows.Forms.ColumnHeader();
|
this.columnHeaderAttributesUse = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||||
this.columnHeaderAttributesDefault = new System.Windows.Forms.ColumnHeader();
|
this.columnHeaderAttributesDefault = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||||
this.contextMenuStripAttributes = new System.Windows.Forms.ContextMenuStrip(this.components);
|
this.contextMenuStripAttributes = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||||
this.toolStripMenuItemAttributesCopyLine = new System.Windows.Forms.ToolStripMenuItem();
|
this.toolStripMenuItemAttributesCopyLine = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.toolStripMenuItemAttributesCopyList = new System.Windows.Forms.ToolStripMenuItem();
|
this.toolStripMenuItemAttributesCopyList = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
@ -75,15 +77,15 @@ namespace XSDDiagram
|
|||||||
this.propertyGridSchemaObject = new System.Windows.Forms.PropertyGrid();
|
this.propertyGridSchemaObject = new System.Windows.Forms.PropertyGrid();
|
||||||
this.splitter1 = new System.Windows.Forms.Splitter();
|
this.splitter1 = new System.Windows.Forms.Splitter();
|
||||||
this.listViewEnumerate = new System.Windows.Forms.ListView();
|
this.listViewEnumerate = new System.Windows.Forms.ListView();
|
||||||
this.columnHeaderAttributeEnumerateName = new System.Windows.Forms.ColumnHeader();
|
this.columnHeaderAttributeEnumerateName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||||
this.contextMenuStripEnumerate = new System.Windows.Forms.ContextMenuStrip(this.components);
|
this.contextMenuStripEnumerate = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||||
this.toolStripMenuItemEnumerateCopyLine = new System.Windows.Forms.ToolStripMenuItem();
|
this.toolStripMenuItemEnumerateCopyLine = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.toolStripMenuItemEnumerateCopyList = new System.Windows.Forms.ToolStripMenuItem();
|
this.toolStripMenuItemEnumerateCopyList = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.splitterElementList = new System.Windows.Forms.Splitter();
|
this.splitterElementList = new System.Windows.Forms.Splitter();
|
||||||
this.listViewElements = new System.Windows.Forms.ListView();
|
this.listViewElements = new System.Windows.Forms.ListView();
|
||||||
this.columnHeaderElementListName = new System.Windows.Forms.ColumnHeader();
|
this.columnHeaderElementListName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||||
this.columnHeaderElementListType = new System.Windows.Forms.ColumnHeader();
|
this.columnHeaderElementListType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||||
this.columnHeaderElementListNamespace = new System.Windows.Forms.ColumnHeader();
|
this.columnHeaderElementListNamespace = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||||
this.contextMenuStripElements = new System.Windows.Forms.ContextMenuStrip(this.components);
|
this.contextMenuStripElements = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||||
this.addToDiagrammToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.addToDiagrammToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripSeparator();
|
this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
@ -98,7 +100,7 @@ namespace XSDDiagram
|
|||||||
this.expandOneLevelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.expandOneLevelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.textBoxElementPath = new System.Windows.Forms.TextBox();
|
this.textBoxElementPath = new System.Windows.Forms.TextBox();
|
||||||
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
|
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
|
||||||
this.openURLToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.recentFilesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.menuStripMain.SuspendLayout();
|
this.menuStripMain.SuspendLayout();
|
||||||
this.statusStripMain.SuspendLayout();
|
this.statusStripMain.SuspendLayout();
|
||||||
this.toolStripMain.SuspendLayout();
|
this.toolStripMain.SuspendLayout();
|
||||||
@ -138,6 +140,8 @@ namespace XSDDiagram
|
|||||||
this.openURLToolStripMenuItem,
|
this.openURLToolStripMenuItem,
|
||||||
this.saveDiagramToolStripMenuItem,
|
this.saveDiagramToolStripMenuItem,
|
||||||
this.validateXMLFileToolStripMenuItem,
|
this.validateXMLFileToolStripMenuItem,
|
||||||
|
this.recentFilesToolStripMenuItem,
|
||||||
|
this.closeToolStripMenuItem,
|
||||||
this.toolStripMenuItem2,
|
this.toolStripMenuItem2,
|
||||||
this.pageToolStripMenuItem,
|
this.pageToolStripMenuItem,
|
||||||
this.printPreviewToolStripMenuItem,
|
this.printPreviewToolStripMenuItem,
|
||||||
@ -147,7 +151,6 @@ namespace XSDDiagram
|
|||||||
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
||||||
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
|
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
|
||||||
this.fileToolStripMenuItem.Text = "&File";
|
this.fileToolStripMenuItem.Text = "&File";
|
||||||
this.fileToolStripMenuItem.DropDownOpening += new System.EventHandler(this.toolsToolStripMenuItem_DropDownOpening);
|
|
||||||
//
|
//
|
||||||
// openToolStripMenuItem
|
// openToolStripMenuItem
|
||||||
//
|
//
|
||||||
@ -158,6 +161,15 @@ namespace XSDDiagram
|
|||||||
this.openToolStripMenuItem.Text = "&Open...";
|
this.openToolStripMenuItem.Text = "&Open...";
|
||||||
this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click);
|
this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
|
// openURLToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.openURLToolStripMenuItem.Image = global::XSDDiagram.Properties.Resources.Open;
|
||||||
|
this.openURLToolStripMenuItem.Name = "openURLToolStripMenuItem";
|
||||||
|
this.openURLToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.U)));
|
||||||
|
this.openURLToolStripMenuItem.Size = new System.Drawing.Size(204, 22);
|
||||||
|
this.openURLToolStripMenuItem.Text = "Open &URL...";
|
||||||
|
this.openURLToolStripMenuItem.Click += new System.EventHandler(this.openURLToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
// saveDiagramToolStripMenuItem
|
// saveDiagramToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.saveDiagramToolStripMenuItem.Image = global::XSDDiagram.Properties.Resources.SaveGreen;
|
this.saveDiagramToolStripMenuItem.Image = global::XSDDiagram.Properties.Resources.SaveGreen;
|
||||||
@ -174,6 +186,13 @@ namespace XSDDiagram
|
|||||||
this.validateXMLFileToolStripMenuItem.Text = "&Validate XML File...";
|
this.validateXMLFileToolStripMenuItem.Text = "&Validate XML File...";
|
||||||
this.validateXMLFileToolStripMenuItem.Click += new System.EventHandler(this.validateXMLFileToolStripMenuItem_Click);
|
this.validateXMLFileToolStripMenuItem.Click += new System.EventHandler(this.validateXMLFileToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
|
// closeToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.closeToolStripMenuItem.Name = "closeToolStripMenuItem";
|
||||||
|
this.closeToolStripMenuItem.Size = new System.Drawing.Size(204, 22);
|
||||||
|
this.closeToolStripMenuItem.Text = "&Close";
|
||||||
|
this.closeToolStripMenuItem.Click += new System.EventHandler(this.closeToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
// toolStripMenuItem2
|
// toolStripMenuItem2
|
||||||
//
|
//
|
||||||
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
|
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
|
||||||
@ -221,7 +240,7 @@ namespace XSDDiagram
|
|||||||
this.toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.windowsExplorerRegistrationToolStripMenuItem});
|
this.windowsExplorerRegistrationToolStripMenuItem});
|
||||||
this.toolsToolStripMenuItem.Name = "toolsToolStripMenuItem";
|
this.toolsToolStripMenuItem.Name = "toolsToolStripMenuItem";
|
||||||
this.toolsToolStripMenuItem.Size = new System.Drawing.Size(48, 20);
|
this.toolsToolStripMenuItem.Size = new System.Drawing.Size(47, 20);
|
||||||
this.toolsToolStripMenuItem.Text = "&Tools";
|
this.toolsToolStripMenuItem.Text = "&Tools";
|
||||||
//
|
//
|
||||||
// windowsExplorerRegistrationToolStripMenuItem
|
// windowsExplorerRegistrationToolStripMenuItem
|
||||||
@ -263,7 +282,7 @@ namespace XSDDiagram
|
|||||||
//
|
//
|
||||||
this.nextTabToolStripMenuItem.Name = "nextTabToolStripMenuItem";
|
this.nextTabToolStripMenuItem.Name = "nextTabToolStripMenuItem";
|
||||||
this.nextTabToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Tab)));
|
this.nextTabToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Tab)));
|
||||||
this.nextTabToolStripMenuItem.Size = new System.Drawing.Size(228, 22);
|
this.nextTabToolStripMenuItem.Size = new System.Drawing.Size(226, 22);
|
||||||
this.nextTabToolStripMenuItem.Text = "&Next Tab";
|
this.nextTabToolStripMenuItem.Text = "&Next Tab";
|
||||||
this.nextTabToolStripMenuItem.Click += new System.EventHandler(this.nextTabToolStripMenuItem_Click);
|
this.nextTabToolStripMenuItem.Click += new System.EventHandler(this.nextTabToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
@ -272,7 +291,7 @@ namespace XSDDiagram
|
|||||||
this.previousTabToolStripMenuItem.Name = "previousTabToolStripMenuItem";
|
this.previousTabToolStripMenuItem.Name = "previousTabToolStripMenuItem";
|
||||||
this.previousTabToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
|
this.previousTabToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
|
||||||
| System.Windows.Forms.Keys.Tab)));
|
| System.Windows.Forms.Keys.Tab)));
|
||||||
this.previousTabToolStripMenuItem.Size = new System.Drawing.Size(228, 22);
|
this.previousTabToolStripMenuItem.Size = new System.Drawing.Size(226, 22);
|
||||||
this.previousTabToolStripMenuItem.Text = "&Previous Tab";
|
this.previousTabToolStripMenuItem.Text = "&Previous Tab";
|
||||||
this.previousTabToolStripMenuItem.Click += new System.EventHandler(this.previousTabToolStripMenuItem_Click);
|
this.previousTabToolStripMenuItem.Click += new System.EventHandler(this.previousTabToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
@ -638,8 +657,8 @@ namespace XSDDiagram
|
|||||||
this.listViewAttributes.UseCompatibleStateImageBehavior = false;
|
this.listViewAttributes.UseCompatibleStateImageBehavior = false;
|
||||||
this.listViewAttributes.View = System.Windows.Forms.View.Details;
|
this.listViewAttributes.View = System.Windows.Forms.View.Details;
|
||||||
this.listViewAttributes.AfterLabelEdit += new System.Windows.Forms.LabelEditEventHandler(this.listView_AfterLabelEdit);
|
this.listViewAttributes.AfterLabelEdit += new System.Windows.Forms.LabelEditEventHandler(this.listView_AfterLabelEdit);
|
||||||
this.listViewAttributes.SelectedIndexChanged += new System.EventHandler(this.listViewAttributes_SelectedIndexChanged);
|
|
||||||
this.listViewAttributes.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.listViewAttributes_ColumnClick);
|
this.listViewAttributes.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.listViewAttributes_ColumnClick);
|
||||||
|
this.listViewAttributes.SelectedIndexChanged += new System.EventHandler(this.listViewAttributes_SelectedIndexChanged);
|
||||||
//
|
//
|
||||||
// columnHeaderAttributesName
|
// columnHeaderAttributesName
|
||||||
//
|
//
|
||||||
@ -695,6 +714,7 @@ namespace XSDDiagram
|
|||||||
//
|
//
|
||||||
// propertyGridSchemaObject
|
// propertyGridSchemaObject
|
||||||
//
|
//
|
||||||
|
this.propertyGridSchemaObject.CategoryForeColor = System.Drawing.SystemColors.InactiveCaptionText;
|
||||||
this.propertyGridSchemaObject.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.propertyGridSchemaObject.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.propertyGridSchemaObject.HelpVisible = false;
|
this.propertyGridSchemaObject.HelpVisible = false;
|
||||||
this.propertyGridSchemaObject.Location = new System.Drawing.Point(3, 3);
|
this.propertyGridSchemaObject.Location = new System.Drawing.Point(3, 3);
|
||||||
@ -786,10 +806,10 @@ namespace XSDDiagram
|
|||||||
this.listViewElements.UseCompatibleStateImageBehavior = false;
|
this.listViewElements.UseCompatibleStateImageBehavior = false;
|
||||||
this.listViewElements.View = System.Windows.Forms.View.Details;
|
this.listViewElements.View = System.Windows.Forms.View.Details;
|
||||||
this.listViewElements.AfterLabelEdit += new System.Windows.Forms.LabelEditEventHandler(this.listView_AfterLabelEdit);
|
this.listViewElements.AfterLabelEdit += new System.Windows.Forms.LabelEditEventHandler(this.listView_AfterLabelEdit);
|
||||||
this.listViewElements.DoubleClick += new System.EventHandler(this.listViewElement_DoubleClick);
|
|
||||||
this.listViewElements.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.listViewElement_ColumnClick);
|
this.listViewElements.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.listViewElement_ColumnClick);
|
||||||
this.listViewElements.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.listViewElements_ItemDrag);
|
this.listViewElements.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.listViewElements_ItemDrag);
|
||||||
this.listViewElements.Click += new System.EventHandler(this.listViewElement_Click);
|
this.listViewElements.Click += new System.EventHandler(this.listViewElement_Click);
|
||||||
|
this.listViewElements.DoubleClick += new System.EventHandler(this.listViewElement_DoubleClick);
|
||||||
//
|
//
|
||||||
// columnHeaderElementListName
|
// columnHeaderElementListName
|
||||||
//
|
//
|
||||||
@ -917,14 +937,11 @@ namespace XSDDiagram
|
|||||||
this.toolTip.OwnerDraw = true;
|
this.toolTip.OwnerDraw = true;
|
||||||
this.toolTip.ShowAlways = true;
|
this.toolTip.ShowAlways = true;
|
||||||
//
|
//
|
||||||
// openURLToolStripMenuItem
|
// recentFilesToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.openURLToolStripMenuItem.Image = global::XSDDiagram.Properties.Resources.Open;
|
this.recentFilesToolStripMenuItem.Name = "recentFilesToolStripMenuItem";
|
||||||
this.openURLToolStripMenuItem.Name = "openURLToolStripMenuItem";
|
this.recentFilesToolStripMenuItem.Size = new System.Drawing.Size(204, 22);
|
||||||
this.openURLToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.U)));
|
this.recentFilesToolStripMenuItem.Text = "&Recent Files";
|
||||||
this.openURLToolStripMenuItem.Size = new System.Drawing.Size(204, 22);
|
|
||||||
this.openURLToolStripMenuItem.Text = "Open &URL...";
|
|
||||||
this.openURLToolStripMenuItem.Click += new System.EventHandler(this.openURLToolStripMenuItem_Click);
|
|
||||||
//
|
//
|
||||||
// MainForm
|
// MainForm
|
||||||
//
|
//
|
||||||
@ -1057,6 +1074,8 @@ namespace XSDDiagram
|
|||||||
private System.Windows.Forms.ToolTip toolTip;
|
private System.Windows.Forms.ToolTip toolTip;
|
||||||
private System.Windows.Forms.ToolStripMenuItem validateXMLFileToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem validateXMLFileToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem openURLToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem openURLToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem closeToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem recentFilesToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
123
MainForm.cs
123
MainForm.cs
@ -1,5 +1,5 @@
|
|||||||
// XSDDiagram - A XML Schema Definition file viewer
|
// XSDDiagram - A XML Schema Definition file viewer
|
||||||
// Copyright (C) 2006-2011 Regis COSNIER
|
// Copyright (C) 2006-2016 Regis COSNIER
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
@ -37,6 +37,8 @@ using XSDDiagram.Rendering;
|
|||||||
using System.Xml.Schema;
|
using System.Xml.Schema;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
using System.Security.Principal;
|
||||||
|
|
||||||
namespace XSDDiagram
|
namespace XSDDiagram
|
||||||
{
|
{
|
||||||
public partial class MainForm : Form
|
public partial class MainForm : Form
|
||||||
@ -55,11 +57,36 @@ namespace XSDDiagram
|
|||||||
private bool webBrowserSupported = true;
|
private bool webBrowserSupported = true;
|
||||||
private string backupUsername = "", backupPassword = "";
|
private string backupUsername = "", backupPassword = "";
|
||||||
|
|
||||||
|
private MRUManager mruManager;
|
||||||
|
|
||||||
public MainForm()
|
public MainForm()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
this.toolsToolStripMenuItem.Visible = !Options.IsRunningOnMono;
|
bool isElevated = false;
|
||||||
|
WindowsIdentity identity = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
identity = WindowsIdentity.GetCurrent();
|
||||||
|
if (identity != null)
|
||||||
|
{
|
||||||
|
WindowsPrincipal principal = new WindowsPrincipal(identity);
|
||||||
|
if (principal != null)
|
||||||
|
isElevated = principal.IsInRole(WindowsBuiltInRole.Administrator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (UnauthorizedAccessException)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (identity != null)
|
||||||
|
identity.Dispose();
|
||||||
|
}
|
||||||
|
this.toolsToolStripMenuItem.Visible = isElevated && !Options.IsRunningOnMono;
|
||||||
|
|
||||||
this.originalTitle = Text;
|
this.originalTitle = Text;
|
||||||
|
|
||||||
@ -89,6 +116,8 @@ namespace XSDDiagram
|
|||||||
webBrowserSupported = false;
|
webBrowserSupported = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UpdateActionsState();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool schema_RequestCredential(string url, string realm, int attemptCount, out string username, out string password)
|
bool schema_RequestCredential(string url, string realm, int attemptCount, out string username, out string password)
|
||||||
@ -133,6 +162,9 @@ namespace XSDDiagram
|
|||||||
|
|
||||||
private void MainForm_Load(object sender, EventArgs e)
|
private void MainForm_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
this.mruManager = new MRUManager(this.recentFilesToolStripMenuItem, "xsddiagram", this.recentFilesToolStripMenuSubItemFile_Click, this.recentFilesToolStripMenuSubItemClearAll_Click);
|
||||||
|
|
||||||
|
|
||||||
this.toolStripComboBoxZoom.SelectedIndex = 8;
|
this.toolStripComboBoxZoom.SelectedIndex = 8;
|
||||||
this.toolStripComboBoxAlignement.SelectedIndex = 1;
|
this.toolStripComboBoxAlignement.SelectedIndex = 1;
|
||||||
|
|
||||||
@ -174,6 +206,22 @@ namespace XSDDiagram
|
|||||||
LoadSchema(openURLForm.URL);
|
LoadSchema(openURLForm.URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void closeToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
CleanupUserInterface(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void recentFilesToolStripMenuSubItemFile_Click(object sender, EventArgs evt)
|
||||||
|
{
|
||||||
|
string filenameOrURL = (sender as ToolStripItem).Text;
|
||||||
|
LoadSchema(filenameOrURL);
|
||||||
|
//this.mruManager.RemoveRecentFile(filenameOrURL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void recentFilesToolStripMenuSubItemClearAll_Click(object sender, EventArgs evt)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
private void MainForm_DragDrop(object sender, DragEventArgs e)
|
private void MainForm_DragDrop(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Data.GetDataPresent("UniformResourceLocator"))
|
if (e.Data.GetDataPresent("UniformResourceLocator"))
|
||||||
@ -320,24 +368,16 @@ namespace XSDDiagram
|
|||||||
{
|
{
|
||||||
Cursor = Cursors.WaitCursor;
|
Cursor = Cursors.WaitCursor;
|
||||||
|
|
||||||
|
this.mruManager.AddRecentFile(schemaFilename);
|
||||||
|
|
||||||
|
CleanupUserInterface(false);
|
||||||
|
|
||||||
UpdateTitle(schemaFilename);
|
UpdateTitle(schemaFilename);
|
||||||
|
|
||||||
this.diagram.Clear();
|
|
||||||
this.panelDiagram.VirtualSize = new Size(0, 0);
|
|
||||||
this.panelDiagram.VirtualPoint = new Point(0, 0);
|
|
||||||
this.panelDiagram.Clear();
|
|
||||||
this.hashtableTabPageByFilename.Clear();
|
|
||||||
this.listViewElements.Items.Clear();
|
|
||||||
this.toolStripComboBoxSchemaElement.Items.Clear();
|
|
||||||
this.toolStripComboBoxSchemaElement.Items.Add("");
|
|
||||||
this.propertyGridSchemaObject.SelectedObject = null;
|
|
||||||
|
|
||||||
while (this.tabControlView.TabCount > 1)
|
|
||||||
this.tabControlView.TabPages.RemoveAt(1);
|
|
||||||
|
|
||||||
|
|
||||||
schema.LoadSchema(schemaFilename);
|
schema.LoadSchema(schemaFilename);
|
||||||
|
|
||||||
|
UpdateActionsState();
|
||||||
|
|
||||||
foreach (XSDObject xsdObject in schema.Elements)
|
foreach (XSDObject xsdObject in schema.Elements)
|
||||||
{
|
{
|
||||||
this.listViewElements.Items.Add(new ListViewItem(new string[] { xsdObject.Name, xsdObject.Type, xsdObject.NameSpace })).Tag = xsdObject;
|
this.listViewElements.Items.Add(new ListViewItem(new string[] { xsdObject.Name, xsdObject.Type, xsdObject.NameSpace })).Tag = xsdObject;
|
||||||
@ -366,7 +406,7 @@ namespace XSDDiagram
|
|||||||
{
|
{
|
||||||
string fullPath = filename;
|
string fullPath = filename;
|
||||||
Control browser = null;
|
Control browser = null;
|
||||||
if(webBrowserSupported)
|
if (webBrowserSupported)
|
||||||
browser = new WebBrowser();
|
browser = new WebBrowser();
|
||||||
else
|
else
|
||||||
browser = new System.Windows.Forms.TextBox() { Multiline = true, ReadOnly = true, ScrollBars = ScrollBars.Both };
|
browser = new System.Windows.Forms.TextBox() { Multiline = true, ReadOnly = true, ScrollBars = ScrollBars.Both };
|
||||||
@ -395,6 +435,50 @@ namespace XSDDiagram
|
|||||||
//currentLoadedSchemaFilename = schemaFilename;
|
//currentLoadedSchemaFilename = schemaFilename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateActionsState()
|
||||||
|
{
|
||||||
|
bool isSchemaLoaded = schema.IsLoaded();
|
||||||
|
toolStripButtonSaveDiagram.Enabled = isSchemaLoaded;
|
||||||
|
toolStripButtonPrint.Enabled = isSchemaLoaded;
|
||||||
|
toolStripButtonAddToDiagram.Enabled = isSchemaLoaded;
|
||||||
|
toolStripButtonAddAllToDiagram.Enabled = isSchemaLoaded;
|
||||||
|
toolStripButtonRemoveAllFromDiagram.Enabled = isSchemaLoaded;
|
||||||
|
toolStripButtonExpandOneLevel.Enabled = isSchemaLoaded;
|
||||||
|
closeToolStripMenuItem.Enabled = isSchemaLoaded;
|
||||||
|
saveDiagramToolStripMenuItem.Enabled = isSchemaLoaded;
|
||||||
|
validateXMLFileToolStripMenuItem.Enabled = isSchemaLoaded;
|
||||||
|
printPreviewToolStripMenuItem.Enabled = isSchemaLoaded;
|
||||||
|
printToolStripMenuItem.Enabled = isSchemaLoaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CleanupUserInterface(bool fullCleanup)
|
||||||
|
{
|
||||||
|
this.diagram.Clear();
|
||||||
|
this.panelDiagram.VirtualSize = new Size(0, 0);
|
||||||
|
this.panelDiagram.VirtualPoint = new Point(0, 0);
|
||||||
|
this.panelDiagram.Clear();
|
||||||
|
this.hashtableTabPageByFilename.Clear();
|
||||||
|
this.listViewElements.Items.Clear();
|
||||||
|
this.listViewAttributes.Items.Clear();
|
||||||
|
this.toolStripComboBoxSchemaElement.SelectedItem = "";
|
||||||
|
this.toolStripComboBoxSchemaElement.Items.Clear();
|
||||||
|
this.toolStripComboBoxSchemaElement.Items.Add("");
|
||||||
|
this.propertyGridSchemaObject.SelectedObject = null;
|
||||||
|
this.textBoxElementPath.Text = "";
|
||||||
|
|
||||||
|
while (this.tabControlView.TabCount > 1)
|
||||||
|
this.tabControlView.TabPages.RemoveAt(1);
|
||||||
|
|
||||||
|
ShowDocumentation(null);
|
||||||
|
|
||||||
|
if (fullCleanup)
|
||||||
|
{
|
||||||
|
UpdateTitle("");
|
||||||
|
schema.Cleanup();
|
||||||
|
UpdateActionsState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DiagramControl_MouseClick(object sender, MouseEventArgs e)
|
void DiagramControl_MouseClick(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
Point location = e.Location;
|
Point location = e.Location;
|
||||||
@ -1681,11 +1765,6 @@ namespace XSDDiagram
|
|||||||
e.Exception.LineNumber, e.Exception.LinePosition, e.Exception.Message, validationErrorMessages.Count, e.Severity));
|
e.Exception.LineNumber, e.Exception.LinePosition, e.Exception.Message, validationErrorMessages.Count, e.Severity));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void toolsToolStripMenuItem_DropDownOpening(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
validateXMLFileToolStripMenuItem.Enabled = (schema != null && schema.XsdFilenames.Count != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void MainForm_KeyUp(object sender, KeyEventArgs e)
|
private void MainForm_KeyUp(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Control && (e.KeyCode == Keys.D0 || e.KeyCode == Keys.NumPad0))
|
if (e.Control && (e.KeyCode == Keys.D0 || e.KeyCode == Keys.NumPad0))
|
||||||
|
@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
|||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("")]
|
[assembly: AssemblyCompany("")]
|
||||||
[assembly: AssemblyProduct("XSD Diagram")]
|
[assembly: AssemblyProduct("XSD Diagram")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2006-2015 Regis Cosnier, All Rights Reserved.")]
|
[assembly: AssemblyCopyright("Copyright © 2006-2016 Regis Cosnier, All Rights Reserved.")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
|||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
[assembly: AssemblyVersion("0.17.0.0")]
|
[assembly: AssemblyVersion("0.18.0.0")]
|
||||||
[assembly: AssemblyFileVersion("0.17.0.0")]
|
[assembly: AssemblyFileVersion("0.18.0.0")]
|
||||||
|
34
ReadMe.txt
34
ReadMe.txt
@ -1,6 +1,6 @@
|
|||||||
XSD Diagram is a free xml schema definition diagram viewer (http://regis.cosnier.free.fr).
|
XSD Diagram is a free xml schema definition diagram viewer (http://regis.cosnier.free.fr).
|
||||||
|
|
||||||
Version 0.17 Copyright (c) 2006-2015 Regis Cosnier, All Rights Reserved.
|
Version 0.18alpha Copyright (c) 2006-2016 Regis Cosnier, All Rights Reserved.
|
||||||
|
|
||||||
This program is free software and may be distributed
|
This program is free software and may be distributed
|
||||||
according to the terms of the GNU General Public License (GPL).
|
according to the terms of the GNU General Public License (GPL).
|
||||||
@ -71,9 +71,9 @@ Options:
|
|||||||
|
|
||||||
|
|
||||||
Example 1:
|
Example 1:
|
||||||
> XSDDiagramConsole.exe -o file.png -r TotoRoot -e 3 -z 200 ./folder1/toto.xsd
|
> XSDDiagramConsole.exe -o file.png -r TotoRoot -r TotoComplexType -e 3 -z 200 ./folder1/toto.xsd
|
||||||
will generate a PNG image from a diagram with a root element
|
will generate a PNG image from a diagram with a root elements
|
||||||
'TotoRoot' and expanding the tree from the root until the 3rd level.
|
'TotoRoot' and 'TotoComplexType', and expanding the tree from the root until the 3rd level.
|
||||||
|
|
||||||
Example 2:
|
Example 2:
|
||||||
> XSDDiagram.exe ./folder1/toto.xsd
|
> XSDDiagram.exe ./folder1/toto.xsd
|
||||||
@ -95,16 +95,16 @@ Example 5:
|
|||||||
'TotoRoot' and expanding the tree from the root until the 3rd level.
|
'TotoRoot' and expanding the tree from the root until the 3rd level.
|
||||||
|
|
||||||
|
|
||||||
|
NOTES:
|
||||||
|
|
||||||
|
- With Mono on Linux, to prevent an exception with a missing assembly, please install the package "libmono-winforms2.0-cil"
|
||||||
|
(Prevent the error: Could not load file or assembly 'System.Windows.Forms').
|
||||||
|
|
||||||
|
|
||||||
TODO LIST:
|
TODO LIST:
|
||||||
|
|
||||||
- BUG: If I have an attribute with annotation selected, the annotation displays in the gray box in the bottom right as expected. If I move to another attribute that does not have annotation, the annotation from the previously selected attribute still displays. The gray box should have its content cleared if an attribute with no content is selected.
|
|
||||||
- BUG: Cascading substitution groups may appear weird.
|
- BUG: Cascading substitution groups may appear weird.
|
||||||
- BUG: There is a bug when printing with margin!
|
|
||||||
- BUG: On Linux, the horizontal and vertical scrollbars don't appear correctly.
|
|
||||||
- Add include a possibility to show the length of an element (Jörg S.)
|
- Add include a possibility to show the length of an element (Jörg S.)
|
||||||
- Add a close entry in the File menu (Eric).
|
|
||||||
- Add a recently opened list (Eric).
|
|
||||||
- From AlexM: oh, and allow the specification of a complex type in the command line as a root... for the same component used in multiple schemas from one library.
|
|
||||||
- Add the attributes to the element in the diagram (suggested by bob)
|
- Add the attributes to the element in the diagram (suggested by bob)
|
||||||
- Tooltips above the diagram element with a summary (xpath/attributes/doc) (display 200ms after the mouse move -> avoid 100 %CPU)
|
- Tooltips above the diagram element with a summary (xpath/attributes/doc) (display 200ms after the mouse move -> avoid 100 %CPU)
|
||||||
o The optional display of attributes inside the diagram
|
o The optional display of attributes inside the diagram
|
||||||
@ -118,6 +118,18 @@ TODO LIST:
|
|||||||
|
|
||||||
CHANGES:
|
CHANGES:
|
||||||
|
|
||||||
|
version 0.18 (Not released yet)
|
||||||
|
- Add a close entry in the File menu.
|
||||||
|
- Add a recently opened list.
|
||||||
|
- Show the Windows Explorer registration menu only if we have the adminitrative right.
|
||||||
|
- Disable the impossible actions in the menu and the toolbar when XSD file are not loaded.
|
||||||
|
- From AlexM: oh, and allow the specification of a complex type in the command line as a root (-r element1 -r complexType2 -r ...).
|
||||||
|
- Fixed min/maxOccurs for group references (Thanks Cleric-K).
|
||||||
|
- Fixed the node expansion group of type 'All' (Thanks Carsten).
|
||||||
|
- Fix a bug when printing with margin!
|
||||||
|
- On Linux with Mono, the horizontal and vertical scrollbars should now appear.
|
||||||
|
- Fix an UTF8 bug when downloading from a URL.
|
||||||
|
|
||||||
version 0.17 (2015-09-02)
|
version 0.17 (2015-09-02)
|
||||||
- Add CSV and TXT output rendering following the Christian's idea.
|
- Add CSV and TXT output rendering following the Christian's idea.
|
||||||
- Log errors in the standard error console (when launched via command line).
|
- Log errors in the standard error console (when launched via command line).
|
||||||
@ -218,7 +230,7 @@ version 0.1 (2006-09-14)
|
|||||||
|
|
||||||
LICENSE:
|
LICENSE:
|
||||||
|
|
||||||
Copyright (c) 2006-2015 Regis COSNIER, All Rights Reserved.
|
Copyright (c) 2006-2016 Regis COSNIER, All Rights Reserved.
|
||||||
|
|
||||||
This program is free software and may be distributed
|
This program is free software and may be distributed
|
||||||
according to the terms of the GNU General Public License (GPL).
|
according to the terms of the GNU General Public License (GPL).
|
||||||
|
BIN
XSDDiagram.exe
BIN
XSDDiagram.exe
Binary file not shown.
@ -124,6 +124,7 @@
|
|||||||
<Compile Include="MainForm.Designer.cs">
|
<Compile Include="MainForm.Designer.cs">
|
||||||
<DependentUpon>MainForm.cs</DependentUpon>
|
<DependentUpon>MainForm.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="MRUManager.cs" />
|
||||||
<Compile Include="OpenURLForm.cs">
|
<Compile Include="OpenURLForm.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
Binary file not shown.
@ -16,6 +16,7 @@ using System.IO;
|
|||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace XSDDiagram
|
namespace XSDDiagram
|
||||||
{
|
{
|
||||||
@ -56,14 +57,7 @@ namespace XSDDiagram
|
|||||||
|
|
||||||
public void LoadSchema(string fileName)
|
public void LoadSchema(string fileName)
|
||||||
{
|
{
|
||||||
this.firstElement = null;
|
Cleanup();
|
||||||
this.elements.Clear();
|
|
||||||
this.hashtableElementsByName.Clear();
|
|
||||||
this.hashtableElementsByName[""] = null;
|
|
||||||
this.hashtableAttributesByName.Clear();
|
|
||||||
this.hashtableAttributesByName[""] = null;
|
|
||||||
this.loadError.Clear();
|
|
||||||
this.listOfXsdFilename.Clear();
|
|
||||||
|
|
||||||
string url = fileName.Trim(), baseUrl = "";
|
string url = fileName.Trim(), baseUrl = "";
|
||||||
if (url.IndexOf("http://") == 0 || url.IndexOf("https://") == 0)
|
if (url.IndexOf("http://") == 0 || url.IndexOf("https://") == 0)
|
||||||
@ -79,6 +73,23 @@ namespace XSDDiagram
|
|||||||
ImportSchema(fileName, baseUrl);
|
ImportSchema(fileName, baseUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Cleanup()
|
||||||
|
{
|
||||||
|
this.firstElement = null;
|
||||||
|
this.elements.Clear();
|
||||||
|
this.hashtableElementsByName.Clear();
|
||||||
|
this.hashtableElementsByName[""] = null;
|
||||||
|
this.hashtableAttributesByName.Clear();
|
||||||
|
this.hashtableAttributesByName[""] = null;
|
||||||
|
this.loadError.Clear();
|
||||||
|
this.listOfXsdFilename.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsLoaded()
|
||||||
|
{
|
||||||
|
return this.listOfXsdFilename.Count > 0;
|
||||||
|
}
|
||||||
|
|
||||||
private void ImportSchema(string fileName, string baseUrl)
|
private void ImportSchema(string fileName, string baseUrl)
|
||||||
{
|
{
|
||||||
System.Diagnostics.Trace.WriteLine("ImportSchema: " + fileName);
|
System.Diagnostics.Trace.WriteLine("ImportSchema: " + fileName);
|
||||||
@ -249,6 +260,7 @@ namespace XSDDiagram
|
|||||||
if (!File.Exists(loadedFileName))
|
if (!File.Exists(loadedFileName))
|
||||||
{
|
{
|
||||||
WebClient webClient = new WebClient();
|
WebClient webClient = new WebClient();
|
||||||
|
webClient.Encoding = Encoding.UTF8;
|
||||||
bool tryAgain = false;
|
bool tryAgain = false;
|
||||||
int attemptCount = 0;
|
int attemptCount = 0;
|
||||||
do
|
do
|
||||||
|
@ -327,6 +327,8 @@ namespace XSDDiagram.Rendering
|
|||||||
{
|
{
|
||||||
DiagramItem childDiagramGroup = new DiagramItem();
|
DiagramItem childDiagramGroup = new DiagramItem();
|
||||||
childDiagramGroup.ItemType = DiagramItemType.group;
|
childDiagramGroup.ItemType = DiagramItemType.group;
|
||||||
|
|
||||||
|
XMLSchema.group referenceGroup = null;
|
||||||
if (childGroup.@ref != null)
|
if (childGroup.@ref != null)
|
||||||
{
|
{
|
||||||
childDiagramGroup.IsReference = true;
|
childDiagramGroup.IsReference = true;
|
||||||
@ -337,7 +339,10 @@ namespace XSDDiagram.Rendering
|
|||||||
{
|
{
|
||||||
XMLSchema.group group = grpObject.Tag as XMLSchema.group;
|
XMLSchema.group group = grpObject.Tag as XMLSchema.group;
|
||||||
if (group != null)
|
if (group != null)
|
||||||
|
{
|
||||||
|
referenceGroup = childGroup;
|
||||||
childGroup = group;
|
childGroup = group;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (type == DiagramItemGroupType.Group)
|
else if (type == DiagramItemGroupType.Group)
|
||||||
@ -353,13 +358,13 @@ namespace XSDDiagram.Rendering
|
|||||||
childDiagramGroup.Diagram = this;
|
childDiagramGroup.Diagram = this;
|
||||||
childDiagramGroup.TabSchema = childGroup;
|
childDiagramGroup.TabSchema = childGroup;
|
||||||
int occurrence;
|
int occurrence;
|
||||||
if (int.TryParse(childGroup.minOccurs, out occurrence))
|
if (int.TryParse(referenceGroup != null ? referenceGroup.minOccurs : childGroup.minOccurs, out occurrence))
|
||||||
childDiagramGroup.MinOccurrence = occurrence;
|
childDiagramGroup.MinOccurrence = occurrence;
|
||||||
else
|
else
|
||||||
childDiagramGroup.MinOccurrence = -1;
|
childDiagramGroup.MinOccurrence = -1;
|
||||||
//try { childDiagramGroup.MinOccurrence = int.Parse(childGroup.minOccurs); }
|
//try { childDiagramGroup.MinOccurrence = int.Parse(childGroup.minOccurs); }
|
||||||
//catch { childDiagramGroup.MinOccurrence = -1; }
|
//catch { childDiagramGroup.MinOccurrence = -1; }
|
||||||
if (int.TryParse(childGroup.maxOccurs, out occurrence))
|
if (int.TryParse(referenceGroup != null ? referenceGroup.maxOccurs : childGroup.maxOccurs, out occurrence))
|
||||||
childDiagramGroup.MaxOccurrence = occurrence;
|
childDiagramGroup.MaxOccurrence = occurrence;
|
||||||
else
|
else
|
||||||
childDiagramGroup.MaxOccurrence = -1;
|
childDiagramGroup.MaxOccurrence = -1;
|
||||||
@ -765,6 +770,15 @@ namespace XSDDiagram.Rendering
|
|||||||
if (diagramCompositors != null)
|
if (diagramCompositors != null)
|
||||||
ExpandChildren(diagramCompositors);
|
ExpandChildren(diagramCompositors);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XMLSchema.group groupAll = extensionType.all as XMLSchema.group;
|
||||||
|
if (groupAll != null)
|
||||||
|
{
|
||||||
|
DiagramItem diagramCompositors = AddCompositors(parentDiagramElement, groupAll, DiagramItemGroupType.All, extensionType.@base.Namespace);
|
||||||
|
parentDiagramElement.ShowChildElements = true;
|
||||||
|
if (diagramCompositors != null)
|
||||||
|
ExpandChildren(diagramCompositors);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (complexContent.Item is XMLSchema.restrictionType)
|
else if (complexContent.Item is XMLSchema.restrictionType)
|
||||||
{
|
{
|
||||||
|
@ -356,7 +356,7 @@ namespace XSDDiagram.Rendering
|
|||||||
Rectangle clipping = new Rectangle(new Point(column * e.MarginBounds.Width, row * e.MarginBounds.Height),
|
Rectangle clipping = new Rectangle(new Point(column * e.MarginBounds.Width, row * e.MarginBounds.Height),
|
||||||
new Size((column + 1) * e.MarginBounds.Width, (row + 1) * e.MarginBounds.Height));
|
new Size((column + 1) * e.MarginBounds.Width, (row + 1) * e.MarginBounds.Height));
|
||||||
|
|
||||||
//MONOFIX graphics.Clip = new Region(e.MarginBounds);
|
graphics.Clip = new Region(e.MarginBounds);
|
||||||
|
|
||||||
//Point virtualPoint = this.panelDiagram.VirtualPoint;
|
//Point virtualPoint = this.panelDiagram.VirtualPoint;
|
||||||
graphics.TranslateTransform(-(float)(clipping.Left - e.MarginBounds.Left),
|
graphics.TranslateTransform(-(float)(clipping.Left - e.MarginBounds.Left),
|
||||||
|
Loading…
Reference in New Issue
Block a user