annotate FrmMain.cs @ 237:ea5cb50ebe5e

Fixes #384: Validation warnings don't get cleared when creating new armies * Check whether army is valid when it changes (also means we validate on load as well as clearing on close)
author IBBoard <dev@ibboard.co.uk>
date Sat, 21 Jan 2012 16:51:07 +0000
parents c06d0865ff27
children 55c94d438a4b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1 // This file (FrmMain.cs) is a part of the IBBoard.WarFoundry.GUI.WinForms project and is copyright 2007, 2008, 2009 IBBoard.
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
2 //
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
3 // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license.
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
4
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
5 using System;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
6 using System.Collections.Generic;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
7 using System.Drawing;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
8 using System.Drawing.Drawing2D;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
9 using System.ComponentModel;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
10 using System.Windows.Forms;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
11 using System.Data;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
12 using System.IO;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
13 using System.Threading;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
14 using log4net;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
15 using IBBoard;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
16 using IBBoard.CustomMath;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
17 using IBBoard.Commands;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
18 using IBBoard.IO;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
19 using IBBoard.Lang;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
20 using IBBoard.Windows.Forms;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
21 using IBBoard.Windows.Forms.I18N;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
22 using IBBoard.Xml;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
23 using IBBoard.WarFoundry.API;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
24 using IBBoard.WarFoundry.API.Commands;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
25 using IBBoard.WarFoundry.API.Exporters;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
26 using IBBoard.WarFoundry.API.Objects;
196
15148d255e50 * First stab at displaying new unit requirements
IBBoard <dev@ibboard.co.uk>
parents: 195
diff changeset
27 using IBBoard.WarFoundry.API.Objects.Requirement;
190
1ca23c47345a Re #327: Point names used in the GUI
snowblizz
parents: 183
diff changeset
28 using IBBoard.WarFoundry.API.Util;
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
29 using IBBoard.WarFoundry.API.Savers;
193
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 191
diff changeset
30 using IBBoard.WarFoundry.API.Savers.Xml;
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
31 using IBBoard.WarFoundry.API.Factories;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
32 using IBBoard.WarFoundry.API.Factories.Xml;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
33
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
34 namespace IBBoard.WarFoundry.GUI.WinForms
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
35 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
36 /// <summary>
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
37 /// Summary description for Form1.
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
38 /// </summary>
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
39 public class FrmMain : System.Windows.Forms.Form
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
40 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
41 private static readonly string AppTitle = "WarFoundry";
183
75afd724a825 * Increase WarFoundry WinForms version numbers to 0.1 in preparation for first WinForms release
IBBoard <dev@ibboard.co.uk>
parents: 181
diff changeset
42 internal static readonly string VERSION = "0.1";
217
c47094612bac Re #355: Add XML export format that can be transformed with an XSL
IBBoard <dev@ibboard.co.uk>
parents: 214
diff changeset
43 const string DefaultDataDir = "data";
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
44
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
45 private Preferences preferences;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
46 private readonly ILog log = LogManager.GetLogger(typeof(FrmMain));
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
47
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
48 private CommandStack commandStack;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
49
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
50 public ObjectAddDelegate UnitAddedMethod;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
51 public ObjectRemoveDelegate UnitRemovedMethod;
222
4ada3252d1ea Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 221
diff changeset
52 public StringValChangedDelegate ArmyNameChangedMethod;
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
53 public DoubleValChangedDelegate PointsValueChangedMethod;
222
4ada3252d1ea Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 221
diff changeset
54 public IntValChangedDelegate MaxPointsValueChangedMethod;
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
55
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
56 private FrmArmyTree armyTree;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
57 private string loadedFilePath;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
58 private Dictionary<string, FrmUnit> unitWindows;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
59
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
60 private System.ComponentModel.IContainer components;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
61 private System.Windows.Forms.OpenFileDialog openArmyDialog;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
62 private System.Windows.Forms.SaveFileDialog saveArmyDialog;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
63 private System.Windows.Forms.MainMenu mainMenu;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
64 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbMainPanel;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
65 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbErrorPanel;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
66 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbPointsPanel;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
67 private System.Windows.Forms.ContextMenu undoMenu;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
68 private System.Windows.Forms.ContextMenu redoMenu;
217
c47094612bac Re #355: Add XML export format that can be transformed with an XSL
IBBoard <dev@ibboard.co.uk>
parents: 214
diff changeset
69 private IBBoard.Windows.Forms.ColorableStatusBar statusBar;
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
70 private MenuStrip menuStrip;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
71 private IBBToolStripMenuItem menuFile;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
72 private IBBToolStripMenuItem miNewArmy;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
73 private IBBToolStripMenuItem miOpenArmy;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
74 private IBBToolStripMenuItem miSaveArmy;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
75 private IBBToolStripMenuItem miSaveArmyAs;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
76 private IBBToolStripMenuItem miExportArmyAs;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
77 private IBBToolStripMenuItem miExportArmyAsBasicHTML;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
78 private IBBToolStripMenuItem miCloseArmy;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
79 private ToolStripSeparator toolStripSeparator1;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
80 private IBBToolStripMenuItem miReloadFiles;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
81 private ToolStripSeparator toolStripSeparator2;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
82 private IBBToolStripMenuItem miExit;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
83 private IBBToolStripMenuItem menuEdit;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
84 private IBBToolStripMenuItem miUndo;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
85 private IBBToolStripMenuItem miRedo;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
86 private IBBToolStripMenuItem menuHelp;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
87 private ToolStrip mainToolStrip;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
88 private IBBToolStripButton bttnNewArmy;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
89 private IBBToolStripButton bttnOpenArmy;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
90 private IBBToolStripButton bttnSaveArmy;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
91 private ToolStripSeparator toolStripSeparator3;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
92 private IBBToolStripSplitButton bttnUndo;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
93 private IBBToolStripSplitButton bttnRedo;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
94 private ToolStrip catToolStrip;
140
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
95 private ToolStripPanel toolStripPanel;
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
96 private ToolStripSeparator toolStripSeparator4;
217
c47094612bac Re #355: Add XML export format that can be transformed with an XSL
IBBoard <dev@ibboard.co.uk>
parents: 214
diff changeset
97 private IBBToolStripMenuItem miPreferences;
c47094612bac Re #355: Add XML export format that can be transformed with an XSL
IBBoard <dev@ibboard.co.uk>
parents: 214
diff changeset
98 private IBBToolStripMenuItem miExportArmyAsBasicXml;
221
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
99 private IBBToolStripMenuItem miEditArmy;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
100 private ToolStripSeparator toolStripSeparator5;
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
101 private IBBToolStripMenuItem miAbout;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
102
190
1ca23c47345a Re #327: Point names used in the GUI
snowblizz
parents: 183
diff changeset
103
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
104 /// <summary>
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
105 /// The main entry point for the application.
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
106 /// </summary>
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
107 [STAThread]
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
108 static void Main(string[] args)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
109 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
110 try
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
111 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
112 LogManager.GetLogger(typeof(FrmMain)).Info("Starting WarFoundry WinForms");
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
113 Application.EnableVisualStyles();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
114 Application.Run(new FrmMain(args));
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
115 LogManager.GetLogger(typeof(FrmMain)).Info("Closing WarFoundry WinForms");
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
116 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
117 catch (Exception ex)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
118 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
119 LogManager.GetLogger(typeof(FrmMain)).Fatal(ex);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
120 MessageBox.Show(null, "A major, unexpected and fatal error ocurred while starting the application: \r\n\r\n" + ex.Message + "\r\n\r\n" + ex.StackTrace, "Fatal error", MessageBoxButtons.OK, MessageBoxIcon.Error);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
121 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
122 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
123
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
124 public FrmMain(string[] args)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
125 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
126 this.Closing+=new CancelEventHandler(FrmMain_Closing);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
127 CommandStack.CommandStackUpdated += new MethodInvoker(commandStack_CommandStackUpdated);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
128
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
129 InitializeComponent();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
130 toolStripPanel.Join(mainToolStrip, 0, 0);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
131 toolStripPanel.Join(catToolStrip, mainToolStrip.Right, 0);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
132
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
133 Preferences = new Preferences("WarFoundry");
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
134 try
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
135 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
136 Translation.InitialiseTranslations(Constants.ExecutablePath, Preferences["language"].ToString());
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
137 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
138 catch (TranslationLoadException ex)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
139 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
140 log.Error("Translation loading failed for language " + Preferences["language"].ToString(), ex);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
141 MessageBox.Show(this, "Translation loading failed for language " + Preferences["language"].ToString(), "Translation failure", MessageBoxButtons.OK, MessageBoxIcon.Error);
140
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
142 }
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
143
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
144 Translation.TranslationChanged += new MethodInvoker(TranslationChanged);
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
145
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
146 TranslateControls();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
147 unitWindows = new Dictionary<string, FrmUnit>();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
148
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
149 WarFoundryCore.GameSystemChanged+= new GameSystemChangedDelegate(FrmMain_GameSystemChanged);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
150 WarFoundryCore.ArmyChanged += new ArmyChangedDelegate(FrmMain_ArmyChanged);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
151 UnitAddedMethod = new ObjectAddDelegate(FrmMain_UnitAddedMethod);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
152 UnitRemovedMethod = new ObjectRemoveDelegate(FrmMain_UnitRemovedMethod);
222
4ada3252d1ea Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 221
diff changeset
153 ArmyNameChangedMethod = new StringValChangedDelegate(FrmMain_ArmyNameChangedMethod);
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
154 PointsValueChangedMethod = new DoubleValChangedDelegate(FrmMain_PointsValueChangedMethod);
222
4ada3252d1ea Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 221
diff changeset
155 MaxPointsValueChangedMethod = new IntValChangedDelegate(FrmMain_MaxPointsValueChangedMethod);
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
156
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
157 sbErrorPanel.Color = Color.Red;
190
1ca23c47345a Re #327: Point names used in the GUI
snowblizz
parents: 183
diff changeset
158 SetPointsPanelToolTipText();
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
159
144
4023a9bdcb8b Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 142
diff changeset
160 // hack to load default files
4023a9bdcb8b Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 142
diff changeset
161 WarFoundryLoader.GetDefault().AddLoadDirectory(new DirectoryInfo(Constants.ExecutablePath + Constants.DirectoryString + DefaultDataDir));
4023a9bdcb8b Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 142
diff changeset
162 WarFoundryLoader.GetDefault().RegisterFactory(WarFoundryXmlFactory.GetFactory());
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
163 WarFoundryLoader.GetDefault().FileLoadingFinished += FileLoadingFinished;
193
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 191
diff changeset
164 WarFoundrySaver.SetFileSaver(new WarFoundryXmlFileSaver());
140
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
165 }
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
166
159
964f946d3cac Fixes #288: WarFoundry WinForms assumes that army tree will be open
IBBoard <dev@ibboard.co.uk>
parents: 158
diff changeset
167 private FrmArmyTree GetArmyTree()
964f946d3cac Fixes #288: WarFoundry WinForms assumes that army tree will be open
IBBoard <dev@ibboard.co.uk>
parents: 158
diff changeset
168 {
964f946d3cac Fixes #288: WarFoundry WinForms assumes that army tree will be open
IBBoard <dev@ibboard.co.uk>
parents: 158
diff changeset
169 if (armyTree == null || armyTree.IsDisposed)
964f946d3cac Fixes #288: WarFoundry WinForms assumes that army tree will be open
IBBoard <dev@ibboard.co.uk>
parents: 158
diff changeset
170 {
964f946d3cac Fixes #288: WarFoundry WinForms assumes that army tree will be open
IBBoard <dev@ibboard.co.uk>
parents: 158
diff changeset
171 CreateArmyTree();
964f946d3cac Fixes #288: WarFoundry WinForms assumes that army tree will be open
IBBoard <dev@ibboard.co.uk>
parents: 158
diff changeset
172 }
964f946d3cac Fixes #288: WarFoundry WinForms assumes that army tree will be open
IBBoard <dev@ibboard.co.uk>
parents: 158
diff changeset
173
964f946d3cac Fixes #288: WarFoundry WinForms assumes that army tree will be open
IBBoard <dev@ibboard.co.uk>
parents: 158
diff changeset
174 return armyTree;
964f946d3cac Fixes #288: WarFoundry WinForms assumes that army tree will be open
IBBoard <dev@ibboard.co.uk>
parents: 158
diff changeset
175 }
964f946d3cac Fixes #288: WarFoundry WinForms assumes that army tree will be open
IBBoard <dev@ibboard.co.uk>
parents: 158
diff changeset
176
964f946d3cac Fixes #288: WarFoundry WinForms assumes that army tree will be open
IBBoard <dev@ibboard.co.uk>
parents: 158
diff changeset
177 private void CreateArmyTree()
964f946d3cac Fixes #288: WarFoundry WinForms assumes that army tree will be open
IBBoard <dev@ibboard.co.uk>
parents: 158
diff changeset
178 {
964f946d3cac Fixes #288: WarFoundry WinForms assumes that army tree will be open
IBBoard <dev@ibboard.co.uk>
parents: 158
diff changeset
179 armyTree = new FrmArmyTree(CommandStack);
964f946d3cac Fixes #288: WarFoundry WinForms assumes that army tree will be open
IBBoard <dev@ibboard.co.uk>
parents: 158
diff changeset
180 armyTree.MdiParent = this;
964f946d3cac Fixes #288: WarFoundry WinForms assumes that army tree will be open
IBBoard <dev@ibboard.co.uk>
parents: 158
diff changeset
181 armyTree.StartPosition = FormStartPosition.Manual;
964f946d3cac Fixes #288: WarFoundry WinForms assumes that army tree will be open
IBBoard <dev@ibboard.co.uk>
parents: 158
diff changeset
182 armyTree.Location = new Point(this.DisplayRectangle.Width - armyTree.Width - 10, 10);
964f946d3cac Fixes #288: WarFoundry WinForms assumes that army tree will be open
IBBoard <dev@ibboard.co.uk>
parents: 158
diff changeset
183 }
964f946d3cac Fixes #288: WarFoundry WinForms assumes that army tree will be open
IBBoard <dev@ibboard.co.uk>
parents: 158
diff changeset
184
140
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
185 private void TranslateControls()
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
186 {
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
187 ControlTranslator.TranslateControls(Controls);
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
188 ControlTranslator.TranslateComponents(components.Components);
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
189 ControlTranslator.TranslateComponent(openArmyDialog);
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
190 ControlTranslator.TranslateComponent(saveArmyDialog);
190
1ca23c47345a Re #327: Point names used in the GUI
snowblizz
parents: 183
diff changeset
191 //translate pointspanel and tooltip
1ca23c47345a Re #327: Point names used in the GUI
snowblizz
parents: 183
diff changeset
192 SetPointsPanelToolTipText();
1ca23c47345a Re #327: Point names used in the GUI
snowblizz
parents: 183
diff changeset
193 SetPointsPanelText();
1ca23c47345a Re #327: Point names used in the GUI
snowblizz
parents: 183
diff changeset
194 }
140
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
195
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
196 void TranslationChanged()
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
197 {
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
198 TranslateControls();
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
199 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
200
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
201 public static string DataPath
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
202 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
203 get { return Constants.ExecutablePath+Constants.DirectoryChar+"data"; }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
204 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
205
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
206 public static String ArmiesPath
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
207 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
208 get { return Environment.GetFolderPath(Environment.SpecialFolder.Personal); }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
209 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
210
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
211 public Preferences Preferences
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
212 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
213 get { return preferences; }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
214 set { preferences = value; }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
215 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
216
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
217 public CommandStack CommandStack
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
218 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
219 get
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
220 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
221 if (commandStack == null)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
222 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
223 commandStack = new CommandStack();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
224 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
225
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
226 return commandStack;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
227 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
228 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
229
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
230 /// <summary>
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
231 /// Clean up any resources being used.
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
232 /// </summary>
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
233 protected override void Dispose( bool disposing )
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
234 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
235 if( disposing )
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
236 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
237 if (components != null)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
238 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
239 components.Dispose();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
240 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
241 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
242 base.Dispose( disposing );
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
243 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
244
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
245 #region Windows Form Designer generated code
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
246 /// <summary>
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
247 /// Required method for Designer support - do not modify
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
248 /// the contents of this method with the code editor.
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
249 /// </summary>
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
250 private void InitializeComponent()
140
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
251 {
221
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
252 this.components = new System.ComponentModel.Container();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
253 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain));
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
254 this.undoMenu = new System.Windows.Forms.ContextMenu();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
255 this.redoMenu = new System.Windows.Forms.ContextMenu();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
256 this.mainMenu = new System.Windows.Forms.MainMenu(this.components);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
257 this.openArmyDialog = new System.Windows.Forms.OpenFileDialog();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
258 this.saveArmyDialog = new System.Windows.Forms.SaveFileDialog();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
259 this.menuStrip = new System.Windows.Forms.MenuStrip();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
260 this.mainToolStrip = new System.Windows.Forms.ToolStrip();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
261 this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
262 this.catToolStrip = new System.Windows.Forms.ToolStrip();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
263 this.toolStripPanel = new System.Windows.Forms.ToolStripPanel();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
264 this.bttnNewArmy = new IBBoard.Windows.Forms.IBBToolStripButton();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
265 this.bttnOpenArmy = new IBBoard.Windows.Forms.IBBToolStripButton();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
266 this.bttnSaveArmy = new IBBoard.Windows.Forms.IBBToolStripButton();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
267 this.bttnUndo = new IBBoard.Windows.Forms.IBBToolStripSplitButton();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
268 this.bttnRedo = new IBBoard.Windows.Forms.IBBToolStripSplitButton();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
269 this.statusBar = new IBBoard.Windows.Forms.ColorableStatusBar();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
270 this.sbMainPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
271 this.sbErrorPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
272 this.sbPointsPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
273 this.menuFile = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
274 this.miNewArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
275 this.miOpenArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
276 this.miSaveArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
277 this.miSaveArmyAs = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
278 this.miExportArmyAs = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
279 this.miExportArmyAsBasicHTML = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
280 this.miExportArmyAsBasicXml = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
281 this.miCloseArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
282 this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
283 this.miReloadFiles = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
284 this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
285 this.miExit = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
286 this.menuEdit = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
287 this.miUndo = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
288 this.miRedo = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
289 this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
290 this.miEditArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
291 this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
292 this.miPreferences = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
293 this.menuHelp = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
294 this.miAbout = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
295 this.menuStrip.SuspendLayout();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
296 this.mainToolStrip.SuspendLayout();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
297 ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).BeginInit();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
298 ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).BeginInit();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
299 ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).BeginInit();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
300 this.SuspendLayout();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
301 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
302 // saveArmyDialog
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
303 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
304 this.saveArmyDialog.Title = "Translatable:saveArmyDialog";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
305 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
306 // menuStrip
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
307 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
308 this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
140
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
309 this.menuFile,
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
310 this.menuEdit,
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
311 this.menuHelp});
221
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
312 this.menuStrip.Location = new System.Drawing.Point(0, 0);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
313 this.menuStrip.Name = "menuStrip";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
314 this.menuStrip.Size = new System.Drawing.Size(790, 24);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
315 this.menuStrip.TabIndex = 6;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
316 this.menuStrip.Text = "menuStrip1";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
317 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
318 // mainToolStrip
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
319 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
320 this.mainToolStrip.Dock = System.Windows.Forms.DockStyle.None;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
321 this.mainToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
322 this.bttnNewArmy,
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
323 this.bttnOpenArmy,
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
324 this.bttnSaveArmy,
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
325 this.toolStripSeparator3,
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
326 this.bttnUndo,
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
327 this.bttnRedo});
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
328 this.mainToolStrip.Location = new System.Drawing.Point(0, 24);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
329 this.mainToolStrip.Name = "mainToolStrip";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
330 this.mainToolStrip.Size = new System.Drawing.Size(151, 25);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
331 this.mainToolStrip.TabIndex = 8;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
332 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
333 // toolStripSeparator3
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
334 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
335 this.toolStripSeparator3.Name = "toolStripSeparator3";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
336 this.toolStripSeparator3.Size = new System.Drawing.Size(6, 25);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
337 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
338 // catToolStrip
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
339 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
340 this.catToolStrip.Dock = System.Windows.Forms.DockStyle.None;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
341 this.catToolStrip.Location = new System.Drawing.Point(161, 24);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
342 this.catToolStrip.Name = "catToolStrip";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
343 this.catToolStrip.Size = new System.Drawing.Size(111, 25);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
344 this.catToolStrip.TabIndex = 9;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
345 this.catToolStrip.Visible = false;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
346 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
347 // toolStripPanel
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
348 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
349 this.toolStripPanel.Dock = System.Windows.Forms.DockStyle.Top;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
350 this.toolStripPanel.Location = new System.Drawing.Point(0, 24);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
351 this.toolStripPanel.Name = "toolStripPanel";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
352 this.toolStripPanel.Orientation = System.Windows.Forms.Orientation.Horizontal;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
353 this.toolStripPanel.RowMargin = new System.Windows.Forms.Padding(3, 0, 0, 0);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
354 this.toolStripPanel.Size = new System.Drawing.Size(790, 0);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
355 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
356 // bttnNewArmy
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
357 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
358 this.bttnNewArmy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
359 this.bttnNewArmy.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.document_new;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
360 this.bttnNewArmy.ImageTransparentColor = System.Drawing.Color.Magenta;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
361 this.bttnNewArmy.Name = "bttnNewArmy";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
362 this.bttnNewArmy.Size = new System.Drawing.Size(23, 22);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
363 this.bttnNewArmy.Text = "new army";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
364 this.bttnNewArmy.Click += new System.EventHandler(this.miNewArmy_Click);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
365 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
366 // bttnOpenArmy
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
367 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
368 this.bttnOpenArmy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
369 this.bttnOpenArmy.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.document_open;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
370 this.bttnOpenArmy.ImageTransparentColor = System.Drawing.Color.Magenta;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
371 this.bttnOpenArmy.Name = "bttnOpenArmy";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
372 this.bttnOpenArmy.Size = new System.Drawing.Size(23, 22);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
373 this.bttnOpenArmy.Text = "open army";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
374 this.bttnOpenArmy.Click += new System.EventHandler(this.miOpenArmy_Click);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
375 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
376 // bttnSaveArmy
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
377 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
378 this.bttnSaveArmy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
379 this.bttnSaveArmy.Enabled = false;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
380 this.bttnSaveArmy.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.document_save;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
381 this.bttnSaveArmy.ImageTransparentColor = System.Drawing.Color.Magenta;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
382 this.bttnSaveArmy.Name = "bttnSaveArmy";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
383 this.bttnSaveArmy.Size = new System.Drawing.Size(23, 22);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
384 this.bttnSaveArmy.Text = "save army";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
385 this.bttnSaveArmy.Click += new System.EventHandler(this.miSaveArmy_Click);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
386 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
387 // bttnUndo
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
388 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
389 this.bttnUndo.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
390 this.bttnUndo.Enabled = false;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
391 this.bttnUndo.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.edit_undo;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
392 this.bttnUndo.ImageTransparentColor = System.Drawing.Color.Magenta;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
393 this.bttnUndo.Name = "bttnUndo";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
394 this.bttnUndo.Size = new System.Drawing.Size(32, 22);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
395 this.bttnUndo.Text = "undo";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
396 this.bttnUndo.ButtonClick += new System.EventHandler(this.miUndo_Click);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
397 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
398 // bttnRedo
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
399 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
400 this.bttnRedo.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
401 this.bttnRedo.Enabled = false;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
402 this.bttnRedo.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.edit_redo;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
403 this.bttnRedo.ImageTransparentColor = System.Drawing.Color.Magenta;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
404 this.bttnRedo.Name = "bttnRedo";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
405 this.bttnRedo.Size = new System.Drawing.Size(32, 22);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
406 this.bttnRedo.Text = "redo";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
407 this.bttnRedo.ButtonClick += new System.EventHandler(this.miRedo_Click);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
408 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
409 // statusBar
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
410 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
411 this.statusBar.Location = new System.Drawing.Point(0, 586);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
412 this.statusBar.Name = "statusBar";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
413 this.statusBar.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
414 this.sbMainPanel,
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
415 this.sbErrorPanel,
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
416 this.sbPointsPanel});
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
417 this.statusBar.ShowPanels = true;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
418 this.statusBar.Size = new System.Drawing.Size(790, 22);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
419 this.statusBar.TabIndex = 1;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
420 this.statusBar.DrawItem += new System.Windows.Forms.StatusBarDrawItemEventHandler(this.statusBar_DrawItem);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
421 this.statusBar.PanelClick += new System.Windows.Forms.StatusBarPanelClickEventHandler(this.statusBar_PanelClick);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
422 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
423 // sbMainPanel
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
424 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
425 this.sbMainPanel.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
426 this.sbMainPanel.Color = System.Drawing.SystemColors.WindowText;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
427 this.sbMainPanel.Name = "sbMainPanel";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
428 this.sbMainPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
429 this.sbMainPanel.Width = 473;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
430 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
431 // sbErrorPanel
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
432 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
433 this.sbErrorPanel.Color = System.Drawing.SystemColors.WindowText;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
434 this.sbErrorPanel.Name = "sbErrorPanel";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
435 this.sbErrorPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
436 this.sbErrorPanel.Width = 150;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
437 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
438 // sbPointsPanel
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
439 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
440 this.sbPointsPanel.Color = System.Drawing.SystemColors.WindowText;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
441 this.sbPointsPanel.Name = "sbPointsPanel";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
442 this.sbPointsPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
443 this.sbPointsPanel.ToolTipText = "current points total";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
444 this.sbPointsPanel.Width = 150;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
445 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
446 // menuFile
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
447 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
448 this.menuFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
140
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
449 this.miNewArmy,
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
450 this.miOpenArmy,
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
451 this.miSaveArmy,
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
452 this.miSaveArmyAs,
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
453 this.miExportArmyAs,
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
454 this.miCloseArmy,
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
455 this.toolStripSeparator1,
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
456 this.miReloadFiles,
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
457 this.toolStripSeparator2,
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
458 this.miExit});
221
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
459 this.menuFile.Name = "menuFile";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
460 this.menuFile.Size = new System.Drawing.Size(33, 20);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
461 this.menuFile.Text = "&file";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
462 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
463 // miNewArmy
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
464 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
465 this.miNewArmy.Name = "miNewArmy";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
466 this.miNewArmy.Size = new System.Drawing.Size(170, 22);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
467 this.miNewArmy.Text = "&new army";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
468 this.miNewArmy.Click += new System.EventHandler(this.miNewArmy_Click);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
469 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
470 // miOpenArmy
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
471 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
472 this.miOpenArmy.Name = "miOpenArmy";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
473 this.miOpenArmy.Size = new System.Drawing.Size(170, 22);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
474 this.miOpenArmy.Text = "&open army";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
475 this.miOpenArmy.Click += new System.EventHandler(this.miOpenArmy_Click);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
476 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
477 // miSaveArmy
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
478 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
479 this.miSaveArmy.Enabled = false;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
480 this.miSaveArmy.Name = "miSaveArmy";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
481 this.miSaveArmy.Size = new System.Drawing.Size(170, 22);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
482 this.miSaveArmy.Text = "&save army";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
483 this.miSaveArmy.Click += new System.EventHandler(this.miSaveArmy_Click);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
484 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
485 // miSaveArmyAs
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
486 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
487 this.miSaveArmyAs.Enabled = false;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
488 this.miSaveArmyAs.Name = "miSaveArmyAs";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
489 this.miSaveArmyAs.Size = new System.Drawing.Size(170, 22);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
490 this.miSaveArmyAs.Text = "save army &as...";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
491 this.miSaveArmyAs.Click += new System.EventHandler(this.miSaveArmyAs_Click);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
492 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
493 // miExportArmyAs
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
494 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
495 this.miExportArmyAs.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
207
ac5f87626abd Basic XML translations
Dan.Kulinski@dank-laptop.Global.Local
parents: 197
diff changeset
496 this.miExportArmyAsBasicHTML,
ac5f87626abd Basic XML translations
Dan.Kulinski@dank-laptop.Global.Local
parents: 197
diff changeset
497 this.miExportArmyAsBasicXml});
221
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
498 this.miExportArmyAs.Enabled = false;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
499 this.miExportArmyAs.Name = "miExportArmyAs";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
500 this.miExportArmyAs.Size = new System.Drawing.Size(170, 22);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
501 this.miExportArmyAs.Text = "export army as...";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
502 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
503 // miExportArmyAsBasicHTML
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
504 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
505 this.miExportArmyAsBasicHTML.Name = "miExportArmyAsBasicHTML";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
506 this.miExportArmyAsBasicHTML.Size = new System.Drawing.Size(132, 22);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
507 this.miExportArmyAsBasicHTML.Text = "&basic html";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
508 this.miExportArmyAsBasicHTML.Click += new System.EventHandler(this.miExportArmyAsBasicHTML_Click);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
509 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
510 // miExportArmyAsBasicXml
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
511 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
512 this.miExportArmyAsBasicXml.Name = "miExportArmyAsBasicXml";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
513 this.miExportArmyAsBasicXml.Size = new System.Drawing.Size(132, 22);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
514 this.miExportArmyAsBasicXml.Text = "basic xml";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
515 this.miExportArmyAsBasicXml.Click += new System.EventHandler(this.miExportArmyAsBasicXml_Click);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
516 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
517 // miCloseArmy
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
518 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
519 this.miCloseArmy.Enabled = false;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
520 this.miCloseArmy.Name = "miCloseArmy";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
521 this.miCloseArmy.Size = new System.Drawing.Size(170, 22);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
522 this.miCloseArmy.Text = "&close army";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
523 this.miCloseArmy.Click += new System.EventHandler(this.miCloseArmy_Click);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
524 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
525 // toolStripSeparator1
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
526 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
527 this.toolStripSeparator1.Name = "toolStripSeparator1";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
528 this.toolStripSeparator1.Size = new System.Drawing.Size(167, 6);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
529 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
530 // miReloadFiles
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
531 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
532 this.miReloadFiles.Name = "miReloadFiles";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
533 this.miReloadFiles.Size = new System.Drawing.Size(170, 22);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
534 this.miReloadFiles.Text = "&reload files";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
535 this.miReloadFiles.Click += new System.EventHandler(this.miReloadFiles_Click);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
536 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
537 // toolStripSeparator2
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
538 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
539 this.toolStripSeparator2.Name = "toolStripSeparator2";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
540 this.toolStripSeparator2.Size = new System.Drawing.Size(167, 6);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
541 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
542 // miExit
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
543 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
544 this.miExit.Name = "miExit";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
545 this.miExit.Size = new System.Drawing.Size(170, 22);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
546 this.miExit.Text = "e&xit";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
547 this.miExit.Click += new System.EventHandler(this.miExit_Click);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
548 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
549 // menuEdit
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
550 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
551 this.menuEdit.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
140
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
552 this.miUndo,
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
553 this.miRedo,
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
554 this.toolStripSeparator4,
221
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
555 this.miEditArmy,
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
556 this.toolStripSeparator5,
140
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
557 this.miPreferences});
221
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
558 this.menuEdit.Name = "menuEdit";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
559 this.menuEdit.Size = new System.Drawing.Size(37, 20);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
560 this.menuEdit.Text = "&edit";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
561 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
562 // miUndo
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
563 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
564 this.miUndo.Enabled = false;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
565 this.miUndo.Name = "miUndo";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
566 this.miUndo.Size = new System.Drawing.Size(152, 22);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
567 this.miUndo.Text = "&undo";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
568 this.miUndo.Click += new System.EventHandler(this.miUndo_Click);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
569 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
570 // miRedo
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
571 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
572 this.miRedo.Enabled = false;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
573 this.miRedo.Name = "miRedo";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
574 this.miRedo.Size = new System.Drawing.Size(152, 22);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
575 this.miRedo.Text = "&redo";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
576 this.miRedo.Click += new System.EventHandler(this.miRedo_Click);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
577 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
578 // toolStripSeparator4
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
579 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
580 this.toolStripSeparator4.Name = "toolStripSeparator4";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
581 this.toolStripSeparator4.Size = new System.Drawing.Size(149, 6);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
582 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
583 // miEditArmy
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
584 //
222
4ada3252d1ea Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 221
diff changeset
585 this.miEditArmy.Enabled = false;
221
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
586 this.miEditArmy.Name = "miEditArmy";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
587 this.miEditArmy.Size = new System.Drawing.Size(152, 22);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
588 this.miEditArmy.Text = "&edit army";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
589 this.miEditArmy.Click += new System.EventHandler(this.miEditArmy_Click);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
590 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
591 // toolStripSeparator5
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
592 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
593 this.toolStripSeparator5.Name = "toolStripSeparator5";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
594 this.toolStripSeparator5.Size = new System.Drawing.Size(149, 6);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
595 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
596 // miPreferences
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
597 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
598 this.miPreferences.Name = "miPreferences";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
599 this.miPreferences.Size = new System.Drawing.Size(152, 22);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
600 this.miPreferences.Text = "&preferences";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
601 this.miPreferences.Click += new System.EventHandler(this.miPreferences_Click);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
602 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
603 // menuHelp
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
604 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
605 this.menuHelp.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
140
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
606 this.miAbout});
221
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
607 this.menuHelp.Name = "menuHelp";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
608 this.menuHelp.Size = new System.Drawing.Size(39, 20);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
609 this.menuHelp.Text = "&help";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
610 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
611 // miAbout
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
612 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
613 this.miAbout.Name = "miAbout";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
614 this.miAbout.Size = new System.Drawing.Size(113, 22);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
615 this.miAbout.Text = "&about";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
616 this.miAbout.Click += new System.EventHandler(this.miAbout_Click);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
617 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
618 // FrmMain
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
619 //
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
620 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
621 this.ClientSize = new System.Drawing.Size(790, 608);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
622 this.Controls.Add(this.mainToolStrip);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
623 this.Controls.Add(this.toolStripPanel);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
624 this.Controls.Add(this.statusBar);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
625 this.Controls.Add(this.catToolStrip);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
626 this.Controls.Add(this.menuStrip);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
627 this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
628 this.IsMdiContainer = true;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
629 this.MainMenuStrip = this.menuStrip;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
630 this.Menu = this.mainMenu;
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
631 this.Name = "FrmMain";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
632 this.Text = "WarFoundry";
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
633 this.Load += new System.EventHandler(this.FrmMain_Load);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
634 this.menuStrip.ResumeLayout(false);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
635 this.menuStrip.PerformLayout();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
636 this.mainToolStrip.ResumeLayout(false);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
637 this.mainToolStrip.PerformLayout();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
638 ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).EndInit();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
639 ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).EndInit();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
640 ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).EndInit();
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
641 this.ResumeLayout(false);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
642 this.PerformLayout();
140
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
643
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
644 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
645 #endregion
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
646
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
647 private void FileLoadingFinished(List<FileLoadFailure> failures)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
648 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
649 foreach (FileLoadFailure failure in failures)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
650 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
651 log.Warn("Failed to load " + failure.FailedFile.FullName + ": " + failure.Message);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
652 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
653 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
654
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
655 private void miExit_Click(object sender, System.EventArgs e)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
656 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
657 Application.Exit();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
658 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
659
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
660 private void miNewArmy_Click(object sender, System.EventArgs e)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
661 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
662 CreateNewArmy();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
663 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
664
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
665 private void CreateNewArmy()
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
666 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
667 if (CloseCurrentArmy())
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
668 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
669 FrmNewArmy newArmy = new FrmNewArmy(CurrentGameSystem);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
670 DialogResult dr = newArmy.ShowDialog();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
671
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
672 if (dr == DialogResult.OK)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
673 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
674 try
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
675 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
676 CurrentArmy = new Army(newArmy.SelectedRace, newArmy.ArmyName, newArmy.ArmySize);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
677 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
678 catch (RequiredDataMissingException ex)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
679 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
680 log.Error("Required data missing from race file", ex);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
681 MessageBox.Show(this, ex.Message, Translation.GetTranslation("InvalidRaceFileBoxTitle", "invalid race file"), MessageBoxButtons.OK, MessageBoxIcon.Error);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
682 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
683 catch (InvalidFileException ex)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
684 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
685 log.Error("Race file was invalid", ex);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
686 MessageBox.Show(this, ex.Message, Translation.GetTranslation("InvalidRaceFileBoxTitle", "invalid race file"), MessageBoxButtons.OK, MessageBoxIcon.Error);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
687 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
688 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
689 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
690 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
691
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
692 private bool OpenArmy()
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
693 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
694 if (openArmyDialog.Filter=="")
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
695 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
696 string savePath = ArmiesPath;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
697
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
698 if (!Directory.Exists(savePath))
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
699 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
700 Directory.CreateDirectory(savePath);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
701 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
702
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
703 openArmyDialog.InitialDirectory = savePath;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
704 openArmyDialog.Filter = Translation.GetTranslation("armyFileFilter")+"|*.army";
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
705 openArmyDialog.Title = Translation.GetTranslation("openArmyDialog");
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
706
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
707 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
708
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
709 DialogResult dr = openArmyDialog.ShowDialog(this);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
710
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
711 if (dr == DialogResult.OK)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
712 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
713 if (CloseCurrentArmy())
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
714 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
715 try
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
716 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
717 string newFilePath = openArmyDialog.FileName;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
718 CurrentArmy = WarFoundryLoader.GetDefault().LoadArmy(new FileInfo(newFilePath));
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
719 loadedFilePath = newFilePath;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
720 return true;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
721 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
722 catch (RequiredDataMissingException ex)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
723 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
724 log.Error(ex);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
725 MessageBox.Show(this, ex.Message, Translation.GetTranslation("InvalidArmyFileBoxTitle", "invalid army file"), MessageBoxButtons.OK, MessageBoxIcon.Error);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
726 return false;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
727 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
728 catch (InvalidFileException ex)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
729 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
730 log.Error(ex);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
731 MessageBox.Show(this, ex.Message, Translation.GetTranslation("InvalidArmyFileBoxTitle", "invalid army file"), MessageBoxButtons.OK, MessageBoxIcon.Error);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
732 return false;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
733 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
734 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
735 else
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
736 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
737 return false;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
738 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
739 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
740 else
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
741 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
742 return false;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
743 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
744 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
745
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
746 private bool CloseCurrentArmy()
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
747 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
748 if (CurrentArmy!=null)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
749 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
750 bool canClose = false;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
751
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
752 if (CommandStack.IsDirty())
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
753 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
754 string saveChanges = Translation.GetTranslation("SaveChangesQuestion", "the army \"{0}\" has been modified\r\nsave changes before closing army?", CurrentArmy.Name);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
755 string saveChangesTitle = Translation.GetTranslation("SaveChangesTitle", "unsaved changes");
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
756 DialogResult dr = MessageBox.Show(this, saveChanges, saveChangesTitle, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button3);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
757
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
758 if (dr == DialogResult.Yes)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
759 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
760 canClose = SaveCurrentArmy();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
761 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
762 else if (dr == DialogResult.No)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
763 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
764 canClose = true;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
765 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
766 //else they said cancel and we default to "canClose = false" so do nothing
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
767 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
768 else
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
769 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
770 canClose = true;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
771 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
772
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
773 if (canClose)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
774 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
775 //do close
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
776 DisableCategoryButtons();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
777 CurrentArmy = null;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
778 return true;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
779 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
780 else
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
781 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
782 return false;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
783 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
784 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
785 else
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
786 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
787 DisableCategoryButtons();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
788 //pretend we succeeded
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
789 return true;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
790 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
791 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
792
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
793 private void UndoLastAction()
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
794 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
795 if (commandStack.CanUndo())
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
796 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
797 commandStack.Undo();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
798 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
799 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
800
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
801 private void RedoAction()
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
802 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
803 if (commandStack.CanRedo())
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
804 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
805 commandStack.Redo();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
806 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
807 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
808
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
809 private bool SaveCurrentArmy()
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
810 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
811 bool saved = false;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
812
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
813 string filePath = loadedFilePath;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
814
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
815 if (filePath == null)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
816 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
817 filePath = PromptForArmyFilePath();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
818 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
819
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
820 if (filePath != null)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
821 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
822 saved = SaveCurrentArmyToFile(filePath);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
823 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
824
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
825 return saved;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
826 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
827
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
828 private bool SaveCurrentArmyAs()
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
829 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
830 bool saved = false;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
831 string filePath = PromptForArmyFilePath();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
832
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
833 if (filePath != null)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
834 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
835 saved = SaveCurrentArmyToFile(filePath);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
836 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
837
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
838 return saved;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
839 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
840
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
841 private bool SaveCurrentArmyToFile(string filePath)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
842 {
193
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 191
diff changeset
843 if (WarFoundrySaver.GetSaver().Save(filePath, CurrentArmy))
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
844 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
845 loadedFilePath = filePath;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
846 miSaveArmy.Enabled = false;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
847 bttnSaveArmy.Enabled = false;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
848 CommandStack.setCleanMark();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
849 return true;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
850 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
851 else
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
852 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
853 MessageBox.Show(this, Translation.GetTranslation("SaveFailed", "file save failed - check log for details"), Translation.GetTranslation("SaveFailedTitle", "file save failed"), MessageBoxButtons.OK, MessageBoxIcon.Error);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
854 return false;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
855 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
856 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
857
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
858 private string PromptForArmyFilePath()
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
859 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
860 if (saveArmyDialog.Filter == "")
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
861 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
862 string savePath = ArmiesPath;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
863
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
864 if (!Directory.Exists(savePath))
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
865 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
866 Directory.CreateDirectory(savePath);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
867 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
868
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
869 saveArmyDialog.InitialDirectory = savePath;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
870 saveArmyDialog.Filter = Translation.GetTranslation("armyFileFilter")+"|*.army";
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
871 saveArmyDialog.Title = Translation.GetTranslation("saveArmyDialog");
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
872 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
873
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
874 DialogResult dr = saveArmyDialog.ShowDialog(this);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
875
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
876 if (dr == DialogResult.OK)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
877 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
878 return saveArmyDialog.FileName;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
879 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
880 else
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
881 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
882 return null;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
883 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
884 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
885
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
886 public GameSystem CurrentGameSystem
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
887 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
888 get { return WarFoundryCore.CurrentGameSystem; }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
889 set { WarFoundryCore.CurrentGameSystem = value; }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
890 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
891
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
892 public Army CurrentArmy
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
893 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
894 get { return WarFoundryCore.CurrentArmy; }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
895 set { SetArmy(value); }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
896 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
897
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
898 private void FrmMain_GameSystemChanged(GameSystem oldSystem, GameSystem newSystem)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
899 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
900 SetAppTitle();
195
983d96be91f5 Fixes #161: Re-implement "load last used game system by default" in WinForms
IBBoard <dev@ibboard.co.uk>
parents: 193
diff changeset
901
983d96be91f5 Fixes #161: Re-implement "load last used game system by default" in WinForms
IBBoard <dev@ibboard.co.uk>
parents: 193
diff changeset
902 if (newSystem == null)
983d96be91f5 Fixes #161: Re-implement "load last used game system by default" in WinForms
IBBoard <dev@ibboard.co.uk>
parents: 193
diff changeset
903 {
983d96be91f5 Fixes #161: Re-implement "load last used game system by default" in WinForms
IBBoard <dev@ibboard.co.uk>
parents: 193
diff changeset
904 Preferences["currSystem"] = "";
983d96be91f5 Fixes #161: Re-implement "load last used game system by default" in WinForms
IBBoard <dev@ibboard.co.uk>
parents: 193
diff changeset
905 }
983d96be91f5 Fixes #161: Re-implement "load last used game system by default" in WinForms
IBBoard <dev@ibboard.co.uk>
parents: 193
diff changeset
906 else
983d96be91f5 Fixes #161: Re-implement "load last used game system by default" in WinForms
IBBoard <dev@ibboard.co.uk>
parents: 193
diff changeset
907 {
983d96be91f5 Fixes #161: Re-implement "load last used game system by default" in WinForms
IBBoard <dev@ibboard.co.uk>
parents: 193
diff changeset
908 Preferences["currSystem"] = newSystem.ID;
983d96be91f5 Fixes #161: Re-implement "load last used game system by default" in WinForms
IBBoard <dev@ibboard.co.uk>
parents: 193
diff changeset
909 }
983d96be91f5 Fixes #161: Re-implement "load last used game system by default" in WinForms
IBBoard <dev@ibboard.co.uk>
parents: 193
diff changeset
910
983d96be91f5 Fixes #161: Re-implement "load last used game system by default" in WinForms
IBBoard <dev@ibboard.co.uk>
parents: 193
diff changeset
911 Preferences.Save();
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
912 RemoveCategoryButtons();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
913 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
914
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
915 private void FrmMain_ArmyChanged(Army oldArmy, Army newArmy)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
916 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
917 CommandStack.Reset();
237
ea5cb50ebe5e Fixes #384: Validation warnings don't get cleared when creating new armies
IBBoard <dev@ibboard.co.uk>
parents: 234
diff changeset
918 ValidateArmy();
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
919 loadedFilePath = null;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
920 miSaveArmy.Enabled = false;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
921 bttnSaveArmy.Enabled = false;
222
4ada3252d1ea Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 221
diff changeset
922 miEditArmy.Enabled = (CurrentArmy != null);
196
15148d255e50 * First stab at displaying new unit requirements
IBBoard <dev@ibboard.co.uk>
parents: 195
diff changeset
923 //TODO: Subscribe to an "army changed" event here
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
924 SetPointsPanelText();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
925 SetAppTitle();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
926 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
927
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
928 private void SetArmy(Army newArmy)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
929 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
930 IgnoreArmy(CurrentArmy);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
931 CloseAllUnitWindows();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
932
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
933 if (newArmy == null)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
934 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
935 SetNullArmyState();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
936 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
937 else
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
938 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
939 WarFoundryCore.CurrentGameSystem = newArmy.GameSystem;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
940 ListenToArmy(newArmy);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
941 SetNonNullArmyState(newArmy);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
942 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
943
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
944 WarFoundryCore.CurrentArmy = newArmy;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
945 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
946
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
947 private void IgnoreArmy(Army oldArmy)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
948 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
949 if (oldArmy != null)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
950 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
951 oldArmy.UnitAdded -= UnitAddedMethod;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
952 oldArmy.UnitRemoved -= UnitRemovedMethod;
222
4ada3252d1ea Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 221
diff changeset
953 oldArmy.NameChanged -= ArmyNameChangedMethod;
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
954 oldArmy.PointsValueChanged -= PointsValueChangedMethod;
222
4ada3252d1ea Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 221
diff changeset
955 oldArmy.MaxPointsValueChanged -= MaxPointsValueChangedMethod;
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
956 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
957 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
958
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
959 private void CloseAllUnitWindows()
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
960 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
961 FrmUnit[] unitForms = DictionaryUtils.ToArray(unitWindows);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
962
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
963 foreach (FrmUnit window in unitForms)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
964 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
965 window.Close();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
966 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
967
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
968 unitWindows.Clear();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
969 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
970
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
971 private void ListenToArmy(Army newArmy)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
972 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
973 if (newArmy != null)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
974 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
975 newArmy.UnitAdded += UnitAddedMethod;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
976 newArmy.UnitRemoved += UnitRemovedMethod;
222
4ada3252d1ea Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 221
diff changeset
977 newArmy.NameChanged += ArmyNameChangedMethod;
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
978 newArmy.PointsValueChanged += PointsValueChangedMethod;
222
4ada3252d1ea Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 221
diff changeset
979 newArmy.MaxPointsValueChanged += MaxPointsValueChangedMethod;
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
980 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
981 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
982
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
983 private void SetNullArmyState()
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
984 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
985 miSaveArmyAs.Enabled = false;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
986 miCloseArmy.Enabled = false;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
987 miExportArmyAs.Enabled = false;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
988 DisableCategoryButtons();
159
964f946d3cac Fixes #288: WarFoundry WinForms assumes that army tree will be open
IBBoard <dev@ibboard.co.uk>
parents: 158
diff changeset
989 GetArmyTree().Hide();
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
990 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
991
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
992 private void SetNonNullArmyState(Army newArmy)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
993 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
994 SetCategoryButtons(newArmy.Race.Categories);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
995 EnableCategoryButtons();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
996 miSaveArmyAs.Enabled = true;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
997 miCloseArmy.Enabled = true;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
998 miExportArmyAs.Enabled = true;
159
964f946d3cac Fixes #288: WarFoundry WinForms assumes that army tree will be open
IBBoard <dev@ibboard.co.uk>
parents: 158
diff changeset
999 GetArmyTree().Show();
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1000 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1001
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1002 private void SetCategoryButtons(Category[] cats)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1003 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1004 if (CategoryButtonsHaveChanged(cats))
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1005 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1006 RemoveCategoryButtons();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1007 AddCategoryButtons(cats);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1008 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1009 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1010
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1011 private bool CategoryButtonsHaveChanged(Category[] cats)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1012 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1013 int catCount = cats.Length;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1014 ToolStripItemCollection items = catToolStrip.Items;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1015 bool haveChanged = (!catToolStrip.Visible || catCount != items.Count);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1016
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1017 if (!haveChanged)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1018 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1019 for (int i = 0; i < catCount; i++)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1020 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1021 if (cats[i].Equals(items[i+1].Tag))
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1022 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1023 haveChanged = true;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1024 break;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1025 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1026 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1027 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1028
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1029 return haveChanged;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1030 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1031
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1032 private void RemoveCategoryButtons()
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1033 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1034 this.Invoke(new MethodInvoker(catToolStrip.Items.Clear));
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1035 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1036
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1037 private void AddCategoryButtons(Category[] cats)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1038 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1039 int catCount = cats.Length;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1040 Category cat;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1041 IBBToolStripButton[] categoryButtons = new IBBToolStripButton[catCount];
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1042
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1043 for (int i = 0; i < catCount; i++)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1044 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1045 cat = cats[i];
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1046 IBBToolStripButton button = new IBBToolStripButton();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1047 button.Text = cat.Name;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1048 button.Tag = cat;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1049 button.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.list_add;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1050 button.Enabled = false;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1051 button.Click += new EventHandler(CreateUnitForCategoryButtonClick);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1052 categoryButtons[i] = button;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1053 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1054
146
5d9d4c75305f Fixes #250: New panels don't work perfectly in Linux through Mono
IBBoard <dev@ibboard.co.uk>
parents: 144
diff changeset
1055 this.Invoke(new ArrayMethodInvoker<IBBToolStripButton>(AddCatToolStripButtons), new object[] { categoryButtons });
5d9d4c75305f Fixes #250: New panels don't work perfectly in Linux through Mono
IBBoard <dev@ibboard.co.uk>
parents: 144
diff changeset
1056 }
5d9d4c75305f Fixes #250: New panels don't work perfectly in Linux through Mono
IBBoard <dev@ibboard.co.uk>
parents: 144
diff changeset
1057
5d9d4c75305f Fixes #250: New panels don't work perfectly in Linux through Mono
IBBoard <dev@ibboard.co.uk>
parents: 144
diff changeset
1058 private void AddCatToolStripButtons(IBBToolStripButton[] buttons)
5d9d4c75305f Fixes #250: New panels don't work perfectly in Linux through Mono
IBBoard <dev@ibboard.co.uk>
parents: 144
diff changeset
1059 {
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1060 log.Debug("Toolstrip width: " + catToolStrip.Width);
146
5d9d4c75305f Fixes #250: New panels don't work perfectly in Linux through Mono
IBBoard <dev@ibboard.co.uk>
parents: 144
diff changeset
1061 catToolStrip.Items.AddRange(buttons);
5d9d4c75305f Fixes #250: New panels don't work perfectly in Linux through Mono
IBBoard <dev@ibboard.co.uk>
parents: 144
diff changeset
1062 catToolStrip.Refresh();
5d9d4c75305f Fixes #250: New panels don't work perfectly in Linux through Mono
IBBoard <dev@ibboard.co.uk>
parents: 144
diff changeset
1063 int buttonWidths = 0;
5d9d4c75305f Fixes #250: New panels don't work perfectly in Linux through Mono
IBBoard <dev@ibboard.co.uk>
parents: 144
diff changeset
1064
5d9d4c75305f Fixes #250: New panels don't work perfectly in Linux through Mono
IBBoard <dev@ibboard.co.uk>
parents: 144
diff changeset
1065 foreach (IBBToolStripButton button in buttons)
5d9d4c75305f Fixes #250: New panels don't work perfectly in Linux through Mono
IBBoard <dev@ibboard.co.uk>
parents: 144
diff changeset
1066 {
5d9d4c75305f Fixes #250: New panels don't work perfectly in Linux through Mono
IBBoard <dev@ibboard.co.uk>
parents: 144
diff changeset
1067 buttonWidths += button.Width;
5d9d4c75305f Fixes #250: New panels don't work perfectly in Linux through Mono
IBBoard <dev@ibboard.co.uk>
parents: 144
diff changeset
1068 }
5d9d4c75305f Fixes #250: New panels don't work perfectly in Linux through Mono
IBBoard <dev@ibboard.co.uk>
parents: 144
diff changeset
1069 catToolStrip.Width = buttonWidths;
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1070 log.Debug("Button widths: " + buttonWidths);
146
5d9d4c75305f Fixes #250: New panels don't work perfectly in Linux through Mono
IBBoard <dev@ibboard.co.uk>
parents: 144
diff changeset
1071 log.Debug("Toolstrip width: " + catToolStrip.Width);
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1072 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1073
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1074 private void CreateUnitForCategoryButtonClick(object sender, EventArgs e)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1075 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1076 if (sender is IBBToolStripButton)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1077 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1078 IBBToolStripButton button = (IBBToolStripButton)sender;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1079 object tag = button.Tag;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1080
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1081 if (tag is Category)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1082 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1083 AddUnitFromCategory((Category)tag);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1084 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1085 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1086 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1087
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1088 private void EnableCategoryButtons()
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1089 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1090 catToolStrip.Visible = true;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1091 SetCategoryButtonState(true);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1092 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1093
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1094 private void DisableCategoryButtons()
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1095 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1096 catToolStrip.Visible = false;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1097 SetCategoryButtonState(false);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1098 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1099
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1100 private void SetCategoryButtonState(bool state)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1101 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1102 foreach (IBBToolStripButton button in catToolStrip.Items)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1103 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1104 button.Enabled = state;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1105 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1106 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1107
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1108 private void miSaveArmyAs_Click(object sender, System.EventArgs e)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1109 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1110 SaveCurrentArmyAs();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1111 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1112
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1113 private void commandStack_CommandStackUpdated()
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1114 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1115 bttnUndo.Enabled = commandStack.CanUndo();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1116 miUndo.Enabled = bttnUndo.Enabled;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1117 bttnRedo.Enabled = commandStack.CanRedo();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1118 miRedo.Enabled = bttnRedo.Enabled;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1119
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1120 PopulateRedoMenu();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1121 PopulateUndoMenu();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1122
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1123 bttnSaveArmy.Enabled = commandStack.IsDirty() && CurrentArmy!=null;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1124 miSaveArmy.Enabled = commandStack.IsDirty() && CurrentArmy!=null;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1125 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1126
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1127 private void PopulateRedoMenu()
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1128 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1129 int redoLength = commandStack.RedoLength;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1130 int maxRedo = Math.Min(10, redoLength);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1131 ToolStripItemCollection dropDownItems = bttnRedo.DropDownItems;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1132 dropDownItems.Clear();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1133
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1134 for (int i = 1; i <= maxRedo; i++)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1135 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1136 Command cmd = commandStack.PeekRedoCommand(i);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1137
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1138 if (cmd == null)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1139 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1140 break;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1141 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1143 dropDownItems.Add(cmd.Description, null, redoMenu_Click);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1144 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1145
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1146 if (redoLength > 0)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1147 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1148 bttnRedo.Text = commandStack.PeekRedoCommand(1).Description;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1149 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1150 else
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1151 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1152 bttnRedo.Text = Translation.GetTranslation("bttnRedo");
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1153 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1154 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1155
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1156 private void PopulateUndoMenu()
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1157 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1158 int undoLength = commandStack.UndoLength;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1159 int maxUndo = Math.Min(10, undoLength);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1160 ToolStripItemCollection dropDownItems = bttnUndo.DropDownItems;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1161 dropDownItems.Clear();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1162
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1163 for (int i = 1; i <= maxUndo; i++)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1164 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1165 Command cmd = commandStack.PeekUndoCommand(i);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1166
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1167 if (cmd == null)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1168 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1169 break;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1170 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1171
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1172 dropDownItems.Add(cmd.UndoDescription, null, undoMenu_Click);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1173 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1174
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1175 if (undoLength > 0)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1176 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1177 bttnUndo.Text = commandStack.PeekUndoCommand(1).UndoDescription;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1178 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1179 else
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1180 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1181 bttnUndo.Text = Translation.GetTranslation("bttnUndo");
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1182 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1183 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1184
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1185 private void miSaveArmy_Click(object sender, System.EventArgs e)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1186 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1187 SaveCurrentArmy();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1188 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1189
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1190 private void SetAppTitle()
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1191 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1192 string str = AppTitle;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1193
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1194 if (CurrentGameSystem!=null)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1195 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1196 str+= " - "+CurrentGameSystem.Name;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1197 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1198
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1199 if (CurrentArmy!=null)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1200 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1201 str+= " - "+CurrentArmy.Name;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1202 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1203
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1204 this.Text = str;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1205 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1206
234
c06d0865ff27 Fixes #388: Add "Add unit" options to army tree
IBBoard <dev@ibboard.co.uk>
parents: 222
diff changeset
1207 internal void AddUnitFromCategory(Category cat)
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1208 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1209 FrmNewUnit newUnit = new FrmNewUnit(CurrentArmy.Race, cat, CurrentArmy);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1210 DialogResult dr = newUnit.ShowDialog(this);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1211
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1212 if (dr == DialogResult.OK)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1213 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1214 CreateAndAddUnitCommand cmd = new CreateAndAddUnitCommand(newUnit.SelectedUnit, CurrentArmy.GetCategory(cat));
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1215 commandStack.Execute(cmd);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1216 OpenUnitDialog(cmd.Unit);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1217 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1218 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1219
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1220 internal void OpenUnitDialog(Unit unit)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1221 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1222 string unitID = unit.ID;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1223
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1224 if (unitWindows.ContainsKey(unitID))
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1225 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1226 unitWindows[unitID].Focus();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1227 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1228 else
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1229 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1230 FrmUnit unitForm = new FrmUnit(unit, commandStack);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1231 unitWindows.Add(unitID, unitForm);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1232 unitForm.MdiParent = this;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1233 unitForm.Closing += new CancelEventHandler(unitForm_Closing);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1234 unitForm.Show();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1235 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1236 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1237
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1238 private void unitForm_Closing(object sender, CancelEventArgs e)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1239 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1240 if (sender is FrmUnit)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1241 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1242 FrmUnit unitForm = (FrmUnit) sender;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1243 unitWindows.Remove(unitForm.Unit.ID);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1244 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1245 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1246
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1247 private void FrmMain_UnitAddedMethod(object unitObj)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1248 {
196
15148d255e50 * First stab at displaying new unit requirements
IBBoard <dev@ibboard.co.uk>
parents: 195
diff changeset
1249 ValidateArmy();
15148d255e50 * First stab at displaying new unit requirements
IBBoard <dev@ibboard.co.uk>
parents: 195
diff changeset
1250 }
15148d255e50 * First stab at displaying new unit requirements
IBBoard <dev@ibboard.co.uk>
parents: 195
diff changeset
1251
15148d255e50 * First stab at displaying new unit requirements
IBBoard <dev@ibboard.co.uk>
parents: 195
diff changeset
1252 private void ValidateArmy()
15148d255e50 * First stab at displaying new unit requirements
IBBoard <dev@ibboard.co.uk>
parents: 195
diff changeset
1253 {
197
10ba2c5340b2 Re #343: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents: 196
diff changeset
1254 ICollection<string> failureMessages;
237
ea5cb50ebe5e Fixes #384: Validation warnings don't get cleared when creating new armies
IBBoard <dev@ibboard.co.uk>
parents: 234
diff changeset
1255 if (CurrentArmy == null || Validates.AsOkay(RequirementHandler.ValidateArmy(CurrentArmy, out failureMessages)))
196
15148d255e50 * First stab at displaying new unit requirements
IBBoard <dev@ibboard.co.uk>
parents: 195
diff changeset
1256 {
15148d255e50 * First stab at displaying new unit requirements
IBBoard <dev@ibboard.co.uk>
parents: 195
diff changeset
1257 sbErrorPanel.Text = "";
15148d255e50 * First stab at displaying new unit requirements
IBBoard <dev@ibboard.co.uk>
parents: 195
diff changeset
1258 sbErrorPanel.Tag = "";
15148d255e50 * First stab at displaying new unit requirements
IBBoard <dev@ibboard.co.uk>
parents: 195
diff changeset
1259 }
15148d255e50 * First stab at displaying new unit requirements
IBBoard <dev@ibboard.co.uk>
parents: 195
diff changeset
1260 else
15148d255e50 * First stab at displaying new unit requirements
IBBoard <dev@ibboard.co.uk>
parents: 195
diff changeset
1261 {
197
10ba2c5340b2 Re #343: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents: 196
diff changeset
1262 sbErrorPanel.Text = failureMessages.Count + " validation errors";
10ba2c5340b2 Re #343: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents: 196
diff changeset
1263 sbErrorPanel.Tag = String.Join("\n", new List<string>(failureMessages).ToArray());
196
15148d255e50 * First stab at displaying new unit requirements
IBBoard <dev@ibboard.co.uk>
parents: 195
diff changeset
1264 }
15148d255e50 * First stab at displaying new unit requirements
IBBoard <dev@ibboard.co.uk>
parents: 195
diff changeset
1265 }
15148d255e50 * First stab at displaying new unit requirements
IBBoard <dev@ibboard.co.uk>
parents: 195
diff changeset
1266
15148d255e50 * First stab at displaying new unit requirements
IBBoard <dev@ibboard.co.uk>
parents: 195
diff changeset
1267 private void FrmMain_UnitRemovedMethod(object unitObj)
15148d255e50 * First stab at displaying new unit requirements
IBBoard <dev@ibboard.co.uk>
parents: 195
diff changeset
1268 {
15148d255e50 * First stab at displaying new unit requirements
IBBoard <dev@ibboard.co.uk>
parents: 195
diff changeset
1269 ValidateArmy();
15148d255e50 * First stab at displaying new unit requirements
IBBoard <dev@ibboard.co.uk>
parents: 195
diff changeset
1270
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1271 if (unitObj is Unit)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1272 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1273 Unit unit = (Unit)unitObj;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1274
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1275 //check if window is open, and close it if it is
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1276 foreach (Form frm in this.MdiChildren)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1277 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1278 if (frm is FrmUnit)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1279 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1280 if (((FrmUnit)frm).Unit == unit)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1281 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1282 frm.Close();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1283 break;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1284 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1285 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1286 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1287 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1288 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1289
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1290 private void miUndo_Click(object sender, System.EventArgs e)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1291 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1292 UndoLastAction();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1293 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1294
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1295 private void miRedo_Click(object sender, System.EventArgs e)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1296 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1297 RedoAction();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1298 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1299
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1300 private void miCloseArmy_Click(object sender, EventArgs e)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1301 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1302 CloseCurrentArmy();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1303 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1304
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1305 private void miOpenArmy_Click(object sender, EventArgs e)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1306 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1307 OpenArmy();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1308 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1309
222
4ada3252d1ea Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 221
diff changeset
1310 private void FrmMain_ArmyNameChangedMethod(WarFoundryObject obj, string oldString, string newString)
4ada3252d1ea Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 221
diff changeset
1311 {
4ada3252d1ea Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 221
diff changeset
1312 SetAppTitle();
4ada3252d1ea Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 221
diff changeset
1313 }
4ada3252d1ea Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 221
diff changeset
1314
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1315 private void FrmMain_PointsValueChangedMethod(WarFoundryObject obj, double oldVal, double newVal)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1316 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1317 if (obj is Army)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1318 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1319 SetPointsPanelText();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1320 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1321 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1322
222
4ada3252d1ea Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 221
diff changeset
1323 private void FrmMain_MaxPointsValueChangedMethod(WarFoundryObject obj, int oldVal, int newVal)
4ada3252d1ea Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 221
diff changeset
1324 {
4ada3252d1ea Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 221
diff changeset
1325 if (obj is Army)
4ada3252d1ea Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 221
diff changeset
1326 {
4ada3252d1ea Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 221
diff changeset
1327 SetPointsPanelText();
4ada3252d1ea Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 221
diff changeset
1328 }
4ada3252d1ea Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 221
diff changeset
1329 }
4ada3252d1ea Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 221
diff changeset
1330
190
1ca23c47345a Re #327: Point names used in the GUI
snowblizz
parents: 183
diff changeset
1331 private void SetPointsPanelText()
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1332 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1333 if (CurrentArmy==null)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1334 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1335 sbPointsPanel.Text = "";
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1336 sbPointsPanel.ResetColor();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1337 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1338 else
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1339 {
193
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 191
diff changeset
1340 string pointsPanelText = String.Format(Translation.GetTranslation("statusPanelPoints"), CurrentArmy.Points, CurrentGameSystem.GetPointsName(CurrentArmy.Points), CurrentArmy.MaxPoints, CurrentGameSystem.GetPointsName(CurrentArmy.MaxPoints));
190
1ca23c47345a Re #327: Point names used in the GUI
snowblizz
parents: 183
diff changeset
1341 sbPointsPanel.Text = pointsPanelText;
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1342
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1343 if (CurrentArmy.Points>CurrentArmy.MaxPoints)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1344 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1345 sbPointsPanel.Color = Color.Red;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1346 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1347 else
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1348 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1349 sbPointsPanel.ResetColor();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1350 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1351 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1352 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1353
190
1ca23c47345a Re #327: Point names used in the GUI
snowblizz
parents: 183
diff changeset
1354 private void SetPointsPanelToolTipText()
1ca23c47345a Re #327: Point names used in the GUI
snowblizz
parents: 183
diff changeset
1355 {
1ca23c47345a Re #327: Point names used in the GUI
snowblizz
parents: 183
diff changeset
1356 sbPointsPanel.ToolTipText = Translation.GetTranslation("statusPanelPointsToolTip", "total points value");
1ca23c47345a Re #327: Point names used in the GUI
snowblizz
parents: 183
diff changeset
1357 }
1ca23c47345a Re #327: Point names used in the GUI
snowblizz
parents: 183
diff changeset
1358
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1359 private void redoMenu_Click(object sender, EventArgs e)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1360 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1361 if (sender is ToolStripDropDownItem)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1362 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1363 ToolStripDropDownItem item = (ToolStripDropDownItem)sender;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1364 //we know it's an redo menu item so find it's index and redo everything
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1365 int max = bttnRedo.DropDownItems.IndexOf(item);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1366
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1367 if (max >= 0)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1368 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1369 for (int i = 0; i <= max; i++)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1370 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1371 commandStack.Redo();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1372 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1373 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1374 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1375 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1376
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1377 private void undoMenu_Click(object sender, EventArgs e)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1378 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1379 if (sender is ToolStripDropDownItem)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1380 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1381 ToolStripDropDownItem item = (ToolStripDropDownItem)sender;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1382 //we know it's an redo menu item so find it's index and redo everything
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1383 int max = bttnUndo.DropDownItems.IndexOf(item);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1384
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1385 if (max >= 0)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1386 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1387 for (int i = 0; i <= max; i++)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1388 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1389 commandStack.Undo();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1390 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1391 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1392 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1393 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1394
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1395 private void statusBar_DrawItem(object sender, System.Windows.Forms.StatusBarDrawItemEventArgs sbdevent)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1396 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1397 statusBar.ColorableStatusBarDrawItem(sender, sbdevent);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1398 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1399
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1400 private void FrmMain_Closing(object sender, CancelEventArgs e)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1401 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1402 if (!CloseCurrentArmy())
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1403 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1404 e.Cancel = true;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1405 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1406 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1407
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1408 private void miReloadFiles_Click(object sender, System.EventArgs e)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1409 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1410 WarFoundryLoader.GetDefault().LoadFiles();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1411 sbMainPanel.Text = Translation.GetTranslation("GameSystemFilesReloaded", "Game system and race files reloaded");
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1412 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1413
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1414 private void statusBar_PanelClick(object sender, StatusBarPanelClickEventArgs e)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1415 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1416 if (e.StatusBarPanel == sbErrorPanel && sbErrorPanel.Text!="")
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1417 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1418 MessageBox.Show(this, sbErrorPanel.TagString, Translation.GetTranslation("FailedRequirementMessage"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1419 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1420 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1421
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1422 private void miExportArmyAsBasicHTML_Click(object sender, EventArgs e)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1423 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1424 SaveFileDialog dialog = new SaveFileDialog();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1425 dialog.Filter = Translation.GetTranslation("armyExportBasicHtmlFilter", "HTML pages") + "|*.html";
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1426 dialog.Title = Translation.GetTranslation("exportArmyDialog", "Export army");
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1427
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1428 DialogResult dr = dialog.ShowDialog(this);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1429
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1430 if (dr == DialogResult.OK)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1431 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1432 Army army = CurrentArmy;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1433 string filePath = dialog.FileName;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1434 log.DebugFormat("Exporting {0} to {1} as basic HTML", army.Name, filePath);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1435 WarFoundryHtmlExporter.GetDefault().ExportArmy(army, filePath);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1436 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1437 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1438
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1439 private void FrmMain_Load(object sender, EventArgs e)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1440 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1441 string gameSystemID = Preferences.GetStringProperty("currSystem");
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1442
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1443 if (gameSystemID != null && !"".Equals(gameSystemID))
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1444 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1445 log.Debug("Attempting to load current game system from properties");
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1446 GameSystem sys = WarFoundryLoader.GetDefault().GetGameSystem(gameSystemID);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1447
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1448 if (sys != null)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1449 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1450 WarFoundryCore.CurrentGameSystem = sys;
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1451 log.InfoFormat("Loaded game system {0} from properties", gameSystemID);
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1452 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1453 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1454 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1455
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1456 private void miAbout_Click(object sender, EventArgs e)
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1457 {
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1458 FrmAbout about = new FrmAbout();
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1459 about.ShowDialog(this);
140
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
1460 }
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
1461
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
1462 private void miPreferences_Click(object sender, EventArgs e)
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
1463 {
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
1464 FrmPreferences prefsForm = new FrmPreferences(Preferences);
60c795eca8de Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents: 137
diff changeset
1465 prefsForm.Show(this);
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1466 }
207
ac5f87626abd Basic XML translations
Dan.Kulinski@dank-laptop.Global.Local
parents: 197
diff changeset
1467
217
c47094612bac Re #355: Add XML export format that can be transformed with an XSL
IBBoard <dev@ibboard.co.uk>
parents: 214
diff changeset
1468 private void miExportArmyAsBasicXml_Click(object sender, EventArgs e)
c47094612bac Re #355: Add XML export format that can be transformed with an XSL
IBBoard <dev@ibboard.co.uk>
parents: 214
diff changeset
1469 {
c47094612bac Re #355: Add XML export format that can be transformed with an XSL
IBBoard <dev@ibboard.co.uk>
parents: 214
diff changeset
1470 Form xmlOutput = new FrmXmlExport(CurrentArmy);
c47094612bac Re #355: Add XML export format that can be transformed with an XSL
IBBoard <dev@ibboard.co.uk>
parents: 214
diff changeset
1471 xmlOutput.ShowDialog(this);
c47094612bac Re #355: Add XML export format that can be transformed with an XSL
IBBoard <dev@ibboard.co.uk>
parents: 214
diff changeset
1472 }
221
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
1473
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
1474 private void miEditArmy_Click(object sender, EventArgs e)
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
1475 {
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
1476 FrmEditArmy editArmy = new FrmEditArmy(commandStack, CurrentArmy);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
1477 editArmy.ShowDialog(this);
5233147ca7e4 Re #101: Make army names and sizes modifiable after creation
IBBoard <dev@ibboard.co.uk>
parents: 217
diff changeset
1478 }
142
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1479 }
e0af96397e26 Re #203: Translate WarFoundry
IBBoard <dev@ibboard.co.uk>
parents: 140
diff changeset
1480 }