diff FrmMain.cs @ 221: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 83685ed69c69
children 5233147ca7e4
line wrap: on
line diff
--- 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);
+		}
 	}
 }