comparison FrmMain.cs @ 46:1576f669b3eb

Fixes #137: Remove use of old collections * Remove all references (lots unused) in WinForms code * Remove DebugOutput window as it isn't used any more * Remove unused static hashtable from UnitEquipmentChoice
author IBBoard <dev@ibboard.co.uk>
date Sun, 13 Sep 2009 17:33:36 +0000
parents 740350673006
children 93b3d23147ba
comparison
equal deleted inserted replaced
45:1c74b51abac1 46:1576f669b3eb
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. 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 4
5 using System; 5 using System;
6 using System.Drawing; 6 using System.Drawing;
7 using System.Drawing.Drawing2D; 7 using System.Drawing.Drawing2D;
8 using System.Collections;
9 using System.ComponentModel; 8 using System.ComponentModel;
10 using System.Windows.Forms; 9 using System.Windows.Forms;
11 using System.Data; 10 using System.Data;
12 using System.IO; 11 using System.IO;
13 using System.Threading; 12 using System.Threading;
48 public ObjectRemoveDelegate UnitRemovedMethod; 47 public ObjectRemoveDelegate UnitRemovedMethod;
49 public DoubleValChangedDelegate PointsValueChangedMethod; 48 public DoubleValChangedDelegate PointsValueChangedMethod;
50 //public FailedUnitRequirementDelegate FailedUnitRequirementMethod; 49 //public FailedUnitRequirementDelegate FailedUnitRequirementMethod;
51 50
52 private FrmArmyTree armyTree; 51 private FrmArmyTree armyTree;
53 private FrmDebugOutput debugWindow;
54 private string loadedFilePath; 52 private string loadedFilePath;
55 53
56 private System.ComponentModel.IContainer components; 54 private System.ComponentModel.IContainer components;
57 private System.Windows.Forms.ToolBar toolBar; 55 private System.Windows.Forms.ToolBar toolBar;
58 private IBBoard.Windows.Forms.IBBToolBarButton bttnNewArmy; 56 private IBBoard.Windows.Forms.IBBToolBarButton bttnNewArmy;
79 private IBBoard.Windows.Forms.IBBMenuItem miExit; 77 private IBBoard.Windows.Forms.IBBMenuItem miExit;
80 private IBBoard.Windows.Forms.IBBMenuItem menuEdit; 78 private IBBoard.Windows.Forms.IBBMenuItem menuEdit;
81 private IBBoard.Windows.Forms.IBBMenuItem miUndo; 79 private IBBoard.Windows.Forms.IBBMenuItem miUndo;
82 private IBBoard.Windows.Forms.IBBMenuItem miRedo; 80 private IBBoard.Windows.Forms.IBBMenuItem miRedo;
83 private IBBoard.Windows.Forms.IBBMenuItem menuHelp; 81 private IBBoard.Windows.Forms.IBBMenuItem menuHelp;
84 private IBBoard.Windows.Forms.IBBMenuItem miDebugWindow;
85 private IBBoard.Windows.Forms.IBBMenuItem miAbout; 82 private IBBoard.Windows.Forms.IBBMenuItem miAbout;
86 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbMainPanel; 83 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbMainPanel;
87 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbErrorPanel; 84 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbErrorPanel;
88 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbPointsPanel; 85 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbPointsPanel;
89 private System.Windows.Forms.ContextMenu undoMenu; 86 private System.Windows.Forms.ContextMenu undoMenu;
241 this.menuEdit = new IBBoard.Windows.Forms.IBBMenuItem(); 238 this.menuEdit = new IBBoard.Windows.Forms.IBBMenuItem();
242 this.miUndo = new IBBoard.Windows.Forms.IBBMenuItem(); 239 this.miUndo = new IBBoard.Windows.Forms.IBBMenuItem();
243 this.miRedo = new IBBoard.Windows.Forms.IBBMenuItem(); 240 this.miRedo = new IBBoard.Windows.Forms.IBBMenuItem();
244 this.menuHelp = new IBBoard.Windows.Forms.IBBMenuItem(); 241 this.menuHelp = new IBBoard.Windows.Forms.IBBMenuItem();
245 this.miAbout = new IBBoard.Windows.Forms.IBBMenuItem(); 242 this.miAbout = new IBBoard.Windows.Forms.IBBMenuItem();
246 this.miDebugWindow = new IBBoard.Windows.Forms.IBBMenuItem();
247 this.openArmyDialog = new System.Windows.Forms.OpenFileDialog(); 243 this.openArmyDialog = new System.Windows.Forms.OpenFileDialog();
248 this.saveArmyDialog = new System.Windows.Forms.SaveFileDialog(); 244 this.saveArmyDialog = new System.Windows.Forms.SaveFileDialog();
249 this.pnlRight = new System.Windows.Forms.Panel(); 245 this.pnlRight = new System.Windows.Forms.Panel();
250 this.statusBarTimer = new System.Windows.Forms.Timer(this.components); 246 this.statusBarTimer = new System.Windows.Forms.Timer(this.components);
251 ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).BeginInit(); 247 ((System.ComponentModel.ISupportInitialize) (this.sbMainPanel)).BeginInit();
252 ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).BeginInit(); 248 ((System.ComponentModel.ISupportInitialize) (this.sbErrorPanel)).BeginInit();
253 ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).BeginInit(); 249 ((System.ComponentModel.ISupportInitialize) (this.sbPointsPanel)).BeginInit();
254 this.SuspendLayout(); 250 this.SuspendLayout();
255 // 251 //
256 // statusBar 252 // statusBar
257 // 253 //
258 this.statusBar.Location = new System.Drawing.Point(0, 548); 254 this.statusBar.Location = new System.Drawing.Point(0, 548);
348 this.bttnRedo.Name = "bttnRedo"; 344 this.bttnRedo.Name = "bttnRedo";
349 this.bttnRedo.Style = System.Windows.Forms.ToolBarButtonStyle.DropDownButton; 345 this.bttnRedo.Style = System.Windows.Forms.ToolBarButtonStyle.DropDownButton;
350 // 346 //
351 // buttonIcons 347 // buttonIcons
352 // 348 //
353 this.buttonIcons.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("buttonIcons.ImageStream"))); 349 this.buttonIcons.ImageStream = ((System.Windows.Forms.ImageListStreamer) (resources.GetObject("buttonIcons.ImageStream")));
354 this.buttonIcons.TransparentColor = System.Drawing.Color.Transparent; 350 this.buttonIcons.TransparentColor = System.Drawing.Color.Transparent;
355 this.buttonIcons.Images.SetKeyName(0, ""); 351 this.buttonIcons.Images.SetKeyName(0, "");
356 this.buttonIcons.Images.SetKeyName(1, ""); 352 this.buttonIcons.Images.SetKeyName(1, "");
357 this.buttonIcons.Images.SetKeyName(2, ""); 353 this.buttonIcons.Images.SetKeyName(2, "");
358 this.buttonIcons.Images.SetKeyName(3, ""); 354 this.buttonIcons.Images.SetKeyName(3, "");
490 // 486 //
491 // menuHelp 487 // menuHelp
492 // 488 //
493 this.menuHelp.Index = 2; 489 this.menuHelp.Index = 2;
494 this.menuHelp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { 490 this.menuHelp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
495 this.miAbout, 491 this.miAbout});
496 this.miDebugWindow});
497 this.menuHelp.Text = "&help"; 492 this.menuHelp.Text = "&help";
498 // 493 //
499 // miAbout 494 // miAbout
500 // 495 //
501 this.miAbout.Enabled = false; 496 this.miAbout.Enabled = false;
502 this.miAbout.Index = 0; 497 this.miAbout.Index = 0;
503 this.miAbout.Text = "&about"; 498 this.miAbout.Text = "&about";
504 // 499 //
505 // miDebugWindow
506 //
507 this.miDebugWindow.Index = 1;
508 this.miDebugWindow.Text = "&debug";
509 this.miDebugWindow.Click += new System.EventHandler(this.miDebugWindow_Click);
510 //
511 // saveArmyDialog 500 // saveArmyDialog
512 // 501 //
513 this.saveArmyDialog.Title = "Translatable:saveArmyDialog"; 502 this.saveArmyDialog.Title = "Translatable:saveArmyDialog";
514 // 503 //
515 // pnlRight 504 // pnlRight
516 // 505 //
517 this.pnlRight.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 506 this.pnlRight.Anchor = ((System.Windows.Forms.AnchorStyles) (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
518 | System.Windows.Forms.AnchorStyles.Right))); 507 | System.Windows.Forms.AnchorStyles.Right)));
519 this.pnlRight.BackColor = System.Drawing.SystemColors.AppWorkspace; 508 this.pnlRight.BackColor = System.Drawing.SystemColors.AppWorkspace;
520 this.pnlRight.Location = new System.Drawing.Point(726, 30); 509 this.pnlRight.Location = new System.Drawing.Point(726, 30);
521 this.pnlRight.Name = "pnlRight"; 510 this.pnlRight.Name = "pnlRight";
522 this.pnlRight.Size = new System.Drawing.Size(64, 516); 511 this.pnlRight.Size = new System.Drawing.Size(64, 516);
534 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); 523 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
535 this.ClientSize = new System.Drawing.Size(792, 570); 524 this.ClientSize = new System.Drawing.Size(792, 570);
536 this.Controls.Add(this.pnlRight); 525 this.Controls.Add(this.pnlRight);
537 this.Controls.Add(this.toolBar); 526 this.Controls.Add(this.toolBar);
538 this.Controls.Add(this.statusBar); 527 this.Controls.Add(this.statusBar);
539 this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 528 this.Icon = ((System.Drawing.Icon) (resources.GetObject("$this.Icon")));
540 this.IsMdiContainer = true; 529 this.IsMdiContainer = true;
541 this.Menu = this.mainMenu; 530 this.Menu = this.mainMenu;
542 this.Name = "FrmMain"; 531 this.Name = "FrmMain";
543 this.Text = "WarFoundry"; 532 this.Text = "WarFoundry";
544 ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).EndInit(); 533 ((System.ComponentModel.ISupportInitialize) (this.sbMainPanel)).EndInit();
545 ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).EndInit(); 534 ((System.ComponentModel.ISupportInitialize) (this.sbErrorPanel)).EndInit();
546 ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).EndInit(); 535 ((System.ComponentModel.ISupportInitialize) (this.sbPointsPanel)).EndInit();
547 this.ResumeLayout(false); 536 this.ResumeLayout(false);
548 this.PerformLayout(); 537 this.PerformLayout();
549 538
550 } 539 }
551 #endregion 540 #endregion
1221 private void statusBar_DrawItem(object sender, System.Windows.Forms.StatusBarDrawItemEventArgs sbdevent) 1210 private void statusBar_DrawItem(object sender, System.Windows.Forms.StatusBarDrawItemEventArgs sbdevent)
1222 { 1211 {
1223 statusBar.ColorableStatusBarDrawItem(sender, sbdevent); 1212 statusBar.ColorableStatusBarDrawItem(sender, sbdevent);
1224 } 1213 }
1225 1214
1226 private void miDebugWindow_Click(object sender, EventArgs e)
1227 {
1228 if (debugWindow == null || debugWindow.IsDisposed)
1229 {
1230 debugWindow = new FrmDebugOutput();
1231 }
1232
1233 debugWindow.Show();
1234 debugWindow.Focus();
1235 }
1236
1237 private void FrmMain_Closing(object sender, CancelEventArgs e) 1215 private void FrmMain_Closing(object sender, CancelEventArgs e)
1238 { 1216 {
1239 if (!CloseCurrentArmy()) 1217 if (!CloseCurrentArmy())
1240 { 1218 {
1241 e.Cancel = true; 1219 e.Cancel = true;