# HG changeset patch # User IBBoard # Date 1252863216 0 # Node ID 1576f669b3eb1a4cd9b9c52d613a8f98a8075b52 # Parent 1c74b51abac1293d45e1ade8faacefb971b96a2e 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 diff -r 1c74b51abac1 -r 1576f669b3eb FrmDebugOutput.cs --- a/FrmDebugOutput.cs Wed Sep 09 19:56:24 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,309 +0,0 @@ -// This file (FrmDebugOutput.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 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. - -using System; -using System.Drawing; -using System.Collections; -using System.ComponentModel; -using System.Text; -using System.Windows.Forms; -using IBBoard.Lang; -using IBBoard.Logging; -using IBBoard.Windows.Forms; - -namespace IBBoard.WarFoundry -{ - /// - /// Summary description for FrmDebugOutput. - /// - public class FrmDebugOutput : IBBForm - { - private System.Windows.Forms.ListBox lstDebugItems; - private System.Windows.Forms.ComboBox cmbDebugLevel; - private System.Windows.Forms.Label lblDebugLevel; - /// - /// Required designer variable. - /// - private System.ComponentModel.Container components = null; - private System.Windows.Forms.ContextMenu contextMenu; - private System.Windows.Forms.MenuItem miCopy; - private System.Windows.Forms.TextBox txtDetail; - private System.Windows.Forms.Splitter splitter1; - private System.Windows.Forms.Panel panel1; - //private int MAX_LIST_LENGTH = 50; - - public FrmDebugOutput() - { - //this.logger = logger; - //logger.LogUpdatedEvent+=new IBBoard.Logging.Logger.LogUpdatedDelegate(logger_LogUpdatedEvent); - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - /*if (LogLevels.Debug >= logger.LogLevel) - { - cmbDebugLevel.Items.Add(LogLevels.Debug); - } - - if (LogLevels.Info >= logger.LogLevel) - { - cmbDebugLevel.Items.Add(LogLevels.Info); - } - - if (LogLevels.Warning >= logger.LogLevel) - { - cmbDebugLevel.Items.Add(LogLevels.Warning); - } - - if (LogLevels.Error >= logger.LogLevel) - { - cmbDebugLevel.Items.Add(LogLevels.Error); - } - - if (LogLevels.Critical >= logger.LogLevel) - { - cmbDebugLevel.Items.Add(LogLevels.Critical); - }*/ - - this.Name = "DebugOutputForm"; - - //cmbDebugLevel.SelectedItem = logger.LogLevel; - - Translation.Translate(this, true); - - fillDebugList(); - } - - /// - /// 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.lstDebugItems = new System.Windows.Forms.ListBox(); - this.contextMenu = new System.Windows.Forms.ContextMenu(); - this.miCopy = new System.Windows.Forms.MenuItem(); - this.cmbDebugLevel = new System.Windows.Forms.ComboBox(); - this.lblDebugLevel = new System.Windows.Forms.Label(); - this.txtDetail = new System.Windows.Forms.TextBox(); - this.splitter1 = new System.Windows.Forms.Splitter(); - this.panel1 = new System.Windows.Forms.Panel(); - this.SuspendLayout(); - // - // lstDebugItems - // - this.lstDebugItems.ContextMenu = this.contextMenu; - this.lstDebugItems.Dock = System.Windows.Forms.DockStyle.Fill; - this.lstDebugItems.IntegralHeight = false; - this.lstDebugItems.Location = new System.Drawing.Point(0, 24); - this.lstDebugItems.Name = "lstDebugItems"; - this.lstDebugItems.ScrollAlwaysVisible = true; - this.lstDebugItems.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended; - this.lstDebugItems.Size = new System.Drawing.Size(656, 144); - this.lstDebugItems.TabIndex = 0; - this.lstDebugItems.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lstDebugItems_MouseDown); - this.lstDebugItems.SelectedIndexChanged += new System.EventHandler(this.lstDebugItems_SelectedIndexChanged); - // - // contextMenu - // - this.contextMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { - this.miCopy}); - this.contextMenu.Popup += new System.EventHandler(this.contextMenu_Popup); - // - // miCopy - // - this.miCopy.Index = 0; - this.miCopy.Text = "&Copy"; - this.miCopy.Click += new System.EventHandler(this.miCopy_Click); - // - // cmbDebugLevel - // - this.cmbDebugLevel.Location = new System.Drawing.Point(190, 2); - this.cmbDebugLevel.Name = "cmbDebugLevel"; - this.cmbDebugLevel.Size = new System.Drawing.Size(464, 21); - this.cmbDebugLevel.TabIndex = 1; - this.cmbDebugLevel.SelectedIndexChanged += new System.EventHandler(this.cmbDebugLevel_SelectedIndexChanged); - // - // lblDebugLevel - // - this.lblDebugLevel.Location = new System.Drawing.Point(16, 0); - this.lblDebugLevel.Name = "lblDebugLevel"; - this.lblDebugLevel.Size = new System.Drawing.Size(168, 21); - this.lblDebugLevel.TabIndex = 2; - this.lblDebugLevel.Text = "debug level:"; - this.lblDebugLevel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // txtDetail - // - this.txtDetail.Dock = System.Windows.Forms.DockStyle.Bottom; - this.txtDetail.Location = new System.Drawing.Point(0, 172); - this.txtDetail.Multiline = true; - this.txtDetail.Name = "txtDetail"; - this.txtDetail.ReadOnly = true; - this.txtDetail.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.txtDetail.Size = new System.Drawing.Size(656, 64); - this.txtDetail.TabIndex = 3; - this.txtDetail.TabStop = false; - this.txtDetail.Text = ""; - this.txtDetail.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtDetail_KeyDown); - // - // splitter1 - // - this.splitter1.Cursor = System.Windows.Forms.Cursors.HSplit; - this.splitter1.Dock = System.Windows.Forms.DockStyle.Bottom; - this.splitter1.Location = new System.Drawing.Point(0, 168); - this.splitter1.MinExtra = 50; - this.splitter1.MinSize = 50; - this.splitter1.Name = "splitter1"; - this.splitter1.Size = new System.Drawing.Size(656, 4); - this.splitter1.TabIndex = 4; - this.splitter1.TabStop = false; - // - // panel1 - // - this.panel1.Dock = System.Windows.Forms.DockStyle.Top; - this.panel1.Location = new System.Drawing.Point(0, 0); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(656, 24); - this.panel1.TabIndex = 5; - // - // FrmDebugOutput - // - this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); - this.ClientSize = new System.Drawing.Size(656, 236); - this.Controls.Add(this.lblDebugLevel); - this.Controls.Add(this.cmbDebugLevel); - this.Controls.Add(this.lstDebugItems); - this.Controls.Add(this.splitter1); - this.Controls.Add(this.panel1); - this.Controls.Add(this.txtDetail); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.Name = "FrmDebugOutput"; - this.ShowInTaskbar = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "FrmDebugOutput"; - this.ResumeLayout(false); - - } - #endregion - - private void cmbDebugLevel_SelectedIndexChanged(object sender, System.EventArgs e) - { - fillDebugList(); - } - - private void fillDebugList() - { - lstDebugItems.Items.Clear(); - /*LogItem[] items = logger.GetLogItems((LogLevels)cmbDebugLevel.SelectedItem); - int last = items.Length - 1; - int stop = last - MAX_LIST_LENGTH; - - if (stop < 0) - { - stop = 0; - } - - //reverse fill the list so that we can have newest items at the top - for (int i = last; i >= stop; i--) - { - lstDebugItems.Items.Add(items[i]); - }*/ - } - - private void logger_LogUpdatedEvent(LogItem item) - { - /*if (item.Level >= (LogLevels)cmbDebugLevel.SelectedItem) - { - lock (lstDebugItems) - { - lstDebugItems.Items.Insert(0, item); - - if (lstDebugItems.Items.Count > MAX_LIST_LENGTH) - { - lstDebugItems.Items.RemoveAt(lstDebugItems.Items.Count - 1); - } - } - }*/ - } - - private void miCopy_Click(object sender, System.EventArgs e) - { - if (lstDebugItems.SelectedIndices.Count==1) - { - Clipboard.SetDataObject(lstDebugItems.SelectedItem.ToString()); - } - else if (lstDebugItems.SelectedIndices.Count > 1) - { - StringBuilder sb = new StringBuilder(); - - foreach (int idx in lstDebugItems.SelectedIndices) - { - sb.Append(lstDebugItems.Items[idx].ToString()+Environment.NewLine); - } - - Clipboard.SetDataObject(sb.ToString().Trim()); - } - } - - private void contextMenu_Popup(object sender, System.EventArgs e) - { - foreach (MenuItem mi in contextMenu.MenuItems) - { - mi.Visible = lstDebugItems.SelectedIndex > -1; - } - } - - private void lstDebugItems_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) - { - if (e.Button == MouseButtons.Right) - { - int idx = lstDebugItems.IndexFromPoint(e.X, e.Y); - - if (lstDebugItems.SelectedIndices.Contains(idx)) - { - lstDebugItems.SelectedIndex = idx; - } - } - } - - private void lstDebugItems_SelectedIndexChanged(object sender, System.EventArgs e) - { - if (lstDebugItems.SelectedIndex > -1) - { - LogItem item = (LogItem)lstDebugItems.SelectedItem; - txtDetail.Text = item.ToString() + Environment.NewLine + Environment.NewLine + "Stack Trace: "+ item.StackTrace; - } - else - { - txtDetail.Text = ""; - } - } - - private void txtDetail_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) - { - if(e.KeyData == (Keys.Control|Keys.A) && e.Control) - { - txtDetail.SelectAll(); - } - } - } -} diff -r 1c74b51abac1 -r 1576f669b3eb FrmDebugOutput.resources Binary file FrmDebugOutput.resources has changed diff -r 1c74b51abac1 -r 1576f669b3eb FrmDebugOutput.resx --- a/FrmDebugOutput.resx Wed Sep 09 19:56:24 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,208 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 1.3 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Private - - - False - - - Private - - - Private - - - 17, 17 - - - Private - - - Private - - - Private - - - Private - - - False - - - Private - - - False - - - Private - - - Private - - - Private - - - Private - - - False - - - False - - - Private - - - Private - - - False - - - True - - - Private - - - 8, 8 - - - True - - - Private - - - False - - - False - - - False - - - 8, 8 - - - (Default) - - - True - - - FrmDebugOutput - - - 80 - - - True - - - Private - - \ No newline at end of file diff -r 1c74b51abac1 -r 1576f669b3eb FrmEditUnitEquipment.cs --- a/FrmEditUnitEquipment.cs Wed Sep 09 19:56:24 2009 +0000 +++ b/FrmEditUnitEquipment.cs Sun Sep 13 17:33:36 2009 +0000 @@ -4,7 +4,6 @@ using System; using System.Drawing; -using System.Collections; using System.ComponentModel; using System.Windows.Forms; using IBBoard.Commands; diff -r 1c74b51abac1 -r 1576f669b3eb FrmMain.cs --- a/FrmMain.cs Wed Sep 09 19:56:24 2009 +0000 +++ b/FrmMain.cs Sun Sep 13 17:33:36 2009 +0000 @@ -5,7 +5,6 @@ using System; using System.Drawing; using System.Drawing.Drawing2D; -using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; @@ -50,7 +49,6 @@ //public FailedUnitRequirementDelegate FailedUnitRequirementMethod; private FrmArmyTree armyTree; - private FrmDebugOutput debugWindow; private string loadedFilePath; private System.ComponentModel.IContainer components; @@ -81,7 +79,6 @@ private IBBoard.Windows.Forms.IBBMenuItem miUndo; private IBBoard.Windows.Forms.IBBMenuItem miRedo; private IBBoard.Windows.Forms.IBBMenuItem menuHelp; - private IBBoard.Windows.Forms.IBBMenuItem miDebugWindow; private IBBoard.Windows.Forms.IBBMenuItem miAbout; private IBBoard.Windows.Forms.ColorableStatusBarPanel sbMainPanel; private IBBoard.Windows.Forms.ColorableStatusBarPanel sbErrorPanel; @@ -243,14 +240,13 @@ this.miRedo = new IBBoard.Windows.Forms.IBBMenuItem(); this.menuHelp = new IBBoard.Windows.Forms.IBBMenuItem(); this.miAbout = new IBBoard.Windows.Forms.IBBMenuItem(); - this.miDebugWindow = new IBBoard.Windows.Forms.IBBMenuItem(); this.openArmyDialog = new System.Windows.Forms.OpenFileDialog(); this.saveArmyDialog = new System.Windows.Forms.SaveFileDialog(); this.pnlRight = new System.Windows.Forms.Panel(); this.statusBarTimer = new System.Windows.Forms.Timer(this.components); - ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).BeginInit(); + ((System.ComponentModel.ISupportInitialize) (this.sbMainPanel)).BeginInit(); + ((System.ComponentModel.ISupportInitialize) (this.sbErrorPanel)).BeginInit(); + ((System.ComponentModel.ISupportInitialize) (this.sbPointsPanel)).BeginInit(); this.SuspendLayout(); // // statusBar @@ -350,7 +346,7 @@ // // buttonIcons // - this.buttonIcons.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("buttonIcons.ImageStream"))); + this.buttonIcons.ImageStream = ((System.Windows.Forms.ImageListStreamer) (resources.GetObject("buttonIcons.ImageStream"))); this.buttonIcons.TransparentColor = System.Drawing.Color.Transparent; this.buttonIcons.Images.SetKeyName(0, ""); this.buttonIcons.Images.SetKeyName(1, ""); @@ -492,8 +488,7 @@ // this.menuHelp.Index = 2; this.menuHelp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { - this.miAbout, - this.miDebugWindow}); + this.miAbout}); this.menuHelp.Text = "&help"; // // miAbout @@ -502,19 +497,13 @@ this.miAbout.Index = 0; this.miAbout.Text = "&about"; // - // miDebugWindow - // - this.miDebugWindow.Index = 1; - this.miDebugWindow.Text = "&debug"; - this.miDebugWindow.Click += new System.EventHandler(this.miDebugWindow_Click); - // // saveArmyDialog // this.saveArmyDialog.Title = "Translatable:saveArmyDialog"; // // pnlRight // - this.pnlRight.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.pnlRight.Anchor = ((System.Windows.Forms.AnchorStyles) (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Right))); this.pnlRight.BackColor = System.Drawing.SystemColors.AppWorkspace; this.pnlRight.Location = new System.Drawing.Point(726, 30); @@ -536,14 +525,14 @@ this.Controls.Add(this.pnlRight); this.Controls.Add(this.toolBar); this.Controls.Add(this.statusBar); - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Icon = ((System.Drawing.Icon) (resources.GetObject("$this.Icon"))); this.IsMdiContainer = true; this.Menu = this.mainMenu; this.Name = "FrmMain"; this.Text = "WarFoundry"; - ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).EndInit(); + ((System.ComponentModel.ISupportInitialize) (this.sbMainPanel)).EndInit(); + ((System.ComponentModel.ISupportInitialize) (this.sbErrorPanel)).EndInit(); + ((System.ComponentModel.ISupportInitialize) (this.sbPointsPanel)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -1223,17 +1212,6 @@ statusBar.ColorableStatusBarDrawItem(sender, sbdevent); } - private void miDebugWindow_Click(object sender, EventArgs e) - { - if (debugWindow == null || debugWindow.IsDisposed) - { - debugWindow = new FrmDebugOutput(); - } - - debugWindow.Show(); - debugWindow.Focus(); - } - private void FrmMain_Closing(object sender, CancelEventArgs e) { if (!CloseCurrentArmy()) diff -r 1c74b51abac1 -r 1576f669b3eb FrmNewArmy.cs --- a/FrmNewArmy.cs Wed Sep 09 19:56:24 2009 +0000 +++ b/FrmNewArmy.cs Sun Sep 13 17:33:36 2009 +0000 @@ -4,7 +4,6 @@ using System; using System.Drawing; -using System.Collections; using System.ComponentModel; using System.Windows.Forms; using IBBoard; diff -r 1c74b51abac1 -r 1576f669b3eb FrmNewUnit.cs --- a/FrmNewUnit.cs Wed Sep 09 19:56:24 2009 +0000 +++ b/FrmNewUnit.cs Sun Sep 13 17:33:36 2009 +0000 @@ -4,7 +4,6 @@ using System; using System.Drawing; -using System.Collections; using System.ComponentModel; using System.Windows.Forms; using IBBoard; diff -r 1c74b51abac1 -r 1576f669b3eb FrmNewUnitEquipment.cs --- a/FrmNewUnitEquipment.cs Wed Sep 09 19:56:24 2009 +0000 +++ b/FrmNewUnitEquipment.cs Sun Sep 13 17:33:36 2009 +0000 @@ -4,7 +4,6 @@ using System; using System.Drawing; -using System.Collections; using System.ComponentModel; using System.Windows.Forms; using IBBoard; diff -r 1c74b51abac1 -r 1576f669b3eb FrmReplaceUnitEquipment.cs --- a/FrmReplaceUnitEquipment.cs Wed Sep 09 19:56:24 2009 +0000 +++ b/FrmReplaceUnitEquipment.cs Sun Sep 13 17:33:36 2009 +0000 @@ -4,7 +4,6 @@ using System; using System.Drawing; -using System.Collections; using System.ComponentModel; using System.Windows.Forms; using IBBoard; diff -r 1c74b51abac1 -r 1576f669b3eb FrmSelectSystem.cs --- a/FrmSelectSystem.cs Wed Sep 09 19:56:24 2009 +0000 +++ b/FrmSelectSystem.cs Sun Sep 13 17:33:36 2009 +0000 @@ -5,7 +5,6 @@ using System; using System.IO; using System.Drawing; -using System.Collections; using System.ComponentModel; using System.Windows.Forms; using IBBoard; diff -r 1c74b51abac1 -r 1576f669b3eb IBBoard.WarFoundry.GUI.WinForms.csproj --- a/IBBoard.WarFoundry.GUI.WinForms.csproj Wed Sep 09 19:56:24 2009 +0000 +++ b/IBBoard.WarFoundry.GUI.WinForms.csproj Sun Sep 13 17:33:36 2009 +0000 @@ -118,9 +118,6 @@ Form - - Form - Form @@ -158,9 +155,6 @@ FrmArmyTree.cs - - FrmDebugOutput.cs - FrmEditUnitEquipment.cs diff -r 1c74b51abac1 -r 1576f669b3eb Util/UnitEquipmentChoice.cs --- a/Util/UnitEquipmentChoice.cs Wed Sep 09 19:56:24 2009 +0000 +++ b/Util/UnitEquipmentChoice.cs Sun Sep 13 17:33:36 2009 +0000 @@ -3,7 +3,6 @@ // 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. using System; -using System.Collections; using IBBoard.WarFoundry.API.Objects; @@ -19,8 +18,6 @@ private Unit unit; private UnitEquipmentItem item; - private static Hashtable equipObjs = new Hashtable(); - public UnitEquipmentChoice(Unit unit, UnitEquipmentItem unitItem) { this.unit = unit;