changeset 246:e532d2f51ff0

Re #417: Make installation/first use easier * Add "Add Data File" menu item
author IBBoard <dev@ibboard.co.uk>
date Sat, 19 May 2012 16:21:00 +0100
parents d0454aae0241
children 2bde6d18d3bd
files FrmMain.cs
diffstat 1 files changed, 179 insertions(+), 147 deletions(-) [+]
line wrap: on
line diff
--- a/FrmMain.cs	Sun Apr 15 21:00:51 2012 +0100
+++ b/FrmMain.cs	Sat May 19 16:21:00 2012 +0100
@@ -98,6 +98,7 @@
 		private IBBToolStripMenuItem miExportArmyAsBasicXml;
 		private IBBToolStripMenuItem miEditArmy;
 		private ToolStripSeparator toolStripSeparator5;
+		private IBBToolStripMenuItem miAddDataFile;
 		private IBBToolStripMenuItem miAbout;
 
 
@@ -257,19 +258,6 @@
 			this.openArmyDialog = new System.Windows.Forms.OpenFileDialog();
 			this.saveArmyDialog = new System.Windows.Forms.SaveFileDialog();
 			this.menuStrip = new System.Windows.Forms.MenuStrip();
-			this.mainToolStrip = new System.Windows.Forms.ToolStrip();
-			this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
-			this.catToolStrip = new System.Windows.Forms.ToolStrip();
-			this.toolStripPanel = new System.Windows.Forms.ToolStripPanel();
-			this.bttnNewArmy = new IBBoard.Windows.Forms.IBBToolStripButton();
-			this.bttnOpenArmy = new IBBoard.Windows.Forms.IBBToolStripButton();
-			this.bttnSaveArmy = new IBBoard.Windows.Forms.IBBToolStripButton();
-			this.bttnUndo = new IBBoard.Windows.Forms.IBBToolStripSplitButton();
-			this.bttnRedo = new IBBoard.Windows.Forms.IBBToolStripSplitButton();
-			this.statusBar = new IBBoard.Windows.Forms.ColorableStatusBar();
-			this.sbMainPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel();
-			this.sbErrorPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel();
-			this.sbPointsPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel();
 			this.menuFile = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
 			this.miNewArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
 			this.miOpenArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
@@ -280,6 +268,7 @@
 			this.miExportArmyAsBasicXml = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
 			this.miCloseArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
 			this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
+			this.miAddDataFile = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
 			this.miReloadFiles = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
 			this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
 			this.miExit = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
@@ -292,6 +281,19 @@
 			this.miPreferences = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
 			this.menuHelp = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
 			this.miAbout = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
+			this.mainToolStrip = new System.Windows.Forms.ToolStrip();
+			this.bttnNewArmy = new IBBoard.Windows.Forms.IBBToolStripButton();
+			this.bttnOpenArmy = new IBBoard.Windows.Forms.IBBToolStripButton();
+			this.bttnSaveArmy = new IBBoard.Windows.Forms.IBBToolStripButton();
+			this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
+			this.bttnUndo = new IBBoard.Windows.Forms.IBBToolStripSplitButton();
+			this.bttnRedo = new IBBoard.Windows.Forms.IBBToolStripSplitButton();
+			this.catToolStrip = new System.Windows.Forms.ToolStrip();
+			this.toolStripPanel = new System.Windows.Forms.ToolStripPanel();
+			this.statusBar = new IBBoard.Windows.Forms.ColorableStatusBar();
+			this.sbMainPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel();
+			this.sbErrorPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel();
+			this.sbPointsPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel();
 			this.menuStrip.SuspendLayout();
 			this.mainToolStrip.SuspendLayout();
 			((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).BeginInit();
@@ -315,134 +317,6 @@
 			this.menuStrip.TabIndex = 6;
 			this.menuStrip.Text = "menuStrip1";
 			// 
-			// mainToolStrip
-			// 
-			this.mainToolStrip.Dock = System.Windows.Forms.DockStyle.None;
-			this.mainToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
-            this.bttnNewArmy,
-            this.bttnOpenArmy,
-            this.bttnSaveArmy,
-            this.toolStripSeparator3,
-            this.bttnUndo,
-            this.bttnRedo});
-			this.mainToolStrip.Location = new System.Drawing.Point(0, 24);
-			this.mainToolStrip.Name = "mainToolStrip";
-			this.mainToolStrip.Size = new System.Drawing.Size(151, 25);
-			this.mainToolStrip.TabIndex = 8;
-			// 
-			// toolStripSeparator3
-			// 
-			this.toolStripSeparator3.Name = "toolStripSeparator3";
-			this.toolStripSeparator3.Size = new System.Drawing.Size(6, 25);
-			// 
-			// catToolStrip
-			// 
-			this.catToolStrip.Dock = System.Windows.Forms.DockStyle.None;
-			this.catToolStrip.Location = new System.Drawing.Point(161, 24);
-			this.catToolStrip.Name = "catToolStrip";
-			this.catToolStrip.Size = new System.Drawing.Size(111, 25);
-			this.catToolStrip.TabIndex = 9;
-			this.catToolStrip.Visible = false;
-			// 
-			// toolStripPanel
-			// 
-			this.toolStripPanel.Dock = System.Windows.Forms.DockStyle.Top;
-			this.toolStripPanel.Location = new System.Drawing.Point(0, 24);
-			this.toolStripPanel.Name = "toolStripPanel";
-			this.toolStripPanel.Orientation = System.Windows.Forms.Orientation.Horizontal;
-			this.toolStripPanel.RowMargin = new System.Windows.Forms.Padding(3, 0, 0, 0);
-			this.toolStripPanel.Size = new System.Drawing.Size(790, 0);
-			// 
-			// bttnNewArmy
-			// 
-			this.bttnNewArmy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
-			this.bttnNewArmy.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.document_new;
-			this.bttnNewArmy.ImageTransparentColor = System.Drawing.Color.Magenta;
-			this.bttnNewArmy.Name = "bttnNewArmy";
-			this.bttnNewArmy.Size = new System.Drawing.Size(23, 22);
-			this.bttnNewArmy.Text = "new army";
-			this.bttnNewArmy.Click += new System.EventHandler(this.miNewArmy_Click);
-			// 
-			// bttnOpenArmy
-			// 
-			this.bttnOpenArmy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
-			this.bttnOpenArmy.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.document_open;
-			this.bttnOpenArmy.ImageTransparentColor = System.Drawing.Color.Magenta;
-			this.bttnOpenArmy.Name = "bttnOpenArmy";
-			this.bttnOpenArmy.Size = new System.Drawing.Size(23, 22);
-			this.bttnOpenArmy.Text = "open army";
-			this.bttnOpenArmy.Click += new System.EventHandler(this.miOpenArmy_Click);
-			// 
-			// bttnSaveArmy
-			// 
-			this.bttnSaveArmy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
-			this.bttnSaveArmy.Enabled = false;
-			this.bttnSaveArmy.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.document_save;
-			this.bttnSaveArmy.ImageTransparentColor = System.Drawing.Color.Magenta;
-			this.bttnSaveArmy.Name = "bttnSaveArmy";
-			this.bttnSaveArmy.Size = new System.Drawing.Size(23, 22);
-			this.bttnSaveArmy.Text = "save army";
-			this.bttnSaveArmy.Click += new System.EventHandler(this.miSaveArmy_Click);
-			// 
-			// bttnUndo
-			// 
-			this.bttnUndo.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
-			this.bttnUndo.Enabled = false;
-			this.bttnUndo.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.edit_undo;
-			this.bttnUndo.ImageTransparentColor = System.Drawing.Color.Magenta;
-			this.bttnUndo.Name = "bttnUndo";
-			this.bttnUndo.Size = new System.Drawing.Size(32, 22);
-			this.bttnUndo.Text = "undo";
-			this.bttnUndo.ButtonClick += new System.EventHandler(this.miUndo_Click);
-			// 
-			// bttnRedo
-			// 
-			this.bttnRedo.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
-			this.bttnRedo.Enabled = false;
-			this.bttnRedo.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.edit_redo;
-			this.bttnRedo.ImageTransparentColor = System.Drawing.Color.Magenta;
-			this.bttnRedo.Name = "bttnRedo";
-			this.bttnRedo.Size = new System.Drawing.Size(32, 22);
-			this.bttnRedo.Text = "redo";
-			this.bttnRedo.ButtonClick += new System.EventHandler(this.miRedo_Click);
-			// 
-			// statusBar
-			// 
-			this.statusBar.Location = new System.Drawing.Point(0, 586);
-			this.statusBar.Name = "statusBar";
-			this.statusBar.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
-            this.sbMainPanel,
-            this.sbErrorPanel,
-            this.sbPointsPanel});
-			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);
-			// 
-			// sbMainPanel
-			// 
-			this.sbMainPanel.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
-			this.sbMainPanel.Color = System.Drawing.SystemColors.WindowText;
-			this.sbMainPanel.Name = "sbMainPanel";
-			this.sbMainPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw;
-			this.sbMainPanel.Width = 473;
-			// 
-			// sbErrorPanel
-			// 
-			this.sbErrorPanel.Color = System.Drawing.SystemColors.WindowText;
-			this.sbErrorPanel.Name = "sbErrorPanel";
-			this.sbErrorPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw;
-			this.sbErrorPanel.Width = 150;
-			// 
-			// sbPointsPanel
-			// 
-			this.sbPointsPanel.Color = System.Drawing.SystemColors.WindowText;
-			this.sbPointsPanel.Name = "sbPointsPanel";
-			this.sbPointsPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw;
-			this.sbPointsPanel.ToolTipText = "current points total";
-			this.sbPointsPanel.Width = 150;
-			// 
 			// menuFile
 			// 
 			this.menuFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -453,6 +327,7 @@
             this.miExportArmyAs,
             this.miCloseArmy,
             this.toolStripSeparator1,
+            this.miAddDataFile,
             this.miReloadFiles,
             this.toolStripSeparator2,
             this.miExit});
@@ -527,6 +402,13 @@
 			this.toolStripSeparator1.Name = "toolStripSeparator1";
 			this.toolStripSeparator1.Size = new System.Drawing.Size(167, 6);
 			// 
+			// miAddDataFile
+			// 
+			this.miAddDataFile.Name = "miAddDataFile";
+			this.miAddDataFile.Size = new System.Drawing.Size(170, 22);
+			this.miAddDataFile.Text = "add data file";
+			this.miAddDataFile.Click += new System.EventHandler(this.AddDataFile_Click);
+			// 
 			// miReloadFiles
 			// 
 			this.miReloadFiles.Name = "miReloadFiles";
@@ -563,7 +445,7 @@
 			// 
 			this.miUndo.Enabled = false;
 			this.miUndo.Name = "miUndo";
-			this.miUndo.Size = new System.Drawing.Size(152, 22);
+			this.miUndo.Size = new System.Drawing.Size(143, 22);
 			this.miUndo.Text = "&undo";
 			this.miUndo.Click += new System.EventHandler(this.miUndo_Click);
 			// 
@@ -571,32 +453,32 @@
 			// 
 			this.miRedo.Enabled = false;
 			this.miRedo.Name = "miRedo";
-			this.miRedo.Size = new System.Drawing.Size(152, 22);
+			this.miRedo.Size = new System.Drawing.Size(143, 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(149, 6);
+			this.toolStripSeparator4.Size = new System.Drawing.Size(140, 6);
 			// 
 			// miEditArmy
 			// 
 			this.miEditArmy.Enabled = false;
 			this.miEditArmy.Name = "miEditArmy";
-			this.miEditArmy.Size = new System.Drawing.Size(152, 22);
+			this.miEditArmy.Size = new System.Drawing.Size(143, 22);
 			this.miEditArmy.Text = "&edit army";
 			this.miEditArmy.Click += new System.EventHandler(this.miEditArmy_Click);
 			// 
 			// toolStripSeparator5
 			// 
 			this.toolStripSeparator5.Name = "toolStripSeparator5";
-			this.toolStripSeparator5.Size = new System.Drawing.Size(149, 6);
+			this.toolStripSeparator5.Size = new System.Drawing.Size(140, 6);
 			// 
 			// miPreferences
 			// 
 			this.miPreferences.Name = "miPreferences";
-			this.miPreferences.Size = new System.Drawing.Size(152, 22);
+			this.miPreferences.Size = new System.Drawing.Size(143, 22);
 			this.miPreferences.Text = "&preferences";
 			this.miPreferences.Click += new System.EventHandler(this.miPreferences_Click);
 			// 
@@ -615,6 +497,134 @@
 			this.miAbout.Text = "&about";
 			this.miAbout.Click += new System.EventHandler(this.miAbout_Click);
 			// 
+			// mainToolStrip
+			// 
+			this.mainToolStrip.Dock = System.Windows.Forms.DockStyle.None;
+			this.mainToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.bttnNewArmy,
+            this.bttnOpenArmy,
+            this.bttnSaveArmy,
+            this.toolStripSeparator3,
+            this.bttnUndo,
+            this.bttnRedo});
+			this.mainToolStrip.Location = new System.Drawing.Point(0, 24);
+			this.mainToolStrip.Name = "mainToolStrip";
+			this.mainToolStrip.Size = new System.Drawing.Size(151, 25);
+			this.mainToolStrip.TabIndex = 8;
+			// 
+			// bttnNewArmy
+			// 
+			this.bttnNewArmy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
+			this.bttnNewArmy.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.document_new;
+			this.bttnNewArmy.ImageTransparentColor = System.Drawing.Color.Magenta;
+			this.bttnNewArmy.Name = "bttnNewArmy";
+			this.bttnNewArmy.Size = new System.Drawing.Size(23, 22);
+			this.bttnNewArmy.Text = "new army";
+			this.bttnNewArmy.Click += new System.EventHandler(this.miNewArmy_Click);
+			// 
+			// bttnOpenArmy
+			// 
+			this.bttnOpenArmy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
+			this.bttnOpenArmy.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.document_open;
+			this.bttnOpenArmy.ImageTransparentColor = System.Drawing.Color.Magenta;
+			this.bttnOpenArmy.Name = "bttnOpenArmy";
+			this.bttnOpenArmy.Size = new System.Drawing.Size(23, 22);
+			this.bttnOpenArmy.Text = "open army";
+			this.bttnOpenArmy.Click += new System.EventHandler(this.miOpenArmy_Click);
+			// 
+			// bttnSaveArmy
+			// 
+			this.bttnSaveArmy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
+			this.bttnSaveArmy.Enabled = false;
+			this.bttnSaveArmy.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.document_save;
+			this.bttnSaveArmy.ImageTransparentColor = System.Drawing.Color.Magenta;
+			this.bttnSaveArmy.Name = "bttnSaveArmy";
+			this.bttnSaveArmy.Size = new System.Drawing.Size(23, 22);
+			this.bttnSaveArmy.Text = "save army";
+			this.bttnSaveArmy.Click += new System.EventHandler(this.miSaveArmy_Click);
+			// 
+			// toolStripSeparator3
+			// 
+			this.toolStripSeparator3.Name = "toolStripSeparator3";
+			this.toolStripSeparator3.Size = new System.Drawing.Size(6, 25);
+			// 
+			// bttnUndo
+			// 
+			this.bttnUndo.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
+			this.bttnUndo.Enabled = false;
+			this.bttnUndo.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.edit_undo;
+			this.bttnUndo.ImageTransparentColor = System.Drawing.Color.Magenta;
+			this.bttnUndo.Name = "bttnUndo";
+			this.bttnUndo.Size = new System.Drawing.Size(32, 22);
+			this.bttnUndo.Text = "undo";
+			this.bttnUndo.ButtonClick += new System.EventHandler(this.miUndo_Click);
+			// 
+			// bttnRedo
+			// 
+			this.bttnRedo.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
+			this.bttnRedo.Enabled = false;
+			this.bttnRedo.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.edit_redo;
+			this.bttnRedo.ImageTransparentColor = System.Drawing.Color.Magenta;
+			this.bttnRedo.Name = "bttnRedo";
+			this.bttnRedo.Size = new System.Drawing.Size(32, 22);
+			this.bttnRedo.Text = "redo";
+			this.bttnRedo.ButtonClick += new System.EventHandler(this.miRedo_Click);
+			// 
+			// catToolStrip
+			// 
+			this.catToolStrip.Dock = System.Windows.Forms.DockStyle.None;
+			this.catToolStrip.Location = new System.Drawing.Point(161, 24);
+			this.catToolStrip.Name = "catToolStrip";
+			this.catToolStrip.Size = new System.Drawing.Size(111, 25);
+			this.catToolStrip.TabIndex = 9;
+			this.catToolStrip.Visible = false;
+			// 
+			// toolStripPanel
+			// 
+			this.toolStripPanel.Dock = System.Windows.Forms.DockStyle.Top;
+			this.toolStripPanel.Location = new System.Drawing.Point(0, 24);
+			this.toolStripPanel.Name = "toolStripPanel";
+			this.toolStripPanel.Orientation = System.Windows.Forms.Orientation.Horizontal;
+			this.toolStripPanel.RowMargin = new System.Windows.Forms.Padding(3, 0, 0, 0);
+			this.toolStripPanel.Size = new System.Drawing.Size(790, 0);
+			// 
+			// statusBar
+			// 
+			this.statusBar.Location = new System.Drawing.Point(0, 586);
+			this.statusBar.Name = "statusBar";
+			this.statusBar.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
+            this.sbMainPanel,
+            this.sbErrorPanel,
+            this.sbPointsPanel});
+			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);
+			// 
+			// sbMainPanel
+			// 
+			this.sbMainPanel.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
+			this.sbMainPanel.Color = System.Drawing.SystemColors.WindowText;
+			this.sbMainPanel.Name = "sbMainPanel";
+			this.sbMainPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw;
+			this.sbMainPanel.Width = 473;
+			// 
+			// sbErrorPanel
+			// 
+			this.sbErrorPanel.Color = System.Drawing.SystemColors.WindowText;
+			this.sbErrorPanel.Name = "sbErrorPanel";
+			this.sbErrorPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw;
+			this.sbErrorPanel.Width = 150;
+			// 
+			// sbPointsPanel
+			// 
+			this.sbPointsPanel.Color = System.Drawing.SystemColors.WindowText;
+			this.sbPointsPanel.Name = "sbPointsPanel";
+			this.sbPointsPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw;
+			this.sbPointsPanel.ToolTipText = "current points total";
+			this.sbPointsPanel.Width = 150;
+			// 
 			// FrmMain
 			// 
 			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
@@ -1485,5 +1495,27 @@
 			FrmEditArmy editArmy = new FrmEditArmy(commandStack, CurrentArmy);
 			editArmy.ShowDialog(this);
 		}
+
+		private void AddDataFile_Click(object sender, EventArgs e)
+		{
+			OpenFileDialog addDataFileDialog = new OpenFileDialog();
+			addDataFileDialog.Filter = "data files|*.system;*.race";
+			addDataFileDialog.Title = "add data files";
+			addDataFileDialog.CheckFileExists = true;
+			addDataFileDialog.Multiselect = true;
+			DialogResult dr = addDataFileDialog.ShowDialog(this);
+
+			if (dr == DialogResult.OK)
+			{
+				foreach (string filePath in addDataFileDialog.FileNames)
+				{
+					WarFoundryLoader.AddNewDataFile(filePath);
+				}
+
+				WarFoundryLoader.GetDefault().LoadFiles();
+			}
+
+			addDataFileDialog.Dispose();
+		}
 	}
 }