# HG changeset patch # User IBBoard # Date 1245247531 0 # Node ID 475d3cdb75f431948f188322a9c9b498b3147c11 # Parent e45af3c75b4e002942b40887644e25e88d5bf462 * White space cleanup no-open-ticket diff -r e45af3c75b4e -r 475d3cdb75f4 FrmArmyTree.cs --- a/FrmArmyTree.cs Wed Jun 17 11:04:22 2009 +0000 +++ b/FrmArmyTree.cs Wed Jun 17 14:05:31 2009 +0000 @@ -1,386 +1,386 @@ -// This file (FrmArmyTree.cs) is a part of the IBBoard.WarFoundry.GUI.WinForms project and is copyright 2009 IBBoard. -// -// The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license. - -using System; -using System.Drawing; -using System.Collections; -using System.ComponentModel; -using System.Windows.Forms; -using IBBoard.Commands; -using IBBoard.WarFoundry.API; -using IBBoard.WarFoundry.API.Commands; -using IBBoard.Windows.Forms; -using IBBoard.WarFoundry.API.Objects; - -namespace IBBoard.WarFoundry -{ - /// - /// Summary description for FrmArmyTree. - /// - public class FrmArmyTree : IBBoard.Windows.Forms.IBBForm - { - private System.Windows.Forms.TreeView treeView; - /// - /// Required designer variable. - /// - private System.ComponentModel.Container components = null; - private Hashtable htNodes; - private System.Windows.Forms.ContextMenu contextMenu; - private System.Windows.Forms.MenuItem miDelete; - private System.Windows.Forms.MenuItem miEdit; - private Hashtable htUnitWindows; - - private ObjectAddDelegate UnitAddedMethod; - private ObjectRemoveDelegate UnitRemovedMethod; - private StringValChangedDelegate UnitNameChangedMethod, ArmyNameChangedMethod, TreeNameChangedMethod; - private CommandStack commandStack; - - public FrmArmyTree(CommandStack cmdStack) - { - commandStack = cmdStack; - InitializeComponent(); - UnitAddedMethod = new ObjectAddDelegate(AddUnit); - UnitRemovedMethod = new ObjectRemoveDelegate(RemoveUnit); - UnitNameChangedMethod = new StringValChangedDelegate(UpdateUnitName); - ArmyNameChangedMethod = new StringValChangedDelegate(UpdateArmyName); - TreeNameChangedMethod = new StringValChangedDelegate(FrmArmyTree_TreeNameChanged); - htNodes = new Hashtable(); - htUnitWindows = new Hashtable(); - this.Name = "ArmyTree"; - WarFoundryCore.ArmyChanged+= new ArmyChangedDelegate(FrmArmyTree_ArmyChanged); - } - - public FrmArmyTree(Army army, CommandStack cmdStack) : this(cmdStack) - { - SetArmy(army); - } - - /// - /// Clean up any resources being used. - /// - protected override void Dispose( bool disposing ) - { - if( disposing ) - { - if(components != null) - { - components.Dispose(); - } - } - base.Dispose( disposing ); - } - - #region Windows Form Designer generated code - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.treeView = new System.Windows.Forms.TreeView(); - this.contextMenu = new System.Windows.Forms.ContextMenu(); - this.miEdit = new System.Windows.Forms.MenuItem(); - this.miDelete = new System.Windows.Forms.MenuItem(); - this.SuspendLayout(); - // - // treeView - // - this.treeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.treeView.ContextMenu = this.contextMenu; - this.treeView.FullRowSelect = true; - this.treeView.ImageIndex = -1; - this.treeView.Location = new System.Drawing.Point(0, 0); - this.treeView.Name = "treeView"; - this.treeView.SelectedImageIndex = -1; - this.treeView.Size = new System.Drawing.Size(240, 278); - this.treeView.TabIndex = 0; - this.treeView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.treeView_MouseDown); - this.treeView.DoubleClick += new System.EventHandler(this.treeView_DoubleClick); - // - // contextMenu - // - this.contextMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { - this.miEdit, - this.miDelete}); - this.contextMenu.Popup += new System.EventHandler(this.contextMenu_Popup); - // - // miEdit - // - this.miEdit.Index = 0; - this.miEdit.Text = "&Edit unit"; - this.miEdit.Click += new System.EventHandler(this.miEdit_Click); - // - // miDelete - // - this.miDelete.Index = 1; - this.miDelete.Text = "&Delete unit"; - this.miDelete.Click += new System.EventHandler(this.miDelete_Click); - // - // FrmArmyTree - // - this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); - this.ClientSize = new System.Drawing.Size(240, 277); - this.ControlBox = false; - this.Controls.Add(this.treeView); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "FrmArmyTree"; - this.Text = "FrmArmyTree"; - this.ResumeLayout(false); - - } - #endregion - - private void ClearArmy() - { - htNodes.Clear(); - treeView.Nodes.Clear(); - - ArrayList list = new ArrayList(htUnitWindows.Values); - - foreach (FrmUnit window in list) - { - window.Close(); - } - - htUnitWindows.Clear(); - } - - private void SetArmy(Army army) - { - if (army!=null) - { - ArmyCategory[] cats = army.Categories; - TreeNode[] catNodes = new TreeNode[cats.Length]; - Unit[] units; - - for (int i = 0; i + /// Summary description for FrmArmyTree. + /// + public class FrmArmyTree : IBBoard.Windows.Forms.IBBForm + { + private System.Windows.Forms.TreeView treeView; + /// + /// Required designer variable. + /// + private System.ComponentModel.Container components = null; + private Hashtable htNodes; + private System.Windows.Forms.ContextMenu contextMenu; + private System.Windows.Forms.MenuItem miDelete; + private System.Windows.Forms.MenuItem miEdit; + private Hashtable htUnitWindows; + + private ObjectAddDelegate UnitAddedMethod; + private ObjectRemoveDelegate UnitRemovedMethod; + private StringValChangedDelegate UnitNameChangedMethod, ArmyNameChangedMethod, TreeNameChangedMethod; + private CommandStack commandStack; + + public FrmArmyTree(CommandStack cmdStack) + { + commandStack = cmdStack; + InitializeComponent(); + UnitAddedMethod = new ObjectAddDelegate(AddUnit); + UnitRemovedMethod = new ObjectRemoveDelegate(RemoveUnit); + UnitNameChangedMethod = new StringValChangedDelegate(UpdateUnitName); + ArmyNameChangedMethod = new StringValChangedDelegate(UpdateArmyName); + TreeNameChangedMethod = new StringValChangedDelegate(FrmArmyTree_TreeNameChanged); + htNodes = new Hashtable(); + htUnitWindows = new Hashtable(); + this.Name = "ArmyTree"; + WarFoundryCore.ArmyChanged+= new ArmyChangedDelegate(FrmArmyTree_ArmyChanged); + } + + public FrmArmyTree(Army army, CommandStack cmdStack) : this(cmdStack) + { + SetArmy(army); + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if(components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.treeView = new System.Windows.Forms.TreeView(); + this.contextMenu = new System.Windows.Forms.ContextMenu(); + this.miEdit = new System.Windows.Forms.MenuItem(); + this.miDelete = new System.Windows.Forms.MenuItem(); + this.SuspendLayout(); + // + // treeView + // + this.treeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.treeView.ContextMenu = this.contextMenu; + this.treeView.FullRowSelect = true; + this.treeView.ImageIndex = -1; + this.treeView.Location = new System.Drawing.Point(0, 0); + this.treeView.Name = "treeView"; + this.treeView.SelectedImageIndex = -1; + this.treeView.Size = new System.Drawing.Size(240, 278); + this.treeView.TabIndex = 0; + this.treeView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.treeView_MouseDown); + this.treeView.DoubleClick += new System.EventHandler(this.treeView_DoubleClick); + // + // contextMenu + // + this.contextMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { + this.miEdit, + this.miDelete}); + this.contextMenu.Popup += new System.EventHandler(this.contextMenu_Popup); + // + // miEdit + // + this.miEdit.Index = 0; + this.miEdit.Text = "&Edit unit"; + this.miEdit.Click += new System.EventHandler(this.miEdit_Click); + // + // miDelete + // + this.miDelete.Index = 1; + this.miDelete.Text = "&Delete unit"; + this.miDelete.Click += new System.EventHandler(this.miDelete_Click); + // + // FrmArmyTree + // + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(240, 277); + this.ControlBox = false; + this.Controls.Add(this.treeView); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "FrmArmyTree"; + this.Text = "FrmArmyTree"; + this.ResumeLayout(false); + + } + #endregion + + private void ClearArmy() + { + htNodes.Clear(); + treeView.Nodes.Clear(); + + ArrayList list = new ArrayList(htUnitWindows.Values); + + foreach (FrmUnit window in list) + { + window.Close(); + } + + htUnitWindows.Clear(); + } + + private void SetArmy(Army army) + { + if (army!=null) + { + ArmyCategory[] cats = army.Categories; + TreeNode[] catNodes = new TreeNode[cats.Length]; + Unit[] units; + + for (int i = 0; i