Mercurial > repos > IBDev-IBBoard.WarFoundry.GUI.GTK
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 wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FrmReplaceEquipment.cs Wed Nov 03 21:02:54 2010 +0000 @@ -0,0 +1,235 @@ +// This file (FrmAddEquipment.cs) is a part of the IBBoard.WarFoundry.GUI.GTK project and is copyright 2010 IBBoard +// +// The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. + +using System; +using IBBoard.WarFoundry.GUI.GTK.UIControl.Interfaces; +using IBBoard.WarFoundry.API.Objects; +using Gtk; +using IBBoard.WarFoundry.GUI.GTK.Util; +using IBBoard.GtkSharp; +using log4net.Repository.Hierarchy; +using log4net; + +namespace IBBoard.WarFoundry.GUI.GTK +{ + public partial class FrmReplaceEquipment : Dialog, IReplaceEquipmentUI + { + private static ILog log = LogManager.GetLogger(typeof(FrmReplaceEquipment)); + + public event SingleArgMethodInvoker<UnitEquipmentItem> UnitEquipmentItemChoiceChanged; + + public event MethodInvoker UnitEquipmentAmountTypeChanged; + + public event MethodInvoker UnitEquipmentAmountChanged; + private bool limitsEnabled = false; + private bool ratioLimited = false; + + public FrmReplaceEquipment() + { + this.Build(); + lstEquipment.Selection.Changed += OnSelectionChanged; + TreeViewColumn equipColumn = new TreeViewColumn(); + equipColumn.Title = "Equipment"; + CellRendererText equipCell = new CellRendererText(); + equipColumn.PackStart(equipCell, true); + equipColumn.SetCellDataFunc(equipCell, GtkWarFoundryUtil.RenderWarFoundryObjectName); + lstEquipment.AppendColumn(equipColumn); + } + + private void OnUnitEquipmentAmountChanged() + { + if (UnitEquipmentAmountChanged != null) + { + UnitEquipmentAmountChanged(); + } + } + + private void OnUnitEquipmentAmountTypeChanged() + { + if (UnitEquipmentAmountChanged != null) + { + UnitEquipmentAmountTypeChanged(); + } + } + + protected void OnSelectionChanged(object o, EventArgs e) + { + if (UnitEquipmentItemChoiceChanged != null) + { + UnitEquipmentItemChoiceChanged(SelectedUnitEquipmentItem); + } + } + + public void SetUnitEquipmentItems(UnitEquipmentItem[] items) + { + ListStore store = new ListStore(typeof(UnitEquipmentItem)); + + foreach (UnitEquipmentItem equipItem in items) + { + store.AppendValues(equipItem); + } + + lstEquipment.Model = store; + } + + public void SetUnitEquipmentLimits(bool isRatioLimit, double minPercent, double maxPercent, int minNumber, int maxNumber) + { + log.DebugFormat("IsRatio? {0}. Limits: {1}->{2}, {3}%->{4}%", isRatioLimit, minNumber, maxNumber, minPercent, maxPercent); + ratioLimited = isRatioLimit; + numericAmount.SetRange(minNumber, maxNumber); + percentageAmount.SetRange(minPercent, maxPercent); + + if (isRatioLimit) + { + if (minPercent == 100) + { + rbEquipAll.Active = true; + } + else + { + rbEquipPercent.Active = true; + } + } + else + { + rbEquipNumeric.Active = true; + } + } + + public void SetUnitEquipmentLimitsEnabled(bool isEnabled) + { + SetNumericAmountEnabledState(isEnabled); + SetPercentageAmountEnabledState(isEnabled); + } + + public bool ShowControl() + { + int result = Run(); + bool okayClicked = (result == (int)ResponseType.Ok); + this.Hide(); + return okayClicked; + } + + protected virtual void CancelButtonClicked(object sender, System.EventArgs e) + { + log.Debug("Cancel clicked"); + Respond(ResponseType.Cancel); + } + + protected virtual void OkayButtonClicked(object sender, System.EventArgs e) + { + log.Debug("Okay clicked"); + Respond(ResponseType.Ok); + } + + public void SetOkayEnabledState(bool enabled) + { + buttonOk.Sensitive = enabled; + } + + protected virtual void SpinButtonValueChanged(object sender, System.EventArgs e) + { + OnUnitEquipmentAmountChanged(); + } + + protected virtual void RadioButtonClicked(object sender, System.EventArgs e) + { + OnUnitEquipmentAmountTypeChanged(); + } + + public void SetNumericAmountEnabledState(bool enabled) + { + rbEquipNumeric.Sensitive = enabled; + numericAmount.Sensitive = enabled; + } + + public void SetPercentageAmountEnabledState(bool enabled) + { + if (enabled) + { + double minPercentage = GetMinPercentage(); + rbEquipPercent.Sensitive = minPercentage != 100; + percentageAmount.Sensitive = minPercentage != 100; + double maxPercentage = GetMaxPercentage(); + rbEquipAll.Sensitive = ratioLimited && maxPercentage == 100; + lblEquipAll.Sensitive = ratioLimited && maxPercentage == 100; + } + else + { + rbEquipPercent.Sensitive = false; + percentageAmount.Sensitive = false; + rbEquipAll.Sensitive = false; + lblEquipAll.Sensitive = false; + } + } + + private double GetMaxPercentage() + { + double min, max; + percentageAmount.GetRange(out min, out max); + return max; + } + + private double GetMinPercentage() + { + double min, max; + percentageAmount.GetRange(out min, out max); + return min; + } + + public UnitEquipmentItem SelectedUnitEquipmentItem + { + get + { + return (UnitEquipmentItem)TreeUtils.GetSelectedItem(lstEquipment); + } + } + + public bool IsRatioEquipmentAmount + { + get + { + return !rbEquipNumeric.Active; + } + } + + public int EquipmentNumericAmount + { + get + { + return (int)numericAmount.Value; + } + + set + { + numericAmount.Value = value; + } + } + + public double EquipmentPercentageAmount + { + get + { + double percent; + + if (rbEquipAll.Active) + { + percent = 100; + } + else + { + percent = percentageAmount.Value; + } + + return percent; + } + + set + { + percentageAmount.Value = value; + } + } + } +} +
--- a/IBBoard.WarFoundry.GUI.GTK.csproj Sat Oct 30 14:30:29 2010 +0000 +++ b/IBBoard.WarFoundry.GUI.GTK.csproj Wed Nov 03 21:02:54 2010 +0000 @@ -62,6 +62,10 @@ <Compile Include="UIControl\AbstractBaseEquipmentUIControl.cs" /> <Compile Include="UIControl\Interfaces\IBaseEquipmentUI.cs" /> <Compile Include="UIControl\Interfaces\ISelectableItemEquipmentUI.cs" /> + <Compile Include="UIControl\Interfaces\IReplaceEquipmentUI.cs" /> + <Compile Include="FrmReplaceEquipment.cs" /> + <Compile Include="UIControl\ReplaceEquipmentUIControl.cs" /> + <Compile Include="gtk-gui\IBBoard.WarFoundry.GUI.GTK.FrmReplaceEquipment.cs" /> </ItemGroup> <ItemGroup> <Content Include="App.png" />
--- a/UIControl/AddEquipmentUIControl.cs Sat Oct 30 14:30:29 2010 +0000 +++ b/UIControl/AddEquipmentUIControl.cs Wed Nov 03 21:02:54 2010 +0000 @@ -1,14 +1,14 @@ // This file (AddEquipmentUIControl.cs) is a part of the IBBoard.WarFoundry.GUI.GTK project and is copyright 2010 IBBoard // -// // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. -using System; +// The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. + using IBBoard.Commands; +using IBBoard.WarFoundry.API.Commands; using IBBoard.WarFoundry.API.Objects; using IBBoard.WarFoundry.API.Util; using IBBoard.WarFoundry.GUI.GTK.UIControl.Interfaces; -using IBBoard.WarFoundry.API.Commands; using CustomMath = IBBoard.CustomMath; -using IBBoard.Lang; + namespace IBBoard.WarFoundry.GUI.GTK.UIControl { public class AddEquipmentUIControl : AbstractBaseEquipmentUIControl<IAddEquipmentUI> @@ -17,13 +17,13 @@ { //Do nothing extra } - + //TODO Make abstract protected override IAddEquipmentUI CreateEquipmentUI() { return new FrmAddEquipment(); } - + protected override void CompleteUISetup() { UnitEquipmentItem[] items = Arrays.Subtract(UnitEquipmentUtil.GetAllowedEquipmentItems(unit), unit.GetEquipment());
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/UIControl/Interfaces/IReplaceEquipmentUI.cs Wed Nov 03 21:02:54 2010 +0000 @@ -0,0 +1,17 @@ +// This file (IReplaceEquipmentUI.cs) is a part of the IBBoard.WarFoundry.GUI.GTK project and is copyright 2010 IBBoard +// +// The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. + +using System; + +namespace IBBoard.WarFoundry.GUI.GTK.UIControl.Interfaces +{ + /// <summary> + /// The interface that UI components should implement to represent "Replace Equipment" dialogs or system equivalents (e.g. console areas or HTML fragments) + /// </summary> + public interface IReplaceEquipmentUI : ISelectableItemEquipmentUI + { + //Marker interface + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/UIControl/ReplaceEquipmentUIControl.cs Wed Nov 03 21:02:54 2010 +0000 @@ -0,0 +1,81 @@ +// This file (AddEquipmentUIControl.cs) is a part of the IBBoard.WarFoundry.GUI.GTK project and is copyright 2010 IBBoard +// +// The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. + +using IBBoard.Commands; +using IBBoard.WarFoundry.API.Commands; +using IBBoard.WarFoundry.API.Objects; +using IBBoard.WarFoundry.API.Util; +using IBBoard.WarFoundry.GUI.GTK.UIControl.Interfaces; +using CustomMath = IBBoard.CustomMath; + +namespace IBBoard.WarFoundry.GUI.GTK.UIControl +{ + public class ReplaceEquipmentUIControl : AbstractBaseEquipmentUIControl<IReplaceEquipmentUI> + { + private UnitEquipmentItem origItem; + + public ReplaceEquipmentUIControl(Unit unit, UnitEquipmentItem equipmentItem, CommandStack commandStack) : base(unit, commandStack) + { + origItem = equipmentItem; + } + + //TODO Make abstract + + protected override IReplaceEquipmentUI CreateEquipmentUI() + { + return new FrmReplaceEquipment(); + } + + protected override void CompleteUISetup() + { + UnitType unitType = unit.UnitType; + string[] mutexGroups = origItem.MutexGroups; + UnitEquipmentItem[] mutexItems = unitType.GetEquipmentItemsByExclusionGroups(mutexGroups); + UnitEquipmentItem[] currentEquipment = unit.GetEquipment(); + UnitEquipmentItem[] items = Arrays.Subtract(mutexItems, currentEquipment); + ui.SetUnitEquipmentItems(items); + ui.UnitEquipmentItemChoiceChanged += HandleUiUnitEquipmentItemChoiceChanged; + } + + private void HandleUiUnitEquipmentItemChoiceChanged(UnitEquipmentItem equip) + { + equipItem = equip; + + if (equip != null) + { + bool equipIsRatioLimit = UnitEquipmentUtil.IsEquipmentRatioLimited(unit, equip); + maxPercentage = GetMaxPercentageLimit(equip); + minPercentage = GetMinPercentageLimit(equip); + maxNumber = GetMaxNumericLimit(equip); + minNumber = GetMinNumericLimit(equip); + + ui.SetUnitEquipmentLimits(equipIsRatioLimit, minPercentage, maxPercentage, minNumber, maxNumber); + ui.SetUnitEquipmentLimitsEnabled(true); + ui.SetOkayEnabledState(HasNonZeroEquipmentAmount()); + SetEquipmentAmountControlEnabledStates(); + } + else + { + maxPercentage = minPercentage = 0; + maxNumber = minNumber = 0; + ui.SetUnitEquipmentLimits(false, minPercentage, maxPercentage, minNumber, maxNumber); + ui.SetUnitEquipmentLimitsEnabled(false); + ui.SetOkayEnabledState(false); + } + } + + protected override void DoProcessing() + { + if (isRatioAmount) + { + commandStack.Execute(new ReplaceUnitEquipmentWithRatioAmountItemCommand(unit, origItem, equipItem, equipmentAmount)); + } + else + { + commandStack.Execute(new ReplaceUnitEquipmentWithRatioAmountItemCommand(unit, origItem, equipItem, (int)equipmentAmount)); + } + } + } +} +
--- a/Widgets/UnitDisplayWidget.cs Sat Oct 30 14:30:29 2010 +0000 +++ b/Widgets/UnitDisplayWidget.cs Wed Nov 03 21:02:54 2010 +0000 @@ -22,7 +22,6 @@ public partial class UnitDisplayWidget : Gtk.Bin { private static ILog log = LogManager.GetLogger(typeof(UnitDisplayWidget)); - private WFObjects.Unit unit; private CommandStack stack; @@ -46,10 +45,11 @@ SetWeapons(); } - private void HandleEquipmentListSelectionChanged (object sender, EventArgs e) + private void HandleEquipmentListSelectionChanged(object sender, EventArgs e) { SetButtonsEnabledState(); } + private void SetButtonsEnabledState() { UnitEquipmentItem equipItem = GetSelectedEquipmentItem(); @@ -57,6 +57,7 @@ bttnEditEquipment.Sensitive = (UnitEquipmentUtil.CanEditEquipmentAmount(unit, equipItem)); bttnRemoveEquipment.Sensitive = (equipItem != null && !equipItem.IsRequired); } + private UnitEquipmentItem GetSelectedEquipmentItem() { return (UnitEquipmentItem)TreeUtils.GetSelectedItem(equipmentList); @@ -64,17 +65,17 @@ private void SetStats() { - CellRendererText renderer = new CellRendererText(); - unitStats.AppendColumn(Translation.GetTranslation("UnitNameColumn", "Unit Type", null), renderer, new TreeCellDataFunc(RenderUnitName)); - - TreeCellDataFunc statFunc = new TreeCellDataFunc(RenderUnitStat); - Stat[] stats = unit.UnitStatsArray; + CellRendererText renderer = new CellRendererText(); + unitStats.AppendColumn(Translation.GetTranslation("UnitNameColumn", "Unit Type", null), renderer, new TreeCellDataFunc(RenderUnitName)); + + TreeCellDataFunc statFunc = new TreeCellDataFunc(RenderUnitStat); + Stat[] stats = unit.UnitStatsArray; int length = stats.Length; for (int i = 0; i < length; i++) { - unitStats.AppendColumn(stats[i].ParentSlotName, renderer, statFunc); + unitStats.AppendColumn(stats[i].ParentSlotName, renderer, statFunc); } TreeStore model = new TreeStore(typeof(WFObjects.Unit)); @@ -160,7 +161,6 @@ { amountString = Translation.GetTranslation("equipmentChoiceAmountAll", "all ({1})", amount, number); } - else { amountString = Translation.GetTranslation("equipmentChoiceAmountPercentage", "{0}% ({1})", amount, number); @@ -195,22 +195,26 @@ { ((ListStore)equipmentList.Model).AppendValues(obj); } - else if (newValue == 0) + else { - TreeIter treeIter = TreeUtils.GetItemIter(equipmentList, obj); - ((ListStore)equipmentList.Model).Remove(ref treeIter); - } - + if (newValue == 0) + { + TreeIter treeIter = TreeUtils.GetItemIter(equipmentList, obj); + ((ListStore)equipmentList.Model).Remove(ref treeIter); + } + + } equipmentList.QueueDraw(); } - protected virtual void OnUnitSizeFocusOut (object o, Gtk.FocusOutEventArgs args) + protected virtual void OnUnitSizeFocusOut(object o, Gtk.FocusOutEventArgs args) { SetNewUnitSize(); } [GLib.ConnectBefore ()] - protected virtual void OnUnitSizeKeyPress (object o, Gtk.KeyPressEventArgs args) + + protected virtual void OnUnitSizeKeyPress(object o, Gtk.KeyPressEventArgs args) { if (args.Event.Key == Gdk.Key.Return || args.Event.Key == Gdk.Key.KP_Enter) { @@ -220,20 +224,21 @@ private void SetNewUnitSize() { - if (unitSize.Value!=unit.Size) + if (unitSize.Value != unit.Size) { SetUnitSizeCommand cmd = new SetUnitSizeCommand(unit, (int)Math.Round(unitSize.Value)); stack.Execute(cmd); } } - protected virtual void OnUnitNameFocusOut (object o, Gtk.FocusOutEventArgs args) + protected virtual void OnUnitNameFocusOut(object o, Gtk.FocusOutEventArgs args) { SetNewUnitName(); } [GLib.ConnectBefore ()] - protected virtual void OnUnitNameKeyPress (object o, Gtk.KeyPressEventArgs args) + + protected virtual void OnUnitNameKeyPress(object o, Gtk.KeyPressEventArgs args) { if (args.Event.Key == Gdk.Key.Return || args.Event.Key == Gdk.Key.KP_Enter) { @@ -264,7 +269,7 @@ protected virtual void HandleRemoveButtonActivated(object sender, System.EventArgs e) { UnitEquipmentItem item = GetSelectedEquipmentItem(); - log.Debug("Remove "+item); + log.Debug("Remove " + item); if (item != null) { @@ -285,6 +290,19 @@ } } + protected virtual void HandleReplaceButtonClicked(object sender, System.EventArgs e) + { + UnitEquipmentItem item = GetSelectedEquipmentItem(); + log.Debug("Replace " + item); + + if (item != null) + { + ReplaceEquipmentUIControl addEquipment = new ReplaceEquipmentUIControl(unit, item, stack); + addEquipment.Show(); + } + } + + } }
--- a/gtk-gui/IBBoard.WarFoundry.GUI.GTK.FrmAddEquipment.cs Sat Oct 30 14:30:29 2010 +0000 +++ b/gtk-gui/IBBoard.WarFoundry.GUI.GTK.FrmAddEquipment.cs Wed Nov 03 21:02:54 2010 +0000 @@ -5,37 +5,22 @@ public partial class FrmAddEquipment { private global::Gtk.Table table1; - - private global::Gtk.ScrolledWindow GtkScrolledWindow; - - private global::Gtk.TreeView lstEquipment; - - private global::Gtk.HBox hbox2; - - private global::Gtk.Table table2; - - private global::Gtk.Label lblEquipAll; - - private global::Gtk.Label lblPercent; - - private global::Gtk.SpinButton numericAmount; - - private global::Gtk.SpinButton percentageAmount; - - private global::Gtk.RadioButton rbEquipAll; - - private global::Gtk.RadioButton rbEquipNumeric; - - private global::Gtk.RadioButton rbEquipPercent; - - private global::Gtk.Label lblEquipAmount; - - private global::Gtk.Label lblEquipment; - - private global::Gtk.Button buttonCancel; - - private global::Gtk.Button buttonOk; - + private global::Gtk.ScrolledWindow GtkScrolledWindow; + private global::Gtk.TreeView lstEquipment; + private global::Gtk.HBox hbox2; + private global::Gtk.Table table2; + private global::Gtk.Label lblEquipAll; + private global::Gtk.Label lblPercent; + private global::Gtk.SpinButton numericAmount; + private global::Gtk.SpinButton percentageAmount; + private global::Gtk.RadioButton rbEquipAll; + private global::Gtk.RadioButton rbEquipNumeric; + private global::Gtk.RadioButton rbEquipPercent; + private global::Gtk.Label lblEquipAmount; + private global::Gtk.Label lblEquipment; + private global::Gtk.Button buttonCancel; + private global::Gtk.Button buttonOk; + protected virtual void Build() { global::Stetic.Gui.Initialize(this); @@ -135,7 +120,6 @@ this.rbEquipAll = new global::Gtk.RadioButton(""); this.rbEquipAll.CanFocus = true; this.rbEquipAll.Name = "rbEquipAll"; - this.rbEquipAll.Active = true; this.rbEquipAll.DrawIndicator = true; this.rbEquipAll.UseUnderline = true; this.rbEquipAll.Group = new global::GLib.SList(global::System.IntPtr.Zero);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gtk-gui/IBBoard.WarFoundry.GUI.GTK.FrmReplaceEquipment.cs Wed Nov 03 21:02:54 2010 +0000 @@ -0,0 +1,236 @@ + +// This file has been generated by the GUI designer. Do not modify. +namespace IBBoard.WarFoundry.GUI.GTK +{ + public partial class FrmReplaceEquipment + { + private global::Gtk.Table table1; + private global::Gtk.ScrolledWindow GtkScrolledWindow; + private global::Gtk.TreeView lstEquipment; + private global::Gtk.HBox hbox2; + private global::Gtk.Table table2; + private global::Gtk.Label lblEquipAll; + private global::Gtk.Label lblPercent; + private global::Gtk.SpinButton numericAmount; + private global::Gtk.SpinButton percentageAmount; + private global::Gtk.RadioButton rbEquipAll; + private global::Gtk.RadioButton rbEquipNumeric; + private global::Gtk.RadioButton rbEquipPercent; + private global::Gtk.Label lblEquipAmount; + private global::Gtk.Label lblEquipment; + private global::Gtk.Button buttonCancel; + private global::Gtk.Button buttonOk; + + protected virtual void Build() + { + global::Stetic.Gui.Initialize(this); + // Widget IBBoard.WarFoundry.GUI.GTK.FrmReplaceEquipment + this.Name = "IBBoard.WarFoundry.GUI.GTK.FrmReplaceEquipment"; + this.Title = global::Mono.Unix.Catalog.GetString("Add equipment"); + this.WindowPosition = ((global::Gtk.WindowPosition)(4)); + this.Modal = true; + this.SkipPagerHint = true; + this.SkipTaskbarHint = true; + // Internal child IBBoard.WarFoundry.GUI.GTK.FrmReplaceEquipment.VBox + global::Gtk.VBox w1 = this.VBox; + w1.Name = "dialog1_VBox"; + w1.BorderWidth = ((uint)(2)); + // Container child dialog1_VBox.Gtk.Box+BoxChild + this.table1 = new global::Gtk.Table(((uint)(2)), ((uint)(2)), false); + this.table1.Name = "table1"; + this.table1.RowSpacing = ((uint)(6)); + this.table1.ColumnSpacing = ((uint)(6)); + // Container child table1.Gtk.Table+TableChild + this.GtkScrolledWindow = new global::Gtk.ScrolledWindow(); + this.GtkScrolledWindow.Name = "GtkScrolledWindow"; + this.GtkScrolledWindow.ShadowType = ((global::Gtk.ShadowType)(1)); + // Container child GtkScrolledWindow.Gtk.Container+ContainerChild + this.lstEquipment = new global::Gtk.TreeView(); + this.lstEquipment.CanFocus = true; + this.lstEquipment.Name = "lstEquipment"; + this.lstEquipment.HeadersVisible = false; + this.GtkScrolledWindow.Add(this.lstEquipment); + this.table1.Add(this.GtkScrolledWindow); + global::Gtk.Table.TableChild w3 = ((global::Gtk.Table.TableChild)(this.table1[this.GtkScrolledWindow])); + w3.LeftAttach = ((uint)(1)); + w3.RightAttach = ((uint)(2)); + w3.YOptions = ((global::Gtk.AttachOptions)(4)); + // Container child table1.Gtk.Table+TableChild + this.hbox2 = new global::Gtk.HBox(); + this.hbox2.Name = "hbox2"; + this.hbox2.Spacing = 6; + // Container child hbox2.Gtk.Box+BoxChild + this.table2 = new global::Gtk.Table(((uint)(3)), ((uint)(3)), false); + this.table2.Name = "table2"; + this.table2.RowSpacing = ((uint)(6)); + this.table2.ColumnSpacing = ((uint)(6)); + // Container child table2.Gtk.Table+TableChild + this.lblEquipAll = new global::Gtk.Label(); + this.lblEquipAll.Name = "lblEquipAll"; + this.lblEquipAll.LabelProp = global::Mono.Unix.Catalog.GetString("equip all"); + this.table2.Add(this.lblEquipAll); + global::Gtk.Table.TableChild w4 = ((global::Gtk.Table.TableChild)(this.table2[this.lblEquipAll])); + w4.TopAttach = ((uint)(2)); + w4.BottomAttach = ((uint)(3)); + w4.LeftAttach = ((uint)(1)); + w4.RightAttach = ((uint)(2)); + w4.YOptions = ((global::Gtk.AttachOptions)(4)); + // Container child table2.Gtk.Table+TableChild + this.lblPercent = new global::Gtk.Label(); + this.lblPercent.Name = "lblPercent"; + this.lblPercent.LabelProp = global::Mono.Unix.Catalog.GetString("%"); + this.table2.Add(this.lblPercent); + global::Gtk.Table.TableChild w5 = ((global::Gtk.Table.TableChild)(this.table2[this.lblPercent])); + w5.TopAttach = ((uint)(1)); + w5.BottomAttach = ((uint)(2)); + w5.LeftAttach = ((uint)(2)); + w5.RightAttach = ((uint)(3)); + w5.XOptions = ((global::Gtk.AttachOptions)(4)); + w5.YOptions = ((global::Gtk.AttachOptions)(4)); + // Container child table2.Gtk.Table+TableChild + this.numericAmount = new global::Gtk.SpinButton(0, 100, 1); + this.numericAmount.CanFocus = true; + this.numericAmount.Name = "numericAmount"; + this.numericAmount.Adjustment.PageIncrement = 10; + this.numericAmount.ClimbRate = 1; + this.numericAmount.Numeric = true; + this.table2.Add(this.numericAmount); + global::Gtk.Table.TableChild w6 = ((global::Gtk.Table.TableChild)(this.table2[this.numericAmount])); + w6.LeftAttach = ((uint)(1)); + w6.RightAttach = ((uint)(2)); + w6.XOptions = ((global::Gtk.AttachOptions)(0)); + w6.YOptions = ((global::Gtk.AttachOptions)(4)); + // Container child table2.Gtk.Table+TableChild + this.percentageAmount = new global::Gtk.SpinButton(0, 100, 1); + this.percentageAmount.CanFocus = true; + this.percentageAmount.Name = "percentageAmount"; + this.percentageAmount.Adjustment.PageIncrement = 10; + this.percentageAmount.ClimbRate = 1; + this.percentageAmount.Digits = ((uint)(1)); + this.percentageAmount.Numeric = true; + this.table2.Add(this.percentageAmount); + global::Gtk.Table.TableChild w7 = ((global::Gtk.Table.TableChild)(this.table2[this.percentageAmount])); + w7.TopAttach = ((uint)(1)); + w7.BottomAttach = ((uint)(2)); + w7.LeftAttach = ((uint)(1)); + w7.RightAttach = ((uint)(2)); + w7.XOptions = ((global::Gtk.AttachOptions)(0)); + w7.YOptions = ((global::Gtk.AttachOptions)(4)); + // Container child table2.Gtk.Table+TableChild + this.rbEquipAll = new global::Gtk.RadioButton(""); + this.rbEquipAll.CanFocus = true; + this.rbEquipAll.Name = "rbEquipAll"; + this.rbEquipAll.DrawIndicator = true; + this.rbEquipAll.UseUnderline = true; + this.rbEquipAll.Group = new global::GLib.SList(global::System.IntPtr.Zero); + this.table2.Add(this.rbEquipAll); + global::Gtk.Table.TableChild w8 = ((global::Gtk.Table.TableChild)(this.table2[this.rbEquipAll])); + w8.TopAttach = ((uint)(2)); + w8.BottomAttach = ((uint)(3)); + w8.XOptions = ((global::Gtk.AttachOptions)(4)); + w8.YOptions = ((global::Gtk.AttachOptions)(4)); + // Container child table2.Gtk.Table+TableChild + this.rbEquipNumeric = new global::Gtk.RadioButton(""); + this.rbEquipNumeric.CanFocus = true; + this.rbEquipNumeric.Name = "rbEquipNumeric"; + this.rbEquipNumeric.DrawIndicator = true; + this.rbEquipNumeric.UseUnderline = true; + this.rbEquipNumeric.Group = this.rbEquipAll.Group; + this.table2.Add(this.rbEquipNumeric); + global::Gtk.Table.TableChild w9 = ((global::Gtk.Table.TableChild)(this.table2[this.rbEquipNumeric])); + w9.XOptions = ((global::Gtk.AttachOptions)(4)); + w9.YOptions = ((global::Gtk.AttachOptions)(4)); + // Container child table2.Gtk.Table+TableChild + this.rbEquipPercent = new global::Gtk.RadioButton(""); + this.rbEquipPercent.CanFocus = true; + this.rbEquipPercent.Name = "rbEquipPercent"; + this.rbEquipPercent.DrawIndicator = true; + this.rbEquipPercent.UseUnderline = true; + this.rbEquipPercent.Group = this.rbEquipAll.Group; + this.table2.Add(this.rbEquipPercent); + global::Gtk.Table.TableChild w10 = ((global::Gtk.Table.TableChild)(this.table2[this.rbEquipPercent])); + w10.TopAttach = ((uint)(1)); + w10.BottomAttach = ((uint)(2)); + w10.XOptions = ((global::Gtk.AttachOptions)(4)); + w10.YOptions = ((global::Gtk.AttachOptions)(4)); + this.hbox2.Add(this.table2); + global::Gtk.Box.BoxChild w11 = ((global::Gtk.Box.BoxChild)(this.hbox2[this.table2])); + w11.Position = 0; + w11.Expand = false; + w11.Fill = false; + this.table1.Add(this.hbox2); + global::Gtk.Table.TableChild w12 = ((global::Gtk.Table.TableChild)(this.table1[this.hbox2])); + w12.TopAttach = ((uint)(1)); + w12.BottomAttach = ((uint)(2)); + w12.LeftAttach = ((uint)(1)); + w12.RightAttach = ((uint)(2)); + w12.YOptions = ((global::Gtk.AttachOptions)(4)); + // Container child table1.Gtk.Table+TableChild + this.lblEquipAmount = new global::Gtk.Label(); + this.lblEquipAmount.Name = "lblEquipAmount"; + this.lblEquipAmount.LabelProp = global::Mono.Unix.Catalog.GetString("amount:"); + this.table1.Add(this.lblEquipAmount); + global::Gtk.Table.TableChild w13 = ((global::Gtk.Table.TableChild)(this.table1[this.lblEquipAmount])); + w13.TopAttach = ((uint)(1)); + w13.BottomAttach = ((uint)(2)); + w13.XOptions = ((global::Gtk.AttachOptions)(4)); + w13.YOptions = ((global::Gtk.AttachOptions)(4)); + // Container child table1.Gtk.Table+TableChild + this.lblEquipment = new global::Gtk.Label(); + this.lblEquipment.Name = "lblEquipment"; + this.lblEquipment.LabelProp = global::Mono.Unix.Catalog.GetString("equipment"); + this.table1.Add(this.lblEquipment); + global::Gtk.Table.TableChild w14 = ((global::Gtk.Table.TableChild)(this.table1[this.lblEquipment])); + w14.XOptions = ((global::Gtk.AttachOptions)(4)); + w14.YOptions = ((global::Gtk.AttachOptions)(4)); + w1.Add(this.table1); + global::Gtk.Box.BoxChild w15 = ((global::Gtk.Box.BoxChild)(w1[this.table1])); + w15.Position = 0; + w15.Expand = false; + w15.Fill = false; + // Internal child IBBoard.WarFoundry.GUI.GTK.FrmReplaceEquipment.ActionArea + global::Gtk.HButtonBox w16 = this.ActionArea; + w16.Name = "dialog1_ActionArea"; + w16.Spacing = 10; + w16.BorderWidth = ((uint)(5)); + w16.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4)); + // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild + this.buttonCancel = new global::Gtk.Button(); + this.buttonCancel.CanDefault = true; + this.buttonCancel.CanFocus = true; + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.UseStock = true; + this.buttonCancel.UseUnderline = true; + this.buttonCancel.Label = "gtk-cancel"; + this.AddActionWidget(this.buttonCancel, -6); + global::Gtk.ButtonBox.ButtonBoxChild w17 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w16[this.buttonCancel])); + w17.Expand = false; + w17.Fill = false; + // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild + this.buttonOk = new global::Gtk.Button(); + this.buttonOk.CanDefault = true; + this.buttonOk.CanFocus = true; + this.buttonOk.Name = "buttonOk"; + this.buttonOk.UseStock = true; + this.buttonOk.UseUnderline = true; + this.buttonOk.Label = "gtk-ok"; + this.AddActionWidget(this.buttonOk, -5); + global::Gtk.ButtonBox.ButtonBoxChild w18 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w16[this.buttonOk])); + w18.Position = 1; + w18.Expand = false; + w18.Fill = false; + if ((this.Child != null)) + { + this.Child.ShowAll(); + } + this.DefaultWidth = 400; + this.DefaultHeight = 300; + this.Show(); + this.rbEquipNumeric.Clicked += new global::System.EventHandler(this.RadioButtonClicked); + this.percentageAmount.ValueChanged += new global::System.EventHandler(this.SpinButtonValueChanged); + this.numericAmount.ValueChanged += new global::System.EventHandler(this.SpinButtonValueChanged); + this.buttonCancel.Clicked += new global::System.EventHandler(this.CancelButtonClicked); + this.buttonOk.Clicked += new global::System.EventHandler(this.OkayButtonClicked); + } + } +}
--- a/gtk-gui/gui.stetic Sat Oct 30 14:30:29 2010 +0000 +++ b/gtk-gui/gui.stetic Wed Nov 03 21:02:54 2010 +0000 @@ -916,6 +916,7 @@ <property name="Type">TextOnly</property> <property name="Label" translatable="yes">Replace</property> <property name="UseUnderline">True</property> + <signal name="Clicked" handler="HandleReplaceButtonClicked" /> </widget> <packing> <property name="Position">2</property> @@ -1128,7 +1129,6 @@ <property name="MemberName" /> <property name="CanFocus">True</property> <property name="Label" translatable="yes" /> - <property name="Active">True</property> <property name="DrawIndicator">True</property> <property name="HasLabel">True</property> <property name="UseUnderline">True</property> @@ -1611,4 +1611,350 @@ </widget> </child> </widget> + <widget class="Gtk.Dialog" id="IBBoard.WarFoundry.GUI.GTK.FrmReplaceEquipment" design-size="400 300"> + <property name="MemberName" /> + <property name="Title" translatable="yes">Add equipment</property> + <property name="WindowPosition">CenterOnParent</property> + <property name="Modal">True</property> + <property name="SkipPagerHint">True</property> + <property name="SkipTaskbarHint">True</property> + <property name="Buttons">2</property> + <property name="HelpButton">False</property> + <child internal-child="VBox"> + <widget class="Gtk.VBox" id="dialog1_VBox"> + <property name="MemberName" /> + <property name="BorderWidth">2</property> + <child> + <widget class="Gtk.Table" id="table1"> + <property name="MemberName" /> + <property name="NRows">2</property> + <property name="NColumns">2</property> + <property name="RowSpacing">6</property> + <property name="ColumnSpacing">6</property> + <child> + <widget class="Gtk.ScrolledWindow" id="GtkScrolledWindow"> + <property name="MemberName" /> + <property name="ShadowType">In</property> + <child> + <widget class="Gtk.TreeView" id="lstEquipment"> + <property name="MemberName" /> + <property name="CanFocus">True</property> + <property name="ShowScrollbars">True</property> + <property name="HeadersVisible">False</property> + </widget> + </child> + </widget> + <packing> + <property name="LeftAttach">1</property> + <property name="RightAttach">2</property> + <property name="AutoSize">True</property> + <property name="YOptions">Fill</property> + <property name="XExpand">True</property> + <property name="XFill">True</property> + <property name="XShrink">False</property> + <property name="YExpand">False</property> + <property name="YFill">True</property> + <property name="YShrink">False</property> + </packing> + </child> + <child> + <widget class="Gtk.HBox" id="hbox2"> + <property name="MemberName" /> + <property name="Spacing">6</property> + <child> + <widget class="Gtk.Table" id="table2"> + <property name="MemberName" /> + <property name="NRows">3</property> + <property name="NColumns">3</property> + <property name="RowSpacing">6</property> + <property name="ColumnSpacing">6</property> + <child> + <placeholder /> + </child> + <child> + <placeholder /> + </child> + <child> + <widget class="Gtk.Label" id="lblEquipAll"> + <property name="MemberName" /> + <property name="LabelProp" translatable="yes">equip all</property> + </widget> + <packing> + <property name="TopAttach">2</property> + <property name="BottomAttach">3</property> + <property name="LeftAttach">1</property> + <property name="RightAttach">2</property> + <property name="AutoSize">False</property> + <property name="YOptions">Fill</property> + <property name="XExpand">True</property> + <property name="XFill">True</property> + <property name="XShrink">False</property> + <property name="YExpand">False</property> + <property name="YFill">True</property> + <property name="YShrink">False</property> + </packing> + </child> + <child> + <widget class="Gtk.Label" id="lblPercent"> + <property name="MemberName" /> + <property name="LabelProp" translatable="yes">%</property> + </widget> + <packing> + <property name="TopAttach">1</property> + <property name="BottomAttach">2</property> + <property name="LeftAttach">2</property> + <property name="RightAttach">3</property> + <property name="AutoSize">True</property> + <property name="XOptions">Fill</property> + <property name="YOptions">Fill</property> + <property name="XExpand">False</property> + <property name="XFill">True</property> + <property name="XShrink">False</property> + <property name="YExpand">False</property> + <property name="YFill">True</property> + <property name="YShrink">False</property> + </packing> + </child> + <child> + <widget class="Gtk.SpinButton" id="numericAmount"> + <property name="MemberName" /> + <property name="CanFocus">True</property> + <property name="Upper">100</property> + <property name="PageIncrement">10</property> + <property name="StepIncrement">1</property> + <property name="ClimbRate">1</property> + <property name="Numeric">True</property> + <signal name="ValueChanged" handler="SpinButtonValueChanged" /> + </widget> + <packing> + <property name="LeftAttach">1</property> + <property name="RightAttach">2</property> + <property name="AutoSize">False</property> + <property name="XOptions">0</property> + <property name="YOptions">Fill</property> + <property name="XExpand">False</property> + <property name="XFill">False</property> + <property name="XShrink">False</property> + <property name="YExpand">False</property> + <property name="YFill">True</property> + <property name="YShrink">False</property> + </packing> + </child> + <child> + <widget class="Gtk.SpinButton" id="percentageAmount"> + <property name="MemberName" /> + <property name="CanFocus">True</property> + <property name="Upper">100</property> + <property name="PageIncrement">10</property> + <property name="StepIncrement">1</property> + <property name="ClimbRate">1</property> + <property name="Digits">1</property> + <property name="Numeric">True</property> + <signal name="ValueChanged" handler="SpinButtonValueChanged" /> + </widget> + <packing> + <property name="TopAttach">1</property> + <property name="BottomAttach">2</property> + <property name="LeftAttach">1</property> + <property name="RightAttach">2</property> + <property name="AutoSize">False</property> + <property name="XOptions">0</property> + <property name="YOptions">Fill</property> + <property name="XExpand">False</property> + <property name="XFill">False</property> + <property name="XShrink">False</property> + <property name="YExpand">False</property> + <property name="YFill">True</property> + <property name="YShrink">False</property> + </packing> + </child> + <child> + <widget class="Gtk.RadioButton" id="rbEquipAll"> + <property name="MemberName" /> + <property name="CanFocus">True</property> + <property name="Label" translatable="yes" /> + <property name="DrawIndicator">True</property> + <property name="HasLabel">True</property> + <property name="UseUnderline">True</property> + <property name="Group">group1</property> + </widget> + <packing> + <property name="TopAttach">2</property> + <property name="BottomAttach">3</property> + <property name="AutoSize">True</property> + <property name="XOptions">Fill</property> + <property name="YOptions">Fill</property> + <property name="XExpand">False</property> + <property name="XFill">True</property> + <property name="XShrink">False</property> + <property name="YExpand">False</property> + <property name="YFill">True</property> + <property name="YShrink">False</property> + </packing> + </child> + <child> + <widget class="Gtk.RadioButton" id="rbEquipNumeric"> + <property name="MemberName" /> + <property name="CanFocus">True</property> + <property name="Label" translatable="yes" /> + <property name="DrawIndicator">True</property> + <property name="HasLabel">True</property> + <property name="UseUnderline">True</property> + <property name="Group">group1</property> + <signal name="Clicked" handler="RadioButtonClicked" /> + </widget> + <packing> + <property name="AutoSize">False</property> + <property name="XOptions">Fill</property> + <property name="YOptions">Fill</property> + <property name="XExpand">False</property> + <property name="XFill">True</property> + <property name="XShrink">False</property> + <property name="YExpand">False</property> + <property name="YFill">True</property> + <property name="YShrink">False</property> + </packing> + </child> + <child> + <widget class="Gtk.RadioButton" id="rbEquipPercent"> + <property name="MemberName" /> + <property name="CanFocus">True</property> + <property name="Label" translatable="yes" /> + <property name="DrawIndicator">True</property> + <property name="HasLabel">True</property> + <property name="UseUnderline">True</property> + <property name="Group">group1</property> + </widget> + <packing> + <property name="TopAttach">1</property> + <property name="BottomAttach">2</property> + <property name="AutoSize">True</property> + <property name="XOptions">Fill</property> + <property name="YOptions">Fill</property> + <property name="XExpand">False</property> + <property name="XFill">True</property> + <property name="XShrink">False</property> + <property name="YExpand">False</property> + <property name="YFill">True</property> + <property name="YShrink">False</property> + </packing> + </child> + </widget> + <packing> + <property name="Position">0</property> + <property name="AutoSize">True</property> + <property name="Expand">False</property> + <property name="Fill">False</property> + </packing> + </child> + <child> + <placeholder /> + </child> + </widget> + <packing> + <property name="TopAttach">1</property> + <property name="BottomAttach">2</property> + <property name="LeftAttach">1</property> + <property name="RightAttach">2</property> + <property name="AutoSize">True</property> + <property name="YOptions">Fill</property> + <property name="XExpand">True</property> + <property name="XFill">True</property> + <property name="XShrink">False</property> + <property name="YExpand">False</property> + <property name="YFill">True</property> + <property name="YShrink">False</property> + </packing> + </child> + <child> + <widget class="Gtk.Label" id="lblEquipAmount"> + <property name="MemberName" /> + <property name="LabelProp" translatable="yes">amount:</property> + </widget> + <packing> + <property name="TopAttach">1</property> + <property name="BottomAttach">2</property> + <property name="AutoSize">True</property> + <property name="XOptions">Fill</property> + <property name="YOptions">Fill</property> + <property name="XExpand">False</property> + <property name="XFill">True</property> + <property name="XShrink">False</property> + <property name="YExpand">False</property> + <property name="YFill">True</property> + <property name="YShrink">False</property> + </packing> + </child> + <child> + <widget class="Gtk.Label" id="lblEquipment"> + <property name="MemberName" /> + <property name="LabelProp" translatable="yes">equipment</property> + </widget> + <packing> + <property name="AutoSize">True</property> + <property name="XOptions">Fill</property> + <property name="YOptions">Fill</property> + <property name="XExpand">False</property> + <property name="XFill">True</property> + <property name="XShrink">False</property> + <property name="YExpand">False</property> + <property name="YFill">True</property> + <property name="YShrink">False</property> + </packing> + </child> + </widget> + <packing> + <property name="Position">0</property> + <property name="AutoSize">True</property> + <property name="Expand">False</property> + <property name="Fill">False</property> + </packing> + </child> + </widget> + </child> + <child internal-child="ActionArea"> + <widget class="Gtk.HButtonBox" id="dialog1_ActionArea"> + <property name="MemberName" /> + <property name="Spacing">10</property> + <property name="BorderWidth">5</property> + <property name="Size">2</property> + <property name="LayoutStyle">End</property> + <child> + <widget class="Gtk.Button" id="buttonCancel"> + <property name="MemberName" /> + <property name="CanDefault">True</property> + <property name="CanFocus">True</property> + <property name="UseStock">True</property> + <property name="Type">StockItem</property> + <property name="StockId">gtk-cancel</property> + <property name="ResponseId">-6</property> + <signal name="Clicked" handler="CancelButtonClicked" /> + <property name="label">gtk-cancel</property> + </widget> + <packing> + <property name="Expand">False</property> + <property name="Fill">False</property> + </packing> + </child> + <child> + <widget class="Gtk.Button" id="buttonOk"> + <property name="MemberName" /> + <property name="CanDefault">True</property> + <property name="CanFocus">True</property> + <property name="UseStock">True</property> + <property name="Type">StockItem</property> + <property name="StockId">gtk-ok</property> + <property name="ResponseId">-5</property> + <signal name="Clicked" handler="OkayButtonClicked" /> + <property name="label">gtk-ok</property> + </widget> + <packing> + <property name="Position">1</property> + <property name="Expand">False</property> + <property name="Fill">False</property> + </packing> + </child> + </widget> + </child> + </widget> </stetic-interface> \ No newline at end of file