Mercurial > repos > IBBoard.WarFoundry.GUI.WinForms
changeset 95:83c259516041
Fixes #196: Add notes and abilities to UI
* Add basic list of abilities that just shows names
* Translate label
Also:
* Re-add instruction to put initial unit name in text box
* Change behaviour of showing unit size box so that it is disabled when size can't be changed rather than hidden (makes more sense when min == max and max != 1)
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Mon, 09 Nov 2009 16:33:17 +0000 |
parents | e4a8653b9536 |
children | 057498981bde |
files | FrmUnit.cs translations/en.translation |
diffstat | 2 files changed, 35 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/FrmUnit.cs Mon Nov 09 12:42:13 2009 +0000 +++ b/FrmUnit.cs Mon Nov 09 16:33:17 2009 +0000 @@ -41,6 +41,8 @@ private Label lblPoints; private IBBLabel lblNotes; private TextBox notes; + private ListBox abilitiesList; + private IBBLabel lblAbilities; /// <summary> /// Required designer variable. /// </summary> @@ -55,26 +57,21 @@ // InitializeComponent(); ControlTranslator.TranslateControl(this); + tbUnitName.Text = unit.Name; Text = Translation.GetTranslation("FrmUnit", "{0}", unit.Name); unit.NameChanged += new StringValChangedDelegate(unit_NameChanged); unit.UnitSizeChanged += new IntValChangedDelegate(unit_UnitSizeChanged); unit.UnitEquipmentAmountChanged += new DoubleValChangedDelegate(unit_UnitEquipmentAmountChanged); unit.PointsValueChanged += new DoubleValChangedDelegate(unit_PointsValueChanged); - if (unit.UnitType.MaxSize == unit.UnitType.MinSize) - { - unitSize.Value = unit.UnitType.MaxSize; - unitSize.Visible = false; - lblUnitSize.Visible = false; - } - else - { - unitSize.Value = unit.Size; - unitSize.Maximum = (unit.UnitType.MaxSize == WarFoundryCore.INFINITY ? int.MaxValue : unit.UnitType.MaxSize); - unitSize.Minimum = unit.UnitType.MinSize; - } + unitSize.Value = unit.Size; + unitSize.Maximum = (unit.UnitType.MaxSize == WarFoundryCore.INFINITY ? int.MaxValue : unit.UnitType.MaxSize); + unitSize.Minimum = unit.UnitType.MinSize; + unitSize.Enabled = (unitSize.Maximum != unitSize.Minimum); notes.Text = unit.UnitType.Notes; + abilitiesList.DataSource = new List<Ability>(unit.UnitType.GetRequiredAbilities()); + abilitiesList.DisplayMember = "Name"; SetPointsValueText(); SetStats(); SetWeapons(); @@ -194,6 +191,8 @@ this.lblPoints = new System.Windows.Forms.Label(); this.lblNotes = new IBBoard.Windows.Forms.IBBLabel(); this.notes = new System.Windows.Forms.TextBox(); + this.abilitiesList = new System.Windows.Forms.ListBox(); + this.lblAbilities = new IBBoard.Windows.Forms.IBBLabel(); ((System.ComponentModel.ISupportInitialize) (this.statsGrid)).BeginInit(); ((System.ComponentModel.ISupportInitialize) (this.unitSize)).BeginInit(); this.SuspendLayout(); @@ -334,7 +333,7 @@ // // lblNotes // - this.lblNotes.Location = new System.Drawing.Point(12, 240); + this.lblNotes.Location = new System.Drawing.Point(13, 317); this.lblNotes.Name = "lblNotes"; this.lblNotes.Size = new System.Drawing.Size(84, 62); this.lblNotes.TabIndex = 13; @@ -343,17 +342,36 @@ // // notes // - this.notes.Location = new System.Drawing.Point(101, 240); + this.notes.Location = new System.Drawing.Point(102, 317); this.notes.Multiline = true; this.notes.Name = "notes"; this.notes.ReadOnly = true; - this.notes.Size = new System.Drawing.Size(409, 62); + this.notes.Size = new System.Drawing.Size(408, 62); this.notes.TabIndex = 14; // + // abilitiesList + // + this.abilitiesList.FormattingEnabled = true; + this.abilitiesList.Location = new System.Drawing.Point(102, 240); + this.abilitiesList.Name = "abilitiesList"; + this.abilitiesList.Size = new System.Drawing.Size(408, 69); + this.abilitiesList.TabIndex = 15; + // + // lblAbilities + // + this.lblAbilities.Location = new System.Drawing.Point(13, 240); + this.lblAbilities.Name = "lblAbilities"; + this.lblAbilities.Size = new System.Drawing.Size(84, 62); + this.lblAbilities.TabIndex = 16; + this.lblAbilities.Text = "abilities"; + this.lblAbilities.TextAlign = System.Drawing.ContentAlignment.TopRight; + // // FrmUnit // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); - this.ClientSize = new System.Drawing.Size(616, 314); + this.ClientSize = new System.Drawing.Size(616, 391); + this.Controls.Add(this.lblAbilities); + this.Controls.Add(this.abilitiesList); this.Controls.Add(this.notes); this.Controls.Add(this.lblNotes); this.Controls.Add(this.lblPoints);
--- a/translations/en.translation Mon Nov 09 12:42:13 2009 +0000 +++ b/translations/en.translation Mon Nov 09 16:33:17 2009 +0000 @@ -58,6 +58,7 @@ <translation id="lblUnitSize">Unit size:</translation> <translation id="lblEquip">Equipment:</translation> <translation id="bttnAddWeapon">Add</translation> + <translation id="lblAbilities">Abilities:</translation> <translation id="lblNotes">Notes:</translation> <translation id="bttnRemoveWeapon">Remove</translation> <translation id="bttnReplaceWeapon">Replace</translation>