changeset 68:7028e24b67ec

Re #60: Add UI to add/remove/edit weapons in GTK * Add "Replace" dialog Note: Dialog null refs because of a bad assumption in the base class - base constructor calls SetupUI before Replace constructor has set all of its values
author IBBoard <dev@ibboard.co.uk>
date Wed, 03 Nov 2010 21:02:54 +0000
parents a7306b5a229e
children 3b4a646b4054
files FrmReplaceEquipment.cs IBBoard.WarFoundry.GUI.GTK.csproj UIControl/AddEquipmentUIControl.cs UIControl/Interfaces/IReplaceEquipmentUI.cs UIControl/ReplaceEquipmentUIControl.cs Widgets/UnitDisplayWidget.cs gtk-gui/IBBoard.WarFoundry.GUI.GTK.FrmAddEquipment.cs gtk-gui/IBBoard.WarFoundry.GUI.GTK.FrmReplaceEquipment.cs gtk-gui/gui.stetic
diffstat 9 files changed, 980 insertions(+), 59 deletions(-) [+]
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/FrmReplaceEquipment.cs	Wed Nov 03 21:02:54 2010 +0000
     1.3 @@ -0,0 +1,235 @@
     1.4 +//  This file (FrmAddEquipment.cs) is a part of the IBBoard.WarFoundry.GUI.GTK project and is copyright 2010 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 +using System;
     1.9 +using IBBoard.WarFoundry.GUI.GTK.UIControl.Interfaces;
    1.10 +using IBBoard.WarFoundry.API.Objects;
    1.11 +using Gtk;
    1.12 +using IBBoard.WarFoundry.GUI.GTK.Util;
    1.13 +using IBBoard.GtkSharp;
    1.14 +using log4net.Repository.Hierarchy;
    1.15 +using log4net;
    1.16 +
    1.17 +namespace IBBoard.WarFoundry.GUI.GTK
    1.18 +{
    1.19 +	public partial class FrmReplaceEquipment : Dialog, IReplaceEquipmentUI
    1.20 +	{
    1.21 +		private static ILog log = LogManager.GetLogger(typeof(FrmReplaceEquipment));
    1.22 +		
    1.23 +		public event SingleArgMethodInvoker<UnitEquipmentItem> UnitEquipmentItemChoiceChanged;
    1.24 +
    1.25 +		public event MethodInvoker UnitEquipmentAmountTypeChanged;
    1.26 +
    1.27 +		public event MethodInvoker UnitEquipmentAmountChanged;
    1.28 +				private bool limitsEnabled = false;
    1.29 +		private bool ratioLimited = false;
    1.30 +		
    1.31 +		public FrmReplaceEquipment()
    1.32 +		{
    1.33 +			this.Build();
    1.34 +			lstEquipment.Selection.Changed += OnSelectionChanged;
    1.35 +			TreeViewColumn equipColumn = new TreeViewColumn();
    1.36 +			equipColumn.Title = "Equipment";
    1.37 +			CellRendererText equipCell = new CellRendererText();
    1.38 +			equipColumn.PackStart(equipCell, true);
    1.39 +			equipColumn.SetCellDataFunc(equipCell, GtkWarFoundryUtil.RenderWarFoundryObjectName);
    1.40 +			lstEquipment.AppendColumn(equipColumn);			
    1.41 +		}
    1.42 +		
    1.43 +		private void OnUnitEquipmentAmountChanged()
    1.44 +		{
    1.45 +			if (UnitEquipmentAmountChanged != null)
    1.46 +			{
    1.47 +				UnitEquipmentAmountChanged();
    1.48 +			}
    1.49 +		}
    1.50 +		
    1.51 +		private void OnUnitEquipmentAmountTypeChanged()
    1.52 +		{
    1.53 +			if (UnitEquipmentAmountChanged != null)
    1.54 +			{
    1.55 +				UnitEquipmentAmountTypeChanged();
    1.56 +			}
    1.57 +		}
    1.58 +		
    1.59 +		protected void OnSelectionChanged(object o, EventArgs e)
    1.60 +		{
    1.61 +			if (UnitEquipmentItemChoiceChanged != null)
    1.62 +			{
    1.63 +				UnitEquipmentItemChoiceChanged(SelectedUnitEquipmentItem);
    1.64 +			}
    1.65 +		}
    1.66 +
    1.67 +		public void SetUnitEquipmentItems(UnitEquipmentItem[] items)
    1.68 +		{
    1.69 +			ListStore store = new ListStore(typeof(UnitEquipmentItem));
    1.70 +			
    1.71 +			foreach (UnitEquipmentItem equipItem in items)
    1.72 +			{
    1.73 +				store.AppendValues(equipItem);
    1.74 +			}
    1.75 +			
    1.76 +			lstEquipment.Model = store;
    1.77 +		}
    1.78 +
    1.79 +		public void SetUnitEquipmentLimits(bool isRatioLimit, double minPercent, double maxPercent, int minNumber, int maxNumber)
    1.80 +		{
    1.81 +			log.DebugFormat("IsRatio? {0}. Limits: {1}->{2}, {3}%->{4}%", isRatioLimit, minNumber, maxNumber, minPercent, maxPercent);
    1.82 +			ratioLimited = isRatioLimit;
    1.83 +			numericAmount.SetRange(minNumber, maxNumber);
    1.84 +			percentageAmount.SetRange(minPercent, maxPercent);
    1.85 +			
    1.86 +			if (isRatioLimit)
    1.87 +			{
    1.88 +				if (minPercent == 100)
    1.89 +				{
    1.90 +					rbEquipAll.Active = true;
    1.91 +				}
    1.92 +				else
    1.93 +				{
    1.94 +					rbEquipPercent.Active = true;
    1.95 +				}
    1.96 +			}
    1.97 +			else
    1.98 +			{
    1.99 +				rbEquipNumeric.Active = true;
   1.100 +			}
   1.101 +		}
   1.102 +
   1.103 +		public void SetUnitEquipmentLimitsEnabled(bool isEnabled)
   1.104 +		{
   1.105 +			SetNumericAmountEnabledState(isEnabled);
   1.106 +			SetPercentageAmountEnabledState(isEnabled);
   1.107 +		}
   1.108 +
   1.109 +		public bool ShowControl()
   1.110 +		{
   1.111 +			int result = Run();
   1.112 +			bool okayClicked = (result == (int)ResponseType.Ok);
   1.113 +			this.Hide();
   1.114 +			return okayClicked;
   1.115 +		}
   1.116 +		
   1.117 +		protected virtual void CancelButtonClicked(object sender, System.EventArgs e)
   1.118 +		{
   1.119 +			log.Debug("Cancel clicked");
   1.120 +			Respond(ResponseType.Cancel);
   1.121 +		}	
   1.122 +		
   1.123 +		protected virtual void OkayButtonClicked(object sender, System.EventArgs e)
   1.124 +		{
   1.125 +			log.Debug("Okay clicked");
   1.126 +			Respond(ResponseType.Ok);
   1.127 +		}		
   1.128 +		
   1.129 +		public void SetOkayEnabledState(bool enabled)
   1.130 +		{
   1.131 +			buttonOk.Sensitive = enabled;
   1.132 +		}
   1.133 +				
   1.134 +		protected virtual void SpinButtonValueChanged(object sender, System.EventArgs e)
   1.135 +		{
   1.136 +			OnUnitEquipmentAmountChanged();
   1.137 +		}		
   1.138 +		
   1.139 +		protected virtual void RadioButtonClicked(object sender, System.EventArgs e)
   1.140 +		{
   1.141 +			OnUnitEquipmentAmountTypeChanged();
   1.142 +		}
   1.143 +		
   1.144 +		public void SetNumericAmountEnabledState(bool enabled)
   1.145 +		{
   1.146 +			rbEquipNumeric.Sensitive = enabled;
   1.147 +			numericAmount.Sensitive = enabled;
   1.148 +		}		
   1.149 +		
   1.150 +		public void SetPercentageAmountEnabledState(bool enabled)
   1.151 +		{
   1.152 +			if (enabled)
   1.153 +			{
   1.154 +				double minPercentage = GetMinPercentage();
   1.155 +				rbEquipPercent.Sensitive = minPercentage != 100;
   1.156 +				percentageAmount.Sensitive = minPercentage != 100;
   1.157 +				double maxPercentage = GetMaxPercentage();
   1.158 +				rbEquipAll.Sensitive = ratioLimited && maxPercentage == 100;
   1.159 +				lblEquipAll.Sensitive = ratioLimited && maxPercentage == 100;
   1.160 +			}
   1.161 +			else
   1.162 +			{
   1.163 +				rbEquipPercent.Sensitive = false;
   1.164 +				percentageAmount.Sensitive = false;
   1.165 +				rbEquipAll.Sensitive = false;
   1.166 +				lblEquipAll.Sensitive = false;
   1.167 +			}
   1.168 +		}
   1.169 +
   1.170 +		private double GetMaxPercentage()
   1.171 +		{
   1.172 +			double min, max;
   1.173 +			percentageAmount.GetRange(out min, out max);
   1.174 +			return max;
   1.175 +		}
   1.176 +
   1.177 +		private double GetMinPercentage()
   1.178 +		{
   1.179 +			double min, max;
   1.180 +			percentageAmount.GetRange(out min, out max);
   1.181 +			return min;
   1.182 +		}
   1.183 +		
   1.184 +		public UnitEquipmentItem SelectedUnitEquipmentItem
   1.185 +		{
   1.186 +			get
   1.187 +			{
   1.188 +				return (UnitEquipmentItem)TreeUtils.GetSelectedItem(lstEquipment);
   1.189 +			}
   1.190 +		}
   1.191 +		
   1.192 +				public bool IsRatioEquipmentAmount
   1.193 +		{
   1.194 +			get
   1.195 +			{
   1.196 +				return !rbEquipNumeric.Active;
   1.197 +			}
   1.198 +		}
   1.199 +		
   1.200 +				public int EquipmentNumericAmount
   1.201 +		{
   1.202 +			get
   1.203 +			{
   1.204 +				return (int)numericAmount.Value;
   1.205 +			}
   1.206 +			
   1.207 +			set
   1.208 +			{
   1.209 +				numericAmount.Value = value;
   1.210 +			}
   1.211 +		}
   1.212 +		
   1.213 +				public double EquipmentPercentageAmount
   1.214 +		{
   1.215 +			get
   1.216 +			{
   1.217 +				double percent;
   1.218 +				
   1.219 +				if (rbEquipAll.Active)
   1.220 +				{
   1.221 +					percent = 100;
   1.222 +				}
   1.223 +				else
   1.224 +				{
   1.225 +					percent = percentageAmount.Value;
   1.226 +				}
   1.227 +				
   1.228 +				return percent;
   1.229 +			}
   1.230 +			
   1.231 +			set
   1.232 +			{
   1.233 +				percentageAmount.Value = value;
   1.234 +			}
   1.235 +		}
   1.236 +	}
   1.237 +}
   1.238 +
     2.1 --- a/IBBoard.WarFoundry.GUI.GTK.csproj	Sat Oct 30 14:30:29 2010 +0000
     2.2 +++ b/IBBoard.WarFoundry.GUI.GTK.csproj	Wed Nov 03 21:02:54 2010 +0000
     2.3 @@ -62,6 +62,10 @@
     2.4      <Compile Include="UIControl\AbstractBaseEquipmentUIControl.cs" />
     2.5      <Compile Include="UIControl\Interfaces\IBaseEquipmentUI.cs" />
     2.6      <Compile Include="UIControl\Interfaces\ISelectableItemEquipmentUI.cs" />
     2.7 +    <Compile Include="UIControl\Interfaces\IReplaceEquipmentUI.cs" />
     2.8 +    <Compile Include="FrmReplaceEquipment.cs" />
     2.9 +    <Compile Include="UIControl\ReplaceEquipmentUIControl.cs" />
    2.10 +    <Compile Include="gtk-gui\IBBoard.WarFoundry.GUI.GTK.FrmReplaceEquipment.cs" />
    2.11    </ItemGroup>
    2.12    <ItemGroup>
    2.13      <Content Include="App.png" />
     3.1 --- a/UIControl/AddEquipmentUIControl.cs	Sat Oct 30 14:30:29 2010 +0000
     3.2 +++ b/UIControl/AddEquipmentUIControl.cs	Wed Nov 03 21:02:54 2010 +0000
     3.3 @@ -1,14 +1,14 @@
     3.4  //  This file (AddEquipmentUIControl.cs) is a part of the IBBoard.WarFoundry.GUI.GTK project and is copyright 2010 IBBoard
     3.5  // 
     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.
     3.7 -using System;
     3.8 +// 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.9 +
    3.10  using IBBoard.Commands;
    3.11 +using IBBoard.WarFoundry.API.Commands;
    3.12  using IBBoard.WarFoundry.API.Objects;
    3.13  using IBBoard.WarFoundry.API.Util;
    3.14  using IBBoard.WarFoundry.GUI.GTK.UIControl.Interfaces;
    3.15 -using IBBoard.WarFoundry.API.Commands;
    3.16  using CustomMath = IBBoard.CustomMath;
    3.17 -using IBBoard.Lang;
    3.18 +
    3.19  namespace IBBoard.WarFoundry.GUI.GTK.UIControl
    3.20  {
    3.21  	public class AddEquipmentUIControl : AbstractBaseEquipmentUIControl<IAddEquipmentUI>
    3.22 @@ -17,13 +17,13 @@
    3.23  		{
    3.24  			//Do nothing extra
    3.25  		}
    3.26 -		
    3.27 +
    3.28  		//TODO Make abstract
    3.29  		protected override IAddEquipmentUI CreateEquipmentUI()
    3.30  		{
    3.31  			return new FrmAddEquipment();
    3.32  		}
    3.33 -		
    3.34 +
    3.35  		protected override void CompleteUISetup()
    3.36  		{			
    3.37  			UnitEquipmentItem[] items = Arrays.Subtract(UnitEquipmentUtil.GetAllowedEquipmentItems(unit), unit.GetEquipment());
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/UIControl/Interfaces/IReplaceEquipmentUI.cs	Wed Nov 03 21:02:54 2010 +0000
     4.3 @@ -0,0 +1,17 @@
     4.4 +//  This file (IReplaceEquipmentUI.cs) is a part of the IBBoard.WarFoundry.GUI.GTK project and is copyright 2010 IBBoard
     4.5 +// 
     4.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.
     4.7 +
     4.8 +using System;
     4.9 +
    4.10 +namespace IBBoard.WarFoundry.GUI.GTK.UIControl.Interfaces
    4.11 +{
    4.12 +	/// <summary>
    4.13 +	/// The interface that UI components should implement to represent "Replace Equipment" dialogs or system equivalents (e.g. console areas or HTML fragments)
    4.14 +	/// </summary>
    4.15 +	public interface IReplaceEquipmentUI : ISelectableItemEquipmentUI
    4.16 +	{
    4.17 +		//Marker interface
    4.18 +	}
    4.19 +}
    4.20 +
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/UIControl/ReplaceEquipmentUIControl.cs	Wed Nov 03 21:02:54 2010 +0000
     5.3 @@ -0,0 +1,81 @@
     5.4 +//  This file (AddEquipmentUIControl.cs) is a part of the IBBoard.WarFoundry.GUI.GTK project and is copyright 2010 IBBoard
     5.5 +// 
     5.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.
     5.7 +
     5.8 +using IBBoard.Commands;
     5.9 +using IBBoard.WarFoundry.API.Commands;
    5.10 +using IBBoard.WarFoundry.API.Objects;
    5.11 +using IBBoard.WarFoundry.API.Util;
    5.12 +using IBBoard.WarFoundry.GUI.GTK.UIControl.Interfaces;
    5.13 +using CustomMath = IBBoard.CustomMath;
    5.14 +
    5.15 +namespace IBBoard.WarFoundry.GUI.GTK.UIControl
    5.16 +{
    5.17 +	public class ReplaceEquipmentUIControl : AbstractBaseEquipmentUIControl<IReplaceEquipmentUI>
    5.18 +	{		
    5.19 +		private UnitEquipmentItem origItem;
    5.20 +		
    5.21 +		public ReplaceEquipmentUIControl(Unit unit, UnitEquipmentItem equipmentItem, CommandStack commandStack) : base(unit, commandStack)
    5.22 +		{
    5.23 +			origItem = equipmentItem;
    5.24 +		}
    5.25 +
    5.26 +		//TODO Make abstract
    5.27 +
    5.28 +		protected override IReplaceEquipmentUI CreateEquipmentUI()
    5.29 +		{
    5.30 +			return new FrmReplaceEquipment();
    5.31 +		}
    5.32 +
    5.33 +		protected override void CompleteUISetup()
    5.34 +		{			
    5.35 +			UnitType unitType = unit.UnitType;
    5.36 +			string[] mutexGroups = origItem.MutexGroups;
    5.37 +			UnitEquipmentItem[] mutexItems = unitType.GetEquipmentItemsByExclusionGroups(mutexGroups);
    5.38 +			UnitEquipmentItem[] currentEquipment = unit.GetEquipment();
    5.39 +			UnitEquipmentItem[] items = Arrays.Subtract(mutexItems, currentEquipment);
    5.40 +			ui.SetUnitEquipmentItems(items);
    5.41 +			ui.UnitEquipmentItemChoiceChanged += HandleUiUnitEquipmentItemChoiceChanged;
    5.42 +		}
    5.43 +
    5.44 +		private void HandleUiUnitEquipmentItemChoiceChanged(UnitEquipmentItem equip)
    5.45 +		{
    5.46 +			equipItem = equip;
    5.47 +			
    5.48 +			if (equip != null)
    5.49 +			{
    5.50 +				bool equipIsRatioLimit = UnitEquipmentUtil.IsEquipmentRatioLimited(unit, equip);
    5.51 +				maxPercentage = GetMaxPercentageLimit(equip);
    5.52 +				minPercentage = GetMinPercentageLimit(equip);
    5.53 +				maxNumber = GetMaxNumericLimit(equip);
    5.54 +				minNumber = GetMinNumericLimit(equip);
    5.55 +			
    5.56 +				ui.SetUnitEquipmentLimits(equipIsRatioLimit, minPercentage, maxPercentage, minNumber, maxNumber);
    5.57 +				ui.SetUnitEquipmentLimitsEnabled(true);
    5.58 +				ui.SetOkayEnabledState(HasNonZeroEquipmentAmount());
    5.59 +				SetEquipmentAmountControlEnabledStates();
    5.60 +			}
    5.61 +			else
    5.62 +			{
    5.63 +				maxPercentage = minPercentage = 0;
    5.64 +				maxNumber = minNumber = 0;
    5.65 +				ui.SetUnitEquipmentLimits(false, minPercentage, maxPercentage, minNumber, maxNumber);
    5.66 +				ui.SetUnitEquipmentLimitsEnabled(false);
    5.67 +				ui.SetOkayEnabledState(false);
    5.68 +			}
    5.69 +		}
    5.70 +
    5.71 +		protected override void DoProcessing()
    5.72 +		{
    5.73 +			if (isRatioAmount)
    5.74 +			{
    5.75 +				commandStack.Execute(new ReplaceUnitEquipmentWithRatioAmountItemCommand(unit, origItem, equipItem, equipmentAmount));
    5.76 +			}
    5.77 +			else
    5.78 +			{
    5.79 +				commandStack.Execute(new ReplaceUnitEquipmentWithRatioAmountItemCommand(unit, origItem, equipItem, (int)equipmentAmount));
    5.80 +			}
    5.81 +		}
    5.82 +	}
    5.83 +}
    5.84 +
     6.1 --- a/Widgets/UnitDisplayWidget.cs	Sat Oct 30 14:30:29 2010 +0000
     6.2 +++ b/Widgets/UnitDisplayWidget.cs	Wed Nov 03 21:02:54 2010 +0000
     6.3 @@ -22,7 +22,6 @@
     6.4  	public partial class UnitDisplayWidget : Gtk.Bin
     6.5  	{
     6.6  		private static ILog log = LogManager.GetLogger(typeof(UnitDisplayWidget));
     6.7 -		
     6.8  		private WFObjects.Unit unit;
     6.9  		private CommandStack stack;
    6.10  		
    6.11 @@ -46,10 +45,11 @@
    6.12  			SetWeapons();
    6.13  		}
    6.14  
    6.15 -		private void HandleEquipmentListSelectionChanged (object sender, EventArgs e)
    6.16 +		private void HandleEquipmentListSelectionChanged(object sender, EventArgs e)
    6.17  		{
    6.18  			SetButtonsEnabledState();	
    6.19  		}
    6.20 +
    6.21  		private void SetButtonsEnabledState()
    6.22  		{			
    6.23  			UnitEquipmentItem equipItem = GetSelectedEquipmentItem();
    6.24 @@ -57,6 +57,7 @@
    6.25  			bttnEditEquipment.Sensitive = (UnitEquipmentUtil.CanEditEquipmentAmount(unit, equipItem));
    6.26  			bttnRemoveEquipment.Sensitive = (equipItem != null && !equipItem.IsRequired);
    6.27  		}
    6.28 +
    6.29  		private UnitEquipmentItem GetSelectedEquipmentItem()
    6.30  		{
    6.31  			return (UnitEquipmentItem)TreeUtils.GetSelectedItem(equipmentList);
    6.32 @@ -64,17 +65,17 @@
    6.33  
    6.34  		private void SetStats()
    6.35  		{
    6.36 -            CellRendererText renderer = new CellRendererText();
    6.37 -            unitStats.AppendColumn(Translation.GetTranslation("UnitNameColumn", "Unit Type", null), renderer, new TreeCellDataFunc(RenderUnitName));
    6.38 -            
    6.39 -            TreeCellDataFunc statFunc = new TreeCellDataFunc(RenderUnitStat);
    6.40 -            Stat[] stats = unit.UnitStatsArray;
    6.41 +			CellRendererText renderer = new CellRendererText();
    6.42 +			unitStats.AppendColumn(Translation.GetTranslation("UnitNameColumn", "Unit Type", null), renderer, new TreeCellDataFunc(RenderUnitName));
    6.43 +			
    6.44 +			TreeCellDataFunc statFunc = new TreeCellDataFunc(RenderUnitStat);
    6.45 +			Stat[] stats = unit.UnitStatsArray;
    6.46  			
    6.47  			int length = stats.Length;
    6.48  
    6.49  			for (int i = 0; i < length; i++)
    6.50  			{
    6.51 -	            unitStats.AppendColumn(stats[i].ParentSlotName, renderer, statFunc);
    6.52 +				unitStats.AppendColumn(stats[i].ParentSlotName, renderer, statFunc);
    6.53  			}
    6.54  
    6.55  			TreeStore model = new TreeStore(typeof(WFObjects.Unit));
    6.56 @@ -160,7 +161,6 @@
    6.57  				{
    6.58  					amountString = Translation.GetTranslation("equipmentChoiceAmountAll", "all ({1})", amount, number);
    6.59  				}
    6.60 -
    6.61  				else
    6.62  				{
    6.63  					amountString = Translation.GetTranslation("equipmentChoiceAmountPercentage", "{0}% ({1})", amount, number);
    6.64 @@ -195,22 +195,26 @@
    6.65  			{
    6.66  				((ListStore)equipmentList.Model).AppendValues(obj);
    6.67  			}
    6.68 -			else if (newValue == 0)
    6.69 +			else
    6.70  			{
    6.71 -				TreeIter treeIter = TreeUtils.GetItemIter(equipmentList, obj);
    6.72 -				((ListStore)equipmentList.Model).Remove(ref treeIter);
    6.73 -			}
    6.74 -			
    6.75 +				if (newValue == 0)
    6.76 +				{
    6.77 +					TreeIter treeIter = TreeUtils.GetItemIter(equipmentList, obj);
    6.78 +					((ListStore)equipmentList.Model).Remove(ref treeIter);
    6.79 +				}
    6.80 +
    6.81 +			}			
    6.82  			equipmentList.QueueDraw();
    6.83  		}
    6.84  
    6.85 -		protected virtual void OnUnitSizeFocusOut (object o, Gtk.FocusOutEventArgs args)
    6.86 +		protected virtual void OnUnitSizeFocusOut(object o, Gtk.FocusOutEventArgs args)
    6.87  		{
    6.88  			SetNewUnitSize();
    6.89  		}
    6.90  
    6.91  		[GLib.ConnectBefore ()]
    6.92 -		protected virtual void OnUnitSizeKeyPress (object o, Gtk.KeyPressEventArgs args)
    6.93 +
    6.94 +		protected virtual void OnUnitSizeKeyPress(object o, Gtk.KeyPressEventArgs args)
    6.95  		{
    6.96  			if (args.Event.Key == Gdk.Key.Return || args.Event.Key == Gdk.Key.KP_Enter)
    6.97  			{
    6.98 @@ -220,20 +224,21 @@
    6.99  		
   6.100  		private void SetNewUnitSize()
   6.101  		{
   6.102 -			if (unitSize.Value!=unit.Size)
   6.103 +			if (unitSize.Value != unit.Size)
   6.104  			{
   6.105  				SetUnitSizeCommand cmd = new SetUnitSizeCommand(unit, (int)Math.Round(unitSize.Value));
   6.106  				stack.Execute(cmd);
   6.107  			}
   6.108  		}
   6.109  
   6.110 -		protected virtual void OnUnitNameFocusOut (object o, Gtk.FocusOutEventArgs args)
   6.111 +		protected virtual void OnUnitNameFocusOut(object o, Gtk.FocusOutEventArgs args)
   6.112  		{
   6.113  			SetNewUnitName();
   6.114  		}
   6.115  
   6.116  		[GLib.ConnectBefore ()]
   6.117 -		protected virtual void OnUnitNameKeyPress (object o, Gtk.KeyPressEventArgs args)
   6.118 +
   6.119 +		protected virtual void OnUnitNameKeyPress(object o, Gtk.KeyPressEventArgs args)
   6.120  		{
   6.121  			if (args.Event.Key == Gdk.Key.Return || args.Event.Key == Gdk.Key.KP_Enter)
   6.122  			{
   6.123 @@ -264,7 +269,7 @@
   6.124  		protected virtual void HandleRemoveButtonActivated(object sender, System.EventArgs e)
   6.125  		{
   6.126  			UnitEquipmentItem item = GetSelectedEquipmentItem();
   6.127 -			log.Debug("Remove "+item);
   6.128 +			log.Debug("Remove " + item);
   6.129  				
   6.130  			if (item != null)
   6.131  			{
   6.132 @@ -285,6 +290,19 @@
   6.133  			}
   6.134  		}
   6.135  		
   6.136 +		protected virtual void HandleReplaceButtonClicked(object sender, System.EventArgs e)
   6.137 +		{
   6.138 +			UnitEquipmentItem item = GetSelectedEquipmentItem();
   6.139 +			log.Debug("Replace " + item);
   6.140 +				
   6.141 +			if (item != null)
   6.142 +			{
   6.143 +				ReplaceEquipmentUIControl addEquipment = new ReplaceEquipmentUIControl(unit, item, stack);
   6.144 +				addEquipment.Show();
   6.145 +			}
   6.146 +		}
   6.147 +		
   6.148 +		
   6.149  		
   6.150  	}
   6.151  }
     7.1 --- a/gtk-gui/IBBoard.WarFoundry.GUI.GTK.FrmAddEquipment.cs	Sat Oct 30 14:30:29 2010 +0000
     7.2 +++ b/gtk-gui/IBBoard.WarFoundry.GUI.GTK.FrmAddEquipment.cs	Wed Nov 03 21:02:54 2010 +0000
     7.3 @@ -5,37 +5,22 @@
     7.4  	public partial class FrmAddEquipment
     7.5  	{
     7.6  		private global::Gtk.Table table1;
     7.7 -
     7.8 -		private global::Gtk.ScrolledWindow GtkScrolledWindow;
     7.9 -
    7.10 -		private global::Gtk.TreeView lstEquipment;
    7.11 -
    7.12 -		private global::Gtk.HBox hbox2;
    7.13 -
    7.14 -		private global::Gtk.Table table2;
    7.15 -
    7.16 -		private global::Gtk.Label lblEquipAll;
    7.17 -
    7.18 -		private global::Gtk.Label lblPercent;
    7.19 -
    7.20 -		private global::Gtk.SpinButton numericAmount;
    7.21 -
    7.22 -		private global::Gtk.SpinButton percentageAmount;
    7.23 -
    7.24 -		private global::Gtk.RadioButton rbEquipAll;
    7.25 -
    7.26 -		private global::Gtk.RadioButton rbEquipNumeric;
    7.27 -
    7.28 -		private global::Gtk.RadioButton rbEquipPercent;
    7.29 -
    7.30 -		private global::Gtk.Label lblEquipAmount;
    7.31 -
    7.32 -		private global::Gtk.Label lblEquipment;
    7.33 -
    7.34 -		private global::Gtk.Button buttonCancel;
    7.35 -
    7.36 -		private global::Gtk.Button buttonOk;
    7.37 -
    7.38 +				private global::Gtk.ScrolledWindow GtkScrolledWindow;
    7.39 +				private global::Gtk.TreeView lstEquipment;
    7.40 +				private global::Gtk.HBox hbox2;
    7.41 +				private global::Gtk.Table table2;
    7.42 +				private global::Gtk.Label lblEquipAll;
    7.43 +				private global::Gtk.Label lblPercent;
    7.44 +				private global::Gtk.SpinButton numericAmount;
    7.45 +				private global::Gtk.SpinButton percentageAmount;
    7.46 +				private global::Gtk.RadioButton rbEquipAll;
    7.47 +				private global::Gtk.RadioButton rbEquipNumeric;
    7.48 +				private global::Gtk.RadioButton rbEquipPercent;
    7.49 +				private global::Gtk.Label lblEquipAmount;
    7.50 +				private global::Gtk.Label lblEquipment;
    7.51 +				private global::Gtk.Button buttonCancel;
    7.52 +				private global::Gtk.Button buttonOk;
    7.53 +		
    7.54  		protected virtual void Build()
    7.55  		{
    7.56  			global::Stetic.Gui.Initialize(this);
    7.57 @@ -135,7 +120,6 @@
    7.58  			this.rbEquipAll = new global::Gtk.RadioButton("");
    7.59  			this.rbEquipAll.CanFocus = true;
    7.60  			this.rbEquipAll.Name = "rbEquipAll";
    7.61 -			this.rbEquipAll.Active = true;
    7.62  			this.rbEquipAll.DrawIndicator = true;
    7.63  			this.rbEquipAll.UseUnderline = true;
    7.64  			this.rbEquipAll.Group = new global::GLib.SList(global::System.IntPtr.Zero);
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/gtk-gui/IBBoard.WarFoundry.GUI.GTK.FrmReplaceEquipment.cs	Wed Nov 03 21:02:54 2010 +0000
     8.3 @@ -0,0 +1,236 @@
     8.4 +
     8.5 +// This file has been generated by the GUI designer. Do not modify.
     8.6 +namespace IBBoard.WarFoundry.GUI.GTK
     8.7 +{
     8.8 +	public partial class FrmReplaceEquipment
     8.9 +	{
    8.10 +		private global::Gtk.Table table1;
    8.11 +				private global::Gtk.ScrolledWindow GtkScrolledWindow;
    8.12 +				private global::Gtk.TreeView lstEquipment;
    8.13 +				private global::Gtk.HBox hbox2;
    8.14 +				private global::Gtk.Table table2;
    8.15 +				private global::Gtk.Label lblEquipAll;
    8.16 +				private global::Gtk.Label lblPercent;
    8.17 +				private global::Gtk.SpinButton numericAmount;
    8.18 +				private global::Gtk.SpinButton percentageAmount;
    8.19 +				private global::Gtk.RadioButton rbEquipAll;
    8.20 +				private global::Gtk.RadioButton rbEquipNumeric;
    8.21 +				private global::Gtk.RadioButton rbEquipPercent;
    8.22 +				private global::Gtk.Label lblEquipAmount;
    8.23 +				private global::Gtk.Label lblEquipment;
    8.24 +				private global::Gtk.Button buttonCancel;
    8.25 +				private global::Gtk.Button buttonOk;
    8.26 +		
    8.27 +		protected virtual void Build()
    8.28 +		{
    8.29 +			global::Stetic.Gui.Initialize(this);
    8.30 +			// Widget IBBoard.WarFoundry.GUI.GTK.FrmReplaceEquipment
    8.31 +			this.Name = "IBBoard.WarFoundry.GUI.GTK.FrmReplaceEquipment";
    8.32 +			this.Title = global::Mono.Unix.Catalog.GetString("Add equipment");
    8.33 +			this.WindowPosition = ((global::Gtk.WindowPosition)(4));
    8.34 +			this.Modal = true;
    8.35 +			this.SkipPagerHint = true;
    8.36 +			this.SkipTaskbarHint = true;
    8.37 +			// Internal child IBBoard.WarFoundry.GUI.GTK.FrmReplaceEquipment.VBox
    8.38 +			global::Gtk.VBox w1 = this.VBox;
    8.39 +			w1.Name = "dialog1_VBox";
    8.40 +			w1.BorderWidth = ((uint)(2));
    8.41 +			// Container child dialog1_VBox.Gtk.Box+BoxChild
    8.42 +			this.table1 = new global::Gtk.Table(((uint)(2)), ((uint)(2)), false);
    8.43 +			this.table1.Name = "table1";
    8.44 +			this.table1.RowSpacing = ((uint)(6));
    8.45 +			this.table1.ColumnSpacing = ((uint)(6));
    8.46 +			// Container child table1.Gtk.Table+TableChild
    8.47 +			this.GtkScrolledWindow = new global::Gtk.ScrolledWindow();
    8.48 +			this.GtkScrolledWindow.Name = "GtkScrolledWindow";
    8.49 +			this.GtkScrolledWindow.ShadowType = ((global::Gtk.ShadowType)(1));
    8.50 +			// Container child GtkScrolledWindow.Gtk.Container+ContainerChild
    8.51 +			this.lstEquipment = new global::Gtk.TreeView();
    8.52 +			this.lstEquipment.CanFocus = true;
    8.53 +			this.lstEquipment.Name = "lstEquipment";
    8.54 +			this.lstEquipment.HeadersVisible = false;
    8.55 +			this.GtkScrolledWindow.Add(this.lstEquipment);
    8.56 +			this.table1.Add(this.GtkScrolledWindow);
    8.57 +			global::Gtk.Table.TableChild w3 = ((global::Gtk.Table.TableChild)(this.table1[this.GtkScrolledWindow]));
    8.58 +			w3.LeftAttach = ((uint)(1));
    8.59 +			w3.RightAttach = ((uint)(2));
    8.60 +			w3.YOptions = ((global::Gtk.AttachOptions)(4));
    8.61 +			// Container child table1.Gtk.Table+TableChild
    8.62 +			this.hbox2 = new global::Gtk.HBox();
    8.63 +			this.hbox2.Name = "hbox2";
    8.64 +			this.hbox2.Spacing = 6;
    8.65 +			// Container child hbox2.Gtk.Box+BoxChild
    8.66 +			this.table2 = new global::Gtk.Table(((uint)(3)), ((uint)(3)), false);
    8.67 +			this.table2.Name = "table2";
    8.68 +			this.table2.RowSpacing = ((uint)(6));
    8.69 +			this.table2.ColumnSpacing = ((uint)(6));
    8.70 +			// Container child table2.Gtk.Table+TableChild
    8.71 +			this.lblEquipAll = new global::Gtk.Label();
    8.72 +			this.lblEquipAll.Name = "lblEquipAll";
    8.73 +			this.lblEquipAll.LabelProp = global::Mono.Unix.Catalog.GetString("equip all");
    8.74 +			this.table2.Add(this.lblEquipAll);
    8.75 +			global::Gtk.Table.TableChild w4 = ((global::Gtk.Table.TableChild)(this.table2[this.lblEquipAll]));
    8.76 +			w4.TopAttach = ((uint)(2));
    8.77 +			w4.BottomAttach = ((uint)(3));
    8.78 +			w4.LeftAttach = ((uint)(1));
    8.79 +			w4.RightAttach = ((uint)(2));
    8.80 +			w4.YOptions = ((global::Gtk.AttachOptions)(4));
    8.81 +			// Container child table2.Gtk.Table+TableChild
    8.82 +			this.lblPercent = new global::Gtk.Label();
    8.83 +			this.lblPercent.Name = "lblPercent";
    8.84 +			this.lblPercent.LabelProp = global::Mono.Unix.Catalog.GetString("%");
    8.85 +			this.table2.Add(this.lblPercent);
    8.86 +			global::Gtk.Table.TableChild w5 = ((global::Gtk.Table.TableChild)(this.table2[this.lblPercent]));
    8.87 +			w5.TopAttach = ((uint)(1));
    8.88 +			w5.BottomAttach = ((uint)(2));
    8.89 +			w5.LeftAttach = ((uint)(2));
    8.90 +			w5.RightAttach = ((uint)(3));
    8.91 +			w5.XOptions = ((global::Gtk.AttachOptions)(4));
    8.92 +			w5.YOptions = ((global::Gtk.AttachOptions)(4));
    8.93 +			// Container child table2.Gtk.Table+TableChild
    8.94 +			this.numericAmount = new global::Gtk.SpinButton(0, 100, 1);
    8.95 +			this.numericAmount.CanFocus = true;
    8.96 +			this.numericAmount.Name = "numericAmount";
    8.97 +			this.numericAmount.Adjustment.PageIncrement = 10;
    8.98 +			this.numericAmount.ClimbRate = 1;
    8.99 +			this.numericAmount.Numeric = true;
   8.100 +			this.table2.Add(this.numericAmount);
   8.101 +			global::Gtk.Table.TableChild w6 = ((global::Gtk.Table.TableChild)(this.table2[this.numericAmount]));
   8.102 +			w6.LeftAttach = ((uint)(1));
   8.103 +			w6.RightAttach = ((uint)(2));
   8.104 +			w6.XOptions = ((global::Gtk.AttachOptions)(0));
   8.105 +			w6.YOptions = ((global::Gtk.AttachOptions)(4));
   8.106 +			// Container child table2.Gtk.Table+TableChild
   8.107 +			this.percentageAmount = new global::Gtk.SpinButton(0, 100, 1);
   8.108 +			this.percentageAmount.CanFocus = true;
   8.109 +			this.percentageAmount.Name = "percentageAmount";
   8.110 +			this.percentageAmount.Adjustment.PageIncrement = 10;
   8.111 +			this.percentageAmount.ClimbRate = 1;
   8.112 +			this.percentageAmount.Digits = ((uint)(1));
   8.113 +			this.percentageAmount.Numeric = true;
   8.114 +			this.table2.Add(this.percentageAmount);
   8.115 +			global::Gtk.Table.TableChild w7 = ((global::Gtk.Table.TableChild)(this.table2[this.percentageAmount]));
   8.116 +			w7.TopAttach = ((uint)(1));
   8.117 +			w7.BottomAttach = ((uint)(2));
   8.118 +			w7.LeftAttach = ((uint)(1));
   8.119 +			w7.RightAttach = ((uint)(2));
   8.120 +			w7.XOptions = ((global::Gtk.AttachOptions)(0));
   8.121 +			w7.YOptions = ((global::Gtk.AttachOptions)(4));
   8.122 +			// Container child table2.Gtk.Table+TableChild
   8.123 +			this.rbEquipAll = new global::Gtk.RadioButton("");
   8.124 +			this.rbEquipAll.CanFocus = true;
   8.125 +			this.rbEquipAll.Name = "rbEquipAll";
   8.126 +			this.rbEquipAll.DrawIndicator = true;
   8.127 +			this.rbEquipAll.UseUnderline = true;
   8.128 +			this.rbEquipAll.Group = new global::GLib.SList(global::System.IntPtr.Zero);
   8.129 +			this.table2.Add(this.rbEquipAll);
   8.130 +			global::Gtk.Table.TableChild w8 = ((global::Gtk.Table.TableChild)(this.table2[this.rbEquipAll]));
   8.131 +			w8.TopAttach = ((uint)(2));
   8.132 +			w8.BottomAttach = ((uint)(3));
   8.133 +			w8.XOptions = ((global::Gtk.AttachOptions)(4));
   8.134 +			w8.YOptions = ((global::Gtk.AttachOptions)(4));
   8.135 +			// Container child table2.Gtk.Table+TableChild
   8.136 +			this.rbEquipNumeric = new global::Gtk.RadioButton("");
   8.137 +			this.rbEquipNumeric.CanFocus = true;
   8.138 +			this.rbEquipNumeric.Name = "rbEquipNumeric";
   8.139 +			this.rbEquipNumeric.DrawIndicator = true;
   8.140 +			this.rbEquipNumeric.UseUnderline = true;
   8.141 +			this.rbEquipNumeric.Group = this.rbEquipAll.Group;
   8.142 +			this.table2.Add(this.rbEquipNumeric);
   8.143 +			global::Gtk.Table.TableChild w9 = ((global::Gtk.Table.TableChild)(this.table2[this.rbEquipNumeric]));
   8.144 +			w9.XOptions = ((global::Gtk.AttachOptions)(4));
   8.145 +			w9.YOptions = ((global::Gtk.AttachOptions)(4));
   8.146 +			// Container child table2.Gtk.Table+TableChild
   8.147 +			this.rbEquipPercent = new global::Gtk.RadioButton("");
   8.148 +			this.rbEquipPercent.CanFocus = true;
   8.149 +			this.rbEquipPercent.Name = "rbEquipPercent";
   8.150 +			this.rbEquipPercent.DrawIndicator = true;
   8.151 +			this.rbEquipPercent.UseUnderline = true;
   8.152 +			this.rbEquipPercent.Group = this.rbEquipAll.Group;
   8.153 +			this.table2.Add(this.rbEquipPercent);
   8.154 +			global::Gtk.Table.TableChild w10 = ((global::Gtk.Table.TableChild)(this.table2[this.rbEquipPercent]));
   8.155 +			w10.TopAttach = ((uint)(1));
   8.156 +			w10.BottomAttach = ((uint)(2));
   8.157 +			w10.XOptions = ((global::Gtk.AttachOptions)(4));
   8.158 +			w10.YOptions = ((global::Gtk.AttachOptions)(4));
   8.159 +			this.hbox2.Add(this.table2);
   8.160 +			global::Gtk.Box.BoxChild w11 = ((global::Gtk.Box.BoxChild)(this.hbox2[this.table2]));
   8.161 +			w11.Position = 0;
   8.162 +			w11.Expand = false;
   8.163 +			w11.Fill = false;
   8.164 +			this.table1.Add(this.hbox2);
   8.165 +			global::Gtk.Table.TableChild w12 = ((global::Gtk.Table.TableChild)(this.table1[this.hbox2]));
   8.166 +			w12.TopAttach = ((uint)(1));
   8.167 +			w12.BottomAttach = ((uint)(2));
   8.168 +			w12.LeftAttach = ((uint)(1));
   8.169 +			w12.RightAttach = ((uint)(2));
   8.170 +			w12.YOptions = ((global::Gtk.AttachOptions)(4));
   8.171 +			// Container child table1.Gtk.Table+TableChild
   8.172 +			this.lblEquipAmount = new global::Gtk.Label();
   8.173 +			this.lblEquipAmount.Name = "lblEquipAmount";
   8.174 +			this.lblEquipAmount.LabelProp = global::Mono.Unix.Catalog.GetString("amount:");
   8.175 +			this.table1.Add(this.lblEquipAmount);
   8.176 +			global::Gtk.Table.TableChild w13 = ((global::Gtk.Table.TableChild)(this.table1[this.lblEquipAmount]));
   8.177 +			w13.TopAttach = ((uint)(1));
   8.178 +			w13.BottomAttach = ((uint)(2));
   8.179 +			w13.XOptions = ((global::Gtk.AttachOptions)(4));
   8.180 +			w13.YOptions = ((global::Gtk.AttachOptions)(4));
   8.181 +			// Container child table1.Gtk.Table+TableChild
   8.182 +			this.lblEquipment = new global::Gtk.Label();
   8.183 +			this.lblEquipment.Name = "lblEquipment";
   8.184 +			this.lblEquipment.LabelProp = global::Mono.Unix.Catalog.GetString("equipment");
   8.185 +			this.table1.Add(this.lblEquipment);
   8.186 +			global::Gtk.Table.TableChild w14 = ((global::Gtk.Table.TableChild)(this.table1[this.lblEquipment]));
   8.187 +			w14.XOptions = ((global::Gtk.AttachOptions)(4));
   8.188 +			w14.YOptions = ((global::Gtk.AttachOptions)(4));
   8.189 +			w1.Add(this.table1);
   8.190 +			global::Gtk.Box.BoxChild w15 = ((global::Gtk.Box.BoxChild)(w1[this.table1]));
   8.191 +			w15.Position = 0;
   8.192 +			w15.Expand = false;
   8.193 +			w15.Fill = false;
   8.194 +			// Internal child IBBoard.WarFoundry.GUI.GTK.FrmReplaceEquipment.ActionArea
   8.195 +			global::Gtk.HButtonBox w16 = this.ActionArea;
   8.196 +			w16.Name = "dialog1_ActionArea";
   8.197 +			w16.Spacing = 10;
   8.198 +			w16.BorderWidth = ((uint)(5));
   8.199 +			w16.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4));
   8.200 +			// Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild
   8.201 +			this.buttonCancel = new global::Gtk.Button();
   8.202 +			this.buttonCancel.CanDefault = true;
   8.203 +			this.buttonCancel.CanFocus = true;
   8.204 +			this.buttonCancel.Name = "buttonCancel";
   8.205 +			this.buttonCancel.UseStock = true;
   8.206 +			this.buttonCancel.UseUnderline = true;
   8.207 +			this.buttonCancel.Label = "gtk-cancel";
   8.208 +			this.AddActionWidget(this.buttonCancel, -6);
   8.209 +			global::Gtk.ButtonBox.ButtonBoxChild w17 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w16[this.buttonCancel]));
   8.210 +			w17.Expand = false;
   8.211 +			w17.Fill = false;
   8.212 +			// Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild
   8.213 +			this.buttonOk = new global::Gtk.Button();
   8.214 +			this.buttonOk.CanDefault = true;
   8.215 +			this.buttonOk.CanFocus = true;
   8.216 +			this.buttonOk.Name = "buttonOk";
   8.217 +			this.buttonOk.UseStock = true;
   8.218 +			this.buttonOk.UseUnderline = true;
   8.219 +			this.buttonOk.Label = "gtk-ok";
   8.220 +			this.AddActionWidget(this.buttonOk, -5);
   8.221 +			global::Gtk.ButtonBox.ButtonBoxChild w18 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w16[this.buttonOk]));
   8.222 +			w18.Position = 1;
   8.223 +			w18.Expand = false;
   8.224 +			w18.Fill = false;
   8.225 +			if ((this.Child != null))
   8.226 +			{
   8.227 +				this.Child.ShowAll();
   8.228 +			}
   8.229 +			this.DefaultWidth = 400;
   8.230 +			this.DefaultHeight = 300;
   8.231 +			this.Show();
   8.232 +			this.rbEquipNumeric.Clicked += new global::System.EventHandler(this.RadioButtonClicked);
   8.233 +			this.percentageAmount.ValueChanged += new global::System.EventHandler(this.SpinButtonValueChanged);
   8.234 +			this.numericAmount.ValueChanged += new global::System.EventHandler(this.SpinButtonValueChanged);
   8.235 +			this.buttonCancel.Clicked += new global::System.EventHandler(this.CancelButtonClicked);
   8.236 +			this.buttonOk.Clicked += new global::System.EventHandler(this.OkayButtonClicked);
   8.237 +		}
   8.238 +	}
   8.239 +}
     9.1 --- a/gtk-gui/gui.stetic	Sat Oct 30 14:30:29 2010 +0000
     9.2 +++ b/gtk-gui/gui.stetic	Wed Nov 03 21:02:54 2010 +0000
     9.3 @@ -916,6 +916,7 @@
     9.4                      <property name="Type">TextOnly</property>
     9.5                      <property name="Label" translatable="yes">Replace</property>
     9.6                      <property name="UseUnderline">True</property>
     9.7 +                    <signal name="Clicked" handler="HandleReplaceButtonClicked" />
     9.8                    </widget>
     9.9                    <packing>
    9.10                      <property name="Position">2</property>
    9.11 @@ -1128,7 +1129,6 @@
    9.12                          <property name="MemberName" />
    9.13                          <property name="CanFocus">True</property>
    9.14                          <property name="Label" translatable="yes" />
    9.15 -                        <property name="Active">True</property>
    9.16                          <property name="DrawIndicator">True</property>
    9.17                          <property name="HasLabel">True</property>
    9.18                          <property name="UseUnderline">True</property>
    9.19 @@ -1611,4 +1611,350 @@
    9.20        </widget>
    9.21      </child>
    9.22    </widget>
    9.23 +  <widget class="Gtk.Dialog" id="IBBoard.WarFoundry.GUI.GTK.FrmReplaceEquipment" design-size="400 300">
    9.24 +    <property name="MemberName" />
    9.25 +    <property name="Title" translatable="yes">Add equipment</property>
    9.26 +    <property name="WindowPosition">CenterOnParent</property>
    9.27 +    <property name="Modal">True</property>
    9.28 +    <property name="SkipPagerHint">True</property>
    9.29 +    <property name="SkipTaskbarHint">True</property>
    9.30 +    <property name="Buttons">2</property>
    9.31 +    <property name="HelpButton">False</property>
    9.32 +    <child internal-child="VBox">
    9.33 +      <widget class="Gtk.VBox" id="dialog1_VBox">
    9.34 +        <property name="MemberName" />
    9.35 +        <property name="BorderWidth">2</property>
    9.36 +        <child>
    9.37 +          <widget class="Gtk.Table" id="table1">
    9.38 +            <property name="MemberName" />
    9.39 +            <property name="NRows">2</property>
    9.40 +            <property name="NColumns">2</property>
    9.41 +            <property name="RowSpacing">6</property>
    9.42 +            <property name="ColumnSpacing">6</property>
    9.43 +            <child>
    9.44 +              <widget class="Gtk.ScrolledWindow" id="GtkScrolledWindow">
    9.45 +                <property name="MemberName" />
    9.46 +                <property name="ShadowType">In</property>
    9.47 +                <child>
    9.48 +                  <widget class="Gtk.TreeView" id="lstEquipment">
    9.49 +                    <property name="MemberName" />
    9.50 +                    <property name="CanFocus">True</property>
    9.51 +                    <property name="ShowScrollbars">True</property>
    9.52 +                    <property name="HeadersVisible">False</property>
    9.53 +                  </widget>
    9.54 +                </child>
    9.55 +              </widget>
    9.56 +              <packing>
    9.57 +                <property name="LeftAttach">1</property>
    9.58 +                <property name="RightAttach">2</property>
    9.59 +                <property name="AutoSize">True</property>
    9.60 +                <property name="YOptions">Fill</property>
    9.61 +                <property name="XExpand">True</property>
    9.62 +                <property name="XFill">True</property>
    9.63 +                <property name="XShrink">False</property>
    9.64 +                <property name="YExpand">False</property>
    9.65 +                <property name="YFill">True</property>
    9.66 +                <property name="YShrink">False</property>
    9.67 +              </packing>
    9.68 +            </child>
    9.69 +            <child>
    9.70 +              <widget class="Gtk.HBox" id="hbox2">
    9.71 +                <property name="MemberName" />
    9.72 +                <property name="Spacing">6</property>
    9.73 +                <child>
    9.74 +                  <widget class="Gtk.Table" id="table2">
    9.75 +                    <property name="MemberName" />
    9.76 +                    <property name="NRows">3</property>
    9.77 +                    <property name="NColumns">3</property>
    9.78 +                    <property name="RowSpacing">6</property>
    9.79 +                    <property name="ColumnSpacing">6</property>
    9.80 +                    <child>
    9.81 +                      <placeholder />
    9.82 +                    </child>
    9.83 +                    <child>
    9.84 +                      <placeholder />
    9.85 +                    </child>
    9.86 +                    <child>
    9.87 +                      <widget class="Gtk.Label" id="lblEquipAll">
    9.88 +                        <property name="MemberName" />
    9.89 +                        <property name="LabelProp" translatable="yes">equip all</property>
    9.90 +                      </widget>
    9.91 +                      <packing>
    9.92 +                        <property name="TopAttach">2</property>
    9.93 +                        <property name="BottomAttach">3</property>
    9.94 +                        <property name="LeftAttach">1</property>
    9.95 +                        <property name="RightAttach">2</property>
    9.96 +                        <property name="AutoSize">False</property>
    9.97 +                        <property name="YOptions">Fill</property>
    9.98 +                        <property name="XExpand">True</property>
    9.99 +                        <property name="XFill">True</property>
   9.100 +                        <property name="XShrink">False</property>
   9.101 +                        <property name="YExpand">False</property>
   9.102 +                        <property name="YFill">True</property>
   9.103 +                        <property name="YShrink">False</property>
   9.104 +                      </packing>
   9.105 +                    </child>
   9.106 +                    <child>
   9.107 +                      <widget class="Gtk.Label" id="lblPercent">
   9.108 +                        <property name="MemberName" />
   9.109 +                        <property name="LabelProp" translatable="yes">%</property>
   9.110 +                      </widget>
   9.111 +                      <packing>
   9.112 +                        <property name="TopAttach">1</property>
   9.113 +                        <property name="BottomAttach">2</property>
   9.114 +                        <property name="LeftAttach">2</property>
   9.115 +                        <property name="RightAttach">3</property>
   9.116 +                        <property name="AutoSize">True</property>
   9.117 +                        <property name="XOptions">Fill</property>
   9.118 +                        <property name="YOptions">Fill</property>
   9.119 +                        <property name="XExpand">False</property>
   9.120 +                        <property name="XFill">True</property>
   9.121 +                        <property name="XShrink">False</property>
   9.122 +                        <property name="YExpand">False</property>
   9.123 +                        <property name="YFill">True</property>
   9.124 +                        <property name="YShrink">False</property>
   9.125 +                      </packing>
   9.126 +                    </child>
   9.127 +                    <child>
   9.128 +                      <widget class="Gtk.SpinButton" id="numericAmount">
   9.129 +                        <property name="MemberName" />
   9.130 +                        <property name="CanFocus">True</property>
   9.131 +                        <property name="Upper">100</property>
   9.132 +                        <property name="PageIncrement">10</property>
   9.133 +                        <property name="StepIncrement">1</property>
   9.134 +                        <property name="ClimbRate">1</property>
   9.135 +                        <property name="Numeric">True</property>
   9.136 +                        <signal name="ValueChanged" handler="SpinButtonValueChanged" />
   9.137 +                      </widget>
   9.138 +                      <packing>
   9.139 +                        <property name="LeftAttach">1</property>
   9.140 +                        <property name="RightAttach">2</property>
   9.141 +                        <property name="AutoSize">False</property>
   9.142 +                        <property name="XOptions">0</property>
   9.143 +                        <property name="YOptions">Fill</property>
   9.144 +                        <property name="XExpand">False</property>
   9.145 +                        <property name="XFill">False</property>
   9.146 +                        <property name="XShrink">False</property>
   9.147 +                        <property name="YExpand">False</property>
   9.148 +                        <property name="YFill">True</property>
   9.149 +                        <property name="YShrink">False</property>
   9.150 +                      </packing>
   9.151 +                    </child>
   9.152 +                    <child>
   9.153 +                      <widget class="Gtk.SpinButton" id="percentageAmount">
   9.154 +                        <property name="MemberName" />
   9.155 +                        <property name="CanFocus">True</property>
   9.156 +                        <property name="Upper">100</property>
   9.157 +                        <property name="PageIncrement">10</property>
   9.158 +                        <property name="StepIncrement">1</property>
   9.159 +                        <property name="ClimbRate">1</property>
   9.160 +                        <property name="Digits">1</property>
   9.161 +                        <property name="Numeric">True</property>
   9.162 +                        <signal name="ValueChanged" handler="SpinButtonValueChanged" />
   9.163 +                      </widget>
   9.164 +                      <packing>
   9.165 +                        <property name="TopAttach">1</property>
   9.166 +                        <property name="BottomAttach">2</property>
   9.167 +                        <property name="LeftAttach">1</property>
   9.168 +                        <property name="RightAttach">2</property>
   9.169 +                        <property name="AutoSize">False</property>
   9.170 +                        <property name="XOptions">0</property>
   9.171 +                        <property name="YOptions">Fill</property>
   9.172 +                        <property name="XExpand">False</property>
   9.173 +                        <property name="XFill">False</property>
   9.174 +                        <property name="XShrink">False</property>
   9.175 +                        <property name="YExpand">False</property>
   9.176 +                        <property name="YFill">True</property>
   9.177 +                        <property name="YShrink">False</property>
   9.178 +                      </packing>
   9.179 +                    </child>
   9.180 +                    <child>
   9.181 +                      <widget class="Gtk.RadioButton" id="rbEquipAll">
   9.182 +                        <property name="MemberName" />
   9.183 +                        <property name="CanFocus">True</property>
   9.184 +                        <property name="Label" translatable="yes" />
   9.185 +                        <property name="DrawIndicator">True</property>
   9.186 +                        <property name="HasLabel">True</property>
   9.187 +                        <property name="UseUnderline">True</property>
   9.188 +                        <property name="Group">group1</property>
   9.189 +                      </widget>
   9.190 +                      <packing>
   9.191 +                        <property name="TopAttach">2</property>
   9.192 +                        <property name="BottomAttach">3</property>
   9.193 +                        <property name="AutoSize">True</property>
   9.194 +                        <property name="XOptions">Fill</property>
   9.195 +                        <property name="YOptions">Fill</property>
   9.196 +                        <property name="XExpand">False</property>
   9.197 +                        <property name="XFill">True</property>
   9.198 +                        <property name="XShrink">False</property>
   9.199 +                        <property name="YExpand">False</property>
   9.200 +                        <property name="YFill">True</property>
   9.201 +                        <property name="YShrink">False</property>
   9.202 +                      </packing>
   9.203 +                    </child>
   9.204 +                    <child>
   9.205 +                      <widget class="Gtk.RadioButton" id="rbEquipNumeric">
   9.206 +                        <property name="MemberName" />
   9.207 +                        <property name="CanFocus">True</property>
   9.208 +                        <property name="Label" translatable="yes" />
   9.209 +                        <property name="DrawIndicator">True</property>
   9.210 +                        <property name="HasLabel">True</property>
   9.211 +                        <property name="UseUnderline">True</property>
   9.212 +                        <property name="Group">group1</property>
   9.213 +                        <signal name="Clicked" handler="RadioButtonClicked" />
   9.214 +                      </widget>
   9.215 +                      <packing>
   9.216 +                        <property name="AutoSize">False</property>
   9.217 +                        <property name="XOptions">Fill</property>
   9.218 +                        <property name="YOptions">Fill</property>
   9.219 +                        <property name="XExpand">False</property>
   9.220 +                        <property name="XFill">True</property>
   9.221 +                        <property name="XShrink">False</property>
   9.222 +                        <property name="YExpand">False</property>
   9.223 +                        <property name="YFill">True</property>
   9.224 +                        <property name="YShrink">False</property>
   9.225 +                      </packing>
   9.226 +                    </child>
   9.227 +                    <child>
   9.228 +                      <widget class="Gtk.RadioButton" id="rbEquipPercent">
   9.229 +                        <property name="MemberName" />
   9.230 +                        <property name="CanFocus">True</property>
   9.231 +                        <property name="Label" translatable="yes" />
   9.232 +                        <property name="DrawIndicator">True</property>
   9.233 +                        <property name="HasLabel">True</property>
   9.234 +                        <property name="UseUnderline">True</property>
   9.235 +                        <property name="Group">group1</property>
   9.236 +                      </widget>
   9.237 +                      <packing>
   9.238 +                        <property name="TopAttach">1</property>
   9.239 +                        <property name="BottomAttach">2</property>
   9.240 +                        <property name="AutoSize">True</property>
   9.241 +                        <property name="XOptions">Fill</property>
   9.242 +                        <property name="YOptions">Fill</property>
   9.243 +                        <property name="XExpand">False</property>
   9.244 +                        <property name="XFill">True</property>
   9.245 +                        <property name="XShrink">False</property>
   9.246 +                        <property name="YExpand">False</property>
   9.247 +                        <property name="YFill">True</property>
   9.248 +                        <property name="YShrink">False</property>
   9.249 +                      </packing>
   9.250 +                    </child>
   9.251 +                  </widget>
   9.252 +                  <packing>
   9.253 +                    <property name="Position">0</property>
   9.254 +                    <property name="AutoSize">True</property>
   9.255 +                    <property name="Expand">False</property>
   9.256 +                    <property name="Fill">False</property>
   9.257 +                  </packing>
   9.258 +                </child>
   9.259 +                <child>
   9.260 +                  <placeholder />
   9.261 +                </child>
   9.262 +              </widget>
   9.263 +              <packing>
   9.264 +                <property name="TopAttach">1</property>
   9.265 +                <property name="BottomAttach">2</property>
   9.266 +                <property name="LeftAttach">1</property>
   9.267 +                <property name="RightAttach">2</property>
   9.268 +                <property name="AutoSize">True</property>
   9.269 +                <property name="YOptions">Fill</property>
   9.270 +                <property name="XExpand">True</property>
   9.271 +                <property name="XFill">True</property>
   9.272 +                <property name="XShrink">False</property>
   9.273 +                <property name="YExpand">False</property>
   9.274 +                <property name="YFill">True</property>
   9.275 +                <property name="YShrink">False</property>
   9.276 +              </packing>
   9.277 +            </child>
   9.278 +            <child>
   9.279 +              <widget class="Gtk.Label" id="lblEquipAmount">
   9.280 +                <property name="MemberName" />
   9.281 +                <property name="LabelProp" translatable="yes">amount:</property>
   9.282 +              </widget>
   9.283 +              <packing>
   9.284 +                <property name="TopAttach">1</property>
   9.285 +                <property name="BottomAttach">2</property>
   9.286 +                <property name="AutoSize">True</property>
   9.287 +                <property name="XOptions">Fill</property>
   9.288 +                <property name="YOptions">Fill</property>
   9.289 +                <property name="XExpand">False</property>
   9.290 +                <property name="XFill">True</property>
   9.291 +                <property name="XShrink">False</property>
   9.292 +                <property name="YExpand">False</property>
   9.293 +                <property name="YFill">True</property>
   9.294 +                <property name="YShrink">False</property>
   9.295 +              </packing>
   9.296 +            </child>
   9.297 +            <child>
   9.298 +              <widget class="Gtk.Label" id="lblEquipment">
   9.299 +                <property name="MemberName" />
   9.300 +                <property name="LabelProp" translatable="yes">equipment</property>
   9.301 +              </widget>
   9.302 +              <packing>
   9.303 +                <property name="AutoSize">True</property>
   9.304 +                <property name="XOptions">Fill</property>
   9.305 +                <property name="YOptions">Fill</property>
   9.306 +                <property name="XExpand">False</property>
   9.307 +                <property name="XFill">True</property>
   9.308 +                <property name="XShrink">False</property>
   9.309 +                <property name="YExpand">False</property>
   9.310 +                <property name="YFill">True</property>
   9.311 +                <property name="YShrink">False</property>
   9.312 +              </packing>
   9.313 +            </child>
   9.314 +          </widget>
   9.315 +          <packing>
   9.316 +            <property name="Position">0</property>
   9.317 +            <property name="AutoSize">True</property>
   9.318 +            <property name="Expand">False</property>
   9.319 +            <property name="Fill">False</property>
   9.320 +          </packing>
   9.321 +        </child>
   9.322 +      </widget>
   9.323 +    </child>
   9.324 +    <child internal-child="ActionArea">
   9.325 +      <widget class="Gtk.HButtonBox" id="dialog1_ActionArea">
   9.326 +        <property name="MemberName" />
   9.327 +        <property name="Spacing">10</property>
   9.328 +        <property name="BorderWidth">5</property>
   9.329 +        <property name="Size">2</property>
   9.330 +        <property name="LayoutStyle">End</property>
   9.331 +        <child>
   9.332 +          <widget class="Gtk.Button" id="buttonCancel">
   9.333 +            <property name="MemberName" />
   9.334 +            <property name="CanDefault">True</property>
   9.335 +            <property name="CanFocus">True</property>
   9.336 +            <property name="UseStock">True</property>
   9.337 +            <property name="Type">StockItem</property>
   9.338 +            <property name="StockId">gtk-cancel</property>
   9.339 +            <property name="ResponseId">-6</property>
   9.340 +            <signal name="Clicked" handler="CancelButtonClicked" />
   9.341 +            <property name="label">gtk-cancel</property>
   9.342 +          </widget>
   9.343 +          <packing>
   9.344 +            <property name="Expand">False</property>
   9.345 +            <property name="Fill">False</property>
   9.346 +          </packing>
   9.347 +        </child>
   9.348 +        <child>
   9.349 +          <widget class="Gtk.Button" id="buttonOk">
   9.350 +            <property name="MemberName" />
   9.351 +            <property name="CanDefault">True</property>
   9.352 +            <property name="CanFocus">True</property>
   9.353 +            <property name="UseStock">True</property>
   9.354 +            <property name="Type">StockItem</property>
   9.355 +            <property name="StockId">gtk-ok</property>
   9.356 +            <property name="ResponseId">-5</property>
   9.357 +            <signal name="Clicked" handler="OkayButtonClicked" />
   9.358 +            <property name="label">gtk-ok</property>
   9.359 +          </widget>
   9.360 +          <packing>
   9.361 +            <property name="Position">1</property>
   9.362 +            <property name="Expand">False</property>
   9.363 +            <property name="Fill">False</property>
   9.364 +          </packing>
   9.365 +        </child>
   9.366 +      </widget>
   9.367 +    </child>
   9.368 +  </widget>
   9.369  </stetic-interface>
   9.370 \ No newline at end of file