[mapguide-commits] r8561 - in trunk/Tools/Maestro/Maestro.Editors: . Generic LayerDefinition/Vector/Scales
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Thu Mar 5 05:30:21 PST 2015
Author: jng
Date: 2015-03-05 05:30:21 -0800 (Thu, 05 Mar 2015)
New Revision: 8561
Modified:
trunk/Tools/Maestro/Maestro.Editors/Generic/XmlEditorDialog.cs
trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/SymbolInstancesDialog.Designer.cs
trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/SymbolInstancesDialog.cs
trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/SymbolInstancesDialog.resx
trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs
trunk/Tools/Maestro/Maestro.Editors/Strings.resx
Log:
#2544: Fix inability to edit composite symbolization as XML
#2540: Support exporting inline symbol definitions in composite symbolizations to external symbols
Modified: trunk/Tools/Maestro/Maestro.Editors/Generic/XmlEditorDialog.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Generic/XmlEditorDialog.cs 2015-03-05 12:54:30 UTC (rev 8560)
+++ trunk/Tools/Maestro/Maestro.Editors/Generic/XmlEditorDialog.cs 2015-03-05 13:30:21 UTC (rev 8561)
@@ -24,6 +24,7 @@
using System;
using System.IO;
using System.Windows.Forms;
+using System.Xml;
using System.Xml.Schema;
#pragma warning disable 1591
@@ -44,6 +45,7 @@
internal XmlEditorDialog()
{
InitializeComponent();
+ this.OnlyValidateWellFormedness = false;
_ed = new XmlEditorCtrl();
_ed.Validator = new XmlValidationCallback(ValidateXml);
_ed.Dock = DockStyle.Fill;
@@ -138,7 +140,26 @@
private void ValidateXml(out string[] errors, out string[] warnings)
{
- XmlValidator.ValidateResourceXmlContent(this.XmlContent, this.XsdPath, out errors, out warnings);
+ if (this.OnlyValidateWellFormedness)
+ {
+ errors = new string[0];
+ warnings = new string[0];
+
+ //Test for well-formedness
+ try
+ {
+ XmlDocument doc = new XmlDocument();
+ doc.LoadXml(this.XmlContent);
+ }
+ catch (XmlException ex)
+ {
+ errors = new string[] { ex.Message };
+ }
+ }
+ else
+ {
+ XmlValidator.ValidateResourceXmlContent(this.XmlContent, this.XsdPath, out errors, out warnings);
+ }
}
private void btnCancel_Click(object sender, EventArgs e)
@@ -164,5 +185,7 @@
}
public event EventHandler ResourceChanged;
+
+ public bool OnlyValidateWellFormedness { get; set; }
}
}
\ No newline at end of file
Modified: trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/SymbolInstancesDialog.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/SymbolInstancesDialog.Designer.cs 2015-03-05 12:54:30 UTC (rev 8560)
+++ trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/SymbolInstancesDialog.Designer.cs 2015-03-05 13:30:21 UTC (rev 8561)
@@ -48,6 +48,7 @@
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
this.inlineSimpleSymbolToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.btnDelete = new System.Windows.Forms.ToolStripButton();
+ this.btnSaveExternal = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.btnEditInstanceProperties = new System.Windows.Forms.ToolStripButton();
this.btnEditComponent = new System.Windows.Forms.ToolStripButton();
@@ -114,6 +115,7 @@
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.btnAdd,
this.btnDelete,
+ this.btnSaveExternal,
this.toolStripSeparator2,
this.btnEditInstanceProperties,
this.btnEditComponent});
@@ -220,6 +222,13 @@
this.btnDelete.Name = "btnDelete";
this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
//
+ // btnSaveExternal
+ //
+ resources.ApplyResources(this.btnSaveExternal, "btnSaveExternal");
+ this.btnSaveExternal.Image = global::Maestro.Editors.Properties.Resources.disk;
+ this.btnSaveExternal.Name = "btnSaveExternal";
+ this.btnSaveExternal.Click += new System.EventHandler(this.btnSaveExternal_Click);
+ //
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
@@ -425,5 +434,6 @@
private System.Windows.Forms.ToolStripDropDownButton btnEditProperty;
private System.Windows.Forms.ToolStripMenuItem viaEditorToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem viaExpressionEditorToolStripMenuItem;
+ private System.Windows.Forms.ToolStripButton btnSaveExternal;
}
}
\ No newline at end of file
Modified: trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/SymbolInstancesDialog.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/SymbolInstancesDialog.cs 2015-03-05 12:54:30 UTC (rev 8560)
+++ trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/SymbolInstancesDialog.cs 2015-03-05 13:30:21 UTC (rev 8561)
@@ -236,7 +236,7 @@
li.Tag = symRef;
var sym = GetSymbolDefinition(symRef);
- if (li.ImageIndex == 0)
+ if (symRef.Reference.Type == SymbolInstanceType.Reference)
li.Text = sym.Name + " (" + ((ISymbolInstanceReferenceLibrary)symRef.Reference).ResourceId + ")";
else
li.Text = sym.Name + " (" + Strings.InlineSymbolDefinition + ")";
@@ -320,11 +320,13 @@
//Now add available parameters
PopulateAvailableParameters(symRef, sym);
+ btnSaveExternal.Enabled = (symRef.Reference.Type == SymbolInstanceType.Inline);
btnEditInstanceProperties.Enabled = true;
btnEditComponent.Enabled = true;
}
else
{
+ btnSaveExternal.Enabled = false;
btnEditInstanceProperties.Enabled = false;
btnEditComponent.Enabled = false;
}
@@ -386,6 +388,7 @@
{
string xml = _comp.ToXml();
XmlEditorDialog diag = new XmlEditorDialog();
+ diag.OnlyValidateWellFormedness = true;
diag.XmlContent = xml;
if (diag.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
@@ -774,5 +777,28 @@
var instance = _comp.CreateInlineSimpleSymbol(ssym);
AddInstance(instance, true);
}
+
+ private void btnSaveExternal_Click(object sender, EventArgs e)
+ {
+ if (lstInstances.SelectedItems.Count == 1)
+ {
+ var it = lstInstances.SelectedItems[0];
+ ISymbolInstance symRef = (ISymbolInstance)it.Tag;
+
+ if (symRef.Reference.Type == SymbolInstanceType.Inline)
+ {
+ var sym = ((ISymbolInstanceReferenceInline)symRef.Reference).SymbolDefinition;
+ using (var picker = new ResourcePicker(_edSvc.CurrentConnection, ResourceTypes.SymbolDefinition.ToString(), ResourcePickerMode.SaveResource))
+ {
+ if (picker.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+ {
+ sym.SetSchemaAttributes();
+ _edSvc.CurrentConnection.ResourceService.SaveResourceAs(sym, picker.ResourceID);
+ MessageBox.Show(string.Format(Maestro.Editors.Strings.SymbolExported, picker.ResourceID));
+ }
+ }
+ }
+ }
+ }
}
}
\ No newline at end of file
Modified: trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/SymbolInstancesDialog.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/SymbolInstancesDialog.resx 2015-03-05 12:54:30 UTC (rev 8560)
+++ trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/SymbolInstancesDialog.resx 2015-03-05 13:30:21 UTC (rev 8561)
@@ -123,7 +123,7 @@
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="btnClose.Location" type="System.Drawing.Point, System.Drawing">
- <value>368, 527</value>
+ <value>397, 527</value>
</data>
<data name="btnClose.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
@@ -163,7 +163,7 @@
<value>3, 41</value>
</data>
<data name="lstInstances.Size" type="System.Drawing.Size, System.Drawing">
- <value>425, 82</value>
+ <value>454, 82</value>
</data>
<data name="lstInstances.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
@@ -264,6 +264,18 @@
<data name="btnDelete.Text" xml:space="preserve">
<value>Delete</value>
</data>
+ <data name="btnSaveExternal.Enabled" type="System.Boolean, mscorlib">
+ <value>False</value>
+ </data>
+ <data name="btnSaveExternal.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
+ <value>Magenta</value>
+ </data>
+ <data name="btnSaveExternal.Size" type="System.Drawing.Size, System.Drawing">
+ <value>60, 22</value>
+ </data>
+ <data name="btnSaveExternal.Text" xml:space="preserve">
+ <value>Export</value>
+ </data>
<data name="toolStripSeparator2.Size" type="System.Drawing.Size, System.Drawing">
<value>6, 25</value>
</data>
@@ -295,7 +307,7 @@
<value>3, 16</value>
</data>
<data name="toolStrip1.Size" type="System.Drawing.Size, System.Drawing">
- <value>425, 25</value>
+ <value>454, 25</value>
</data>
<data name="toolStrip1.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
@@ -319,7 +331,7 @@
<value>12, 12</value>
</data>
<data name="grpComponents.Size" type="System.Drawing.Size, System.Drawing">
- <value>431, 126</value>
+ <value>460, 126</value>
</data>
<data name="grpComponents.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
@@ -349,7 +361,7 @@
<value>3, 41</value>
</data>
<data name="grdOverrides.Size" type="System.Drawing.Size, System.Drawing">
- <value>425, 261</value>
+ <value>454, 261</value>
</data>
<data name="grdOverrides.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
@@ -442,7 +454,7 @@
<value>3, 16</value>
</data>
<data name="toolStrip2.Size" type="System.Drawing.Size, System.Drawing">
- <value>425, 25</value>
+ <value>454, 25</value>
</data>
<data name="toolStrip2.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
@@ -466,7 +478,7 @@
<value>12, 141</value>
</data>
<data name="grpProperties.Size" type="System.Drawing.Size, System.Drawing">
- <value>431, 305</value>
+ <value>460, 305</value>
</data>
<data name="grpProperties.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
@@ -523,7 +535,7 @@
<value>19, 19</value>
</data>
<data name="symPreview.Size" type="System.Drawing.Size, System.Drawing">
- <value>393, 36</value>
+ <value>422, 36</value>
</data>
<data name="symPreview.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
@@ -544,7 +556,7 @@
<value>12, 452</value>
</data>
<data name="grpPreview.Size" type="System.Drawing.Size, System.Drawing">
- <value>431, 69</value>
+ <value>460, 69</value>
</data>
<data name="grpPreview.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
@@ -592,7 +604,7 @@
<value>True</value>
</metadata>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
- <value>455, 562</value>
+ <value>484, 562</value>
</data>
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
<value>CenterParent</value>
@@ -684,6 +696,12 @@
<data name=">>btnDelete.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
+ <data name=">>btnSaveExternal.Name" xml:space="preserve">
+ <value>btnSaveExternal</value>
+ </data>
+ <data name=">>btnSaveExternal.Type" xml:space="preserve">
+ <value>System.Windows.Forms.ToolStripButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
<data name=">>toolStripSeparator2.Name" xml:space="preserve">
<value>toolStripSeparator2</value>
</data>
Modified: trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs 2015-03-05 12:54:30 UTC (rev 8560)
+++ trunk/Tools/Maestro/Maestro.Editors/Strings.Designer.cs 2015-03-05 13:30:21 UTC (rev 8561)
@@ -2774,6 +2774,15 @@
}
/// <summary>
+ /// Looks up a localized string similar to Symbol exported to: {0}.
+ /// </summary>
+ internal static string SymbolExported {
+ get {
+ return ResourceManager.GetString("SymbolExported", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to <image>.
/// </summary>
internal static string SymbolGraphicsImagePlaceholder {
Modified: trunk/Tools/Maestro/Maestro.Editors/Strings.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Strings.resx 2015-03-05 12:54:30 UTC (rev 8560)
+++ trunk/Tools/Maestro/Maestro.Editors/Strings.resx 2015-03-05 13:30:21 UTC (rev 8561)
@@ -1712,4 +1712,7 @@
<data name="LinkedTileSetNote" xml:space="preserve">
<value>The Map Definition's coordinate system and extents have been replaced with the ones from the linked tile set</value>
</data>
+ <data name="SymbolExported" xml:space="preserve">
+ <value>Symbol exported to: {0}</value>
+ </data>
</root>
\ No newline at end of file
More information about the mapguide-commits
mailing list