# HG changeset patch # User IBBoard # Date 1283458341 0 # Node ID e3fe48c4d7943dbbcabcb30b71c441f7f1034c4f # Parent c2d79b4209e374b3b3dbec94e72cc7dd553e8d5a Re #60: Add UI to add/remove/edit weapons in GTK * Add most of basic "edit" interface, based on "add" interface TODO: * Set initial values * Warn when setting to 0 diff -r c2d79b4209e3 -r e3fe48c4d794 FrmEditEquipment.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FrmEditEquipment.cs Thu Sep 02 20:12:21 2010 +0000 @@ -0,0 +1,204 @@ +// This file (FrmEditEquipment.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 FrmEditEquipment : Dialog, IEditEquipmentUI + { + private static ILog log = LogManager.GetLogger(typeof(FrmAddEquipment)); + + public event SingleArgMethodInvoker UnitEquipmentItemChoiceChanged; + public event MethodInvoker UnitEquipmentAmountTypeChanged; + public event MethodInvoker UnitEquipmentAmountChanged; + + private bool limitsEnabled = false; + private bool ratioLimited = false; + + public FrmEditEquipment() + { + this.Build(); + TreeViewColumn equipColumn = new TreeViewColumn(); + equipColumn.Title = "Equipment"; + CellRendererText equipCell = new CellRendererText(); + equipColumn.PackStart(equipCell, true); + equipColumn.SetCellDataFunc(equipCell, GtkWarFoundryUtil.RenderWarFoundryObjectName); + } + + private void OnUnitEquipmentAmountChanged() + { + if (UnitEquipmentAmountChanged != null) + { + UnitEquipmentAmountChanged(); + } + } + + private void OnUnitEquipmentAmountTypeChanged() + { + if (UnitEquipmentAmountChanged != null) + { + UnitEquipmentAmountTypeChanged(); + } + } + + 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 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; + } + } + } +} + diff -r c2d79b4209e3 -r e3fe48c4d794 FrmMainWindow.cs --- a/FrmMainWindow.cs Mon Aug 30 19:44:35 2010 +0000 +++ b/FrmMainWindow.cs Thu Sep 02 20:12:21 2010 +0000 @@ -94,6 +94,8 @@ LogManager.GetLogger(typeof(FrmMainWindow)).Fatal(msg, ex); MessageDialog dialog = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, false, "An unhandled exception occurred. Please check the log for more details."); dialog.Run(); + dialog.Hide(); + dialog.Dispose(); } private static string GetStackTrace(Exception ex) diff -r c2d79b4209e3 -r e3fe48c4d794 IBBoard.WarFoundry.GUI.GTK.csproj --- a/IBBoard.WarFoundry.GUI.GTK.csproj Mon Aug 30 19:44:35 2010 +0000 +++ b/IBBoard.WarFoundry.GUI.GTK.csproj Thu Sep 02 20:12:21 2010 +0000 @@ -55,6 +55,10 @@ + + + + diff -r c2d79b4209e3 -r e3fe48c4d794 UIControl/AddEquipmentUIControl.cs --- a/UIControl/AddEquipmentUIControl.cs Mon Aug 30 19:44:35 2010 +0000 +++ b/UIControl/AddEquipmentUIControl.cs Thu Sep 02 20:12:21 2010 +0000 @@ -1,4 +1,4 @@ -// This file (AddEquipmentUI.cs) is a part of the IBBoard.WarFoundry.GUI.GTK project and is copyright 2010 IBBoard +// 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; diff -r c2d79b4209e3 -r e3fe48c4d794 UIControl/EditEquipmentUIControl.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/UIControl/EditEquipmentUIControl.cs Thu Sep 02 20:12:21 2010 +0000 @@ -0,0 +1,205 @@ +// This file (EditEquipmentUIControl.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.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; +using IBBoard.WarFoundry.GUI.GTK; +namespace IBBoard.WarFoundry.GUI.GTK.UIControl +{ + public class EditEquipmentUIControl + { + private CommandStack commandStack; + private IEditEquipmentUI ui; + private Unit unit; + private UnitEquipmentItem equipItem; + private double minPercentage, maxPercentage; + private int minNumber, maxNumber; + private bool isRatioAmount; + private double equipmentAmount; + + + public EditEquipmentUIControl(Unit unit, UnitEquipmentItem item, CommandStack commandStack) + { + this.unit = unit; + this.commandStack = commandStack; + this.equipItem = item; + SetupUI(); + } + + private void SetupUI() + { + CreateEquipmentUI(); + ui.SetOkayEnabledState(false); + isRatioAmount = UnitEquipmentUtil.IsEquipmentRatioLimited(unit, equipItem); + maxPercentage = GetMaxPercentageLimit(equipItem); + minPercentage = GetMinPercentageLimit(equipItem); + maxNumber = GetMaxNumericLimit(equipItem); + minNumber = GetMinNumericLimit(equipItem); + + ui.SetUnitEquipmentLimits(isRatioAmount, minPercentage, maxPercentage, minNumber, maxNumber); + ui.SetUnitEquipmentLimitsEnabled(true); + ui.SetOkayEnabledState(HasNonZeroEquipmentAmount()); + SetEquipmentAmountControlEnabledStates(); + + //TODO: Set initial values + + ui.UnitEquipmentAmountChanged += HandleUnitEquipmentAmountChanged; + ui.UnitEquipmentAmountTypeChanged += HandleUnitEquipmentAmountChanged; + } + + private void HandleUnitEquipmentAmountChanged() + { + ui.SetOkayEnabledState(equipItem != null && HasNonZeroEquipmentAmount()); + isRatioAmount = ui.IsRatioEquipmentAmount; + + if (isRatioAmount) + { + double equipmentAmount = ui.EquipmentPercentageAmount; + SetEquipmentAmountsFromPercentage(equipmentAmount); + } + else + { + int equipmentIntAmount = ui.EquipmentNumericAmount; + equipmentAmount = equipmentIntAmount; + SetEquipmentAmountsFromNumber(equipmentIntAmount); + } + } + + private void SetEquipmentAmountsFromPercentage(double equipAmount) + { + if (equipAmount > maxPercentage) + { + string percentageTooLarge = Translation.GetTranslation("equipPercentageTooLarge", "the current percentage ({0}%) was larger than the maximum for the equipment item ({1}%) - the maximum value will be used instead", equipAmount, maxPercentage); + string percentageTooLargeTitle = Translation.GetTranslation("equipPercentageTooLargeTitle", "equipment percentage too large"); + // MessageBox.Show(ParentForm, percentageTooLarge, percentageTooLargeTitle); + equipAmount = maxPercentage; + } + else if (equipAmount < minPercentage) + { + string percentageTooSmall = Translation.GetTranslation("equipPercentageTooSmall", "the current percentage ({0}%) was smaller than the minimum for the equipment item ({1}%) - the minimum value will be used instead", equipAmount, minPercentage); + string percentageTooSmallTitle = Translation.GetTranslation("equipPercentageTooSmallTitle", "equipment percentage too small"); + // MessageBox.Show(ParentForm, percentageTooSmall, percentageTooSmallTitle); + equipAmount = minPercentage; + } + + ui.EquipmentNumericAmount = CalculateNumericValueFromPercentage(equipAmount); + ui.EquipmentPercentageAmount = equipAmount; + } + + private int CalculateNumericValueFromPercentage(double percent) + { + int calcedAmount = (int)CustomMath.IBBMath.Round((unit.Size * (percent / 100.0)), equipItem.RoundNumberUp); + return Math.Min(Math.Max(calcedAmount, minNumber), maxNumber); + } + + private void SetEquipmentAmountsFromNumber(int equipAmount) + { + if (equipAmount > maxNumber) + { + string amountTooLarge = Translation.GetTranslation("equipNumberTooLarge", "the current amount ({0}) was larger than the maximum for the equipment item ({1}) - the maximum value will be used instead", equipAmount, maxNumber); + string amountTooLargeTitle = Translation.GetTranslation("equipNumberTooLargeTitle", "equipment amount too large"); + //MessageBox.Show(ParentForm, amountTooLarge, amountTooLargeTitle); + equipAmount = maxNumber; + } + else if (equipAmount < minNumber) + { + string amountTooSmall = Translation.GetTranslation("equipNumberTooSmall", "the current amount ({0}) was smaller than the minimum for the equipment item ({1}) - the minimum value will be used instead", equipAmount, minNumber); + string amountTooSmallTitle = Translation.GetTranslation("equipNumberTooSmallTitle", "equipment amount too small"); + //MessageBox.Show(ParentForm, amountTooSmall, amountTooSmallTitle); + equipAmount = minNumber; + } + + ui.EquipmentPercentageAmount = CalcualtePercentageValueFromNumber(equipAmount); + ui.EquipmentNumericAmount = equipAmount; + } + + private double CalcualtePercentageValueFromNumber(int number) + { + double calcedAmount = RoundPercentage(CustomMath.IBBMath.Percentage(number, unit.Size)); + return Math.Min(Math.Max(calcedAmount, minPercentage), maxPercentage); + } + + //TODO Make abstract + protected void CreateEquipmentUI() + { + ui = new FrmEditEquipment(); + } + + private void SetEquipmentAmountControlEnabledStates() + { + ui.SetNumericAmountEnabledState(!isRatioAmount); + ui.SetPercentageAmountEnabledState(true); + } + + private double GetMaxPercentageLimit(UnitEquipmentItem equip) + { + double maxPercent = RoundPercentage(UnitEquipmentUtil.GetMaxEquipmentPercentage(unit, equip)); + return Math.Max(0, maxPercent); + } + + private double GetMinPercentageLimit(UnitEquipmentItem equip) + { + double minPercent = RoundPercentage(UnitEquipmentUtil.GetMinEquipmentPercentage(unit, equip)); + return Math.Max(0, minPercent); + } + + private int GetMaxNumericLimit(UnitEquipmentItem equip) + { + int maxNumber = UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip); + return Math.Max(0, maxNumber); + } + private int GetMinNumericLimit(UnitEquipmentItem equip) + { + int minNumber = UnitEquipmentUtil.GetMinEquipmentCount(unit, equip); + return Math.Max(0, minNumber); + } + + private bool HasNonZeroEquipmentAmount() + { + bool nonZero; + + if (isRatioAmount) + { + nonZero = (ui.EquipmentPercentageAmount > 0); + } + + else + { + nonZero = (ui.EquipmentNumericAmount > 0); + } + + return nonZero; + } + + private double RoundPercentage(double percent) + { + return Math.Round(percent, 1); + } + + public void Show() + { + bool okayed = ui.ShowControl(); + + if (okayed) + { + if (isRatioAmount) + { + commandStack.Execute(new SetUnitEquipmentRatioAmountCommand(unit, equipItem, equipmentAmount)); + } + else + { + commandStack.Execute(new SetUnitEquipmentNumericAmountCommand(unit, equipItem, (int)equipmentAmount)); + } + } + + ui.Dispose(); + } + } +} + diff -r c2d79b4209e3 -r e3fe48c4d794 UIControl/Interfaces/IEditEquipmentUI.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/UIControl/Interfaces/IEditEquipmentUI.cs Thu Sep 02 20:12:21 2010 +0000 @@ -0,0 +1,110 @@ +// This file (IEditEquipmentUI.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.API.Objects; +namespace IBBoard.WarFoundry.GUI.GTK.UIControl.Interfaces +{ + /// + /// The interface that UI components should implement to represent "Edit Equipment" dialogs or system equivalents (e.g. console areas or HTML fragments) + /// + public interface IEditEquipmentUI : IDisposable + { + /// + /// Occurs when the unit equipment amount type changes (e.g. percentage to numeric) + /// + event MethodInvoker UnitEquipmentAmountTypeChanged; + + /// + /// Occurs when the unit equipment amount changes + /// + event MethodInvoker UnitEquipmentAmountChanged; + + /// + /// Sets the limits for the currently selected equipment item + /// + /// + /// True if the current limit is a ratio limit, else false for absolute limits + /// + /// + /// The minimum limit as a percentage + /// + /// + /// The maximum limit as a percentage + /// + /// + /// The minimum number as an absolute figure + /// + /// + /// The maximum number as an absolute figure + /// + void SetUnitEquipmentLimits(bool isRatioLimit, double minPercent, double maxPercent, int minNumber, int maxNumber); + + /// + /// Sets whether the unit equipment limit UI components should be enabled and able to accept input. This will + /// generally pass the values on to the and + /// methods and is included for convenience + /// + /// + /// True if the UI components should accept input, else false + /// + void SetUnitEquipmentLimitsEnabled(bool isEnabled); + + /// + /// Shows the control and awaits a user action (close or okay) + /// + /// + /// true if the control was closed with "Okay", else false + /// + bool ShowControl(); + + /// + /// Gets a value indicating whether the equipment amount is a ratio or an absolute number. + /// + /// + /// true if the selected amount is a ratio type (percentage or "all"); otherwise, false. + /// + bool IsRatioEquipmentAmount { get; } + + /// + /// Gets and sets the numeric amount for the current equipment amount. This number is meaningless if is true + /// + /// + /// The absolue number of items taken. + /// + int EquipmentNumericAmount { get; set; } + + /// + /// Gets and sets the percentage amount for the current equipment amount. This number is meaningless if is false + /// + /// + /// The number of items taken as a percentage of the unit size. + /// + double EquipmentPercentageAmount { get; set; } + + /// + /// Sets the state of the Okay button. + /// + /// + /// true to enable the button, else false + /// + void SetOkayEnabledState(bool enabled); + + /// + /// Sets the state of the numeric equipment amount control. + /// + /// + /// true to enable the control, else false + /// + void SetNumericAmountEnabledState(bool enabled); + + /// + /// Sets the state of the percentage equipment amount control. + /// + /// + /// true to enable the control, else false + /// + void SetPercentageAmountEnabledState(bool enabled); + } +} + diff -r c2d79b4209e3 -r e3fe48c4d794 Widgets/UnitDisplayWidget.cs --- a/Widgets/UnitDisplayWidget.cs Mon Aug 30 19:44:35 2010 +0000 +++ b/Widgets/UnitDisplayWidget.cs Thu Sep 02 20:12:21 2010 +0000 @@ -272,5 +272,19 @@ stack.Execute(cmd); } } + + protected virtual void HandleEditButtonClicked(object sender, System.EventArgs e) + { + UnitEquipmentItem item = GetSelectedEquipmentItem(); + log.Debug("Edit " + item); + + if (item != null) + { + EditEquipmentUIControl editEquipment = new EditEquipmentUIControl(unit, item, stack); + editEquipment.Show(); + } + } + + } } diff -r c2d79b4209e3 -r e3fe48c4d794 gtk-gui/IBBoard.WarFoundry.GTK.Widgets.UnitDisplayWidget.cs --- a/gtk-gui/IBBoard.WarFoundry.GTK.Widgets.UnitDisplayWidget.cs Mon Aug 30 19:44:35 2010 +0000 +++ b/gtk-gui/IBBoard.WarFoundry.GTK.Widgets.UnitDisplayWidget.cs Thu Sep 02 20:12:21 2010 +0000 @@ -239,6 +239,7 @@ this.unitSize.FocusOutEvent += new global::Gtk.FocusOutEventHandler(this.OnUnitSizeFocusOut); this.unitSize.KeyPressEvent += new global::Gtk.KeyPressEventHandler(this.OnUnitSizeKeyPress); this.bttnAddEquipment.Clicked += new global::System.EventHandler(this.OnBttnAddEquipmentClicked); + this.bttnEditEquipment.Clicked += new global::System.EventHandler(this.HandleEditButtonClicked); this.bttnRemoveEquipment.Clicked += new global::System.EventHandler(this.HandleRemoveButtonActivated); } } diff -r c2d79b4209e3 -r e3fe48c4d794 gtk-gui/IBBoard.WarFoundry.GUI.GTK.FrmEditEquipment.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gtk-gui/IBBoard.WarFoundry.GUI.GTK.FrmEditEquipment.cs Thu Sep 02 20:12:21 2010 +0000 @@ -0,0 +1,214 @@ + +// This file has been generated by the GUI designer. Do not modify. +namespace IBBoard.WarFoundry.GUI.GTK +{ + public partial class FrmEditEquipment + { + private global::Gtk.Table table1; + + 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.Button buttonCancel; + + private global::Gtk.Button buttonOk; + + protected virtual void Build() + { + global::Stetic.Gui.Initialize(this); + // Widget IBBoard.WarFoundry.GUI.GTK.FrmEditEquipment + this.Name = "IBBoard.WarFoundry.GUI.GTK.FrmEditEquipment"; + this.WindowPosition = ((global::Gtk.WindowPosition)(4)); + // Internal child IBBoard.WarFoundry.GUI.GTK.FrmEditEquipment.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)(1)), ((uint)(2)), false); + this.table1.Name = "table1"; + this.table1.RowSpacing = ((uint)(6)); + this.table1.ColumnSpacing = ((uint)(6)); + // 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 w2 = ((global::Gtk.Table.TableChild)(this.table2[this.lblEquipAll])); + w2.TopAttach = ((uint)(2)); + w2.BottomAttach = ((uint)(3)); + w2.LeftAttach = ((uint)(1)); + w2.RightAttach = ((uint)(2)); + w2.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 w3 = ((global::Gtk.Table.TableChild)(this.table2[this.lblPercent])); + w3.TopAttach = ((uint)(1)); + w3.BottomAttach = ((uint)(2)); + w3.LeftAttach = ((uint)(2)); + w3.RightAttach = ((uint)(3)); + w3.XOptions = ((global::Gtk.AttachOptions)(4)); + w3.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 w4 = ((global::Gtk.Table.TableChild)(this.table2[this.numericAmount])); + w4.LeftAttach = ((uint)(1)); + w4.RightAttach = ((uint)(2)); + w4.XOptions = ((global::Gtk.AttachOptions)(0)); + w4.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 w5 = ((global::Gtk.Table.TableChild)(this.table2[this.percentageAmount])); + w5.TopAttach = ((uint)(1)); + w5.BottomAttach = ((uint)(2)); + w5.LeftAttach = ((uint)(1)); + w5.RightAttach = ((uint)(2)); + w5.XOptions = ((global::Gtk.AttachOptions)(0)); + w5.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 w6 = ((global::Gtk.Table.TableChild)(this.table2[this.rbEquipAll])); + w6.TopAttach = ((uint)(2)); + w6.BottomAttach = ((uint)(3)); + w6.XOptions = ((global::Gtk.AttachOptions)(4)); + w6.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 w7 = ((global::Gtk.Table.TableChild)(this.table2[this.rbEquipNumeric])); + w7.XOptions = ((global::Gtk.AttachOptions)(4)); + w7.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 w8 = ((global::Gtk.Table.TableChild)(this.table2[this.rbEquipPercent])); + w8.TopAttach = ((uint)(1)); + w8.BottomAttach = ((uint)(2)); + w8.XOptions = ((global::Gtk.AttachOptions)(4)); + w8.YOptions = ((global::Gtk.AttachOptions)(4)); + this.hbox2.Add(this.table2); + global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this.hbox2[this.table2])); + w9.Position = 0; + w9.Expand = false; + w9.Fill = false; + this.table1.Add(this.hbox2); + global::Gtk.Table.TableChild w10 = ((global::Gtk.Table.TableChild)(this.table1[this.hbox2])); + w10.LeftAttach = ((uint)(1)); + w10.RightAttach = ((uint)(2)); + w10.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 w11 = ((global::Gtk.Table.TableChild)(this.table1[this.lblEquipAmount])); + w11.XOptions = ((global::Gtk.AttachOptions)(4)); + w11.YOptions = ((global::Gtk.AttachOptions)(4)); + w1.Add(this.table1); + global::Gtk.Box.BoxChild w12 = ((global::Gtk.Box.BoxChild)(w1[this.table1])); + w12.Position = 0; + w12.Expand = false; + w12.Fill = false; + // Internal child IBBoard.WarFoundry.GUI.GTK.FrmEditEquipment.ActionArea + global::Gtk.HButtonBox w13 = this.ActionArea; + w13.Name = "dialog1_ActionArea"; + w13.Spacing = 10; + w13.BorderWidth = ((uint)(5)); + w13.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 w14 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w13[this.buttonCancel])); + w14.Expand = false; + w14.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 w15 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w13[this.buttonOk])); + w15.Position = 1; + w15.Expand = false; + w15.Fill = false; + if ((this.Child != null)) + { + this.Child.ShowAll(); + } + this.DefaultWidth = 280; + this.DefaultHeight = 175; + 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); + } + } +} diff -r c2d79b4209e3 -r e3fe48c4d794 gtk-gui/gui.stetic --- a/gtk-gui/gui.stetic Mon Aug 30 19:44:35 2010 +0000 +++ b/gtk-gui/gui.stetic Thu Sep 02 20:12:21 2010 +0000 @@ -899,6 +899,7 @@ TextOnly Edit True + 1 @@ -1123,7 +1124,6 @@ True - True True True True @@ -1308,4 +1308,298 @@ + + + CenterOnParent + 2 + False + + + + 2 + + + + 2 + 6 + 6 + + + + 6 + + + + 3 + 3 + 6 + 6 + + + + + + + + + + equip all + + + 2 + 3 + 1 + 2 + False + Fill + True + True + False + False + True + False + + + + + + % + + + 1 + 2 + 2 + 3 + True + Fill + Fill + False + True + False + False + True + False + + + + + + True + 100 + 10 + 1 + 1 + True + + + + 1 + 2 + False + 0 + Fill + False + False + False + False + True + False + + + + + + True + 100 + 10 + 1 + 1 + 1 + True + + + + 1 + 2 + 1 + 2 + False + 0 + Fill + False + False + False + False + True + False + + + + + + True + + True + True + True + group1 + + + 2 + 3 + True + Fill + Fill + False + True + False + False + True + False + + + + + + True + + True + True + True + group1 + + + + False + Fill + Fill + False + True + False + False + True + False + + + + + + True + + True + True + True + group1 + + + 1 + 2 + True + Fill + Fill + False + True + False + False + True + False + + + + + 0 + True + False + False + + + + + + + + 1 + 2 + True + Fill + True + True + False + False + True + False + + + + + + amount: + + + True + Fill + Fill + False + True + False + False + True + False + + + + + 0 + True + False + False + + + + + + + + 10 + 5 + 2 + End + + + + True + True + True + StockItem + gtk-cancel + -6 + + gtk-cancel + + + False + False + + + + + + True + True + True + StockItem + gtk-ok + -5 + + gtk-ok + + + 1 + False + False + + + + + \ No newline at end of file