mirror of
https://github.com/dgis/xsddiagram.git
synced 2024-08-17 06:20:23 +03:00
- Disable the impossible actions in the menu and the toolbar when XSD file are not loaded.
- Fix an UTF8 bug when downloading from a URL.
This commit is contained in:
parent
6ebf6ea5ce
commit
0f26397b35
1
MainForm.Designer.cs
generated
1
MainForm.Designer.cs
generated
@ -151,7 +151,6 @@ namespace XSDDiagram
|
||||
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
||||
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
|
||||
this.fileToolStripMenuItem.Text = "&File";
|
||||
this.fileToolStripMenuItem.DropDownOpening += new System.EventHandler(this.toolsToolStripMenuItem_DropDownOpening);
|
||||
//
|
||||
// openToolStripMenuItem
|
||||
//
|
||||
|
31
MainForm.cs
31
MainForm.cs
@ -1,5 +1,5 @@
|
||||
// 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
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
@ -116,7 +116,9 @@ namespace XSDDiagram
|
||||
webBrowserSupported = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UpdateActionsState();
|
||||
}
|
||||
|
||||
bool schema_RequestCredential(string url, string realm, int attemptCount, out string username, out string password)
|
||||
{
|
||||
@ -374,6 +376,8 @@ namespace XSDDiagram
|
||||
|
||||
schema.LoadSchema(schemaFilename);
|
||||
|
||||
UpdateActionsState();
|
||||
|
||||
foreach (XSDObject xsdObject in schema.Elements)
|
||||
{
|
||||
this.listViewElements.Items.Add(new ListViewItem(new string[] { xsdObject.Name, xsdObject.Type, xsdObject.NameSpace })).Tag = xsdObject;
|
||||
@ -431,6 +435,22 @@ namespace XSDDiagram
|
||||
//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();
|
||||
@ -444,6 +464,7 @@ namespace XSDDiagram
|
||||
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);
|
||||
@ -454,6 +475,7 @@ namespace XSDDiagram
|
||||
{
|
||||
UpdateTitle("");
|
||||
schema.Cleanup();
|
||||
UpdateActionsState();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1743,11 +1765,6 @@ namespace XSDDiagram
|
||||
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)
|
||||
{
|
||||
if (e.Control && (e.KeyCode == Keys.D0 || e.KeyCode == Keys.NumPad0))
|
||||
|
10
ReadMe.txt
10
ReadMe.txt
@ -71,9 +71,9 @@ Options:
|
||||
|
||||
|
||||
Example 1:
|
||||
> XSDDiagramConsole.exe -o file.png -r TotoRoot -e 3 -z 200 ./folder1/toto.xsd
|
||||
will generate a PNG image from a diagram with a root element
|
||||
'TotoRoot' and expanding the tree from the root until the 3rd level.
|
||||
> 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 elements
|
||||
'TotoRoot' and 'TotoComplexType', and expanding the tree from the root until the 3rd level.
|
||||
|
||||
Example 2:
|
||||
> XSDDiagram.exe ./folder1/toto.xsd
|
||||
@ -105,7 +105,6 @@ TODO LIST:
|
||||
|
||||
- BUG: Cascading substitution groups may appear weird.
|
||||
- Add include a possibility to show the length of an element (Jörg S.)
|
||||
- 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)
|
||||
- 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
|
||||
@ -123,10 +122,13 @@ 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)
|
||||
- Add CSV and TXT output rendering following the Christian's idea.
|
||||
|
BIN
XSDDiagram.exe
BIN
XSDDiagram.exe
Binary file not shown.
Binary file not shown.
@ -16,6 +16,7 @@ using System.IO;
|
||||
using System.Net;
|
||||
using System.Xml.Serialization;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Text;
|
||||
|
||||
namespace XSDDiagram
|
||||
{
|
||||
@ -84,6 +85,11 @@ namespace XSDDiagram
|
||||
this.listOfXsdFilename.Clear();
|
||||
}
|
||||
|
||||
public bool IsLoaded()
|
||||
{
|
||||
return this.listOfXsdFilename.Count > 0;
|
||||
}
|
||||
|
||||
private void ImportSchema(string fileName, string baseUrl)
|
||||
{
|
||||
System.Diagnostics.Trace.WriteLine("ImportSchema: " + fileName);
|
||||
@ -254,6 +260,7 @@ namespace XSDDiagram
|
||||
if (!File.Exists(loadedFileName))
|
||||
{
|
||||
WebClient webClient = new WebClient();
|
||||
webClient.Encoding = Encoding.UTF8;
|
||||
bool tryAgain = false;
|
||||
int attemptCount = 0;
|
||||
do
|
||||
|
Loading…
Reference in New Issue
Block a user