comparison FrmMain.cs @ 210:694f23814ec2

Re #354: Single-button Add Unit * Make the form translatable * Update FrmArmyTree so it doesn't look out of place (ContextMenuStrip and update the icons) * Add "change selection on right-click" code to solve calculation issues * Hide categories that don't have entries (assume they're not relevant to that race) Also: * Clean up code and replace space indents with tabs
author IBBoard <dev@ibboard.co.uk>
date Sat, 20 Aug 2011 20:58:16 +0100
parents 19a88383dfa7
children
comparison
equal deleted inserted replaced
209:a11faa64c333 210:694f23814ec2
38 /// </summary> 38 /// </summary>
39 public class FrmMain : System.Windows.Forms.Form 39 public class FrmMain : System.Windows.Forms.Form
40 { 40 {
41 private static readonly string AppTitle = "WarFoundry"; 41 private static readonly string AppTitle = "WarFoundry";
42 internal static readonly string VERSION = "0.1"; 42 internal static readonly string VERSION = "0.1";
43 const string DefaultDataDir = "data"; 43 const string DefaultDataDir = "data";
44 /* public static string pointsAbbrevSingle; 44 /* public static string pointsAbbrevSingle;
45 public static string pointsAbbrevPlural; 45 public static string pointsAbbrevPlural;
46 public static string pointsAbbreviation; 46 public static string pointsAbbreviation;
47 public static string pointsNameSingle; 47 public static string pointsNameSingle;
48 public static string pointsNamePlural; 48 public static string pointsNamePlural;
49 public static string pointsName;*/ 49 public static string pointsName;*/
50 50
51 private Preferences preferences; 51 private Preferences preferences;
52 private readonly ILog log = LogManager.GetLogger(typeof(FrmMain)); 52 private readonly ILog log = LogManager.GetLogger(typeof(FrmMain));
53 53
54 private CommandStack commandStack; 54 private CommandStack commandStack;
57 public ObjectRemoveDelegate UnitRemovedMethod; 57 public ObjectRemoveDelegate UnitRemovedMethod;
58 public DoubleValChangedDelegate PointsValueChangedMethod; 58 public DoubleValChangedDelegate PointsValueChangedMethod;
59 //public FailedUnitRequirementDelegate FailedUnitRequirementMethod; 59 //public FailedUnitRequirementDelegate FailedUnitRequirementMethod;
60 60
61 private FrmArmyTree armyTree; 61 private FrmArmyTree armyTree;
62 private FrmNewUnitFromTree newUnitTree; 62 private FrmNewUnitFromTree newUnitTree;
63 private string loadedFilePath; 63 private string loadedFilePath;
64 private Dictionary<string, FrmUnit> unitWindows; 64 private Dictionary<string, FrmUnit> unitWindows;
65 65
66 private System.ComponentModel.IContainer components; 66 private System.ComponentModel.IContainer components;
67 private System.Windows.Forms.OpenFileDialog openArmyDialog; 67 private System.Windows.Forms.OpenFileDialog openArmyDialog;
70 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbMainPanel; 70 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbMainPanel;
71 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbErrorPanel; 71 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbErrorPanel;
72 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbPointsPanel; 72 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbPointsPanel;
73 private System.Windows.Forms.ContextMenu undoMenu; 73 private System.Windows.Forms.ContextMenu undoMenu;
74 private System.Windows.Forms.ContextMenu redoMenu; 74 private System.Windows.Forms.ContextMenu redoMenu;
75 private IBBoard.Windows.Forms.ColorableStatusBar statusBar; 75 private IBBoard.Windows.Forms.ColorableStatusBar statusBar;
76 private MenuStrip menuStrip; 76 private MenuStrip menuStrip;
77 private IBBToolStripMenuItem menuFile; 77 private IBBToolStripMenuItem menuFile;
78 private IBBToolStripMenuItem miNewArmy; 78 private IBBToolStripMenuItem miNewArmy;
79 private IBBToolStripMenuItem miOpenArmy; 79 private IBBToolStripMenuItem miOpenArmy;
80 private IBBToolStripMenuItem miSaveArmy; 80 private IBBToolStripMenuItem miSaveArmy;
154 UnitAddedMethod = new ObjectAddDelegate(FrmMain_UnitAddedMethod); 154 UnitAddedMethod = new ObjectAddDelegate(FrmMain_UnitAddedMethod);
155 UnitRemovedMethod = new ObjectRemoveDelegate(FrmMain_UnitRemovedMethod); 155 UnitRemovedMethod = new ObjectRemoveDelegate(FrmMain_UnitRemovedMethod);
156 PointsValueChangedMethod = new DoubleValChangedDelegate(FrmMain_PointsValueChangedMethod); 156 PointsValueChangedMethod = new DoubleValChangedDelegate(FrmMain_PointsValueChangedMethod);
157 //FailedUnitRequirementMethod = new FailedUnitRequirementDelegate(FrmMain_FailedUnitRequirement); 157 //FailedUnitRequirementMethod = new FailedUnitRequirementDelegate(FrmMain_FailedUnitRequirement);
158 158
159 159
160 sbErrorPanel.Color = Color.Red; 160 sbErrorPanel.Color = Color.Red;
161 SetPointsPanelToolTipText(); 161 SetPointsPanelToolTipText();
162 162
163 // hack to load default files 163 // hack to load default files
164 WarFoundryLoader.GetDefault().AddLoadDirectory(new DirectoryInfo(Constants.ExecutablePath + Constants.DirectoryString + DefaultDataDir)); 164 WarFoundryLoader.GetDefault().AddLoadDirectory(new DirectoryInfo(Constants.ExecutablePath + Constants.DirectoryString + DefaultDataDir));
183 armyTree.MdiParent = this; 183 armyTree.MdiParent = this;
184 armyTree.StartPosition = FormStartPosition.Manual; 184 armyTree.StartPosition = FormStartPosition.Manual;
185 armyTree.Location = new Point(this.DisplayRectangle.Width - armyTree.Width - 10, 10); 185 armyTree.Location = new Point(this.DisplayRectangle.Width - armyTree.Width - 10, 10);
186 } 186 }
187 187
188 private FrmNewUnitFromTree GetNewUnitTree() 188 private FrmNewUnitFromTree GetNewUnitTree()
189 { 189 {
190 if (newUnitTree == null || newUnitTree.IsDisposed) 190 if (newUnitTree == null || newUnitTree.IsDisposed)
191 { 191 {
192 CreateNewUnitTree(); 192 CreateNewUnitTree();
193 } 193 }
194 194
195 return newUnitTree; 195 return newUnitTree;
196 } 196 }
197 197
198 private void CreateNewUnitTree() 198 private void CreateNewUnitTree()
199 { 199 {
200 newUnitTree = new FrmNewUnitFromTree(); 200 newUnitTree = new FrmNewUnitFromTree();
201 newUnitTree.MdiParent = this; 201 newUnitTree.MdiParent = this;
202 newUnitTree.StartPosition = FormStartPosition.Manual; 202 newUnitTree.StartPosition = FormStartPosition.Manual;
203 newUnitTree.Location = new Point(10, 10); 203 newUnitTree.Location = new Point(10, 10);
204 } 204 }
205 205
206 private void TranslateControls() 206 private void TranslateControls()
207 { 207 {
208 ControlTranslator.TranslateControls(Controls); 208 ControlTranslator.TranslateControls(Controls);
209 ControlTranslator.TranslateComponents(components.Components); 209 ControlTranslator.TranslateComponents(components.Components);
210 ControlTranslator.TranslateComponent(openArmyDialog); 210 ControlTranslator.TranslateComponent(openArmyDialog);
211 ControlTranslator.TranslateComponent(saveArmyDialog); 211 ControlTranslator.TranslateComponent(saveArmyDialog);
212 //translate pointspanel and tooltip 212 //translate pointspanel and tooltip
213 SetPointsPanelToolTipText(); 213 SetPointsPanelToolTipText();
214 SetPointsPanelText(); 214 SetPointsPanelText();
215 } 215 }
216 216
217 void TranslationChanged() 217 void TranslationChanged()
218 { 218 {
219 TranslateControls(); 219 TranslateControls();
220 } 220 }
268 /// Required method for Designer support - do not modify 268 /// Required method for Designer support - do not modify
269 /// the contents of this method with the code editor. 269 /// the contents of this method with the code editor.
270 /// </summary> 270 /// </summary>
271 private void InitializeComponent() 271 private void InitializeComponent()
272 { 272 {
273 this.components = new System.ComponentModel.Container(); 273 this.components = new System.ComponentModel.Container();
274 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain)); 274 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain));
275 this.undoMenu = new System.Windows.Forms.ContextMenu(); 275 this.undoMenu = new System.Windows.Forms.ContextMenu();
276 this.redoMenu = new System.Windows.Forms.ContextMenu(); 276 this.redoMenu = new System.Windows.Forms.ContextMenu();
277 this.mainMenu = new System.Windows.Forms.MainMenu(this.components); 277 this.mainMenu = new System.Windows.Forms.MainMenu(this.components);
278 this.openArmyDialog = new System.Windows.Forms.OpenFileDialog(); 278 this.openArmyDialog = new System.Windows.Forms.OpenFileDialog();
279 this.saveArmyDialog = new System.Windows.Forms.SaveFileDialog(); 279 this.saveArmyDialog = new System.Windows.Forms.SaveFileDialog();
280 this.menuStrip = new System.Windows.Forms.MenuStrip(); 280 this.menuStrip = new System.Windows.Forms.MenuStrip();
281 this.menuFile = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); 281 this.menuFile = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
282 this.miNewArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); 282 this.miNewArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
283 this.miOpenArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); 283 this.miOpenArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
284 this.miSaveArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); 284 this.miSaveArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
285 this.miSaveArmyAs = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); 285 this.miSaveArmyAs = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
286 this.miExportArmyAs = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); 286 this.miExportArmyAs = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
287 this.miExportArmyAsBasicHTML = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); 287 this.miExportArmyAsBasicHTML = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
288 this.miCloseArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); 288 this.miCloseArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
289 this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); 289 this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
290 this.miReloadFiles = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); 290 this.miReloadFiles = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
291 this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); 291 this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
292 this.miExit = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); 292 this.miExit = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
293 this.menuEdit = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); 293 this.menuEdit = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
294 this.miUndo = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); 294 this.miUndo = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
295 this.miRedo = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); 295 this.miRedo = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
296 this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); 296 this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
297 this.miPreferences = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); 297 this.miPreferences = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
298 this.menuHelp = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); 298 this.menuHelp = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
299 this.miAbout = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); 299 this.miAbout = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
300 this.mainToolStrip = new System.Windows.Forms.ToolStrip(); 300 this.mainToolStrip = new System.Windows.Forms.ToolStrip();
301 this.bttnNewArmy = new IBBoard.Windows.Forms.IBBToolStripButton(); 301 this.bttnNewArmy = new IBBoard.Windows.Forms.IBBToolStripButton();
302 this.bttnOpenArmy = new IBBoard.Windows.Forms.IBBToolStripButton(); 302 this.bttnOpenArmy = new IBBoard.Windows.Forms.IBBToolStripButton();
303 this.bttnSaveArmy = new IBBoard.Windows.Forms.IBBToolStripButton(); 303 this.bttnSaveArmy = new IBBoard.Windows.Forms.IBBToolStripButton();
304 this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); 304 this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
305 this.bttnUndo = new IBBoard.Windows.Forms.IBBToolStripSplitButton(); 305 this.bttnUndo = new IBBoard.Windows.Forms.IBBToolStripSplitButton();
306 this.bttnRedo = new IBBoard.Windows.Forms.IBBToolStripSplitButton(); 306 this.bttnRedo = new IBBoard.Windows.Forms.IBBToolStripSplitButton();
307 this.catToolStrip = new System.Windows.Forms.ToolStrip(); 307 this.catToolStrip = new System.Windows.Forms.ToolStrip();
308 this.statusBar = new IBBoard.Windows.Forms.ColorableStatusBar(); 308 this.statusBar = new IBBoard.Windows.Forms.ColorableStatusBar();
309 this.sbMainPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel(); 309 this.sbMainPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel();
310 this.sbErrorPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel(); 310 this.sbErrorPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel();
311 this.sbPointsPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel(); 311 this.sbPointsPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel();
312 this.toolStripPanel = new System.Windows.Forms.ToolStripPanel(); 312 this.toolStripPanel = new System.Windows.Forms.ToolStripPanel();
313 this.menuStrip.SuspendLayout(); 313 this.menuStrip.SuspendLayout();
314 this.mainToolStrip.SuspendLayout(); 314 this.mainToolStrip.SuspendLayout();
315 ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).BeginInit(); 315 ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).BeginInit();
316 ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).BeginInit(); 316 ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).BeginInit();
317 ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).BeginInit(); 317 ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).BeginInit();
318 this.SuspendLayout(); 318 this.SuspendLayout();
319 // 319 //
320 // saveArmyDialog 320 // saveArmyDialog
321 // 321 //
322 this.saveArmyDialog.Title = "Translatable:saveArmyDialog"; 322 this.saveArmyDialog.Title = "Translatable:saveArmyDialog";
323 // 323 //
324 // menuStrip 324 // menuStrip
325 // 325 //
326 this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 326 this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
327 this.menuFile, 327 this.menuFile,
328 this.menuEdit, 328 this.menuEdit,
329 this.menuHelp}); 329 this.menuHelp});
330 this.menuStrip.Location = new System.Drawing.Point(0, 0); 330 this.menuStrip.Location = new System.Drawing.Point(0, 0);
331 this.menuStrip.Name = "menuStrip"; 331 this.menuStrip.Name = "menuStrip";
332 this.menuStrip.Size = new System.Drawing.Size(790, 24); 332 this.menuStrip.Size = new System.Drawing.Size(790, 24);
333 this.menuStrip.TabIndex = 6; 333 this.menuStrip.TabIndex = 6;
334 this.menuStrip.Text = "menuStrip1"; 334 this.menuStrip.Text = "menuStrip1";
335 // 335 //
336 // menuFile 336 // menuFile
337 // 337 //
338 this.menuFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { 338 this.menuFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
339 this.miNewArmy, 339 this.miNewArmy,
340 this.miOpenArmy, 340 this.miOpenArmy,
341 this.miSaveArmy, 341 this.miSaveArmy,
342 this.miSaveArmyAs, 342 this.miSaveArmyAs,
343 this.miExportArmyAs, 343 this.miExportArmyAs,
344 this.miCloseArmy, 344 this.miCloseArmy,
345 this.toolStripSeparator1, 345 this.toolStripSeparator1,
346 this.miReloadFiles, 346 this.miReloadFiles,
347 this.toolStripSeparator2, 347 this.toolStripSeparator2,
348 this.miExit}); 348 this.miExit});
349 this.menuFile.Name = "menuFile"; 349 this.menuFile.Name = "menuFile";
350 this.menuFile.Size = new System.Drawing.Size(33, 20); 350 this.menuFile.Size = new System.Drawing.Size(33, 20);
351 this.menuFile.Text = "&file"; 351 this.menuFile.Text = "&file";
352 // 352 //
353 // miNewArmy 353 // miNewArmy
354 // 354 //
355 this.miNewArmy.Name = "miNewArmy"; 355 this.miNewArmy.Name = "miNewArmy";
356 this.miNewArmy.Size = new System.Drawing.Size(164, 22); 356 this.miNewArmy.Size = new System.Drawing.Size(164, 22);
357 this.miNewArmy.Text = "&new army"; 357 this.miNewArmy.Text = "&new army";
358 this.miNewArmy.Click += new System.EventHandler(this.miNewArmy_Click); 358 this.miNewArmy.Click += new System.EventHandler(this.miNewArmy_Click);
359 // 359 //
360 // miOpenArmy 360 // miOpenArmy
361 // 361 //
362 this.miOpenArmy.Name = "miOpenArmy"; 362 this.miOpenArmy.Name = "miOpenArmy";
363 this.miOpenArmy.Size = new System.Drawing.Size(164, 22); 363 this.miOpenArmy.Size = new System.Drawing.Size(164, 22);
364 this.miOpenArmy.Text = "&open army"; 364 this.miOpenArmy.Text = "&open army";
365 this.miOpenArmy.Click += new System.EventHandler(this.miOpenArmy_Click); 365 this.miOpenArmy.Click += new System.EventHandler(this.miOpenArmy_Click);
366 // 366 //
367 // miSaveArmy 367 // miSaveArmy
368 // 368 //
369 this.miSaveArmy.Enabled = false; 369 this.miSaveArmy.Enabled = false;
370 this.miSaveArmy.Name = "miSaveArmy"; 370 this.miSaveArmy.Name = "miSaveArmy";
371 this.miSaveArmy.Size = new System.Drawing.Size(164, 22); 371 this.miSaveArmy.Size = new System.Drawing.Size(164, 22);
372 this.miSaveArmy.Text = "&save army"; 372 this.miSaveArmy.Text = "&save army";
373 this.miSaveArmy.Click += new System.EventHandler(this.miSaveArmy_Click); 373 this.miSaveArmy.Click += new System.EventHandler(this.miSaveArmy_Click);
374 // 374 //
375 // miSaveArmyAs 375 // miSaveArmyAs
376 // 376 //
377 this.miSaveArmyAs.Enabled = false; 377 this.miSaveArmyAs.Enabled = false;
378 this.miSaveArmyAs.Name = "miSaveArmyAs"; 378 this.miSaveArmyAs.Name = "miSaveArmyAs";
379 this.miSaveArmyAs.Size = new System.Drawing.Size(164, 22); 379 this.miSaveArmyAs.Size = new System.Drawing.Size(164, 22);
380 this.miSaveArmyAs.Text = "save army &as..."; 380 this.miSaveArmyAs.Text = "save army &as...";
381 this.miSaveArmyAs.Click += new System.EventHandler(this.miSaveArmyAs_Click); 381 this.miSaveArmyAs.Click += new System.EventHandler(this.miSaveArmyAs_Click);
382 // 382 //
383 // miExportArmyAs 383 // miExportArmyAs
384 // 384 //
385 this.miExportArmyAs.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { 385 this.miExportArmyAs.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
386 this.miExportArmyAsBasicHTML}); 386 this.miExportArmyAsBasicHTML});
387 this.miExportArmyAs.Enabled = false; 387 this.miExportArmyAs.Enabled = false;
388 this.miExportArmyAs.Name = "miExportArmyAs"; 388 this.miExportArmyAs.Name = "miExportArmyAs";
389 this.miExportArmyAs.Size = new System.Drawing.Size(164, 22); 389 this.miExportArmyAs.Size = new System.Drawing.Size(164, 22);
390 this.miExportArmyAs.Text = "export army as..."; 390 this.miExportArmyAs.Text = "export army as...";
391 // 391 //
392 // miExportArmyAsBasicHTML 392 // miExportArmyAsBasicHTML
393 // 393 //
394 this.miExportArmyAsBasicHTML.Name = "miExportArmyAsBasicHTML"; 394 this.miExportArmyAsBasicHTML.Name = "miExportArmyAsBasicHTML";
395 this.miExportArmyAsBasicHTML.Size = new System.Drawing.Size(130, 22); 395 this.miExportArmyAsBasicHTML.Size = new System.Drawing.Size(130, 22);
396 this.miExportArmyAsBasicHTML.Text = "&basic html"; 396 this.miExportArmyAsBasicHTML.Text = "&basic html";
397 this.miExportArmyAsBasicHTML.Click += new System.EventHandler(this.miExportArmyAsBasicHTML_Click); 397 this.miExportArmyAsBasicHTML.Click += new System.EventHandler(this.miExportArmyAsBasicHTML_Click);
398 // 398 //
399 // miCloseArmy 399 // miCloseArmy
400 // 400 //
401 this.miCloseArmy.Enabled = false; 401 this.miCloseArmy.Enabled = false;
402 this.miCloseArmy.Name = "miCloseArmy"; 402 this.miCloseArmy.Name = "miCloseArmy";
403 this.miCloseArmy.Size = new System.Drawing.Size(164, 22); 403 this.miCloseArmy.Size = new System.Drawing.Size(164, 22);
404 this.miCloseArmy.Text = "&close army"; 404 this.miCloseArmy.Text = "&close army";
405 this.miCloseArmy.Click += new System.EventHandler(this.miCloseArmy_Click); 405 this.miCloseArmy.Click += new System.EventHandler(this.miCloseArmy_Click);
406 // 406 //
407 // toolStripSeparator1 407 // toolStripSeparator1
408 // 408 //
409 this.toolStripSeparator1.Name = "toolStripSeparator1"; 409 this.toolStripSeparator1.Name = "toolStripSeparator1";
410 this.toolStripSeparator1.Size = new System.Drawing.Size(161, 6); 410 this.toolStripSeparator1.Size = new System.Drawing.Size(161, 6);
411 // 411 //
412 // miReloadFiles 412 // miReloadFiles
413 // 413 //
414 this.miReloadFiles.Name = "miReloadFiles"; 414 this.miReloadFiles.Name = "miReloadFiles";
415 this.miReloadFiles.Size = new System.Drawing.Size(164, 22); 415 this.miReloadFiles.Size = new System.Drawing.Size(164, 22);
416 this.miReloadFiles.Text = "&reload files"; 416 this.miReloadFiles.Text = "&reload files";
417 this.miReloadFiles.Click += new System.EventHandler(this.miReloadFiles_Click); 417 this.miReloadFiles.Click += new System.EventHandler(this.miReloadFiles_Click);
418 // 418 //
419 // toolStripSeparator2 419 // toolStripSeparator2
420 // 420 //
421 this.toolStripSeparator2.Name = "toolStripSeparator2"; 421 this.toolStripSeparator2.Name = "toolStripSeparator2";
422 this.toolStripSeparator2.Size = new System.Drawing.Size(161, 6); 422 this.toolStripSeparator2.Size = new System.Drawing.Size(161, 6);
423 // 423 //
424 // miExit 424 // miExit
425 // 425 //
426 this.miExit.Name = "miExit"; 426 this.miExit.Name = "miExit";
427 this.miExit.Size = new System.Drawing.Size(164, 22); 427 this.miExit.Size = new System.Drawing.Size(164, 22);
428 this.miExit.Text = "e&xit"; 428 this.miExit.Text = "e&xit";
429 this.miExit.Click += new System.EventHandler(this.miExit_Click); 429 this.miExit.Click += new System.EventHandler(this.miExit_Click);
430 // 430 //
431 // menuEdit 431 // menuEdit
432 // 432 //
433 this.menuEdit.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { 433 this.menuEdit.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
434 this.miUndo, 434 this.miUndo,
435 this.miRedo, 435 this.miRedo,
436 this.toolStripSeparator4, 436 this.toolStripSeparator4,
437 this.miPreferences}); 437 this.miPreferences});
438 this.menuEdit.Name = "menuEdit"; 438 this.menuEdit.Name = "menuEdit";
439 this.menuEdit.Size = new System.Drawing.Size(36, 20); 439 this.menuEdit.Size = new System.Drawing.Size(36, 20);
440 this.menuEdit.Text = "&edit"; 440 this.menuEdit.Text = "&edit";
441 // 441 //
442 // miUndo 442 // miUndo
443 // 443 //
444 this.miUndo.Enabled = false; 444 this.miUndo.Enabled = false;
445 this.miUndo.Name = "miUndo"; 445 this.miUndo.Name = "miUndo";
446 this.miUndo.Size = new System.Drawing.Size(142, 22); 446 this.miUndo.Size = new System.Drawing.Size(142, 22);
447 this.miUndo.Text = "&undo"; 447 this.miUndo.Text = "&undo";
448 this.miUndo.Click += new System.EventHandler(this.miUndo_Click); 448 this.miUndo.Click += new System.EventHandler(this.miUndo_Click);
449 // 449 //
450 // miRedo 450 // miRedo
451 // 451 //
452 this.miRedo.Enabled = false; 452 this.miRedo.Enabled = false;
453 this.miRedo.Name = "miRedo"; 453 this.miRedo.Name = "miRedo";
454 this.miRedo.Size = new System.Drawing.Size(142, 22); 454 this.miRedo.Size = new System.Drawing.Size(142, 22);
455 this.miRedo.Text = "&redo"; 455 this.miRedo.Text = "&redo";
456 this.miRedo.Click += new System.EventHandler(this.miRedo_Click); 456 this.miRedo.Click += new System.EventHandler(this.miRedo_Click);
457 // 457 //
458 // toolStripSeparator4 458 // toolStripSeparator4
459 // 459 //
460 this.toolStripSeparator4.Name = "toolStripSeparator4"; 460 this.toolStripSeparator4.Name = "toolStripSeparator4";
461 this.toolStripSeparator4.Size = new System.Drawing.Size(139, 6); 461 this.toolStripSeparator4.Size = new System.Drawing.Size(139, 6);
462 // 462 //
463 // miPreferences 463 // miPreferences
464 // 464 //
465 this.miPreferences.Name = "miPreferences"; 465 this.miPreferences.Name = "miPreferences";
466 this.miPreferences.Size = new System.Drawing.Size(142, 22); 466 this.miPreferences.Size = new System.Drawing.Size(142, 22);
467 this.miPreferences.Text = "&preferences"; 467 this.miPreferences.Text = "&preferences";
468 this.miPreferences.Click += new System.EventHandler(this.miPreferences_Click); 468 this.miPreferences.Click += new System.EventHandler(this.miPreferences_Click);
469 // 469 //
470 // menuHelp 470 // menuHelp
471 // 471 //
472 this.menuHelp.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { 472 this.menuHelp.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
473 this.miAbout}); 473 this.miAbout});
474 this.menuHelp.Name = "menuHelp"; 474 this.menuHelp.Name = "menuHelp";
475 this.menuHelp.Size = new System.Drawing.Size(39, 20); 475 this.menuHelp.Size = new System.Drawing.Size(39, 20);
476 this.menuHelp.Text = "&help"; 476 this.menuHelp.Text = "&help";
477 // 477 //
478 // miAbout 478 // miAbout
479 // 479 //
480 this.miAbout.Name = "miAbout"; 480 this.miAbout.Name = "miAbout";
481 this.miAbout.Size = new System.Drawing.Size(109, 22); 481 this.miAbout.Size = new System.Drawing.Size(109, 22);
482 this.miAbout.Text = "&about"; 482 this.miAbout.Text = "&about";
483 this.miAbout.Click += new System.EventHandler(this.miAbout_Click); 483 this.miAbout.Click += new System.EventHandler(this.miAbout_Click);
484 // 484 //
485 // mainToolStrip 485 // mainToolStrip
486 // 486 //
487 this.mainToolStrip.Dock = System.Windows.Forms.DockStyle.None; 487 this.mainToolStrip.Dock = System.Windows.Forms.DockStyle.None;
488 this.mainToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 488 this.mainToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
489 this.bttnNewArmy, 489 this.bttnNewArmy,
490 this.bttnOpenArmy, 490 this.bttnOpenArmy,
491 this.bttnSaveArmy, 491 this.bttnSaveArmy,
492 this.toolStripSeparator3, 492 this.toolStripSeparator3,
493 this.bttnUndo, 493 this.bttnUndo,
494 this.bttnRedo}); 494 this.bttnRedo});
495 this.mainToolStrip.Location = new System.Drawing.Point(0, 24); 495 this.mainToolStrip.Location = new System.Drawing.Point(0, 24);
496 this.mainToolStrip.Name = "mainToolStrip"; 496 this.mainToolStrip.Name = "mainToolStrip";
497 this.mainToolStrip.Size = new System.Drawing.Size(182, 25); 497 this.mainToolStrip.Size = new System.Drawing.Size(182, 25);
498 this.mainToolStrip.TabIndex = 8; 498 this.mainToolStrip.TabIndex = 8;
499 // 499 //
500 // bttnNewArmy 500 // bttnNewArmy
501 // 501 //
502 this.bttnNewArmy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; 502 this.bttnNewArmy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
503 this.bttnNewArmy.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.document_new; 503 this.bttnNewArmy.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.document_new;
504 this.bttnNewArmy.ImageTransparentColor = System.Drawing.Color.Magenta; 504 this.bttnNewArmy.ImageTransparentColor = System.Drawing.Color.Magenta;
505 this.bttnNewArmy.Name = "bttnNewArmy"; 505 this.bttnNewArmy.Name = "bttnNewArmy";
506 this.bttnNewArmy.Size = new System.Drawing.Size(23, 22); 506 this.bttnNewArmy.Size = new System.Drawing.Size(23, 22);
507 this.bttnNewArmy.Text = "new army"; 507 this.bttnNewArmy.Text = "new army";
508 this.bttnNewArmy.Click += new System.EventHandler(this.miNewArmy_Click); 508 this.bttnNewArmy.Click += new System.EventHandler(this.miNewArmy_Click);
509 // 509 //
510 // bttnOpenArmy 510 // bttnOpenArmy
511 // 511 //
512 this.bttnOpenArmy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; 512 this.bttnOpenArmy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
513 this.bttnOpenArmy.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.document_open; 513 this.bttnOpenArmy.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.document_open;
514 this.bttnOpenArmy.ImageTransparentColor = System.Drawing.Color.Magenta; 514 this.bttnOpenArmy.ImageTransparentColor = System.Drawing.Color.Magenta;
515 this.bttnOpenArmy.Name = "bttnOpenArmy"; 515 this.bttnOpenArmy.Name = "bttnOpenArmy";
516 this.bttnOpenArmy.Size = new System.Drawing.Size(23, 22); 516 this.bttnOpenArmy.Size = new System.Drawing.Size(23, 22);
517 this.bttnOpenArmy.Text = "open army"; 517 this.bttnOpenArmy.Text = "open army";
518 this.bttnOpenArmy.Click += new System.EventHandler(this.miOpenArmy_Click); 518 this.bttnOpenArmy.Click += new System.EventHandler(this.miOpenArmy_Click);
519 // 519 //
520 // bttnSaveArmy 520 // bttnSaveArmy
521 // 521 //
522 this.bttnSaveArmy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; 522 this.bttnSaveArmy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
523 this.bttnSaveArmy.Enabled = false; 523 this.bttnSaveArmy.Enabled = false;
524 this.bttnSaveArmy.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.document_save; 524 this.bttnSaveArmy.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.document_save;
525 this.bttnSaveArmy.ImageTransparentColor = System.Drawing.Color.Magenta; 525 this.bttnSaveArmy.ImageTransparentColor = System.Drawing.Color.Magenta;
526 this.bttnSaveArmy.Name = "bttnSaveArmy"; 526 this.bttnSaveArmy.Name = "bttnSaveArmy";
527 this.bttnSaveArmy.Size = new System.Drawing.Size(23, 22); 527 this.bttnSaveArmy.Size = new System.Drawing.Size(23, 22);
528 this.bttnSaveArmy.Text = "save army"; 528 this.bttnSaveArmy.Text = "save army";
529 this.bttnSaveArmy.Click += new System.EventHandler(this.miSaveArmy_Click); 529 this.bttnSaveArmy.Click += new System.EventHandler(this.miSaveArmy_Click);
530 // 530 //
531 // toolStripSeparator3 531 // toolStripSeparator3
532 // 532 //
533 this.toolStripSeparator3.Name = "toolStripSeparator3"; 533 this.toolStripSeparator3.Name = "toolStripSeparator3";
534 this.toolStripSeparator3.Size = new System.Drawing.Size(6, 25); 534 this.toolStripSeparator3.Size = new System.Drawing.Size(6, 25);
535 // 535 //
536 // bttnUndo 536 // bttnUndo
537 // 537 //
538 this.bttnUndo.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; 538 this.bttnUndo.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
539 this.bttnUndo.Enabled = false; 539 this.bttnUndo.Enabled = false;
540 this.bttnUndo.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.edit_undo; 540 this.bttnUndo.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.edit_undo;
541 this.bttnUndo.ImageTransparentColor = System.Drawing.Color.Magenta; 541 this.bttnUndo.ImageTransparentColor = System.Drawing.Color.Magenta;
542 this.bttnUndo.Name = "bttnUndo"; 542 this.bttnUndo.Name = "bttnUndo";
543 this.bttnUndo.Size = new System.Drawing.Size(32, 22); 543 this.bttnUndo.Size = new System.Drawing.Size(32, 22);
544 this.bttnUndo.Text = "undo"; 544 this.bttnUndo.Text = "undo";
545 this.bttnUndo.ButtonClick += new System.EventHandler(this.miUndo_Click); 545 this.bttnUndo.ButtonClick += new System.EventHandler(this.miUndo_Click);
546 // 546 //
547 // bttnRedo 547 // bttnRedo
548 // 548 //
549 this.bttnRedo.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; 549 this.bttnRedo.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
550 this.bttnRedo.Enabled = false; 550 this.bttnRedo.Enabled = false;
551 this.bttnRedo.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.edit_redo; 551 this.bttnRedo.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.edit_redo;
552 this.bttnRedo.ImageTransparentColor = System.Drawing.Color.Magenta; 552 this.bttnRedo.ImageTransparentColor = System.Drawing.Color.Magenta;
553 this.bttnRedo.Name = "bttnRedo"; 553 this.bttnRedo.Name = "bttnRedo";
554 this.bttnRedo.Size = new System.Drawing.Size(32, 22); 554 this.bttnRedo.Size = new System.Drawing.Size(32, 22);
555 this.bttnRedo.Text = "redo"; 555 this.bttnRedo.Text = "redo";
556 this.bttnRedo.ButtonClick += new System.EventHandler(this.miRedo_Click); 556 this.bttnRedo.ButtonClick += new System.EventHandler(this.miRedo_Click);
557 // 557 //
558 // catToolStrip 558 // catToolStrip
559 // 559 //
560 this.catToolStrip.Dock = System.Windows.Forms.DockStyle.None; 560 this.catToolStrip.Dock = System.Windows.Forms.DockStyle.None;
561 this.catToolStrip.Location = new System.Drawing.Point(161, 24); 561 this.catToolStrip.Location = new System.Drawing.Point(161, 24);
562 this.catToolStrip.Name = "catToolStrip"; 562 this.catToolStrip.Name = "catToolStrip";
563 this.catToolStrip.Size = new System.Drawing.Size(111, 25); 563 this.catToolStrip.Size = new System.Drawing.Size(111, 25);
564 this.catToolStrip.TabIndex = 9; 564 this.catToolStrip.TabIndex = 9;
565 this.catToolStrip.Visible = false; 565 this.catToolStrip.Visible = false;
566 // 566 //
567 // statusBar 567 // statusBar
568 // 568 //
569 this.statusBar.Location = new System.Drawing.Point(0, 586); 569 this.statusBar.Location = new System.Drawing.Point(0, 586);
570 this.statusBar.Name = "statusBar"; 570 this.statusBar.Name = "statusBar";
571 this.statusBar.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] { 571 this.statusBar.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
572 this.sbMainPanel, 572 this.sbMainPanel,
573 this.sbErrorPanel, 573 this.sbErrorPanel,
574 this.sbPointsPanel}); 574 this.sbPointsPanel});
575 this.statusBar.ShowPanels = true; 575 this.statusBar.ShowPanels = true;
576 this.statusBar.Size = new System.Drawing.Size(790, 22); 576 this.statusBar.Size = new System.Drawing.Size(790, 22);
577 this.statusBar.TabIndex = 1; 577 this.statusBar.TabIndex = 1;
578 this.statusBar.PanelClick += new System.Windows.Forms.StatusBarPanelClickEventHandler(this.statusBar_PanelClick); 578 this.statusBar.PanelClick += new System.Windows.Forms.StatusBarPanelClickEventHandler(this.statusBar_PanelClick);
579 this.statusBar.DrawItem += new System.Windows.Forms.StatusBarDrawItemEventHandler(this.statusBar_DrawItem); 579 this.statusBar.DrawItem += new System.Windows.Forms.StatusBarDrawItemEventHandler(this.statusBar_DrawItem);
580 // 580 //
581 // sbMainPanel 581 // sbMainPanel
582 // 582 //
583 this.sbMainPanel.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring; 583 this.sbMainPanel.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
584 this.sbMainPanel.Color = System.Drawing.SystemColors.WindowText; 584 this.sbMainPanel.Color = System.Drawing.SystemColors.WindowText;
585 this.sbMainPanel.Name = "sbMainPanel"; 585 this.sbMainPanel.Name = "sbMainPanel";
586 this.sbMainPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw; 586 this.sbMainPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw;
587 this.sbMainPanel.Width = 473; 587 this.sbMainPanel.Width = 473;
588 // 588 //
589 // sbErrorPanel 589 // sbErrorPanel
590 // 590 //
591 this.sbErrorPanel.Color = System.Drawing.SystemColors.WindowText; 591 this.sbErrorPanel.Color = System.Drawing.SystemColors.WindowText;
592 this.sbErrorPanel.Name = "sbErrorPanel"; 592 this.sbErrorPanel.Name = "sbErrorPanel";
593 this.sbErrorPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw; 593 this.sbErrorPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw;
594 this.sbErrorPanel.Width = 150; 594 this.sbErrorPanel.Width = 150;
595 // 595 //
596 // sbPointsPanel 596 // sbPointsPanel
597 // 597 //
598 this.sbPointsPanel.Color = System.Drawing.SystemColors.WindowText; 598 this.sbPointsPanel.Color = System.Drawing.SystemColors.WindowText;
599 this.sbPointsPanel.Name = "sbPointsPanel"; 599 this.sbPointsPanel.Name = "sbPointsPanel";
600 this.sbPointsPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw; 600 this.sbPointsPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw;
601 this.sbPointsPanel.ToolTipText = "current points total"; 601 this.sbPointsPanel.ToolTipText = "current points total";
602 this.sbPointsPanel.Width = 150; 602 this.sbPointsPanel.Width = 150;
603 // 603 //
604 // toolStripPanel 604 // toolStripPanel
605 // 605 //
606 this.toolStripPanel.Dock = System.Windows.Forms.DockStyle.Top; 606 this.toolStripPanel.Dock = System.Windows.Forms.DockStyle.Top;
607 this.toolStripPanel.Location = new System.Drawing.Point(0, 24); 607 this.toolStripPanel.Location = new System.Drawing.Point(0, 24);
608 this.toolStripPanel.Name = "toolStripPanel"; 608 this.toolStripPanel.Name = "toolStripPanel";
609 this.toolStripPanel.Orientation = System.Windows.Forms.Orientation.Horizontal; 609 this.toolStripPanel.Orientation = System.Windows.Forms.Orientation.Horizontal;
610 this.toolStripPanel.RowMargin = new System.Windows.Forms.Padding(3, 0, 0, 0); 610 this.toolStripPanel.RowMargin = new System.Windows.Forms.Padding(3, 0, 0, 0);
611 this.toolStripPanel.Size = new System.Drawing.Size(790, 0); 611 this.toolStripPanel.Size = new System.Drawing.Size(790, 0);
612 // 612 //
613 // FrmMain 613 // FrmMain
614 // 614 //
615 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); 615 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
616 this.ClientSize = new System.Drawing.Size(790, 608); 616 this.ClientSize = new System.Drawing.Size(790, 608);
617 this.Controls.Add(this.mainToolStrip); 617 this.Controls.Add(this.mainToolStrip);
618 this.Controls.Add(this.toolStripPanel); 618 this.Controls.Add(this.toolStripPanel);
619 this.Controls.Add(this.statusBar); 619 this.Controls.Add(this.statusBar);
620 this.Controls.Add(this.catToolStrip); 620 this.Controls.Add(this.catToolStrip);
621 this.Controls.Add(this.menuStrip); 621 this.Controls.Add(this.menuStrip);
622 this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 622 this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
623 this.IsMdiContainer = true; 623 this.IsMdiContainer = true;
624 this.MainMenuStrip = this.menuStrip; 624 this.MainMenuStrip = this.menuStrip;
625 this.Menu = this.mainMenu; 625 this.Menu = this.mainMenu;
626 this.Name = "FrmMain"; 626 this.Name = "FrmMain";
627 this.Text = "WarFoundry"; 627 this.Text = "WarFoundry";
628 this.Load += new System.EventHandler(this.FrmMain_Load); 628 this.Load += new System.EventHandler(this.FrmMain_Load);
629 this.menuStrip.ResumeLayout(false); 629 this.menuStrip.ResumeLayout(false);
630 this.menuStrip.PerformLayout(); 630 this.menuStrip.PerformLayout();
631 this.mainToolStrip.ResumeLayout(false); 631 this.mainToolStrip.ResumeLayout(false);
632 this.mainToolStrip.PerformLayout(); 632 this.mainToolStrip.PerformLayout();
633 ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).EndInit(); 633 ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).EndInit();
634 ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).EndInit(); 634 ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).EndInit();
635 ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).EndInit(); 635 ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).EndInit();
636 this.ResumeLayout(false); 636 this.ResumeLayout(false);
637 this.PerformLayout(); 637 this.PerformLayout();
638 638
639 } 639 }
640 #endregion 640 #endregion
641 641
642 private void FileLoadingFinished(List<FileLoadFailure> failures) 642 private void FileLoadingFinished(List<FileLoadFailure> failures)
833 return saved; 833 return saved;
834 } 834 }
835 835
836 private bool SaveCurrentArmyToFile(string filePath) 836 private bool SaveCurrentArmyToFile(string filePath)
837 { 837 {
838 if (WarFoundrySaver.GetSaver().Save(filePath, CurrentArmy)) 838 if (WarFoundrySaver.GetSaver().Save(filePath, CurrentArmy))
839 { 839 {
840 loadedFilePath = filePath; 840 loadedFilePath = filePath;
841 miSaveArmy.Enabled = false; 841 miSaveArmy.Enabled = false;
842 bttnSaveArmy.Enabled = false; 842 bttnSaveArmy.Enabled = false;
843 CommandStack.setCleanMark(); 843 CommandStack.setCleanMark();
892 892
893 private void FrmMain_GameSystemChanged(GameSystem oldSystem, GameSystem newSystem) 893 private void FrmMain_GameSystemChanged(GameSystem oldSystem, GameSystem newSystem)
894 { 894 {
895 SetAppTitle(); 895 SetAppTitle();
896 896
897 if (newSystem == null) 897 if (newSystem == null)
898 { 898 {
899 Preferences["currSystem"] = ""; 899 Preferences["currSystem"] = "";
900 } 900 }
901 else 901 else
902 { 902 {
903 Preferences["currSystem"] = newSystem.ID; 903 Preferences["currSystem"] = newSystem.ID;
904 } 904 }
905 905
906 Preferences.Save(); 906 Preferences.Save();
907 RemoveCategoryButtons(); 907 RemoveCategoryButtons();
908 } 908 }
909 909
910 private void FrmMain_ArmyChanged(Army oldArmy, Army newArmy) 910 private void FrmMain_ArmyChanged(Army oldArmy, Army newArmy)
911 { 911 {
912 CommandStack.Reset(); 912 CommandStack.Reset();
913 loadedFilePath = null; 913 loadedFilePath = null;
914 miSaveArmy.Enabled = false; 914 miSaveArmy.Enabled = false;
915 bttnSaveArmy.Enabled = false; 915 bttnSaveArmy.Enabled = false;
916 //TODO: Subscribe to an "army changed" event here 916 //TODO: Subscribe to an "army changed" event here
917 SetPointsPanelText(); 917 SetPointsPanelText();
918 SetAppTitle(); 918 SetAppTitle();
919 } 919 }
920 920
921 private void SetArmy(Army newArmy) 921 private void SetArmy(Army newArmy)
974 miSaveArmyAs.Enabled = false; 974 miSaveArmyAs.Enabled = false;
975 miCloseArmy.Enabled = false; 975 miCloseArmy.Enabled = false;
976 miExportArmyAs.Enabled = false; 976 miExportArmyAs.Enabled = false;
977 DisableCategoryButtons(); 977 DisableCategoryButtons();
978 GetArmyTree().Hide(); 978 GetArmyTree().Hide();
979 GetNewUnitTree().Hide(); 979 GetNewUnitTree().Hide();
980 } 980 }
981 981
982 private void SetNonNullArmyState(Army newArmy) 982 private void SetNonNullArmyState(Army newArmy)
983 { 983 {
984 SetCategoryButtons(newArmy.Race.Categories); 984 SetCategoryButtons(newArmy.Race.Categories);
985 EnableCategoryButtons(); 985 EnableCategoryButtons();
986 miSaveArmyAs.Enabled = true; 986 miSaveArmyAs.Enabled = true;
987 miCloseArmy.Enabled = true; 987 miCloseArmy.Enabled = true;
988 miExportArmyAs.Enabled = true; 988 miExportArmyAs.Enabled = true;
989 GetArmyTree().Show(); 989 GetArmyTree().Show();
990 GetNewUnitTree().Show(); 990 GetNewUnitTree().Show();
991 } 991 }
992 992
993 private void SetCategoryButtons(Category[] cats) 993 private void SetCategoryButtons(Category[] cats)
994 { 994 {
995 if (CategoryButtonsHaveChanged(cats)) 995 if (CategoryButtonsHaveChanged(cats))
1200 FrmNewUnit newUnit = new FrmNewUnit(CurrentArmy.Race, cat, CurrentArmy); 1200 FrmNewUnit newUnit = new FrmNewUnit(CurrentArmy.Race, cat, CurrentArmy);
1201 DialogResult dr = newUnit.ShowDialog(this); 1201 DialogResult dr = newUnit.ShowDialog(this);
1202 1202
1203 if (dr == DialogResult.OK) 1203 if (dr == DialogResult.OK)
1204 { 1204 {
1205 UnitType unitType = newUnit.SelectedUnit; 1205 UnitType unitType = newUnit.SelectedUnit;
1206 CreateUnitInCategory(unitType, cat); 1206 CreateUnitInCategory(unitType, cat);
1207 } 1207 }
1208 } 1208 }
1209 1209
1210 internal void CreateUnitInCategory(UnitType unitType, Category cat) 1210 internal void CreateUnitInCategory(UnitType unitType, Category cat)
1211 { 1211 {
1212 ArmyCategory armyCat = CurrentArmy.GetCategory(cat); 1212 ArmyCategory armyCat = CurrentArmy.GetCategory(cat);
1213 CreateAndAddUnitCommand cmd = new CreateAndAddUnitCommand(unitType, armyCat); 1213 CreateAndAddUnitCommand cmd = new CreateAndAddUnitCommand(unitType, armyCat);
1214 commandStack.Execute(cmd); 1214 commandStack.Execute(cmd);
1215 OpenUnitDialog(cmd.Unit); 1215 OpenUnitDialog(cmd.Unit);
1216 } 1216 }
1217 1217
1218 internal void OpenUnitDialog(Unit unit) 1218 internal void OpenUnitDialog(Unit unit)
1219 { 1219 {
1220 string unitID = unit.ID; 1220 string unitID = unit.ID;
1221 1221
1242 } 1242 }
1243 } 1243 }
1244 1244
1245 private void FrmMain_UnitAddedMethod(object unitObj) 1245 private void FrmMain_UnitAddedMethod(object unitObj)
1246 { 1246 {
1247 ValidateArmy(); 1247 ValidateArmy();
1248 } 1248 }
1249 1249
1250 private void ValidateArmy() 1250 private void ValidateArmy()
1251 { 1251 {
1252 ICollection<string> failureMessages; 1252 ICollection<string> failureMessages;
1253 if (Validates.AsOkay(RequirementHandler.ValidateArmy(CurrentArmy, out failureMessages))) 1253 if (Validates.AsOkay(RequirementHandler.ValidateArmy(CurrentArmy, out failureMessages)))
1254 { 1254 {
1255 sbErrorPanel.Text = ""; 1255 sbErrorPanel.Text = "";
1256 sbErrorPanel.Tag = ""; 1256 sbErrorPanel.Tag = "";
1257 } 1257 }
1258 else 1258 else
1259 { 1259 {
1260 sbErrorPanel.Text = failureMessages.Count + " validation errors"; 1260 sbErrorPanel.Text = failureMessages.Count + " validation errors";
1261 sbErrorPanel.Tag = String.Join("\n", new List<string>(failureMessages).ToArray()); 1261 sbErrorPanel.Tag = String.Join("\n", new List<string>(failureMessages).ToArray());
1262 } 1262 }
1263 } 1263 }
1264 1264
1265 private void FrmMain_UnitRemovedMethod(object unitObj) 1265 private void FrmMain_UnitRemovedMethod(object unitObj)
1266 { 1266 {
1267 ValidateArmy(); 1267 ValidateArmy();
1268 1268
1269 if (unitObj is Unit) 1269 if (unitObj is Unit)
1270 { 1270 {
1271 Unit unit = (Unit)unitObj; 1271 Unit unit = (Unit)unitObj;
1272 1272
1311 { 1311 {
1312 SetPointsPanelText(); 1312 SetPointsPanelText();
1313 } 1313 }
1314 } 1314 }
1315 1315
1316 private void SetPointsPanelText() 1316 private void SetPointsPanelText()
1317 { 1317 {
1318 if (CurrentArmy==null) 1318 if (CurrentArmy==null)
1319 { 1319 {
1320 sbPointsPanel.Text = ""; 1320 sbPointsPanel.Text = "";
1321 sbPointsPanel.ResetColor(); 1321 sbPointsPanel.ResetColor();
1322 } 1322 }
1323 else 1323 else
1324 { 1324 {
1325 string pointsPanelText = String.Format(Translation.GetTranslation("statusPanelPoints"), CurrentArmy.Points, CurrentGameSystem.GetPointsName(CurrentArmy.Points), CurrentArmy.MaxPoints, CurrentGameSystem.GetPointsName(CurrentArmy.MaxPoints)); 1325 string pointsPanelText = String.Format(Translation.GetTranslation("statusPanelPoints"), CurrentArmy.Points, CurrentGameSystem.GetPointsName(CurrentArmy.Points), CurrentArmy.MaxPoints, CurrentGameSystem.GetPointsName(CurrentArmy.MaxPoints));
1326 sbPointsPanel.Text = pointsPanelText; 1326 sbPointsPanel.Text = pointsPanelText;
1327 1327
1328 if (CurrentArmy.Points>CurrentArmy.MaxPoints) 1328 if (CurrentArmy.Points>CurrentArmy.MaxPoints)
1329 { 1329 {
1330 sbPointsPanel.Color = Color.Red; 1330 sbPointsPanel.Color = Color.Red;
1331 } 1331 }
1334 sbPointsPanel.ResetColor(); 1334 sbPointsPanel.ResetColor();
1335 } 1335 }
1336 } 1336 }
1337 } 1337 }
1338 1338
1339 private void SetPointsPanelToolTipText() 1339 private void SetPointsPanelToolTipText()
1340 { 1340 {
1341 sbPointsPanel.ToolTipText = Translation.GetTranslation("statusPanelPointsToolTip", "total points value"); 1341 sbPointsPanel.ToolTipText = Translation.GetTranslation("statusPanelPointsToolTip", "total points value");
1342 } 1342 }
1343 1343
1344 private void redoMenu_Click(object sender, EventArgs e) 1344 private void redoMenu_Click(object sender, EventArgs e)
1345 { 1345 {
1346 if (sender is ToolStripDropDownItem) 1346 if (sender is ToolStripDropDownItem)
1347 { 1347 {