comparison FrmMain.cs @ 54:d6ff354a5d84

Re #166: Move game system changing to part of army creation * Initial commit - code works but naming isn't correct * Remove system selection dialog * Add game system selection to FrmNewArmy * Populate race list based on game system selected * Always enable "New Army" button/menu item
author IBBoard <dev@ibboard.co.uk>
date Sat, 19 Sep 2009 10:27:01 +0000
parents 93b3d23147ba
children 039b02006a8a
comparison
equal deleted inserted replaced
53:e6d0d9eababf 54:d6ff354a5d84
68 private IBBoard.Windows.Forms.IBBMenuItem miOpenArmy; 68 private IBBoard.Windows.Forms.IBBMenuItem miOpenArmy;
69 private IBBoard.Windows.Forms.IBBMenuItem miCloseArmy; 69 private IBBoard.Windows.Forms.IBBMenuItem miCloseArmy;
70 private IBBoard.Windows.Forms.IBBMenuItem miSaveArmy; 70 private IBBoard.Windows.Forms.IBBMenuItem miSaveArmy;
71 private IBBoard.Windows.Forms.IBBMenuItem miSaveArmyAs; 71 private IBBoard.Windows.Forms.IBBMenuItem miSaveArmyAs;
72 private System.Windows.Forms.MenuItem miSep2; 72 private System.Windows.Forms.MenuItem miSep2;
73 private IBBoard.Windows.Forms.IBBMenuItem miChangeSystem;
74 private System.Windows.Forms.MenuItem miSep1;
75 private IBBoard.Windows.Forms.IBBMenuItem miReloadFiles; 73 private IBBoard.Windows.Forms.IBBMenuItem miReloadFiles;
76 private System.Windows.Forms.MenuItem miSep3; 74 private System.Windows.Forms.MenuItem miSep3;
77 private IBBoard.Windows.Forms.IBBMenuItem miExit; 75 private IBBoard.Windows.Forms.IBBMenuItem miExit;
78 private IBBoard.Windows.Forms.IBBMenuItem menuEdit; 76 private IBBoard.Windows.Forms.IBBMenuItem menuEdit;
79 private IBBoard.Windows.Forms.IBBMenuItem miUndo; 77 private IBBoard.Windows.Forms.IBBMenuItem miUndo;
226 this.miSaveArmy = new IBBoard.Windows.Forms.IBBMenuItem(); 224 this.miSaveArmy = new IBBoard.Windows.Forms.IBBMenuItem();
227 this.miSaveArmyAs = new IBBoard.Windows.Forms.IBBMenuItem(); 225 this.miSaveArmyAs = new IBBoard.Windows.Forms.IBBMenuItem();
228 this.miExportArmyAs = new System.Windows.Forms.MenuItem(); 226 this.miExportArmyAs = new System.Windows.Forms.MenuItem();
229 this.miExportArmyAsBasicHTML = new System.Windows.Forms.MenuItem(); 227 this.miExportArmyAsBasicHTML = new System.Windows.Forms.MenuItem();
230 this.miCloseArmy = new IBBoard.Windows.Forms.IBBMenuItem(); 228 this.miCloseArmy = new IBBoard.Windows.Forms.IBBMenuItem();
231 this.miSep1 = new System.Windows.Forms.MenuItem();
232 this.miChangeSystem = new IBBoard.Windows.Forms.IBBMenuItem();
233 this.miSep2 = new System.Windows.Forms.MenuItem(); 229 this.miSep2 = new System.Windows.Forms.MenuItem();
234 this.miReloadFiles = new IBBoard.Windows.Forms.IBBMenuItem(); 230 this.miReloadFiles = new IBBoard.Windows.Forms.IBBMenuItem();
235 this.miSep3 = new System.Windows.Forms.MenuItem(); 231 this.miSep3 = new System.Windows.Forms.MenuItem();
236 this.miExit = new IBBoard.Windows.Forms.IBBMenuItem(); 232 this.miExit = new IBBoard.Windows.Forms.IBBMenuItem();
237 this.menuEdit = new IBBoard.Windows.Forms.IBBMenuItem(); 233 this.menuEdit = new IBBoard.Windows.Forms.IBBMenuItem();
285 this.sbPointsPanel.ToolTipText = "Current Points Total"; 281 this.sbPointsPanel.ToolTipText = "Current Points Total";
286 this.sbPointsPanel.Width = 150; 282 this.sbPointsPanel.Width = 150;
287 // 283 //
288 // toolBar 284 // toolBar
289 // 285 //
290 this.toolBar.Appearance = System.Windows.Forms.ToolBarAppearance.Flat;
291 this.toolBar.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] { 286 this.toolBar.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
292 this.bttnNewArmy, 287 this.bttnNewArmy,
293 this.bttnOpenArmy, 288 this.bttnOpenArmy,
294 this.bttnSaveArmy, 289 this.bttnSaveArmy,
295 this.bttnSep1, 290 this.bttnSep1,
305 this.toolBar.TabIndex = 2; 300 this.toolBar.TabIndex = 2;
306 this.toolBar.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar_ButtonClick); 301 this.toolBar.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar_ButtonClick);
307 // 302 //
308 // bttnNewArmy 303 // bttnNewArmy
309 // 304 //
310 this.bttnNewArmy.Enabled = false;
311 this.bttnNewArmy.ImageIndex = 0; 305 this.bttnNewArmy.ImageIndex = 0;
312 this.bttnNewArmy.Name = "bttnNewArmy"; 306 this.bttnNewArmy.Name = "bttnNewArmy";
313 // 307 //
314 // bttnOpenArmy 308 // bttnOpenArmy
315 // 309 //
370 this.miOpenArmy, 364 this.miOpenArmy,
371 this.miSaveArmy, 365 this.miSaveArmy,
372 this.miSaveArmyAs, 366 this.miSaveArmyAs,
373 this.miExportArmyAs, 367 this.miExportArmyAs,
374 this.miCloseArmy, 368 this.miCloseArmy,
375 this.miSep1,
376 this.miChangeSystem,
377 this.miSep2, 369 this.miSep2,
378 this.miReloadFiles, 370 this.miReloadFiles,
379 this.miSep3, 371 this.miSep3,
380 this.miExit}); 372 this.miExit});
381 this.menuFile.Text = "&file"; 373 this.menuFile.Text = "&file";
382 // 374 //
383 // miNewArmy 375 // miNewArmy
384 // 376 //
385 this.miNewArmy.Enabled = false;
386 this.miNewArmy.Index = 0; 377 this.miNewArmy.Index = 0;
387 this.miNewArmy.Text = "&new army"; 378 this.miNewArmy.Text = "&new army";
388 this.miNewArmy.Click += new System.EventHandler(this.miNewArmy_Click); 379 this.miNewArmy.Click += new System.EventHandler(this.miNewArmy_Click);
389 // 380 //
390 // miOpenArmy 381 // miOpenArmy
426 this.miCloseArmy.Enabled = false; 417 this.miCloseArmy.Enabled = false;
427 this.miCloseArmy.Index = 5; 418 this.miCloseArmy.Index = 5;
428 this.miCloseArmy.Text = "&close army"; 419 this.miCloseArmy.Text = "&close army";
429 this.miCloseArmy.Click += new System.EventHandler(this.miCloseArmy_Click); 420 this.miCloseArmy.Click += new System.EventHandler(this.miCloseArmy_Click);
430 // 421 //
431 // miSep1
432 //
433 this.miSep1.Index = 6;
434 this.miSep1.Text = "-";
435 //
436 // miChangeSystem
437 //
438 this.miChangeSystem.Index = 7;
439 this.miChangeSystem.Text = "change &game system";
440 this.miChangeSystem.Click += new System.EventHandler(this.miChangeSystem_Click);
441 //
442 // miSep2 422 // miSep2
443 // 423 //
444 this.miSep2.Index = 8; 424 this.miSep2.Index = 6;
445 this.miSep2.Text = "-"; 425 this.miSep2.Text = "-";
446 // 426 //
447 // miReloadFiles 427 // miReloadFiles
448 // 428 //
449 this.miReloadFiles.Index = 9; 429 this.miReloadFiles.Index = 7;
450 this.miReloadFiles.Text = "&reload files"; 430 this.miReloadFiles.Text = "&reload files";
451 this.miReloadFiles.Click += new System.EventHandler(this.miReloadFiles_Click); 431 this.miReloadFiles.Click += new System.EventHandler(this.miReloadFiles_Click);
452 // 432 //
453 // miSep3 433 // miSep3
454 // 434 //
455 this.miSep3.Index = 10; 435 this.miSep3.Index = 8;
456 this.miSep3.Text = "-"; 436 this.miSep3.Text = "-";
457 // 437 //
458 // miExit 438 // miExit
459 // 439 //
460 this.miExit.Index = 11; 440 this.miExit.Index = 9;
461 this.miExit.Text = "e&xit"; 441 this.miExit.Text = "e&xit";
462 this.miExit.Click += new System.EventHandler(this.miExit_Click); 442 this.miExit.Click += new System.EventHandler(this.miExit_Click);
463 // 443 //
464 // menuEdit 444 // menuEdit
465 // 445 //
793 //it must be one of our extra buttons for the categories 773 //it must be one of our extra buttons for the categories
794 AddUnitFromCategory((Category)e.Button.Tag); 774 AddUnitFromCategory((Category)e.Button.Tag);
795 } 775 }
796 } 776 }
797 777
798 private GameSystem CurrentGameSystem 778 public static GameSystem CurrentGameSystem
799 { 779 {
800 get { return WarFoundryCore.CurrentGameSystem; } 780 get { return WarFoundryCore.CurrentGameSystem; }
801 set { WarFoundryCore.CurrentGameSystem = value; } 781 set { WarFoundryCore.CurrentGameSystem = value; }
802 } 782 }
803 783
804 private static Army CurrentArmy 784 public static Army CurrentArmy
805 { 785 {
806 get { return WarFoundryCore.CurrentArmy; } 786 get { return WarFoundryCore.CurrentArmy; }
807 set { WarFoundryCore.CurrentArmy = value; } 787 set { WarFoundryCore.CurrentArmy = value; }
808 } 788 }
809 789
810 private void SelectGameSystem()
811 {
812 FrmSelectSystem selectSystem = new FrmSelectSystem();
813 DialogResult dr = selectSystem.ShowDialog(this);
814
815 if (dr==DialogResult.OK)
816 {
817 CloseCurrentArmy();
818 CurrentGameSystem = selectSystem.GameSystem;
819 }
820 }
821
822 private void miChangeSystem_Click(object sender, System.EventArgs e)
823 {
824 SelectGameSystem();
825 }
826
827 private void FrmMain_GameSystemChanged(GameSystem oldSystem, GameSystem newSystem) 790 private void FrmMain_GameSystemChanged(GameSystem oldSystem, GameSystem newSystem)
828 { 791 {
829 miNewArmy.Enabled = newSystem != null;
830 bttnNewArmy.Enabled = newSystem != null;
831 SetAppTitle(); 792 SetAppTitle();
832 RemoveCategoryButtons(); 793 RemoveCategoryButtons();
833 AddCategoryButtons(); 794 AddCategoryButtons();
834 } 795 }
835 796
1250 1211
1251 DialogResult dr = dialog.ShowDialog(this); 1212 DialogResult dr = dialog.ShowDialog(this);
1252 1213
1253 if (dr == DialogResult.OK) 1214 if (dr == DialogResult.OK)
1254 { 1215 {
1255 Army army = WarFoundryCore.CurrentArmy; 1216 Army army = CurrentArmy;
1256 string filePath = dialog.FileName; 1217 string filePath = dialog.FileName;
1257 logger.DebugFormat("Exporting {0} to {1} as basic HTML", army.Name, filePath); 1218 logger.DebugFormat("Exporting {0} to {1} as basic HTML", army.Name, filePath);
1258 WarFoundryHtmlExporter.GetDefault().ExportArmy(army, filePath); 1219 WarFoundryHtmlExporter.GetDefault().ExportArmy(army, filePath);
1259 } 1220 }
1260 } 1221 }