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