Mercurial > repos > IBBoard.WarFoundry.GUI.WinForms
changeset 217:c47094612bac
Re #355: Add XML export format that can be transformed with an XSL
* Merge Clutch's WinForms code into main branch
* Fix targetting of project
* Add .hgignore
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Thu, 25 Aug 2011 20:43:51 +0100 |
parents | 314d90a059d8 (current diff) e10688b29092 (diff) |
children | b3a47b712a8b |
files | .hgignore FrmMain.cs IBBoard.WarFoundry.GUI.WinForms.csproj |
diffstat | 15 files changed, 540 insertions(+), 47 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Thu Aug 25 20:43:51 2011 +0100 @@ -0,0 +1,4 @@ +bin/ +obj/ +IBBoard.WarFoundry.GUI.WinForms.csproj.user +IBBoard.WarFoundry.GUI.WinForms.suo
--- a/FrmMain.cs Tue Aug 16 20:34:46 2011 +0100 +++ b/FrmMain.cs Thu Aug 25 20:43:51 2011 +0100 @@ -40,13 +40,7 @@ { private static readonly string AppTitle = "WarFoundry"; internal static readonly string VERSION = "0.1"; - const string DefaultDataDir = "data"; - /* public static string pointsAbbrevSingle; - public static string pointsAbbrevPlural; - public static string pointsAbbreviation; - public static string pointsNameSingle; - public static string pointsNamePlural; - public static string pointsName;*/ + const string DefaultDataDir = "data"; private Preferences preferences; private readonly ILog log = LogManager.GetLogger(typeof(FrmMain)); @@ -56,7 +50,6 @@ public ObjectAddDelegate UnitAddedMethod; public ObjectRemoveDelegate UnitRemovedMethod; public DoubleValChangedDelegate PointsValueChangedMethod; - //public FailedUnitRequirementDelegate FailedUnitRequirementMethod; private FrmArmyTree armyTree; private string loadedFilePath; @@ -71,7 +64,7 @@ private IBBoard.Windows.Forms.ColorableStatusBarPanel sbPointsPanel; private System.Windows.Forms.ContextMenu undoMenu; private System.Windows.Forms.ContextMenu redoMenu; - private IBBoard.Windows.Forms.ColorableStatusBar statusBar; + private IBBoard.Windows.Forms.ColorableStatusBar statusBar; private MenuStrip menuStrip; private IBBToolStripMenuItem menuFile; private IBBToolStripMenuItem miNewArmy; @@ -100,6 +93,7 @@ private ToolStripPanel toolStripPanel; private ToolStripSeparator toolStripSeparator4; private IBBToolStripMenuItem miPreferences; + private IBBToolStripMenuItem miExportArmyAsBasicXml; private IBBToolStripMenuItem miAbout; @@ -153,9 +147,7 @@ UnitAddedMethod = new ObjectAddDelegate(FrmMain_UnitAddedMethod); UnitRemovedMethod = new ObjectRemoveDelegate(FrmMain_UnitRemovedMethod); PointsValueChangedMethod = new DoubleValChangedDelegate(FrmMain_PointsValueChangedMethod); - //FailedUnitRequirementMethod = new FailedUnitRequirementDelegate(FrmMain_FailedUnitRequirement); - sbErrorPanel.Color = Color.Red; SetPointsPanelToolTipText(); @@ -266,6 +258,7 @@ this.miSaveArmyAs = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); this.miExportArmyAs = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); this.miExportArmyAsBasicHTML = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.miExportArmyAsBasicXml = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); this.miCloseArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.miReloadFiles = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); @@ -328,20 +321,20 @@ this.toolStripSeparator2, this.miExit}); this.menuFile.Name = "menuFile"; - this.menuFile.Size = new System.Drawing.Size(33, 20); + this.menuFile.Size = new System.Drawing.Size(35, 20); this.menuFile.Text = "&file"; // // miNewArmy // this.miNewArmy.Name = "miNewArmy"; - this.miNewArmy.Size = new System.Drawing.Size(164, 22); + this.miNewArmy.Size = new System.Drawing.Size(160, 22); this.miNewArmy.Text = "&new army"; this.miNewArmy.Click += new System.EventHandler(this.miNewArmy_Click); // // miOpenArmy // this.miOpenArmy.Name = "miOpenArmy"; - this.miOpenArmy.Size = new System.Drawing.Size(164, 22); + this.miOpenArmy.Size = new System.Drawing.Size(160, 22); this.miOpenArmy.Text = "&open army"; this.miOpenArmy.Click += new System.EventHandler(this.miOpenArmy_Click); // @@ -349,7 +342,7 @@ // this.miSaveArmy.Enabled = false; this.miSaveArmy.Name = "miSaveArmy"; - this.miSaveArmy.Size = new System.Drawing.Size(164, 22); + this.miSaveArmy.Size = new System.Drawing.Size(160, 22); this.miSaveArmy.Text = "&save army"; this.miSaveArmy.Click += new System.EventHandler(this.miSaveArmy_Click); // @@ -357,55 +350,63 @@ // this.miSaveArmyAs.Enabled = false; this.miSaveArmyAs.Name = "miSaveArmyAs"; - this.miSaveArmyAs.Size = new System.Drawing.Size(164, 22); + this.miSaveArmyAs.Size = new System.Drawing.Size(160, 22); this.miSaveArmyAs.Text = "save army &as..."; this.miSaveArmyAs.Click += new System.EventHandler(this.miSaveArmyAs_Click); // // miExportArmyAs // this.miExportArmyAs.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.miExportArmyAsBasicHTML}); + this.miExportArmyAsBasicHTML, + this.miExportArmyAsBasicXml}); this.miExportArmyAs.Enabled = false; this.miExportArmyAs.Name = "miExportArmyAs"; - this.miExportArmyAs.Size = new System.Drawing.Size(164, 22); + this.miExportArmyAs.Size = new System.Drawing.Size(160, 22); this.miExportArmyAs.Text = "export army as..."; // // miExportArmyAsBasicHTML // this.miExportArmyAsBasicHTML.Name = "miExportArmyAsBasicHTML"; - this.miExportArmyAsBasicHTML.Size = new System.Drawing.Size(130, 22); + this.miExportArmyAsBasicHTML.Size = new System.Drawing.Size(152, 22); this.miExportArmyAsBasicHTML.Text = "&basic html"; this.miExportArmyAsBasicHTML.Click += new System.EventHandler(this.miExportArmyAsBasicHTML_Click); // + // miExportArmyAsBasicXml + // + this.miExportArmyAsBasicXml.Name = "miExportArmyAsBasicXml"; + this.miExportArmyAsBasicXml.Size = new System.Drawing.Size(152, 22); + this.miExportArmyAsBasicXml.Text = "basic xml"; + this.miExportArmyAsBasicXml.Click += new System.EventHandler(this.miExportArmyAsBasicXml_Click); + // // miCloseArmy // this.miCloseArmy.Enabled = false; this.miCloseArmy.Name = "miCloseArmy"; - this.miCloseArmy.Size = new System.Drawing.Size(164, 22); + this.miCloseArmy.Size = new System.Drawing.Size(160, 22); this.miCloseArmy.Text = "&close army"; this.miCloseArmy.Click += new System.EventHandler(this.miCloseArmy_Click); // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(161, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(157, 6); // // miReloadFiles // this.miReloadFiles.Name = "miReloadFiles"; - this.miReloadFiles.Size = new System.Drawing.Size(164, 22); + this.miReloadFiles.Size = new System.Drawing.Size(160, 22); this.miReloadFiles.Text = "&reload files"; this.miReloadFiles.Click += new System.EventHandler(this.miReloadFiles_Click); // // toolStripSeparator2 // this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(161, 6); + this.toolStripSeparator2.Size = new System.Drawing.Size(157, 6); // // miExit // this.miExit.Name = "miExit"; - this.miExit.Size = new System.Drawing.Size(164, 22); + this.miExit.Size = new System.Drawing.Size(160, 22); this.miExit.Text = "e&xit"; this.miExit.Click += new System.EventHandler(this.miExit_Click); // @@ -417,14 +418,14 @@ this.toolStripSeparator4, this.miPreferences}); this.menuEdit.Name = "menuEdit"; - this.menuEdit.Size = new System.Drawing.Size(36, 20); + this.menuEdit.Size = new System.Drawing.Size(39, 20); this.menuEdit.Text = "&edit"; // // miUndo // this.miUndo.Enabled = false; this.miUndo.Name = "miUndo"; - this.miUndo.Size = new System.Drawing.Size(142, 22); + this.miUndo.Size = new System.Drawing.Size(135, 22); this.miUndo.Text = "&undo"; this.miUndo.Click += new System.EventHandler(this.miUndo_Click); // @@ -432,19 +433,19 @@ // this.miRedo.Enabled = false; this.miRedo.Name = "miRedo"; - this.miRedo.Size = new System.Drawing.Size(142, 22); + this.miRedo.Size = new System.Drawing.Size(135, 22); this.miRedo.Text = "&redo"; this.miRedo.Click += new System.EventHandler(this.miRedo_Click); // // toolStripSeparator4 // this.toolStripSeparator4.Name = "toolStripSeparator4"; - this.toolStripSeparator4.Size = new System.Drawing.Size(139, 6); + this.toolStripSeparator4.Size = new System.Drawing.Size(132, 6); // // miPreferences // this.miPreferences.Name = "miPreferences"; - this.miPreferences.Size = new System.Drawing.Size(142, 22); + this.miPreferences.Size = new System.Drawing.Size(135, 22); this.miPreferences.Text = "&preferences"; this.miPreferences.Click += new System.EventHandler(this.miPreferences_Click); // @@ -453,13 +454,13 @@ this.menuHelp.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.miAbout}); this.menuHelp.Name = "menuHelp"; - this.menuHelp.Size = new System.Drawing.Size(39, 20); + this.menuHelp.Size = new System.Drawing.Size(42, 20); this.menuHelp.Text = "&help"; // // miAbout // this.miAbout.Name = "miAbout"; - this.miAbout.Size = new System.Drawing.Size(109, 22); + this.miAbout.Size = new System.Drawing.Size(105, 22); this.miAbout.Text = "&about"; this.miAbout.Click += new System.EventHandler(this.miAbout_Click); // @@ -475,7 +476,7 @@ this.bttnRedo}); this.mainToolStrip.Location = new System.Drawing.Point(0, 24); this.mainToolStrip.Name = "mainToolStrip"; - this.mainToolStrip.Size = new System.Drawing.Size(182, 25); + this.mainToolStrip.Size = new System.Drawing.Size(151, 25); this.mainToolStrip.TabIndex = 8; // // bttnNewArmy @@ -556,8 +557,8 @@ this.statusBar.ShowPanels = true; this.statusBar.Size = new System.Drawing.Size(790, 22); this.statusBar.TabIndex = 1; + this.statusBar.DrawItem += new System.Windows.Forms.StatusBarDrawItemEventHandler(this.statusBar_DrawItem); this.statusBar.PanelClick += new System.Windows.Forms.StatusBarPanelClickEventHandler(this.statusBar_PanelClick); - this.statusBar.DrawItem += new System.Windows.Forms.StatusBarDrawItemEventHandler(this.statusBar_DrawItem); // // sbMainPanel // @@ -1421,5 +1422,11 @@ FrmPreferences prefsForm = new FrmPreferences(Preferences); prefsForm.Show(this); } + + private void miExportArmyAsBasicXml_Click(object sender, EventArgs e) + { + Form xmlOutput = new FrmXmlExport(CurrentArmy); + xmlOutput.ShowDialog(this); + } } }
--- a/FrmMain.resx Tue Aug 16 20:34:46 2011 +0100 +++ b/FrmMain.resx Thu Aug 25 20:43:51 2011 +0100 @@ -112,36 +112,36 @@ <value>2.0</value> </resheader> <resheader name="reader"> - <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <resheader name="writer"> - <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> - <metadata name="undoMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <metadata name="undoMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>17, 17</value> </metadata> - <metadata name="redoMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <metadata name="redoMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>122, 17</value> </metadata> - <metadata name="mainMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <metadata name="mainMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>334, 17</value> </metadata> - <metadata name="openArmyDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <metadata name="openArmyDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>438, 17</value> </metadata> - <metadata name="saveArmyDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <metadata name="saveArmyDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>573, 17</value> </metadata> - <metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>835, 17</value> </metadata> - <metadata name="mainToolStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <metadata name="mainToolStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>17, 54</value> </metadata> - <metadata name="catToolStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <metadata name="catToolStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>138, 54</value> </metadata> - <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> + <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <value> AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAABMLAAATCwAAAAAAAAAA
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FrmXmlExport.Designer.cs Thu Aug 25 20:43:51 2011 +0100 @@ -0,0 +1,162 @@ +namespace IBBoard.WarFoundry.GUI.WinForms +{ + partial class FrmXmlExport + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.lbTitle = new IBBoard.Windows.Forms.IBBLabel(); + this.tbOutputFile = new System.Windows.Forms.TextBox(); + this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog(); + this.bttnOutputSelect = new IBBoard.Windows.Forms.IBBButton(); + this.cbApplyTransform = new System.Windows.Forms.CheckBox(); + this.bttnExport = new IBBoard.Windows.Forms.IBBButton(); + this.bttnCancel = new IBBoard.Windows.Forms.IBBButton(); + this.tbXslPath = new System.Windows.Forms.TextBox(); + this.bttnXslSelect = new IBBoard.Windows.Forms.IBBButton(); + this.SuspendLayout(); + // + // lbTitle + // + this.lbTitle.AutoSize = true; + this.lbTitle.Location = new System.Drawing.Point(12, 9); + this.lbTitle.Name = "lbTitle"; + this.lbTitle.Size = new System.Drawing.Size(61, 13); + this.lbTitle.TabIndex = 0; + this.lbTitle.Text = "XML Ouput"; + // + // tbOutputFile + // + this.tbOutputFile.Location = new System.Drawing.Point(15, 28); + this.tbOutputFile.Name = "tbOutputFile"; + this.tbOutputFile.Size = new System.Drawing.Size(179, 20); + this.tbOutputFile.TabIndex = 1; + this.tbOutputFile.TextChanged += new System.EventHandler(this.tbOutputFile_Change); + // + // bttnOutputSelect + // + this.bttnOutputSelect.Location = new System.Drawing.Point(202, 28); + this.bttnOutputSelect.Name = "bttnOutputSelect"; + this.bttnOutputSelect.Size = new System.Drawing.Size(32, 20); + this.bttnOutputSelect.TabIndex = 2; + this.bttnOutputSelect.Text = "..."; + this.bttnOutputSelect.UseVisualStyleBackColor = true; + this.bttnOutputSelect.Click += new System.EventHandler(this.bttnOutputSelect_Click); + // + // cbApplyTransform + // + this.cbApplyTransform.AutoSize = true; + this.cbApplyTransform.Location = new System.Drawing.Point(15, 54); + this.cbApplyTransform.Name = "cbApplyTransform"; + this.cbApplyTransform.Size = new System.Drawing.Size(125, 17); + this.cbApplyTransform.TabIndex = 3; + this.cbApplyTransform.Text = "Apply XSL Transform"; + this.cbApplyTransform.UseVisualStyleBackColor = true; + this.cbApplyTransform.CheckedChanged += new System.EventHandler(this.cbApplyTransform_CheckedChanged); + // + // bttnExport + // + this.bttnExport.Enabled = false; + this.bttnExport.Location = new System.Drawing.Point(78, 116); + this.bttnExport.Name = "bttnExport"; + this.bttnExport.Size = new System.Drawing.Size(75, 23); + this.bttnExport.TabIndex = 5; + this.bttnExport.Text = "&Export"; + this.bttnExport.UseVisualStyleBackColor = true; + this.bttnExport.Click += new System.EventHandler(this.bttnExport_Click); + // + // bttnCancel + // + this.bttnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.bttnCancel.Location = new System.Drawing.Point(159, 116); + this.bttnCancel.Name = "bttnCancel"; + this.bttnCancel.Size = new System.Drawing.Size(75, 23); + this.bttnCancel.TabIndex = 6; + this.bttnCancel.Text = "&Cancel"; + this.bttnCancel.UseVisualStyleBackColor = true; + this.bttnCancel.Click += new System.EventHandler(this.bttnCancel_Click); + // + // tbXslPath + // + this.tbXslPath.Enabled = false; + this.tbXslPath.Location = new System.Drawing.Point(15, 77); + this.tbXslPath.Name = "tbXslPath"; + this.tbXslPath.Size = new System.Drawing.Size(179, 20); + this.tbXslPath.TabIndex = 7; + // + // bttnXslSelect + // + this.bttnXslSelect.Enabled = false; + this.bttnXslSelect.Location = new System.Drawing.Point(202, 77); + this.bttnXslSelect.Name = "bttnXslSelect"; + this.bttnXslSelect.Size = new System.Drawing.Size(32, 20); + this.bttnXslSelect.TabIndex = 8; + this.bttnXslSelect.Text = "..."; + this.bttnXslSelect.UseVisualStyleBackColor = true; + this.bttnXslSelect.Click += new System.EventHandler(this.bttnXslSelect_Click); + // + // FrmXmlExport + // + this.AcceptButton = this.bttnExport; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.bttnCancel; + this.ClientSize = new System.Drawing.Size(241, 145); + this.ControlBox = false; + this.Controls.Add(this.bttnXslSelect); + this.Controls.Add(this.tbXslPath); + this.Controls.Add(this.bttnCancel); + this.Controls.Add(this.bttnExport); + this.Controls.Add(this.cbApplyTransform); + this.Controls.Add(this.bttnOutputSelect); + this.Controls.Add(this.tbOutputFile); + this.Controls.Add(this.lbTitle); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.Name = "FrmXmlExport"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.Text = "Export as XML"; + this.TopMost = true; + this.Load += new System.EventHandler(this.FrmXmlExport_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private Windows.Forms.IBBLabel lbTitle; + private System.Windows.Forms.TextBox tbOutputFile; + private System.Windows.Forms.SaveFileDialog saveFileDialog1; + private Windows.Forms.IBBButton bttnOutputSelect; + private System.Windows.Forms.CheckBox cbApplyTransform; + private Windows.Forms.IBBButton bttnExport; + private Windows.Forms.IBBButton bttnCancel; + private System.Windows.Forms.TextBox tbXslPath; + private Windows.Forms.IBBButton bttnXslSelect; + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FrmXmlExport.cs Thu Aug 25 20:43:51 2011 +0100 @@ -0,0 +1,140 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.IO; +using System.Windows.Forms; +using System.Xml.Xsl; +using IBBoard.Lang; +using IBBoard.WarFoundry.API.Objects; +using IBBoard.WarFoundry.API.Exporters; +using System.Xml.Xsl; + +namespace IBBoard.WarFoundry.GUI.WinForms +{ + public partial class FrmXmlExport : Form + { + Army myArmy = null; + public FrmXmlExport(Army army) + { + InitializeComponent(); + myArmy = army; + } + + private void FrmXmlExport_Load(object sender, EventArgs e) + { + tbXslPath.Text = Directory.GetCurrentDirectory() + "\\xsl\\default_html.xsl"; + } + + private void bttnOutputSelect_Click(object sender, EventArgs e) + { + SaveFileDialog sfd = new SaveFileDialog(); + sfd.Filter = "XML File|*.xml|HTML File|*.html|XHTML File|*.xhtml"; + sfd.Title = "Save XML output"; + sfd.ShowDialog(); + + if (sfd.FileName != "") + { + tbOutputFile.Text = sfd.FileName; + } + } + + private void bttnCancel_Click(object sender, EventArgs e) + { + this.DialogResult = DialogResult.Cancel; + this.Hide(); + } + + private void bttnExport_Click(object sender, EventArgs e) + { + string errorMessage = ""; + // Catch potential errors with the file export or XSL compiliation + try + { + if (cbApplyTransform.Checked) + { + WarFoundryXmlWithXslExporter.GetDefault().ExportArmyWithTransform(myArmy, tbOutputFile.Text, tbXslPath.Text); + } + else + { + WarFoundryXmlWithXslExporter.GetDefault().ExportArmy(myArmy, tbOutputFile.Text); + } + } + catch (XsltCompileException ex) + { + errorMessage = Translation.GetTranslation("mbErrorCompileFailed", "") + + ":\n" + ex.Message; + } + catch (XsltException ex) + { + + errorMessage = Translation.GetTranslation("mbErrorXSLTFailed", "") + + ":\n" + ex.Message; + } + catch (FileNotFoundException ex) + { + errorMessage = Translation.GetTranslation("mbErrorFileNotFoundFailed", "") + + ":\n" + ex.Message; + } + catch (IOException ex) + { + errorMessage = Translation.GetTranslation("mbErrorIOFailed", "") + + ":\n" + ex.Message; + } + catch (Exception ex) + { + errorMessage = Translation.GetTranslation("mbErrorFailed", "") + + ":\n" + ex.Message; + } + if (errorMessage != "") + { + MessageBox.Show(errorMessage, "Error During Export", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + this.DialogResult = DialogResult.OK; + this.Hide(); + } + + private void tbOutputFile_Change(object sender, EventArgs e) + { + if (tbOutputFile.Text != "") + { + bttnExport.Enabled = true; + } + else + { + bttnExport.Enabled = false; + } + } + + private void cbApplyTransform_CheckedChanged(object sender, EventArgs e) + { + if (cbApplyTransform.Checked) + { + tbXslPath.Enabled = true; + bttnXslSelect.Enabled = true; + } + else + { + tbXslPath.Enabled = false; + bttnXslSelect.Enabled = false; + } + } + + private void bttnXslSelect_Click(object sender, EventArgs e) + { + OpenFileDialog ofd = new OpenFileDialog(); + + ofd.InitialDirectory = Directory.GetCurrentDirectory() + "\\xsl"; + ofd.Filter = "XSL Files|*.xsl"; + DialogResult result = ofd.ShowDialog(); + + if (result == DialogResult.OK) + { + tbXslPath.Text = ofd.FileName; + } + + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FrmXmlExport.resx Thu Aug 25 20:43:51 2011 +0100 @@ -0,0 +1,123 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <metadata name="saveFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> +</root> \ No newline at end of file
--- a/IBBoard.WarFoundry.GUI.WinForms.csproj Tue Aug 16 20:34:46 2011 +0100 +++ b/IBBoard.WarFoundry.GUI.WinForms.csproj Thu Aug 25 20:43:51 2011 +0100 @@ -26,7 +26,7 @@ <UpgradeBackupLocation> </UpgradeBackupLocation> <OldToolsVersion>3.5</OldToolsVersion> - <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> + <TargetFrameworkVersion>v2.0</TargetFrameworkVersion> <IsWebBootstrapper>false</IsWebBootstrapper> <PublishUrl>publish\</PublishUrl> <Install>true</Install> @@ -42,6 +42,7 @@ <ApplicationVersion>1.0.0.%2a</ApplicationVersion> <UseApplicationTrust>false</UseApplicationTrust> <BootstrapperEnabled>true</BootstrapperEnabled> + <TargetFrameworkProfile /> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <OutputPath>bin\Debug\</OutputPath> @@ -162,6 +163,12 @@ <Compile Include="FrmUnit.cs"> <SubType>Form</SubType> </Compile> + <Compile Include="FrmXmlExport.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="FrmXmlExport.Designer.cs"> + <DependentUpon>FrmXmlExport.cs</DependentUpon> + </Compile> <Compile Include="Properties\Resources.Designer.cs"> <AutoGen>True</AutoGen> <DesignTime>True</DesignTime> @@ -218,6 +225,9 @@ <DependentUpon>FrmUnit.cs</DependentUpon> <SubType>Designer</SubType> </EmbeddedResource> + <EmbeddedResource Include="FrmXmlExport.resx"> + <DependentUpon>FrmXmlExport.cs</DependentUpon> + </EmbeddedResource> <EmbeddedResource Include="Properties\Resources.resx"> <SubType>Designer</SubType> <Generator>ResXFileCodeGenerator</Generator>
--- a/translations/de.translation Tue Aug 16 20:34:46 2011 +0100 +++ b/translations/de.translation Thu Aug 25 20:43:51 2011 +0100 @@ -9,6 +9,7 @@ <translation id="miSaveArmyAs">Speichern unter...</translation> <translation id="miExportArmyAs">Exportieren</translation> <translation id="miExportArmyAsBasicHTML">Einfaches HTML</translation> + <translation id="miExportArmyAsBasicXML">XML...</translation> <translation id="miCloseArmy">Schließen</translation> <translation id="miReloadFiles">Dateien neu laden</translation> <translation id="miExit">Beenden</translation> @@ -121,5 +122,10 @@ <translation id="FrmPreferences">Einstellungen</translation> <translation id="languagePrefSection">Sprache</translation> <translation id="lblLanguage">Sprache:</translation> - <translation id="languagesGroup">Sprache</translation> + <translation id="languagesGroup">Sprache</translation> + <translation id="mbErrorCompileFailed">Failed to compile XSL translation</translation> + <translation id="mbErrorXSLTFailed">Failed to load XSL translation</translation> + <translation id="mbErrorFileNotFoundFailed">Failed to load XSL translation</translation> + <translation id="mbErrorIOFailed">Failed to output file</translation> + <translation id="mbErrorFailed">Failed to export</translation> </translations> \ No newline at end of file
--- a/translations/en.translation Tue Aug 16 20:34:46 2011 +0100 +++ b/translations/en.translation Thu Aug 25 20:43:51 2011 +0100 @@ -9,6 +9,7 @@ <translation id="miSaveArmyAs">Save army &as...</translation> <translation id="miExportArmyAs">&Export army</translation> <translation id="miExportArmyAsBasicHTML">Basic HTML</translation> + <translation id="miExportArmyAsBasicXml">XML...</translation> <translation id="miCloseArmy">&Close army</translation> <translation id="miReloadFiles">&Reload files</translation> <translation id="miExit">E&xit</translation> @@ -131,4 +132,9 @@ <translation id="treeNodeText">{0} ({1} {2})</translation> <translation id="setUnitEquipmentItemName">( {0} {1} each)</translation> <translation id="FailedRequirementMessage">Army Requirement Failures</translation> + <translation id="mbErrorCompileFailed">Failed to compile XSL translation</translation> + <translation id="mbErrorXSLTFailed">Failed to load XSL translation</translation> + <translation id="mbErrorFileNotFoundFailed">Failed to load XSL translation</translation> + <translation id="mbErrorIOFailed">Failed to output file</translation> + <translation id="mbErrorFailed">Failed to export</translation> </translations> \ No newline at end of file
--- a/translations/fi.translation Tue Aug 16 20:34:46 2011 +0100 +++ b/translations/fi.translation Thu Aug 25 20:43:51 2011 +0100 @@ -9,6 +9,7 @@ <translation id="miSaveArmyAs">Tallenna &nimellä...</translation> <translation id="miExportArmyAs">&Vie...</translation> <translation id="miExportArmyAsBasicHTML">Perus HTML:nä</translation> + <translation id="miExportArmyAsBasicXML">XML...</translation> <translation id="miCloseArmy">&Sulje armeija</translation> <translation id="miReloadFiles">&Lataa tiedostot uudelleen</translation> <translation id="miExit">Lo&peta</translation> @@ -123,6 +124,11 @@ <translation id="lblLanguage">Kieli:</translation> <translation id="languagesGroup">Kieli</translation> <translation id="GameSystemFilesReloaded">Pelisysteemi ja rotutiedostot ovat ladatut.</translation> + <translation id="mbErrorCompileFailed">Failed to compile XSL translation</translation> + <translation id="mbErrorXSLTFailed">Failed to load XSL translation</translation> + <translation id="mbErrorFileNotFoundFailed">Failed to load XSL translation</translation> + <translation id="mbErrorIOFailed">Failed to output file</translation> + <translation id="mbErrorFailed">Failed to export</translation> </translations>
--- a/translations/fr.translation Tue Aug 16 20:34:46 2011 +0100 +++ b/translations/fr.translation Thu Aug 25 20:43:51 2011 +0100 @@ -9,6 +9,7 @@ <translation id="miSaveArmyAs">Enregistrer une armée sous…</translation> <translation id="miExportArmyAs">&Exporter une armée</translation> <translation id="miExportArmyAsBasicHTML">HTML Basic</translation> + <translation id="miExportArmyAsBasicXML">XML...</translation> <translation id="miCloseArmy">&Fermer une armée</translation> <translation id="miReloadFiles">&Recharger les fichiers</translation> <translation id="miExit">&Sortir</translation> @@ -108,4 +109,9 @@ <translation id="requirementUnitTypeAtLeastSingle">{1} {0}</translation> <translation id="requirementUnitTypeAtLeastJoiner">{0}, {1}</translation> <translation id="requirementUnitTypeAtLeast">{0} peut être sélectionné seulement si l'objet suivant est sélectionné : {1}</translation> + <translation id="mbErrorCompileFailed">Failed to compile XSL translation</translation> + <translation id="mbErrorXSLTFailed">Failed to load XSL translation</translation> + <translation id="mbErrorFileNotFoundFailed">Failed to load XSL translation</translation> + <translation id="mbErrorIOFailed">Failed to output file</translation> + <translation id="mbErrorFailed">Failed to export</translation> </translations> \ No newline at end of file
--- a/translations/it.translation Tue Aug 16 20:34:46 2011 +0100 +++ b/translations/it.translation Thu Aug 25 20:43:51 2011 +0100 @@ -9,6 +9,7 @@ <translation id="miSaveArmyAs">Salve &lista come...</translation> <translation id="miExportArmyAs">&Esporta lista</translation> <translation id="miExportArmyAsBasicHTML">HTML Base</translation> + <translation id="miExportArmyAsBasicXML">XML...</translation> <translation id="miCloseArmy">&Chiudi lista</translation> <translation id="miReloadFiles">&Ricarica files</translation> <translation id="miExit">E&sci</translation> @@ -122,4 +123,9 @@ <translation id="languagePrefSection">Lingua</translation> <translation id="lblLanguage">Lingua:</translation> <translation id="languagesGroup">Lingua</translation> + <translation id="mbErrorCompileFailed">Failed to compile XSL translation</translation> + <translation id="mbErrorXSLTFailed">Failed to load XSL translation</translation> + <translation id="mbErrorFileNotFoundFailed">Failed to load XSL translation</translation> + <translation id="mbErrorIOFailed">Failed to output file</translation> + <translation id="mbErrorFailed">Failed to export</translation> </translations> \ No newline at end of file
--- a/translations/nl.translation Tue Aug 16 20:34:46 2011 +0100 +++ b/translations/nl.translation Thu Aug 25 20:43:51 2011 +0100 @@ -9,6 +9,7 @@ <translation id="miSaveArmyAs">Opslaan als</translation> <translation id="miExportArmyAs">Exporteren</translation> <translation id="miExportArmyAsBasicHTML">Standaard HTML</translation> + <translation id="miExportArmyAsBasicXML">XML...</translation> <translation id="miCloseArmy">Sluit Leger</translation> <translation id="miReloadFiles">Herlaad bestanden</translation> <translation id="miExit">Afsluiten</translation> @@ -107,4 +108,9 @@ <translation id="requirementUnitTypeAtLeastSingle">{1} {0}</translation> <translation id="requirementUnitTypeAtLeastJoiner">{0}, {1}</translation> <translation id="requirementUnitTypeAtLeast">{0} kan alleen gekozen worden als een van de volgende dingen genomen is: {1}</translation> + <translation id="mbErrorCompileFailed">Failed to compile XSL translation</translation> + <translation id="mbErrorXSLTFailed">Failed to load XSL translation</translation> + <translation id="mbErrorFileNotFoundFailed">Failed to load XSL translation</translation> + <translation id="mbErrorIOFailed">Failed to output file</translation> + <translation id="mbErrorFailed">Failed to export</translation> </translations> \ No newline at end of file
--- a/translations/ru.translation Tue Aug 16 20:34:46 2011 +0100 +++ b/translations/ru.translation Thu Aug 25 20:43:51 2011 +0100 @@ -9,6 +9,7 @@ <translation id="miSaveArmyAs">Сохранить армию &как...</translation> <translation id="miExportArmyAs">&Экспортировать армию</translation> <translation id="miExportArmyAsBasicHTML">Basic HTML</translation> + <translation id="miExportArmyAsBasicXML">XML</translation> <translation id="miCloseArmy">&Закрыть армию</translation> <translation id="miReloadFiles">&Перезагрузить файлы</translation> <translation id="miExit">&Выход</translation> @@ -93,4 +94,9 @@ <translation id="setUnitNameCommandUndoDescription">Поменять название "{0}" на "{1}"</translation> <translation id="setUnitSizeCommandDescription">Сделать размер {0} - {1}</translation> <translation id="setUnitSizeCommandUndoDescription">Сделать размер {0} - {1}</translation> + <translation id="mbErrorCompileFailed">Failed to compile XSL translation</translation> + <translation id="mbErrorXSLTFailed">Failed to load XSL translation</translation> + <translation id="mbErrorFileNotFoundFailed">Failed to load XSL translation</translation> + <translation id="mbErrorIOFailed">Failed to output file</translation> + <translation id="mbErrorFailed">Failed to export</translation> </translations> \ No newline at end of file
--- a/translations/sv.translation Tue Aug 16 20:34:46 2011 +0100 +++ b/translations/sv.translation Thu Aug 25 20:43:51 2011 +0100 @@ -81,6 +81,7 @@ <translation id="miExit">A&vsluta</translation> <translation id="miExportArmyAs">&Exportera armé</translation> <translation id="miExportArmyAsBasicHTML">Normal HTML</translation> + <translation id="miExportArmyAsBasicXML">XML...</translation> <translation id="miNewArmy">&Skapa ny armé</translation> <translation id="miOpenArmy">&Öppna sparad armé</translation> <translation id="miPreferences">&Inställningar</translation> @@ -130,5 +131,9 @@ <translation id="statusPanelPointsToolTip">Aktuellt poängvärde för armé</translation> <translation id="treeNodeText">{0} ({1} {2})</translation> <translation id="setUnitEquipmentItemName">( {0} {1} var)</translation> - + <translation id="mbErrorCompileFailed">Failed to compile XSL translation</translation> + <translation id="mbErrorXSLTFailed">Failed to load XSL translation</translation> + <translation id="mbErrorFileNotFoundFailed">Failed to load XSL translation</translation> + <translation id="mbErrorIOFailed">Failed to output file</translation> + <translation id="mbErrorFailed">Failed to export</translation> </translations>