changeset 231:8021cc097ec8

Re #382: WinForms builds from Linux/Mono fail on Windows/.Net * Remove unnecessary ImageList from FrmNewUnit and replace with common resource
author IBBoard <dev@ibboard.co.uk>
date Sun, 04 Dec 2011 14:06:49 +0000
parents 5b8f0a6bf0b2
children 26eb5fc9d8c5
files FrmNewUnit.cs FrmNewUnit.resx FrmUnit.resources Properties/Resources.Designer.cs Properties/Resources.resx
diffstat 5 files changed, 222 insertions(+), 332 deletions(-) [+]
line diff
     1.1 --- a/FrmNewUnit.cs	Sat Dec 03 15:03:12 2011 +0000
     1.2 +++ b/FrmNewUnit.cs	Sun Dec 04 14:06:49 2011 +0000
     1.3 @@ -1,238 +1,212 @@
     1.4 -// This file (FrmNewUnit.cs) is a part of the IBBoard.WarFoundry.GUI.WinForms project and is copyright 2007, 2008, 2009 IBBoard.
     1.5 -//
     1.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.
     1.7 -
     1.8 +// This file (FrmNewUnit.cs) is a part of the IBBoard.WarFoundry.GUI.WinForms project and is copyright 2007, 2008, 2009 IBBoard.
     1.9 +//
    1.10 +// 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.
    1.11 +
    1.12  using System;
    1.13 -using System.Collections.Generic;
    1.14 -using System.Drawing;
    1.15 -using System.ComponentModel;
    1.16 -using System.Windows.Forms;
    1.17 -using IBBoard;
    1.18 -using IBBoard.Lang;
    1.19 -using IBBoard.Windows.Forms;
    1.20 -using IBBoard.WarFoundry.API;
    1.21 +using System.Collections.Generic;
    1.22 +using System.Drawing;
    1.23 +using System.ComponentModel;
    1.24 +using System.Windows.Forms;
    1.25 +using IBBoard;
    1.26 +using IBBoard.Lang;
    1.27 +using IBBoard.Windows.Forms;
    1.28 +using IBBoard.WarFoundry.API;
    1.29  using IBBoard.WarFoundry.API.Objects;
    1.30 -using IBBoard.WarFoundry.API.Objects.Requirement;
    1.31 -using IBBoard.Windows.Forms.I18N;
    1.32 -
    1.33 -namespace IBBoard.WarFoundry
    1.34 -{
    1.35 -	/// <summary>
    1.36 -	/// Summary description for FrmNewUnit.
    1.37 -	/// </summary>
    1.38 -	public class FrmNewUnit : IBBForm
    1.39 -	{
    1.40 -		private System.ComponentModel.IContainer components;
    1.41 -		private IBBoard.Windows.Forms.IBBButton bttnCancel;
    1.42 -		private IBBoard.Windows.Forms.IBBLabel lblUnitList;
    1.43 -		private IBBoard.Windows.Forms.IBBButton bttnSelectUnit;
    1.44 -		private System.Windows.Forms.ListBox lstUnits;
    1.45 -		private UnitType[] units;
    1.46 -		private Army army;
    1.47 -		private System.Windows.Forms.ImageList imageList;
    1.48 -		private System.Windows.Forms.Label lblNewUnitWarning;
    1.49 -		private System.Windows.Forms.Label lblWarningIcon;
    1.50 -
    1.51 -		public FrmNewUnit(Race race, Category cat, Army army)
    1.52 -		{
    1.53 -			InitializeComponent();
    1.54 -
    1.55 -			ControlTranslator.TranslateControl(this, cat.Name);
    1.56 -			units = race.GetUnitTypes(cat);
    1.57 -			this.army = army;
    1.58 -			
    1.59 -			for (int i = 0; i<units.Length; i++)
    1.60 -			{
    1.61 -				lstUnits.Items.Add(units[i].Name);
    1.62 -			}
    1.63 -		}
    1.64 -
    1.65 -		/// <summary>
    1.66 -		/// Clean up any resources being used.
    1.67 -		/// </summary>
    1.68 -		protected override void Dispose( bool disposing )
    1.69 -		{
    1.70 -			if( disposing )
    1.71 -			{
    1.72 -				if(components != null)
    1.73 -				{
    1.74 -					components.Dispose();
    1.75 -				}
    1.76 -			}
    1.77 -			base.Dispose( disposing );
    1.78 -		}
    1.79 -
    1.80 -		#region Windows Form Designer generated code
    1.81 -		/// <summary>
    1.82 -		/// Required method for Designer support - do not modify
    1.83 -		/// the contents of this method with the code editor.
    1.84 -		/// </summary>
    1.85 -		private void InitializeComponent()
    1.86 +using IBBoard.WarFoundry.API.Objects.Requirement;
    1.87 +using IBBoard.Windows.Forms.I18N;
    1.88 +
    1.89 +namespace IBBoard.WarFoundry
    1.90 +{
    1.91 +	/// <summary>
    1.92 +	/// Summary description for FrmNewUnit.
    1.93 +	/// </summary>
    1.94 +	public class FrmNewUnit : IBBForm
    1.95 +	{
    1.96 +		private IBBoard.Windows.Forms.IBBButton bttnCancel;
    1.97 +		private IBBoard.Windows.Forms.IBBLabel lblUnitList;
    1.98 +		private IBBoard.Windows.Forms.IBBButton bttnSelectUnit;
    1.99 +		private System.Windows.Forms.ListBox lstUnits;
   1.100 +		private UnitType[] units;
   1.101 +		private Army army;
   1.102 +		private System.Windows.Forms.Label lblNewUnitWarning;
   1.103 +		private System.Windows.Forms.Label lblWarningIcon;
   1.104 +
   1.105 +		public FrmNewUnit(Race race, Category cat, Army army)
   1.106  		{
   1.107 -            this.components = new System.ComponentModel.Container();
   1.108 -            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmNewUnit));
   1.109 -            this.lstUnits = new System.Windows.Forms.ListBox();
   1.110 -            this.bttnCancel = new IBBoard.Windows.Forms.IBBButton();
   1.111 -            this.lblUnitList = new IBBoard.Windows.Forms.IBBLabel();
   1.112 -            this.bttnSelectUnit = new IBBoard.Windows.Forms.IBBButton();
   1.113 -            this.lblNewUnitWarning = new System.Windows.Forms.Label();
   1.114 -            this.imageList = new System.Windows.Forms.ImageList(this.components);
   1.115 -            this.lblWarningIcon = new System.Windows.Forms.Label();
   1.116 -            this.SuspendLayout();
   1.117 -            // 
   1.118 -            // lstUnits
   1.119 -            // 
   1.120 -            this.lstUnits.Location = new System.Drawing.Point(88, 8);
   1.121 -            this.lstUnits.Name = "lstUnits";
   1.122 -            this.lstUnits.Size = new System.Drawing.Size(272, 121);
   1.123 -            this.lstUnits.TabIndex = 7;
   1.124 -            this.lstUnits.SelectedIndexChanged += new System.EventHandler(this.lstUnits_SelectedIndexChanged);
   1.125 -            this.lstUnits.DoubleClick += new System.EventHandler(this.lstUnits_DoubleClick);
   1.126 -            this.lstUnits.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lstUnits_MouseDown);
   1.127 -            // 
   1.128 -            // bttnCancel
   1.129 -            // 
   1.130 -            this.bttnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
   1.131 -            this.bttnCancel.FlatStyle = System.Windows.Forms.FlatStyle.System;
   1.132 -            this.bttnCancel.Location = new System.Drawing.Point(8, 168);
   1.133 -            this.bttnCancel.Name = "bttnCancel";
   1.134 -            this.bttnCancel.Size = new System.Drawing.Size(80, 24);
   1.135 -            this.bttnCancel.TabIndex = 6;
   1.136 -            this.bttnCancel.Text = "Cancel";
   1.137 -            this.bttnCancel.Click += new System.EventHandler(this.bttnCancel_Click);
   1.138 -            // 
   1.139 -            // lblUnitList
   1.140 -            // 
   1.141 -            this.lblUnitList.Location = new System.Drawing.Point(0, 8);
   1.142 -            this.lblUnitList.Name = "lblUnitList";
   1.143 -            this.lblUnitList.Size = new System.Drawing.Size(88, 80);
   1.144 -            this.lblUnitList.TabIndex = 5;
   1.145 -            this.lblUnitList.Text = "unit list";
   1.146 -            this.lblUnitList.TextAlign = System.Drawing.ContentAlignment.TopRight;
   1.147 -            // 
   1.148 -            // bttnSelectUnit
   1.149 -            // 
   1.150 -            this.bttnSelectUnit.Enabled = false;
   1.151 -            this.bttnSelectUnit.FlatStyle = System.Windows.Forms.FlatStyle.System;
   1.152 -            this.bttnSelectUnit.Location = new System.Drawing.Point(256, 168);
   1.153 -            this.bttnSelectUnit.Name = "bttnSelectUnit";
   1.154 -            this.bttnSelectUnit.Size = new System.Drawing.Size(104, 24);
   1.155 -            this.bttnSelectUnit.TabIndex = 4;
   1.156 -            this.bttnSelectUnit.Text = "create unit";
   1.157 -            this.bttnSelectUnit.Click += new System.EventHandler(this.bttnSelectUnit_Click);
   1.158 -            // 
   1.159 -            // lblNewUnitWarning
   1.160 -            // 
   1.161 -            this.lblNewUnitWarning.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
   1.162 -            this.lblNewUnitWarning.ImageList = this.imageList;
   1.163 -            this.lblNewUnitWarning.Location = new System.Drawing.Point(48, 136);
   1.164 -            this.lblNewUnitWarning.Name = "lblNewUnitWarning";
   1.165 -            this.lblNewUnitWarning.Size = new System.Drawing.Size(312, 32);
   1.166 -            this.lblNewUnitWarning.TabIndex = 9;
   1.167 -            this.lblNewUnitWarning.Text = "One or more unit requirements are not satisfied.";
   1.168 -            this.lblNewUnitWarning.TextAlign = System.Drawing.ContentAlignment.TopRight;
   1.169 -            this.lblNewUnitWarning.Visible = false;
   1.170 -            // 
   1.171 -            // imageList
   1.172 -            // 
   1.173 -            this.imageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList.ImageStream")));
   1.174 -            this.imageList.TransparentColor = System.Drawing.Color.Transparent;
   1.175 -            this.imageList.Images.SetKeyName(0, "");
   1.176 -            // 
   1.177 -            // lblWarningIcon
   1.178 -            // 
   1.179 -            this.lblWarningIcon.Image = ((System.Drawing.Image)(resources.GetObject("lblWarningIcon.Image")));
   1.180 -            this.lblWarningIcon.Location = new System.Drawing.Point(8, 136);
   1.181 -            this.lblWarningIcon.Name = "lblWarningIcon";
   1.182 -            this.lblWarningIcon.Size = new System.Drawing.Size(40, 32);
   1.183 -            this.lblWarningIcon.TabIndex = 10;
   1.184 -            this.lblWarningIcon.Visible = false;
   1.185 -            // 
   1.186 -            // FrmNewUnit
   1.187 -            // 
   1.188 -            this.AcceptButton = this.bttnSelectUnit;
   1.189 -            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
   1.190 -            this.CancelButton = this.bttnCancel;
   1.191 -            this.ClientSize = new System.Drawing.Size(370, 196);
   1.192 -            this.Controls.Add(this.lblWarningIcon);
   1.193 -            this.Controls.Add(this.lblNewUnitWarning);
   1.194 -            this.Controls.Add(this.bttnCancel);
   1.195 -            this.Controls.Add(this.lblUnitList);
   1.196 -            this.Controls.Add(this.bttnSelectUnit);
   1.197 -            this.Controls.Add(this.lstUnits);
   1.198 -            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
   1.199 -            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
   1.200 -            this.MaximizeBox = false;
   1.201 -            this.MinimizeBox = false;
   1.202 -            this.Name = "FrmNewUnit";
   1.203 -            this.ShowInTaskbar = false;
   1.204 -            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
   1.205 -            this.Text = "FrmNewUni";
   1.206 -            this.ResumeLayout(false);
   1.207 +			InitializeComponent();
   1.208  
   1.209 -		}
   1.210 -		#endregion
   1.211 -
   1.212 -		public UnitType SelectedUnit
   1.213 -		{
   1.214 -			get { return units[lstUnits.SelectedIndex]; }
   1.215 -		}
   1.216 -
   1.217 -		private void bttnCancel_Click(object sender, System.EventArgs e)
   1.218 -		{
   1.219 -			DialogResult = DialogResult.Cancel;
   1.220 -			this.Close();
   1.221 -		}
   1.222 -
   1.223 -		private void bttnSelectUnit_Click(object sender, System.EventArgs e)
   1.224 -		{
   1.225 -			selectUnit();
   1.226 -		}
   1.227 -
   1.228 -		private void selectUnit()
   1.229 -		{
   1.230 -			DialogResult = DialogResult.OK;
   1.231 -			this.Close();
   1.232 -		}
   1.233 -
   1.234 -		private void setSelectUnitEnabledVal()
   1.235 -		{
   1.236 -			if (lstUnits.SelectedIndex>-1)
   1.237 -			{
   1.238 +			ControlTranslator.TranslateControl(this, cat.Name);
   1.239 +			units = race.GetUnitTypes(cat);
   1.240 +			this.army = army;
   1.241 +			
   1.242 +			for (int i = 0; i<units.Length; i++)
   1.243 +			{
   1.244 +				lstUnits.Items.Add(units[i].Name);
   1.245 +			}
   1.246 +		}
   1.247 +
   1.248 +		#region Windows Form Designer generated code
   1.249 +		/// <summary>
   1.250 +		/// Required method for Designer support - do not modify
   1.251 +		/// the contents of this method with the code editor.
   1.252 +		/// </summary>
   1.253 +		private void InitializeComponent()
   1.254 +		{
   1.255 +			System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmNewUnit));
   1.256 +			this.lstUnits = new System.Windows.Forms.ListBox();
   1.257 +			this.bttnCancel = new IBBoard.Windows.Forms.IBBButton();
   1.258 +			this.lblUnitList = new IBBoard.Windows.Forms.IBBLabel();
   1.259 +			this.bttnSelectUnit = new IBBoard.Windows.Forms.IBBButton();
   1.260 +			this.lblNewUnitWarning = new System.Windows.Forms.Label();
   1.261 +			this.lblWarningIcon = new System.Windows.Forms.Label();
   1.262 +			this.SuspendLayout();
   1.263 +			// 
   1.264 +			// lstUnits
   1.265 +			// 
   1.266 +			this.lstUnits.Location = new System.Drawing.Point(88, 8);
   1.267 +			this.lstUnits.Name = "lstUnits";
   1.268 +			this.lstUnits.Size = new System.Drawing.Size(272, 121);
   1.269 +			this.lstUnits.TabIndex = 7;
   1.270 +			this.lstUnits.SelectedIndexChanged += new System.EventHandler(this.lstUnits_SelectedIndexChanged);
   1.271 +			this.lstUnits.DoubleClick += new System.EventHandler(this.lstUnits_DoubleClick);
   1.272 +			this.lstUnits.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lstUnits_MouseDown);
   1.273 +			// 
   1.274 +			// bttnCancel
   1.275 +			// 
   1.276 +			this.bttnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
   1.277 +			this.bttnCancel.FlatStyle = System.Windows.Forms.FlatStyle.System;
   1.278 +			this.bttnCancel.Location = new System.Drawing.Point(8, 168);
   1.279 +			this.bttnCancel.Name = "bttnCancel";
   1.280 +			this.bttnCancel.Size = new System.Drawing.Size(80, 24);
   1.281 +			this.bttnCancel.TabIndex = 6;
   1.282 +			this.bttnCancel.Text = "Cancel";
   1.283 +			this.bttnCancel.Click += new System.EventHandler(this.bttnCancel_Click);
   1.284 +			// 
   1.285 +			// lblUnitList
   1.286 +			// 
   1.287 +			this.lblUnitList.Location = new System.Drawing.Point(0, 8);
   1.288 +			this.lblUnitList.Name = "lblUnitList";
   1.289 +			this.lblUnitList.Size = new System.Drawing.Size(88, 80);
   1.290 +			this.lblUnitList.TabIndex = 5;
   1.291 +			this.lblUnitList.Text = "unit list";
   1.292 +			this.lblUnitList.TextAlign = System.Drawing.ContentAlignment.TopRight;
   1.293 +			// 
   1.294 +			// bttnSelectUnit
   1.295 +			// 
   1.296 +			this.bttnSelectUnit.Enabled = false;
   1.297 +			this.bttnSelectUnit.FlatStyle = System.Windows.Forms.FlatStyle.System;
   1.298 +			this.bttnSelectUnit.Location = new System.Drawing.Point(256, 168);
   1.299 +			this.bttnSelectUnit.Name = "bttnSelectUnit";
   1.300 +			this.bttnSelectUnit.Size = new System.Drawing.Size(104, 24);
   1.301 +			this.bttnSelectUnit.TabIndex = 4;
   1.302 +			this.bttnSelectUnit.Text = "create unit";
   1.303 +			this.bttnSelectUnit.Click += new System.EventHandler(this.bttnSelectUnit_Click);
   1.304 +			// 
   1.305 +			// lblNewUnitWarning
   1.306 +			// 
   1.307 +			this.lblNewUnitWarning.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
   1.308 +			this.lblNewUnitWarning.Location = new System.Drawing.Point(48, 136);
   1.309 +			this.lblNewUnitWarning.Name = "lblNewUnitWarning";
   1.310 +			this.lblNewUnitWarning.Size = new System.Drawing.Size(312, 32);
   1.311 +			this.lblNewUnitWarning.TabIndex = 9;
   1.312 +			this.lblNewUnitWarning.Text = "One or more unit requirements are not satisfied.";
   1.313 +			this.lblNewUnitWarning.TextAlign = System.Drawing.ContentAlignment.TopRight;
   1.314 +			this.lblNewUnitWarning.Visible = false;
   1.315 +			// 
   1.316 +			// lblWarningIcon
   1.317 +			// 
   1.318 +			this.lblWarningIcon.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.dialog_warning;
   1.319 +			this.lblWarningIcon.Location = new System.Drawing.Point(8, 136);
   1.320 +			this.lblWarningIcon.Name = "lblWarningIcon";
   1.321 +			this.lblWarningIcon.Size = new System.Drawing.Size(40, 32);
   1.322 +			this.lblWarningIcon.TabIndex = 10;
   1.323 +			this.lblWarningIcon.Visible = false;
   1.324 +			// 
   1.325 +			// FrmNewUnit
   1.326 +			// 
   1.327 +			this.AcceptButton = this.bttnSelectUnit;
   1.328 +			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
   1.329 +			this.CancelButton = this.bttnCancel;
   1.330 +			this.ClientSize = new System.Drawing.Size(370, 196);
   1.331 +			this.Controls.Add(this.lblWarningIcon);
   1.332 +			this.Controls.Add(this.lblNewUnitWarning);
   1.333 +			this.Controls.Add(this.bttnCancel);
   1.334 +			this.Controls.Add(this.lblUnitList);
   1.335 +			this.Controls.Add(this.bttnSelectUnit);
   1.336 +			this.Controls.Add(this.lstUnits);
   1.337 +			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
   1.338 +			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
   1.339 +			this.MaximizeBox = false;
   1.340 +			this.MinimizeBox = false;
   1.341 +			this.Name = "FrmNewUnit";
   1.342 +			this.ShowInTaskbar = false;
   1.343 +			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
   1.344 +			this.Text = "FrmNewUni";
   1.345 +			this.ResumeLayout(false);
   1.346 +
   1.347 +		}
   1.348 +		#endregion
   1.349 +
   1.350 +		public UnitType SelectedUnit
   1.351 +		{
   1.352 +			get { return units[lstUnits.SelectedIndex]; }
   1.353 +		}
   1.354 +
   1.355 +		private void bttnCancel_Click(object sender, System.EventArgs e)
   1.356 +		{
   1.357 +			DialogResult = DialogResult.Cancel;
   1.358 +			this.Close();
   1.359 +		}
   1.360 +
   1.361 +		private void bttnSelectUnit_Click(object sender, System.EventArgs e)
   1.362 +		{
   1.363 +			selectUnit();
   1.364 +		}
   1.365 +
   1.366 +		private void selectUnit()
   1.367 +		{
   1.368 +			DialogResult = DialogResult.OK;
   1.369 +			this.Close();
   1.370 +		}
   1.371 +
   1.372 +		private void setSelectUnitEnabledVal()
   1.373 +		{
   1.374 +			if (lstUnits.SelectedIndex>-1)
   1.375 +			{
   1.376  				bttnSelectUnit.Enabled = true;
   1.377 -                ICollection<string> failureMessages;
   1.378 -				lblNewUnitWarning.Visible = !Validates.AsOkay(RequirementHandler.AllowsAdding(SelectedUnit, army, out failureMessages));
   1.379 -				lblWarningIcon.Visible = lblNewUnitWarning.Visible;
   1.380 -
   1.381 -				if (lblNewUnitWarning.Visible)
   1.382 -				{
   1.383 -					lblNewUnitWarning.Text = String.Join("\n", new List<string>(failureMessages).ToArray());
   1.384 -				}
   1.385 -			}
   1.386 -			else
   1.387 -			{
   1.388 -				bttnSelectUnit.Enabled = false;
   1.389 -			}
   1.390 -		}
   1.391 -
   1.392 -		private void lstUnits_SelectedIndexChanged(object sender, System.EventArgs e)
   1.393 -		{
   1.394 -			setSelectUnitEnabledVal();
   1.395 -		}
   1.396 -
   1.397 -		private void lstUnits_DoubleClick(object sender, EventArgs e)
   1.398 -		{
   1.399 -			if (lstUnits.SelectedIndex>-1)
   1.400 -			{
   1.401 -				selectUnit();
   1.402 -			}
   1.403 -		}
   1.404 -
   1.405 -		private void lstUnits_MouseDown(object sender, MouseEventArgs e)
   1.406 -		{
   1.407 -			//make sure no item is selected when a click is made outside a unit
   1.408 -			int index = lstUnits.IndexFromPoint(e.X, e.Y);
   1.409 -			lstUnits.SelectedIndex = index;
   1.410 -		}
   1.411 -	}
   1.412 -}
   1.413 +                ICollection<string> failureMessages;
   1.414 +				lblNewUnitWarning.Visible = !Validates.AsOkay(RequirementHandler.AllowsAdding(SelectedUnit, army, out failureMessages));
   1.415 +				lblWarningIcon.Visible = lblNewUnitWarning.Visible;
   1.416 +
   1.417 +				if (lblNewUnitWarning.Visible)
   1.418 +				{
   1.419 +					lblNewUnitWarning.Text = String.Join("\n", new List<string>(failureMessages).ToArray());
   1.420 +				}
   1.421 +			}
   1.422 +			else
   1.423 +			{
   1.424 +				bttnSelectUnit.Enabled = false;
   1.425 +			}
   1.426 +		}
   1.427 +
   1.428 +		private void lstUnits_SelectedIndexChanged(object sender, System.EventArgs e)
   1.429 +		{
   1.430 +			setSelectUnitEnabledVal();
   1.431 +		}
   1.432 +
   1.433 +		private void lstUnits_DoubleClick(object sender, EventArgs e)
   1.434 +		{
   1.435 +			if (lstUnits.SelectedIndex>-1)
   1.436 +			{
   1.437 +				selectUnit();
   1.438 +			}
   1.439 +		}
   1.440 +
   1.441 +		private void lstUnits_MouseDown(object sender, MouseEventArgs e)
   1.442 +		{
   1.443 +			//make sure no item is selected when a click is made outside a unit
   1.444 +			int index = lstUnits.IndexFromPoint(e.X, e.Y);
   1.445 +			lstUnits.SelectedIndex = index;
   1.446 +		}
   1.447 +	}
   1.448 +}
     2.1 --- a/FrmNewUnit.resx	Sat Dec 03 15:03:12 2011 +0000
     2.2 +++ b/FrmNewUnit.resx	Sun Dec 04 14:06:49 2011 +0000
     2.3 @@ -117,101 +117,7 @@
     2.4    <resheader name="writer">
     2.5      <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
     2.6    </resheader>
     2.7 -  <metadata name="imageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     2.8 -    <value>17, 17</value>
     2.9 -  </metadata>
    2.10 -  <data name="imageList.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
    2.11 -    <value>
    2.12 -        AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
    2.13 -        LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
    2.14 -        ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAC4
    2.15 -        DAAAAk1TRnQBSQFMAwEBAAEEAQABBAEAASABAAEgAQAE/wEhAQAI/wFCAU0BNgcAATYDAAEoAwABgAMA
    2.16 -        ASADAAEBAQABIAYAAUD/AP8AJAADAgH/AwIB/wMCAf8DAgH/AwIB/wMCAf8DAgH/AwIB/wMCAf8DAgH/
    2.17 -        AwIB/wMCAf8DAgH/AwIB/wMCAf8DAgH/AwIB/wMCAf8DAgH/AwIB/wMCAf8DAgH/AwIB//8AnQADAgH/
    2.18 -        AwIB/wICASoB/wICAS0B/wICASsB/wICASsB/wICASsB/wICASsB/wICASsB/wICASsB/wICASsB/wIC
    2.19 -        ASsB/wICASsB/wICASsB/wICASsB/wICASsB/wICASsB/wICASsB/wICASsB/wICASsB/wICASsB/wIC
    2.20 -        ASsB/wICASsB/wICAS0B/wICAS0B/wICASoB/wMCAf//AJEAAwIB/wICAWwB/wICAZ0B/wICAZ8B/wIC
    2.21 -        AZ8B/wICAZ8B/wICAZ8B/wICAZ8B/wICAZ8B/wICAZ8B/wICAZ8B/wICAZ8B/wICAZ8B/wICAZ8B/wIC
    2.22 -        AZ8B/wICAZ8B/wICAZ8B/wICAZ8B/wICAZ8B/wICAZ8B/wICAZ8B/wICAZ8B/wICAZ8B/wICAZ8B/wIC
    2.23 -        AZ8B/wICAZ8B/wICAZ8B/wICAZ0B/wICAXIB//8AjQADAgH/AgIBnAH/Aj0BxAH/AnIB4AH/AncB4gH/
    2.24 -        AnYB4gH/AnMB4QH/AnEB4QH/Am4B4AH/AmsB3wH/AmgB3wH/AmYB3gH/AmMB3gH/AmAB3QH/Al4B3AH/
    2.25 -        AlsB3AH/AlgB2wH/AlUB2wH/AlMB2gH/AlAB2gH/Ak0B2QH/AkoB2AH/AkcB2AH/AkUB1wH/AkIB1wH/
    2.26 -        AkAB1gH/AjgB1AH/Ah0BvAH/AgIBngH//wCRAAICAaAB/wJ7Ad0B/wIWAdAB/wICAcwB/wICAcwB/wIC
    2.27 -        AcwB/wICAcwB/wICAcwB/wICAcwB/wICAcwB/wICAcwB/wICAcwB/wICAcwB/wICAcwB/wICAcwB/wIC
    2.28 -        AcwB/wICAcwB/wICAcwB/wICAcwB/wICAcwB/wICAcwB/wICAcwB/wICAcwB/wICAcwB/wICAcwB/wIM
    2.29 -        Ac4B/wI6Ac8B/wICAZ8B//8AkQACAgGhAf8CWAHHAf8CPAHYAf8CAgHMAf8CowHbAf8C0gHgAf8C0gHg
    2.30 -        Af8C0wHhAf8C1AHiAf8C1AHiAf8C1QHjAf8C1gHkAf8C1wHlAf8C2AHmAf8C2AHmAf8C2QHnAf8C2QHn
    2.31 -        Af8C2gHoAf8C2gHoAf8C2wHpAf8C3AHqAf8C3QHrAf8C3gHsAf8CwQHnAf8CAgHMAf8CHQHRAf8CKwG/
    2.32 -        Af8CAgGiAf//AJEAAgIBngH/AhgBpwH/AncB3QH/AgoBzgH/AlIB0wH/A+AB/wPhAf8D4QH/A+IB/wPj
    2.33 -        Af8D4wH/A+QB/wPlAf8D5gH/A+YB/wPnAf8D6AH/A+kB/wPqAf8D6gH/A+sB/wPsAf8D7QH/AmsB2wH/
    2.34 -        AgUBzQH/Aj0B0wH/Ag4BpQH/AgIBoAH//wCVAAICAaEB/wJUAcQB/wJGAdoB/wIEAcwB/wKzAdsB/wPg
    2.35 -        Af8D4QH/A+EB/wPiAf8D4wH/A+MB/wPkAf8DPgH/AzkB/wPmAf8D5wH/A+gB/wPpAf8D6gH/A+oB/wPr
    2.36 -        Af8CzQHnAf8CCQHNAf8CJgHTAf8CLgG7Af8CAgGgAf//AJkAAgIBngH/AhEBpgH/AnsB3AH/AhABzwH/
    2.37 -        Aj0B0QH/A98B/wPgAf8D4AH/A+EB/wPiAf8D4gH/A+MB/wM5Af8DNwH/A+YB/wPmAf8D5wH/A+gB/wPp
    2.38 -        Af8D6gH/A+oB/wJUAdcB/wIKAc4B/wJFAdIB/wIKAaIB/wICAaAB//8AnQACAgGgAf8CSAG9Af8CUwHc
    2.39 -        Af8CAgHMAf8CogHaAf8D3wH/A+AB/wPgAf8D4QH/A+IB/wPiAf8D1wH/A9cB/wPlAf8D5gH/A+YB/wPn
    2.40 -        Af8D6AH/A+kB/wK6AeMB/wIDAcwB/wIxAdUB/wIrAbcB/wICAaAB//8AoQACAgGiAf8CCgGiAf8CewHa
    2.41 -        Af8CGQHRAf8CLAHQAf8C3QHfAf8D3wH/A+AB/wPgAf8D4QH/A+IB/wMnAf8DJwH/A+QB/wPlAf8D5QH/
    2.42 -        A+YB/wPnAf8D6AH/Aj0B0wH/AhABzwH/AksB0QH/AgcBogH/AgIBoQH//wClAAICAZ8B/wI9AbgB/wJg
    2.43 -        Ad4B/wICAcwB/wKNAdcB/wPfAf8D3wH/A+AB/wPgAf8D4QH/Ax0B/wMdAf8D4wH/A+QB/wPlAf8D5QH/
    2.44 -        A+YB/wKkAd8B/wICAcwB/wI+AdcB/wImAbEB/wICAaEB//8ArQACBQGiAf8CdQHXAf8CJAHTAf8CHQHO
    2.45 -        Af8C1wHdAf8D3wH/A98B/wPgAf8D4AH/Aw8B/wMPAf8D4gH/A+MB/wPkAf8D5QH/AuIB5AH/AioB0QH/
    2.46 -        AhoB0QH/Ak0BzgH/AgQBogH/AgIBpAH//wCtAAICAaAB/wIxAbEB/wJsAd8B/wIDAcwB/wJ7AdUB/wPe
    2.47 -        Af8D3gH/A98B/wPgAf8DBQH/AwUB/wPhAf8D4gH/A+MB/wPkAf8CjAHaAf8CAwHMAf8CTQHaAf8CIAGs
    2.48 -        Af8CAgGfAf//ALUAAgMBoQH/Am4B0wH/AjEB1QH/AhIBzgH/As4B3AH/A94B/wPeAf8D1wH/AwIB/wMC
    2.49 -        Af8D2QH/A+EB/wPiAf8C2gHiAf8CGwHPAf8CJgHTAf8CSwHLAf8CAgGhAf//ALkAAgIBoAH/AiQBrAH/
    2.50 -        AncB4AH/AgYBzQH/AmgB1AH/A90B/wPeAf8DzAH/AwIB/wMCAf8DzgH/A+EB/wPhAf8CeAHYAf8CBgHN
    2.51 -        Af8CWQHbAf8CGAGoAf8CAgGfAf//AL0AAgIBoAH/AmQBzAH/Aj0B2AH/AgkBzQH/AsMB2wH/A90B/wPB
    2.52 -        Af8DAgH/AwIB/wPDAf8D4AH/As4B3wH/Ag4BzQH/AjMB1gH/AkcBxwH/AgIBogH//wDBAAICAZwB/wIZ
    2.53 -        AakB/wJ+AeAB/wIKAc4B/wJUAdIB/wPdAf8D2gH/A88B/wPPAf8D3AH/A98B/wJjAdUB/wILAc4B/wJk
    2.54 -        AdsB/wIRAaUB/wICAZ4B//8AxQACAgGgAf8CWAHGAf8CSgHaAf8CBAHMAf8CtAHZAf8D3QH/A90B/wPe
    2.55 -        Af8D3gH/AsAB3AH/AgYBzAH/AkIB2QH/AkABwQH/AgIBoQH//wDJAAICAZ4B/wIRAaYB/wKBAeAB/wIR
    2.56 -        Ac8B/wJBAdEB/wPcAf8D3QH/A90B/wPeAf8CTAHSAf8CEwHPAf8CagHbAf8CCwGiAf8CAgGfAf//AM0A
    2.57 -        AgIBnwH/Ak0BwAH/AlcB3AH/AgIBzAH/AqIB1wH/A9wB/wPcAf8CrQHZAf8CAwHMAf8CUgHcAf8COQG8
    2.58 -        Af8CAgGgAf//ANEAAgIBpQH/AgoBowH/AoEB3gH/AhsB0QH/Ai4BzwH/AtoB2wH/A9wB/wI3AdAB/wIe
    2.59 -        AdIB/wJsAdkB/wIGAaIB/wICAZ4B//8A1QACAgGgAf8CQQG6Af8CZQHfAf8CAgHMAf8CjwHWAf8CmAHW
    2.60 -        Af8CAwHMAf8CYwHfAf8CMAG2Af8CAgGgAf//AN0AAgUBoQH/AnwB2gH/AiYB0wH/AhcBzgH/AhkBzQH/
    2.61 -        AiwB1AH/AmoB1wH/AgMBoAH/AgIBnwH//wDdAAICAZ4B/wI0AbQB/wJzAeEB/wIDAcwB/wIFAc0B/wJz
    2.62 -        AeEB/wImAa8B/wICAZ4B//8A5QACAwGhAf8CcAHVAf8CRAHZAf8CSAHaAf8CYQHSAf8CAgGhAf//AOkA
    2.63 -        AgIBoAH/AhUBpwH/Am8B2gH/AmwB2gH/AhEBpwH/AgIBnwH//wDtAAICAZ0B/wICAaEB/wICAaAB/wIC
    2.64 -        AaAB//8A/wD/AP8A/wD/AP8AvwABQgFNAT4HAAE+AwABKAMAAYADAAEgAwABAQEAAQEGAAECFgAD/wEA
    2.65 -        BP8MAAHwAgABHwwAAcACAAEHDAABgAIAAQMMAAGAAgABAwwAAcACAAEDDAABwAIAAQMMAAHAAgABAwwA
    2.66 -        AeACAAEHDAAB4AIAAQcMAAHwAgABDwwAAfACAAEPDAAB+AIAAR8MAAH8AgABHwwAAfwCAAE/DAAB/gIA
    2.67 -        AX8MAAH+AgABfwwAAf8CAAH/DAAB/wIAAf8MAAH/AYABAQH/DAAB/wGAAQEB/wwAAf8BwAEDAf8MAAH/
    2.68 -        AcABAwH/DAAB/wHgAQcB/wwAAf8B8AEHAf8MAAH/AfABDwH/DAAB/wH4AR8B/wwAAf8B+AEfAf8MAAH/
    2.69 -        AfwBPwH/DAAE/wwABP8MAAT/DAAL
    2.70 -</value>
    2.71 -  </data>
    2.72    <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    2.73 -  <data name="lblWarningIcon.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
    2.74 -    <value>
    2.75 -        iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
    2.76 -        YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAABU9JREFUWEftV2to
    2.77 -        k2cUftPUmWpvTm2VOtlKBes6i4LWWWldtcVaJtpinUMUq4hK1ZZqQZFR2I8xUAR/+WMXm7brNpQhll2q
    2.78 -        Y5bKhC0Xk7RN8n25Nb3fYJuwYdr07DmvpHTV2iTqvwUeyOW853nO5T3nixD/v14gA98Koa0TIvYFXER/
    2.79 -        9HMhauqFeHRdiH+Aj6P3FMVJEJY0L148oZw6RcrJk9SclBT4UogPo3AV+RFOe71Go3aePj3pLCggpaiI
    2.80 -        rIcOTSIb/VeFmB+5xwhPfCHE4Zb168e7q6vJoNGQUaslfv9dRsZj/FYdobvIzBF9XL1WO6RcuEC2jAwy
    2.81 -        LV1KxtRU6lizhuzHj9N1jeYvlCI5Mq8RWKP2ta35+QHvkSNkEIK6rlyhrmvXZCa8hw/T92vXPobNpxG4
    2.82 -        DN+0SYhFDTrdI09dHVmWLydzVhapikIul4sebthA1hUryImG1MfGcineCN9zmJZI7eV7JSUB1969Mnq7
    2.83 -        Xi/JGc6bN2UWXLt3092cnACy0BCm2/DMOKKvcNV8iN6clESW/HxJ7Ha7JTweD1l37iTzokWkohf0cXFB
    2.84 -        CH4nPO9hWHFEv5aXjys7dpAhJoacLS3/IWcBrnv3yBAbS86tW6ktL28c1/JOGK7nNvlMiKxvUlODvosX
    2.85 -        yaTTkbW0VJIrqL/ZbJbgbHi9XupEI5ri4kitqKCmpKQgMlcwN8McFoi+1VBRMeHIzSXj/PmktrdLAW1t
    2.86 -        bYSjEu34zufzkddkImN8PHWtW0cPCguDeiGsMNBELQLkeTfS04O+c+fIiPR2HDs2VXODwTAlwATi7u5u
    2.87 -        CUdtrbRV9+2jr1NSeER/EJUAVo6Ra7ZVVgY7s7PJlJxMLhBxvRl2u31KgNPplOR+v5/8XBpcUx5UvxcX
    2.88 -        84juxQB7LWIRiL7sVnb2hBd3m69Y5/nzU+Rcb065FmOYESLv6emh3t5eUi5dkmeUkhK6sXIlZ+FMRALq
    2.89 -        sOP1Wq3XXlMzaUtPJ1NaGrkRMROHyFlAQkKCBEceIu/r66NefLasXk2WZcvIBBH6mJg/G4VIDFsEFB//
    2.90 -        MTc34Dl48MnQuXz5KXKOOg3CGNPJWUB/fz95GxufnN2yhW5hUaEUn4QlAJ27UK/TjSlIuQWL5iEWjRdd
    2.91 -        Pz3yUMpXrVpFDE47E4fIBwYGaHBwkGy4OebERLIUF5N+3jwWkTanCNT+o5+LigKuPXtkBApG7rPIOe3c
    2.92 -        iIwQMUceIh8aGqKe1tYn/YMm/iEzkxcVkvucFwbHUozcv12IXipHBLORc9pzcnJoAxYRE88kHx4eJoYd
    2.93 -        g0sOsG3bCJkNQsTbs0pAiq7eLy0NKNu3y5Gr3r4tuz10x0PNFqr5FtSXRcxGPjIyQgNGoxxgfC3vZGWN
    2.94 -        Q8BPzxSA6NObU1Im3Bg6rNiGzfY88tnSHoqcyUdHR2lsbIzUEyfkkxP3RFN8PGch7ykRiL7pARaOY/Nm
    2.95 -        WXu1oYF8VqtEt81G/o4OiZ7OTurt6qI+1L7f4ZAYwCBiDGIIMYZUlYaxH0bQvKMYWgMY2+zTghvzS2bm
    2.96 -        BBr9t5kCYqDqDzdq/3DJEmn8KmBasIDMmzYROjGIWaObLiIeW89xPzc36KuqIj/K4D97Vj5sdp85Q77K
    2.97 -        SvIijV7sAs/Ro+TB1nNjRrgOHCDX/v2klpeTWlZGCm6OsmsXOTF8HFjdjsJCsqP57FjRXXl51LFxI91N
    2.98 -        S5tEuUdAHjddwMKTQryPPxtDUMcKXxnAMVwlRCnI580sQzK+eGu1EO/inryXKUThywL7AwrgezM43pwZ
    2.99 -        /XQhWnxYCLwOLHmJYH8JAP9xif754LlTLMof/wXRnKHWYdYWFAAAAABJRU5ErkJggg==
   2.100 -</value>
   2.101 -  </data>
   2.102    <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
   2.103      <value>
   2.104          AAABAAQAEBAAAAEAIABoBAAARgAAABgYAAABACAAiAkAAK4EAAAgIAAAAQAgAKgQAAA2DgAAMDAAAAEA
     3.1 Binary file FrmUnit.resources has changed
     4.1 --- a/Properties/Resources.Designer.cs	Sat Dec 03 15:03:12 2011 +0000
     4.2 +++ b/Properties/Resources.Designer.cs	Sun Dec 04 14:06:49 2011 +0000
     4.3 @@ -60,6 +60,13 @@
     4.4              }
     4.5          }
     4.6          
     4.7 +        internal static System.Drawing.Bitmap dialog_warning {
     4.8 +            get {
     4.9 +                object obj = ResourceManager.GetObject("dialog-warning", resourceCulture);
    4.10 +                return ((System.Drawing.Bitmap)(obj));
    4.11 +            }
    4.12 +        }
    4.13 +        
    4.14          internal static System.Drawing.Bitmap document_new {
    4.15              get {
    4.16                  object obj = ResourceManager.GetObject("document-new", resourceCulture);
     5.1 --- a/Properties/Resources.resx	Sat Dec 03 15:03:12 2011 +0000
     5.2 +++ b/Properties/Resources.resx	Sun Dec 04 14:06:49 2011 +0000
     5.3 @@ -121,9 +121,15 @@
     5.4    <data name="document-open" type="System.Resources.ResXFileRef, System.Windows.Forms">
     5.5      <value>..\icons\document-open.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
     5.6    </data>
     5.7 +  <data name="warning-sml" type="System.Resources.ResXFileRef, System.Windows.Forms">
     5.8 +    <value>..\icons\warning-sml.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
     5.9 +  </data>
    5.10    <data name="list-add" type="System.Resources.ResXFileRef, System.Windows.Forms">
    5.11      <value>..\icons\list-add.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
    5.12    </data>
    5.13 +  <data name="edit-delete" type="System.Resources.ResXFileRef, System.Windows.Forms">
    5.14 +    <value>..\icons\edit-delete.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
    5.15 +  </data>
    5.16    <data name="edit-undo" type="System.Resources.ResXFileRef, System.Windows.Forms">
    5.17      <value>..\icons\edit-undo.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
    5.18    </data>
    5.19 @@ -139,11 +145,8 @@
    5.20    <data name="document-save" type="System.Resources.ResXFileRef, System.Windows.Forms">
    5.21      <value>..\icons\document-save.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
    5.22    </data>
    5.23 -  <data name="warning-sml" type="System.Resources.ResXFileRef, System.Windows.Forms">
    5.24 -    <value>..\icons\warning-sml.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
    5.25 -  </data>
    5.26    <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    5.27 -  <data name="edit-delete" type="System.Resources.ResXFileRef, System.Windows.Forms">
    5.28 -    <value>..\icons\edit-delete.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
    5.29 +  <data name="dialog-warning" type="System.Resources.ResXFileRef, System.Windows.Forms">
    5.30 +    <value>..\icons\dialog-warning.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
    5.31    </data>
    5.32  </root>
    5.33 \ No newline at end of file